diff --git a/assets/index-2df7e6e2.css b/assets/index-2df7e6e2.css new file mode 100644 index 0000000..223d4f3 --- /dev/null +++ b/assets/index-2df7e6e2.css @@ -0,0 +1 @@ +.TimelineControl{background-color:#333;border-top:1px solid #444}.TimelineControl label{position:relative;display:inline-block}.TimelineControl button,.TimelineControl label span{font-size:12px;line-height:1rem;border-right:1px solid #666;background-color:#444}.TimelineControl label span{position:absolute;top:3px;left:3px;padding:3px 4px 3px 0;text-align:right;width:2.75rem}.TimelineControl button span{vertical-align:top}.TimelineControl button,.TimelineControl label input{padding:0 2px;width:96px;height:24px}.TimelineControl label input{padding:0 2px 0 2.85rem}.TimelineControl .bars{height:32px;background-color:#222;border-top:1px solid #222}.TimelineControl .bars .bar{display:inline-block;height:100%;background-color:#282828;border-right:1px solid #333;position:relative;overflow:visible;user-select:none}.TimelineControl .bars .bar .hover{display:none;position:absolute;top:-16px;background-color:#00000080;border-radius:4px;padding:3px;font-size:10px;line-height:10px;pointer-events:none}.TimelineControl .bars .bar.active .hover,.TimelineControl .bars .bar:hover .hover{display:block}.TimelineControl .bars .bar.darker{background-color:#222}.TimelineControl .bars .bar.active{background-color:#04a7ff}.AccordionPanel{border-top:1px solid #444;border-bottom:1px solid #444}.AccordionPanel+.AccordionPanel{border-top:none}.AccordionPanel>h3{background-color:#222;line-height:1.5em}.AccordionPanel>h3>*{vertical-align:middle}.AccordionPanel>h3>button{margin:0 1rem 0 0;border:none;border-right:1px solid #444}.AccordionPanel.open h3{border-bottom:1px solid #444}.AccordionPanel .content{padding:8px}#container{display:flex;height:100%}#preview{position:relative;flex-grow:1;display:flex;flex-direction:column;height:100%;max-height:100%}#viewport{flex-grow:1;position:relative}#viewport-holder{height:100%}#vert-count{position:absolute;z-index:0}.bottom-panel{position:absolute;bottom:0;left:0;right:0}#controls{width:50%;min-width:320px;z-index:1;top:0;left:0;background-color:#333;border-left:1px solid #444;overflow-y:auto;max-height:100%}*{margin:0;padding:0;border:0;vertical-align:top;color:inherit;line-height:inherit;font-size:inherit;font-family:inherit;font-weight:inherit;box-sizing:border-box}html,body,canvas{height:100%;width:100%}.viewport-parent,.label-div,canvas{display:block;position:absolute;min-width:100%;min-height:100%;max-width:100%;max-height:100%}body{background-color:#000;color:#999;line-height:1.5rem;font-size:16px;font-family:monaco,monospace;font-weight:400}#app{height:100%}input,button,select,textarea{color:#9f0;padding:2px 4px;margin:2px;background-color:#333;border:1px solid #666;vertical-align:middle;height:2rem}textarea{max-width:100%}button.save,input[type=submit]{background-color:#555}input[type=submit]:hover,button:hover{border:1px solid #888;background-color:#444;cursor:pointer}.form-control{background-color:#252525;padding:8px;margin-bottom:.5rem}.form-control>label{display:block}label>span,label>input,label>textarea{display:block}label>span{color:#bbb;font-size:.75rem}code,.code{border-radius:4px;background-color:#0008;padding:4px 8px}code{margin:0 -4px}p,pre{margin-bottom:.5rem;font-size:.75rem}.vertex-label{padding-bottom:2rem;width:2rem;text-align:center;border:1px solid #0000;border-radius:50%}.vertex-label:hover{color:red;border:1px solid #f00f}.vertex-label-text{font-size:1.5rem;line-height:2rem;width:2rem;top:-2rem;position:absolute}.viewport-parent.hidden .vertex-label-text{display:none} diff --git a/assets/index-68b2865e.js b/assets/index-d5177473.js similarity index 90% rename from assets/index-68b2865e.js rename to assets/index-d5177473.js index a2d7b67..56c678d 100644 --- a/assets/index-68b2865e.js +++ b/assets/index-d5177473.js @@ -1,16 +1,16 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();function wd(n,e){const t=Object.create(null),i=n.split(",");for(let s=0;s!!t[s.toLowerCase()]:s=>!!t[s]}const gt={},qr=[],ai=()=>{},gy=()=>!1,Oy=/^on[^a-z]/,gh=n=>Oy.test(n),Md=n=>n.startsWith("onUpdate:"),Zt=Object.assign,Td=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},vy=Object.prototype.hasOwnProperty,st=(n,e)=>vy.call(n,e),Qe=Array.isArray,Kr=n=>Fa(n)==="[object Map]",Ao=n=>Fa(n)==="[object Set]",Hp=n=>Fa(n)==="[object Date]",Ye=n=>typeof n=="function",Dt=n=>typeof n=="string",ga=n=>typeof n=="symbol",ft=n=>n!==null&&typeof n=="object",fv=n=>ft(n)&&Ye(n.then)&&Ye(n.catch),dv=Object.prototype.toString,Fa=n=>dv.call(n),xy=n=>Fa(n).slice(8,-1),pv=n=>Fa(n)==="[object Object]",Ed=n=>Dt(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,ac=wd(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Oh=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},Sy=/-(\w)/g,uo=Oh(n=>n.replace(Sy,(e,t)=>t?t.toUpperCase():"")),_y=/\B([A-Z])/g,Po=Oh(n=>n.replace(_y,"-$1").toLowerCase()),mv=Oh(n=>n.charAt(0).toUpperCase()+n.slice(1)),jh=Oh(n=>n?`on${mv(n)}`:""),Oa=(n,e)=>!Object.is(n,e),lc=(n,e)=>{for(let t=0;t{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value:t})},Mc=n=>{const e=parseFloat(n);return isNaN(e)?n:e};let Yp;const cf=()=>Yp||(Yp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ba(n){if(Qe(n)){const e={};for(let t=0;t{if(t){const i=t.split(by);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Co(n){let e="";if(Dt(n))e=n;else if(Qe(n))for(let t=0;tXa(t,e))}const Vn=n=>Dt(n)?n:n==null?"":Qe(n)||ft(n)&&(n.toString===dv||!Ye(n.toString))?JSON.stringify(n,Ov,2):String(n),Ov=(n,e)=>e&&e.__v_isRef?Ov(n,e.value):Kr(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,s])=>(t[`${i} =>`]=s,t),{})}:Ao(e)?{[`Set(${e.size})`]:[...e.values()]}:ft(e)&&!Qe(e)&&!pv(e)?String(e):e;let kn;class vv{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=kn,!e&&kn&&(this.index=(kn.scopes||(kn.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=kn;try{return kn=this,e()}finally{kn=t}}}on(){kn=this}off(){kn=this.parent}stop(e){if(this._active){let t,i;for(t=0,i=this.effects.length;t{const e=new Set(n);return e.w=0,e.n=0,e},Sv=n=>(n.w&ys)>0,_v=n=>(n.n&ys)>0,Ly=({deps:n})=>{if(n.length)for(let e=0;e{const{deps:e}=n;if(e.length){let t=0;for(let i=0;i{(h==="length"||h>=l)&&a.push(c)})}else switch(t!==void 0&&a.push(o.get(t)),e){case"add":Qe(n)?Ed(t)&&a.push(o.get("length")):(a.push(o.get(tr)),Kr(n)&&a.push(o.get(ff)));break;case"delete":Qe(n)||(a.push(o.get(tr)),Kr(n)&&a.push(o.get(ff)));break;case"set":Kr(n)&&a.push(o.get(tr));break}if(a.length===1)a[0]&&df(a[0]);else{const l=[];for(const c of a)c&&l.push(...c);df(Pd(l))}}function df(n,e){const t=Qe(n)?n:[...n];for(const i of t)i.computed&&qp(i);for(const i of t)i.computed||qp(i)}function qp(n,e){(n!==ni||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const Uy=wd("__proto__,__v_isRef,__isVue"),wv=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(ga)),Iy=Rd(),Qy=Rd(!1,!0),Ny=Rd(!0),Kp=$y();function $y(){const n={};return["includes","indexOf","lastIndexOf"].forEach(e=>{n[e]=function(...t){const i=at(this);for(let r=0,o=this.length;r{n[e]=function(...t){Ro();const i=at(this)[e].apply(this,t);return ko(),i}}),n}function Fy(n){const e=at(this);return Mn(e,"has",n),e.hasOwnProperty(n)}function Rd(n=!1,e=!1){return function(i,s,r){if(s==="__v_isReactive")return!n;if(s==="__v_isReadonly")return n;if(s==="__v_isShallow")return e;if(s==="__v_raw"&&r===(n?e?nb:Pv:e?Av:Ev).get(i))return i;const o=Qe(i);if(!n){if(o&&st(Kp,s))return Reflect.get(Kp,s,r);if(s==="hasOwnProperty")return Fy}const a=Reflect.get(i,s,r);return(ga(s)?wv.has(s):Uy(s))||(n||Mn(i,"get",s),e)?a:Ot(a)?o&&Ed(s)?a:a.value:ft(a)?n?Ud(a):Dd(a):a}}const By=Mv(),Xy=Mv(!0);function Mv(n=!1){return function(t,i,s,r){let o=t[i];if(fo(o)&&Ot(o)&&!Ot(s))return!1;if(!n&&(!Tc(s)&&!fo(s)&&(o=at(o),s=at(s)),!Qe(t)&&Ot(o)&&!Ot(s)))return o.value=s,!0;const a=Qe(t)&&Ed(i)?Number(i)n,vh=n=>Reflect.getPrototypeOf(n);function ll(n,e,t=!1,i=!1){n=n.__v_raw;const s=at(n),r=at(e);t||(e!==r&&Mn(s,"get",e),Mn(s,"get",r));const{has:o}=vh(s),a=i?kd:t?Nd:va;if(o.call(s,e))return a(n.get(e));if(o.call(s,r))return a(n.get(r));n!==s&&n.get(e)}function cl(n,e=!1){const t=this.__v_raw,i=at(t),s=at(n);return e||(n!==s&&Mn(i,"has",n),Mn(i,"has",s)),n===s?t.has(n):t.has(n)||t.has(s)}function hl(n,e=!1){return n=n.__v_raw,!e&&Mn(at(n),"iterate",tr),Reflect.get(n,"size",n)}function Jp(n){n=at(n);const e=at(this);return vh(e).has.call(e,n)||(e.add(n),ji(e,"add",n,n)),this}function em(n,e){e=at(e);const t=at(this),{has:i,get:s}=vh(t);let r=i.call(t,n);r||(n=at(n),r=i.call(t,n));const o=s.call(t,n);return t.set(n,e),r?Oa(e,o)&&ji(t,"set",n,e):ji(t,"add",n,e),this}function tm(n){const e=at(this),{has:t,get:i}=vh(e);let s=t.call(e,n);s||(n=at(n),s=t.call(e,n)),i&&i.call(e,n);const r=e.delete(n);return s&&ji(e,"delete",n,void 0),r}function nm(){const n=at(this),e=n.size!==0,t=n.clear();return e&&ji(n,"clear",void 0,void 0),t}function ul(n,e){return function(i,s){const r=this,o=r.__v_raw,a=at(o),l=e?kd:n?Nd:va;return!n&&Mn(a,"iterate",tr),o.forEach((c,h)=>i.call(s,l(c),l(h),r))}}function fl(n,e,t){return function(...i){const s=this.__v_raw,r=at(s),o=Kr(r),a=n==="entries"||n===Symbol.iterator&&o,l=n==="keys"&&o,c=s[n](...i),h=t?kd:e?Nd:va;return!e&&Mn(r,"iterate",l?ff:tr),{next(){const{value:u,done:f}=c.next();return f?{value:u,done:f}:{value:a?[h(u[0]),h(u[1])]:h(u),done:f}},[Symbol.iterator](){return this}}}}function is(n){return function(...e){return n==="delete"?!1:this}}function Hy(){const n={get(r){return ll(this,r)},get size(){return hl(this)},has:cl,add:Jp,set:em,delete:tm,clear:nm,forEach:ul(!1,!1)},e={get(r){return ll(this,r,!1,!0)},get size(){return hl(this)},has:cl,add:Jp,set:em,delete:tm,clear:nm,forEach:ul(!1,!0)},t={get(r){return ll(this,r,!0)},get size(){return hl(this,!0)},has(r){return cl.call(this,r,!0)},add:is("add"),set:is("set"),delete:is("delete"),clear:is("clear"),forEach:ul(!0,!1)},i={get(r){return ll(this,r,!0,!0)},get size(){return hl(this,!0)},has(r){return cl.call(this,r,!0)},add:is("add"),set:is("set"),delete:is("delete"),clear:is("clear"),forEach:ul(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=fl(r,!1,!1),t[r]=fl(r,!0,!1),e[r]=fl(r,!1,!0),i[r]=fl(r,!0,!0)}),[n,t,e,i]}const[Yy,jy,qy,Ky]=Hy();function Ld(n,e){const t=e?n?Ky:qy:n?jy:Yy;return(i,s,r)=>s==="__v_isReactive"?!n:s==="__v_isReadonly"?n:s==="__v_raw"?i:Reflect.get(st(t,s)&&s in i?t:i,s,r)}const Jy={get:Ld(!1,!1)},eb={get:Ld(!1,!0)},tb={get:Ld(!0,!1)},Ev=new WeakMap,Av=new WeakMap,Pv=new WeakMap,nb=new WeakMap;function ib(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function sb(n){return n.__v_skip||!Object.isExtensible(n)?0:ib(xy(n))}function Dd(n){return fo(n)?n:Id(n,!1,Tv,Jy,Ev)}function rb(n){return Id(n,!1,Zy,eb,Av)}function Ud(n){return Id(n,!0,Gy,tb,Pv)}function Id(n,e,t,i,s){if(!ft(n)||n.__v_raw&&!(e&&n.__v_isReactive))return n;const r=s.get(n);if(r)return r;const o=sb(n);if(o===0)return n;const a=new Proxy(n,o===2?i:t);return s.set(n,a),a}function Jr(n){return fo(n)?Jr(n.__v_raw):!!(n&&n.__v_isReactive)}function fo(n){return!!(n&&n.__v_isReadonly)}function Tc(n){return!!(n&&n.__v_isShallow)}function Cv(n){return Jr(n)||fo(n)}function at(n){const e=n&&n.__v_raw;return e?at(e):n}function Qd(n){return wc(n,"__v_skip",!0),n}const va=n=>ft(n)?Dd(n):n,Nd=n=>ft(n)?Ud(n):n;function Rv(n){gs&&ni&&(n=at(n),bv(n.dep||(n.dep=Pd())))}function kv(n,e){n=at(n);const t=n.dep;t&&df(t)}function Ot(n){return!!(n&&n.__v_isRef===!0)}function Lt(n){return Lv(n,!1)}function cc(n){return Lv(n,!0)}function Lv(n,e){return Ot(n)?n:new ob(n,e)}class ob{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:at(e),this._value=t?e:va(e)}get value(){return Rv(this),this._value}set value(e){const t=this.__v_isShallow||Tc(e)||fo(e);e=t?e:at(e),Oa(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:va(e),kv(this))}}function et(n){return Ot(n)?n.value:n}const ab={get:(n,e,t)=>et(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const s=n[e];return Ot(s)&&!Ot(t)?(s.value=t,!0):Reflect.set(n,e,t,i)}};function Dv(n){return Jr(n)?n:new Proxy(n,ab)}class lb{constructor(e,t,i,s){this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new Cd(e,()=>{this._dirty||(this._dirty=!0,kv(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=i}get value(){const e=at(this);return Rv(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}function cb(n,e,t=!1){let i,s;const r=Ye(n);return r?(i=n,s=ai):(i=n.get,s=n.set),new lb(i,s,r||!s,t)}function Os(n,e,t,i){let s;try{s=i?n(...i):n()}catch(r){xh(r,e,t)}return s}function li(n,e,t,i){if(Ye(n)){const r=Os(n,e,t,i);return r&&fv(r)&&r.catch(o=>{xh(o,e,t)}),r}const s=[];for(let r=0;r>>1;Sa(nn[i])Si&&nn.splice(e,1)}function db(n){Qe(n)?eo.push(...n):(!zi||!zi.includes(n,n.allowRecurse?Ws+1:Ws))&&eo.push(n),Qv()}function im(n,e=xa?Si+1:0){for(;eSa(t)-Sa(i)),Ws=0;Wsn.id==null?1/0:n.id,pb=(n,e)=>{const t=Sa(n)-Sa(e);if(t===0){if(n.pre&&!e.pre)return-1;if(e.pre&&!n.pre)return 1}return t};function $v(n){pf=!1,xa=!0,nn.sort(pb);const e=ai;try{for(Si=0;SiDt(d)?d.trim():d)),u&&(s=t.map(Mc))}let a,l=i[a=jh(e)]||i[a=jh(uo(e))];!l&&r&&(l=i[a=jh(Po(e))]),l&&li(l,n,6,s);const c=i[a+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[a])return;n.emitted[a]=!0,li(c,n,6,s)}}function Fv(n,e,t=!1){const i=e.emitsCache,s=i.get(n);if(s!==void 0)return s;const r=n.emits;let o={},a=!1;if(!Ye(n)){const l=c=>{const h=Fv(c,e,!0);h&&(a=!0,Zt(o,h))};!t&&e.mixins.length&&e.mixins.forEach(l),n.extends&&l(n.extends),n.mixins&&n.mixins.forEach(l)}return!r&&!a?(ft(n)&&i.set(n,null),null):(Qe(r)?r.forEach(l=>o[l]=null):Zt(o,r),ft(n)&&i.set(n,o),o)}function Sh(n,e){return!n||!gh(e)?!1:(e=e.slice(2).replace(/Once$/,""),st(n,e[0].toLowerCase()+e.slice(1))||st(n,Po(e))||st(n,e))}let On=null,Bv=null;function Ec(n){const e=On;return On=n,Bv=n&&n.type.__scopeId||null,e}function _h(n,e=On,t){if(!e||n._n)return n;const i=(...s)=>{i._d&&dm(-1);const r=Ec(e);let o;try{o=n(...s)}finally{Ec(r),i._d&&dm(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function qh(n){const{type:e,vnode:t,proxy:i,withProxy:s,props:r,propsOptions:[o],slots:a,attrs:l,emit:c,render:h,renderCache:u,data:f,setupState:d,ctx:g,inheritAttrs:O}=n;let m,p;const y=Ec(n);try{if(t.shapeFlag&4){const x=s||i;m=Oi(h.call(x,x,u,r,d,f,g)),p=l}else{const x=e;m=Oi(x.length>1?x(r,{attrs:l,slots:a,emit:c}):x(r,null)),p=e.props?l:gb(l)}}catch(x){ha.length=0,xh(x,n,1),m=Nt(bs)}let S=m;if(p&&O!==!1){const x=Object.keys(p),{shapeFlag:w}=S;x.length&&w&7&&(o&&x.some(Md)&&(p=Ob(p,o)),S=po(S,p))}return t.dirs&&(S=po(S),S.dirs=S.dirs?S.dirs.concat(t.dirs):t.dirs),t.transition&&(S.transition=t.transition),m=S,Ec(y),m}const gb=n=>{let e;for(const t in n)(t==="class"||t==="style"||gh(t))&&((e||(e={}))[t]=n[t]);return e},Ob=(n,e)=>{const t={};for(const i in n)(!Md(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t};function vb(n,e,t){const{props:i,children:s,component:r}=n,{props:o,children:a,patchFlag:l}=e,c=r.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&l>=0){if(l&1024)return!0;if(l&16)return i?sm(i,o,c):!!o;if(l&8){const h=e.dynamicProps;for(let u=0;un.__isSuspense;function _b(n,e){e&&e.pendingBranch?Qe(n)?e.effects.push(...n):e.effects.push(n):db(n)}function yb(n,e){return Bd(n,null,e)}const dl={};function Ln(n,e,t){return Bd(n,e,t)}function Bd(n,e,{immediate:t,deep:i,flush:s,onTrack:r,onTrigger:o}=gt){var a;const l=xv()===((a=sn)==null?void 0:a.scope)?sn:null;let c,h=!1,u=!1;if(Ot(n)?(c=()=>n.value,h=Tc(n)):Jr(n)?(c=()=>n,i=!0):Qe(n)?(u=!0,h=n.some(x=>Jr(x)||Tc(x)),c=()=>n.map(x=>{if(Ot(x))return x.value;if(Jr(x))return qs(x);if(Ye(x))return Os(x,l,2)})):Ye(n)?e?c=()=>Os(n,l,2):c=()=>{if(!(l&&l.isUnmounted))return f&&f(),li(n,l,3,[d])}:c=ai,e&&i){const x=c;c=()=>qs(x())}let f,d=x=>{f=y.onStop=()=>{Os(x,l,4)}},g;if(ya)if(d=ai,e?t&&li(e,l,3,[c(),u?[]:void 0,d]):c(),s==="sync"){const x=pw();g=x.__watcherHandles||(x.__watcherHandles=[])}else return ai;let O=u?new Array(n.length).fill(dl):dl;const m=()=>{if(y.active)if(e){const x=y.run();(i||h||(u?x.some((w,T)=>Oa(w,O[T])):Oa(x,O)))&&(f&&f(),li(e,l,3,[x,O===dl?void 0:u&&O[0]===dl?[]:O,d]),O=x)}else y.run()};m.allowRecurse=!!e;let p;s==="sync"?p=m:s==="post"?p=()=>Sn(m,l&&l.suspense):(m.pre=!0,l&&(m.id=l.uid),p=()=>Fd(m));const y=new Cd(c,p);e?t?m():O=y.run():s==="post"?Sn(y.run.bind(y),l&&l.suspense):y.run();const S=()=>{y.stop(),l&&l.scope&&Td(l.scope.effects,y)};return g&&g.push(S),S}function bb(n,e,t){const i=this.proxy,s=Dt(n)?n.includes(".")?Xv(i,n):()=>i[n]:n.bind(i,i);let r;Ye(e)?r=e:(r=e.handler,t=e);const o=sn;go(this);const a=Bd(s,r.bind(i),t);return o?go(o):nr(),a}function Xv(n,e){const t=e.split(".");return()=>{let i=n;for(let s=0;s{qs(t,e)});else if(pv(n))for(const t in n)qs(n[t],e);return n}function bi(n,e){const t=On;if(t===null)return n;const i=Th(t)||t.proxy,s=n.dirs||(n.dirs=[]);for(let r=0;rZt({name:n.name},e,{setup:n}))():n}const aa=n=>!!n.type.__asyncLoader,zv=n=>n.type.__isKeepAlive;function Mb(n,e){Vv(n,"a",e)}function Tb(n,e){Vv(n,"da",e)}function Vv(n,e,t=sn){const i=n.__wdc||(n.__wdc=()=>{let s=t;for(;s;){if(s.isDeactivated)return;s=s.parent}return n()});if(yh(e,i,t),t){let s=t.parent;for(;s&&s.parent;)zv(s.parent.vnode)&&Eb(i,e,t,s),s=s.parent}}function Eb(n,e,t,i){const s=yh(e,n,i,!0);Wv(()=>{Td(i[e],s)},t)}function yh(n,e,t=sn,i=!1){if(t){const s=t[n]||(t[n]=[]),r=e.__weh||(e.__weh=(...o)=>{if(t.isUnmounted)return;Ro(),go(t);const a=li(e,t,n,o);return nr(),ko(),a});return i?s.unshift(r):s.push(r),r}}const Ji=n=>(e,t=sn)=>(!ya||n==="sp")&&yh(n,(...i)=>e(...i),t),Ab=Ji("bm"),Xd=Ji("m"),Pb=Ji("bu"),Cb=Ji("u"),zd=Ji("bum"),Wv=Ji("um"),Rb=Ji("sp"),kb=Ji("rtg"),Lb=Ji("rtc");function Db(n,e=sn){yh("ec",n,e)}const Ub=Symbol.for("v-ndc");function Ac(n,e,t,i){let s;const r=t&&t[i];if(Qe(n)||Dt(n)){s=new Array(n.length);for(let o=0,a=n.length;oe(o,a,void 0,r&&r[a]));else{const o=Object.keys(n);s=new Array(o.length);for(let a=0,l=o.length;aRc(e)?!(e.type===bs||e.type===fn&&!Gv(e.children)):!0)?n:null}const mf=n=>n?sx(n)?Th(n)||n.proxy:mf(n.parent):null,la=Zt(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>n.props,$attrs:n=>n.attrs,$slots:n=>n.slots,$refs:n=>n.refs,$parent:n=>mf(n.parent),$root:n=>mf(n.root),$emit:n=>n.emit,$options:n=>Vd(n),$forceUpdate:n=>n.f||(n.f=()=>Fd(n.update)),$nextTick:n=>n.n||(n.n=Iv.bind(n.proxy)),$watch:n=>bb.bind(n)}),Kh=(n,e)=>n!==gt&&!n.__isScriptSetup&&st(n,e),Qb={get({_:n},e){const{ctx:t,setupState:i,data:s,props:r,accessCache:o,type:a,appContext:l}=n;let c;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return i[e];case 2:return s[e];case 4:return t[e];case 3:return r[e]}else{if(Kh(i,e))return o[e]=1,i[e];if(s!==gt&&st(s,e))return o[e]=2,s[e];if((c=n.propsOptions[0])&&st(c,e))return o[e]=3,r[e];if(t!==gt&&st(t,e))return o[e]=4,t[e];gf&&(o[e]=0)}}const h=la[e];let u,f;if(h)return e==="$attrs"&&Mn(n,"get",e),h(n);if((u=a.__cssModules)&&(u=u[e]))return u;if(t!==gt&&st(t,e))return o[e]=4,t[e];if(f=l.config.globalProperties,st(f,e))return f[e]},set({_:n},e,t){const{data:i,setupState:s,ctx:r}=n;return Kh(s,e)?(s[e]=t,!0):i!==gt&&st(i,e)?(i[e]=t,!0):st(n.props,e)||e[0]==="$"&&e.slice(1)in n?!1:(r[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:i,appContext:s,propsOptions:r}},o){let a;return!!t[o]||n!==gt&&st(n,o)||Kh(e,o)||(a=r[0])&&st(a,o)||st(i,o)||st(la,o)||st(s.config.globalProperties,o)},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:st(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};function rm(n){return Qe(n)?n.reduce((e,t)=>(e[t]=null,e),{}):n}let gf=!0;function Nb(n){const e=Vd(n),t=n.proxy,i=n.ctx;gf=!1,e.beforeCreate&&om(e.beforeCreate,n,"bc");const{data:s,computed:r,methods:o,watch:a,provide:l,inject:c,created:h,beforeMount:u,mounted:f,beforeUpdate:d,updated:g,activated:O,deactivated:m,beforeDestroy:p,beforeUnmount:y,destroyed:S,unmounted:x,render:w,renderTracked:T,renderTriggered:C,errorCaptured:k,serverPrefetch:b,expose:E,inheritAttrs:j,components:ae,directives:Q,filters:W}=e;if(c&&$b(c,i,null),o)for(const X in o){const z=o[X];Ye(z)&&(i[X]=z.bind(t))}if(s){const X=s.call(t,t);ft(X)&&(n.data=Dd(X))}if(gf=!0,r)for(const X in r){const z=r[X],se=Ye(z)?z.bind(t,t):Ye(z.get)?z.get.bind(t,t):ai,J=!Ye(z)&&Ye(z.set)?z.set.bind(t):ai,be=es({get:se,set:J});Object.defineProperty(i,X,{enumerable:!0,configurable:!0,get:()=>be.value,set:N=>be.value=N})}if(a)for(const X in a)Zv(a[X],i,t,X);if(l){const X=Ye(l)?l.call(t):l;Reflect.ownKeys(X).forEach(z=>{Wb(z,X[z])})}h&&om(h,n,"c");function K(X,z){Qe(z)?z.forEach(se=>X(se.bind(t))):z&&X(z.bind(t))}if(K(Ab,u),K(Xd,f),K(Pb,d),K(Cb,g),K(Mb,O),K(Tb,m),K(Db,k),K(Lb,T),K(kb,C),K(zd,y),K(Wv,x),K(Rb,b),Qe(E))if(E.length){const X=n.exposed||(n.exposed={});E.forEach(z=>{Object.defineProperty(X,z,{get:()=>t[z],set:se=>t[z]=se})})}else n.exposed||(n.exposed={});w&&n.render===ai&&(n.render=w),j!=null&&(n.inheritAttrs=j),ae&&(n.components=ae),Q&&(n.directives=Q)}function $b(n,e,t=ai){Qe(n)&&(n=Of(n));for(const i in n){const s=n[i];let r;ft(s)?"default"in s?r=ca(s.from||i,s.default,!0):r=ca(s.from||i):r=ca(s),Ot(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[i]=r}}function om(n,e,t){li(Qe(n)?n.map(i=>i.bind(e.proxy)):n.bind(e.proxy),e,t)}function Zv(n,e,t,i){const s=i.includes(".")?Xv(t,i):()=>t[i];if(Dt(n)){const r=e[n];Ye(r)&&Ln(s,r)}else if(Ye(n))Ln(s,n.bind(t));else if(ft(n))if(Qe(n))n.forEach(r=>Zv(r,e,t,i));else{const r=Ye(n.handler)?n.handler.bind(t):e[n.handler];Ye(r)&&Ln(s,r,n)}}function Vd(n){const e=n.type,{mixins:t,extends:i}=e,{mixins:s,optionsCache:r,config:{optionMergeStrategies:o}}=n.appContext,a=r.get(e);let l;return a?l=a:!s.length&&!t&&!i?l=e:(l={},s.length&&s.forEach(c=>Pc(l,c,o,!0)),Pc(l,e,o)),ft(e)&&r.set(e,l),l}function Pc(n,e,t,i=!1){const{mixins:s,extends:r}=e;r&&Pc(n,r,t,!0),s&&s.forEach(o=>Pc(n,o,t,!0));for(const o in e)if(!(i&&o==="expose")){const a=Fb[o]||t&&t[o];n[o]=a?a(n[o],e[o]):e[o]}return n}const Fb={data:am,props:lm,emits:lm,methods:qo,computed:qo,beforeCreate:cn,created:cn,beforeMount:cn,mounted:cn,beforeUpdate:cn,updated:cn,beforeDestroy:cn,beforeUnmount:cn,destroyed:cn,unmounted:cn,activated:cn,deactivated:cn,errorCaptured:cn,serverPrefetch:cn,components:qo,directives:qo,watch:Xb,provide:am,inject:Bb};function am(n,e){return e?n?function(){return Zt(Ye(n)?n.call(this,this):n,Ye(e)?e.call(this,this):e)}:e:n}function Bb(n,e){return qo(Of(n),Of(e))}function Of(n){if(Qe(n)){const e={};for(let t=0;t1)return t&&Ye(e)?e.call(i&&i.proxy):e}}function Gb(n,e,t,i=!1){const s={},r={};wc(r,wh,1),n.propsDefaults=Object.create(null),Yv(n,e,s,r);for(const o in n.propsOptions[0])o in s||(s[o]=void 0);t?n.props=i?s:rb(s):n.type.props?n.props=s:n.props=r,n.attrs=r}function Zb(n,e,t,i){const{props:s,attrs:r,vnode:{patchFlag:o}}=n,a=at(s),[l]=n.propsOptions;let c=!1;if((i||o>0)&&!(o&16)){if(o&8){const h=n.vnode.dynamicProps;for(let u=0;u{l=!0;const[f,d]=jv(u,e,!0);Zt(o,f),d&&a.push(...d)};!t&&e.mixins.length&&e.mixins.forEach(h),n.extends&&h(n.extends),n.mixins&&n.mixins.forEach(h)}if(!r&&!l)return ft(n)&&i.set(n,qr),qr;if(Qe(r))for(let h=0;h-1,d[1]=O<0||g-1||st(d,"default"))&&a.push(u)}}}const c=[o,a];return ft(n)&&i.set(n,c),c}function cm(n){return n[0]!=="$"}function hm(n){const e=n&&n.toString().match(/^\s*(function|class) (\w+)/);return e?e[2]:n===null?"null":""}function um(n,e){return hm(n)===hm(e)}function fm(n,e){return Qe(e)?e.findIndex(t=>um(t,n)):Ye(e)&&um(e,n)?0:-1}const qv=n=>n[0]==="_"||n==="$stable",Wd=n=>Qe(n)?n.map(Oi):[Oi(n)],Hb=(n,e,t)=>{if(e._n)return e;const i=_h((...s)=>Wd(e(...s)),t);return i._c=!1,i},Kv=(n,e,t)=>{const i=n._ctx;for(const s in n){if(qv(s))continue;const r=n[s];if(Ye(r))e[s]=Hb(s,r,i);else if(r!=null){const o=Wd(r);e[s]=()=>o}}},Jv=(n,e)=>{const t=Wd(e);n.slots.default=()=>t},Yb=(n,e)=>{if(n.vnode.shapeFlag&32){const t=e._;t?(n.slots=at(e),wc(e,"_",t)):Kv(e,n.slots={})}else n.slots={},e&&Jv(n,e);wc(n.slots,wh,1)},jb=(n,e,t)=>{const{vnode:i,slots:s}=n;let r=!0,o=gt;if(i.shapeFlag&32){const a=e._;a?t&&a===1?r=!1:(Zt(s,e),!t&&a===1&&delete s._):(r=!e.$stable,Kv(e,s)),o=e}else e&&(Jv(n,e),o={default:1});if(r)for(const a in s)!qv(a)&&!(a in o)&&delete s[a]};function xf(n,e,t,i,s=!1){if(Qe(n)){n.forEach((f,d)=>xf(f,e&&(Qe(e)?e[d]:e),t,i,s));return}if(aa(i)&&!s)return;const r=i.shapeFlag&4?Th(i.component)||i.component.proxy:i.el,o=s?null:r,{i:a,r:l}=n,c=e&&e.r,h=a.refs===gt?a.refs={}:a.refs,u=a.setupState;if(c!=null&&c!==l&&(Dt(c)?(h[c]=null,st(u,c)&&(u[c]=null)):Ot(c)&&(c.value=null)),Ye(l))Os(l,a,12,[o,h]);else{const f=Dt(l),d=Ot(l);if(f||d){const g=()=>{if(n.f){const O=f?st(u,l)?u[l]:h[l]:l.value;s?Qe(O)&&Td(O,r):Qe(O)?O.includes(r)||O.push(r):f?(h[l]=[r],st(u,l)&&(u[l]=h[l])):(l.value=[r],n.k&&(h[n.k]=l.value))}else f?(h[l]=o,st(u,l)&&(u[l]=o)):d&&(l.value=o,n.k&&(h[n.k]=o))};o?(g.id=-1,Sn(g,t)):g()}}}const Sn=_b;function qb(n){return Kb(n)}function Kb(n,e){const t=cf();t.__VUE__=!0;const{insert:i,remove:s,patchProp:r,createElement:o,createText:a,createComment:l,setText:c,setElementText:h,parentNode:u,nextSibling:f,setScopeId:d=ai,insertStaticContent:g}=n,O=(v,R,U,Z=null,B=null,ce=null,he=!1,q=null,ue=!!R.dynamicChildren)=>{if(v===R)return;v&&!No(v,R)&&(Z=De(v),N(v,B,ce,!0),v=null),R.patchFlag===-2&&(ue=!1,R.dynamicChildren=null);const{type:le,ref:we,shapeFlag:M}=R;switch(le){case bh:m(v,R,U,Z);break;case bs:p(v,R,U,Z);break;case Jh:v==null&&y(R,U,Z,he);break;case fn:ae(v,R,U,Z,B,ce,he,q,ue);break;default:M&1?w(v,R,U,Z,B,ce,he,q,ue):M&6?Q(v,R,U,Z,B,ce,he,q,ue):(M&64||M&128)&&le.process(v,R,U,Z,B,ce,he,q,ue,Ue)}we!=null&&B&&xf(we,v&&v.ref,ce,R||v,!R)},m=(v,R,U,Z)=>{if(v==null)i(R.el=a(R.children),U,Z);else{const B=R.el=v.el;R.children!==v.children&&c(B,R.children)}},p=(v,R,U,Z)=>{v==null?i(R.el=l(R.children||""),U,Z):R.el=v.el},y=(v,R,U,Z)=>{[v.el,v.anchor]=g(v.children,R,U,Z,v.el,v.anchor)},S=({el:v,anchor:R},U,Z)=>{let B;for(;v&&v!==R;)B=f(v),i(v,U,Z),v=B;i(R,U,Z)},x=({el:v,anchor:R})=>{let U;for(;v&&v!==R;)U=f(v),s(v),v=U;s(R)},w=(v,R,U,Z,B,ce,he,q,ue)=>{he=he||R.type==="svg",v==null?T(R,U,Z,B,ce,he,q,ue):b(v,R,B,ce,he,q,ue)},T=(v,R,U,Z,B,ce,he,q)=>{let ue,le;const{type:we,props:M,shapeFlag:_,transition:I,dirs:ee}=v;if(ue=v.el=o(v.type,ce,M&&M.is,M),_&8?h(ue,v.children):_&16&&k(v.children,ue,null,Z,B,ce&&we!=="foreignObject",he,q),ee&&Is(v,null,Z,"created"),C(ue,v,v.scopeId,he,Z),M){for(const P in M)P!=="value"&&!ac(P)&&r(ue,P,null,M[P],ce,v.children,Z,B,Se);"value"in M&&r(ue,"value",null,M.value),(le=M.onVnodeBeforeMount)&&fi(le,Z,v)}ee&&Is(v,null,Z,"beforeMount");const oe=(!B||B&&!B.pendingBranch)&&I&&!I.persisted;oe&&I.beforeEnter(ue),i(ue,R,U),((le=M&&M.onVnodeMounted)||oe||ee)&&Sn(()=>{le&&fi(le,Z,v),oe&&I.enter(ue),ee&&Is(v,null,Z,"mounted")},B)},C=(v,R,U,Z,B)=>{if(U&&d(v,U),Z)for(let ce=0;ce{for(let le=ue;le{const q=R.el=v.el;let{patchFlag:ue,dynamicChildren:le,dirs:we}=R;ue|=v.patchFlag&16;const M=v.props||gt,_=R.props||gt;let I;U&&Qs(U,!1),(I=_.onVnodeBeforeUpdate)&&fi(I,U,R,v),we&&Is(R,v,U,"beforeUpdate"),U&&Qs(U,!0);const ee=B&&R.type!=="foreignObject";if(le?E(v.dynamicChildren,le,q,U,Z,ee,ce):he||z(v,R,q,null,U,Z,ee,ce,!1),ue>0){if(ue&16)j(q,R,M,_,U,Z,B);else if(ue&2&&M.class!==_.class&&r(q,"class",null,_.class,B),ue&4&&r(q,"style",M.style,_.style,B),ue&8){const oe=R.dynamicProps;for(let P=0;P{I&&fi(I,U,R,v),we&&Is(R,v,U,"updated")},Z)},E=(v,R,U,Z,B,ce,he)=>{for(let q=0;q{if(U!==Z){if(U!==gt)for(const q in U)!ac(q)&&!(q in Z)&&r(v,q,U[q],null,he,R.children,B,ce,Se);for(const q in Z){if(ac(q))continue;const ue=Z[q],le=U[q];ue!==le&&q!=="value"&&r(v,q,le,ue,he,R.children,B,ce,Se)}"value"in Z&&r(v,"value",U.value,Z.value)}},ae=(v,R,U,Z,B,ce,he,q,ue)=>{const le=R.el=v?v.el:a(""),we=R.anchor=v?v.anchor:a("");let{patchFlag:M,dynamicChildren:_,slotScopeIds:I}=R;I&&(q=q?q.concat(I):I),v==null?(i(le,U,Z),i(we,U,Z),k(R.children,U,we,B,ce,he,q,ue)):M>0&&M&64&&_&&v.dynamicChildren?(E(v.dynamicChildren,_,U,B,ce,he,q),(R.key!=null||B&&R===B.subTree)&&ex(v,R,!0)):z(v,R,U,we,B,ce,he,q,ue)},Q=(v,R,U,Z,B,ce,he,q,ue)=>{R.slotScopeIds=q,v==null?R.shapeFlag&512?B.ctx.activate(R,U,Z,he,ue):W(R,U,Z,B,ce,he,ue):G(v,R,ue)},W=(v,R,U,Z,B,ce,he)=>{const q=v.component=ow(v,Z,B);if(zv(v)&&(q.ctx.renderer=Ue),aw(q),q.asyncDep){if(B&&B.registerDep(q,K),!v.el){const ue=q.subTree=Nt(bs);p(null,ue,R,U)}return}K(q,v,R,U,B,ce,he)},G=(v,R,U)=>{const Z=R.component=v.component;if(vb(v,R,U))if(Z.asyncDep&&!Z.asyncResolved){X(Z,R,U);return}else Z.next=R,fb(Z.update),Z.update();else R.el=v.el,Z.vnode=R},K=(v,R,U,Z,B,ce,he)=>{const q=()=>{if(v.isMounted){let{next:we,bu:M,u:_,parent:I,vnode:ee}=v,oe=we,P;Qs(v,!1),we?(we.el=ee.el,X(v,we,he)):we=ee,M&&lc(M),(P=we.props&&we.props.onVnodeBeforeUpdate)&&fi(P,I,we,ee),Qs(v,!0);const te=qh(v),fe=v.subTree;v.subTree=te,O(fe,te,u(fe.el),De(fe),v,B,ce),we.el=te.el,oe===null&&xb(v,te.el),_&&Sn(_,B),(P=we.props&&we.props.onVnodeUpdated)&&Sn(()=>fi(P,I,we,ee),B)}else{let we;const{el:M,props:_}=R,{bm:I,m:ee,parent:oe}=v,P=aa(R);if(Qs(v,!1),I&&lc(I),!P&&(we=_&&_.onVnodeBeforeMount)&&fi(we,oe,R),Qs(v,!0),M&&We){const te=()=>{v.subTree=qh(v),We(M,v.subTree,v,B,null)};P?R.type.__asyncLoader().then(()=>!v.isUnmounted&&te()):te()}else{const te=v.subTree=qh(v);O(null,te,U,Z,v,B,ce),R.el=te.el}if(ee&&Sn(ee,B),!P&&(we=_&&_.onVnodeMounted)){const te=R;Sn(()=>fi(we,oe,te),B)}(R.shapeFlag&256||oe&&aa(oe.vnode)&&oe.vnode.shapeFlag&256)&&v.a&&Sn(v.a,B),v.isMounted=!0,R=U=Z=null}},ue=v.effect=new Cd(q,()=>Fd(le),v.scope),le=v.update=()=>ue.run();le.id=v.uid,Qs(v,!0),le()},X=(v,R,U)=>{R.component=v;const Z=v.vnode.props;v.vnode=R,v.next=null,Zb(v,R.props,Z,U),jb(v,R.children,U),Ro(),im(),ko()},z=(v,R,U,Z,B,ce,he,q,ue=!1)=>{const le=v&&v.children,we=v?v.shapeFlag:0,M=R.children,{patchFlag:_,shapeFlag:I}=R;if(_>0){if(_&128){J(le,M,U,Z,B,ce,he,q,ue);return}else if(_&256){se(le,M,U,Z,B,ce,he,q,ue);return}}I&8?(we&16&&Se(le,B,ce),M!==le&&h(U,M)):we&16?I&16?J(le,M,U,Z,B,ce,he,q,ue):Se(le,B,ce,!0):(we&8&&h(U,""),I&16&&k(M,U,Z,B,ce,he,q,ue))},se=(v,R,U,Z,B,ce,he,q,ue)=>{v=v||qr,R=R||qr;const le=v.length,we=R.length,M=Math.min(le,we);let _;for(_=0;_we?Se(v,B,ce,!0,!1,M):k(R,U,Z,B,ce,he,q,ue,M)},J=(v,R,U,Z,B,ce,he,q,ue)=>{let le=0;const we=R.length;let M=v.length-1,_=we-1;for(;le<=M&&le<=_;){const I=v[le],ee=R[le]=ue?ls(R[le]):Oi(R[le]);if(No(I,ee))O(I,ee,U,null,B,ce,he,q,ue);else break;le++}for(;le<=M&&le<=_;){const I=v[M],ee=R[_]=ue?ls(R[_]):Oi(R[_]);if(No(I,ee))O(I,ee,U,null,B,ce,he,q,ue);else break;M--,_--}if(le>M){if(le<=_){const I=_+1,ee=I_)for(;le<=M;)N(v[le],B,ce,!0),le++;else{const I=le,ee=le,oe=new Map;for(le=ee;le<=_;le++){const xe=R[le]=ue?ls(R[le]):Oi(R[le]);xe.key!=null&&oe.set(xe.key,le)}let P,te=0;const fe=_-ee+1;let H=!1,Ae=0;const Re=new Array(fe);for(le=0;le=fe){N(xe,B,ce,!0);continue}let _e;if(xe.key!=null)_e=oe.get(xe.key);else for(P=ee;P<=_;P++)if(Re[P-ee]===0&&No(xe,R[P])){_e=P;break}_e===void 0?N(xe,B,ce,!0):(Re[_e-ee]=le+1,_e>=Ae?Ae=_e:H=!0,O(xe,R[_e],U,null,B,ce,he,q,ue),te++)}const ke=H?Jb(Re):qr;for(P=ke.length-1,le=fe-1;le>=0;le--){const xe=ee+le,_e=R[xe],Ne=xe+1{const{el:ce,type:he,transition:q,children:ue,shapeFlag:le}=v;if(le&6){be(v.component.subTree,R,U,Z);return}if(le&128){v.suspense.move(R,U,Z);return}if(le&64){he.move(v,R,U,Ue);return}if(he===fn){i(ce,R,U);for(let M=0;Mq.enter(ce),B);else{const{leave:M,delayLeave:_,afterLeave:I}=q,ee=()=>i(ce,R,U),oe=()=>{M(ce,()=>{ee(),I&&I()})};_?_(ce,ee,oe):oe()}else i(ce,R,U)},N=(v,R,U,Z=!1,B=!1)=>{const{type:ce,props:he,ref:q,children:ue,dynamicChildren:le,shapeFlag:we,patchFlag:M,dirs:_}=v;if(q!=null&&xf(q,null,U,v,!0),we&256){R.ctx.deactivate(v);return}const I=we&1&&_,ee=!aa(v);let oe;if(ee&&(oe=he&&he.onVnodeBeforeUnmount)&&fi(oe,R,v),we&6)Te(v.component,U,Z);else{if(we&128){v.suspense.unmount(U,Z);return}I&&Is(v,null,R,"beforeUnmount"),we&64?v.type.remove(v,R,U,B,Ue,Z):le&&(ce!==fn||M>0&&M&64)?Se(le,R,U,!1,!0):(ce===fn&&M&384||!B&&we&16)&&Se(ue,R,U),Z&&de(v)}(ee&&(oe=he&&he.onVnodeUnmounted)||I)&&Sn(()=>{oe&&fi(oe,R,v),I&&Is(v,null,R,"unmounted")},U)},de=v=>{const{type:R,el:U,anchor:Z,transition:B}=v;if(R===fn){pe(U,Z);return}if(R===Jh){x(v);return}const ce=()=>{s(U),B&&!B.persisted&&B.afterLeave&&B.afterLeave()};if(v.shapeFlag&1&&B&&!B.persisted){const{leave:he,delayLeave:q}=B,ue=()=>he(U,ce);q?q(v.el,ce,ue):ue()}else ce()},pe=(v,R)=>{let U;for(;v!==R;)U=f(v),s(v),v=U;s(R)},Te=(v,R,U)=>{const{bum:Z,scope:B,update:ce,subTree:he,um:q}=v;Z&&lc(Z),B.stop(),ce&&(ce.active=!1,N(he,v,R,U)),q&&Sn(q,R),Sn(()=>{v.isUnmounted=!0},R),R&&R.pendingBranch&&!R.isUnmounted&&v.asyncDep&&!v.asyncResolved&&v.suspenseId===R.pendingId&&(R.deps--,R.deps===0&&R.resolve())},Se=(v,R,U,Z=!1,B=!1,ce=0)=>{for(let he=ce;hev.shapeFlag&6?De(v.component.subTree):v.shapeFlag&128?v.suspense.next():f(v.anchor||v.el),ze=(v,R,U)=>{v==null?R._vnode&&N(R._vnode,null,null,!0):O(R._vnode||null,v,R,null,null,null,U),im(),Nv(),R._vnode=v},Ue={p:O,um:N,m:be,r:de,mt:W,mc:k,pc:z,pbc:E,n:De,o:n};let dt,We;return e&&([dt,We]=e(Ue)),{render:ze,hydrate:dt,createApp:Vb(ze,dt)}}function Qs({effect:n,update:e},t){n.allowRecurse=e.allowRecurse=t}function ex(n,e,t=!1){const i=n.children,s=e.children;if(Qe(i)&&Qe(s))for(let r=0;r>1,n[t[a]]0&&(e[i]=t[r-1]),t[r]=i)}}for(r=t.length,o=t[r-1];r-- >0;)t[r]=o,o=e[o];return t}const ew=n=>n.__isTeleport,fn=Symbol.for("v-fgt"),bh=Symbol.for("v-txt"),bs=Symbol.for("v-cmt"),Jh=Symbol.for("v-stc"),ha=[];let ri=null;function Ct(n=!1){ha.push(ri=n?null:[])}function tw(){ha.pop(),ri=ha[ha.length-1]||null}let _a=1;function dm(n){_a+=n}function tx(n){return n.dynamicChildren=_a>0?ri||qr:null,tw(),_a>0&&ri&&ri.push(n),n}function gn(n,e,t,i,s,r){return tx(ve(n,e,t,i,s,r,!0))}function za(n,e,t,i,s){return tx(Nt(n,e,t,i,s,!0))}function Rc(n){return n?n.__v_isVNode===!0:!1}function No(n,e){return n.type===e.type&&n.key===e.key}const wh="__vInternal",nx=({key:n})=>n??null,hc=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?Dt(n)||Ot(n)||Ye(n)?{i:On,r:n,k:e,f:!!t}:n:null);function ve(n,e=null,t=null,i=0,s=null,r=n===fn?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&nx(e),ref:e&&hc(e),scopeId:Bv,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:On};return a?(Gd(l,t),r&128&&n.normalize(l)):t&&(l.shapeFlag|=Dt(t)?8:16),_a>0&&!o&&ri&&(l.patchFlag>0||r&6)&&l.patchFlag!==32&&ri.push(l),l}const Nt=nw;function nw(n,e=null,t=null,i=0,s=null,r=!1){if((!n||n===Ub)&&(n=bs),Rc(n)){const a=po(n,e,!0);return t&&Gd(a,t),_a>0&&!r&&ri&&(a.shapeFlag&6?ri[ri.indexOf(n)]=a:ri.push(a)),a.patchFlag|=-2,a}if(uw(n)&&(n=n.__vccOpts),e){e=ix(e);let{class:a,style:l}=e;a&&!Dt(a)&&(e.class=Co(a)),ft(l)&&(Cv(l)&&!Qe(l)&&(l=Zt({},l)),e.style=Ba(l))}const o=Dt(n)?1:Sb(n)?128:ew(n)?64:ft(n)?4:Ye(n)?2:0;return ve(n,e,t,i,s,o,r,!0)}function ix(n){return n?Cv(n)||wh in n?Zt({},n):n:null}function po(n,e,t=!1){const{props:i,ref:s,patchFlag:r,children:o}=n,a=e?iw(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:n.type,props:a,key:a&&nx(a),ref:e&&e.ref?t&&s?Qe(s)?s.concat(hc(e)):[s,hc(e)]:hc(e):s,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:o,target:n.target,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==fn?r===-1?16:r|16:r,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:n.transition,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&po(n.ssContent),ssFallback:n.ssFallback&&po(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce}}function mo(n=" ",e=0){return Nt(bh,null,n,e)}function Mh(n="",e=!1){return e?(Ct(),za(bs,null,n)):Nt(bs,null,n)}function Oi(n){return n==null||typeof n=="boolean"?Nt(bs):Qe(n)?Nt(fn,null,n.slice()):typeof n=="object"?ls(n):Nt(bh,null,String(n))}function ls(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:po(n)}function Gd(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if(Qe(e))t=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),Gd(n,s()),s._c&&(s._d=!0));return}else{t=32;const s=e._;!s&&!(wh in e)?e._ctx=On:s===3&&On&&(On.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else Ye(e)?(e={default:e,_ctx:On},t=32):(e=String(e),i&64?(t=16,e=[mo(e)]):t=8);n.children=e,n.shapeFlag|=t}function iw(...n){const e={};for(let t=0;tsn=n),Zd=n=>{Sr.length>1?Sr.forEach(e=>e(n)):Sr[0](n)};const go=n=>{Zd(n),n.scope.on()},nr=()=>{sn&&sn.scope.off(),Zd(null)};function sx(n){return n.vnode.shapeFlag&4}let ya=!1;function aw(n,e=!1){ya=e;const{props:t,children:i}=n.vnode,s=sx(n);Gb(n,t,s,e),Yb(n,i);const r=s?lw(n,e):void 0;return ya=!1,r}function lw(n,e){const t=n.type;n.accessCache=Object.create(null),n.proxy=Qd(new Proxy(n.ctx,Qb));const{setup:i}=t;if(i){const s=n.setupContext=i.length>1?hw(n):null;go(n),Ro();const r=Os(i,n,0,[n.props,s]);if(ko(),nr(),fv(r)){if(r.then(nr,nr),e)return r.then(o=>{mm(n,o,e)}).catch(o=>{xh(o,n,0)});n.asyncDep=r}else mm(n,r,e)}else rx(n,e)}function mm(n,e,t){Ye(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:ft(e)&&(n.setupState=Dv(e)),rx(n,t)}let gm;function rx(n,e,t){const i=n.type;if(!n.render){if(!e&&gm&&!i.render){const s=i.template||Vd(n).template;if(s){const{isCustomElement:r,compilerOptions:o}=n.appContext.config,{delimiters:a,compilerOptions:l}=i,c=Zt(Zt({isCustomElement:r,delimiters:a},o),l);i.render=gm(s,c)}}n.render=i.render||ai}go(n),Ro(),Nb(n),ko(),nr()}function cw(n){return n.attrsProxy||(n.attrsProxy=new Proxy(n.attrs,{get(e,t){return Mn(n,"get","$attrs"),e[t]}}))}function hw(n){const e=t=>{n.exposed=t||{}};return{get attrs(){return cw(n)},slots:n.slots,emit:n.emit,expose:e}}function Th(n){if(n.exposed)return n.exposeProxy||(n.exposeProxy=new Proxy(Dv(Qd(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in la)return la[t](n)},has(e,t){return t in e||t in la}}))}function uw(n){return Ye(n)&&"__vccOpts"in n}const es=(n,e)=>cb(n,e,ya);function fw(n,e,t){const i=arguments.length;return i===2?ft(e)&&!Qe(e)?Rc(e)?Nt(n,null,[e]):Nt(n,e):Nt(n,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&Rc(t)&&(t=[t]),Nt(n,e,t))}const dw=Symbol.for("v-scx"),pw=()=>ca(dw),mw="3.3.4",gw="http://www.w3.org/2000/svg",Gs=typeof document<"u"?document:null,Om=Gs&&Gs.createElement("template"),Ow={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,i)=>{const s=e?Gs.createElementNS(gw,n):Gs.createElement(n,t?{is:t}:void 0);return n==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:n=>Gs.createTextNode(n),createComment:n=>Gs.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>Gs.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,i,s,r){const o=t?t.previousSibling:e.lastChild;if(s&&(s===r||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),t),!(s===r||!(s=s.nextSibling)););else{Om.innerHTML=i?`${n}`:n;const a=Om.content;if(i){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}};function vw(n,e,t){const i=n._vtc;i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}function xw(n,e,t){const i=n.style,s=Dt(t);if(t&&!s){if(e&&!Dt(e))for(const r in e)t[r]==null&&Sf(i,r,"");for(const r in t)Sf(i,r,t[r])}else{const r=i.display;s?e!==t&&(i.cssText=t):e&&n.removeAttribute("style"),"_vod"in n&&(i.display=r)}}const vm=/\s*!important$/;function Sf(n,e,t){if(Qe(t))t.forEach(i=>Sf(n,e,i));else if(t==null&&(t=""),e.startsWith("--"))n.setProperty(e,t);else{const i=Sw(n,e);vm.test(t)?n.setProperty(Po(i),t.replace(vm,""),"important"):n[i]=t}}const xm=["Webkit","Moz","ms"],eu={};function Sw(n,e){const t=eu[e];if(t)return t;let i=uo(e);if(i!=="filter"&&i in n)return eu[e]=i;i=mv(i);for(let s=0;stu||(Tw.then(()=>tu=0),tu=Date.now());function Aw(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;li(Pw(i,t.value),e,5,[i])};return t.value=n,t.attached=Ew(),t}function Pw(n,e){if(Qe(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(i=>s=>!s._stopped&&i&&i(s))}else return e}const ym=/^on[a-z]/,Cw=(n,e,t,i,s=!1,r,o,a,l)=>{e==="class"?vw(n,i,s):e==="style"?xw(n,t,i):gh(e)?Md(e)||ww(n,e,t,i,o):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Rw(n,e,i,s))?yw(n,e,i,r,o,a,l):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),_w(n,e,i,s))};function Rw(n,e,t,i){return i?!!(e==="innerHTML"||e==="textContent"||e in n&&ym.test(e)&&Ye(t)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA"||ym.test(e)&&Dt(t)?!1:e in n}const Oo=n=>{const e=n.props["onUpdate:modelValue"]||!1;return Qe(e)?t=>lc(e,t):e};function kw(n){n.target.composing=!0}function bm(n){const e=n.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Wr={created(n,{modifiers:{lazy:e,trim:t,number:i}},s){n._assign=Oo(s);const r=i||s.props&&s.props.type==="number";us(n,e?"change":"input",o=>{if(o.target.composing)return;let a=n.value;t&&(a=a.trim()),r&&(a=Mc(a)),n._assign(a)}),t&&us(n,"change",()=>{n.value=n.value.trim()}),e||(us(n,"compositionstart",kw),us(n,"compositionend",bm),us(n,"change",bm))},mounted(n,{value:e}){n.value=e??""},beforeUpdate(n,{value:e,modifiers:{lazy:t,trim:i,number:s}},r){if(n._assign=Oo(r),n.composing||document.activeElement===n&&n.type!=="range"&&(t||i&&n.value.trim()===e||(s||n.type==="number")&&Mc(n.value)===e))return;const o=e??"";n.value!==o&&(n.value=o)}},Lw={deep:!0,created(n,e,t){n._assign=Oo(t),us(n,"change",()=>{const i=n._modelValue,s=ba(n),r=n.checked,o=n._assign;if(Qe(i)){const a=Ad(i,s),l=a!==-1;if(r&&!l)o(i.concat(s));else if(!r&&l){const c=[...i];c.splice(a,1),o(c)}}else if(Ao(i)){const a=new Set(i);r?a.add(s):a.delete(s),o(a)}else o(ax(n,r))})},mounted:wm,beforeUpdate(n,e,t){n._assign=Oo(t),wm(n,e,t)}};function wm(n,{value:e,oldValue:t},i){n._modelValue=e,Qe(e)?n.checked=Ad(e,i.props.value)>-1:Ao(e)?n.checked=e.has(i.props.value):e!==t&&(n.checked=Xa(e,ax(n,!0)))}const ox={deep:!0,created(n,{value:e,modifiers:{number:t}},i){const s=Ao(e);us(n,"change",()=>{const r=Array.prototype.filter.call(n.options,o=>o.selected).map(o=>t?Mc(ba(o)):ba(o));n._assign(n.multiple?s?new Set(r):r:r[0])}),n._assign=Oo(i)},mounted(n,{value:e}){Mm(n,e)},beforeUpdate(n,e,t){n._assign=Oo(t)},updated(n,{value:e}){Mm(n,e)}};function Mm(n,e){const t=n.multiple;if(!(t&&!Qe(e)&&!Ao(e))){for(let i=0,s=n.options.length;i-1:r.selected=e.has(o);else if(Xa(ba(r),e)){n.selectedIndex!==i&&(n.selectedIndex=i);return}}!t&&n.selectedIndex!==-1&&(n.selectedIndex=-1)}}function ba(n){return"_value"in n?n._value:n.value}function ax(n,e){const t=e?"_trueValue":"_falseValue";return t in n?n[t]:e}const Dw=["ctrl","shift","alt","meta"],Uw={stop:n=>n.stopPropagation(),prevent:n=>n.preventDefault(),self:n=>n.target!==n.currentTarget,ctrl:n=>!n.ctrlKey,shift:n=>!n.shiftKey,alt:n=>!n.altKey,meta:n=>!n.metaKey,left:n=>"button"in n&&n.button!==0,middle:n=>"button"in n&&n.button!==1,right:n=>"button"in n&&n.button!==2,exact:(n,e)=>Dw.some(t=>n[`${t}Key`]&&!e.includes(t))},Eh=(n,e)=>(t,...i)=>{for(let s=0;s{$o(n,!1)}):$o(n,e))},beforeUnmount(n,{value:e}){$o(n,e)}};function $o(n,e){n.style.display=e?n._vod:"none"}const Qw=Zt({patchProp:Cw},Ow);let Tm;function Nw(){return Tm||(Tm=qb(Qw))}const $w=(...n)=>{const e=Nw().createApp(...n),{mount:t}=e;return e.mount=i=>{const s=Fw(i);if(!s)return;const r=e._component;!Ye(r)&&!r.render&&!r.template&&(r.template=s.innerHTML),s.innerHTML="";const o=t(s,!1,s instanceof SVGElement);return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e};function Fw(n){return Dt(n)?document.querySelector(n):n}var Bw=!1;/*! +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();function wd(n,e){const t=Object.create(null),i=n.split(",");for(let s=0;s!!t[s.toLowerCase()]:s=>!!t[s]}const gt={},Kr=[],ai=()=>{},Oy=()=>!1,vy=/^on[^a-z]/,gh=n=>vy.test(n),Md=n=>n.startsWith("onUpdate:"),Zt=Object.assign,Td=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},xy=Object.prototype.hasOwnProperty,st=(n,e)=>xy.call(n,e),Qe=Array.isArray,Jr=n=>Fa(n)==="[object Map]",Po=n=>Fa(n)==="[object Set]",Hp=n=>Fa(n)==="[object Date]",Ye=n=>typeof n=="function",Lt=n=>typeof n=="string",ga=n=>typeof n=="symbol",ft=n=>n!==null&&typeof n=="object",fv=n=>ft(n)&&Ye(n.then)&&Ye(n.catch),dv=Object.prototype.toString,Fa=n=>dv.call(n),Sy=n=>Fa(n).slice(8,-1),pv=n=>Fa(n)==="[object Object]",Ed=n=>Lt(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,ac=wd(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Oh=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},_y=/-(\w)/g,fo=Oh(n=>n.replace(_y,(e,t)=>t?t.toUpperCase():"")),yy=/\B([A-Z])/g,Co=Oh(n=>n.replace(yy,"-$1").toLowerCase()),mv=Oh(n=>n.charAt(0).toUpperCase()+n.slice(1)),jh=Oh(n=>n?`on${mv(n)}`:""),Oa=(n,e)=>!Object.is(n,e),lc=(n,e)=>{for(let t=0;t{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value:t})},Mc=n=>{const e=parseFloat(n);return isNaN(e)?n:e};let Yp;const cf=()=>Yp||(Yp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ba(n){if(Qe(n)){const e={};for(let t=0;t{if(t){const i=t.split(wy);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Ro(n){let e="";if(Lt(n))e=n;else if(Qe(n))for(let t=0;tXa(t,e))}const Vn=n=>Lt(n)?n:n==null?"":Qe(n)||ft(n)&&(n.toString===dv||!Ye(n.toString))?JSON.stringify(n,Ov,2):String(n),Ov=(n,e)=>e&&e.__v_isRef?Ov(n,e.value):Jr(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,s])=>(t[`${i} =>`]=s,t),{})}:Po(e)?{[`Set(${e.size})`]:[...e.values()]}:ft(e)&&!Qe(e)&&!pv(e)?String(e):e;let kn;class vv{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=kn,!e&&kn&&(this.index=(kn.scopes||(kn.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=kn;try{return kn=this,e()}finally{kn=t}}}on(){kn=this}off(){kn=this.parent}stop(e){if(this._active){let t,i;for(t=0,i=this.effects.length;t{const e=new Set(n);return e.w=0,e.n=0,e},Sv=n=>(n.w&ys)>0,_v=n=>(n.n&ys)>0,Dy=({deps:n})=>{if(n.length)for(let e=0;e{const{deps:e}=n;if(e.length){let t=0;for(let i=0;i{(h==="length"||h>=l)&&a.push(c)})}else switch(t!==void 0&&a.push(o.get(t)),e){case"add":Qe(n)?Ed(t)&&a.push(o.get("length")):(a.push(o.get(tr)),Jr(n)&&a.push(o.get(ff)));break;case"delete":Qe(n)||(a.push(o.get(tr)),Jr(n)&&a.push(o.get(ff)));break;case"set":Jr(n)&&a.push(o.get(tr));break}if(a.length===1)a[0]&&df(a[0]);else{const l=[];for(const c of a)c&&l.push(...c);df(Pd(l))}}function df(n,e){const t=Qe(n)?n:[...n];for(const i of t)i.computed&&qp(i);for(const i of t)i.computed||qp(i)}function qp(n,e){(n!==ni||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const Iy=wd("__proto__,__v_isRef,__isVue"),wv=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(ga)),Qy=Rd(),Ny=Rd(!1,!0),$y=Rd(!0),Kp=Fy();function Fy(){const n={};return["includes","indexOf","lastIndexOf"].forEach(e=>{n[e]=function(...t){const i=at(this);for(let r=0,o=this.length;r{n[e]=function(...t){ko();const i=at(this)[e].apply(this,t);return Lo(),i}}),n}function By(n){const e=at(this);return Mn(e,"has",n),e.hasOwnProperty(n)}function Rd(n=!1,e=!1){return function(i,s,r){if(s==="__v_isReactive")return!n;if(s==="__v_isReadonly")return n;if(s==="__v_isShallow")return e;if(s==="__v_raw"&&r===(n?e?ib:Pv:e?Av:Ev).get(i))return i;const o=Qe(i);if(!n){if(o&&st(Kp,s))return Reflect.get(Kp,s,r);if(s==="hasOwnProperty")return By}const a=Reflect.get(i,s,r);return(ga(s)?wv.has(s):Iy(s))||(n||Mn(i,"get",s),e)?a:Ot(a)?o&&Ed(s)?a:a.value:ft(a)?n?Ud(a):Dd(a):a}}const Xy=Mv(),zy=Mv(!0);function Mv(n=!1){return function(t,i,s,r){let o=t[i];if(po(o)&&Ot(o)&&!Ot(s))return!1;if(!n&&(!Tc(s)&&!po(s)&&(o=at(o),s=at(s)),!Qe(t)&&Ot(o)&&!Ot(s)))return o.value=s,!0;const a=Qe(t)&&Ed(i)?Number(i)n,vh=n=>Reflect.getPrototypeOf(n);function ll(n,e,t=!1,i=!1){n=n.__v_raw;const s=at(n),r=at(e);t||(e!==r&&Mn(s,"get",e),Mn(s,"get",r));const{has:o}=vh(s),a=i?kd:t?Nd:va;if(o.call(s,e))return a(n.get(e));if(o.call(s,r))return a(n.get(r));n!==s&&n.get(e)}function cl(n,e=!1){const t=this.__v_raw,i=at(t),s=at(n);return e||(n!==s&&Mn(i,"has",n),Mn(i,"has",s)),n===s?t.has(n):t.has(n)||t.has(s)}function hl(n,e=!1){return n=n.__v_raw,!e&&Mn(at(n),"iterate",tr),Reflect.get(n,"size",n)}function Jp(n){n=at(n);const e=at(this);return vh(e).has.call(e,n)||(e.add(n),ji(e,"add",n,n)),this}function em(n,e){e=at(e);const t=at(this),{has:i,get:s}=vh(t);let r=i.call(t,n);r||(n=at(n),r=i.call(t,n));const o=s.call(t,n);return t.set(n,e),r?Oa(e,o)&&ji(t,"set",n,e):ji(t,"add",n,e),this}function tm(n){const e=at(this),{has:t,get:i}=vh(e);let s=t.call(e,n);s||(n=at(n),s=t.call(e,n)),i&&i.call(e,n);const r=e.delete(n);return s&&ji(e,"delete",n,void 0),r}function nm(){const n=at(this),e=n.size!==0,t=n.clear();return e&&ji(n,"clear",void 0,void 0),t}function ul(n,e){return function(i,s){const r=this,o=r.__v_raw,a=at(o),l=e?kd:n?Nd:va;return!n&&Mn(a,"iterate",tr),o.forEach((c,h)=>i.call(s,l(c),l(h),r))}}function fl(n,e,t){return function(...i){const s=this.__v_raw,r=at(s),o=Jr(r),a=n==="entries"||n===Symbol.iterator&&o,l=n==="keys"&&o,c=s[n](...i),h=t?kd:e?Nd:va;return!e&&Mn(r,"iterate",l?ff:tr),{next(){const{value:u,done:f}=c.next();return f?{value:u,done:f}:{value:a?[h(u[0]),h(u[1])]:h(u),done:f}},[Symbol.iterator](){return this}}}}function is(n){return function(...e){return n==="delete"?!1:this}}function Yy(){const n={get(r){return ll(this,r)},get size(){return hl(this)},has:cl,add:Jp,set:em,delete:tm,clear:nm,forEach:ul(!1,!1)},e={get(r){return ll(this,r,!1,!0)},get size(){return hl(this)},has:cl,add:Jp,set:em,delete:tm,clear:nm,forEach:ul(!1,!0)},t={get(r){return ll(this,r,!0)},get size(){return hl(this,!0)},has(r){return cl.call(this,r,!0)},add:is("add"),set:is("set"),delete:is("delete"),clear:is("clear"),forEach:ul(!0,!1)},i={get(r){return ll(this,r,!0,!0)},get size(){return hl(this,!0)},has(r){return cl.call(this,r,!0)},add:is("add"),set:is("set"),delete:is("delete"),clear:is("clear"),forEach:ul(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=fl(r,!1,!1),t[r]=fl(r,!0,!1),e[r]=fl(r,!1,!0),i[r]=fl(r,!0,!0)}),[n,t,e,i]}const[jy,qy,Ky,Jy]=Yy();function Ld(n,e){const t=e?n?Jy:Ky:n?qy:jy;return(i,s,r)=>s==="__v_isReactive"?!n:s==="__v_isReadonly"?n:s==="__v_raw"?i:Reflect.get(st(t,s)&&s in i?t:i,s,r)}const eb={get:Ld(!1,!1)},tb={get:Ld(!1,!0)},nb={get:Ld(!0,!1)},Ev=new WeakMap,Av=new WeakMap,Pv=new WeakMap,ib=new WeakMap;function sb(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function rb(n){return n.__v_skip||!Object.isExtensible(n)?0:sb(Sy(n))}function Dd(n){return po(n)?n:Id(n,!1,Tv,eb,Ev)}function ob(n){return Id(n,!1,Hy,tb,Av)}function Ud(n){return Id(n,!0,Zy,nb,Pv)}function Id(n,e,t,i,s){if(!ft(n)||n.__v_raw&&!(e&&n.__v_isReactive))return n;const r=s.get(n);if(r)return r;const o=rb(n);if(o===0)return n;const a=new Proxy(n,o===2?i:t);return s.set(n,a),a}function eo(n){return po(n)?eo(n.__v_raw):!!(n&&n.__v_isReactive)}function po(n){return!!(n&&n.__v_isReadonly)}function Tc(n){return!!(n&&n.__v_isShallow)}function Cv(n){return eo(n)||po(n)}function at(n){const e=n&&n.__v_raw;return e?at(e):n}function Qd(n){return wc(n,"__v_skip",!0),n}const va=n=>ft(n)?Dd(n):n,Nd=n=>ft(n)?Ud(n):n;function Rv(n){gs&&ni&&(n=at(n),bv(n.dep||(n.dep=Pd())))}function kv(n,e){n=at(n);const t=n.dep;t&&df(t)}function Ot(n){return!!(n&&n.__v_isRef===!0)}function $t(n){return Lv(n,!1)}function cc(n){return Lv(n,!0)}function Lv(n,e){return Ot(n)?n:new ab(n,e)}class ab{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:at(e),this._value=t?e:va(e)}get value(){return Rv(this),this._value}set value(e){const t=this.__v_isShallow||Tc(e)||po(e);e=t?e:at(e),Oa(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:va(e),kv(this))}}function nt(n){return Ot(n)?n.value:n}const lb={get:(n,e,t)=>nt(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const s=n[e];return Ot(s)&&!Ot(t)?(s.value=t,!0):Reflect.set(n,e,t,i)}};function Dv(n){return eo(n)?n:new Proxy(n,lb)}class cb{constructor(e,t,i,s){this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new Cd(e,()=>{this._dirty||(this._dirty=!0,kv(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=i}get value(){const e=at(this);return Rv(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}function hb(n,e,t=!1){let i,s;const r=Ye(n);return r?(i=n,s=ai):(i=n.get,s=n.set),new cb(i,s,r||!s,t)}function Os(n,e,t,i){let s;try{s=i?n(...i):n()}catch(r){xh(r,e,t)}return s}function li(n,e,t,i){if(Ye(n)){const r=Os(n,e,t,i);return r&&fv(r)&&r.catch(o=>{xh(o,e,t)}),r}const s=[];for(let r=0;r>>1;Sa(nn[i])Si&&nn.splice(e,1)}function pb(n){Qe(n)?to.push(...n):(!Xi||!Xi.includes(n,n.allowRecurse?Ws+1:Ws))&&to.push(n),Qv()}function im(n,e=xa?Si+1:0){for(;eSa(t)-Sa(i)),Ws=0;Wsn.id==null?1/0:n.id,mb=(n,e)=>{const t=Sa(n)-Sa(e);if(t===0){if(n.pre&&!e.pre)return-1;if(e.pre&&!n.pre)return 1}return t};function $v(n){pf=!1,xa=!0,nn.sort(mb);const e=ai;try{for(Si=0;SiLt(d)?d.trim():d)),u&&(s=t.map(Mc))}let a,l=i[a=jh(e)]||i[a=jh(fo(e))];!l&&r&&(l=i[a=jh(Co(e))]),l&&li(l,n,6,s);const c=i[a+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[a])return;n.emitted[a]=!0,li(c,n,6,s)}}function Fv(n,e,t=!1){const i=e.emitsCache,s=i.get(n);if(s!==void 0)return s;const r=n.emits;let o={},a=!1;if(!Ye(n)){const l=c=>{const h=Fv(c,e,!0);h&&(a=!0,Zt(o,h))};!t&&e.mixins.length&&e.mixins.forEach(l),n.extends&&l(n.extends),n.mixins&&n.mixins.forEach(l)}return!r&&!a?(ft(n)&&i.set(n,null),null):(Qe(r)?r.forEach(l=>o[l]=null):Zt(o,r),ft(n)&&i.set(n,o),o)}function Sh(n,e){return!n||!gh(e)?!1:(e=e.slice(2).replace(/Once$/,""),st(n,e[0].toLowerCase()+e.slice(1))||st(n,Co(e))||st(n,e))}let On=null,Bv=null;function Ec(n){const e=On;return On=n,Bv=n&&n.type.__scopeId||null,e}function _h(n,e=On,t){if(!e||n._n)return n;const i=(...s)=>{i._d&&dm(-1);const r=Ec(e);let o;try{o=n(...s)}finally{Ec(r),i._d&&dm(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function qh(n){const{type:e,vnode:t,proxy:i,withProxy:s,props:r,propsOptions:[o],slots:a,attrs:l,emit:c,render:h,renderCache:u,data:f,setupState:d,ctx:g,inheritAttrs:O}=n;let m,p;const y=Ec(n);try{if(t.shapeFlag&4){const x=s||i;m=Oi(h.call(x,x,u,r,d,f,g)),p=l}else{const x=e;m=Oi(x.length>1?x(r,{attrs:l,slots:a,emit:c}):x(r,null)),p=e.props?l:Ob(l)}}catch(x){ha.length=0,xh(x,n,1),m=Qt(bs)}let S=m;if(p&&O!==!1){const x=Object.keys(p),{shapeFlag:w}=S;x.length&&w&7&&(o&&x.some(Md)&&(p=vb(p,o)),S=mo(S,p))}return t.dirs&&(S=mo(S),S.dirs=S.dirs?S.dirs.concat(t.dirs):t.dirs),t.transition&&(S.transition=t.transition),m=S,Ec(y),m}const Ob=n=>{let e;for(const t in n)(t==="class"||t==="style"||gh(t))&&((e||(e={}))[t]=n[t]);return e},vb=(n,e)=>{const t={};for(const i in n)(!Md(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t};function xb(n,e,t){const{props:i,children:s,component:r}=n,{props:o,children:a,patchFlag:l}=e,c=r.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&l>=0){if(l&1024)return!0;if(l&16)return i?sm(i,o,c):!!o;if(l&8){const h=e.dynamicProps;for(let u=0;un.__isSuspense;function yb(n,e){e&&e.pendingBranch?Qe(n)?e.effects.push(...n):e.effects.push(n):pb(n)}function bb(n,e){return Bd(n,null,e)}const dl={};function Ln(n,e,t){return Bd(n,e,t)}function Bd(n,e,{immediate:t,deep:i,flush:s,onTrack:r,onTrigger:o}=gt){var a;const l=xv()===((a=sn)==null?void 0:a.scope)?sn:null;let c,h=!1,u=!1;if(Ot(n)?(c=()=>n.value,h=Tc(n)):eo(n)?(c=()=>n,i=!0):Qe(n)?(u=!0,h=n.some(x=>eo(x)||Tc(x)),c=()=>n.map(x=>{if(Ot(x))return x.value;if(eo(x))return qs(x);if(Ye(x))return Os(x,l,2)})):Ye(n)?e?c=()=>Os(n,l,2):c=()=>{if(!(l&&l.isUnmounted))return f&&f(),li(n,l,3,[d])}:c=ai,e&&i){const x=c;c=()=>qs(x())}let f,d=x=>{f=y.onStop=()=>{Os(x,l,4)}},g;if(ya)if(d=ai,e?t&&li(e,l,3,[c(),u?[]:void 0,d]):c(),s==="sync"){const x=mw();g=x.__watcherHandles||(x.__watcherHandles=[])}else return ai;let O=u?new Array(n.length).fill(dl):dl;const m=()=>{if(y.active)if(e){const x=y.run();(i||h||(u?x.some((w,T)=>Oa(w,O[T])):Oa(x,O)))&&(f&&f(),li(e,l,3,[x,O===dl?void 0:u&&O[0]===dl?[]:O,d]),O=x)}else y.run()};m.allowRecurse=!!e;let p;s==="sync"?p=m:s==="post"?p=()=>Sn(m,l&&l.suspense):(m.pre=!0,l&&(m.id=l.uid),p=()=>Fd(m));const y=new Cd(c,p);e?t?m():O=y.run():s==="post"?Sn(y.run.bind(y),l&&l.suspense):y.run();const S=()=>{y.stop(),l&&l.scope&&Td(l.scope.effects,y)};return g&&g.push(S),S}function wb(n,e,t){const i=this.proxy,s=Lt(n)?n.includes(".")?Xv(i,n):()=>i[n]:n.bind(i,i);let r;Ye(e)?r=e:(r=e.handler,t=e);const o=sn;Oo(this);const a=Bd(s,r.bind(i),t);return o?Oo(o):nr(),a}function Xv(n,e){const t=e.split(".");return()=>{let i=n;for(let s=0;s{qs(t,e)});else if(pv(n))for(const t in n)qs(n[t],e);return n}function Wi(n,e){const t=On;if(t===null)return n;const i=Th(t)||t.proxy,s=n.dirs||(n.dirs=[]);for(let r=0;rZt({name:n.name},e,{setup:n}))():n}const aa=n=>!!n.type.__asyncLoader,zv=n=>n.type.__isKeepAlive;function Tb(n,e){Vv(n,"a",e)}function Eb(n,e){Vv(n,"da",e)}function Vv(n,e,t=sn){const i=n.__wdc||(n.__wdc=()=>{let s=t;for(;s;){if(s.isDeactivated)return;s=s.parent}return n()});if(yh(e,i,t),t){let s=t.parent;for(;s&&s.parent;)zv(s.parent.vnode)&&Ab(i,e,t,s),s=s.parent}}function Ab(n,e,t,i){const s=yh(e,n,i,!0);Wv(()=>{Td(i[e],s)},t)}function yh(n,e,t=sn,i=!1){if(t){const s=t[n]||(t[n]=[]),r=e.__weh||(e.__weh=(...o)=>{if(t.isUnmounted)return;ko(),Oo(t);const a=li(e,t,n,o);return nr(),Lo(),a});return i?s.unshift(r):s.push(r),r}}const Ji=n=>(e,t=sn)=>(!ya||n==="sp")&&yh(n,(...i)=>e(...i),t),Pb=Ji("bm"),Xd=Ji("m"),Cb=Ji("bu"),Rb=Ji("u"),zd=Ji("bum"),Wv=Ji("um"),kb=Ji("sp"),Lb=Ji("rtg"),Db=Ji("rtc");function Ub(n,e=sn){yh("ec",n,e)}const Ib=Symbol.for("v-ndc");function Ac(n,e,t,i){let s;const r=t&&t[i];if(Qe(n)||Lt(n)){s=new Array(n.length);for(let o=0,a=n.length;oe(o,a,void 0,r&&r[a]));else{const o=Object.keys(n);s=new Array(o.length);for(let a=0,l=o.length;aRc(e)?!(e.type===bs||e.type===fn&&!Gv(e.children)):!0)?n:null}const mf=n=>n?sx(n)?Th(n)||n.proxy:mf(n.parent):null,la=Zt(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>n.props,$attrs:n=>n.attrs,$slots:n=>n.slots,$refs:n=>n.refs,$parent:n=>mf(n.parent),$root:n=>mf(n.root),$emit:n=>n.emit,$options:n=>Vd(n),$forceUpdate:n=>n.f||(n.f=()=>Fd(n.update)),$nextTick:n=>n.n||(n.n=Iv.bind(n.proxy)),$watch:n=>wb.bind(n)}),Kh=(n,e)=>n!==gt&&!n.__isScriptSetup&&st(n,e),Nb={get({_:n},e){const{ctx:t,setupState:i,data:s,props:r,accessCache:o,type:a,appContext:l}=n;let c;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return i[e];case 2:return s[e];case 4:return t[e];case 3:return r[e]}else{if(Kh(i,e))return o[e]=1,i[e];if(s!==gt&&st(s,e))return o[e]=2,s[e];if((c=n.propsOptions[0])&&st(c,e))return o[e]=3,r[e];if(t!==gt&&st(t,e))return o[e]=4,t[e];gf&&(o[e]=0)}}const h=la[e];let u,f;if(h)return e==="$attrs"&&Mn(n,"get",e),h(n);if((u=a.__cssModules)&&(u=u[e]))return u;if(t!==gt&&st(t,e))return o[e]=4,t[e];if(f=l.config.globalProperties,st(f,e))return f[e]},set({_:n},e,t){const{data:i,setupState:s,ctx:r}=n;return Kh(s,e)?(s[e]=t,!0):i!==gt&&st(i,e)?(i[e]=t,!0):st(n.props,e)||e[0]==="$"&&e.slice(1)in n?!1:(r[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:i,appContext:s,propsOptions:r}},o){let a;return!!t[o]||n!==gt&&st(n,o)||Kh(e,o)||(a=r[0])&&st(a,o)||st(i,o)||st(la,o)||st(s.config.globalProperties,o)},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:st(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};function rm(n){return Qe(n)?n.reduce((e,t)=>(e[t]=null,e),{}):n}let gf=!0;function $b(n){const e=Vd(n),t=n.proxy,i=n.ctx;gf=!1,e.beforeCreate&&om(e.beforeCreate,n,"bc");const{data:s,computed:r,methods:o,watch:a,provide:l,inject:c,created:h,beforeMount:u,mounted:f,beforeUpdate:d,updated:g,activated:O,deactivated:m,beforeDestroy:p,beforeUnmount:y,destroyed:S,unmounted:x,render:w,renderTracked:T,renderTriggered:C,errorCaptured:k,serverPrefetch:b,expose:E,inheritAttrs:j,components:ae,directives:Q,filters:W}=e;if(c&&Fb(c,i,null),o)for(const X in o){const z=o[X];Ye(z)&&(i[X]=z.bind(t))}if(s){const X=s.call(t,t);ft(X)&&(n.data=Dd(X))}if(gf=!0,r)for(const X in r){const z=r[X],se=Ye(z)?z.bind(t,t):Ye(z.get)?z.get.bind(t,t):ai,J=!Ye(z)&&Ye(z.set)?z.set.bind(t):ai,be=es({get:se,set:J});Object.defineProperty(i,X,{enumerable:!0,configurable:!0,get:()=>be.value,set:N=>be.value=N})}if(a)for(const X in a)Zv(a[X],i,t,X);if(l){const X=Ye(l)?l.call(t):l;Reflect.ownKeys(X).forEach(z=>{Gb(z,X[z])})}h&&om(h,n,"c");function K(X,z){Qe(z)?z.forEach(se=>X(se.bind(t))):z&&X(z.bind(t))}if(K(Pb,u),K(Xd,f),K(Cb,d),K(Rb,g),K(Tb,O),K(Eb,m),K(Ub,k),K(Db,T),K(Lb,C),K(zd,y),K(Wv,x),K(kb,b),Qe(E))if(E.length){const X=n.exposed||(n.exposed={});E.forEach(z=>{Object.defineProperty(X,z,{get:()=>t[z],set:se=>t[z]=se})})}else n.exposed||(n.exposed={});w&&n.render===ai&&(n.render=w),j!=null&&(n.inheritAttrs=j),ae&&(n.components=ae),Q&&(n.directives=Q)}function Fb(n,e,t=ai){Qe(n)&&(n=Of(n));for(const i in n){const s=n[i];let r;ft(s)?"default"in s?r=ca(s.from||i,s.default,!0):r=ca(s.from||i):r=ca(s),Ot(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[i]=r}}function om(n,e,t){li(Qe(n)?n.map(i=>i.bind(e.proxy)):n.bind(e.proxy),e,t)}function Zv(n,e,t,i){const s=i.includes(".")?Xv(t,i):()=>t[i];if(Lt(n)){const r=e[n];Ye(r)&&Ln(s,r)}else if(Ye(n))Ln(s,n.bind(t));else if(ft(n))if(Qe(n))n.forEach(r=>Zv(r,e,t,i));else{const r=Ye(n.handler)?n.handler.bind(t):e[n.handler];Ye(r)&&Ln(s,r,n)}}function Vd(n){const e=n.type,{mixins:t,extends:i}=e,{mixins:s,optionsCache:r,config:{optionMergeStrategies:o}}=n.appContext,a=r.get(e);let l;return a?l=a:!s.length&&!t&&!i?l=e:(l={},s.length&&s.forEach(c=>Pc(l,c,o,!0)),Pc(l,e,o)),ft(e)&&r.set(e,l),l}function Pc(n,e,t,i=!1){const{mixins:s,extends:r}=e;r&&Pc(n,r,t,!0),s&&s.forEach(o=>Pc(n,o,t,!0));for(const o in e)if(!(i&&o==="expose")){const a=Bb[o]||t&&t[o];n[o]=a?a(n[o],e[o]):e[o]}return n}const Bb={data:am,props:lm,emits:lm,methods:qo,computed:qo,beforeCreate:cn,created:cn,beforeMount:cn,mounted:cn,beforeUpdate:cn,updated:cn,beforeDestroy:cn,beforeUnmount:cn,destroyed:cn,unmounted:cn,activated:cn,deactivated:cn,errorCaptured:cn,serverPrefetch:cn,components:qo,directives:qo,watch:zb,provide:am,inject:Xb};function am(n,e){return e?n?function(){return Zt(Ye(n)?n.call(this,this):n,Ye(e)?e.call(this,this):e)}:e:n}function Xb(n,e){return qo(Of(n),Of(e))}function Of(n){if(Qe(n)){const e={};for(let t=0;t1)return t&&Ye(e)?e.call(i&&i.proxy):e}}function Zb(n,e,t,i=!1){const s={},r={};wc(r,wh,1),n.propsDefaults=Object.create(null),Yv(n,e,s,r);for(const o in n.propsOptions[0])o in s||(s[o]=void 0);t?n.props=i?s:ob(s):n.type.props?n.props=s:n.props=r,n.attrs=r}function Hb(n,e,t,i){const{props:s,attrs:r,vnode:{patchFlag:o}}=n,a=at(s),[l]=n.propsOptions;let c=!1;if((i||o>0)&&!(o&16)){if(o&8){const h=n.vnode.dynamicProps;for(let u=0;u{l=!0;const[f,d]=jv(u,e,!0);Zt(o,f),d&&a.push(...d)};!t&&e.mixins.length&&e.mixins.forEach(h),n.extends&&h(n.extends),n.mixins&&n.mixins.forEach(h)}if(!r&&!l)return ft(n)&&i.set(n,Kr),Kr;if(Qe(r))for(let h=0;h-1,d[1]=O<0||g-1||st(d,"default"))&&a.push(u)}}}const c=[o,a];return ft(n)&&i.set(n,c),c}function cm(n){return n[0]!=="$"}function hm(n){const e=n&&n.toString().match(/^\s*(function|class) (\w+)/);return e?e[2]:n===null?"null":""}function um(n,e){return hm(n)===hm(e)}function fm(n,e){return Qe(e)?e.findIndex(t=>um(t,n)):Ye(e)&&um(e,n)?0:-1}const qv=n=>n[0]==="_"||n==="$stable",Wd=n=>Qe(n)?n.map(Oi):[Oi(n)],Yb=(n,e,t)=>{if(e._n)return e;const i=_h((...s)=>Wd(e(...s)),t);return i._c=!1,i},Kv=(n,e,t)=>{const i=n._ctx;for(const s in n){if(qv(s))continue;const r=n[s];if(Ye(r))e[s]=Yb(s,r,i);else if(r!=null){const o=Wd(r);e[s]=()=>o}}},Jv=(n,e)=>{const t=Wd(e);n.slots.default=()=>t},jb=(n,e)=>{if(n.vnode.shapeFlag&32){const t=e._;t?(n.slots=at(e),wc(e,"_",t)):Kv(e,n.slots={})}else n.slots={},e&&Jv(n,e);wc(n.slots,wh,1)},qb=(n,e,t)=>{const{vnode:i,slots:s}=n;let r=!0,o=gt;if(i.shapeFlag&32){const a=e._;a?t&&a===1?r=!1:(Zt(s,e),!t&&a===1&&delete s._):(r=!e.$stable,Kv(e,s)),o=e}else e&&(Jv(n,e),o={default:1});if(r)for(const a in s)!qv(a)&&!(a in o)&&delete s[a]};function xf(n,e,t,i,s=!1){if(Qe(n)){n.forEach((f,d)=>xf(f,e&&(Qe(e)?e[d]:e),t,i,s));return}if(aa(i)&&!s)return;const r=i.shapeFlag&4?Th(i.component)||i.component.proxy:i.el,o=s?null:r,{i:a,r:l}=n,c=e&&e.r,h=a.refs===gt?a.refs={}:a.refs,u=a.setupState;if(c!=null&&c!==l&&(Lt(c)?(h[c]=null,st(u,c)&&(u[c]=null)):Ot(c)&&(c.value=null)),Ye(l))Os(l,a,12,[o,h]);else{const f=Lt(l),d=Ot(l);if(f||d){const g=()=>{if(n.f){const O=f?st(u,l)?u[l]:h[l]:l.value;s?Qe(O)&&Td(O,r):Qe(O)?O.includes(r)||O.push(r):f?(h[l]=[r],st(u,l)&&(u[l]=h[l])):(l.value=[r],n.k&&(h[n.k]=l.value))}else f?(h[l]=o,st(u,l)&&(u[l]=o)):d&&(l.value=o,n.k&&(h[n.k]=o))};o?(g.id=-1,Sn(g,t)):g()}}}const Sn=yb;function Kb(n){return Jb(n)}function Jb(n,e){const t=cf();t.__VUE__=!0;const{insert:i,remove:s,patchProp:r,createElement:o,createText:a,createComment:l,setText:c,setElementText:h,parentNode:u,nextSibling:f,setScopeId:d=ai,insertStaticContent:g}=n,O=(v,R,U,Z=null,B=null,ce=null,he=!1,q=null,ue=!!R.dynamicChildren)=>{if(v===R)return;v&&!$o(v,R)&&(Z=De(v),N(v,B,ce,!0),v=null),R.patchFlag===-2&&(ue=!1,R.dynamicChildren=null);const{type:le,ref:we,shapeFlag:M}=R;switch(le){case bh:m(v,R,U,Z);break;case bs:p(v,R,U,Z);break;case Jh:v==null&&y(R,U,Z,he);break;case fn:ae(v,R,U,Z,B,ce,he,q,ue);break;default:M&1?w(v,R,U,Z,B,ce,he,q,ue):M&6?Q(v,R,U,Z,B,ce,he,q,ue):(M&64||M&128)&&le.process(v,R,U,Z,B,ce,he,q,ue,Ue)}we!=null&&B&&xf(we,v&&v.ref,ce,R||v,!R)},m=(v,R,U,Z)=>{if(v==null)i(R.el=a(R.children),U,Z);else{const B=R.el=v.el;R.children!==v.children&&c(B,R.children)}},p=(v,R,U,Z)=>{v==null?i(R.el=l(R.children||""),U,Z):R.el=v.el},y=(v,R,U,Z)=>{[v.el,v.anchor]=g(v.children,R,U,Z,v.el,v.anchor)},S=({el:v,anchor:R},U,Z)=>{let B;for(;v&&v!==R;)B=f(v),i(v,U,Z),v=B;i(R,U,Z)},x=({el:v,anchor:R})=>{let U;for(;v&&v!==R;)U=f(v),s(v),v=U;s(R)},w=(v,R,U,Z,B,ce,he,q,ue)=>{he=he||R.type==="svg",v==null?T(R,U,Z,B,ce,he,q,ue):b(v,R,B,ce,he,q,ue)},T=(v,R,U,Z,B,ce,he,q)=>{let ue,le;const{type:we,props:M,shapeFlag:_,transition:I,dirs:ee}=v;if(ue=v.el=o(v.type,ce,M&&M.is,M),_&8?h(ue,v.children):_&16&&k(v.children,ue,null,Z,B,ce&&we!=="foreignObject",he,q),ee&&Is(v,null,Z,"created"),C(ue,v,v.scopeId,he,Z),M){for(const P in M)P!=="value"&&!ac(P)&&r(ue,P,null,M[P],ce,v.children,Z,B,Se);"value"in M&&r(ue,"value",null,M.value),(le=M.onVnodeBeforeMount)&&fi(le,Z,v)}ee&&Is(v,null,Z,"beforeMount");const oe=(!B||B&&!B.pendingBranch)&&I&&!I.persisted;oe&&I.beforeEnter(ue),i(ue,R,U),((le=M&&M.onVnodeMounted)||oe||ee)&&Sn(()=>{le&&fi(le,Z,v),oe&&I.enter(ue),ee&&Is(v,null,Z,"mounted")},B)},C=(v,R,U,Z,B)=>{if(U&&d(v,U),Z)for(let ce=0;ce{for(let le=ue;le{const q=R.el=v.el;let{patchFlag:ue,dynamicChildren:le,dirs:we}=R;ue|=v.patchFlag&16;const M=v.props||gt,_=R.props||gt;let I;U&&Qs(U,!1),(I=_.onVnodeBeforeUpdate)&&fi(I,U,R,v),we&&Is(R,v,U,"beforeUpdate"),U&&Qs(U,!0);const ee=B&&R.type!=="foreignObject";if(le?E(v.dynamicChildren,le,q,U,Z,ee,ce):he||z(v,R,q,null,U,Z,ee,ce,!1),ue>0){if(ue&16)j(q,R,M,_,U,Z,B);else if(ue&2&&M.class!==_.class&&r(q,"class",null,_.class,B),ue&4&&r(q,"style",M.style,_.style,B),ue&8){const oe=R.dynamicProps;for(let P=0;P{I&&fi(I,U,R,v),we&&Is(R,v,U,"updated")},Z)},E=(v,R,U,Z,B,ce,he)=>{for(let q=0;q{if(U!==Z){if(U!==gt)for(const q in U)!ac(q)&&!(q in Z)&&r(v,q,U[q],null,he,R.children,B,ce,Se);for(const q in Z){if(ac(q))continue;const ue=Z[q],le=U[q];ue!==le&&q!=="value"&&r(v,q,le,ue,he,R.children,B,ce,Se)}"value"in Z&&r(v,"value",U.value,Z.value)}},ae=(v,R,U,Z,B,ce,he,q,ue)=>{const le=R.el=v?v.el:a(""),we=R.anchor=v?v.anchor:a("");let{patchFlag:M,dynamicChildren:_,slotScopeIds:I}=R;I&&(q=q?q.concat(I):I),v==null?(i(le,U,Z),i(we,U,Z),k(R.children,U,we,B,ce,he,q,ue)):M>0&&M&64&&_&&v.dynamicChildren?(E(v.dynamicChildren,_,U,B,ce,he,q),(R.key!=null||B&&R===B.subTree)&&ex(v,R,!0)):z(v,R,U,we,B,ce,he,q,ue)},Q=(v,R,U,Z,B,ce,he,q,ue)=>{R.slotScopeIds=q,v==null?R.shapeFlag&512?B.ctx.activate(R,U,Z,he,ue):W(R,U,Z,B,ce,he,ue):G(v,R,ue)},W=(v,R,U,Z,B,ce,he)=>{const q=v.component=aw(v,Z,B);if(zv(v)&&(q.ctx.renderer=Ue),lw(q),q.asyncDep){if(B&&B.registerDep(q,K),!v.el){const ue=q.subTree=Qt(bs);p(null,ue,R,U)}return}K(q,v,R,U,B,ce,he)},G=(v,R,U)=>{const Z=R.component=v.component;if(xb(v,R,U))if(Z.asyncDep&&!Z.asyncResolved){X(Z,R,U);return}else Z.next=R,db(Z.update),Z.update();else R.el=v.el,Z.vnode=R},K=(v,R,U,Z,B,ce,he)=>{const q=()=>{if(v.isMounted){let{next:we,bu:M,u:_,parent:I,vnode:ee}=v,oe=we,P;Qs(v,!1),we?(we.el=ee.el,X(v,we,he)):we=ee,M&&lc(M),(P=we.props&&we.props.onVnodeBeforeUpdate)&&fi(P,I,we,ee),Qs(v,!0);const te=qh(v),fe=v.subTree;v.subTree=te,O(fe,te,u(fe.el),De(fe),v,B,ce),we.el=te.el,oe===null&&Sb(v,te.el),_&&Sn(_,B),(P=we.props&&we.props.onVnodeUpdated)&&Sn(()=>fi(P,I,we,ee),B)}else{let we;const{el:M,props:_}=R,{bm:I,m:ee,parent:oe}=v,P=aa(R);if(Qs(v,!1),I&&lc(I),!P&&(we=_&&_.onVnodeBeforeMount)&&fi(we,oe,R),Qs(v,!0),M&&We){const te=()=>{v.subTree=qh(v),We(M,v.subTree,v,B,null)};P?R.type.__asyncLoader().then(()=>!v.isUnmounted&&te()):te()}else{const te=v.subTree=qh(v);O(null,te,U,Z,v,B,ce),R.el=te.el}if(ee&&Sn(ee,B),!P&&(we=_&&_.onVnodeMounted)){const te=R;Sn(()=>fi(we,oe,te),B)}(R.shapeFlag&256||oe&&aa(oe.vnode)&&oe.vnode.shapeFlag&256)&&v.a&&Sn(v.a,B),v.isMounted=!0,R=U=Z=null}},ue=v.effect=new Cd(q,()=>Fd(le),v.scope),le=v.update=()=>ue.run();le.id=v.uid,Qs(v,!0),le()},X=(v,R,U)=>{R.component=v;const Z=v.vnode.props;v.vnode=R,v.next=null,Hb(v,R.props,Z,U),qb(v,R.children,U),ko(),im(),Lo()},z=(v,R,U,Z,B,ce,he,q,ue=!1)=>{const le=v&&v.children,we=v?v.shapeFlag:0,M=R.children,{patchFlag:_,shapeFlag:I}=R;if(_>0){if(_&128){J(le,M,U,Z,B,ce,he,q,ue);return}else if(_&256){se(le,M,U,Z,B,ce,he,q,ue);return}}I&8?(we&16&&Se(le,B,ce),M!==le&&h(U,M)):we&16?I&16?J(le,M,U,Z,B,ce,he,q,ue):Se(le,B,ce,!0):(we&8&&h(U,""),I&16&&k(M,U,Z,B,ce,he,q,ue))},se=(v,R,U,Z,B,ce,he,q,ue)=>{v=v||Kr,R=R||Kr;const le=v.length,we=R.length,M=Math.min(le,we);let _;for(_=0;_we?Se(v,B,ce,!0,!1,M):k(R,U,Z,B,ce,he,q,ue,M)},J=(v,R,U,Z,B,ce,he,q,ue)=>{let le=0;const we=R.length;let M=v.length-1,_=we-1;for(;le<=M&&le<=_;){const I=v[le],ee=R[le]=ue?ls(R[le]):Oi(R[le]);if($o(I,ee))O(I,ee,U,null,B,ce,he,q,ue);else break;le++}for(;le<=M&&le<=_;){const I=v[M],ee=R[_]=ue?ls(R[_]):Oi(R[_]);if($o(I,ee))O(I,ee,U,null,B,ce,he,q,ue);else break;M--,_--}if(le>M){if(le<=_){const I=_+1,ee=I_)for(;le<=M;)N(v[le],B,ce,!0),le++;else{const I=le,ee=le,oe=new Map;for(le=ee;le<=_;le++){const xe=R[le]=ue?ls(R[le]):Oi(R[le]);xe.key!=null&&oe.set(xe.key,le)}let P,te=0;const fe=_-ee+1;let H=!1,Ae=0;const Re=new Array(fe);for(le=0;le=fe){N(xe,B,ce,!0);continue}let _e;if(xe.key!=null)_e=oe.get(xe.key);else for(P=ee;P<=_;P++)if(Re[P-ee]===0&&$o(xe,R[P])){_e=P;break}_e===void 0?N(xe,B,ce,!0):(Re[_e-ee]=le+1,_e>=Ae?Ae=_e:H=!0,O(xe,R[_e],U,null,B,ce,he,q,ue),te++)}const ke=H?ew(Re):Kr;for(P=ke.length-1,le=fe-1;le>=0;le--){const xe=ee+le,_e=R[xe],Ne=xe+1{const{el:ce,type:he,transition:q,children:ue,shapeFlag:le}=v;if(le&6){be(v.component.subTree,R,U,Z);return}if(le&128){v.suspense.move(R,U,Z);return}if(le&64){he.move(v,R,U,Ue);return}if(he===fn){i(ce,R,U);for(let M=0;Mq.enter(ce),B);else{const{leave:M,delayLeave:_,afterLeave:I}=q,ee=()=>i(ce,R,U),oe=()=>{M(ce,()=>{ee(),I&&I()})};_?_(ce,ee,oe):oe()}else i(ce,R,U)},N=(v,R,U,Z=!1,B=!1)=>{const{type:ce,props:he,ref:q,children:ue,dynamicChildren:le,shapeFlag:we,patchFlag:M,dirs:_}=v;if(q!=null&&xf(q,null,U,v,!0),we&256){R.ctx.deactivate(v);return}const I=we&1&&_,ee=!aa(v);let oe;if(ee&&(oe=he&&he.onVnodeBeforeUnmount)&&fi(oe,R,v),we&6)Te(v.component,U,Z);else{if(we&128){v.suspense.unmount(U,Z);return}I&&Is(v,null,R,"beforeUnmount"),we&64?v.type.remove(v,R,U,B,Ue,Z):le&&(ce!==fn||M>0&&M&64)?Se(le,R,U,!1,!0):(ce===fn&&M&384||!B&&we&16)&&Se(ue,R,U),Z&&de(v)}(ee&&(oe=he&&he.onVnodeUnmounted)||I)&&Sn(()=>{oe&&fi(oe,R,v),I&&Is(v,null,R,"unmounted")},U)},de=v=>{const{type:R,el:U,anchor:Z,transition:B}=v;if(R===fn){pe(U,Z);return}if(R===Jh){x(v);return}const ce=()=>{s(U),B&&!B.persisted&&B.afterLeave&&B.afterLeave()};if(v.shapeFlag&1&&B&&!B.persisted){const{leave:he,delayLeave:q}=B,ue=()=>he(U,ce);q?q(v.el,ce,ue):ue()}else ce()},pe=(v,R)=>{let U;for(;v!==R;)U=f(v),s(v),v=U;s(R)},Te=(v,R,U)=>{const{bum:Z,scope:B,update:ce,subTree:he,um:q}=v;Z&&lc(Z),B.stop(),ce&&(ce.active=!1,N(he,v,R,U)),q&&Sn(q,R),Sn(()=>{v.isUnmounted=!0},R),R&&R.pendingBranch&&!R.isUnmounted&&v.asyncDep&&!v.asyncResolved&&v.suspenseId===R.pendingId&&(R.deps--,R.deps===0&&R.resolve())},Se=(v,R,U,Z=!1,B=!1,ce=0)=>{for(let he=ce;hev.shapeFlag&6?De(v.component.subTree):v.shapeFlag&128?v.suspense.next():f(v.anchor||v.el),ze=(v,R,U)=>{v==null?R._vnode&&N(R._vnode,null,null,!0):O(R._vnode||null,v,R,null,null,null,U),im(),Nv(),R._vnode=v},Ue={p:O,um:N,m:be,r:de,mt:W,mc:k,pc:z,pbc:E,n:De,o:n};let dt,We;return e&&([dt,We]=e(Ue)),{render:ze,hydrate:dt,createApp:Wb(ze,dt)}}function Qs({effect:n,update:e},t){n.allowRecurse=e.allowRecurse=t}function ex(n,e,t=!1){const i=n.children,s=e.children;if(Qe(i)&&Qe(s))for(let r=0;r>1,n[t[a]]0&&(e[i]=t[r-1]),t[r]=i)}}for(r=t.length,o=t[r-1];r-- >0;)t[r]=o,o=e[o];return t}const tw=n=>n.__isTeleport,fn=Symbol.for("v-fgt"),bh=Symbol.for("v-txt"),bs=Symbol.for("v-cmt"),Jh=Symbol.for("v-stc"),ha=[];let ri=null;function Ct(n=!1){ha.push(ri=n?null:[])}function nw(){ha.pop(),ri=ha[ha.length-1]||null}let _a=1;function dm(n){_a+=n}function tx(n){return n.dynamicChildren=_a>0?ri||Kr:null,nw(),_a>0&&ri&&ri.push(n),n}function gn(n,e,t,i,s,r){return tx(ve(n,e,t,i,s,r,!0))}function za(n,e,t,i,s){return tx(Qt(n,e,t,i,s,!0))}function Rc(n){return n?n.__v_isVNode===!0:!1}function $o(n,e){return n.type===e.type&&n.key===e.key}const wh="__vInternal",nx=({key:n})=>n??null,hc=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?Lt(n)||Ot(n)||Ye(n)?{i:On,r:n,k:e,f:!!t}:n:null);function ve(n,e=null,t=null,i=0,s=null,r=n===fn?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&nx(e),ref:e&&hc(e),scopeId:Bv,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:On};return a?(Gd(l,t),r&128&&n.normalize(l)):t&&(l.shapeFlag|=Lt(t)?8:16),_a>0&&!o&&ri&&(l.patchFlag>0||r&6)&&l.patchFlag!==32&&ri.push(l),l}const Qt=iw;function iw(n,e=null,t=null,i=0,s=null,r=!1){if((!n||n===Ib)&&(n=bs),Rc(n)){const a=mo(n,e,!0);return t&&Gd(a,t),_a>0&&!r&&ri&&(a.shapeFlag&6?ri[ri.indexOf(n)]=a:ri.push(a)),a.patchFlag|=-2,a}if(fw(n)&&(n=n.__vccOpts),e){e=ix(e);let{class:a,style:l}=e;a&&!Lt(a)&&(e.class=Ro(a)),ft(l)&&(Cv(l)&&!Qe(l)&&(l=Zt({},l)),e.style=Ba(l))}const o=Lt(n)?1:_b(n)?128:tw(n)?64:ft(n)?4:Ye(n)?2:0;return ve(n,e,t,i,s,o,r,!0)}function ix(n){return n?Cv(n)||wh in n?Zt({},n):n:null}function mo(n,e,t=!1){const{props:i,ref:s,patchFlag:r,children:o}=n,a=e?sw(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:n.type,props:a,key:a&&nx(a),ref:e&&e.ref?t&&s?Qe(s)?s.concat(hc(e)):[s,hc(e)]:hc(e):s,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:o,target:n.target,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==fn?r===-1?16:r|16:r,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:n.transition,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&mo(n.ssContent),ssFallback:n.ssFallback&&mo(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce}}function go(n=" ",e=0){return Qt(bh,null,n,e)}function Mh(n="",e=!1){return e?(Ct(),za(bs,null,n)):Qt(bs,null,n)}function Oi(n){return n==null||typeof n=="boolean"?Qt(bs):Qe(n)?Qt(fn,null,n.slice()):typeof n=="object"?ls(n):Qt(bh,null,String(n))}function ls(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:mo(n)}function Gd(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if(Qe(e))t=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),Gd(n,s()),s._c&&(s._d=!0));return}else{t=32;const s=e._;!s&&!(wh in e)?e._ctx=On:s===3&&On&&(On.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else Ye(e)?(e={default:e,_ctx:On},t=32):(e=String(e),i&64?(t=16,e=[go(e)]):t=8);n.children=e,n.shapeFlag|=t}function sw(...n){const e={};for(let t=0;tsn=n),Zd=n=>{_r.length>1?_r.forEach(e=>e(n)):_r[0](n)};const Oo=n=>{Zd(n),n.scope.on()},nr=()=>{sn&&sn.scope.off(),Zd(null)};function sx(n){return n.vnode.shapeFlag&4}let ya=!1;function lw(n,e=!1){ya=e;const{props:t,children:i}=n.vnode,s=sx(n);Zb(n,t,s,e),jb(n,i);const r=s?cw(n,e):void 0;return ya=!1,r}function cw(n,e){const t=n.type;n.accessCache=Object.create(null),n.proxy=Qd(new Proxy(n.ctx,Nb));const{setup:i}=t;if(i){const s=n.setupContext=i.length>1?uw(n):null;Oo(n),ko();const r=Os(i,n,0,[n.props,s]);if(Lo(),nr(),fv(r)){if(r.then(nr,nr),e)return r.then(o=>{mm(n,o,e)}).catch(o=>{xh(o,n,0)});n.asyncDep=r}else mm(n,r,e)}else rx(n,e)}function mm(n,e,t){Ye(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:ft(e)&&(n.setupState=Dv(e)),rx(n,t)}let gm;function rx(n,e,t){const i=n.type;if(!n.render){if(!e&&gm&&!i.render){const s=i.template||Vd(n).template;if(s){const{isCustomElement:r,compilerOptions:o}=n.appContext.config,{delimiters:a,compilerOptions:l}=i,c=Zt(Zt({isCustomElement:r,delimiters:a},o),l);i.render=gm(s,c)}}n.render=i.render||ai}Oo(n),ko(),$b(n),Lo(),nr()}function hw(n){return n.attrsProxy||(n.attrsProxy=new Proxy(n.attrs,{get(e,t){return Mn(n,"get","$attrs"),e[t]}}))}function uw(n){const e=t=>{n.exposed=t||{}};return{get attrs(){return hw(n)},slots:n.slots,emit:n.emit,expose:e}}function Th(n){if(n.exposed)return n.exposeProxy||(n.exposeProxy=new Proxy(Dv(Qd(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in la)return la[t](n)},has(e,t){return t in e||t in la}}))}function fw(n){return Ye(n)&&"__vccOpts"in n}const es=(n,e)=>hb(n,e,ya);function dw(n,e,t){const i=arguments.length;return i===2?ft(e)&&!Qe(e)?Rc(e)?Qt(n,null,[e]):Qt(n,e):Qt(n,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&Rc(t)&&(t=[t]),Qt(n,e,t))}const pw=Symbol.for("v-scx"),mw=()=>ca(pw),gw="3.3.4",Ow="http://www.w3.org/2000/svg",Gs=typeof document<"u"?document:null,Om=Gs&&Gs.createElement("template"),vw={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,i)=>{const s=e?Gs.createElementNS(Ow,n):Gs.createElement(n,t?{is:t}:void 0);return n==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:n=>Gs.createTextNode(n),createComment:n=>Gs.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>Gs.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,i,s,r){const o=t?t.previousSibling:e.lastChild;if(s&&(s===r||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),t),!(s===r||!(s=s.nextSibling)););else{Om.innerHTML=i?`${n}`:n;const a=Om.content;if(i){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}};function xw(n,e,t){const i=n._vtc;i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}function Sw(n,e,t){const i=n.style,s=Lt(t);if(t&&!s){if(e&&!Lt(e))for(const r in e)t[r]==null&&Sf(i,r,"");for(const r in t)Sf(i,r,t[r])}else{const r=i.display;s?e!==t&&(i.cssText=t):e&&n.removeAttribute("style"),"_vod"in n&&(i.display=r)}}const vm=/\s*!important$/;function Sf(n,e,t){if(Qe(t))t.forEach(i=>Sf(n,e,i));else if(t==null&&(t=""),e.startsWith("--"))n.setProperty(e,t);else{const i=_w(n,e);vm.test(t)?n.setProperty(Co(i),t.replace(vm,""),"important"):n[i]=t}}const xm=["Webkit","Moz","ms"],eu={};function _w(n,e){const t=eu[e];if(t)return t;let i=fo(e);if(i!=="filter"&&i in n)return eu[e]=i;i=mv(i);for(let s=0;stu||(Ew.then(()=>tu=0),tu=Date.now());function Pw(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;li(Cw(i,t.value),e,5,[i])};return t.value=n,t.attached=Aw(),t}function Cw(n,e){if(Qe(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(i=>s=>!s._stopped&&i&&i(s))}else return e}const ym=/^on[a-z]/,Rw=(n,e,t,i,s=!1,r,o,a,l)=>{e==="class"?xw(n,i,s):e==="style"?Sw(n,t,i):gh(e)?Md(e)||Mw(n,e,t,i,o):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):kw(n,e,i,s))?bw(n,e,i,r,o,a,l):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),yw(n,e,i,s))};function kw(n,e,t,i){return i?!!(e==="innerHTML"||e==="textContent"||e in n&&ym.test(e)&&Ye(t)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA"||ym.test(e)&&Lt(t)?!1:e in n}const vo=n=>{const e=n.props["onUpdate:modelValue"]||!1;return Qe(e)?t=>lc(e,t):e};function Lw(n){n.target.composing=!0}function bm(n){const e=n.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Gr={created(n,{modifiers:{lazy:e,trim:t,number:i}},s){n._assign=vo(s);const r=i||s.props&&s.props.type==="number";us(n,e?"change":"input",o=>{if(o.target.composing)return;let a=n.value;t&&(a=a.trim()),r&&(a=Mc(a)),n._assign(a)}),t&&us(n,"change",()=>{n.value=n.value.trim()}),e||(us(n,"compositionstart",Lw),us(n,"compositionend",bm),us(n,"change",bm))},mounted(n,{value:e}){n.value=e??""},beforeUpdate(n,{value:e,modifiers:{lazy:t,trim:i,number:s}},r){if(n._assign=vo(r),n.composing||document.activeElement===n&&n.type!=="range"&&(t||i&&n.value.trim()===e||(s||n.type==="number")&&Mc(n.value)===e))return;const o=e??"";n.value!==o&&(n.value=o)}},Dw={deep:!0,created(n,e,t){n._assign=vo(t),us(n,"change",()=>{const i=n._modelValue,s=ba(n),r=n.checked,o=n._assign;if(Qe(i)){const a=Ad(i,s),l=a!==-1;if(r&&!l)o(i.concat(s));else if(!r&&l){const c=[...i];c.splice(a,1),o(c)}}else if(Po(i)){const a=new Set(i);r?a.add(s):a.delete(s),o(a)}else o(ax(n,r))})},mounted:wm,beforeUpdate(n,e,t){n._assign=vo(t),wm(n,e,t)}};function wm(n,{value:e,oldValue:t},i){n._modelValue=e,Qe(e)?n.checked=Ad(e,i.props.value)>-1:Po(e)?n.checked=e.has(i.props.value):e!==t&&(n.checked=Xa(e,ax(n,!0)))}const ox={deep:!0,created(n,{value:e,modifiers:{number:t}},i){const s=Po(e);us(n,"change",()=>{const r=Array.prototype.filter.call(n.options,o=>o.selected).map(o=>t?Mc(ba(o)):ba(o));n._assign(n.multiple?s?new Set(r):r:r[0])}),n._assign=vo(i)},mounted(n,{value:e}){Mm(n,e)},beforeUpdate(n,e,t){n._assign=vo(t)},updated(n,{value:e}){Mm(n,e)}};function Mm(n,e){const t=n.multiple;if(!(t&&!Qe(e)&&!Po(e))){for(let i=0,s=n.options.length;i-1:r.selected=e.has(o);else if(Xa(ba(r),e)){n.selectedIndex!==i&&(n.selectedIndex=i);return}}!t&&n.selectedIndex!==-1&&(n.selectedIndex=-1)}}function ba(n){return"_value"in n?n._value:n.value}function ax(n,e){const t=e?"_trueValue":"_falseValue";return t in n?n[t]:e}const Uw=["ctrl","shift","alt","meta"],Iw={stop:n=>n.stopPropagation(),prevent:n=>n.preventDefault(),self:n=>n.target!==n.currentTarget,ctrl:n=>!n.ctrlKey,shift:n=>!n.shiftKey,alt:n=>!n.altKey,meta:n=>!n.metaKey,left:n=>"button"in n&&n.button!==0,middle:n=>"button"in n&&n.button!==1,right:n=>"button"in n&&n.button!==2,exact:(n,e)=>Uw.some(t=>n[`${t}Key`]&&!e.includes(t))},Eh=(n,e)=>(t,...i)=>{for(let s=0;s{const e=Nw().createApp(...n),{mount:t}=e;return e.mount=i=>{const s=Fw(i);if(!s)return;const r=e._component;!Ye(r)&&!r.render&&!r.template&&(r.template=s.innerHTML),s.innerHTML="";const o=t(s,!1,s instanceof SVGElement);return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e};function Fw(n){return Lt(n)?document.querySelector(n):n}var Bw=!1;/*! * pinia v2.1.3 * (c) 2023 Eduardo San Martin Morote * @license MIT - */const Xw=Symbol();var Em;(function(n){n.direct="direct",n.patchObject="patch object",n.patchFunction="patch function"})(Em||(Em={}));function zw(){const n=Cy(!0),e=n.run(()=>Lt({}));let t=[],i=[];const s=Qd({install(r){s._a=r,r.provide(Xw,s),r.config.globalProperties.$pinia=s,i.forEach(o=>t.push(o)),i=[]},use(r){return!this._a&&!Bw?i.push(r):t.push(r),this},_p:t,_a:null,_e:n,_s:new Map,state:e});return s}/** + */const Xw=Symbol();var Em;(function(n){n.direct="direct",n.patchObject="patch object",n.patchFunction="patch function"})(Em||(Em={}));function zw(){const n=Ry(!0),e=n.run(()=>$t({}));let t=[],i=[];const s=Qd({install(r){s._a=r,r.provide(Xw,s),r.config.globalProperties.$pinia=s,i.forEach(o=>t.push(o)),i=[]},use(r){return!this._a&&!Bw?i.push(r):t.push(r),this},_p:t,_a:null,_e:n,_s:new Map,state:e});return s}/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const Hd="153",_r={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},yr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Vw=0,Am=1,Ww=2,lx=1,Gw=2,Xi=3,ws=0,wn=1,Wi=2,vs=0,to=1,Pm=2,Cm=3,Rm=4,Zw=5,Br=100,Hw=101,Yw=102,km=103,Lm=104,jw=200,qw=201,Kw=202,Jw=203,cx=204,hx=205,eM=206,tM=207,nM=208,iM=209,sM=210,rM=0,oM=1,aM=2,_f=3,lM=4,cM=5,hM=6,uM=7,ux=0,fM=1,dM=2,Zi=0,pM=1,mM=2,gM=3,OM=4,vM=5,fx=300,vo=301,xo=302,yf=303,bf=304,Ah=306,wf=1e3,ii=1001,Mf=1002,un=1003,Dm=1004,nu=1005,Fn=1006,xM=1007,wa=1008,xs=1009,SM=1010,_M=1011,Yd=1012,dx=1013,ds=1014,ps=1015,Ma=1016,px=1017,mx=1018,ir=1020,yM=1021,si=1023,bM=1024,wM=1025,sr=1026,So=1027,MM=1028,gx=1029,TM=1030,Ox=1031,vx=1033,iu=33776,su=33777,ru=33778,ou=33779,Um=35840,Im=35841,Qm=35842,Nm=35843,EM=36196,$m=37492,Fm=37496,Bm=37808,Xm=37809,zm=37810,Vm=37811,Wm=37812,Gm=37813,Zm=37814,Hm=37815,Ym=37816,jm=37817,qm=37818,Km=37819,Jm=37820,eg=37821,au=36492,AM=36283,tg=36284,ng=36285,ig=36286,xx=3e3,rr=3001,PM=3200,CM=3201,RM=0,kM=1,or="",He="srgb",Ri="srgb-linear",Sx="display-p3",lu=7680,LM=519,DM=512,UM=513,IM=514,QM=515,NM=516,$M=517,FM=518,BM=519,sg=35044,rg="300 es",Tf=1035,Gi=2e3,kc=2001;class Or{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r>8&255]+Jt[n>>16&255]+Jt[n>>24&255]+"-"+Jt[e&255]+Jt[e>>8&255]+"-"+Jt[e>>16&15|64]+Jt[e>>24&255]+"-"+Jt[t&63|128]+Jt[t>>8&255]+"-"+Jt[t>>16&255]+Jt[t>>24&255]+Jt[i&255]+Jt[i>>8&255]+Jt[i>>16&255]+Jt[i>>24&255]).toLowerCase()}function dn(n,e,t){return Math.max(e,Math.min(t,n))}function XM(n,e){return(n%e+e)%e}function hu(n,e,t){return(1-t)*n+t*e}function og(n){return(n&n-1)===0&&n!==0}function Af(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function pl(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function An(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}class Ge{constructor(e=0,t=0){Ge.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(dn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class qe{constructor(e,t,i,s,r,o,a,l,c){qe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,c)}set(e,t,i,s,r,o,a,l,c){const h=this.elements;return h[0]=e,h[1]=s,h[2]=a,h[3]=t,h[4]=r,h[5]=l,h[6]=i,h[7]=o,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],h=i[4],u=i[7],f=i[2],d=i[5],g=i[8],O=s[0],m=s[3],p=s[6],y=s[1],S=s[4],x=s[7],w=s[2],T=s[5],C=s[8];return r[0]=o*O+a*y+l*w,r[3]=o*m+a*S+l*T,r[6]=o*p+a*x+l*C,r[1]=c*O+h*y+u*w,r[4]=c*m+h*S+u*T,r[7]=c*p+h*x+u*C,r[2]=f*O+d*y+g*w,r[5]=f*m+d*S+g*T,r[8]=f*p+d*x+g*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-i*r*h+i*a*l+s*r*c-s*o*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=h*o-a*c,f=a*l-h*r,d=c*r-o*l,g=t*u+i*f+s*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const O=1/g;return e[0]=u*O,e[1]=(s*c-h*i)*O,e[2]=(a*i-s*o)*O,e[3]=f*O,e[4]=(h*t-s*l)*O,e[5]=(s*r-a*t)*O,e[6]=d*O,e[7]=(i*l-c*t)*O,e[8]=(o*t-i*r)*O,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,s,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-s*c,s*l,-s*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(uu.makeScale(e,t)),this}rotate(e){return this.premultiply(uu.makeRotation(-e)),this}translate(e,t){return this.premultiply(uu.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const uu=new qe;function _x(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Lc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const ag={};function ua(n){n in ag||(ag[n]=!0,console.warn(n))}function no(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function fu(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const zM=new qe().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),VM=new qe().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function WM(n){return n.convertSRGBToLinear().applyMatrix3(VM)}function GM(n){return n.applyMatrix3(zM).convertLinearToSRGB()}const ZM={[Ri]:n=>n,[He]:n=>n.convertSRGBToLinear(),[Sx]:WM},HM={[Ri]:n=>n,[He]:n=>n.convertLinearToSRGB(),[Sx]:GM},Yn={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return Ri},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=ZM[e],s=HM[t];if(i===void 0||s===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return s(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let br;class yx{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{br===void 0&&(br=Lc("canvas")),br.width=e.width,br.height=e.height;const i=br.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=br}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Lc("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==fx)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case wf:e.x=e.x-Math.floor(e.x);break;case ii:e.x=e.x<0?0:1;break;case Mf:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case wf:e.y=e.y-Math.floor(e.y);break;case ii:e.y=e.y<0?0:1;break;case Mf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return ua("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===He?rr:xx}set encoding(e){ua("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===rr?He:or}}Nn.DEFAULT_IMAGE=null;Nn.DEFAULT_MAPPING=fx;Nn.DEFAULT_ANISOTROPY=1;class Wt{constructor(e=0,t=0,i=0,s=1){Wt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,s,r;const l=e.elements,c=l[0],h=l[4],u=l[8],f=l[1],d=l[5],g=l[9],O=l[2],m=l[6],p=l[10];if(Math.abs(h-f)<.01&&Math.abs(u-O)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+f)<.1&&Math.abs(u+O)<.1&&Math.abs(g+m)<.1&&Math.abs(c+d+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const S=(c+1)/2,x=(d+1)/2,w=(p+1)/2,T=(h+f)/4,C=(u+O)/4,k=(g+m)/4;return S>x&&S>w?S<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(S),s=T/i,r=C/i):x>w?x<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(x),i=T/s,r=k/s):w<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(w),i=C/r,s=k/r),this.set(i,s,r,t),this}let y=Math.sqrt((m-g)*(m-g)+(u-O)*(u-O)+(f-h)*(f-h));return Math.abs(y)<.001&&(y=1),this.x=(m-g)/y,this.y=(u-O)/y,this.z=(f-h)/y,this.w=Math.acos((c+d+p-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ur extends Or{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Wt(0,0,e,t),this.scissorTest=!1,this.viewport=new Wt(0,0,e,t);const s={width:e,height:t,depth:1};i.encoding!==void 0&&(ua("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===rr?He:or),this.texture=new Nn(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:Fn,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new bx(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class wx extends Nn{constructor(e=null,t=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=un,this.minFilter=un,this.wrapR=ii,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class qM extends Nn{constructor(e=null,t=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=un,this.minFilter=un,this.wrapR=ii,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class fr{constructor(e=0,t=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=s}static slerpFlat(e,t,i,s,r,o,a){let l=i[s+0],c=i[s+1],h=i[s+2],u=i[s+3];const f=r[o+0],d=r[o+1],g=r[o+2],O=r[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(a===1){e[t+0]=f,e[t+1]=d,e[t+2]=g,e[t+3]=O;return}if(u!==O||l!==f||c!==d||h!==g){let m=1-a;const p=l*f+c*d+h*g+u*O,y=p>=0?1:-1,S=1-p*p;if(S>Number.EPSILON){const w=Math.sqrt(S),T=Math.atan2(w,p*y);m=Math.sin(m*T)/w,a=Math.sin(a*T)/w}const x=a*y;if(l=l*m+f*x,c=c*m+d*x,h=h*m+g*x,u=u*m+O*x,m===1-a){const w=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=w,c*=w,h*=w,u*=w}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],c=i[s+2],h=i[s+3],u=r[o],f=r[o+1],d=r[o+2],g=r[o+3];return e[t]=a*g+h*u+l*d-c*f,e[t+1]=l*g+h*f+c*u-a*d,e[t+2]=c*g+h*d+a*f-l*u,e[t+3]=h*g-a*u-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),h=a(s/2),u=a(r/2),f=l(i/2),d=l(s/2),g=l(r/2);switch(o){case"XYZ":this._x=f*h*u+c*d*g,this._y=c*d*u-f*h*g,this._z=c*h*g+f*d*u,this._w=c*h*u-f*d*g;break;case"YXZ":this._x=f*h*u+c*d*g,this._y=c*d*u-f*h*g,this._z=c*h*g-f*d*u,this._w=c*h*u+f*d*g;break;case"ZXY":this._x=f*h*u-c*d*g,this._y=c*d*u+f*h*g,this._z=c*h*g+f*d*u,this._w=c*h*u-f*d*g;break;case"ZYX":this._x=f*h*u-c*d*g,this._y=c*d*u+f*h*g,this._z=c*h*g-f*d*u,this._w=c*h*u+f*d*g;break;case"YZX":this._x=f*h*u+c*d*g,this._y=c*d*u+f*h*g,this._z=c*h*g-f*d*u,this._w=c*h*u-f*d*g;break;case"XZY":this._x=f*h*u-c*d*g,this._y=c*d*u-f*h*g,this._z=c*h*g+f*d*u,this._w=c*h*u+f*d*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],h=t[6],u=t[10],f=i+a+u;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(h-l)*d,this._y=(r-c)*d,this._z=(o-s)*d}else if(i>a&&i>u){const d=2*Math.sqrt(1+i-a-u);this._w=(h-l)/d,this._x=.25*d,this._y=(s+o)/d,this._z=(r+c)/d}else if(a>u){const d=2*Math.sqrt(1+a-i-u);this._w=(r-c)/d,this._x=(s+o)/d,this._y=.25*d,this._z=(l+h)/d}else{const d=2*Math.sqrt(1+u-i-a);this._w=(o-s)/d,this._x=(r+c)/d,this._y=(l+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,h=t._w;return this._x=i*h+o*a+s*c-r*l,this._y=s*h+o*l+r*a-i*c,this._z=r*h+o*c+i*l-s*a,this._w=o*h-i*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*i+t*this._x,this._y=d*s+t*this._y,this._z=d*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),h=Math.atan2(c,a),u=Math.sin((1-t)*h)/c,f=Math.sin(t*h)/c;return this._w=o*u+this._w*f,this._x=i*u+this._x*f,this._y=s*u+this._y*f,this._z=r*u+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),s=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(s),i*Math.sin(r),i*Math.cos(r),t*Math.sin(s))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,i=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(lg.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(lg.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*s-a*i,h=l*i+a*t-r*s,u=l*s+r*i-o*t,f=-r*t-o*i-a*s;return this.x=c*l+f*-r+h*-a-u*-o,this.y=h*l+f*-o+u*-r-c*-a,this.z=u*l+f*-a+c*-o-h*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return pu.copy(this).projectOnVector(e),this.sub(pu)}reflect(e){return this.sub(pu.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(dn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const pu=new F,lg=new fr;class Wa{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Qi),Qi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Fo),ml.subVectors(this.max,Fo),Mr.subVectors(e.a,Fo),Tr.subVectors(e.b,Fo),Er.subVectors(e.c,Fo),ss.subVectors(Tr,Mr),rs.subVectors(Er,Tr),Ns.subVectors(Mr,Er);let t=[0,-ss.z,ss.y,0,-rs.z,rs.y,0,-Ns.z,Ns.y,ss.z,0,-ss.x,rs.z,0,-rs.x,Ns.z,0,-Ns.x,-ss.y,ss.x,0,-rs.y,rs.x,0,-Ns.y,Ns.x,0];return!mu(t,Mr,Tr,Er,ml)||(t=[1,0,0,0,1,0,0,0,1],!mu(t,Mr,Tr,Er,ml))?!1:(gl.crossVectors(ss,rs),t=[gl.x,gl.y,gl.z],mu(t,Mr,Tr,Er,ml))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Qi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Qi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ii[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ii[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ii[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ii[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ii[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ii[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ii[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ii[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ii),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Ii=[new F,new F,new F,new F,new F,new F,new F,new F],Qi=new F,wr=new Wa,Mr=new F,Tr=new F,Er=new F,ss=new F,rs=new F,Ns=new F,Fo=new F,ml=new F,gl=new F,$s=new F;function mu(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){$s.fromArray(n,r);const a=s.x*Math.abs($s.x)+s.y*Math.abs($s.y)+s.z*Math.abs($s.z),l=e.dot($s),c=t.dot($s),h=i.dot($s);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}const KM=new Wa,Bo=new F,gu=new F;class jd{constructor(e=new F,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):KM.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Bo.subVectors(e,this.center);const t=Bo.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(Bo,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(gu.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Bo.copy(e.center).add(gu)),this.expandByPoint(Bo.copy(e.center).sub(gu))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ni=new F,Ou=new F,Ol=new F,os=new F,vu=new F,vl=new F,xu=new F;class JM{constructor(e=new F,t=new F(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ni)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ni.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ni.copy(this.origin).addScaledVector(this.direction,t),Ni.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Ou.copy(e).add(t).multiplyScalar(.5),Ol.copy(t).sub(e).normalize(),os.copy(this.origin).sub(Ou);const r=e.distanceTo(t)*.5,o=-this.direction.dot(Ol),a=os.dot(this.direction),l=-os.dot(Ol),c=os.lengthSq(),h=Math.abs(1-o*o);let u,f,d,g;if(h>0)if(u=o*l-a,f=o*a-l,g=r*h,u>=0)if(f>=-g)if(f<=g){const O=1/h;u*=O,f*=O,d=u*(u+o*f+2*a)+f*(o*u+f+2*l)+c}else f=r,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*l)+c;else f=-r,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*l)+c;else f<=-g?(u=Math.max(0,-(-o*r+a)),f=u>0?-r:Math.min(Math.max(-r,-l),r),d=-u*u+f*(f+2*l)+c):f<=g?(u=0,f=Math.min(Math.max(-r,-l),r),d=f*(f+2*l)+c):(u=Math.max(0,-(o*r+a)),f=u>0?r:Math.min(Math.max(-r,-l),r),d=-u*u+f*(f+2*l)+c);else f=o>0?-r:r,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,u),s&&s.copy(Ou).addScaledVector(Ol,f),d}intersectSphere(e,t){Ni.subVectors(e.center,this.origin);const i=Ni.dot(this.direction),s=Ni.dot(Ni)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,s=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,s=(e.min.x-f.x)*c),h>=0?(r=(e.min.y-f.y)*h,o=(e.max.y-f.y)*h):(r=(e.max.y-f.y)*h,o=(e.min.y-f.y)*h),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(a=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,Ni)!==null}intersectTriangle(e,t,i,s,r){vu.subVectors(t,e),vl.subVectors(i,e),xu.crossVectors(vu,vl);let o=this.direction.dot(xu),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;os.subVectors(this.origin,e);const l=a*this.direction.dot(vl.crossVectors(os,vl));if(l<0)return null;const c=a*this.direction.dot(vu.cross(os));if(c<0||l+c>o)return null;const h=-a*os.dot(xu);return h<0?null:this.at(h/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Tt{constructor(e,t,i,s,r,o,a,l,c,h,u,f,d,g,O,m){Tt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,c,h,u,f,d,g,O,m)}set(e,t,i,s,r,o,a,l,c,h,u,f,d,g,O,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=i,p[12]=s,p[1]=r,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=h,p[10]=u,p[14]=f,p[3]=d,p[7]=g,p[11]=O,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Tt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/Ar.setFromMatrixColumn(e,0).length(),r=1/Ar.setFromMatrixColumn(e,1).length(),o=1/Ar.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),c=Math.sin(s),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const f=o*h,d=o*u,g=a*h,O=a*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=d+g*c,t[5]=f-O*c,t[9]=-a*l,t[2]=O-f*c,t[6]=g+d*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*h,d=l*u,g=c*h,O=c*u;t[0]=f+O*a,t[4]=g*a-d,t[8]=o*c,t[1]=o*u,t[5]=o*h,t[9]=-a,t[2]=d*a-g,t[6]=O+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*h,d=l*u,g=c*h,O=c*u;t[0]=f-O*a,t[4]=-o*u,t[8]=g+d*a,t[1]=d+g*a,t[5]=o*h,t[9]=O-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*h,d=o*u,g=a*h,O=a*u;t[0]=l*h,t[4]=g*c-d,t[8]=f*c+O,t[1]=l*u,t[5]=O*c+f,t[9]=d*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,d=o*c,g=a*l,O=a*c;t[0]=l*h,t[4]=O-f*u,t[8]=g*u+d,t[1]=u,t[5]=o*h,t[9]=-a*h,t[2]=-c*h,t[6]=d*u+g,t[10]=f-O*u}else if(e.order==="XZY"){const f=o*l,d=o*c,g=a*l,O=a*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=f*u+O,t[5]=o*h,t[9]=d*u-g,t[2]=g*u-d,t[6]=a*h,t[10]=O*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(eT,e,tT)}lookAt(e,t,i){const s=this.elements;return Pn.subVectors(e,t),Pn.lengthSq()===0&&(Pn.z=1),Pn.normalize(),as.crossVectors(i,Pn),as.lengthSq()===0&&(Math.abs(i.z)===1?Pn.x+=1e-4:Pn.z+=1e-4,Pn.normalize(),as.crossVectors(i,Pn)),as.normalize(),xl.crossVectors(Pn,as),s[0]=as.x,s[4]=xl.x,s[8]=Pn.x,s[1]=as.y,s[5]=xl.y,s[9]=Pn.y,s[2]=as.z,s[6]=xl.z,s[10]=Pn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],h=i[1],u=i[5],f=i[9],d=i[13],g=i[2],O=i[6],m=i[10],p=i[14],y=i[3],S=i[7],x=i[11],w=i[15],T=s[0],C=s[4],k=s[8],b=s[12],E=s[1],j=s[5],ae=s[9],Q=s[13],W=s[2],G=s[6],K=s[10],X=s[14],z=s[3],se=s[7],J=s[11],be=s[15];return r[0]=o*T+a*E+l*W+c*z,r[4]=o*C+a*j+l*G+c*se,r[8]=o*k+a*ae+l*K+c*J,r[12]=o*b+a*Q+l*X+c*be,r[1]=h*T+u*E+f*W+d*z,r[5]=h*C+u*j+f*G+d*se,r[9]=h*k+u*ae+f*K+d*J,r[13]=h*b+u*Q+f*X+d*be,r[2]=g*T+O*E+m*W+p*z,r[6]=g*C+O*j+m*G+p*se,r[10]=g*k+O*ae+m*K+p*J,r[14]=g*b+O*Q+m*X+p*be,r[3]=y*T+S*E+x*W+w*z,r[7]=y*C+S*j+x*G+w*se,r[11]=y*k+S*ae+x*K+w*J,r[15]=y*b+S*Q+x*X+w*be,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],h=e[2],u=e[6],f=e[10],d=e[14],g=e[3],O=e[7],m=e[11],p=e[15];return g*(+r*l*u-s*c*u-r*a*f+i*c*f+s*a*d-i*l*d)+O*(+t*l*d-t*c*f+r*o*f-s*o*d+s*c*h-r*l*h)+m*(+t*c*u-t*a*d-r*o*u+i*o*d+r*a*h-i*c*h)+p*(-s*a*h-t*l*u+t*a*f+s*o*u-i*o*f+i*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=e[9],f=e[10],d=e[11],g=e[12],O=e[13],m=e[14],p=e[15],y=u*m*c-O*f*c+O*l*d-a*m*d-u*l*p+a*f*p,S=g*f*c-h*m*c-g*l*d+o*m*d+h*l*p-o*f*p,x=h*O*c-g*u*c+g*a*d-o*O*d-h*a*p+o*u*p,w=g*u*l-h*O*l-g*a*f+o*O*f+h*a*m-o*u*m,T=t*y+i*S+s*x+r*w;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/T;return e[0]=y*C,e[1]=(O*f*r-u*m*r-O*s*d+i*m*d+u*s*p-i*f*p)*C,e[2]=(a*m*r-O*l*r+O*s*c-i*m*c-a*s*p+i*l*p)*C,e[3]=(u*l*r-a*f*r-u*s*c+i*f*c+a*s*d-i*l*d)*C,e[4]=S*C,e[5]=(h*m*r-g*f*r+g*s*d-t*m*d-h*s*p+t*f*p)*C,e[6]=(g*l*r-o*m*r-g*s*c+t*m*c+o*s*p-t*l*p)*C,e[7]=(o*f*r-h*l*r+h*s*c-t*f*c-o*s*d+t*l*d)*C,e[8]=x*C,e[9]=(g*u*r-h*O*r-g*i*d+t*O*d+h*i*p-t*u*p)*C,e[10]=(o*O*r-g*a*r+g*i*c-t*O*c-o*i*p+t*a*p)*C,e[11]=(h*a*r-o*u*r-h*i*c+t*u*c+o*i*d-t*a*d)*C,e[12]=w*C,e[13]=(h*O*s-g*u*s+g*i*f-t*O*f-h*i*m+t*u*m)*C,e[14]=(g*a*s-o*O*s-g*i*l+t*O*l+o*i*m-t*a*m)*C,e[15]=(o*u*s-h*a*s+h*i*l-t*u*l-o*i*f+t*a*f)*C,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,l=e.z,c=r*o,h=r*a;return this.set(c*o+i,c*a-s*l,c*l+s*a,0,c*a+s*l,h*a+i,h*l-s*o,0,c*l-s*a,h*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,h=o+o,u=a+a,f=r*c,d=r*h,g=r*u,O=o*h,m=o*u,p=a*u,y=l*c,S=l*h,x=l*u,w=i.x,T=i.y,C=i.z;return s[0]=(1-(O+p))*w,s[1]=(d+x)*w,s[2]=(g-S)*w,s[3]=0,s[4]=(d-x)*T,s[5]=(1-(f+p))*T,s[6]=(m+y)*T,s[7]=0,s[8]=(g+S)*C,s[9]=(m-y)*C,s[10]=(1-(f+O))*C,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=Ar.set(s[0],s[1],s[2]).length();const o=Ar.set(s[4],s[5],s[6]).length(),a=Ar.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],jn.copy(this);const c=1/r,h=1/o,u=1/a;return jn.elements[0]*=c,jn.elements[1]*=c,jn.elements[2]*=c,jn.elements[4]*=h,jn.elements[5]*=h,jn.elements[6]*=h,jn.elements[8]*=u,jn.elements[9]*=u,jn.elements[10]*=u,t.setFromRotationMatrix(jn),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o,a=Gi){const l=this.elements,c=2*r/(t-e),h=2*r/(i-s),u=(t+e)/(t-e),f=(i+s)/(i-s);let d,g;if(a===Gi)d=-(o+r)/(o-r),g=-2*o*r/(o-r);else if(a===kc)d=-o/(o-r),g=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=d,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,o,a=Gi){const l=this.elements,c=1/(t-e),h=1/(i-s),u=1/(o-r),f=(t+e)*c,d=(i+s)*h;let g,O;if(a===Gi)g=(o+r)*u,O=-2*u;else if(a===kc)g=r*u,O=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-d,l[2]=0,l[6]=0,l[10]=O,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Ar=new F,jn=new Tt,eT=new F(0,0,0),tT=new F(1,1,1),as=new F,xl=new F,Pn=new F,cg=new Tt,hg=new fr;class Ph{constructor(e=0,t=0,i=0,s=Ph.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],l=s[1],c=s[5],h=s[9],u=s[2],f=s[6],d=s[10];switch(t){case"XYZ":this._y=Math.asin(dn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-dn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(dn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-dn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(dn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-dn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return cg.makeRotationFromQuaternion(e),this.setFromRotationMatrix(cg,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return hg.setFromEuler(this),this.setFromQuaternion(hg,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ph.DEFAULT_ORDER="XYZ";class Mx{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xo,e,iT),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xo,sT,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,s=t.length;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON()));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),h.length>0&&(i.images=h),u.length>0&&(i.shapes=u),f.length>0&&(i.skeletons=f),d.length>0&&(i.animations=d),g.length>0&&(i.nodes=g)}return i.object=s,i;function o(a){const l=[];for(const c in a){const h=a[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){qn.subVectors(s,t),Fi.subVectors(i,t),Su.subVectors(e,t);const o=qn.dot(qn),a=qn.dot(Fi),l=qn.dot(Su),c=Fi.dot(Fi),h=Fi.dot(Su),u=o*c-a*a;if(u===0)return r.set(-2,-1,-1);const f=1/u,d=(c*l-a*h)*f,g=(o*h-a*l)*f;return r.set(1-d-g,g,d)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,Bi),Bi.x>=0&&Bi.y>=0&&Bi.x+Bi.y<=1}static getUV(e,t,i,s,r,o,a,l){return _l===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),_l=!0),this.getInterpolation(e,t,i,s,r,o,a,l)}static getInterpolation(e,t,i,s,r,o,a,l){return this.getBarycoord(e,t,i,s,Bi),l.setScalar(0),l.addScaledVector(r,Bi.x),l.addScaledVector(o,Bi.y),l.addScaledVector(a,Bi.z),l}static isFrontFacing(e,t,i,s){return qn.subVectors(i,t),Fi.subVectors(e,t),qn.cross(Fi).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return qn.subVectors(this.c,this.b),Fi.subVectors(this.a,this.b),qn.cross(Fi).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ti.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ti.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,s,r){return _l===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),_l=!0),ti.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}getInterpolation(e,t,i,s,r){return ti.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return ti.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ti.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,r=this.c;let o,a;Cr.subVectors(s,i),Rr.subVectors(r,i),_u.subVectors(e,i);const l=Cr.dot(_u),c=Rr.dot(_u);if(l<=0&&c<=0)return t.copy(i);yu.subVectors(e,s);const h=Cr.dot(yu),u=Rr.dot(yu);if(h>=0&&u<=h)return t.copy(s);const f=l*u-h*c;if(f<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(i).addScaledVector(Cr,o);bu.subVectors(e,r);const d=Cr.dot(bu),g=Rr.dot(bu);if(g>=0&&d<=g)return t.copy(r);const O=d*c-l*g;if(O<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(Rr,a);const m=h*g-d*u;if(m<=0&&u-h>=0&&d-g>=0)return gg.subVectors(r,s),a=(u-h)/(u-h+(d-g)),t.copy(s).addScaledVector(gg,a);const p=1/(m+O+f);return o=O*p,a=f*p,t.copy(i).addScaledVector(Cr,o).addScaledVector(Rr,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let oT=0;class Ch extends Or{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:oT++}),this.uuid=Va(),this.name="",this.type="Material",this.blending=to,this.side=ws,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=cx,this.blendDst=hx,this.blendEquation=Br,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=_f,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=LM,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=lu,this.stencilZFail=lu,this.stencilZPass=lu,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==to&&(i.blending=this.blending),this.side!==ws&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const Tx={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Kn={h:0,s:0,l:0},yl={h:0,s:0,l:0};function wu(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ct{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=He){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Yn.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=Yn.workingColorSpace){return this.r=e,this.g=t,this.b=i,Yn.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=Yn.workingColorSpace){if(e=XM(e,1),t=dn(t,0,1),i=dn(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=wu(o,r,e+1/3),this.g=wu(o,r,e),this.b=wu(o,r,e-1/3)}return Yn.toWorkingColorSpace(this,s),this}setStyle(e,t=He){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=He){const i=Tx[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=no(e.r),this.g=no(e.g),this.b=no(e.b),this}copyLinearToSRGB(e){return this.r=fu(e.r),this.g=fu(e.g),this.b=fu(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=He){return Yn.fromWorkingColorSpace(en.copy(this),e),Math.round(dn(en.r*255,0,255))*65536+Math.round(dn(en.g*255,0,255))*256+Math.round(dn(en.b*255,0,255))}getHexString(e=He){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Yn.workingColorSpace){Yn.fromWorkingColorSpace(en.copy(this),t);const i=en.r,s=en.g,r=en.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,c;const h=(a+o)/2;if(a===o)l=0,c=0;else{const u=o-a;switch(c=h<=.5?u/(o+a):u/(2-o-a),o){case i:l=(s-r)/u+(s0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,f=c.length;u0&&(s[l]=h,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const s=e.attributes;for(const c in s){const h=s[c];this.setAttribute(c,h.clone(t))}const r=e.morphAttributes;for(const c in r){const h=[],u=r[c];for(let f=0,d=u.length;f0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(Og.copy(r).invert(),Fs.copy(e.ray).applyMatrix4(Og),!(i.boundingBox!==null&&Fs.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Fs)))}_computeIntersections(e,t,i){let s;const r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,c=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,f=r.groups,d=r.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,O=f.length;gt.far?null:{distance:c,point:Cl.clone(),object:n}}function Rl(n,e,t,i,s,r,o,a,l,c){n.getVertexPosition(a,Lr),n.getVertexPosition(l,Dr),n.getVertexPosition(c,Ur);const h=lT(n,e,t,i,Lr,Dr,Ur,Pl);if(h){s&&(Tl.fromBufferAttribute(s,a),El.fromBufferAttribute(s,l),Al.fromBufferAttribute(s,c),h.uv=ti.getInterpolation(Pl,Lr,Dr,Ur,Tl,El,Al,new Ge)),r&&(Tl.fromBufferAttribute(r,a),El.fromBufferAttribute(r,l),Al.fromBufferAttribute(r,c),h.uv1=ti.getInterpolation(Pl,Lr,Dr,Ur,Tl,El,Al,new Ge),h.uv2=h.uv1),o&&(xg.fromBufferAttribute(o,a),Sg.fromBufferAttribute(o,l),_g.fromBufferAttribute(o,c),h.normal=ti.getInterpolation(Pl,Lr,Dr,Ur,xg,Sg,_g,new F),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const u={a,b:l,c,normal:new F,materialIndex:0};ti.getNormal(Lr,Dr,Ur,u.normal),h.face=u}return h}class Ga extends Rs{constructor(e=1,t=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const l=[],c=[],h=[],u=[];let f=0,d=0;g("z","y","x",-1,-1,i,t,e,o,r,0),g("z","y","x",1,-1,i,t,-e,o,r,1),g("x","z","y",1,1,e,i,t,s,o,2),g("x","z","y",1,-1,e,i,-t,s,o,3),g("x","y","z",1,-1,e,t,i,s,r,4),g("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new Pi(c,3)),this.setAttribute("normal",new Pi(h,3)),this.setAttribute("uv",new Pi(u,2));function g(O,m,p,y,S,x,w,T,C,k,b){const E=x/C,j=w/k,ae=x/2,Q=w/2,W=T/2,G=C+1,K=k+1;let X=0,z=0;const se=new F;for(let J=0;J0?1:-1,h.push(se.x,se.y,se.z),u.push(N/C),u.push(1-J/k),X+=1}}for(let J=0;J>8&255]+Jt[n>>16&255]+Jt[n>>24&255]+"-"+Jt[e&255]+Jt[e>>8&255]+"-"+Jt[e>>16&15|64]+Jt[e>>24&255]+"-"+Jt[t&63|128]+Jt[t>>8&255]+"-"+Jt[t>>16&255]+Jt[t>>24&255]+Jt[i&255]+Jt[i>>8&255]+Jt[i>>16&255]+Jt[i>>24&255]).toLowerCase()}function dn(n,e,t){return Math.max(e,Math.min(t,n))}function XM(n,e){return(n%e+e)%e}function hu(n,e,t){return(1-t)*n+t*e}function og(n){return(n&n-1)===0&&n!==0}function Af(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function pl(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function An(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}class Ge{constructor(e=0,t=0){Ge.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(dn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class qe{constructor(e,t,i,s,r,o,a,l,c){qe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,c)}set(e,t,i,s,r,o,a,l,c){const h=this.elements;return h[0]=e,h[1]=s,h[2]=a,h[3]=t,h[4]=r,h[5]=l,h[6]=i,h[7]=o,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],h=i[4],u=i[7],f=i[2],d=i[5],g=i[8],O=s[0],m=s[3],p=s[6],y=s[1],S=s[4],x=s[7],w=s[2],T=s[5],C=s[8];return r[0]=o*O+a*y+l*w,r[3]=o*m+a*S+l*T,r[6]=o*p+a*x+l*C,r[1]=c*O+h*y+u*w,r[4]=c*m+h*S+u*T,r[7]=c*p+h*x+u*C,r[2]=f*O+d*y+g*w,r[5]=f*m+d*S+g*T,r[8]=f*p+d*x+g*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t*o*h-t*a*c-i*r*h+i*a*l+s*r*c-s*o*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=h*o-a*c,f=a*l-h*r,d=c*r-o*l,g=t*u+i*f+s*d;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const O=1/g;return e[0]=u*O,e[1]=(s*c-h*i)*O,e[2]=(a*i-s*o)*O,e[3]=f*O,e[4]=(h*t-s*l)*O,e[5]=(s*r-a*t)*O,e[6]=d*O,e[7]=(i*l-c*t)*O,e[8]=(o*t-i*r)*O,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,s,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-s*c,s*l,-s*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(uu.makeScale(e,t)),this}rotate(e){return this.premultiply(uu.makeRotation(-e)),this}translate(e,t){return this.premultiply(uu.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const uu=new qe;function _x(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Lc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const ag={};function ua(n){n in ag||(ag[n]=!0,console.warn(n))}function io(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function fu(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const zM=new qe().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),VM=new qe().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function WM(n){return n.convertSRGBToLinear().applyMatrix3(VM)}function GM(n){return n.applyMatrix3(zM).convertLinearToSRGB()}const ZM={[Ci]:n=>n,[He]:n=>n.convertSRGBToLinear(),[Sx]:WM},HM={[Ci]:n=>n,[He]:n=>n.convertLinearToSRGB(),[Sx]:GM},Yn={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return Ci},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=ZM[e],s=HM[t];if(i===void 0||s===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return s(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let wr;class yx{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{wr===void 0&&(wr=Lc("canvas")),wr.width=e.width,wr.height=e.height;const i=wr.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=wr}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Lc("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==fx)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case wf:e.x=e.x-Math.floor(e.x);break;case ii:e.x=e.x<0?0:1;break;case Mf:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case wf:e.y=e.y-Math.floor(e.y);break;case ii:e.y=e.y<0?0:1;break;case Mf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return ua("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===He?rr:xx}set encoding(e){ua("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===rr?He:or}}Nn.DEFAULT_IMAGE=null;Nn.DEFAULT_MAPPING=fx;Nn.DEFAULT_ANISOTROPY=1;class Wt{constructor(e=0,t=0,i=0,s=1){Wt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,s,r;const l=e.elements,c=l[0],h=l[4],u=l[8],f=l[1],d=l[5],g=l[9],O=l[2],m=l[6],p=l[10];if(Math.abs(h-f)<.01&&Math.abs(u-O)<.01&&Math.abs(g-m)<.01){if(Math.abs(h+f)<.1&&Math.abs(u+O)<.1&&Math.abs(g+m)<.1&&Math.abs(c+d+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const S=(c+1)/2,x=(d+1)/2,w=(p+1)/2,T=(h+f)/4,C=(u+O)/4,k=(g+m)/4;return S>x&&S>w?S<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(S),s=T/i,r=C/i):x>w?x<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(x),i=T/s,r=k/s):w<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(w),i=C/r,s=k/r),this.set(i,s,r,t),this}let y=Math.sqrt((m-g)*(m-g)+(u-O)*(u-O)+(f-h)*(f-h));return Math.abs(y)<.001&&(y=1),this.x=(m-g)/y,this.y=(u-O)/y,this.z=(f-h)/y,this.w=Math.acos((c+d+p-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ur extends Or{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Wt(0,0,e,t),this.scissorTest=!1,this.viewport=new Wt(0,0,e,t);const s={width:e,height:t,depth:1};i.encoding!==void 0&&(ua("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===rr?He:or),this.texture=new Nn(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:Fn,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new bx(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class wx extends Nn{constructor(e=null,t=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=un,this.minFilter=un,this.wrapR=ii,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class qM extends Nn{constructor(e=null,t=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:s},this.magFilter=un,this.minFilter=un,this.wrapR=ii,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class fr{constructor(e=0,t=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=s}static slerpFlat(e,t,i,s,r,o,a){let l=i[s+0],c=i[s+1],h=i[s+2],u=i[s+3];const f=r[o+0],d=r[o+1],g=r[o+2],O=r[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u;return}if(a===1){e[t+0]=f,e[t+1]=d,e[t+2]=g,e[t+3]=O;return}if(u!==O||l!==f||c!==d||h!==g){let m=1-a;const p=l*f+c*d+h*g+u*O,y=p>=0?1:-1,S=1-p*p;if(S>Number.EPSILON){const w=Math.sqrt(S),T=Math.atan2(w,p*y);m=Math.sin(m*T)/w,a=Math.sin(a*T)/w}const x=a*y;if(l=l*m+f*x,c=c*m+d*x,h=h*m+g*x,u=u*m+O*x,m===1-a){const w=1/Math.sqrt(l*l+c*c+h*h+u*u);l*=w,c*=w,h*=w,u*=w}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],c=i[s+2],h=i[s+3],u=r[o],f=r[o+1],d=r[o+2],g=r[o+3];return e[t]=a*g+h*u+l*d-c*f,e[t+1]=l*g+h*f+c*u-a*d,e[t+2]=c*g+h*d+a*f-l*u,e[t+3]=h*g-a*u-l*f-c*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),h=a(s/2),u=a(r/2),f=l(i/2),d=l(s/2),g=l(r/2);switch(o){case"XYZ":this._x=f*h*u+c*d*g,this._y=c*d*u-f*h*g,this._z=c*h*g+f*d*u,this._w=c*h*u-f*d*g;break;case"YXZ":this._x=f*h*u+c*d*g,this._y=c*d*u-f*h*g,this._z=c*h*g-f*d*u,this._w=c*h*u+f*d*g;break;case"ZXY":this._x=f*h*u-c*d*g,this._y=c*d*u+f*h*g,this._z=c*h*g+f*d*u,this._w=c*h*u-f*d*g;break;case"ZYX":this._x=f*h*u-c*d*g,this._y=c*d*u+f*h*g,this._z=c*h*g-f*d*u,this._w=c*h*u+f*d*g;break;case"YZX":this._x=f*h*u+c*d*g,this._y=c*d*u+f*h*g,this._z=c*h*g-f*d*u,this._w=c*h*u-f*d*g;break;case"XZY":this._x=f*h*u-c*d*g,this._y=c*d*u-f*h*g,this._z=c*h*g+f*d*u,this._w=c*h*u+f*d*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],h=t[6],u=t[10],f=i+a+u;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(h-l)*d,this._y=(r-c)*d,this._z=(o-s)*d}else if(i>a&&i>u){const d=2*Math.sqrt(1+i-a-u);this._w=(h-l)/d,this._x=.25*d,this._y=(s+o)/d,this._z=(r+c)/d}else if(a>u){const d=2*Math.sqrt(1+a-i-u);this._w=(r-c)/d,this._x=(s+o)/d,this._y=.25*d,this._z=(l+h)/d}else{const d=2*Math.sqrt(1+u-i-a);this._w=(o-s)/d,this._x=(r+c)/d,this._y=(l+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,h=t._w;return this._x=i*h+o*a+s*c-r*l,this._y=s*h+o*l+r*a-i*c,this._z=r*h+o*c+i*l-s*a,this._w=o*h-i*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*i+t*this._x,this._y=d*s+t*this._y,this._z=d*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),h=Math.atan2(c,a),u=Math.sin((1-t)*h)/c,f=Math.sin(t*h)/c;return this._w=o*u+this._w*f,this._x=i*u+this._x*f,this._y=s*u+this._y*f,this._z=r*u+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),s=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(s),i*Math.sin(r),i*Math.cos(r),t*Math.sin(s))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,i=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(lg.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(lg.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*s-a*i,h=l*i+a*t-r*s,u=l*s+r*i-o*t,f=-r*t-o*i-a*s;return this.x=c*l+f*-r+h*-a-u*-o,this.y=h*l+f*-o+u*-r-c*-a,this.z=u*l+f*-a+c*-o-h*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return pu.copy(this).projectOnVector(e),this.sub(pu)}reflect(e){return this.sub(pu.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(dn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const pu=new F,lg=new fr;class Wa{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ii),Ii.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Fo),ml.subVectors(this.max,Fo),Tr.subVectors(e.a,Fo),Er.subVectors(e.b,Fo),Ar.subVectors(e.c,Fo),ss.subVectors(Er,Tr),rs.subVectors(Ar,Er),Ns.subVectors(Tr,Ar);let t=[0,-ss.z,ss.y,0,-rs.z,rs.y,0,-Ns.z,Ns.y,ss.z,0,-ss.x,rs.z,0,-rs.x,Ns.z,0,-Ns.x,-ss.y,ss.x,0,-rs.y,rs.x,0,-Ns.y,Ns.x,0];return!mu(t,Tr,Er,Ar,ml)||(t=[1,0,0,0,1,0,0,0,1],!mu(t,Tr,Er,Ar,ml))?!1:(gl.crossVectors(ss,rs),t=[gl.x,gl.y,gl.z],mu(t,Tr,Er,Ar,ml))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ii).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ii).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ui[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ui[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ui[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ui[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ui[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ui[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ui[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ui[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ui),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Ui=[new F,new F,new F,new F,new F,new F,new F,new F],Ii=new F,Mr=new Wa,Tr=new F,Er=new F,Ar=new F,ss=new F,rs=new F,Ns=new F,Fo=new F,ml=new F,gl=new F,$s=new F;function mu(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){$s.fromArray(n,r);const a=s.x*Math.abs($s.x)+s.y*Math.abs($s.y)+s.z*Math.abs($s.z),l=e.dot($s),c=t.dot($s),h=i.dot($s);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>a)return!1}return!0}const KM=new Wa,Bo=new F,gu=new F;class jd{constructor(e=new F,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):KM.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Bo.subVectors(e,this.center);const t=Bo.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(Bo,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(gu.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Bo.copy(e.center).add(gu)),this.expandByPoint(Bo.copy(e.center).sub(gu))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Qi=new F,Ou=new F,Ol=new F,os=new F,vu=new F,vl=new F,xu=new F;class JM{constructor(e=new F,t=new F(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Qi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Qi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Qi.copy(this.origin).addScaledVector(this.direction,t),Qi.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Ou.copy(e).add(t).multiplyScalar(.5),Ol.copy(t).sub(e).normalize(),os.copy(this.origin).sub(Ou);const r=e.distanceTo(t)*.5,o=-this.direction.dot(Ol),a=os.dot(this.direction),l=-os.dot(Ol),c=os.lengthSq(),h=Math.abs(1-o*o);let u,f,d,g;if(h>0)if(u=o*l-a,f=o*a-l,g=r*h,u>=0)if(f>=-g)if(f<=g){const O=1/h;u*=O,f*=O,d=u*(u+o*f+2*a)+f*(o*u+f+2*l)+c}else f=r,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*l)+c;else f=-r,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*l)+c;else f<=-g?(u=Math.max(0,-(-o*r+a)),f=u>0?-r:Math.min(Math.max(-r,-l),r),d=-u*u+f*(f+2*l)+c):f<=g?(u=0,f=Math.min(Math.max(-r,-l),r),d=f*(f+2*l)+c):(u=Math.max(0,-(o*r+a)),f=u>0?r:Math.min(Math.max(-r,-l),r),d=-u*u+f*(f+2*l)+c);else f=o>0?-r:r,u=Math.max(0,-(o*f+a)),d=-u*u+f*(f+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,u),s&&s.copy(Ou).addScaledVector(Ol,f),d}intersectSphere(e,t){Qi.subVectors(e.center,this.origin);const i=Qi.dot(this.direction),s=Qi.dot(Qi)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,l;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,s=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,s=(e.min.x-f.x)*c),h>=0?(r=(e.min.y-f.y)*h,o=(e.max.y-f.y)*h):(r=(e.max.y-f.y)*h,o=(e.min.y-f.y)*h),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(a=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,Qi)!==null}intersectTriangle(e,t,i,s,r){vu.subVectors(t,e),vl.subVectors(i,e),xu.crossVectors(vu,vl);let o=this.direction.dot(xu),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;os.subVectors(this.origin,e);const l=a*this.direction.dot(vl.crossVectors(os,vl));if(l<0)return null;const c=a*this.direction.dot(vu.cross(os));if(c<0||l+c>o)return null;const h=-a*os.dot(xu);return h<0?null:this.at(h/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Tt{constructor(e,t,i,s,r,o,a,l,c,h,u,f,d,g,O,m){Tt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,c,h,u,f,d,g,O,m)}set(e,t,i,s,r,o,a,l,c,h,u,f,d,g,O,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=i,p[12]=s,p[1]=r,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=h,p[10]=u,p[14]=f,p[3]=d,p[7]=g,p[11]=O,p[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Tt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/Pr.setFromMatrixColumn(e,0).length(),r=1/Pr.setFromMatrixColumn(e,1).length(),o=1/Pr.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),c=Math.sin(s),h=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){const f=o*h,d=o*u,g=a*h,O=a*u;t[0]=l*h,t[4]=-l*u,t[8]=c,t[1]=d+g*c,t[5]=f-O*c,t[9]=-a*l,t[2]=O-f*c,t[6]=g+d*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*h,d=l*u,g=c*h,O=c*u;t[0]=f+O*a,t[4]=g*a-d,t[8]=o*c,t[1]=o*u,t[5]=o*h,t[9]=-a,t[2]=d*a-g,t[6]=O+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*h,d=l*u,g=c*h,O=c*u;t[0]=f-O*a,t[4]=-o*u,t[8]=g+d*a,t[1]=d+g*a,t[5]=o*h,t[9]=O-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*h,d=o*u,g=a*h,O=a*u;t[0]=l*h,t[4]=g*c-d,t[8]=f*c+O,t[1]=l*u,t[5]=O*c+f,t[9]=d*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,d=o*c,g=a*l,O=a*c;t[0]=l*h,t[4]=O-f*u,t[8]=g*u+d,t[1]=u,t[5]=o*h,t[9]=-a*h,t[2]=-c*h,t[6]=d*u+g,t[10]=f-O*u}else if(e.order==="XZY"){const f=o*l,d=o*c,g=a*l,O=a*c;t[0]=l*h,t[4]=-u,t[8]=c*h,t[1]=f*u+O,t[5]=o*h,t[9]=d*u-g,t[2]=g*u-d,t[6]=a*h,t[10]=O*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(eT,e,tT)}lookAt(e,t,i){const s=this.elements;return Pn.subVectors(e,t),Pn.lengthSq()===0&&(Pn.z=1),Pn.normalize(),as.crossVectors(i,Pn),as.lengthSq()===0&&(Math.abs(i.z)===1?Pn.x+=1e-4:Pn.z+=1e-4,Pn.normalize(),as.crossVectors(i,Pn)),as.normalize(),xl.crossVectors(Pn,as),s[0]=as.x,s[4]=xl.x,s[8]=Pn.x,s[1]=as.y,s[5]=xl.y,s[9]=Pn.y,s[2]=as.z,s[6]=xl.z,s[10]=Pn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],h=i[1],u=i[5],f=i[9],d=i[13],g=i[2],O=i[6],m=i[10],p=i[14],y=i[3],S=i[7],x=i[11],w=i[15],T=s[0],C=s[4],k=s[8],b=s[12],E=s[1],j=s[5],ae=s[9],Q=s[13],W=s[2],G=s[6],K=s[10],X=s[14],z=s[3],se=s[7],J=s[11],be=s[15];return r[0]=o*T+a*E+l*W+c*z,r[4]=o*C+a*j+l*G+c*se,r[8]=o*k+a*ae+l*K+c*J,r[12]=o*b+a*Q+l*X+c*be,r[1]=h*T+u*E+f*W+d*z,r[5]=h*C+u*j+f*G+d*se,r[9]=h*k+u*ae+f*K+d*J,r[13]=h*b+u*Q+f*X+d*be,r[2]=g*T+O*E+m*W+p*z,r[6]=g*C+O*j+m*G+p*se,r[10]=g*k+O*ae+m*K+p*J,r[14]=g*b+O*Q+m*X+p*be,r[3]=y*T+S*E+x*W+w*z,r[7]=y*C+S*j+x*G+w*se,r[11]=y*k+S*ae+x*K+w*J,r[15]=y*b+S*Q+x*X+w*be,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],h=e[2],u=e[6],f=e[10],d=e[14],g=e[3],O=e[7],m=e[11],p=e[15];return g*(+r*l*u-s*c*u-r*a*f+i*c*f+s*a*d-i*l*d)+O*(+t*l*d-t*c*f+r*o*f-s*o*d+s*c*h-r*l*h)+m*(+t*c*u-t*a*d-r*o*u+i*o*d+r*a*h-i*c*h)+p*(-s*a*h-t*l*u+t*a*f+s*o*u-i*o*f+i*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=e[9],f=e[10],d=e[11],g=e[12],O=e[13],m=e[14],p=e[15],y=u*m*c-O*f*c+O*l*d-a*m*d-u*l*p+a*f*p,S=g*f*c-h*m*c-g*l*d+o*m*d+h*l*p-o*f*p,x=h*O*c-g*u*c+g*a*d-o*O*d-h*a*p+o*u*p,w=g*u*l-h*O*l-g*a*f+o*O*f+h*a*m-o*u*m,T=t*y+i*S+s*x+r*w;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/T;return e[0]=y*C,e[1]=(O*f*r-u*m*r-O*s*d+i*m*d+u*s*p-i*f*p)*C,e[2]=(a*m*r-O*l*r+O*s*c-i*m*c-a*s*p+i*l*p)*C,e[3]=(u*l*r-a*f*r-u*s*c+i*f*c+a*s*d-i*l*d)*C,e[4]=S*C,e[5]=(h*m*r-g*f*r+g*s*d-t*m*d-h*s*p+t*f*p)*C,e[6]=(g*l*r-o*m*r-g*s*c+t*m*c+o*s*p-t*l*p)*C,e[7]=(o*f*r-h*l*r+h*s*c-t*f*c-o*s*d+t*l*d)*C,e[8]=x*C,e[9]=(g*u*r-h*O*r-g*i*d+t*O*d+h*i*p-t*u*p)*C,e[10]=(o*O*r-g*a*r+g*i*c-t*O*c-o*i*p+t*a*p)*C,e[11]=(h*a*r-o*u*r-h*i*c+t*u*c+o*i*d-t*a*d)*C,e[12]=w*C,e[13]=(h*O*s-g*u*s+g*i*f-t*O*f-h*i*m+t*u*m)*C,e[14]=(g*a*s-o*O*s-g*i*l+t*O*l+o*i*m-t*a*m)*C,e[15]=(o*u*s-h*a*s+h*i*l-t*u*l-o*i*f+t*a*f)*C,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,l=e.z,c=r*o,h=r*a;return this.set(c*o+i,c*a-s*l,c*l+s*a,0,c*a+s*l,h*a+i,h*l-s*o,0,c*l-s*a,h*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,h=o+o,u=a+a,f=r*c,d=r*h,g=r*u,O=o*h,m=o*u,p=a*u,y=l*c,S=l*h,x=l*u,w=i.x,T=i.y,C=i.z;return s[0]=(1-(O+p))*w,s[1]=(d+x)*w,s[2]=(g-S)*w,s[3]=0,s[4]=(d-x)*T,s[5]=(1-(f+p))*T,s[6]=(m+y)*T,s[7]=0,s[8]=(g+S)*C,s[9]=(m-y)*C,s[10]=(1-(f+O))*C,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=Pr.set(s[0],s[1],s[2]).length();const o=Pr.set(s[4],s[5],s[6]).length(),a=Pr.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],jn.copy(this);const c=1/r,h=1/o,u=1/a;return jn.elements[0]*=c,jn.elements[1]*=c,jn.elements[2]*=c,jn.elements[4]*=h,jn.elements[5]*=h,jn.elements[6]*=h,jn.elements[8]*=u,jn.elements[9]*=u,jn.elements[10]*=u,t.setFromRotationMatrix(jn),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o,a=Gi){const l=this.elements,c=2*r/(t-e),h=2*r/(i-s),u=(t+e)/(t-e),f=(i+s)/(i-s);let d,g;if(a===Gi)d=-(o+r)/(o-r),g=-2*o*r/(o-r);else if(a===kc)d=-o/(o-r),g=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=d,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,o,a=Gi){const l=this.elements,c=1/(t-e),h=1/(i-s),u=1/(o-r),f=(t+e)*c,d=(i+s)*h;let g,O;if(a===Gi)g=(o+r)*u,O=-2*u;else if(a===kc)g=r*u,O=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-d,l[2]=0,l[6]=0,l[10]=O,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const Pr=new F,jn=new Tt,eT=new F(0,0,0),tT=new F(1,1,1),as=new F,xl=new F,Pn=new F,cg=new Tt,hg=new fr;class Ph{constructor(e=0,t=0,i=0,s=Ph.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],l=s[1],c=s[5],h=s[9],u=s[2],f=s[6],d=s[10];switch(t){case"XYZ":this._y=Math.asin(dn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-dn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(dn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-dn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(dn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-dn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return cg.makeRotationFromQuaternion(e),this.setFromRotationMatrix(cg,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return hg.setFromEuler(this),this.setFromQuaternion(hg,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ph.DEFAULT_ORDER="XYZ";class Mx{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xo,e,iT),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xo,sT,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,s=t.length;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON()));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,h=l.length;c0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),h.length>0&&(i.images=h),u.length>0&&(i.shapes=u),f.length>0&&(i.skeletons=f),d.length>0&&(i.animations=d),g.length>0&&(i.nodes=g)}return i.object=s,i;function o(a){const l=[];for(const c in a){const h=a[c];delete h.metadata,l.push(h)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){qn.subVectors(s,t),$i.subVectors(i,t),Su.subVectors(e,t);const o=qn.dot(qn),a=qn.dot($i),l=qn.dot(Su),c=$i.dot($i),h=$i.dot(Su),u=o*c-a*a;if(u===0)return r.set(-2,-1,-1);const f=1/u,d=(c*l-a*h)*f,g=(o*h-a*l)*f;return r.set(1-d-g,g,d)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,Fi),Fi.x>=0&&Fi.y>=0&&Fi.x+Fi.y<=1}static getUV(e,t,i,s,r,o,a,l){return _l===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),_l=!0),this.getInterpolation(e,t,i,s,r,o,a,l)}static getInterpolation(e,t,i,s,r,o,a,l){return this.getBarycoord(e,t,i,s,Fi),l.setScalar(0),l.addScaledVector(r,Fi.x),l.addScaledVector(o,Fi.y),l.addScaledVector(a,Fi.z),l}static isFrontFacing(e,t,i,s){return qn.subVectors(i,t),$i.subVectors(e,t),qn.cross($i).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return qn.subVectors(this.c,this.b),$i.subVectors(this.a,this.b),qn.cross($i).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ti.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ti.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,s,r){return _l===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),_l=!0),ti.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}getInterpolation(e,t,i,s,r){return ti.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return ti.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ti.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,r=this.c;let o,a;Rr.subVectors(s,i),kr.subVectors(r,i),_u.subVectors(e,i);const l=Rr.dot(_u),c=kr.dot(_u);if(l<=0&&c<=0)return t.copy(i);yu.subVectors(e,s);const h=Rr.dot(yu),u=kr.dot(yu);if(h>=0&&u<=h)return t.copy(s);const f=l*u-h*c;if(f<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(i).addScaledVector(Rr,o);bu.subVectors(e,r);const d=Rr.dot(bu),g=kr.dot(bu);if(g>=0&&d<=g)return t.copy(r);const O=d*c-l*g;if(O<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(kr,a);const m=h*g-d*u;if(m<=0&&u-h>=0&&d-g>=0)return gg.subVectors(r,s),a=(u-h)/(u-h+(d-g)),t.copy(s).addScaledVector(gg,a);const p=1/(m+O+f);return o=O*p,a=f*p,t.copy(i).addScaledVector(Rr,o).addScaledVector(kr,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let oT=0;class Ch extends Or{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:oT++}),this.uuid=Va(),this.name="",this.type="Material",this.blending=no,this.side=ws,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=cx,this.blendDst=hx,this.blendEquation=Xr,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=_f,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=LM,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=lu,this.stencilZFail=lu,this.stencilZPass=lu,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==no&&(i.blending=this.blending),this.side!==ws&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const Tx={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Kn={h:0,s:0,l:0},yl={h:0,s:0,l:0};function wu(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ct{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=He){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Yn.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=Yn.workingColorSpace){return this.r=e,this.g=t,this.b=i,Yn.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=Yn.workingColorSpace){if(e=XM(e,1),t=dn(t,0,1),i=dn(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=wu(o,r,e+1/3),this.g=wu(o,r,e),this.b=wu(o,r,e-1/3)}return Yn.toWorkingColorSpace(this,s),this}setStyle(e,t=He){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=He){const i=Tx[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=io(e.r),this.g=io(e.g),this.b=io(e.b),this}copyLinearToSRGB(e){return this.r=fu(e.r),this.g=fu(e.g),this.b=fu(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=He){return Yn.fromWorkingColorSpace(en.copy(this),e),Math.round(dn(en.r*255,0,255))*65536+Math.round(dn(en.g*255,0,255))*256+Math.round(dn(en.b*255,0,255))}getHexString(e=He){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Yn.workingColorSpace){Yn.fromWorkingColorSpace(en.copy(this),t);const i=en.r,s=en.g,r=en.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,c;const h=(a+o)/2;if(a===o)l=0,c=0;else{const u=o-a;switch(c=h<=.5?u/(o+a):u/(2-o-a),o){case i:l=(s-r)/u+(s0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],h=[];for(let u=0,f=c.length;u0&&(s[l]=h,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const s=e.attributes;for(const c in s){const h=s[c];this.setAttribute(c,h.clone(t))}const r=e.morphAttributes;for(const c in r){const h=[],u=r[c];for(let f=0,d=u.length;f0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(Og.copy(r).invert(),Fs.copy(e.ray).applyMatrix4(Og),!(i.boundingBox!==null&&Fs.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Fs)))}_computeIntersections(e,t,i){let s;const r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,c=r.attributes.uv,h=r.attributes.uv1,u=r.attributes.normal,f=r.groups,d=r.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,O=f.length;gt.far?null:{distance:c,point:Cl.clone(),object:n}}function Rl(n,e,t,i,s,r,o,a,l,c){n.getVertexPosition(a,Dr),n.getVertexPosition(l,Ur),n.getVertexPosition(c,Ir);const h=lT(n,e,t,i,Dr,Ur,Ir,Pl);if(h){s&&(Tl.fromBufferAttribute(s,a),El.fromBufferAttribute(s,l),Al.fromBufferAttribute(s,c),h.uv=ti.getInterpolation(Pl,Dr,Ur,Ir,Tl,El,Al,new Ge)),r&&(Tl.fromBufferAttribute(r,a),El.fromBufferAttribute(r,l),Al.fromBufferAttribute(r,c),h.uv1=ti.getInterpolation(Pl,Dr,Ur,Ir,Tl,El,Al,new Ge),h.uv2=h.uv1),o&&(xg.fromBufferAttribute(o,a),Sg.fromBufferAttribute(o,l),_g.fromBufferAttribute(o,c),h.normal=ti.getInterpolation(Pl,Dr,Ur,Ir,xg,Sg,_g,new F),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const u={a,b:l,c,normal:new F,materialIndex:0};ti.getNormal(Dr,Ur,Ir,u.normal),h.face=u}return h}class Ga extends Rs{constructor(e=1,t=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const l=[],c=[],h=[],u=[];let f=0,d=0;g("z","y","x",-1,-1,i,t,e,o,r,0),g("z","y","x",1,-1,i,t,-e,o,r,1),g("x","z","y",1,1,e,i,t,s,o,2),g("x","z","y",1,-1,e,i,-t,s,o,3),g("x","y","z",1,-1,e,t,i,s,r,4),g("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new Ai(c,3)),this.setAttribute("normal",new Ai(h,3)),this.setAttribute("uv",new Ai(u,2));function g(O,m,p,y,S,x,w,T,C,k,b){const E=x/C,j=w/k,ae=x/2,Q=w/2,W=T/2,G=C+1,K=k+1;let X=0,z=0;const se=new F;for(let J=0;J0?1:-1,h.push(se.x,se.y,se.z),u.push(N/C),u.push(1-J/k),X+=1}}for(let J=0;J0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Cx extends Gt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Tt,this.projectionMatrix=new Tt,this.projectionMatrixInverse=new Tt,this.coordinateSystem=Gi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Bn extends Cx{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ef*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(cu*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ef*2*Math.atan(Math.tan(cu*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(cu*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/c,s*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Ir=-90,Qr=1;class dT extends Gt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null;const s=new Bn(Ir,Qr,e,t);s.layers=this.layers,this.add(s);const r=new Bn(Ir,Qr,e,t);r.layers=this.layers,this.add(r);const o=new Bn(Ir,Qr,e,t);o.layers=this.layers,this.add(o);const a=new Bn(Ir,Qr,e,t);a.layers=this.layers,this.add(a);const l=new Bn(Ir,Qr,e,t);l.layers=this.layers,this.add(l);const c=new Bn(Ir,Qr,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,s,r,o,a,l]=t;for(const c of t)this.remove(c);if(e===Gi)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===kc)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,r,o,a,l,c]=this.children,h=e.getRenderTarget(),u=e.toneMapping,f=e.xr.enabled;e.toneMapping=Zi,e.xr.enabled=!1;const d=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,s),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=d,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(h),e.toneMapping=u,e.xr.enabled=f,i.texture.needsPMREMUpdate=!0}}class Rx extends Nn{constructor(e,t,i,s,r,o,a,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:vo,super(e,t,i,s,r,o,a,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class pT extends ur{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];t.encoding!==void 0&&(ua("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===rr?He:or),this.texture=new Rx(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Fn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class dr extends Ch{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=uT,this.fragmentShader=fT,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=yo(e.uniforms),this.uniformsGroups=cT(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?t.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[s]={type:"m4",value:o.toArray()}:t.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Cx extends Gt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Tt,this.projectionMatrix=new Tt,this.projectionMatrixInverse=new Tt,this.coordinateSystem=Gi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Bn extends Cx{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ef*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(cu*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ef*2*Math.atan(Math.tan(cu*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(cu*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/c,s*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Qr=-90,Nr=1;class dT extends Gt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null;const s=new Bn(Qr,Nr,e,t);s.layers=this.layers,this.add(s);const r=new Bn(Qr,Nr,e,t);r.layers=this.layers,this.add(r);const o=new Bn(Qr,Nr,e,t);o.layers=this.layers,this.add(o);const a=new Bn(Qr,Nr,e,t);a.layers=this.layers,this.add(a);const l=new Bn(Qr,Nr,e,t);l.layers=this.layers,this.add(l);const c=new Bn(Qr,Nr,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,s,r,o,a,l]=t;for(const c of t)this.remove(c);if(e===Gi)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===kc)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,r,o,a,l,c]=this.children,h=e.getRenderTarget(),u=e.toneMapping,f=e.xr.enabled;e.toneMapping=Zi,e.xr.enabled=!1;const d=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,s),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=d,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(h),e.toneMapping=u,e.xr.enabled=f,i.texture.needsPMREMUpdate=!0}}class Rx extends Nn{constructor(e,t,i,s,r,o,a,l,c,h){e=e!==void 0?e:[],t=t!==void 0?t:xo,super(e,t,i,s,r,o,a,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class pT extends ur{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];t.encoding!==void 0&&(ua("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===rr?He:or),this.texture=new Rx(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Fn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -45,7 +45,7 @@ gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},s=new Ga(5,5,5),r=new dr({name:"CubemapFromEquirect",uniforms:_o(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:wn,blending:vs});r.uniforms.tEquirect.value=t;const o=new wi(s,r),a=t.minFilter;return t.minFilter===wa&&(t.minFilter=Fn),new dT(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,s){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,s);e.setRenderTarget(r)}}const Eu=new F,mT=new F,gT=new qe;class zs{constructor(e=new F(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const s=Eu.subVectors(i,t).cross(mT.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(Eu),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||gT.getNormalMatrix(e),s=this.coplanarPoint(Eu).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Bs=new jd,kl=new F;class qd{constructor(e=new zs,t=new zs,i=new zs,s=new zs,r=new zs,o=new zs){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Gi){const i=this.planes,s=e.elements,r=s[0],o=s[1],a=s[2],l=s[3],c=s[4],h=s[5],u=s[6],f=s[7],d=s[8],g=s[9],O=s[10],m=s[11],p=s[12],y=s[13],S=s[14],x=s[15];if(i[0].setComponents(l-r,f-c,m-d,x-p).normalize(),i[1].setComponents(l+r,f+c,m+d,x+p).normalize(),i[2].setComponents(l+o,f+h,m+g,x+y).normalize(),i[3].setComponents(l-o,f-h,m-g,x-y).normalize(),i[4].setComponents(l-a,f-u,m-O,x-S).normalize(),t===Gi)i[5].setComponents(l+a,f+u,m+O,x+S).normalize();else if(t===kc)i[5].setComponents(a,u,O,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Bs.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Bs.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Bs)}intersectsSprite(e){return Bs.center.set(0,0,0),Bs.radius=.7071067811865476,Bs.applyMatrix4(e.matrixWorld),this.intersectsSphere(Bs)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)0?e.max.x:e.min.x,kl.y=s.normal.y>0?e.max.y:e.min.y,kl.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(kl)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function kx(){let n=null,e=!1,t=null,i=null;function s(r,o){t(r,o),i=n.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(s),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function OT(n,e){const t=e.isWebGL2,i=new WeakMap;function s(c,h){const u=c.array,f=c.usage,d=n.createBuffer();n.bindBuffer(h,d),n.bufferData(h,u,f),c.onUploadCallback();let g;if(u instanceof Float32Array)g=n.FLOAT;else if(u instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)g=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=n.UNSIGNED_SHORT;else if(u instanceof Int16Array)g=n.SHORT;else if(u instanceof Uint32Array)g=n.UNSIGNED_INT;else if(u instanceof Int32Array)g=n.INT;else if(u instanceof Int8Array)g=n.BYTE;else if(u instanceof Uint8Array)g=n.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)g=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:d,type:g,bytesPerElement:u.BYTES_PER_ELEMENT,version:c.version}}function r(c,h,u){const f=h.array,d=h.updateRange;n.bindBuffer(u,c),d.count===-1?n.bufferSubData(u,0,f):(t?n.bufferSubData(u,d.offset*f.BYTES_PER_ELEMENT,f,d.offset,d.count):n.bufferSubData(u,d.offset*f.BYTES_PER_ELEMENT,f.subarray(d.offset,d.offset+d.count)),d.count=-1),h.onUploadCallback()}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const h=i.get(c);h&&(n.deleteBuffer(h.buffer),i.delete(c))}function l(c,h){if(c.isGLBufferAttribute){const f=i.get(c);(!f||f.version1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||gT.getNormalMatrix(e),s=this.coplanarPoint(Eu).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Bs=new jd,kl=new F;class qd{constructor(e=new zs,t=new zs,i=new zs,s=new zs,r=new zs,o=new zs){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Gi){const i=this.planes,s=e.elements,r=s[0],o=s[1],a=s[2],l=s[3],c=s[4],h=s[5],u=s[6],f=s[7],d=s[8],g=s[9],O=s[10],m=s[11],p=s[12],y=s[13],S=s[14],x=s[15];if(i[0].setComponents(l-r,f-c,m-d,x-p).normalize(),i[1].setComponents(l+r,f+c,m+d,x+p).normalize(),i[2].setComponents(l+o,f+h,m+g,x+y).normalize(),i[3].setComponents(l-o,f-h,m-g,x-y).normalize(),i[4].setComponents(l-a,f-u,m-O,x-S).normalize(),t===Gi)i[5].setComponents(l+a,f+u,m+O,x+S).normalize();else if(t===kc)i[5].setComponents(a,u,O,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Bs.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Bs.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Bs)}intersectsSprite(e){return Bs.center.set(0,0,0),Bs.radius=.7071067811865476,Bs.applyMatrix4(e.matrixWorld),this.intersectsSphere(Bs)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)0?e.max.x:e.min.x,kl.y=s.normal.y>0?e.max.y:e.min.y,kl.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(kl)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function kx(){let n=null,e=!1,t=null,i=null;function s(r,o){t(r,o),i=n.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(s),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function OT(n,e){const t=e.isWebGL2,i=new WeakMap;function s(c,h){const u=c.array,f=c.usage,d=n.createBuffer();n.bindBuffer(h,d),n.bufferData(h,u,f),c.onUploadCallback();let g;if(u instanceof Float32Array)g=n.FLOAT;else if(u instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)g=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=n.UNSIGNED_SHORT;else if(u instanceof Int16Array)g=n.SHORT;else if(u instanceof Uint32Array)g=n.UNSIGNED_INT;else if(u instanceof Int32Array)g=n.INT;else if(u instanceof Int8Array)g=n.BYTE;else if(u instanceof Uint8Array)g=n.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)g=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:d,type:g,bytesPerElement:u.BYTES_PER_ELEMENT,version:c.version}}function r(c,h,u){const f=h.array,d=h.updateRange;n.bindBuffer(u,c),d.count===-1?n.bufferSubData(u,0,f):(t?n.bufferSubData(u,d.offset*f.BYTES_PER_ELEMENT,f,d.offset,d.count):n.bufferSubData(u,d.offset*f.BYTES_PER_ELEMENT,f.subarray(d.offset,d.offset+d.count)),d.count=-1),h.onUploadCallback()}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const h=i.get(c);h&&(n.deleteBuffer(h.buffer),i.delete(c))}function l(c,h){if(c.isGLBufferAttribute){const f=i.get(c);(!f||f.version #include #include -}`,je={alphamap_fragment:vT,alphamap_pars_fragment:xT,alphatest_fragment:ST,alphatest_pars_fragment:_T,aomap_fragment:yT,aomap_pars_fragment:bT,begin_vertex:wT,beginnormal_vertex:MT,bsdfs:TT,iridescence_fragment:ET,bumpmap_pars_fragment:AT,clipping_planes_fragment:PT,clipping_planes_pars_fragment:CT,clipping_planes_pars_vertex:RT,clipping_planes_vertex:kT,color_fragment:LT,color_pars_fragment:DT,color_pars_vertex:UT,color_vertex:IT,common:QT,cube_uv_reflection_fragment:NT,defaultnormal_vertex:$T,displacementmap_pars_vertex:FT,displacementmap_vertex:BT,emissivemap_fragment:XT,emissivemap_pars_fragment:zT,encodings_fragment:VT,encodings_pars_fragment:WT,envmap_fragment:GT,envmap_common_pars_fragment:ZT,envmap_pars_fragment:HT,envmap_pars_vertex:YT,envmap_physical_pars_fragment:aE,envmap_vertex:jT,fog_vertex:qT,fog_pars_vertex:KT,fog_fragment:JT,fog_pars_fragment:eE,gradientmap_pars_fragment:tE,lightmap_fragment:nE,lightmap_pars_fragment:iE,lights_lambert_fragment:sE,lights_lambert_pars_fragment:rE,lights_pars_begin:oE,lights_toon_fragment:lE,lights_toon_pars_fragment:cE,lights_phong_fragment:hE,lights_phong_pars_fragment:uE,lights_physical_fragment:fE,lights_physical_pars_fragment:dE,lights_fragment_begin:pE,lights_fragment_maps:mE,lights_fragment_end:gE,logdepthbuf_fragment:OE,logdepthbuf_pars_fragment:vE,logdepthbuf_pars_vertex:xE,logdepthbuf_vertex:SE,map_fragment:_E,map_pars_fragment:yE,map_particle_fragment:bE,map_particle_pars_fragment:wE,metalnessmap_fragment:ME,metalnessmap_pars_fragment:TE,morphcolor_vertex:EE,morphnormal_vertex:AE,morphtarget_pars_vertex:PE,morphtarget_vertex:CE,normal_fragment_begin:RE,normal_fragment_maps:kE,normal_pars_fragment:LE,normal_pars_vertex:DE,normal_vertex:UE,normalmap_pars_fragment:IE,clearcoat_normal_fragment_begin:QE,clearcoat_normal_fragment_maps:NE,clearcoat_pars_fragment:$E,iridescence_pars_fragment:FE,output_fragment:BE,packing:XE,premultiplied_alpha_fragment:zE,project_vertex:VE,dithering_fragment:WE,dithering_pars_fragment:GE,roughnessmap_fragment:ZE,roughnessmap_pars_fragment:HE,shadowmap_pars_fragment:YE,shadowmap_pars_vertex:jE,shadowmap_vertex:qE,shadowmask_pars_fragment:KE,skinbase_vertex:JE,skinning_pars_vertex:eA,skinning_vertex:tA,skinnormal_vertex:nA,specularmap_fragment:iA,specularmap_pars_fragment:sA,tonemapping_fragment:rA,tonemapping_pars_fragment:oA,transmission_fragment:aA,transmission_pars_fragment:lA,uv_pars_fragment:cA,uv_pars_vertex:hA,uv_vertex:uA,worldpos_vertex:fA,background_vert:dA,background_frag:pA,backgroundCube_vert:mA,backgroundCube_frag:gA,cube_vert:OA,cube_frag:vA,depth_vert:xA,depth_frag:SA,distanceRGBA_vert:_A,distanceRGBA_frag:yA,equirect_vert:bA,equirect_frag:wA,linedashed_vert:MA,linedashed_frag:TA,meshbasic_vert:EA,meshbasic_frag:AA,meshlambert_vert:PA,meshlambert_frag:CA,meshmatcap_vert:RA,meshmatcap_frag:kA,meshnormal_vert:LA,meshnormal_frag:DA,meshphong_vert:UA,meshphong_frag:IA,meshphysical_vert:QA,meshphysical_frag:NA,meshtoon_vert:$A,meshtoon_frag:FA,points_vert:BA,points_frag:XA,shadow_vert:zA,shadow_frag:VA,sprite_vert:WA,sprite_frag:GA},Oe={common:{diffuse:{value:new ct(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qe}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qe},normalScale:{value:new Ge(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ct(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ct(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0},uvTransform:{value:new qe}},sprite:{diffuse:{value:new ct(16777215)},opacity:{value:1},center:{value:new Ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}}},vi={basic:{uniforms:hn([Oe.common,Oe.specularmap,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.fog]),vertexShader:je.meshbasic_vert,fragmentShader:je.meshbasic_frag},lambert:{uniforms:hn([Oe.common,Oe.specularmap,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.fog,Oe.lights,{emissive:{value:new ct(0)}}]),vertexShader:je.meshlambert_vert,fragmentShader:je.meshlambert_frag},phong:{uniforms:hn([Oe.common,Oe.specularmap,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.fog,Oe.lights,{emissive:{value:new ct(0)},specular:{value:new ct(1118481)},shininess:{value:30}}]),vertexShader:je.meshphong_vert,fragmentShader:je.meshphong_frag},standard:{uniforms:hn([Oe.common,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.roughnessmap,Oe.metalnessmap,Oe.fog,Oe.lights,{emissive:{value:new ct(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag},toon:{uniforms:hn([Oe.common,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.gradientmap,Oe.fog,Oe.lights,{emissive:{value:new ct(0)}}]),vertexShader:je.meshtoon_vert,fragmentShader:je.meshtoon_frag},matcap:{uniforms:hn([Oe.common,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.fog,{matcap:{value:null}}]),vertexShader:je.meshmatcap_vert,fragmentShader:je.meshmatcap_frag},points:{uniforms:hn([Oe.points,Oe.fog]),vertexShader:je.points_vert,fragmentShader:je.points_frag},dashed:{uniforms:hn([Oe.common,Oe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:je.linedashed_vert,fragmentShader:je.linedashed_frag},depth:{uniforms:hn([Oe.common,Oe.displacementmap]),vertexShader:je.depth_vert,fragmentShader:je.depth_frag},normal:{uniforms:hn([Oe.common,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,{opacity:{value:1}}]),vertexShader:je.meshnormal_vert,fragmentShader:je.meshnormal_frag},sprite:{uniforms:hn([Oe.sprite,Oe.fog]),vertexShader:je.sprite_vert,fragmentShader:je.sprite_frag},background:{uniforms:{uvTransform:{value:new qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:je.background_vert,fragmentShader:je.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:je.backgroundCube_vert,fragmentShader:je.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:je.cube_vert,fragmentShader:je.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:je.equirect_vert,fragmentShader:je.equirect_frag},distanceRGBA:{uniforms:hn([Oe.common,Oe.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:je.distanceRGBA_vert,fragmentShader:je.distanceRGBA_frag},shadow:{uniforms:hn([Oe.lights,Oe.fog,{color:{value:new ct(0)},opacity:{value:1}}]),vertexShader:je.shadow_vert,fragmentShader:je.shadow_frag}};vi.physical={uniforms:hn([vi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qe},clearcoatNormalScale:{value:new Ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qe},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qe},sheen:{value:0},sheenColor:{value:new ct(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qe},transmissionSamplerSize:{value:new Ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qe},attenuationDistance:{value:0},attenuationColor:{value:new ct(0)},specularColor:{value:new ct(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qe},anisotropyVector:{value:new Ge},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qe}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag};const Ll={r:0,b:0,g:0};function ZA(n,e,t,i,s,r,o){const a=new ct(0);let l=r===!0?0:1,c,h,u=null,f=0,d=null;function g(m,p){let y=!1,S=p.isScene===!0?p.background:null;switch(S&&S.isTexture&&(S=(p.backgroundBlurriness>0?t:e).get(S)),S===null?O(a,l):S&&S.isColor&&(O(S,1),y=!0),n.xr.getEnvironmentBlendMode()){case"opaque":y=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,o),y=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,o),y=!0;break}(n.autoClear||y)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),S&&(S.isCubeTexture||S.mapping===Ah)?(h===void 0&&(h=new wi(new Ga(1,1,1),new dr({name:"BackgroundCubeMaterial",uniforms:_o(vi.backgroundCube.uniforms),vertexShader:vi.backgroundCube.vertexShader,fragmentShader:vi.backgroundCube.fragmentShader,side:wn,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(T,C,k){this.matrixWorld.copyPosition(k.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),h.material.uniforms.envMap.value=S,h.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,h.material.toneMapped=S.colorSpace!==He,(u!==S||f!==S.version||d!==n.toneMapping)&&(h.material.needsUpdate=!0,u=S,f=S.version,d=n.toneMapping),h.layers.enableAll(),m.unshift(h,h.geometry,h.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new wi(new Kd(2,2),new dr({name:"BackgroundMaterial",uniforms:_o(vi.background.uniforms),vertexShader:vi.background.vertexShader,fragmentShader:vi.background.fragmentShader,side:ws,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(c)),c.material.uniforms.t2D.value=S,c.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,c.material.toneMapped=S.colorSpace!==He,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(u!==S||f!==S.version||d!==n.toneMapping)&&(c.material.needsUpdate=!0,u=S,f=S.version,d=n.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function O(m,p){m.getRGB(Ll,Px(n)),i.buffers.color.setClear(Ll.r,Ll.g,Ll.b,p,o)}return{getClearColor:function(){return a},setClearColor:function(m,p=1){a.set(m),l=p,O(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,O(a,l)},render:g}}function HA(n,e,t,i){const s=n.getParameter(n.MAX_VERTEX_ATTRIBS),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||r!==null,a={},l=m(null);let c=l,h=!1;function u(W,G,K,X,z){let se=!1;if(o){const J=O(X,K,G);c!==J&&(c=J,d(c.object)),se=p(W,X,K,z),se&&y(W,X,K,z)}else{const J=G.wireframe===!0;(c.geometry!==X.id||c.program!==K.id||c.wireframe!==J)&&(c.geometry=X.id,c.program=K.id,c.wireframe=J,se=!0)}z!==null&&t.update(z,n.ELEMENT_ARRAY_BUFFER),(se||h)&&(h=!1,k(W,G,K,X),z!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(z).buffer))}function f(){return i.isWebGL2?n.createVertexArray():r.createVertexArrayOES()}function d(W){return i.isWebGL2?n.bindVertexArray(W):r.bindVertexArrayOES(W)}function g(W){return i.isWebGL2?n.deleteVertexArray(W):r.deleteVertexArrayOES(W)}function O(W,G,K){const X=K.wireframe===!0;let z=a[W.id];z===void 0&&(z={},a[W.id]=z);let se=z[G.id];se===void 0&&(se={},z[G.id]=se);let J=se[X];return J===void 0&&(J=m(f()),se[X]=J),J}function m(W){const G=[],K=[],X=[];for(let z=0;z=0){const pe=z[N];let Te=se[N];if(Te===void 0&&(N==="instanceMatrix"&&W.instanceMatrix&&(Te=W.instanceMatrix),N==="instanceColor"&&W.instanceColor&&(Te=W.instanceColor)),pe===void 0||pe.attribute!==Te||Te&&pe.data!==Te.data)return!0;J++}return c.attributesNum!==J||c.index!==X}function y(W,G,K,X){const z={},se=G.attributes;let J=0;const be=K.getAttributes();for(const N in be)if(be[N].location>=0){let pe=se[N];pe===void 0&&(N==="instanceMatrix"&&W.instanceMatrix&&(pe=W.instanceMatrix),N==="instanceColor"&&W.instanceColor&&(pe=W.instanceColor));const Te={};Te.attribute=pe,pe&&pe.data&&(Te.data=pe.data),z[N]=Te,J++}c.attributes=z,c.attributesNum=J,c.index=X}function S(){const W=c.newAttributes;for(let G=0,K=W.length;G=0){let de=z[be];if(de===void 0&&(be==="instanceMatrix"&&W.instanceMatrix&&(de=W.instanceMatrix),be==="instanceColor"&&W.instanceColor&&(de=W.instanceColor)),de!==void 0){const pe=de.normalized,Te=de.itemSize,Se=t.get(de);if(Se===void 0)continue;const De=Se.buffer,ze=Se.type,Ue=Se.bytesPerElement,dt=i.isWebGL2===!0&&(ze===n.INT||ze===n.UNSIGNED_INT||de.gpuType===dx);if(de.isInterleavedBufferAttribute){const We=de.data,v=We.stride,R=de.offset;if(We.isInstancedInterleavedBuffer){for(let U=0;U0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=r(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,u=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),O=n.getParameter(n.MAX_VERTEX_ATTRIBS),m=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),p=n.getParameter(n.MAX_VARYING_VECTORS),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),S=f>0,x=o||e.has("OES_texture_float"),w=S&&x,T=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:g,maxAttributes:O,maxVertexUniforms:m,maxVaryings:p,maxFragmentUniforms:y,vertexTextures:S,floatFragmentTextures:x,floatVertexTextures:w,maxSamples:T}}function qA(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new zs,a=new qe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const d=u.length!==0||f||i!==0||s;return s=f,i=u.length,d},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,f){t=h(u,f,0)},this.setState=function(u,f,d){const g=u.clippingPlanes,O=u.clipIntersection,m=u.clipShadows,p=n.get(u);if(!s||g===null||g.length===0||r&&!m)r?h(null):c();else{const y=r?0:i,S=y*4;let x=p.clippingState||null;l.value=x,x=h(g,f,S,d);for(let w=0;w!==S;++w)x[w]=t[w];p.clippingState=x,this.numIntersection=O?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(u,f,d,g){const O=u!==null?u.length:0;let m=null;if(O!==0){if(m=l.value,g!==!0||m===null){const p=d+O*4,y=f.matrixWorldInverse;a.getNormalMatrix(y),(m===null||m.length0){const c=new pT(l.height/2);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",s),t(c.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}class Lx extends Cx{constructor(e=-1,t=1,i=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+t,l=s-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,o=r+c*this.view.width,a-=h*this.view.offsetY,l=a-h*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Gr=4,yg=[.125,.215,.35,.446,.526,.582],Zs=20,Au=new Lx,bg=new ct;let Pu=null;const Vs=(1+Math.sqrt(5))/2,Nr=1/Vs,wg=[new F(1,1,1),new F(-1,1,1),new F(1,1,-1),new F(-1,1,-1),new F(0,Vs,Nr),new F(0,Vs,-Nr),new F(Nr,0,Vs),new F(-Nr,0,Vs),new F(Vs,Nr,0),new F(-Vs,Nr,0)];class Mg{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,s=100){Pu=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,s,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ag(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Eg(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?S:0,S,S),h.setRenderTarget(s),O&&h.render(g,a),h.render(e,a)}g.geometry.dispose(),g.material.dispose(),h.toneMapping=f,h.autoClear=u,e.background=m}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===vo||e.mapping===xo;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ag()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Eg());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new wi(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const l=this._cubeSize;Dl(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Au)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let s=1;sZs&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Zs}`);const p=[];let y=0;for(let C=0;CS-Gr?s-S+Gr:0),T=4*(this._cubeSize-x);Dl(t,w,T,3*x,2*x),l.setRenderTarget(t),l.render(u,Au)}}function JA(n){const e=[],t=[],i=[];let s=n;const r=n-Gr+1+yg.length;for(let o=0;on-Gr?l=yg[o-n+Gr-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),h=-c,u=1+c,f=[h,h,u,h,u,u,h,h,u,u,h,u],d=6,g=6,O=3,m=2,p=1,y=new Float32Array(O*g*d),S=new Float32Array(m*g*d),x=new Float32Array(p*g*d);for(let T=0;T2?0:-1,b=[C,k,0,C+2/3,k,0,C+2/3,k+1,0,C,k,0,C+2/3,k+1,0,C,k+1,0];y.set(b,O*g*T),S.set(f,m*g*T);const E=[T,T,T,T,T,T];x.set(E,p*g*T)}const w=new Rs;w.setAttribute("position",new Ai(y,O)),w.setAttribute("uv",new Ai(S,m)),w.setAttribute("faceIndex",new Ai(x,p)),e.push(w),s>Gr&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function Tg(n,e,t){const i=new ur(n,e,t);return i.texture.mapping=Ah,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Dl(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function e2(n,e,t){const i=new Float32Array(Zs),s=new F(0,1,0);return new dr({name:"SphericalGaussianBlur",defines:{n:Zs,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Jd(),fragmentShader:` +}`,je={alphamap_fragment:vT,alphamap_pars_fragment:xT,alphatest_fragment:ST,alphatest_pars_fragment:_T,aomap_fragment:yT,aomap_pars_fragment:bT,begin_vertex:wT,beginnormal_vertex:MT,bsdfs:TT,iridescence_fragment:ET,bumpmap_pars_fragment:AT,clipping_planes_fragment:PT,clipping_planes_pars_fragment:CT,clipping_planes_pars_vertex:RT,clipping_planes_vertex:kT,color_fragment:LT,color_pars_fragment:DT,color_pars_vertex:UT,color_vertex:IT,common:QT,cube_uv_reflection_fragment:NT,defaultnormal_vertex:$T,displacementmap_pars_vertex:FT,displacementmap_vertex:BT,emissivemap_fragment:XT,emissivemap_pars_fragment:zT,encodings_fragment:VT,encodings_pars_fragment:WT,envmap_fragment:GT,envmap_common_pars_fragment:ZT,envmap_pars_fragment:HT,envmap_pars_vertex:YT,envmap_physical_pars_fragment:aE,envmap_vertex:jT,fog_vertex:qT,fog_pars_vertex:KT,fog_fragment:JT,fog_pars_fragment:eE,gradientmap_pars_fragment:tE,lightmap_fragment:nE,lightmap_pars_fragment:iE,lights_lambert_fragment:sE,lights_lambert_pars_fragment:rE,lights_pars_begin:oE,lights_toon_fragment:lE,lights_toon_pars_fragment:cE,lights_phong_fragment:hE,lights_phong_pars_fragment:uE,lights_physical_fragment:fE,lights_physical_pars_fragment:dE,lights_fragment_begin:pE,lights_fragment_maps:mE,lights_fragment_end:gE,logdepthbuf_fragment:OE,logdepthbuf_pars_fragment:vE,logdepthbuf_pars_vertex:xE,logdepthbuf_vertex:SE,map_fragment:_E,map_pars_fragment:yE,map_particle_fragment:bE,map_particle_pars_fragment:wE,metalnessmap_fragment:ME,metalnessmap_pars_fragment:TE,morphcolor_vertex:EE,morphnormal_vertex:AE,morphtarget_pars_vertex:PE,morphtarget_vertex:CE,normal_fragment_begin:RE,normal_fragment_maps:kE,normal_pars_fragment:LE,normal_pars_vertex:DE,normal_vertex:UE,normalmap_pars_fragment:IE,clearcoat_normal_fragment_begin:QE,clearcoat_normal_fragment_maps:NE,clearcoat_pars_fragment:$E,iridescence_pars_fragment:FE,output_fragment:BE,packing:XE,premultiplied_alpha_fragment:zE,project_vertex:VE,dithering_fragment:WE,dithering_pars_fragment:GE,roughnessmap_fragment:ZE,roughnessmap_pars_fragment:HE,shadowmap_pars_fragment:YE,shadowmap_pars_vertex:jE,shadowmap_vertex:qE,shadowmask_pars_fragment:KE,skinbase_vertex:JE,skinning_pars_vertex:eA,skinning_vertex:tA,skinnormal_vertex:nA,specularmap_fragment:iA,specularmap_pars_fragment:sA,tonemapping_fragment:rA,tonemapping_pars_fragment:oA,transmission_fragment:aA,transmission_pars_fragment:lA,uv_pars_fragment:cA,uv_pars_vertex:hA,uv_vertex:uA,worldpos_vertex:fA,background_vert:dA,background_frag:pA,backgroundCube_vert:mA,backgroundCube_frag:gA,cube_vert:OA,cube_frag:vA,depth_vert:xA,depth_frag:SA,distanceRGBA_vert:_A,distanceRGBA_frag:yA,equirect_vert:bA,equirect_frag:wA,linedashed_vert:MA,linedashed_frag:TA,meshbasic_vert:EA,meshbasic_frag:AA,meshlambert_vert:PA,meshlambert_frag:CA,meshmatcap_vert:RA,meshmatcap_frag:kA,meshnormal_vert:LA,meshnormal_frag:DA,meshphong_vert:UA,meshphong_frag:IA,meshphysical_vert:QA,meshphysical_frag:NA,meshtoon_vert:$A,meshtoon_frag:FA,points_vert:BA,points_frag:XA,shadow_vert:zA,shadow_frag:VA,sprite_vert:WA,sprite_frag:GA},Oe={common:{diffuse:{value:new ct(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qe}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qe},normalScale:{value:new Ge(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ct(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ct(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0},uvTransform:{value:new qe}},sprite:{diffuse:{value:new ct(16777215)},opacity:{value:1},center:{value:new Ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}}},vi={basic:{uniforms:hn([Oe.common,Oe.specularmap,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.fog]),vertexShader:je.meshbasic_vert,fragmentShader:je.meshbasic_frag},lambert:{uniforms:hn([Oe.common,Oe.specularmap,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.fog,Oe.lights,{emissive:{value:new ct(0)}}]),vertexShader:je.meshlambert_vert,fragmentShader:je.meshlambert_frag},phong:{uniforms:hn([Oe.common,Oe.specularmap,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.fog,Oe.lights,{emissive:{value:new ct(0)},specular:{value:new ct(1118481)},shininess:{value:30}}]),vertexShader:je.meshphong_vert,fragmentShader:je.meshphong_frag},standard:{uniforms:hn([Oe.common,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.roughnessmap,Oe.metalnessmap,Oe.fog,Oe.lights,{emissive:{value:new ct(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag},toon:{uniforms:hn([Oe.common,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.gradientmap,Oe.fog,Oe.lights,{emissive:{value:new ct(0)}}]),vertexShader:je.meshtoon_vert,fragmentShader:je.meshtoon_frag},matcap:{uniforms:hn([Oe.common,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.fog,{matcap:{value:null}}]),vertexShader:je.meshmatcap_vert,fragmentShader:je.meshmatcap_frag},points:{uniforms:hn([Oe.points,Oe.fog]),vertexShader:je.points_vert,fragmentShader:je.points_frag},dashed:{uniforms:hn([Oe.common,Oe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:je.linedashed_vert,fragmentShader:je.linedashed_frag},depth:{uniforms:hn([Oe.common,Oe.displacementmap]),vertexShader:je.depth_vert,fragmentShader:je.depth_frag},normal:{uniforms:hn([Oe.common,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,{opacity:{value:1}}]),vertexShader:je.meshnormal_vert,fragmentShader:je.meshnormal_frag},sprite:{uniforms:hn([Oe.sprite,Oe.fog]),vertexShader:je.sprite_vert,fragmentShader:je.sprite_frag},background:{uniforms:{uvTransform:{value:new qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:je.background_vert,fragmentShader:je.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:je.backgroundCube_vert,fragmentShader:je.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:je.cube_vert,fragmentShader:je.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:je.equirect_vert,fragmentShader:je.equirect_frag},distanceRGBA:{uniforms:hn([Oe.common,Oe.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:je.distanceRGBA_vert,fragmentShader:je.distanceRGBA_frag},shadow:{uniforms:hn([Oe.lights,Oe.fog,{color:{value:new ct(0)},opacity:{value:1}}]),vertexShader:je.shadow_vert,fragmentShader:je.shadow_frag}};vi.physical={uniforms:hn([vi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qe},clearcoatNormalScale:{value:new Ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qe},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qe},sheen:{value:0},sheenColor:{value:new ct(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qe},transmissionSamplerSize:{value:new Ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qe},attenuationDistance:{value:0},attenuationColor:{value:new ct(0)},specularColor:{value:new ct(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qe},anisotropyVector:{value:new Ge},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qe}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag};const Ll={r:0,b:0,g:0};function ZA(n,e,t,i,s,r,o){const a=new ct(0);let l=r===!0?0:1,c,h,u=null,f=0,d=null;function g(m,p){let y=!1,S=p.isScene===!0?p.background:null;switch(S&&S.isTexture&&(S=(p.backgroundBlurriness>0?t:e).get(S)),S===null?O(a,l):S&&S.isColor&&(O(S,1),y=!0),n.xr.getEnvironmentBlendMode()){case"opaque":y=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,o),y=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,o),y=!0;break}(n.autoClear||y)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),S&&(S.isCubeTexture||S.mapping===Ah)?(h===void 0&&(h=new bi(new Ga(1,1,1),new dr({name:"BackgroundCubeMaterial",uniforms:yo(vi.backgroundCube.uniforms),vertexShader:vi.backgroundCube.vertexShader,fragmentShader:vi.backgroundCube.fragmentShader,side:wn,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(T,C,k){this.matrixWorld.copyPosition(k.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(h)),h.material.uniforms.envMap.value=S,h.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,h.material.toneMapped=S.colorSpace!==He,(u!==S||f!==S.version||d!==n.toneMapping)&&(h.material.needsUpdate=!0,u=S,f=S.version,d=n.toneMapping),h.layers.enableAll(),m.unshift(h,h.geometry,h.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new bi(new Kd(2,2),new dr({name:"BackgroundMaterial",uniforms:yo(vi.background.uniforms),vertexShader:vi.background.vertexShader,fragmentShader:vi.background.fragmentShader,side:ws,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(c)),c.material.uniforms.t2D.value=S,c.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,c.material.toneMapped=S.colorSpace!==He,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(u!==S||f!==S.version||d!==n.toneMapping)&&(c.material.needsUpdate=!0,u=S,f=S.version,d=n.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function O(m,p){m.getRGB(Ll,Px(n)),i.buffers.color.setClear(Ll.r,Ll.g,Ll.b,p,o)}return{getClearColor:function(){return a},setClearColor:function(m,p=1){a.set(m),l=p,O(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,O(a,l)},render:g}}function HA(n,e,t,i){const s=n.getParameter(n.MAX_VERTEX_ATTRIBS),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||r!==null,a={},l=m(null);let c=l,h=!1;function u(W,G,K,X,z){let se=!1;if(o){const J=O(X,K,G);c!==J&&(c=J,d(c.object)),se=p(W,X,K,z),se&&y(W,X,K,z)}else{const J=G.wireframe===!0;(c.geometry!==X.id||c.program!==K.id||c.wireframe!==J)&&(c.geometry=X.id,c.program=K.id,c.wireframe=J,se=!0)}z!==null&&t.update(z,n.ELEMENT_ARRAY_BUFFER),(se||h)&&(h=!1,k(W,G,K,X),z!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(z).buffer))}function f(){return i.isWebGL2?n.createVertexArray():r.createVertexArrayOES()}function d(W){return i.isWebGL2?n.bindVertexArray(W):r.bindVertexArrayOES(W)}function g(W){return i.isWebGL2?n.deleteVertexArray(W):r.deleteVertexArrayOES(W)}function O(W,G,K){const X=K.wireframe===!0;let z=a[W.id];z===void 0&&(z={},a[W.id]=z);let se=z[G.id];se===void 0&&(se={},z[G.id]=se);let J=se[X];return J===void 0&&(J=m(f()),se[X]=J),J}function m(W){const G=[],K=[],X=[];for(let z=0;z=0){const pe=z[N];let Te=se[N];if(Te===void 0&&(N==="instanceMatrix"&&W.instanceMatrix&&(Te=W.instanceMatrix),N==="instanceColor"&&W.instanceColor&&(Te=W.instanceColor)),pe===void 0||pe.attribute!==Te||Te&&pe.data!==Te.data)return!0;J++}return c.attributesNum!==J||c.index!==X}function y(W,G,K,X){const z={},se=G.attributes;let J=0;const be=K.getAttributes();for(const N in be)if(be[N].location>=0){let pe=se[N];pe===void 0&&(N==="instanceMatrix"&&W.instanceMatrix&&(pe=W.instanceMatrix),N==="instanceColor"&&W.instanceColor&&(pe=W.instanceColor));const Te={};Te.attribute=pe,pe&&pe.data&&(Te.data=pe.data),z[N]=Te,J++}c.attributes=z,c.attributesNum=J,c.index=X}function S(){const W=c.newAttributes;for(let G=0,K=W.length;G=0){let de=z[be];if(de===void 0&&(be==="instanceMatrix"&&W.instanceMatrix&&(de=W.instanceMatrix),be==="instanceColor"&&W.instanceColor&&(de=W.instanceColor)),de!==void 0){const pe=de.normalized,Te=de.itemSize,Se=t.get(de);if(Se===void 0)continue;const De=Se.buffer,ze=Se.type,Ue=Se.bytesPerElement,dt=i.isWebGL2===!0&&(ze===n.INT||ze===n.UNSIGNED_INT||de.gpuType===dx);if(de.isInterleavedBufferAttribute){const We=de.data,v=We.stride,R=de.offset;if(We.isInstancedInterleavedBuffer){for(let U=0;U0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=r(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,u=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),O=n.getParameter(n.MAX_VERTEX_ATTRIBS),m=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),p=n.getParameter(n.MAX_VARYING_VECTORS),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),S=f>0,x=o||e.has("OES_texture_float"),w=S&&x,T=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:h,maxTextures:u,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:g,maxAttributes:O,maxVertexUniforms:m,maxVaryings:p,maxFragmentUniforms:y,vertexTextures:S,floatFragmentTextures:x,floatVertexTextures:w,maxSamples:T}}function qA(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new zs,a=new qe,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const d=u.length!==0||f||i!==0||s;return s=f,i=u.length,d},this.beginShadows=function(){r=!0,h(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(u,f){t=h(u,f,0)},this.setState=function(u,f,d){const g=u.clippingPlanes,O=u.clipIntersection,m=u.clipShadows,p=n.get(u);if(!s||g===null||g.length===0||r&&!m)r?h(null):c();else{const y=r?0:i,S=y*4;let x=p.clippingState||null;l.value=x,x=h(g,f,S,d);for(let w=0;w!==S;++w)x[w]=t[w];p.clippingState=x,this.numIntersection=O?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(u,f,d,g){const O=u!==null?u.length:0;let m=null;if(O!==0){if(m=l.value,g!==!0||m===null){const p=d+O*4,y=f.matrixWorldInverse;a.getNormalMatrix(y),(m===null||m.length0){const c=new pT(l.height/2);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",s),t(c.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}class Lx extends Cx{constructor(e=-1,t=1,i=1,s=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,s,r,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+t,l=s-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,o=r+c*this.view.width,a-=h*this.view.offsetY,l=a-h*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Zr=4,yg=[.125,.215,.35,.446,.526,.582],Zs=20,Au=new Lx,bg=new ct;let Pu=null;const Vs=(1+Math.sqrt(5))/2,$r=1/Vs,wg=[new F(1,1,1),new F(-1,1,1),new F(1,1,-1),new F(-1,1,-1),new F(0,Vs,$r),new F(0,Vs,-$r),new F($r,0,Vs),new F(-$r,0,Vs),new F(Vs,$r,0),new F(-Vs,$r,0)];class Mg{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,s=100){Pu=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,s,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ag(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Eg(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?S:0,S,S),h.setRenderTarget(s),O&&h.render(g,a),h.render(e,a)}g.geometry.dispose(),g.material.dispose(),h.toneMapping=f,h.autoClear=u,e.background=m}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===xo||e.mapping===So;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ag()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Eg());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new bi(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const l=this._cubeSize;Dl(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Au)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let s=1;sZs&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Zs}`);const p=[];let y=0;for(let C=0;CS-Zr?s-S+Zr:0),T=4*(this._cubeSize-x);Dl(t,w,T,3*x,2*x),l.setRenderTarget(t),l.render(u,Au)}}function JA(n){const e=[],t=[],i=[];let s=n;const r=n-Zr+1+yg.length;for(let o=0;on-Zr?l=yg[o-n+Zr-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),h=-c,u=1+c,f=[h,h,u,h,u,u,h,h,u,u,h,u],d=6,g=6,O=3,m=2,p=1,y=new Float32Array(O*g*d),S=new Float32Array(m*g*d),x=new Float32Array(p*g*d);for(let T=0;T2?0:-1,b=[C,k,0,C+2/3,k,0,C+2/3,k+1,0,C,k,0,C+2/3,k+1,0,C,k+1,0];y.set(b,O*g*T),S.set(f,m*g*T);const E=[T,T,T,T,T,T];x.set(E,p*g*T)}const w=new Rs;w.setAttribute("position",new Ei(y,O)),w.setAttribute("uv",new Ei(S,m)),w.setAttribute("faceIndex",new Ei(x,p)),e.push(w),s>Zr&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function Tg(n,e,t){const i=new ur(n,e,t);return i.texture.mapping=Ah,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Dl(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function e2(n,e,t){const i=new Float32Array(Zs),s=new F(0,1,0);return new dr({name:"SphericalGaussianBlur",defines:{n:Zs,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:Jd(),fragmentShader:` precision mediump float; precision mediump int; @@ -3427,9 +3427,9 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function t2(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===yf||l===bf,h=l===vo||l===xo;if(c||h)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let u=e.get(a);return t===null&&(t=new Mg(n)),u=c?t.fromEquirectangular(a,u):t.fromCubemap(a,u),e.set(a,u),u.texture}else{if(e.has(a))return e.get(a).texture;{const u=a.image;if(c&&u&&u.height>0||h&&u&&s(u)){t===null&&(t=new Mg(n));const f=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",r),f.texture}else return null}}}return a}function s(a){let l=0;const c=6;for(let h=0;he.maxTextureSize&&(j=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const ae=new Float32Array(E*j*4*O),Q=new wx(ae,E,j,O);Q.type=ps,Q.needsUpdate=!0;const W=b*4;for(let K=0;K0)return n;const s=e*t;let r=Pg[s];if(r===void 0&&(r=new Float32Array(s),Pg[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(r,a)}return r}function Ft(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t0||h&&u&&s(u)){t===null&&(t=new Mg(n));const f=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",r),f.texture}else return null}}}return a}function s(a){let l=0;const c=6;for(let h=0;he.maxTextureSize&&(j=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const ae=new Float32Array(E*j*4*O),Q=new wx(ae,E,j,O);Q.type=ps,Q.needsUpdate=!0;const W=b*4;for(let K=0;K0)return n;const s=e*t;let r=Pg[s];if(r===void 0&&(r=new Float32Array(s),Pg[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(r,a)}return r}function Ft(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` -`)}function nP(n){switch(n){case Ri:return["Linear","( value )"];case He:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),["Linear","( value )"]}}function Ig(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return t.toUpperCase()+` +`)}function nP(n){switch(n){case Ci:return["Linear","( value )"];case He:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),["Linear","( value )"]}}function Ig(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return t.toUpperCase()+` `+s+` @@ -3439,7 +3439,7 @@ void main() { precision `+n.precision+" int;";return n.precision==="highp"?e+=` #define HIGH_PRECISION`:n.precision==="mediump"?e+=` #define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=` -#define LOW_PRECISION`),e}function fP(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===lx?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===Gw?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===Xi&&(e="SHADOWMAP_TYPE_VSM"),e}function dP(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case vo:case xo:e="ENVMAP_TYPE_CUBE";break;case Ah:e="ENVMAP_TYPE_CUBE_UV";break}return e}function pP(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case xo:e="ENVMAP_MODE_REFRACTION";break}return e}function mP(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case ux:e="ENVMAP_BLENDING_MULTIPLY";break;case fM:e="ENVMAP_BLENDING_MIX";break;case dM:e="ENVMAP_BLENDING_ADD";break}return e}function gP(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function OP(n,e,t,i){const s=n.getContext(),r=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=fP(t),c=dP(t),h=pP(t),u=mP(t),f=gP(t),d=t.isWebGL2?"":rP(t),g=oP(r),O=s.createProgram();let m,p,y=t.glslVersion?"#version "+t.glslVersion+` +#define LOW_PRECISION`),e}function fP(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===lx?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===Gw?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===Bi&&(e="SHADOWMAP_TYPE_VSM"),e}function dP(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case xo:case So:e="ENVMAP_TYPE_CUBE";break;case Ah:e="ENVMAP_TYPE_CUBE_UV";break}return e}function pP(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case So:e="ENVMAP_MODE_REFRACTION";break}return e}function mP(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case ux:e="ENVMAP_BLENDING_MULTIPLY";break;case fM:e="ENVMAP_BLENDING_MIX";break;case dM:e="ENVMAP_BLENDING_ADD";break}return e}function gP(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function OP(n,e,t,i){const s=n.getContext(),r=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=fP(t),c=dP(t),h=pP(t),u=mP(t),f=gP(t),d=t.isWebGL2?"":rP(t),g=oP(r),O=s.createProgram();let m,p,y=t.glslVersion?"#version "+t.glslVersion+` `:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ko).join(` `),m.length>0&&(m+=` `),p=[d,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ko).join(` @@ -3457,7 +3457,7 @@ precision `+n.precision+" int;";return n.precision==="highp"?e+=` Program Info Log: `+b+` `+W+` -`+G)}else b!==""?console.warn("THREE.WebGLProgram: Program Info Log:",b):(E===""||j==="")&&(Q=!1);Q&&(this.diagnostics={runnable:ae,programLog:b,vertexShader:{log:E,prefix:m},fragmentShader:{log:j,prefix:p}})}s.deleteShader(w),s.deleteShader(T);let C;this.getUniforms=function(){return C===void 0&&(C=new uc(s,O)),C};let k;return this.getAttributes=function(){return k===void 0&&(k=aP(s,O)),k},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(O),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=eP++,this.cacheKey=e,this.usedTimes=1,this.program=O,this.vertexShader=w,this.fragmentShader=T,this}let vP=0;class xP{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new SP(e),t.set(e,i)),i}}class SP{constructor(e){this.id=vP++,this.code=e,this.usedTimes=0}}function _P(n,e,t,i,s,r,o){const a=new Mx,l=new xP,c=[],h=s.isWebGL2,u=s.logarithmicDepthBuffer,f=s.vertexTextures;let d=s.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function O(b){return b===0?"uv":`uv${b}`}function m(b,E,j,ae,Q){const W=ae.fog,G=Q.geometry,K=b.isMeshStandardMaterial?ae.environment:null,X=(b.isMeshStandardMaterial?t:e).get(b.envMap||K),z=X&&X.mapping===Ah?X.image.height:null,se=g[b.type];b.precision!==null&&(d=s.getMaxPrecision(b.precision),d!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",d,"instead."));const J=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,be=J!==void 0?J.length:0;let N=0;G.morphAttributes.position!==void 0&&(N=1),G.morphAttributes.normal!==void 0&&(N=2),G.morphAttributes.color!==void 0&&(N=3);let de,pe,Te,Se;if(se){const Et=vi[se];de=Et.vertexShader,pe=Et.fragmentShader}else de=b.vertexShader,pe=b.fragmentShader,l.update(b),Te=l.getVertexShaderID(b),Se=l.getFragmentShaderID(b);const De=n.getRenderTarget(),ze=Q.isInstancedMesh===!0,Ue=!!b.map,dt=!!b.matcap,We=!!X,v=!!b.aoMap,R=!!b.lightMap,U=!!b.bumpMap,Z=!!b.normalMap,B=!!b.displacementMap,ce=!!b.emissiveMap,he=!!b.metalnessMap,q=!!b.roughnessMap,ue=b.anisotropy>0,le=b.clearcoat>0,we=b.iridescence>0,M=b.sheen>0,_=b.transmission>0,I=ue&&!!b.anisotropyMap,ee=le&&!!b.clearcoatMap,oe=le&&!!b.clearcoatNormalMap,P=le&&!!b.clearcoatRoughnessMap,te=we&&!!b.iridescenceMap,fe=we&&!!b.iridescenceThicknessMap,H=M&&!!b.sheenColorMap,Ae=M&&!!b.sheenRoughnessMap,Re=!!b.specularMap,ke=!!b.specularColorMap,xe=!!b.specularIntensityMap,_e=_&&!!b.transmissionMap,Ne=_&&!!b.thicknessMap,tt=!!b.gradientMap,L=!!b.alphaMap,ye=b.alphaTest>0,Y=!!b.extensions,me=!!G.attributes.uv1,Me=!!G.attributes.uv2,rt=!!G.attributes.uv3;return{isWebGL2:h,shaderID:se,shaderType:b.type,shaderName:b.name,vertexShader:de,fragmentShader:pe,defines:b.defines,customVertexShaderID:Te,customFragmentShaderID:Se,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:d,instancing:ze,instancingColor:ze&&Q.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:De===null?n.outputColorSpace:De.isXRRenderTarget===!0?De.texture.colorSpace:Ri,map:Ue,matcap:dt,envMap:We,envMapMode:We&&X.mapping,envMapCubeUVHeight:z,aoMap:v,lightMap:R,bumpMap:U,normalMap:Z,displacementMap:f&&B,emissiveMap:ce,normalMapObjectSpace:Z&&b.normalMapType===kM,normalMapTangentSpace:Z&&b.normalMapType===RM,metalnessMap:he,roughnessMap:q,anisotropy:ue,anisotropyMap:I,clearcoat:le,clearcoatMap:ee,clearcoatNormalMap:oe,clearcoatRoughnessMap:P,iridescence:we,iridescenceMap:te,iridescenceThicknessMap:fe,sheen:M,sheenColorMap:H,sheenRoughnessMap:Ae,specularMap:Re,specularColorMap:ke,specularIntensityMap:xe,transmission:_,transmissionMap:_e,thicknessMap:Ne,gradientMap:tt,opaque:b.transparent===!1&&b.blending===to,alphaMap:L,alphaTest:ye,combine:b.combine,mapUv:Ue&&O(b.map.channel),aoMapUv:v&&O(b.aoMap.channel),lightMapUv:R&&O(b.lightMap.channel),bumpMapUv:U&&O(b.bumpMap.channel),normalMapUv:Z&&O(b.normalMap.channel),displacementMapUv:B&&O(b.displacementMap.channel),emissiveMapUv:ce&&O(b.emissiveMap.channel),metalnessMapUv:he&&O(b.metalnessMap.channel),roughnessMapUv:q&&O(b.roughnessMap.channel),anisotropyMapUv:I&&O(b.anisotropyMap.channel),clearcoatMapUv:ee&&O(b.clearcoatMap.channel),clearcoatNormalMapUv:oe&&O(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:P&&O(b.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&O(b.iridescenceMap.channel),iridescenceThicknessMapUv:fe&&O(b.iridescenceThicknessMap.channel),sheenColorMapUv:H&&O(b.sheenColorMap.channel),sheenRoughnessMapUv:Ae&&O(b.sheenRoughnessMap.channel),specularMapUv:Re&&O(b.specularMap.channel),specularColorMapUv:ke&&O(b.specularColorMap.channel),specularIntensityMapUv:xe&&O(b.specularIntensityMap.channel),transmissionMapUv:_e&&O(b.transmissionMap.channel),thicknessMapUv:Ne&&O(b.thicknessMap.channel),alphaMapUv:L&&O(b.alphaMap.channel),vertexTangents:!!G.attributes.tangent&&(Z||ue),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,vertexUv1s:me,vertexUv2s:Me,vertexUv3s:rt,pointsUvs:Q.isPoints===!0&&!!G.attributes.uv&&(Ue||L),fog:!!W,useFog:b.fog===!0,fogExp2:W&&W.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:Q.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:be,morphTextureStride:N,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&j.length>0,shadowMapType:n.shadowMap.type,toneMapping:b.toneMapped?n.toneMapping:Zi,useLegacyLights:n.useLegacyLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Wi,flipSided:b.side===wn,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:Y&&b.extensions.derivatives===!0,extensionFragDepth:Y&&b.extensions.fragDepth===!0,extensionDrawBuffers:Y&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:Y&&b.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function p(b){const E=[];if(b.shaderID?E.push(b.shaderID):(E.push(b.customVertexShaderID),E.push(b.customFragmentShaderID)),b.defines!==void 0)for(const j in b.defines)E.push(j),E.push(b.defines[j]);return b.isRawShaderMaterial===!1&&(y(E,b),S(E,b),E.push(n.outputColorSpace)),E.push(b.customProgramCacheKey),E.join()}function y(b,E){b.push(E.precision),b.push(E.outputColorSpace),b.push(E.envMapMode),b.push(E.envMapCubeUVHeight),b.push(E.mapUv),b.push(E.alphaMapUv),b.push(E.lightMapUv),b.push(E.aoMapUv),b.push(E.bumpMapUv),b.push(E.normalMapUv),b.push(E.displacementMapUv),b.push(E.emissiveMapUv),b.push(E.metalnessMapUv),b.push(E.roughnessMapUv),b.push(E.anisotropyMapUv),b.push(E.clearcoatMapUv),b.push(E.clearcoatNormalMapUv),b.push(E.clearcoatRoughnessMapUv),b.push(E.iridescenceMapUv),b.push(E.iridescenceThicknessMapUv),b.push(E.sheenColorMapUv),b.push(E.sheenRoughnessMapUv),b.push(E.specularMapUv),b.push(E.specularColorMapUv),b.push(E.specularIntensityMapUv),b.push(E.transmissionMapUv),b.push(E.thicknessMapUv),b.push(E.combine),b.push(E.fogExp2),b.push(E.sizeAttenuation),b.push(E.morphTargetsCount),b.push(E.morphAttributeCount),b.push(E.numDirLights),b.push(E.numPointLights),b.push(E.numSpotLights),b.push(E.numSpotLightMaps),b.push(E.numHemiLights),b.push(E.numRectAreaLights),b.push(E.numDirLightShadows),b.push(E.numPointLightShadows),b.push(E.numSpotLightShadows),b.push(E.numSpotLightShadowsWithMaps),b.push(E.shadowMapType),b.push(E.toneMapping),b.push(E.numClippingPlanes),b.push(E.numClipIntersection),b.push(E.depthPacking)}function S(b,E){a.disableAll(),E.isWebGL2&&a.enable(0),E.supportsVertexTextures&&a.enable(1),E.instancing&&a.enable(2),E.instancingColor&&a.enable(3),E.matcap&&a.enable(4),E.envMap&&a.enable(5),E.normalMapObjectSpace&&a.enable(6),E.normalMapTangentSpace&&a.enable(7),E.clearcoat&&a.enable(8),E.iridescence&&a.enable(9),E.alphaTest&&a.enable(10),E.vertexColors&&a.enable(11),E.vertexAlphas&&a.enable(12),E.vertexUv1s&&a.enable(13),E.vertexUv2s&&a.enable(14),E.vertexUv3s&&a.enable(15),E.vertexTangents&&a.enable(16),E.anisotropy&&a.enable(17),b.push(a.mask),a.disableAll(),E.fog&&a.enable(0),E.useFog&&a.enable(1),E.flatShading&&a.enable(2),E.logarithmicDepthBuffer&&a.enable(3),E.skinning&&a.enable(4),E.morphTargets&&a.enable(5),E.morphNormals&&a.enable(6),E.morphColors&&a.enable(7),E.premultipliedAlpha&&a.enable(8),E.shadowMapEnabled&&a.enable(9),E.useLegacyLights&&a.enable(10),E.doubleSided&&a.enable(11),E.flipSided&&a.enable(12),E.useDepthPacking&&a.enable(13),E.dithering&&a.enable(14),E.transmission&&a.enable(15),E.sheen&&a.enable(16),E.opaque&&a.enable(17),E.pointsUvs&&a.enable(18),b.push(a.mask)}function x(b){const E=g[b.type];let j;if(E){const ae=vi[E];j=hT.clone(ae.uniforms)}else j=b.uniforms;return j}function w(b,E){let j;for(let ae=0,Q=c.length;ae0?i.push(p):d.transparent===!0?s.push(p):t.push(p)}function l(u,f,d,g,O,m){const p=o(u,f,d,g,O,m);d.transmission>0?i.unshift(p):d.transparent===!0?s.unshift(p):t.unshift(p)}function c(u,f){t.length>1&&t.sort(u||bP),i.length>1&&i.sort(f||Bg),s.length>1&&s.sort(f||Bg)}function h(){for(let u=e,f=n.length;u=r.length?(o=new Xg,r.push(o)):o=r[s],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function MP(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new ct};break;case"SpotLight":t={position:new F,direction:new F,color:new ct,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new ct,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new ct,groundColor:new ct};break;case"RectAreaLight":t={color:new ct,position:new F,halfWidth:new F,halfHeight:new F};break}return n[e.id]=t,t}}}function TP(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let EP=0;function AP(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function PP(n,e){const t=new MP,i=TP(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let h=0;h<9;h++)s.probe.push(new F);const r=new F,o=new Tt,a=new Tt;function l(h,u){let f=0,d=0,g=0;for(let j=0;j<9;j++)s.probe[j].set(0,0,0);let O=0,m=0,p=0,y=0,S=0,x=0,w=0,T=0,C=0,k=0;h.sort(AP);const b=u===!0?Math.PI:1;for(let j=0,ae=h.length;j0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Oe.LTC_FLOAT_1,s.rectAreaLTC2=Oe.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=Oe.LTC_HALF_1,s.rectAreaLTC2=Oe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=f,s.ambient[1]=d,s.ambient[2]=g;const E=s.hash;(E.directionalLength!==O||E.pointLength!==m||E.spotLength!==p||E.rectAreaLength!==y||E.hemiLength!==S||E.numDirectionalShadows!==x||E.numPointShadows!==w||E.numSpotShadows!==T||E.numSpotMaps!==C)&&(s.directional.length=O,s.spot.length=p,s.rectArea.length=y,s.point.length=m,s.hemi.length=S,s.directionalShadow.length=x,s.directionalShadowMap.length=x,s.pointShadow.length=w,s.pointShadowMap.length=w,s.spotShadow.length=T,s.spotShadowMap.length=T,s.directionalShadowMatrix.length=x,s.pointShadowMatrix.length=w,s.spotLightMatrix.length=T+C-k,s.spotLightMap.length=C,s.numSpotLightShadowsWithMaps=k,E.directionalLength=O,E.pointLength=m,E.spotLength=p,E.rectAreaLength=y,E.hemiLength=S,E.numDirectionalShadows=x,E.numPointShadows=w,E.numSpotShadows=T,E.numSpotMaps=C,s.version=EP++)}function c(h,u){let f=0,d=0,g=0,O=0,m=0;const p=u.matrixWorldInverse;for(let y=0,S=h.length;y=a.length?(l=new zg(n,e),a.push(l)):l=a[o],l}function s(){t=new WeakMap}return{get:i,dispose:s}}class RP extends Ch{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=PM,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class kP extends Ch{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const LP=`void main() { +`+G)}else b!==""?console.warn("THREE.WebGLProgram: Program Info Log:",b):(E===""||j==="")&&(Q=!1);Q&&(this.diagnostics={runnable:ae,programLog:b,vertexShader:{log:E,prefix:m},fragmentShader:{log:j,prefix:p}})}s.deleteShader(w),s.deleteShader(T);let C;this.getUniforms=function(){return C===void 0&&(C=new uc(s,O)),C};let k;return this.getAttributes=function(){return k===void 0&&(k=aP(s,O)),k},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(O),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=eP++,this.cacheKey=e,this.usedTimes=1,this.program=O,this.vertexShader=w,this.fragmentShader=T,this}let vP=0;class xP{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new SP(e),t.set(e,i)),i}}class SP{constructor(e){this.id=vP++,this.code=e,this.usedTimes=0}}function _P(n,e,t,i,s,r,o){const a=new Mx,l=new xP,c=[],h=s.isWebGL2,u=s.logarithmicDepthBuffer,f=s.vertexTextures;let d=s.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function O(b){return b===0?"uv":`uv${b}`}function m(b,E,j,ae,Q){const W=ae.fog,G=Q.geometry,K=b.isMeshStandardMaterial?ae.environment:null,X=(b.isMeshStandardMaterial?t:e).get(b.envMap||K),z=X&&X.mapping===Ah?X.image.height:null,se=g[b.type];b.precision!==null&&(d=s.getMaxPrecision(b.precision),d!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",d,"instead."));const J=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,be=J!==void 0?J.length:0;let N=0;G.morphAttributes.position!==void 0&&(N=1),G.morphAttributes.normal!==void 0&&(N=2),G.morphAttributes.color!==void 0&&(N=3);let de,pe,Te,Se;if(se){const Et=vi[se];de=Et.vertexShader,pe=Et.fragmentShader}else de=b.vertexShader,pe=b.fragmentShader,l.update(b),Te=l.getVertexShaderID(b),Se=l.getFragmentShaderID(b);const De=n.getRenderTarget(),ze=Q.isInstancedMesh===!0,Ue=!!b.map,dt=!!b.matcap,We=!!X,v=!!b.aoMap,R=!!b.lightMap,U=!!b.bumpMap,Z=!!b.normalMap,B=!!b.displacementMap,ce=!!b.emissiveMap,he=!!b.metalnessMap,q=!!b.roughnessMap,ue=b.anisotropy>0,le=b.clearcoat>0,we=b.iridescence>0,M=b.sheen>0,_=b.transmission>0,I=ue&&!!b.anisotropyMap,ee=le&&!!b.clearcoatMap,oe=le&&!!b.clearcoatNormalMap,P=le&&!!b.clearcoatRoughnessMap,te=we&&!!b.iridescenceMap,fe=we&&!!b.iridescenceThicknessMap,H=M&&!!b.sheenColorMap,Ae=M&&!!b.sheenRoughnessMap,Re=!!b.specularMap,ke=!!b.specularColorMap,xe=!!b.specularIntensityMap,_e=_&&!!b.transmissionMap,Ne=_&&!!b.thicknessMap,et=!!b.gradientMap,L=!!b.alphaMap,ye=b.alphaTest>0,Y=!!b.extensions,me=!!G.attributes.uv1,Me=!!G.attributes.uv2,rt=!!G.attributes.uv3;return{isWebGL2:h,shaderID:se,shaderType:b.type,shaderName:b.name,vertexShader:de,fragmentShader:pe,defines:b.defines,customVertexShaderID:Te,customFragmentShaderID:Se,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:d,instancing:ze,instancingColor:ze&&Q.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:De===null?n.outputColorSpace:De.isXRRenderTarget===!0?De.texture.colorSpace:Ci,map:Ue,matcap:dt,envMap:We,envMapMode:We&&X.mapping,envMapCubeUVHeight:z,aoMap:v,lightMap:R,bumpMap:U,normalMap:Z,displacementMap:f&&B,emissiveMap:ce,normalMapObjectSpace:Z&&b.normalMapType===kM,normalMapTangentSpace:Z&&b.normalMapType===RM,metalnessMap:he,roughnessMap:q,anisotropy:ue,anisotropyMap:I,clearcoat:le,clearcoatMap:ee,clearcoatNormalMap:oe,clearcoatRoughnessMap:P,iridescence:we,iridescenceMap:te,iridescenceThicknessMap:fe,sheen:M,sheenColorMap:H,sheenRoughnessMap:Ae,specularMap:Re,specularColorMap:ke,specularIntensityMap:xe,transmission:_,transmissionMap:_e,thicknessMap:Ne,gradientMap:et,opaque:b.transparent===!1&&b.blending===no,alphaMap:L,alphaTest:ye,combine:b.combine,mapUv:Ue&&O(b.map.channel),aoMapUv:v&&O(b.aoMap.channel),lightMapUv:R&&O(b.lightMap.channel),bumpMapUv:U&&O(b.bumpMap.channel),normalMapUv:Z&&O(b.normalMap.channel),displacementMapUv:B&&O(b.displacementMap.channel),emissiveMapUv:ce&&O(b.emissiveMap.channel),metalnessMapUv:he&&O(b.metalnessMap.channel),roughnessMapUv:q&&O(b.roughnessMap.channel),anisotropyMapUv:I&&O(b.anisotropyMap.channel),clearcoatMapUv:ee&&O(b.clearcoatMap.channel),clearcoatNormalMapUv:oe&&O(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:P&&O(b.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&O(b.iridescenceMap.channel),iridescenceThicknessMapUv:fe&&O(b.iridescenceThicknessMap.channel),sheenColorMapUv:H&&O(b.sheenColorMap.channel),sheenRoughnessMapUv:Ae&&O(b.sheenRoughnessMap.channel),specularMapUv:Re&&O(b.specularMap.channel),specularColorMapUv:ke&&O(b.specularColorMap.channel),specularIntensityMapUv:xe&&O(b.specularIntensityMap.channel),transmissionMapUv:_e&&O(b.transmissionMap.channel),thicknessMapUv:Ne&&O(b.thicknessMap.channel),alphaMapUv:L&&O(b.alphaMap.channel),vertexTangents:!!G.attributes.tangent&&(Z||ue),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,vertexUv1s:me,vertexUv2s:Me,vertexUv3s:rt,pointsUvs:Q.isPoints===!0&&!!G.attributes.uv&&(Ue||L),fog:!!W,useFog:b.fog===!0,fogExp2:W&&W.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:u,skinning:Q.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:be,morphTextureStride:N,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&j.length>0,shadowMapType:n.shadowMap.type,toneMapping:b.toneMapped?n.toneMapping:Zi,useLegacyLights:n.useLegacyLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Vi,flipSided:b.side===wn,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:Y&&b.extensions.derivatives===!0,extensionFragDepth:Y&&b.extensions.fragDepth===!0,extensionDrawBuffers:Y&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:Y&&b.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function p(b){const E=[];if(b.shaderID?E.push(b.shaderID):(E.push(b.customVertexShaderID),E.push(b.customFragmentShaderID)),b.defines!==void 0)for(const j in b.defines)E.push(j),E.push(b.defines[j]);return b.isRawShaderMaterial===!1&&(y(E,b),S(E,b),E.push(n.outputColorSpace)),E.push(b.customProgramCacheKey),E.join()}function y(b,E){b.push(E.precision),b.push(E.outputColorSpace),b.push(E.envMapMode),b.push(E.envMapCubeUVHeight),b.push(E.mapUv),b.push(E.alphaMapUv),b.push(E.lightMapUv),b.push(E.aoMapUv),b.push(E.bumpMapUv),b.push(E.normalMapUv),b.push(E.displacementMapUv),b.push(E.emissiveMapUv),b.push(E.metalnessMapUv),b.push(E.roughnessMapUv),b.push(E.anisotropyMapUv),b.push(E.clearcoatMapUv),b.push(E.clearcoatNormalMapUv),b.push(E.clearcoatRoughnessMapUv),b.push(E.iridescenceMapUv),b.push(E.iridescenceThicknessMapUv),b.push(E.sheenColorMapUv),b.push(E.sheenRoughnessMapUv),b.push(E.specularMapUv),b.push(E.specularColorMapUv),b.push(E.specularIntensityMapUv),b.push(E.transmissionMapUv),b.push(E.thicknessMapUv),b.push(E.combine),b.push(E.fogExp2),b.push(E.sizeAttenuation),b.push(E.morphTargetsCount),b.push(E.morphAttributeCount),b.push(E.numDirLights),b.push(E.numPointLights),b.push(E.numSpotLights),b.push(E.numSpotLightMaps),b.push(E.numHemiLights),b.push(E.numRectAreaLights),b.push(E.numDirLightShadows),b.push(E.numPointLightShadows),b.push(E.numSpotLightShadows),b.push(E.numSpotLightShadowsWithMaps),b.push(E.shadowMapType),b.push(E.toneMapping),b.push(E.numClippingPlanes),b.push(E.numClipIntersection),b.push(E.depthPacking)}function S(b,E){a.disableAll(),E.isWebGL2&&a.enable(0),E.supportsVertexTextures&&a.enable(1),E.instancing&&a.enable(2),E.instancingColor&&a.enable(3),E.matcap&&a.enable(4),E.envMap&&a.enable(5),E.normalMapObjectSpace&&a.enable(6),E.normalMapTangentSpace&&a.enable(7),E.clearcoat&&a.enable(8),E.iridescence&&a.enable(9),E.alphaTest&&a.enable(10),E.vertexColors&&a.enable(11),E.vertexAlphas&&a.enable(12),E.vertexUv1s&&a.enable(13),E.vertexUv2s&&a.enable(14),E.vertexUv3s&&a.enable(15),E.vertexTangents&&a.enable(16),E.anisotropy&&a.enable(17),b.push(a.mask),a.disableAll(),E.fog&&a.enable(0),E.useFog&&a.enable(1),E.flatShading&&a.enable(2),E.logarithmicDepthBuffer&&a.enable(3),E.skinning&&a.enable(4),E.morphTargets&&a.enable(5),E.morphNormals&&a.enable(6),E.morphColors&&a.enable(7),E.premultipliedAlpha&&a.enable(8),E.shadowMapEnabled&&a.enable(9),E.useLegacyLights&&a.enable(10),E.doubleSided&&a.enable(11),E.flipSided&&a.enable(12),E.useDepthPacking&&a.enable(13),E.dithering&&a.enable(14),E.transmission&&a.enable(15),E.sheen&&a.enable(16),E.opaque&&a.enable(17),E.pointsUvs&&a.enable(18),b.push(a.mask)}function x(b){const E=g[b.type];let j;if(E){const ae=vi[E];j=hT.clone(ae.uniforms)}else j=b.uniforms;return j}function w(b,E){let j;for(let ae=0,Q=c.length;ae0?i.push(p):d.transparent===!0?s.push(p):t.push(p)}function l(u,f,d,g,O,m){const p=o(u,f,d,g,O,m);d.transmission>0?i.unshift(p):d.transparent===!0?s.unshift(p):t.unshift(p)}function c(u,f){t.length>1&&t.sort(u||bP),i.length>1&&i.sort(f||Bg),s.length>1&&s.sort(f||Bg)}function h(){for(let u=e,f=n.length;u=r.length?(o=new Xg,r.push(o)):o=r[s],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function MP(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new ct};break;case"SpotLight":t={position:new F,direction:new F,color:new ct,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new ct,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new ct,groundColor:new ct};break;case"RectAreaLight":t={color:new ct,position:new F,halfWidth:new F,halfHeight:new F};break}return n[e.id]=t,t}}}function TP(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let EP=0;function AP(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function PP(n,e){const t=new MP,i=TP(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let h=0;h<9;h++)s.probe.push(new F);const r=new F,o=new Tt,a=new Tt;function l(h,u){let f=0,d=0,g=0;for(let j=0;j<9;j++)s.probe[j].set(0,0,0);let O=0,m=0,p=0,y=0,S=0,x=0,w=0,T=0,C=0,k=0;h.sort(AP);const b=u===!0?Math.PI:1;for(let j=0,ae=h.length;j0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Oe.LTC_FLOAT_1,s.rectAreaLTC2=Oe.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=Oe.LTC_HALF_1,s.rectAreaLTC2=Oe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=f,s.ambient[1]=d,s.ambient[2]=g;const E=s.hash;(E.directionalLength!==O||E.pointLength!==m||E.spotLength!==p||E.rectAreaLength!==y||E.hemiLength!==S||E.numDirectionalShadows!==x||E.numPointShadows!==w||E.numSpotShadows!==T||E.numSpotMaps!==C)&&(s.directional.length=O,s.spot.length=p,s.rectArea.length=y,s.point.length=m,s.hemi.length=S,s.directionalShadow.length=x,s.directionalShadowMap.length=x,s.pointShadow.length=w,s.pointShadowMap.length=w,s.spotShadow.length=T,s.spotShadowMap.length=T,s.directionalShadowMatrix.length=x,s.pointShadowMatrix.length=w,s.spotLightMatrix.length=T+C-k,s.spotLightMap.length=C,s.numSpotLightShadowsWithMaps=k,E.directionalLength=O,E.pointLength=m,E.spotLength=p,E.rectAreaLength=y,E.hemiLength=S,E.numDirectionalShadows=x,E.numPointShadows=w,E.numSpotShadows=T,E.numSpotMaps=C,s.version=EP++)}function c(h,u){let f=0,d=0,g=0,O=0,m=0;const p=u.matrixWorldInverse;for(let y=0,S=h.length;y=a.length?(l=new zg(n,e),a.push(l)):l=a[o],l}function s(){t=new WeakMap}return{get:i,dispose:s}}class RP extends Ch{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=PM,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class kP extends Ch{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const LP=`void main() { gl_Position = vec4( position, 1.0 ); }`,DP=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -3485,7 +3485,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function UP(n,e,t){let i=new qd;const s=new Ge,r=new Ge,o=new Wt,a=new RP({depthPacking:CM}),l=new kP,c={},h=t.maxTextureSize,u={[ws]:wn,[wn]:ws,[Wi]:Wi},f=new dr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ge},radius:{value:4}},vertexShader:LP,fragmentShader:DP}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const g=new Rs;g.setAttribute("position",new Ai(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const O=new wi(g,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=lx;let p=this.type;this.render=function(w,T,C){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;const k=n.getRenderTarget(),b=n.getActiveCubeFace(),E=n.getActiveMipmapLevel(),j=n.state;j.setBlending(vs),j.buffers.color.setClear(1,1,1,1),j.buffers.depth.setTest(!0),j.setScissorTest(!1);const ae=p!==Xi&&this.type===Xi,Q=p===Xi&&this.type!==Xi;for(let W=0,G=w.length;Wh||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/z.x),s.x=r.x*z.x,X.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/z.y),s.y=r.y*z.y,X.mapSize.y=r.y)),X.map===null||ae===!0||Q===!0){const J=this.type!==Xi?{minFilter:un,magFilter:un}:{};X.map!==null&&X.map.dispose(),X.map=new ur(s.x,s.y,J),X.map.texture.name=K.name+".shadowMap",X.camera.updateProjectionMatrix()}n.setRenderTarget(X.map),n.clear();const se=X.getViewportCount();for(let J=0;J0||T.map&&T.alphaTest>0){const j=b.uuid,ae=T.uuid;let Q=c[j];Q===void 0&&(Q={},c[j]=Q);let W=Q[ae];W===void 0&&(W=b.clone(),Q[ae]=W),b=W}if(b.visible=T.visible,b.wireframe=T.wireframe,k===Xi?b.side=T.shadowSide!==null?T.shadowSide:T.side:b.side=T.shadowSide!==null?T.shadowSide:u[T.side],b.alphaMap=T.alphaMap,b.alphaTest=T.alphaTest,b.map=T.map,b.clipShadows=T.clipShadows,b.clippingPlanes=T.clippingPlanes,b.clipIntersection=T.clipIntersection,b.displacementMap=T.displacementMap,b.displacementScale=T.displacementScale,b.displacementBias=T.displacementBias,b.wireframeLinewidth=T.wireframeLinewidth,b.linewidth=T.linewidth,C.isPointLight===!0&&b.isMeshDistanceMaterial===!0){const j=n.properties.get(b);j.light=C}return b}function x(w,T,C,k,b){if(w.visible===!1)return;if(w.layers.test(T.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&b===Xi)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,w.matrixWorld);const ae=e.update(w),Q=w.material;if(Array.isArray(Q)){const W=ae.groups;for(let G=0,K=W.length;G=1):z.indexOf("OpenGL ES")!==-1&&(X=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),K=X>=2);let se=null,J={};const be=n.getParameter(n.SCISSOR_BOX),N=n.getParameter(n.VIEWPORT),de=new Wt().fromArray(be),pe=new Wt().fromArray(N);function Te(L,ye,Y,me){const Me=new Uint8Array(4),rt=n.createTexture();n.bindTexture(L,rt),n.texParameteri(L,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(L,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let yt=0;yt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap;let O;const m=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(M,_){return p?new OffscreenCanvas(M,_):Lc("canvas")}function S(M,_,I,ee){let oe=1;if((M.width>ee||M.height>ee)&&(oe=ee/Math.max(M.width,M.height)),oe<1||_===!0)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap){const P=_?Af:Math.floor,te=P(oe*M.width),fe=P(oe*M.height);O===void 0&&(O=y(te,fe));const H=I?y(te,fe):O;return H.width=te,H.height=fe,H.getContext("2d").drawImage(M,0,0,te,fe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+M.width+"x"+M.height+") to ("+te+"x"+fe+")."),H}else return"data"in M&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+M.width+"x"+M.height+")."),M;return M}function x(M){return og(M.width)&&og(M.height)}function w(M){return a?!1:M.wrapS!==ii||M.wrapT!==ii||M.minFilter!==un&&M.minFilter!==Fn}function T(M,_){return M.generateMipmaps&&_&&M.minFilter!==un&&M.minFilter!==Fn}function C(M){n.generateMipmap(M)}function k(M,_,I,ee,oe=!1){if(a===!1)return _;if(M!==null){if(n[M]!==void 0)return n[M];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let P=_;return _===n.RED&&(I===n.FLOAT&&(P=n.R32F),I===n.HALF_FLOAT&&(P=n.R16F),I===n.UNSIGNED_BYTE&&(P=n.R8)),_===n.RG&&(I===n.FLOAT&&(P=n.RG32F),I===n.HALF_FLOAT&&(P=n.RG16F),I===n.UNSIGNED_BYTE&&(P=n.RG8)),_===n.RGBA&&(I===n.FLOAT&&(P=n.RGBA32F),I===n.HALF_FLOAT&&(P=n.RGBA16F),I===n.UNSIGNED_BYTE&&(P=ee===He&&oe===!1?n.SRGB8_ALPHA8:n.RGBA8),I===n.UNSIGNED_SHORT_4_4_4_4&&(P=n.RGBA4),I===n.UNSIGNED_SHORT_5_5_5_1&&(P=n.RGB5_A1)),(P===n.R16F||P===n.R32F||P===n.RG16F||P===n.RG32F||P===n.RGBA16F||P===n.RGBA32F)&&e.get("EXT_color_buffer_float"),P}function b(M,_,I){return T(M,I)===!0||M.isFramebufferTexture&&M.minFilter!==un&&M.minFilter!==Fn?Math.log2(Math.max(_.width,_.height))+1:M.mipmaps!==void 0&&M.mipmaps.length>0?M.mipmaps.length:M.isCompressedTexture&&Array.isArray(M.image)?_.mipmaps.length:1}function E(M){return M===un||M===Dm||M===nu?n.NEAREST:n.LINEAR}function j(M){const _=M.target;_.removeEventListener("dispose",j),Q(_),_.isVideoTexture&&g.delete(_)}function ae(M){const _=M.target;_.removeEventListener("dispose",ae),G(_)}function Q(M){const _=i.get(M);if(_.__webglInit===void 0)return;const I=M.source,ee=m.get(I);if(ee){const oe=ee[_.__cacheKey];oe.usedTimes--,oe.usedTimes===0&&W(M),Object.keys(ee).length===0&&m.delete(I)}i.remove(M)}function W(M){const _=i.get(M);n.deleteTexture(_.__webglTexture);const I=M.source,ee=m.get(I);delete ee[_.__cacheKey],o.memory.textures--}function G(M){const _=M.texture,I=i.get(M),ee=i.get(_);if(ee.__webglTexture!==void 0&&(n.deleteTexture(ee.__webglTexture),o.memory.textures--),M.depthTexture&&M.depthTexture.dispose(),M.isWebGLCubeRenderTarget)for(let oe=0;oe<6;oe++)n.deleteFramebuffer(I.__webglFramebuffer[oe]),I.__webglDepthbuffer&&n.deleteRenderbuffer(I.__webglDepthbuffer[oe]);else{if(n.deleteFramebuffer(I.__webglFramebuffer),I.__webglDepthbuffer&&n.deleteRenderbuffer(I.__webglDepthbuffer),I.__webglMultisampledFramebuffer&&n.deleteFramebuffer(I.__webglMultisampledFramebuffer),I.__webglColorRenderbuffer)for(let oe=0;oe=l&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+l),K+=1,M}function se(M){const _=[];return _.push(M.wrapS),_.push(M.wrapT),_.push(M.wrapR||0),_.push(M.magFilter),_.push(M.minFilter),_.push(M.anisotropy),_.push(M.internalFormat),_.push(M.format),_.push(M.type),_.push(M.generateMipmaps),_.push(M.premultiplyAlpha),_.push(M.flipY),_.push(M.unpackAlignment),_.push(M.colorSpace),_.join()}function J(M,_){const I=i.get(M);if(M.isVideoTexture&&le(M),M.isRenderTargetTexture===!1&&M.version>0&&I.__version!==M.version){const ee=M.image;if(ee===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ue(I,M,_);return}}t.bindTexture(n.TEXTURE_2D,I.__webglTexture,n.TEXTURE0+_)}function be(M,_){const I=i.get(M);if(M.version>0&&I.__version!==M.version){Ue(I,M,_);return}t.bindTexture(n.TEXTURE_2D_ARRAY,I.__webglTexture,n.TEXTURE0+_)}function N(M,_){const I=i.get(M);if(M.version>0&&I.__version!==M.version){Ue(I,M,_);return}t.bindTexture(n.TEXTURE_3D,I.__webglTexture,n.TEXTURE0+_)}function de(M,_){const I=i.get(M);if(M.version>0&&I.__version!==M.version){dt(I,M,_);return}t.bindTexture(n.TEXTURE_CUBE_MAP,I.__webglTexture,n.TEXTURE0+_)}const pe={[wf]:n.REPEAT,[ii]:n.CLAMP_TO_EDGE,[Mf]:n.MIRRORED_REPEAT},Te={[un]:n.NEAREST,[Dm]:n.NEAREST_MIPMAP_NEAREST,[nu]:n.NEAREST_MIPMAP_LINEAR,[Fn]:n.LINEAR,[xM]:n.LINEAR_MIPMAP_NEAREST,[wa]:n.LINEAR_MIPMAP_LINEAR},Se={[DM]:n.NEVER,[BM]:n.ALWAYS,[UM]:n.LESS,[QM]:n.LEQUAL,[IM]:n.EQUAL,[FM]:n.GEQUAL,[NM]:n.GREATER,[$M]:n.NOTEQUAL};function De(M,_,I){if(I?(n.texParameteri(M,n.TEXTURE_WRAP_S,pe[_.wrapS]),n.texParameteri(M,n.TEXTURE_WRAP_T,pe[_.wrapT]),(M===n.TEXTURE_3D||M===n.TEXTURE_2D_ARRAY)&&n.texParameteri(M,n.TEXTURE_WRAP_R,pe[_.wrapR]),n.texParameteri(M,n.TEXTURE_MAG_FILTER,Te[_.magFilter]),n.texParameteri(M,n.TEXTURE_MIN_FILTER,Te[_.minFilter])):(n.texParameteri(M,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(M,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(M===n.TEXTURE_3D||M===n.TEXTURE_2D_ARRAY)&&n.texParameteri(M,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(_.wrapS!==ii||_.wrapT!==ii)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(M,n.TEXTURE_MAG_FILTER,E(_.magFilter)),n.texParameteri(M,n.TEXTURE_MIN_FILTER,E(_.minFilter)),_.minFilter!==un&&_.minFilter!==Fn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),_.compareFunction&&(n.texParameteri(M,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(M,n.TEXTURE_COMPARE_FUNC,Se[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ee=e.get("EXT_texture_filter_anisotropic");if(_.magFilter===un||_.minFilter!==nu&&_.minFilter!==wa||_.type===ps&&e.has("OES_texture_float_linear")===!1||a===!1&&_.type===Ma&&e.has("OES_texture_half_float_linear")===!1)return;(_.anisotropy>1||i.get(_).__currentAnisotropy)&&(n.texParameterf(M,ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,s.getMaxAnisotropy())),i.get(_).__currentAnisotropy=_.anisotropy)}}function ze(M,_){let I=!1;M.__webglInit===void 0&&(M.__webglInit=!0,_.addEventListener("dispose",j));const ee=_.source;let oe=m.get(ee);oe===void 0&&(oe={},m.set(ee,oe));const P=se(_);if(P!==M.__cacheKey){oe[P]===void 0&&(oe[P]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,I=!0),oe[P].usedTimes++;const te=oe[M.__cacheKey];te!==void 0&&(oe[M.__cacheKey].usedTimes--,te.usedTimes===0&&W(_)),M.__cacheKey=P,M.__webglTexture=oe[P].texture}return I}function Ue(M,_,I){let ee=n.TEXTURE_2D;(_.isDataArrayTexture||_.isCompressedArrayTexture)&&(ee=n.TEXTURE_2D_ARRAY),_.isData3DTexture&&(ee=n.TEXTURE_3D);const oe=ze(M,_),P=_.source;t.bindTexture(ee,M.__webglTexture,n.TEXTURE0+I);const te=i.get(P);if(P.version!==te.__version||oe===!0){t.activeTexture(n.TEXTURE0+I),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const fe=w(_)&&x(_.image)===!1;let H=S(_.image,fe,!1,h);H=we(_,H);const Ae=x(H)||a,Re=r.convert(_.format,_.colorSpace);let ke=r.convert(_.type),xe=k(_.internalFormat,Re,ke,_.colorSpace);De(ee,_,Ae);let _e;const Ne=_.mipmaps,tt=a&&_.isVideoTexture!==!0,L=te.__version===void 0||oe===!0,ye=b(_,H,Ae);if(_.isDepthTexture)xe=n.DEPTH_COMPONENT,a?_.type===ps?xe=n.DEPTH_COMPONENT32F:_.type===ds?xe=n.DEPTH_COMPONENT24:_.type===ir?xe=n.DEPTH24_STENCIL8:xe=n.DEPTH_COMPONENT16:_.type===ps&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),_.format===sr&&xe===n.DEPTH_COMPONENT&&_.type!==Yd&&_.type!==ds&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),_.type=ds,ke=r.convert(_.type)),_.format===So&&xe===n.DEPTH_COMPONENT&&(xe=n.DEPTH_STENCIL,_.type!==ir&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),_.type=ir,ke=r.convert(_.type))),L&&(tt?t.texStorage2D(n.TEXTURE_2D,1,xe,H.width,H.height):t.texImage2D(n.TEXTURE_2D,0,xe,H.width,H.height,0,Re,ke,null));else if(_.isDataTexture)if(Ne.length>0&&Ae){tt&&L&&t.texStorage2D(n.TEXTURE_2D,ye,xe,Ne[0].width,Ne[0].height);for(let Y=0,me=Ne.length;Y>=1,me>>=1}}else if(Ne.length>0&&Ae){tt&&L&&t.texStorage2D(n.TEXTURE_2D,ye,xe,Ne[0].width,Ne[0].height);for(let Y=0,me=Ne.length;Y0&&L++,t.texStorage2D(n.TEXTURE_CUBE_MAP,L,_e,H[0].width,H[0].height));for(let Y=0;Y<6;Y++)if(fe){Ne?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,H[Y].width,H[Y].height,ke,xe,H[Y].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,_e,H[Y].width,H[Y].height,0,ke,xe,H[Y].data);for(let me=0;me=n.TEXTURE_CUBE_MAP_POSITIVE_X&&oe<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ee,oe,i.get(I).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function v(M,_,I){if(n.bindRenderbuffer(n.RENDERBUFFER,M),_.depthBuffer&&!_.stencilBuffer){let ee=n.DEPTH_COMPONENT16;if(I||ue(_)){const oe=_.depthTexture;oe&&oe.isDepthTexture&&(oe.type===ps?ee=n.DEPTH_COMPONENT32F:oe.type===ds&&(ee=n.DEPTH_COMPONENT24));const P=q(_);ue(_)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,P,ee,_.width,_.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,P,ee,_.width,_.height)}else n.renderbufferStorage(n.RENDERBUFFER,ee,_.width,_.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,M)}else if(_.depthBuffer&&_.stencilBuffer){const ee=q(_);I&&ue(_)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,ee,n.DEPTH24_STENCIL8,_.width,_.height):ue(_)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ee,n.DEPTH24_STENCIL8,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,_.width,_.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,M)}else{const ee=_.isWebGLMultipleRenderTargets===!0?_.texture:[_.texture];for(let oe=0;oe0&&ue(M)===!1){const fe=P?_:[_];I.__webglMultisampledFramebuffer=n.createFramebuffer(),I.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,I.__webglMultisampledFramebuffer);for(let H=0;H0&&ue(M)===!1){const _=M.isWebGLMultipleRenderTargets?M.texture:[M.texture],I=M.width,ee=M.height;let oe=n.COLOR_BUFFER_BIT;const P=[],te=M.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,fe=i.get(M),H=M.isWebGLMultipleRenderTargets===!0;if(H)for(let Ae=0;Ae<_.length;Ae++)t.bindFramebuffer(n.FRAMEBUFFER,fe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ae,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,fe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ae,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,fe.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,fe.__webglFramebuffer);for(let Ae=0;Ae<_.length;Ae++){P.push(n.COLOR_ATTACHMENT0+Ae),M.depthBuffer&&P.push(te);const Re=fe.__ignoreDepthValues!==void 0?fe.__ignoreDepthValues:!1;if(Re===!1&&(M.depthBuffer&&(oe|=n.DEPTH_BUFFER_BIT),M.stencilBuffer&&(oe|=n.STENCIL_BUFFER_BIT)),H&&n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,fe.__webglColorRenderbuffer[Ae]),Re===!0&&(n.invalidateFramebuffer(n.READ_FRAMEBUFFER,[te]),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[te])),H){const ke=i.get(_[Ae]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,ke,0)}n.blitFramebuffer(0,0,I,ee,0,0,I,ee,oe,n.NEAREST),d&&n.invalidateFramebuffer(n.READ_FRAMEBUFFER,P)}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),H)for(let Ae=0;Ae<_.length;Ae++){t.bindFramebuffer(n.FRAMEBUFFER,fe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ae,n.RENDERBUFFER,fe.__webglColorRenderbuffer[Ae]);const Re=i.get(_[Ae]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,fe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ae,n.TEXTURE_2D,Re,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,fe.__webglMultisampledFramebuffer)}}function q(M){return Math.min(u,M.samples)}function ue(M){const _=i.get(M);return a&&M.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function le(M){const _=o.render.frame;g.get(M)!==_&&(g.set(M,_),M.update())}function we(M,_){const I=M.colorSpace,ee=M.format,oe=M.type;return M.isCompressedTexture===!0||M.format===Tf||I!==Ri&&I!==or&&(I===He?a===!1?e.has("EXT_sRGB")===!0&&ee===si?(M.format=Tf,M.minFilter=Fn,M.generateMipmaps=!1):_=yx.sRGBToLinear(_):(ee!==si||oe!==xs)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",I)),_}this.allocateTextureUnit=z,this.resetTextureUnits=X,this.setTexture2D=J,this.setTexture2DArray=be,this.setTexture3D=N,this.setTextureCube=de,this.rebindTextures=Z,this.setupRenderTarget=B,this.updateRenderTargetMipmap=ce,this.updateMultisampleRenderTarget=he,this.setupDepthRenderbuffer=U,this.setupFrameBufferTexture=We,this.useMultisampledRTT=ue}function NP(n,e,t){const i=t.isWebGL2;function s(r,o=or){let a;if(r===xs)return n.UNSIGNED_BYTE;if(r===px)return n.UNSIGNED_SHORT_4_4_4_4;if(r===mx)return n.UNSIGNED_SHORT_5_5_5_1;if(r===SM)return n.BYTE;if(r===_M)return n.SHORT;if(r===Yd)return n.UNSIGNED_SHORT;if(r===dx)return n.INT;if(r===ds)return n.UNSIGNED_INT;if(r===ps)return n.FLOAT;if(r===Ma)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===yM)return n.ALPHA;if(r===si)return n.RGBA;if(r===bM)return n.LUMINANCE;if(r===wM)return n.LUMINANCE_ALPHA;if(r===sr)return n.DEPTH_COMPONENT;if(r===So)return n.DEPTH_STENCIL;if(r===Tf)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===MM)return n.RED;if(r===gx)return n.RED_INTEGER;if(r===TM)return n.RG;if(r===Ox)return n.RG_INTEGER;if(r===vx)return n.RGBA_INTEGER;if(r===iu||r===su||r===ru||r===ou)if(o===He)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===iu)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===su)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===ru)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===ou)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===iu)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===su)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===ru)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===ou)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Um||r===Im||r===Qm||r===Nm)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===Um)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===Im)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Qm)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Nm)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===EM)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===$m||r===Fm)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===$m)return o===He?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===Fm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Bm||r===Xm||r===zm||r===Vm||r===Wm||r===Gm||r===Zm||r===Hm||r===Ym||r===jm||r===qm||r===Km||r===Jm||r===eg)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===Bm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Xm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===zm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===Vm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Wm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Gm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Zm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Hm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===Ym)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===jm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===qm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Km)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===Jm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===eg)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===au)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===au)return o===He?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(r===AM||r===tg||r===ng||r===ig)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===au)return a.COMPRESSED_RED_RGTC1_EXT;if(r===tg)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===ng)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===ig)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===ir?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[r]!==void 0?n[r]:null}return{convert:s}}class $P extends Bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Jo extends Gt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const FP={type:"move"};class Ru{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Jo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Jo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Jo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const O of e.hand.values()){const m=t.getJointPose(O,i),p=this._getHandJoint(c,O);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,g=.005;c.inputState.pinching&&f>d+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(FP)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Jo;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class BP extends Nn{constructor(e,t,i,s,r,o,a,l,c,h){if(h=h!==void 0?h:sr,h!==sr&&h!==So)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===sr&&(i=ds),i===void 0&&h===So&&(i=ir),super(null,s,r,o,a,l,h,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:un,this.minFilter=l!==void 0?l:un,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class XP extends Or{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,c=null,h=null,u=null,f=null,d=null,g=null;const O=t.getContextAttributes();let m=null,p=null;const y=[],S=[];let x=null;const w=new Bn;w.layers.enable(1),w.viewport=new Wt;const T=new Bn;T.layers.enable(2),T.viewport=new Wt;const C=[w,T],k=new $P;k.layers.enable(1),k.layers.enable(2);let b=null,E=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getCamera=function(){},this.setUserCamera=function(N){x=N},this.getController=function(N){let de=y[N];return de===void 0&&(de=new Ru,y[N]=de),de.getTargetRaySpace()},this.getControllerGrip=function(N){let de=y[N];return de===void 0&&(de=new Ru,y[N]=de),de.getGripSpace()},this.getHand=function(N){let de=y[N];return de===void 0&&(de=new Ru,y[N]=de),de.getHandSpace()};function j(N){const de=S.indexOf(N.inputSource);if(de===-1)return;const pe=y[de];pe!==void 0&&(pe.update(N.inputSource,N.frame,c||o),pe.dispatchEvent({type:N.type,data:N.inputSource}))}function ae(){s.removeEventListener("select",j),s.removeEventListener("selectstart",j),s.removeEventListener("selectend",j),s.removeEventListener("squeeze",j),s.removeEventListener("squeezestart",j),s.removeEventListener("squeezeend",j),s.removeEventListener("end",ae),s.removeEventListener("inputsourceschange",Q);for(let N=0;N=0&&(S[Te]=null,y[Te].disconnect(pe))}for(let de=0;de=S.length){S.push(pe),Te=De;break}else if(S[De]===null){S[De]=pe,Te=De;break}if(Te===-1)break}const Se=y[Te];Se&&Se.connect(pe)}}const W=new F,G=new F;function K(N,de,pe){W.setFromMatrixPosition(de.matrixWorld),G.setFromMatrixPosition(pe.matrixWorld);const Te=W.distanceTo(G),Se=de.projectionMatrix.elements,De=pe.projectionMatrix.elements,ze=Se[14]/(Se[10]-1),Ue=Se[14]/(Se[10]+1),dt=(Se[9]+1)/Se[5],We=(Se[9]-1)/Se[5],v=(Se[8]-1)/Se[0],R=(De[8]+1)/De[0],U=ze*v,Z=ze*R,B=Te/(-v+R),ce=B*-v;de.matrixWorld.decompose(N.position,N.quaternion,N.scale),N.translateX(ce),N.translateZ(B),N.matrixWorld.compose(N.position,N.quaternion,N.scale),N.matrixWorldInverse.copy(N.matrixWorld).invert();const he=ze+B,q=Ue+B,ue=U-ce,le=Z+(Te-ce),we=dt*Ue/q*he,M=We*Ue/q*he;N.projectionMatrix.makePerspective(ue,le,we,M,he,q),N.projectionMatrixInverse.copy(N.projectionMatrix).invert()}function X(N,de){de===null?N.matrixWorld.copy(N.matrix):N.matrixWorld.multiplyMatrices(de.matrixWorld,N.matrix),N.matrixWorldInverse.copy(N.matrixWorld).invert()}this.updateCameraXR=function(N){if(s===null)return N;x&&(N=x),k.near=T.near=w.near=N.near,k.far=T.far=w.far=N.far,(b!==k.near||E!==k.far)&&(s.updateRenderState({depthNear:k.near,depthFar:k.far}),b=k.near,E=k.far);const de=N.parent,pe=k.cameras;X(k,de);for(let Te=0;Te0&&(m.alphaTest.value=p.alphaTest);const y=e.get(p).envMap;if(y&&(m.envMap.value=y,m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap){m.lightMap.value=p.lightMap;const S=n.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=p.lightMapIntensity*S,t(p.lightMap,m.lightMapTransform)}p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,y,S){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*y,m.scale.value=S*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function h(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function f(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),e.get(p).envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function d(m,p,y){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===wn&&m.clearcoatNormalScale.value.negate())),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function O(m,p){const y=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function VP(n,e,t,i){let s={},r={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(y,S){const x=S.program;i.uniformBlockBinding(y,x)}function c(y,S){let x=s[y.id];x===void 0&&(g(y),x=h(y),s[y.id]=x,y.addEventListener("dispose",m));const w=S.program;i.updateUBOMapping(y,w);const T=e.render.frame;r[y.id]!==T&&(f(y),r[y.id]=T)}function h(y){const S=u();y.__bindingPointIndex=S;const x=n.createBuffer(),w=y.__size,T=y.usage;return n.bindBuffer(n.UNIFORM_BUFFER,x),n.bufferData(n.UNIFORM_BUFFER,w,T),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,S,x),x}function u(){for(let y=0;y0){T=x%w;const ae=w-T;T!==0&&ae-E.boundary<0&&(x+=w-T,b.__offset=x)}x+=E.storage}return T=x%w,T>0&&(x+=w-T),y.__size=x,y.__cache={},this}function O(y){const S={boundary:0,storage:0};return typeof y=="number"?(S.boundary=4,S.storage=4):y.isVector2?(S.boundary=8,S.storage=8):y.isVector3||y.isColor?(S.boundary=16,S.storage=12):y.isVector4?(S.boundary=16,S.storage=16):y.isMatrix3?(S.boundary=48,S.storage=48):y.isMatrix4?(S.boundary=64,S.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),S}function m(y){const S=y.target;S.removeEventListener("dispose",m);const x=o.indexOf(S.__bindingPointIndex);o.splice(x,1),n.deleteBuffer(s[S.id]),delete s[S.id],delete r[S.id]}function p(){for(const y in s)n.deleteBuffer(s[y]);o=[],s={},r={}}return{bind:l,update:c,dispose:p}}function WP(){const n=Lc("canvas");return n.style.display="block",n}class Nx{constructor(e={}){const{canvas:t=WP(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=o;const d=new Uint32Array(4),g=new Int32Array(4);let O=null,m=null;const p=[],y=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputColorSpace=He,this.useLegacyLights=!0,this.toneMapping=Zi,this.toneMappingExposure=1;const S=this;let x=!1,w=0,T=0,C=null,k=-1,b=null;const E=new Wt,j=new Wt;let ae=null;const Q=new ct(0);let W=0,G=t.width,K=t.height,X=1,z=null,se=null;const J=new Wt(0,0,G,K),be=new Wt(0,0,G,K);let N=!1;const de=new qd;let pe=!1,Te=!1,Se=null;const De=new Tt,ze=new Ge,Ue=new F,dt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function We(){return C===null?X:1}let v=i;function R(A,V){for(let ne=0;ne0?m=y[y.length-1]:m=null,p.pop(),p.length>0?O=p[p.length-1]:O=null};function Xp(A,V,ne,$){if(A.visible===!1)return;if(A.layers.test(V.layers)){if(A.isGroup)ne=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(V);else if(A.isLight)m.pushLight(A),A.castShadow&&m.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||de.intersectsSprite(A)){$&&Ue.setFromMatrixPosition(A.matrixWorld).applyMatrix4(De);const $e=_.update(A),Fe=A.material;Fe.visible&&O.push(A,$e,Fe,ne,Ue.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(!A.frustumCulled||de.intersectsObject(A))){A.isSkinnedMesh&&A.skeleton.frame!==ce.render.frame&&(A.skeleton.update(),A.skeleton.frame=ce.render.frame);const $e=_.update(A),Fe=A.material;if($&&(A.boundingSphere!==void 0?(A.boundingSphere===null&&A.computeBoundingSphere(),Ue.copy(A.boundingSphere.center)):($e.boundingSphere===null&&$e.computeBoundingSphere(),Ue.copy($e.boundingSphere.center)),Ue.applyMatrix4(A.matrixWorld).applyMatrix4(De)),Array.isArray(Fe)){const Be=$e.groups;for(let Je=0,Ve=Be.length;Je0&&uy(ie,Pe,V,ne),$&&B.viewport(E.copy($)),ie.length>0&&ol(ie,V,ne),Pe.length>0&&ol(Pe,V,ne),$e.length>0&&ol($e,V,ne),B.buffers.depth.setTest(!0),B.buffers.depth.setMask(!0),B.buffers.color.setMask(!0),B.setPolygonOffset(!1)}function uy(A,V,ne,$){const ie=Z.isWebGL2;Se===null&&(Se=new ur(1,1,{generateMipmaps:!0,type:U.has("EXT_color_buffer_half_float")?Ma:xs,minFilter:wa,samples:ie&&a===!0?4:0})),S.getDrawingBufferSize(ze),ie?Se.setSize(ze.x,ze.y):Se.setSize(Af(ze.x),Af(ze.y));const Pe=S.getRenderTarget();S.setRenderTarget(Se),S.getClearColor(Q),W=S.getClearAlpha(),W<1&&S.setClearColor(16777215,.5),S.clear();const $e=S.toneMapping;S.toneMapping=Zi,ol(A,ne,$),q.updateMultisampleRenderTarget(Se),q.updateRenderTargetMipmap(Se);let Fe=!1;for(let Be=0,Je=V.length;Be0),Ze=!!ne.morphAttributes.position,pt=!!ne.morphAttributes.normal,wt=!!ne.morphAttributes.color,Hn=$.toneMapped?S.toneMapping:Zi,Ui=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,At=Ui!==void 0?Ui.length:0,it=he.get($),Gh=m.state.lights;if(pe===!0&&(Te===!0||A!==b)){const En=A===b&&$.id===k;te.setState($,A,En)}let zt=!1;$.version===it.__version?(it.needsLights&&it.lightsStateVersion!==Gh.state.version||it.outputColorSpace!==Fe||ie.isInstancedMesh&&it.instancing===!1||!ie.isInstancedMesh&&it.instancing===!0||ie.isSkinnedMesh&&it.skinning===!1||!ie.isSkinnedMesh&&it.skinning===!0||it.envMap!==Be||$.fog===!0&&it.fog!==Pe||it.numClippingPlanes!==void 0&&(it.numClippingPlanes!==te.numPlanes||it.numIntersection!==te.numIntersection)||it.vertexAlphas!==Je||it.vertexTangents!==Ve||it.morphTargets!==Ze||it.morphNormals!==pt||it.morphColors!==wt||it.toneMapping!==Hn||Z.isWebGL2===!0&&it.morphTargetsCount!==At)&&(zt=!0):(zt=!0,it.__version=$.version);let Ds=it.currentProgram;zt===!0&&(Ds=al($,V,ie));let Gp=!1,Qo=!1,Zh=!1;const ln=Ds.getUniforms(),Us=it.uniforms;if(B.useProgram(Ds.program)&&(Gp=!0,Qo=!0,Zh=!0),$.id!==k&&(k=$.id,Qo=!0),Gp||b!==A){if(ln.setValue(v,"projectionMatrix",A.projectionMatrix),Z.logarithmicDepthBuffer&&ln.setValue(v,"logDepthBufFC",2/(Math.log(A.far+1)/Math.LN2)),b!==A&&(b=A,Qo=!0,Zh=!0),$.isShaderMaterial||$.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshStandardMaterial||$.envMap){const En=ln.map.cameraPosition;En!==void 0&&En.setValue(v,Ue.setFromMatrixPosition(A.matrixWorld))}($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial)&&ln.setValue(v,"isOrthographic",A.isOrthographicCamera===!0),($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial||$.isShadowMaterial||ie.isSkinnedMesh)&&ln.setValue(v,"viewMatrix",A.matrixWorldInverse)}if(ie.isSkinnedMesh){ln.setOptional(v,ie,"bindMatrix"),ln.setOptional(v,ie,"bindMatrixInverse");const En=ie.skeleton;En&&(Z.floatVertexTextures?(En.boneTexture===null&&En.computeBoneTexture(),ln.setValue(v,"boneTexture",En.boneTexture,q),ln.setValue(v,"boneTextureSize",En.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Hh=ne.morphAttributes;if((Hh.position!==void 0||Hh.normal!==void 0||Hh.color!==void 0&&Z.isWebGL2===!0)&&Ae.update(ie,ne,Ds),(Qo||it.receiveShadow!==ie.receiveShadow)&&(it.receiveShadow=ie.receiveShadow,ln.setValue(v,"receiveShadow",ie.receiveShadow)),$.isMeshGouraudMaterial&&$.envMap!==null&&(Us.envMap.value=Be,Us.flipEnvMap.value=Be.isCubeTexture&&Be.isRenderTargetTexture===!1?-1:1),Qo&&(ln.setValue(v,"toneMappingExposure",S.toneMappingExposure),it.needsLights&&dy(Us,Zh),Pe&&$.fog===!0&&ee.refreshFogUniforms(Us,Pe),ee.refreshMaterialUniforms(Us,$,X,K,Se),uc.upload(v,it.uniformsList,Us,q)),$.isShaderMaterial&&$.uniformsNeedUpdate===!0&&(uc.upload(v,it.uniformsList,Us,q),$.uniformsNeedUpdate=!1),$.isSpriteMaterial&&ln.setValue(v,"center",ie.center),ln.setValue(v,"modelViewMatrix",ie.modelViewMatrix),ln.setValue(v,"normalMatrix",ie.normalMatrix),ln.setValue(v,"modelMatrix",ie.matrixWorld),$.isShaderMaterial||$.isRawShaderMaterial){const En=$.uniformsGroups;for(let Yh=0,my=En.length;Yh0&&q.useMultisampledRTT(A)===!1?ie=he.get(A).__webglMultisampledFramebuffer:ie=Ve,E.copy(A.viewport),j.copy(A.scissor),ae=A.scissorTest}else E.copy(J).multiplyScalar(X).floor(),j.copy(be).multiplyScalar(X).floor(),ae=N;if(B.bindFramebuffer(v.FRAMEBUFFER,ie)&&Z.drawBuffers&&$&&B.drawBuffers(A,ie),B.viewport(E),B.scissor(j),B.setScissorTest(ae),Pe){const Be=he.get(A.texture);v.framebufferTexture2D(v.FRAMEBUFFER,v.COLOR_ATTACHMENT0,v.TEXTURE_CUBE_MAP_POSITIVE_X+V,Be.__webglTexture,ne)}else if($e){const Be=he.get(A.texture),Je=V||0;v.framebufferTextureLayer(v.FRAMEBUFFER,v.COLOR_ATTACHMENT0,Be.__webglTexture,ne||0,Je)}k=-1},this.readRenderTargetPixels=function(A,V,ne,$,ie,Pe,$e){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=he.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&$e!==void 0&&(Fe=Fe[$e]),Fe){B.bindFramebuffer(v.FRAMEBUFFER,Fe);try{const Be=A.texture,Je=Be.format,Ve=Be.type;if(Je!==si&&xe.convert(Je)!==v.getParameter(v.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=Ve===Ma&&(U.has("EXT_color_buffer_half_float")||Z.isWebGL2&&U.has("EXT_color_buffer_float"));if(Ve!==xs&&xe.convert(Ve)!==v.getParameter(v.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ve===ps&&(Z.isWebGL2||U.has("OES_texture_float")||U.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}V>=0&&V<=A.width-$&&ne>=0&&ne<=A.height-ie&&v.readPixels(V,ne,$,ie,xe.convert(Je),xe.convert(Ve),Pe)}finally{const Be=C!==null?he.get(C).__webglFramebuffer:null;B.bindFramebuffer(v.FRAMEBUFFER,Be)}}},this.copyFramebufferToTexture=function(A,V,ne=0){const $=Math.pow(2,-ne),ie=Math.floor(V.image.width*$),Pe=Math.floor(V.image.height*$);q.setTexture2D(V,0),v.copyTexSubImage2D(v.TEXTURE_2D,ne,0,0,A.x,A.y,ie,Pe),B.unbindTexture()},this.copyTextureToTexture=function(A,V,ne,$=0){const ie=V.image.width,Pe=V.image.height,$e=xe.convert(ne.format),Fe=xe.convert(ne.type);q.setTexture2D(ne,0),v.pixelStorei(v.UNPACK_FLIP_Y_WEBGL,ne.flipY),v.pixelStorei(v.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ne.premultiplyAlpha),v.pixelStorei(v.UNPACK_ALIGNMENT,ne.unpackAlignment),V.isDataTexture?v.texSubImage2D(v.TEXTURE_2D,$,A.x,A.y,ie,Pe,$e,Fe,V.image.data):V.isCompressedTexture?v.compressedTexSubImage2D(v.TEXTURE_2D,$,A.x,A.y,V.mipmaps[0].width,V.mipmaps[0].height,$e,V.mipmaps[0].data):v.texSubImage2D(v.TEXTURE_2D,$,A.x,A.y,$e,Fe,V.image),$===0&&ne.generateMipmaps&&v.generateMipmap(v.TEXTURE_2D),B.unbindTexture()},this.copyTextureToTexture3D=function(A,V,ne,$,ie=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Pe=A.max.x-A.min.x+1,$e=A.max.y-A.min.y+1,Fe=A.max.z-A.min.z+1,Be=xe.convert($.format),Je=xe.convert($.type);let Ve;if($.isData3DTexture)q.setTexture3D($,0),Ve=v.TEXTURE_3D;else if($.isDataArrayTexture)q.setTexture2DArray($,0),Ve=v.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}v.pixelStorei(v.UNPACK_FLIP_Y_WEBGL,$.flipY),v.pixelStorei(v.UNPACK_PREMULTIPLY_ALPHA_WEBGL,$.premultiplyAlpha),v.pixelStorei(v.UNPACK_ALIGNMENT,$.unpackAlignment);const Ze=v.getParameter(v.UNPACK_ROW_LENGTH),pt=v.getParameter(v.UNPACK_IMAGE_HEIGHT),wt=v.getParameter(v.UNPACK_SKIP_PIXELS),Hn=v.getParameter(v.UNPACK_SKIP_ROWS),Ui=v.getParameter(v.UNPACK_SKIP_IMAGES),At=ne.isCompressedTexture?ne.mipmaps[0]:ne.image;v.pixelStorei(v.UNPACK_ROW_LENGTH,At.width),v.pixelStorei(v.UNPACK_IMAGE_HEIGHT,At.height),v.pixelStorei(v.UNPACK_SKIP_PIXELS,A.min.x),v.pixelStorei(v.UNPACK_SKIP_ROWS,A.min.y),v.pixelStorei(v.UNPACK_SKIP_IMAGES,A.min.z),ne.isDataTexture||ne.isData3DTexture?v.texSubImage3D(Ve,ie,V.x,V.y,V.z,Pe,$e,Fe,Be,Je,At.data):ne.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),v.compressedTexSubImage3D(Ve,ie,V.x,V.y,V.z,Pe,$e,Fe,Be,At.data)):v.texSubImage3D(Ve,ie,V.x,V.y,V.z,Pe,$e,Fe,Be,Je,At),v.pixelStorei(v.UNPACK_ROW_LENGTH,Ze),v.pixelStorei(v.UNPACK_IMAGE_HEIGHT,pt),v.pixelStorei(v.UNPACK_SKIP_PIXELS,wt),v.pixelStorei(v.UNPACK_SKIP_ROWS,Hn),v.pixelStorei(v.UNPACK_SKIP_IMAGES,Ui),ie===0&&$.generateMipmaps&&v.generateMipmap(Ve),B.unbindTexture()},this.initTexture=function(A){A.isCubeTexture?q.setTextureCube(A,0):A.isData3DTexture?q.setTexture3D(A,0):A.isDataArrayTexture||A.isCompressedArrayTexture?q.setTexture2DArray(A,0):q.setTexture2D(A,0),B.unbindTexture()},this.resetState=function(){w=0,T=0,C=null,B.reset(),_e.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Gi}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===He?rr:xx}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===rr?He:Ri}}class GP extends Nx{}GP.prototype.isWebGL1Renderer=!0;class ZP extends Gt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class ep extends Rs{constructor(e=1,t=32,i=16,s=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:s,phiLength:r,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const h=[],u=new F,f=new F,d=[],g=[],O=[],m=[];for(let p=0;p<=i;p++){const y=[],S=p/i;let x=0;p===0&&o===0?x=.5/t:p===i&&l===Math.PI&&(x=-.5/t);for(let w=0;w<=t;w++){const T=w/t;u.x=-e*Math.cos(s+T*r)*Math.sin(o+S*a),u.y=e*Math.cos(o+S*a),u.z=e*Math.sin(s+T*r)*Math.sin(o+S*a),g.push(u.x,u.y,u.z),f.copy(u).normalize(),O.push(f.x,f.y,f.z),m.push(T+x,1-S),y.push(c++)}h.push(y)}for(let p=0;p0)&&d.push(S,x,T),(p!==i-1||l=-1&&$r.z<=1&&d.layers.test(O.layers)===!0;if(d.element.style.display=m===!0?"":"none",m===!0){d.onBeforeRender(t,g,O);const y=d.element;y.style.transform="translate("+-100*d.center.x+"%,"+-100*d.center.y+"%)translate("+($r.x*r+r)+"px,"+(-$r.y*o+o)+"px)",y.parentNode!==l&&l.appendChild(y),d.onAfterRender(t,g,O)}const p={distanceToCameraSquared:h(O,d)};a.objects.set(d,p)}for(let m=0,p=d.children.length;mMath.PI&&(Ne-=ke),tt<-Math.PI?tt+=ke:tt>Math.PI&&(tt-=ke),Ne<=tt?a.theta=Math.max(Ne,Math.min(tt,a.theta)):a.theta=a.theta>(Ne+tt)/2?Math.max(Ne,a.theta):Math.min(tt,a.theta)),a.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=c,a.radius=Math.max(i.minDistance,Math.min(i.maxDistance,a.radius)),i.enableDamping===!0?i.target.addScaledVector(h,i.dampingFactor):i.target.add(h),P.setFromSpherical(a),P.applyQuaternion(fe),_e.copy(i.target).add(P),i.object.lookAt(i.target),i.enableDamping===!0?(l.theta*=1-i.dampingFactor,l.phi*=1-i.dampingFactor,h.multiplyScalar(1-i.dampingFactor)):(l.set(0,0,0),h.set(0,0,0)),c=1,u||H.distanceToSquared(i.object.position)>o||8*(1-Ae.dot(i.object.quaternion))>o||Re.distanceToSquared(i.target)>0?(i.dispatchEvent(qg),H.copy(i.object.position),Ae.copy(i.object.quaternion),Re.copy(i.target),u=!1,!0):!1}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",M),i.domElement.removeEventListener("pointerdown",U),i.domElement.removeEventListener("pointercancel",B),i.domElement.removeEventListener("wheel",q),i.domElement.removeEventListener("pointermove",Z),i.domElement.removeEventListener("pointerup",B),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",ue),i._domElementKeyEvents=null)};const i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=s.NONE;const o=1e-6,a=new Gg,l=new Gg;let c=1;const h=new F;let u=!1;const f=new Ge,d=new Ge,g=new Ge,O=new Ge,m=new Ge,p=new Ge,y=new Ge,S=new Ge,x=new Ge,w=[],T={};function C(){return 2*Math.PI/60/60*i.autoRotateSpeed}function k(){return Math.pow(.95,i.zoomSpeed)}function b(P){l.theta-=P}function E(P){l.phi-=P}const j=function(){const P=new F;return function(fe,H){P.setFromMatrixColumn(H,0),P.multiplyScalar(-fe),h.add(P)}}(),ae=function(){const P=new F;return function(fe,H){i.screenSpacePanning===!0?P.setFromMatrixColumn(H,1):(P.setFromMatrixColumn(H,0),P.crossVectors(i.object.up,P)),P.multiplyScalar(fe),h.add(P)}}(),Q=function(){const P=new F;return function(fe,H){const Ae=i.domElement;if(i.object.isPerspectiveCamera){const Re=i.object.position;P.copy(Re).sub(i.target);let ke=P.length();ke*=Math.tan(i.object.fov/2*Math.PI/180),j(2*fe*ke/Ae.clientHeight,i.object.matrix),ae(2*H*ke/Ae.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(j(fe*(i.object.right-i.object.left)/i.object.zoom/Ae.clientWidth,i.object.matrix),ae(H*(i.object.top-i.object.bottom)/i.object.zoom/Ae.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function W(P){i.object.isPerspectiveCamera?c/=P:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*P)),i.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function G(P){i.object.isPerspectiveCamera?c*=P:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/P)),i.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function K(P){f.set(P.clientX,P.clientY)}function X(P){y.set(P.clientX,P.clientY)}function z(P){O.set(P.clientX,P.clientY)}function se(P){d.set(P.clientX,P.clientY),g.subVectors(d,f).multiplyScalar(i.rotateSpeed);const te=i.domElement;b(2*Math.PI*g.x/te.clientHeight),E(2*Math.PI*g.y/te.clientHeight),f.copy(d),i.update()}function J(P){S.set(P.clientX,P.clientY),x.subVectors(S,y),x.y>0?W(k()):x.y<0&&G(k()),y.copy(S),i.update()}function be(P){m.set(P.clientX,P.clientY),p.subVectors(m,O).multiplyScalar(i.panSpeed),Q(p.x,p.y),O.copy(m),i.update()}function N(P){P.deltaY<0?G(k()):P.deltaY>0&&W(k()),i.update()}function de(P){let te=!1;switch(P.code){case i.keys.UP:P.ctrlKey||P.metaKey||P.shiftKey?E(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):Q(0,i.keyPanSpeed),te=!0;break;case i.keys.BOTTOM:P.ctrlKey||P.metaKey||P.shiftKey?E(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):Q(0,-i.keyPanSpeed),te=!0;break;case i.keys.LEFT:P.ctrlKey||P.metaKey||P.shiftKey?b(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):Q(i.keyPanSpeed,0),te=!0;break;case i.keys.RIGHT:P.ctrlKey||P.metaKey||P.shiftKey?b(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):Q(-i.keyPanSpeed,0),te=!0;break}te&&(P.preventDefault(),i.update())}function pe(){if(w.length===1)f.set(w[0].pageX,w[0].pageY);else{const P=.5*(w[0].pageX+w[1].pageX),te=.5*(w[0].pageY+w[1].pageY);f.set(P,te)}}function Te(){if(w.length===1)O.set(w[0].pageX,w[0].pageY);else{const P=.5*(w[0].pageX+w[1].pageX),te=.5*(w[0].pageY+w[1].pageY);O.set(P,te)}}function Se(){const P=w[0].pageX-w[1].pageX,te=w[0].pageY-w[1].pageY,fe=Math.sqrt(P*P+te*te);y.set(0,fe)}function De(){i.enableZoom&&Se(),i.enablePan&&Te()}function ze(){i.enableZoom&&Se(),i.enableRotate&&pe()}function Ue(P){if(w.length==1)d.set(P.pageX,P.pageY);else{const fe=oe(P),H=.5*(P.pageX+fe.x),Ae=.5*(P.pageY+fe.y);d.set(H,Ae)}g.subVectors(d,f).multiplyScalar(i.rotateSpeed);const te=i.domElement;b(2*Math.PI*g.x/te.clientHeight),E(2*Math.PI*g.y/te.clientHeight),f.copy(d)}function dt(P){if(w.length===1)m.set(P.pageX,P.pageY);else{const te=oe(P),fe=.5*(P.pageX+te.x),H=.5*(P.pageY+te.y);m.set(fe,H)}p.subVectors(m,O).multiplyScalar(i.panSpeed),Q(p.x,p.y),O.copy(m)}function We(P){const te=oe(P),fe=P.pageX-te.x,H=P.pageY-te.y,Ae=Math.sqrt(fe*fe+H*H);S.set(0,Ae),x.set(0,Math.pow(S.y/y.y,i.zoomSpeed)),W(x.y),y.copy(S)}function v(P){i.enableZoom&&We(P),i.enablePan&&dt(P)}function R(P){i.enableZoom&&We(P),i.enableRotate&&Ue(P)}function U(P){i.enabled!==!1&&(w.length===0&&(i.domElement.setPointerCapture(P.pointerId),i.domElement.addEventListener("pointermove",Z),i.domElement.addEventListener("pointerup",B)),_(P),P.pointerType==="touch"?le(P):ce(P))}function Z(P){i.enabled!==!1&&(P.pointerType==="touch"?we(P):he(P))}function B(P){I(P),w.length===0&&(i.domElement.releasePointerCapture(P.pointerId),i.domElement.removeEventListener("pointermove",Z),i.domElement.removeEventListener("pointerup",B)),i.dispatchEvent(Kg),r=s.NONE}function ce(P){let te;switch(P.button){case 0:te=i.mouseButtons.LEFT;break;case 1:te=i.mouseButtons.MIDDLE;break;case 2:te=i.mouseButtons.RIGHT;break;default:te=-1}switch(te){case _r.DOLLY:if(i.enableZoom===!1)return;X(P),r=s.DOLLY;break;case _r.ROTATE:if(P.ctrlKey||P.metaKey||P.shiftKey){if(i.enablePan===!1)return;z(P),r=s.PAN}else{if(i.enableRotate===!1)return;K(P),r=s.ROTATE}break;case _r.PAN:if(P.ctrlKey||P.metaKey||P.shiftKey){if(i.enableRotate===!1)return;K(P),r=s.ROTATE}else{if(i.enablePan===!1)return;z(P),r=s.PAN}break;default:r=s.NONE}r!==s.NONE&&i.dispatchEvent(Lu)}function he(P){switch(r){case s.ROTATE:if(i.enableRotate===!1)return;se(P);break;case s.DOLLY:if(i.enableZoom===!1)return;J(P);break;case s.PAN:if(i.enablePan===!1)return;be(P);break}}function q(P){i.enabled===!1||i.enableZoom===!1||r!==s.NONE||(P.preventDefault(),i.dispatchEvent(Lu),N(P),i.dispatchEvent(Kg))}function ue(P){i.enabled===!1||i.enablePan===!1||de(P)}function le(P){switch(ee(P),w.length){case 1:switch(i.touches.ONE){case yr.ROTATE:if(i.enableRotate===!1)return;pe(),r=s.TOUCH_ROTATE;break;case yr.PAN:if(i.enablePan===!1)return;Te(),r=s.TOUCH_PAN;break;default:r=s.NONE}break;case 2:switch(i.touches.TWO){case yr.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;De(),r=s.TOUCH_DOLLY_PAN;break;case yr.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;ze(),r=s.TOUCH_DOLLY_ROTATE;break;default:r=s.NONE}break;default:r=s.NONE}r!==s.NONE&&i.dispatchEvent(Lu)}function we(P){switch(ee(P),r){case s.TOUCH_ROTATE:if(i.enableRotate===!1)return;Ue(P),i.update();break;case s.TOUCH_PAN:if(i.enablePan===!1)return;dt(P),i.update();break;case s.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;v(P),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;R(P),i.update();break;default:r=s.NONE}}function M(P){i.enabled!==!1&&P.preventDefault()}function _(P){w.push(P)}function I(P){delete T[P.pointerId];for(let te=0;te{ar.value+=1,ar.value>np.value&&(ar.value=tp.value)},tC=()=>{ar.value-=1,ar.value{const n=Fx.value,e=Bx.value;Du&&clearInterval(Du),n&&(Du=setInterval(Xx,1e3/e))});const Lh=()=>({advanceFrame:Xx,previousFrame:tC,isPlaying:Fx,startFrame:tp,endFrame:np,currentFrame:ar,framesPerSecond:Bx});function nC(n){return xv()?(ky(n),!0):!1}function ip(n){return typeof n=="function"?n():et(n)}const iC=typeof window<"u",sC=()=>{};function rC(n,e){function t(...i){return new Promise((s,r)=>{Promise.resolve(n(()=>e.apply(this,i),{fn:e,thisArg:this,args:i})).then(s).catch(r)})}return t}const zx=n=>n();function oC(n=zx){const e=Lt(!0);function t(){e.value=!1}function i(){e.value=!0}const s=(...r)=>{e.value&&n(...r)};return{isActive:Ud(e),pause:t,resume:i,eventFilter:s}}var Jg=Object.getOwnPropertySymbols,aC=Object.prototype.hasOwnProperty,lC=Object.prototype.propertyIsEnumerable,cC=(n,e)=>{var t={};for(var i in n)aC.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&Jg)for(var i of Jg(n))e.indexOf(i)<0&&lC.call(n,i)&&(t[i]=n[i]);return t};function hC(n,e,t={}){const i=t,{eventFilter:s=zx}=i,r=cC(i,["eventFilter"]);return Ln(n,rC(s,e),r)}var uC=Object.defineProperty,fC=Object.defineProperties,dC=Object.getOwnPropertyDescriptors,Dc=Object.getOwnPropertySymbols,Vx=Object.prototype.hasOwnProperty,Wx=Object.prototype.propertyIsEnumerable,e0=(n,e,t)=>e in n?uC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,pC=(n,e)=>{for(var t in e||(e={}))Vx.call(e,t)&&e0(n,t,e[t]);if(Dc)for(var t of Dc(e))Wx.call(e,t)&&e0(n,t,e[t]);return n},mC=(n,e)=>fC(n,dC(e)),gC=(n,e)=>{var t={};for(var i in n)Vx.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&Dc)for(var i of Dc(n))e.indexOf(i)<0&&Wx.call(n,i)&&(t[i]=n[i]);return t};function OC(n,e,t={}){const i=t,{eventFilter:s}=i,r=gC(i,["eventFilter"]),{eventFilter:o,pause:a,resume:l,isActive:c}=oC(s);return{stop:hC(n,e,mC(pC({},r),{eventFilter:o})),pause:a,resume:l,isActive:c}}function vC(n){var e;const t=ip(n);return(e=t==null?void 0:t.$el)!=null?e:t}const Uc=iC?window:void 0;function t0(...n){let e,t,i,s;if(typeof n[0]=="string"||Array.isArray(n[0])?([t,i,s]=n,e=Uc):[e,t,i,s]=n,!e)return sC;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const r=[],o=()=>{r.forEach(h=>h()),r.length=0},a=(h,u,f,d)=>(h.addEventListener(u,f,d),()=>h.removeEventListener(u,f,d)),l=Ln(()=>[vC(e),ip(s)],([h,u])=>{o(),h&&r.push(...t.flatMap(f=>i.map(d=>a(h,f,d,u))))},{immediate:!0,flush:"post"}),c=()=>{l(),o()};return nC(c),c}const Ul=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Il="__vueuse_ssr_handlers__",xC=SC();function SC(){return Il in Ul||(Ul[Il]=Ul[Il]||{}),Ul[Il]}function _C(n,e){return xC[n]||e}function yC(n){return n==null?"any":n instanceof Set?"set":n instanceof Map?"map":n instanceof Date?"date":typeof n=="boolean"?"boolean":typeof n=="string"?"string":typeof n=="object"?"object":Number.isNaN(n)?"any":"number"}var bC=Object.defineProperty,n0=Object.getOwnPropertySymbols,wC=Object.prototype.hasOwnProperty,MC=Object.prototype.propertyIsEnumerable,i0=(n,e,t)=>e in n?bC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,s0=(n,e)=>{for(var t in e||(e={}))wC.call(e,t)&&i0(n,t,e[t]);if(n0)for(var t of n0(e))MC.call(e,t)&&i0(n,t,e[t]);return n};const TC={boolean:{read:n=>n==="true",write:n=>String(n)},object:{read:n=>JSON.parse(n),write:n=>JSON.stringify(n)},number:{read:n=>Number.parseFloat(n),write:n=>String(n)},any:{read:n=>n,write:n=>String(n)},string:{read:n=>n,write:n=>String(n)},map:{read:n=>new Map(JSON.parse(n)),write:n=>JSON.stringify(Array.from(n.entries()))},set:{read:n=>new Set(JSON.parse(n)),write:n=>JSON.stringify(Array.from(n))},date:{read:n=>new Date(n),write:n=>n.toISOString()}},r0="vueuse-storage";function EC(n,e,t,i={}){var s;const{flush:r="pre",deep:o=!0,listenToStorageChanges:a=!0,writeDefaults:l=!0,mergeDefaults:c=!1,shallow:h,window:u=Uc,eventFilter:f,onError:d=k=>{console.error(k)}}=i,g=(h?cc:Lt)(e);if(!t)try{t=_C("getDefaultStorage",()=>{var k;return(k=Uc)==null?void 0:k.localStorage})()}catch(k){d(k)}if(!t)return g;const O=ip(e),m=yC(O),p=(s=i.serializer)!=null?s:TC[m],{pause:y,resume:S}=OC(g,()=>x(g.value),{flush:r,deep:o,eventFilter:f});return u&&a&&(t0(u,"storage",C),t0(u,r0,T)),C(),g;function x(k){try{if(k==null)t.removeItem(n);else{const b=p.write(k),E=t.getItem(n);E!==b&&(t.setItem(n,b),u&&u.dispatchEvent(new CustomEvent(r0,{detail:{key:n,oldValue:E,newValue:b,storageArea:t}})))}}catch(b){d(b)}}function w(k){const b=k?k.newValue:t.getItem(n);if(b==null)return l&&O!==null&&t.setItem(n,p.write(O)),O;if(!k&&c){const E=p.read(b);return typeof c=="function"?c(E,O):m==="object"&&!Array.isArray(E)?s0(s0({},O),E):E}else return typeof b!="string"?b:p.read(b)}function T(k){C(k.detail)}function C(k){if(!(k&&k.storageArea!==t)){if(k&&k.key==null){g.value=O;return}if(!(k&&k.key!==n)){y();try{g.value=w(k)}catch(b){d(b)}finally{k?Iv(S):S()}}}}}function Za(n,e,t={}){const{window:i=Uc}=t;return EC(n,e,i==null?void 0:i.localStorage,t)}const Gx=[{label:"Default",value:` +}`;function UP(n,e,t){let i=new qd;const s=new Ge,r=new Ge,o=new Wt,a=new RP({depthPacking:CM}),l=new kP,c={},h=t.maxTextureSize,u={[ws]:wn,[wn]:ws,[Vi]:Vi},f=new dr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ge},radius:{value:4}},vertexShader:LP,fragmentShader:DP}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const g=new Rs;g.setAttribute("position",new Ei(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const O=new bi(g,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=lx;let p=this.type;this.render=function(w,T,C){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;const k=n.getRenderTarget(),b=n.getActiveCubeFace(),E=n.getActiveMipmapLevel(),j=n.state;j.setBlending(vs),j.buffers.color.setClear(1,1,1,1),j.buffers.depth.setTest(!0),j.setScissorTest(!1);const ae=p!==Bi&&this.type===Bi,Q=p===Bi&&this.type!==Bi;for(let W=0,G=w.length;Wh||s.y>h)&&(s.x>h&&(r.x=Math.floor(h/z.x),s.x=r.x*z.x,X.mapSize.x=r.x),s.y>h&&(r.y=Math.floor(h/z.y),s.y=r.y*z.y,X.mapSize.y=r.y)),X.map===null||ae===!0||Q===!0){const J=this.type!==Bi?{minFilter:un,magFilter:un}:{};X.map!==null&&X.map.dispose(),X.map=new ur(s.x,s.y,J),X.map.texture.name=K.name+".shadowMap",X.camera.updateProjectionMatrix()}n.setRenderTarget(X.map),n.clear();const se=X.getViewportCount();for(let J=0;J0||T.map&&T.alphaTest>0){const j=b.uuid,ae=T.uuid;let Q=c[j];Q===void 0&&(Q={},c[j]=Q);let W=Q[ae];W===void 0&&(W=b.clone(),Q[ae]=W),b=W}if(b.visible=T.visible,b.wireframe=T.wireframe,k===Bi?b.side=T.shadowSide!==null?T.shadowSide:T.side:b.side=T.shadowSide!==null?T.shadowSide:u[T.side],b.alphaMap=T.alphaMap,b.alphaTest=T.alphaTest,b.map=T.map,b.clipShadows=T.clipShadows,b.clippingPlanes=T.clippingPlanes,b.clipIntersection=T.clipIntersection,b.displacementMap=T.displacementMap,b.displacementScale=T.displacementScale,b.displacementBias=T.displacementBias,b.wireframeLinewidth=T.wireframeLinewidth,b.linewidth=T.linewidth,C.isPointLight===!0&&b.isMeshDistanceMaterial===!0){const j=n.properties.get(b);j.light=C}return b}function x(w,T,C,k,b){if(w.visible===!1)return;if(w.layers.test(T.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&b===Bi)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,w.matrixWorld);const ae=e.update(w),Q=w.material;if(Array.isArray(Q)){const W=ae.groups;for(let G=0,K=W.length;G=1):z.indexOf("OpenGL ES")!==-1&&(X=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),K=X>=2);let se=null,J={};const be=n.getParameter(n.SCISSOR_BOX),N=n.getParameter(n.VIEWPORT),de=new Wt().fromArray(be),pe=new Wt().fromArray(N);function Te(L,ye,Y,me){const Me=new Uint8Array(4),rt=n.createTexture();n.bindTexture(L,rt),n.texParameteri(L,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(L,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let yt=0;yt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap;let O;const m=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(M,_){return p?new OffscreenCanvas(M,_):Lc("canvas")}function S(M,_,I,ee){let oe=1;if((M.width>ee||M.height>ee)&&(oe=ee/Math.max(M.width,M.height)),oe<1||_===!0)if(typeof HTMLImageElement<"u"&&M instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&M instanceof ImageBitmap){const P=_?Af:Math.floor,te=P(oe*M.width),fe=P(oe*M.height);O===void 0&&(O=y(te,fe));const H=I?y(te,fe):O;return H.width=te,H.height=fe,H.getContext("2d").drawImage(M,0,0,te,fe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+M.width+"x"+M.height+") to ("+te+"x"+fe+")."),H}else return"data"in M&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+M.width+"x"+M.height+")."),M;return M}function x(M){return og(M.width)&&og(M.height)}function w(M){return a?!1:M.wrapS!==ii||M.wrapT!==ii||M.minFilter!==un&&M.minFilter!==Fn}function T(M,_){return M.generateMipmaps&&_&&M.minFilter!==un&&M.minFilter!==Fn}function C(M){n.generateMipmap(M)}function k(M,_,I,ee,oe=!1){if(a===!1)return _;if(M!==null){if(n[M]!==void 0)return n[M];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+M+"'")}let P=_;return _===n.RED&&(I===n.FLOAT&&(P=n.R32F),I===n.HALF_FLOAT&&(P=n.R16F),I===n.UNSIGNED_BYTE&&(P=n.R8)),_===n.RG&&(I===n.FLOAT&&(P=n.RG32F),I===n.HALF_FLOAT&&(P=n.RG16F),I===n.UNSIGNED_BYTE&&(P=n.RG8)),_===n.RGBA&&(I===n.FLOAT&&(P=n.RGBA32F),I===n.HALF_FLOAT&&(P=n.RGBA16F),I===n.UNSIGNED_BYTE&&(P=ee===He&&oe===!1?n.SRGB8_ALPHA8:n.RGBA8),I===n.UNSIGNED_SHORT_4_4_4_4&&(P=n.RGBA4),I===n.UNSIGNED_SHORT_5_5_5_1&&(P=n.RGB5_A1)),(P===n.R16F||P===n.R32F||P===n.RG16F||P===n.RG32F||P===n.RGBA16F||P===n.RGBA32F)&&e.get("EXT_color_buffer_float"),P}function b(M,_,I){return T(M,I)===!0||M.isFramebufferTexture&&M.minFilter!==un&&M.minFilter!==Fn?Math.log2(Math.max(_.width,_.height))+1:M.mipmaps!==void 0&&M.mipmaps.length>0?M.mipmaps.length:M.isCompressedTexture&&Array.isArray(M.image)?_.mipmaps.length:1}function E(M){return M===un||M===Dm||M===nu?n.NEAREST:n.LINEAR}function j(M){const _=M.target;_.removeEventListener("dispose",j),Q(_),_.isVideoTexture&&g.delete(_)}function ae(M){const _=M.target;_.removeEventListener("dispose",ae),G(_)}function Q(M){const _=i.get(M);if(_.__webglInit===void 0)return;const I=M.source,ee=m.get(I);if(ee){const oe=ee[_.__cacheKey];oe.usedTimes--,oe.usedTimes===0&&W(M),Object.keys(ee).length===0&&m.delete(I)}i.remove(M)}function W(M){const _=i.get(M);n.deleteTexture(_.__webglTexture);const I=M.source,ee=m.get(I);delete ee[_.__cacheKey],o.memory.textures--}function G(M){const _=M.texture,I=i.get(M),ee=i.get(_);if(ee.__webglTexture!==void 0&&(n.deleteTexture(ee.__webglTexture),o.memory.textures--),M.depthTexture&&M.depthTexture.dispose(),M.isWebGLCubeRenderTarget)for(let oe=0;oe<6;oe++)n.deleteFramebuffer(I.__webglFramebuffer[oe]),I.__webglDepthbuffer&&n.deleteRenderbuffer(I.__webglDepthbuffer[oe]);else{if(n.deleteFramebuffer(I.__webglFramebuffer),I.__webglDepthbuffer&&n.deleteRenderbuffer(I.__webglDepthbuffer),I.__webglMultisampledFramebuffer&&n.deleteFramebuffer(I.__webglMultisampledFramebuffer),I.__webglColorRenderbuffer)for(let oe=0;oe=l&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+l),K+=1,M}function se(M){const _=[];return _.push(M.wrapS),_.push(M.wrapT),_.push(M.wrapR||0),_.push(M.magFilter),_.push(M.minFilter),_.push(M.anisotropy),_.push(M.internalFormat),_.push(M.format),_.push(M.type),_.push(M.generateMipmaps),_.push(M.premultiplyAlpha),_.push(M.flipY),_.push(M.unpackAlignment),_.push(M.colorSpace),_.join()}function J(M,_){const I=i.get(M);if(M.isVideoTexture&&le(M),M.isRenderTargetTexture===!1&&M.version>0&&I.__version!==M.version){const ee=M.image;if(ee===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ue(I,M,_);return}}t.bindTexture(n.TEXTURE_2D,I.__webglTexture,n.TEXTURE0+_)}function be(M,_){const I=i.get(M);if(M.version>0&&I.__version!==M.version){Ue(I,M,_);return}t.bindTexture(n.TEXTURE_2D_ARRAY,I.__webglTexture,n.TEXTURE0+_)}function N(M,_){const I=i.get(M);if(M.version>0&&I.__version!==M.version){Ue(I,M,_);return}t.bindTexture(n.TEXTURE_3D,I.__webglTexture,n.TEXTURE0+_)}function de(M,_){const I=i.get(M);if(M.version>0&&I.__version!==M.version){dt(I,M,_);return}t.bindTexture(n.TEXTURE_CUBE_MAP,I.__webglTexture,n.TEXTURE0+_)}const pe={[wf]:n.REPEAT,[ii]:n.CLAMP_TO_EDGE,[Mf]:n.MIRRORED_REPEAT},Te={[un]:n.NEAREST,[Dm]:n.NEAREST_MIPMAP_NEAREST,[nu]:n.NEAREST_MIPMAP_LINEAR,[Fn]:n.LINEAR,[xM]:n.LINEAR_MIPMAP_NEAREST,[wa]:n.LINEAR_MIPMAP_LINEAR},Se={[DM]:n.NEVER,[BM]:n.ALWAYS,[UM]:n.LESS,[QM]:n.LEQUAL,[IM]:n.EQUAL,[FM]:n.GEQUAL,[NM]:n.GREATER,[$M]:n.NOTEQUAL};function De(M,_,I){if(I?(n.texParameteri(M,n.TEXTURE_WRAP_S,pe[_.wrapS]),n.texParameteri(M,n.TEXTURE_WRAP_T,pe[_.wrapT]),(M===n.TEXTURE_3D||M===n.TEXTURE_2D_ARRAY)&&n.texParameteri(M,n.TEXTURE_WRAP_R,pe[_.wrapR]),n.texParameteri(M,n.TEXTURE_MAG_FILTER,Te[_.magFilter]),n.texParameteri(M,n.TEXTURE_MIN_FILTER,Te[_.minFilter])):(n.texParameteri(M,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(M,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(M===n.TEXTURE_3D||M===n.TEXTURE_2D_ARRAY)&&n.texParameteri(M,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(_.wrapS!==ii||_.wrapT!==ii)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(M,n.TEXTURE_MAG_FILTER,E(_.magFilter)),n.texParameteri(M,n.TEXTURE_MIN_FILTER,E(_.minFilter)),_.minFilter!==un&&_.minFilter!==Fn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),_.compareFunction&&(n.texParameteri(M,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(M,n.TEXTURE_COMPARE_FUNC,Se[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ee=e.get("EXT_texture_filter_anisotropic");if(_.magFilter===un||_.minFilter!==nu&&_.minFilter!==wa||_.type===ps&&e.has("OES_texture_float_linear")===!1||a===!1&&_.type===Ma&&e.has("OES_texture_half_float_linear")===!1)return;(_.anisotropy>1||i.get(_).__currentAnisotropy)&&(n.texParameterf(M,ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,s.getMaxAnisotropy())),i.get(_).__currentAnisotropy=_.anisotropy)}}function ze(M,_){let I=!1;M.__webglInit===void 0&&(M.__webglInit=!0,_.addEventListener("dispose",j));const ee=_.source;let oe=m.get(ee);oe===void 0&&(oe={},m.set(ee,oe));const P=se(_);if(P!==M.__cacheKey){oe[P]===void 0&&(oe[P]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,I=!0),oe[P].usedTimes++;const te=oe[M.__cacheKey];te!==void 0&&(oe[M.__cacheKey].usedTimes--,te.usedTimes===0&&W(_)),M.__cacheKey=P,M.__webglTexture=oe[P].texture}return I}function Ue(M,_,I){let ee=n.TEXTURE_2D;(_.isDataArrayTexture||_.isCompressedArrayTexture)&&(ee=n.TEXTURE_2D_ARRAY),_.isData3DTexture&&(ee=n.TEXTURE_3D);const oe=ze(M,_),P=_.source;t.bindTexture(ee,M.__webglTexture,n.TEXTURE0+I);const te=i.get(P);if(P.version!==te.__version||oe===!0){t.activeTexture(n.TEXTURE0+I),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const fe=w(_)&&x(_.image)===!1;let H=S(_.image,fe,!1,h);H=we(_,H);const Ae=x(H)||a,Re=r.convert(_.format,_.colorSpace);let ke=r.convert(_.type),xe=k(_.internalFormat,Re,ke,_.colorSpace);De(ee,_,Ae);let _e;const Ne=_.mipmaps,et=a&&_.isVideoTexture!==!0,L=te.__version===void 0||oe===!0,ye=b(_,H,Ae);if(_.isDepthTexture)xe=n.DEPTH_COMPONENT,a?_.type===ps?xe=n.DEPTH_COMPONENT32F:_.type===ds?xe=n.DEPTH_COMPONENT24:_.type===ir?xe=n.DEPTH24_STENCIL8:xe=n.DEPTH_COMPONENT16:_.type===ps&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),_.format===sr&&xe===n.DEPTH_COMPONENT&&_.type!==Yd&&_.type!==ds&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),_.type=ds,ke=r.convert(_.type)),_.format===_o&&xe===n.DEPTH_COMPONENT&&(xe=n.DEPTH_STENCIL,_.type!==ir&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),_.type=ir,ke=r.convert(_.type))),L&&(et?t.texStorage2D(n.TEXTURE_2D,1,xe,H.width,H.height):t.texImage2D(n.TEXTURE_2D,0,xe,H.width,H.height,0,Re,ke,null));else if(_.isDataTexture)if(Ne.length>0&&Ae){et&&L&&t.texStorage2D(n.TEXTURE_2D,ye,xe,Ne[0].width,Ne[0].height);for(let Y=0,me=Ne.length;Y>=1,me>>=1}}else if(Ne.length>0&&Ae){et&&L&&t.texStorage2D(n.TEXTURE_2D,ye,xe,Ne[0].width,Ne[0].height);for(let Y=0,me=Ne.length;Y0&&L++,t.texStorage2D(n.TEXTURE_CUBE_MAP,L,_e,H[0].width,H[0].height));for(let Y=0;Y<6;Y++)if(fe){Ne?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,H[Y].width,H[Y].height,ke,xe,H[Y].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,_e,H[Y].width,H[Y].height,0,ke,xe,H[Y].data);for(let me=0;me=n.TEXTURE_CUBE_MAP_POSITIVE_X&&oe<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ee,oe,i.get(I).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function v(M,_,I){if(n.bindRenderbuffer(n.RENDERBUFFER,M),_.depthBuffer&&!_.stencilBuffer){let ee=n.DEPTH_COMPONENT16;if(I||ue(_)){const oe=_.depthTexture;oe&&oe.isDepthTexture&&(oe.type===ps?ee=n.DEPTH_COMPONENT32F:oe.type===ds&&(ee=n.DEPTH_COMPONENT24));const P=q(_);ue(_)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,P,ee,_.width,_.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,P,ee,_.width,_.height)}else n.renderbufferStorage(n.RENDERBUFFER,ee,_.width,_.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,M)}else if(_.depthBuffer&&_.stencilBuffer){const ee=q(_);I&&ue(_)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,ee,n.DEPTH24_STENCIL8,_.width,_.height):ue(_)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ee,n.DEPTH24_STENCIL8,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,_.width,_.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,M)}else{const ee=_.isWebGLMultipleRenderTargets===!0?_.texture:[_.texture];for(let oe=0;oe0&&ue(M)===!1){const fe=P?_:[_];I.__webglMultisampledFramebuffer=n.createFramebuffer(),I.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,I.__webglMultisampledFramebuffer);for(let H=0;H0&&ue(M)===!1){const _=M.isWebGLMultipleRenderTargets?M.texture:[M.texture],I=M.width,ee=M.height;let oe=n.COLOR_BUFFER_BIT;const P=[],te=M.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,fe=i.get(M),H=M.isWebGLMultipleRenderTargets===!0;if(H)for(let Ae=0;Ae<_.length;Ae++)t.bindFramebuffer(n.FRAMEBUFFER,fe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ae,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,fe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ae,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,fe.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,fe.__webglFramebuffer);for(let Ae=0;Ae<_.length;Ae++){P.push(n.COLOR_ATTACHMENT0+Ae),M.depthBuffer&&P.push(te);const Re=fe.__ignoreDepthValues!==void 0?fe.__ignoreDepthValues:!1;if(Re===!1&&(M.depthBuffer&&(oe|=n.DEPTH_BUFFER_BIT),M.stencilBuffer&&(oe|=n.STENCIL_BUFFER_BIT)),H&&n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,fe.__webglColorRenderbuffer[Ae]),Re===!0&&(n.invalidateFramebuffer(n.READ_FRAMEBUFFER,[te]),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[te])),H){const ke=i.get(_[Ae]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,ke,0)}n.blitFramebuffer(0,0,I,ee,0,0,I,ee,oe,n.NEAREST),d&&n.invalidateFramebuffer(n.READ_FRAMEBUFFER,P)}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),H)for(let Ae=0;Ae<_.length;Ae++){t.bindFramebuffer(n.FRAMEBUFFER,fe.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ae,n.RENDERBUFFER,fe.__webglColorRenderbuffer[Ae]);const Re=i.get(_[Ae]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,fe.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ae,n.TEXTURE_2D,Re,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,fe.__webglMultisampledFramebuffer)}}function q(M){return Math.min(u,M.samples)}function ue(M){const _=i.get(M);return a&&M.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function le(M){const _=o.render.frame;g.get(M)!==_&&(g.set(M,_),M.update())}function we(M,_){const I=M.colorSpace,ee=M.format,oe=M.type;return M.isCompressedTexture===!0||M.format===Tf||I!==Ci&&I!==or&&(I===He?a===!1?e.has("EXT_sRGB")===!0&&ee===si?(M.format=Tf,M.minFilter=Fn,M.generateMipmaps=!1):_=yx.sRGBToLinear(_):(ee!==si||oe!==xs)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",I)),_}this.allocateTextureUnit=z,this.resetTextureUnits=X,this.setTexture2D=J,this.setTexture2DArray=be,this.setTexture3D=N,this.setTextureCube=de,this.rebindTextures=Z,this.setupRenderTarget=B,this.updateRenderTargetMipmap=ce,this.updateMultisampleRenderTarget=he,this.setupDepthRenderbuffer=U,this.setupFrameBufferTexture=We,this.useMultisampledRTT=ue}function NP(n,e,t){const i=t.isWebGL2;function s(r,o=or){let a;if(r===xs)return n.UNSIGNED_BYTE;if(r===px)return n.UNSIGNED_SHORT_4_4_4_4;if(r===mx)return n.UNSIGNED_SHORT_5_5_5_1;if(r===SM)return n.BYTE;if(r===_M)return n.SHORT;if(r===Yd)return n.UNSIGNED_SHORT;if(r===dx)return n.INT;if(r===ds)return n.UNSIGNED_INT;if(r===ps)return n.FLOAT;if(r===Ma)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===yM)return n.ALPHA;if(r===si)return n.RGBA;if(r===bM)return n.LUMINANCE;if(r===wM)return n.LUMINANCE_ALPHA;if(r===sr)return n.DEPTH_COMPONENT;if(r===_o)return n.DEPTH_STENCIL;if(r===Tf)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===MM)return n.RED;if(r===gx)return n.RED_INTEGER;if(r===TM)return n.RG;if(r===Ox)return n.RG_INTEGER;if(r===vx)return n.RGBA_INTEGER;if(r===iu||r===su||r===ru||r===ou)if(o===He)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===iu)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===su)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===ru)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===ou)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===iu)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===su)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===ru)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===ou)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Um||r===Im||r===Qm||r===Nm)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===Um)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===Im)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Qm)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Nm)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===EM)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===$m||r===Fm)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===$m)return o===He?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===Fm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===Bm||r===Xm||r===zm||r===Vm||r===Wm||r===Gm||r===Zm||r===Hm||r===Ym||r===jm||r===qm||r===Km||r===Jm||r===eg)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===Bm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Xm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===zm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===Vm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Wm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Gm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Zm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Hm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===Ym)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===jm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===qm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Km)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===Jm)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===eg)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===au)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===au)return o===He?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(r===AM||r===tg||r===ng||r===ig)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(r===au)return a.COMPRESSED_RED_RGTC1_EXT;if(r===tg)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===ng)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===ig)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===ir?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[r]!==void 0?n[r]:null}return{convert:s}}class $P extends Bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Jo extends Gt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const FP={type:"move"};class Ru{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Jo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Jo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Jo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const O of e.hand.values()){const m=t.getJointPose(O,i),p=this._getHandJoint(c,O);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const h=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=h.position.distanceTo(u.position),d=.02,g=.005;c.inputState.pinching&&f>d+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(FP)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Jo;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class BP extends Nn{constructor(e,t,i,s,r,o,a,l,c,h){if(h=h!==void 0?h:sr,h!==sr&&h!==_o)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===sr&&(i=ds),i===void 0&&h===_o&&(i=ir),super(null,s,r,o,a,l,h,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:un,this.minFilter=l!==void 0?l:un,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class XP extends Or{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,c=null,h=null,u=null,f=null,d=null,g=null;const O=t.getContextAttributes();let m=null,p=null;const y=[],S=[];let x=null;const w=new Bn;w.layers.enable(1),w.viewport=new Wt;const T=new Bn;T.layers.enable(2),T.viewport=new Wt;const C=[w,T],k=new $P;k.layers.enable(1),k.layers.enable(2);let b=null,E=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getCamera=function(){},this.setUserCamera=function(N){x=N},this.getController=function(N){let de=y[N];return de===void 0&&(de=new Ru,y[N]=de),de.getTargetRaySpace()},this.getControllerGrip=function(N){let de=y[N];return de===void 0&&(de=new Ru,y[N]=de),de.getGripSpace()},this.getHand=function(N){let de=y[N];return de===void 0&&(de=new Ru,y[N]=de),de.getHandSpace()};function j(N){const de=S.indexOf(N.inputSource);if(de===-1)return;const pe=y[de];pe!==void 0&&(pe.update(N.inputSource,N.frame,c||o),pe.dispatchEvent({type:N.type,data:N.inputSource}))}function ae(){s.removeEventListener("select",j),s.removeEventListener("selectstart",j),s.removeEventListener("selectend",j),s.removeEventListener("squeeze",j),s.removeEventListener("squeezestart",j),s.removeEventListener("squeezeend",j),s.removeEventListener("end",ae),s.removeEventListener("inputsourceschange",Q);for(let N=0;N=0&&(S[Te]=null,y[Te].disconnect(pe))}for(let de=0;de=S.length){S.push(pe),Te=De;break}else if(S[De]===null){S[De]=pe,Te=De;break}if(Te===-1)break}const Se=y[Te];Se&&Se.connect(pe)}}const W=new F,G=new F;function K(N,de,pe){W.setFromMatrixPosition(de.matrixWorld),G.setFromMatrixPosition(pe.matrixWorld);const Te=W.distanceTo(G),Se=de.projectionMatrix.elements,De=pe.projectionMatrix.elements,ze=Se[14]/(Se[10]-1),Ue=Se[14]/(Se[10]+1),dt=(Se[9]+1)/Se[5],We=(Se[9]-1)/Se[5],v=(Se[8]-1)/Se[0],R=(De[8]+1)/De[0],U=ze*v,Z=ze*R,B=Te/(-v+R),ce=B*-v;de.matrixWorld.decompose(N.position,N.quaternion,N.scale),N.translateX(ce),N.translateZ(B),N.matrixWorld.compose(N.position,N.quaternion,N.scale),N.matrixWorldInverse.copy(N.matrixWorld).invert();const he=ze+B,q=Ue+B,ue=U-ce,le=Z+(Te-ce),we=dt*Ue/q*he,M=We*Ue/q*he;N.projectionMatrix.makePerspective(ue,le,we,M,he,q),N.projectionMatrixInverse.copy(N.projectionMatrix).invert()}function X(N,de){de===null?N.matrixWorld.copy(N.matrix):N.matrixWorld.multiplyMatrices(de.matrixWorld,N.matrix),N.matrixWorldInverse.copy(N.matrixWorld).invert()}this.updateCameraXR=function(N){if(s===null)return N;x&&(N=x),k.near=T.near=w.near=N.near,k.far=T.far=w.far=N.far,(b!==k.near||E!==k.far)&&(s.updateRenderState({depthNear:k.near,depthFar:k.far}),b=k.near,E=k.far);const de=N.parent,pe=k.cameras;X(k,de);for(let Te=0;Te0&&(m.alphaTest.value=p.alphaTest);const y=e.get(p).envMap;if(y&&(m.envMap.value=y,m.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap){m.lightMap.value=p.lightMap;const S=n.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=p.lightMapIntensity*S,t(p.lightMap,m.lightMapTransform)}p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,y,S){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*y,m.scale.value=S*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function h(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function u(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function f(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),e.get(p).envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function d(m,p,y){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===wn&&m.clearcoatNormalScale.value.negate())),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function O(m,p){const y=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function VP(n,e,t,i){let s={},r={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(y,S){const x=S.program;i.uniformBlockBinding(y,x)}function c(y,S){let x=s[y.id];x===void 0&&(g(y),x=h(y),s[y.id]=x,y.addEventListener("dispose",m));const w=S.program;i.updateUBOMapping(y,w);const T=e.render.frame;r[y.id]!==T&&(f(y),r[y.id]=T)}function h(y){const S=u();y.__bindingPointIndex=S;const x=n.createBuffer(),w=y.__size,T=y.usage;return n.bindBuffer(n.UNIFORM_BUFFER,x),n.bufferData(n.UNIFORM_BUFFER,w,T),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,S,x),x}function u(){for(let y=0;y0){T=x%w;const ae=w-T;T!==0&&ae-E.boundary<0&&(x+=w-T,b.__offset=x)}x+=E.storage}return T=x%w,T>0&&(x+=w-T),y.__size=x,y.__cache={},this}function O(y){const S={boundary:0,storage:0};return typeof y=="number"?(S.boundary=4,S.storage=4):y.isVector2?(S.boundary=8,S.storage=8):y.isVector3||y.isColor?(S.boundary=16,S.storage=12):y.isVector4?(S.boundary=16,S.storage=16):y.isMatrix3?(S.boundary=48,S.storage=48):y.isMatrix4?(S.boundary=64,S.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),S}function m(y){const S=y.target;S.removeEventListener("dispose",m);const x=o.indexOf(S.__bindingPointIndex);o.splice(x,1),n.deleteBuffer(s[S.id]),delete s[S.id],delete r[S.id]}function p(){for(const y in s)n.deleteBuffer(s[y]);o=[],s={},r={}}return{bind:l,update:c,dispose:p}}function WP(){const n=Lc("canvas");return n.style.display="block",n}class Nx{constructor(e={}){const{canvas:t=WP(),context:i=null,depth:s=!0,stencil:r=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=o;const d=new Uint32Array(4),g=new Int32Array(4);let O=null,m=null;const p=[],y=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputColorSpace=He,this.useLegacyLights=!0,this.toneMapping=Zi,this.toneMappingExposure=1;const S=this;let x=!1,w=0,T=0,C=null,k=-1,b=null;const E=new Wt,j=new Wt;let ae=null;const Q=new ct(0);let W=0,G=t.width,K=t.height,X=1,z=null,se=null;const J=new Wt(0,0,G,K),be=new Wt(0,0,G,K);let N=!1;const de=new qd;let pe=!1,Te=!1,Se=null;const De=new Tt,ze=new Ge,Ue=new F,dt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function We(){return C===null?X:1}let v=i;function R(A,V){for(let ne=0;ne0?m=y[y.length-1]:m=null,p.pop(),p.length>0?O=p[p.length-1]:O=null};function Xp(A,V,ne,$){if(A.visible===!1)return;if(A.layers.test(V.layers)){if(A.isGroup)ne=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(V);else if(A.isLight)m.pushLight(A),A.castShadow&&m.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||de.intersectsSprite(A)){$&&Ue.setFromMatrixPosition(A.matrixWorld).applyMatrix4(De);const $e=_.update(A),Fe=A.material;Fe.visible&&O.push(A,$e,Fe,ne,Ue.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(!A.frustumCulled||de.intersectsObject(A))){A.isSkinnedMesh&&A.skeleton.frame!==ce.render.frame&&(A.skeleton.update(),A.skeleton.frame=ce.render.frame);const $e=_.update(A),Fe=A.material;if($&&(A.boundingSphere!==void 0?(A.boundingSphere===null&&A.computeBoundingSphere(),Ue.copy(A.boundingSphere.center)):($e.boundingSphere===null&&$e.computeBoundingSphere(),Ue.copy($e.boundingSphere.center)),Ue.applyMatrix4(A.matrixWorld).applyMatrix4(De)),Array.isArray(Fe)){const Be=$e.groups;for(let Je=0,Ve=Be.length;Je0&&fy(ie,Pe,V,ne),$&&B.viewport(E.copy($)),ie.length>0&&ol(ie,V,ne),Pe.length>0&&ol(Pe,V,ne),$e.length>0&&ol($e,V,ne),B.buffers.depth.setTest(!0),B.buffers.depth.setMask(!0),B.buffers.color.setMask(!0),B.setPolygonOffset(!1)}function fy(A,V,ne,$){const ie=Z.isWebGL2;Se===null&&(Se=new ur(1,1,{generateMipmaps:!0,type:U.has("EXT_color_buffer_half_float")?Ma:xs,minFilter:wa,samples:ie&&a===!0?4:0})),S.getDrawingBufferSize(ze),ie?Se.setSize(ze.x,ze.y):Se.setSize(Af(ze.x),Af(ze.y));const Pe=S.getRenderTarget();S.setRenderTarget(Se),S.getClearColor(Q),W=S.getClearAlpha(),W<1&&S.setClearColor(16777215,.5),S.clear();const $e=S.toneMapping;S.toneMapping=Zi,ol(A,ne,$),q.updateMultisampleRenderTarget(Se),q.updateRenderTargetMipmap(Se);let Fe=!1;for(let Be=0,Je=V.length;Be0),Ze=!!ne.morphAttributes.position,pt=!!ne.morphAttributes.normal,wt=!!ne.morphAttributes.color,Hn=$.toneMapped?S.toneMapping:Zi,Di=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,At=Di!==void 0?Di.length:0,it=he.get($),Gh=m.state.lights;if(pe===!0&&(Te===!0||A!==b)){const En=A===b&&$.id===k;te.setState($,A,En)}let zt=!1;$.version===it.__version?(it.needsLights&&it.lightsStateVersion!==Gh.state.version||it.outputColorSpace!==Fe||ie.isInstancedMesh&&it.instancing===!1||!ie.isInstancedMesh&&it.instancing===!0||ie.isSkinnedMesh&&it.skinning===!1||!ie.isSkinnedMesh&&it.skinning===!0||it.envMap!==Be||$.fog===!0&&it.fog!==Pe||it.numClippingPlanes!==void 0&&(it.numClippingPlanes!==te.numPlanes||it.numIntersection!==te.numIntersection)||it.vertexAlphas!==Je||it.vertexTangents!==Ve||it.morphTargets!==Ze||it.morphNormals!==pt||it.morphColors!==wt||it.toneMapping!==Hn||Z.isWebGL2===!0&&it.morphTargetsCount!==At)&&(zt=!0):(zt=!0,it.__version=$.version);let Ds=it.currentProgram;zt===!0&&(Ds=al($,V,ie));let Gp=!1,No=!1,Zh=!1;const ln=Ds.getUniforms(),Us=it.uniforms;if(B.useProgram(Ds.program)&&(Gp=!0,No=!0,Zh=!0),$.id!==k&&(k=$.id,No=!0),Gp||b!==A){if(ln.setValue(v,"projectionMatrix",A.projectionMatrix),Z.logarithmicDepthBuffer&&ln.setValue(v,"logDepthBufFC",2/(Math.log(A.far+1)/Math.LN2)),b!==A&&(b=A,No=!0,Zh=!0),$.isShaderMaterial||$.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshStandardMaterial||$.envMap){const En=ln.map.cameraPosition;En!==void 0&&En.setValue(v,Ue.setFromMatrixPosition(A.matrixWorld))}($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial)&&ln.setValue(v,"isOrthographic",A.isOrthographicCamera===!0),($.isMeshPhongMaterial||$.isMeshToonMaterial||$.isMeshLambertMaterial||$.isMeshBasicMaterial||$.isMeshStandardMaterial||$.isShaderMaterial||$.isShadowMaterial||ie.isSkinnedMesh)&&ln.setValue(v,"viewMatrix",A.matrixWorldInverse)}if(ie.isSkinnedMesh){ln.setOptional(v,ie,"bindMatrix"),ln.setOptional(v,ie,"bindMatrixInverse");const En=ie.skeleton;En&&(Z.floatVertexTextures?(En.boneTexture===null&&En.computeBoneTexture(),ln.setValue(v,"boneTexture",En.boneTexture,q),ln.setValue(v,"boneTextureSize",En.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Hh=ne.morphAttributes;if((Hh.position!==void 0||Hh.normal!==void 0||Hh.color!==void 0&&Z.isWebGL2===!0)&&Ae.update(ie,ne,Ds),(No||it.receiveShadow!==ie.receiveShadow)&&(it.receiveShadow=ie.receiveShadow,ln.setValue(v,"receiveShadow",ie.receiveShadow)),$.isMeshGouraudMaterial&&$.envMap!==null&&(Us.envMap.value=Be,Us.flipEnvMap.value=Be.isCubeTexture&&Be.isRenderTargetTexture===!1?-1:1),No&&(ln.setValue(v,"toneMappingExposure",S.toneMappingExposure),it.needsLights&&py(Us,Zh),Pe&&$.fog===!0&&ee.refreshFogUniforms(Us,Pe),ee.refreshMaterialUniforms(Us,$,X,K,Se),uc.upload(v,it.uniformsList,Us,q)),$.isShaderMaterial&&$.uniformsNeedUpdate===!0&&(uc.upload(v,it.uniformsList,Us,q),$.uniformsNeedUpdate=!1),$.isSpriteMaterial&&ln.setValue(v,"center",ie.center),ln.setValue(v,"modelViewMatrix",ie.modelViewMatrix),ln.setValue(v,"normalMatrix",ie.normalMatrix),ln.setValue(v,"modelMatrix",ie.matrixWorld),$.isShaderMaterial||$.isRawShaderMaterial){const En=$.uniformsGroups;for(let Yh=0,gy=En.length;Yh0&&q.useMultisampledRTT(A)===!1?ie=he.get(A).__webglMultisampledFramebuffer:ie=Ve,E.copy(A.viewport),j.copy(A.scissor),ae=A.scissorTest}else E.copy(J).multiplyScalar(X).floor(),j.copy(be).multiplyScalar(X).floor(),ae=N;if(B.bindFramebuffer(v.FRAMEBUFFER,ie)&&Z.drawBuffers&&$&&B.drawBuffers(A,ie),B.viewport(E),B.scissor(j),B.setScissorTest(ae),Pe){const Be=he.get(A.texture);v.framebufferTexture2D(v.FRAMEBUFFER,v.COLOR_ATTACHMENT0,v.TEXTURE_CUBE_MAP_POSITIVE_X+V,Be.__webglTexture,ne)}else if($e){const Be=he.get(A.texture),Je=V||0;v.framebufferTextureLayer(v.FRAMEBUFFER,v.COLOR_ATTACHMENT0,Be.__webglTexture,ne||0,Je)}k=-1},this.readRenderTargetPixels=function(A,V,ne,$,ie,Pe,$e){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=he.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&$e!==void 0&&(Fe=Fe[$e]),Fe){B.bindFramebuffer(v.FRAMEBUFFER,Fe);try{const Be=A.texture,Je=Be.format,Ve=Be.type;if(Je!==si&&xe.convert(Je)!==v.getParameter(v.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=Ve===Ma&&(U.has("EXT_color_buffer_half_float")||Z.isWebGL2&&U.has("EXT_color_buffer_float"));if(Ve!==xs&&xe.convert(Ve)!==v.getParameter(v.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ve===ps&&(Z.isWebGL2||U.has("OES_texture_float")||U.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}V>=0&&V<=A.width-$&&ne>=0&&ne<=A.height-ie&&v.readPixels(V,ne,$,ie,xe.convert(Je),xe.convert(Ve),Pe)}finally{const Be=C!==null?he.get(C).__webglFramebuffer:null;B.bindFramebuffer(v.FRAMEBUFFER,Be)}}},this.copyFramebufferToTexture=function(A,V,ne=0){const $=Math.pow(2,-ne),ie=Math.floor(V.image.width*$),Pe=Math.floor(V.image.height*$);q.setTexture2D(V,0),v.copyTexSubImage2D(v.TEXTURE_2D,ne,0,0,A.x,A.y,ie,Pe),B.unbindTexture()},this.copyTextureToTexture=function(A,V,ne,$=0){const ie=V.image.width,Pe=V.image.height,$e=xe.convert(ne.format),Fe=xe.convert(ne.type);q.setTexture2D(ne,0),v.pixelStorei(v.UNPACK_FLIP_Y_WEBGL,ne.flipY),v.pixelStorei(v.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ne.premultiplyAlpha),v.pixelStorei(v.UNPACK_ALIGNMENT,ne.unpackAlignment),V.isDataTexture?v.texSubImage2D(v.TEXTURE_2D,$,A.x,A.y,ie,Pe,$e,Fe,V.image.data):V.isCompressedTexture?v.compressedTexSubImage2D(v.TEXTURE_2D,$,A.x,A.y,V.mipmaps[0].width,V.mipmaps[0].height,$e,V.mipmaps[0].data):v.texSubImage2D(v.TEXTURE_2D,$,A.x,A.y,$e,Fe,V.image),$===0&&ne.generateMipmaps&&v.generateMipmap(v.TEXTURE_2D),B.unbindTexture()},this.copyTextureToTexture3D=function(A,V,ne,$,ie=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Pe=A.max.x-A.min.x+1,$e=A.max.y-A.min.y+1,Fe=A.max.z-A.min.z+1,Be=xe.convert($.format),Je=xe.convert($.type);let Ve;if($.isData3DTexture)q.setTexture3D($,0),Ve=v.TEXTURE_3D;else if($.isDataArrayTexture)q.setTexture2DArray($,0),Ve=v.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}v.pixelStorei(v.UNPACK_FLIP_Y_WEBGL,$.flipY),v.pixelStorei(v.UNPACK_PREMULTIPLY_ALPHA_WEBGL,$.premultiplyAlpha),v.pixelStorei(v.UNPACK_ALIGNMENT,$.unpackAlignment);const Ze=v.getParameter(v.UNPACK_ROW_LENGTH),pt=v.getParameter(v.UNPACK_IMAGE_HEIGHT),wt=v.getParameter(v.UNPACK_SKIP_PIXELS),Hn=v.getParameter(v.UNPACK_SKIP_ROWS),Di=v.getParameter(v.UNPACK_SKIP_IMAGES),At=ne.isCompressedTexture?ne.mipmaps[0]:ne.image;v.pixelStorei(v.UNPACK_ROW_LENGTH,At.width),v.pixelStorei(v.UNPACK_IMAGE_HEIGHT,At.height),v.pixelStorei(v.UNPACK_SKIP_PIXELS,A.min.x),v.pixelStorei(v.UNPACK_SKIP_ROWS,A.min.y),v.pixelStorei(v.UNPACK_SKIP_IMAGES,A.min.z),ne.isDataTexture||ne.isData3DTexture?v.texSubImage3D(Ve,ie,V.x,V.y,V.z,Pe,$e,Fe,Be,Je,At.data):ne.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),v.compressedTexSubImage3D(Ve,ie,V.x,V.y,V.z,Pe,$e,Fe,Be,At.data)):v.texSubImage3D(Ve,ie,V.x,V.y,V.z,Pe,$e,Fe,Be,Je,At),v.pixelStorei(v.UNPACK_ROW_LENGTH,Ze),v.pixelStorei(v.UNPACK_IMAGE_HEIGHT,pt),v.pixelStorei(v.UNPACK_SKIP_PIXELS,wt),v.pixelStorei(v.UNPACK_SKIP_ROWS,Hn),v.pixelStorei(v.UNPACK_SKIP_IMAGES,Di),ie===0&&$.generateMipmaps&&v.generateMipmap(Ve),B.unbindTexture()},this.initTexture=function(A){A.isCubeTexture?q.setTextureCube(A,0):A.isData3DTexture?q.setTexture3D(A,0):A.isDataArrayTexture||A.isCompressedArrayTexture?q.setTexture2DArray(A,0):q.setTexture2D(A,0),B.unbindTexture()},this.resetState=function(){w=0,T=0,C=null,B.reset(),_e.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Gi}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===He?rr:xx}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===rr?He:Ci}}class GP extends Nx{}GP.prototype.isWebGL1Renderer=!0;class ZP extends Gt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class ep extends Rs{constructor(e=1,t=32,i=16,s=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:s,phiLength:r,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const h=[],u=new F,f=new F,d=[],g=[],O=[],m=[];for(let p=0;p<=i;p++){const y=[],S=p/i;let x=0;p===0&&o===0?x=.5/t:p===i&&l===Math.PI&&(x=-.5/t);for(let w=0;w<=t;w++){const T=w/t;u.x=-e*Math.cos(s+T*r)*Math.sin(o+S*a),u.y=e*Math.cos(o+S*a),u.z=e*Math.sin(s+T*r)*Math.sin(o+S*a),g.push(u.x,u.y,u.z),f.copy(u).normalize(),O.push(f.x,f.y,f.z),m.push(T+x,1-S),y.push(c++)}h.push(y)}for(let p=0;p0)&&d.push(S,x,T),(p!==i-1||l=-1&&Fr.z<=1&&d.layers.test(O.layers)===!0;if(d.element.style.display=m===!0?"":"none",m===!0){d.onBeforeRender(t,g,O);const y=d.element;y.style.transform="translate("+-100*d.center.x+"%,"+-100*d.center.y+"%)translate("+(Fr.x*r+r)+"px,"+(-Fr.y*o+o)+"px)",y.parentNode!==l&&l.appendChild(y),d.onAfterRender(t,g,O)}const p={distanceToCameraSquared:h(O,d)};a.objects.set(d,p)}for(let m=0,p=d.children.length;mMath.PI&&(Ne-=ke),et<-Math.PI?et+=ke:et>Math.PI&&(et-=ke),Ne<=et?a.theta=Math.max(Ne,Math.min(et,a.theta)):a.theta=a.theta>(Ne+et)/2?Math.max(Ne,a.theta):Math.min(et,a.theta)),a.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=c,a.radius=Math.max(i.minDistance,Math.min(i.maxDistance,a.radius)),i.enableDamping===!0?i.target.addScaledVector(h,i.dampingFactor):i.target.add(h),P.setFromSpherical(a),P.applyQuaternion(fe),_e.copy(i.target).add(P),i.object.lookAt(i.target),i.enableDamping===!0?(l.theta*=1-i.dampingFactor,l.phi*=1-i.dampingFactor,h.multiplyScalar(1-i.dampingFactor)):(l.set(0,0,0),h.set(0,0,0)),c=1,u||H.distanceToSquared(i.object.position)>o||8*(1-Ae.dot(i.object.quaternion))>o||Re.distanceToSquared(i.target)>0?(i.dispatchEvent(qg),H.copy(i.object.position),Ae.copy(i.object.quaternion),Re.copy(i.target),u=!1,!0):!1}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",M),i.domElement.removeEventListener("pointerdown",U),i.domElement.removeEventListener("pointercancel",B),i.domElement.removeEventListener("wheel",q),i.domElement.removeEventListener("pointermove",Z),i.domElement.removeEventListener("pointerup",B),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",ue),i._domElementKeyEvents=null)};const i=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=s.NONE;const o=1e-6,a=new Gg,l=new Gg;let c=1;const h=new F;let u=!1;const f=new Ge,d=new Ge,g=new Ge,O=new Ge,m=new Ge,p=new Ge,y=new Ge,S=new Ge,x=new Ge,w=[],T={};function C(){return 2*Math.PI/60/60*i.autoRotateSpeed}function k(){return Math.pow(.95,i.zoomSpeed)}function b(P){l.theta-=P}function E(P){l.phi-=P}const j=function(){const P=new F;return function(fe,H){P.setFromMatrixColumn(H,0),P.multiplyScalar(-fe),h.add(P)}}(),ae=function(){const P=new F;return function(fe,H){i.screenSpacePanning===!0?P.setFromMatrixColumn(H,1):(P.setFromMatrixColumn(H,0),P.crossVectors(i.object.up,P)),P.multiplyScalar(fe),h.add(P)}}(),Q=function(){const P=new F;return function(fe,H){const Ae=i.domElement;if(i.object.isPerspectiveCamera){const Re=i.object.position;P.copy(Re).sub(i.target);let ke=P.length();ke*=Math.tan(i.object.fov/2*Math.PI/180),j(2*fe*ke/Ae.clientHeight,i.object.matrix),ae(2*H*ke/Ae.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(j(fe*(i.object.right-i.object.left)/i.object.zoom/Ae.clientWidth,i.object.matrix),ae(H*(i.object.top-i.object.bottom)/i.object.zoom/Ae.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function W(P){i.object.isPerspectiveCamera?c/=P:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*P)),i.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function G(P){i.object.isPerspectiveCamera?c*=P:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/P)),i.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function K(P){f.set(P.clientX,P.clientY)}function X(P){y.set(P.clientX,P.clientY)}function z(P){O.set(P.clientX,P.clientY)}function se(P){d.set(P.clientX,P.clientY),g.subVectors(d,f).multiplyScalar(i.rotateSpeed);const te=i.domElement;b(2*Math.PI*g.x/te.clientHeight),E(2*Math.PI*g.y/te.clientHeight),f.copy(d),i.update()}function J(P){S.set(P.clientX,P.clientY),x.subVectors(S,y),x.y>0?W(k()):x.y<0&&G(k()),y.copy(S),i.update()}function be(P){m.set(P.clientX,P.clientY),p.subVectors(m,O).multiplyScalar(i.panSpeed),Q(p.x,p.y),O.copy(m),i.update()}function N(P){P.deltaY<0?G(k()):P.deltaY>0&&W(k()),i.update()}function de(P){let te=!1;switch(P.code){case i.keys.UP:P.ctrlKey||P.metaKey||P.shiftKey?E(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):Q(0,i.keyPanSpeed),te=!0;break;case i.keys.BOTTOM:P.ctrlKey||P.metaKey||P.shiftKey?E(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):Q(0,-i.keyPanSpeed),te=!0;break;case i.keys.LEFT:P.ctrlKey||P.metaKey||P.shiftKey?b(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):Q(i.keyPanSpeed,0),te=!0;break;case i.keys.RIGHT:P.ctrlKey||P.metaKey||P.shiftKey?b(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):Q(-i.keyPanSpeed,0),te=!0;break}te&&(P.preventDefault(),i.update())}function pe(){if(w.length===1)f.set(w[0].pageX,w[0].pageY);else{const P=.5*(w[0].pageX+w[1].pageX),te=.5*(w[0].pageY+w[1].pageY);f.set(P,te)}}function Te(){if(w.length===1)O.set(w[0].pageX,w[0].pageY);else{const P=.5*(w[0].pageX+w[1].pageX),te=.5*(w[0].pageY+w[1].pageY);O.set(P,te)}}function Se(){const P=w[0].pageX-w[1].pageX,te=w[0].pageY-w[1].pageY,fe=Math.sqrt(P*P+te*te);y.set(0,fe)}function De(){i.enableZoom&&Se(),i.enablePan&&Te()}function ze(){i.enableZoom&&Se(),i.enableRotate&&pe()}function Ue(P){if(w.length==1)d.set(P.pageX,P.pageY);else{const fe=oe(P),H=.5*(P.pageX+fe.x),Ae=.5*(P.pageY+fe.y);d.set(H,Ae)}g.subVectors(d,f).multiplyScalar(i.rotateSpeed);const te=i.domElement;b(2*Math.PI*g.x/te.clientHeight),E(2*Math.PI*g.y/te.clientHeight),f.copy(d)}function dt(P){if(w.length===1)m.set(P.pageX,P.pageY);else{const te=oe(P),fe=.5*(P.pageX+te.x),H=.5*(P.pageY+te.y);m.set(fe,H)}p.subVectors(m,O).multiplyScalar(i.panSpeed),Q(p.x,p.y),O.copy(m)}function We(P){const te=oe(P),fe=P.pageX-te.x,H=P.pageY-te.y,Ae=Math.sqrt(fe*fe+H*H);S.set(0,Ae),x.set(0,Math.pow(S.y/y.y,i.zoomSpeed)),W(x.y),y.copy(S)}function v(P){i.enableZoom&&We(P),i.enablePan&&dt(P)}function R(P){i.enableZoom&&We(P),i.enableRotate&&Ue(P)}function U(P){i.enabled!==!1&&(w.length===0&&(i.domElement.setPointerCapture(P.pointerId),i.domElement.addEventListener("pointermove",Z),i.domElement.addEventListener("pointerup",B)),_(P),P.pointerType==="touch"?le(P):ce(P))}function Z(P){i.enabled!==!1&&(P.pointerType==="touch"?we(P):he(P))}function B(P){I(P),w.length===0&&(i.domElement.releasePointerCapture(P.pointerId),i.domElement.removeEventListener("pointermove",Z),i.domElement.removeEventListener("pointerup",B)),i.dispatchEvent(Kg),r=s.NONE}function ce(P){let te;switch(P.button){case 0:te=i.mouseButtons.LEFT;break;case 1:te=i.mouseButtons.MIDDLE;break;case 2:te=i.mouseButtons.RIGHT;break;default:te=-1}switch(te){case yr.DOLLY:if(i.enableZoom===!1)return;X(P),r=s.DOLLY;break;case yr.ROTATE:if(P.ctrlKey||P.metaKey||P.shiftKey){if(i.enablePan===!1)return;z(P),r=s.PAN}else{if(i.enableRotate===!1)return;K(P),r=s.ROTATE}break;case yr.PAN:if(P.ctrlKey||P.metaKey||P.shiftKey){if(i.enableRotate===!1)return;K(P),r=s.ROTATE}else{if(i.enablePan===!1)return;z(P),r=s.PAN}break;default:r=s.NONE}r!==s.NONE&&i.dispatchEvent(Lu)}function he(P){switch(r){case s.ROTATE:if(i.enableRotate===!1)return;se(P);break;case s.DOLLY:if(i.enableZoom===!1)return;J(P);break;case s.PAN:if(i.enablePan===!1)return;be(P);break}}function q(P){i.enabled===!1||i.enableZoom===!1||r!==s.NONE||(P.preventDefault(),i.dispatchEvent(Lu),N(P),i.dispatchEvent(Kg))}function ue(P){i.enabled===!1||i.enablePan===!1||de(P)}function le(P){switch(ee(P),w.length){case 1:switch(i.touches.ONE){case br.ROTATE:if(i.enableRotate===!1)return;pe(),r=s.TOUCH_ROTATE;break;case br.PAN:if(i.enablePan===!1)return;Te(),r=s.TOUCH_PAN;break;default:r=s.NONE}break;case 2:switch(i.touches.TWO){case br.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;De(),r=s.TOUCH_DOLLY_PAN;break;case br.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;ze(),r=s.TOUCH_DOLLY_ROTATE;break;default:r=s.NONE}break;default:r=s.NONE}r!==s.NONE&&i.dispatchEvent(Lu)}function we(P){switch(ee(P),r){case s.TOUCH_ROTATE:if(i.enableRotate===!1)return;Ue(P),i.update();break;case s.TOUCH_PAN:if(i.enablePan===!1)return;dt(P),i.update();break;case s.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;v(P),i.update();break;case s.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;R(P),i.update();break;default:r=s.NONE}}function M(P){i.enabled!==!1&&P.preventDefault()}function _(P){w.push(P)}function I(P){delete T[P.pointerId];for(let te=0;te{ar.value+=1,ar.value>np.value&&(ar.value=tp.value)},tC=()=>{ar.value-=1,ar.value{const n=Fx.value,e=Bx.value;Du&&clearInterval(Du),n&&(Du=setInterval(Xx,1e3/e))});const Lh=()=>({advanceFrame:Xx,previousFrame:tC,isPlaying:Fx,startFrame:tp,endFrame:np,currentFrame:ar,framesPerSecond:Bx});function nC(n){return xv()?(Ly(n),!0):!1}function ip(n){return typeof n=="function"?n():nt(n)}const iC=typeof window<"u",sC=()=>{};function rC(n,e){function t(...i){return new Promise((s,r)=>{Promise.resolve(n(()=>e.apply(this,i),{fn:e,thisArg:this,args:i})).then(s).catch(r)})}return t}const zx=n=>n();function oC(n=zx){const e=$t(!0);function t(){e.value=!1}function i(){e.value=!0}const s=(...r)=>{e.value&&n(...r)};return{isActive:Ud(e),pause:t,resume:i,eventFilter:s}}var Jg=Object.getOwnPropertySymbols,aC=Object.prototype.hasOwnProperty,lC=Object.prototype.propertyIsEnumerable,cC=(n,e)=>{var t={};for(var i in n)aC.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&Jg)for(var i of Jg(n))e.indexOf(i)<0&&lC.call(n,i)&&(t[i]=n[i]);return t};function hC(n,e,t={}){const i=t,{eventFilter:s=zx}=i,r=cC(i,["eventFilter"]);return Ln(n,rC(s,e),r)}var uC=Object.defineProperty,fC=Object.defineProperties,dC=Object.getOwnPropertyDescriptors,Dc=Object.getOwnPropertySymbols,Vx=Object.prototype.hasOwnProperty,Wx=Object.prototype.propertyIsEnumerable,e0=(n,e,t)=>e in n?uC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,pC=(n,e)=>{for(var t in e||(e={}))Vx.call(e,t)&&e0(n,t,e[t]);if(Dc)for(var t of Dc(e))Wx.call(e,t)&&e0(n,t,e[t]);return n},mC=(n,e)=>fC(n,dC(e)),gC=(n,e)=>{var t={};for(var i in n)Vx.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&Dc)for(var i of Dc(n))e.indexOf(i)<0&&Wx.call(n,i)&&(t[i]=n[i]);return t};function OC(n,e,t={}){const i=t,{eventFilter:s}=i,r=gC(i,["eventFilter"]),{eventFilter:o,pause:a,resume:l,isActive:c}=oC(s);return{stop:hC(n,e,mC(pC({},r),{eventFilter:o})),pause:a,resume:l,isActive:c}}function vC(n){var e;const t=ip(n);return(e=t==null?void 0:t.$el)!=null?e:t}const Uc=iC?window:void 0;function t0(...n){let e,t,i,s;if(typeof n[0]=="string"||Array.isArray(n[0])?([t,i,s]=n,e=Uc):[e,t,i,s]=n,!e)return sC;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const r=[],o=()=>{r.forEach(h=>h()),r.length=0},a=(h,u,f,d)=>(h.addEventListener(u,f,d),()=>h.removeEventListener(u,f,d)),l=Ln(()=>[vC(e),ip(s)],([h,u])=>{o(),h&&r.push(...t.flatMap(f=>i.map(d=>a(h,f,d,u))))},{immediate:!0,flush:"post"}),c=()=>{l(),o()};return nC(c),c}const Ul=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Il="__vueuse_ssr_handlers__",xC=SC();function SC(){return Il in Ul||(Ul[Il]=Ul[Il]||{}),Ul[Il]}function _C(n,e){return xC[n]||e}function yC(n){return n==null?"any":n instanceof Set?"set":n instanceof Map?"map":n instanceof Date?"date":typeof n=="boolean"?"boolean":typeof n=="string"?"string":typeof n=="object"?"object":Number.isNaN(n)?"any":"number"}var bC=Object.defineProperty,n0=Object.getOwnPropertySymbols,wC=Object.prototype.hasOwnProperty,MC=Object.prototype.propertyIsEnumerable,i0=(n,e,t)=>e in n?bC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,s0=(n,e)=>{for(var t in e||(e={}))wC.call(e,t)&&i0(n,t,e[t]);if(n0)for(var t of n0(e))MC.call(e,t)&&i0(n,t,e[t]);return n};const TC={boolean:{read:n=>n==="true",write:n=>String(n)},object:{read:n=>JSON.parse(n),write:n=>JSON.stringify(n)},number:{read:n=>Number.parseFloat(n),write:n=>String(n)},any:{read:n=>n,write:n=>String(n)},string:{read:n=>n,write:n=>String(n)},map:{read:n=>new Map(JSON.parse(n)),write:n=>JSON.stringify(Array.from(n.entries()))},set:{read:n=>new Set(JSON.parse(n)),write:n=>JSON.stringify(Array.from(n))},date:{read:n=>new Date(n),write:n=>n.toISOString()}},r0="vueuse-storage";function EC(n,e,t,i={}){var s;const{flush:r="pre",deep:o=!0,listenToStorageChanges:a=!0,writeDefaults:l=!0,mergeDefaults:c=!1,shallow:h,window:u=Uc,eventFilter:f,onError:d=k=>{console.error(k)}}=i,g=(h?cc:$t)(e);if(!t)try{t=_C("getDefaultStorage",()=>{var k;return(k=Uc)==null?void 0:k.localStorage})()}catch(k){d(k)}if(!t)return g;const O=ip(e),m=yC(O),p=(s=i.serializer)!=null?s:TC[m],{pause:y,resume:S}=OC(g,()=>x(g.value),{flush:r,deep:o,eventFilter:f});return u&&a&&(t0(u,"storage",C),t0(u,r0,T)),C(),g;function x(k){try{if(k==null)t.removeItem(n);else{const b=p.write(k),E=t.getItem(n);E!==b&&(t.setItem(n,b),u&&u.dispatchEvent(new CustomEvent(r0,{detail:{key:n,oldValue:E,newValue:b,storageArea:t}})))}}catch(b){d(b)}}function w(k){const b=k?k.newValue:t.getItem(n);if(b==null)return l&&O!==null&&t.setItem(n,p.write(O)),O;if(!k&&c){const E=p.read(b);return typeof c=="function"?c(E,O):m==="object"&&!Array.isArray(E)?s0(s0({},O),E):E}else return typeof b!="string"?b:p.read(b)}function T(k){C(k.detail)}function C(k){if(!(k&&k.storageArea!==t)){if(k&&k.key==null){g.value=O;return}if(!(k&&k.key!==n)){y();try{g.value=w(k)}catch(b){d(b)}finally{k?Iv(S):S()}}}}}function Za(n,e,t={}){const{window:i=Uc}=t;return EC(n,e,i==null?void 0:i.localStorage,t)}const Gx=[{label:"Default",value:` return [ Math.cos(((position.x + position.y) * 1) + (time * tau)) * 0.5 + 0.5, 0, @@ -3501,7 +3501,7 @@ return [ brightness, brightness, brightness -]`.trim()}],sp=Za("colorFunctionString",Lt(Gx[0].value)),Ta=Za("userPresets",Lt([]));let fc=()=>[1,1,1];const Zx=()=>{const n=sp.value;try{fc=new Function("config",` +]`.trim()}],sp=Za("colorFunctionString",$t(Gx[0].value)),Ta=Za("userPresets",$t([]));let fc=()=>[1,1,1];const Zx=()=>{const n=sp.value;try{fc=new Function("config",` const { index, count, @@ -3866,23 +3866,23 @@ v 0.000000 0.938913 8.024675 v -0.587401 0.033907 -1.888071 v -0.350409 -0.402419 -1.963040 v 0.000000 1.886240 -2.357533 -`,{endFrame:Hx,startFrame:Ic,currentFrame:RC}=Lh(),{getColorFunction:Yx}=rp(),Qc=new Nx({alpha:!0,antialias:!0}),Ha=new JP;Ha.domElement.className="label-div";const ea=Qc.domElement,Hi=new Bn(45,window.innerWidth/window.innerHeight,.1,1e4),kC=new eC(Hi,Ha.domElement),Ea=new ZP,op=new qP(16777215,.5);op.position.set(-2,2,2);op.castShadow=!0;Ea.add(op);const LC=new HP(13565695,11791088,.5);Ea.add(LC);Hi.position.set(8,0,0);Hi.lookAt(new F(0,0,0));Hi.rotation.z=Math.PI;let Ql,Nl,DC=new Ge;const UC=Math.PI/180,IC=()=>{const n=ea.clientWidth,e=ea.clientHeight,t=window.devicePixelRatio;if(Ql=n*t,Nl=e*t,ea.width!==Ql||ea.height!==Nl){const i=Ql/Nl,s=Math.PI/4;Hi.fov=(i>=1?s:2*Math.atan(Math.tan(s/2)/i))/UC,Hi.aspect=i,Hi.updateProjectionMatrix(),Qc.setPixelRatio(t),Qc.setSize(n,e,!1),Ha.setSize(n,e),DC.set(Ql/2,Nl/2)}};let ap=new ep(1,4,2),io=ap.clone(),Cf=new Rh({color:16776960});const jx=new wi(io,Cf);jx.position.set(1,0,0);const Yi=new Jo;Ea.add(Yi);Yi.add(jx);const qx=()=>{const n=Hx.value-Ic.value+1,e=(Ic.value+RC.value/n)%1;{requestAnimationFrame(qx),IC(),kC.update();const t=Yx();if(t){const i=Yi.children.length;Yi.children.forEach((s,r)=>{s.material.color.fromArray(t({index:r,count:i,position:s.position,time:e}))})}Qc.render(Ea,Hi),Ha.render(Ea,Hi)}};requestAnimationFrame(qx);const QC=n=>{Yi.children=[];const e=[];n.replace(/\r/g,"").split(` -`).forEach((a,l)=>{const c=a.split(" ");if(c[0]==="v"){const h=[c[1]*1,c[2]*1,c[3]*1];e.push(h),Cf=new Rh({color:16776960});const u=new wi(io,Cf),f=document.createElement("div");f.innerText=l;const d=new KP(f);u.position.set(h[0],h[1],h[2]),u.add(d),Yi.add(u)}});const i=e[0].slice(),s=e[0].slice();e.forEach(a=>{i[0]=Math.min(i[0],a[0]),i[1]=Math.min(i[1],a[1]),i[2]=Math.min(i[2],a[2]),s[0]=Math.max(s[0],a[0]),s[1]=Math.max(s[1],a[1]),s[2]=Math.max(s[2],a[2])});const r=2/Math.max(Math.abs(i[0]),Math.abs(i[1]),Math.abs(i[2]),Math.abs(s[0]),Math.abs(s[1]),Math.abs(s[2])),o=1/r/20;return io.copy(ap),io.scale(o,o,o),Yi.scale.set(r,r,r),e},NC=n=>n>=0?Math.min(255,n):0,$C=()=>{const n=Hx.value-Ic.value+1,e=Yx(),t=[];for(let i=0;i{t.push(...e({index:a,count:r,position:o.position,time:s}).map(l=>NC(Math.round(l*255))))})}}return t},Kx=Lt([]),Jx=Za("lastUploadedObjText",Lt(CC)),Nc=Za("settings",{ledScale:.5,showIndices:!1}),FC=es({get(){return Nc.value.ledScale},set(n){const e=n*1;io.copy(ap),io.scale(e,e,e),Nc.value.ledScale=e}}),BC=es({get(){return Nc.value.showIndices},set(n){Nc.value.showIndices=!!n}}),XC=es(()=>Kx.value.length),eS=n=>{Jx.value=n,Kx.value=QC(n)};eS(Jx.value);const lp=()=>({processOutputColors:$C,viewportCanvas:ea,labelOverlay:Ha.domElement,vertCount:XC,ingestObjText:eS,ledSize:FC,showIndices:BC});const zC={class:"TimelineControl"},VC=ve("span",{title:"The beginning of all time"},"start",-1),WC=ve("span",{title:"The end of the world"},"end",-1),GC=ve("span",{title:"The frame which is currently displayed"},"frame",-1),ZC=ve("span",{title:"Frames Per Second"},"fps",-1),HC={class:"timeline"},YC=["onMousedown","onMousemove"],jC={class:"hover"},qC={__name:"TimelineControl",setup(n){const{isPlaying:e,startFrame:t,endFrame:i,currentFrame:s,framesPerSecond:r}=Lh(),o=es(()=>i.value-t.value+7),a=Lt(!1),l=u=>{s.value=u},c=u=>{a.value&&l(u)},h=()=>{a.value=!1};return document.body.addEventListener("mouseup",h),zd(()=>{document.body.removeEventListener("mouseup",h)}),(u,f)=>(Ct(),gn("div",zC,[ve("form",{onSubmit:f[5]||(f[5]=Eh(()=>{},["prevent"]))},[ve("div",null,[ve("button",{onClick:f[0]||(f[0]=d=>e.value=!et(e))},[ve("span",null,"play: ["+Vn(et(e)?"x":" ")+"]",1)]),ve("label",null,[VC,bi(ve("input",{type:"number","onUpdate:modelValue":f[1]||(f[1]=d=>Ot(t)?t.value=d:null)},null,512),[[Wr,et(t)]])]),ve("label",null,[WC,bi(ve("input",{type:"number","onUpdate:modelValue":f[2]||(f[2]=d=>Ot(i)?i.value=d:null)},null,512),[[Wr,et(i)]])]),ve("label",null,[GC,bi(ve("input",{type:"number","onUpdate:modelValue":f[3]||(f[3]=d=>Ot(s)?s.value=d:null)},null,512),[[Wr,et(s)]])]),ve("label",null,[ZC,bi(ve("input",{type:"number","onUpdate:modelValue":f[4]||(f[4]=d=>Ot(r)?r.value=d:null)},null,512),[[Wr,et(r)]])])])],32),ve("div",HC,[ve("div",{class:"bars",onMousedown:f[6]||(f[6]=d=>a.value=!0),onMouseup:f[7]||(f[7]=d=>a.value=!1)},[(Ct(!0),gn(fn,null,Ac(o.value,(d,g)=>(Ct(),gn("span",{class:Co(["bar",{darker:g-2>et(i)||g-2l(g-2),onMousemove:O=>c(g-2)},[ve("span",jC,Vn(g-2),1)],46,YC))),128))],32)])]))}},ta=Za("panelStates",{}),KC=n=>(ta.value[n]===void 0&&(ta.value[n]=!0),es({get:()=>ta.value[n],set:e=>ta.value[n]=e}));window.panelStates=ta;const JC=()=>({getPanelState:KC});const eR={key:0,class:"content"},cp={__name:"AccordionPanel",props:{title:{required:!0,type:String}},setup(n){const e=n,{getPanelState:t}=JC(),i=t(e.title);return(s,r)=>(Ct(),gn("div",{class:Co(["AccordionPanel",{open:et(i)}])},[ve("h3",null,[ve("button",{onClick:r[0]||(r[0]=o=>i.value=!et(i))},Vn(et(i)?"v":">")+" "+Vn(n.title),1)]),et(i)?(Ct(),gn("div",eR,[Ib(s.$slots,"default")])):Mh("",!0)],2))}};class ot{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),_i.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),_i.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new fa(this),r=new fa(e);for(let o=t,a=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(a+=s.value.length,s.done||a>=i)return!0}}iter(e=1){return new fa(this,e)}iterRange(e,t=this.length){return new tS(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new nS(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?ot.empty:e.length<=32?new Mt(e):_i.from(Mt.split(e,[]))}}class Mt extends ot{constructor(e,t=tR(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],a=s+o.length;if((t?i:a)>=e)return new nR(s,a,i,o);s=a+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new Mt(o0(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),a=dc(r.text,o.text.slice(),0,r.length);if(a.length<=32)i.push(new Mt(a,o.length+r.length));else{let l=a.length>>1;i.push(new Mt(a.slice(0,l)),new Mt(a.slice(l)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof Mt))return super.replace(e,t,i);let s=dc(this.text,dc(i.text,o0(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new Mt(s,r):_i.from(Mt.split(s,[]),r)}sliceString(e,t=this.length,i=` +`,{endFrame:Hx,startFrame:Ic,currentFrame:RC}=Lh(),{getColorFunction:Yx}=rp(),Qc=new Nx({alpha:!0,antialias:!0}),Ha=new JP;Ha.domElement.className="label-div";const ea=Qc.domElement,vr=document.createElement("div");vr.className="viewport-parent";vr.appendChild(ea);vr.appendChild(Ha.domElement);const Hi=new Bn(45,window.innerWidth/window.innerHeight,.1,1e4),kC=new eC(Hi,vr),Ea=new ZP,op=new qP(16777215,.5);op.position.set(-2,2,2);op.castShadow=!0;Ea.add(op);const LC=new HP(13565695,11791088,.5);Ea.add(LC);Hi.position.set(8,0,0);Hi.lookAt(new F(0,0,0));Hi.rotation.z=Math.PI;let Ql,Nl,DC=new Ge;const UC=Math.PI/180,IC=()=>{const n=ea.clientWidth,e=ea.clientHeight,t=window.devicePixelRatio;if(Ql=n*t,Nl=e*t,ea.width!==Ql||ea.height!==Nl){const i=Ql/Nl,s=Math.PI/4;Hi.fov=(i>=1?s:2*Math.atan(Math.tan(s/2)/i))/UC,Hi.aspect=i,Hi.updateProjectionMatrix(),Qc.setPixelRatio(t),Qc.setSize(n,e,!1),Ha.setSize(n,e),DC.set(Ql/2,Nl/2)}};let ap=new ep(1,4,2),so=ap.clone(),Cf=new Rh({color:16776960});const jx=new bi(so,Cf);jx.position.set(1,0,0);const Yi=new Jo;Ea.add(Yi);Yi.add(jx);const qx=()=>{const n=Hx.value-Ic.value+1,e=(Ic.value+RC.value/n)%1;{requestAnimationFrame(qx),IC(),kC.update();const t=Yx();if(t){const i=Yi.children.length;Yi.children.forEach((s,r)=>{s.material.color.fromArray(t({index:r,count:i,position:s.position,time:e}))})}Qc.render(Ea,Hi),Ha.render(Ea,Hi)}};requestAnimationFrame(qx);const QC=n=>{Yi.children=[],Ha.domElement.innerHTML="";const e=[];n.replace(/\r/g,"").split(` +`).forEach(a=>{const l=a.split(" ");if(l[0]==="v"){const c=[l[1]*1,l[2]*1,l[3]*1],h=e.length;e.push(c),Cf=new Rh({color:16776960});const u=new bi(so,Cf),f=document.createElement("div"),d=document.createElement("div");f.className="vertex-label",d.className="vertex-label-text",d.innerText=""+h,f.appendChild(d);const g=new KP(f);u.position.set(c[0],c[1],c[2]),u.add(g),Yi.add(u)}});const i=e[0].slice(),s=e[0].slice();e.forEach(a=>{i[0]=Math.min(i[0],a[0]),i[1]=Math.min(i[1],a[1]),i[2]=Math.min(i[2],a[2]),s[0]=Math.max(s[0],a[0]),s[1]=Math.max(s[1],a[1]),s[2]=Math.max(s[2],a[2])});const r=2/Math.max(Math.abs(i[0]),Math.abs(i[1]),Math.abs(i[2]),Math.abs(s[0]),Math.abs(s[1]),Math.abs(s[2])),o=1/r/20;return so.copy(ap),so.scale(o,o,o),Yi.scale.set(r,r,r),e},NC=n=>n>=0?Math.min(255,n):0,$C=()=>{const n=Hx.value-Ic.value+1,e=Yx(),t=[];for(let i=0;i{t.push(...e({index:a,count:r,position:o.position,time:s}).map(l=>NC(Math.round(l*255))))})}}return t},Kx=$t([]),Jx=Za("lastUploadedObjText",$t(CC)),Nc=Za("settings",{ledScale:.5,showIndices:!1}),FC=es({get(){return Nc.value.ledScale},set(n){const e=n*1;so.copy(ap),so.scale(e,e,e),Nc.value.ledScale=e}}),eS=es({get(){return Nc.value.showIndices},set(n){const e=!!n,t=e?"remove":"add";vr.classList[t]("hidden"),Nc.value.showIndices=e}}),BC=eS.value?"remove":"add";vr.classList[BC]("hidden");const XC=es(()=>Kx.value.length),tS=n=>{Jx.value=n,Kx.value=QC(n)};tS(Jx.value);const lp=()=>({processOutputColors:$C,viewportDomParent:vr,vertCount:XC,ingestObjText:tS,ledSize:FC,showIndices:eS});const zC={class:"TimelineControl"},VC=ve("span",{title:"The beginning of all time"},"start",-1),WC=ve("span",{title:"The end of the world"},"end",-1),GC=ve("span",{title:"The frame which is currently displayed"},"frame",-1),ZC=ve("span",{title:"Frames Per Second"},"fps",-1),HC={class:"timeline"},YC=["onMousedown","onMousemove"],jC={class:"hover"},qC={__name:"TimelineControl",setup(n){const{isPlaying:e,startFrame:t,endFrame:i,currentFrame:s,framesPerSecond:r}=Lh(),o=es(()=>i.value-t.value+7),a=$t(!1),l=u=>{s.value=u},c=u=>{a.value&&l(u)},h=()=>{a.value=!1};return document.body.addEventListener("mouseup",h),zd(()=>{document.body.removeEventListener("mouseup",h)}),(u,f)=>(Ct(),gn("div",zC,[ve("form",{onSubmit:f[5]||(f[5]=Eh(()=>{},["prevent"]))},[ve("div",null,[ve("button",{onClick:f[0]||(f[0]=d=>e.value=!nt(e))},[ve("span",null,"play: ["+Vn(nt(e)?"x":" ")+"]",1)]),ve("label",null,[VC,Wi(ve("input",{type:"number","onUpdate:modelValue":f[1]||(f[1]=d=>Ot(t)?t.value=d:null)},null,512),[[Gr,nt(t)]])]),ve("label",null,[WC,Wi(ve("input",{type:"number","onUpdate:modelValue":f[2]||(f[2]=d=>Ot(i)?i.value=d:null)},null,512),[[Gr,nt(i)]])]),ve("label",null,[GC,Wi(ve("input",{type:"number","onUpdate:modelValue":f[3]||(f[3]=d=>Ot(s)?s.value=d:null)},null,512),[[Gr,nt(s)]])]),ve("label",null,[ZC,Wi(ve("input",{type:"number","onUpdate:modelValue":f[4]||(f[4]=d=>Ot(r)?r.value=d:null)},null,512),[[Gr,nt(r)]])])])],32),ve("div",HC,[ve("div",{class:"bars",onMousedown:f[6]||(f[6]=d=>a.value=!0),onMouseup:f[7]||(f[7]=d=>a.value=!1)},[(Ct(!0),gn(fn,null,Ac(o.value,(d,g)=>(Ct(),gn("span",{class:Ro(["bar",{darker:g-2>nt(i)||g-2l(g-2),onMousemove:O=>c(g-2)},[ve("span",jC,Vn(g-2),1)],46,YC))),128))],32)])]))}},ta=Za("panelStates",{}),KC=n=>(ta.value[n]===void 0&&(ta.value[n]=!0),es({get:()=>ta.value[n],set:e=>ta.value[n]=e}));window.panelStates=ta;const JC=()=>({getPanelState:KC});const eR={key:0,class:"content"},cp={__name:"AccordionPanel",props:{title:{required:!0,type:String}},setup(n){const e=n,{getPanelState:t}=JC(),i=t(e.title);return(s,r)=>(Ct(),gn("div",{class:Ro(["AccordionPanel",{open:nt(i)}])},[ve("h3",null,[ve("button",{onClick:r[0]||(r[0]=o=>i.value=!nt(i))},Vn(nt(i)?"v":">")+" "+Vn(n.title),1)]),nt(i)?(Ct(),gn("div",eR,[Qb(s.$slots,"default")])):Mh("",!0)],2))}};class ot{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),_i.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),_i.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new fa(this),r=new fa(e);for(let o=t,a=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(a+=s.value.length,s.done||a>=i)return!0}}iter(e=1){return new fa(this,e)}iterRange(e,t=this.length){return new nS(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new iS(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?ot.empty:e.length<=32?new Mt(e):_i.from(Mt.split(e,[]))}}class Mt extends ot{constructor(e,t=tR(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],a=s+o.length;if((t?i:a)>=e)return new nR(s,a,i,o);s=a+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new Mt(o0(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),a=dc(r.text,o.text.slice(),0,r.length);if(a.length<=32)i.push(new Mt(a,o.length+r.length));else{let l=a.length>>1;i.push(new Mt(a.slice(0,l)),new Mt(a.slice(l)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof Mt))return super.replace(e,t,i);let s=dc(this.text,dc(i.text,o0(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new Mt(s,r):_i.from(Mt.split(s,[]),r)}sliceString(e,t=this.length,i=` `){let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=a.slice(Math.max(0,e-r),t-r)),r=l+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new Mt(i,s)),i=[],s=-1);return s>-1&&t.push(new Mt(i,s)),t}}class _i extends ot{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],a=s+o.length,l=i+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,i,s);s=a+1,i=l+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let c=s&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?i.push(a):a.decompose(e-o,t-o,i,c)}o=l+1}}replace(e,t,i){if(i.lines=r&&t<=a){let l=o.replace(e-r,t-r,i),c=this.lines-o.lines+l.lines;if(l.lines>5-1&&l.lines>c>>5+1){let h=this.children.slice();return h[s]=l,new _i(h,this.length-(t-e)+i.length)}return super.replace(r,a,l)}r=a+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` `){let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=a.sliceString(e-o,t-o,i)),o=l+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof _i))return 0;let i=0,[s,r,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==a)return i;let l=this.children[s],c=e.children[r];if(l!=c)return i+l.scanIdentical(c,t);i+=l.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let g of e)g.flatten(d);return new Mt(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,a=[],l=0,c=-1,h=[];function u(d){let g;if(d.lines>r&&d instanceof _i)for(let O of d.children)u(O);else d.lines>o&&(l>o||!l)?(f(),a.push(d)):d instanceof Mt&&l&&(g=h[h.length-1])instanceof Mt&&d.lines+g.lines<=32?(l+=d.lines,c+=d.length+1,h[h.length-1]=new Mt(g.text.concat(d.text),g.length+1+d.length)):(l+d.lines>s&&f(),l+=d.lines,c+=d.length+1,h.push(d))}function f(){l!=0&&(a.push(h.length==1?h[0]:_i.from(h,c)),c=-1,l=h.length=0)}for(let d of e)u(d);return f(),a.length==1?a[0]:new _i(a,t)}}ot.empty=new Mt([""],0);function tR(n){let e=-1;for(let t of n)e+=t.length+1;return e}function dc(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(l>i&&(a=a.slice(0,i-s)),s0?1:(e instanceof Mt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,a=s instanceof Mt?s.text.length:s.children.length;if(o==(t>0?a:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(s instanceof Mt){let l=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=s.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Mt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class tS{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new fa(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class nS{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ot.prototype[Symbol.iterator]=function(){return this.iter()},fa.prototype[Symbol.iterator]=tS.prototype[Symbol.iterator]=nS.prototype[Symbol.iterator]=function(){return this});class nR{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let so="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;nn)return so[e-1]<=n;return!1}function a0(n){return n>=127462&&n<=127487}const l0=8205;function rn(n,e,t=!0,i=!0){return(t?iS:sR)(n,e,i)}function iS(n,e,t){if(e==n.length)return e;e&&sS(n.charCodeAt(e))&&rS(n.charCodeAt(e-1))&&e--;let i=jt(n,e);for(e+=Xn(i);e=0&&a0(jt(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function sR(n,e,t){for(;e>0;){let i=iS(n,e-2,t);if(i=56320&&n<57344}function rS(n){return n>=55296&&n<56320}function jt(n,e){let t=n.charCodeAt(e);if(!rS(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return sS(i)?(t-55296<<10)+(i-56320)+65536:t}function hp(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Xn(n){return n<65536?1:2}const Rf=/\r\n?|\n/;var Kt=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(Kt||(Kt={}));class Ci{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=a}else{if(i!=Kt.Simple&&c>=e&&(i==Kt.TrackDel&&se||i==Kt.TrackBefore&&se))return null;if(c>e||c==e&&t<0&&!a)return e==s||t<0?r:r+l;r+=l}s=c}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&a>=e)return st?"cover":!0;s=a}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ci(e)}static create(e){return new Ci(e)}}class It extends Ci{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return kf(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return Lf(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=a,t[s+1]=o;let l=s>>1;for(;i.length0&&ms(i,t,r.text),r.forward(h),a+=h}let c=e[o++];for(;a>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,a=null;function l(h=!1){if(!h&&!s.length)return;of||u<0||f>t)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${t})`);let g=d?typeof d=="string"?ot.of(d.split(i||Rf)):d:ot.empty,O=g.length;if(u==f&&O==0)return;uo&&tn(s,u-o,-1),tn(s,f-u,O),ms(r,s,g),o=f}}return c(e),l(!a),a}static empty(e){return new It(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sa&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function ms(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)a=n.sections[o++],l=n.sections[o++];e(s,c,r,h,u),s=c,r=h}}}function Lf(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Aa(n),a=new Aa(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);tn(s,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len=0&&l=0){let c=0,h=o.len;for(;h;)if(a.ins==-1){let u=Math.min(h,a.len);c+=u,h-=u,a.forward(u)}else if(a.ins==0&&a.lenl||o.ins>=0&&o.len>l)&&(a||i.length>c),r.forward2(l),o.forward(l)}}}}class Aa{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?ot.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?ot.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Ks{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Ks(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return re.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return re.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return re.range(e.anchor,e.head)}static create(e,t,i){return new Ks(e,t,i)}}class re{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:re.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;te.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new re(e.ranges.map(t=>Ks.fromJSON(t)),e.main)}static single(e,t=e){return new re([re.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?4:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?re.range(l,a):re.range(a,l))}}return new re(e,t)}}function aS(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let up=0;class Ce{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=up++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}static define(e={}){return new Ce(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:fp),!!e.static,e.enables)}of(e){return new pc([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new pc(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new pc(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function fp(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class pc{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=up++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,a=this.type==2,l=!1,c=!1,h=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?c=!0:((t=e[u.id])!==null&&t!==void 0?t:1)&1||h.push(e[u.id]);return{create(u){return u.values[o]=i(u),1},update(u,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||Df(u,h)){let d=i(u);if(a?!c0(d,u.values[o],s):!s(d,u.values[o]))return u.values[o]=d,1}return 0},reconfigure:(u,f)=>{let d,g=f.config.address[r];if(g!=null){let O=Fc(f,g);if(this.dependencies.every(m=>m instanceof Ce?f.facet(m)===u.facet(m):m instanceof Ht?f.field(m,!1)==u.field(m,!1):!0)||(a?c0(d=i(u),O,s):s(d=i(u),O)))return u.values[o]=O,0}else d=i(u);return u.values[o]=d,1}}}}function c0(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[l.id]),s=t.map(l=>l.type),r=i.filter(l=>!(l&1)),o=n[e.id]>>1;function a(l){let c=[];for(let h=0;hi===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(h0).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,h0.of({field:this,create:e})]}get extension(){return this}}const Hs={lowest:4,low:3,default:2,high:1,highest:0};function Vo(n){return e=>new lS(e,n)}const vr={highest:Vo(Hs.highest),high:Vo(Hs.high),default:Vo(Hs.default),low:Vo(Hs.low),lowest:Vo(Hs.lowest)};class lS{constructor(e,t){this.inner=e,this.prec=t}}class Ya{of(e){return new Uf(this,e)}reconfigure(e){return Ya.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Uf{constructor(e,t){this.compartment=e,this.inner=t}}class $c{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let f of oR(e,t,o))f instanceof Ht?s.push(f):(r[f.facet.id]||(r[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of s)a[f.id]=c.length<<1,c.push(d=>f.slot(d));let h=i==null?void 0:i.config.facets;for(let f in r){let d=r[f],g=d[0].facet,O=h&&h[f]||[];if(d.every(m=>m.type==0))if(a[g.id]=l.length<<1|1,fp(O,d))l.push(i.facet(g));else{let m=g.combine(d.map(p=>p.value));l.push(i&&g.compare(m,i.facet(g))?i.facet(g):m)}else{for(let m of d)m.type==0?(a[m.id]=l.length<<1|1,l.push(m.value)):(a[m.id]=c.length<<1,c.push(p=>m.dynamicSlot(p)));a[g.id]=c.length<<1,c.push(m=>rR(m,g,d))}}let u=c.map(f=>f(a));return new $c(e,o,u,a,l,r)}}function oR(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let c=i[l].indexOf(o);c>-1&&i[l].splice(c,1),o instanceof Uf&&t.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let c of o)r(c,a);else if(o instanceof Uf){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),r(c,a)}else if(o instanceof lS)r(o.inner,o.prec);else if(o instanceof Ht)i[a].push(o),o.provides&&r(o.provides,a);else if(o instanceof pc)i[a].push(o),o.facet.extensions&&r(o.facet.extensions,Hs.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(c,a)}}return r(n,Hs.default),i.reduce((o,a)=>o.concat(a))}function da(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Fc(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const cS=Ce.define(),hS=Ce.define({combine:n=>n.some(e=>e),static:!0}),uS=Ce.define({combine:n=>n.length?n[0]:void 0,static:!0}),fS=Ce.define(),dS=Ce.define(),pS=Ce.define(),mS=Ce.define({combine:n=>n.length?n[0]:!1});class ts{constructor(e,t){this.type=e,this.value=t}static define(){return new aR}}class aR{of(e){return new ts(this,e)}}class lR{constructor(e){this.map=e}of(e){return new Xe(this,e)}}class Xe{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Xe(this.type,t)}is(e){return this.type==e}static define(e={}){return new lR(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}Xe.reconfigure=Xe.define();Xe.appendConfig=Xe.define();class $t{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&aS(i,t.newLength),r.some(a=>a.type==$t.time)||(this.annotations=r.concat($t.time.of(Date.now())))}static create(e,t,i,s,r,o){return new $t(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation($t.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}$t.time=ts.define();$t.userEvent=ts.define();$t.addToHistory=ts.define();$t.remote=ts.define();function cR(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof $t?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof $t?n=r[0]:n=OS(e,ro(r),!1)}return n}function uR(n){let e=n.startState,t=e.facet(pS),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=gS(i,If(e,r,n.changes.newLength),!0))}return i==n?n:$t.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const fR=[];function ro(n){return n==null?fR:Array.isArray(n)?n:[n]}var vt=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(vt||(vt={}));const dR=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Qf;try{Qf=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function pR(n){if(Qf)return Qf.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||dR.test(t)))return!0}return!1}function mR(n){return e=>{if(!/\S/.test(e))return vt.Space;if(pR(e))return vt.Word;for(let t=0;t-1)return vt.Word;return vt.Other}}class nt{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let a=0;as.set(l,a)),t=null),s.set(o.value.compartment,o.value.extension)):o.is(Xe.reconfigure)?(t=null,i=o.value):o.is(Xe.appendConfig)&&(t=null,i=ro(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=$c.resolve(i,s,this),r=new nt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values),new nt(t,e.newDoc,e.newSelection,r,(o,a)=>a.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:re.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=ro(i.effects);for(let a=1;ao.spec.fromJSON(a,l)))}}return nt.create({doc:e.doc,selection:re.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=$c.resolve(e.extensions||[],new Map),i=e.doc instanceof ot?e.doc:ot.of((e.doc||"").split(t.staticFacet(nt.lineSeparator)||Rf)),s=e.selection?e.selection instanceof re?e.selection:re.single(e.selection.anchor,e.selection.head):re.single(0);return aS(s,i.length),t.staticFacet(hS)||(s=s.asSingle()),new nt(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(nt.tabSize)}get lineBreak(){return this.facet(nt.lineSeparator)||` -`}get readOnly(){return this.facet(mS)}phrase(e,...t){for(let i of this.facet(nt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(cS))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return mR(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,a=e-i;for(;o>0;){let l=rn(t,o,!1);if(r(t.slice(l,o))!=vt.Word)break;o=l}for(;an.length?n[0]:4});nt.lineSeparator=uS;nt.readOnly=mS;nt.phrases=Ce.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});nt.languageData=cS;nt.changeFilter=fS;nt.transactionFilter=dS;nt.transactionExtender=pS;Ya.reconfigure=Xe.define();function Li(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],a=i[r];if(a===void 0)i[r]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](a,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class pr{eq(e){return this==e}range(e,t=e){return Nf.create(e,t,this)}}pr.prototype.startSide=pr.prototype.endSide=0;pr.prototype.point=!1;pr.prototype.mapMode=Kt.TrackDel;let Nf=class vS{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new vS(e,t,i)}};function $f(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class dp{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,a=r.length;;){if(o==a)return o;let l=o+a>>1,c=r[l]-e||(i?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,d-f)),i.push(c),s.push(f-o),r.push(d-o))}return{mapped:i.length?new dp(s,r,i,a):null,pos:o}}}class lt{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new lt(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort($f)),this.isEmpty)return t.length?lt.of(t):this;let a=new xS(this,null,-1).goto(0),l=0,c=[],h=new Ms;for(;a.value||l=0){let u=t[l++];h.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndexthis.chunkEnd(a.chunkIndex)||ra.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Pa.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Pa.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=r),a=t.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=r),l=u0(o,a,i),c=new Wo(o,l,r),h=new Wo(a,l,r);i.iterGaps((u,f,d)=>f0(c,u,h,f,d,s)),i.empty&&i.length==0&&f0(c,0,h,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=1e9-1);let r=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),o=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let a=u0(r,o),l=new Wo(r,a,0).goto(i),c=new Wo(o,a,0).goto(i);for(;;){if(l.to!=c.to||!Ff(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>s)return!0;l.next(),c.next()}}static spans(e,t,i,s,r=-1){let o=new Wo(e,null,r).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,i);if(o.point){let h=o.activeForPoint(o.to),u=o.pointFroma&&(s.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>i)return l+(o.point&&o.to>i?1:0);a=o.to,o.next()}}static of(e,t=!1){let i=new Ms;for(let s of e instanceof Nf?[e]:t?gR(e):e)i.add(s.from,s.to,s.value);return i.finish()}}lt.empty=new lt([],[],null,-1);function gR(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort($f);e=i}return n}lt.empty.nextLayer=lt.empty;class Ms{finishChunk(e){this.chunks.push(new dp(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new Ms)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(lt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=lt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function u0(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new xS(o,t,i,r));return s.length==1?s[0]:new Pa(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Uu(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Uu(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Uu(this.heap,0)}}}function Uu(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class Wo{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Pa.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){$l(this.active,e),$l(this.activeTo,e),$l(this.activeRank,e),this.minActive=d0(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&$l(i,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[s]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function f0(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,a=i,l=i-e;for(;;){let c=n.to+l-t.to||n.endSide-t.endSide,h=c<0?n.to+l:t.to,u=Math.min(h,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&Ff(n.activeForPoint(n.to),t.activeForPoint(t.to))||r.comparePoint(a,u,n.point,t.point):u>a&&!Ff(n.active,t.active)&&r.compareRange(a,u,n.active,t.active),h>o)break;a=h,c<=0&&n.next(),c>=0&&t.next()}}function Ff(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function d0(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=rn(n,s)}return i===!0?-1:n.length}const Xf="ͼ",p0=typeof Symbol>"u"?"__"+Xf:Symbol.for(Xf),zf=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),m0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Ts{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,a,l,c){let h=[],u=/^@(\w+)\b/.exec(o[0]),f=u&&u[1]=="keyframes";if(u&&a==null)return l.push(o[0]+";");for(let d in a){let g=a[d];if(/&/.test(d))r(d.split(/,\s*/).map(O=>o.map(m=>O.replace(/&/,m))).reduce((O,m)=>O.concat(m)),g,l);else if(g&&typeof g=="object"){if(!u)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),g,h,f)}else g!=null&&h.push(d.replace(/_.*/,"").replace(/[A-Z]/g,O=>"-"+O.toLowerCase())+": "+g+";")}(h.length||f)&&l.push((i&&!u&&!c?o.map(i):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` +`,this;e--}else if(s instanceof Mt){let l=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=s.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Mt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class nS{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new fa(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class iS{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(ot.prototype[Symbol.iterator]=function(){return this.iter()},fa.prototype[Symbol.iterator]=nS.prototype[Symbol.iterator]=iS.prototype[Symbol.iterator]=function(){return this});class nR{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let ro="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;nn)return ro[e-1]<=n;return!1}function a0(n){return n>=127462&&n<=127487}const l0=8205;function rn(n,e,t=!0,i=!0){return(t?sS:sR)(n,e,i)}function sS(n,e,t){if(e==n.length)return e;e&&rS(n.charCodeAt(e))&&oS(n.charCodeAt(e-1))&&e--;let i=jt(n,e);for(e+=Xn(i);e=0&&a0(jt(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function sR(n,e,t){for(;e>0;){let i=sS(n,e-2,t);if(i=56320&&n<57344}function oS(n){return n>=55296&&n<56320}function jt(n,e){let t=n.charCodeAt(e);if(!oS(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return rS(i)?(t-55296<<10)+(i-56320)+65536:t}function hp(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Xn(n){return n<65536?1:2}const Rf=/\r\n?|\n/;var Kt=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(Kt||(Kt={}));class Pi{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=a}else{if(i!=Kt.Simple&&c>=e&&(i==Kt.TrackDel&&se||i==Kt.TrackBefore&&se))return null;if(c>e||c==e&&t<0&&!a)return e==s||t<0?r:r+l;r+=l}s=c}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&a>=e)return st?"cover":!0;s=a}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Pi(e)}static create(e){return new Pi(e)}}class Ut extends Pi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return kf(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return Lf(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=a,t[s+1]=o;let l=s>>1;for(;i.length0&&ms(i,t,r.text),r.forward(h),a+=h}let c=e[o++];for(;a>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,a=null;function l(h=!1){if(!h&&!s.length)return;of||u<0||f>t)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${t})`);let g=d?typeof d=="string"?ot.of(d.split(i||Rf)):d:ot.empty,O=g.length;if(u==f&&O==0)return;uo&&tn(s,u-o,-1),tn(s,f-u,O),ms(r,s,g),o=f}}return c(e),l(!a),a}static empty(e){return new Ut(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sa&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function ms(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)a=n.sections[o++],l=n.sections[o++];e(s,c,r,h,u),s=c,r=h}}}function Lf(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Aa(n),a=new Aa(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);tn(s,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len=0&&l=0){let c=0,h=o.len;for(;h;)if(a.ins==-1){let u=Math.min(h,a.len);c+=u,h-=u,a.forward(u)}else if(a.ins==0&&a.lenl||o.ins>=0&&o.len>l)&&(a||i.length>c),r.forward2(l),o.forward(l)}}}}class Aa{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?ot.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?ot.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Ks{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Ks(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return re.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return re.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return re.range(e.anchor,e.head)}static create(e,t,i){return new Ks(e,t,i)}}class re{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:re.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;te.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new re(e.ranges.map(t=>Ks.fromJSON(t)),e.main)}static single(e,t=e){return new re([re.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?4:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?re.range(l,a):re.range(a,l))}}return new re(e,t)}}function lS(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let up=0;class Ce{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=up++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}static define(e={}){return new Ce(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:fp),!!e.static,e.enables)}of(e){return new pc([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new pc(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new pc(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function fp(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class pc{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=up++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,a=this.type==2,l=!1,c=!1,h=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?c=!0:((t=e[u.id])!==null&&t!==void 0?t:1)&1||h.push(e[u.id]);return{create(u){return u.values[o]=i(u),1},update(u,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||Df(u,h)){let d=i(u);if(a?!c0(d,u.values[o],s):!s(d,u.values[o]))return u.values[o]=d,1}return 0},reconfigure:(u,f)=>{let d,g=f.config.address[r];if(g!=null){let O=Fc(f,g);if(this.dependencies.every(m=>m instanceof Ce?f.facet(m)===u.facet(m):m instanceof Ht?f.field(m,!1)==u.field(m,!1):!0)||(a?c0(d=i(u),O,s):s(d=i(u),O)))return u.values[o]=O,0}else d=i(u);return u.values[o]=d,1}}}}function c0(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[l.id]),s=t.map(l=>l.type),r=i.filter(l=>!(l&1)),o=n[e.id]>>1;function a(l){let c=[];for(let h=0;hi===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(h0).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,h0.of({field:this,create:e})]}get extension(){return this}}const Hs={lowest:4,low:3,default:2,high:1,highest:0};function Vo(n){return e=>new cS(e,n)}const xr={highest:Vo(Hs.highest),high:Vo(Hs.high),default:Vo(Hs.default),low:Vo(Hs.low),lowest:Vo(Hs.lowest)};class cS{constructor(e,t){this.inner=e,this.prec=t}}class Ya{of(e){return new Uf(this,e)}reconfigure(e){return Ya.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Uf{constructor(e,t){this.compartment=e,this.inner=t}}class $c{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let f of oR(e,t,o))f instanceof Ht?s.push(f):(r[f.facet.id]||(r[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of s)a[f.id]=c.length<<1,c.push(d=>f.slot(d));let h=i==null?void 0:i.config.facets;for(let f in r){let d=r[f],g=d[0].facet,O=h&&h[f]||[];if(d.every(m=>m.type==0))if(a[g.id]=l.length<<1|1,fp(O,d))l.push(i.facet(g));else{let m=g.combine(d.map(p=>p.value));l.push(i&&g.compare(m,i.facet(g))?i.facet(g):m)}else{for(let m of d)m.type==0?(a[m.id]=l.length<<1|1,l.push(m.value)):(a[m.id]=c.length<<1,c.push(p=>m.dynamicSlot(p)));a[g.id]=c.length<<1,c.push(m=>rR(m,g,d))}}let u=c.map(f=>f(a));return new $c(e,o,u,a,l,r)}}function oR(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let c=i[l].indexOf(o);c>-1&&i[l].splice(c,1),o instanceof Uf&&t.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let c of o)r(c,a);else if(o instanceof Uf){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),r(c,a)}else if(o instanceof cS)r(o.inner,o.prec);else if(o instanceof Ht)i[a].push(o),o.provides&&r(o.provides,a);else if(o instanceof pc)i[a].push(o),o.facet.extensions&&r(o.facet.extensions,Hs.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(c,a)}}return r(n,Hs.default),i.reduce((o,a)=>o.concat(a))}function da(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Fc(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const hS=Ce.define(),uS=Ce.define({combine:n=>n.some(e=>e),static:!0}),fS=Ce.define({combine:n=>n.length?n[0]:void 0,static:!0}),dS=Ce.define(),pS=Ce.define(),mS=Ce.define(),gS=Ce.define({combine:n=>n.length?n[0]:!1});class ts{constructor(e,t){this.type=e,this.value=t}static define(){return new aR}}class aR{of(e){return new ts(this,e)}}class lR{constructor(e){this.map=e}of(e){return new Xe(this,e)}}class Xe{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Xe(this.type,t)}is(e){return this.type==e}static define(e={}){return new lR(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}Xe.reconfigure=Xe.define();Xe.appendConfig=Xe.define();class Nt{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&lS(i,t.newLength),r.some(a=>a.type==Nt.time)||(this.annotations=r.concat(Nt.time.of(Date.now())))}static create(e,t,i,s,r,o){return new Nt(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Nt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Nt.time=ts.define();Nt.userEvent=ts.define();Nt.addToHistory=ts.define();Nt.remote=ts.define();function cR(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof Nt?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Nt?n=r[0]:n=vS(e,oo(r),!1)}return n}function uR(n){let e=n.startState,t=e.facet(mS),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=OS(i,If(e,r,n.changes.newLength),!0))}return i==n?n:Nt.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const fR=[];function oo(n){return n==null?fR:Array.isArray(n)?n:[n]}var vt=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(vt||(vt={}));const dR=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Qf;try{Qf=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function pR(n){if(Qf)return Qf.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||dR.test(t)))return!0}return!1}function mR(n){return e=>{if(!/\S/.test(e))return vt.Space;if(pR(e))return vt.Word;for(let t=0;t-1)return vt.Word;return vt.Other}}class tt{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let a=0;as.set(l,a)),t=null),s.set(o.value.compartment,o.value.extension)):o.is(Xe.reconfigure)?(t=null,i=o.value):o.is(Xe.appendConfig)&&(t=null,i=oo(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=$c.resolve(i,s,this),r=new tt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values),new tt(t,e.newDoc,e.newSelection,r,(o,a)=>a.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:re.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=oo(i.effects);for(let a=1;ao.spec.fromJSON(a,l)))}}return tt.create({doc:e.doc,selection:re.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=$c.resolve(e.extensions||[],new Map),i=e.doc instanceof ot?e.doc:ot.of((e.doc||"").split(t.staticFacet(tt.lineSeparator)||Rf)),s=e.selection?e.selection instanceof re?e.selection:re.single(e.selection.anchor,e.selection.head):re.single(0);return lS(s,i.length),t.staticFacet(uS)||(s=s.asSingle()),new tt(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(tt.tabSize)}get lineBreak(){return this.facet(tt.lineSeparator)||` +`}get readOnly(){return this.facet(gS)}phrase(e,...t){for(let i of this.facet(tt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(hS))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return mR(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,a=e-i;for(;o>0;){let l=rn(t,o,!1);if(r(t.slice(l,o))!=vt.Word)break;o=l}for(;an.length?n[0]:4});tt.lineSeparator=fS;tt.readOnly=gS;tt.phrases=Ce.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});tt.languageData=hS;tt.changeFilter=dS;tt.transactionFilter=pS;tt.transactionExtender=mS;Ya.reconfigure=Xe.define();function ki(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],a=i[r];if(a===void 0)i[r]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](a,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class pr{eq(e){return this==e}range(e,t=e){return Nf.create(e,t,this)}}pr.prototype.startSide=pr.prototype.endSide=0;pr.prototype.point=!1;pr.prototype.mapMode=Kt.TrackDel;let Nf=class xS{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new xS(e,t,i)}};function $f(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class dp{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,a=r.length;;){if(o==a)return o;let l=o+a>>1,c=r[l]-e||(i?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,d-f)),i.push(c),s.push(f-o),r.push(d-o))}return{mapped:i.length?new dp(s,r,i,a):null,pos:o}}}class lt{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new lt(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort($f)),this.isEmpty)return t.length?lt.of(t):this;let a=new SS(this,null,-1).goto(0),l=0,c=[],h=new Ms;for(;a.value||l=0){let u=t[l++];h.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndexthis.chunkEnd(a.chunkIndex)||ra.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Pa.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Pa.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=r),a=t.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=r),l=u0(o,a,i),c=new Wo(o,l,r),h=new Wo(a,l,r);i.iterGaps((u,f,d)=>f0(c,u,h,f,d,s)),i.empty&&i.length==0&&f0(c,0,h,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=1e9-1);let r=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),o=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let a=u0(r,o),l=new Wo(r,a,0).goto(i),c=new Wo(o,a,0).goto(i);for(;;){if(l.to!=c.to||!Ff(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>s)return!0;l.next(),c.next()}}static spans(e,t,i,s,r=-1){let o=new Wo(e,null,r).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,i);if(o.point){let h=o.activeForPoint(o.to),u=o.pointFroma&&(s.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>i)return l+(o.point&&o.to>i?1:0);a=o.to,o.next()}}static of(e,t=!1){let i=new Ms;for(let s of e instanceof Nf?[e]:t?gR(e):e)i.add(s.from,s.to,s.value);return i.finish()}}lt.empty=new lt([],[],null,-1);function gR(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort($f);e=i}return n}lt.empty.nextLayer=lt.empty;class Ms{finishChunk(e){this.chunks.push(new dp(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new Ms)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(lt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=lt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function u0(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new SS(o,t,i,r));return s.length==1?s[0]:new Pa(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Uu(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Uu(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Uu(this.heap,0)}}}function Uu(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class Wo{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Pa.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){$l(this.active,e),$l(this.activeTo,e),$l(this.activeRank,e),this.minActive=d0(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&$l(i,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[s]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function f0(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,a=i,l=i-e;for(;;){let c=n.to+l-t.to||n.endSide-t.endSide,h=c<0?n.to+l:t.to,u=Math.min(h,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&Ff(n.activeForPoint(n.to),t.activeForPoint(t.to))||r.comparePoint(a,u,n.point,t.point):u>a&&!Ff(n.active,t.active)&&r.compareRange(a,u,n.active,t.active),h>o)break;a=h,c<=0&&n.next(),c>=0&&t.next()}}function Ff(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function d0(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=rn(n,s)}return i===!0?-1:n.length}const Xf="ͼ",p0=typeof Symbol>"u"?"__"+Xf:Symbol.for(Xf),zf=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),m0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Ts{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,a,l,c){let h=[],u=/^@(\w+)\b/.exec(o[0]),f=u&&u[1]=="keyframes";if(u&&a==null)return l.push(o[0]+";");for(let d in a){let g=a[d];if(/&/.test(d))r(d.split(/,\s*/).map(O=>o.map(m=>O.replace(/&/,m))).reduce((O,m)=>O.concat(m)),g,l);else if(g&&typeof g=="object"){if(!u)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),g,h,f)}else g!=null&&h.push(d.replace(/_.*/,"").replace(/[A-Z]/g,O=>"-"+O.toLowerCase())+": "+g+";")}(h.length||f)&&l.push((i&&!u&&!c?o.map(i):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let e=m0[p0]||1;return m0[p0]=e+1,Xf+e.toString(36)}static mount(e,t){(e[zf]||new OR(e)).mount(Array.isArray(t)?t:[t])}}let g0=new Map;class OR{constructor(e){let t=e.ownerDocument||e,i=t.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=g0.get(t);if(s)return e.adoptedStyleSheets=[s.sheet,...e.adoptedStyleSheets],e[zf]=s;this.sheet=new i.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],g0.set(t,this)}else{this.styleTag=t.createElement("style");let s=e.head||e;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],e[zf]=this}mount(e){let t=this.sheet,i=0,s=0;for(let r=0;r-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,o),t)for(let l=0;l",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},vR=typeof navigator<"u"&&/Mac/.test(navigator.platform),xR=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var qt=0;qt<10;qt++)Es[48+qt]=Es[96+qt]=String(qt);for(var qt=1;qt<=24;qt++)Es[qt+111]="F"+qt;for(var qt=65;qt<=90;qt++)Es[qt]=String.fromCharCode(qt+32),Ca[qt]=String.fromCharCode(qt);for(var Iu in Es)Ca.hasOwnProperty(Iu)||(Ca[Iu]=Es[Iu]);function SR(n){var e=vR&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||xR&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ca:Es)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Bc(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Vf(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function _R(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function mc(n,e){if(!e.anchorNode)return!1;try{return Vf(n,e.anchorNode)}catch{return!1}}function yo(n){return n.nodeType==3?mr(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Xc(n,e,t,i){return t?O0(n,e,t,i,-1)||O0(n,e,t,i,1):!1}function zc(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function O0(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:As(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=zc(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?As(n):0}else return!1}}function As(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Dh(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function yR(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function bR(n,e,t,i,s,r,o,a){let l=n.ownerDocument,c=l.defaultView||window;for(let h=n,u=!1;h&&!u;)if(h.nodeType==1){let f,d=h==l.body;if(d)f=yR(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let m=h.getBoundingClientRect();f={left:m.left,right:m.left+h.clientWidth,top:m.top,bottom:m.top+h.clientHeight}}let g=0,O=0;if(s=="nearest")e.top0&&e.bottom>f.bottom+O&&(O=e.bottom-f.bottom+O+o)):e.bottom>f.bottom&&(O=e.bottom-f.bottom+o,t<0&&e.top-O0&&e.right>f.right+g&&(g=e.right-f.right+g+r)):e.right>f.right&&(g=e.right-f.right+r,t<0&&e.leftt.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11)t=t.host;else break;return null}class MR{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?As(t):0),i,Math.min(e.focusOffset,i?As(i):0))}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let Fr=null;function SS(n){if(n.setActive)return n.setActive();if(Fr)return n.focus(Fr);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Fr==null?{get preventScroll(){return Fr={preventScroll:!0},!0}}:void 0),!Fr){Fr=!1;for(let t=0;tMath.max(1,n.scrollHeight-n.clientHeight-4)}class vn{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new vn(e.parentNode,zc(e),t)}static after(e,t){return new vn(e.parentNode,zc(e)+1,t)}}const pp=[];class ut{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,s=null,r;for(let o of this.children){if(o.flags&7){if(!o.dom&&(r=s?s.nextSibling:i.firstChild)){let a=ut.get(r);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(r)}o.sync(e,t),o.flags&=-8}if(r=s?s.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&r!=o.dom&&(t.written=!0),o.dom.parentNode==i)for(;r&&r!=o.dom;)r=x0(r);else i.insertBefore(o.dom,r);s=o.dom}for(r=s?s.nextSibling:i.firstChild,r&&t&&t.node==i&&(t.written=!0);r;)r=x0(r)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let s=As(e)==0?0:t==0?-1:1;for(;;){let r=e.parentNode;if(r==this.dom)break;s==0&&r.firstChild!=r.lastChild&&(e==r.firstChild?s=-1:s=1),e=r}s<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!ut.get(i);)i=i.nextSibling;if(!i)return this.length;for(let s=0,r=0;;s++){let o=this.children[s];if(o.dom==i)return r;r+=o.length+o.breakAfter}}domBoundsAround(e,t,i=0){let s=-1,r=-1,o=-1,a=-1;for(let l=0,c=i,h=i;lt)return u.domBoundsAround(e,t,c);if(f>=e&&s==-1&&(s=l,r=c),c>t&&u.dom.parentNode==this.dom){o=l,a=h;break}h=f,c=f+u.breakAfter}return{from:r,to:a<0?i+this.length:a,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=pp){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function wS(n,e,t,i,s,r,o,a,l){let{children:c}=n,h=c.length?c[e]:null,u=r.length?r[r.length-1]:null,f=u?u.breakAfter:o;if(!(e==i&&h&&!o&&!f&&r.length<2&&h.merge(t,s,r.length?u:null,t==0,a,l))){if(i0&&(!o&&r.length&&h.merge(t,h.length,r[0],!1,a,0)?h.breakAfter=r.shift().breakAfter:(tr)&&this.lineBreak(),s=o}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,a;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(a=s.exec(t))&&(r=a.index,o=a[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=ut.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+Math.min(t,i.offset))}}function S0(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}class _0{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}let In=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Wf=typeof document<"u"?document:{documentElement:{style:{}}};const Gf=/Edge\/(\d+)/.exec(In.userAgent),ES=/MSIE \d/.test(In.userAgent),Zf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(In.userAgent),Uh=!!(ES||Zf||Gf),y0=!Uh&&/gecko\/(\d+)/i.test(In.userAgent),Qu=!Uh&&/Chrome\/(\d+)/.exec(In.userAgent),b0="webkitFontSmoothing"in Wf.documentElement.style,AS=!Uh&&/Apple Computer/.test(In.vendor),w0=AS&&(/Mobile\/\w+/.test(In.userAgent)||In.maxTouchPoints>2);var Le={mac:w0||/Mac/.test(In.platform),windows:/Win/.test(In.platform),linux:/Linux|X11/.test(In.platform),ie:Uh,ie_version:ES?Wf.documentMode||6:Zf?+Zf[1]:Gf?+Gf[1]:0,gecko:y0,gecko_version:y0?+(/Firefox\/(\d+)/.exec(In.userAgent)||[0,0])[1]:0,chrome:!!Qu,chrome_version:Qu?+Qu[1]:0,ios:w0,android:/Android\b/.test(In.userAgent),webkit:b0,safari:AS,webkit_version:b0?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Wf.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const AR=256;class ki extends ut{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return this.flags&8||i&&(!(i instanceof ki)||this.length-(t-e)+i.length>AR||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new ki(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new vn(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return PR(this.dom,e,t)}}class qi extends ut{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let s of t)s.setParent(this)}setAttrs(e){if(_S(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,s,r,o){return i&&(!(i instanceof qi&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(s=r),i=l,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new qi(this.mark,t,o)}domAtPos(e){return PS(this,e)}coordsAt(e,t){return RS(this,e,t)}}function PR(n,e,t){let i=n.nodeValue.length;e>i&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?Le.chrome||Le.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return Le.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Dh(l,o<0):l||null}class Js extends ut{constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}static create(e,t,i){return new Js(e,t,i)}split(e){let t=Js.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,i,s,r,o){return i&&(!(i instanceof Js)||!this.widget.compare(i.widget)||e>0&&r<=0||t0)?vn.before(this.dom):vn.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?s.length-1:0;r=s[a],!(e>0?a==0:a==s.length-1||r.top0?vn.before(this.dom):vn.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return ot.empty}get isHidden(){return!0}}ki.prototype.children=Js.prototype.children=bo.prototype.children=pp;function PS(n,e){let t=n.dom,{children:i}=n,s=0;for(let r=0;sr&&e0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r0&&e instanceof qi&&s.length&&(i=s[s.length-1])instanceof qi&&i.mark.eq(e.mark)?CS(i,e.children[0],t-1):(s.push(e),e.setParent(n)),n.length+=e.length}function RS(n,e,t){let i=null,s=-1,r=null,o=-1;function a(c,h){for(let u=0,f=0;u=h&&(d.children.length?a(d,h-f):(!r||r.isHidden&&t>0)&&(g>h||f==g&&d.getSide()>0)?(r=d,o=h-f):(f-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let r of i)if(r!=t&&(s.indexOf(r)==-1||n[r]!==e[r]))return!1;return!0}function Yf(n,e,t){let i=null;if(e)for(let s in e)t&&s in t||n.removeAttribute(i=s);if(t)for(let s in t)e&&e[s]==t[s]||n.setAttribute(i=s,t[s]);return!!i}function RR(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new Ps(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=kS(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Ps(e,i,s,t,e.widget||null,!0)}static line(e){return new Ka(e)}static set(e,t=!1){return lt.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ie.none=lt.empty;class qa extends Ie{constructor(e){let{start:t,end:i}=kS(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof qa&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&mp(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}qa.prototype.point=!1;class Ka extends Ie{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ka&&this.spec.class==e.spec.class&&mp(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Ka.prototype.mapMode=Kt.TrackBefore;Ka.prototype.point=!0;class Ps extends Ie{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?Kt.TrackBefore:Kt.TrackAfter:Kt.TrackDel}get type(){return this.startSide=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ps&&kR(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Ps.prototype.point=!0;function kS(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function kR(n,e){return n==e||!!(n&&e&&n.compare(e))}function jf(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class pn extends ut{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,r,o){if(i){if(!(i instanceof pn))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),MS(this,e,t,i?i.children:[],r,o),!0}split(e){let t=new pn;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){mp(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){CS(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Hf(t,this.attrs||{})),i&&(this.attrs=Hf({class:i},this.attrs||{}))}domAtPos(e){return PS(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(_S(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Yf(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let s=this.dom.lastChild;for(;s&&ut.get(s)instanceof qi;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((i=ut.get(s))===null||i===void 0?void 0:i.isEditable)==!1&&(!Le.ios||!this.children.some(r=>r instanceof ki))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof ki)||/[^ -~]/.test(i.text))return null;let s=yo(i.dom);if(s.length!=1)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=RS(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight=t){if(r instanceof pn)return r;if(o>t)break}s=o+r.breakAfter}return null}}class lr extends ut{constructor(e,t,i){super(),this.widget=e,this.length=t,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,s,r,o){return i&&(!(i instanceof lr)||!this.widget.compare(i.widget)||e>0&&r<=0||t0;){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Bl(new ki(this.text.slice(this.textOff,this.textOff+s)),t),i),this.atCursorPos=!0,this.textOff+=s,e-=s,i=0}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof Ps){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=t-e;if(i instanceof Ps)if(i.block){let{type:l}=i;l==_t.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new lr(i.widget||new T0("div"),a,l))}else{let l=Js.create(i.widget||new T0("span"),a,a?0:i.startSide),c=this.atCursorPos&&!l.isEditable&&r<=s.length&&(e0),h=!l.isEditable&&(es.length||i.startSide<=0),u=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),c&&(u.append(Bl(new bo(1),s),r),r=s.length+Math.max(0,r-s.length)),u.append(Bl(l,s),r),this.atCursorPos=h,this.pendingBuffer=h?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,i,s,r){let o=new pa(e,t,i,r);return o.openEnd=lt.spans(s,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Bl(n,e){for(let t of e)n=new qi(t,[n],n.length);return n}class T0 extends ns{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const LS=Ce.define(),DS=Ce.define(),US=Ce.define(),IS=Ce.define(),qf=Ce.define(),QS=Ce.define(),NS=Ce.define(),$S=Ce.define({combine:n=>n.some(e=>e)}),FS=Ce.define({combine:n=>n.some(e=>e)});class Vc{constructor(e,t="nearest",i="nearest",s=5,r=5){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r}map(e){return e.empty?this:new Vc(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const E0=Xe.define({map:(n,e)=>n.map(e)});function Wn(n,e,t){let i=n.facet(IS);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const Ih=Ce.define({combine:n=>n.length?n[0]:!0});let LR=0;const na=Ce.define();class Ut{constructor(e,t,i,s){this.id=e,this.create=t,this.domEventHandlers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:i,provide:s,decorations:r}=t||{};return new Ut(LR++,e,i,o=>{let a=[na.of(o)];return r&&a.push(Ra.of(l=>{let c=l.plugin(o);return c?r(c):Ie.none})),s&&a.push(s(o)),a})}static fromClass(e,t){return Ut.define(i=>new e(i),t)}}class Nu{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Wn(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){Wn(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Wn(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const BS=Ce.define(),gp=Ce.define(),Ra=Ce.define(),Op=Ce.define(),XS=Ce.define();function zS(n){let e=0,t=0,i=0,s=0;for(let r of n.state.facet(XS)){let o=r(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:i,bottom:s}}const ia=Ce.define();class Gn{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Gn(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAh)break;r+=2}if(!l)return i;new Gn(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),o=l.toA,a=l.toB}}}class Wc{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=It.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,a,l)=>s.push(new Gn(r,o,a,l))),this.changedRanges=s}static create(e,t,i){return new Wc(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}var St=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(St||(St={}));const Kf=St.LTR,DR=St.RTL;function VS(n){let e=[];for(let t=0;t=t){if(a.level==i)return o;(r<0||(s!=0?s<0?a.fromt:e[r].level>a.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}const xt=[];function $R(n,e){let t=n.length,i=e==Kf?1:2,s=e==Kf?2:1;if(!n||i==1&&!NR.test(n))return WS(t);for(let o=0,a=i,l=i;o=0;f-=3)if(di[f+1]==-h){let d=di[f+2],g=d&2?i:d&4?d&1?s:i:0;g&&(xt[o]=xt[di[f]]=g),a=f;break}}else{if(di.length==189)break;di[a++]=o,di[a++]=c,di[a++]=l}else if((u=xt[o])==2||u==1){let f=u==i;l=f?0:1;for(let d=a-3;d>=0;d-=3){let g=di[d+2];if(g&2)break;if(f)di[d+2]|=2;else{if(g&4)break;di[d+2]|=4}}}for(let o=0;oa;){let h=c,u=xt[--c]!=2;for(;c>a&&u==(xt[c-1]!=2);)c--;r.push(new ao(c,h,u?2:1))}else r.push(new ao(a,o,0))}else for(let o=0;o0&&t.length&&(t.every(({fromA:a,toA:l})=>lthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let i=this.view.inputState.composing<0?null:XR(this.view,e.changes);if(this.hasComposition){this.markedForComposition.clear();let{from:a,to:l}=this.hasComposition;t=new Gn(a,l,e.changes.mapPos(a,-1),e.changes.mapPos(l,1)).addToSet(t.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Le.ie||Le.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,r=this.updateDeco(),o=WR(s,r,e.changes);return t=Gn.extendWithRanges(t,o),!(this.flags&7)&&t.length==0?!1:(this.updateInner(t,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=Le.chrome||Le.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||s.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to=0?s[o]:null;if(!a)break;let{fromA:l,toA:c,fromB:h,toB:u}=a,f,d,g,O;if(i&&i.range.fromBh){let x=pa.build(this.view.state.doc,h,i.range.fromB,this.decorations,this.dynamicDecorationMap),w=pa.build(this.view.state.doc,i.range.toB,u,this.decorations,this.dynamicDecorationMap);d=x.breakAtStart,g=x.openStart,O=w.openEnd;let T=this.compositionView(i);w.breakAtStart?T.breakAfter=1:w.content.length&&T.merge(T.length,T.length,w.content[0],!1,w.openStart,0)&&(T.breakAfter=w.content[0].breakAfter,w.content.shift()),x.content.length&&T.merge(0,0,x.content[x.content.length-1],!0,0,x.openEnd)&&x.content.pop(),f=x.content.concat(T).concat(w.content)}else({content:f,breakAtStart:d,openStart:g,openEnd:O}=pa.build(this.view.state.doc,h,u,this.decorations,this.dynamicDecorationMap));let{i:m,off:p}=r.findPos(c,1),{i:y,off:S}=r.findPos(l,-1);wS(this,y,S,m,p,f,d,g,O)}i&&this.fixCompositionDOM(i)}compositionView(e){let t=new ki(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new qi(s,[t],t.length);let i=new pn;return i.append(t,0),i}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8,this.markedForComposition.add(o);let a=ut.get(r);a!=o&&(a&&(a.dom=null),o.setDOM(r))},i=this.childPos(e.range.fromB,1),s=this.children[i.i];t(e.line,s);for(let r=e.marks.length-1;r>=-1;r--)i=s.childPos(i.off,1),s=s.children[i.i],t(r>=0?e.marks[r].node:e.text,s)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom,r=!s&&mc(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.domAtPos(a.anchor),c=a.empty?l:this.domAtPos(a.head);if(Le.gecko&&a.empty&&!this.hasComposition&&BR(l)){let u=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(u,l.node.childNodes[l.offset]||null)),l=c=new vn(u,0),o=!0}let h=this.view.observer.selectionRange;(o||!h.focusNode||!Xc(l.node,l.offset,h.anchorNode,h.anchorOffset)||!Xc(c.node,c.offset,h.focusNode,h.focusOffset))&&(this.view.observer.ignore(()=>{Le.android&&Le.chrome&&this.dom.contains(h.focusNode)&&GR(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let u=Bc(this.view.root);if(u)if(a.empty){if(Le.gecko){let f=zR(l.node,l.offset);if(f&&f!=3){let d=HS(l.node,l.offset,f==1?1:-1);d&&(l=new vn(d,f==1?0:d.nodeValue.length))}}u.collapse(l.node,l.offset),a.bidiLevel!=null&&h.cursorBidiLevel!=null&&(h.cursorBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(l.node,l.offset);try{u.extend(c.node,c.offset)}catch{}}else{let f=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),f.setEnd(c.node,c.offset),f.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(f)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new vn(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new vn(h.focusNode,h.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Bc(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=pn.find(this,t.head);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let h=this.domAtPos(t.head+t.assoc);i.collapse(h.node,h.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&i.collapse(s,r)}nearest(e){for(let t=e;t;){let i=ut.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;to||e==o&&r.type!=_t.WidgetBefore&&r.type!=_t.WidgetAfter&&(!s||t==2||this.children[s-1].breakAfter||this.children[s-1].type==_t.WidgetBefore&&t>-2))return r.coordsAt(e-o,t);i=o}}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),s=this.children[t];if(!(s instanceof pn))return null;for(;s.children.length;){let{i:a,off:l}=s.childPos(i,1);for(;;a++){if(a==s.children.length)return null;if((s=s.children[a]).length)break}i=l}if(!(s instanceof ki))return null;let r=rn(s.text,i);if(r==i)return null;let o=mr(s.dom,i,r).getClientRects();return!o.length||o[0].top>=o[0].bottom?null:o[0]}measureVisibleLineHeights(e){let t=[],{from:i,to:s}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==St.LTR;for(let c=0,h=0;hs)break;if(c>=i){let d=u.dom.getBoundingClientRect();if(t.push(d.height),o){let g=u.dom.lastChild,O=g?yo(g):[];if(O.length){let m=O[O.length-1],p=l?m.right-d.left:d.right-m.left;p>a&&(a=p,this.minWidth=r,this.minWidthFrom=c,this.minWidthTo=f)}}}c=f+u.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?St.RTL:St.LTR}measureTextSize(){for(let r of this.children)if(r instanceof pn){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=yo(e.firstChild)[0];t=e.getBoundingClientRect().height,i=r?r.width/27:7,s=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:s}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new bS(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>i){let a=t.lineBlockAt(o).bottom-t.lineBlockAt(i).top;e.push(Ie.replace({widget:new P0(a),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return Ie.set(e)}updateDeco(){let e=this.view.state.facet(Ra).map((t,i)=>(this.dynamicDecorationMap[i]=typeof t=="function")?t(this.view):t);for(let t=e.length;tt.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=zS(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom};bR(this.view.scrollDOM,o,t.head-1)return null;o+=u.text.length}if(a=a.parentNode,!a)return null;let l=ut.get(a);if(l){s=r=l.posAtStart+o;break}}return{from:s,to:r,node:t}}function XR(n,e){let t=ZS(n);if(!t)return null;let{from:i,to:s,node:r}=t,o=e.mapPos(i,-1),a=e.mapPos(s,1),l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(a-o!=l.length){let f=e.mapPos(i,1),d=e.mapPos(s,-1);if(d-f==l.length)o=f,a=d;else if(n.state.doc.sliceString(a-l.length,a)==l)o=a-l.length;else if(n.state.doc.sliceString(o,o+l.length)==l)a=o+l.length;else return null}let{main:c}=n.state.selection;if(n.state.doc.sliceString(o,a)!=l||o>c.head||a0)i=i.childNodes[s-1],s=As(i);else break}if(t>=0)for(let i=n,s=e;;){if(i.nodeType==3)return i;if(i.nodeType==1&&s=0)i=i.childNodes[s],s=0;else break}return null}function zR(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e0;){let c=rn(s.text,o,!1);if(i(s.text.slice(c,o))!=l)break;o=c}for(;an?e.left-n:Math.max(0,n-e.right)}function YR(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function $u(n,e){return n.tope.top+1}function C0(n,e){return en.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function ed(n,e,t){let i,s,r,o,a=!1,l,c,h,u;for(let g=n.firstChild;g;g=g.nextSibling){let O=yo(g);for(let m=0;mS||o==S&&r>y){i=g,s=p,r=y,o=S;let x=S?t0?m0)}y==0?t>p.bottom&&(!h||h.bottomp.top)&&(c=g,u=p):h&&$u(h,p)?h=R0(h,p.bottom):u&&$u(u,p)&&(u=C0(u,p.top))}}if(h&&h.bottom>=t?(i=l,s=h):u&&u.top<=t&&(i=c,s=u),!i)return{node:n,offset:0};let f=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return k0(i,f,t);if(a&&i.contentEditable!="false")return ed(i,f,t);let d=Array.prototype.indexOf.call(n.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:n,offset:d}}function k0(n,e,t){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;at?h.top-t:t-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&u=(h.left+h.right)/2,d=f;if((Le.chrome||Le.gecko)&&mr(n,a).getBoundingClientRect().left==h.right&&(d=!f),u<=0)return{node:n,offset:a+(d?1:0)};s=a+(d?1:0),r=u}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function YS(n,e,t,i=-1){var s,r;let o=n.contentDOM.getBoundingClientRect(),a=o.top+n.viewState.paddingTop,l,{docHeight:c}=n.viewState,{x:h,y:u}=e,f=u-a;if(f<0)return 0;if(f>c)return n.state.doc.length;for(let x=n.viewState.heightOracle.textHeight/2,w=!1;l=n.elementAtHeight(f),l.type!=_t.Text;)for(;f=i>0?l.bottom+x:l.top-x,!(f>=0&&f<=c);){if(w)return t?null:0;w=!0,i=-i}u=a+f;let d=l.from;if(dn.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:t?null:L0(n,o,l,h,u);let g=n.dom.ownerDocument,O=n.root.elementFromPoint?n.root:g,m=O.elementFromPoint(h,u);m&&!n.contentDOM.contains(m)&&(m=null),m||(h=Math.max(o.left+1,Math.min(o.right-1,h)),m=O.elementFromPoint(h,u),m&&!n.contentDOM.contains(m)&&(m=null));let p,y=-1;if(m&&((s=n.docView.nearest(m))===null||s===void 0?void 0:s.isEditable)!=!1){if(g.caretPositionFromPoint){let x=g.caretPositionFromPoint(h,u);x&&({offsetNode:p,offset:y}=x)}else if(g.caretRangeFromPoint){let x=g.caretRangeFromPoint(h,u);x&&({startContainer:p,startOffset:y}=x,(!n.contentDOM.contains(p)||Le.safari&&jR(p,y,h)||Le.chrome&&qR(p,y,h))&&(p=void 0))}}if(!p||!n.docView.dom.contains(p)){let x=pn.find(n.docView,d);if(!x)return f>l.top+l.height/2?l.to:l.from;({node:p,offset:y}=ed(x.dom,h,u))}let S=n.docView.nearest(p);if(!S)return null;if(S.isWidget&&((r=S.dom)===null||r===void 0?void 0:r.nodeType)==1){let x=S.dom.getBoundingClientRect();return e.yn.defaultLineHeight*1.5){let a=n.viewState.heightOracle.textHeight,l=Math.floor((s-t.top-(n.defaultLineHeight-a)*.5)/a);r+=l*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+Bf(o,r,n.state.tabSize)}function jR(n,e,t){let i;if(n.nodeType!=3||e!=(i=n.nodeValue.length))return!1;for(let s=n.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return mr(n,i-1,i).getBoundingClientRect().left>t}function qR(n,e,t){if(e!=0)return!1;for(let s=n;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let i=n.nodeType==1?n.getBoundingClientRect():mr(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function td(n,e){let t=n.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==_t.Text))return i}return t}function KR(n,e,t,i){let s=td(n,e.head),r=!i||s.type!=_t.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=n.dom.getBoundingClientRect(),a=n.textDirectionAt(s.from),l=n.posAtCoords({x:t==(a==St.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(l!=null)return re.cursor(l,t?-1:1)}return re.cursor(t?s.to:s.from,t?-1:1)}function D0(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let a=e,l=null;;){let c=FR(s,r,o,a,t),h=GS;if(!c){if(s.number==(t?n.state.doc.lines:1))return a;h=` -`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),c=re.cursor(t?s.from:s.to)}if(l){if(!l(h))return a}else{if(!i)return c;l=i(h)}a=c}}function JR(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==vt.Space&&(s=o),s==o}}function e3(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return re.cursor(s,e.assoc);let o=e.goalColumn,a,l=n.contentDOM.getBoundingClientRect(),c=n.coordsAtPos(s),h=n.documentTop;if(c)o==null&&(o=c.left-l.left),a=r<0?c.top:c.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,n.defaultCharacterWidth*(s-d.from))),a=(r<0?d.top:d.bottom)+h}let u=l.left+o,f=i??n.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let g=a+(f+d)*r,O=YS(n,{x:u,y:g},!1,r);if(gl.bottom||(r<0?Os))return re.cursor(O,e.assoc,void 0,o)}}function gc(n,e,t){for(;;){let i=0;for(let s of n)s.between(e-1,e+1,(r,o,a)=>{if(e>r&&es(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:re.cursor(i,i{this.ignoreDuringComposition(s)||s.type=="keydown"&&this.keydown(e,s)||(this.mustFlushObserver(s)&&e.observer.forceFlush(),this.runCustomHandlers(s.type,e,s)?s.preventDefault():i(e,s))};for(let i in Rt){let s=Rt[i];e.contentDOM.addEventListener(i,r=>{U0(e,r)&&t(s,r)},nd[i]),this.registeredEvents.push(i)}e.scrollDOM.addEventListener("mousedown",i=>{if(i.target==e.scrollDOM&&i.clientY>e.contentDOM.getBoundingClientRect().bottom&&(t(Rt.mousedown,i),!i.defaultPrevented&&i.button==2)){let s=e.contentDOM.style.minHeight;e.contentDOM.style.minHeight="100%",setTimeout(()=>e.contentDOM.style.minHeight=s,200)}}),e.scrollDOM.addEventListener("drop",i=>{i.target==e.scrollDOM&&i.clientY>e.contentDOM.getBoundingClientRect().bottom&&t(Rt.drop,i)}),Le.chrome&&Le.chrome_version==102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,Le.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,t){var i;let s;this.customHandlers=[];for(let r of t)if(s=(i=r.update(e).spec)===null||i===void 0?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:s});for(let o in s)this.registeredEvents.indexOf(o)<0&&o!="scroll"&&(this.registeredEvents.push(o),e.contentDOM.addEventListener(o,a=>{U0(e,a)&&this.runCustomHandlers(o,e,a)&&a.preventDefault()}))}}runCustomHandlers(e,t,i){for(let s of this.customHandlers){let r=s.handlers[e];if(r)try{if(r.call(s.plugin,i,t)||i.defaultPrevented)return!0}catch(o){Wn(t.state,o)}}return!1}runScrollHandlers(e,t){this.lastScrollTop=e.scrollDOM.scrollTop,this.lastScrollLeft=e.scrollDOM.scrollLeft;for(let i of this.customHandlers){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,t,e)}catch(r){Wn(e.state,r)}}}keydown(e,t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()s.keyCode==t.keyCode))&&!t.ctrlKey||n3.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=i||t,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,oo(e.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:Le.safari&&!Le.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const jS=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],n3="dthko",qS=[16,17,18,20,91,92,224,225],Xl=6;function zl(n){return Math.max(0,n)*.7+8}function i3(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class s3{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=wR(e.contentDOM),this.atoms=e.state.facet(Op).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(nt.allowMultipleSelections)&&r3(e,t),this.dragging=a3(e,t)&&t_(t)==1?null:!1}start(e){this.dragging===!1&&(e.preventDefault(),this.select(e))}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&i3(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,s=0,r=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=zS(this.view);e.clientX-o.left<=r.left+Xl?i=-zl(r.left-e.clientX):e.clientX+o.right>=r.right-Xl&&(i=zl(e.clientX-r.right)),e.clientY-o.top<=r.top+Xl?s=-zl(r.top-e.clientY):e.clientY+o.bottom>=r.bottom-Xl&&(s=zl(e.clientY-r.bottom)),this.setScrollSpeed(i,s)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;ithis.select(this.lastEvent),20)}}function r3(n,e){let t=n.state.facet(LS);return t.length?t[0](e):Le.mac?e.metaKey:e.ctrlKey}function o3(n,e){let t=n.state.facet(DS);return t.length?t[0](e):Le.mac?!e.altKey:!e.ctrlKey}function a3(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Bc(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function U0(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=ut.get(t))&&i.ignoreEvent(e))return!1;return!0}const Rt=Object.create(null),nd=Object.create(null),KS=Le.ie&&Le.ie_version<15||Le.ios&&Le.webkit_version<604;function l3(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),JS(n,t.value)},50)}function JS(n,e){let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(id!=null&&t.selection.ranges.every(l=>l.empty)&&id==r.toString()){let l=-1;i=t.changeByRange(c=>{let h=t.doc.lineAt(c.from);if(h.from==l)return{range:c};l=h.from;let u=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:u},range:re.cursor(c.from+u.length)}})}else o?i=t.changeByRange(l=>{let c=r.line(s++);return{changes:{from:l.from,to:l.to,insert:c.text},range:re.cursor(l.from+c.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Rt.keydown=(n,e)=>{n.inputState.setSelectionOrigin("select"),e.keyCode==27&&(n.inputState.lastEscPress=Date.now())};Rt.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};Rt.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};nd.touchstart=nd.touchmove={passive:!0};Rt.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return;let t=null;for(let i of n.state.facet(US))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=u3(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new s3(n,e,t,i)),i&&n.observer.ignore(()=>SS(n.contentDOM)),n.inputState.mouseSelection&&n.inputState.mouseSelection.start(e)}};function I0(n,e,t,i){if(i==1)return re.cursor(e,t);if(i==2)return ZR(n.state,e,t);{let s=pn.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,a=s?s.posAtEnd:r.to;return an>=e.top&&n<=e.bottom,Q0=(n,e,t)=>e_(e,t)&&n>=t.left&&n<=t.right;function c3(n,e,t,i){let s=pn.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Q0(t,i,o))return-1;let a=s.coordsAt(r,1);return a&&Q0(t,i,a)?1:o&&e_(i,o)?-1:1}function N0(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:c3(n,t,e.clientX,e.clientY)}}const h3=Le.ie&&Le.ie_version<=11;let $0=null,F0=0,B0=0;function t_(n){if(!h3)return n.detail;let e=$0,t=B0;return $0=n,B0=Date.now(),F0=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(F0+1)%3:1}function u3(n,e){let t=N0(n,e),i=t_(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,a){let l=N0(n,r),c,h=I0(n,l.pos,l.bias,i);if(t.pos!=l.pos&&!o){let u=I0(n,t.pos,t.bias,i),f=Math.min(u.from,h.from),d=Math.max(u.to,h.to);h=f1&&(c=f3(s,l.pos))?c:a?s.addRange(h):re.create([h])}}}function f3(n,e){for(let t=0;t=e)return re.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Rt.dragstart=(n,e)=>{let{selection:{main:t}}=n.state,{mouseSelection:i}=n.inputState;i&&(i.dragging=t),e.dataTransfer&&(e.dataTransfer.setData("Text",n.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove")};function X0(n,e,t,i){if(!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:r}=n.inputState,o=i&&r&&r.dragging&&o3(n,e)?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:t},l=n.state.changes(o?[o,a]:a);n.focus(),n.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Rt.drop=(n,e)=>{if(!e.dataTransfer)return;if(n.state.readOnly)return e.preventDefault();let t=e.dataTransfer.files;if(t&&t.length){e.preventDefault();let i=Array(t.length),s=0,r=()=>{++s==t.length&&X0(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(i[o]=a.result),r()},a.readAsText(t[o])}}else X0(n,e,e.dataTransfer.getData("Text"),!0)};Rt.paste=(n,e)=>{if(n.state.readOnly)return e.preventDefault();n.observer.flush();let t=KS?null:e.clipboardData;t?(JS(n,t.getData("text/plain")||t.getData("text/uri-text")),e.preventDefault()):l3(n)};function d3(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function p3(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:e.join(n.lineBreak),ranges:t,linewise:i}}let id=null;Rt.copy=Rt.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=p3(n.state);if(!t&&!s)return;id=s?t:null;let r=KS?null:e.clipboardData;r?(e.preventDefault(),r.clearData(),r.setData("text/plain",t)):d3(n,t),e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"})};const n_=ts.define();function i_(n,e){let t=[];for(let i of n.facet(NS)){let s=i(n,e);s&&t.push(s)}return t?n.update({effects:t,annotations:n_.of(!0)}):null}function s_(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=i_(n.state,e);t?n.dispatch(t):n.update([])}},10)}Rt.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),s_(n)};Rt.blur=n=>{n.observer.clearSelectionRange(),s_(n)};Rt.compositionstart=Rt.compositionupdate=n=>{n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0)};Rt.compositionend=n=>{n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,Le.chrome&&Le.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50)};Rt.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Rt.beforeinput=(n,e)=>{var t;let i;if(Le.chrome&&Le.android&&(i=jS.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var r;(((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}};const z0=["pre-wrap","normal","pre-line","break-spaces"];class m3{constructor(e){this.lineWrapping=e,this.doc=ot.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return z0.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,l){this.heightSamples={};for(let c=0;c0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>Oc&&(e.heightChanged=!0),this.height=t)}replace(e,t,i){return xn.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:h,toB:u}=s[a],f=r.lineAt(l,mt.ByPosNoHeight,i.setDoc(t),0,0),d=f.to>=c?f:r.lineAt(c,mt.ByPosNoHeight,i,0,0);for(u+=d.to-c,c=d.to;a>0&&f.from<=s[a-1].toA;)l=s[a-1].fromA,h=s[a-1].fromB,a--,lr*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),i+=1+a.break,s-=a.size}else if(r>s*2){let a=e[i];a.break?e.splice(i,1,a.left,null,a.right):e.splice(i,1,a.left,a.right),i+=2+a.break,r-=a.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(e,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Dn extends r_{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,s){return new yi(s,this.length,i,this.height,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof Dn||s instanceof Yt&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof Yt?s=new Dn(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):xn.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(e,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Yt extends xn{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*r);o=l/r,this.length>r+1&&(a=(this.height-l)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:a}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,s);if(t.lineWrapping){let c=s+Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length),h=t.doc.lineAt(c),u=a+h.length*l,f=Math.max(i,e-u/2);return new yi(h.from,h.length,f,u,0)}else{let c=Math.max(0,Math.min(o-r,Math.floor((e-i)/a))),{from:h,length:u}=t.doc.line(r+c);return new yi(h,u,i+a*c,a,0)}}lineAt(e,t,i,s,r){if(t==mt.ByHeight)return this.blockAt(e,i,s,r);if(t==mt.ByPosNoHeight){let{from:d,to:g}=i.doc.lineAt(e);return new yi(d,g-d,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(i,r),c=i.doc.lineAt(e),h=a+c.length*l,u=c.number-o,f=s+a*u+l*(c.from-r-u);return new yi(c.from,c.length,Math.max(s,Math.min(f,s+this.height-h)),h,0)}forEachLine(e,t,i,s,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(i,r);for(let h=e,u=s;h<=t;){let f=i.doc.lineAt(h);if(h==e){let g=f.number-a;u+=l*g+c*(e-r-g)}let d=l+c*f.length;o(new yi(f.from,f.length,u,d,0)),u+=d,h=f.to+1}}replace(e,t,i){let s=this.length-t;if(s>0){let r=i[i.length-1];r instanceof Yt?i[i.length-1]=new Yt(r.length+s):i.push(null,new Yt(s-1))}if(e>0){let r=i[0];r instanceof Yt?i[0]=new Yt(e+r.length):i.unshift(new Yt(e-1),null)}return xn.of(i)}decomposeLeft(e,t){t.push(new Yt(e-1),null)}decomposeRight(e,t){t.push(null,new Yt(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],a=Math.max(t,s.from),l=-1;for(s.from>t&&o.push(new Yt(s.from-t-1).updateHeight(e,t));a<=r&&s.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let u=s.heights[s.index++];l==-1?l=u:Math.abs(u-l)>=Oc&&(l=-2);let f=new Dn(h,u);f.outdated=!1,o.push(f),a+=h+1}a<=r&&o.push(null,new Yt(r-a).updateHeight(e,a));let c=xn.of(o);return(l<0||Math.abs(c.height-this.height)>=Oc||Math.abs(l-this.heightMetrics(e,t).perLine)>=Oc)&&(e.heightChanged=!0),c}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class O3 extends xn{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return ea))return c;let h=t==mt.ByPosNoHeight?mt.ByPosNoHeight:mt.ByPos;return l?c.join(this.right.lineAt(a,h,i,o,a)):this.left.lineAt(a,h,i,s,r).join(c)}forEachLine(e,t,i,s,r,o){let a=s+this.left.height,l=r+this.left.length+this.break;if(this.break)e=l&&this.right.forEachLine(e,t,i,a,l,o);else{let c=this.lineAt(l,mt.ByPos,i,s,r);e=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,i,a,l,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let a of i)r.push(a);if(e>0&&V0(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?xn.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,a=t+r.length+this.break,l=null;return s&&s.from<=t+r.length&&s.more?l=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(e,a,i,s):o.updateHeight(e,a,i),l?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function V0(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof Yt&&(i=n[e+1])instanceof Yt&&n.splice(e-1,3,new Yt(t.length+1+i.length))}const v3=5;class vp{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Dn?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Dn(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=v3)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Dn(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new Yt(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Dn)return e;let t=new Dn(0,-1);return this.nodes.push(t),t}addBlock(e){var t;this.enterLine();let i=(t=e.deco)===null||t===void 0?void 0:t.type;i==_t.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,i!=_t.WidgetBefore&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Dn)&&!this.isCovered?this.nodes.push(new Dn(0,-1)):(this.writtenToh.clientHeight||h.scrollWidth>h.clientWidth)&&u.overflow!="visible"){let f=h.getBoundingClientRect();r=Math.max(r,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=c==n.parentNode?f.bottom:Math.min(l,f.bottom)}c=u.position=="absolute"||u.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function y3(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Bu{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new m3(t),this.stateDeco=e.facet(Ra).filter(i=>typeof i!="function"),this.heightMap=xn.empty().applyChanges(this.stateDeco,ot.empty,this.heightOracle.setDoc(e.doc),[new Gn(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ie.set(this.lineGaps.map(i=>i.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new Vl(r,o))}}this.viewports=e.sort((i,s)=>i.from-s.from),this.scaler=this.heightMap.height<=7e6?G0:new T3(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:sa(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ra).filter(h=>typeof h!="function");let s=e.changedRanges,r=Gn.extendWithRanges(s,x3(i,this.stateDeco,e?e.changes:It.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),c&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(FS)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?St.RTL:St.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,h=0,u=parseInt(i.paddingTop)||0,f=parseInt(i.paddingBottom)||0;(this.paddingTop!=u||this.paddingBottom!=f)&&(this.paddingTop=u,this.paddingBottom=f,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8),this.scrollTop!=e.scrollDOM.scrollTop&&(this.scrollAnchorHeight=-1,this.scrollTop=e.scrollDOM.scrollTop),this.scrolledToBottom=yS(e.scrollDOM);let d=(this.printing?y3:_3)(t,this.paddingTop),g=d.top-this.pixelViewport.top,O=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let p=a.width;if((this.contentDOMWidth!=p||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let S=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(S)&&(o=!0),o||s.lineWrapping&&Math.abs(p-this.contentDOMWidth)>s.charWidth){let{lineHeight:x,charWidth:w,textHeight:T}=e.docView.measureTextSize();o=x>0&&s.refresh(r,x,w,T,p/w,S),o&&(e.docView.minWidth=0,c|=8)}g>0&&O>0?h=Math.max(g,O):g<0&&O<0&&(h=Math.min(g,O)),s.heightChanged=!1;for(let x of this.viewports){let w=x.from==this.viewport.from?S:e.docView.measureVisibleLineHeights(x);this.heightMap=(o?xn.empty().applyChanges(this.stateDeco,ot.empty,this.heightOracle,[new Gn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new g3(x.from,w))}s.heightChanged&&(c|=2)}let y=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return y&&(this.viewport=this.getViewport(h,this.scrollTarget)),this.updateForViewport(),(c&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Vl(s.lineAt(o-i*1e3,mt.ByHeight,r,0,0).from,s.lineAt(a+(1-i)*1e3,mt.ByHeight,r,0,0).to);if(t){let{head:c}=t.range;if(cl.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=s.lineAt(c,mt.ByPos,r,0,0),f;t.y=="center"?f=(u.top+u.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&c=a+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=St.LTR&&!i)return[];let a=[],l=(c,h,u,f)=>{if(h-cc&&mm.from>=u.from&&m.to<=u.to&&Math.abs(m.from-c)m.fromp));if(!O){if(hm.from<=h&&m.to>=h)){let m=t.moveToLineBoundary(re.cursor(h),!1,!0).head;m>c&&(h=m)}O=new Bu(c,h,this.gapSize(u,c,h,f))}a.push(O)};for(let c of this.viewportLines){if(c.lengthc.from&&l(c.from,f,c,h),dt.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];lt.spans(e,this.viewport.from,this.viewport.to,{span(s,r){t.push({from:s,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=t[r].from||s.to!=t[r].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||sa(this.heightMap.lineAt(e,mt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return sa(this.heightMap.lineAt(this.scaler.fromDOM(e),mt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return sa(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Vl{constructor(e,t){this.from=e,this.to=t}}function w3(n,e,t){let i=[],s=n,r=0;return lt.spans(t,n,e,{span(){},point(o,a){o>s&&(i.push({from:s,to:o}),r+=o-s),s=a}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],a=o-r;if(i<=a)return r+i;i-=a}}function Gl(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function M3(n,e){for(let t of n)if(e(t))return t}const G0={toDOM(n){return n},fromDOM(n){return n},scale:1};class T3{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:a,to:l})=>{let c=t.lineAt(a,mt.ByPos,e,0,0).top,h=t.lineAt(l,mt.ByPos,e,0,0).bottom;return s+=h-c,{from:a,to:l,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let a of this.viewports)a.domTop=o+(a.top-r)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),r=a.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tsa(s,e)):n._content)}const Zl=Ce.define({combine:n=>n.join(" ")}),sd=Ce.define({combine:n=>n.indexOf(!0)>-1}),rd=Ts.newName(),o_=Ts.newName(),a_=Ts.newName(),l_={"&light":"."+o_,"&dark":"."+a_};function od(n,e,t){return new Ts(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const E3=od("."+rd,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},l_);class A3{constructor(e,t,i,s){this.typeOver=s,this.bounds=null,this.text="";let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let a=r||o?[]:C3(e),l=new TS(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=R3(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=r&&r.node==a.focusNode&&r.offset==a.focusOffset||!Vf(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Vf(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset);this.newSel=re.single(c,l)}}}function c_(n,e){let t,{newSel:i}=e,s=n.state.selection.main,r=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=s.from,c=null;(r===8||Le.android&&e.text.length=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,s.to))}:(Le.mac||Le.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=re.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:ot.of([" "])}):Le.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` - `&&n.lineWrapping&&(i&&(i=re.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:ot.of([" "])}),t){let o=n.state;if(Le.ios&&n.inputState.flushIOSKey(n)||Le.android&&(t.from==s.from&&t.to==s.to&&t.insert.length==1&&t.insert.lines==2&&oo(n.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||r==8&&t.insert.lengthh(n,t.from,t.to,a)))return!0;n.inputState.composing>=0&&n.inputState.composing++;let l;if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!i||i.main.empty&&i.main.from==t.from+t.insert.length)&&n.inputState.composing<0){let h=s.fromt.to?o.sliceDoc(t.to,s.to):"";l=o.replaceSelection(n.state.toText(h+t.insert.sliceString(0,void 0,n.state.lineBreak)+u))}else{let h=o.changes(t),u=i&&i.main.to<=h.newLength?i.main:void 0;if(o.selection.ranges.length>1&&n.inputState.composing>=0&&t.to<=s.to&&t.to>=s.to-10){let f=n.state.sliceDoc(t.from,t.to),d=ZS(n)||n.state.doc.lineAt(s.head),g=s.to-t.to,O=s.to-s.from;l=o.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:h,range:u||m.map(h)};let p=m.to-g,y=p-f.length;if(m.to-m.from!=O||n.state.sliceDoc(y,p)!=f||d&&m.to>=d.from&&m.from<=d.to)return{range:m};let S=o.changes({from:y,to:p,insert:t.insert}),x=m.to-s.to;return{changes:S,range:u?re.range(Math.max(0,u.anchor+x),Math.max(0,u.head+x)):m.map(S)}})}else l={changes:h,selection:u&&o.selection.replaceRange(u)}}let c="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,c+=".compose",n.inputState.compositionFirstChange&&(c+=".start",n.inputState.compositionFirstChange=!1)),n.dispatch(l,{scrollIntoView:!0,userEvent:c}),!0}else if(i&&!i.main.eq(s)){let o=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),a=n.inputState.lastSelectionOrigin),n.dispatch({selection:i,scrollIntoView:o,userEvent:a}),!0}else return!1}function P3(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(i=="end"){let l=Math.max(0,r-Math.min(o,a));t-=o+l-r}if(o=o?r-t:0;r-=l,a=r+(a-o),o=r}else if(a=a?r-t:0;r-=l,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}function C3(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new _0(t,i)),(s!=t||r!=i)&&e.push(new _0(s,r))),e}function R3(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?re.single(t+e,i+e):null}const k3={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xu=Le.ie&&Le.ie_version<=11;class L3{constructor(e){this.view=e,this.active=!1,this.selectionRange=new MR,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(Le.ie&&Le.ie_version<=11||Le.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Xu&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)this.view.requestMeasure()),this.resizeContent.observe(e.contentDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runScrollHandlers(this.view,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(Ih)?i.root.activeElement!=this.dom:!mc(i.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Le.ie&&Le.ie_version<=11||Le.android&&Le.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Xc(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Le.safari&&e.root.nodeType==11&&_R(this.dom.ownerDocument)==this.dom&&D3(this.view)||Bc(e.root);if(!t||this.selectionRange.eq(t))return!1;let i=mc(this.dom,t);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&oo(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&mc(this.dom,this.selectionRange);return e<0&&!s?null:(e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new A3(this.view,e,t,i))}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return!1;let i=this.view.state,s=c_(this.view,t);return this.view.state==i&&this.view.update([]),s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=Z0(t,e.previousSibling||e.target.previousSibling,-1),s=Z0(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,i,s;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect(),(s=this.resizeContent)===null||s===void 0||s.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Z0(n,e,t){for(;e;){let i=ut.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function D3(n){let e=null;function t(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}if(n.contentDOM.addEventListener("beforeinput",t,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let i=e.startContainer,s=e.startOffset,r=e.endContainer,o=e.endOffset,a=n.docView.domAtPos(n.state.selection.main.anchor);return Xc(a.node,a.offset,r,o)&&([i,s,r,o]=[r,o,i,s]),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:o}}class Ee{constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=e.dispatch||(t=>this.update([t])),this.dispatch=this.dispatch.bind(this),this._root=e.root||TR(e.parent)||document,this.viewState=new W0(e.state||nt.create(e)),this.plugins=this.state.facet(na).map(t=>new Nu(t));for(let t of this.plugins)t.update(this);this.observer=new L3(this),this.inputState=new t3(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new A0(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...e){let t=e.length==1&&e[0]instanceof $t?e[0]:this.state.update(...e);this._dispatch(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let f of e){if(f.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=f.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(n_))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=i_(r,o),l||(a=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(h=null)):this.observer.clear(),r.facet(nt.phrases)!=this.state.facet(nt.phrases))return this.setState(r);s=Wc.create(this,r,e),s.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(u&&(u=u.map(f.changes)),f.scrollIntoView){let{main:d}=f.state.selection;u=new Vc(d.empty?d:re.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of f.effects)d.is(E0)&&(u=d.value)}this.viewState.update(s,u),this.bidiCache=Gc.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(ia)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Zl)!=s.state.facet(Zl)&&(this.viewState.mustMeasureContent=!0),(t||i||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!s.empty)for(let f of this.state.facet(qf))f(s);(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!c_(this,h)&&c.force&&oo(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new W0(e),this.plugins=e.facet(na).map(i=>new Nu(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView=new A0(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(na),i=e.state.facet(na);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new Nu(r));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,{scrollTop:s}=i,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;s!=this.viewState.scrollTop&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(yS(i))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(d=>{try{return d.read(this)}catch(g){return Wn(this.state,g),H0}}),u=Wc.create(this,this.state,[]),f=!1;u.flags|=l,t?t.flags|=l:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),f=this.docView.update(u));for(let d=0;d1||g<-1){s=i.scrollTop=s+g,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(qf))a(t)}get themeClasses(){return rd+" "+(this.state.facet(sd)?a_:o_)+" "+this.state.facet(Zl)}updateAttrs(){let e=Y0(this,BS,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Ih)?"true":"false",class:"cm-content",style:`${Le.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Y0(this,gp,t);let i=this.observer.ignore(()=>{let s=Yf(this.contentDOM,this.contentAttrs,t),r=Yf(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(Ee.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(ia),Ts.mount(this.root,this.styleModules.concat(E3).reverse())}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Fu(this,e,D0(this,e,t,i))}moveByGroup(e,t){return Fu(this,e,D0(this,e,t,i=>JR(this,e.head,i)))}moveToLineBoundary(e,t,i=!0){return KR(this,e,t,i)}moveVertically(e,t,i){return Fu(this,e,e3(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),YS(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[ao.find(r,e-s.from,-1,t)];return Dh(i,o.dir==St.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet($S)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>U3)return WS(e.length);let t=this.textDirectionAt(e.from);for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t)return s.order;let i=$R(e.text,t);return this.bidiCache.push(new Gc(e.from,e.to,t,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Le.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{SS(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return E0.of(new Vc(typeof e=="number"?re.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return Ut.define(()=>({}),{eventHandlers:e})}static theme(e,t){let i=Ts.newName(),s=[Zl.of(i),ia.of(od(`.${i}`,e))];return t&&t.dark&&s.push(sd.of(!0)),s}static baseTheme(e){return vr.lowest(ia.of(od("."+rd,e,l_)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&ut.get(i)||ut.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}Ee.styleModule=ia;Ee.inputHandler=QS;Ee.focusChangeEffect=NS;Ee.perLineTextDirection=$S;Ee.exceptionSink=IS;Ee.updateListener=qf;Ee.editable=Ih;Ee.mouseSelectionStyle=US;Ee.dragMovesSelection=DS;Ee.clickAddsSelectionRange=LS;Ee.decorations=Ra;Ee.atomicRanges=Op;Ee.scrollMargins=XS;Ee.darkTheme=sd;Ee.contentAttributes=gp;Ee.editorAttributes=BS;Ee.lineWrapping=Ee.contentAttributes.of({class:"cm-lineWrapping"});Ee.announce=Xe.define();const U3=4096,H0={};class Gc{constructor(e,t,i,s){this.from=e,this.to=t,this.dir=i,this.order=s}static update(e,t){if(t.empty)return e;let i=[],s=e.length?e[e.length-1].dir:St.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&Hf(o,t)}return t}const I3=Le.mac?"mac":Le.windows?"win":Le.linux?"linux":"key";function Q3(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,a;for(let l=0;li.concat(s),[]))),t}function $3(n,e,t){return u_(h_(n.state),e,n,t)}let fs=null;const F3=4e3;function B3(n,e=I3){let t=Object.create(null),i=Object.create(null),s=(o,a)=>{let l=i[o];if(l==null)i[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,a,l,c,h)=>{var u,f;let d=t[o]||(t[o]=Object.create(null)),g=a.split(/ (?!$)/).map(p=>Q3(p,e));for(let p=1;p{let x=fs={view:S,prefix:y,scope:o};return setTimeout(()=>{fs==x&&(fs=null)},F3),!0}]})}let O=g.join(" ");s(O,!1);let m=d[O]||(d[O]={preventDefault:!1,stopPropagation:!1,run:((f=(u=d._any)===null||u===void 0?void 0:u.run)===null||f===void 0?void 0:f.slice())||[]});l&&m.run.push(l),c&&(m.preventDefault=!0),h&&(m.stopPropagation=!0)};for(let o of n){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let h=t[c]||(t[c]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let u in h)h[u].run.push(o.any)}let l=o[e]||o.key;if(l)for(let c of a)r(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}function u_(n,e,t,i){let s=SR(e),r=jt(s,0),o=Xn(r)==s.length&&s!=" ",a="",l=!1,c=!1,h=!1;fs&&fs.view==t&&fs.scope==i&&(a=fs.prefix+" ",qS.indexOf(e.keyCode)<0&&(c=!0,fs=null));let u=new Set,f=m=>{if(m){for(let p of m.run)if(!u.has(p)&&(u.add(p),p(t,e)))return m.stopPropagation&&(h=!0),!0;m.preventDefault&&(m.stopPropagation&&(h=!0),c=!0)}return!1},d=n[i],g,O;return d&&(f(d[a+Hl(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Le.windows&&e.ctrlKey&&e.altKey)&&(g=Es[e.keyCode])&&g!=s?(f(d[a+Hl(g,e,!0)])||e.shiftKey&&(O=Ca[e.keyCode])!=s&&O!=g&&f(d[a+Hl(O,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(d[a+Hl(s,e,!0)])&&(l=!0),!l&&f(d._any)&&(l=!0)),c&&(l=!0),l&&h&&e.stopPropagation(),l}class el{constructor(e,t,i,s,r){this.className=e,this.left=t,this.top=i,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=f_(e);return[new el(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return X3(e,t,i)}}function f_(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==St.LTR?e.left:e.right-n.scrollDOM.clientWidth)-n.scrollDOM.scrollLeft,top:e.top-n.scrollDOM.scrollTop}}function q0(n,e,t){let i=re.cursor(e);return{from:Math.max(t.from,n.moveToLineBoundary(i,!1,!0).from),to:Math.min(t.to,n.moveToLineBoundary(i,!0,!0).from),type:_t.Text}}function X3(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to),r=n.textDirection==St.LTR,o=n.contentDOM,a=o.getBoundingClientRect(),l=f_(n),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),f=a.right-(h?parseInt(h.paddingRight):0),d=td(n,i),g=td(n,s),O=d.type==_t.Text?d:null,m=g.type==_t.Text?g:null;if(O&&(n.lineWrapping||d.widgetLineBreaks)&&(O=q0(n,i,O)),m&&(n.lineWrapping||g.widgetLineBreaks)&&(m=q0(n,s,m)),O&&m&&O.from==m.from)return y(S(t.from,t.to,O));{let w=O?S(t.from,null,O):x(d,!1),T=m?S(null,t.to,m):x(g,!0),C=[];return(O||d).to<(m||g).from-(O&&m?1:0)||d.widgetLineBreaks>1&&w.bottom+n.defaultLineHeight/2ae&&W.from=K)break;J>G&&j(Math.max(se,G),w==null&&se<=ae,Math.min(J,K),T==null&&J>=Q,z.dir)}if(G=X.to+1,G>=K)break}return E.length==0&&j(ae,w==null,Q,T==null,n.textDirection),{top:k,bottom:b,horizontal:E}}function x(w,T){let C=a.top+(T?w.top:w.bottom);return{top:C,bottom:C,horizontal:[]}}}function z3(n,e){return n.constructor==e.constructor&&n.eq(e)}class V3{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(vc)!=e.state.facet(vc)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&e.view.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(vc);for(;t!z3(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const vc=Ce.define();function d_(n){return[Ut.define(e=>new V3(e,n)),vc.of(n)]}const p_=!Le.ios,ka=Ce.define({combine(n){return Li(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function W3(n={}){return[ka.of(n),G3,Z3,H3,FS.of(!0)]}function m_(n){return n.startState.facet(ka)!=n.state.facet(ka)}const G3=d_({above:!0,markers(n){let{state:e}=n,t=e.facet(ka),i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||p_:t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:re.cursor(s.head,s.head>s.anchor?-1:1);for(let l of el.forRange(n,o,a))i.push(l)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=m_(n);return t&&K0(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){K0(e.state,n)},class:"cm-cursorLayer"});function K0(n,e){e.style.animationDuration=n.facet(ka).cursorBlinkRate+"ms"}const Z3=d_({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:el.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||m_(n)},class:"cm-selectionLayer"}),g_={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};p_&&(g_[".cm-line"].caretColor="transparent !important");const H3=vr.highest(Ee.theme(g_)),O_=Xe.define({map(n,e){return n==null?null:e.mapPos(n)}}),ra=Ht.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(O_)?i.value:t,n)}}),Y3=Ut.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(ra);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(ra)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let n=this.view.state.field(ra),e=n!=null&&this.view.coordsAtPos(n);if(!e)return null;let t=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-t.left+this.view.scrollDOM.scrollLeft,top:e.top-t.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(ra)!=n&&this.view.dispatch({effects:O_.of(n)})}},{eventHandlers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function j3(){return[ra,Y3]}function J0(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,a;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;a=e.exec(r.value);)s(o+a.index,a)}function q3(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class K3{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(a,l,c,h)=>s(h,c,c+a[0].length,a,l);else if(typeof i=="function")this.addMatch=(a,l,c,h)=>{let u=i(a,l,c);u&&h(c,c+a[0].length,u)};else if(i)this.addMatch=(a,l,c,h)=>h(c,c+a[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new Ms,i=t.add.bind(t);for(let{from:s,to:r}of q3(e,this.maxLength))J0(e.state.doc,this.regexp,s,r,(o,a)=>this.addMatch(a,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,a,l)=>{l>e.view.viewport.from&&a1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),a=Math.min(r.to,s);if(a>o){let l=e.state.doc.lineAt(o),c=l.tol.from;o--)if(this.boundary.test(l.text[o-1-l.from])){h=o;break}for(;af.push(p.range(O,m));if(l==c)for(this.regexp.lastIndex=h-l.from;(d=this.regexp.exec(l.text))&&d.indexthis.addMatch(m,e,O,g));t=t.update({filterFrom:h,filterTo:u,filter:(O,m)=>Ou,add:f})}}return t}}const ad=/x/.unicode!=null?"gu":"g",J3=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,ad),ek={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let zu=null;function tk(){var n;if(zu==null&&typeof document<"u"&&document.body){let e=document.body.style;zu=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return zu||!1}const xc=Ce.define({combine(n){let e=Li(n,{render:null,specialChars:J3,addSpecialChars:null});return(e.replaceTabs=!tk())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,ad)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,ad)),e}});function nk(n={}){return[xc.of(n),ik()]}let eO=null;function ik(){return eO||(eO=Ut.fromClass(class{constructor(n){this.view=n,this.decorations=Ie.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(xc)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new K3({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=jt(e[0],0);if(r==9){let o=s.lineAt(i),a=t.state.tabSize,l=ja(o.text,a,i-o.from);return Ie.replace({widget:new ak((a-l%a)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=Ie.replace({widget:new ok(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(xc);n.startState.facet(xc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const sk="•";function rk(n){return n>=32?sk:n==10?"␤":String.fromCharCode(9216+n)}class ok extends ns{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=rk(this.code),i=e.state.phrase("Control character")+" "+(ek[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class ak extends ns{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function lk(){return hk}const ck=Ie.line({class:"cm-activeLine"}),hk=Ut.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(ck.range(s.from)),e=s.from)}return Ie.set(t)}},{decorations:n=>n.decorations});class uk extends ns{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let t=e.firstChild?yo(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),s=Dh(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function fk(n){return Ut.fromClass(class{constructor(e){this.view=e,this.placeholder=n?Ie.set([Ie.widget({widget:new uk(n),side:1}).range(0)]):Ie.none}get decorations(){return this.view.state.doc.length?Ie.none:this.placeholder}},{decorations:e=>e.decorations})}const ld=2e3;function dk(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>ld||t.off>ld||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=i;l<=s;l++){let c=n.doc.line(l);c.length<=a&&r.push(re.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=i;l<=s;l++){let c=n.doc.line(l),h=Bf(c.text,o,n.tabSize,!0);if(h<0)r.push(re.cursor(c.to));else{let u=Bf(c.text,a,n.tabSize);r.push(re.range(c.from+h,c.from+u))}}}return r}function pk(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function tO(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>ld?-1:s==i.length?pk(n,e.clientX):ja(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function mk(n,e){let t=tO(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let a=tO(n,s);if(!a)return i;let l=dk(n.state,t,a);return l.length?o?re.create(l.concat(i.ranges)):re.create(l):i}}:null}function gk(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return Ee.mouseSelectionStyle.of((t,i)=>e(i)?mk(t,i):null)}const Ok={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},vk={style:"cursor: crosshair"};function xk(n={}){let[e,t]=Ok[n.key||"Alt"],i=Ut.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventHandlers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,Ee.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?vk:null})]}const Yl="-10000px";class v_{constructor(e,t,i){this.facet=t,this.createTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(s=>s),this.tooltipViews=this.tooltips.map(i)}update(e){var t;let i=e.state.facet(this.facet),s=i.filter(o=>o);if(i===this.input){for(let o of this.tooltipViews)o.update&&o.update(e);return!1}let r=[];for(let o=0;o{var e,t,i;return{position:Le.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Sk}}}),nO=new WeakMap,x_=Ut.fromClass(class{constructor(n){this.view=n,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(Vu);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new v_(n,xp,t=>this.createTooltip(t)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(Vu);if(i.position!=this.position){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n){let e=n.create(this.view);if(e.dom.classList.add("cm-tooltip"),n.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Yl,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var n,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(n=t.destroy)===null||n===void 0||n.call(t);(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=this.view.dom.getBoundingClientRect();return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map((e,t)=>{let i=this.manager.tooltipViews[t];return i.getCoords?i.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Vu).tooltipSpace(this.view)}}writeMeasure(n){var e;let{editor:t,space:i}=n,s=[];for(let r=0;r=Math.min(t.bottom,i.bottom)||c.rightMath.min(t.right,i.right)+.1){l.style.top=Yl;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,f=u?7:0,d=h.right-h.left,g=(e=nO.get(a))!==null&&e!==void 0?e:h.bottom-h.top,O=a.offset||yk,m=this.view.textDirection==St.LTR,p=h.width>i.right-i.left?m?i.left:i.right-h.width:m?Math.min(c.left-(u?14:0)+O.x,i.right-d):Math.max(i.left,c.left-d+(u?14:0)-O.x),y=!!o.above;!o.strictSide&&(y?c.top-(h.bottom-h.top)-O.yi.bottom)&&y==i.bottom-c.bottom>c.top-i.top&&(y=!y);let S=(y?c.top-i.top:i.bottom-c.bottom)-f;if(Sp&&T.topx&&(x=y?T.top-g-2-f:T.bottom+f+2);this.position=="absolute"?(l.style.top=x-n.parent.top+"px",l.style.left=p-n.parent.left+"px"):(l.style.top=x+"px",l.style.left=p+"px"),u&&(u.style.left=`${c.left+(m?O.x:-O.x)-(p+14-7)}px`),a.overlap!==!0&&s.push({left:p,top:x,right:w,bottom:x+g}),l.classList.toggle("cm-tooltip-above",y),l.classList.toggle("cm-tooltip-below",!y),a.positioned&&a.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Yl}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),_k=Ee.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),yk={x:0,y:0},xp=Ce.define({enables:[x_,_k]}),Zc=Ce.define();class Sp{constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new v_(e,Zc,t=>this.createHostedView(t))}static create(e){return new Sp(e)}createHostedView(e){let t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}}const bk=xp.compute([Zc],n=>{let e=n.facet(Zc).filter(t=>t);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.filter(t=>t.end!=null).map(t=>t.end)),create:Sp.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class wk{constructor(e,t,i,s,r){this.view=e,this.source=t,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let e=Date.now()-this.lastMove.time;ei.bottom||e.xi.right+this.view.defaultCharacterWidth)return;let s=this.view.bidiSpans(this.view.state.doc.lineAt(t)).find(a=>a.from<=t&&a.to>=t),r=s&&s.dir==St.RTL?-1:1,o=this.source(this.view,t,e.x{this.pending==a&&(this.pending=null,l&&this.view.dispatch({effects:this.setHover.of(l)}))},l=>Wn(this.view.state,l,"hover tooltip"))}else o&&this.view.dispatch({effects:this.setHover.of(o)})}mousemove(e){var t;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let i=this.active;if(i&&!iO(this.lastMove.target)||this.pending){let{pos:s}=i||this.pending,r=(t=i==null?void 0:i.end)!==null&&t!==void 0?t:s;(s==r?this.view.posAtCoords(this.lastMove)!=s:!Mk(this.view,s,r,e.clientX,e.clientY,6))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!iO(e.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function iO(n){for(let e=n;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains("cm-tooltip"))return!0;return!1}function Mk(n,e,t,i,s,r){let o=document.createRange(),a=n.domAtPos(e),l=n.domAtPos(t);o.setEnd(l.node,l.offset),o.setStart(a.node,a.offset);let c=o.getClientRects();o.detach();for(let h=0;hZc.from(s)});return[i,Ut.define(s=>new wk(s,n,i,t,e.hoverTime||300)),bk]}function S_(n,e){let t=n.plugin(x_);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Ek=Xe.define(),sO=Ce.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function La(n,e){let t=n.plugin(__),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const __=Ut.fromClass(class{constructor(n){this.input=n.state.facet(Da),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(sO);this.top=new jl(n,!0,e.topContainer),this.bottom=new jl(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(sO);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new jl(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new jl(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Da);if(t!=this.input){let i=t.filter(l=>l),s=[],r=[],o=[],a=[];for(let l of i){let c=this.specs.indexOf(l),h;c<0?(h=l(n.view),a.push(h)):(h=this.panels[c],h.update&&h.update(n)),s.push(h),(h.top?r:o).push(h)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>Ee.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class jl{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=rO(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=rO(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function rO(n){let e=n.nextSibling;return n.remove(),e}const Da=Ce.define({enables:__});class Ki extends pr{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ki.prototype.elementClass="";Ki.prototype.toDOM=void 0;Ki.prototype.mapMode=Kt.TrackBefore;Ki.prototype.startSide=Ki.prototype.endSide=-1;Ki.prototype.point=!0;const Sc=Ce.define(),Ak={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>lt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},ma=Ce.define();function Pk(n){return[y_(),ma.of(Object.assign(Object.assign({},Ak),n))]}const cd=Ce.define({combine:n=>n.some(e=>e)});function y_(n){let e=[Ck];return n&&n.fixed===!1&&e.push(cd.of(!0)),e}const Ck=Ut.fromClass(class{constructor(n){this.view=n,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=n.state.facet(ma).map(e=>new aO(n,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!n.state.facet(cd),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}n.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(cd)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&this.dom.remove();let t=lt.iter(this.view.state.facet(Sc),this.view.viewport.from),i=[],s=this.gutters.map(r=>new Rk(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let a of r.type)if(a.type==_t.Text&&o){hd(t,i,a.from);for(let l of s)l.line(this.view,a,i);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(r.type==_t.Text){hd(t,i,r.from);for(let o of s)o.line(this.view,r,i)}for(let r of s)r.finish();n&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(n){let e=n.startState.facet(ma),t=n.state.facet(ma),i=n.docChanged||n.heightChanged||n.viewportChanged||!lt.eq(n.startState.facet(Sc),n.state.facet(Sc),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new aO(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove()}},{provide:n=>Ee.scrollMargins.of(e=>{let t=e.plugin(n);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==St.LTR?{left:t.dom.offsetWidth}:{right:t.dom.offsetWidth}})});function oO(n){return Array.isArray(n)?n:[n]}function hd(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class Rk{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=lt.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=t.top-this.height;if(this.i==s.elements.length){let o=new b_(e,t.height,r,i);s.elements.push(o),s.dom.appendChild(o.dom)}else s.elements[this.i].update(e,t.height,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];hd(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t);i&&this.addElement(e,t,[i])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class aO{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let l=r.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,a,s)&&s.preventDefault()});this.markers=oO(t.markers(e)),t.initialSpacer&&(this.spacer=new b_(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=oO(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!lt.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class b_{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.dom.style.height=(this.height=t)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),kk(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let a=o,l=rr(a,l,c)||o(a,l,c):o}return i}})}});class Wu extends Ki{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Gu(n,e){return n.state.facet(Hr).formatNumber(e,n.state)}const Dk=ma.compute([Hr],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Lk)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new Wu(Gu(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(Hr)!=e.state.facet(Hr),initialSpacer(e){return new Wu(Gu(e,lO(e.state.doc.lines)))},updateSpacer(e,t){let i=Gu(t.view,lO(t.view.state.doc.lines));return i==e.number?e:new Wu(i)},domEventHandlers:n.facet(Hr).domEventHandlers}));function Uk(n={}){return[Hr.of(n),y_(),Dk]}function lO(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(Ik.range(s)))}return lt.of(e)});function Nk(){return Qk}const w_=1024;let $k=0;class Zu{constructor(e,t){this.from=e,this.to=t}}class Ke{constructor(e={}){this.id=$k++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Tn.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}Ke.closedBy=new Ke({deserialize:n=>n.split(" ")});Ke.openedBy=new Ke({deserialize:n=>n.split(" ")});Ke.group=new Ke({deserialize:n=>n.split(" ")});Ke.contextHash=new Ke({perNode:!0});Ke.lookAhead=new Ke({perNode:!0});Ke.mounted=new Ke({perNode:!0});const Fk=Object.create(null);class Tn{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Fk,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Tn(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Ke.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(Ke.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}Tn.none=new Tn("",Object.create(null),0,8);class _p{constructor(e){this.types=e;for(let t=0;t0;for(let l=this.cursor(o|Qt.IncludeAnonymous);;){let c=!1;if(l.from<=r&&l.to>=s&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&i&&(a||!l.type.isAnonymous)&&i(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:wp(Tn.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new kt(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new kt(Tn.none,t,i,s)))}static build(e){return Xk(e)}}kt.empty=new kt(Tn.none,[],[],0);class yp{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new yp(this.buffer,this.index)}}class xr{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Tn.none}toString(){let e=[];for(let t=0;t0));l=o[l+3]);return a}slice(e,t,i){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let a=e,l=0;a=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function T_(n,e){let t=n.childBefore(e);for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}function wo(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?a.length:-1;e!=c;e+=t){let h=a[e],u=l[e]+o.from;if(M_(s,i,u,u+h.length)){if(h instanceof xr){if(r&Qt.ExcludeBuffers)continue;let f=h.findChild(0,h.buffer.length,t,i-u,s);if(f>-1)return new Mi(new Bk(o,h,e,u),null,f)}else if(r&Qt.IncludeAnonymous||!h.type.isAnonymous||bp(h)){let f;if(!(r&Qt.IgnoreMounts)&&h.props&&(f=h.prop(Ke.mounted))&&!f.overlay)return new ci(f.tree,u,e,o);let d=new ci(h,u,e,o);return r&Qt.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?h.children.length-1:0,t,i,s)}}}if(r&Qt.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let s;if(!(i&Qt.IgnoreOverlays)&&(s=this._tree.prop(Ke.mounted))&&s.overlay){let r=e-this.from;for(let{from:o,to:a}of s.overlay)if((t>0?o<=r:o=r:a>r))return new ci(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new jc(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return wo(this,e,t,!1)}resolveInner(e,t=0){return wo(this,e,t,!0)}enterUnfinishedNodesBefore(e){return T_(this,e)}getChild(e,t=null,i=null){let s=Hc(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Hc(this,e,t,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return Yc(this,e)}}function Hc(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(;!s.type.is(t);)if(!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function Yc(n,e,t=e.length-1){for(let i=n.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Bk{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class Mi{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new Mi(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&Qt.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Mi(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Mi(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Mi(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new jc(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o)),t.push(0)}return new kt(this.type,e,t,this.to-this.from)}resolve(e,t=0){return wo(this,e,t,!1)}resolveInner(e,t=0){return wo(this,e,t,!0)}enterUnfinishedNodesBefore(e){return T_(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,i=null){let s=Hc(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Hc(this,e,t,i)}get node(){return this}matchContext(e){return Yc(this,e)}}class jc{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof ci)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof ci?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&Qt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Qt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Qt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let a=i._tree.children[r];if(this.mode&Qt.IncludeAnonymous||a instanceof xr||!a.type.isAnonymous||bp(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}for(let s=i;s=0;r--){if(r<0)return Yc(this.node,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function bp(n){return n.children.some(e=>e instanceof xr||!e.type.isAnonymous||bp(e))}function Xk(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=w_,reused:r=[],minRepeatType:o=i.types.length}=n,a=Array.isArray(t)?new yp(t,t.length):t,l=i.types,c=0,h=0;function u(x,w,T,C,k){let{id:b,start:E,end:j,size:ae}=a,Q=h;for(;ae<0;)if(a.next(),ae==-1){let z=r[b];T.push(z),C.push(E-x);return}else if(ae==-3){c=b;return}else if(ae==-4){h=b;return}else throw new RangeError(`Unrecognized record size: ${ae}`);let W=l[b],G,K,X=E-x;if(j-E<=s&&(K=O(a.pos-w,k))){let z=new Uint16Array(K.size-K.skip),se=a.pos-K.size,J=z.length;for(;a.pos>se;)J=m(K.start,z,J);G=new xr(z,j-K.start,i),X=K.start-x}else{let z=a.pos-ae;a.next();let se=[],J=[],be=b>=o?b:-1,N=0,de=j;for(;a.pos>z;)be>=0&&a.id==be&&a.size>=0?(a.end<=de-s&&(d(se,J,E,N,a.end,de,be,Q),N=se.length,de=a.end),a.next()):u(E,z,se,J,be);if(be>=0&&N>0&&N-1&&N>0){let pe=f(W);G=wp(W,se,J,0,se.length,0,j-E,pe,pe)}else G=g(W,se,J,j-E,Q-j)}T.push(G),C.push(X)}function f(x){return(w,T,C)=>{let k=0,b=w.length-1,E,j;if(b>=0&&(E=w[b])instanceof kt){if(!b&&E.type==x&&E.length==C)return E;(j=E.prop(Ke.lookAhead))&&(k=T[b]+E.length+j)}return g(x,w,T,C,k)}}function d(x,w,T,C,k,b,E,j){let ae=[],Q=[];for(;x.length>C;)ae.push(x.pop()),Q.push(w.pop()+T-k);x.push(g(i.types[E],ae,Q,b-k,j-b)),w.push(k-T)}function g(x,w,T,C,k=0,b){if(c){let E=[Ke.contextHash,c];b=b?[E].concat(b):[E]}if(k>25){let E=[Ke.lookAhead,k];b=b?[E].concat(b):[E]}return new kt(x,w,T,C,b)}function O(x,w){let T=a.fork(),C=0,k=0,b=0,E=T.end-s,j={size:0,start:0,skip:0};e:for(let ae=T.pos-x;T.pos>ae;){let Q=T.size;if(T.id==w&&Q>=0){j.size=C,j.start=k,j.skip=b,b+=4,C+=4,T.next();continue}let W=T.pos-Q;if(Q<0||W=o?4:0,K=T.start;for(T.next();T.pos>W;){if(T.size<0)if(T.size==-3)G+=4;else break e;else T.id>=o&&(G+=4);T.next()}k=K,C+=Q,b+=G}return(w<0||C==x)&&(j.size=C,j.start=k,j.skip=b),j.size>4?j:void 0}function m(x,w,T){let{id:C,start:k,end:b,size:E}=a;if(a.next(),E>=0&&C4){let ae=a.pos-(E-4);for(;a.pos>ae;)T=m(x,w,T)}w[--T]=j,w[--T]=b-x,w[--T]=k-x,w[--T]=C}else E==-3?c=C:E==-4&&(h=C);return T}let p=[],y=[];for(;a.pos>0;)u(n.start||0,n.bufferStart||0,p,y,-1);let S=(e=n.length)!==null&&e!==void 0?e:p.length?y[0]+p[0].length:0;return new kt(l[n.topID],p.reverse(),y.reverse(),S)}const hO=new WeakMap;function _c(n,e){if(!n.isAnonymous||e instanceof xr||e.type!=n)return 1;let t=hO.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof kt)){t=1;break}t+=_c(n,i)}hO.set(e,t)}return t}function wp(n,e,t,i,s,r,o,a,l){let c=0;for(let g=i;g=h)break;T+=C}if(S==x+1){if(T>h){let C=g[x];d(C.children,C.positions,0,C.children.length,O[x]+y);continue}u.push(g[x])}else{let C=O[S-1]+g[S-1].length-w;u.push(wp(n,g,O,x,S,w,C,null,l))}f.push(w+y-r)}}return d(e,t,i,s,0),(a||l)(u,f,o)}class zk{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Mi?this.setBuffer(e.context.buffer,e.index,t):e instanceof ci&&this.map.set(e.tree,t)}get(e){return e instanceof Mi?this.getBuffer(e.context.buffer,e.index):e instanceof ci?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class cr{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new cr(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let h=a=i)for(;o&&o.from=f.from||u<=f.to||c){let d=Math.max(f.from,l)-c,g=Math.min(f.to,u)-c;f=d>=g?null:new cr(d,g,f.tree,f.offset+c,a>0,!!h)}if(f&&s.push(f),o.to>u)break;o=rnew Zu(s.from,s.to)):[new Zu(0,0)]:[new Zu(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class Vk{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new Ke({perNode:!0});let Wk=0;class xi{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=Wk++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new xi([],null,[]);if(t.set.push(t),e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new qc;return t=>t.modified.indexOf(e)>-1?t:qc.get(t.base||t,t.modified.concat(e).sort((i,s)=>i.id-s.id))}}let Gk=0;class qc{constructor(){this.instances=[],this.id=Gk++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(a=>a.base==e&&Zk(t,a.modified));if(i)return i;let s=[],r=new xi(s,e,t);for(let a of t)a.instances.push(r);let o=Hk(t);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(qc.get(a,l));return r}}function Zk(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function Hk(n){let e=[[]];for(let t=0;ti.length-t.length)}function A_(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,a=s;for(let u=0;;){if(a=="..."&&u>0&&u+3==s.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+s);if(r.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),u+=f[0].length,u==s.length)break;let d=s[u++];if(u==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);a=s.slice(u)}let l=r.length-1,c=r[l];if(!c)throw new RangeError("Invalid path: "+s);let h=new Kc(i,o,l>0?r.slice(0,l):null);e[c]=h.sort(e[c])}}return P_.add(e)}const P_=new Ke;class Kc{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let a of r)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:i}}function Yk(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function jk(n,e,t,i=0,s=n.length){let r=new qk(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class qk{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:a,to:l}=e;if(a>=i||l<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let c=s,h=Kk(e)||Kc.empty,u=Yk(r,h.tags);if(u&&(c&&(c+=" "),c+=u,h.mode==1&&(s+=(s?" ":"")+u)),this.startSpan(Math.max(t,a),c),h.opaque)return;let f=e.tree&&e.tree.prop(Ke.mounted);if(f&&f.overlay){let d=e.node.enter(f.overlay[0].from+a,1),g=this.highlighters.filter(m=>!m.scope||m.scope(f.tree.type)),O=e.firstChild();for(let m=0,p=a;;m++){let y=m=S||!e.nextSibling())););if(!y||S>i)break;p=y.to+a,p>t&&(this.highlightRange(d.cursor(),Math.max(t,y.from+a),Math.min(i,p),"",g),this.startSpan(Math.min(i,p),c))}O&&e.parent()}else if(e.firstChild()){f&&(s="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),c)}while(e.nextSibling());e.parent()}}}function Kk(n){let e=n.type.prop(P_);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const ge=xi.define,Kl=ge(),cs=ge(),uO=ge(cs),fO=ge(cs),hs=ge(),Jl=ge(hs),Hu=ge(hs),gi=ge(),Xs=ge(gi),pi=ge(),mi=ge(),ud=ge(),Go=ge(ud),ec=ge(),D={comment:Kl,lineComment:ge(Kl),blockComment:ge(Kl),docComment:ge(Kl),name:cs,variableName:ge(cs),typeName:uO,tagName:ge(uO),propertyName:fO,attributeName:ge(fO),className:ge(cs),labelName:ge(cs),namespace:ge(cs),macroName:ge(cs),literal:hs,string:Jl,docString:ge(Jl),character:ge(Jl),attributeValue:ge(Jl),number:Hu,integer:ge(Hu),float:ge(Hu),bool:ge(hs),regexp:ge(hs),escape:ge(hs),color:ge(hs),url:ge(hs),keyword:pi,self:ge(pi),null:ge(pi),atom:ge(pi),unit:ge(pi),modifier:ge(pi),operatorKeyword:ge(pi),controlKeyword:ge(pi),definitionKeyword:ge(pi),moduleKeyword:ge(pi),operator:mi,derefOperator:ge(mi),arithmeticOperator:ge(mi),logicOperator:ge(mi),bitwiseOperator:ge(mi),compareOperator:ge(mi),updateOperator:ge(mi),definitionOperator:ge(mi),typeOperator:ge(mi),controlOperator:ge(mi),punctuation:ud,separator:ge(ud),bracket:Go,angleBracket:ge(Go),squareBracket:ge(Go),paren:ge(Go),brace:ge(Go),content:gi,heading:Xs,heading1:ge(Xs),heading2:ge(Xs),heading3:ge(Xs),heading4:ge(Xs),heading5:ge(Xs),heading6:ge(Xs),contentSeparator:ge(gi),list:ge(gi),quote:ge(gi),emphasis:ge(gi),strong:ge(gi),link:ge(gi),monospace:ge(gi),strikethrough:ge(gi),inserted:ge(),deleted:ge(),changed:ge(),invalid:ge(),meta:ec,documentMeta:ge(ec),annotation:ge(ec),processingInstruction:ge(ec),definition:xi.defineModifier(),constant:xi.defineModifier(),function:xi.defineModifier(),standard:xi.defineModifier(),local:xi.defineModifier(),special:xi.defineModifier()};C_([{tag:D.link,class:"tok-link"},{tag:D.heading,class:"tok-heading"},{tag:D.emphasis,class:"tok-emphasis"},{tag:D.strong,class:"tok-strong"},{tag:D.keyword,class:"tok-keyword"},{tag:D.atom,class:"tok-atom"},{tag:D.bool,class:"tok-bool"},{tag:D.url,class:"tok-url"},{tag:D.labelName,class:"tok-labelName"},{tag:D.inserted,class:"tok-inserted"},{tag:D.deleted,class:"tok-deleted"},{tag:D.literal,class:"tok-literal"},{tag:D.string,class:"tok-string"},{tag:D.number,class:"tok-number"},{tag:[D.regexp,D.escape,D.special(D.string)],class:"tok-string2"},{tag:D.variableName,class:"tok-variableName"},{tag:D.local(D.variableName),class:"tok-variableName tok-local"},{tag:D.definition(D.variableName),class:"tok-variableName tok-definition"},{tag:D.special(D.variableName),class:"tok-variableName2"},{tag:D.definition(D.propertyName),class:"tok-propertyName tok-definition"},{tag:D.typeName,class:"tok-typeName"},{tag:D.namespace,class:"tok-namespace"},{tag:D.className,class:"tok-className"},{tag:D.macroName,class:"tok-macroName"},{tag:D.propertyName,class:"tok-propertyName"},{tag:D.operator,class:"tok-operator"},{tag:D.comment,class:"tok-comment"},{tag:D.meta,class:"tok-meta"},{tag:D.invalid,class:"tok-invalid"},{tag:D.punctuation,class:"tok-punctuation"}]);var Yu;const Yr=new Ke;function R_(n){return Ce.define({combine:n?e=>e.concat(n):void 0})}const Mp=new Ke;class oi{constructor(e,t,i=[],s=""){this.data=e,this.name=s,nt.prototype.hasOwnProperty("tree")||Object.defineProperty(nt.prototype,"tree",{get(){return Xt(this)}}),this.parser=t,this.extension=[Cs.of(this),nt.languageData.of((r,o,a)=>{let l=dO(r,o,a),c=l.type.prop(Yr);if(!c)return[];let h=r.facet(c),u=l.type.prop(Mp);if(u){let f=l.resolve(o-l.from,a);for(let d of u)if(d.test(f,r)){let g=r.facet(d.facet);return d.type=="replace"?g:g.concat(h)}}return h})].concat(i)}isActiveAt(e,t,i=-1){return dO(e,t,i).type.prop(Yr)==this.data}findRegions(e){let t=e.facet(Cs);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(Yr)==this.data){i.push({from:o,to:o+r.length});return}let a=r.prop(Ke.mounted);if(a){if(a.tree.prop(Yr)==this.data){if(a.overlay)for(let l of a.overlay)i.push({from:l.from+o,to:l.to+o});else i.push({from:o,to:o+r.length});return}else if(a.overlay){let l=i.length;if(s(a.tree,a.overlay[0].from+o),i.length>l)return}}for(let l=0;li.isTop?t:void 0)]}),e.name)}configure(e,t){return new Jc(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xt(n){let e=n.field(oi.state,!1);return e?e.tree:kt.empty}class Jk{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Zo=null;class eh{constructor(e,t,i=[],s,r,o,a,l){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new eh(e,t,[],kt.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Jk(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=kt.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(cr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Zo;Zo=this;try{return e()}finally{Zo=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=pO(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,h,u,f)=>l.push({fromA:c,toA:h,fromB:u,toB:f})),i=cr.applyChanges(i,l),s=kt.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),u=e.mapPos(c.to,-1);he.from&&(this.fragments=pO(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends E_{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let l=Zo;if(l){for(let c of s)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new kt(Tn.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Zo}}function pO(n,e,t){return cr.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Mo{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Mo(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=eh.create(e.facet(Cs).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Mo(i)}}oi.state=Ht.define({create:Mo.init,update(n,e){for(let t of e.effects)if(t.is(oi.setState))return t.value;return e.startState.facet(Cs)!=e.state.facet(Cs)?Mo.init(e.state):n.apply(e)}});let k_=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(k_=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const ju=typeof navigator<"u"&&(!((Yu=navigator.scheduling)===null||Yu===void 0)&&Yu.isInputPending)?()=>navigator.scheduling.isInputPending():null,eL=Ut.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(oi.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(oi.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=k_(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,l=r.context.work(()=>ju&&ju()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:oi.setState.of(new Mo(r.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Wn(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Cs=Ce.define({combine(n){return n.length?n[0]:null},enables:n=>[oi.state,eL,Ee.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class tL{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const nL=Ce.define(),tl=Ce.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function th(n){let e=n.facet(tl);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Ua(n,e){let t="",i=n.tabSize,s=n.facet(tl)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return ja(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const L_=new Ke;function iL(n,e,t){return D_(e.resolveInner(t).enterUnfinishedNodesBefore(t),t,n)}function sL(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function rL(n){let e=n.type.prop(L_);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(Ke.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>U_(o,!0,1,void 0,r&&!sL(o)?s.from:void 0)}return n.parent==null?oL:null}function D_(n,e,t){for(;n;n=n.parent){let i=rL(n);if(i)return i(Ep.create(t,e,n))}return null}function oL(){return 0}class Ep extends Qh{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.node=i}static create(e,t,i){return new Ep(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(aL(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){let e=this.node.parent;return e?D_(e,this.pos,this.base):0}}function aL(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function lL(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==i)return null;if(!l.type.isSkipped)return l.fromU_(i,e,t,n)}function U_(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,a=i&&r.slice(o,o+i.length)==i||s==n.pos+o,l=e?lL(n):null;return l?a?n.column(l.from):n.column(l.to):n.baseIndent+(a?0:n.unit*t)}const hL=n=>n.baseIndent;function qu({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const uL=200;function fL(){return nt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+uL)return n;let r=t.sliceString(s.from,i);if(!e.some(c=>c.test(r)))return n;let{state:o}=n,a=-1,l=[];for(let{head:c}of o.selection.ranges){let h=o.doc.lineAt(c);if(h.from==a)continue;a=h.from;let u=Tp(o,h.from);if(u==null)continue;let f=/^\s*/.exec(h.text)[0],d=Ua(o,u);f!=d&&l.push({from:h.from,to:h.from+f.length,insert:d})}return l.length?[n,{changes:l,sequential:!0}]:n})}const dL=Ce.define(),I_=new Ke;function pL(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(r&&o.from=e&&l.to>t&&(r=l)}}return r}function gL(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function nh(n,e,t){for(let i of n.facet(dL)){let s=i(n,e,t);if(s)return s}return mL(n,e,t)}function Q_(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Nh=Xe.define({map:Q_}),nl=Xe.define({map:Q_});function N_(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const gr=Ht.define({create(){return Ie.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)t.is(Nh)&&!OL(n,t.value.from,t.value.to)?n=n.update({add:[mO.range(t.value.from,t.value.to)]}):t.is(nl)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:i}=e.selection.main;n.between(i,i,(s,r)=>{si&&(t=!0)}),t&&(n=n.update({filterFrom:i,filterTo:i,filter:(s,r)=>r<=i||s>=i}))}return n},provide:n=>Ee.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{(!s||s.from>r)&&(s={from:r,to:o})}),s}function OL(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function $_(n,e){return n.field(gr,!1)?e:e.concat(Xe.appendConfig.of(X_()))}const vL=n=>{for(let e of N_(n)){let t=nh(n.state,e.from,e.to);if(t)return n.dispatch({effects:$_(n.state,[Nh.of(t),F_(n,t)])}),!0}return!1},xL=n=>{if(!n.state.field(gr,!1))return!1;let e=[];for(let t of N_(n)){let i=ih(n.state,t.from,t.to);i&&e.push(nl.of(i),F_(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function F_(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return Ee.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const SL=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(gr,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(nl.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},yL=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:vL},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:xL},{key:"Ctrl-Alt-[",run:SL},{key:"Ctrl-Alt-]",run:_L}],bL={placeholderDOM:null,placeholderText:"…"},B_=Ce.define({combine(n){return Li(n,bL)}});function X_(n){let e=[gr,TL];return n&&e.push(B_.of(n)),e}const mO=Ie.replace({widget:new class extends ns{toDOM(n){let{state:e}=n,t=e.facet(B_),i=r=>{let o=n.lineBlockAt(n.posAtDOM(r.target)),a=ih(n.state,o.from,o.to);a&&n.dispatch({effects:nl.of(a)}),r.preventDefault()};if(t.placeholderDOM)return t.placeholderDOM(n,i);let s=document.createElement("span");return s.textContent=t.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}}}),wL={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Ku extends Ki{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function ML(n={}){let e=Object.assign(Object.assign({},wL),n),t=new Ku(e,!0),i=new Ku(e,!1),s=Ut.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Cs)!=o.state.facet(Cs)||o.startState.field(gr,!1)!=o.state.field(gr,!1)||Xt(o.startState)!=Xt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Ms;for(let l of o.viewportLineBlocks){let c=ih(o.state,l.from,l.to)?i:nh(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:r}=e;return[s,Pk({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||lt.empty},initialSpacer(){return new Ku(e,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:(o,a,l)=>{if(r.click&&r.click(o,a,l))return!0;let c=ih(o.state,a.from,a.to);if(c)return o.dispatch({effects:nl.of(c)}),!0;let h=nh(o.state,a.from,a.to);return h?(o.dispatch({effects:Nh.of(h)}),!0):!1}})}),X_()]}const TL=Ee.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class il{constructor(e,t){this.specs=e;let i;function s(a){let l=Ts.newName();return(i||(i=Object.create(null)))["."+l]=a,l}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof oi?a=>a.prop(Yr)==o.data:o?a=>a==o:void 0,this.style=C_(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:r}).style,this.module=i?new Ts(i):null,this.themeType=t.themeType}static define(e,t){return new il(e,t||{})}}const fd=Ce.define(),z_=Ce.define({combine(n){return n.length?[n[0]]:null}});function Ju(n){let e=n.facet(fd);return e.length?e:n.facet(z_)}function V_(n,e){let t=[AL],i;return n instanceof il&&(n.module&&t.push(Ee.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(z_.of(n)):i?t.push(fd.computeN([Ee.darkTheme],s=>s.facet(Ee.darkTheme)==(i=="dark")?[n]:[])):t.push(fd.of(n)),t}class EL{constructor(e){this.markCache=Object.create(null),this.tree=Xt(e.state),this.decorations=this.buildDeco(e,Ju(e.state))}update(e){let t=Xt(e.state),i=Ju(e.state),s=i!=Ju(e.startState);t.length{i.add(o,a,this.markCache[l]||(this.markCache[l]=Ie.mark({class:l})))},s,r);return i.finish()}}const AL=vr.high(Ut.fromClass(EL,{decorations:n=>n.decorations})),PL=il.define([{tag:D.meta,color:"#404740"},{tag:D.link,textDecoration:"underline"},{tag:D.heading,textDecoration:"underline",fontWeight:"bold"},{tag:D.emphasis,fontStyle:"italic"},{tag:D.strong,fontWeight:"bold"},{tag:D.strikethrough,textDecoration:"line-through"},{tag:D.keyword,color:"#708"},{tag:[D.atom,D.bool,D.url,D.contentSeparator,D.labelName],color:"#219"},{tag:[D.literal,D.inserted],color:"#164"},{tag:[D.string,D.deleted],color:"#a11"},{tag:[D.regexp,D.escape,D.special(D.string)],color:"#e40"},{tag:D.definition(D.variableName),color:"#00f"},{tag:D.local(D.variableName),color:"#30a"},{tag:[D.typeName,D.namespace],color:"#085"},{tag:D.className,color:"#167"},{tag:[D.special(D.variableName),D.macroName],color:"#256"},{tag:D.definition(D.propertyName),color:"#00c"},{tag:D.comment,color:"#940"},{tag:D.invalid,color:"#f00"}]),CL=Ee.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),W_=1e4,G_="()[]{}",Z_=Ce.define({combine(n){return Li(n,{afterCursor:!0,brackets:G_,maxScanDistance:W_,renderMatch:LL})}}),RL=Ie.mark({class:"cm-matchingBracket"}),kL=Ie.mark({class:"cm-nonmatchingBracket"});function LL(n){let e=[],t=n.matched?RL:kL;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const DL=Ht.define({create(){return Ie.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(Z_);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=Ti(e.state,s.head,-1,i)||s.head>0&&Ti(e.state,s.head-1,1,i)||i.afterCursor&&(Ti(e.state,s.head,1,i)||s.headEe.decorations.from(n)}),UL=[DL,CL];function IL(n={}){return[Z_.of(n),UL]}const QL=new Ke;function dd(n,e,t){let i=n.prop(e<0?Ke.openedBy:Ke.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function pd(n){let e=n.type.prop(QL);return e?e(n.node):n}function Ti(n,e,t,i={}){let s=i.maxScanDistance||W_,r=i.brackets||G_,o=Xt(n),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=dd(l.type,t,r);if(c&&l.from0?e>=h.from&&eh.from&&e<=h.to))return NL(n,e,t,l,h,c,r)}}return $L(n,e,t,o,a.type,s,r)}function NL(n,e,t,i,s,r,o){let a=i.parent,l={from:s.from,to:s.to},c=0,h=a==null?void 0:a.cursor();if(h&&(t<0?h.childBefore(i.from):h.childAfter(i.to)))do if(t<0?h.to<=i.from:h.from>=i.to){if(c==0&&r.indexOf(h.type.name)>-1&&h.from0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},h=n.doc.iterRange(e,t>0?n.doc.length:0),u=0;for(let f=0;!h.next().done&&f<=r;){let d=h.value;t<0&&(f+=d.length);let g=e+f*t;for(let O=t>0?0:d.length-1,m=t>0?d.length:-1;O!=m;O+=t){let p=o.indexOf(d[O]);if(!(p<0||i.resolveInner(g+O,1).type!=s))if(p%2==0==t>0)u++;else{if(u==1)return{start:c,end:{from:g+O,to:g+O+1},matched:p>>1==l>>1};u--}}t>0&&(f+=d.length)}return h.done?{start:c,matched:!1}:null}const FL=Object.create(null),gO=[Tn.none],OO=[],BL=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])BL[n]=XL(FL,e);function ef(n,e){OO.indexOf(n)>-1||(OO.push(n),console.warn(e))}function XL(n,e){let t=null;for(let r of e.split(".")){let o=n[r]||D[r];o?typeof o=="function"?t?t=o(t):ef(r,`Modifier ${r} used at start of tag`):t?ef(r,`Tag ${r} used as modifier`):t=o:ef(r,`Unknown highlighting tag ${r}`)}if(!t)return 0;let i=e.replace(/ /g,"_"),s=Tn.define({id:gO.length,name:i,props:[A_({[i]:t})]});return gO.push(s),s.id}const zL=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Pp(n.state,t.from);return i.line?VL(n):i.block?GL(n):!1};function Ap(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const VL=Ap(YL,0),WL=Ap(H_,0),GL=Ap((n,e)=>H_(n,e,HL(e)),0);function Pp(n,e){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const Ho=50;function ZL(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-Ho,i),o=n.sliceDoc(s,s+Ho),a=/\s*$/.exec(r)[0].length,l=/^\s*/.exec(o)[0].length,c=r.length-a;if(r.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:i-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let h,u;s-i<=2*Ho?h=u=n.sliceDoc(i,s):(h=n.sliceDoc(i,i+Ho),u=n.sliceDoc(s-Ho,s));let f=/^\s*/.exec(h)[0].length,d=/\s*$/.exec(u)[0].length,g=u.length-d-t.length;return h.slice(f,f+e.length)==e&&u.slice(g,g+t.length)==t?{open:{pos:i+f+e.length,margin:/\s/.test(h.charAt(f+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(u.charAt(g-1))?1:0}}:null}function HL(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function H_(n,e,t=e.selection.ranges){let i=t.map(r=>Pp(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>ZL(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,a;os&&(r==o||o>u.from)){s=u.from;let f=/^\s*/.exec(u.text)[0].length,d=f==u.length,g=u.text.slice(f,f+c.length)==c?f:-1;fr.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:a,token:l,indent:c,empty:h,single:u}of i)(u||!h)&&r.push({from:a.from+c,insert:l+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:a,token:l}of i)if(a>=0){let c=o.from+a,h=c+l.length;o.text[h-o.from]==" "&&h++,r.push({from:c,to:h})}return{changes:r}}return null}const md=ts.define(),jL=ts.define(),qL=Ce.define(),Y_=Ce.define({combine(n){return Li(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}});function KL(n){let e=0;return n.iterChangedRanges((t,i)=>e=i),e}const j_=Ht.define({create(){return Ei.empty},update(n,e){let t=e.state.facet(Y_),i=e.annotation(md);if(i){let l=e.docChanged?re.single(KL(e.changes)):void 0,c=yn.fromTransaction(e,l),h=i.side,u=h==0?n.undone:n.done;return c?u=sh(u,u.length,t.minDepth,c):u=J_(u,e.startState.selection),new Ei(h==0?i.rest:u,h==0?u:i.rest)}let s=e.annotation(jL);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation($t.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=yn.fromTransaction(e),o=e.annotation($t.time),a=e.annotation($t.userEvent);return r?n=n.addChanges(r,o,a,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Ei(n.done.map(yn.fromJSON),n.undone.map(yn.fromJSON))}});function JL(n={}){return[j_,Y_.of(n),Ee.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?q_:e.inputType=="historyRedo"?gd:null;return i?(e.preventDefault(),i(t)):!1}})]}function $h(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(j_,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const q_=$h(0,!1),gd=$h(1,!1),eD=$h(0,!0),tD=$h(1,!0);class yn{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new yn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new yn(e.changes&&It.fromJSON(e.changes),[],e.mapped&&Ci.fromJSON(e.mapped),e.startSelection&&re.fromJSON(e.startSelection),e.selectionsAfter.map(re.fromJSON))}static fromTransaction(e,t){let i=zn;for(let s of e.startState.facet(qL)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new yn(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,zn)}static selection(e){return new yn(void 0,zn,void 0,void 0,e)}}function sh(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function nD(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,a)=>{for(let l=0;l=c&&o<=h&&(i=!0)}}),i}function iD(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function K_(n,e){return n.length?e.length?n.concat(e):n:e}const zn=[],sD=200;function J_(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-sD));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),sh(n,n.length-1,1e9,t.setSelAfter(i)))}else return[yn.selection([e])]}function rD(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function tf(n,e){if(!n.length)return n;let t=n.length,i=zn;for(;t;){let s=oD(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[yn.selection(i)]:zn}function oD(n,e,t){let i=K_(n.selectionsAfter.length?n.selectionsAfter.map(a=>a.map(e)):zn,t);if(!n.changes)return yn.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new yn(s,Xe.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const aD=/^(input\.type|delete)($|\.)/;class Ei{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new Ei(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!i||aD.test(i))&&(!a.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):Fh(t,e))}function on(n){return n.textDirectionAt(n.state.selection.main.head)==St.LTR}const t1=n=>e1(n,!on(n)),n1=n=>e1(n,on(n));function i1(n,e){return hi(n,t=>t.empty?n.moveByGroup(t,e):Fh(t,e))}const cD=n=>i1(n,!on(n)),hD=n=>i1(n,on(n));function uD(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Bh(n,e,t){let i=Xt(n).resolveInner(e.head),s=t?Ke.closedBy:Ke.openedBy;for(let l=e.head;;){let c=t?i.childAfter(l):i.childBefore(l);if(!c)break;uD(n,c,s)?i=c:l=t?c.to:c.from}let r=i.type.prop(s),o,a;return r&&(o=t?Ti(n,i.from,1):Ti(n,i.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?i.to:i.from,re.cursor(a,t?-1:1)}const fD=n=>hi(n,e=>Bh(n.state,e,!on(n))),dD=n=>hi(n,e=>Bh(n.state,e,on(n)));function s1(n,e){return hi(n,t=>{if(!t.empty)return Fh(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const r1=n=>s1(n,!1),o1=n=>s1(n,!0);function a1(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):Fh(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),a=n.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottoml1(n,!1),Od=n=>l1(n,!0);function ks(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=re.cursor(i.from+r))}return s}const pD=n=>hi(n,e=>ks(n,e,!0)),mD=n=>hi(n,e=>ks(n,e,!1)),gD=n=>hi(n,e=>ks(n,e,!on(n))),OD=n=>hi(n,e=>ks(n,e,on(n))),vD=n=>hi(n,e=>re.cursor(n.lineBlockAt(e.head).from,1)),xD=n=>hi(n,e=>re.cursor(n.lineBlockAt(e.head).to,-1));function SD(n,e,t){let i=!1,s=Do(n.selection,r=>{let o=Ti(n,r.head,-1)||Ti(n,r.head,1)||r.head>0&&Ti(n,r.head-1,1)||r.headSD(n,e,!1);function Zn(n,e){let t=Do(n.state.selection,i=>{let s=e(i);return re.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Di(n.state,t)),!0)}function c1(n,e){return Zn(n,t=>n.moveByChar(t,e))}const h1=n=>c1(n,!on(n)),u1=n=>c1(n,on(n));function f1(n,e){return Zn(n,t=>n.moveByGroup(t,e))}const yD=n=>f1(n,!on(n)),bD=n=>f1(n,on(n)),wD=n=>Zn(n,e=>Bh(n.state,e,!on(n))),MD=n=>Zn(n,e=>Bh(n.state,e,on(n)));function d1(n,e){return Zn(n,t=>n.moveVertically(t,e))}const p1=n=>d1(n,!1),m1=n=>d1(n,!0);function g1(n,e){return Zn(n,t=>n.moveVertically(t,e,a1(n).height))}const xO=n=>g1(n,!1),SO=n=>g1(n,!0),TD=n=>Zn(n,e=>ks(n,e,!0)),ED=n=>Zn(n,e=>ks(n,e,!1)),AD=n=>Zn(n,e=>ks(n,e,!on(n))),PD=n=>Zn(n,e=>ks(n,e,on(n))),CD=n=>Zn(n,e=>re.cursor(n.lineBlockAt(e.head).from)),RD=n=>Zn(n,e=>re.cursor(n.lineBlockAt(e.head).to)),_O=({state:n,dispatch:e})=>(e(Di(n,{anchor:0})),!0),yO=({state:n,dispatch:e})=>(e(Di(n,{anchor:n.doc.length})),!0),bO=({state:n,dispatch:e})=>(e(Di(n,{anchor:n.selection.main.anchor,head:0})),!0),wO=({state:n,dispatch:e})=>(e(Di(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),kD=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),LD=({state:n,dispatch:e})=>{let t=zh(n).map(({from:i,to:s})=>re.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:re.create(t),userEvent:"select"})),!0},DD=({state:n,dispatch:e})=>{let t=Do(n.selection,i=>{var s;let r=Xt(n).resolveInner(i.head,1);for(;!(r.from=i.to||r.to>i.to&&r.from<=i.from||!(!((s=r.parent)===null||s===void 0)&&s.parent));)r=r.parent;return re.range(r.to,r.from)});return e(Di(n,t)),!0},UD=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=re.create([t.main]):t.main.empty||(i=re.create([re.cursor(t.main.head)])),i?(e(Di(n,i)),!0):!1};function Xh(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:a}=r;if(o==a){let l=e(o);lo&&(t="delete.forward",l=tc(n,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=tc(n,o,!1),a=tc(n,a,!0);return o==a?{range:r}:{changes:{from:o,to:a},range:re.cursor(o)}});return s.changes.empty?!1:(n.dispatch(i.update(s,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?Ee.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function tc(n,e,t){if(n instanceof Ee)for(let i of n.state.facet(Ee.atomicRanges).map(s=>s(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const O1=(n,e)=>Xh(n,t=>{let{state:i}=n,s=i.doc.lineAt(t),r,o;if(!e&&t>s.from&&tO1(n,!1),v1=n=>O1(n,!0),x1=(n,e)=>Xh(n,t=>{let i=t,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let a=null;;){if(i==(e?r.to:r.from)){i==t&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let l=rn(r.text,i-r.from,e)+r.from,c=r.text.slice(Math.min(i,l)-r.from,Math.max(i,l)-r.from),h=o(c);if(a!=null&&h!=a)break;(c!=" "||i!=t)&&(a=h),i=l}return i}),S1=n=>x1(n,!1),ID=n=>x1(n,!0),_1=n=>Xh(n,e=>{let t=n.lineBlockAt(e).to;return eXh(n,e=>{let t=n.lineBlockAt(e).from;return e>t?t:Math.max(0,e-1)}),ND=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:ot.of(["",""])},range:re.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},$D=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:rn(r.text,s-r.from,!1)+r.from,a=s==r.to?s+1:rn(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:a,insert:n.doc.slice(s,a).append(n.doc.slice(o,s))},range:re.cursor(a)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function zh(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function y1(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of zh(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),a=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let l of r.ranges)s.push(re.range(Math.min(n.doc.length,l.anchor+a),Math.min(n.doc.length,l.head+a)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let l of r.ranges)s.push(re.range(l.anchor-a,l.head-a))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:re.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const FD=({state:n,dispatch:e})=>y1(n,e,!1),BD=({state:n,dispatch:e})=>y1(n,e,!0);function b1(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of zh(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});return e(n.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const XD=({state:n,dispatch:e})=>b1(n,e,!1),zD=({state:n,dispatch:e})=>b1(n,e,!0),VD=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(zh(e).map(({from:s,to:r})=>(s>0?s--:rn.moveVertically(s,!0)).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function WD(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Xt(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(Ke.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from?{from:i.to,to:s.from}:null}const GD=w1(!1),ZD=w1(!0);function w1(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,a=e.doc.lineAt(r),l=!n&&r==o&&WD(e,r);n&&(r=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new Qh(e,{simulateBreak:r,simulateDoubleBreak:!!l}),h=Tp(c,r);for(h==null&&(h=/^\s*/.exec(e.doc.lineAt(r).text)[0].length);oa.from&&r{let s=[];for(let o=i.from;o<=i.to;){let a=n.doc.lineAt(o);a.number>t&&(i.empty||i.to>a.from)&&(e(a,s,i),t=a.number),o=a.to+1}let r=n.changes(s);return{changes:s,range:re.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const HD=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new Qh(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=Cp(n,(r,o,a)=>{let l=Tp(i,r.from);if(l==null)return;/\S/.test(r.text)||(l=0);let c=/^\s*/.exec(r.text)[0],h=Ua(n,l);(c!=h||a.fromn.readOnly?!1:(e(n.update(Cp(n,(t,i)=>{i.push({from:t.from,insert:n.facet(tl)})}),{userEvent:"input.indent"})),!0),T1=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Cp(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=ja(s,n.tabSize),o=0,a=Ua(n,Math.max(0,r-th(n)));for(;o({mac:n.key,run:n.run,shift:n.shift}))),qD=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:fD,shift:wD},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:dD,shift:MD},{key:"Alt-ArrowUp",run:FD},{key:"Shift-Alt-ArrowUp",run:XD},{key:"Alt-ArrowDown",run:BD},{key:"Shift-Alt-ArrowDown",run:zD},{key:"Escape",run:UD},{key:"Mod-Enter",run:ZD},{key:"Alt-l",mac:"Ctrl-l",run:LD},{key:"Mod-i",run:DD,preventDefault:!0},{key:"Mod-[",run:T1},{key:"Mod-]",run:M1},{key:"Mod-Alt-\\",run:HD},{key:"Shift-Mod-k",run:VD},{key:"Shift-Mod-\\",run:_D},{key:"Mod-/",run:zL},{key:"Alt-A",run:WL}].concat(jD),KD={key:"Tab",run:M1,shift:T1};function ht(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;en.normalize("NFKD"):n=>n;class To{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?a=>r(MO(a)):MO,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return jt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=hp(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Xn(e);let s=this.normalize(t);for(let r=0,o=i;;r++){let a=s.charCodeAt(r),l=this.match(a,o);if(r==s.length-1){if(l)return this.value=l,this;break}o==i&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=rh(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let a=new lo(t,e.sliceString(t,i));return nf.set(e,a),a}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this.matchPos=rh(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=lo.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(P1.prototype[Symbol.iterator]=C1.prototype[Symbol.iterator]=function(){return this});function JD(n){try{return new RegExp(n,Rp),!0}catch{return!1}}function rh(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function xd(n){let e=ht("input",{class:"cm-textfield",name:"line"}),t=ht("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:oh.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},ht("label",n.state.phrase("Go to line"),": ",e)," ",ht("button",{class:"cm-button",type:"submit"},n.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:r}=n,o=r.doc.lineAt(r.selection.main.head),[,a,l,c,h]=s,u=c?+c.slice(1):0,f=l?+l:o.number;if(l&&h){let O=f/100;a&&(O=O*(a=="-"?-1:1)+o.number/r.doc.lines),f=Math.round(r.doc.lines*O)}else l&&a&&(f=f*(a=="-"?-1:1)+o.number);let d=r.doc.line(Math.max(1,Math.min(r.doc.lines,f))),g=re.cursor(d.from+Math.max(0,Math.min(u,d.length)));n.dispatch({effects:[oh.of(!1),Ee.scrollIntoView(g.from,{y:"center"})],selection:g}),n.focus()}return{dom:t}}const oh=Xe.define(),TO=Ht.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(oh)&&(n=t.value);return n},provide:n=>Da.from(n,e=>e?xd:null)}),eU=n=>{let e=La(n,xd);if(!e){let t=[oh.of(!0)];n.state.field(TO,!1)==null&&t.push(Xe.appendConfig.of([TO,tU])),n.dispatch({effects:t}),e=La(n,xd)}return e&&e.dom.querySelector("input").focus(),!0},tU=Ee.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),nU={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},R1=Ce.define({combine(n){return Li(n,nU,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function iU(n){let e=[lU,aU];return n&&e.push(R1.of(n)),e}const sU=Ie.mark({class:"cm-selectionMatch"}),rU=Ie.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function EO(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=vt.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=vt.Word)}function oU(n,e,t,i){return n(e.sliceDoc(t,t+1))==vt.Word&&n(e.sliceDoc(i-1,i))==vt.Word}const aU=Ut.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(R1),{state:t}=n,i=t.selection;if(i.ranges.length>1)return Ie.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return Ie.none;let l=t.wordAt(s.head);if(!l)return Ie.none;o=t.charCategorizer(s.head),r=t.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l200)return Ie.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(EO(o,t,s.from,s.to)&&oU(o,t,s.from,s.to)))return Ie.none}else if(r=t.sliceDoc(s.from,s.to).trim(),!r)return Ie.none}let a=[];for(let l of n.visibleRanges){let c=new To(t.doc,r,l.from,l.to);for(;!c.next().done;){let{from:h,to:u}=c.value;if((!o||EO(o,t,h,u))&&(s.empty&&h<=s.from&&u>=s.to?a.push(rU.range(h,u)):(h>=s.to||u<=s.from)&&a.push(sU.range(h,u)),a.length>e.maxMatches))return Ie.none}}return Ie.set(a)}},{decorations:n=>n.decorations}),lU=Ee.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),cU=({state:n,dispatch:e})=>{let{selection:t}=n,i=re.create(t.ranges.map(s=>n.wordAt(s.head)||re.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function hU(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,a=new To(n.doc,e,i[i.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new To(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(l=>l.from==a.value.from))continue;if(r){let l=n.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const uU=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return cU({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=hU(n,i);return s?(e(n.update({selection:n.selection.addRange(re.range(s.from,s.to),!1),effects:Ee.scrollIntoView(s.to)})),!0):!1},Uo=Ce.define({combine(n){return Li(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new bU(e),scrollToMatch:e=>Ee.scrollIntoView(e)})}});class k1{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||JD(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` -`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new mU(this):new dU(this)}getCursor(e,t=0,i){let s=e.doc?e:nt.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?zr(this,s,t,i):Xr(this,s,t,i)}}class L1{constructor(e){this.spec=e}}function Xr(n,e,t,i){return new To(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),n.wholeWord?fU(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function fU(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Xr(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function zr(n,e,t,i){return new P1(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?pU(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function ah(n,e){return n.slice(rn(n,e,!1),e)}function lh(n,e){return n.slice(e,rn(n,e))}function pU(n){return(e,t,i)=>!i[0].length||(n(ah(i.input,i.index))!=vt.Word||n(lh(i.input,i.index))!=vt.Word)&&(n(lh(i.input,i.index+i[0].length))!=vt.Word||n(ah(i.input,i.index+i[0].length))!=vt.Word)}class mU extends L1{nextMatch(e,t,i){let s=zr(this.spec,e,i,e.doc.length).next();return s.done&&(s=zr(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=zr(this.spec,e,r,i),a=null;for(;!o.next().done;)a=o.value;if(a&&(r==t||a.from>r+10))return a;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(t,i)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=zr(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Ia=Xe.define(),kp=Xe.define(),Ss=Ht.define({create(n){return new sf(Sd(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Ia)?n=new sf(t.value.create(),n.panel):t.is(kp)&&(n=new sf(n.query,t.value?Lp:null));return n},provide:n=>Da.from(n,e=>e.panel)});class sf{constructor(e,t){this.query=e,this.panel=t}}const gU=Ie.mark({class:"cm-searchMatch"}),OU=Ie.mark({class:"cm-searchMatch cm-searchMatch-selected"}),vU=Ut.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(Ss))}update(n){let e=n.state.field(Ss);(e!=n.startState.field(Ss)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Ie.none;let{view:t}=this,i=new Ms;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-2*250;)l=r[++s].to;n.highlight(t.state,a,l,(c,h)=>{let u=t.state.selection.ranges.some(f=>f.from==c&&f.to==h);i.add(c,h,u?OU:gU)})}return i.finish()}},{decorations:n=>n.decorations});function sl(n){return e=>{let t=e.state.field(Ss,!1);return t&&t.query.spec.valid?n(e,t):I1(e)}}const ch=sl((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=re.single(i.from,i.to),r=n.state.facet(Uo);return n.dispatch({selection:s,effects:[Dp(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),U1(n),!0}),hh=sl((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=re.single(s.from,s.to),o=n.state.facet(Uo);return n.dispatch({selection:r,effects:[Dp(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),U1(n),!0}),xU=sl((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:re.create(t.map(i=>re.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),SU=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let a=new To(n.doc,n.sliceDoc(i,s));!a.next().done;){if(r.length>1e3)return!1;a.value.from==i&&(o=r.length),r.push(re.range(a.value.from,a.value.to))}return e(n.update({selection:re.create(r,o),userEvent:"select.search.matches"})),!0},AO=sl((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=[],a,l,c=[];if(r.from==i&&r.to==s&&(l=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:l}),r=e.nextMatch(t,r.from,r.to),c.push(Ee.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))),r){let h=o.length==0||o[0].from>=r.to?0:r.to-r.from-l.length;a=re.single(r.from-h,r.to-h),c.push(Dp(n,r)),c.push(t.facet(Uo).scrollToMatch(a.main,n))}return n.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),_U=sl((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:Ee.announce.of(i),userEvent:"input.replace.all"}),!0});function Lp(n){return n.state.facet(Uo).createPanel(n)}function Sd(n,e){var t,i,s,r,o;let a=n.selection.main,l=a.empty||a.to>a.from+100?"":n.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=n.facet(Uo);return new k1({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:c.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:c.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function D1(n){let e=La(n,Lp);return e&&e.dom.querySelector("[main-field]")}function U1(n){let e=D1(n);e&&e==n.root.activeElement&&e.select()}const I1=n=>{let e=n.state.field(Ss,!1);if(e&&e.panel){let t=D1(n);if(t&&t!=n.root.activeElement){let i=Sd(n.state,e.query.spec);i.valid&&n.dispatch({effects:Ia.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[kp.of(!0),e?Ia.of(Sd(n.state,e.query.spec)):Xe.appendConfig.of(MU)]});return!0},Q1=n=>{let e=n.state.field(Ss,!1);if(!e||!e.panel)return!1;let t=La(n,Lp);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:kp.of(!1)}),!0},yU=[{key:"Mod-f",run:I1,scope:"editor search-panel"},{key:"F3",run:ch,shift:hh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ch,shift:hh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Q1,scope:"editor search-panel"},{key:"Mod-Shift-l",run:SU},{key:"Alt-g",run:eU},{key:"Mod-d",run:uU,preventDefault:!0}];class bU{constructor(e){this.view=e;let t=this.query=e.state.field(Ss).query.spec;this.commit=this.commit.bind(this),this.searchField=ht("input",{value:t.search,placeholder:Rn(e,"Find"),"aria-label":Rn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ht("input",{value:t.replace,placeholder:Rn(e,"Replace"),"aria-label":Rn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ht("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=ht("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=ht("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return ht("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=ht("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>ch(e),[Rn(e,"next")]),i("prev",()=>hh(e),[Rn(e,"previous")]),i("select",()=>xU(e),[Rn(e,"all")]),ht("label",null,[this.caseField,Rn(e,"match case")]),ht("label",null,[this.reField,Rn(e,"regexp")]),ht("label",null,[this.wordField,Rn(e,"by word")]),...e.state.readOnly?[]:[ht("br"),this.replaceField,i("replace",()=>AO(e),[Rn(e,"replace")]),i("replaceAll",()=>_U(e),[Rn(e,"replace all")])],ht("button",{name:"close",onclick:()=>Q1(e),"aria-label":Rn(e,"close"),type:"button"},["×"])])}commit(){let e=new k1({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Ia.of(e)}))}keydown(e){$3(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?hh:ch)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),AO(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Ia)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Uo).top}}function Rn(n,e){return n.state.phrase(e)}const nc=30,ic=/[\s\.,:;?!]/;function Dp(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-nc),o=Math.min(s,t+nc),a=n.state.sliceDoc(r,o);if(r!=i.from){for(let l=0;la.length-nc;l--)if(!ic.test(a[l-1])&&ic.test(a[l])){a=a.slice(0,l);break}}return Ee.announce.of(`${n.state.phrase("current match")}. ${a} ${n.state.phrase("on line")} ${i.number}.`)}const wU=Ee.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),MU=[Ss,vr.lowest(vU),wU];class N1{constructor(e,t,i){this.state=e,this.pos=t,this.explicit=i,this.abortListeners=[]}tokenBefore(e){let t=Xt(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(F1(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function PO(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function TU(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:TU(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function EU(n,e){return t=>{for(let i=Xt(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class CO{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function _s(n){return n.selection.main.from}function F1(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const B1=ts.define();function AU(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return Object.assign(Object.assign({},n.changeByRange(a=>a!=s&&t!=i&&n.sliceDoc(a.from+r,a.from+o)!=n.sliceDoc(t,i)?{range:a}:{changes:{from:a.from+r,to:i==s.from?a.to:a.from+o,insert:e},range:re.cursor(a.from+r+e.length)})),{userEvent:"input.complete"})}const RO=new WeakMap;function PU(n){if(!Array.isArray(n))return n;let e=RO.get(n);return e||RO.set(n,e=$1(n)),e}const Up=Xe.define(),Qa=Xe.define();class CU{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(T=hp(w))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!y||C==1&&m||x==0&&C!=0)&&(t[u]==w||i[u]==w&&(f=!0)?o[u++]=y:o.length&&(p=!1)),x=C,y+=Xn(w)}return u==l&&o[0]==0&&p?this.result(-100+(f?-200:0),o,e):d==l&&g==0?this.ret(-200-e.length+(O==e.length?0:-100),[0,O]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):d==l?this.ret(-200+-700-e.length,[g,O]):u==l?this.result(-100+(f?-200:0)+-700+(p?0:-1100),o,e):t.length==2?!1:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let a=o+(this.astral?Xn(jt(i,o)):1);r&&s[r-1]==o?s[r-1]=a:(s[r++]=o,s[r++]=a)}return this.ret(e-i.length,s)}}const bn=Ce.define({combine(n){return Li(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:RU,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>kO(e(i),t(i)),optionClass:(e,t)=>i=>kO(e(i),t(i)),addToOptions:(e,t)=>e.concat(t)})}});function kO(n,e){return n?e?n+" "+e:n:e}function RU(n,e,t,i,s){let r=n.textDirection==St.RTL,o=r,a=!1,l="top",c,h,u=e.left-s.left,f=s.right-e.right,d=i.right-i.left,g=i.bottom-i.top;if(o&&u=g||O>e.top?c=t.bottom-e.top:(l="bottom",c=e.bottom-t.top)}return{style:`${l}: ${c}px; max-width: ${h}px`,class:"cm-completionInfo-"+(a?r?"left-narrow":"right-narrow":o?"left":"right")}}function kU(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s){let r=document.createElement("span");r.className="cm-completionLabel";let o=t.displayLabel||t.label,a=0;for(let l=0;la&&r.appendChild(document.createTextNode(o.slice(a,c)));let u=r.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(o.slice(c,h))),u.className="cm-completionMatchedText",a=h}return at.position-i.position).map(t=>t.render)}function LO(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class LU{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,a=e.state.facet(bn);this.optionContent=kU(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=LO(r.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{for(let c=l.target,h;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(h=/-(\d+)$/.exec(c.id))&&+h[1]{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(bn).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Qa.of(null)})}),this.list=this.dom.appendChild(this.createListBox(r,s.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}mount(){this.updateSel()}update(e){var t,i,s;let r=e.state.field(this.stateField),o=e.startState.field(this.stateField);this.updateTooltipClass(e.state),r!=o&&(this.updateSel(),((t=r.open)===null||t===void 0?void 0:t.disabled)!=((i=o.open)===null||i===void 0?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(!((s=r.open)===null||s===void 0)&&s.disabled)))}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=LO(t.options.length,t.selected,this.view.state.facet(bn).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t.options,e.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let r=typeof s=="string"?document.createTextNode(s):s(i);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>Wn(this.view.state,o,"completion info")):this.addInfoPane(r,i)}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return t&&UU(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottomi.from||i.from==0))if(r=f,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=f}}const h=s.appendChild(document.createElement("li"));h.id=t+"-"+o,h.setAttribute("role","option");let u=this.optionClass(a);u&&(h.className=u);for(let f of this.optionContent){let d=f(a,this.view.state,l);d&&h.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew LU(t,n,e)}function UU(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect();i.topt.bottom&&(n.scrollTop+=i.bottom-t.bottom)}function DO(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function IU(n,e){let t=[],i=null,s=l=>{t.push(l);let{section:c}=l.completion;if(c){i||(i=[]);let h=typeof c=="string"?c:c.name;i.some(u=>u.name==h)||i.push(typeof c=="string"?{name:h}:c)}};for(let l of n)if(l.hasResult()){let c=l.result.getMatch;if(l.result.filter===!1)for(let h of l.result.options)s(new CO(h,l.source,c?c(h):[],1e9-t.length));else{let h=new CU(e.sliceDoc(l.from,l.to));for(let u of l.result.options)if(h.match(u.label)){let f=u.displayLabel?c?c(u,h.matched):[]:h.matched;s(new CO(u,l.source,f,h.score+(u.boost||0)))}}}if(i){let l=Object.create(null),c=0,h=(u,f)=>{var d,g;return((d=u.rank)!==null&&d!==void 0?d:1e9)-((g=f.rank)!==null&&g!==void 0?g:1e9)||(u.nameh.score-c.score||a(c.completion,h.completion))){let c=l.completion;!o||o.label!=c.label||o.detail!=c.detail||o.type!=null&&c.type!=null&&o.type!=c.type||o.apply!=c.apply||o.boost!=c.boost?r.push(l):DO(l.completion)>DO(o)&&(r[r.length-1]=l),o=l.completion}return r}class jr{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new jr(this.options,UO(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r){let o=IU(e,t);if(!o.length)return s&&e.some(l=>l.state==1)?new jr(s.options,s.attrs,s.tooltip,s.timestamp,s.selected,!0):null;let a=t.facet(bn).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let l=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(l,c.from):l,1e8),create:DU(Un,V1),above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new jr(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class uh{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new uh($U,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(bn),r=(i.override||t.languageDataAt("autocomplete",_s(t)).map(PU)).map(a=>(this.active.find(c=>c.source==a)||new _n(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,l)=>a==this.active[l])&&(r=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!QU(r,this.active)?o=jr.build(r,t,this.id,o,i):o&&o.disabled&&!r.some(a=>a.state==1)&&(o=null),!o&&r.every(a=>a.state!=1)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new _n(a.source,0):a));for(let a of e.effects)a.is(z1)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new uh(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:NU}}function QU(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const $U=[];function _d(n){return n.isUserEvent("input.type")?"input":n.isUserEvent("delete.backward")?"delete":null}class _n{constructor(e,t,i=-1){this.source=e,this.state=t,this.explicitPos=i}hasResult(){return!1}update(e,t){let i=_d(e),s=this;i?s=s.handleUserEvent(e,i,t):e.docChanged?s=s.handleChange(e):e.selection&&s.state!=0&&(s=new _n(s.source,0));for(let r of e.effects)if(r.is(Up))s=new _n(s.source,1,r.value?_s(e.state):-1);else if(r.is(Qa))s=new _n(s.source,0);else if(r.is(X1))for(let o of r.value)o.source==s.source&&(s=o);return s}handleUserEvent(e,t,i){return t=="delete"||!i.activateOnTyping?this.map(e.changes):new _n(this.source,1)}handleChange(e){return e.changes.touchesRange(_s(e.startState))?new _n(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new _n(this.source,this.state,e.mapPos(this.explicitPos))}}class co extends _n{constructor(e,t,i,s,r){super(e,2,t),this.result=i,this.from=s,this.to=r}hasResult(){return!0}handleUserEvent(e,t,i){var s;let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=_s(e.state);if((this.explicitPos<0?a<=r:ao||t=="delete"&&_s(e.startState)==this.from)return new _n(this.source,t=="input"&&i.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),c;return FU(this.result.validFor,e.state,r,o)?new co(this.source,l,this.result,r,o):this.result.update&&(c=this.result.update(this.result,r,o,new N1(e.state,a,l>=0)))?new co(this.source,l,c,c.from,(s=c.to)!==null&&s!==void 0?s:_s(e.state)):new _n(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new _n(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new co(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function FU(n,e,t,i){if(!n)return!1;let s=e.sliceDoc(t,i);return typeof n=="function"?n(s,t,i,e):F1(n,!0).test(s)}const X1=Xe.define({map(n,e){return n.map(t=>t.map(e))}}),z1=Xe.define(),Un=Ht.define({create(){return uh.start()},update(n,e){return n.update(e)},provide:n=>[xp.from(n,e=>e.tooltip),Ee.contentAttributes.from(n,e=>e.attrs)]});function V1(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Un).active.find(s=>s.source==e.source);return i instanceof co?(typeof t=="string"?n.dispatch(Object.assign(Object.assign({},AU(n.state,t,i.from,i.to)),{annotations:B1.of(e.completion)})):t(n,e.completion,i.from,i.to),!0):!1}function sc(n,e="option"){return t=>{let i=t.state.field(Un,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:z1.of(a)}),!0}}const BU=n=>{let e=n.state.field(Un,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(Un,!1)?(n.dispatch({effects:Up.of(!0)}),!0):!1,zU=n=>{let e=n.state.field(Un,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Qa.of(null)}),!0)};class VU{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const IO=50,WU=50,GU=1e3,ZU=Ut.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of n.state.field(Un).active)e.state==1&&this.startQuery(e)}update(n){let e=n.state.field(Un);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Un)==e)return;let t=n.transactions.some(i=>(i.selection||i.docChanged)&&!_d(i));for(let i=0;iWU&&Date.now()-s.time>GU){for(let r of s.context.abortListeners)try{r()}catch(o){Wn(this.view.state,o)}s.context.abortListeners=null,this.running.splice(i--,1)}else s.updates.push(...n.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(i=>i.state==1&&!this.running.some(s=>s.active.source==i.source))?setTimeout(()=>this.startUpdate(),IO):-1,this.composing!=0)for(let i of n.transactions)_d(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:n}=this.view,e=n.field(Un);for(let t of e.active)t.state==1&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t)}startQuery(n){let{state:e}=this.view,t=_s(e),i=new N1(e,t,n.explicitPos==t),s=new VU(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:Qa.of(null)}),Wn(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),IO))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(bn);for(let i=0;io.source==s.active.source);if(r&&r.state==1)if(s.done==null){let o=new _n(s.active.source,0);for(let a of s.updates)o=o.update(a,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:X1.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Un,!1);if(e&&e.tooltip&&this.view.state.facet(bn).closeOnBlur){let t=e.open&&S_(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&this.view.dispatch({effects:Qa.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Up.of(!1)}),20),this.composing=0}}}),W1=Ee.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class HU{constructor(e,t,i,s){this.field=e,this.line=t,this.from=i,this.to=s}}class Ip{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,Kt.TrackDel),i=e.mapPos(this.to,1,Kt.TrackDel);return t==null||i==null?null:new Ip(this.field,t,i)}}class Qp{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let l of this.lines){if(i.length){let c=o,h=/^\t*/.exec(l)[0].length;for(let u=0;unew Ip(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:i,ranges:a}}static parse(e){let t=[],i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let a=r[1]?+r[1]:null,l=r[2]||r[3]||"",c=-1;for(let h=0;h=c&&u.field++}s.push(new HU(c,i.length,r.index,r.index+l.length)),o=o.slice(0,r.index)+l+o.slice(r.index+r[0].length)}for(let a;a=/\\([{}])/.exec(o);){o=o.slice(0,a.index)+a[1]+o.slice(a.index+a[0].length);for(let l of s)l.line==i.length&&l.from>a.index&&(l.from--,l.to--)}i.push(o)}return new Qp(i,s)}}let YU=Ie.widget({widget:new class extends ns{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),jU=Ie.mark({class:"cm-snippetField"});class Io{constructor(e,t){this.ranges=e,this.active=t,this.deco=Ie.set(e.map(i=>(i.from==i.to?YU:jU).range(i.from,i.to)))}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new Io(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const rl=Xe.define({map(n,e){return n&&n.map(e)}}),qU=Xe.define(),Na=Ht.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(rl))return t.value;if(t.is(qU)&&n)return new Io(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>Ee.decorations.from(n,e=>e?e.deco:Ie.none)});function Np(n,e){return re.create(n.filter(t=>t.field==e).map(t=>re.range(t.from,t.to)))}function KU(n){let e=Qp.parse(n);return(t,i,s,r)=>{let{text:o,ranges:a}=e.instantiate(t.state,s),l={changes:{from:s,to:r,insert:ot.of(o)},scrollIntoView:!0,annotations:i?B1.of(i):void 0};if(a.length&&(l.selection=Np(a,0)),a.length>1){let c=new Io(a,0),h=l.effects=[rl.of(c)];t.state.field(Na,!1)===void 0&&h.push(Xe.appendConfig.of([Na,iI,sI,W1]))}t.dispatch(t.state.update(l))}}function G1(n){return({state:e,dispatch:t})=>{let i=e.field(Na,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return t(e.update({selection:Np(i.ranges,s),effects:rl.of(r?null:new Io(i.ranges,s))})),!0}}const JU=({state:n,dispatch:e})=>n.field(Na,!1)?(e(n.update({effects:rl.of(null)})),!0):!1,eI=G1(1),tI=G1(-1),nI=[{key:"Tab",run:eI,shift:tI},{key:"Escape",run:JU}],QO=Ce.define({combine(n){return n.length?n[0]:nI}}),iI=vr.highest(Ja.compute([QO],n=>n.facet(QO)));function Jn(n,e){return Object.assign(Object.assign({},e),{apply:KU(n)})}const sI=Ee.domEventHandlers({mousedown(n,e){let t=e.state.field(Na,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==t.active?!1:(e.dispatch({selection:Np(t.ranges,s.field),effects:rl.of(t.ranges.some(r=>r.field>s.field)?new Io(t.ranges,s.field):null)}),!0)}}),$a={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},er=Xe.define({map(n,e){let t=e.mapPos(n,-1,Kt.TrackAfter);return t??void 0}}),$p=new class extends pr{};$p.startSide=1;$p.endSide=-1;const Z1=Ht.define({create(){return lt.empty},update(n,e){if(e.selection){let t=e.state.doc.lineAt(e.selection.main.head).from,i=e.startState.doc.lineAt(e.startState.selection.main.head).from;t!=e.changes.mapPos(i,-1)&&(n=lt.empty)}n=n.map(e.changes);for(let t of e.effects)t.is(er)&&(n=n.update({add:[$p.range(t.value,t.value+1)]}));return n}});function rI(){return[aI,Z1]}const rf="()[]{}<>";function H1(n){for(let e=0;e{if((oI?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&Xn(jt(i,0))==1||e!=s.from||t!=s.to)return!1;let r=hI(n.state,i);return r?(n.dispatch(r),!0):!1}),lI=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=Y1(n,n.selection.main.head).brackets||$a.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let a=uI(n.doc,o.head);for(let l of i)if(l==a&&Vh(n.doc,o.head)==H1(jt(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:re.cursor(o.head-l.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},cI=[{key:"Backspace",run:lI}];function hI(n,e){let t=Y1(n,n.selection.main.head),i=t.brackets||$a.brackets;for(let s of i){let r=H1(jt(s,0));if(e==s)return r==s?pI(n,s,i.indexOf(s+s+s)>-1,t):fI(n,s,r,t.before||$a.before);if(e==r&&j1(n,n.selection.main.from))return dI(n,s,r)}return null}function j1(n,e){let t=!1;return n.field(Z1).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Vh(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Xn(jt(t,0)))}function uI(n,e){let t=n.sliceString(e-2,e);return Xn(jt(t,0))==t.length?t:t.slice(1)}function fI(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:er.of(o.to+e.length),range:re.range(o.anchor+e.length,o.head+e.length)};let a=Vh(n.doc,o.head);return!a||/\s/.test(a)||i.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:er.of(o.head+e.length),range:re.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function dI(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&Vh(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:re.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function pI(n,e,t,i){let s=i.stringPrefixes||$a.stringPrefixes,r=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:er.of(a.to+e.length),range:re.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Vh(n.doc,l),h;if(c==e){if(NO(n,l))return{changes:{insert:e+e,from:l},effects:er.of(l+e.length),range:re.cursor(l+e.length)};if(j1(n,l)){let f=t&&n.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:re.cursor(l+f.length)}}}else{if(t&&n.sliceDoc(l-2*e.length,l)==e+e&&(h=$O(n,l-2*e.length,s))>-1&&NO(n,h))return{changes:{insert:e+e+e+e,from:l},effects:er.of(l+e.length),range:re.cursor(l+e.length)};if(n.charCategorizer(l)(c)!=vt.Word&&$O(n,l,s)>-1&&!mI(n,l,e,s))return{changes:{insert:e+e,from:l},effects:er.of(l+e.length),range:re.cursor(l+e.length)}}return{range:r=a}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function NO(n,e){let t=Xt(n).resolveInner(e+1);return t.parent&&t.from==e}function mI(n,e,t,i){let s=Xt(n).resolveInner(e,-1),r=i.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),l=a.indexOf(t);if(!l||l>-1&&i.indexOf(a.slice(0,l))>-1){let h=s.firstChild;for(;h&&h.from==s.from&&h.to-h.from>t.length+l;){if(n.sliceDoc(h.to-t.length,h.to)==t)return!1;h=h.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function $O(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=vt.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=vt.Word)return r}return-1}function gI(n={}){return[Un,bn.of(n),ZU,OI,W1]}const q1=[{key:"Ctrl-Space",run:XU},{key:"Escape",run:zU},{key:"ArrowDown",run:sc(!0)},{key:"ArrowUp",run:sc(!1)},{key:"PageDown",run:sc(!0,"page")},{key:"PageUp",run:sc(!1,"page")},{key:"Enter",run:BU}],OI=vr.highest(Ja.computeN([bn],n=>n.facet(bn).defaultKeymap?[q1]:[]));class vI{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Ys{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=e,r=i.facet(ey).markerFilter;r&&(s=r(s));let o=Ie.set(s.map(a=>a.from==a.to||a.from==a.to-1&&i.doc.lineAt(a.from).to==a.from?Ie.widget({widget:new EI(a),diagnostic:a}).range(a.from):Ie.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new Ys(o,t,Eo(o))}}function Eo(n,e=null,t=0){let i=null;return n.between(t,1e9,(s,r,{spec:o})=>{if(!(e&&o.diagnostic!=e))return i=new vI(s,r,o.diagnostic),!1}),i}function xI(n,e){let t=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(i=>i.is(K1))||n.changes.touchesRange(t.from,t.to))}function SI(n,e){return n.field(Qn,!1)?e:e.concat(Xe.appendConfig.of(CI))}const K1=Xe.define(),Fp=Xe.define(),J1=Xe.define(),Qn=Ht.define({create(){return new Ys(Ie.none,null,null)},update(n,e){if(e.docChanged){let t=n.diagnostics.map(e.changes),i=null;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);i=Eo(t,n.selected.diagnostic,s)||Eo(t,null,s)}n=new Ys(t,n.panel,i)}for(let t of e.effects)t.is(K1)?n=Ys.init(t.value,n.panel,e.state):t.is(Fp)?n=new Ys(n.diagnostics,t.value?Wh.open:null,n.selected):t.is(J1)&&(n=new Ys(n.diagnostics,n.panel,t.value));return n},provide:n=>[Da.from(n,e=>e.panel),Ee.decorations.from(n,e=>e.diagnostics)]}),_I=Ie.mark({class:"cm-lintRange cm-lintRange-active"});function yI(n,e,t){let{diagnostics:i}=n.state.field(Qn),s=[],r=2e8,o=0;i.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:h})=>{e>=l&&e<=c&&(l==c||(e>l||t>0)&&(eny(n,t,!1)))}const wI=n=>{let e=n.state.field(Qn,!1);(!e||!e.panel)&&n.dispatch({effects:SI(n.state,[Fp.of(!0)])});let t=La(n,Wh.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},FO=n=>{let e=n.state.field(Qn,!1);return!e||!e.panel?!1:(n.dispatch({effects:Fp.of(!1)}),!0)},MI=n=>{let e=n.state.field(Qn,!1);if(!e)return!1;let t=n.state.selection.main,i=e.diagnostics.iter(t.to+1);return!i.value&&(i=e.diagnostics.iter(0),!i.value||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},TI=[{key:"Mod-Shift-m",run:wI,preventDefault:!0},{key:"F8",run:MI}],ey=Ce.define({combine(n){return Object.assign({sources:n.map(e=>e.source)},Li(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t}))}});function ty(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function ny(n,e,t){var i;let s=t?ty(e.actions):[];return ht("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ht("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let d=Eo(n.state.field(Qn).diagnostics,e);d&&r.apply(n,d.from,d.to)},{name:c}=r,h=s[o]?c.indexOf(s[o]):-1,u=h<0?c:[c.slice(0,h),ht("u",c.slice(h,h+1)),c.slice(h+1)];return ht("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${h<0?"":` (access key "${s[o]})"`}.`},u)}),e.source&&ht("div",{class:"cm-diagnosticSource"},e.source))}class EI extends ns{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return ht("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class BO{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=ny(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Wh{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)FO(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=ty(r.actions);for(let a=0;a{for(let r=0;rFO(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Qn).selected;if(!e)return-1;for(let t=0;t{let c=-1,h;for(let u=i;ui&&(this.items.splice(i,c-i),s=!0)),t&&h.diagnostic==t.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),r=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),i++});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{o.topa.bottom&&(this.list.scrollTop+=o.bottom-a.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Qn),i=Eo(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:J1.of(i)})}static open(e){return new Wh(e)}}function AI(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function rc(n){return AI(``,'width="6" height="3"')}const PI=Ee.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:rc("#d11")},".cm-lintRange-warning":{backgroundImage:rc("orange")},".cm-lintRange-info":{backgroundImage:rc("#999")},".cm-lintRange-hint":{backgroundImage:rc("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),CI=[Qn,Ee.decorations.compute([Qn],n=>{let{selected:e,panel:t}=n.field(Qn);return!e||!t||e.from==e.to?Ie.none:Ie.set([_I.range(e.from,e.to)])}),Tk(yI,{hideOn:xI}),PI],RI=(()=>[Uk(),Nk(),nk(),JL(),ML(),W3(),j3(),nt.allowMultipleSelections.of(!0),fL(),V_(PL,{fallback:!0}),IL(),rI(),gI(),gk(),xk(),lk(),iU(),Ja.of([...cI,...qD,...yU,...lD,...yL,...q1,...TI])])();/*! +`;this.styleTag.textContent=r}}}var Es={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ca={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},vR=typeof navigator<"u"&&/Mac/.test(navigator.platform),xR=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var qt=0;qt<10;qt++)Es[48+qt]=Es[96+qt]=String(qt);for(var qt=1;qt<=24;qt++)Es[qt+111]="F"+qt;for(var qt=65;qt<=90;qt++)Es[qt]=String.fromCharCode(qt+32),Ca[qt]=String.fromCharCode(qt);for(var Iu in Es)Ca.hasOwnProperty(Iu)||(Ca[Iu]=Es[Iu]);function SR(n){var e=vR&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||xR&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ca:Es)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Bc(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Vf(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function _R(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function mc(n,e){if(!e.anchorNode)return!1;try{return Vf(n,e.anchorNode)}catch{return!1}}function bo(n){return n.nodeType==3?mr(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Xc(n,e,t,i){return t?O0(n,e,t,i,-1)||O0(n,e,t,i,1):!1}function zc(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function O0(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:As(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=zc(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?As(n):0}else return!1}}function As(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Dh(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function yR(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function bR(n,e,t,i,s,r,o,a){let l=n.ownerDocument,c=l.defaultView||window;for(let h=n,u=!1;h&&!u;)if(h.nodeType==1){let f,d=h==l.body;if(d)f=yR(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let m=h.getBoundingClientRect();f={left:m.left,right:m.left+h.clientWidth,top:m.top,bottom:m.top+h.clientHeight}}let g=0,O=0;if(s=="nearest")e.top0&&e.bottom>f.bottom+O&&(O=e.bottom-f.bottom+O+o)):e.bottom>f.bottom&&(O=e.bottom-f.bottom+o,t<0&&e.top-O0&&e.right>f.right+g&&(g=e.right-f.right+g+r)):e.right>f.right&&(g=e.right-f.right+r,t<0&&e.leftt.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11)t=t.host;else break;return null}class MR{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?As(t):0),i,Math.min(e.focusOffset,i?As(i):0))}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let Br=null;function _S(n){if(n.setActive)return n.setActive();if(Br)return n.focus(Br);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Br==null?{get preventScroll(){return Br={preventScroll:!0},!0}}:void 0),!Br){Br=!1;for(let t=0;tMath.max(1,n.scrollHeight-n.clientHeight-4)}class vn{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new vn(e.parentNode,zc(e),t)}static after(e,t){return new vn(e.parentNode,zc(e)+1,t)}}const pp=[];class ut{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,s=null,r;for(let o of this.children){if(o.flags&7){if(!o.dom&&(r=s?s.nextSibling:i.firstChild)){let a=ut.get(r);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(r)}o.sync(e,t),o.flags&=-8}if(r=s?s.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&r!=o.dom&&(t.written=!0),o.dom.parentNode==i)for(;r&&r!=o.dom;)r=x0(r);else i.insertBefore(o.dom,r);s=o.dom}for(r=s?s.nextSibling:i.firstChild,r&&t&&t.node==i&&(t.written=!0);r;)r=x0(r)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let s=As(e)==0?0:t==0?-1:1;for(;;){let r=e.parentNode;if(r==this.dom)break;s==0&&r.firstChild!=r.lastChild&&(e==r.firstChild?s=-1:s=1),e=r}s<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!ut.get(i);)i=i.nextSibling;if(!i)return this.length;for(let s=0,r=0;;s++){let o=this.children[s];if(o.dom==i)return r;r+=o.length+o.breakAfter}}domBoundsAround(e,t,i=0){let s=-1,r=-1,o=-1,a=-1;for(let l=0,c=i,h=i;lt)return u.domBoundsAround(e,t,c);if(f>=e&&s==-1&&(s=l,r=c),c>t&&u.dom.parentNode==this.dom){o=l,a=h;break}h=f,c=f+u.breakAfter}return{from:r,to:a<0?i+this.length:a,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=pp){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function MS(n,e,t,i,s,r,o,a,l){let{children:c}=n,h=c.length?c[e]:null,u=r.length?r[r.length-1]:null,f=u?u.breakAfter:o;if(!(e==i&&h&&!o&&!f&&r.length<2&&h.merge(t,s,r.length?u:null,t==0,a,l))){if(i0&&(!o&&r.length&&h.merge(t,h.length,r[0],!1,a,0)?h.breakAfter=r.shift().breakAfter:(tr)&&this.lineBreak(),s=o}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,a;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(a=s.exec(t))&&(r=a.index,o=a[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=ut.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+Math.min(t,i.offset))}}function S0(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}class _0{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}let In=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Wf=typeof document<"u"?document:{documentElement:{style:{}}};const Gf=/Edge\/(\d+)/.exec(In.userAgent),AS=/MSIE \d/.test(In.userAgent),Zf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(In.userAgent),Uh=!!(AS||Zf||Gf),y0=!Uh&&/gecko\/(\d+)/i.test(In.userAgent),Qu=!Uh&&/Chrome\/(\d+)/.exec(In.userAgent),b0="webkitFontSmoothing"in Wf.documentElement.style,PS=!Uh&&/Apple Computer/.test(In.vendor),w0=PS&&(/Mobile\/\w+/.test(In.userAgent)||In.maxTouchPoints>2);var Le={mac:w0||/Mac/.test(In.platform),windows:/Win/.test(In.platform),linux:/Linux|X11/.test(In.platform),ie:Uh,ie_version:AS?Wf.documentMode||6:Zf?+Zf[1]:Gf?+Gf[1]:0,gecko:y0,gecko_version:y0?+(/Firefox\/(\d+)/.exec(In.userAgent)||[0,0])[1]:0,chrome:!!Qu,chrome_version:Qu?+Qu[1]:0,ios:w0,android:/Android\b/.test(In.userAgent),webkit:b0,safari:PS,webkit_version:b0?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Wf.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const AR=256;class Ri extends ut{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return this.flags&8||i&&(!(i instanceof Ri)||this.length-(t-e)+i.length>AR||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ri(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new vn(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return PR(this.dom,e,t)}}class qi extends ut{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let s of t)s.setParent(this)}setAttrs(e){if(yS(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,s,r,o){return i&&(!(i instanceof qi&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(s=r),i=l,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new qi(this.mark,t,o)}domAtPos(e){return CS(this,e)}coordsAt(e,t){return kS(this,e,t)}}function PR(n,e,t){let i=n.nodeValue.length;e>i&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?Le.chrome||Le.gecko||(e?(s--,o=1):r=0)?0:a.length-1];return Le.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Dh(l,o<0):l||null}class Js extends ut{constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}static create(e,t,i){return new Js(e,t,i)}split(e){let t=Js.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,i,s,r,o){return i&&(!(i instanceof Js)||!this.widget.compare(i.widget)||e>0&&r<=0||t0)?vn.before(this.dom):vn.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?s.length-1:0;r=s[a],!(e>0?a==0:a==s.length-1||r.top0?vn.before(this.dom):vn.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return ot.empty}get isHidden(){return!0}}Ri.prototype.children=Js.prototype.children=wo.prototype.children=pp;function CS(n,e){let t=n.dom,{children:i}=n,s=0;for(let r=0;sr&&e0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r0&&e instanceof qi&&s.length&&(i=s[s.length-1])instanceof qi&&i.mark.eq(e.mark)?RS(i,e.children[0],t-1):(s.push(e),e.setParent(n)),n.length+=e.length}function kS(n,e,t){let i=null,s=-1,r=null,o=-1;function a(c,h){for(let u=0,f=0;u=h&&(d.children.length?a(d,h-f):(!r||r.isHidden&&t>0)&&(g>h||f==g&&d.getSide()>0)?(r=d,o=h-f):(f-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return!1;for(let r of i)if(r!=t&&(s.indexOf(r)==-1||n[r]!==e[r]))return!1;return!0}function Yf(n,e,t){let i=null;if(e)for(let s in e)t&&s in t||n.removeAttribute(i=s);if(t)for(let s in t)e&&e[s]==t[s]||n.setAttribute(i=s,t[s]);return!!i}function RR(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new Ps(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=LS(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Ps(e,i,s,t,e.widget||null,!0)}static line(e){return new Ka(e)}static set(e,t=!1){return lt.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ie.none=lt.empty;class qa extends Ie{constructor(e){let{start:t,end:i}=LS(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof qa&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&mp(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}qa.prototype.point=!1;class Ka extends Ie{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ka&&this.spec.class==e.spec.class&&mp(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Ka.prototype.mapMode=Kt.TrackBefore;Ka.prototype.point=!0;class Ps extends Ie{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?Kt.TrackBefore:Kt.TrackAfter:Kt.TrackDel}get type(){return this.startSide=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ps&&kR(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Ps.prototype.point=!0;function LS(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function kR(n,e){return n==e||!!(n&&e&&n.compare(e))}function jf(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class pn extends ut{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,r,o){if(i){if(!(i instanceof pn))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),TS(this,e,t,i?i.children:[],r,o),!0}split(e){let t=new pn;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){mp(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){RS(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Hf(t,this.attrs||{})),i&&(this.attrs=Hf({class:i},this.attrs||{}))}domAtPos(e){return CS(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(yS(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Yf(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let s=this.dom.lastChild;for(;s&&ut.get(s)instanceof qi;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((i=ut.get(s))===null||i===void 0?void 0:i.isEditable)==!1&&(!Le.ios||!this.children.some(r=>r instanceof Ri))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof Ri)||/[^ -~]/.test(i.text))return null;let s=bo(i.dom);if(s.length!=1)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=kS(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight=t){if(r instanceof pn)return r;if(o>t)break}s=o+r.breakAfter}return null}}class lr extends ut{constructor(e,t,i){super(),this.widget=e,this.length=t,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,s,r,o){return i&&(!(i instanceof lr)||!this.widget.compare(i.widget)||e>0&&r<=0||t0;){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Bl(new Ri(this.text.slice(this.textOff,this.textOff+s)),t),i),this.atCursorPos=!0,this.textOff+=s,e-=s,i=0}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof Ps){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=t-e;if(i instanceof Ps)if(i.block){let{type:l}=i;l==_t.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new lr(i.widget||new T0("div"),a,l))}else{let l=Js.create(i.widget||new T0("span"),a,a?0:i.startSide),c=this.atCursorPos&&!l.isEditable&&r<=s.length&&(e0),h=!l.isEditable&&(es.length||i.startSide<=0),u=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),c&&(u.append(Bl(new wo(1),s),r),r=s.length+Math.max(0,r-s.length)),u.append(Bl(l,s),r),this.atCursorPos=h,this.pendingBuffer=h?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,i,s,r){let o=new pa(e,t,i,r);return o.openEnd=lt.spans(s,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Bl(n,e){for(let t of e)n=new qi(t,[n],n.length);return n}class T0 extends ns{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const DS=Ce.define(),US=Ce.define(),IS=Ce.define(),QS=Ce.define(),qf=Ce.define(),NS=Ce.define(),$S=Ce.define(),FS=Ce.define({combine:n=>n.some(e=>e)}),BS=Ce.define({combine:n=>n.some(e=>e)});class Vc{constructor(e,t="nearest",i="nearest",s=5,r=5){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r}map(e){return e.empty?this:new Vc(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const E0=Xe.define({map:(n,e)=>n.map(e)});function Wn(n,e,t){let i=n.facet(QS);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const Ih=Ce.define({combine:n=>n.length?n[0]:!0});let LR=0;const na=Ce.define();class Dt{constructor(e,t,i,s){this.id=e,this.create=t,this.domEventHandlers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:i,provide:s,decorations:r}=t||{};return new Dt(LR++,e,i,o=>{let a=[na.of(o)];return r&&a.push(Ra.of(l=>{let c=l.plugin(o);return c?r(c):Ie.none})),s&&a.push(s(o)),a})}static fromClass(e,t){return Dt.define(i=>new e(i),t)}}class Nu{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Wn(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){Wn(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Wn(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const XS=Ce.define(),gp=Ce.define(),Ra=Ce.define(),Op=Ce.define(),zS=Ce.define();function VS(n){let e=0,t=0,i=0,s=0;for(let r of n.state.facet(zS)){let o=r(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:i,bottom:s}}const ia=Ce.define();class Gn{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Gn(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAh)break;r+=2}if(!l)return i;new Gn(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),o=l.toA,a=l.toB}}}class Wc{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=Ut.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,a,l)=>s.push(new Gn(r,o,a,l))),this.changedRanges=s}static create(e,t,i){return new Wc(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}var St=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(St||(St={}));const Kf=St.LTR,DR=St.RTL;function WS(n){let e=[];for(let t=0;t=t){if(a.level==i)return o;(r<0||(s!=0?s<0?a.fromt:e[r].level>a.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}const xt=[];function $R(n,e){let t=n.length,i=e==Kf?1:2,s=e==Kf?2:1;if(!n||i==1&&!NR.test(n))return GS(t);for(let o=0,a=i,l=i;o=0;f-=3)if(di[f+1]==-h){let d=di[f+2],g=d&2?i:d&4?d&1?s:i:0;g&&(xt[o]=xt[di[f]]=g),a=f;break}}else{if(di.length==189)break;di[a++]=o,di[a++]=c,di[a++]=l}else if((u=xt[o])==2||u==1){let f=u==i;l=f?0:1;for(let d=a-3;d>=0;d-=3){let g=di[d+2];if(g&2)break;if(f)di[d+2]|=2;else{if(g&4)break;di[d+2]|=4}}}for(let o=0;oa;){let h=c,u=xt[--c]!=2;for(;c>a&&u==(xt[c-1]!=2);)c--;r.push(new lo(c,h,u?2:1))}else r.push(new lo(a,o,0))}else for(let o=0;o0&&t.length&&(t.every(({fromA:a,toA:l})=>lthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let i=this.view.inputState.composing<0?null:XR(this.view,e.changes);if(this.hasComposition){this.markedForComposition.clear();let{from:a,to:l}=this.hasComposition;t=new Gn(a,l,e.changes.mapPos(a,-1),e.changes.mapPos(l,1)).addToSet(t.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Le.ie||Le.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,r=this.updateDeco(),o=WR(s,r,e.changes);return t=Gn.extendWithRanges(t,o),!(this.flags&7)&&t.length==0?!1:(this.updateInner(t,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=Le.chrome||Le.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||s.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to=0?s[o]:null;if(!a)break;let{fromA:l,toA:c,fromB:h,toB:u}=a,f,d,g,O;if(i&&i.range.fromBh){let x=pa.build(this.view.state.doc,h,i.range.fromB,this.decorations,this.dynamicDecorationMap),w=pa.build(this.view.state.doc,i.range.toB,u,this.decorations,this.dynamicDecorationMap);d=x.breakAtStart,g=x.openStart,O=w.openEnd;let T=this.compositionView(i);w.breakAtStart?T.breakAfter=1:w.content.length&&T.merge(T.length,T.length,w.content[0],!1,w.openStart,0)&&(T.breakAfter=w.content[0].breakAfter,w.content.shift()),x.content.length&&T.merge(0,0,x.content[x.content.length-1],!0,0,x.openEnd)&&x.content.pop(),f=x.content.concat(T).concat(w.content)}else({content:f,breakAtStart:d,openStart:g,openEnd:O}=pa.build(this.view.state.doc,h,u,this.decorations,this.dynamicDecorationMap));let{i:m,off:p}=r.findPos(c,1),{i:y,off:S}=r.findPos(l,-1);MS(this,y,S,m,p,f,d,g,O)}i&&this.fixCompositionDOM(i)}compositionView(e){let t=new Ri(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new qi(s,[t],t.length);let i=new pn;return i.append(t,0),i}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8,this.markedForComposition.add(o);let a=ut.get(r);a!=o&&(a&&(a.dom=null),o.setDOM(r))},i=this.childPos(e.range.fromB,1),s=this.children[i.i];t(e.line,s);for(let r=e.marks.length-1;r>=-1;r--)i=s.childPos(i.off,1),s=s.children[i.i],t(r>=0?e.marks[r].node:e.text,s)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom,r=!s&&mc(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.domAtPos(a.anchor),c=a.empty?l:this.domAtPos(a.head);if(Le.gecko&&a.empty&&!this.hasComposition&&BR(l)){let u=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(u,l.node.childNodes[l.offset]||null)),l=c=new vn(u,0),o=!0}let h=this.view.observer.selectionRange;(o||!h.focusNode||!Xc(l.node,l.offset,h.anchorNode,h.anchorOffset)||!Xc(c.node,c.offset,h.focusNode,h.focusOffset))&&(this.view.observer.ignore(()=>{Le.android&&Le.chrome&&this.dom.contains(h.focusNode)&&GR(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let u=Bc(this.view.root);if(u)if(a.empty){if(Le.gecko){let f=zR(l.node,l.offset);if(f&&f!=3){let d=YS(l.node,l.offset,f==1?1:-1);d&&(l=new vn(d,f==1?0:d.nodeValue.length))}}u.collapse(l.node,l.offset),a.bidiLevel!=null&&h.cursorBidiLevel!=null&&(h.cursorBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(l.node,l.offset);try{u.extend(c.node,c.offset)}catch{}}else{let f=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),f.setEnd(c.node,c.offset),f.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(f)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new vn(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new vn(h.focusNode,h.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=Bc(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=pn.find(this,t.head);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let h=this.domAtPos(t.head+t.assoc);i.collapse(h.node,h.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&i.collapse(s,r)}nearest(e){for(let t=e;t;){let i=ut.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;to||e==o&&r.type!=_t.WidgetBefore&&r.type!=_t.WidgetAfter&&(!s||t==2||this.children[s-1].breakAfter||this.children[s-1].type==_t.WidgetBefore&&t>-2))return r.coordsAt(e-o,t);i=o}}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),s=this.children[t];if(!(s instanceof pn))return null;for(;s.children.length;){let{i:a,off:l}=s.childPos(i,1);for(;;a++){if(a==s.children.length)return null;if((s=s.children[a]).length)break}i=l}if(!(s instanceof Ri))return null;let r=rn(s.text,i);if(r==i)return null;let o=mr(s.dom,i,r).getClientRects();return!o.length||o[0].top>=o[0].bottom?null:o[0]}measureVisibleLineHeights(e){let t=[],{from:i,to:s}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==St.LTR;for(let c=0,h=0;hs)break;if(c>=i){let d=u.dom.getBoundingClientRect();if(t.push(d.height),o){let g=u.dom.lastChild,O=g?bo(g):[];if(O.length){let m=O[O.length-1],p=l?m.right-d.left:d.right-m.left;p>a&&(a=p,this.minWidth=r,this.minWidthFrom=c,this.minWidthTo=f)}}}c=f+u.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?St.RTL:St.LTR}measureTextSize(){for(let r of this.children)if(r instanceof pn){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=bo(e.firstChild)[0];t=e.getBoundingClientRect().height,i=r?r.width/27:7,s=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:s}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new wS(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>i){let a=t.lineBlockAt(o).bottom-t.lineBlockAt(i).top;e.push(Ie.replace({widget:new P0(a),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return Ie.set(e)}updateDeco(){let e=this.view.state.facet(Ra).map((t,i)=>(this.dynamicDecorationMap[i]=typeof t=="function")?t(this.view):t);for(let t=e.length;tt.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=VS(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom};bR(this.view.scrollDOM,o,t.head-1)return null;o+=u.text.length}if(a=a.parentNode,!a)return null;let l=ut.get(a);if(l){s=r=l.posAtStart+o;break}}return{from:s,to:r,node:t}}function XR(n,e){let t=HS(n);if(!t)return null;let{from:i,to:s,node:r}=t,o=e.mapPos(i,-1),a=e.mapPos(s,1),l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(a-o!=l.length){let f=e.mapPos(i,1),d=e.mapPos(s,-1);if(d-f==l.length)o=f,a=d;else if(n.state.doc.sliceString(a-l.length,a)==l)o=a-l.length;else if(n.state.doc.sliceString(o,o+l.length)==l)a=o+l.length;else return null}let{main:c}=n.state.selection;if(n.state.doc.sliceString(o,a)!=l||o>c.head||a0)i=i.childNodes[s-1],s=As(i);else break}if(t>=0)for(let i=n,s=e;;){if(i.nodeType==3)return i;if(i.nodeType==1&&s=0)i=i.childNodes[s],s=0;else break}return null}function zR(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e0;){let c=rn(s.text,o,!1);if(i(s.text.slice(c,o))!=l)break;o=c}for(;an?e.left-n:Math.max(0,n-e.right)}function YR(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function $u(n,e){return n.tope.top+1}function C0(n,e){return en.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function ed(n,e,t){let i,s,r,o,a=!1,l,c,h,u;for(let g=n.firstChild;g;g=g.nextSibling){let O=bo(g);for(let m=0;mS||o==S&&r>y){i=g,s=p,r=y,o=S;let x=S?t0?m0)}y==0?t>p.bottom&&(!h||h.bottomp.top)&&(c=g,u=p):h&&$u(h,p)?h=R0(h,p.bottom):u&&$u(u,p)&&(u=C0(u,p.top))}}if(h&&h.bottom>=t?(i=l,s=h):u&&u.top<=t&&(i=c,s=u),!i)return{node:n,offset:0};let f=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return k0(i,f,t);if(a&&i.contentEditable!="false")return ed(i,f,t);let d=Array.prototype.indexOf.call(n.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:n,offset:d}}function k0(n,e,t){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;at?h.top-t:t-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&u=(h.left+h.right)/2,d=f;if((Le.chrome||Le.gecko)&&mr(n,a).getBoundingClientRect().left==h.right&&(d=!f),u<=0)return{node:n,offset:a+(d?1:0)};s=a+(d?1:0),r=u}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function jS(n,e,t,i=-1){var s,r;let o=n.contentDOM.getBoundingClientRect(),a=o.top+n.viewState.paddingTop,l,{docHeight:c}=n.viewState,{x:h,y:u}=e,f=u-a;if(f<0)return 0;if(f>c)return n.state.doc.length;for(let x=n.viewState.heightOracle.textHeight/2,w=!1;l=n.elementAtHeight(f),l.type!=_t.Text;)for(;f=i>0?l.bottom+x:l.top-x,!(f>=0&&f<=c);){if(w)return t?null:0;w=!0,i=-i}u=a+f;let d=l.from;if(dn.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:t?null:L0(n,o,l,h,u);let g=n.dom.ownerDocument,O=n.root.elementFromPoint?n.root:g,m=O.elementFromPoint(h,u);m&&!n.contentDOM.contains(m)&&(m=null),m||(h=Math.max(o.left+1,Math.min(o.right-1,h)),m=O.elementFromPoint(h,u),m&&!n.contentDOM.contains(m)&&(m=null));let p,y=-1;if(m&&((s=n.docView.nearest(m))===null||s===void 0?void 0:s.isEditable)!=!1){if(g.caretPositionFromPoint){let x=g.caretPositionFromPoint(h,u);x&&({offsetNode:p,offset:y}=x)}else if(g.caretRangeFromPoint){let x=g.caretRangeFromPoint(h,u);x&&({startContainer:p,startOffset:y}=x,(!n.contentDOM.contains(p)||Le.safari&&jR(p,y,h)||Le.chrome&&qR(p,y,h))&&(p=void 0))}}if(!p||!n.docView.dom.contains(p)){let x=pn.find(n.docView,d);if(!x)return f>l.top+l.height/2?l.to:l.from;({node:p,offset:y}=ed(x.dom,h,u))}let S=n.docView.nearest(p);if(!S)return null;if(S.isWidget&&((r=S.dom)===null||r===void 0?void 0:r.nodeType)==1){let x=S.dom.getBoundingClientRect();return e.yn.defaultLineHeight*1.5){let a=n.viewState.heightOracle.textHeight,l=Math.floor((s-t.top-(n.defaultLineHeight-a)*.5)/a);r+=l*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+Bf(o,r,n.state.tabSize)}function jR(n,e,t){let i;if(n.nodeType!=3||e!=(i=n.nodeValue.length))return!1;for(let s=n.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return mr(n,i-1,i).getBoundingClientRect().left>t}function qR(n,e,t){if(e!=0)return!1;for(let s=n;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let i=n.nodeType==1?n.getBoundingClientRect():mr(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function td(n,e){let t=n.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==_t.Text))return i}return t}function KR(n,e,t,i){let s=td(n,e.head),r=!i||s.type!=_t.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=n.dom.getBoundingClientRect(),a=n.textDirectionAt(s.from),l=n.posAtCoords({x:t==(a==St.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(l!=null)return re.cursor(l,t?-1:1)}return re.cursor(t?s.to:s.from,t?-1:1)}function D0(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let a=e,l=null;;){let c=FR(s,r,o,a,t),h=ZS;if(!c){if(s.number==(t?n.state.doc.lines:1))return a;h=` +`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),c=re.cursor(t?s.from:s.to)}if(l){if(!l(h))return a}else{if(!i)return c;l=i(h)}a=c}}function JR(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==vt.Space&&(s=o),s==o}}function e3(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return re.cursor(s,e.assoc);let o=e.goalColumn,a,l=n.contentDOM.getBoundingClientRect(),c=n.coordsAtPos(s),h=n.documentTop;if(c)o==null&&(o=c.left-l.left),a=r<0?c.top:c.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,n.defaultCharacterWidth*(s-d.from))),a=(r<0?d.top:d.bottom)+h}let u=l.left+o,f=i??n.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let g=a+(f+d)*r,O=jS(n,{x:u,y:g},!1,r);if(gl.bottom||(r<0?Os))return re.cursor(O,e.assoc,void 0,o)}}function gc(n,e,t){for(;;){let i=0;for(let s of n)s.between(e-1,e+1,(r,o,a)=>{if(e>r&&es(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:re.cursor(i,i{this.ignoreDuringComposition(s)||s.type=="keydown"&&this.keydown(e,s)||(this.mustFlushObserver(s)&&e.observer.forceFlush(),this.runCustomHandlers(s.type,e,s)?s.preventDefault():i(e,s))};for(let i in Rt){let s=Rt[i];e.contentDOM.addEventListener(i,r=>{U0(e,r)&&t(s,r)},nd[i]),this.registeredEvents.push(i)}e.scrollDOM.addEventListener("mousedown",i=>{if(i.target==e.scrollDOM&&i.clientY>e.contentDOM.getBoundingClientRect().bottom&&(t(Rt.mousedown,i),!i.defaultPrevented&&i.button==2)){let s=e.contentDOM.style.minHeight;e.contentDOM.style.minHeight="100%",setTimeout(()=>e.contentDOM.style.minHeight=s,200)}}),e.scrollDOM.addEventListener("drop",i=>{i.target==e.scrollDOM&&i.clientY>e.contentDOM.getBoundingClientRect().bottom&&t(Rt.drop,i)}),Le.chrome&&Le.chrome_version==102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,Le.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,t){var i;let s;this.customHandlers=[];for(let r of t)if(s=(i=r.update(e).spec)===null||i===void 0?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:s});for(let o in s)this.registeredEvents.indexOf(o)<0&&o!="scroll"&&(this.registeredEvents.push(o),e.contentDOM.addEventListener(o,a=>{U0(e,a)&&this.runCustomHandlers(o,e,a)&&a.preventDefault()}))}}runCustomHandlers(e,t,i){for(let s of this.customHandlers){let r=s.handlers[e];if(r)try{if(r.call(s.plugin,i,t)||i.defaultPrevented)return!0}catch(o){Wn(t.state,o)}}return!1}runScrollHandlers(e,t){this.lastScrollTop=e.scrollDOM.scrollTop,this.lastScrollLeft=e.scrollDOM.scrollLeft;for(let i of this.customHandlers){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,t,e)}catch(r){Wn(e.state,r)}}}keydown(e,t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()s.keyCode==t.keyCode))&&!t.ctrlKey||n3.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=i||t,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,ao(e.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:Le.safari&&!Le.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const qS=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],n3="dthko",KS=[16,17,18,20,91,92,224,225],Xl=6;function zl(n){return Math.max(0,n)*.7+8}function i3(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class s3{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=wR(e.contentDOM),this.atoms=e.state.facet(Op).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(tt.allowMultipleSelections)&&r3(e,t),this.dragging=a3(e,t)&&n_(t)==1?null:!1}start(e){this.dragging===!1&&(e.preventDefault(),this.select(e))}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&i3(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,s=0,r=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=VS(this.view);e.clientX-o.left<=r.left+Xl?i=-zl(r.left-e.clientX):e.clientX+o.right>=r.right-Xl&&(i=zl(e.clientX-r.right)),e.clientY-o.top<=r.top+Xl?s=-zl(r.top-e.clientY):e.clientY+o.bottom>=r.bottom-Xl&&(s=zl(e.clientY-r.bottom)),this.setScrollSpeed(i,s)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;ithis.select(this.lastEvent),20)}}function r3(n,e){let t=n.state.facet(DS);return t.length?t[0](e):Le.mac?e.metaKey:e.ctrlKey}function o3(n,e){let t=n.state.facet(US);return t.length?t[0](e):Le.mac?!e.altKey:!e.ctrlKey}function a3(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Bc(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function U0(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=ut.get(t))&&i.ignoreEvent(e))return!1;return!0}const Rt=Object.create(null),nd=Object.create(null),JS=Le.ie&&Le.ie_version<15||Le.ios&&Le.webkit_version<604;function l3(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),e_(n,t.value)},50)}function e_(n,e){let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(id!=null&&t.selection.ranges.every(l=>l.empty)&&id==r.toString()){let l=-1;i=t.changeByRange(c=>{let h=t.doc.lineAt(c.from);if(h.from==l)return{range:c};l=h.from;let u=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:u},range:re.cursor(c.from+u.length)}})}else o?i=t.changeByRange(l=>{let c=r.line(s++);return{changes:{from:l.from,to:l.to,insert:c.text},range:re.cursor(l.from+c.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Rt.keydown=(n,e)=>{n.inputState.setSelectionOrigin("select"),e.keyCode==27&&(n.inputState.lastEscPress=Date.now())};Rt.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};Rt.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};nd.touchstart=nd.touchmove={passive:!0};Rt.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return;let t=null;for(let i of n.state.facet(IS))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=u3(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new s3(n,e,t,i)),i&&n.observer.ignore(()=>_S(n.contentDOM)),n.inputState.mouseSelection&&n.inputState.mouseSelection.start(e)}};function I0(n,e,t,i){if(i==1)return re.cursor(e,t);if(i==2)return ZR(n.state,e,t);{let s=pn.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,a=s?s.posAtEnd:r.to;return an>=e.top&&n<=e.bottom,Q0=(n,e,t)=>t_(e,t)&&n>=t.left&&n<=t.right;function c3(n,e,t,i){let s=pn.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Q0(t,i,o))return-1;let a=s.coordsAt(r,1);return a&&Q0(t,i,a)?1:o&&t_(i,o)?-1:1}function N0(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:c3(n,t,e.clientX,e.clientY)}}const h3=Le.ie&&Le.ie_version<=11;let $0=null,F0=0,B0=0;function n_(n){if(!h3)return n.detail;let e=$0,t=B0;return $0=n,B0=Date.now(),F0=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(F0+1)%3:1}function u3(n,e){let t=N0(n,e),i=n_(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,a){let l=N0(n,r),c,h=I0(n,l.pos,l.bias,i);if(t.pos!=l.pos&&!o){let u=I0(n,t.pos,t.bias,i),f=Math.min(u.from,h.from),d=Math.max(u.to,h.to);h=f1&&(c=f3(s,l.pos))?c:a?s.addRange(h):re.create([h])}}}function f3(n,e){for(let t=0;t=e)return re.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Rt.dragstart=(n,e)=>{let{selection:{main:t}}=n.state,{mouseSelection:i}=n.inputState;i&&(i.dragging=t),e.dataTransfer&&(e.dataTransfer.setData("Text",n.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove")};function X0(n,e,t,i){if(!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:r}=n.inputState,o=i&&r&&r.dragging&&o3(n,e)?{from:r.dragging.from,to:r.dragging.to}:null,a={from:s,insert:t},l=n.state.changes(o?[o,a]:a);n.focus(),n.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Rt.drop=(n,e)=>{if(!e.dataTransfer)return;if(n.state.readOnly)return e.preventDefault();let t=e.dataTransfer.files;if(t&&t.length){e.preventDefault();let i=Array(t.length),s=0,r=()=>{++s==t.length&&X0(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(i[o]=a.result),r()},a.readAsText(t[o])}}else X0(n,e,e.dataTransfer.getData("Text"),!0)};Rt.paste=(n,e)=>{if(n.state.readOnly)return e.preventDefault();n.observer.flush();let t=JS?null:e.clipboardData;t?(e_(n,t.getData("text/plain")||t.getData("text/uri-text")),e.preventDefault()):l3(n)};function d3(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function p3(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:e.join(n.lineBreak),ranges:t,linewise:i}}let id=null;Rt.copy=Rt.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=p3(n.state);if(!t&&!s)return;id=s?t:null;let r=JS?null:e.clipboardData;r?(e.preventDefault(),r.clearData(),r.setData("text/plain",t)):d3(n,t),e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"})};const i_=ts.define();function s_(n,e){let t=[];for(let i of n.facet($S)){let s=i(n,e);s&&t.push(s)}return t?n.update({effects:t,annotations:i_.of(!0)}):null}function r_(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=s_(n.state,e);t?n.dispatch(t):n.update([])}},10)}Rt.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),r_(n)};Rt.blur=n=>{n.observer.clearSelectionRange(),r_(n)};Rt.compositionstart=Rt.compositionupdate=n=>{n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0)};Rt.compositionend=n=>{n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,Le.chrome&&Le.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50)};Rt.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Rt.beforeinput=(n,e)=>{var t;let i;if(Le.chrome&&Le.android&&(i=qS.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var r;(((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}};const z0=["pre-wrap","normal","pre-line","break-spaces"];class m3{constructor(e){this.lineWrapping=e,this.doc=ot.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return z0.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,l){this.heightSamples={};for(let c=0;c0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>Oc&&(e.heightChanged=!0),this.height=t)}replace(e,t,i){return xn.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:h,toB:u}=s[a],f=r.lineAt(l,mt.ByPosNoHeight,i.setDoc(t),0,0),d=f.to>=c?f:r.lineAt(c,mt.ByPosNoHeight,i,0,0);for(u+=d.to-c,c=d.to;a>0&&f.from<=s[a-1].toA;)l=s[a-1].fromA,h=s[a-1].fromB,a--,lr*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),i+=1+a.break,s-=a.size}else if(r>s*2){let a=e[i];a.break?e.splice(i,1,a.left,null,a.right):e.splice(i,1,a.left,a.right),i+=2+a.break,r-=a.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(e,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Dn extends o_{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,s){return new yi(s,this.length,i,this.height,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof Dn||s instanceof Yt&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof Yt?s=new Dn(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):xn.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(e,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Yt extends xn{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*r);o=l/r,this.length>r+1&&(a=(this.height-l)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:a}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,s);if(t.lineWrapping){let c=s+Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length),h=t.doc.lineAt(c),u=a+h.length*l,f=Math.max(i,e-u/2);return new yi(h.from,h.length,f,u,0)}else{let c=Math.max(0,Math.min(o-r,Math.floor((e-i)/a))),{from:h,length:u}=t.doc.line(r+c);return new yi(h,u,i+a*c,a,0)}}lineAt(e,t,i,s,r){if(t==mt.ByHeight)return this.blockAt(e,i,s,r);if(t==mt.ByPosNoHeight){let{from:d,to:g}=i.doc.lineAt(e);return new yi(d,g-d,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(i,r),c=i.doc.lineAt(e),h=a+c.length*l,u=c.number-o,f=s+a*u+l*(c.from-r-u);return new yi(c.from,c.length,Math.max(s,Math.min(f,s+this.height-h)),h,0)}forEachLine(e,t,i,s,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(i,r);for(let h=e,u=s;h<=t;){let f=i.doc.lineAt(h);if(h==e){let g=f.number-a;u+=l*g+c*(e-r-g)}let d=l+c*f.length;o(new yi(f.from,f.length,u,d,0)),u+=d,h=f.to+1}}replace(e,t,i){let s=this.length-t;if(s>0){let r=i[i.length-1];r instanceof Yt?i[i.length-1]=new Yt(r.length+s):i.push(null,new Yt(s-1))}if(e>0){let r=i[0];r instanceof Yt?i[0]=new Yt(e+r.length):i.unshift(new Yt(e-1),null)}return xn.of(i)}decomposeLeft(e,t){t.push(new Yt(e-1),null)}decomposeRight(e,t){t.push(null,new Yt(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],a=Math.max(t,s.from),l=-1;for(s.from>t&&o.push(new Yt(s.from-t-1).updateHeight(e,t));a<=r&&s.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let u=s.heights[s.index++];l==-1?l=u:Math.abs(u-l)>=Oc&&(l=-2);let f=new Dn(h,u);f.outdated=!1,o.push(f),a+=h+1}a<=r&&o.push(null,new Yt(r-a).updateHeight(e,a));let c=xn.of(o);return(l<0||Math.abs(c.height-this.height)>=Oc||Math.abs(l-this.heightMetrics(e,t).perLine)>=Oc)&&(e.heightChanged=!0),c}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class O3 extends xn{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return ea))return c;let h=t==mt.ByPosNoHeight?mt.ByPosNoHeight:mt.ByPos;return l?c.join(this.right.lineAt(a,h,i,o,a)):this.left.lineAt(a,h,i,s,r).join(c)}forEachLine(e,t,i,s,r,o){let a=s+this.left.height,l=r+this.left.length+this.break;if(this.break)e=l&&this.right.forEachLine(e,t,i,a,l,o);else{let c=this.lineAt(l,mt.ByPos,i,s,r);e=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,i,a,l,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let a of i)r.push(a);if(e>0&&V0(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?xn.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,a=t+r.length+this.break,l=null;return s&&s.from<=t+r.length&&s.more?l=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(e,a,i,s):o.updateHeight(e,a,i),l?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function V0(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof Yt&&(i=n[e+1])instanceof Yt&&n.splice(e-1,3,new Yt(t.length+1+i.length))}const v3=5;class vp{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Dn?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Dn(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=v3)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Dn(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new Yt(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Dn)return e;let t=new Dn(0,-1);return this.nodes.push(t),t}addBlock(e){var t;this.enterLine();let i=(t=e.deco)===null||t===void 0?void 0:t.type;i==_t.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,i!=_t.WidgetBefore&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Dn)&&!this.isCovered?this.nodes.push(new Dn(0,-1)):(this.writtenToh.clientHeight||h.scrollWidth>h.clientWidth)&&u.overflow!="visible"){let f=h.getBoundingClientRect();r=Math.max(r,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=c==n.parentNode?f.bottom:Math.min(l,f.bottom)}c=u.position=="absolute"||u.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function y3(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Bu{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new m3(t),this.stateDeco=e.facet(Ra).filter(i=>typeof i!="function"),this.heightMap=xn.empty().applyChanges(this.stateDeco,ot.empty,this.heightOracle.setDoc(e.doc),[new Gn(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ie.set(this.lineGaps.map(i=>i.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new Vl(r,o))}}this.viewports=e.sort((i,s)=>i.from-s.from),this.scaler=this.heightMap.height<=7e6?G0:new T3(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:sa(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Ra).filter(h=>typeof h!="function");let s=e.changedRanges,r=Gn.extendWithRanges(s,x3(i,this.stateDeco,e?e.changes:Ut.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),c&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(BS)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?St.RTL:St.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,h=0,u=parseInt(i.paddingTop)||0,f=parseInt(i.paddingBottom)||0;(this.paddingTop!=u||this.paddingBottom!=f)&&(this.paddingTop=u,this.paddingBottom=f,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8),this.scrollTop!=e.scrollDOM.scrollTop&&(this.scrollAnchorHeight=-1,this.scrollTop=e.scrollDOM.scrollTop),this.scrolledToBottom=bS(e.scrollDOM);let d=(this.printing?y3:_3)(t,this.paddingTop),g=d.top-this.pixelViewport.top,O=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let p=a.width;if((this.contentDOMWidth!=p||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let S=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(S)&&(o=!0),o||s.lineWrapping&&Math.abs(p-this.contentDOMWidth)>s.charWidth){let{lineHeight:x,charWidth:w,textHeight:T}=e.docView.measureTextSize();o=x>0&&s.refresh(r,x,w,T,p/w,S),o&&(e.docView.minWidth=0,c|=8)}g>0&&O>0?h=Math.max(g,O):g<0&&O<0&&(h=Math.min(g,O)),s.heightChanged=!1;for(let x of this.viewports){let w=x.from==this.viewport.from?S:e.docView.measureVisibleLineHeights(x);this.heightMap=(o?xn.empty().applyChanges(this.stateDeco,ot.empty,this.heightOracle,[new Gn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new g3(x.from,w))}s.heightChanged&&(c|=2)}let y=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return y&&(this.viewport=this.getViewport(h,this.scrollTarget)),this.updateForViewport(),(c&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Vl(s.lineAt(o-i*1e3,mt.ByHeight,r,0,0).from,s.lineAt(a+(1-i)*1e3,mt.ByHeight,r,0,0).to);if(t){let{head:c}=t.range;if(cl.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=s.lineAt(c,mt.ByPos,r,0,0),f;t.y=="center"?f=(u.top+u.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&c=a+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=St.LTR&&!i)return[];let a=[],l=(c,h,u,f)=>{if(h-cc&&mm.from>=u.from&&m.to<=u.to&&Math.abs(m.from-c)m.fromp));if(!O){if(hm.from<=h&&m.to>=h)){let m=t.moveToLineBoundary(re.cursor(h),!1,!0).head;m>c&&(h=m)}O=new Bu(c,h,this.gapSize(u,c,h,f))}a.push(O)};for(let c of this.viewportLines){if(c.lengthc.from&&l(c.from,f,c,h),dt.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];lt.spans(e,this.viewport.from,this.viewport.to,{span(s,r){t.push({from:s,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=t[r].from||s.to!=t[r].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||sa(this.heightMap.lineAt(e,mt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return sa(this.heightMap.lineAt(this.scaler.fromDOM(e),mt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return sa(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Vl{constructor(e,t){this.from=e,this.to=t}}function w3(n,e,t){let i=[],s=n,r=0;return lt.spans(t,n,e,{span(){},point(o,a){o>s&&(i.push({from:s,to:o}),r+=o-s),s=a}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],a=o-r;if(i<=a)return r+i;i-=a}}function Gl(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function M3(n,e){for(let t of n)if(e(t))return t}const G0={toDOM(n){return n},fromDOM(n){return n},scale:1};class T3{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:a,to:l})=>{let c=t.lineAt(a,mt.ByPos,e,0,0).top,h=t.lineAt(l,mt.ByPos,e,0,0).bottom;return s+=h-c,{from:a,to:l,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let a of this.viewports)a.domTop=o+(a.top-r)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),r=a.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tsa(s,e)):n._content)}const Zl=Ce.define({combine:n=>n.join(" ")}),sd=Ce.define({combine:n=>n.indexOf(!0)>-1}),rd=Ts.newName(),a_=Ts.newName(),l_=Ts.newName(),c_={"&light":"."+a_,"&dark":"."+l_};function od(n,e,t){return new Ts(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const E3=od("."+rd,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},c_);class A3{constructor(e,t,i,s){this.typeOver=s,this.bounds=null,this.text="";let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let a=r||o?[]:C3(e),l=new ES(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=R3(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=r&&r.node==a.focusNode&&r.offset==a.focusOffset||!Vf(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Vf(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset);this.newSel=re.single(c,l)}}}function h_(n,e){let t,{newSel:i}=e,s=n.state.selection.main,r=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=s.from,c=null;(r===8||Le.android&&e.text.length=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,s.to))}:(Le.mac||Le.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=re.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:ot.of([" "])}):Le.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` + `&&n.lineWrapping&&(i&&(i=re.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:ot.of([" "])}),t){let o=n.state;if(Le.ios&&n.inputState.flushIOSKey(n)||Le.android&&(t.from==s.from&&t.to==s.to&&t.insert.length==1&&t.insert.lines==2&&ao(n.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||r==8&&t.insert.lengthh(n,t.from,t.to,a)))return!0;n.inputState.composing>=0&&n.inputState.composing++;let l;if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!i||i.main.empty&&i.main.from==t.from+t.insert.length)&&n.inputState.composing<0){let h=s.fromt.to?o.sliceDoc(t.to,s.to):"";l=o.replaceSelection(n.state.toText(h+t.insert.sliceString(0,void 0,n.state.lineBreak)+u))}else{let h=o.changes(t),u=i&&i.main.to<=h.newLength?i.main:void 0;if(o.selection.ranges.length>1&&n.inputState.composing>=0&&t.to<=s.to&&t.to>=s.to-10){let f=n.state.sliceDoc(t.from,t.to),d=HS(n)||n.state.doc.lineAt(s.head),g=s.to-t.to,O=s.to-s.from;l=o.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:h,range:u||m.map(h)};let p=m.to-g,y=p-f.length;if(m.to-m.from!=O||n.state.sliceDoc(y,p)!=f||d&&m.to>=d.from&&m.from<=d.to)return{range:m};let S=o.changes({from:y,to:p,insert:t.insert}),x=m.to-s.to;return{changes:S,range:u?re.range(Math.max(0,u.anchor+x),Math.max(0,u.head+x)):m.map(S)}})}else l={changes:h,selection:u&&o.selection.replaceRange(u)}}let c="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,c+=".compose",n.inputState.compositionFirstChange&&(c+=".start",n.inputState.compositionFirstChange=!1)),n.dispatch(l,{scrollIntoView:!0,userEvent:c}),!0}else if(i&&!i.main.eq(s)){let o=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),a=n.inputState.lastSelectionOrigin),n.dispatch({selection:i,scrollIntoView:o,userEvent:a}),!0}else return!1}function P3(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&a>0&&n.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(i=="end"){let l=Math.max(0,r-Math.min(o,a));t-=o+l-r}if(o=o?r-t:0;r-=l,a=r+(a-o),o=r}else if(a=a?r-t:0;r-=l,o=r+(o-a),a=r}return{from:r,toA:o,toB:a}}function C3(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new _0(t,i)),(s!=t||r!=i)&&e.push(new _0(s,r))),e}function R3(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?re.single(t+e,i+e):null}const k3={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xu=Le.ie&&Le.ie_version<=11;class L3{constructor(e){this.view=e,this.active=!1,this.selectionRange=new MR,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(Le.ie&&Le.ie_version<=11||Le.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Xu&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)this.view.requestMeasure()),this.resizeContent.observe(e.contentDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runScrollHandlers(this.view,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(Ih)?i.root.activeElement!=this.dom:!mc(i.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Le.ie&&Le.ie_version<=11||Le.android&&Le.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Xc(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Le.safari&&e.root.nodeType==11&&_R(this.dom.ownerDocument)==this.dom&&D3(this.view)||Bc(e.root);if(!t||this.selectionRange.eq(t))return!1;let i=mc(this.dom,t);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&ao(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&mc(this.dom,this.selectionRange);return e<0&&!s?null:(e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new A3(this.view,e,t,i))}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return!1;let i=this.view.state,s=h_(this.view,t);return this.view.state==i&&this.view.update([]),s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let i=Z0(t,e.previousSibling||e.target.previousSibling,-1),s=Z0(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,i,s;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect(),(s=this.resizeContent)===null||s===void 0||s.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Z0(n,e,t){for(;e;){let i=ut.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function D3(n){let e=null;function t(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}if(n.contentDOM.addEventListener("beforeinput",t,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let i=e.startContainer,s=e.startOffset,r=e.endContainer,o=e.endOffset,a=n.docView.domAtPos(n.state.selection.main.anchor);return Xc(a.node,a.offset,r,o)&&([i,s,r,o]=[r,o,i,s]),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:o}}class Ee{constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=e.dispatch||(t=>this.update([t])),this.dispatch=this.dispatch.bind(this),this._root=e.root||TR(e.parent)||document,this.viewState=new W0(e.state||tt.create(e)),this.plugins=this.state.facet(na).map(t=>new Nu(t));for(let t of this.plugins)t.update(this);this.observer=new L3(this),this.inputState=new t3(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new A0(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...e){let t=e.length==1&&e[0]instanceof Nt?e[0]:this.state.update(...e);this._dispatch(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let f of e){if(f.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=f.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(i_))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=s_(r,o),l||(a=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(h=null)):this.observer.clear(),r.facet(tt.phrases)!=this.state.facet(tt.phrases))return this.setState(r);s=Wc.create(this,r,e),s.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(u&&(u=u.map(f.changes)),f.scrollIntoView){let{main:d}=f.state.selection;u=new Vc(d.empty?d:re.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of f.effects)d.is(E0)&&(u=d.value)}this.viewState.update(s,u),this.bidiCache=Gc.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(ia)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Zl)!=s.state.facet(Zl)&&(this.viewState.mustMeasureContent=!0),(t||i||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!s.empty)for(let f of this.state.facet(qf))f(s);(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!h_(this,h)&&c.force&&ao(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new W0(e),this.plugins=e.facet(na).map(i=>new Nu(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView=new A0(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(na),i=e.state.facet(na);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new Nu(r));else{let a=this.plugins[o];a.mustUpdate=e,s.push(a)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,{scrollTop:s}=i,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;s!=this.viewState.scrollTop&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(bS(i))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(d=>{try{return d.read(this)}catch(g){return Wn(this.state,g),H0}}),u=Wc.create(this,this.state,[]),f=!1;u.flags|=l,t?t.flags|=l:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),f=this.docView.update(u));for(let d=0;d1||g<-1){s=i.scrollTop=s+g,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(qf))a(t)}get themeClasses(){return rd+" "+(this.state.facet(sd)?l_:a_)+" "+this.state.facet(Zl)}updateAttrs(){let e=Y0(this,XS,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Ih)?"true":"false",class:"cm-content",style:`${Le.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Y0(this,gp,t);let i=this.observer.ignore(()=>{let s=Yf(this.contentDOM,this.contentAttrs,t),r=Yf(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(Ee.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(ia),Ts.mount(this.root,this.styleModules.concat(E3).reverse())}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Fu(this,e,D0(this,e,t,i))}moveByGroup(e,t){return Fu(this,e,D0(this,e,t,i=>JR(this,e.head,i)))}moveToLineBoundary(e,t,i=!0){return KR(this,e,t,i)}moveVertically(e,t,i){return Fu(this,e,e3(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),jS(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[lo.find(r,e-s.from,-1,t)];return Dh(i,o.dir==St.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(FS)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>U3)return GS(e.length);let t=this.textDirectionAt(e.from);for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t)return s.order;let i=$R(e.text,t);return this.bidiCache.push(new Gc(e.from,e.to,t,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Le.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{_S(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return E0.of(new Vc(typeof e=="number"?re.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return Dt.define(()=>({}),{eventHandlers:e})}static theme(e,t){let i=Ts.newName(),s=[Zl.of(i),ia.of(od(`.${i}`,e))];return t&&t.dark&&s.push(sd.of(!0)),s}static baseTheme(e){return xr.lowest(ia.of(od("."+rd,e,c_)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&ut.get(i)||ut.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}Ee.styleModule=ia;Ee.inputHandler=NS;Ee.focusChangeEffect=$S;Ee.perLineTextDirection=FS;Ee.exceptionSink=QS;Ee.updateListener=qf;Ee.editable=Ih;Ee.mouseSelectionStyle=IS;Ee.dragMovesSelection=US;Ee.clickAddsSelectionRange=DS;Ee.decorations=Ra;Ee.atomicRanges=Op;Ee.scrollMargins=zS;Ee.darkTheme=sd;Ee.contentAttributes=gp;Ee.editorAttributes=XS;Ee.lineWrapping=Ee.contentAttributes.of({class:"cm-lineWrapping"});Ee.announce=Xe.define();const U3=4096,H0={};class Gc{constructor(e,t,i,s){this.from=e,this.to=t,this.dir=i,this.order=s}static update(e,t){if(t.empty)return e;let i=[],s=e.length?e[e.length-1].dir:St.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&Hf(o,t)}return t}const I3=Le.mac?"mac":Le.windows?"win":Le.linux?"linux":"key";function Q3(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,a;for(let l=0;li.concat(s),[]))),t}function $3(n,e,t){return f_(u_(n.state),e,n,t)}let fs=null;const F3=4e3;function B3(n,e=I3){let t=Object.create(null),i=Object.create(null),s=(o,a)=>{let l=i[o];if(l==null)i[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,a,l,c,h)=>{var u,f;let d=t[o]||(t[o]=Object.create(null)),g=a.split(/ (?!$)/).map(p=>Q3(p,e));for(let p=1;p{let x=fs={view:S,prefix:y,scope:o};return setTimeout(()=>{fs==x&&(fs=null)},F3),!0}]})}let O=g.join(" ");s(O,!1);let m=d[O]||(d[O]={preventDefault:!1,stopPropagation:!1,run:((f=(u=d._any)===null||u===void 0?void 0:u.run)===null||f===void 0?void 0:f.slice())||[]});l&&m.run.push(l),c&&(m.preventDefault=!0),h&&(m.stopPropagation=!0)};for(let o of n){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let h=t[c]||(t[c]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let u in h)h[u].run.push(o.any)}let l=o[e]||o.key;if(l)for(let c of a)r(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}function f_(n,e,t,i){let s=SR(e),r=jt(s,0),o=Xn(r)==s.length&&s!=" ",a="",l=!1,c=!1,h=!1;fs&&fs.view==t&&fs.scope==i&&(a=fs.prefix+" ",KS.indexOf(e.keyCode)<0&&(c=!0,fs=null));let u=new Set,f=m=>{if(m){for(let p of m.run)if(!u.has(p)&&(u.add(p),p(t,e)))return m.stopPropagation&&(h=!0),!0;m.preventDefault&&(m.stopPropagation&&(h=!0),c=!0)}return!1},d=n[i],g,O;return d&&(f(d[a+Hl(s,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Le.windows&&e.ctrlKey&&e.altKey)&&(g=Es[e.keyCode])&&g!=s?(f(d[a+Hl(g,e,!0)])||e.shiftKey&&(O=Ca[e.keyCode])!=s&&O!=g&&f(d[a+Hl(O,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(d[a+Hl(s,e,!0)])&&(l=!0),!l&&f(d._any)&&(l=!0)),c&&(l=!0),l&&h&&e.stopPropagation(),l}class el{constructor(e,t,i,s,r){this.className=e,this.left=t,this.top=i,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=d_(e);return[new el(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return X3(e,t,i)}}function d_(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==St.LTR?e.left:e.right-n.scrollDOM.clientWidth)-n.scrollDOM.scrollLeft,top:e.top-n.scrollDOM.scrollTop}}function q0(n,e,t){let i=re.cursor(e);return{from:Math.max(t.from,n.moveToLineBoundary(i,!1,!0).from),to:Math.min(t.to,n.moveToLineBoundary(i,!0,!0).from),type:_t.Text}}function X3(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to),r=n.textDirection==St.LTR,o=n.contentDOM,a=o.getBoundingClientRect(),l=d_(n),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),f=a.right-(h?parseInt(h.paddingRight):0),d=td(n,i),g=td(n,s),O=d.type==_t.Text?d:null,m=g.type==_t.Text?g:null;if(O&&(n.lineWrapping||d.widgetLineBreaks)&&(O=q0(n,i,O)),m&&(n.lineWrapping||g.widgetLineBreaks)&&(m=q0(n,s,m)),O&&m&&O.from==m.from)return y(S(t.from,t.to,O));{let w=O?S(t.from,null,O):x(d,!1),T=m?S(null,t.to,m):x(g,!0),C=[];return(O||d).to<(m||g).from-(O&&m?1:0)||d.widgetLineBreaks>1&&w.bottom+n.defaultLineHeight/2ae&&W.from=K)break;J>G&&j(Math.max(se,G),w==null&&se<=ae,Math.min(J,K),T==null&&J>=Q,z.dir)}if(G=X.to+1,G>=K)break}return E.length==0&&j(ae,w==null,Q,T==null,n.textDirection),{top:k,bottom:b,horizontal:E}}function x(w,T){let C=a.top+(T?w.top:w.bottom);return{top:C,bottom:C,horizontal:[]}}}function z3(n,e){return n.constructor==e.constructor&&n.eq(e)}class V3{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(vc)!=e.state.facet(vc)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&e.view.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(vc);for(;t!z3(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const vc=Ce.define();function p_(n){return[Dt.define(e=>new V3(e,n)),vc.of(n)]}const m_=!Le.ios,ka=Ce.define({combine(n){return ki(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function W3(n={}){return[ka.of(n),G3,Z3,H3,BS.of(!0)]}function g_(n){return n.startState.facet(ka)!=n.state.facet(ka)}const G3=p_({above:!0,markers(n){let{state:e}=n,t=e.facet(ka),i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||m_:t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:re.cursor(s.head,s.head>s.anchor?-1:1);for(let l of el.forRange(n,o,a))i.push(l)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=g_(n);return t&&K0(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){K0(e.state,n)},class:"cm-cursorLayer"});function K0(n,e){e.style.animationDuration=n.facet(ka).cursorBlinkRate+"ms"}const Z3=p_({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:el.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||g_(n)},class:"cm-selectionLayer"}),O_={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};m_&&(O_[".cm-line"].caretColor="transparent !important");const H3=xr.highest(Ee.theme(O_)),v_=Xe.define({map(n,e){return n==null?null:e.mapPos(n)}}),ra=Ht.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(v_)?i.value:t,n)}}),Y3=Dt.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(ra);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(ra)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let n=this.view.state.field(ra),e=n!=null&&this.view.coordsAtPos(n);if(!e)return null;let t=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-t.left+this.view.scrollDOM.scrollLeft,top:e.top-t.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(ra)!=n&&this.view.dispatch({effects:v_.of(n)})}},{eventHandlers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function j3(){return[ra,Y3]}function J0(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,a;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;a=e.exec(r.value);)s(o+a.index,a)}function q3(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class K3{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(a,l,c,h)=>s(h,c,c+a[0].length,a,l);else if(typeof i=="function")this.addMatch=(a,l,c,h)=>{let u=i(a,l,c);u&&h(c,c+a[0].length,u)};else if(i)this.addMatch=(a,l,c,h)=>h(c,c+a[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new Ms,i=t.add.bind(t);for(let{from:s,to:r}of q3(e,this.maxLength))J0(e.state.doc,this.regexp,s,r,(o,a)=>this.addMatch(a,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,a,l)=>{l>e.view.viewport.from&&a1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),a=Math.min(r.to,s);if(a>o){let l=e.state.doc.lineAt(o),c=l.tol.from;o--)if(this.boundary.test(l.text[o-1-l.from])){h=o;break}for(;af.push(p.range(O,m));if(l==c)for(this.regexp.lastIndex=h-l.from;(d=this.regexp.exec(l.text))&&d.indexthis.addMatch(m,e,O,g));t=t.update({filterFrom:h,filterTo:u,filter:(O,m)=>Ou,add:f})}}return t}}const ad=/x/.unicode!=null?"gu":"g",J3=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,ad),ek={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let zu=null;function tk(){var n;if(zu==null&&typeof document<"u"&&document.body){let e=document.body.style;zu=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return zu||!1}const xc=Ce.define({combine(n){let e=ki(n,{render:null,specialChars:J3,addSpecialChars:null});return(e.replaceTabs=!tk())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,ad)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,ad)),e}});function nk(n={}){return[xc.of(n),ik()]}let eO=null;function ik(){return eO||(eO=Dt.fromClass(class{constructor(n){this.view=n,this.decorations=Ie.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(xc)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new K3({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=jt(e[0],0);if(r==9){let o=s.lineAt(i),a=t.state.tabSize,l=ja(o.text,a,i-o.from);return Ie.replace({widget:new ak((a-l%a)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=Ie.replace({widget:new ok(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(xc);n.startState.facet(xc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const sk="•";function rk(n){return n>=32?sk:n==10?"␤":String.fromCharCode(9216+n)}class ok extends ns{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=rk(this.code),i=e.state.phrase("Control character")+" "+(ek[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class ak extends ns{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function lk(){return hk}const ck=Ie.line({class:"cm-activeLine"}),hk=Dt.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(ck.range(s.from)),e=s.from)}return Ie.set(t)}},{decorations:n=>n.decorations});class uk extends ns{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let t=e.firstChild?bo(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),s=Dh(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function fk(n){return Dt.fromClass(class{constructor(e){this.view=e,this.placeholder=n?Ie.set([Ie.widget({widget:new uk(n),side:1}).range(0)]):Ie.none}get decorations(){return this.view.state.doc.length?Ie.none:this.placeholder}},{decorations:e=>e.decorations})}const ld=2e3;function dk(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>ld||t.off>ld||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=i;l<=s;l++){let c=n.doc.line(l);c.length<=a&&r.push(re.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=i;l<=s;l++){let c=n.doc.line(l),h=Bf(c.text,o,n.tabSize,!0);if(h<0)r.push(re.cursor(c.to));else{let u=Bf(c.text,a,n.tabSize);r.push(re.range(c.from+h,c.from+u))}}}return r}function pk(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function tO(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>ld?-1:s==i.length?pk(n,e.clientX):ja(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function mk(n,e){let t=tO(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let a=tO(n,s);if(!a)return i;let l=dk(n.state,t,a);return l.length?o?re.create(l.concat(i.ranges)):re.create(l):i}}:null}function gk(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return Ee.mouseSelectionStyle.of((t,i)=>e(i)?mk(t,i):null)}const Ok={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},vk={style:"cursor: crosshair"};function xk(n={}){let[e,t]=Ok[n.key||"Alt"],i=Dt.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventHandlers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,Ee.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?vk:null})]}const Yl="-10000px";class x_{constructor(e,t,i){this.facet=t,this.createTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(s=>s),this.tooltipViews=this.tooltips.map(i)}update(e){var t;let i=e.state.facet(this.facet),s=i.filter(o=>o);if(i===this.input){for(let o of this.tooltipViews)o.update&&o.update(e);return!1}let r=[];for(let o=0;o{var e,t,i;return{position:Le.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Sk}}}),nO=new WeakMap,S_=Dt.fromClass(class{constructor(n){this.view=n,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(Vu);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new x_(n,xp,t=>this.createTooltip(t)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(Vu);if(i.position!=this.position){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n){let e=n.create(this.view);if(e.dom.classList.add("cm-tooltip"),n.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Yl,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var n,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(n=t.destroy)===null||n===void 0||n.call(t);(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=this.view.dom.getBoundingClientRect();return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map((e,t)=>{let i=this.manager.tooltipViews[t];return i.getCoords?i.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Vu).tooltipSpace(this.view)}}writeMeasure(n){var e;let{editor:t,space:i}=n,s=[];for(let r=0;r=Math.min(t.bottom,i.bottom)||c.rightMath.min(t.right,i.right)+.1){l.style.top=Yl;continue}let u=o.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,f=u?7:0,d=h.right-h.left,g=(e=nO.get(a))!==null&&e!==void 0?e:h.bottom-h.top,O=a.offset||yk,m=this.view.textDirection==St.LTR,p=h.width>i.right-i.left?m?i.left:i.right-h.width:m?Math.min(c.left-(u?14:0)+O.x,i.right-d):Math.max(i.left,c.left-d+(u?14:0)-O.x),y=!!o.above;!o.strictSide&&(y?c.top-(h.bottom-h.top)-O.yi.bottom)&&y==i.bottom-c.bottom>c.top-i.top&&(y=!y);let S=(y?c.top-i.top:i.bottom-c.bottom)-f;if(Sp&&T.topx&&(x=y?T.top-g-2-f:T.bottom+f+2);this.position=="absolute"?(l.style.top=x-n.parent.top+"px",l.style.left=p-n.parent.left+"px"):(l.style.top=x+"px",l.style.left=p+"px"),u&&(u.style.left=`${c.left+(m?O.x:-O.x)-(p+14-7)}px`),a.overlap!==!0&&s.push({left:p,top:x,right:w,bottom:x+g}),l.classList.toggle("cm-tooltip-above",y),l.classList.toggle("cm-tooltip-below",!y),a.positioned&&a.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Yl}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),_k=Ee.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),yk={x:0,y:0},xp=Ce.define({enables:[S_,_k]}),Zc=Ce.define();class Sp{constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new x_(e,Zc,t=>this.createHostedView(t))}static create(e){return new Sp(e)}createHostedView(e){let t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}}const bk=xp.compute([Zc],n=>{let e=n.facet(Zc).filter(t=>t);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.filter(t=>t.end!=null).map(t=>t.end)),create:Sp.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class wk{constructor(e,t,i,s,r){this.view=e,this.source=t,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let e=Date.now()-this.lastMove.time;ei.bottom||e.xi.right+this.view.defaultCharacterWidth)return;let s=this.view.bidiSpans(this.view.state.doc.lineAt(t)).find(a=>a.from<=t&&a.to>=t),r=s&&s.dir==St.RTL?-1:1,o=this.source(this.view,t,e.x{this.pending==a&&(this.pending=null,l&&this.view.dispatch({effects:this.setHover.of(l)}))},l=>Wn(this.view.state,l,"hover tooltip"))}else o&&this.view.dispatch({effects:this.setHover.of(o)})}mousemove(e){var t;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let i=this.active;if(i&&!iO(this.lastMove.target)||this.pending){let{pos:s}=i||this.pending,r=(t=i==null?void 0:i.end)!==null&&t!==void 0?t:s;(s==r?this.view.posAtCoords(this.lastMove)!=s:!Mk(this.view,s,r,e.clientX,e.clientY,6))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!iO(e.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function iO(n){for(let e=n;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains("cm-tooltip"))return!0;return!1}function Mk(n,e,t,i,s,r){let o=document.createRange(),a=n.domAtPos(e),l=n.domAtPos(t);o.setEnd(l.node,l.offset),o.setStart(a.node,a.offset);let c=o.getClientRects();o.detach();for(let h=0;hZc.from(s)});return[i,Dt.define(s=>new wk(s,n,i,t,e.hoverTime||300)),bk]}function __(n,e){let t=n.plugin(S_);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Ek=Xe.define(),sO=Ce.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function La(n,e){let t=n.plugin(y_),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const y_=Dt.fromClass(class{constructor(n){this.input=n.state.facet(Da),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(sO);this.top=new jl(n,!0,e.topContainer),this.bottom=new jl(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(sO);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new jl(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new jl(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Da);if(t!=this.input){let i=t.filter(l=>l),s=[],r=[],o=[],a=[];for(let l of i){let c=this.specs.indexOf(l),h;c<0?(h=l(n.view),a.push(h)):(h=this.panels[c],h.update&&h.update(n)),s.push(h),(h.top?r:o).push(h)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>Ee.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class jl{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=rO(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=rO(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function rO(n){let e=n.nextSibling;return n.remove(),e}const Da=Ce.define({enables:y_});class Ki extends pr{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ki.prototype.elementClass="";Ki.prototype.toDOM=void 0;Ki.prototype.mapMode=Kt.TrackBefore;Ki.prototype.startSide=Ki.prototype.endSide=-1;Ki.prototype.point=!0;const Sc=Ce.define(),Ak={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>lt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},ma=Ce.define();function Pk(n){return[b_(),ma.of(Object.assign(Object.assign({},Ak),n))]}const cd=Ce.define({combine:n=>n.some(e=>e)});function b_(n){let e=[Ck];return n&&n.fixed===!1&&e.push(cd.of(!0)),e}const Ck=Dt.fromClass(class{constructor(n){this.view=n,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=n.state.facet(ma).map(e=>new aO(n,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!n.state.facet(cd),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}n.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(cd)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&this.dom.remove();let t=lt.iter(this.view.state.facet(Sc),this.view.viewport.from),i=[],s=this.gutters.map(r=>new Rk(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let a of r.type)if(a.type==_t.Text&&o){hd(t,i,a.from);for(let l of s)l.line(this.view,a,i);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(r.type==_t.Text){hd(t,i,r.from);for(let o of s)o.line(this.view,r,i)}for(let r of s)r.finish();n&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(n){let e=n.startState.facet(ma),t=n.state.facet(ma),i=n.docChanged||n.heightChanged||n.viewportChanged||!lt.eq(n.startState.facet(Sc),n.state.facet(Sc),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new aO(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove()}},{provide:n=>Ee.scrollMargins.of(e=>{let t=e.plugin(n);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==St.LTR?{left:t.dom.offsetWidth}:{right:t.dom.offsetWidth}})});function oO(n){return Array.isArray(n)?n:[n]}function hd(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class Rk{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=lt.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=t.top-this.height;if(this.i==s.elements.length){let o=new w_(e,t.height,r,i);s.elements.push(o),s.dom.appendChild(o.dom)}else s.elements[this.i].update(e,t.height,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];hd(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t);i&&this.addElement(e,t,[i])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class aO{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let l=r.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,a,s)&&s.preventDefault()});this.markers=oO(t.markers(e)),t.initialSpacer&&(this.spacer=new w_(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=oO(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!lt.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class w_{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.dom.style.height=(this.height=t)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),kk(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let a=o,l=rr(a,l,c)||o(a,l,c):o}return i}})}});class Wu extends Ki{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Gu(n,e){return n.state.facet(Yr).formatNumber(e,n.state)}const Dk=ma.compute([Yr],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Lk)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new Wu(Gu(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(Yr)!=e.state.facet(Yr),initialSpacer(e){return new Wu(Gu(e,lO(e.state.doc.lines)))},updateSpacer(e,t){let i=Gu(t.view,lO(t.view.state.doc.lines));return i==e.number?e:new Wu(i)},domEventHandlers:n.facet(Yr).domEventHandlers}));function Uk(n={}){return[Yr.of(n),b_(),Dk]}function lO(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(Ik.range(s)))}return lt.of(e)});function Nk(){return Qk}const M_=1024;let $k=0;class Zu{constructor(e,t){this.from=e,this.to=t}}class Ke{constructor(e={}){this.id=$k++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Tn.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}Ke.closedBy=new Ke({deserialize:n=>n.split(" ")});Ke.openedBy=new Ke({deserialize:n=>n.split(" ")});Ke.group=new Ke({deserialize:n=>n.split(" ")});Ke.contextHash=new Ke({perNode:!0});Ke.lookAhead=new Ke({perNode:!0});Ke.mounted=new Ke({perNode:!0});const Fk=Object.create(null);class Tn{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Fk,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Tn(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Ke.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(Ke.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}Tn.none=new Tn("",Object.create(null),0,8);class _p{constructor(e){this.types=e;for(let t=0;t0;for(let l=this.cursor(o|It.IncludeAnonymous);;){let c=!1;if(l.from<=r&&l.to>=s&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&i&&(a||!l.type.isAnonymous)&&i(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:wp(Tn.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new kt(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new kt(Tn.none,t,i,s)))}static build(e){return Xk(e)}}kt.empty=new kt(Tn.none,[],[],0);class yp{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new yp(this.buffer,this.index)}}class Sr{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Tn.none}toString(){let e=[];for(let t=0;t0));l=o[l+3]);return a}slice(e,t,i){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let a=e,l=0;a=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function E_(n,e){let t=n.childBefore(e);for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}function Mo(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?a.length:-1;e!=c;e+=t){let h=a[e],u=l[e]+o.from;if(T_(s,i,u,u+h.length)){if(h instanceof Sr){if(r&It.ExcludeBuffers)continue;let f=h.findChild(0,h.buffer.length,t,i-u,s);if(f>-1)return new wi(new Bk(o,h,e,u),null,f)}else if(r&It.IncludeAnonymous||!h.type.isAnonymous||bp(h)){let f;if(!(r&It.IgnoreMounts)&&h.props&&(f=h.prop(Ke.mounted))&&!f.overlay)return new ci(f.tree,u,e,o);let d=new ci(h,u,e,o);return r&It.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?h.children.length-1:0,t,i,s)}}}if(r&It.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let s;if(!(i&It.IgnoreOverlays)&&(s=this._tree.prop(Ke.mounted))&&s.overlay){let r=e-this.from;for(let{from:o,to:a}of s.overlay)if((t>0?o<=r:o=r:a>r))return new ci(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new jc(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return Mo(this,e,t,!1)}resolveInner(e,t=0){return Mo(this,e,t,!0)}enterUnfinishedNodesBefore(e){return E_(this,e)}getChild(e,t=null,i=null){let s=Hc(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Hc(this,e,t,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return Yc(this,e)}}function Hc(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(;!s.type.is(t);)if(!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function Yc(n,e,t=e.length-1){for(let i=n.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Bk{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class wi{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new wi(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&It.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new wi(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new wi(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new wi(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new jc(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o)),t.push(0)}return new kt(this.type,e,t,this.to-this.from)}resolve(e,t=0){return Mo(this,e,t,!1)}resolveInner(e,t=0){return Mo(this,e,t,!0)}enterUnfinishedNodesBefore(e){return E_(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,i=null){let s=Hc(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Hc(this,e,t,i)}get node(){return this}matchContext(e){return Yc(this,e)}}class jc{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof ci)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof ci?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&It.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&It.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&It.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let a=i._tree.children[r];if(this.mode&It.IncludeAnonymous||a instanceof Sr||!a.type.isAnonymous||bp(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}for(let s=i;s=0;r--){if(r<0)return Yc(this.node,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function bp(n){return n.children.some(e=>e instanceof Sr||!e.type.isAnonymous||bp(e))}function Xk(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=M_,reused:r=[],minRepeatType:o=i.types.length}=n,a=Array.isArray(t)?new yp(t,t.length):t,l=i.types,c=0,h=0;function u(x,w,T,C,k){let{id:b,start:E,end:j,size:ae}=a,Q=h;for(;ae<0;)if(a.next(),ae==-1){let z=r[b];T.push(z),C.push(E-x);return}else if(ae==-3){c=b;return}else if(ae==-4){h=b;return}else throw new RangeError(`Unrecognized record size: ${ae}`);let W=l[b],G,K,X=E-x;if(j-E<=s&&(K=O(a.pos-w,k))){let z=new Uint16Array(K.size-K.skip),se=a.pos-K.size,J=z.length;for(;a.pos>se;)J=m(K.start,z,J);G=new Sr(z,j-K.start,i),X=K.start-x}else{let z=a.pos-ae;a.next();let se=[],J=[],be=b>=o?b:-1,N=0,de=j;for(;a.pos>z;)be>=0&&a.id==be&&a.size>=0?(a.end<=de-s&&(d(se,J,E,N,a.end,de,be,Q),N=se.length,de=a.end),a.next()):u(E,z,se,J,be);if(be>=0&&N>0&&N-1&&N>0){let pe=f(W);G=wp(W,se,J,0,se.length,0,j-E,pe,pe)}else G=g(W,se,J,j-E,Q-j)}T.push(G),C.push(X)}function f(x){return(w,T,C)=>{let k=0,b=w.length-1,E,j;if(b>=0&&(E=w[b])instanceof kt){if(!b&&E.type==x&&E.length==C)return E;(j=E.prop(Ke.lookAhead))&&(k=T[b]+E.length+j)}return g(x,w,T,C,k)}}function d(x,w,T,C,k,b,E,j){let ae=[],Q=[];for(;x.length>C;)ae.push(x.pop()),Q.push(w.pop()+T-k);x.push(g(i.types[E],ae,Q,b-k,j-b)),w.push(k-T)}function g(x,w,T,C,k=0,b){if(c){let E=[Ke.contextHash,c];b=b?[E].concat(b):[E]}if(k>25){let E=[Ke.lookAhead,k];b=b?[E].concat(b):[E]}return new kt(x,w,T,C,b)}function O(x,w){let T=a.fork(),C=0,k=0,b=0,E=T.end-s,j={size:0,start:0,skip:0};e:for(let ae=T.pos-x;T.pos>ae;){let Q=T.size;if(T.id==w&&Q>=0){j.size=C,j.start=k,j.skip=b,b+=4,C+=4,T.next();continue}let W=T.pos-Q;if(Q<0||W=o?4:0,K=T.start;for(T.next();T.pos>W;){if(T.size<0)if(T.size==-3)G+=4;else break e;else T.id>=o&&(G+=4);T.next()}k=K,C+=Q,b+=G}return(w<0||C==x)&&(j.size=C,j.start=k,j.skip=b),j.size>4?j:void 0}function m(x,w,T){let{id:C,start:k,end:b,size:E}=a;if(a.next(),E>=0&&C4){let ae=a.pos-(E-4);for(;a.pos>ae;)T=m(x,w,T)}w[--T]=j,w[--T]=b-x,w[--T]=k-x,w[--T]=C}else E==-3?c=C:E==-4&&(h=C);return T}let p=[],y=[];for(;a.pos>0;)u(n.start||0,n.bufferStart||0,p,y,-1);let S=(e=n.length)!==null&&e!==void 0?e:p.length?y[0]+p[0].length:0;return new kt(l[n.topID],p.reverse(),y.reverse(),S)}const hO=new WeakMap;function _c(n,e){if(!n.isAnonymous||e instanceof Sr||e.type!=n)return 1;let t=hO.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof kt)){t=1;break}t+=_c(n,i)}hO.set(e,t)}return t}function wp(n,e,t,i,s,r,o,a,l){let c=0;for(let g=i;g=h)break;T+=C}if(S==x+1){if(T>h){let C=g[x];d(C.children,C.positions,0,C.children.length,O[x]+y);continue}u.push(g[x])}else{let C=O[S-1]+g[S-1].length-w;u.push(wp(n,g,O,x,S,w,C,null,l))}f.push(w+y-r)}}return d(e,t,i,s,0),(a||l)(u,f,o)}class zk{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof wi?this.setBuffer(e.context.buffer,e.index,t):e instanceof ci&&this.map.set(e.tree,t)}get(e){return e instanceof wi?this.getBuffer(e.context.buffer,e.index):e instanceof ci?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class cr{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new cr(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let h=a=i)for(;o&&o.from=f.from||u<=f.to||c){let d=Math.max(f.from,l)-c,g=Math.min(f.to,u)-c;f=d>=g?null:new cr(d,g,f.tree,f.offset+c,a>0,!!h)}if(f&&s.push(f),o.to>u)break;o=rnew Zu(s.from,s.to)):[new Zu(0,0)]:[new Zu(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class Vk{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new Ke({perNode:!0});let Wk=0;class xi{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=Wk++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new xi([],null,[]);if(t.set.push(t),e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new qc;return t=>t.modified.indexOf(e)>-1?t:qc.get(t.base||t,t.modified.concat(e).sort((i,s)=>i.id-s.id))}}let Gk=0;class qc{constructor(){this.instances=[],this.id=Gk++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(a=>a.base==e&&Zk(t,a.modified));if(i)return i;let s=[],r=new xi(s,e,t);for(let a of t)a.instances.push(r);let o=Hk(t);for(let a of e.set)if(!a.modified.length)for(let l of o)s.push(qc.get(a,l));return r}}function Zk(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function Hk(n){let e=[[]];for(let t=0;ti.length-t.length)}function P_(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,a=s;for(let u=0;;){if(a=="..."&&u>0&&u+3==s.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+s);if(r.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),u+=f[0].length,u==s.length)break;let d=s[u++];if(u==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);a=s.slice(u)}let l=r.length-1,c=r[l];if(!c)throw new RangeError("Invalid path: "+s);let h=new Kc(i,o,l>0?r.slice(0,l):null);e[c]=h.sort(e[c])}}return C_.add(e)}const C_=new Ke;class Kc{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let a of r)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:i}}function Yk(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function jk(n,e,t,i=0,s=n.length){let r=new qk(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class qk{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:a,to:l}=e;if(a>=i||l<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let c=s,h=Kk(e)||Kc.empty,u=Yk(r,h.tags);if(u&&(c&&(c+=" "),c+=u,h.mode==1&&(s+=(s?" ":"")+u)),this.startSpan(Math.max(t,a),c),h.opaque)return;let f=e.tree&&e.tree.prop(Ke.mounted);if(f&&f.overlay){let d=e.node.enter(f.overlay[0].from+a,1),g=this.highlighters.filter(m=>!m.scope||m.scope(f.tree.type)),O=e.firstChild();for(let m=0,p=a;;m++){let y=m=S||!e.nextSibling())););if(!y||S>i)break;p=y.to+a,p>t&&(this.highlightRange(d.cursor(),Math.max(t,y.from+a),Math.min(i,p),"",g),this.startSpan(Math.min(i,p),c))}O&&e.parent()}else if(e.firstChild()){f&&(s="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),c)}while(e.nextSibling());e.parent()}}}function Kk(n){let e=n.type.prop(C_);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const ge=xi.define,Kl=ge(),cs=ge(),uO=ge(cs),fO=ge(cs),hs=ge(),Jl=ge(hs),Hu=ge(hs),gi=ge(),Xs=ge(gi),pi=ge(),mi=ge(),ud=ge(),Go=ge(ud),ec=ge(),D={comment:Kl,lineComment:ge(Kl),blockComment:ge(Kl),docComment:ge(Kl),name:cs,variableName:ge(cs),typeName:uO,tagName:ge(uO),propertyName:fO,attributeName:ge(fO),className:ge(cs),labelName:ge(cs),namespace:ge(cs),macroName:ge(cs),literal:hs,string:Jl,docString:ge(Jl),character:ge(Jl),attributeValue:ge(Jl),number:Hu,integer:ge(Hu),float:ge(Hu),bool:ge(hs),regexp:ge(hs),escape:ge(hs),color:ge(hs),url:ge(hs),keyword:pi,self:ge(pi),null:ge(pi),atom:ge(pi),unit:ge(pi),modifier:ge(pi),operatorKeyword:ge(pi),controlKeyword:ge(pi),definitionKeyword:ge(pi),moduleKeyword:ge(pi),operator:mi,derefOperator:ge(mi),arithmeticOperator:ge(mi),logicOperator:ge(mi),bitwiseOperator:ge(mi),compareOperator:ge(mi),updateOperator:ge(mi),definitionOperator:ge(mi),typeOperator:ge(mi),controlOperator:ge(mi),punctuation:ud,separator:ge(ud),bracket:Go,angleBracket:ge(Go),squareBracket:ge(Go),paren:ge(Go),brace:ge(Go),content:gi,heading:Xs,heading1:ge(Xs),heading2:ge(Xs),heading3:ge(Xs),heading4:ge(Xs),heading5:ge(Xs),heading6:ge(Xs),contentSeparator:ge(gi),list:ge(gi),quote:ge(gi),emphasis:ge(gi),strong:ge(gi),link:ge(gi),monospace:ge(gi),strikethrough:ge(gi),inserted:ge(),deleted:ge(),changed:ge(),invalid:ge(),meta:ec,documentMeta:ge(ec),annotation:ge(ec),processingInstruction:ge(ec),definition:xi.defineModifier(),constant:xi.defineModifier(),function:xi.defineModifier(),standard:xi.defineModifier(),local:xi.defineModifier(),special:xi.defineModifier()};R_([{tag:D.link,class:"tok-link"},{tag:D.heading,class:"tok-heading"},{tag:D.emphasis,class:"tok-emphasis"},{tag:D.strong,class:"tok-strong"},{tag:D.keyword,class:"tok-keyword"},{tag:D.atom,class:"tok-atom"},{tag:D.bool,class:"tok-bool"},{tag:D.url,class:"tok-url"},{tag:D.labelName,class:"tok-labelName"},{tag:D.inserted,class:"tok-inserted"},{tag:D.deleted,class:"tok-deleted"},{tag:D.literal,class:"tok-literal"},{tag:D.string,class:"tok-string"},{tag:D.number,class:"tok-number"},{tag:[D.regexp,D.escape,D.special(D.string)],class:"tok-string2"},{tag:D.variableName,class:"tok-variableName"},{tag:D.local(D.variableName),class:"tok-variableName tok-local"},{tag:D.definition(D.variableName),class:"tok-variableName tok-definition"},{tag:D.special(D.variableName),class:"tok-variableName2"},{tag:D.definition(D.propertyName),class:"tok-propertyName tok-definition"},{tag:D.typeName,class:"tok-typeName"},{tag:D.namespace,class:"tok-namespace"},{tag:D.className,class:"tok-className"},{tag:D.macroName,class:"tok-macroName"},{tag:D.propertyName,class:"tok-propertyName"},{tag:D.operator,class:"tok-operator"},{tag:D.comment,class:"tok-comment"},{tag:D.meta,class:"tok-meta"},{tag:D.invalid,class:"tok-invalid"},{tag:D.punctuation,class:"tok-punctuation"}]);var Yu;const jr=new Ke;function k_(n){return Ce.define({combine:n?e=>e.concat(n):void 0})}const Mp=new Ke;class oi{constructor(e,t,i=[],s=""){this.data=e,this.name=s,tt.prototype.hasOwnProperty("tree")||Object.defineProperty(tt.prototype,"tree",{get(){return Xt(this)}}),this.parser=t,this.extension=[Cs.of(this),tt.languageData.of((r,o,a)=>{let l=dO(r,o,a),c=l.type.prop(jr);if(!c)return[];let h=r.facet(c),u=l.type.prop(Mp);if(u){let f=l.resolve(o-l.from,a);for(let d of u)if(d.test(f,r)){let g=r.facet(d.facet);return d.type=="replace"?g:g.concat(h)}}return h})].concat(i)}isActiveAt(e,t,i=-1){return dO(e,t,i).type.prop(jr)==this.data}findRegions(e){let t=e.facet(Cs);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(jr)==this.data){i.push({from:o,to:o+r.length});return}let a=r.prop(Ke.mounted);if(a){if(a.tree.prop(jr)==this.data){if(a.overlay)for(let l of a.overlay)i.push({from:l.from+o,to:l.to+o});else i.push({from:o,to:o+r.length});return}else if(a.overlay){let l=i.length;if(s(a.tree,a.overlay[0].from+o),i.length>l)return}}for(let l=0;li.isTop?t:void 0)]}),e.name)}configure(e,t){return new Jc(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xt(n){let e=n.field(oi.state,!1);return e?e.tree:kt.empty}class Jk{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Zo=null;class eh{constructor(e,t,i=[],s,r,o,a,l){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new eh(e,t,[],kt.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Jk(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=kt.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(cr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Zo;Zo=this;try{return e()}finally{Zo=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=pO(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,h,u,f)=>l.push({fromA:c,toA:h,fromB:u,toB:f})),i=cr.applyChanges(i,l),s=kt.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),u=e.mapPos(c.to,-1);he.from&&(this.fragments=pO(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends A_{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let l=Zo;if(l){for(let c of s)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new kt(Tn.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Zo}}function pO(n,e,t){return cr.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class To{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new To(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=eh.create(e.facet(Cs).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new To(i)}}oi.state=Ht.define({create:To.init,update(n,e){for(let t of e.effects)if(t.is(oi.setState))return t.value;return e.startState.facet(Cs)!=e.state.facet(Cs)?To.init(e.state):n.apply(e)}});let L_=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(L_=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const ju=typeof navigator<"u"&&(!((Yu=navigator.scheduling)===null||Yu===void 0)&&Yu.isInputPending)?()=>navigator.scheduling.isInputPending():null,eL=Dt.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(oi.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(oi.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=L_(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,l=r.context.work(()=>ju&&ju()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:oi.setState.of(new To(r.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Wn(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Cs=Ce.define({combine(n){return n.length?n[0]:null},enables:n=>[oi.state,eL,Ee.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class tL{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const nL=Ce.define(),tl=Ce.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function th(n){let e=n.facet(tl);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Ua(n,e){let t="",i=n.tabSize,s=n.facet(tl)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return ja(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const D_=new Ke;function iL(n,e,t){return U_(e.resolveInner(t).enterUnfinishedNodesBefore(t),t,n)}function sL(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function rL(n){let e=n.type.prop(D_);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(Ke.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>I_(o,!0,1,void 0,r&&!sL(o)?s.from:void 0)}return n.parent==null?oL:null}function U_(n,e,t){for(;n;n=n.parent){let i=rL(n);if(i)return i(Ep.create(t,e,n))}return null}function oL(){return 0}class Ep extends Qh{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.node=i}static create(e,t,i){return new Ep(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(aL(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){let e=this.node.parent;return e?U_(e,this.pos,this.base):0}}function aL(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function lL(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==i)return null;if(!l.type.isSkipped)return l.fromI_(i,e,t,n)}function I_(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,a=i&&r.slice(o,o+i.length)==i||s==n.pos+o,l=e?lL(n):null;return l?a?n.column(l.from):n.column(l.to):n.baseIndent+(a?0:n.unit*t)}const hL=n=>n.baseIndent;function qu({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const uL=200;function fL(){return tt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+uL)return n;let r=t.sliceString(s.from,i);if(!e.some(c=>c.test(r)))return n;let{state:o}=n,a=-1,l=[];for(let{head:c}of o.selection.ranges){let h=o.doc.lineAt(c);if(h.from==a)continue;a=h.from;let u=Tp(o,h.from);if(u==null)continue;let f=/^\s*/.exec(h.text)[0],d=Ua(o,u);f!=d&&l.push({from:h.from,to:h.from+f.length,insert:d})}return l.length?[n,{changes:l,sequential:!0}]:n})}const dL=Ce.define(),Q_=new Ke;function pL(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(r&&o.from=e&&l.to>t&&(r=l)}}return r}function gL(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function nh(n,e,t){for(let i of n.facet(dL)){let s=i(n,e,t);if(s)return s}return mL(n,e,t)}function N_(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Nh=Xe.define({map:N_}),nl=Xe.define({map:N_});function $_(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const gr=Ht.define({create(){return Ie.none},update(n,e){n=n.map(e.changes);for(let t of e.effects)t.is(Nh)&&!OL(n,t.value.from,t.value.to)?n=n.update({add:[mO.range(t.value.from,t.value.to)]}):t.is(nl)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:i}=e.selection.main;n.between(i,i,(s,r)=>{si&&(t=!0)}),t&&(n=n.update({filterFrom:i,filterTo:i,filter:(s,r)=>r<=i||s>=i}))}return n},provide:n=>Ee.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{(!s||s.from>r)&&(s={from:r,to:o})}),s}function OL(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function F_(n,e){return n.field(gr,!1)?e:e.concat(Xe.appendConfig.of(z_()))}const vL=n=>{for(let e of $_(n)){let t=nh(n.state,e.from,e.to);if(t)return n.dispatch({effects:F_(n.state,[Nh.of(t),B_(n,t)])}),!0}return!1},xL=n=>{if(!n.state.field(gr,!1))return!1;let e=[];for(let t of $_(n)){let i=ih(n.state,t.from,t.to);i&&e.push(nl.of(i),B_(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function B_(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return Ee.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const SL=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(gr,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(nl.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},yL=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:vL},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:xL},{key:"Ctrl-Alt-[",run:SL},{key:"Ctrl-Alt-]",run:_L}],bL={placeholderDOM:null,placeholderText:"…"},X_=Ce.define({combine(n){return ki(n,bL)}});function z_(n){let e=[gr,TL];return n&&e.push(X_.of(n)),e}const mO=Ie.replace({widget:new class extends ns{toDOM(n){let{state:e}=n,t=e.facet(X_),i=r=>{let o=n.lineBlockAt(n.posAtDOM(r.target)),a=ih(n.state,o.from,o.to);a&&n.dispatch({effects:nl.of(a)}),r.preventDefault()};if(t.placeholderDOM)return t.placeholderDOM(n,i);let s=document.createElement("span");return s.textContent=t.placeholderText,s.setAttribute("aria-label",e.phrase("folded code")),s.title=e.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}}}),wL={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Ku extends Ki{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function ML(n={}){let e=Object.assign(Object.assign({},wL),n),t=new Ku(e,!0),i=new Ku(e,!1),s=Dt.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Cs)!=o.state.facet(Cs)||o.startState.field(gr,!1)!=o.state.field(gr,!1)||Xt(o.startState)!=Xt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Ms;for(let l of o.viewportLineBlocks){let c=ih(o.state,l.from,l.to)?i:nh(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:r}=e;return[s,Pk({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||lt.empty},initialSpacer(){return new Ku(e,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:(o,a,l)=>{if(r.click&&r.click(o,a,l))return!0;let c=ih(o.state,a.from,a.to);if(c)return o.dispatch({effects:nl.of(c)}),!0;let h=nh(o.state,a.from,a.to);return h?(o.dispatch({effects:Nh.of(h)}),!0):!1}})}),z_()]}const TL=Ee.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class il{constructor(e,t){this.specs=e;let i;function s(a){let l=Ts.newName();return(i||(i=Object.create(null)))["."+l]=a,l}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof oi?a=>a.prop(jr)==o.data:o?a=>a==o:void 0,this.style=R_(e.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:r}).style,this.module=i?new Ts(i):null,this.themeType=t.themeType}static define(e,t){return new il(e,t||{})}}const fd=Ce.define(),V_=Ce.define({combine(n){return n.length?[n[0]]:null}});function Ju(n){let e=n.facet(fd);return e.length?e:n.facet(V_)}function W_(n,e){let t=[AL],i;return n instanceof il&&(n.module&&t.push(Ee.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(V_.of(n)):i?t.push(fd.computeN([Ee.darkTheme],s=>s.facet(Ee.darkTheme)==(i=="dark")?[n]:[])):t.push(fd.of(n)),t}class EL{constructor(e){this.markCache=Object.create(null),this.tree=Xt(e.state),this.decorations=this.buildDeco(e,Ju(e.state))}update(e){let t=Xt(e.state),i=Ju(e.state),s=i!=Ju(e.startState);t.length{i.add(o,a,this.markCache[l]||(this.markCache[l]=Ie.mark({class:l})))},s,r);return i.finish()}}const AL=xr.high(Dt.fromClass(EL,{decorations:n=>n.decorations})),PL=il.define([{tag:D.meta,color:"#404740"},{tag:D.link,textDecoration:"underline"},{tag:D.heading,textDecoration:"underline",fontWeight:"bold"},{tag:D.emphasis,fontStyle:"italic"},{tag:D.strong,fontWeight:"bold"},{tag:D.strikethrough,textDecoration:"line-through"},{tag:D.keyword,color:"#708"},{tag:[D.atom,D.bool,D.url,D.contentSeparator,D.labelName],color:"#219"},{tag:[D.literal,D.inserted],color:"#164"},{tag:[D.string,D.deleted],color:"#a11"},{tag:[D.regexp,D.escape,D.special(D.string)],color:"#e40"},{tag:D.definition(D.variableName),color:"#00f"},{tag:D.local(D.variableName),color:"#30a"},{tag:[D.typeName,D.namespace],color:"#085"},{tag:D.className,color:"#167"},{tag:[D.special(D.variableName),D.macroName],color:"#256"},{tag:D.definition(D.propertyName),color:"#00c"},{tag:D.comment,color:"#940"},{tag:D.invalid,color:"#f00"}]),CL=Ee.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),G_=1e4,Z_="()[]{}",H_=Ce.define({combine(n){return ki(n,{afterCursor:!0,brackets:Z_,maxScanDistance:G_,renderMatch:LL})}}),RL=Ie.mark({class:"cm-matchingBracket"}),kL=Ie.mark({class:"cm-nonmatchingBracket"});function LL(n){let e=[],t=n.matched?RL:kL;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const DL=Ht.define({create(){return Ie.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(H_);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=Mi(e.state,s.head,-1,i)||s.head>0&&Mi(e.state,s.head-1,1,i)||i.afterCursor&&(Mi(e.state,s.head,1,i)||s.headEe.decorations.from(n)}),UL=[DL,CL];function IL(n={}){return[H_.of(n),UL]}const QL=new Ke;function dd(n,e,t){let i=n.prop(e<0?Ke.openedBy:Ke.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function pd(n){let e=n.type.prop(QL);return e?e(n.node):n}function Mi(n,e,t,i={}){let s=i.maxScanDistance||G_,r=i.brackets||Z_,o=Xt(n),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=dd(l.type,t,r);if(c&&l.from0?e>=h.from&&eh.from&&e<=h.to))return NL(n,e,t,l,h,c,r)}}return $L(n,e,t,o,a.type,s,r)}function NL(n,e,t,i,s,r,o){let a=i.parent,l={from:s.from,to:s.to},c=0,h=a==null?void 0:a.cursor();if(h&&(t<0?h.childBefore(i.from):h.childAfter(i.to)))do if(t<0?h.to<=i.from:h.from>=i.to){if(c==0&&r.indexOf(h.type.name)>-1&&h.from0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},h=n.doc.iterRange(e,t>0?n.doc.length:0),u=0;for(let f=0;!h.next().done&&f<=r;){let d=h.value;t<0&&(f+=d.length);let g=e+f*t;for(let O=t>0?0:d.length-1,m=t>0?d.length:-1;O!=m;O+=t){let p=o.indexOf(d[O]);if(!(p<0||i.resolveInner(g+O,1).type!=s))if(p%2==0==t>0)u++;else{if(u==1)return{start:c,end:{from:g+O,to:g+O+1},matched:p>>1==l>>1};u--}}t>0&&(f+=d.length)}return h.done?{start:c,matched:!1}:null}const FL=Object.create(null),gO=[Tn.none],OO=[],BL=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])BL[n]=XL(FL,e);function ef(n,e){OO.indexOf(n)>-1||(OO.push(n),console.warn(e))}function XL(n,e){let t=null;for(let r of e.split(".")){let o=n[r]||D[r];o?typeof o=="function"?t?t=o(t):ef(r,`Modifier ${r} used at start of tag`):t?ef(r,`Tag ${r} used as modifier`):t=o:ef(r,`Unknown highlighting tag ${r}`)}if(!t)return 0;let i=e.replace(/ /g,"_"),s=Tn.define({id:gO.length,name:i,props:[P_({[i]:t})]});return gO.push(s),s.id}const zL=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Pp(n.state,t.from);return i.line?VL(n):i.block?GL(n):!1};function Ap(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const VL=Ap(YL,0),WL=Ap(Y_,0),GL=Ap((n,e)=>Y_(n,e,HL(e)),0);function Pp(n,e){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const Ho=50;function ZL(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-Ho,i),o=n.sliceDoc(s,s+Ho),a=/\s*$/.exec(r)[0].length,l=/^\s*/.exec(o)[0].length,c=r.length-a;if(r.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:i-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let h,u;s-i<=2*Ho?h=u=n.sliceDoc(i,s):(h=n.sliceDoc(i,i+Ho),u=n.sliceDoc(s-Ho,s));let f=/^\s*/.exec(h)[0].length,d=/\s*$/.exec(u)[0].length,g=u.length-d-t.length;return h.slice(f,f+e.length)==e&&u.slice(g,g+t.length)==t?{open:{pos:i+f+e.length,margin:/\s/.test(h.charAt(f+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(u.charAt(g-1))?1:0}}:null}function HL(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function Y_(n,e,t=e.selection.ranges){let i=t.map(r=>Pp(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>ZL(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,a;os&&(r==o||o>u.from)){s=u.from;let f=/^\s*/.exec(u.text)[0].length,d=f==u.length,g=u.text.slice(f,f+c.length)==c?f:-1;fr.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:a,token:l,indent:c,empty:h,single:u}of i)(u||!h)&&r.push({from:a.from+c,insert:l+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:a,token:l}of i)if(a>=0){let c=o.from+a,h=c+l.length;o.text[h-o.from]==" "&&h++,r.push({from:c,to:h})}return{changes:r}}return null}const md=ts.define(),jL=ts.define(),qL=Ce.define(),j_=Ce.define({combine(n){return ki(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}});function KL(n){let e=0;return n.iterChangedRanges((t,i)=>e=i),e}const q_=Ht.define({create(){return Ti.empty},update(n,e){let t=e.state.facet(j_),i=e.annotation(md);if(i){let l=e.docChanged?re.single(KL(e.changes)):void 0,c=yn.fromTransaction(e,l),h=i.side,u=h==0?n.undone:n.done;return c?u=sh(u,u.length,t.minDepth,c):u=e1(u,e.startState.selection),new Ti(h==0?i.rest:u,h==0?u:i.rest)}let s=e.annotation(jL);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(Nt.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=yn.fromTransaction(e),o=e.annotation(Nt.time),a=e.annotation(Nt.userEvent);return r?n=n.addChanges(r,o,a,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Ti(n.done.map(yn.fromJSON),n.undone.map(yn.fromJSON))}});function JL(n={}){return[q_,j_.of(n),Ee.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?K_:e.inputType=="historyRedo"?gd:null;return i?(e.preventDefault(),i(t)):!1}})]}function $h(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(q_,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const K_=$h(0,!1),gd=$h(1,!1),eD=$h(0,!0),tD=$h(1,!0);class yn{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new yn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new yn(e.changes&&Ut.fromJSON(e.changes),[],e.mapped&&Pi.fromJSON(e.mapped),e.startSelection&&re.fromJSON(e.startSelection),e.selectionsAfter.map(re.fromJSON))}static fromTransaction(e,t){let i=zn;for(let s of e.startState.facet(qL)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new yn(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,zn)}static selection(e){return new yn(void 0,zn,void 0,void 0,e)}}function sh(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function nD(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,a)=>{for(let l=0;l=c&&o<=h&&(i=!0)}}),i}function iD(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function J_(n,e){return n.length?e.length?n.concat(e):n:e}const zn=[],sD=200;function e1(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-sD));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),sh(n,n.length-1,1e9,t.setSelAfter(i)))}else return[yn.selection([e])]}function rD(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function tf(n,e){if(!n.length)return n;let t=n.length,i=zn;for(;t;){let s=oD(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[yn.selection(i)]:zn}function oD(n,e,t){let i=J_(n.selectionsAfter.length?n.selectionsAfter.map(a=>a.map(e)):zn,t);if(!n.changes)return yn.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new yn(s,Xe.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const aD=/^(input\.type|delete)($|\.)/;class Ti{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new Ti(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!i||aD.test(i))&&(!a.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):Fh(t,e))}function on(n){return n.textDirectionAt(n.state.selection.main.head)==St.LTR}const n1=n=>t1(n,!on(n)),i1=n=>t1(n,on(n));function s1(n,e){return hi(n,t=>t.empty?n.moveByGroup(t,e):Fh(t,e))}const cD=n=>s1(n,!on(n)),hD=n=>s1(n,on(n));function uD(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Bh(n,e,t){let i=Xt(n).resolveInner(e.head),s=t?Ke.closedBy:Ke.openedBy;for(let l=e.head;;){let c=t?i.childAfter(l):i.childBefore(l);if(!c)break;uD(n,c,s)?i=c:l=t?c.to:c.from}let r=i.type.prop(s),o,a;return r&&(o=t?Mi(n,i.from,1):Mi(n,i.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?i.to:i.from,re.cursor(a,t?-1:1)}const fD=n=>hi(n,e=>Bh(n.state,e,!on(n))),dD=n=>hi(n,e=>Bh(n.state,e,on(n)));function r1(n,e){return hi(n,t=>{if(!t.empty)return Fh(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const o1=n=>r1(n,!1),a1=n=>r1(n,!0);function l1(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):Fh(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),a=n.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottomc1(n,!1),Od=n=>c1(n,!0);function ks(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=re.cursor(i.from+r))}return s}const pD=n=>hi(n,e=>ks(n,e,!0)),mD=n=>hi(n,e=>ks(n,e,!1)),gD=n=>hi(n,e=>ks(n,e,!on(n))),OD=n=>hi(n,e=>ks(n,e,on(n))),vD=n=>hi(n,e=>re.cursor(n.lineBlockAt(e.head).from,1)),xD=n=>hi(n,e=>re.cursor(n.lineBlockAt(e.head).to,-1));function SD(n,e,t){let i=!1,s=Uo(n.selection,r=>{let o=Mi(n,r.head,-1)||Mi(n,r.head,1)||r.head>0&&Mi(n,r.head-1,1)||r.headSD(n,e,!1);function Zn(n,e){let t=Uo(n.state.selection,i=>{let s=e(i);return re.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Li(n.state,t)),!0)}function h1(n,e){return Zn(n,t=>n.moveByChar(t,e))}const u1=n=>h1(n,!on(n)),f1=n=>h1(n,on(n));function d1(n,e){return Zn(n,t=>n.moveByGroup(t,e))}const yD=n=>d1(n,!on(n)),bD=n=>d1(n,on(n)),wD=n=>Zn(n,e=>Bh(n.state,e,!on(n))),MD=n=>Zn(n,e=>Bh(n.state,e,on(n)));function p1(n,e){return Zn(n,t=>n.moveVertically(t,e))}const m1=n=>p1(n,!1),g1=n=>p1(n,!0);function O1(n,e){return Zn(n,t=>n.moveVertically(t,e,l1(n).height))}const xO=n=>O1(n,!1),SO=n=>O1(n,!0),TD=n=>Zn(n,e=>ks(n,e,!0)),ED=n=>Zn(n,e=>ks(n,e,!1)),AD=n=>Zn(n,e=>ks(n,e,!on(n))),PD=n=>Zn(n,e=>ks(n,e,on(n))),CD=n=>Zn(n,e=>re.cursor(n.lineBlockAt(e.head).from)),RD=n=>Zn(n,e=>re.cursor(n.lineBlockAt(e.head).to)),_O=({state:n,dispatch:e})=>(e(Li(n,{anchor:0})),!0),yO=({state:n,dispatch:e})=>(e(Li(n,{anchor:n.doc.length})),!0),bO=({state:n,dispatch:e})=>(e(Li(n,{anchor:n.selection.main.anchor,head:0})),!0),wO=({state:n,dispatch:e})=>(e(Li(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),kD=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),LD=({state:n,dispatch:e})=>{let t=zh(n).map(({from:i,to:s})=>re.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:re.create(t),userEvent:"select"})),!0},DD=({state:n,dispatch:e})=>{let t=Uo(n.selection,i=>{var s;let r=Xt(n).resolveInner(i.head,1);for(;!(r.from=i.to||r.to>i.to&&r.from<=i.from||!(!((s=r.parent)===null||s===void 0)&&s.parent));)r=r.parent;return re.range(r.to,r.from)});return e(Li(n,t)),!0},UD=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=re.create([t.main]):t.main.empty||(i=re.create([re.cursor(t.main.head)])),i?(e(Li(n,i)),!0):!1};function Xh(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:a}=r;if(o==a){let l=e(o);lo&&(t="delete.forward",l=tc(n,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=tc(n,o,!1),a=tc(n,a,!0);return o==a?{range:r}:{changes:{from:o,to:a},range:re.cursor(o)}});return s.changes.empty?!1:(n.dispatch(i.update(s,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?Ee.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function tc(n,e,t){if(n instanceof Ee)for(let i of n.state.facet(Ee.atomicRanges).map(s=>s(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const v1=(n,e)=>Xh(n,t=>{let{state:i}=n,s=i.doc.lineAt(t),r,o;if(!e&&t>s.from&&tv1(n,!1),x1=n=>v1(n,!0),S1=(n,e)=>Xh(n,t=>{let i=t,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let a=null;;){if(i==(e?r.to:r.from)){i==t&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let l=rn(r.text,i-r.from,e)+r.from,c=r.text.slice(Math.min(i,l)-r.from,Math.max(i,l)-r.from),h=o(c);if(a!=null&&h!=a)break;(c!=" "||i!=t)&&(a=h),i=l}return i}),_1=n=>S1(n,!1),ID=n=>S1(n,!0),y1=n=>Xh(n,e=>{let t=n.lineBlockAt(e).to;return eXh(n,e=>{let t=n.lineBlockAt(e).from;return e>t?t:Math.max(0,e-1)}),ND=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:ot.of(["",""])},range:re.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},$D=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:rn(r.text,s-r.from,!1)+r.from,a=s==r.to?s+1:rn(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:a,insert:n.doc.slice(s,a).append(n.doc.slice(o,s))},range:re.cursor(a)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function zh(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function b1(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of zh(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),a=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let l of r.ranges)s.push(re.range(Math.min(n.doc.length,l.anchor+a),Math.min(n.doc.length,l.head+a)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let l of r.ranges)s.push(re.range(l.anchor-a,l.head-a))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:re.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const FD=({state:n,dispatch:e})=>b1(n,e,!1),BD=({state:n,dispatch:e})=>b1(n,e,!0);function w1(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of zh(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});return e(n.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const XD=({state:n,dispatch:e})=>w1(n,e,!1),zD=({state:n,dispatch:e})=>w1(n,e,!0),VD=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(zh(e).map(({from:s,to:r})=>(s>0?s--:rn.moveVertically(s,!0)).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function WD(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Xt(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(Ke.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from?{from:i.to,to:s.from}:null}const GD=M1(!1),ZD=M1(!0);function M1(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,a=e.doc.lineAt(r),l=!n&&r==o&&WD(e,r);n&&(r=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new Qh(e,{simulateBreak:r,simulateDoubleBreak:!!l}),h=Tp(c,r);for(h==null&&(h=/^\s*/.exec(e.doc.lineAt(r).text)[0].length);oa.from&&r{let s=[];for(let o=i.from;o<=i.to;){let a=n.doc.lineAt(o);a.number>t&&(i.empty||i.to>a.from)&&(e(a,s,i),t=a.number),o=a.to+1}let r=n.changes(s);return{changes:s,range:re.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const HD=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new Qh(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=Cp(n,(r,o,a)=>{let l=Tp(i,r.from);if(l==null)return;/\S/.test(r.text)||(l=0);let c=/^\s*/.exec(r.text)[0],h=Ua(n,l);(c!=h||a.fromn.readOnly?!1:(e(n.update(Cp(n,(t,i)=>{i.push({from:t.from,insert:n.facet(tl)})}),{userEvent:"input.indent"})),!0),E1=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Cp(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=ja(s,n.tabSize),o=0,a=Ua(n,Math.max(0,r-th(n)));for(;o({mac:n.key,run:n.run,shift:n.shift}))),qD=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:fD,shift:wD},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:dD,shift:MD},{key:"Alt-ArrowUp",run:FD},{key:"Shift-Alt-ArrowUp",run:XD},{key:"Alt-ArrowDown",run:BD},{key:"Shift-Alt-ArrowDown",run:zD},{key:"Escape",run:UD},{key:"Mod-Enter",run:ZD},{key:"Alt-l",mac:"Ctrl-l",run:LD},{key:"Mod-i",run:DD,preventDefault:!0},{key:"Mod-[",run:E1},{key:"Mod-]",run:T1},{key:"Mod-Alt-\\",run:HD},{key:"Shift-Mod-k",run:VD},{key:"Shift-Mod-\\",run:_D},{key:"Mod-/",run:zL},{key:"Alt-A",run:WL}].concat(jD),KD={key:"Tab",run:T1,shift:E1};function ht(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;en.normalize("NFKD"):n=>n;class Eo{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?a=>r(MO(a)):MO,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return jt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=hp(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Xn(e);let s=this.normalize(t);for(let r=0,o=i;;r++){let a=s.charCodeAt(r),l=this.match(a,o);if(r==s.length-1){if(l)return this.value=l,this;break}o==i&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=rh(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let a=new co(t,e.sliceString(t,i));return nf.set(e,a),a}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this.matchPos=rh(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=co.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(C1.prototype[Symbol.iterator]=R1.prototype[Symbol.iterator]=function(){return this});function JD(n){try{return new RegExp(n,Rp),!0}catch{return!1}}function rh(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function xd(n){let e=ht("input",{class:"cm-textfield",name:"line"}),t=ht("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:oh.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},ht("label",n.state.phrase("Go to line"),": ",e)," ",ht("button",{class:"cm-button",type:"submit"},n.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:r}=n,o=r.doc.lineAt(r.selection.main.head),[,a,l,c,h]=s,u=c?+c.slice(1):0,f=l?+l:o.number;if(l&&h){let O=f/100;a&&(O=O*(a=="-"?-1:1)+o.number/r.doc.lines),f=Math.round(r.doc.lines*O)}else l&&a&&(f=f*(a=="-"?-1:1)+o.number);let d=r.doc.line(Math.max(1,Math.min(r.doc.lines,f))),g=re.cursor(d.from+Math.max(0,Math.min(u,d.length)));n.dispatch({effects:[oh.of(!1),Ee.scrollIntoView(g.from,{y:"center"})],selection:g}),n.focus()}return{dom:t}}const oh=Xe.define(),TO=Ht.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(oh)&&(n=t.value);return n},provide:n=>Da.from(n,e=>e?xd:null)}),eU=n=>{let e=La(n,xd);if(!e){let t=[oh.of(!0)];n.state.field(TO,!1)==null&&t.push(Xe.appendConfig.of([TO,tU])),n.dispatch({effects:t}),e=La(n,xd)}return e&&e.dom.querySelector("input").focus(),!0},tU=Ee.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),nU={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},k1=Ce.define({combine(n){return ki(n,nU,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function iU(n){let e=[lU,aU];return n&&e.push(k1.of(n)),e}const sU=Ie.mark({class:"cm-selectionMatch"}),rU=Ie.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function EO(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=vt.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=vt.Word)}function oU(n,e,t,i){return n(e.sliceDoc(t,t+1))==vt.Word&&n(e.sliceDoc(i-1,i))==vt.Word}const aU=Dt.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(k1),{state:t}=n,i=t.selection;if(i.ranges.length>1)return Ie.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return Ie.none;let l=t.wordAt(s.head);if(!l)return Ie.none;o=t.charCategorizer(s.head),r=t.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l200)return Ie.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(EO(o,t,s.from,s.to)&&oU(o,t,s.from,s.to)))return Ie.none}else if(r=t.sliceDoc(s.from,s.to).trim(),!r)return Ie.none}let a=[];for(let l of n.visibleRanges){let c=new Eo(t.doc,r,l.from,l.to);for(;!c.next().done;){let{from:h,to:u}=c.value;if((!o||EO(o,t,h,u))&&(s.empty&&h<=s.from&&u>=s.to?a.push(rU.range(h,u)):(h>=s.to||u<=s.from)&&a.push(sU.range(h,u)),a.length>e.maxMatches))return Ie.none}}return Ie.set(a)}},{decorations:n=>n.decorations}),lU=Ee.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),cU=({state:n,dispatch:e})=>{let{selection:t}=n,i=re.create(t.ranges.map(s=>n.wordAt(s.head)||re.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function hU(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,a=new Eo(n.doc,e,i[i.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Eo(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(l=>l.from==a.value.from))continue;if(r){let l=n.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const uU=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return cU({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=hU(n,i);return s?(e(n.update({selection:n.selection.addRange(re.range(s.from,s.to),!1),effects:Ee.scrollIntoView(s.to)})),!0):!1},Io=Ce.define({combine(n){return ki(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new bU(e),scrollToMatch:e=>Ee.scrollIntoView(e)})}});class L1{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||JD(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new mU(this):new dU(this)}getCursor(e,t=0,i){let s=e.doc?e:tt.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?Vr(this,s,t,i):zr(this,s,t,i)}}class D1{constructor(e){this.spec=e}}function zr(n,e,t,i){return new Eo(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),n.wholeWord?fU(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function fU(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=zr(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Vr(n,e,t,i){return new C1(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?pU(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function ah(n,e){return n.slice(rn(n,e,!1),e)}function lh(n,e){return n.slice(e,rn(n,e))}function pU(n){return(e,t,i)=>!i[0].length||(n(ah(i.input,i.index))!=vt.Word||n(lh(i.input,i.index))!=vt.Word)&&(n(lh(i.input,i.index+i[0].length))!=vt.Word||n(ah(i.input,i.index+i[0].length))!=vt.Word)}class mU extends D1{nextMatch(e,t,i){let s=Vr(this.spec,e,i,e.doc.length).next();return s.done&&(s=Vr(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Vr(this.spec,e,r,i),a=null;for(;!o.next().done;)a=o.value;if(a&&(r==t||a.from>r+10))return a;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(t,i)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Vr(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const Ia=Xe.define(),kp=Xe.define(),Ss=Ht.define({create(n){return new sf(Sd(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Ia)?n=new sf(t.value.create(),n.panel):t.is(kp)&&(n=new sf(n.query,t.value?Lp:null));return n},provide:n=>Da.from(n,e=>e.panel)});class sf{constructor(e,t){this.query=e,this.panel=t}}const gU=Ie.mark({class:"cm-searchMatch"}),OU=Ie.mark({class:"cm-searchMatch cm-searchMatch-selected"}),vU=Dt.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(Ss))}update(n){let e=n.state.field(Ss);(e!=n.startState.field(Ss)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Ie.none;let{view:t}=this,i=new Ms;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-2*250;)l=r[++s].to;n.highlight(t.state,a,l,(c,h)=>{let u=t.state.selection.ranges.some(f=>f.from==c&&f.to==h);i.add(c,h,u?OU:gU)})}return i.finish()}},{decorations:n=>n.decorations});function sl(n){return e=>{let t=e.state.field(Ss,!1);return t&&t.query.spec.valid?n(e,t):Q1(e)}}const ch=sl((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=re.single(i.from,i.to),r=n.state.facet(Io);return n.dispatch({selection:s,effects:[Dp(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),I1(n),!0}),hh=sl((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=re.single(s.from,s.to),o=n.state.facet(Io);return n.dispatch({selection:r,effects:[Dp(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),I1(n),!0}),xU=sl((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:re.create(t.map(i=>re.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),SU=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let a=new Eo(n.doc,n.sliceDoc(i,s));!a.next().done;){if(r.length>1e3)return!1;a.value.from==i&&(o=r.length),r.push(re.range(a.value.from,a.value.to))}return e(n.update({selection:re.create(r,o),userEvent:"select.search.matches"})),!0},AO=sl((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=[],a,l,c=[];if(r.from==i&&r.to==s&&(l=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:l}),r=e.nextMatch(t,r.from,r.to),c.push(Ee.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))),r){let h=o.length==0||o[0].from>=r.to?0:r.to-r.from-l.length;a=re.single(r.from-h,r.to-h),c.push(Dp(n,r)),c.push(t.facet(Io).scrollToMatch(a.main,n))}return n.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),_U=sl((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:Ee.announce.of(i),userEvent:"input.replace.all"}),!0});function Lp(n){return n.state.facet(Io).createPanel(n)}function Sd(n,e){var t,i,s,r,o;let a=n.selection.main,l=a.empty||a.to>a.from+100?"":n.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=n.facet(Io);return new L1({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:c.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:c.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function U1(n){let e=La(n,Lp);return e&&e.dom.querySelector("[main-field]")}function I1(n){let e=U1(n);e&&e==n.root.activeElement&&e.select()}const Q1=n=>{let e=n.state.field(Ss,!1);if(e&&e.panel){let t=U1(n);if(t&&t!=n.root.activeElement){let i=Sd(n.state,e.query.spec);i.valid&&n.dispatch({effects:Ia.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[kp.of(!0),e?Ia.of(Sd(n.state,e.query.spec)):Xe.appendConfig.of(MU)]});return!0},N1=n=>{let e=n.state.field(Ss,!1);if(!e||!e.panel)return!1;let t=La(n,Lp);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:kp.of(!1)}),!0},yU=[{key:"Mod-f",run:Q1,scope:"editor search-panel"},{key:"F3",run:ch,shift:hh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ch,shift:hh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:N1,scope:"editor search-panel"},{key:"Mod-Shift-l",run:SU},{key:"Alt-g",run:eU},{key:"Mod-d",run:uU,preventDefault:!0}];class bU{constructor(e){this.view=e;let t=this.query=e.state.field(Ss).query.spec;this.commit=this.commit.bind(this),this.searchField=ht("input",{value:t.search,placeholder:Rn(e,"Find"),"aria-label":Rn(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ht("input",{value:t.replace,placeholder:Rn(e,"Replace"),"aria-label":Rn(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ht("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=ht("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=ht("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return ht("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=ht("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>ch(e),[Rn(e,"next")]),i("prev",()=>hh(e),[Rn(e,"previous")]),i("select",()=>xU(e),[Rn(e,"all")]),ht("label",null,[this.caseField,Rn(e,"match case")]),ht("label",null,[this.reField,Rn(e,"regexp")]),ht("label",null,[this.wordField,Rn(e,"by word")]),...e.state.readOnly?[]:[ht("br"),this.replaceField,i("replace",()=>AO(e),[Rn(e,"replace")]),i("replaceAll",()=>_U(e),[Rn(e,"replace all")])],ht("button",{name:"close",onclick:()=>N1(e),"aria-label":Rn(e,"close"),type:"button"},["×"])])}commit(){let e=new L1({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Ia.of(e)}))}keydown(e){$3(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?hh:ch)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),AO(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Ia)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Io).top}}function Rn(n,e){return n.state.phrase(e)}const nc=30,ic=/[\s\.,:;?!]/;function Dp(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-nc),o=Math.min(s,t+nc),a=n.state.sliceDoc(r,o);if(r!=i.from){for(let l=0;la.length-nc;l--)if(!ic.test(a[l-1])&&ic.test(a[l])){a=a.slice(0,l);break}}return Ee.announce.of(`${n.state.phrase("current match")}. ${a} ${n.state.phrase("on line")} ${i.number}.`)}const wU=Ee.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),MU=[Ss,xr.lowest(vU),wU];class $1{constructor(e,t,i){this.state=e,this.pos=t,this.explicit=i,this.abortListeners=[]}tokenBefore(e){let t=Xt(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(B1(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function PO(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function TU(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:TU(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function EU(n,e){return t=>{for(let i=Xt(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class CO{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function _s(n){return n.selection.main.from}function B1(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const X1=ts.define();function AU(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return Object.assign(Object.assign({},n.changeByRange(a=>a!=s&&t!=i&&n.sliceDoc(a.from+r,a.from+o)!=n.sliceDoc(t,i)?{range:a}:{changes:{from:a.from+r,to:i==s.from?a.to:a.from+o,insert:e},range:re.cursor(a.from+r+e.length)})),{userEvent:"input.complete"})}const RO=new WeakMap;function PU(n){if(!Array.isArray(n))return n;let e=RO.get(n);return e||RO.set(n,e=F1(n)),e}const Up=Xe.define(),Qa=Xe.define();class CU{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(T=hp(w))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!y||C==1&&m||x==0&&C!=0)&&(t[u]==w||i[u]==w&&(f=!0)?o[u++]=y:o.length&&(p=!1)),x=C,y+=Xn(w)}return u==l&&o[0]==0&&p?this.result(-100+(f?-200:0),o,e):d==l&&g==0?this.ret(-200-e.length+(O==e.length?0:-100),[0,O]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):d==l?this.ret(-200+-700-e.length,[g,O]):u==l?this.result(-100+(f?-200:0)+-700+(p?0:-1100),o,e):t.length==2?!1:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let a=o+(this.astral?Xn(jt(i,o)):1);r&&s[r-1]==o?s[r-1]=a:(s[r++]=o,s[r++]=a)}return this.ret(e-i.length,s)}}const bn=Ce.define({combine(n){return ki(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:RU,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>kO(e(i),t(i)),optionClass:(e,t)=>i=>kO(e(i),t(i)),addToOptions:(e,t)=>e.concat(t)})}});function kO(n,e){return n?e?n+" "+e:n:e}function RU(n,e,t,i,s){let r=n.textDirection==St.RTL,o=r,a=!1,l="top",c,h,u=e.left-s.left,f=s.right-e.right,d=i.right-i.left,g=i.bottom-i.top;if(o&&u=g||O>e.top?c=t.bottom-e.top:(l="bottom",c=e.bottom-t.top)}return{style:`${l}: ${c}px; max-width: ${h}px`,class:"cm-completionInfo-"+(a?r?"left-narrow":"right-narrow":o?"left":"right")}}function kU(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s){let r=document.createElement("span");r.className="cm-completionLabel";let o=t.displayLabel||t.label,a=0;for(let l=0;la&&r.appendChild(document.createTextNode(o.slice(a,c)));let u=r.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(o.slice(c,h))),u.className="cm-completionMatchedText",a=h}return at.position-i.position).map(t=>t.render)}function LO(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class LU{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,a=e.state.facet(bn);this.optionContent=kU(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=LO(r.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{for(let c=l.target,h;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(h=/-(\d+)$/.exec(c.id))&&+h[1]{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(bn).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Qa.of(null)})}),this.list=this.dom.appendChild(this.createListBox(r,s.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}mount(){this.updateSel()}update(e){var t,i,s;let r=e.state.field(this.stateField),o=e.startState.field(this.stateField);this.updateTooltipClass(e.state),r!=o&&(this.updateSel(),((t=r.open)===null||t===void 0?void 0:t.disabled)!=((i=o.open)===null||i===void 0?void 0:i.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(!((s=r.open)===null||s===void 0)&&s.disabled)))}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=LO(t.options.length,t.selected,this.view.state.facet(bn).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t.options,e.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let r=typeof s=="string"?document.createTextNode(s):s(i);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>Wn(this.view.state,o,"completion info")):this.addInfoPane(r,i)}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return t&&UU(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottomi.from||i.from==0))if(r=f,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=f}}const h=s.appendChild(document.createElement("li"));h.id=t+"-"+o,h.setAttribute("role","option");let u=this.optionClass(a);u&&(h.className=u);for(let f of this.optionContent){let d=f(a,this.view.state,l);d&&h.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew LU(t,n,e)}function UU(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect();i.topt.bottom&&(n.scrollTop+=i.bottom-t.bottom)}function DO(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function IU(n,e){let t=[],i=null,s=l=>{t.push(l);let{section:c}=l.completion;if(c){i||(i=[]);let h=typeof c=="string"?c:c.name;i.some(u=>u.name==h)||i.push(typeof c=="string"?{name:h}:c)}};for(let l of n)if(l.hasResult()){let c=l.result.getMatch;if(l.result.filter===!1)for(let h of l.result.options)s(new CO(h,l.source,c?c(h):[],1e9-t.length));else{let h=new CU(e.sliceDoc(l.from,l.to));for(let u of l.result.options)if(h.match(u.label)){let f=u.displayLabel?c?c(u,h.matched):[]:h.matched;s(new CO(u,l.source,f,h.score+(u.boost||0)))}}}if(i){let l=Object.create(null),c=0,h=(u,f)=>{var d,g;return((d=u.rank)!==null&&d!==void 0?d:1e9)-((g=f.rank)!==null&&g!==void 0?g:1e9)||(u.nameh.score-c.score||a(c.completion,h.completion))){let c=l.completion;!o||o.label!=c.label||o.detail!=c.detail||o.type!=null&&c.type!=null&&o.type!=c.type||o.apply!=c.apply||o.boost!=c.boost?r.push(l):DO(l.completion)>DO(o)&&(r[r.length-1]=l),o=l.completion}return r}class qr{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new qr(this.options,UO(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r){let o=IU(e,t);if(!o.length)return s&&e.some(l=>l.state==1)?new qr(s.options,s.attrs,s.tooltip,s.timestamp,s.selected,!0):null;let a=t.facet(bn).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let l=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(l,c.from):l,1e8),create:DU(Un,W1),above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new qr(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class uh{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new uh($U,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(bn),r=(i.override||t.languageDataAt("autocomplete",_s(t)).map(PU)).map(a=>(this.active.find(c=>c.source==a)||new _n(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,l)=>a==this.active[l])&&(r=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!QU(r,this.active)?o=qr.build(r,t,this.id,o,i):o&&o.disabled&&!r.some(a=>a.state==1)&&(o=null),!o&&r.every(a=>a.state!=1)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new _n(a.source,0):a));for(let a of e.effects)a.is(V1)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new uh(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:NU}}function QU(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const $U=[];function _d(n){return n.isUserEvent("input.type")?"input":n.isUserEvent("delete.backward")?"delete":null}class _n{constructor(e,t,i=-1){this.source=e,this.state=t,this.explicitPos=i}hasResult(){return!1}update(e,t){let i=_d(e),s=this;i?s=s.handleUserEvent(e,i,t):e.docChanged?s=s.handleChange(e):e.selection&&s.state!=0&&(s=new _n(s.source,0));for(let r of e.effects)if(r.is(Up))s=new _n(s.source,1,r.value?_s(e.state):-1);else if(r.is(Qa))s=new _n(s.source,0);else if(r.is(z1))for(let o of r.value)o.source==s.source&&(s=o);return s}handleUserEvent(e,t,i){return t=="delete"||!i.activateOnTyping?this.map(e.changes):new _n(this.source,1)}handleChange(e){return e.changes.touchesRange(_s(e.startState))?new _n(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new _n(this.source,this.state,e.mapPos(this.explicitPos))}}class ho extends _n{constructor(e,t,i,s,r){super(e,2,t),this.result=i,this.from=s,this.to=r}hasResult(){return!0}handleUserEvent(e,t,i){var s;let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=_s(e.state);if((this.explicitPos<0?a<=r:ao||t=="delete"&&_s(e.startState)==this.from)return new _n(this.source,t=="input"&&i.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),c;return FU(this.result.validFor,e.state,r,o)?new ho(this.source,l,this.result,r,o):this.result.update&&(c=this.result.update(this.result,r,o,new $1(e.state,a,l>=0)))?new ho(this.source,l,c,c.from,(s=c.to)!==null&&s!==void 0?s:_s(e.state)):new _n(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new _n(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new ho(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function FU(n,e,t,i){if(!n)return!1;let s=e.sliceDoc(t,i);return typeof n=="function"?n(s,t,i,e):B1(n,!0).test(s)}const z1=Xe.define({map(n,e){return n.map(t=>t.map(e))}}),V1=Xe.define(),Un=Ht.define({create(){return uh.start()},update(n,e){return n.update(e)},provide:n=>[xp.from(n,e=>e.tooltip),Ee.contentAttributes.from(n,e=>e.attrs)]});function W1(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Un).active.find(s=>s.source==e.source);return i instanceof ho?(typeof t=="string"?n.dispatch(Object.assign(Object.assign({},AU(n.state,t,i.from,i.to)),{annotations:X1.of(e.completion)})):t(n,e.completion,i.from,i.to),!0):!1}function sc(n,e="option"){return t=>{let i=t.state.field(Un,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:V1.of(a)}),!0}}const BU=n=>{let e=n.state.field(Un,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(Un,!1)?(n.dispatch({effects:Up.of(!0)}),!0):!1,zU=n=>{let e=n.state.field(Un,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Qa.of(null)}),!0)};class VU{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const IO=50,WU=50,GU=1e3,ZU=Dt.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of n.state.field(Un).active)e.state==1&&this.startQuery(e)}update(n){let e=n.state.field(Un);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Un)==e)return;let t=n.transactions.some(i=>(i.selection||i.docChanged)&&!_d(i));for(let i=0;iWU&&Date.now()-s.time>GU){for(let r of s.context.abortListeners)try{r()}catch(o){Wn(this.view.state,o)}s.context.abortListeners=null,this.running.splice(i--,1)}else s.updates.push(...n.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(i=>i.state==1&&!this.running.some(s=>s.active.source==i.source))?setTimeout(()=>this.startUpdate(),IO):-1,this.composing!=0)for(let i of n.transactions)_d(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:n}=this.view,e=n.field(Un);for(let t of e.active)t.state==1&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t)}startQuery(n){let{state:e}=this.view,t=_s(e),i=new $1(e,t,n.explicitPos==t),s=new VU(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:Qa.of(null)}),Wn(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),IO))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(bn);for(let i=0;io.source==s.active.source);if(r&&r.state==1)if(s.done==null){let o=new _n(s.active.source,0);for(let a of s.updates)o=o.update(a,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:z1.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Un,!1);if(e&&e.tooltip&&this.view.state.facet(bn).closeOnBlur){let t=e.open&&__(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&this.view.dispatch({effects:Qa.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Up.of(!1)}),20),this.composing=0}}}),G1=Ee.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class HU{constructor(e,t,i,s){this.field=e,this.line=t,this.from=i,this.to=s}}class Ip{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,Kt.TrackDel),i=e.mapPos(this.to,1,Kt.TrackDel);return t==null||i==null?null:new Ip(this.field,t,i)}}class Qp{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let l of this.lines){if(i.length){let c=o,h=/^\t*/.exec(l)[0].length;for(let u=0;unew Ip(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:i,ranges:a}}static parse(e){let t=[],i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let a=r[1]?+r[1]:null,l=r[2]||r[3]||"",c=-1;for(let h=0;h=c&&u.field++}s.push(new HU(c,i.length,r.index,r.index+l.length)),o=o.slice(0,r.index)+l+o.slice(r.index+r[0].length)}for(let a;a=/\\([{}])/.exec(o);){o=o.slice(0,a.index)+a[1]+o.slice(a.index+a[0].length);for(let l of s)l.line==i.length&&l.from>a.index&&(l.from--,l.to--)}i.push(o)}return new Qp(i,s)}}let YU=Ie.widget({widget:new class extends ns{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),jU=Ie.mark({class:"cm-snippetField"});class Qo{constructor(e,t){this.ranges=e,this.active=t,this.deco=Ie.set(e.map(i=>(i.from==i.to?YU:jU).range(i.from,i.to)))}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new Qo(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const rl=Xe.define({map(n,e){return n&&n.map(e)}}),qU=Xe.define(),Na=Ht.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(rl))return t.value;if(t.is(qU)&&n)return new Qo(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>Ee.decorations.from(n,e=>e?e.deco:Ie.none)});function Np(n,e){return re.create(n.filter(t=>t.field==e).map(t=>re.range(t.from,t.to)))}function KU(n){let e=Qp.parse(n);return(t,i,s,r)=>{let{text:o,ranges:a}=e.instantiate(t.state,s),l={changes:{from:s,to:r,insert:ot.of(o)},scrollIntoView:!0,annotations:i?X1.of(i):void 0};if(a.length&&(l.selection=Np(a,0)),a.length>1){let c=new Qo(a,0),h=l.effects=[rl.of(c)];t.state.field(Na,!1)===void 0&&h.push(Xe.appendConfig.of([Na,iI,sI,G1]))}t.dispatch(t.state.update(l))}}function Z1(n){return({state:e,dispatch:t})=>{let i=e.field(Na,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return t(e.update({selection:Np(i.ranges,s),effects:rl.of(r?null:new Qo(i.ranges,s))})),!0}}const JU=({state:n,dispatch:e})=>n.field(Na,!1)?(e(n.update({effects:rl.of(null)})),!0):!1,eI=Z1(1),tI=Z1(-1),nI=[{key:"Tab",run:eI,shift:tI},{key:"Escape",run:JU}],QO=Ce.define({combine(n){return n.length?n[0]:nI}}),iI=xr.highest(Ja.compute([QO],n=>n.facet(QO)));function Jn(n,e){return Object.assign(Object.assign({},e),{apply:KU(n)})}const sI=Ee.domEventHandlers({mousedown(n,e){let t=e.state.field(Na,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==t.active?!1:(e.dispatch({selection:Np(t.ranges,s.field),effects:rl.of(t.ranges.some(r=>r.field>s.field)?new Qo(t.ranges,s.field):null)}),!0)}}),$a={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},er=Xe.define({map(n,e){let t=e.mapPos(n,-1,Kt.TrackAfter);return t??void 0}}),$p=new class extends pr{};$p.startSide=1;$p.endSide=-1;const H1=Ht.define({create(){return lt.empty},update(n,e){if(e.selection){let t=e.state.doc.lineAt(e.selection.main.head).from,i=e.startState.doc.lineAt(e.startState.selection.main.head).from;t!=e.changes.mapPos(i,-1)&&(n=lt.empty)}n=n.map(e.changes);for(let t of e.effects)t.is(er)&&(n=n.update({add:[$p.range(t.value,t.value+1)]}));return n}});function rI(){return[aI,H1]}const rf="()[]{}<>";function Y1(n){for(let e=0;e{if((oI?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&Xn(jt(i,0))==1||e!=s.from||t!=s.to)return!1;let r=hI(n.state,i);return r?(n.dispatch(r),!0):!1}),lI=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=j1(n,n.selection.main.head).brackets||$a.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let a=uI(n.doc,o.head);for(let l of i)if(l==a&&Vh(n.doc,o.head)==Y1(jt(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:re.cursor(o.head-l.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},cI=[{key:"Backspace",run:lI}];function hI(n,e){let t=j1(n,n.selection.main.head),i=t.brackets||$a.brackets;for(let s of i){let r=Y1(jt(s,0));if(e==s)return r==s?pI(n,s,i.indexOf(s+s+s)>-1,t):fI(n,s,r,t.before||$a.before);if(e==r&&q1(n,n.selection.main.from))return dI(n,s,r)}return null}function q1(n,e){let t=!1;return n.field(H1).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Vh(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Xn(jt(t,0)))}function uI(n,e){let t=n.sliceString(e-2,e);return Xn(jt(t,0))==t.length?t:t.slice(1)}function fI(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:er.of(o.to+e.length),range:re.range(o.anchor+e.length,o.head+e.length)};let a=Vh(n.doc,o.head);return!a||/\s/.test(a)||i.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:er.of(o.head+e.length),range:re.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function dI(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&Vh(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:re.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function pI(n,e,t,i){let s=i.stringPrefixes||$a.stringPrefixes,r=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:er.of(a.to+e.length),range:re.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Vh(n.doc,l),h;if(c==e){if(NO(n,l))return{changes:{insert:e+e,from:l},effects:er.of(l+e.length),range:re.cursor(l+e.length)};if(q1(n,l)){let f=t&&n.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:re.cursor(l+f.length)}}}else{if(t&&n.sliceDoc(l-2*e.length,l)==e+e&&(h=$O(n,l-2*e.length,s))>-1&&NO(n,h))return{changes:{insert:e+e+e+e,from:l},effects:er.of(l+e.length),range:re.cursor(l+e.length)};if(n.charCategorizer(l)(c)!=vt.Word&&$O(n,l,s)>-1&&!mI(n,l,e,s))return{changes:{insert:e+e,from:l},effects:er.of(l+e.length),range:re.cursor(l+e.length)}}return{range:r=a}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function NO(n,e){let t=Xt(n).resolveInner(e+1);return t.parent&&t.from==e}function mI(n,e,t,i){let s=Xt(n).resolveInner(e,-1),r=i.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),l=a.indexOf(t);if(!l||l>-1&&i.indexOf(a.slice(0,l))>-1){let h=s.firstChild;for(;h&&h.from==s.from&&h.to-h.from>t.length+l;){if(n.sliceDoc(h.to-t.length,h.to)==t)return!1;h=h.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function $O(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=vt.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=vt.Word)return r}return-1}function gI(n={}){return[Un,bn.of(n),ZU,OI,G1]}const K1=[{key:"Ctrl-Space",run:XU},{key:"Escape",run:zU},{key:"ArrowDown",run:sc(!0)},{key:"ArrowUp",run:sc(!1)},{key:"PageDown",run:sc(!0,"page")},{key:"PageUp",run:sc(!1,"page")},{key:"Enter",run:BU}],OI=xr.highest(Ja.computeN([bn],n=>n.facet(bn).defaultKeymap?[K1]:[]));class vI{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Ys{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=e,r=i.facet(ty).markerFilter;r&&(s=r(s));let o=Ie.set(s.map(a=>a.from==a.to||a.from==a.to-1&&i.doc.lineAt(a.from).to==a.from?Ie.widget({widget:new EI(a),diagnostic:a}).range(a.from):Ie.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new Ys(o,t,Ao(o))}}function Ao(n,e=null,t=0){let i=null;return n.between(t,1e9,(s,r,{spec:o})=>{if(!(e&&o.diagnostic!=e))return i=new vI(s,r,o.diagnostic),!1}),i}function xI(n,e){let t=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(i=>i.is(J1))||n.changes.touchesRange(t.from,t.to))}function SI(n,e){return n.field(Qn,!1)?e:e.concat(Xe.appendConfig.of(CI))}const J1=Xe.define(),Fp=Xe.define(),ey=Xe.define(),Qn=Ht.define({create(){return new Ys(Ie.none,null,null)},update(n,e){if(e.docChanged){let t=n.diagnostics.map(e.changes),i=null;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);i=Ao(t,n.selected.diagnostic,s)||Ao(t,null,s)}n=new Ys(t,n.panel,i)}for(let t of e.effects)t.is(J1)?n=Ys.init(t.value,n.panel,e.state):t.is(Fp)?n=new Ys(n.diagnostics,t.value?Wh.open:null,n.selected):t.is(ey)&&(n=new Ys(n.diagnostics,n.panel,t.value));return n},provide:n=>[Da.from(n,e=>e.panel),Ee.decorations.from(n,e=>e.diagnostics)]}),_I=Ie.mark({class:"cm-lintRange cm-lintRange-active"});function yI(n,e,t){let{diagnostics:i}=n.state.field(Qn),s=[],r=2e8,o=0;i.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:h})=>{e>=l&&e<=c&&(l==c||(e>l||t>0)&&(eiy(n,t,!1)))}const wI=n=>{let e=n.state.field(Qn,!1);(!e||!e.panel)&&n.dispatch({effects:SI(n.state,[Fp.of(!0)])});let t=La(n,Wh.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},FO=n=>{let e=n.state.field(Qn,!1);return!e||!e.panel?!1:(n.dispatch({effects:Fp.of(!1)}),!0)},MI=n=>{let e=n.state.field(Qn,!1);if(!e)return!1;let t=n.state.selection.main,i=e.diagnostics.iter(t.to+1);return!i.value&&(i=e.diagnostics.iter(0),!i.value||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},TI=[{key:"Mod-Shift-m",run:wI,preventDefault:!0},{key:"F8",run:MI}],ty=Ce.define({combine(n){return Object.assign({sources:n.map(e=>e.source)},ki(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t}))}});function ny(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function iy(n,e,t){var i;let s=t?ny(e.actions):[];return ht("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ht("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let d=Ao(n.state.field(Qn).diagnostics,e);d&&r.apply(n,d.from,d.to)},{name:c}=r,h=s[o]?c.indexOf(s[o]):-1,u=h<0?c:[c.slice(0,h),ht("u",c.slice(h,h+1)),c.slice(h+1)];return ht("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${h<0?"":` (access key "${s[o]})"`}.`},u)}),e.source&&ht("div",{class:"cm-diagnosticSource"},e.source))}class EI extends ns{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return ht("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class BO{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=iy(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Wh{constructor(e){this.view=e,this.items=[];let t=s=>{if(s.keyCode==27)FO(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=ny(r.actions);for(let a=0;a{for(let r=0;rFO(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Qn).selected;if(!e)return-1;for(let t=0;t{let c=-1,h;for(let u=i;ui&&(this.items.splice(i,c-i),s=!0)),t&&h.diagnostic==t.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),r=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),i++});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{o.topa.bottom&&(this.list.scrollTop+=o.bottom-a.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Qn),i=Ao(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:ey.of(i)})}static open(e){return new Wh(e)}}function AI(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function rc(n){return AI(``,'width="6" height="3"')}const PI=Ee.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:rc("#d11")},".cm-lintRange-warning":{backgroundImage:rc("orange")},".cm-lintRange-info":{backgroundImage:rc("#999")},".cm-lintRange-hint":{backgroundImage:rc("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),CI=[Qn,Ee.decorations.compute([Qn],n=>{let{selected:e,panel:t}=n.field(Qn);return!e||!t||e.from==e.to?Ie.none:Ie.set([_I.range(e.from,e.to)])}),Tk(yI,{hideOn:xI}),PI],RI=(()=>[Uk(),Nk(),nk(),JL(),ML(),W3(),j3(),tt.allowMultipleSelections.of(!0),fL(),W_(PL,{fallback:!0}),IL(),rI(),gI(),gk(),xk(),lk(),iU(),Ja.of([...cI,...qD,...yU,...lD,...yL,...K1,...TI])])();/*! * VueCodemirror v6.1.1 * Copyright (c) Surmon. All rights reserved. * Released under the MIT License. * Surmon -*/var kI=Object.freeze({autofocus:!1,disabled:!1,indentWithTab:!0,tabSize:2,placeholder:"",autoDestroy:!0,extensions:[RI]}),LI=Symbol("vue-codemirror-global-config"),mn,DI=function(n){var e=n.onUpdate,t=n.onChange,i=n.onFocus,s=n.onBlur,r=function(o,a){var l={};for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&a.indexOf(c)<0&&(l[c]=o[c]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function"){var h=0;for(c=Object.getOwnPropertySymbols(o);ht%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let s=e.parser.context;return new fh(e,[],t,i,i,0,[],0,s?new zO(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,s=e&65535,{parser:r}=this.p,o=r.dynamicPrecedence(s);if(o&&(this.score+=o),i==0){this.pushState(r.getGoto(this.state,s,!0),this.reducePos),s=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(s,l)}storeNode(e,t,i,s=4,r=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(t==i)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(e,t,i,s);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(e,t,i){let s=this.pos;if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(t,s),t<=this.p.parser.maxNode&&this.buffer.push(t,s,i,4);else{let r=e,{parser:o}=this.p;(i>this.pos||t<=o.maxNode)&&(this.pos=i,o.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,s),this.shiftContext(t,s),t<=o.maxNode&&this.buffer.push(t,s,i,4)}}apply(e,t,i){e&65536?this.reduce(e):this.shift(e,t,i)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new fh(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new BI(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if(!(i&65536))return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let r=0,o;rl&1&&a==o)||s.push(t[r],o)}t=s}let i=[];for(let s=0;s>19,s=t&65535,r=this.stack.length-i*3;if(r<0||e.getGoto(this.stack[r],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(s,r)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-r;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=i(o,r+1);if(a!=null)return a}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class zO{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}var VO;(function(n){n[n.Insert=200]="Insert",n[n.Delete=190]="Delete",n[n.Reduce=100]="Reduce",n[n.MaxNext=4]="MaxNext",n[n.MaxInsertStackDepth=300]="MaxInsertStackDepth",n[n.DampenInsertStackDepth=120]="DampenInsertStackDepth",n[n.MinBigReduction=2e3]="MinBigReduction"})(VO||(VO={}));class BI{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class dh{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new dh(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new dh(this.stack,this.pos,this.index)}}function oa(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,s=0;i=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),r+=l,a)break;r*=46}t?t[s++]=r:t=new e(r)}return t}class yc{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const WO=new yc;class XI{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=WO,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,s=this.rangeIndex,r=this.pos+e;for(;ri.to:r>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-i.to,i=o}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,s;if(t>=0&&t=this.chunk2Pos&&ia.to&&(this.chunk2=this.chunk2.slice(0,a.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=WO,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return i}}class ho{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;sy(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}ho.prototype.contextual=ho.prototype.fallback=ho.prototype.extend=!1;class yd{constructor(e,t,i){this.precTable=t,this.elseToken=i,this.data=typeof e=="string"?oa(e):e}token(e,t){let i=e.pos,s=0;for(;;){let r=e.next<0,o=e.resolveOffset(1,1);if(sy(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(r||s++,o==null)break;e.reset(o,e.token)}s&&(e.reset(i,e.token),e.acceptToken(this.elseToken,s))}}yd.prototype.contextual=ho.prototype.fallback=ho.prototype.extend=!1;class Bp{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function sy(n,e,t,i,s,r){let o=0,a=1<0){let g=n[d];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||zI(g,e.token.value,s,r))){e.acceptToken(g);break}}let h=e.next,u=0,f=n[o+2];if(e.next<0&&f>u&&n[c+f*3-3]==65535&&n[c+f*3-3]==65535){o=n[c+f*3-1];continue e}for(;u>1,g=c+d+(d<<1),O=n[g],m=n[g+1]||65536;if(h=m)u=d+1;else{o=n[g+2],e.advance();continue e}}break}}function GO(n,e,t){for(let i=e,s;(s=n[i])!=65535;i++)if(s==t)return i-e;return-1}function zI(n,e,t,i){let s=GO(t,i,e);return s<0||GO(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class VI{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?HO(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?HO(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof kt){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class WI{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new yc)}getActions(e){let t=0,i=null,{parser:s}=e.p,{tokenizers:r}=s,o=s.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;cu.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let f=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!h.extend&&(i=u,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!i&&e.pos==this.stream.end&&(i=new yc,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new yc,{pos:i,p:s}=e;return t.start=i,t.end=Math.min(i+1,s.stream.end),t.value=i==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(s,e),i),e.value>-1){let{parser:r}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,i,s){for(let r=0;re.bufferLength*4?new VI(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],s,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)i.push(a);else{if(this.advanceStack(a,i,e))continue;{s||(s=[],r=[]),s.push(a);let l=this.tokens.getMainToken(a);r.push(l.value,l.end)}}break}}if(!i.length){let o=s&&YI(s);if(o)return this.stackToTree(o);if(this.parser.strict)throw ei&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,i);if(o)return this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((a,l)=>l.score-a.score);i.length>o;)i.pop();i.some(a=>a.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)i.splice(l--,1);else{i.splice(o--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(s);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?r.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!c||(u.prop(Ke.contextHash)||0)==h))return e.useNode(u,f),ei&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(u.type.id)})`),!0;if(!(u instanceof kt)||u.children.length==0||u.positions[0]>0)break;let d=u.children[0];if(d instanceof kt&&u.positions[0]==0)u=d;else break}}let a=r.stateSlot(e.state,4);if(a>0)return e.reduce(a),ei&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(a&65535)})`),!0;if(e.stack.length>=15e3)for(;e.stack.length>9e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;cs?t.push(g):i.push(g)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return jO(e,t),!0}}runRecovery(e,t,i){let s=null,r=!1;for(let o=0;o ":"";if(a.deadEnd&&(r||(r=!0,a.restart(),ei&&console.log(h+this.stackID(a)+" (restarted)"),this.advanceFully(a,i))))continue;let u=a.split(),f=h;for(let d=0;u.forceReduce()&&d<10&&(ei&&console.log(f+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,i));d++)ei&&(f=this.stackID(u)+" -> ");for(let d of a.recoverByInsert(l))ei&&console.log(h+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,i);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),ei&&console.log(h+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),jO(a,i)):(!s||s.scoren;class HI{constructor(e){this.start=e.start,this.shift=e.shift||af,this.reduce=e.reduce||af,this.reuse=e.reuse||af,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ph extends E_{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;ae.topRules[a][1]),s=[];for(let a=0;a=0)r(h,l,a[c++]);else{let u=a[c+-h];for(let f=-h;f>0;f--)r(a[c++],l,u);c++}}}this.nodeSet=new _p(t.map((a,l)=>Tn.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:s[l],top:i.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=w_;let o=oa(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new ho(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let s=new GI(this,e,t,i);for(let r of this.wrappers)s=r(s,e,t,i);return s}getGoto(e,t,i=!1){let s=this.goto;if(t>=s[0])return-1;for(let r=s[t+1];;){let o=s[r++],a=o&1,l=s[r++];if(a&&i)return l;for(let c=r+(o>>1);r0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),s=i?t(i):void 0;for(let r=this.stateSlot(e,1);s==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Vi(this.data,r+2);else break;s=t(Vi(this.data,r+1))}return s}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Vi(this.data,i+2);else break;if(!(this.data[i+2]&1)){let s=this.data[i+1];t.some((r,o)=>o&1&&r==s)||t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(ph.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let s=e.tokenizers.find(r=>r.from==i);return s?s.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let r=e.specializers.find(a=>a.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return t.specializers[s]=qO(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);o>=0&&(i[o]=!0)}let s=null;for(let r=0;ri)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const jI=303,KO=1,qI=2,KI=304,JI=306,eQ=307,tQ=3,nQ=4,iQ=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],ry=125,sQ=59,JO=47,rQ=42,oQ=43,aQ=45,lQ=new HI({start:!1,shift(n,e){return e==tQ||e==nQ||e==JI?n:e==eQ},strict:!1}),cQ=new Bp((n,e)=>{let{next:t}=n;(t==ry||t==-1||e.context)&&n.acceptToken(KI)},{contextual:!0,fallback:!0}),hQ=new Bp((n,e)=>{let{next:t}=n,i;iQ.indexOf(t)>-1||t==JO&&((i=n.peek(1))==JO||i==rQ)||t!=ry&&t!=sQ&&t!=-1&&!e.context&&n.acceptToken(jI)},{contextual:!0}),uQ=new Bp((n,e)=>{let{next:t}=n;if((t==oQ||t==aQ)&&(n.advance(),t==n.next)){n.advance();let i=!e.context&&e.canShift(KO);n.acceptToken(i?KO:qI)}},{contextual:!0}),fQ=A_({"get set async static":D.modifier,"for while do if else switch try catch finally return throw break continue default case":D.controlKeyword,"in of await yield void typeof delete instanceof":D.operatorKeyword,"let var const function class extends":D.definitionKeyword,"import export from":D.moduleKeyword,"with debugger as new":D.keyword,TemplateString:D.special(D.string),super:D.atom,BooleanLiteral:D.bool,this:D.self,null:D.null,Star:D.modifier,VariableName:D.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":D.function(D.variableName),VariableDefinition:D.definition(D.variableName),Label:D.labelName,PropertyName:D.propertyName,PrivatePropertyName:D.special(D.propertyName),"CallExpression/MemberExpression/PropertyName":D.function(D.propertyName),"FunctionDeclaration/VariableDefinition":D.function(D.definition(D.variableName)),"ClassDeclaration/VariableDefinition":D.definition(D.className),PropertyDefinition:D.definition(D.propertyName),PrivatePropertyDefinition:D.definition(D.special(D.propertyName)),UpdateOp:D.updateOperator,LineComment:D.lineComment,BlockComment:D.blockComment,Number:D.number,String:D.string,Escape:D.escape,ArithOp:D.arithmeticOperator,LogicOp:D.logicOperator,BitOp:D.bitwiseOperator,CompareOp:D.compareOperator,RegExp:D.regexp,Equals:D.definitionOperator,Arrow:D.function(D.punctuation),": Spread":D.punctuation,"( )":D.paren,"[ ]":D.squareBracket,"{ }":D.brace,"InterpolationStart InterpolationEnd":D.special(D.brace),".":D.derefOperator,", ;":D.separator,"@":D.meta,TypeName:D.typeName,TypeDefinition:D.definition(D.typeName),"type enum interface implements namespace module declare":D.definitionKeyword,"abstract global Privacy readonly override":D.modifier,"is keyof unique infer":D.operatorKeyword,JSXAttributeValue:D.attributeValue,JSXText:D.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":D.angleBracket,"JSXIdentifier JSXNameSpacedName":D.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":D.attributeName,"JSXBuiltin/JSXIdentifier":D.standard(D.tagName)}),dQ={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,using:413,interface:419,enum:423,namespace:429,module:431,declare:435,global:439,for:458,of:467,while:470,with:474,do:478,if:482,else:484,switch:488,case:494,try:500,catch:504,finally:508,return:512,throw:516,break:520,continue:524,debugger:528},pQ={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},mQ={__proto__:null,"<":137},gQ=ph.deserialize({version:14,states:"$6tO`QUOOO%TQUOOO'WQWOOP(eOSOOO*sQ(CjO'#CfO*zOpO'#CgO+YO!bO'#CgO+hO07`O'#DZO-yQUO'#DaO.ZQUO'#DlO%TQUO'#DvO0_QUO'#EOOOQ(CY'#EW'#EWO0xQSO'#ETOOQO'#Ei'#EiOOQO'#Ic'#IcO1QQSO'#GkO1]QSO'#EhO1bQSO'#EhO3dQ(CjO'#JdO6TQ(CjO'#JeO6qQSO'#FWO6vQ#tO'#FoOOQ(CY'#F`'#F`O7RO&jO'#F`O7aQ,UO'#FvO8wQSO'#FuOOQ(CY'#Je'#JeOOQ(CW'#Jd'#JdO8|QSO'#GoOOQQ'#KP'#KPO9XQSO'#IPO9^Q(C[O'#IQOOQQ'#JQ'#JQOOQQ'#IU'#IUQ`QUOOO%TQUO'#DnO9fQUO'#DzO9mQUO'#D|O9SQSO'#GkO9tQ,UO'#ClO:SQSO'#EgO:_QSO'#ErO:dQ,UO'#F_O;RQSO'#GkOOQO'#KQ'#KQO;WQSO'#KQO;fQSO'#GsO;fQSO'#GtO;fQSO'#GvO9SQSO'#GyO<]QSO'#G|O=tQSO'#CbO>UQSO'#HYO>^QSO'#H`O>^QSO'#HbO`QUO'#HdO>^QSO'#HfO>^QSO'#HiO>cQSO'#HoO>hQ(C]O'#HuO%TQUO'#HwO>sQ(C]O'#HyO?OQ(C]O'#H{O9^Q(C[O'#H}O?ZQ(CjO'#CfO@]QWO'#DfQOQSOOO%TQUO'#D|O@sQSO'#EPO9tQ,UO'#EgOAOQSO'#EgOAZQ`O'#F_OOQQ'#Cd'#CdOOQ(CW'#Dk'#DkOOQ(CW'#Jh'#JhO%TQUO'#JhOOQO'#Jl'#JlOOQO'#I`'#I`OBZQWO'#E`OOQ(CW'#E_'#E_OCVQ(C`O'#E`OCaQWO'#ESOOQO'#Jk'#JkOCuQWO'#JlOESQWO'#ESOCaQWO'#E`PEaO?MpO'#C`POOO)CDo)CDoOOOO'#IV'#IVOElOpO,59ROOQ(CY,59R,59ROOOO'#IW'#IWOEzO!bO,59RO%TQUO'#D]OOOO'#IY'#IYOFYO07`O,59uOOQ(CY,59u,59uOFhQUO'#IZOF{QSO'#JfOH}QbO'#JfO+vQUO'#JfOIUQSO,59{OIlQSO'#EiOIyQSO'#JtOJUQSO'#JsOJUQSO'#JsOJ^QSO,5;VOJcQSO'#JrOOQ(CY,5:W,5:WOJjQUO,5:WOLkQ(CjO,5:bOM[QSO,5:jOMuQ(C[O'#JqOM|QSO'#JpO8|QSO'#JpONbQSO'#JpONjQSO,5;UONoQSO'#JpO!!wQbO'#JeOOQ(CY'#Cf'#CfO%TQUO'#EOO!#gQ`O,5:oOOQO'#Jm'#JmOOQO-EkOOQQ'#JY'#JYOOQQ,5>l,5>lOOQQ-EqQ(CjO,5:hOOQO,5@l,5@lO!?bQ,UO,5=VO!?pQ(C[O'#JZO8wQSO'#JZO!@RQ(C[O,59WO!@^QWO,59WO!@fQ,UO,59WO9tQ,UO,59WO!@qQSO,5;SO!@yQSO'#HXO!A[QSO'#KUO%TQUO,5;wO!7[QWO,5;yO!AdQSO,5=rO!AiQSO,5=rO!AnQSO,5=rO9^Q(C[O,5=rO;fQSO,5=bOOQO'#Cr'#CrO!A|QWO,5=_O!BUQ,UO,5=`O!BaQSO,5=bO!BfQ`O,5=eO!BnQSO'#KQO>cQSO'#HOO9SQSO'#HQO!BsQSO'#HQO9tQ,UO'#HSO!BxQSO'#HSOOQQ,5=h,5=hO!B}QSO'#HTO!CVQSO'#ClO!C[QSO,58|O!CfQSO,58|O!EkQUO,58|OOQQ,58|,58|O!E{Q(C[O,58|O%TQUO,58|O!HWQUO'#H[OOQQ'#H]'#H]OOQQ'#H^'#H^O`QUO,5=tO!HnQSO,5=tO`QUO,5=zO`QUO,5=|O!HsQSO,5>OO`QUO,5>QO!HxQSO,5>TO!H}QUO,5>ZOOQQ,5>a,5>aO%TQUO,5>aO9^Q(C[O,5>cOOQQ,5>e,5>eO!MXQSO,5>eOOQQ,5>g,5>gO!MXQSO,5>gOOQQ,5>i,5>iO!M^QWO'#DXO%TQUO'#JhO!M{QWO'#JhO!NjQWO'#DgO!N{QWO'#DgO##^QUO'#DgO##eQSO'#JgO##mQSO,5:QO##rQSO'#EmO#$QQSO'#JuO#$YQSO,5;WO#$_QWO'#DgO#$lQWO'#EROOQ(CY,5:k,5:kO%TQUO,5:kO#$sQSO,5:kO>cQSO,5;RO!@^QWO,5;RO!@fQ,UO,5;RO9tQ,UO,5;RO#${QSO,5@SO#%QQ!LQO,5:oOOQO-E<^-E<^O#&WQ(C`O,5:zOCaQWO,5:nO#&bQWO,5:nOCaQWO,5:zO!@RQ(C[O,5:nOOQ(CW'#Ec'#EcOOQO,5:z,5:zO%TQUO,5:zO#&oQ(C[O,5:zO#&zQ(C[O,5:zO!@^QWO,5:nOOQO,5;Q,5;QO#'YQ(C[O,5:zPOOO'#IT'#ITP#'nO?MpO,58zPOOO,58z,58zOOOO-EuO+vQUO,5>uOOQO,5>{,5>{O#(YQUO'#IZOOQO-E^QSO1G3jO$.OQUO1G3lO$2SQUO'#HkOOQQ1G3o1G3oO$2aQSO'#HqO>cQSO'#HsOOQQ1G3u1G3uO$2iQUO1G3uO9^Q(C[O1G3{OOQQ1G3}1G3}OOQ(CW'#GW'#GWO9^Q(C[O1G4PO9^Q(C[O1G4RO$6pQSO,5@SO!){QUO,5;XO8|QSO,5;XO>cQSO,5:RO!){QUO,5:RO!@^QWO,5:RO$6uQ$IUO,5:ROOQO,5;X,5;XO$7PQWO'#I[O$7gQSO,5@ROOQ(CY1G/l1G/lO$7oQWO'#IbO$7yQSO,5@aOOQ(CW1G0r1G0rO!N{QWO,5:ROOQO'#I_'#I_O$8RQWO,5:mOOQ(CY,5:m,5:mO#$vQSO1G0VOOQ(CY1G0V1G0VO%TQUO1G0VOOQ(CY1G0m1G0mO>cQSO1G0mO!@^QWO1G0mO!@fQ,UO1G0mOOQ(CW1G5n1G5nO!@RQ(C[O1G0YOOQO1G0f1G0fO%TQUO1G0fO$8YQ(C[O1G0fO$8eQ(C[O1G0fO!@^QWO1G0YOCaQWO1G0YO$8sQ(C[O1G0fOOQO1G0Y1G0YO$9XQ(CjO1G0fPOOO-EuO$9uQSO1G5lO$9}QSO1G5yO$:VQbO1G5zO8|QSO,5>{O$:aQ(CjO1G5wO%TQUO1G5wO$:qQ(C[O1G5wO$;SQSO1G5vO$;SQSO1G5vO8|QSO1G5vO$;[QSO,5?OO8|QSO,5?OOOQO,5?O,5?OO$;pQSO,5?OO$$QQSO,5?OOOQO-EqQ(CjO,5VOOQQ,5>V,5>VO%TQUO'#HlO%(SQSO'#HnOOQQ,5>],5>]O8|QSO,5>]OOQQ,5>_,5>_OOQQ7+)a7+)aOOQQ7+)g7+)gOOQQ7+)k7+)kOOQQ7+)m7+)mO%(XQWO1G5nO%(mQ$IUO1G0sO%(wQSO1G0sOOQO1G/m1G/mO%)SQ$IUO1G/mO>cQSO1G/mO!){QUO'#DgOOQO,5>v,5>vOOQO-E|,5>|OOQO-E<`-E<`O!@^QWO1G/mOOQO-E<]-E<]OOQ(CY1G0X1G0XOOQ(CY7+%q7+%qO#$vQSO7+%qOOQ(CY7+&X7+&XO>cQSO7+&XO!@^QWO7+&XOOQO7+%t7+%tO$9XQ(CjO7+&QOOQO7+&Q7+&QO%TQUO7+&QO%)^Q(C[O7+&QO!@RQ(C[O7+%tO!@^QWO7+%tO%)iQ(C[O7+&QO%)wQ(CjO7++cO%TQUO7++cO%*XQSO7++bO%*XQSO7++bOOQO1G4j1G4jO8|QSO1G4jO%*aQSO1G4jOOQO7+%y7+%yO#$vQSO<wOOQO-ExO%TQUO,5>xOOQO-E<[-E<[O%2aQSO1G5pOOQ(CY<QQ$IUO1G0xO%>XQ$IUO1G0xO%@PQ$IUO1G0xO%@dQ(CjO<WOOQQ,5>Y,5>YO%M}QSO1G3wO8|QSO7+&_O!){QUO7+&_OOQO7+%X7+%XO%NSQ$IUO1G5zO>cQSO7+%XOOQ(CY<cQSO<cQSO7+)cO&5kQSO<zAN>zO%TQUOAN?WOOQO<TQSOANAxOOQQANAzANAzO9^Q(C[OANAzO#MsQSOANAzOOQO'#HV'#HVOOQO7+*d7+*dOOQQG22tG22tOOQQANEOANEOOOQQANEPANEPOOQQANBSANBSO&>]QSOANBSOOQQ<bQSOLD,iO&>jQ$IUO7+'sO&@`Q$IUO7+'uO&BUQ,UOG26{OOQO<ROPYXXYXkYXyYXzYX|YX!eYX!fYX!hYX!lYX#XYX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(SYX(cYX(jYX(kYX!VYX!WYX~O#yYX~P#@lOP$[OX:XOk9{Oy#xOz#yO|#zO!e9}O!f#vO!h#wO!l$[O#g9yO#h9zO#i9zO#j9zO#k9|O#l9}O#m9}O#n:WO#o9}O#q:OO#s:QO#u:SO#v:TO(SVO(c$YO(j#{O(k#|O~O#y.hO~P#ByO#X:YO#{:YO#y(XX!W(XX~PN}O^'Za!V'Za'l'Za'j'Za!g'Za!S'Zao'Za!X'Za%a'Za!a'Za~P!7sOP#fiX#fi^#fik#fiz#fi!V#fi!e#fi!f#fi!h#fi!l#fi#g#fi#h#fi#i#fi#j#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi'l#fi(S#fi(c#fi'j#fi!S#fi!g#fio#fi!X#fi%a#fi!a#fi~P#,`O^#zi!V#zi'l#zi'j#zi!S#zi!g#zio#zi!X#zi%a#zi!a#zi~P!7sO$W.mO$Y.mO~O$W.nO$Y.nO~O!a)^O#X.oO!X$^X$T$^X$W$^X$Y$^X$a$^X~O!U.pO~O!X)aO$T.rO$W)`O$Y)`O$a.sO~O!V:UO!W(WX~P#ByO!W.tO~O!a)^O$a(lX~O$a.vO~Oq)pO(T)qO(U.yO~O!S.}O~P!&VO!VcX!acX!gcX!g$sX(ccX~P!/ZO!g/TO~P#,`O!V/UO!a#tO(c'fO!g(pX~O!g/ZO~O!U*RO'u%_O!g(pP~O#d/]O~O!S$sX!V$sX!a$zX~P!/ZO!V/^O!S(qX~P#,`O!a/`O~O!S/bO~Ok/fO!a#tO!h%]O(O%QO(c'fO~O'u/hO~O!a+XO~O^%fO!V/lO'l%fO~O!W/nO~P!3XO!]/oO!^/oO'v!kO(V!lO~O|/qO(V!lO~O#T/rO~O'u&POd'`X!V'`X~O!V*kOd(Pa~Od/wO~Oy/xOz/xO|/yOgva(jva(kva!Vva#Xva~Odva#yva~P$ aOy)uO|)vOg$la(j$la(k$la!V$la#X$la~Od$la#y$la~P$!VOy)uO|)vOg$na(j$na(k$na!V$na#X$na~Od$na#y$na~P$!xO#d/{O~Od$|a!V$|a#X$|a#y$|a~P!0dO!a#tO~O#d0OO~O!V*|O^(ua'l(ua~Oy#xOz#yO|#zO!f#vO!h#wO(SVOP!niX!nik!ni!V!ni!e!ni!l!ni#g!ni#h!ni#i!ni#j!ni#k!ni#l!ni#m!ni#n!ni#o!ni#q!ni#s!ni#u!ni#v!ni(c!ni(j!ni(k!ni~O^!ni'l!ni'j!ni!S!ni!g!nio!ni!X!ni%a!ni!a!ni~P$$gOg.TO!X'UO%a.SO~Oi0YO'u0XO~P!1UO!a+XO^'}a!X'}a'l'}a!V'}a~O#d0`O~OXYX!VcX!WcX~O!V0aO!W(yX~O!W0cO~OX0dO~O'u+aO'wTO'zUO~O!X%vO'u%_O]'hX!V'hX~O!V+fO](xa~O!g0iO~P!7sOX0lO~O]0mO~O#X0pO~Og0sO!X${O~O(V(sO!W(vP~Og0|O!X0yO%a0{O(O%QO~OX1WO!V1UO!W(wX~O!W1XO~O]1ZO^%fO'l%fO~O'u#lO'wTO'zUO~O#X$dO#{$dOP(XXX(XXk(XXy(XXz(XX|(XX!V(XX!e(XX!h(XX!l(XX#g(XX#h(XX#i(XX#j(XX#k(XX#l(XX#m(XX#n(XX#q(XX#s(XX#u(XX#v(XX(S(XX(c(XX(j(XX(k(XX~O#o1^O&R1_O^(XX!f(XX~P$+]O#X$dO#o1^O&R1_O~O^1aO~P%TO^1cO~O&[1fOP&YiQ&YiV&Yi^&Yia&Yib&Yii&Yik&Yil&Yim&Yis&Yiu&Yiw&Yi|&Yi!Q&Yi!R&Yi!X&Yi!c&Yi!h&Yi!k&Yi!l&Yi!m&Yi!o&Yi!q&Yi!t&Yi!x&Yi#p&Yi$Q&Yi$U&Yi%`&Yi%b&Yi%d&Yi%e&Yi%f&Yi%i&Yi%k&Yi%n&Yi%o&Yi%q&Yi%}&Yi&T&Yi&V&Yi&X&Yi&Z&Yi&^&Yi&d&Yi&j&Yi&l&Yi&n&Yi&p&Yi&r&Yi'j&Yi'u&Yi'w&Yi'z&Yi(S&Yi(b&Yi(o&Yi!W&Yi_&Yi&a&Yi~O_1lO!W1jO&a1kO~P`O!XXO!h1nO~O&h,iOP&ciQ&ciV&ci^&cia&cib&cii&cik&cil&cim&cis&ciu&ciw&ci|&ci!Q&ci!R&ci!X&ci!c&ci!h&ci!k&ci!l&ci!m&ci!o&ci!q&ci!t&ci!x&ci#p&ci$Q&ci$U&ci%`&ci%b&ci%d&ci%e&ci%f&ci%i&ci%k&ci%n&ci%o&ci%q&ci%}&ci&T&ci&V&ci&X&ci&Z&ci&^&ci&d&ci&j&ci&l&ci&n&ci&p&ci&r&ci'j&ci'u&ci'w&ci'z&ci(S&ci(b&ci(o&ci!W&ci&[&ci_&ci&a&ci~O!S1tO~O!V!Za!W!Za~P#ByOl!mO|!nO!U1zO(V!lO!V'OX!W'OX~P?wO!V,yO!W(Za~O!V'UX!W'UX~P!6{O!V,|O!W(ia~O!W2RO~P'WO^%fO#X2[O'l%fO~O^%fO!a#tO#X2[O'l%fO~O^%fO!a#tO!l2`O#X2[O'l%fO(c'fO~O^%fO'l%fO~P!7sO!V$`Oo$ka~O!S&}i!V&}i~P!7sO!V'zO!S(Yi~O!V(RO!S(gi~O!S(hi!V(hi~P!7sO!V(ei!g(ei^(ei'l(ei~P!7sO#X2bO!V(ei!g(ei^(ei'l(ei~O!V(_O!g(di~O|%`O!X%aO!x]O#b2gO#c2fO'u%_O~O|%`O!X%aO#c2fO'u%_O~Og2nO!X'UO%a2mO~Og2nO!X'UO%a2mO(O%QO~O#dvaPvaXva^vakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva'lva(Sva(cva!gva!Sva'jvaova!Xva%ava!ava~P$ aO#d$laP$laX$la^$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la'l$la(S$la(c$la!g$la!S$la'j$lao$la!X$la%a$la!a$la~P$!VO#d$naP$naX$na^$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na'l$na(S$na(c$na!g$na!S$na'j$nao$na!X$na%a$na!a$na~P$!xO#d$|aP$|aX$|a^$|ak$|az$|a!V$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a'l$|a(S$|a(c$|a!g$|a!S$|a'j$|a#X$|ao$|a!X$|a%a$|a!a$|a~P#,`O^#[q!V#[q'l#[q'j#[q!S#[q!g#[qo#[q!X#[q%a#[q!a#[q~P!7sOd'PX!V'PX~P!'oO!V.^Od(]a~O!U2vO!V'QX!g'QX~P%TO!V.aO!g(^a~O!V.aO!g(^a~P!7sO!S2yO~O#y!ja!W!ja~PJqO#y!ba!V!ba!W!ba~P#ByO#y!na!W!na~P!:^O#y!pa!W!pa~P!`O^#wy!V#wy'l#wy'j#wy!S#wy!g#wyo#wy!X#wy%a#wy!a#wy~P!7sOg;lOy)uO|)vO(j)xO(k)zO~OP#fiX#fik#fiz#fi!e#fi!f#fi!h#fi!l#fi#g#fi#h#fi#i#fi#j#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi#y#fi(S#fi(c#fi!V#fi!W#fi~P%AWO!f#vOP(RXX(RXg(RXk(RXy(RXz(RX|(RX!e(RX!h(RX!l(RX#g(RX#h(RX#i(RX#j(RX#k(RX#l(RX#m(RX#n(RX#o(RX#q(RX#s(RX#u(RX#v(RX#y(RX(S(RX(c(RX(j(RX(k(RX!V(RX!W(RX~O#y#zi!V#zi!W#zi~P#ByO#y!ni!W!ni~P$$gO!W6_O~O!V'Za!W'Za~P#ByO!a#tO(c'fO!V'[a!g'[a~O!V/UO!g(pi~O!V/UO!a#tO!g(pi~Od$uq!V$uq#X$uq#y$uq~P!0dO!S'^a!V'^a~P#,`O!a6fO~O!V/^O!S(qi~P#,`O!V/^O!S(qi~O!S6jO~O!a#tO#o6oO~Ok6pO!a#tO(c'fO~O!S6rO~Od$wq!V$wq#X$wq#y$wq~P!0dO^$iy!V$iy'l$iy'j$iy!S$iy!g$iyo$iy!X$iy%a$iy!a$iy~P!7sO!a5jO~O!V4VO!X(ra~O^#[y!V#[y'l#[y'j#[y!S#[y!g#[yo#[y!X#[y%a#[y!a#[y~P!7sOX6wO~O!V0aO!W(yi~O]6}O~O(V(sO!V'cX!W'cX~O!V4mO!W(va~OikO'u7UO~P.bO!W7XO~P%$gOl!mO|7YO'wTO'zUO(V!lO(b!rO~O!X0yO~O!X0yO%a7[O~Og7_O!X0yO%a7[O~OX7dO!V'fa!W'fa~O!V1UO!W(wi~O!g7hO~O!g7iO~O!g7lO~O!g7lO~P%TO^7nO~O!a7oO~O!g7pO~O!V(hi!W(hi~P#ByO^%fO#X7xO'l%fO~O!V(ey!g(ey^(ey'l(ey~P!7sO!V(_O!g(dy~O!X'UO%a7{O~O#d$uqP$uqX$uq^$uqk$uqz$uq!V$uq!e$uq!f$uq!h$uq!l$uq#g$uq#h$uq#i$uq#j$uq#k$uq#l$uq#m$uq#n$uq#o$uq#q$uq#s$uq#u$uq#v$uq'l$uq(S$uq(c$uq!g$uq!S$uq'j$uq#X$uqo$uq!X$uq%a$uq!a$uq~P#,`O#d$wqP$wqX$wq^$wqk$wqz$wq!V$wq!e$wq!f$wq!h$wq!l$wq#g$wq#h$wq#i$wq#j$wq#k$wq#l$wq#m$wq#n$wq#o$wq#q$wq#s$wq#u$wq#v$wq'l$wq(S$wq(c$wq!g$wq!S$wq'j$wq#X$wqo$wq!X$wq%a$wq!a$wq~P#,`O!V'Qi!g'Qi~P!7sO#y#[q!V#[q!W#[q~P#ByOy/xOz/xO|/yOPvaXvagvakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva#yva(Sva(cva(jva(kva!Vva!Wva~Oy)uO|)vOP$laX$lag$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la#y$la(S$la(c$la(j$la(k$la!V$la!W$la~Oy)uO|)vOP$naX$nag$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na#y$na(S$na(c$na(j$na(k$na!V$na!W$na~OP$|aX$|ak$|az$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a#y$|a(S$|a(c$|a!V$|a!W$|a~P%AWO#y$hq!V$hq!W$hq~P#ByO#y$iq!V$iq!W$iq~P#ByO!W8VO~O#y8WO~P!0dO!a#tO!V'[i!g'[i~O!a#tO(c'fO!V'[i!g'[i~O!V/UO!g(pq~O!S'^i!V'^i~P#,`O!V/^O!S(qq~O!S8^O~P#,`O!S8^O~Od(Qy!V(Qy~P!0dO!V'aa!X'aa~P#,`O^%Tq!X%Tq'l%Tq!V%Tq~P#,`OX8cO~O!V0aO!W(yq~O#X8gO!V'ca!W'ca~O!V4mO!W(vi~P#ByOPYXXYXkYXyYXzYX|YX!SYX!VYX!eYX!fYX!hYX!lYX#XYX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(SYX(cYX(jYX(kYX~O!a%RX#o%RX~P&2WO!X0yO%a8kO~O'wTO'zUO(V8pO~O!V1UO!W(wq~O!g8sO~O!g8tO~O!g8uO~O!g8uO~P%TO#X8xO!V#ay!W#ay~O!V#ay!W#ay~P#ByO!X'UO%a8}O~O#y#wy!V#wy!W#wy~P#ByOP$uiX$uik$uiz$ui!e$ui!f$ui!h$ui!l$ui#g$ui#h$ui#i$ui#j$ui#k$ui#l$ui#m$ui#n$ui#o$ui#q$ui#s$ui#u$ui#v$ui#y$ui(S$ui(c$ui!V$ui!W$ui~P%AWOy)uO|)vO(k)zOP%XiX%Xig%Xik%Xiz%Xi!e%Xi!f%Xi!h%Xi!l%Xi#g%Xi#h%Xi#i%Xi#j%Xi#k%Xi#l%Xi#m%Xi#n%Xi#o%Xi#q%Xi#s%Xi#u%Xi#v%Xi#y%Xi(S%Xi(c%Xi(j%Xi!V%Xi!W%Xi~Oy)uO|)vOP%ZiX%Zig%Zik%Ziz%Zi!e%Zi!f%Zi!h%Zi!l%Zi#g%Zi#h%Zi#i%Zi#j%Zi#k%Zi#l%Zi#m%Zi#n%Zi#o%Zi#q%Zi#s%Zi#u%Zi#v%Zi#y%Zi(S%Zi(c%Zi(j%Zi(k%Zi!V%Zi!W%Zi~O#y$iy!V$iy!W$iy~P#ByO#y#[y!V#[y!W#[y~P#ByO!a#tO!V'[q!g'[q~O!V/UO!g(py~O!S'^q!V'^q~P#,`O!S9UO~P#,`O!V0aO!W(yy~O!V4mO!W(vq~O!X0yO%a9]O~O!g9`O~O!X'UO%a9eO~OP$uqX$uqk$uqz$uq!e$uq!f$uq!h$uq!l$uq#g$uq#h$uq#i$uq#j$uq#k$uq#l$uq#m$uq#n$uq#o$uq#q$uq#s$uq#u$uq#v$uq#y$uq(S$uq(c$uq!V$uq!W$uq~P%AWOP$wqX$wqk$wqz$wq!e$wq!f$wq!h$wq!l$wq#g$wq#h$wq#i$wq#j$wq#k$wq#l$wq#m$wq#n$wq#o$wq#q$wq#s$wq#u$wq#v$wq#y$wq(S$wq(c$wq!V$wq!W$wq~P%AWOd%]!Z!V%]!Z#X%]!Z#y%]!Z~P!0dO!V'cq!W'cq~P#ByO!V#a!Z!W#a!Z~P#ByO#d%]!ZP%]!ZX%]!Z^%]!Zk%]!Zz%]!Z!V%]!Z!e%]!Z!f%]!Z!h%]!Z!l%]!Z#g%]!Z#h%]!Z#i%]!Z#j%]!Z#k%]!Z#l%]!Z#m%]!Z#n%]!Z#o%]!Z#q%]!Z#s%]!Z#u%]!Z#v%]!Z'l%]!Z(S%]!Z(c%]!Z!g%]!Z!S%]!Z'j%]!Z#X%]!Zo%]!Z!X%]!Z%a%]!Z!a%]!Z~P#,`OP%]!ZX%]!Zk%]!Zz%]!Z!e%]!Z!f%]!Z!h%]!Z!l%]!Z#g%]!Z#h%]!Z#i%]!Z#j%]!Z#k%]!Z#l%]!Z#m%]!Z#n%]!Z#o%]!Z#q%]!Z#s%]!Z#u%]!Z#v%]!Z#y%]!Z(S%]!Z(c%]!Z!V%]!Z!W%]!Z~P%AWOo(WX~P1jO'v!kO~P!){O!ScX!VcX#XcX~P&2WOPYXXYXkYXyYXzYX|YX!VYX!VcX!eYX!fYX!hYX!lYX#XYX#XcX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(SYX(cYX(jYX(kYX~O!acX!gYX!gcX(ccX~P&GnOP9pOQ9pOa;aOb!hOikOk9pOlkOmkOskOu9pOw9pO|WO!QkO!RkO!XXO!c9sO!hZO!k9pO!l9pO!m9pO!o9tO!q9wO!t!gO$Q!jO$UfO'u)TO'wTO'zUO(SVO(b[O(o;_O~O!V:UO!W$ka~Oi%ROk$sOl$rOm$rOs%SOu%TOw:[O|$zO!X${O!c;fO!h$wO#c:bO$Q%XO$m:^O$o:`O$r%YO'u(kO'wTO'zUO(O%QO(S$tO~O#p)[O~P&LdO!WYX!WcX~P&GnO#d9xO~O!a#tO#d9xO~O#X:YO~O#o9}O~O#X:dO!V(hX!W(hX~O#X:YO!V(fX!W(fX~O#d:eO~Od:gO~P!0dO#d:lO~O#d:mO~O!a#tO#d:nO~O!a#tO#d:eO~O#y:oO~P#ByO#d:pO~O#d:qO~O#d:rO~O#d:sO~O#d:tO~O#d:uO~O#y:vO~P!0dO#y:wO~P!0dO$U~!f!|!}#P#Q#T#b#c#n(o$m$o$r%U%`%a%b%i%k%n%o%q%s~'pR$U(o#h!R'n'v#il#g#jky'o(V'o'u$W$Y$W~",goto:"$&a(}PPPP)OP)RP)cP*r.uPPPP5UPP5kP;f>mP?QP?QPPP?QP@rP?QP?QP?QP@vPP@{PAfPF]PPPFaPPPPFaIaPPPIgJbPFaPLoPPPPN}FaPPPFaPFaP!#]FaP!&p!'r!'{P!(n!(r!(nPPPPP!+|!'rPP!,j!-dP!0WFaFa!0]!3f!7z!7z!;oPPP!;vFaPPPPPPPPPPP!?SP!@ePPFa!ArPFaPFaFaFaFaPFa!CUPP!F]P!I`P!Id!In!Ir!IrP!FYP!Iv!IvP!LyP!L}FaFa!MT#!V?QP?QP?Q?QP##a?Q?Q#%]?Q#'l?Q#)b?Q?Q#*O#+|#+|#,Q#,Y#+|#,bP#+|P?Q#,z?Q#.T?Q?Q5UPPP#/aPPP#/y#/yP#/yP#0`#/yPP#0fP#0]P#0]#0x#0]#1d#1j5R)R#1m)RP#1t#1t#1tP)RP)RP)RP)RPP)RP#1z#1}P#1})RP#2RP#2UP)RP)RP)RP)RP)RP)R)RPP#2[#2b#2l#2r#2x#3O#3U#3d#3j#3p#3z#4Q#4[#4k#4q#5b#5t#5z#6Q#6`#6u#8W#8f#8l#8r#8x#9O#9Y#9`#9f#9p#:S#:YPPPPPPPPPP#:`PPPPPPP#;S#>ZP#?j#?q#?yPPPP#DX#F}#Me#Mh#Mk#Nd#Ng#Nj#Nq#NyPP$ P$ T$ {$!z$#O$#dPP$#h$#n$#rP$#u$#y$#|$$r$%Y$%p$%t$%w$%z$&Q$&T$&X$&]R!zRmqOXs!Y#b%e&h&j&k&m,a,f1f1iY!tQ'U-R0y4tQ%kuQ%sxQ%z{Q&`!US&|!d,yQ'[!hS'b!q!wS*^${*cQ+_%tQ+l%|Q,Q&YQ-P'TQ-Z']Q-c'cQ/o*eQ1T,RR:c9t$|dOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{,^,a,f-V-_-m-s.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2v4q4{5]5^5a5t7Y7_7n7xS#o]9q!r)V$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bQ*n%UQ+d%vQ,S&]Q,Z&eQ.W:ZQ0V+VQ0Z+XQ0f+eQ1],XQ2j.TQ4_0aQ5S1UQ6Q2nQ6W:[Q6y4`R8O6R&zkOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bt!mQ!q!t!w!x&|'T'U'b'c'd,y-P-R-c0y4t4v$^$ri#t#v$b$c$w$z%V%W%[)p)v)y){)|*T*Z*i*j+U+X+p+s.S.^/O/]/^/`/{0p0s0{2m3e3o3w3}4V4X4z6O6f6o7[7{8W8k8}9]9e:W:X:]:^:_:`:a:b:h:i:j:k:l:m:p:q:r:s:v:w;_;g;h;k;lQ%}{Q&z!dS'Q%a,|Q+d%vQ/z*rQ0f+eQ0k+kQ1[,WQ1],XQ4_0aQ4h0mQ5V1WQ5W1ZQ6y4`Q6|4eQ7g5YQ8f6}R8q7dpnOXs!U!Y#b%e&_&h&j&k&m,a,f1f1iR,U&a&t^OPXYstuvy!Y!_!f!i!n#Q#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y'W'h'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;a;b[#ZWZ#U#X&}'x!S%bm#f#g#j%]%`(R(](^(_*y*z*|,],s-q-w-x-y-{1n2f2g5j5{Q%nwQ%rxS%w{%|Q&T!SQ'X!gQ'Z!hQ(f#qS*Q$w*US+^%s%tQ+b%vQ+{&WQ,P&YS-Y'[']Q.V(gQ/Y*RQ0_+_Q0e+eQ0g+fQ0j+jQ1O+|S1S,Q,RQ2W-ZQ3f/UQ4^0aQ4b0dQ4g0lQ5R1TQ6c3gQ6x4`Q6{4dQ8b6wR9W8cv$yi#v%V%W%[)y){*T*i*j.^/]/{3e3}8W;_;g;h!S%px!h!s%r%s%t&{'Z'[']'a'k*]+^+_,v-Y-Z-b/g0_2P2W2_3yQ+W%nQ+q&QQ+t&RQ,O&YQ.U(fQ0}+{U1R,P,Q,RQ2o.VQ4|1OS5Q1S1TQ7c5R#O;c#t$b$c$w$z)p)v)|*Z+U+X+p+s.S/O/^/`0p0s0{2m3o3w4V4X4z6O6f6o7[7{8k8}9]9e:]:_:a:h:j:l:p:r:v;k;lg;d:W:X:^:`:b:i:k:m:q:s:wW%Oi%Q*k;_S&Q!P&_Q&R!QQ&S!RR+o&O$_$}i#t#v$b$c$w$z%V%W%[)p)v)y){)|*T*Z*i*j+U+X+p+s.S.^/O/]/^/`/{0p0s0{2m3e3o3w3}4V4X4z6O6f6o7[7{8W8k8}9]9e:W:X:]:^:_:`:a:b:h:i:j:k:l:m:p:q:r:s:v:w;_;g;h;k;lT)q$t)rV*o%U:Z:[U'Q!d%a,|S(t#x#yQ+i%yS.O(b(cQ0t+uQ4O/xR7R4m&zkOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;b$i$_c#W#c%i%j%l'w'}(i(p(x(y(z({(|(})O)P)Q)R)S)U)X)])g+S+h,w-f-k-p-r.].c.g.i.j.k.z/|1u1x2Y2a2u2z2{2|2}3O3P3Q3R3S3T3U3V3W3Z3[3a4S4[5m5s5x6U6V6[6]7T7r7v8P8T8U8z9Y9a9r;UT#RV#S&{kOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bQ'O!dR1{,yv!mQ!d!q!t!w!x&|'T'U'b'c'd,y-P-R-c0y4t4vS*]${*cS/g*^*eQ/p*fQ0v+wQ3y/oR3|/rlqOXs!Y#b%e&h&j&k&m,a,f1f1iQ&o!]Q'l!vS(h#s9xQ+[%qQ+y&TQ+z&VQ-W'YQ-e'eS.[(m:eS/}*w:nQ0]+]Q0x+xQ1m,hQ1o,iQ1w,tQ2U-XQ2X-]S4T0O:tQ4Y0^S4]0`:uQ5l1yQ5p2VQ5u2^Q6v4ZQ7s5nQ7t5qQ7w5vR8w7p$d$^c#W#c%j%l'w'}(i(p(x(y(z({(|(})O)P)Q)R)S)U)X)])g+S+h,w-f-k-p-r.].c.g.j.k.z/|1u1x2Y2a2u2z2{2|2}3O3P3Q3R3S3T3U3V3W3Z3[3a4S4[5m5s5x6U6V6[6]7T7r7v8P8T8U8z9Y9a9r;US(e#n'_U*h$|(l3YS+R%i.iQ2k0VQ5}2jQ7}6QR9O8O$d$]c#W#c%j%l'w'}(i(p(x(y(z({(|(})O)P)Q)R)S)U)X)])g+S+h,w-f-k-p-r.].c.g.j.k.z/|1u1x2Y2a2u2z2{2|2}3O3P3Q3R3S3T3U3V3W3Z3[3a4S4[5m5s5x6U6V6[6]7T7r7v8P8T8U8z9Y9a9r;US(d#n'_S(v#y$^S+Q%i.iS.P(c(eQ.l)WQ0S+RR2h.Q&zkOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bS#o]9qQ&j!WQ&k!XQ&m!ZQ&n![R1e,dQ'V!gQ+T%nQ-U'XS.R(f+WQ2S-TW2l.U.V0U0WQ5o2TU5|2i2k2oS7z5}6PS8|7|7}S9c8{9OQ9k9dR9n9lU!uQ'U-RT4r0y4t!O_OXZ`s!U!Y#b#f%]%e&_&a&h&j&k&m(_,a,f-x1f1i]!oQ!q'U-R0y4tT#o]9q%WzOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&e&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{+V,^,a,f-V-_-m-s.T.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2n2v4q4{5]5^5a5t6R7Y7_7n7xS(t#x#yS.O(b(c!s:{$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bY!sQ'U-R0y4tQ'a!qS'k!t!wS'm!x4vS-b'b'cQ-d'dR2_-cQ'j!sS(Z#e1`S-a'a'mQ/X*QQ/e*]Q2`-dQ3k/YS3t/f/pQ6b3fS6m3z3|Q8Y6cR8a6pQ#ubQ'i!sS(Y#e1`S([#k*vQ*x%^Q+Y%oQ+`%uU-`'a'j'mQ-t(ZQ/W*QQ/d*]Q/j*`Q0[+ZQ1P+}S2]-a-dQ2e-|S3j/X/YS3s/e/pQ3v/iQ3x/kQ5O1QQ5w2`Q6a3fQ6e3kS6i3t3|Q6n3{Q7a5PS8X6b6cQ8]6jQ8_6mQ8n7bQ9S8YQ9T8^Q9V8aQ9_8oQ9g9UQ;O:yQ;Z;SR;[;TV!uQ'U-R%WaOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&e&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{+V,^,a,f-V-_-m-s.T.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2n2v4q4{5]5^5a5t6R7Y7_7n7xS#uy!i!r:x$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bR;O;a%WbOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&e&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{+V,^,a,f-V-_-m-s.T.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2n2v4q4{5]5^5a5t6R7Y7_7n7xQ%^j!S%ox!h!s%r%s%t&{'Z'[']'a'k*]+^+_,v-Y-Z-b/g0_2P2W2_3yS%uy!iQ+Z%pQ+}&YW1Q,O,P,Q,RU5P1R1S1TS7b5Q5RQ8o7c!r:y$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bQ;S;`R;T;a$zeOPXYstuv!Y!_!f!n#Q#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&h&j&k&m&q&y'W'h'z(Q(X(m(q(u)t*w*{+V,^,a,f-V-_-m-s.T.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2n2v4q4{5]5^5a5t6R7Y7_7n7xY#`WZ#U#X'x!S%bm#f#g#j%]%`(R(](^(_*y*z*|,],s-q-w-x-y-{1n2f2g5j5{Q,[&e!p:z$Z$l)i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bR:}&}S'R!d%aR1},|$|dOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{,^,a,f-V-_-m-s.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2v4q4{5]5^5a5t7Y7_7n7x!r)V$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bQ,Z&eQ0V+VQ2j.TQ6Q2nR8O6R!f$Tc#W%i'w'}(i(p)P)Q)R)S)X)]+h-f-k-p-r.].c.z/|2Y2a2u3W4S4[5s5x6U7v8z9r!T:P)U)g,w.i1u1x2z3S3T3U3V3Z3a5m6V6[6]7T7r8P8T8U9Y9a;U!b$Vc#W%i'w'}(i(p)R)S)X)]+h-f-k-p-r.].c.z/|2Y2a2u3W4S4[5s5x6U7v8z9r!P:R)U)g,w.i1u1x2z3U3V3Z3a5m6V6[6]7T7r8P8T8U9Y9a;U!^$Zc#W%i'w'}(i(p)X)]+h-f-k-p-r.].c.z/|2Y2a2u3W4S4[5s5x6U7v8z9rQ3e/Sz;b)U)g,w.i1u1x2z3Z3a5m6V6[6]7T7r8P8T8U9Y9a;UQ;g;iR;h;j&zkOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bS$mh$nR3^.o'RgOPWXYZhstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l$n%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.o.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bT$if$oQ$gfS)`$j)dR)l$oT$hf$oT)b$j)d'RhOPWXYZhstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l$n%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.o.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bT$mh$nQ$phR)k$n%WjOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&e&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{+V,^,a,f-V-_-m-s.T.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2n2v4q4{5]5^5a5t6R7Y7_7n7x!s;`$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;b#alOPXZs!Y!_!n#Q#b#m#z$l%e&a&d&e&h&j&k&m&q&y'W(u)i*{+V,^,a,f-V.T.p/y0|1^1_1a1c1f1i1k2n3]4q4{5]5^5a6R7Y7_7nv$|i#v%V%W%[)y){*T*i*j.^/]/{3e3}8W;_;g;h#O(l#t$b$c$w$z)p)v)|*Z+U+X+p+s.S/O/^/`0p0s0{2m3o3w4V4X4z6O6f6o7[7{8k8}9]9e:]:_:a:h:j:l:p:r:v;k;lQ*s%YQ.{)ug3Y:W:X:^:`:b:i:k:m:q:s:wv$xi#v%V%W%[)y){*T*i*j.^/]/{3e3}8W;_;g;hQ*V$yS*`${*cQ*t%ZQ/k*a#O;Q#t$b$c$w$z)p)v)|*Z+U+X+p+s.S/O/^/`0p0s0{2m3o3w4V4X4z6O6f6o7[7{8k8}9]9e:]:_:a:h:j:l:p:r:v;k;lf;R:W:X:^:`:b:i:k:m:q:s:wQ;V;cQ;W;dQ;X;eR;Y;fv$|i#v%V%W%[)y){*T*i*j.^/]/{3e3}8W;_;g;h#O(l#t$b$c$w$z)p)v)|*Z+U+X+p+s.S/O/^/`0p0s0{2m3o3w4V4X4z6O6f6o7[7{8k8}9]9e:]:_:a:h:j:l:p:r:v;k;lg3Y:W:X:^:`:b:i:k:m:q:s:wloOXs!Y#b%e&h&j&k&m,a,f1f1iQ*Y$zQ,o&tQ,p&vR3n/^$^$}i#t#v$b$c$w$z%V%W%[)p)v)y){)|*T*Z*i*j+U+X+p+s.S.^/O/]/^/`/{0p0s0{2m3e3o3w3}4V4X4z6O6f6o7[7{8W8k8}9]9e:W:X:]:^:_:`:a:b:h:i:j:k:l:m:p:q:r:s:v:w;_;g;h;k;lQ+r&RQ0r+tQ4k0qR7Q4lT*b${*cS*b${*cT4s0y4tS/i*_4qT3{/q7YQ+Y%oQ/j*`Q0[+ZQ1P+}Q5O1QQ7a5PQ8n7bR9_8on)y$u(n*u/[/s/t2s3l4R6`6q9R;P;];^!Y:h(j)Z*P*X.Z.w.|/S/a0T0o0q2r3m3q4j4l6S6T6g6k6s6u8[8`9f;i;j]:i3X6Z8Q9P9Q9op){$u(n*u/Q/[/s/t2s3l4R6`6q9R;P;];^![:j(j)Z*P*X.Z.w.|/S/a0T0o0q2p2r3m3q4j4l6S6T6g6k6s6u8[8`9f;i;j_:k3X6Z8Q8R9P9Q9opnOXs!U!Y#b%e&_&h&j&k&m,a,f1f1iQ&[!TR,^&epnOXs!U!Y#b%e&_&h&j&k&m,a,f1f1iR&[!TQ+v&SR0n+oqnOXs!U!Y#b%e&_&h&j&k&m,a,f1f1iQ0z+{S4y0}1OU7Z4w4x4|S8j7]7^S9Z8i8lQ9h9[R9m9iQ&c!UR,V&_R5V1WS%w{%|R0g+fQ&h!VR,a&iR,g&nT1g,f1iR,k&oQ,j&oR1p,kQ'o!yR-g'oQsOQ#bXT%hs#bQ!|TR'q!|Q#PUR's#PQ)r$tR.x)rQ#SVR'u#SQ#VWU'{#V'|-nQ'|#WR-n'}Q,z'OR1|,zQ._(nR2t._Q.b(pS2w.b2xR2x.cQ-R'UR2Q-RY!qQ'U-R0y4tR'`!qS#]W%`U(S#](T-oQ(T#^R-o(OQ,}'RR2O,}r`OXs!U!Y#b%e&_&a&h&j&k&m,a,f1f1iS#fZ%]U#p`#f-xR-x(_Q(`#hQ-u([W-}(`-u2c5yQ2c-vR5y2dQ)d$jR.q)dQ$nhR)j$nQ$acU)Y$a-j:VQ-j9rR:V)gQ/V*QW3h/V3i6d8ZU3i/W/X/YS6d3j3kR8Z6e#o)w$u(j(n)Z*P*X*p*q*u.X.Y.Z.w.|/Q/R/S/[/a/s/t0T0o0q2p2q2r2s3X3l3m3q4R4j4l6S6T6X6Y6Z6`6g6k6q6s6u8Q8R8S8[8`9P9Q9R9f9o;P;];^;i;jQ/_*XU3p/_3r6hQ3r/aR6h3qQ*c${R/m*cQ*l%PR/v*lQ4W0TR6t4WQ*}%cR0R*}Q4n0tS7S4n8hR8h7TQ+x&TR0w+xQ4t0yR7W4tQ1V,SS5T1V7eR7e5VQ0b+bW4a0b4c6z8dQ4c0eQ6z4bR8d6{Q+g%wR0h+gQ1i,fR5e1iWrOXs#bQ&l!YQ+P%eQ,`&hQ,b&jQ,c&kQ,e&mQ1d,aS1g,f1iR5d1fQ%gpQ&p!^Q&s!`Q&u!aQ&w!bQ'g!sQ+O%dQ+[%qQ+n%}Q,U&cQ,m&rW-^'a'i'j'mQ-e'eQ/l*bQ0]+]S1Y,V,YQ1q,lQ1r,oQ1s,pQ2X-]W2Z-`-a-d-fQ4Y0^Q4f0kQ4i0oQ4}1PQ5X1[Q5c1eU5r2Y2]2`Q5u2^Q6v4ZQ7O4hQ7P4jQ7V4sQ7`5OQ7f5WS7u5s5wQ7w5vQ8e6|Q8m7aQ8r7gQ8y7vQ9X8fQ9^8nQ9b8zR9j9_Q%qxQ'Y!hQ'e!sU+]%r%s%tQ,t&{U-X'Z'[']S-]'a'kQ/c*]S0^+^+_Q1y,vS2V-Y-ZQ2^-bQ3u/gQ4Z0_Q5n2PQ5q2WQ5v2_R6l3yS$vi;_R*m%QU%Pi%Q;_R/u*kQ$uiS(j#t+XQ(n#vS)Z$b$cQ*P$wQ*X$zQ*p%VQ*q%WQ*u%[Q.X:]Q.Y:_Q.Z:aQ.w)pS.|)v/OQ/Q)yQ/R){Q/S)|Q/[*TQ/a*ZQ/s*iQ/t*jh0T+U.S0{2m4z6O7[7{8k8}9]9eQ0o+pQ0q+sQ2p:hQ2q:jQ2r:lQ2s.^S3X:W:XQ3l/]Q3m/^Q3q/`Q4R/{Q4j0pQ4l0sQ6S:pQ6T:rQ6X:^Q6Y:`Q6Z:bQ6`3eQ6g3oQ6k3wQ6q3}Q6s4VQ6u4XQ8Q:mQ8R:iQ8S:kQ8[6fQ8`6oQ9P:qQ9Q:sQ9R8WQ9f:vQ9o:wQ;P;_Q;];gQ;^;hQ;i;kR;j;llpOXs!Y#b%e&h&j&k&m,a,f1f1iQ!ePS#dZ#mQ&r!_U'^!n4q7YQ't#QQ(w#zQ)h$lS,Y&a&dQ,_&eQ,l&qQ,q&yQ-T'WQ.e(uQ.u)iQ0P*{Q0W+VQ1b,^Q2T-VQ2k.TQ3`.pQ4P/yQ4x0|Q5Z1^Q5[1_Q5`1aQ5b1cQ5g1kQ5}2nQ6^3]Q7^4{Q7j5]Q7k5^Q7m5aQ7}6RQ8l7_R8v7n#UcOPXZs!Y!_!n#b#m#z%e&a&d&e&h&j&k&m&q&y'W(u*{+V,^,a,f-V.T/y0|1^1_1a1c1f1i1k2n4q4{5]5^5a6R7Y7_7nQ#WWQ#cYQ%itQ%juS%lv!fS'w#U'zQ'}#XQ(i#sQ(p#wQ(x#}Q(y$OQ(z$PQ({$QQ(|$RQ(}$SQ)O$TQ)P$UQ)Q$VQ)R$WQ)S$XQ)U$ZQ)X$`Q)]$dW)g$l)i.p3]Q+S%kQ+h%xS,w&}1zQ-f'hS-k'x-mQ-p(QQ-r(XQ.](mQ.c(qQ.g9pQ.i9sQ.j9tQ.k9wQ.z)tQ/|*wQ1u,rQ1x,uQ2Y-_Q2a-sQ2u.aQ2z9xQ2{9yQ2|9zQ2}9{Q3O9|Q3P9}Q3Q:OQ3R:PQ3S:QQ3T:RQ3U:SQ3V:TQ3W.hQ3Z:YQ3[:cQ3a:UQ4S0OQ4[0`Q5m:dQ5s2[Q5x2bQ6U2vQ6V:eQ6[:gQ6]:nQ7T4oQ7r5kQ7v5tQ8P:oQ8T:tQ8U:uQ8z7xQ9Y8gQ9a8xQ9r#QR;U;bR#YWR'P!dY!sQ'U-R0y4tS&{!d,yQ'a!qS'k!t!wS'm!x4vS,v&|'TS-b'b'cQ-d'dQ2P-PR2_-cR(o#vR(r#wQ!eQT-Q'U-R]!pQ!q'U-R0y4tQ#n]R'_9qT#iZ%]S#hZ%]S%cm,]U([#f#g#jS-v(](^Q-z(_Q0Q*|Q2d-wU2e-x-y-{S5z2f2gR7y5{`#[W#U#X%`'x(R*y-qr#eZm#f#g#j%](](^(_*|-w-x-y-{2f2g5{Q1`,]Q1v,sQ5i1nQ7q5jT:|&}*zT#_W%`S#^W%`S'y#U(RS(O#X*yS,x&}*zT-l'x-qT'S!d%aQ$jfR)n$oT)c$j)dR3_.oT*S$w*UR*[$zQ0U+UQ2i.SQ4w0{Q6P2mQ7]4zQ7|6OQ8i7[Q8{7{Q9[8kQ9d8}Q9i9]R9l9elqOXs!Y#b%e&h&j&k&m,a,f1f1iQ&b!UR,U&_rmOXs!T!U!Y#b%e&_&h&j&k&m,a,f1f1iR,]&eT%dm,]R0u+uR,T&]Q%{{R+m%|R+c%vT&f!V&iT&g!V&iT1h,f1i",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:366,context:lQ,nodeProps:[["group",-26,6,14,16,62,199,203,207,208,210,213,216,226,228,234,236,238,240,243,249,255,257,259,261,263,265,266,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[fQ],skippedNodes:[0,3,4,269],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(n%d_$d&j'xp'{!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$d&j'{!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'{!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$d&j'xpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU'xpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX'xp'{!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$d&j'xp'{!b'n(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST'y#S$d&j'o(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$d&j'xp'{!b'o(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$d&j!l$Ip'xp'{!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#q$Id$d&j'xp'{!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#q$Id$d&j'xp'{!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$2b3l_'w$(n$d&j'{!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k*r4r_$d&j'{!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k)`5vX$d&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q)`6jT$_#t$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c#t6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y#t7bO$_#t#t7eP;=`<%l6y)`7kP;=`<%l5q*r7w]$_#t$d&j'{!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}%W8uZ'{!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p%W9oU$_#t'{!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}%W:UP;=`<%l8p*r:[P;=`<%l4k#%|:hg$d&j'xp'{!bOY%ZYZ&cZr%Zrs&}st%Ztu`k$d&j'xp'{!b(V!LY'u&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P+d@`k$d&j'xp'{!b$W#tOY%ZYZ&cZr%Zrs&}st%Ztu@Tuw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![@T![!^%Z!^!_*g!_!c%Z!c!}@T!}#O%Z#O#P&c#P#R%Z#R#S@T#S#T%Z#T#o@T#o#p*g#p$g%Z$g;'S@T;'S;=`BT<%lO@T+dBWP;=`<%l@T(CSB^P;=`<%l>P%#SBl`$d&j'xp'{!b#i$IdOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#SCy_$d&j#{$Id'xp'{!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%DfETa(k%Z![!^%Z!^!_*g!_!c%Z!c!i#>Z!i#O%Z#O#P&c#P#R%Z#R#S#>Z#S#T%Z#T#Z#>Z#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#>fi$d&j'xp'{!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#>Z![!^%Z!^!_*g!_!c%Z!c!i#>Z!i#O%Z#O#P&c#P#R%Z#R#S#>Z#S#T%Z#T#Z#>Z#Z#b%Z#b#c#5T#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%Gh#@b_!a$b$d&j#y%Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$JT>P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(CS$=Uk$d&j'xp'{!b'o(;d(V!LY'u&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P",tokenizers:[hQ,uQ,2,3,4,5,6,7,8,9,10,11,12,13,cQ,new yd("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(U~~",141,327),new yd("j~RQYZXz{^~^O'r~~aP!P!Qd~iO's~~",25,309)],topRules:{Script:[0,5],SingleExpression:[1,267],SingleClassItem:[2,268]},dialects:{jsx:12794,ts:12796},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:313,get:n=>dQ[n]||-1},{term:329,get:n=>pQ[n]||-1},{term:67,get:n=>mQ[n]||-1}],tokenPrec:12820}),OQ=[Jn("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Jn("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Jn("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Jn("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Jn("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Jn(`try { +*/var kI=Object.freeze({autofocus:!1,disabled:!1,indentWithTab:!0,tabSize:2,placeholder:"",autoDestroy:!0,extensions:[RI]}),LI=Symbol("vue-codemirror-global-config"),mn,DI=function(n){var e=n.onUpdate,t=n.onChange,i=n.onFocus,s=n.onBlur,r=function(o,a){var l={};for(var c in o)Object.prototype.hasOwnProperty.call(o,c)&&a.indexOf(c)<0&&(l[c]=o[c]);if(o!=null&&typeof Object.getOwnPropertySymbols=="function"){var h=0;for(c=Object.getOwnPropertySymbols(o);ht%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let s=e.parser.context;return new fh(e,[],t,i,i,0,[],0,s?new zO(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,s=e&65535,{parser:r}=this.p,o=r.dynamicPrecedence(s);if(o&&(this.score+=o),i==0){this.pushState(r.getGoto(this.state,s,!0),this.reducePos),s=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(s,l)}storeNode(e,t,i,s=4,r=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(t==i)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(e,t,i,s);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(e,t,i){let s=this.pos;if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(t,s),t<=this.p.parser.maxNode&&this.buffer.push(t,s,i,4);else{let r=e,{parser:o}=this.p;(i>this.pos||t<=o.maxNode)&&(this.pos=i,o.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,s),this.shiftContext(t,s),t<=o.maxNode&&this.buffer.push(t,s,i,4)}}apply(e,t,i){e&65536?this.reduce(e):this.shift(e,t,i)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new fh(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new BI(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if(!(i&65536))return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let r=0,o;rl&1&&a==o)||s.push(t[r],o)}t=s}let i=[];for(let s=0;s>19,s=t&65535,r=this.stack.length-i*3;if(r<0||e.getGoto(this.stack[r],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(s,r)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-r;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=i(o,r+1);if(a!=null)return a}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class zO{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}var VO;(function(n){n[n.Insert=200]="Insert",n[n.Delete=190]="Delete",n[n.Reduce=100]="Reduce",n[n.MaxNext=4]="MaxNext",n[n.MaxInsertStackDepth=300]="MaxInsertStackDepth",n[n.DampenInsertStackDepth=120]="DampenInsertStackDepth",n[n.MinBigReduction=2e3]="MinBigReduction"})(VO||(VO={}));class BI{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class dh{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new dh(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new dh(this.stack,this.pos,this.index)}}function oa(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,s=0;i=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),r+=l,a)break;r*=46}t?t[s++]=r:t=new e(r)}return t}class yc{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const WO=new yc;class XI{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=WO,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,s=this.rangeIndex,r=this.pos+e;for(;ri.to:r>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-i.to,i=o}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,s;if(t>=0&&t=this.chunk2Pos&&ia.to&&(this.chunk2=this.chunk2.slice(0,a.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=WO,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return i}}class uo{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;ry(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}uo.prototype.contextual=uo.prototype.fallback=uo.prototype.extend=!1;class yd{constructor(e,t,i){this.precTable=t,this.elseToken=i,this.data=typeof e=="string"?oa(e):e}token(e,t){let i=e.pos,s=0;for(;;){let r=e.next<0,o=e.resolveOffset(1,1);if(ry(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(r||s++,o==null)break;e.reset(o,e.token)}s&&(e.reset(i,e.token),e.acceptToken(this.elseToken,s))}}yd.prototype.contextual=uo.prototype.fallback=uo.prototype.extend=!1;class Bp{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function ry(n,e,t,i,s,r){let o=0,a=1<0){let g=n[d];if(l.allows(g)&&(e.token.value==-1||e.token.value==g||zI(g,e.token.value,s,r))){e.acceptToken(g);break}}let h=e.next,u=0,f=n[o+2];if(e.next<0&&f>u&&n[c+f*3-3]==65535&&n[c+f*3-3]==65535){o=n[c+f*3-1];continue e}for(;u>1,g=c+d+(d<<1),O=n[g],m=n[g+1]||65536;if(h=m)u=d+1;else{o=n[g+2],e.advance();continue e}}break}}function GO(n,e,t){for(let i=e,s;(s=n[i])!=65535;i++)if(s==t)return i-e;return-1}function zI(n,e,t,i){let s=GO(t,i,e);return s<0||GO(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class VI{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?HO(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?HO(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof kt){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class WI{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new yc)}getActions(e){let t=0,i=null,{parser:s}=e.p,{tokenizers:r}=s,o=s.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;cu.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let f=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!h.extend&&(i=u,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!i&&e.pos==this.stream.end&&(i=new yc,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new yc,{pos:i,p:s}=e;return t.start=i,t.end=Math.min(i+1,s.stream.end),t.value=i==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(s,e),i),e.value>-1){let{parser:r}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,i,s){for(let r=0;re.bufferLength*4?new VI(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],s,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)i.push(a);else{if(this.advanceStack(a,i,e))continue;{s||(s=[],r=[]),s.push(a);let l=this.tokens.getMainToken(a);r.push(l.value,l.end)}}break}}if(!i.length){let o=s&&YI(s);if(o)return this.stackToTree(o);if(this.parser.strict)throw ei&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,i);if(o)return this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((a,l)=>l.score-a.score);i.length>o;)i.pop();i.some(a=>a.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)i.splice(l--,1);else{i.splice(o--,1);continue e}}}i.length>12&&i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(s);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?r.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!c||(u.prop(Ke.contextHash)||0)==h))return e.useNode(u,f),ei&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(u.type.id)})`),!0;if(!(u instanceof kt)||u.children.length==0||u.positions[0]>0)break;let d=u.children[0];if(d instanceof kt&&u.positions[0]==0)u=d;else break}}let a=r.stateSlot(e.state,4);if(a>0)return e.reduce(a),ei&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(a&65535)})`),!0;if(e.stack.length>=15e3)for(;e.stack.length>9e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;cs?t.push(g):i.push(g)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return jO(e,t),!0}}runRecovery(e,t,i){let s=null,r=!1;for(let o=0;o ":"";if(a.deadEnd&&(r||(r=!0,a.restart(),ei&&console.log(h+this.stackID(a)+" (restarted)"),this.advanceFully(a,i))))continue;let u=a.split(),f=h;for(let d=0;u.forceReduce()&&d<10&&(ei&&console.log(f+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,i));d++)ei&&(f=this.stackID(u)+" -> ");for(let d of a.recoverByInsert(l))ei&&console.log(h+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,i);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),ei&&console.log(h+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),jO(a,i)):(!s||s.scoren;class HI{constructor(e){this.start=e.start,this.shift=e.shift||af,this.reduce=e.reduce||af,this.reuse=e.reuse||af,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ph extends A_{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;ae.topRules[a][1]),s=[];for(let a=0;a=0)r(h,l,a[c++]);else{let u=a[c+-h];for(let f=-h;f>0;f--)r(a[c++],l,u);c++}}}this.nodeSet=new _p(t.map((a,l)=>Tn.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:s[l],top:i.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=M_;let o=oa(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new uo(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let s=new GI(this,e,t,i);for(let r of this.wrappers)s=r(s,e,t,i);return s}getGoto(e,t,i=!1){let s=this.goto;if(t>=s[0])return-1;for(let r=s[t+1];;){let o=s[r++],a=o&1,l=s[r++];if(a&&i)return l;for(let c=r+(o>>1);r0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),s=i?t(i):void 0;for(let r=this.stateSlot(e,1);s==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=zi(this.data,r+2);else break;s=t(zi(this.data,r+1))}return s}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=zi(this.data,i+2);else break;if(!(this.data[i+2]&1)){let s=this.data[i+1];t.some((r,o)=>o&1&&r==s)||t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(ph.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let s=e.tokenizers.find(r=>r.from==i);return s?s.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let r=e.specializers.find(a=>a.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return t.specializers[s]=qO(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);o>=0&&(i[o]=!0)}let s=null;for(let r=0;ri)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const jI=303,KO=1,qI=2,KI=304,JI=306,eQ=307,tQ=3,nQ=4,iQ=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],oy=125,sQ=59,JO=47,rQ=42,oQ=43,aQ=45,lQ=new HI({start:!1,shift(n,e){return e==tQ||e==nQ||e==JI?n:e==eQ},strict:!1}),cQ=new Bp((n,e)=>{let{next:t}=n;(t==oy||t==-1||e.context)&&n.acceptToken(KI)},{contextual:!0,fallback:!0}),hQ=new Bp((n,e)=>{let{next:t}=n,i;iQ.indexOf(t)>-1||t==JO&&((i=n.peek(1))==JO||i==rQ)||t!=oy&&t!=sQ&&t!=-1&&!e.context&&n.acceptToken(jI)},{contextual:!0}),uQ=new Bp((n,e)=>{let{next:t}=n;if((t==oQ||t==aQ)&&(n.advance(),t==n.next)){n.advance();let i=!e.context&&e.canShift(KO);n.acceptToken(i?KO:qI)}},{contextual:!0}),fQ=P_({"get set async static":D.modifier,"for while do if else switch try catch finally return throw break continue default case":D.controlKeyword,"in of await yield void typeof delete instanceof":D.operatorKeyword,"let var const function class extends":D.definitionKeyword,"import export from":D.moduleKeyword,"with debugger as new":D.keyword,TemplateString:D.special(D.string),super:D.atom,BooleanLiteral:D.bool,this:D.self,null:D.null,Star:D.modifier,VariableName:D.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":D.function(D.variableName),VariableDefinition:D.definition(D.variableName),Label:D.labelName,PropertyName:D.propertyName,PrivatePropertyName:D.special(D.propertyName),"CallExpression/MemberExpression/PropertyName":D.function(D.propertyName),"FunctionDeclaration/VariableDefinition":D.function(D.definition(D.variableName)),"ClassDeclaration/VariableDefinition":D.definition(D.className),PropertyDefinition:D.definition(D.propertyName),PrivatePropertyDefinition:D.definition(D.special(D.propertyName)),UpdateOp:D.updateOperator,LineComment:D.lineComment,BlockComment:D.blockComment,Number:D.number,String:D.string,Escape:D.escape,ArithOp:D.arithmeticOperator,LogicOp:D.logicOperator,BitOp:D.bitwiseOperator,CompareOp:D.compareOperator,RegExp:D.regexp,Equals:D.definitionOperator,Arrow:D.function(D.punctuation),": Spread":D.punctuation,"( )":D.paren,"[ ]":D.squareBracket,"{ }":D.brace,"InterpolationStart InterpolationEnd":D.special(D.brace),".":D.derefOperator,", ;":D.separator,"@":D.meta,TypeName:D.typeName,TypeDefinition:D.definition(D.typeName),"type enum interface implements namespace module declare":D.definitionKeyword,"abstract global Privacy readonly override":D.modifier,"is keyof unique infer":D.operatorKeyword,JSXAttributeValue:D.attributeValue,JSXText:D.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":D.angleBracket,"JSXIdentifier JSXNameSpacedName":D.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":D.attributeName,"JSXBuiltin/JSXIdentifier":D.standard(D.tagName)}),dQ={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,using:413,interface:419,enum:423,namespace:429,module:431,declare:435,global:439,for:458,of:467,while:470,with:474,do:478,if:482,else:484,switch:488,case:494,try:500,catch:504,finally:508,return:512,throw:516,break:520,continue:524,debugger:528},pQ={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},mQ={__proto__:null,"<":137},gQ=ph.deserialize({version:14,states:"$6tO`QUOOO%TQUOOO'WQWOOP(eOSOOO*sQ(CjO'#CfO*zOpO'#CgO+YO!bO'#CgO+hO07`O'#DZO-yQUO'#DaO.ZQUO'#DlO%TQUO'#DvO0_QUO'#EOOOQ(CY'#EW'#EWO0xQSO'#ETOOQO'#Ei'#EiOOQO'#Ic'#IcO1QQSO'#GkO1]QSO'#EhO1bQSO'#EhO3dQ(CjO'#JdO6TQ(CjO'#JeO6qQSO'#FWO6vQ#tO'#FoOOQ(CY'#F`'#F`O7RO&jO'#F`O7aQ,UO'#FvO8wQSO'#FuOOQ(CY'#Je'#JeOOQ(CW'#Jd'#JdO8|QSO'#GoOOQQ'#KP'#KPO9XQSO'#IPO9^Q(C[O'#IQOOQQ'#JQ'#JQOOQQ'#IU'#IUQ`QUOOO%TQUO'#DnO9fQUO'#DzO9mQUO'#D|O9SQSO'#GkO9tQ,UO'#ClO:SQSO'#EgO:_QSO'#ErO:dQ,UO'#F_O;RQSO'#GkOOQO'#KQ'#KQO;WQSO'#KQO;fQSO'#GsO;fQSO'#GtO;fQSO'#GvO9SQSO'#GyO<]QSO'#G|O=tQSO'#CbO>UQSO'#HYO>^QSO'#H`O>^QSO'#HbO`QUO'#HdO>^QSO'#HfO>^QSO'#HiO>cQSO'#HoO>hQ(C]O'#HuO%TQUO'#HwO>sQ(C]O'#HyO?OQ(C]O'#H{O9^Q(C[O'#H}O?ZQ(CjO'#CfO@]QWO'#DfQOQSOOO%TQUO'#D|O@sQSO'#EPO9tQ,UO'#EgOAOQSO'#EgOAZQ`O'#F_OOQQ'#Cd'#CdOOQ(CW'#Dk'#DkOOQ(CW'#Jh'#JhO%TQUO'#JhOOQO'#Jl'#JlOOQO'#I`'#I`OBZQWO'#E`OOQ(CW'#E_'#E_OCVQ(C`O'#E`OCaQWO'#ESOOQO'#Jk'#JkOCuQWO'#JlOESQWO'#ESOCaQWO'#E`PEaO?MpO'#C`POOO)CDo)CDoOOOO'#IV'#IVOElOpO,59ROOQ(CY,59R,59ROOOO'#IW'#IWOEzO!bO,59RO%TQUO'#D]OOOO'#IY'#IYOFYO07`O,59uOOQ(CY,59u,59uOFhQUO'#IZOF{QSO'#JfOH}QbO'#JfO+vQUO'#JfOIUQSO,59{OIlQSO'#EiOIyQSO'#JtOJUQSO'#JsOJUQSO'#JsOJ^QSO,5;VOJcQSO'#JrOOQ(CY,5:W,5:WOJjQUO,5:WOLkQ(CjO,5:bOM[QSO,5:jOMuQ(C[O'#JqOM|QSO'#JpO8|QSO'#JpONbQSO'#JpONjQSO,5;UONoQSO'#JpO!!wQbO'#JeOOQ(CY'#Cf'#CfO%TQUO'#EOO!#gQ`O,5:oOOQO'#Jm'#JmOOQO-EkOOQQ'#JY'#JYOOQQ,5>l,5>lOOQQ-EqQ(CjO,5:hOOQO,5@l,5@lO!?bQ,UO,5=VO!?pQ(C[O'#JZO8wQSO'#JZO!@RQ(C[O,59WO!@^QWO,59WO!@fQ,UO,59WO9tQ,UO,59WO!@qQSO,5;SO!@yQSO'#HXO!A[QSO'#KUO%TQUO,5;wO!7[QWO,5;yO!AdQSO,5=rO!AiQSO,5=rO!AnQSO,5=rO9^Q(C[O,5=rO;fQSO,5=bOOQO'#Cr'#CrO!A|QWO,5=_O!BUQ,UO,5=`O!BaQSO,5=bO!BfQ`O,5=eO!BnQSO'#KQO>cQSO'#HOO9SQSO'#HQO!BsQSO'#HQO9tQ,UO'#HSO!BxQSO'#HSOOQQ,5=h,5=hO!B}QSO'#HTO!CVQSO'#ClO!C[QSO,58|O!CfQSO,58|O!EkQUO,58|OOQQ,58|,58|O!E{Q(C[O,58|O%TQUO,58|O!HWQUO'#H[OOQQ'#H]'#H]OOQQ'#H^'#H^O`QUO,5=tO!HnQSO,5=tO`QUO,5=zO`QUO,5=|O!HsQSO,5>OO`QUO,5>QO!HxQSO,5>TO!H}QUO,5>ZOOQQ,5>a,5>aO%TQUO,5>aO9^Q(C[O,5>cOOQQ,5>e,5>eO!MXQSO,5>eOOQQ,5>g,5>gO!MXQSO,5>gOOQQ,5>i,5>iO!M^QWO'#DXO%TQUO'#JhO!M{QWO'#JhO!NjQWO'#DgO!N{QWO'#DgO##^QUO'#DgO##eQSO'#JgO##mQSO,5:QO##rQSO'#EmO#$QQSO'#JuO#$YQSO,5;WO#$_QWO'#DgO#$lQWO'#EROOQ(CY,5:k,5:kO%TQUO,5:kO#$sQSO,5:kO>cQSO,5;RO!@^QWO,5;RO!@fQ,UO,5;RO9tQ,UO,5;RO#${QSO,5@SO#%QQ!LQO,5:oOOQO-E<^-E<^O#&WQ(C`O,5:zOCaQWO,5:nO#&bQWO,5:nOCaQWO,5:zO!@RQ(C[O,5:nOOQ(CW'#Ec'#EcOOQO,5:z,5:zO%TQUO,5:zO#&oQ(C[O,5:zO#&zQ(C[O,5:zO!@^QWO,5:nOOQO,5;Q,5;QO#'YQ(C[O,5:zPOOO'#IT'#ITP#'nO?MpO,58zPOOO,58z,58zOOOO-EuO+vQUO,5>uOOQO,5>{,5>{O#(YQUO'#IZOOQO-E^QSO1G3jO$.OQUO1G3lO$2SQUO'#HkOOQQ1G3o1G3oO$2aQSO'#HqO>cQSO'#HsOOQQ1G3u1G3uO$2iQUO1G3uO9^Q(C[O1G3{OOQQ1G3}1G3}OOQ(CW'#GW'#GWO9^Q(C[O1G4PO9^Q(C[O1G4RO$6pQSO,5@SO!){QUO,5;XO8|QSO,5;XO>cQSO,5:RO!){QUO,5:RO!@^QWO,5:RO$6uQ$IUO,5:ROOQO,5;X,5;XO$7PQWO'#I[O$7gQSO,5@ROOQ(CY1G/l1G/lO$7oQWO'#IbO$7yQSO,5@aOOQ(CW1G0r1G0rO!N{QWO,5:ROOQO'#I_'#I_O$8RQWO,5:mOOQ(CY,5:m,5:mO#$vQSO1G0VOOQ(CY1G0V1G0VO%TQUO1G0VOOQ(CY1G0m1G0mO>cQSO1G0mO!@^QWO1G0mO!@fQ,UO1G0mOOQ(CW1G5n1G5nO!@RQ(C[O1G0YOOQO1G0f1G0fO%TQUO1G0fO$8YQ(C[O1G0fO$8eQ(C[O1G0fO!@^QWO1G0YOCaQWO1G0YO$8sQ(C[O1G0fOOQO1G0Y1G0YO$9XQ(CjO1G0fPOOO-EuO$9uQSO1G5lO$9}QSO1G5yO$:VQbO1G5zO8|QSO,5>{O$:aQ(CjO1G5wO%TQUO1G5wO$:qQ(C[O1G5wO$;SQSO1G5vO$;SQSO1G5vO8|QSO1G5vO$;[QSO,5?OO8|QSO,5?OOOQO,5?O,5?OO$;pQSO,5?OO$$QQSO,5?OOOQO-EqQ(CjO,5VOOQQ,5>V,5>VO%TQUO'#HlO%(SQSO'#HnOOQQ,5>],5>]O8|QSO,5>]OOQQ,5>_,5>_OOQQ7+)a7+)aOOQQ7+)g7+)gOOQQ7+)k7+)kOOQQ7+)m7+)mO%(XQWO1G5nO%(mQ$IUO1G0sO%(wQSO1G0sOOQO1G/m1G/mO%)SQ$IUO1G/mO>cQSO1G/mO!){QUO'#DgOOQO,5>v,5>vOOQO-E|,5>|OOQO-E<`-E<`O!@^QWO1G/mOOQO-E<]-E<]OOQ(CY1G0X1G0XOOQ(CY7+%q7+%qO#$vQSO7+%qOOQ(CY7+&X7+&XO>cQSO7+&XO!@^QWO7+&XOOQO7+%t7+%tO$9XQ(CjO7+&QOOQO7+&Q7+&QO%TQUO7+&QO%)^Q(C[O7+&QO!@RQ(C[O7+%tO!@^QWO7+%tO%)iQ(C[O7+&QO%)wQ(CjO7++cO%TQUO7++cO%*XQSO7++bO%*XQSO7++bOOQO1G4j1G4jO8|QSO1G4jO%*aQSO1G4jOOQO7+%y7+%yO#$vQSO<wOOQO-ExO%TQUO,5>xOOQO-E<[-E<[O%2aQSO1G5pOOQ(CY<QQ$IUO1G0xO%>XQ$IUO1G0xO%@PQ$IUO1G0xO%@dQ(CjO<WOOQQ,5>Y,5>YO%M}QSO1G3wO8|QSO7+&_O!){QUO7+&_OOQO7+%X7+%XO%NSQ$IUO1G5zO>cQSO7+%XOOQ(CY<cQSO<cQSO7+)cO&5kQSO<zAN>zO%TQUOAN?WOOQO<TQSOANAxOOQQANAzANAzO9^Q(C[OANAzO#MsQSOANAzOOQO'#HV'#HVOOQO7+*d7+*dOOQQG22tG22tOOQQANEOANEOOOQQANEPANEPOOQQANBSANBSO&>]QSOANBSOOQQ<bQSOLD,iO&>jQ$IUO7+'sO&@`Q$IUO7+'uO&BUQ,UOG26{OOQO<ROPYXXYXkYXyYXzYX|YX!eYX!fYX!hYX!lYX#XYX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(SYX(cYX(jYX(kYX!VYX!WYX~O#yYX~P#@lOP$[OX:XOk9{Oy#xOz#yO|#zO!e9}O!f#vO!h#wO!l$[O#g9yO#h9zO#i9zO#j9zO#k9|O#l9}O#m9}O#n:WO#o9}O#q:OO#s:QO#u:SO#v:TO(SVO(c$YO(j#{O(k#|O~O#y.hO~P#ByO#X:YO#{:YO#y(XX!W(XX~PN}O^'Za!V'Za'l'Za'j'Za!g'Za!S'Zao'Za!X'Za%a'Za!a'Za~P!7sOP#fiX#fi^#fik#fiz#fi!V#fi!e#fi!f#fi!h#fi!l#fi#g#fi#h#fi#i#fi#j#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi'l#fi(S#fi(c#fi'j#fi!S#fi!g#fio#fi!X#fi%a#fi!a#fi~P#,`O^#zi!V#zi'l#zi'j#zi!S#zi!g#zio#zi!X#zi%a#zi!a#zi~P!7sO$W.mO$Y.mO~O$W.nO$Y.nO~O!a)^O#X.oO!X$^X$T$^X$W$^X$Y$^X$a$^X~O!U.pO~O!X)aO$T.rO$W)`O$Y)`O$a.sO~O!V:UO!W(WX~P#ByO!W.tO~O!a)^O$a(lX~O$a.vO~Oq)pO(T)qO(U.yO~O!S.}O~P!&VO!VcX!acX!gcX!g$sX(ccX~P!/ZO!g/TO~P#,`O!V/UO!a#tO(c'fO!g(pX~O!g/ZO~O!U*RO'u%_O!g(pP~O#d/]O~O!S$sX!V$sX!a$zX~P!/ZO!V/^O!S(qX~P#,`O!a/`O~O!S/bO~Ok/fO!a#tO!h%]O(O%QO(c'fO~O'u/hO~O!a+XO~O^%fO!V/lO'l%fO~O!W/nO~P!3XO!]/oO!^/oO'v!kO(V!lO~O|/qO(V!lO~O#T/rO~O'u&POd'`X!V'`X~O!V*kOd(Pa~Od/wO~Oy/xOz/xO|/yOgva(jva(kva!Vva#Xva~Odva#yva~P$ aOy)uO|)vOg$la(j$la(k$la!V$la#X$la~Od$la#y$la~P$!VOy)uO|)vOg$na(j$na(k$na!V$na#X$na~Od$na#y$na~P$!xO#d/{O~Od$|a!V$|a#X$|a#y$|a~P!0dO!a#tO~O#d0OO~O!V*|O^(ua'l(ua~Oy#xOz#yO|#zO!f#vO!h#wO(SVOP!niX!nik!ni!V!ni!e!ni!l!ni#g!ni#h!ni#i!ni#j!ni#k!ni#l!ni#m!ni#n!ni#o!ni#q!ni#s!ni#u!ni#v!ni(c!ni(j!ni(k!ni~O^!ni'l!ni'j!ni!S!ni!g!nio!ni!X!ni%a!ni!a!ni~P$$gOg.TO!X'UO%a.SO~Oi0YO'u0XO~P!1UO!a+XO^'}a!X'}a'l'}a!V'}a~O#d0`O~OXYX!VcX!WcX~O!V0aO!W(yX~O!W0cO~OX0dO~O'u+aO'wTO'zUO~O!X%vO'u%_O]'hX!V'hX~O!V+fO](xa~O!g0iO~P!7sOX0lO~O]0mO~O#X0pO~Og0sO!X${O~O(V(sO!W(vP~Og0|O!X0yO%a0{O(O%QO~OX1WO!V1UO!W(wX~O!W1XO~O]1ZO^%fO'l%fO~O'u#lO'wTO'zUO~O#X$dO#{$dOP(XXX(XXk(XXy(XXz(XX|(XX!V(XX!e(XX!h(XX!l(XX#g(XX#h(XX#i(XX#j(XX#k(XX#l(XX#m(XX#n(XX#q(XX#s(XX#u(XX#v(XX(S(XX(c(XX(j(XX(k(XX~O#o1^O&R1_O^(XX!f(XX~P$+]O#X$dO#o1^O&R1_O~O^1aO~P%TO^1cO~O&[1fOP&YiQ&YiV&Yi^&Yia&Yib&Yii&Yik&Yil&Yim&Yis&Yiu&Yiw&Yi|&Yi!Q&Yi!R&Yi!X&Yi!c&Yi!h&Yi!k&Yi!l&Yi!m&Yi!o&Yi!q&Yi!t&Yi!x&Yi#p&Yi$Q&Yi$U&Yi%`&Yi%b&Yi%d&Yi%e&Yi%f&Yi%i&Yi%k&Yi%n&Yi%o&Yi%q&Yi%}&Yi&T&Yi&V&Yi&X&Yi&Z&Yi&^&Yi&d&Yi&j&Yi&l&Yi&n&Yi&p&Yi&r&Yi'j&Yi'u&Yi'w&Yi'z&Yi(S&Yi(b&Yi(o&Yi!W&Yi_&Yi&a&Yi~O_1lO!W1jO&a1kO~P`O!XXO!h1nO~O&h,iOP&ciQ&ciV&ci^&cia&cib&cii&cik&cil&cim&cis&ciu&ciw&ci|&ci!Q&ci!R&ci!X&ci!c&ci!h&ci!k&ci!l&ci!m&ci!o&ci!q&ci!t&ci!x&ci#p&ci$Q&ci$U&ci%`&ci%b&ci%d&ci%e&ci%f&ci%i&ci%k&ci%n&ci%o&ci%q&ci%}&ci&T&ci&V&ci&X&ci&Z&ci&^&ci&d&ci&j&ci&l&ci&n&ci&p&ci&r&ci'j&ci'u&ci'w&ci'z&ci(S&ci(b&ci(o&ci!W&ci&[&ci_&ci&a&ci~O!S1tO~O!V!Za!W!Za~P#ByOl!mO|!nO!U1zO(V!lO!V'OX!W'OX~P?wO!V,yO!W(Za~O!V'UX!W'UX~P!6{O!V,|O!W(ia~O!W2RO~P'WO^%fO#X2[O'l%fO~O^%fO!a#tO#X2[O'l%fO~O^%fO!a#tO!l2`O#X2[O'l%fO(c'fO~O^%fO'l%fO~P!7sO!V$`Oo$ka~O!S&}i!V&}i~P!7sO!V'zO!S(Yi~O!V(RO!S(gi~O!S(hi!V(hi~P!7sO!V(ei!g(ei^(ei'l(ei~P!7sO#X2bO!V(ei!g(ei^(ei'l(ei~O!V(_O!g(di~O|%`O!X%aO!x]O#b2gO#c2fO'u%_O~O|%`O!X%aO#c2fO'u%_O~Og2nO!X'UO%a2mO~Og2nO!X'UO%a2mO(O%QO~O#dvaPvaXva^vakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva'lva(Sva(cva!gva!Sva'jvaova!Xva%ava!ava~P$ aO#d$laP$laX$la^$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la'l$la(S$la(c$la!g$la!S$la'j$lao$la!X$la%a$la!a$la~P$!VO#d$naP$naX$na^$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na'l$na(S$na(c$na!g$na!S$na'j$nao$na!X$na%a$na!a$na~P$!xO#d$|aP$|aX$|a^$|ak$|az$|a!V$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a'l$|a(S$|a(c$|a!g$|a!S$|a'j$|a#X$|ao$|a!X$|a%a$|a!a$|a~P#,`O^#[q!V#[q'l#[q'j#[q!S#[q!g#[qo#[q!X#[q%a#[q!a#[q~P!7sOd'PX!V'PX~P!'oO!V.^Od(]a~O!U2vO!V'QX!g'QX~P%TO!V.aO!g(^a~O!V.aO!g(^a~P!7sO!S2yO~O#y!ja!W!ja~PJqO#y!ba!V!ba!W!ba~P#ByO#y!na!W!na~P!:^O#y!pa!W!pa~P!`O^#wy!V#wy'l#wy'j#wy!S#wy!g#wyo#wy!X#wy%a#wy!a#wy~P!7sOg;lOy)uO|)vO(j)xO(k)zO~OP#fiX#fik#fiz#fi!e#fi!f#fi!h#fi!l#fi#g#fi#h#fi#i#fi#j#fi#k#fi#l#fi#m#fi#n#fi#o#fi#q#fi#s#fi#u#fi#v#fi#y#fi(S#fi(c#fi!V#fi!W#fi~P%AWO!f#vOP(RXX(RXg(RXk(RXy(RXz(RX|(RX!e(RX!h(RX!l(RX#g(RX#h(RX#i(RX#j(RX#k(RX#l(RX#m(RX#n(RX#o(RX#q(RX#s(RX#u(RX#v(RX#y(RX(S(RX(c(RX(j(RX(k(RX!V(RX!W(RX~O#y#zi!V#zi!W#zi~P#ByO#y!ni!W!ni~P$$gO!W6_O~O!V'Za!W'Za~P#ByO!a#tO(c'fO!V'[a!g'[a~O!V/UO!g(pi~O!V/UO!a#tO!g(pi~Od$uq!V$uq#X$uq#y$uq~P!0dO!S'^a!V'^a~P#,`O!a6fO~O!V/^O!S(qi~P#,`O!V/^O!S(qi~O!S6jO~O!a#tO#o6oO~Ok6pO!a#tO(c'fO~O!S6rO~Od$wq!V$wq#X$wq#y$wq~P!0dO^$iy!V$iy'l$iy'j$iy!S$iy!g$iyo$iy!X$iy%a$iy!a$iy~P!7sO!a5jO~O!V4VO!X(ra~O^#[y!V#[y'l#[y'j#[y!S#[y!g#[yo#[y!X#[y%a#[y!a#[y~P!7sOX6wO~O!V0aO!W(yi~O]6}O~O(V(sO!V'cX!W'cX~O!V4mO!W(va~OikO'u7UO~P.bO!W7XO~P%$gOl!mO|7YO'wTO'zUO(V!lO(b!rO~O!X0yO~O!X0yO%a7[O~Og7_O!X0yO%a7[O~OX7dO!V'fa!W'fa~O!V1UO!W(wi~O!g7hO~O!g7iO~O!g7lO~O!g7lO~P%TO^7nO~O!a7oO~O!g7pO~O!V(hi!W(hi~P#ByO^%fO#X7xO'l%fO~O!V(ey!g(ey^(ey'l(ey~P!7sO!V(_O!g(dy~O!X'UO%a7{O~O#d$uqP$uqX$uq^$uqk$uqz$uq!V$uq!e$uq!f$uq!h$uq!l$uq#g$uq#h$uq#i$uq#j$uq#k$uq#l$uq#m$uq#n$uq#o$uq#q$uq#s$uq#u$uq#v$uq'l$uq(S$uq(c$uq!g$uq!S$uq'j$uq#X$uqo$uq!X$uq%a$uq!a$uq~P#,`O#d$wqP$wqX$wq^$wqk$wqz$wq!V$wq!e$wq!f$wq!h$wq!l$wq#g$wq#h$wq#i$wq#j$wq#k$wq#l$wq#m$wq#n$wq#o$wq#q$wq#s$wq#u$wq#v$wq'l$wq(S$wq(c$wq!g$wq!S$wq'j$wq#X$wqo$wq!X$wq%a$wq!a$wq~P#,`O!V'Qi!g'Qi~P!7sO#y#[q!V#[q!W#[q~P#ByOy/xOz/xO|/yOPvaXvagvakva!eva!fva!hva!lva#gva#hva#iva#jva#kva#lva#mva#nva#ova#qva#sva#uva#vva#yva(Sva(cva(jva(kva!Vva!Wva~Oy)uO|)vOP$laX$lag$lak$laz$la!e$la!f$la!h$la!l$la#g$la#h$la#i$la#j$la#k$la#l$la#m$la#n$la#o$la#q$la#s$la#u$la#v$la#y$la(S$la(c$la(j$la(k$la!V$la!W$la~Oy)uO|)vOP$naX$nag$nak$naz$na!e$na!f$na!h$na!l$na#g$na#h$na#i$na#j$na#k$na#l$na#m$na#n$na#o$na#q$na#s$na#u$na#v$na#y$na(S$na(c$na(j$na(k$na!V$na!W$na~OP$|aX$|ak$|az$|a!e$|a!f$|a!h$|a!l$|a#g$|a#h$|a#i$|a#j$|a#k$|a#l$|a#m$|a#n$|a#o$|a#q$|a#s$|a#u$|a#v$|a#y$|a(S$|a(c$|a!V$|a!W$|a~P%AWO#y$hq!V$hq!W$hq~P#ByO#y$iq!V$iq!W$iq~P#ByO!W8VO~O#y8WO~P!0dO!a#tO!V'[i!g'[i~O!a#tO(c'fO!V'[i!g'[i~O!V/UO!g(pq~O!S'^i!V'^i~P#,`O!V/^O!S(qq~O!S8^O~P#,`O!S8^O~Od(Qy!V(Qy~P!0dO!V'aa!X'aa~P#,`O^%Tq!X%Tq'l%Tq!V%Tq~P#,`OX8cO~O!V0aO!W(yq~O#X8gO!V'ca!W'ca~O!V4mO!W(vi~P#ByOPYXXYXkYXyYXzYX|YX!SYX!VYX!eYX!fYX!hYX!lYX#XYX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(SYX(cYX(jYX(kYX~O!a%RX#o%RX~P&2WO!X0yO%a8kO~O'wTO'zUO(V8pO~O!V1UO!W(wq~O!g8sO~O!g8tO~O!g8uO~O!g8uO~P%TO#X8xO!V#ay!W#ay~O!V#ay!W#ay~P#ByO!X'UO%a8}O~O#y#wy!V#wy!W#wy~P#ByOP$uiX$uik$uiz$ui!e$ui!f$ui!h$ui!l$ui#g$ui#h$ui#i$ui#j$ui#k$ui#l$ui#m$ui#n$ui#o$ui#q$ui#s$ui#u$ui#v$ui#y$ui(S$ui(c$ui!V$ui!W$ui~P%AWOy)uO|)vO(k)zOP%XiX%Xig%Xik%Xiz%Xi!e%Xi!f%Xi!h%Xi!l%Xi#g%Xi#h%Xi#i%Xi#j%Xi#k%Xi#l%Xi#m%Xi#n%Xi#o%Xi#q%Xi#s%Xi#u%Xi#v%Xi#y%Xi(S%Xi(c%Xi(j%Xi!V%Xi!W%Xi~Oy)uO|)vOP%ZiX%Zig%Zik%Ziz%Zi!e%Zi!f%Zi!h%Zi!l%Zi#g%Zi#h%Zi#i%Zi#j%Zi#k%Zi#l%Zi#m%Zi#n%Zi#o%Zi#q%Zi#s%Zi#u%Zi#v%Zi#y%Zi(S%Zi(c%Zi(j%Zi(k%Zi!V%Zi!W%Zi~O#y$iy!V$iy!W$iy~P#ByO#y#[y!V#[y!W#[y~P#ByO!a#tO!V'[q!g'[q~O!V/UO!g(py~O!S'^q!V'^q~P#,`O!S9UO~P#,`O!V0aO!W(yy~O!V4mO!W(vq~O!X0yO%a9]O~O!g9`O~O!X'UO%a9eO~OP$uqX$uqk$uqz$uq!e$uq!f$uq!h$uq!l$uq#g$uq#h$uq#i$uq#j$uq#k$uq#l$uq#m$uq#n$uq#o$uq#q$uq#s$uq#u$uq#v$uq#y$uq(S$uq(c$uq!V$uq!W$uq~P%AWOP$wqX$wqk$wqz$wq!e$wq!f$wq!h$wq!l$wq#g$wq#h$wq#i$wq#j$wq#k$wq#l$wq#m$wq#n$wq#o$wq#q$wq#s$wq#u$wq#v$wq#y$wq(S$wq(c$wq!V$wq!W$wq~P%AWOd%]!Z!V%]!Z#X%]!Z#y%]!Z~P!0dO!V'cq!W'cq~P#ByO!V#a!Z!W#a!Z~P#ByO#d%]!ZP%]!ZX%]!Z^%]!Zk%]!Zz%]!Z!V%]!Z!e%]!Z!f%]!Z!h%]!Z!l%]!Z#g%]!Z#h%]!Z#i%]!Z#j%]!Z#k%]!Z#l%]!Z#m%]!Z#n%]!Z#o%]!Z#q%]!Z#s%]!Z#u%]!Z#v%]!Z'l%]!Z(S%]!Z(c%]!Z!g%]!Z!S%]!Z'j%]!Z#X%]!Zo%]!Z!X%]!Z%a%]!Z!a%]!Z~P#,`OP%]!ZX%]!Zk%]!Zz%]!Z!e%]!Z!f%]!Z!h%]!Z!l%]!Z#g%]!Z#h%]!Z#i%]!Z#j%]!Z#k%]!Z#l%]!Z#m%]!Z#n%]!Z#o%]!Z#q%]!Z#s%]!Z#u%]!Z#v%]!Z#y%]!Z(S%]!Z(c%]!Z!V%]!Z!W%]!Z~P%AWOo(WX~P1jO'v!kO~P!){O!ScX!VcX#XcX~P&2WOPYXXYXkYXyYXzYX|YX!VYX!VcX!eYX!fYX!hYX!lYX#XYX#XcX#dcX#gYX#hYX#iYX#jYX#kYX#lYX#mYX#nYX#oYX#qYX#sYX#uYX#vYX#{YX(SYX(cYX(jYX(kYX~O!acX!gYX!gcX(ccX~P&GnOP9pOQ9pOa;aOb!hOikOk9pOlkOmkOskOu9pOw9pO|WO!QkO!RkO!XXO!c9sO!hZO!k9pO!l9pO!m9pO!o9tO!q9wO!t!gO$Q!jO$UfO'u)TO'wTO'zUO(SVO(b[O(o;_O~O!V:UO!W$ka~Oi%ROk$sOl$rOm$rOs%SOu%TOw:[O|$zO!X${O!c;fO!h$wO#c:bO$Q%XO$m:^O$o:`O$r%YO'u(kO'wTO'zUO(O%QO(S$tO~O#p)[O~P&LdO!WYX!WcX~P&GnO#d9xO~O!a#tO#d9xO~O#X:YO~O#o9}O~O#X:dO!V(hX!W(hX~O#X:YO!V(fX!W(fX~O#d:eO~Od:gO~P!0dO#d:lO~O#d:mO~O!a#tO#d:nO~O!a#tO#d:eO~O#y:oO~P#ByO#d:pO~O#d:qO~O#d:rO~O#d:sO~O#d:tO~O#d:uO~O#y:vO~P!0dO#y:wO~P!0dO$U~!f!|!}#P#Q#T#b#c#n(o$m$o$r%U%`%a%b%i%k%n%o%q%s~'pR$U(o#h!R'n'v#il#g#jky'o(V'o'u$W$Y$W~",goto:"$&a(}PPPP)OP)RP)cP*r.uPPPP5UPP5kP;f>mP?QP?QPPP?QP@rP?QP?QP?QP@vPP@{PAfPF]PPPFaPPPPFaIaPPPIgJbPFaPLoPPPPN}FaPPPFaPFaP!#]FaP!&p!'r!'{P!(n!(r!(nPPPPP!+|!'rPP!,j!-dP!0WFaFa!0]!3f!7z!7z!;oPPP!;vFaPPPPPPPPPPP!?SP!@ePPFa!ArPFaPFaFaFaFaPFa!CUPP!F]P!I`P!Id!In!Ir!IrP!FYP!Iv!IvP!LyP!L}FaFa!MT#!V?QP?QP?Q?QP##a?Q?Q#%]?Q#'l?Q#)b?Q?Q#*O#+|#+|#,Q#,Y#+|#,bP#+|P?Q#,z?Q#.T?Q?Q5UPPP#/aPPP#/y#/yP#/yP#0`#/yPP#0fP#0]P#0]#0x#0]#1d#1j5R)R#1m)RP#1t#1t#1tP)RP)RP)RP)RPP)RP#1z#1}P#1})RP#2RP#2UP)RP)RP)RP)RP)RP)R)RPP#2[#2b#2l#2r#2x#3O#3U#3d#3j#3p#3z#4Q#4[#4k#4q#5b#5t#5z#6Q#6`#6u#8W#8f#8l#8r#8x#9O#9Y#9`#9f#9p#:S#:YPPPPPPPPPP#:`PPPPPPP#;S#>ZP#?j#?q#?yPPPP#DX#F}#Me#Mh#Mk#Nd#Ng#Nj#Nq#NyPP$ P$ T$ {$!z$#O$#dPP$#h$#n$#rP$#u$#y$#|$$r$%Y$%p$%t$%w$%z$&Q$&T$&X$&]R!zRmqOXs!Y#b%e&h&j&k&m,a,f1f1iY!tQ'U-R0y4tQ%kuQ%sxQ%z{Q&`!US&|!d,yQ'[!hS'b!q!wS*^${*cQ+_%tQ+l%|Q,Q&YQ-P'TQ-Z']Q-c'cQ/o*eQ1T,RR:c9t$|dOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{,^,a,f-V-_-m-s.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2v4q4{5]5^5a5t7Y7_7n7xS#o]9q!r)V$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bQ*n%UQ+d%vQ,S&]Q,Z&eQ.W:ZQ0V+VQ0Z+XQ0f+eQ1],XQ2j.TQ4_0aQ5S1UQ6Q2nQ6W:[Q6y4`R8O6R&zkOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bt!mQ!q!t!w!x&|'T'U'b'c'd,y-P-R-c0y4t4v$^$ri#t#v$b$c$w$z%V%W%[)p)v)y){)|*T*Z*i*j+U+X+p+s.S.^/O/]/^/`/{0p0s0{2m3e3o3w3}4V4X4z6O6f6o7[7{8W8k8}9]9e:W:X:]:^:_:`:a:b:h:i:j:k:l:m:p:q:r:s:v:w;_;g;h;k;lQ%}{Q&z!dS'Q%a,|Q+d%vQ/z*rQ0f+eQ0k+kQ1[,WQ1],XQ4_0aQ4h0mQ5V1WQ5W1ZQ6y4`Q6|4eQ7g5YQ8f6}R8q7dpnOXs!U!Y#b%e&_&h&j&k&m,a,f1f1iR,U&a&t^OPXYstuvy!Y!_!f!i!n#Q#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y'W'h'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;a;b[#ZWZ#U#X&}'x!S%bm#f#g#j%]%`(R(](^(_*y*z*|,],s-q-w-x-y-{1n2f2g5j5{Q%nwQ%rxS%w{%|Q&T!SQ'X!gQ'Z!hQ(f#qS*Q$w*US+^%s%tQ+b%vQ+{&WQ,P&YS-Y'[']Q.V(gQ/Y*RQ0_+_Q0e+eQ0g+fQ0j+jQ1O+|S1S,Q,RQ2W-ZQ3f/UQ4^0aQ4b0dQ4g0lQ5R1TQ6c3gQ6x4`Q6{4dQ8b6wR9W8cv$yi#v%V%W%[)y){*T*i*j.^/]/{3e3}8W;_;g;h!S%px!h!s%r%s%t&{'Z'[']'a'k*]+^+_,v-Y-Z-b/g0_2P2W2_3yQ+W%nQ+q&QQ+t&RQ,O&YQ.U(fQ0}+{U1R,P,Q,RQ2o.VQ4|1OS5Q1S1TQ7c5R#O;c#t$b$c$w$z)p)v)|*Z+U+X+p+s.S/O/^/`0p0s0{2m3o3w4V4X4z6O6f6o7[7{8k8}9]9e:]:_:a:h:j:l:p:r:v;k;lg;d:W:X:^:`:b:i:k:m:q:s:wW%Oi%Q*k;_S&Q!P&_Q&R!QQ&S!RR+o&O$_$}i#t#v$b$c$w$z%V%W%[)p)v)y){)|*T*Z*i*j+U+X+p+s.S.^/O/]/^/`/{0p0s0{2m3e3o3w3}4V4X4z6O6f6o7[7{8W8k8}9]9e:W:X:]:^:_:`:a:b:h:i:j:k:l:m:p:q:r:s:v:w;_;g;h;k;lT)q$t)rV*o%U:Z:[U'Q!d%a,|S(t#x#yQ+i%yS.O(b(cQ0t+uQ4O/xR7R4m&zkOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;b$i$_c#W#c%i%j%l'w'}(i(p(x(y(z({(|(})O)P)Q)R)S)U)X)])g+S+h,w-f-k-p-r.].c.g.i.j.k.z/|1u1x2Y2a2u2z2{2|2}3O3P3Q3R3S3T3U3V3W3Z3[3a4S4[5m5s5x6U6V6[6]7T7r7v8P8T8U8z9Y9a9r;UT#RV#S&{kOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bQ'O!dR1{,yv!mQ!d!q!t!w!x&|'T'U'b'c'd,y-P-R-c0y4t4vS*]${*cS/g*^*eQ/p*fQ0v+wQ3y/oR3|/rlqOXs!Y#b%e&h&j&k&m,a,f1f1iQ&o!]Q'l!vS(h#s9xQ+[%qQ+y&TQ+z&VQ-W'YQ-e'eS.[(m:eS/}*w:nQ0]+]Q0x+xQ1m,hQ1o,iQ1w,tQ2U-XQ2X-]S4T0O:tQ4Y0^S4]0`:uQ5l1yQ5p2VQ5u2^Q6v4ZQ7s5nQ7t5qQ7w5vR8w7p$d$^c#W#c%j%l'w'}(i(p(x(y(z({(|(})O)P)Q)R)S)U)X)])g+S+h,w-f-k-p-r.].c.g.j.k.z/|1u1x2Y2a2u2z2{2|2}3O3P3Q3R3S3T3U3V3W3Z3[3a4S4[5m5s5x6U6V6[6]7T7r7v8P8T8U8z9Y9a9r;US(e#n'_U*h$|(l3YS+R%i.iQ2k0VQ5}2jQ7}6QR9O8O$d$]c#W#c%j%l'w'}(i(p(x(y(z({(|(})O)P)Q)R)S)U)X)])g+S+h,w-f-k-p-r.].c.g.j.k.z/|1u1x2Y2a2u2z2{2|2}3O3P3Q3R3S3T3U3V3W3Z3[3a4S4[5m5s5x6U6V6[6]7T7r7v8P8T8U8z9Y9a9r;US(d#n'_S(v#y$^S+Q%i.iS.P(c(eQ.l)WQ0S+RR2h.Q&zkOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bS#o]9qQ&j!WQ&k!XQ&m!ZQ&n![R1e,dQ'V!gQ+T%nQ-U'XS.R(f+WQ2S-TW2l.U.V0U0WQ5o2TU5|2i2k2oS7z5}6PS8|7|7}S9c8{9OQ9k9dR9n9lU!uQ'U-RT4r0y4t!O_OXZ`s!U!Y#b#f%]%e&_&a&h&j&k&m(_,a,f-x1f1i]!oQ!q'U-R0y4tT#o]9q%WzOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&e&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{+V,^,a,f-V-_-m-s.T.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2n2v4q4{5]5^5a5t6R7Y7_7n7xS(t#x#yS.O(b(c!s:{$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bY!sQ'U-R0y4tQ'a!qS'k!t!wS'm!x4vS-b'b'cQ-d'dR2_-cQ'j!sS(Z#e1`S-a'a'mQ/X*QQ/e*]Q2`-dQ3k/YS3t/f/pQ6b3fS6m3z3|Q8Y6cR8a6pQ#ubQ'i!sS(Y#e1`S([#k*vQ*x%^Q+Y%oQ+`%uU-`'a'j'mQ-t(ZQ/W*QQ/d*]Q/j*`Q0[+ZQ1P+}S2]-a-dQ2e-|S3j/X/YS3s/e/pQ3v/iQ3x/kQ5O1QQ5w2`Q6a3fQ6e3kS6i3t3|Q6n3{Q7a5PS8X6b6cQ8]6jQ8_6mQ8n7bQ9S8YQ9T8^Q9V8aQ9_8oQ9g9UQ;O:yQ;Z;SR;[;TV!uQ'U-R%WaOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&e&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{+V,^,a,f-V-_-m-s.T.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2n2v4q4{5]5^5a5t6R7Y7_7n7xS#uy!i!r:x$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bR;O;a%WbOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&e&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{+V,^,a,f-V-_-m-s.T.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2n2v4q4{5]5^5a5t6R7Y7_7n7xQ%^j!S%ox!h!s%r%s%t&{'Z'[']'a'k*]+^+_,v-Y-Z-b/g0_2P2W2_3yS%uy!iQ+Z%pQ+}&YW1Q,O,P,Q,RU5P1R1S1TS7b5Q5RQ8o7c!r:y$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bQ;S;`R;T;a$zeOPXYstuv!Y!_!f!n#Q#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&h&j&k&m&q&y'W'h'z(Q(X(m(q(u)t*w*{+V,^,a,f-V-_-m-s.T.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2n2v4q4{5]5^5a5t6R7Y7_7n7xY#`WZ#U#X'x!S%bm#f#g#j%]%`(R(](^(_*y*z*|,],s-q-w-x-y-{1n2f2g5j5{Q,[&e!p:z$Z$l)i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bR:}&}S'R!d%aR1},|$|dOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{,^,a,f-V-_-m-s.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2v4q4{5]5^5a5t7Y7_7n7x!r)V$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bQ,Z&eQ0V+VQ2j.TQ6Q2nR8O6R!f$Tc#W%i'w'}(i(p)P)Q)R)S)X)]+h-f-k-p-r.].c.z/|2Y2a2u3W4S4[5s5x6U7v8z9r!T:P)U)g,w.i1u1x2z3S3T3U3V3Z3a5m6V6[6]7T7r8P8T8U9Y9a;U!b$Vc#W%i'w'}(i(p)R)S)X)]+h-f-k-p-r.].c.z/|2Y2a2u3W4S4[5s5x6U7v8z9r!P:R)U)g,w.i1u1x2z3U3V3Z3a5m6V6[6]7T7r8P8T8U9Y9a;U!^$Zc#W%i'w'}(i(p)X)]+h-f-k-p-r.].c.z/|2Y2a2u3W4S4[5s5x6U7v8z9rQ3e/Sz;b)U)g,w.i1u1x2z3Z3a5m6V6[6]7T7r8P8T8U9Y9a;UQ;g;iR;h;j&zkOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bS$mh$nR3^.o'RgOPWXYZhstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l$n%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.o.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bT$if$oQ$gfS)`$j)dR)l$oT$hf$oT)b$j)d'RhOPWXYZhstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$Z$`$d$l$n%e%k%x&a&d&e&h&j&k&m&q&y&}'W'h'x'z(Q(X(m(q(u)i)t*w*{+V,^,a,f,r,u-V-_-m-s.T.a.h.o.p/y0O0`0|1^1_1a1c1f1i1k1z2[2b2n2v3]4o4q4{5]5^5a5k5t6R7Y7_7n7x8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;bT$mh$nQ$phR)k$n%WjOPWXYZstuv!Y!_!f!n#Q#U#X#b#m#s#w#z#}$O$P$Q$R$S$T$U$V$W$X$`$d%e%k%x&a&d&e&h&j&k&m&q&y'W'h'x'z(Q(X(m(q(u)t*w*{+V,^,a,f-V-_-m-s.T.a.h/y0O0`0|1^1_1a1c1f1i1k2[2b2n2v4q4{5]5^5a5t6R7Y7_7n7x!s;`$Z$l&})i,r,u.p1z3]4o5k8g8x9p9s9t9w9x9y9z9{9|9}:O:P:Q:R:S:T:U:Y:c:d:e:g:n:o:t:u;b#alOPXZs!Y!_!n#Q#b#m#z$l%e&a&d&e&h&j&k&m&q&y'W(u)i*{+V,^,a,f-V.T.p/y0|1^1_1a1c1f1i1k2n3]4q4{5]5^5a6R7Y7_7nv$|i#v%V%W%[)y){*T*i*j.^/]/{3e3}8W;_;g;h#O(l#t$b$c$w$z)p)v)|*Z+U+X+p+s.S/O/^/`0p0s0{2m3o3w4V4X4z6O6f6o7[7{8k8}9]9e:]:_:a:h:j:l:p:r:v;k;lQ*s%YQ.{)ug3Y:W:X:^:`:b:i:k:m:q:s:wv$xi#v%V%W%[)y){*T*i*j.^/]/{3e3}8W;_;g;hQ*V$yS*`${*cQ*t%ZQ/k*a#O;Q#t$b$c$w$z)p)v)|*Z+U+X+p+s.S/O/^/`0p0s0{2m3o3w4V4X4z6O6f6o7[7{8k8}9]9e:]:_:a:h:j:l:p:r:v;k;lf;R:W:X:^:`:b:i:k:m:q:s:wQ;V;cQ;W;dQ;X;eR;Y;fv$|i#v%V%W%[)y){*T*i*j.^/]/{3e3}8W;_;g;h#O(l#t$b$c$w$z)p)v)|*Z+U+X+p+s.S/O/^/`0p0s0{2m3o3w4V4X4z6O6f6o7[7{8k8}9]9e:]:_:a:h:j:l:p:r:v;k;lg3Y:W:X:^:`:b:i:k:m:q:s:wloOXs!Y#b%e&h&j&k&m,a,f1f1iQ*Y$zQ,o&tQ,p&vR3n/^$^$}i#t#v$b$c$w$z%V%W%[)p)v)y){)|*T*Z*i*j+U+X+p+s.S.^/O/]/^/`/{0p0s0{2m3e3o3w3}4V4X4z6O6f6o7[7{8W8k8}9]9e:W:X:]:^:_:`:a:b:h:i:j:k:l:m:p:q:r:s:v:w;_;g;h;k;lQ+r&RQ0r+tQ4k0qR7Q4lT*b${*cS*b${*cT4s0y4tS/i*_4qT3{/q7YQ+Y%oQ/j*`Q0[+ZQ1P+}Q5O1QQ7a5PQ8n7bR9_8on)y$u(n*u/[/s/t2s3l4R6`6q9R;P;];^!Y:h(j)Z*P*X.Z.w.|/S/a0T0o0q2r3m3q4j4l6S6T6g6k6s6u8[8`9f;i;j]:i3X6Z8Q9P9Q9op){$u(n*u/Q/[/s/t2s3l4R6`6q9R;P;];^![:j(j)Z*P*X.Z.w.|/S/a0T0o0q2p2r3m3q4j4l6S6T6g6k6s6u8[8`9f;i;j_:k3X6Z8Q8R9P9Q9opnOXs!U!Y#b%e&_&h&j&k&m,a,f1f1iQ&[!TR,^&epnOXs!U!Y#b%e&_&h&j&k&m,a,f1f1iR&[!TQ+v&SR0n+oqnOXs!U!Y#b%e&_&h&j&k&m,a,f1f1iQ0z+{S4y0}1OU7Z4w4x4|S8j7]7^S9Z8i8lQ9h9[R9m9iQ&c!UR,V&_R5V1WS%w{%|R0g+fQ&h!VR,a&iR,g&nT1g,f1iR,k&oQ,j&oR1p,kQ'o!yR-g'oQsOQ#bXT%hs#bQ!|TR'q!|Q#PUR's#PQ)r$tR.x)rQ#SVR'u#SQ#VWU'{#V'|-nQ'|#WR-n'}Q,z'OR1|,zQ._(nR2t._Q.b(pS2w.b2xR2x.cQ-R'UR2Q-RY!qQ'U-R0y4tR'`!qS#]W%`U(S#](T-oQ(T#^R-o(OQ,}'RR2O,}r`OXs!U!Y#b%e&_&a&h&j&k&m,a,f1f1iS#fZ%]U#p`#f-xR-x(_Q(`#hQ-u([W-}(`-u2c5yQ2c-vR5y2dQ)d$jR.q)dQ$nhR)j$nQ$acU)Y$a-j:VQ-j9rR:V)gQ/V*QW3h/V3i6d8ZU3i/W/X/YS6d3j3kR8Z6e#o)w$u(j(n)Z*P*X*p*q*u.X.Y.Z.w.|/Q/R/S/[/a/s/t0T0o0q2p2q2r2s3X3l3m3q4R4j4l6S6T6X6Y6Z6`6g6k6q6s6u8Q8R8S8[8`9P9Q9R9f9o;P;];^;i;jQ/_*XU3p/_3r6hQ3r/aR6h3qQ*c${R/m*cQ*l%PR/v*lQ4W0TR6t4WQ*}%cR0R*}Q4n0tS7S4n8hR8h7TQ+x&TR0w+xQ4t0yR7W4tQ1V,SS5T1V7eR7e5VQ0b+bW4a0b4c6z8dQ4c0eQ6z4bR8d6{Q+g%wR0h+gQ1i,fR5e1iWrOXs#bQ&l!YQ+P%eQ,`&hQ,b&jQ,c&kQ,e&mQ1d,aS1g,f1iR5d1fQ%gpQ&p!^Q&s!`Q&u!aQ&w!bQ'g!sQ+O%dQ+[%qQ+n%}Q,U&cQ,m&rW-^'a'i'j'mQ-e'eQ/l*bQ0]+]S1Y,V,YQ1q,lQ1r,oQ1s,pQ2X-]W2Z-`-a-d-fQ4Y0^Q4f0kQ4i0oQ4}1PQ5X1[Q5c1eU5r2Y2]2`Q5u2^Q6v4ZQ7O4hQ7P4jQ7V4sQ7`5OQ7f5WS7u5s5wQ7w5vQ8e6|Q8m7aQ8r7gQ8y7vQ9X8fQ9^8nQ9b8zR9j9_Q%qxQ'Y!hQ'e!sU+]%r%s%tQ,t&{U-X'Z'[']S-]'a'kQ/c*]S0^+^+_Q1y,vS2V-Y-ZQ2^-bQ3u/gQ4Z0_Q5n2PQ5q2WQ5v2_R6l3yS$vi;_R*m%QU%Pi%Q;_R/u*kQ$uiS(j#t+XQ(n#vS)Z$b$cQ*P$wQ*X$zQ*p%VQ*q%WQ*u%[Q.X:]Q.Y:_Q.Z:aQ.w)pS.|)v/OQ/Q)yQ/R){Q/S)|Q/[*TQ/a*ZQ/s*iQ/t*jh0T+U.S0{2m4z6O7[7{8k8}9]9eQ0o+pQ0q+sQ2p:hQ2q:jQ2r:lQ2s.^S3X:W:XQ3l/]Q3m/^Q3q/`Q4R/{Q4j0pQ4l0sQ6S:pQ6T:rQ6X:^Q6Y:`Q6Z:bQ6`3eQ6g3oQ6k3wQ6q3}Q6s4VQ6u4XQ8Q:mQ8R:iQ8S:kQ8[6fQ8`6oQ9P:qQ9Q:sQ9R8WQ9f:vQ9o:wQ;P;_Q;];gQ;^;hQ;i;kR;j;llpOXs!Y#b%e&h&j&k&m,a,f1f1iQ!ePS#dZ#mQ&r!_U'^!n4q7YQ't#QQ(w#zQ)h$lS,Y&a&dQ,_&eQ,l&qQ,q&yQ-T'WQ.e(uQ.u)iQ0P*{Q0W+VQ1b,^Q2T-VQ2k.TQ3`.pQ4P/yQ4x0|Q5Z1^Q5[1_Q5`1aQ5b1cQ5g1kQ5}2nQ6^3]Q7^4{Q7j5]Q7k5^Q7m5aQ7}6RQ8l7_R8v7n#UcOPXZs!Y!_!n#b#m#z%e&a&d&e&h&j&k&m&q&y'W(u*{+V,^,a,f-V.T/y0|1^1_1a1c1f1i1k2n4q4{5]5^5a6R7Y7_7nQ#WWQ#cYQ%itQ%juS%lv!fS'w#U'zQ'}#XQ(i#sQ(p#wQ(x#}Q(y$OQ(z$PQ({$QQ(|$RQ(}$SQ)O$TQ)P$UQ)Q$VQ)R$WQ)S$XQ)U$ZQ)X$`Q)]$dW)g$l)i.p3]Q+S%kQ+h%xS,w&}1zQ-f'hS-k'x-mQ-p(QQ-r(XQ.](mQ.c(qQ.g9pQ.i9sQ.j9tQ.k9wQ.z)tQ/|*wQ1u,rQ1x,uQ2Y-_Q2a-sQ2u.aQ2z9xQ2{9yQ2|9zQ2}9{Q3O9|Q3P9}Q3Q:OQ3R:PQ3S:QQ3T:RQ3U:SQ3V:TQ3W.hQ3Z:YQ3[:cQ3a:UQ4S0OQ4[0`Q5m:dQ5s2[Q5x2bQ6U2vQ6V:eQ6[:gQ6]:nQ7T4oQ7r5kQ7v5tQ8P:oQ8T:tQ8U:uQ8z7xQ9Y8gQ9a8xQ9r#QR;U;bR#YWR'P!dY!sQ'U-R0y4tS&{!d,yQ'a!qS'k!t!wS'm!x4vS,v&|'TS-b'b'cQ-d'dQ2P-PR2_-cR(o#vR(r#wQ!eQT-Q'U-R]!pQ!q'U-R0y4tQ#n]R'_9qT#iZ%]S#hZ%]S%cm,]U([#f#g#jS-v(](^Q-z(_Q0Q*|Q2d-wU2e-x-y-{S5z2f2gR7y5{`#[W#U#X%`'x(R*y-qr#eZm#f#g#j%](](^(_*|-w-x-y-{2f2g5{Q1`,]Q1v,sQ5i1nQ7q5jT:|&}*zT#_W%`S#^W%`S'y#U(RS(O#X*yS,x&}*zT-l'x-qT'S!d%aQ$jfR)n$oT)c$j)dR3_.oT*S$w*UR*[$zQ0U+UQ2i.SQ4w0{Q6P2mQ7]4zQ7|6OQ8i7[Q8{7{Q9[8kQ9d8}Q9i9]R9l9elqOXs!Y#b%e&h&j&k&m,a,f1f1iQ&b!UR,U&_rmOXs!T!U!Y#b%e&_&h&j&k&m,a,f1f1iR,]&eT%dm,]R0u+uR,T&]Q%{{R+m%|R+c%vT&f!V&iT&g!V&iT1h,f1i",nodeNames:"⚠ ArithOp ArithOp LineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:366,context:lQ,nodeProps:[["group",-26,6,14,16,62,199,203,207,208,210,213,216,226,228,234,236,238,240,243,249,255,257,259,261,263,265,266,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[fQ],skippedNodes:[0,3,4,269],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(n%d_$d&j'xp'{!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$d&j'{!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'{!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$d&j'xpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU'xpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX'xp'{!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$d&j'xp'{!b'n(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST'y#S$d&j'o(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$d&j'xp'{!b'o(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$d&j!l$Ip'xp'{!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#q$Id$d&j'xp'{!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#q$Id$d&j'xp'{!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$2b3l_'w$(n$d&j'{!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k*r4r_$d&j'{!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k)`5vX$d&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q)`6jT$_#t$d&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c#t6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y#t7bO$_#t#t7eP;=`<%l6y)`7kP;=`<%l5q*r7w]$_#t$d&j'{!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}%W8uZ'{!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p%W9oU$_#t'{!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}%W:UP;=`<%l8p*r:[P;=`<%l4k#%|:hg$d&j'xp'{!bOY%ZYZ&cZr%Zrs&}st%Ztu`k$d&j'xp'{!b(V!LY'u&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P+d@`k$d&j'xp'{!b$W#tOY%ZYZ&cZr%Zrs&}st%Ztu@Tuw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![@T![!^%Z!^!_*g!_!c%Z!c!}@T!}#O%Z#O#P&c#P#R%Z#R#S@T#S#T%Z#T#o@T#o#p*g#p$g%Z$g;'S@T;'S;=`BT<%lO@T+dBWP;=`<%l@T(CSB^P;=`<%l>P%#SBl`$d&j'xp'{!b#i$IdOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`Cn!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#SCy_$d&j#{$Id'xp'{!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%DfETa(k%Z![!^%Z!^!_*g!_!c%Z!c!i#>Z!i#O%Z#O#P&c#P#R%Z#R#S#>Z#S#T%Z#T#Z#>Z#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#>fi$d&j'xp'{!bl$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#>Z![!^%Z!^!_*g!_!c%Z!c!i#>Z!i#O%Z#O#P&c#P#R%Z#R#S#>Z#S#T%Z#T#Z#>Z#Z#b%Z#b#c#5T#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%Gh#@b_!a$b$d&j#y%Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$JT>P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(CS$=Uk$d&j'xp'{!b'o(;d(V!LY'u&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P",tokenizers:[hQ,uQ,2,3,4,5,6,7,8,9,10,11,12,13,cQ,new yd("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(U~~",141,327),new yd("j~RQYZXz{^~^O'r~~aP!P!Qd~iO's~~",25,309)],topRules:{Script:[0,5],SingleExpression:[1,267],SingleClassItem:[2,268]},dialects:{jsx:12794,ts:12796},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:313,get:n=>dQ[n]||-1},{term:329,get:n=>pQ[n]||-1},{term:67,get:n=>mQ[n]||-1}],tokenPrec:12820}),OQ=[Jn("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Jn("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Jn("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Jn("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Jn("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Jn(`try { \${} } catch (\${error}) { \${} @@ -3894,10 +3894,10 @@ v 0.000000 1.886240 -2.357533 constructor(\${params}) { \${} } -}`,{label:"class",detail:"definition",type:"keyword"}),Jn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Jn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],ev=new zk,oy=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Yo(n){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,n),!0}}const vQ=["FunctionDeclaration"],xQ={FunctionDeclaration:Yo("function"),ClassDeclaration:Yo("class"),ClassExpression:()=>!0,EnumDeclaration:Yo("constant"),TypeAliasDeclaration:Yo("type"),NamespaceDeclaration:Yo("namespace"),VariableDefinition(n,e){n.matchContext(vQ)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function ay(n,e){let t=ev.get(e);if(t)return t;let i=[],s=!0;function r(o,a){let l=n.sliceString(o.from,o.to);i.push({label:l,type:a})}return e.cursor(Qt.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let a=xQ[o.name];if(a&&a(o,r)||oy.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of ay(n,o.node))i.push(a);return!1}}),ev.set(e,i),i}const tv=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,ly=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function SQ(n){let e=Xt(n.state).resolveInner(n.pos,-1);if(ly.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&tv.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let s=e;s;s=s.parent)oy.has(s.name)&&(i=i.concat(ay(n.state.doc,s)));return{options:i,from:t?e.from:n.pos,validFor:tv}}const hr=Jc.define({name:"javascript",parser:gQ.configure({props:[L_.add({IfStatement:qu({except:/^\s*({|else\b)/}),TryStatement:qu({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:hL,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:i?1:2)*n.unit},Block:cL({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":qu({except:/^{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),I_.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":pL,BlockComment(n){return{from:n.from+2,to:n.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),cy={test:n=>/^JSX/.test(n.name),facet:R_({commentTokens:{block:{open:"{/*",close:"*/}"}}})},_Q=hr.configure({dialect:"ts"},"typescript"),yQ=hr.configure({dialect:"jsx",props:[Mp.add(n=>n.isTop?[cy]:void 0)]}),bQ=hr.configure({dialect:"jsx ts",props:[Mp.add(n=>n.isTop?[cy]:void 0)]},"typescript"),wQ="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(n=>({label:n,type:"keyword"}));function MQ(n={}){let e=n.jsx?n.typescript?bQ:yQ:n.typescript?_Q:hr;return new tL(e,[hr.data.of({autocomplete:EU(ly,$1(OQ.concat(wQ)))}),hr.data.of({autocomplete:SQ}),n.jsx?PQ:[]])}function TQ(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function nv(n,e,t=n.length){for(let i=e==null?void 0:e.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return n.sliceString(i.from,Math.min(i.to,t));return""}function EQ(n){return n&&(n.name=="JSXEndTag"||n.name=="JSXSelfCloseEndTag")}const AQ=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),PQ=Ee.inputHandler.of((n,e,t,i)=>{if((AQ?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||i!=">"&&i!="/"||!hr.isActiveAt(n.state,e,-1))return!1;let{state:s}=n,r=s.changeByRange(o=>{var a;let{head:l}=o,c=Xt(s).resolveInner(l,-1),h;if(c.name=="JSXStartTag"&&(c=c.parent),!(c.name=="JSXAttributeValue"&&c.to>l)){if(i==">"&&c.name=="JSXFragmentTag")return{range:re.cursor(l+1),changes:{from:l,insert:">"}};if(i=="/"&&c.name=="JSXFragmentTag"){let u=c.parent,f=u==null?void 0:u.parent;if(u.from==l-1&&((a=f.lastChild)===null||a===void 0?void 0:a.name)!="JSXEndTag"&&(h=nv(s.doc,f==null?void 0:f.firstChild,l))){let d=`/${h}>`;return{range:re.cursor(l+d.length),changes:{from:l,insert:d}}}}else if(i==">"){let u=TQ(c);if(u&&!EQ(u.lastChild)&&s.sliceDoc(l,l+2)!="`}}}}return{range:o}});return r.changes.empty?!1:(n.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}),CQ="#e5c07b",iv="#e06c75",RQ="#56b6c2",kQ="#ffffff",bc="#abb2bf",bd="#7d8799",LQ="#61afef",DQ="#98c379",sv="#d19a66",UQ="#c678dd",IQ="#21252b",rv="#2c313a",ov="#282c34",lf="#353a42",QQ="#3E4451",av="#528bff",NQ=Ee.theme({"&":{color:bc,backgroundColor:ov},".cm-content":{caretColor:av},".cm-cursor, .cm-dropCursor":{borderLeftColor:av},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:QQ},".cm-panels":{backgroundColor:IQ,color:bc},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:ov,color:bd,border:"none"},".cm-activeLineGutter":{backgroundColor:rv},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:lf},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:lf,borderBottomColor:lf},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:rv,color:bc}}},{dark:!0}),$Q=il.define([{tag:D.keyword,color:UQ},{tag:[D.name,D.deleted,D.character,D.propertyName,D.macroName],color:iv},{tag:[D.function(D.variableName),D.labelName],color:LQ},{tag:[D.color,D.constant(D.name),D.standard(D.name)],color:sv},{tag:[D.definition(D.name),D.separator],color:bc},{tag:[D.typeName,D.className,D.number,D.changed,D.annotation,D.modifier,D.self,D.namespace],color:CQ},{tag:[D.operator,D.operatorKeyword,D.url,D.escape,D.regexp,D.link,D.special(D.string)],color:RQ},{tag:[D.meta,D.comment],color:bd},{tag:D.strong,fontWeight:"bold"},{tag:D.emphasis,fontStyle:"italic"},{tag:D.strikethrough,textDecoration:"line-through"},{tag:D.link,color:bd,textDecoration:"underline"},{tag:D.heading,fontWeight:"bold",color:iv},{tag:[D.atom,D.bool,D.special(D.variableName)],color:sv},{tag:[D.processingInstruction,D.string,D.inserted],color:DQ},{tag:D.invalid,color:kQ}]),FQ=[NQ,V_($Q)],BQ=ve("p",null," Here is where you will write a JavaScript function body that will be run once per tick for each LED in your input mesh. This function must return an array of Numbers, where the expected value is a float range from 0 to 1. Values outside of this range will be clamped to that range. There are several variables available for use inside this function: ",-1),XQ=ve("pre",{class:"code"},`position: {x:Number, y:Number, z:Number} +}`,{label:"class",detail:"definition",type:"keyword"}),Jn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Jn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],ev=new zk,ay=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Yo(n){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,n),!0}}const vQ=["FunctionDeclaration"],xQ={FunctionDeclaration:Yo("function"),ClassDeclaration:Yo("class"),ClassExpression:()=>!0,EnumDeclaration:Yo("constant"),TypeAliasDeclaration:Yo("type"),NamespaceDeclaration:Yo("namespace"),VariableDefinition(n,e){n.matchContext(vQ)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function ly(n,e){let t=ev.get(e);if(t)return t;let i=[],s=!0;function r(o,a){let l=n.sliceString(o.from,o.to);i.push({label:l,type:a})}return e.cursor(It.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let a=xQ[o.name];if(a&&a(o,r)||ay.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of ly(n,o.node))i.push(a);return!1}}),ev.set(e,i),i}const tv=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,cy=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function SQ(n){let e=Xt(n.state).resolveInner(n.pos,-1);if(cy.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&tv.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let s=e;s;s=s.parent)ay.has(s.name)&&(i=i.concat(ly(n.state.doc,s)));return{options:i,from:t?e.from:n.pos,validFor:tv}}const hr=Jc.define({name:"javascript",parser:gQ.configure({props:[D_.add({IfStatement:qu({except:/^\s*({|else\b)/}),TryStatement:qu({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:hL,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:i?1:2)*n.unit},Block:cL({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":qu({except:/^{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),Q_.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":pL,BlockComment(n){return{from:n.from+2,to:n.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),hy={test:n=>/^JSX/.test(n.name),facet:k_({commentTokens:{block:{open:"{/*",close:"*/}"}}})},_Q=hr.configure({dialect:"ts"},"typescript"),yQ=hr.configure({dialect:"jsx",props:[Mp.add(n=>n.isTop?[hy]:void 0)]}),bQ=hr.configure({dialect:"jsx ts",props:[Mp.add(n=>n.isTop?[hy]:void 0)]},"typescript"),wQ="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(n=>({label:n,type:"keyword"}));function MQ(n={}){let e=n.jsx?n.typescript?bQ:yQ:n.typescript?_Q:hr;return new tL(e,[hr.data.of({autocomplete:EU(cy,F1(OQ.concat(wQ)))}),hr.data.of({autocomplete:SQ}),n.jsx?PQ:[]])}function TQ(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function nv(n,e,t=n.length){for(let i=e==null?void 0:e.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return n.sliceString(i.from,Math.min(i.to,t));return""}function EQ(n){return n&&(n.name=="JSXEndTag"||n.name=="JSXSelfCloseEndTag")}const AQ=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),PQ=Ee.inputHandler.of((n,e,t,i)=>{if((AQ?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||i!=">"&&i!="/"||!hr.isActiveAt(n.state,e,-1))return!1;let{state:s}=n,r=s.changeByRange(o=>{var a;let{head:l}=o,c=Xt(s).resolveInner(l,-1),h;if(c.name=="JSXStartTag"&&(c=c.parent),!(c.name=="JSXAttributeValue"&&c.to>l)){if(i==">"&&c.name=="JSXFragmentTag")return{range:re.cursor(l+1),changes:{from:l,insert:">"}};if(i=="/"&&c.name=="JSXFragmentTag"){let u=c.parent,f=u==null?void 0:u.parent;if(u.from==l-1&&((a=f.lastChild)===null||a===void 0?void 0:a.name)!="JSXEndTag"&&(h=nv(s.doc,f==null?void 0:f.firstChild,l))){let d=`/${h}>`;return{range:re.cursor(l+d.length),changes:{from:l,insert:d}}}}else if(i==">"){let u=TQ(c);if(u&&!EQ(u.lastChild)&&s.sliceDoc(l,l+2)!="`}}}}return{range:o}});return r.changes.empty?!1:(n.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}),CQ="#e5c07b",iv="#e06c75",RQ="#56b6c2",kQ="#ffffff",bc="#abb2bf",bd="#7d8799",LQ="#61afef",DQ="#98c379",sv="#d19a66",UQ="#c678dd",IQ="#21252b",rv="#2c313a",ov="#282c34",lf="#353a42",QQ="#3E4451",av="#528bff",NQ=Ee.theme({"&":{color:bc,backgroundColor:ov},".cm-content":{caretColor:av},".cm-cursor, .cm-dropCursor":{borderLeftColor:av},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:QQ},".cm-panels":{backgroundColor:IQ,color:bc},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:ov,color:bd,border:"none"},".cm-activeLineGutter":{backgroundColor:rv},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:lf},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:lf,borderBottomColor:lf},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:rv,color:bc}}},{dark:!0}),$Q=il.define([{tag:D.keyword,color:UQ},{tag:[D.name,D.deleted,D.character,D.propertyName,D.macroName],color:iv},{tag:[D.function(D.variableName),D.labelName],color:LQ},{tag:[D.color,D.constant(D.name),D.standard(D.name)],color:sv},{tag:[D.definition(D.name),D.separator],color:bc},{tag:[D.typeName,D.className,D.number,D.changed,D.annotation,D.modifier,D.self,D.namespace],color:CQ},{tag:[D.operator,D.operatorKeyword,D.url,D.escape,D.regexp,D.link,D.special(D.string)],color:RQ},{tag:[D.meta,D.comment],color:bd},{tag:D.strong,fontWeight:"bold"},{tag:D.emphasis,fontStyle:"italic"},{tag:D.strikethrough,textDecoration:"line-through"},{tag:D.link,color:bd,textDecoration:"underline"},{tag:D.heading,fontWeight:"bold",color:iv},{tag:[D.atom,D.bool,D.special(D.variableName)],color:sv},{tag:[D.processingInstruction,D.string,D.inserted],color:DQ},{tag:D.invalid,color:kQ}]),FQ=[NQ,W_($Q)],BQ=ve("p",null," Here is where you will write a JavaScript function body that will be run once per tick for each LED in your input mesh. This function must return an array of Numbers, where the expected value is a float range from 0 to 1. Values outside of this range will be clamped to that range. There are several variables available for use inside this function: ",-1),XQ=ve("pre",{class:"code"},`position: {x:Number, y:Number, z:Number} index: Number // the index of the LED count: Number // total number of LEDs -time: Number // A value in 0 to 1 range`,-1),zQ={class:"form-control"},VQ={style:{display:"inline"}},WQ=ve("span",null,"Load pattern:",-1),GQ={label:"Built-in"},ZQ=["value"],HQ={label:"User patterns (localStorage)"},YQ=["value"],jQ={class:"form-control"},qQ=ve("span",null,"Vertex Color Function",-1),KQ={style:{"text-align":"right"}},JQ=ve("input",{type:"submit",value:"Run Input"},null,-1),e5={__name:"ColorFunctionPanel",setup(n){const{presets:e,userPresets:t,colorFunctionString:i,removePresetByName:s,saveCurrentPattern:r,processColorFunction:o}=rp(),a=[MQ(),FQ],l=Lt(null),c=es({get(){return l.value||e[0]},set(h){l.value=h,i.value=h.value,o()}});return(h,u)=>(Ct(),za(cp,{title:"Color Function"},{default:_h(()=>[BQ,XQ,ve("form",{onSubmit:u[4]||(u[4]=Eh((...f)=>et(o)&&et(o)(...f),["prevent"]))},[ve("div",zQ,[ve("label",VQ,[WQ,bi(ve("select",{"onUpdate:modelValue":u[0]||(u[0]=f=>c.value=f)},[ve("optgroup",GQ,[(Ct(!0),gn(fn,null,Ac(et(e),f=>(Ct(),gn("option",{key:f.label,value:f},Vn(f.label),9,ZQ))),128))]),ve("optgroup",HQ,[(Ct(!0),gn(fn,null,Ac(et(t),f=>(Ct(),gn("option",{key:f.label,value:f},Vn(f.label),9,YQ))),128))])],512),[[ox,c.value]])]),l.value&&l.value.is_custom?(Ct(),gn("button",{key:0,type:"button",onClick:u[1]||(u[1]=f=>et(s)(l.value.label))},' Delete "'+Vn(l.value.label)+'" ',1)):Mh("",!0)]),ve("div",jQ,[ve("label",null,[qQ,Nt(et(FI),{modelValue:et(i),"onUpdate:modelValue":u[2]||(u[2]=f=>Ot(i)?i.value=f:null),extensions:a,"indent-with-tab":!0,"tab-size":4},null,8,["modelValue"])]),ve("div",KQ,[ve("button",{class:"save",type:"button",onClick:u[3]||(u[3]=(...f)=>et(r)&&et(r)(...f))}," Save Pattern "),JQ])])],32)]),_:1}))}},{processOutputColors:t5}=lp(),{startFrame:n5,endFrame:i5,framesPerSecond:s5}=Lh(),{colorFunctionString:r5}=rp(),lv=Lt(null),mh=Lt("AnimationName"),cv=(n,e)=>{let[...t]=n;for(var i=[];t.length;)i.push(t.splice(0,e));return i},o5=n=>{const e=mh.value.replaceAll(" ","_"),t=e.toLocaleUpperCase(),i=n.map(c=>"0x"+c.toString(16).padStart(2,"0").toLocaleUpperCase()),s=i5.value-n5.value+1,r=n.length/3/s,o=s*r-1,a=cv(i,3).map((c,h)=>{let u=",";return h===o&&(u=""),` ${c.join(", ")}${u} // ${h%r}`}),l=cv(a,r).map((c,h)=>` // frame index ${h} +time: Number // A value in 0 to 1 range`,-1),zQ={class:"form-control"},VQ={style:{display:"inline"}},WQ=ve("span",null,"Load pattern:",-1),GQ={label:"Built-in"},ZQ=["value"],HQ={label:"User patterns (localStorage)"},YQ=["value"],jQ={class:"form-control"},qQ=ve("span",null,"Vertex Color Function",-1),KQ={style:{"text-align":"right"}},JQ=ve("input",{type:"submit",value:"Run Input"},null,-1),e5={__name:"ColorFunctionPanel",setup(n){const{presets:e,userPresets:t,colorFunctionString:i,removePresetByName:s,saveCurrentPattern:r,processColorFunction:o}=rp(),a=[MQ(),FQ],l=$t(null),c=es({get(){return l.value||e[0]},set(h){l.value=h,i.value=h.value,o()}});return(h,u)=>(Ct(),za(cp,{title:"Color Function"},{default:_h(()=>[BQ,XQ,ve("form",{onSubmit:u[4]||(u[4]=Eh((...f)=>nt(o)&&nt(o)(...f),["prevent"]))},[ve("div",zQ,[ve("label",VQ,[WQ,Wi(ve("select",{"onUpdate:modelValue":u[0]||(u[0]=f=>c.value=f)},[ve("optgroup",GQ,[(Ct(!0),gn(fn,null,Ac(nt(e),f=>(Ct(),gn("option",{key:f.label,value:f},Vn(f.label),9,ZQ))),128))]),ve("optgroup",HQ,[(Ct(!0),gn(fn,null,Ac(nt(t),f=>(Ct(),gn("option",{key:f.label,value:f},Vn(f.label),9,YQ))),128))])],512),[[ox,c.value]])]),l.value&&l.value.is_custom?(Ct(),gn("button",{key:0,type:"button",onClick:u[1]||(u[1]=f=>nt(s)(l.value.label))},' Delete "'+Vn(l.value.label)+'" ',1)):Mh("",!0)]),ve("div",jQ,[ve("label",null,[qQ,Qt(nt(FI),{modelValue:nt(i),"onUpdate:modelValue":u[2]||(u[2]=f=>Ot(i)?i.value=f:null),extensions:a,"indent-with-tab":!0,"tab-size":4},null,8,["modelValue"])]),ve("div",KQ,[ve("button",{class:"save",type:"button",onClick:u[3]||(u[3]=(...f)=>nt(r)&&nt(r)(...f))}," Save Pattern "),JQ])])],32)]),_:1}))}},{processOutputColors:t5}=lp(),{startFrame:n5,endFrame:i5,framesPerSecond:s5}=Lh(),{colorFunctionString:r5}=rp(),lv=$t(null),mh=$t("AnimationName"),cv=(n,e)=>{let[...t]=n;for(var i=[];t.length;)i.push(t.splice(0,e));return i},o5=n=>{const e=mh.value.replaceAll(" ","_"),t=e.toLocaleUpperCase(),i=n.map(c=>"0x"+c.toString(16).padStart(2,"0").toLocaleUpperCase()),s=i5.value-n5.value+1,r=n.length/3/s,o=s*r-1,a=cv(i,3).map((c,h)=>{let u=",";return h===o&&(u=""),` ${c.join(", ")}${u} // ${h%r}`}),l=cv(a,r).map((c,h)=>` // frame index ${h} ${c.join(` `)}`);return`#ifndef ${t}_H #define ${t}_H @@ -3919,4 +3919,4 @@ ${l.join(` }; #endif /* ${t}_H */ -`},a5=n=>Uint8Array.from(n),l5=(n,e)=>{let t=n,i="octet/stream";typeof t=="string"&&(i="text/plain");const s=new Blob([t],{type:i});return{href:window.URL.createObjectURL(s),target:"_blank",download:e}},hv={cHeader(n){const e=o5(n);return console.log("cHeaderText",e),{fileName:mh.value+".h",data:e}},bin(n){const e=a5(n);return console.log("binData",e),{fileName:mh.value+".bin",data:e}}};let uv=Lt("cHeader");const c5=()=>({outputName:mh,outputType:uv,outputTypes:Object.keys(hv),processedDownloadLink:lv,processOutput:()=>{const n=t5(),{data:e,fileName:t}=hv[uv.value](n);lv.value=l5(e,t)}}),h5=ve("p",null,"This section allows you to generate static output in several different formats.",-1),u5={class:"form-control"},f5=ve("span",null,"Output Variable Name Prefix",-1),d5={class:"form-control"},p5=ve("span",null,"Output type",-1),m5=ve("div",null,[ve("input",{type:"submit",value:"Process Output"})],-1),g5={key:0},O5={__name:"OutputPanel",setup(n){const{outputName:e,outputType:t,outputTypes:i,processedDownloadLink:s,processOutput:r}=c5();return(o,a)=>(Ct(),za(cp,{title:"Output"},{default:_h(()=>[h5,ve("form",{onSubmit:a[2]||(a[2]=Eh((...l)=>et(r)&&et(r)(...l),["prevent"]))},[ve("div",u5,[ve("label",null,[f5,bi(ve("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=l=>Ot(e)?e.value=l:null)},null,512),[[Wr,et(e)]])])]),ve("div",d5,[ve("label",null,[p5,bi(ve("select",{"onUpdate:modelValue":a[1]||(a[1]=l=>Ot(t)?t.value=l:null)},[(Ct(!0),gn(fn,null,Ac(et(i),l=>(Ct(),gn("option",{key:l},Vn(l),1))),128))],512),[[ox,et(t)]])])]),m5],32),et(s)?(Ct(),gn("p",g5,[ve("a",Ty(ix(et(s))),[mo("Download "),ve("code",null,Vn(et(s).download),1)],16)])):Mh("",!0)]),_:1}))}},v5=ve("p",null,[mo(" Here, you may input an "),ve("code",null,"Wavefront/OBJ"),mo(" 3D model file, where each vertex in your model will be treated as one RGB LED. This file is never sent to any server; all work is done locally in your browser. ")],-1),x5={class:"form-control"},S5=ve("span",null,"OBJ File",-1),_5={class:"form-control"},y5={class:"form-control"},b5={__name:"MeshInputPanel",setup(n){const{ingestObjText:e,ledSize:t,showIndices:i}=lp(),s=o=>{o.target.files[0].text().then(e)},r=es(()=>t.value.toFixed(2));return(o,a)=>(Ct(),za(cp,{title:"Mesh Input"},{default:_h(()=>[v5,ve("form",{onSubmit:a[2]||(a[2]=Eh(()=>{},["prevent"]))},[ve("div",x5,[ve("label",null,[S5,ve("input",{type:"file",onInput:s},null,32)])]),ve("div",_5,[ve("label",null,[ve("span",null,[mo("LED preview size: "),ve("code",null,Vn(r.value),1)]),bi(ve("input",{type:"range","onUpdate:modelValue":a[0]||(a[0]=l=>Ot(t)?t.value=l:null),min:"0.02",max:"0.40",step:"0.01",style:{width:"100%"}},null,512),[[Wr,et(t)]])])]),ve("div",y5,[ve("label",null,[ve("span",null,[mo("Show Indices: "),ve("code",null,Vn(et(i)),1)]),bi(ve("input",{type:"checkbox",value:!0,"onUpdate:modelValue":a[1]||(a[1]=l=>Ot(i)?i.value=l:null)},null,512),[[Lw,et(i)]])])])],32)]),_:1}))}};const w5={id:"container"},M5={id:"preview"},T5={id:"viewport"},E5={id:"vert-count"},A5={class:"bottom-panel"},P5={class:"panel-toggler"},C5={key:0,id:"controls"},R5={__name:"App",setup(n){const{vertCount:e,viewportCanvas:t,labelOverlay:i,showIndices:s}=lp(),{advanceFrame:r,previousFrame:o,isPlaying:a}=Lh(),l=Lt(null),c=Lt(null),h=Lt(!0),u={"`":()=>{h.value=!h.value}," ":()=>{a.value=!a.value},ArrowRight:()=>{a.value=!1,r()},ArrowLeft:()=>{a.value=!1,o()}},f=["input","textarea","select",".cm-editor *"];return window.addEventListener("keydown",d=>{console.log(`What is key? "${d.key}"`);const g=u[d.key];g&&!d.target.matches(f)&&(d.preventDefault(),g())}),Xd(()=>{l.value.appendChild(t),c.value.appendChild(i)}),(d,g)=>(Ct(),gn("div",w5,[ve("div",M5,[ve("div",T5,[ve("div",{id:"viewport-holder",ref_key:"viewportHolder",ref:l},null,512),bi(ve("div",{id:"label-holder",ref_key:"labelHolder",ref:c},null,512),[[Iw,et(s)]]),ve("div",E5,"vertCount: "+Vn(et(e)),1),ve("div",A5,[ve("div",P5,[ve("button",{onClick:g[0]||(g[0]=O=>h.value=!h.value)},"Toggle Controls")])])]),Nt(qC)]),h.value?(Ct(),gn("div",C5,[Nt(b5),Nt(O5),Nt(e5)])):Mh("",!0)]))}};const hy=$w(R5);hy.use(zw());hy.mount("#app"); +`},a5=n=>Uint8Array.from(n),l5=(n,e)=>{let t=n,i="octet/stream";typeof t=="string"&&(i="text/plain");const s=new Blob([t],{type:i});return{href:window.URL.createObjectURL(s),target:"_blank",download:e}},hv={cHeader(n){const e=o5(n);return console.log("cHeaderText",e),{fileName:mh.value+".h",data:e}},bin(n){const e=a5(n);return console.log("binData",e),{fileName:mh.value+".bin",data:e}}};let uv=$t("cHeader");const c5=()=>({outputName:mh,outputType:uv,outputTypes:Object.keys(hv),processedDownloadLink:lv,processOutput:()=>{const n=t5(),{data:e,fileName:t}=hv[uv.value](n);lv.value=l5(e,t)}}),h5=ve("p",null,"This section allows you to generate static output in several different formats.",-1),u5={class:"form-control"},f5=ve("span",null,"Output Variable Name Prefix",-1),d5={class:"form-control"},p5=ve("span",null,"Output type",-1),m5=ve("div",null,[ve("input",{type:"submit",value:"Process Output"})],-1),g5={key:0},O5={__name:"OutputPanel",setup(n){const{outputName:e,outputType:t,outputTypes:i,processedDownloadLink:s,processOutput:r}=c5();return(o,a)=>(Ct(),za(cp,{title:"Output"},{default:_h(()=>[h5,ve("form",{onSubmit:a[2]||(a[2]=Eh((...l)=>nt(r)&&nt(r)(...l),["prevent"]))},[ve("div",u5,[ve("label",null,[f5,Wi(ve("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=l=>Ot(e)?e.value=l:null)},null,512),[[Gr,nt(e)]])])]),ve("div",d5,[ve("label",null,[p5,Wi(ve("select",{"onUpdate:modelValue":a[1]||(a[1]=l=>Ot(t)?t.value=l:null)},[(Ct(!0),gn(fn,null,Ac(nt(i),l=>(Ct(),gn("option",{key:l},Vn(l),1))),128))],512),[[ox,nt(t)]])])]),m5],32),nt(s)?(Ct(),gn("p",g5,[ve("a",Ey(ix(nt(s))),[go("Download "),ve("code",null,Vn(nt(s).download),1)],16)])):Mh("",!0)]),_:1}))}},v5=ve("p",null,[go(" Here, you may input an "),ve("code",null,"Wavefront/OBJ"),go(" 3D model file, where each vertex in your model will be treated as one RGB LED. This file is never sent to any server; all work is done locally in your browser. ")],-1),x5={class:"form-control"},S5=ve("span",null,"OBJ File",-1),_5={class:"form-control"},y5={class:"form-control"},b5={__name:"MeshInputPanel",setup(n){const{ingestObjText:e,ledSize:t,showIndices:i}=lp(),s=o=>{o.target.files[0].text().then(e)},r=es(()=>t.value.toFixed(2));return(o,a)=>(Ct(),za(cp,{title:"Mesh Input"},{default:_h(()=>[v5,ve("form",{onSubmit:a[2]||(a[2]=Eh(()=>{},["prevent"]))},[ve("div",x5,[ve("label",null,[S5,ve("input",{type:"file",onInput:s},null,32)])]),ve("div",_5,[ve("label",null,[ve("span",null,[go("LED preview size: "),ve("code",null,Vn(r.value),1)]),Wi(ve("input",{type:"range","onUpdate:modelValue":a[0]||(a[0]=l=>Ot(t)?t.value=l:null),min:"0.02",max:"0.40",step:"0.01",style:{width:"100%"}},null,512),[[Gr,nt(t)]])])]),ve("div",y5,[ve("label",null,[ve("span",null,[go("Show Indices: "),ve("code",null,Vn(nt(i)),1)]),Wi(ve("input",{type:"checkbox",value:!0,"onUpdate:modelValue":a[1]||(a[1]=l=>Ot(i)?i.value=l:null)},null,512),[[Dw,nt(i)]])])])],32)]),_:1}))}};const w5={id:"container"},M5={id:"preview"},T5={id:"viewport"},E5={id:"vert-count"},A5={class:"bottom-panel"},P5={class:"panel-toggler"},C5={key:0,id:"controls"},R5={__name:"App",setup(n){const{vertCount:e,viewportDomParent:t}=lp(),{advanceFrame:i,previousFrame:s,isPlaying:r}=Lh(),o=$t(null),a=$t(!0),l={"`":()=>{a.value=!a.value}," ":()=>{r.value=!r.value},ArrowRight:()=>{r.value=!1,i()},ArrowLeft:()=>{r.value=!1,s()}},c=["input","textarea","select",".cm-editor *"];return window.addEventListener("keydown",h=>{console.log(`What is key? "${h.key}"`);const u=l[h.key];u&&!h.target.matches(c)&&(h.preventDefault(),u())}),Xd(()=>{o.value.appendChild(t)}),(h,u)=>(Ct(),gn("div",w5,[ve("div",M5,[ve("div",T5,[ve("div",{id:"viewport-holder",ref_key:"viewportHolder",ref:o},null,512),ve("div",E5,"vertCount: "+Vn(nt(e)),1),ve("div",A5,[ve("div",P5,[ve("button",{onClick:u[0]||(u[0]=f=>a.value=!a.value)},"Toggle Controls")])])]),Qt(qC)]),a.value?(Ct(),gn("div",C5,[Qt(b5),Qt(O5),Qt(e5)])):Mh("",!0)]))}};const uy=$w(R5);uy.use(zw());uy.mount("#app"); diff --git a/assets/index-e2074de0.css b/assets/index-e2074de0.css deleted file mode 100644 index 294e40f..0000000 --- a/assets/index-e2074de0.css +++ /dev/null @@ -1 +0,0 @@ -.TimelineControl{background-color:#333;border-top:1px solid #444}.TimelineControl label{position:relative;display:inline-block}.TimelineControl button,.TimelineControl label span{font-size:12px;line-height:1rem;border-right:1px solid #666;background-color:#444}.TimelineControl label span{position:absolute;top:3px;left:3px;padding:3px 4px 3px 0;text-align:right;width:2.75rem}.TimelineControl button span{vertical-align:top}.TimelineControl button,.TimelineControl label input{padding:0 2px;width:96px;height:24px}.TimelineControl label input{padding:0 2px 0 2.85rem}.TimelineControl .bars{height:32px;background-color:#222;border-top:1px solid #222}.TimelineControl .bars .bar{display:inline-block;height:100%;background-color:#282828;border-right:1px solid #333;position:relative;overflow:visible;user-select:none}.TimelineControl .bars .bar .hover{display:none;position:absolute;top:-16px;background-color:#00000080;border-radius:4px;padding:3px;font-size:10px;line-height:10px;pointer-events:none}.TimelineControl .bars .bar.active .hover,.TimelineControl .bars .bar:hover .hover{display:block}.TimelineControl .bars .bar.darker{background-color:#222}.TimelineControl .bars .bar.active{background-color:#04a7ff}.AccordionPanel{border-top:1px solid #444;border-bottom:1px solid #444}.AccordionPanel+.AccordionPanel{border-top:none}.AccordionPanel>h3{background-color:#222;line-height:1.5em}.AccordionPanel>h3>*{vertical-align:middle}.AccordionPanel>h3>button{margin:0 1rem 0 0;border:none;border-right:1px solid #444}.AccordionPanel.open h3{border-bottom:1px solid #444}.AccordionPanel .content{padding:8px}#container{display:flex;height:100%}#preview{position:relative;flex-grow:1;display:flex;flex-direction:column;height:100%;max-height:100%}#viewport{flex-grow:1;position:relative}#vert-count{position:absolute;z-index:0}.bottom-panel{position:absolute;bottom:0;left:0;right:0}#controls{width:50%;min-width:320px;z-index:1;top:0;left:0;background-color:#333;border-left:1px solid #444;overflow-y:auto;max-height:100%}*{margin:0;padding:0;border:0;vertical-align:top;color:inherit;line-height:inherit;font-size:inherit;font-family:inherit;font-weight:inherit;box-sizing:border-box}html,body,canvas{height:100%;width:100%}.label-div,canvas{display:block;position:absolute;max-width:100%;max-height:100%;font-size:2rem}body{background-color:#000;color:#999;line-height:1.5rem;font-size:16px;font-family:monaco,monospace;font-weight:400}#app{height:100%}input,button,select,textarea{color:#9f0;padding:2px 4px;margin:2px;background-color:#333;border:1px solid #666;vertical-align:middle;height:2rem}textarea{max-width:100%}button.save,input[type=submit]{background-color:#555}input[type=submit]:hover,button:hover{border:1px solid #888;background-color:#444;cursor:pointer}.form-control{background-color:#252525;padding:8px;margin-bottom:.5rem}.form-control>label{display:block}label>span,label>input,label>textarea{display:block}label>span{color:#bbb;font-size:.75rem}code,.code{border-radius:4px;background-color:#0008;padding:4px 8px}code{margin:0 -4px}p,pre{margin-bottom:.5rem;font-size:.75rem} diff --git a/index.html b/index.html index ddf9e86..e8f905f 100644 --- a/index.html +++ b/index.html @@ -8,8 +8,8 @@ > Spatial LED Color Designer - - + +