dsh-code-server-app 0.1.2 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -1,945 +1,6 @@
1
- // dsh-code-server — client bundle(侧栏按钮 + 内部浮动窗口 iframe)
2
- // 格式:window.__ModuleLoader__.load({ id, factory });factory(require) 的
3
- // require 解析浏览器端冻结模块表(react 等官方共享模块)
4
- //
5
- // 数据通道:同源 fetch DSH webServer 上的 /code-server JSON API
6
- // GET /code-server/status → { ok, running, status, port, host, pid, cwd, url, version, error, logTail, adopted }
7
- // POST /code-server/start → { cwd? } → status
8
- // POST /code-server/stop → status
9
- //
10
- // UI 结构(参照 dsh-univer-office 的 WorktreeWindow):
11
- // - sidebar.footer.action(id code-server-panel):"Code Server"按钮;点击打开窗口
12
- // - shell.overlay(id code-server):内部浮动窗口——固定定位 + 空转根容器,
13
- // 窗口自身接管 pointer-events,可拖动/8 向缩放/最大化/折叠/关闭
14
- //
15
- // 窗口几何与手势完全复刻 univer-office 模式:
16
- // - 根容器 position:fixed inset:0 pointer-events:none(点击穿透到底层)
17
- // - 窗口 pointer-events:auto,标题栏 pointerdown 拖动(setPointerCapture),
18
- // 双击最大化,8 个 resize handle 缩放,min 尺寸约束,viewport 边缘 clamp。
19
- window.__ModuleLoader__.load({
20
- id: 'dsh-code-server-app',
21
- factory: (require) => {
22
- var module = { exports: {} }
23
- var exports = module.exports
24
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
25
- let React = require('react')
26
- // ReactDOM 为必需:窗口经 createPortal 挂到 document.body(跨越 shell.overlay 的
27
- // stacking context)。react-dom 在冻结模块表内(官方 feedback bundle 同款),
28
- // 缺失时在此显式失败(而非静默降级导致窗口被输入框遮挡)。
29
- let ReactDOM = require('react-dom')
1
+ window.__ModuleLoader__.load({id:'dsh-code-server-app',factory:function(require){var module={exports:{}};var exports=module.exports;
2
+ var yn=Object.defineProperty;var mc=Object.getOwnPropertyDescriptor;var pc=Object.getOwnPropertyNames;var dc=Object.prototype.hasOwnProperty;var hc=(t,e)=>{for(var r in e)yn(t,r,{get:e[r],enumerable:!0})},gc=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of pc(e))!dc.call(t,n)&&n!==r&&yn(t,n,{get:()=>e[n],enumerable:!(o=mc(e,n))||o.enumerable});return t};var xc=t=>gc(yn({},"__esModule",{value:!0}),t);var Cm={};hc(Cm,{apply:()=>Tm,inject:()=>Vm,name:()=>Pm});module.exports=xc(Cm);var Ui=require("react"),zr=(0,Ui.createContext)({});var Hi=require("react");function Ki(t){let e=(0,Hi.useRef)(null);return e.current===null&&(e.current=t()),e.current}var Gr=require("react");var _i=typeof window!="undefined";var $i=_i?Gr.useLayoutEffect:Gr.useEffect;var Yi=require("react"),ve=(0,Yi.createContext)(null);function te(t,e){t.indexOf(e)===-1&&t.push(e)}function Ft(t,e){let r=t.indexOf(e);r>-1&&t.splice(r,1)}var _=(t,e,r)=>r>e?e:r<t?t:r;var Et=()=>{},it=()=>{};var et={};var Ke=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);var _e=t=>typeof t=="object"&&t!==null;var $e=t=>/^0[^.\s]+$/u.test(t);function Ye(t){let e;return()=>(e===void 0&&(e=t()),e)}var j=t=>t;var yt=(...t)=>t.reduce((e,r)=>o=>r(e(o)));var bt=(t,e,r)=>{let o=e-t;return o?(r-t)/o:1};var At=class{constructor(){this.subscriptions=[]}add(e){return te(this.subscriptions,e),()=>Ft(this.subscriptions,e)}notify(e,r,o){let n=this.subscriptions.length;if(n)if(n===1)this.subscriptions[0](e,r,o);else for(let s=0;s<n;s++){let i=this.subscriptions[s];i&&i(e,r,o)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}};var U=t=>t*1e3,X=t=>t/1e3;var Xe=(t,e)=>e?t*(1e3/e):0;var Xi=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,yc=1e-7,vc=12;function bc(t,e,r,o,n){let s,i,a=0;do i=e+(r-e)/2,s=Xi(i,o,n)-t,s>0?r=i:e=i;while(Math.abs(s)>yc&&++a<vc);return i}function Nt(t,e,r,o){if(t===e&&r===o)return j;let n=s=>bc(s,0,1,t,r);return s=>s===0||s===1?s:Xi(n(s),e,o)}var Wr=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2;var Ur=t=>e=>1-t(1-e);var Hr=Nt(.33,1.53,.69,.99),be=Ur(Hr),qe=Wr(be);var Ze=t=>t>=1?1:(t*=2)<1?.5*be(t):.5*(2-Math.pow(2,-10*(t-1)));var Je=t=>1-Math.sin(Math.acos(t)),Qe=Ur(Je),tr=Wr(Je);var vn=Nt(.42,0,1,1),bn=Nt(0,0,.58,1),er=Nt(.42,0,.58,1);var wn=t=>Array.isArray(t)&&typeof t[0]!="number";var rr=t=>Array.isArray(t)&&typeof t[0]=="number";var qi={linear:j,easeIn:vn,easeInOut:er,easeOut:bn,circIn:Je,circInOut:tr,circOut:Qe,backIn:be,backInOut:qe,backOut:Hr,anticipate:Ze},wc=t=>typeof t=="string",Kr=t=>{if(rr(t)){it(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[e,r,o,n]=t;return Nt(e,r,o,n)}else if(wc(t))return it(qi[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),qi[t];return t};var or=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Zi(t){let e=new Set,r=new Set,o=!1,n=!1,s=new WeakSet,i={delta:0,timestamp:0,isProcessing:!1};function a(u){s.has(u)&&(c.schedule(u),t()),u(i)}let c={schedule:(u,l=!1,f=!1)=>{let p=f&&o?e:r;return l&&s.add(u),p.add(u),u},cancel:u=>{r.delete(u),s.delete(u)},process:u=>{if(i=u,o){n=!0;return}o=!0;let l=e;e=r,r=l,e.forEach(a),e.clear(),o=!1,n&&(n=!1,c.process(u))}};return c}var Tc=40;function _r(t,e){let r=!1,o=!0,n={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,i=or.reduce((b,v)=>(b[v]=Zi(s),b),{}),{setup:a,read:c,resolveKeyframes:u,preUpdate:l,update:f,preRender:m,render:p,postRender:d}=i,h=()=>{let b=et.useManualTiming,v=b?n.timestamp:performance.now();r=!1,b||(n.delta=o?1e3/60:Math.max(Math.min(v-n.timestamp,Tc),1)),n.timestamp=v,n.isProcessing=!0,a.process(n),c.process(n),u.process(n),l.process(n),f.process(n),m.process(n),p.process(n),d.process(n),n.isProcessing=!1,r&&e&&(o=!1,t(h))},g=()=>{r=!0,o=!0,n.isProcessing||t(h)};return{schedule:or.reduce((b,v)=>{let S=i[v];return b[v]=(C,A=!1,V=!1)=>(r||g(),S.schedule(C,A,V)),b},{}),cancel:b=>{for(let v=0;v<or.length;v++)i[or[v]].cancel(b)},state:n,steps:i}}var{schedule:E,cancel:st,state:W,steps:nr}=_r(typeof requestAnimationFrame!="undefined"?requestAnimationFrame:j,!0);var $r;function Sc(){$r=void 0}var z={now:()=>($r===void 0&&z.set(W.isProcessing||et.useManualTiming?W.timestamp:performance.now()),$r),set:t=>{$r=t,queueMicrotask(Sc)}};var Ji=t=>e=>typeof e=="string"&&e.startsWith(t),Yr=Ji("--"),Vc=Ji("var(--"),we=t=>Vc(t)?Pc.test(t.split("/*")[0].trim()):!1,Pc=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Tn(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}var wt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Mt={...wt,transform:t=>_(0,1,t)},ir={...wt,default:1};var jt=t=>Math.round(t*1e5)/1e5;var Te=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Qi(t){return t==null}var ts=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;var Se=(t,e)=>r=>!!(typeof r=="string"&&ts.test(r)&&r.startsWith(t)||e&&!Qi(r)&&Object.prototype.hasOwnProperty.call(r,e)),Xr=(t,e,r)=>o=>{if(typeof o!="string")return o;let[n,s,i,a]=o.match(Te);return{[t]:parseFloat(n),[e]:parseFloat(s),[r]:parseFloat(i),alpha:a!==void 0?parseFloat(a):1}};var Cc=t=>_(0,255,t),Sn={...wt,transform:t=>Math.round(Cc(t))},Tt={test:Se("rgb","red"),parse:Xr("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:o=1})=>"rgba("+Sn.transform(t)+", "+Sn.transform(e)+", "+Sn.transform(r)+", "+jt(Mt.transform(o))+")"};function Ec(t){let e="",r="",o="",n="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),o=t.substring(5,7),n=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),o=t.substring(3,4),n=t.substring(4,5),e+=e,r+=r,o+=o,n+=n),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(o,16),alpha:n?parseInt(n,16)/255:1}}var sr={test:Se("#"),parse:Ec,transform:Tt.transform};var ar=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),pt=ar("deg"),Q=ar("%"),T=ar("px"),Vn=ar("vh"),Pn=ar("vw"),qr={...Q,parse:t=>Q.parse(t)/100,transform:t=>Q.transform(t*100)};var zt={test:Se("hsl","hue"),parse:Xr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:o=1})=>"hsla("+Math.round(t)+", "+Q.transform(jt(e))+", "+Q.transform(jt(r))+", "+jt(Mt.transform(o))+")"};var O={test:t=>Tt.test(t)||sr.test(t)||zt.test(t),parse:t=>Tt.test(t)?Tt.parse(t):zt.test(t)?zt.parse(t):sr.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Tt.transform(t):zt.transform(t),getAnimatableNone:t=>{let e=O.parse(t);return e.alpha=0,O.transform(e)}};var es=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Ac(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Te))==null?void 0:e.length)||0)+(((r=t.match(es))==null?void 0:r.length)||0)>0}var os="number",ns="color",Mc="var",Dc="var(",rs="${}",Rc=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Gt(t){let e=t.toString(),r=[],o={color:[],number:[],var:[]},n=[],s=0,a=e.replace(Rc,c=>(O.test(c)?(o.color.push(s),n.push(ns),r.push(O.parse(c))):c.startsWith(Dc)?(o.var.push(s),n.push(Mc),r.push(c)):(o.number.push(s),n.push(os),r.push(parseFloat(c))),++s,rs)).split(rs);return{values:r,split:a,indexes:o,types:n}}function kc(t){return Gt(t).values}function is({split:t,types:e}){let r=t.length;return o=>{let n="";for(let s=0;s<r;s++)if(n+=t[s],o[s]!==void 0){let i=e[s];i===os?n+=jt(o[s]):i===ns?n+=O.transform(o[s]):n+=o[s]}return n}}function Lc(t){return is(Gt(t))}var Ic=t=>typeof t=="number"?0:O.test(t)?O.getAnimatableNone(t):t,Bc=(t,e)=>typeof t=="number"?e!=null&&e.trim().endsWith("/")?t:0:Ic(t);function Oc(t){let e=Gt(t);return is(e)(e.values.map((o,n)=>Bc(o,e.split[n])))}var $={test:Ac,parse:kc,createTransformer:Lc,getAnimatableNone:Oc};function Cn(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function ss({hue:t,saturation:e,lightness:r,alpha:o}){t/=360,e/=100,r/=100;let n=0,s=0,i=0;if(!e)n=s=i=r;else{let a=r<.5?r*(1+e):r+e-r*e,c=2*r-a;n=Cn(c,a,t+1/3),s=Cn(c,a,t),i=Cn(c,a,t-1/3)}return{red:Math.round(n*255),green:Math.round(s*255),blue:Math.round(i*255),alpha:o}}function Ve(t,e){return r=>r>0?e:t}var M=(t,e,r)=>t+(e-t)*r;var En=(t,e,r)=>{let o=t*t,n=r*(e*e-o)+o;return n<0?0:Math.sqrt(n)},Fc=[sr,Tt,zt],Nc=t=>Fc.find(e=>e.test(t));function as(t){let e=Nc(t);if(Et(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let r=e.parse(t);return e===zt&&(r=ss(r)),r}var An=(t,e)=>{let r=as(t),o=as(e);if(!r||!o)return Ve(t,e);let n={...r};return s=>(n.red=En(r.red,o.red,s),n.green=En(r.green,o.green,s),n.blue=En(r.blue,o.blue,s),n.alpha=M(r.alpha,o.alpha,s),Tt.transform(n))};var Zr=new Set(["none","hidden"]);function ls(t,e){return Zr.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function jc(t,e){return r=>M(t,e,r)}function Jr(t){return typeof t=="number"?jc:typeof t=="string"?we(t)?Ve:O.test(t)?An:Wc:Array.isArray(t)?cs:typeof t=="object"?O.test(t)?An:zc:Ve}function cs(t,e){let r=[...t],o=r.length,n=t.map((s,i)=>Jr(s)(s,e[i]));return s=>{for(let i=0;i<o;i++)r[i]=n[i](s);return r}}function zc(t,e){let r={...t,...e},o={};for(let n in r)t[n]!==void 0&&e[n]!==void 0&&(o[n]=Jr(t[n])(t[n],e[n]));return n=>{for(let s in o)r[s]=o[s](n);return r}}function Gc(t,e){var n;let r=[],o={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){let i=e.types[s],a=t.indexes[i][o[i]],c=(n=t.values[a])!=null?n:0;r[s]=c,o[i]++}return r}var Wc=(t,e)=>{let r=$.createTransformer(e),o=Gt(t),n=Gt(e);return o.indexes.var.length===n.indexes.var.length&&o.indexes.color.length===n.indexes.color.length&&o.indexes.number.length>=n.indexes.number.length?Zr.has(t)&&!n.values.length||Zr.has(e)&&!o.values.length?ls(t,e):yt(cs(Gc(o,n),n.values),r):(Et(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Ve(t,e))};function Qr(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?M(t,e,r):Jr(t)(t,e)}var us=t=>{let e=({timestamp:r})=>t(r);return{start:(r=!0)=>E.update(e,r),stop:()=>st(e),now:()=>W.isProcessing?W.timestamp:z.now()}};var to=(t,e,r=10)=>{let o="",n=Math.max(Math.round(e/r),2);for(let s=0;s<n;s++)o+=Math.round(t(s/(n-1))*1e4)/1e4+", ";return`linear(${o.substring(0,o.length-2)})`};function Pe(t){let e=0,r=50,o=t.next(e);for(;!o.done&&e<2e4;)e+=r,o=t.next(e);return e>=2e4?1/0:e}function fs(t,e=100,r){let o=r({...t,keyframes:[0,e]}),n=Math.min(Pe(o),2e4);return{type:"keyframes",ease:s=>o.next(n*s).value/e,duration:X(n)}}var G={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Rn(t,e){return t*Math.sqrt(1-e*e)}var Uc=12;function Hc(t,e,r){let o=r;for(let n=1;n<Uc;n++)o=o-t(o)/e(o);return o}var Dn=.001;function Kc({duration:t=G.duration,bounce:e=G.bounce,velocity:r=G.velocity,mass:o=G.mass}){let n,s;Et(t<=U(G.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let i=1-e;i=_(G.minDamping,G.maxDamping,i),t=_(G.minDuration,G.maxDuration,X(t)),i<1?(n=u=>{let l=u*i,f=l*t,m=l-r,p=Rn(u,i),d=Math.exp(-f);return Dn-m/p*d},s=u=>{let f=u*i*t,m=f*r+r,p=Math.pow(i,2)*Math.pow(u,2)*t,d=Math.exp(-f),h=Rn(Math.pow(u,2),i);return(-n(u)+Dn>0?-1:1)*((m-p)*d)/h}):(n=u=>{let l=Math.exp(-u*t),f=(u-r)*t+1;return-Dn+l*f},s=u=>{let l=Math.exp(-u*t),f=(r-u)*(t*t);return l*f});let a=5/t,c=Hc(n,s,a);if(t=U(t),isNaN(c))return{stiffness:G.stiffness,damping:G.damping,duration:t};{let u=Math.pow(c,2)*o;return{stiffness:u,damping:i*2*Math.sqrt(o*u),duration:t}}}var _c=["duration","bounce"],$c=["stiffness","damping","mass"];function ms(t,e){return e.some(r=>t[r]!==void 0)}function Yc(t){let e={velocity:G.velocity,stiffness:G.stiffness,damping:G.damping,mass:G.mass,isResolvedFromDuration:!1,...t};if(!ms(t,$c)&&ms(t,_c))if(e.velocity=0,t.visualDuration){let r=t.visualDuration,o=2*Math.PI/(r*1.2),n=o*o,s=2*_(.05,1,1-(t.bounce||0))*Math.sqrt(n);e={...e,mass:G.mass,stiffness:n,damping:s}}else{let r=Kc({...t,velocity:0});e={...e,...r,mass:G.mass},e.isResolvedFromDuration=!0}return e}function Ce(t=G.visualDuration,e=G.bounce){let r=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t,{restSpeed:o,restDelta:n}=r,s=r.keyframes[0],i=r.keyframes[r.keyframes.length-1],a={done:!1,value:s},{stiffness:c,damping:u,mass:l,duration:f,velocity:m,isResolvedFromDuration:p}=Yc({...r,velocity:-X(r.velocity||0)}),d=m||0,h=u/(2*Math.sqrt(c*l)),g=i-s,x=X(Math.sqrt(c/l)),w=Math.abs(g)<5;o||(o=w?G.restSpeed.granular:G.restSpeed.default),n||(n=w?G.restDelta.granular:G.restDelta.default);let b,v,S,C,A,V;if(h<1)S=Rn(x,h),C=(d+h*x*g)/S,b=P=>{let B=Math.exp(-h*x*P);return i-B*(C*Math.sin(S*P)+g*Math.cos(S*P))},A=h*x*C+g*S,V=h*x*g-C*S,v=P=>Math.exp(-h*x*P)*(A*Math.sin(S*P)+V*Math.cos(S*P));else if(h===1){b=B=>i-Math.exp(-x*B)*(g+(d+x*g)*B);let P=d+x*g;v=B=>Math.exp(-x*B)*(x*P*B-d)}else{let P=x*Math.sqrt(h*h-1);b=I=>{let tt=Math.exp(-h*x*I),at=Math.min(P*I,300);return i-tt*((d+h*x*g)*Math.sinh(at)+P*g*Math.cosh(at))/P};let B=(d+h*x*g)/P,R=h*x*B-g*P,Z=h*x*g-B*P;v=I=>{let tt=Math.exp(-h*x*I),at=Math.min(P*I,300);return tt*(R*Math.sinh(at)+Z*Math.cosh(at))}}let L={calculatedDuration:p&&f||null,velocity:P=>U(v(P)),next:P=>{if(!p&&h<1){let R=Math.exp(-h*x*P),Z=Math.sin(S*P),I=Math.cos(S*P),tt=i-R*(C*Z+g*I),at=U(R*(A*Z+V*I));return a.done=Math.abs(at)<=o&&Math.abs(i-tt)<=n,a.value=a.done?i:tt,a}let B=b(P);if(p)a.done=P>=f;else{let R=U(v(P));a.done=Math.abs(R)<=o&&Math.abs(i-B)<=n}return a.value=a.done?i:B,a},toString:()=>{let P=Math.min(Pe(L),2e4),B=to(R=>L.next(P*R).value,P,30);return P+"ms "+B},toTransition:()=>{}};return L}Ce.applyToOptions=t=>{let e=fs(t,100,Ce);return t.ease=e.ease,t.duration=U(e.duration),t.type="keyframes",t};var Xc=5;function eo(t,e,r){let o=Math.max(e-Xc,0);return Xe(r-t(o),e-o)}function lr({keyframes:t,velocity:e=0,power:r=.8,timeConstant:o=325,bounceDamping:n=10,bounceStiffness:s=500,modifyTarget:i,min:a,max:c,restDelta:u=.5,restSpeed:l}){let f=t[0],m={done:!1,value:f},p=V=>a!==void 0&&V<a||c!==void 0&&V>c,d=V=>a===void 0?c:c===void 0||Math.abs(a-V)<Math.abs(c-V)?a:c,h=r*e,g=f+h,x=i===void 0?g:i(g);x!==g&&(h=x-f);let w=V=>-h*Math.exp(-V/o),b=V=>x+w(V),v=V=>{let L=w(V),P=b(V);m.done=Math.abs(L)<=u,m.value=m.done?x:P},S,C,A=V=>{p(m.value)&&(S=V,C=Ce({keyframes:[m.value,d(m.value)],velocity:eo(b,V,m.value),damping:n,stiffness:s,restDelta:u,restSpeed:l}))};return A(0),{calculatedDuration:null,next:V=>{let L=!1;return!C&&S===void 0&&(L=!0,v(V),A(V)),S!==void 0&&V>=S?C.next(V-S):(!L&&v(V),m)}}}function qc(t,e,r){let o=[],n=r||et.mix||Qr,s=t.length-1;for(let i=0;i<s;i++){let a=n(t[i],t[i+1]);if(e){let c=Array.isArray(e)?e[i]||j:e;a=yt(c,a)}o.push(a)}return o}function ps(t,e,{clamp:r=!0,ease:o,mixer:n}={}){let s=t.length;if(it(s===e.length,"Both input and output ranges must be the same length","range-length"),s===1)return()=>e[0];if(s===2&&e[0]===e[1])return()=>e[1];let i=t[0]===t[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());let a=qc(e,o,n),c=a.length,u=l=>{if(i&&l<t[0])return e[0];let f=0;if(c>1)for(;f<t.length-2&&!(l<t[f+1]);f++);let m=bt(t[f],t[f+1],l);return a[f](m)};return r?l=>u(_(t[0],t[s-1],l)):u}function ds(t,e){let r=t[t.length-1];for(let o=1;o<=e;o++){let n=bt(0,e,o);t.push(M(r,1,n))}}function hs(t){let e=[0];return ds(e,t.length-1),e}function gs(t,e){return t.map(r=>r*e)}function Zc(t,e){return t.map(()=>e||er).splice(0,t.length-1)}function ee({duration:t=300,keyframes:e,times:r,ease:o="easeInOut"}){let n=wn(o)?o.map(Kr):Kr(o),s={done:!1,value:e[0]},i=gs(r&&r.length===e.length?r:hs(e),t),a=ps(i,e,{ease:Array.isArray(n)?n:Zc(e,n)});return{calculatedDuration:t,next:c=>(s.value=a(c),s.done=c>=t,s)}}var Jc=t=>t!==null;function Wt(t,{repeat:e,repeatType:r="loop"},o,n=1){let s=t.filter(Jc),a=n<0||e&&r!=="loop"&&e%2===1?0:s.length-1;return!a||o===void 0?s[a]:o}var Qc={decay:lr,inertia:lr,tween:ee,keyframes:ee,spring:Ce};function ro(t){typeof t.type=="string"&&(t.type=Qc[t.type])}var Ut=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,r){return this.finished.then(e,r)}};var tu=t=>t/100,Dt=class extends Ut{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var o,n;let{motionValue:r}=this.options;r&&r.updatedAt!==z.now()&&this.tick(z.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(n=(o=this.options).onStop)==null||n.call(o))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;ro(e);let{type:r=ee,repeat:o=0,repeatDelay:n=0,repeatType:s,velocity:i=0}=e,{keyframes:a}=e,c=r||ee;c!==ee&&typeof a[0]!="number"&&(this.mixKeyframes=yt(tu,Qr(a[0],a[1])),a=[0,100]);let u=c({...e,keyframes:a});s==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...a].reverse(),velocity:-i})),u.calculatedDuration===null&&(u.calculatedDuration=Pe(u));let{calculatedDuration:l}=u;this.calculatedDuration=l,this.resolvedDuration=l+n,this.totalDuration=this.resolvedDuration*(o+1)-n,this.generator=u}updateTime(e){let r=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(e,r=!1){let{generator:o,totalDuration:n,mixKeyframes:s,mirroredGenerator:i,resolvedDuration:a,calculatedDuration:c}=this;if(this.startTime===null)return o.next(0);let{delay:u=0,keyframes:l,repeat:f,repeatType:m,repeatDelay:p,type:d,onUpdate:h,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-n/this.speed,this.startTime)),r?this.currentTime=e:this.updateTime(e);let x=this.currentTime-u*(this.playbackSpeed>=0?1:-1),w=this.playbackSpeed>=0?x<0:x>n;this.currentTime=Math.max(x,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=n);let b=this.currentTime,v=o;if(f){let V=Math.min(this.currentTime,n)/a,L=Math.floor(V),P=V%1;!P&&V>=1&&(P=1),P===1&&L--,L=Math.min(L,f+1),!!(L%2)&&(m==="reverse"?(P=1-P,p&&(P-=p/a)):m==="mirror"&&(v=i)),b=_(0,1,P)*a}let S;w?(this.delayState.value=l[0],S=this.delayState):S=v.next(b),s&&!w&&(S.value=s(S.value));let{done:C}=S;!w&&c!==null&&(C=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);let A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return A&&d!==lr&&(S.value=Wt(l,this.options,g,this.speed)),h&&h(S.value),A&&this.finish(),S}then(e,r){return this.finished.then(e,r)}get duration(){return X(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+X(e)}get time(){return X(this.currentTime)}set time(e){e=U(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let r=this.generator.next(e).value;return eo(o=>this.generator.next(o).value,e,r)}get speed(){return this.playbackSpeed}set speed(e){let r=this.playbackSpeed!==e;r&&this.driver&&this.updateTime(z.now()),this.playbackSpeed=e,r&&this.driver&&(this.time=X(this.currentTime))}play(){var n,s;if(this.isStopped)return;let{driver:e=us,startTime:r}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),(s=(n=this.options).onPlay)==null||s.call(n);let o=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=o):this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime||(this.startTime=r!=null?r:o),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(z.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,r;this.notifyFinished(),this.teardown(),this.state="finished",(r=(e=this.options).onComplete)==null||r.call(e)}cancel(){var e,r;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(r=(e=this.options).onCancel)==null||r.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var r;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(r=this.driver)==null||r.stop(),e.observe(this)}};function xs(t){var e;for(let r=1;r<t.length;r++)(e=t[r])!=null||(t[r]=t[r-1])}var re=t=>t*180/Math.PI,kn=t=>{let e=re(Math.atan2(t[1],t[0]));return Ln(e)},eu={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:kn,rotateZ:kn,skewX:t=>re(Math.atan(t[1])),skewY:t=>re(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ln=t=>(t=t%360,t<0&&(t+=360),t),ys=kn,vs=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),bs=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),ru={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:vs,scaleY:bs,scale:t=>(vs(t)+bs(t))/2,rotateX:t=>Ln(re(Math.atan2(t[6],t[5]))),rotateY:t=>Ln(re(Math.atan2(-t[2],t[0]))),rotateZ:ys,rotate:ys,skewX:t=>re(Math.atan(t[4])),skewY:t=>re(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function oo(t){return t.includes("scale")?1:0}function no(t,e){if(!t||t==="none")return oo(e);let r=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),o,n;if(r)o=ru,n=r;else{let a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);o=eu,n=a}if(!n)return oo(e);let s=o[e],i=n[1].split(",").map(ou);return typeof s=="function"?s(i):i[s]}var ws=(t,e)=>{let{transform:r="none"}=getComputedStyle(t);return no(r,e)};function ou(t){return parseFloat(t.trim())}var St=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],dt=new Set([...St,"pathRotation"]);var In=t=>t===wt||t===T,nu=new Set(["x","y","z"]),iu=St.filter(t=>!nu.has(t));function Ts(t){let e=[];return iu.forEach(r=>{let o=t.getValue(r);o!==void 0&&(e.push([r,o.get()]),o.set(r.startsWith("scale")?1:0))}),e}var Rt={width:({x:t},{paddingLeft:e="0",paddingRight:r="0",boxSizing:o})=>{let n=t.max-t.min;return o==="border-box"?n:n-parseFloat(e)-parseFloat(r)},height:({y:t},{paddingTop:e="0",paddingBottom:r="0",boxSizing:o})=>{let n=t.max-t.min;return o==="border-box"?n:n-parseFloat(e)-parseFloat(r)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>no(e,"x"),y:(t,{transform:e})=>no(e,"y")};Rt.translateX=Rt.x;Rt.translateY=Rt.y;var oe=new Set,Bn=!1,On=!1,Fn=!1;function Ss(){if(On){let t=Array.from(oe).filter(o=>o.needsMeasurement),e=new Set(t.map(o=>o.element)),r=new Map;e.forEach(o=>{let n=Ts(o);n.length&&(r.set(o,n),o.render())}),t.forEach(o=>o.measureInitialState()),e.forEach(o=>{o.render();let n=r.get(o);n&&n.forEach(([s,i])=>{var a;(a=o.getValue(s))==null||a.set(i)})}),t.forEach(o=>o.measureEndState()),t.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}On=!1,Bn=!1,oe.forEach(t=>t.complete(Fn)),oe.clear()}function Vs(){oe.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(On=!0)})}function Ps(){Fn=!0,Vs(),Ss(),Fn=!1}var Ht=class{constructor(e,r,o,n,s,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=o,this.motionValue=n,this.element=s,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(oe.add(this),Bn||(Bn=!0,E.read(Vs),E.resolveKeyframes(Ss))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:r,element:o,motionValue:n}=this;if(e[0]===null){let s=n==null?void 0:n.get(),i=e[e.length-1];if(s!==void 0)e[0]=s;else if(o&&r){let a=o.readValue(r,i);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=i),n&&s===void 0&&n.set(e[0])}xs(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),oe.delete(this)}cancel(){this.state==="scheduled"&&(oe.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}};var Cs=t=>t.startsWith("--");function io(t,e,r){Cs(e)?t.style.setProperty(e,r):t.style[e]=r}var Es={};function so(t,e){let r=Ye(t);return()=>{var o;return(o=Es[e])!=null?o:r()}}var As=so(()=>window.ScrollTimeline!==void 0,"scrollTimeline");var ao=so(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing");var ne=([t,e,r,o])=>`cubic-bezier(${t}, ${e}, ${r}, ${o})`;var Nn={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ne([0,.65,.55,1]),circOut:ne([.55,0,1,.45]),backIn:ne([.31,.01,.66,-.59]),backOut:ne([.33,1.53,.69,.99])};function jn(t,e){if(t)return typeof t=="function"?ao()?to(t,e):"ease-out":rr(t)?ne(t):Array.isArray(t)?t.map(r=>jn(r,e)||Nn.easeOut):Nn[t]}function Ms(t,e,r,{delay:o=0,duration:n=300,repeat:s=0,repeatType:i="loop",ease:a="easeOut",times:c}={},u=void 0){let l={[e]:r};c&&(l.offset=c);let f=jn(a,n);Array.isArray(f)&&(l.easing=f);let m={delay:o,duration:n,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:s+1,direction:i==="reverse"?"alternate":"normal"};return u&&(m.pseudoElement=u),t.animate(l,m)}function lo(t){return typeof t=="function"&&"applyToOptions"in t}function Ds({type:t,...e}){var r,o;return lo(t)&&ao()?t.applyToOptions(e):((r=e.duration)!=null||(e.duration=300),(o=e.ease)!=null||(e.ease="easeOut"),e)}var Ee=class extends Ut{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:r,name:o,keyframes:n,pseudoElement:s,allowFlatten:i=!1,finalKeyframe:a,onComplete:c}=e;this.isPseudoElement=!!s,this.allowFlatten=i,this.options=e,it(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");let u=Ds(e);this.animation=Ms(r,o,n,u,s),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){let l=Wt(n,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(l),io(r,o,l),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,r;(r=(e=this.animation).finish)==null||r.call(e)}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var r,o,n;let e=(r=this.options)==null?void 0:r.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((n=(o=this.animation).commitStyles)==null||n.call(o))}get duration(){var r,o;let e=((o=(r=this.animation.effect)==null?void 0:r.getComputedTiming)==null?void 0:o.call(r).duration)||0;return X(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+X(e)}get time(){return X(Number(this.animation.currentTime)||0)}set time(e){let r=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=U(e),r&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){var e;return(e=this.manualStartTime)!=null?e:Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:r,rangeEnd:o,observe:n}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&As()?(this.animation.timeline=e,r&&(this.animation.rangeStart=r),o&&(this.animation.rangeEnd=o),j):n(this)}};var Rs={anticipate:Ze,backInOut:qe,circInOut:tr};function su(t){return t in Rs}function ks(t){typeof t.ease=="string"&&su(t.ease)&&(t.ease=Rs[t.ease])}var zn=10,co=class extends Ee{constructor(e){ks(e),ro(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:r,onUpdate:o,onComplete:n,element:s,...i}=this.options;if(!r)return;if(e!==void 0){r.set(e);return}let a=new Dt({...i,autoplay:!1}),c=Math.max(zn,z.now()-this.startTime),u=_(0,zn,c-zn),l=a.sample(c).value,{name:f}=this.options;s&&f&&io(s,f,l),r.setWithVelocity(a.sample(Math.max(0,c-u)).value,l,u),a.stop()}};var Gn=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&($.test(t)||t==="0")&&!t.startsWith("url("));function au(t){let e=t[0];if(t.length===1)return!0;for(let r=0;r<t.length;r++)if(t[r]!==e)return!0}function Ls(t,e,r,o){let n=t[0];if(n===null)return!1;if(e==="display"||e==="visibility")return!0;let s=t[t.length-1],i=Gn(n,e),a=Gn(s,e);return Et(i===a,`You are trying to animate ${e} from "${n}" to "${s}". "${i?s:n}" is not an animatable value.`,"value-not-animatable"),!i||!a?!1:au(t)||(r==="spring"||lo(r))&&o}function cr(t){t.duration=0,t.type="keyframes"}var uo=new Set(["opacity","clipPath","filter","transform","backgroundColor"]);var lu=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Is(t){for(let e=0;e<t.length;e++)if(typeof t[e]=="string"&&lu.test(t[e]))return!0;return!1}var cu=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),uu=Ye(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Bs(t){var f;let{motionValue:e,name:r,repeatDelay:o,repeatType:n,damping:s,type:i,keyframes:a}=t,c=(f=e==null?void 0:e.owner)==null?void 0:f.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:u,transformTemplate:l}=e.owner.getProps();return uu()&&r&&(uo.has(r)||cu.has(r)&&Is(a))&&(r!=="transform"||!l)&&!u&&!o&&n!=="mirror"&&s!==0&&i!=="inertia"}var fu=40,fo=class extends Ut{constructor({autoplay:e=!0,delay:r=0,type:o="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:i="loop",keyframes:a,name:c,motionValue:u,element:l,...f}){var d;super(),this.stop=()=>{var h,g;this._animation&&(this._animation.stop(),(h=this.stopTimeline)==null||h.call(this)),(g=this.keyframeResolver)==null||g.cancel()},this.createdAt=z.now();let m={autoplay:e,delay:r,type:o,repeat:n,repeatDelay:s,repeatType:i,name:c,motionValue:u,element:l,...f},p=(l==null?void 0:l.KeyframeResolver)||Ht;this.keyframeResolver=new p(a,(h,g,x)=>this.onKeyframesResolved(h,g,m,!x),c,u,l),(d=this.keyframeResolver)==null||d.scheduleResolve()}onKeyframesResolved(e,r,o,n){var x,w;this.keyframeResolver=void 0;let{name:s,type:i,velocity:a,delay:c,isHandoff:u,onUpdate:l}=o;this.resolvedAt=z.now();let f=!0;Ls(e,s,i,a)||(f=!1,(et.instantAnimations||!c)&&(l==null||l(Wt(e,o,r))),e[0]=e[e.length-1],cr(o),o.repeat=0);let p={startTime:n?this.resolvedAt?this.resolvedAt-this.createdAt>fu?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...o,keyframes:e},d=f&&!u&&Bs(p),h=(w=(x=p.motionValue)==null?void 0:x.owner)==null?void 0:w.current,g;if(d)try{g=new co({...p,element:h})}catch(b){g=new Dt(p)}else g=new Dt(p);g.finished.then(()=>{this.notifyFinished()}).catch(j),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,r){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Ps()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}};function mo(t,e,r,o=0,n=1){let s=Array.from(t).sort((u,l)=>u.sortNodePosition(l)).indexOf(e),i=t.size,a=(i-1)*o;return typeof r=="function"?r(s,i):n===1?s*o:a-s*o}var Os=30,mu=t=>!isNaN(parseFloat(t)),Fs={current:void 0},Wn=class{constructor(e,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=o=>{var s;let n=z.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(o),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(let i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=z.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=mu(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new At);let o=this.events[e].add(r);return e==="change"?()=>{o(),E.read(()=>{this.events.change.getSize()||this.stop()})}:o}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,r,o){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-o}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Fs.current&&Fs.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=z.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Os)return 0;let r=Math.min(this.updatedAt-this.prevUpdatedAt,Os);return Xe(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,r;(e=this.dependents)==null||e.clear(),(r=this.events.destroy)==null||r.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function vt(t,e){return new Wn(t,e)}function po(t,e){if(t!=null&&t.inherit&&e){let{inherit:r,...o}=t;return{...e,...o}}return t}function Ae(t,e){var o,n;let r=(n=(o=t==null?void 0:t[e])!=null?o:t==null?void 0:t.default)!=null?n:t;return r!==t?po(r,t):r}var pu={type:"spring",stiffness:500,damping:25,restSpeed:10},du=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),hu={type:"keyframes",duration:.8},gu={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ns=(t,{keyframes:e})=>e.length>2?hu:dt.has(t)?t.startsWith("scale")?du(e[1]):pu:gu;var xu=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function js(t){for(let e in t)if(!xu.has(e))return!0;return!1}var ie=(t,e,r,o={},n,s)=>i=>{let a=Ae(o,t)||{},c=a.delay||o.delay||0,{elapsed:u=0}=o;u=u-U(c);let l={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:m=>{e.set(m),a.onUpdate&&a.onUpdate(m)},onComplete:()=>{i(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:n};js(a)||Object.assign(l,Ns(t,l)),l.duration&&(l.duration=U(l.duration)),l.repeatDelay&&(l.repeatDelay=U(l.repeatDelay)),l.from!==void 0&&(l.keyframes[0]=l.from);let f=!1;if((l.type===!1||l.duration===0&&!l.repeatDelay)&&(cr(l),l.delay===0&&(f=!0)),(et.instantAnimations||et.skipAnimations||n!=null&&n.shouldSkipAnimations||a.skipAnimations)&&(f=!0,cr(l),l.delay=0),l.allowFlatten=!a.type&&!a.ease,f&&!s&&e.get()!==void 0){let m=Wt(l.keyframes,a);if(m!==void 0){E.update(()=>{l.onUpdate(m),l.onComplete()});return}}return a.isSync?new Dt(l):new fo(l)};var yu=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function vu(t){let e=yu.exec(t);if(!e)return[,];let[,r,o,n]=e;return[`--${r!=null?r:o}`,n]}var bu=4;function Un(t,e,r=1){it(r<=bu,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[o,n]=vu(t);if(!o)return;let s=window.getComputedStyle(e).getPropertyValue(o);if(s){let i=s.trim();return Ke(i)?parseFloat(i):i}return we(n)?Un(n,e,r+1):n}function zs(t){let e=[{},{}];return t==null||t.values.forEach((r,o)=>{e[0][o]=r.get(),e[1][o]=r.getVelocity()}),e}function se(t,e,r,o){if(typeof e=="function"){let[n,s]=zs(o);e=e(r!==void 0?r:t.custom,n,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){let[n,s]=zs(o);e=e(r!==void 0?r:t.custom,n,s)}return e}function ct(t,e,r){let o=t.getProps();return se(o,e,r!==void 0?r:o.custom,t)}var ho=new Set(["width","height","top","left","right","bottom",...St]);var ur=t=>Array.isArray(t);function wu(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,vt(r))}function Tu(t){return ur(t)?t[t.length-1]||0:t}function Gs(t,e){let r=ct(t,e),{transitionEnd:o={},transition:n={},...s}=r||{};s={...s,...o};for(let i in s){let a=Tu(s[i]);wu(t,i,a)}}var k=t=>!!(t&&t.getVelocity);function Ws(t){return!!(k(t)&&t.add)}function Me(t,e){let r=t.getValue("willChange");if(Ws(r))return r.add(e);if(!r&&et.WillChange){let o=new et.WillChange("auto");t.addValue("willChange",o),o.add(e)}}function De(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Us="framerAppearId",fr="data-"+De(Us);function go(t){return t.props[fr]}function Su({protectedKeys:t,needsAnimating:e},r){let o=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,o}function xo(t,e,{delay:r=0,transitionOverride:o,type:n}={}){var d;let{transition:s,transitionEnd:i,...a}=e,c=t.getDefaultTransition();s=s?po(s,c):c;let u=s==null?void 0:s.reduceMotion,l=s==null?void 0:s.skipAnimations;o&&(s=o);let f=[],m=n&&t.animationState&&t.animationState.getState()[n],p=s==null?void 0:s.path;p&&p.animateVisualElement(t,a,s,r,f);for(let h in a){let g=t.getValue(h,(d=t.latestValues[h])!=null?d:null),x=a[h];if(x===void 0||m&&Su(m,h))continue;let w={delay:r,...Ae(s||{},h)};l&&(w.skipAnimations=!0);let b=g.get();if(b!==void 0&&!g.isAnimating()&&!Array.isArray(x)&&x===b&&!w.velocity){E.update(()=>g.set(x));continue}let v=!1;if(window.MotionHandoffAnimation){let A=go(t);if(A){let V=window.MotionHandoffAnimation(A,h,E);V!==null&&(w.startTime=V,v=!0)}}Me(t,h);let S=u!=null?u:t.shouldReduceMotion;g.start(ie(h,g,x,S&&ho.has(h)?{type:!1}:w,t,v));let C=g.animation;C&&f.push(C)}if(i){let h=()=>E.update(()=>{i&&Gs(t,i)});f.length?Promise.all(f).then(h):h()}return f}function yo(t,e,r={}){var c;let o=ct(t,e,r.type==="exit"?(c=t.presenceContext)==null?void 0:c.custom:void 0),{transition:n=t.getDefaultTransition()||{}}=o||{};r.transitionOverride&&(n=r.transitionOverride);let s=o?()=>Promise.all(xo(t,o,r)):()=>Promise.resolve(),i=t.variantChildren&&t.variantChildren.size?(u=0)=>{let{delayChildren:l=0,staggerChildren:f,staggerDirection:m}=n;return Vu(t,e,u,l,f,m,r)}:()=>Promise.resolve(),{when:a}=n;if(a){let[u,l]=a==="beforeChildren"?[s,i]:[i,s];return u().then(()=>l())}else return Promise.all([s(),i(r.delay)])}function Vu(t,e,r=0,o=0,n=0,s=1,i){let a=[];for(let c of t.variantChildren)c.notify("AnimationStart",e),a.push(yo(c,e,{...i,delay:r+(typeof o=="function"?0:o)+mo(t.variantChildren,c,o,n,s)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(a)}function Hs(t,e,r={}){t.notify("AnimationStart",e);let o;if(Array.isArray(e)){let n=e.map(s=>yo(t,s,r));o=Promise.all(n)}else if(typeof e=="string")o=yo(t,e,r);else{let n=typeof e=="function"?ct(t,e,r.custom):e;o=Promise.all(xo(t,n,r))}return o.then(()=>{t.notify("AnimationComplete",e)})}var Ks={test:t=>t==="auto",parse:t=>t};var vo=t=>e=>e.test(t);var Hn=[wt,T,Q,pt,Pn,Vn,Ks],Kn=t=>Hn.find(vo(t));function _s(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||$e(t):!0}var Pu=new Set(["brightness","contrast","saturate","opacity"]);function Cu(t){let[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;let[o]=r.match(Te)||[];if(!o)return t;let n=r.replace(o,""),s=Pu.has(e)?1:0;return o!==r&&(s*=100),e+"("+s+n+")"}var Eu=/\b([a-z-]*)\(.*?\)/gu,mr={...$,getAnimatableNone:t=>{let e=t.match(Eu);return e?e.map(Cu).join(" "):t}};var pr={...$,getAnimatableNone:t=>{let e=$.parse(t);return $.createTransformer(t)(e.map(o=>typeof o=="number"?0:typeof o=="object"?{...o,alpha:1}:o))}};var _n={...wt,transform:Math.round};var $s={rotate:pt,pathRotation:pt,rotateX:pt,rotateY:pt,rotateZ:pt,scale:ir,scaleX:ir,scaleY:ir,scaleZ:ir,skew:pt,skewX:pt,skewY:pt,distance:T,translateX:T,translateY:T,translateZ:T,x:T,y:T,z:T,perspective:T,transformPerspective:T,opacity:Mt,originX:qr,originY:qr,originZ:T};var ae={borderWidth:T,borderTopWidth:T,borderRightWidth:T,borderBottomWidth:T,borderLeftWidth:T,borderRadius:T,borderTopLeftRadius:T,borderTopRightRadius:T,borderBottomRightRadius:T,borderBottomLeftRadius:T,width:T,maxWidth:T,height:T,maxHeight:T,top:T,right:T,bottom:T,left:T,inset:T,insetBlock:T,insetBlockStart:T,insetBlockEnd:T,insetInline:T,insetInlineStart:T,insetInlineEnd:T,padding:T,paddingTop:T,paddingRight:T,paddingBottom:T,paddingLeft:T,paddingBlock:T,paddingBlockStart:T,paddingBlockEnd:T,paddingInline:T,paddingInlineStart:T,paddingInlineEnd:T,margin:T,marginTop:T,marginRight:T,marginBottom:T,marginLeft:T,marginBlock:T,marginBlockStart:T,marginBlockEnd:T,marginInline:T,marginInlineStart:T,marginInlineEnd:T,fontSize:T,backgroundPositionX:T,backgroundPositionY:T,...$s,zIndex:_n,fillOpacity:Mt,strokeOpacity:Mt,numOctaves:_n};var Au={...ae,color:O,backgroundColor:O,outlineColor:O,fill:O,stroke:O,borderColor:O,borderTopColor:O,borderRightColor:O,borderBottomColor:O,borderLeftColor:O,filter:mr,WebkitFilter:mr,mask:pr,WebkitMask:pr},bo=t=>Au[t];var Mu=new Set([mr,pr]);function wo(t,e){let r=bo(t);return Mu.has(r)||(r=$),r.getAnimatableNone?r.getAnimatableNone(e):void 0}var Du=new Set(["auto","none","0"]);function Ys(t,e,r){let o=0,n;for(;o<t.length&&!n;){let s=t[o];typeof s=="string"&&!Du.has(s)&&Gt(s).values.length&&(n=t[o]),o++}if(n&&r)for(let s of e)t[s]=wo(r,n)}var To=class extends Ht{constructor(e,r,o,n,s){super(e,r,o,n,s,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:r,name:o}=this;if(!r||!r.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let f=e[l];if(typeof f=="string"&&(f=f.trim(),we(f))){let m=Un(f,r.current);m!==void 0&&(e[l]=m),l===e.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!ho.has(o)||e.length!==2)return;let[n,s]=e,i=Kn(n),a=Kn(s),c=Tn(n),u=Tn(s);if(c!==u&&Rt[o]){this.needsMeasurement=!0;return}if(i!==a)if(In(i)&&In(a))for(let l=0;l<e.length;l++){let f=e[l];typeof f=="string"&&(e[l]=parseFloat(f))}else Rt[o]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:r}=this,o=[];for(let n=0;n<e.length;n++)(e[n]===null||_s(e[n]))&&o.push(n);o.length&&Ys(e,o,r)}measureInitialState(){let{element:e,unresolvedKeyframes:r,name:o}=this;if(!e||!e.current)return;o==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Rt[o](e.measureViewportBox(),window.getComputedStyle(e.current)),r[0]=this.measuredOrigin;let n=r[r.length-1];n!==void 0&&e.getValue(o,n).jump(n,!1)}measureEndState(){var a;let{element:e,name:r,unresolvedKeyframes:o}=this;if(!e||!e.current)return;let n=e.getValue(r);n&&n.jump(this.measuredOrigin,!1);let s=o.length-1,i=o[s];o[s]=Rt[r](e.measureViewportBox(),window.getComputedStyle(e.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([c,u])=>{e.getValue(c).set(u)}),this.resolveNoneKeyframes()}};var dr=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function So(t,e,r){var o;if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let n=document;e&&(n=e.current);let s=(o=r==null?void 0:r[t])!=null?o:n.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t).filter(n=>n!=null)}var hr=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Xs(t){return _e(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}var{schedule:le,cancel:Ru}=_r(queueMicrotask,!1);var ht={x:!1,y:!1};function Vo(){return ht.x||ht.y}function $n(t){return t==="x"||t==="y"?ht[t]?null:(ht[t]=!0,()=>{ht[t]=!1}):ht.x||ht.y?null:(ht.x=ht.y=!0,()=>{ht.x=ht.y=!1})}function Po(t,e){let r=So(t),o=new AbortController,n={passive:!0,...e,signal:o.signal};return[r,n,()=>o.abort()]}function ku(t){return!(t.pointerType==="touch"||Vo())}function Yn(t,e,r={}){let[o,n,s]=Po(t,r);return o.forEach(i=>{let a=!1,c=!1,u,l=()=>{i.removeEventListener("pointerleave",d)},f=g=>{u&&(u(g),u=void 0),l()},m=g=>{a=!1,window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m),c&&(c=!1,f(g))},p=()=>{a=!0,window.addEventListener("pointerup",m,n),window.addEventListener("pointercancel",m,n)},d=g=>{if(g.pointerType!=="touch"){if(a){c=!0;return}f(g)}},h=g=>{if(!ku(g))return;c=!1;let x=e(i,g);typeof x=="function"&&(u=x,i.addEventListener("pointerleave",d,n))};i.addEventListener("pointerenter",h,n),i.addEventListener("pointerdown",p,n)}),s}var Xn=(t,e)=>e?t===e?!0:Xn(t,e.parentElement):!1;var ce=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;var Lu=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function qn(t){return Lu.has(t.tagName)||t.isContentEditable===!0}var Iu=new Set(["INPUT","SELECT","TEXTAREA"]);function Zn(t){return Iu.has(t.tagName)||t.isContentEditable===!0}var Re=new WeakSet;function qs(t){return e=>{e.key==="Enter"&&t(e)}}function Jn(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}var Zs=(t,e)=>{let r=t.currentTarget;if(!r)return;let o=qs(()=>{if(Re.has(r))return;Jn(r,"down");let n=qs(()=>{Jn(r,"up")}),s=()=>Jn(r,"cancel");r.addEventListener("keyup",n,e),r.addEventListener("blur",s,e)});r.addEventListener("keydown",o,e),r.addEventListener("blur",()=>r.removeEventListener("keydown",o),e)};function Js(t){return ce(t)&&!Vo()}var Qs=new WeakSet;function Qn(t,e,r={}){let[o,n,s]=Po(t,r),i=a=>{let c=a.currentTarget;if(!Js(a)||Qs.has(a))return;Re.add(c),r.stopPropagation&&Qs.add(a);let u=e(c,a),l={...n,capture:!0},f=(d,h)=>{window.removeEventListener("pointerup",m,l),window.removeEventListener("pointercancel",p,l),Re.has(c)&&Re.delete(c),Js(d)&&typeof u=="function"&&u(d,{success:h})},m=d=>{f(d,c===window||c===document||r.useGlobalTarget||Xn(c,d.target))},p=d=>{f(d,!1)};window.addEventListener("pointerup",m,l),window.addEventListener("pointercancel",p,l)};return o.forEach(a=>{(r.useGlobalTarget?window:a).addEventListener("pointerdown",i,n),Xs(a)&&(a.addEventListener("focus",u=>Zs(u,n)),!qn(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),s}function ke(t){return _e(t)&&"ownerSVGElement"in t}var Co=new WeakMap,Kt,ta=(t,e,r)=>(o,n)=>n&&n[0]?n[0][t+"Size"]:ke(o)&&"getBBox"in o?o.getBBox()[e]:o[r],Bu=ta("inline","width","offsetWidth"),Ou=ta("block","height","offsetHeight");function Fu({target:t,borderBoxSize:e}){var r;(r=Co.get(t))==null||r.forEach(o=>{o(t,{get width(){return Bu(t,e)},get height(){return Ou(t,e)}})})}function Nu(t){t.forEach(Fu)}function ju(){typeof ResizeObserver!="undefined"&&(Kt=new ResizeObserver(Nu))}function ea(t,e){Kt||ju();let r=So(t);return r.forEach(o=>{let n=Co.get(o);n||(n=new Set,Co.set(o,n)),n.add(e),Kt==null||Kt.observe(o)}),()=>{r.forEach(o=>{let n=Co.get(o);n==null||n.delete(e),n!=null&&n.size||Kt==null||Kt.unobserve(o)})}}var Eo=new Set,Le;function zu(){Le=()=>{let t={get width(){return window.innerWidth},get height(){return window.innerHeight}};Eo.forEach(e=>e(t))},window.addEventListener("resize",Le)}function ra(t){return Eo.add(t),Le||zu(),()=>{Eo.delete(t),!Eo.size&&typeof Le=="function"&&(window.removeEventListener("resize",Le),Le=void 0)}}function Ao(t,e){return typeof t=="function"?ra(t):ea(t,e)}var ue={value:null,addProjectionMetrics:null};function oa(t){return ke(t)&&t.tagName==="svg"}var Gu=[...Hn,O,$],na=t=>Gu.find(vo(t));var ti=()=>({translate:0,scale:1,origin:0,originPoint:0}),_t=()=>({x:ti(),y:ti()}),ei=()=>({min:0,max:0}),F=()=>({x:ei(),y:ei()});var ia=new WeakMap;function kt(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Vt(t){return typeof t=="string"||Array.isArray(t)}var Mo=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],gr=["initial",...Mo];function $t(t){return kt(t.animate)||gr.some(e=>Vt(t[e]))}function xr(t){return!!($t(t)||t.variants)}function sa(t,e,r){for(let o in e){let n=e[o],s=r[o];if(k(n))t.addValue(o,n);else if(k(s))t.addValue(o,vt(n,{owner:t}));else if(s!==n)if(t.hasValue(o)){let i=t.getValue(o);i.liveStyle===!0?i.jump(n):i.hasAnimated||i.set(n)}else{let i=t.getStaticValue(o);t.addValue(o,vt(i!==void 0?i:n,{owner:t}))}}for(let o in r)e[o]===void 0&&t.removeValue(o);return e}var yr={current:null},Do={current:!1};var Wu=typeof window!="undefined";function aa(){if(Do.current=!0,!!Wu)if(window.matchMedia){let t=window.matchMedia("(prefers-reduced-motion)"),e=()=>yr.current=t.matches;t.addEventListener("change",e),e()}else yr.current=!1}var la=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Ro={};function br(t){Ro=t}function ri(){return Ro}var vr=class{scrapeMotionValuesFromProps(e,r,o){return{}}constructor({parent:e,props:r,presenceContext:o,reducedMotionConfig:n,skipAnimations:s,blockInitialAnimation:i,visualState:a},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Ht,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let p=z.now();this.renderScheduledAt<p&&(this.renderScheduledAt=p,E.render(this.render,!1,!0))};let{latestValues:u,renderState:l}=a;this.latestValues=u,this.baseTarget={...u},this.initialValues=r.initial?{...u}:{},this.renderState=l,this.parent=e,this.props=r,this.presenceContext=o,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.skipAnimationsConfig=s,this.options=c,this.blockInitialAnimation=!!i,this.isControllingVariants=$t(r),this.isVariantNode=xr(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:f,...m}=this.scrapeMotionValuesFromProps(r,{},this);for(let p in m){let d=m[p];u[p]!==void 0&&k(d)&&d.set(u[p])}}mount(e){var r,o,n;if(this.hasBeenMounted)for(let s in this.initialValues)(r=this.values.get(s))==null||r.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=e,ia.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,i)=>this.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Do.current||aa(),this.shouldReduceMotion=yr.current),this.shouldSkipAnimations=(o=this.skipAnimationsConfig)!=null?o:!1,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),st(this.notifyUpdate),st(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(let r in this.events)this.events[r].clear();for(let r in this.features){let o=this.features[r];o&&(o.unmount(),o.isMounted=!1)}this.current=null}addChild(e){var r;this.children.add(e),(r=this.enteringChildren)!=null||(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,r){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),r.accelerate&&uo.has(e)&&this.current instanceof HTMLElement){let{factory:i,keyframes:a,times:c,ease:u,duration:l}=r.accelerate,f=new Ee({element:this.current,name:e,keyframes:a,times:c,ease:u,duration:U(l)}),m=i(f);this.valueSubscriptions.set(e,()=>{m(),f.cancel()});return}let o=dt.has(e);o&&this.onBindTransform&&this.onBindTransform();let n=r.on("change",i=>{this.latestValues[e]=i,this.props.onUpdate&&E.preRender(this.notifyUpdate),o&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),s;typeof window!="undefined"&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{n(),s&&s()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Ro){let r=Ro[e];if(!r)continue;let{isEnabled:o,Feature:n}=r;if(!this.features[e]&&n&&o(this.props)&&(this.features[e]=new n(this)),this.features[e]){let s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):F()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let o=0;o<la.length;o++){let n=la[o];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let s="on"+n,i=e[s];i&&(this.propEventSubscriptions[n]=this.on(n,i))}this.prevMotionValues=sa(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(e),()=>r.variantChildren.delete(e)}addValue(e,r){let o=this.values.get(e);r!==o&&(o&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);let r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let o=this.values.get(e);return o===void 0&&r!==void 0&&(o=vt(r===null?void 0:r,{owner:this}),this.addValue(e,o)),o}readValue(e,r){var n;let o=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(n=this.getBaseTargetFromProps(this.props,e))!=null?n:this.readValueFromInstance(this.current,e,this.options);return o!=null&&(typeof o=="string"&&(Ke(o)||$e(o))?o=parseFloat(o):!na(o)&&$.test(r)&&(o=wo(e,r)),this.setBaseTarget(e,k(o)?o.get():o)),k(o)?o.get():o}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){var s;let{initial:r}=this.props,o;if(typeof r=="string"||typeof r=="object"){let i=se(this.props,r,(s=this.presenceContext)==null?void 0:s.custom);i&&(o=i[e])}if(r&&o!==void 0)return o;let n=this.getBaseTargetFromProps(this.props,e);return n!==void 0&&!k(n)?n:this.initialValues[e]!==void 0&&o===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new At),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}scheduleRenderMicrotask(){le.render(this.render)}};var Ie=class extends vr{constructor(){super(...arguments),this.KeyframeResolver=To}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){let o=e.style;return o?o[r]:void 0}removeValueFromRenderState(e,{vars:r,style:o}){delete r[e],delete o[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;k(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}};var Y=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function wr({top:t,left:e,right:r,bottom:o}){return{x:{min:e,max:r},y:{min:t,max:o}}}function oi({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function ni(t,e){if(!e)return t;let r=e({x:t.left,y:t.top}),o=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:o.y,right:o.x}}function ii(t){return t===void 0||t===1}function ko({scale:t,scaleX:e,scaleY:r}){return!ii(t)||!ii(e)||!ii(r)}function Lt(t){return ko(t)||si(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function si(t){return ca(t.x)||ca(t.y)}function ca(t){return t&&t!=="0%"}function Tr(t,e,r){let o=t-r,n=e*o;return r+n}function ua(t,e,r,o,n){return n!==void 0&&(t=Tr(t,n,o)),Tr(t,r,o)+e}function ai(t,e=0,r=1,o,n){t.min=ua(t.min,e,r,o,n),t.max=ua(t.max,e,r,o,n)}function li(t,{x:e,y:r}){ai(t.x,e.translate,e.scale,e.originPoint),ai(t.y,r.translate,r.scale,r.originPoint)}var fa=.999999999999,ma=1.0000000000001;function ha(t,e,r,o=!1){var a;let n=r.length;if(!n)return;e.x=e.y=1;let s,i;for(let c=0;c<n;c++){s=r[c],i=s.projectionDelta;let{visualElement:u}=s.options;u&&u.props.style&&u.props.style.display==="contents"||(o&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(gt(t.x,-s.scroll.offset.x),gt(t.y,-s.scroll.offset.y)),i&&(e.x*=i.x.scale,e.y*=i.y.scale,li(t,i)),o&&Lt(s.latestValues)&&Sr(t,s.latestValues,(a=s.layout)==null?void 0:a.layoutBox))}e.x<ma&&e.x>fa&&(e.x=1),e.y<ma&&e.y>fa&&(e.y=1)}function gt(t,e){t.min+=e,t.max+=e}function pa(t,e,r,o,n=.5){let s=M(t.min,t.max,n);ai(t,e,r,s,o)}function da(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function Sr(t,e,r){let o=r!=null?r:t;pa(t.x,da(e.x,o.x),e.scaleX,e.scale,e.originX),pa(t.y,da(e.y,o.y),e.scaleY,e.scale,e.originY)}function Lo(t,e){return wr(ni(t.getBoundingClientRect(),e))}function ci(t,e,r){let o=Lo(t,r),{scroll:n}=e;return n&&(gt(o.x,n.offset.x),gt(o.y,n.offset.y)),o}var Uu={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Hu=St.length;function ga(t,e,r){let o="",n=!0;for(let i=0;i<Hu;i++){let a=St[i],c=t[a];if(c===void 0)continue;let u=!0;if(typeof c=="number")u=c===(a.startsWith("scale")?1:0);else{let l=parseFloat(c);u=a.startsWith("scale")?l===1:l===0}if(!u||r){let l=hr(c,ae[a]);if(!u){n=!1;let f=Uu[a]||a;o+=`${f}(${l}) `}r&&(e[a]=l)}}let s=t.pathRotation;return s&&(n=!1,o+=`rotate(${hr(s,ae.pathRotation)}) `),o=o.trim(),r?o=r(e,n?"":o):n&&(o="none"),o}function fe(t,e,r){let{style:o,vars:n,transformOrigin:s}=t,i=!1,a=!1;for(let c in e){let u=e[c];if(dt.has(c)){i=!0;continue}else if(Yr(c)){n[c]=u;continue}else{let l=hr(u,ae[c]);c.startsWith("origin")?(a=!0,s[c]=l):o[c]=l}}if(e.transform||(i||r?o.transform=ga(e,t.transform,r):o.transform&&(o.transform="none")),a){let{originX:c="50%",originY:u="50%",originZ:l=0}=s;o.transformOrigin=`${c} ${u} ${l}`}}function Io(t,{style:e,vars:r},o,n){let s=t.style,i;for(i in e)s[i]=e[i];n==null||n.applyProjectionStyles(s,o);for(i in r)s.setProperty(i,r[i])}function xa(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}var Be={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(T.test(t))t=parseFloat(t);else return t;let r=xa(t,e.target.x),o=xa(t,e.target.y);return`${r}% ${o}%`}};var ya={correct:(t,{treeScale:e,projectionDelta:r})=>{let o=t,n=$.parse(t);if(n.length>5)return o;let s=$.createTransformer(t),i=typeof n[0]!="number"?1:0,a=r.x.scale*e.x,c=r.y.scale*e.y;n[0+i]/=a,n[1+i]/=c;let u=M(a,c,.5);return typeof n[2+i]=="number"&&(n[2+i]/=u),typeof n[3+i]=="number"&&(n[3+i]/=u),s(n)}};var Vr={borderRadius:{...Be,applyTo:[...dr]},borderTopLeftRadius:Be,borderTopRightRadius:Be,borderBottomLeftRadius:Be,borderBottomRightRadius:Be,boxShadow:ya};function Pr(t,{layout:e,layoutId:r}){return dt.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Vr[t]||t==="opacity")}function me(t,e,r){var i;let o=t.style,n=e==null?void 0:e.style,s={};if(!o)return s;for(let a in o)(k(o[a])||n&&k(n[a])||Pr(a,t)||((i=r==null?void 0:r.getValue(a))==null?void 0:i.liveStyle)!==void 0)&&(s[a]=o[a]);return s}function Ku(t){return window.getComputedStyle(t)}var Cr=class extends Ie{constructor(){super(...arguments),this.type="html",this.renderInstance=Io}mount(e){it(!!e.style,"motion.create() components must forward their ref to a HTML or SVG element","custom-component-ref"),super.mount(e)}readValueFromInstance(e,r){var o;if(dt.has(r))return(o=this.projection)!=null&&o.isProjecting?oo(r):ws(e,r);{let n=Ku(e),s=(Yr(r)?n.getPropertyValue(r):n[r])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:r}){return Lo(e,r)}build(e,r,o){fe(e,r,o.transformTemplate)}scrapeMotionValuesFromProps(e,r,o){return me(e,r,o)}};var _u={offset:"stroke-dashoffset",array:"stroke-dasharray"},$u={offset:"strokeDashoffset",array:"strokeDasharray"};function va(t,e,r=1,o=0,n=!0){t.pathLength=1;let s=n?_u:$u;t[s.offset]=`${-o}`,t[s.array]=`${e} ${r}`}var Yu=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Er(t,{attrX:e,attrY:r,attrScale:o,pathLength:n,pathSpacing:s=1,pathOffset:i=0,...a},c,u,l){var p,d;if(fe(t,a,u),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};let{attrs:f,style:m}=t;f.transform&&(m.transform=f.transform,delete f.transform),(m.transform||f.transformOrigin)&&(m.transformOrigin=(p=f.transformOrigin)!=null?p:"50% 50%",delete f.transformOrigin),m.transform&&(m.transformBox=(d=l==null?void 0:l.transformBox)!=null?d:"fill-box",delete f.transformBox);for(let h of Yu)f[h]!==void 0&&(m[h]=f[h],delete f[h]);e!==void 0&&(f.x=e),r!==void 0&&(f.y=r),o!==void 0&&(f.scale=o),n!==void 0&&va(f,n,s,i,!1)}var Bo=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);var Ar=t=>typeof t=="string"&&t.toLowerCase()==="svg";function ba(t,e,r,o){Io(t,e,void 0,o);for(let n in e.attrs)t.setAttribute(Bo.has(n)?n:De(n),e.attrs[n])}function Mr(t,e,r){let o=me(t,e,r);for(let n in t)if(k(t[n])||k(e[n])){let s=St.indexOf(n)!==-1?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n;o[s]=t[n]}return o}var Dr=class extends Ie{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=F}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(dt.has(r)){let o=bo(r);return o&&o.default||0}return r=Bo.has(r)?r:De(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,o){return Mr(e,r,o)}build(e,r,o){Er(e,r,this.isSVGTag,o.transformTemplate,o.style)}renderInstance(e,r,o,n){ba(e,r,o,n)}mount(e){this.isSVGTag=Ar(e.tagName),super.mount(e)}};var Xu=gr.length;function ui(t){if(!t)return;if(!t.isControllingVariants){let r=t.parent?ui(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}let e={};for(let r=0;r<Xu;r++){let o=gr[r],n=t.props[o];(Vt(n)||n===!1)&&(e[o]=n)}return e}function fi(t,e){if(!Array.isArray(e))return!1;let r=e.length;if(r!==t.length)return!1;for(let o=0;o<r;o++)if(e[o]!==t[o])return!1;return!0}var qu=[...Mo].reverse(),Zu=Mo.length;function Ju(t){return e=>Promise.all(e.map(({animation:r,options:o})=>Hs(t,r,o)))}function mi(t){let e=Ju(t),r=wa(),o=!0,n=!1,s=u=>(l,f)=>{var p;let m=ct(t,f,u==="exit"?(p=t.presenceContext)==null?void 0:p.custom:void 0);if(m){let{transition:d,transitionEnd:h,...g}=m;l={...l,...g,...h}}return l};function i(u){e=u(t)}function a(u){let{props:l}=t,f=ui(t.parent)||{},m=[],p=new Set,d={},h=1/0;for(let x=0;x<Zu;x++){let w=qu[x],b=r[w],v=l[w]!==void 0?l[w]:f[w],S=Vt(v),C=w===u?b.isActive:null;C===!1&&(h=x);let A=v===f[w]&&v!==l[w]&&S;if(A&&(o||n)&&t.manuallyAnimateOnMount&&(A=!1),b.protectedKeys={...d},!b.isActive&&C===null||!v&&!b.prevProp||kt(v)||typeof v=="boolean")continue;if(w==="exit"&&b.isActive&&C!==!0){b.prevResolvedValues&&(d={...d,...b.prevResolvedValues});continue}let V=Ta(b.prevProp,v),L=V||w===u&&b.isActive&&!A&&S||x>h&&S,P=!1,B=Array.isArray(v)?v:[v],R=B.reduce(s(w),{});C===!1&&(R={});let{prevResolvedValues:Z={}}=b,I={...Z,...R},tt=K=>{L=!0,p.has(K)&&(P=!0,p.delete(K)),b.needsAnimating[K]=!0;let ot=t.getValue(K);ot&&(ot.liveStyle=!1)};for(let K in I){let ot=R[K],ft=Z[K];if(d.hasOwnProperty(K))continue;let Ot=!1;ur(ot)&&ur(ft)?Ot=!fi(ot,ft)||V:Ot=ot!==ft,Ot?ot!=null?tt(K):p.add(K):ot!==void 0&&p.has(K)?tt(K):b.protectedKeys[K]=!0}b.prevProp=v,b.prevResolvedValues=R,b.isActive&&(d={...d,...R}),(o||n)&&t.blockInitialAnimation&&(L=!1);let at=A&&V;L&&(!at||P)&&m.push(...B.map(K=>{let ot={type:w};if(typeof K=="string"&&(o||n)&&!at&&t.manuallyAnimateOnMount&&t.parent){let{parent:ft}=t,Ot=ct(ft,K);if(ft.enteringChildren&&Ot){let{delayChildren:hn}=Ot.transition||{};ot.delay=mo(ft.enteringChildren,t,hn)}}return{animation:K,options:ot}}))}if(p.size){let x={};if(typeof l.initial!="boolean"){let w=ct(t,Array.isArray(l.initial)?l.initial[0]:l.initial);w&&w.transition&&(x.transition=w.transition)}p.forEach(w=>{let b=t.getBaseTarget(w),v=t.getValue(w);v&&(v.liveStyle=!0),x[w]=b!=null?b:null}),m.push({animation:x})}let g=!!m.length;return o&&(l.initial===!1||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(g=!1),o=!1,n=!1,g?e(m):Promise.resolve()}function c(u,l){var m;if(r[u].isActive===l)return Promise.resolve();(m=t.variantChildren)==null||m.forEach(p=>{var d;return(d=p.animationState)==null?void 0:d.setActive(u,l)}),r[u].isActive=l;let f=a(u);for(let p in r)r[p].protectedKeys={};return f}return{animateChanges:a,setActive:c,setAnimateFunction:i,getState:()=>r,reset:()=>{r=wa(),n=!0}}}function Ta(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!fi(e,t):!1}function pe(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wa(){return{animate:pe(!0),whileInView:pe(),whileHover:pe(),whileTap:pe(),whileDrag:pe(),whileFocus:pe(),exit:pe()}}function Oo(t,e){t.min=e.min,t.max=e.max}function xt(t,e){Oo(t.x,e.x),Oo(t.y,e.y)}function pi(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}var Sa=1e-4,Qu=1-Sa,tf=1+Sa,Va=.01,ef=0-Va,rf=0+Va;function H(t){return t.max-t.min}function xi(t,e,r){return Math.abs(t-e)<=r}function di(t,e,r,o=.5){t.origin=o,t.originPoint=M(e.min,e.max,t.origin),t.scale=H(r)/H(e),t.translate=M(r.min,r.max,t.origin)-t.originPoint,(t.scale>=Qu&&t.scale<=tf||isNaN(t.scale))&&(t.scale=1),(t.translate>=ef&&t.translate<=rf||isNaN(t.translate))&&(t.translate=0)}function de(t,e,r,o){di(t.x,e.x,r.x,o?o.originX:void 0),di(t.y,e.y,r.y,o?o.originY:void 0)}function hi(t,e,r,o=0){let n=o?M(r.min,r.max,o):r.min;t.min=n+e.min,t.max=t.min+H(e)}function yi(t,e,r,o){hi(t.x,e.x,r.x,o==null?void 0:o.x),hi(t.y,e.y,r.y,o==null?void 0:o.y)}function gi(t,e,r,o=0){let n=o?M(r.min,r.max,o):r.min;t.min=e.min-n,t.max=t.min+H(e)}function Oe(t,e,r,o){gi(t.x,e.x,r.x,o==null?void 0:o.x),gi(t.y,e.y,r.y,o==null?void 0:o.y)}function Pa(t,e,r,o,n){return t-=e,t=Tr(t,1/r,o),n!==void 0&&(t=Tr(t,1/n,o)),t}function of(t,e=0,r=1,o=.5,n,s=t,i=t){if(Q.test(e)&&(e=parseFloat(e),e=M(i.min,i.max,e/100)-i.min),typeof e!="number")return;let a=M(s.min,s.max,o);t===s&&(a-=e),t.min=Pa(t.min,e,r,a,n),t.max=Pa(t.max,e,r,a,n)}function Ca(t,e,[r,o,n],s,i){of(t,e[r],e[o],e[n],e.scale,s,i)}var nf=["x","scaleX","originX"],sf=["y","scaleY","originY"];function vi(t,e,r,o){Ca(t.x,e,nf,r?r.x:void 0,o?o.x:void 0),Ca(t.y,e,sf,r?r.y:void 0,o?o.y:void 0)}function Ea(t){return t.translate===0&&t.scale===1}function bi(t){return Ea(t.x)&&Ea(t.y)}function Aa(t,e){return t.min===e.min&&t.max===e.max}function Da(t,e){return Aa(t.x,e.x)&&Aa(t.y,e.y)}function Ma(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function wi(t,e){return Ma(t.x,e.x)&&Ma(t.y,e.y)}function Ti(t){return H(t.x)/H(t.y)}function Si(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function ut(t){return[t("x"),t("y")]}function Ra(t,e,r){let o="",n=t.x.translate/e.x,s=t.y.translate/e.y,i=(r==null?void 0:r.z)||0;if((n||s||i)&&(o=`translate3d(${n}px, ${s}px, ${i}px) `),(e.x!==1||e.y!==1)&&(o+=`scale(${1/e.x}, ${1/e.y}) `),r){let{transformPerspective:u,rotate:l,pathRotation:f,rotateX:m,rotateY:p,skewX:d,skewY:h}=r;u&&(o=`perspective(${u}px) ${o}`),l&&(o+=`rotate(${l}deg) `),f&&(o+=`rotate(${f}deg) `),m&&(o+=`rotateX(${m}deg) `),p&&(o+=`rotateY(${p}deg) `),d&&(o+=`skewX(${d}deg) `),h&&(o+=`skewY(${h}deg) `)}let a=t.x.scale*e.x,c=t.y.scale*e.y;return(a!==1||c!==1)&&(o+=`scale(${a}, ${c})`),o||"none"}var af=dr.length,ka=t=>typeof t=="string"?parseFloat(t):t,La=t=>typeof t=="number"||T.test(t);function Ba(t,e,r,o,n,s){var i,a,c,u;n?(t.opacity=M(0,(i=r.opacity)!=null?i:1,lf(o)),t.opacityExit=M((a=e.opacity)!=null?a:1,0,cf(o))):s&&(t.opacity=M((c=e.opacity)!=null?c:1,(u=r.opacity)!=null?u:1,o));for(let l=0;l<af;l++){let f=dr[l],m=Ia(e,f),p=Ia(r,f);if(m===void 0&&p===void 0)continue;m||(m=0),p||(p=0),m===0||p===0||La(m)===La(p)?(t[f]=Math.max(M(ka(m),ka(p),o),0),(Q.test(p)||Q.test(m))&&(t[f]+="%")):t[f]=p}(e.rotate||r.rotate)&&(t.rotate=M(e.rotate||0,r.rotate||0,o))}function Ia(t,e){return t[e]!==void 0?t[e]:t.borderRadius}var lf=Oa(0,.5,Qe),cf=Oa(.5,.95,j);function Oa(t,e,r){return o=>o<t?0:o>e?1:r(bt(t,e,o))}function Fa(t,e,r){let o=k(t)?t:vt(t);return o.start(ie("",o,e,r)),o.animation}function Pt(t,e,r,o={passive:!0}){return t.addEventListener(e,r,o),()=>t.removeEventListener(e,r,o)}var Na=(t,e)=>t.depth-e.depth;var Fo=class{constructor(){this.children=[],this.isDirty=!1}add(e){te(this.children,e),this.isDirty=!0}remove(e){Ft(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Na),this.isDirty=!1,this.children.forEach(e)}};function ja(t,e){let r=z.now(),o=({timestamp:n})=>{let s=n-r;s>=e&&(st(o),t(s-e))};return E.setup(o,!0),()=>st(o)}function he(t){return k(t)?t.get():t}var No=class{constructor(){this.members=[]}add(e){te(this.members,e);for(let r=this.members.length-1;r>=0;r--){let o=this.members[r];if(o===e||o===this.lead||o===this.prevLead)continue;let n=o.instance;(!n||n.isConnected===!1)&&!o.snapshot&&(Ft(this.members,o),o.unmount())}e.scheduleRender()}remove(e){if(Ft(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){var r;for(let o=this.members.indexOf(e)-1;o>=0;o--){let n=this.members[o];if(n.isPresent!==!1&&((r=n.instance)==null?void 0:r.isConnected)!==!1)return this.promote(n),!0}return!1}promote(e,r){var n;let o=this.lead;if(e!==o&&(this.prevLead=o,this.lead=e,e.show(),o)){o.updateSnapshot(),e.scheduleRender();let{layoutDependency:s}=o.options,{layoutDependency:i}=e.options;(s===void 0||s!==i)&&(e.resumeFrom=o,r&&(o.preserveOpacity=!0),o.snapshot&&(e.snapshot=o.snapshot,e.snapshot.latestValues=o.animationValues||o.latestValues),(n=e.root)!=null&&n.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&o.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var r,o,n,s,i;(o=(r=e.options).onExitComplete)==null||o.call(r),(i=(n=e.resumingFrom)==null?void 0:(s=n.options).onExitComplete)==null||i.call(s)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}};var ge={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var xe={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Vi=["","X","Y","Z"],uf=1e3,ff=0;function Pi(t,e,r,o){let{latestValues:n}=e;n[t]&&(r[t]=n[t],e.setStaticValue(t,0),o&&(o[t]=0))}function Ya(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:e}=t.options;if(!e)return;let r=go(e);if(window.MotionHasOptimisedAnimation(r,"transform")){let{layout:n,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",E,!(n||s))}let{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&Ya(o)}function jo({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:o,resetTransform:n}){return class{constructor(i={},a=e==null?void 0:e()){this.id=ff++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ue.value&&(xe.nodes=xe.calculatedTargetDeltas=xe.calculatedProjections=0),this.nodes.forEach(df),this.nodes.forEach(bf),this.nodes.forEach(wf),this.nodes.forEach(hf),ue.addProjectionMetrics&&ue.addProjectionMetrics(xe)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new Fo)}addEventListener(i,a){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new At),this.eventHandlers.get(i).add(a)}notifyListeners(i,...a){let c=this.eventHandlers.get(i);c&&c.notify(...a)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=ke(i)&&!oa(i),this.instance=i;let{layoutId:a,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||a)&&(this.isLayoutDirty=!0),t){let l,f=0,m=()=>this.root.updateBlockedByResize=!1;E.read(()=>{f=window.innerWidth}),t(i,()=>{let p=window.innerWidth;p!==f&&(f=p,this.root.updateBlockedByResize=!0,l&&l(),l=ja(m,250),ge.hasAnimatedSinceResize&&(ge.hasAnimatedSinceResize=!1,this.nodes.forEach(Wa)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&u&&(a||c)&&this.addEventListener("didUpdate",({delta:l,hasLayoutChanged:f,hasRelativeLayoutChanged:m,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let d=this.options.transition||u.getDefaultTransition()||Cf,{onLayoutAnimationStart:h,onLayoutAnimationComplete:g}=u.getProps(),x=!this.targetLayout||!wi(this.targetLayout,p),w=!f&&m;if(this.options.layoutRoot||this.resumeFrom||w||f&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let b={...Ae(d,"layout"),onPlay:h,onComplete:g};(u.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(l,w,b.path)}else f||Wa(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),st(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Tf),this.animationId++)}getTransformTemplate(){let{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Ya(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let l=0;l<this.path.length;l++){let f=this.path[l];f.shouldResetTransform=!0,(typeof f.latestValues.x=="string"||typeof f.latestValues.y=="string")&&(f.isLayoutDirty=!0),f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}let{layoutId:a,layout:c}=this.options;if(a===void 0&&!c)return;let u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let c=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),c&&this.nodes.forEach(xf),this.nodes.forEach(za);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Ga);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(yf),this.nodes.forEach(vf),this.nodes.forEach(mf),this.nodes.forEach(pf)):this.nodes.forEach(Ga),this.clearAllSnapshots();let a=z.now();W.delta=_(0,1e3/60,a-W.timestamp),W.timestamp=a,W.isProcessing=!0,nr.update.process(W),nr.preRender.process(W),nr.render.process(W),W.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,le.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(gf),this.sharedNodes.forEach(Sf)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,E.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){E.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!H(this.snapshot.measuredBox.x)&&!H(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();let i=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=F()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(a=!1),a&&this.instance){let c=o(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:c,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!n)return;let i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!bi(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,l=u!==this.prevTransformTemplateValue;i&&this.instance&&(a||Lt(this.latestValues)||l)&&(n(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){let a=this.measurePageBox(),c=this.removeElementScroll(a);return i&&(c=this.removeTransform(c)),Ef(c),{animationId:this.root.animationId,measuredBox:a,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;let{visualElement:i}=this.options;if(!i)return F();let a=i.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(Af))){let{scroll:l}=this.root;l&&(gt(a.x,l.offset.x),gt(a.y,l.offset.y))}return a}removeElementScroll(i){var c;let a=F();if(xt(a,i),(c=this.scroll)!=null&&c.wasRoot)return a;for(let u=0;u<this.path.length;u++){let l=this.path[u],{scroll:f,options:m}=l;l!==this.root&&f&&m.layoutScroll&&(f.wasRoot&&xt(a,i),gt(a.x,f.offset.x),gt(a.y,f.offset.y))}return a}applyTransform(i,a=!1,c){var l,f;let u=c||F();xt(u,i);for(let m=0;m<this.path.length;m++){let p=this.path[m];!a&&p.options.layoutScroll&&p.scroll&&p!==p.root&&(gt(u.x,-p.scroll.offset.x),gt(u.y,-p.scroll.offset.y)),Lt(p.latestValues)&&Sr(u,p.latestValues,(l=p.layout)==null?void 0:l.layoutBox)}return Lt(this.latestValues)&&Sr(u,this.latestValues,(f=this.layout)==null?void 0:f.layoutBox),u}removeTransform(i){var c;let a=F();xt(a,i);for(let u=0;u<this.path.length;u++){let l=this.path[u];if(!Lt(l.latestValues))continue;let f;l.instance&&(ko(l.latestValues)&&l.updateSnapshot(),f=F(),xt(f,l.measurePageBox())),vi(a,l.latestValues,(c=l.snapshot)==null?void 0:c.layoutBox,f)}return Lt(this.latestValues)&&vi(a,this.latestValues),a}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==W.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){var p;let a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);let c=!!this.resumingFrom||this!==a;if(!(i||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:l,layoutId:f}=this.options;if(!this.layout||!(l||f))return;this.resolvedRelativeTargetAt=W.timestamp;let m=this.getClosestProjectingParent();m&&this.linkedParentVersion!==m.layoutVersion&&!m.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&m&&m.layout?this.createRelativeTarget(m,this.layout.layoutBox,m.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=F(),this.targetWithTransforms=F()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),yi(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):xt(this.target,this.layout.layoutBox),li(this.target,this.targetDelta)):xt(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?this.createRelativeTarget(m,this.target,m.target):this.relativeParent=this.relativeTarget=void 0),ue.value&&xe.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||ko(this.parent.latestValues)||si(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(i,a,c){this.relativeParent=i,this.linkedParentVersion=i.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=F(),this.relativeTargetOrigin=F(),Oe(this.relativeTargetOrigin,a,c,this.options.layoutAnchor||void 0),xt(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var d;let i=this.getLead(),a=!!this.resumingFrom||this!==i,c=!0;if((this.isProjectionDirty||(d=this.parent)!=null&&d.isProjectionDirty)&&(c=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===W.timestamp&&(c=!1),c)return;let{layout:u,layoutId:l}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||l))return;xt(this.layoutCorrected,this.layout.layoutBox);let f=this.treeScale.x,m=this.treeScale.y;ha(this.layoutCorrected,this.treeScale,this.path,a),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=F());let{target:p}=i;if(!p){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(pi(this.prevProjectionDelta.x,this.projectionDelta.x),pi(this.prevProjectionDelta.y,this.projectionDelta.y)),de(this.projectionDelta,this.layoutCorrected,p,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==m||!Si(this.projectionDelta.x,this.prevProjectionDelta.x)||!Si(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),ue.value&&xe.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),i){let c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=_t(),this.projectionDelta=_t(),this.projectionDeltaWithTransform=_t()}setAnimationOrigin(i,a=!1,c){let u=this.snapshot,l=u?u.latestValues:{},f={...this.latestValues},m=_t();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;let p=F(),d=u?u.source:void 0,h=this.layout?this.layout.source:void 0,g=d!==h,x=this.getStack(),w=!x||x.members.length<=1,b=!!(g&&!w&&this.options.crossfade===!0&&!this.path.some(Pf));this.animationProgress=0;let v,S=c==null?void 0:c.interpolateProjection(i);this.mixTargetDelta=C=>{let A=C/1e3,V=S==null?void 0:S(A);V?(m.x.translate=V.x,m.x.scale=M(i.x.scale,1,A),m.x.origin=i.x.origin,m.x.originPoint=i.x.originPoint,m.y.translate=V.y,m.y.scale=M(i.y.scale,1,A),m.y.origin=i.y.origin,m.y.originPoint=i.y.originPoint):(Ua(m.x,i.x,A),Ua(m.y,i.y,A)),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Oe(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Vf(this.relativeTarget,this.relativeTargetOrigin,p,A),v&&Da(this.relativeTarget,v)&&(this.isProjectionDirty=!1),v||(v=F()),xt(v,this.relativeTarget)),g&&(this.animationValues=f,Ba(f,l,this.latestValues,A,b,w)),V&&V.rotate!==void 0&&(this.animationValues||(this.animationValues=f),this.animationValues.pathRotation=V.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=A},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){var a,c,u;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(st(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=E.update(()=>{ge.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=vt(0)),this.motionValue.jump(0,!1),this.currentAnimation=Fa(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:l=>{this.mixTargetDelta(l),i.onUpdate&&i.onUpdate(l)},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(uf),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let i=this.getLead(),{targetWithTransforms:a,target:c,layout:u,latestValues:l}=i;if(!(!a||!c||!u)){if(this!==i&&this.layout&&u&&Xa(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||F();let f=H(this.layout.layoutBox.x);c.x.min=i.target.x.min,c.x.max=c.x.min+f;let m=H(this.layout.layoutBox.y);c.y.min=i.target.y.min,c.y.max=c.y.min+m}xt(a,c),Sr(a,l),de(this.projectionDeltaWithTransform,this.layoutCorrected,a,l)}}registerSharedNode(i,a){this.sharedNodes.has(i)||this.sharedNodes.set(i,new No),this.sharedNodes.get(i).add(a);let u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){let i=this.getStack();return i?i.lead===this:!0}getLead(){var a;let{layoutId:i}=this.options;return i?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;let{layoutId:i}=this.options;return i?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){let{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:a,preserveFollowOpacity:c}={}){let u=this.getStack();u&&u.promote(this,c),i&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){let i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){let{visualElement:i}=this.options;if(!i)return;let a=!1,{latestValues:c}=i;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(a=!0),!a)return;let u={};c.z&&Pi("z",i,u,this.animationValues);for(let l=0;l<Vi.length;l++)Pi(`rotate${Vi[l]}`,i,u,this.animationValues),Pi(`skew${Vi[l]}`,i,u,this.animationValues);i.render();for(let l in u)i.setStaticValue(l,u[l]),this.animationValues&&(this.animationValues[l]=u[l]);i.scheduleRender()}applyProjectionStyles(i,a){var d,h;if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}let c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=he(a==null?void 0:a.pointerEvents)||"",i.transform=c?c(this.latestValues,""):"none";return}let u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=he(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!Lt(this.latestValues)&&(i.transform=c?c({},""):"none",this.hasProjected=!1);return}i.visibility="";let l=u.animationValues||u.latestValues;this.applyTransformsToTarget();let f=Ra(this.projectionDeltaWithTransform,this.treeScale,l);c&&(f=c(l,f)),i.transform=f;let{x:m,y:p}=this.projectionDelta;i.transformOrigin=`${m.origin*100}% ${p.origin*100}% 0`,u.animationValues?i.opacity=u===this?(h=(d=l.opacity)!=null?d:this.latestValues.opacity)!=null?h:1:this.preserveOpacity?this.latestValues.opacity:l.opacityExit:i.opacity=u===this?l.opacity!==void 0?l.opacity:"":l.opacityExit!==void 0?l.opacityExit:0;for(let g in Vr){if(l[g]===void 0)continue;let{correct:x,applyTo:w,isCSSVariable:b}=Vr[g],v=f==="none"?l[g]:x(l[g],u);if(w){let S=w.length;for(let C=0;C<S;C++)i[w[C]]=v}else b?this.options.visualElement.renderState.vars[g]=v:i[g]=v}this.options.layoutId&&(i.pointerEvents=u===this?he(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>{var a;return(a=i.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(za),this.root.sharedNodes.clear()}}}function mf(t){t.updateLayout()}function pf(t){var r;let e=((r=t.resumeFrom)==null?void 0:r.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){let{layoutBox:o,measuredBox:n}=t.layout,{animationType:s}=t.options,i=e.source!==t.layout.source;if(s==="size")ut(f=>{let m=i?e.measuredBox[f]:e.layoutBox[f],p=H(m);m.min=o[f].min,m.max=m.min+p});else if(s==="x"||s==="y"){let f=s==="x"?"y":"x";Oo(i?e.measuredBox[f]:e.layoutBox[f],o[f])}else Xa(s,e.layoutBox,o)&&ut(f=>{let m=i?e.measuredBox[f]:e.layoutBox[f],p=H(o[f]);m.max=m.min+p,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+p)});let a=_t();de(a,o,e.layoutBox);let c=_t();i?de(c,t.applyTransform(n,!0),e.measuredBox):de(c,o,e.layoutBox);let u=!bi(a),l=!1;if(!t.resumeFrom){let f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){let{snapshot:m,layout:p}=f;if(m&&p){let d=t.options.layoutAnchor||void 0,h=F();Oe(h,e.layoutBox,m.layoutBox,d);let g=F();Oe(g,o,p.layoutBox,d),wi(h,g)||(l=!0),f.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=h,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:o,snapshot:e,delta:c,layoutDelta:a,hasLayoutChanged:u,hasRelativeLayoutChanged:l})}else if(t.isLead()){let{onExitComplete:o}=t.options;o&&o()}t.options.transition=void 0}function df(t){ue.value&&xe.nodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function hf(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function gf(t){t.clearSnapshot()}function za(t){t.clearMeasurements()}function xf(t){t.isLayoutDirty=!0,t.updateLayout()}function Ga(t){t.isLayoutDirty=!1}function yf(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function vf(t){let{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Wa(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function bf(t){t.resolveTargetDelta()}function wf(t){t.calcProjection()}function Tf(t){t.resetSkewAndRotation()}function Sf(t){t.removeLeadSnapshot()}function Ua(t,e,r){t.translate=M(e.translate,0,r),t.scale=M(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function Ha(t,e,r,o){t.min=M(e.min,r.min,o),t.max=M(e.max,r.max,o)}function Vf(t,e,r,o){Ha(t.x,e.x,r.x,o),Ha(t.y,e.y,r.y,o)}function Pf(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}var Cf={duration:.45,ease:[.4,0,.1,1]},Ka=t=>typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),_a=Ka("applewebkit/")&&!Ka("chrome/")?Math.round:j;function $a(t){t.min=_a(t.min),t.max=_a(t.max)}function Ef(t){$a(t.x),$a(t.y)}function Xa(t,e,r){return t==="position"||t==="preserve-aspect"&&!xi(Ti(e),Ti(r),.2)}function Af(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}var qa=jo({attachResizeListener:(t,e)=>Pt(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||((t=document.body)==null?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0});var zo={current:void 0},Rr=jo({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!zo.current){let t=new qa({});t.mount(window),t.setOptions({layoutScroll:!0}),zo.current=t}return zo.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"});var Za=require("react"),Go=(0,Za.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});var Yt=require("react");function Ja(t=!0){let e=(0,Yt.useContext)(ve);if(e===null)return[!0,null];let{isPresent:r,onExitComplete:o,register:n}=e,s=(0,Yt.useId)();(0,Yt.useEffect)(()=>{if(t)return n(s)},[t]);let i=(0,Yt.useCallback)(()=>t&&o&&o(s),[s,o,t]);return!r&&o?[!1,i]:[!0]}var Qa=require("react"),Wo=(0,Qa.createContext)({strict:!1});var tl={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},el=!1;function Mf(){if(el)return;let t={};for(let e in tl)t[e]={isEnabled:r=>tl[e].some(o=>!!r[o])};br(t),el=!0}function Uo(){return Mf(),ri()}function rl(t){let e=Uo();for(let r in t)e[r]={...e[r],...t[r]};br(e)}var Df=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function kr(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Df.has(t)}var ol=t=>!kr(t);function Rf(t){typeof t=="function"&&(ol=e=>e.startsWith("on")?!kr(e):t(e))}try{Rf(require("@emotion/is-prop-valid").default)}catch(t){}function nl(t,e,r){let o={};for(let n in t)n==="values"&&typeof t.values=="object"||k(t[n])||(ol(n)||r===!0&&kr(n)||!e&&!kr(n)||t.draggable&&n.startsWith("onDrag"))&&(o[n]=t[n]);return o}var Yo=require("react/jsx-runtime");var ze=require("react");var il=require("react"),Xt=(0,il.createContext)({});var Ho=require("react");function sl(t,e){if($t(t)){let{initial:r,animate:o}=t;return{initial:r===!1||Vt(r)?r:void 0,animate:Vt(o)?o:void 0}}return t.inherit!==!1?e:{}}function ll(t){let{initial:e,animate:r}=sl(t,(0,Ho.useContext)(Xt));return(0,Ho.useMemo)(()=>({initial:e,animate:r}),[al(e),al(r)])}function al(t){return Array.isArray(t)?t.join(" "):t}var je=require("react");var cl=require("react");var Fe=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Ci(t,e,r){for(let o in e)!k(e[o])&&!Pr(o,r)&&(t[o]=e[o])}function kf({transformTemplate:t},e){return(0,cl.useMemo)(()=>{let r=Fe();return fe(r,e,t),Object.assign({},r.vars,r.style)},[e])}function Lf(t,e){let r=t.style||{},o={};return Ci(o,r,t),Object.assign(o,kf(t,e)),o}function ul(t,e){let r={},o=Lf(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=o,r}var fl=require("react");var Ko=()=>({...Fe(),attrs:{}});function ml(t,e,r,o){let n=(0,fl.useMemo)(()=>{let s=Ko();return Er(s,e,Ar(o),t.transformTemplate,t.style),{...s.attrs,style:{...s.style}}},[e]);if(t.style){let s={};Ci(s,t.style,t),n.style={...s,...n.style}}return n}var pl=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Ne(t){return typeof t!="string"||t.includes("-")?!1:!!(pl.indexOf(t)>-1||/[A-Z]/u.test(t))}function dl(t,e,r,{latestValues:o},n,s=!1,i){let c=((i!=null?i:Ne(t))?ml:ul)(e,o,n,t),u=nl(e,typeof t=="string",s),l=t!==je.Fragment?{...u,...c,ref:r}:{},{children:f}=e,m=(0,je.useMemo)(()=>k(f)?f.get():f,[f]);return(0,je.createElement)(t,{...l,children:m})}var Ei=require("react");function If({scrapeMotionValuesFromProps:t,createRenderState:e},r,o,n){return{latestValues:Bf(r,o,n,t),renderState:e()}}function Bf(t,e,r,o){let n={},s=o(t,{});for(let m in s)n[m]=he(s[m]);let{initial:i,animate:a}=t,c=$t(t),u=xr(t);e&&u&&!c&&t.inherit!==!1&&(i===void 0&&(i=e.initial),a===void 0&&(a=e.animate));let l=r?r.initial===!1:!1;l=l||i===!1;let f=l?a:i;if(f&&typeof f!="boolean"&&!kt(f)){let m=Array.isArray(f)?f:[f];for(let p=0;p<m.length;p++){let d=se(t,m[p]);if(d){let{transitionEnd:h,transition:g,...x}=d;for(let w in x){let b=x[w];if(Array.isArray(b)){let v=l?b.length-1:0;b=b[v]}b!==null&&(n[w]=b)}for(let w in h)n[w]=h[w]}}}return n}var _o=t=>(e,r)=>{let o=(0,Ei.useContext)(Xt),n=(0,Ei.useContext)(ve),s=()=>If(t,e,o,n);return r?s():Ki(s)};var hl=_o({scrapeMotionValuesFromProps:me,createRenderState:Fe});var gl=_o({scrapeMotionValuesFromProps:Mr,createRenderState:Ko});var xl=Symbol.for("motionComponentSymbol");var ye=require("react");function yl(t,e,r){let o=(0,ye.useRef)(r);(0,ye.useInsertionEffect)(()=>{o.current=r});let n=(0,ye.useRef)(null);return(0,ye.useCallback)(s=>{var a;s&&((a=t.onMount)==null||a.call(t,s)),e&&(s?e.mount(s):e.unmount());let i=o.current;if(typeof i=="function")if(s){let c=i(s);typeof c=="function"&&(n.current=c)}else n.current?(n.current(),n.current=null):i(s);else i&&(i.current=s)},[e])}var rt=require("react");var vl=require("react"),$o=(0,vl.createContext)({});function qt(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function bl(t,e,r,o,n,s){var b,v;let{visualElement:i}=(0,rt.useContext)(Xt),a=(0,rt.useContext)(Wo),c=(0,rt.useContext)(ve),u=(0,rt.useContext)(Go),l=u.reducedMotion,f=u.skipAnimations,m=(0,rt.useRef)(null),p=(0,rt.useRef)(!1);o=o||a.renderer,!m.current&&o&&(m.current=o(t,{visualState:e,parent:i,props:r,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:l,skipAnimations:f,isSVG:s}),p.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));let d=m.current,h=(0,rt.useContext)($o);d&&!d.projection&&n&&(d.type==="html"||d.type==="svg")&&Of(m.current,r,n,h);let g=(0,rt.useRef)(!1);(0,rt.useInsertionEffect)(()=>{d&&g.current&&d.update(r,c)});let x=r[fr],w=(0,rt.useRef)(!!x&&typeof window!="undefined"&&!((b=window.MotionHandoffIsComplete)!=null&&b.call(window,x))&&((v=window.MotionHasOptimisedAnimation)==null?void 0:v.call(window,x)));return $i(()=>{p.current=!0,d&&(g.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),w.current&&d.animationState&&d.animationState.animateChanges())}),(0,rt.useEffect)(()=>{d&&(!w.current&&d.animationState&&d.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var S;(S=window.MotionHandoffMarkAsComplete)==null||S.call(window,x)}),w.current=!1),d.enteringChildren=void 0)}),d}function Of(t,e,r,o){let{layoutId:n,layout:s,drag:i,dragConstraints:a,layoutScroll:c,layoutRoot:u,layoutAnchor:l,layoutCrossfade:f}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:wl(t.parent)),t.projection.setOptions({layoutId:n,layout:s,alwaysMeasureLayout:!!i||a&&qt(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:o,crossfade:f,layoutScroll:c,layoutRoot:u,layoutAnchor:l})}function wl(t){if(t)return t.options.allowProjection!==!1?t.projection:wl(t.parent)}function Xo(t,{forwardMotionProps:e=!1,type:r}={},o,n){var u,l;o&&rl(o);let s=r?r==="svg":Ne(t),i=s?gl:hl;function a(f,m){let p,d={...(0,ze.useContext)(Go),...f,layoutId:Ff(f)},{isStatic:h}=d,g=ll(f),x=i(f,h);if(!h&&typeof window!="undefined"){Nf(d,o);let w=jf(d);p=w.MeasureLayout,g.visualElement=bl(t,x,d,n,w.ProjectionNode,s)}return(0,Yo.jsxs)(Xt.Provider,{value:g,children:[p&&g.visualElement?(0,Yo.jsx)(p,{visualElement:g.visualElement,...d}):null,dl(t,f,yl(x,g.visualElement,m),x,h,e,s)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${(l=(u=t.displayName)!=null?u:t.name)!=null?l:""})`}`;let c=(0,ze.forwardRef)(a);return c[xl]=t,c}function Ff({layoutId:t}){let e=(0,ze.useContext)(zr).id;return e&&t!==void 0?e+"-"+t:t}function Nf(t,e){let r=(0,ze.useContext)(Wo).strict}function jf(t){let e=Uo(),{drag:r,layout:o}=e;if(!r&&!o)return{};let n={...r,...o};return{MeasureLayout:r!=null&&r.isEnabled(t)||o!=null&&o.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function Tl(t,e){if(typeof Proxy=="undefined")return Xo;let r=new Map,o=(s,i)=>Xo(s,i,t,e),n=(s,i)=>o(s,i);return new Proxy(n,{get:(s,i)=>i==="create"?o:(r.has(i)||r.set(i,Xo(i,void 0,t,e)),r.get(i))})}var Sl=require("react");var Vl=(t,e)=>{var o;return((o=e.isSVG)!=null?o:Ne(t))?new Dr(e):new Cr(e,{allowProjection:t!==Sl.Fragment})};var qo=class extends Y{constructor(e){super(e),e.animationState||(e.animationState=mi(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();kt(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}};var zf=0,Zo=class extends Y{constructor(){super(...arguments),this.id=zf++,this.isExitComplete=!1}update(){var s;if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===o)return;if(e&&o===!1){if(this.isExitComplete){let{initial:i,custom:a}=this.node.getProps();if(typeof i=="string"||typeof i=="object"&&i!==null&&!Array.isArray(i)){let c=ct(this.node,i,a);if(c){let{transition:u,transitionEnd:l,...f}=c;for(let m in f)(s=this.node.getValue(m))==null||s.jump(f[m])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}let n=this.node.animationState.setActive("exit",!e);r&&!e&&n.then(()=>{this.isExitComplete=!0,r(this.id)})}mount(){let{register:e,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),e&&(this.unmount=e(this.id))}unmount(){}};var Pl={animation:{Feature:qo},exit:{Feature:Zo}};function It(t){return{point:{x:t.pageX,y:t.pageY}}}var Cl=t=>e=>ce(e)&&t(e,It(e));function Zt(t,e,r,o){return Pt(t,e,Cl(r),o)}var Jo=({current:t})=>t?t.ownerDocument.defaultView:null;var El=(t,e)=>Math.abs(t-e);function Al(t,e){let r=El(t.x,e.x),o=El(t.y,e.y);return Math.sqrt(r**2+o**2)}var Ml=new Set(["auto","scroll"]),Ge=class{constructor(e,r,{transformPagePoint:o,contextWindow:n=window,dragSnapToOrigin:s=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=d=>{this.handleScroll(d.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Qo(this.lastRawMoveEventInfo,this.transformPagePoint));let d=Ai(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,g=Al(d.offset,{x:0,y:0})>=this.distanceThreshold;if(!h&&!g)return;let{point:x}=d,{timestamp:w}=W;this.history.push({...x,timestamp:w});let{onStart:b,onMove:v}=this.handlers;h||(b&&b(this.lastMoveEvent,d),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,d)},this.handlePointerMove=(d,h)=>{this.lastMoveEvent=d,this.lastRawMoveEventInfo=h,this.lastMoveEventInfo=Qo(h,this.transformPagePoint),E.update(this.updatePoint,!0)},this.handlePointerUp=(d,h)=>{this.end();let{onEnd:g,onSessionEnd:x,resumeAnimation:w}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let b=Ai(d.type==="pointercancel"?this.lastMoveEventInfo:Qo(h,this.transformPagePoint),this.history);this.startEvent&&g&&g(d,b),x&&x(d,b)},!ce(e))return;this.dragSnapToOrigin=s,this.handlers=r,this.transformPagePoint=o,this.distanceThreshold=i,this.contextWindow=n||window;let c=It(e),u=Qo(c,this.transformPagePoint),{point:l}=u,{timestamp:f}=W;this.history=[{...l,timestamp:f}];let{onSessionStart:m}=r;m&&m(e,Ai(u,this.history));let p={passive:!0,capture:!0};this.removeListeners=yt(Zt(this.contextWindow,"pointermove",this.handlePointerMove,p),Zt(this.contextWindow,"pointerup",this.handlePointerUp,p),Zt(this.contextWindow,"pointercancel",this.handlePointerUp,p)),a&&this.startScrollTracking(a)}startScrollTracking(e){let r=e.parentElement;for(;r;){let o=getComputedStyle(r);(Ml.has(o.overflowX)||Ml.has(o.overflowY))&&this.scrollPositions.set(r,{x:r.scrollLeft,y:r.scrollTop}),r=r.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let r=this.scrollPositions.get(e);if(!r)return;let o=e===window,n=o?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s={x:n.x-r.x,y:n.y-r.y};s.x===0&&s.y===0||(o?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,n),E.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),st(this.updatePoint)}};function Qo(t,e){return e?{point:e(t.point)}:t}function Dl(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Ai({point:t},e){return{point:t,delta:Dl(t,Rl(e)),offset:Dl(t,Gf(e)),velocity:Wf(e,.1)}}function Gf(t){return t[0]}function Rl(t){return t[t.length-1]}function Wf(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,o=null,n=Rl(t);for(;r>=0&&(o=t[r],!(n.timestamp-o.timestamp>U(e)));)r--;if(!o)return{x:0,y:0};o===t[0]&&t.length>2&&n.timestamp-o.timestamp>U(e)*2&&(o=t[1]);let s=X(n.timestamp-o.timestamp);if(s===0)return{x:0,y:0};let i={x:(n.x-o.x)/s,y:(n.y-o.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function Ol(t,{min:e,max:r},o){return e!==void 0&&t<e?t=o?M(e,t,o.min):Math.max(t,e):r!==void 0&&t>r&&(t=o?M(r,t,o.max):Math.min(t,r)),t}function kl(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function Fl(t,{top:e,left:r,bottom:o,right:n}){return{x:kl(t.x,r,n),y:kl(t.y,e,o)}}function Ll(t,e){let r=e.min-t.min,o=e.max-t.max;return e.max-e.min<t.max-t.min&&([r,o]=[o,r]),{min:r,max:o}}function Nl(t,e){return{x:Ll(t.x,e.x),y:Ll(t.y,e.y)}}function jl(t,e){let r=.5,o=H(t),n=H(e);return n>o?r=bt(e.min,e.max-o,t.min):o>n&&(r=bt(t.min,t.max-n,e.min)),_(0,1,r)}function zl(t,e){let r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}var tn=.35;function Gl(t=tn){return t===!1?t=0:t===!0&&(t=tn),{x:Il(t,"left","right"),y:Il(t,"top","bottom")}}function Il(t,e,r){return{min:Bl(t,e),max:Bl(t,r)}}function Bl(t,e){return typeof t=="number"?t:t[e]||0}var Uf=new WeakMap,rn=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=F(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:r=!1,distanceThreshold:o}={}){let{presenceContext:n}=this.visualElement;if(n&&n.isPresent===!1)return;let s=f=>{r&&this.snapToCursor(It(f).point),this.stopAnimation()},i=(f,m)=>{let{drag:p,dragPropagation:d,onDragStart:h}=this.getProps();if(p&&!d&&(this.openDragLock&&this.openDragLock(),this.openDragLock=$n(p),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ut(x=>{let w=this.getAxisMotionValue(x).get()||0;if(Q.test(w)){let{projection:b}=this.visualElement;if(b&&b.layout){let v=b.layout.layoutBox[x];v&&(w=H(v)*(parseFloat(w)/100))}}this.originPoint[x]=w}),h&&E.update(()=>h(f,m),!1,!0),Me(this.visualElement,"transform");let{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},a=(f,m)=>{this.latestPointerEvent=f,this.latestPanInfo=m;let{dragPropagation:p,dragDirectionLock:d,onDirectionLock:h,onDrag:g}=this.getProps();if(!p&&!this.openDragLock)return;let{offset:x}=m;if(d&&this.currentDirection===null){this.currentDirection=Kf(x),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",m.point,x),this.updateAxis("y",m.point,x),this.visualElement.render(),g&&E.update(()=>g(f,m),!1,!0)},c=(f,m)=>{this.latestPointerEvent=f,this.latestPanInfo=m,this.stop(f,m),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{let{dragSnapToOrigin:f}=this.getProps();(f||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new Ge(e,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:o,contextWindow:Jo(this.visualElement),element:this.visualElement.current})}stop(e,r){let o=e||this.latestPointerEvent,n=r||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!n||!o)return;let{velocity:i}=n;this.startAnimation(i);let{onDragEnd:a}=this.getProps();a&&E.postRender(()=>a(o,n))}cancel(){this.isDragging=!1;let{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:o}=this.getProps();!o&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,r,o){let{drag:n}=this.getProps();if(!o||!en(e,n,this.currentDirection))return;let s=this.getAxisMotionValue(e),i=this.originPoint[e]+o[e];this.constraints&&this.constraints[e]&&(i=Ol(i,this.constraints[e],this.elastic[e])),s.set(i)}resolveConstraints(){var s;let{dragConstraints:e,dragElastic:r}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,n=this.constraints;e&&qt(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&o?this.constraints=Fl(o.layoutBox,e):this.constraints=!1,this.elastic=Gl(r),n!==this.constraints&&!qt(e)&&o&&this.constraints&&!this.hasMutatedConstraints&&ut(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=zl(o.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!qt(e))return!1;let o=e.current;it(o!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:n}=this.visualElement;if(!n||!n.layout)return!1;n.root&&(n.root.scroll=void 0,n.root.updateScroll());let s=ci(o,n.root,this.visualElement.getTransformPagePoint()),i=Nl(n.layout.layoutBox,s);if(r){let a=r(oi(i));this.hasMutatedConstraints=!!a,a&&(i=wr(a))}return i}startAnimation(e){let{drag:r,dragMomentum:o,dragElastic:n,dragTransition:s,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},u=ut(l=>{if(!en(l,r,this.currentDirection))return;let f=c&&c[l]||{};(i===!0||i===l)&&(f={min:0,max:0});let m=n?200:1e6,p=n?40:1e7,d={type:"inertia",velocity:o?e[l]:0,bounceStiffness:m,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(l,d)});return Promise.all(u).then(a)}startAxisValueAnimation(e,r){let o=this.getAxisMotionValue(e);return Me(this.visualElement,e),o.start(ie(e,o,0,r,this.visualElement,!1))}stopAnimation(){ut(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){var s;let r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps()[r];return n||this.visualElement.getValue(e,(s=this.visualElement.latestValues[e])!=null?s:0)}snapToCursor(e){ut(r=>{let{drag:o}=this.getProps();if(!en(r,o,this.currentDirection))return;let{projection:n}=this.visualElement,s=this.getAxisMotionValue(r);if(n&&n.layout){let{min:i,max:a}=n.layout.layoutBox[r],c=s.get()||0;s.set(e[r]-M(i,a,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:r}=this.getProps(),{projection:o}=this.visualElement;if(!qt(r)||!o||!this.constraints)return;this.stopAnimation();let n={x:0,y:0};ut(i=>{let a=this.getAxisMotionValue(i);if(a&&this.constraints!==!1){let c=a.get();n[i]=jl({min:c,max:c},this.constraints[i])}});let{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.constraints=!1,this.resolveConstraints(),ut(i=>{if(!en(i,e,null))return;let a=this.getAxisMotionValue(i),{min:c,max:u}=this.constraints[i];a.set(M(c,u,n[i]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Uf.set(this.visualElement,this);let e=this.visualElement.current,r=Zt(e,"pointerdown",u=>{let{drag:l,dragListener:f=!0}=this.getProps(),m=u.target,p=m!==e&&Zn(m);l&&f&&!p&&this.start(u)}),o,n=()=>{let{dragConstraints:u}=this.getProps();qt(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),o||(o=Hf(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,i=s.addEventListener("measure",n);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),E.read(n);let a=Pt(window,"resize",()=>this.scalePositionWithinConstraints()),c=s.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:l})=>{this.isDragging&&l&&(ut(f=>{let m=this.getAxisMotionValue(f);m&&(this.originPoint[f]+=u[f].translate,m.set(m.get()+u[f].translate))}),this.visualElement.render())}));return()=>{a(),r(),i(),c&&c(),o&&o()}}getProps(){let e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:o=!1,dragPropagation:n=!1,dragConstraints:s=!1,dragElastic:i=tn,dragMomentum:a=!0}=e;return{...e,drag:r,dragDirectionLock:o,dragPropagation:n,dragConstraints:s,dragElastic:i,dragMomentum:a}}};function Wl(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function Hf(t,e,r){let o=Ao(t,Wl(r)),n=Ao(e,Wl(r));return()=>{o(),n()}}function en(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function Kf(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}var on=class extends Y{constructor(e){super(e),this.removeGroupControls=j,this.removeListeners=j,this.controls=new rn(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||j}update(){let{dragControls:e}=this.node.getProps(),{dragControls:r}=this.node.prevProps||{};e!==r&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}};var Mi=t=>(e,r)=>{t&&E.update(()=>t(e,r),!1,!0)},nn=class extends Y{constructor(){super(...arguments),this.removePointerDownListener=j}onPointerDown(e){this.session=new Ge(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Jo(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:r,onPan:o,onPanEnd:n}=this.node.getProps();return{onSessionStart:Mi(e),onStart:Mi(r),onMove:Mi(o),onEnd:(s,i)=>{delete this.session,n&&E.postRender(()=>n(s,i))}}}mount(){this.removePointerDownListener=Zt(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}};var Ul=require("react/jsx-runtime");var Lr=require("react");var Di=!1,Ri=class extends Lr.Component{componentDidMount(){let{visualElement:e,layoutGroup:r,switchLayoutGroup:o,layoutId:n}=this.props,{projection:s}=e;s&&(r.group&&r.group.add(s),o&&o.register&&n&&o.register(s),Di&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ge.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:r,visualElement:o,drag:n,isPresent:s}=this.props,{projection:i}=o;return i&&(i.isPresent=s,e.layoutDependency!==r&&i.setOptions({...i.options,layoutDependency:r}),Di=!0,n||e.layoutDependency!==r||r===void 0||e.isPresent!==s?i.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?i.promote():i.relegate()||E.postRender(()=>{let a=i.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){let{visualElement:e,layoutAnchor:r}=this.props,{projection:o}=e;o&&(o.options.layoutAnchor=r,o.root.didUpdate(),le.postRender(()=>{!o.currentAnimation&&o.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:r,switchLayoutGroup:o}=this.props,{projection:n}=e;Di=!0,n&&(n.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(n),o&&o.deregister&&o.deregister(n))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function sn(t){let[e,r]=Ja(),o=(0,Lr.useContext)(zr);return(0,Ul.jsx)(Ri,{...t,layoutGroup:o,switchLayoutGroup:(0,Lr.useContext)($o),isPresent:e,safeToRemove:r})}var Hl={pan:{Feature:nn},drag:{Feature:on,ProjectionNode:Rr,MeasureLayout:sn}};function Kl(t,e,r){let{props:o}=t;t.animationState&&o.whileHover&&t.animationState.setActive("whileHover",r==="Start");let n="onHover"+r,s=o[n];s&&E.postRender(()=>s(e,It(e)))}var an=class extends Y{mount(){let{current:e}=this.node;e&&(this.unmount=Yn(e,(r,o)=>(Kl(this.node,o,"Start"),n=>Kl(this.node,n,"End"))))}unmount(){}};var ln=class extends Y{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(r){e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=yt(Pt(this.node.current,"focus",()=>this.onFocus()),Pt(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};function _l(t,e,r){let{props:o}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&o.whileTap&&t.animationState.setActive("whileTap",r==="Start");let n="onTap"+(r==="End"?"":r),s=o[n];s&&E.postRender(()=>s(e,It(e)))}var cn=class extends Y{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:r,propagate:o}=this.node.props;this.unmount=Qn(e,(n,s)=>(_l(this.node,s,"Start"),(i,{success:a})=>_l(this.node,i,a?"End":"Cancel")),{useGlobalTarget:r,stopPropagation:(o==null?void 0:o.tap)===!1})}unmount(){}};var Li=new WeakMap,ki=new WeakMap,_f=t=>{let e=Li.get(t.target);e&&e(t)},$f=t=>{t.forEach(_f)};function Yf({root:t,...e}){let r=t||document;ki.has(r)||ki.set(r,{});let o=ki.get(r),n=JSON.stringify(e);return o[n]||(o[n]=new IntersectionObserver($f,{root:t,...e})),o[n]}function $l(t,e,r){let o=Yf(e);return Li.set(t,r),o.observe(t),()=>{Li.delete(t),o.unobserve(t)}}var Xf={some:0,all:1},un=class extends Y{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var c;(c=this.stopObserver)==null||c.call(this);let{viewport:e={}}=this.node.getProps(),{root:r,margin:o,amount:n="some",once:s}=e,i={root:r?r.current:void 0,rootMargin:o,threshold:typeof n=="number"?n:Xf[n]},a=u=>{let{isIntersecting:l}=u;if(this.isInView===l||(this.isInView=l,s&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);let{onViewportEnter:f,onViewportLeave:m}=this.node.getProps(),p=l?f:m;p&&p(u)};this.stopObserver=$l(this.node.current,i,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver=="undefined")return;let{props:e,prevProps:r}=this.node;["amount","margin","root"].some(qf(e,r))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}};function qf({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}var Yl={inView:{Feature:un},tap:{Feature:cn},focus:{Feature:ln},hover:{Feature:an}};var Xl={layout:{ProjectionNode:Rr,MeasureLayout:sn}};var ql={...Pl,...Yl,...Hl,...Xl};var Ii=Tl(ql,Vl);var Bi=Ii;var y=require("react"),tc=require("react-dom"),Oi=new Set,Fi={open:!1,status:null,busy:!1};function Bt(t){Fi=Object.assign({},Fi,t),Oi.forEach(function(e){e()})}function Jf(t){return Oi.add(t),function(){Oi.delete(t)}}function Qf(){return Fi}function ec(){return y.useSyncExternalStore(Jf,Qf)}async function Jt(t,e){var r={method:e===void 0?"GET":"POST",headers:{}};e!==void 0&&(r.headers["content-type"]="application/json",r.body=JSON.stringify(e));var o=await fetch(t,r),n=await o.text(),s=null;try{s=n===""?null:JSON.parse(n)}catch(i){s=null}return o.ok?s!==null?s:{ok:!1,error:"invalid JSON response"}:{ok:!1,error:"HTTP "+o.status+(s!==null&&s.error!==void 0?": "+s.error:"")}}function tm(t,e){try{var r=t(function(f){return f}),o=e===null?null:typeof e=="function"?e(function(f){return f}):null,n=r!=null?r.current:void 0;if(n!==void 0&&r!=null&&r.byId!=null){var s=r.byId[n];if(s!=null&&typeof s.cwd=="string"&&s.cwd!=="")return s.cwd}var i=o!=null&&Array.isArray(o.items)?o.items:[];if(n!==void 0)for(var a=0;a<i.length;a++){var c=i[a];if(c.sessionIds!=null&&c.sessionIds.indexOf(n)!==-1&&typeof c.path=="string"&&c.path!=="")return c.path}var u=o!=null?o.recentWorkspaceId:void 0;if(u!==void 0){for(var l=0;l<i.length;l++)if(i[l].workspaceId===u&&typeof i[l].path=="string"&&i[l].path!=="")return i[l].path}if(i.length>0&&typeof i[0].path=="string"&&i[0].path!=="")return i[0].path}catch(f){}}var em=["nw","n","ne","w","e","sw","s","se"],q=12,rm=720,om=520,rc=360,oc=260,Zl=24;function nc(t){if(t===!1)return 0;try{if(typeof document=="undefined")return 0;var e=document.querySelectorAll("[data-composer-seat]");if(e===null||e.length===0)return 0;for(var r=Number.POSITIVE_INFINITY,o=0,n=0;n<e.length;n++){var s=e[n].getBoundingClientRect();s===null||s.width<=0||(s.top<r&&(r=s.top),s.bottom>o&&(o=s.bottom))}if(!isFinite(r)||o<=0)return 0;var i=window.innerHeight;return i-o>24?0:Math.min(Math.max(1,i-r+8),420)}catch(a){return 0}}function Ct(){return{width:Math.max(1,window.innerWidth),height:Math.max(1,window.innerHeight)}}function dn(t,e){return{width:Math.max(1,t.width-q*2),height:Math.max(1,t.height-q*2-e)}}function Qt(t,e,r){return Math.min(r,Math.max(e,t))}function Ue(t,e,r){let o=dn(e,r),n=Qt(t.width,Math.min(rc,o.width),o.width),s=Qt(t.height,Math.min(oc,o.height),o.height);return{x:Qt(t.x,q,Math.max(q,e.width-q-n)),y:Qt(t.y,q,Math.max(q,e.height-q-r-s)),width:n,height:s}}function nm(t,e,r){let o=dn(e,r),n=Math.min(rm,o.width),s=Math.min(om,o.height),i=im(),a=i>0?i-8:e.height-q-r;return Ue({x:e.width-q-n-t*Zl,y:Math.max(q,a-s-t*Zl),width:n,height:s},e,r)}function im(){try{if(typeof document=="undefined")return-1;var t=document.querySelectorAll("[data-composer-seat]");if(t===null||t.length===0)return-1;for(var e=Number.POSITIVE_INFINITY,r=0;r<t.length;r++){var o=t[r].getBoundingClientRect();o!==null&&o.width>0&&o.top<e&&(e=o.top)}return isFinite(e)?e:-1}catch(n){return-1}}function sm(t,e,r,o,n){return Ue({...t,x:t.x+e,y:t.y+r},o,n)}function am(t,e,r,o,n,s){let i=Ue(t,n,s),a=dn(n,s),c=Math.min(rc,a.width),u=Math.min(oc,a.height),l=n.height-q-s,f=i.x,m=i.x+i.width,p=i.y,d=i.y+i.height;return e.includes("w")&&(f=Qt(i.x+r,q,m-c)),e.includes("e")&&(m=Qt(m+r,f+c,n.width-q)),e.includes("n")&&(p=Qt(i.y+o,q,d-u)),e.includes("s")&&(d=Qt(d+o,p+u,l)),{x:f,y:p,width:m-f,height:d-p}}function fn(t,e){let r=dn(t,e);return{x:q,y:q,width:r.width,height:r.height}}var lm='.dshcs-root{position:fixed;inset:0;z-index:2147483000;pointer-events:none}.dshcs-win{--dshcs-accent:#5b6cff;pointer-events:auto;position:fixed;isolation:isolate;z-index:2147483000;display:flex;flex-direction:column;min-width:1px;min-height:1px;overflow:hidden;color:var(--dsw-alias-label-primary,#172033);background:var(--dsw-alias-bg-base,#fff);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;box-shadow:0 1px 2px rgba(13,22,38,.08),0 18px 48px rgba(13,22,38,.2),0 0 0 1px rgba(255,255,255,.4) inset;transition:border-color .16s ease,box-shadow .16s ease}.dshcs-win:hover{border-color:color-mix(in srgb,var(--dshcs-accent) 28%,var(--dsw-alias-border-l2,#dfe3eb));box-shadow:0 2px 5px rgba(13,22,38,.1),0 22px 58px rgba(13,22,38,.24),0 0 0 1px rgba(255,255,255,.5) inset}.dshcs-win[data-interaction]{transition:none;user-select:none}.dshcs-win[data-interaction]::after{content:"";position:absolute;inset:0;z-index:18;background:transparent}.dshcs-win-max{border-radius:14px;z-index:2147483001;box-shadow:0 1px 2px rgba(13,22,38,.06),0 8px 24px rgba(13,22,38,.12)}.dshcs-win-max:hover{box-shadow:0 1px 2px rgba(13,22,38,.06),0 10px 28px rgba(13,22,38,.14)}.dshcs-win-snap{border-color:color-mix(in srgb,var(--dshcs-accent) 70%,var(--dsw-alias-border-l2,#dfe3eb));box-shadow:0 0 0 3px color-mix(in srgb,var(--dshcs-accent) 26%,transparent),0 22px 58px rgba(13,22,38,.24),0 0 0 1px rgba(255,255,255,.5) inset}.dshcs-snapghost{position:fixed;left:0;top:0;z-index:2147483000;pointer-events:none;display:grid;place-items:center;border:1.5px solid color-mix(in srgb,var(--dshcs-accent,#5b6cff) 85%,transparent);background:color-mix(in srgb,var(--dshcs-accent,#5b6cff) 11%,transparent);border-radius:12px;box-shadow:0 0 0 3px color-mix(in srgb,var(--dshcs-accent,#5b6cff) 20%,transparent),0 10px 34px rgba(13,22,38,.14)}.dshcs-snapghint{position:absolute;top:12px;left:50%;transform:translateX(-50%);padding:5px 14px;border-radius:999px;background:color-mix(in srgb,var(--dshcs-accent,#5b6cff) 92%,#172033);color:#fff;font-size:12px;font-weight:650;letter-spacing:.02em;white-space:nowrap;box-shadow:0 6px 18px rgba(13,22,38,.3)}.dshcs-drag{position:absolute;top:0;left:0;right:0;height:14px;z-index:26;cursor:grab;touch-action:none;user-select:none}.dshcs-win[data-interaction=move] .dshcs-drag{cursor:grabbing}.dshcs-win-max .dshcs-drag{cursor:default}.dshcs-drag:hover{background:color-mix(in srgb,var(--dsw-alias-label-primary,#172033) 5%,transparent)}.dshcs-body{position:relative;display:flex;flex:1;min-width:0;min-height:0;flex-direction:column;background:var(--dsw-alias-bg-base,#fff)}.dshcs-body[hidden]{display:none}.dshcs-frame{display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;border:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-empty{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;padding:44px 24px 24px}.dshcs-emptybox{max-width:560px;text-align:left;background:var(--dsw-alias-bg-layer-2,#f7f8fb);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;padding:16px 18px}.dshcs-error{color:var(--dsw-alias-label-error,#d92d20);white-space:pre-wrap;word-break:break-all;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin:8px 0 0}.dshcs-hint{color:var(--dsw-alias-label-tertiary,#7d8798);font-size:12px;margin:6px 0 0}.dshcs-resize{position:absolute;z-index:24;display:block;touch-action:none}.dshcs-resize-n,.dshcs-resize-s{left:16px;right:16px;height:10px;cursor:ns-resize}.dshcs-resize-n{top:0}.dshcs-resize-s{bottom:0}.dshcs-resize-w,.dshcs-resize-e{top:16px;bottom:16px;width:10px;cursor:ew-resize}.dshcs-resize-w{left:0}.dshcs-resize-e{right:0}.dshcs-resize-nw,.dshcs-resize-ne,.dshcs-resize-sw,.dshcs-resize-se{width:18px;height:18px}.dshcs-resize-nw{left:0;top:0;cursor:nwse-resize}.dshcs-resize-ne{right:0;top:0;cursor:nesw-resize}.dshcs-resize-sw{left:0;bottom:0;cursor:nesw-resize}.dshcs-resize-se{right:0;bottom:0;cursor:nwse-resize}.dshcs-resize-se::after{content:"";position:absolute;right:4px;bottom:4px;width:7px;height:7px;border-right:1.5px solid color-mix(in srgb,var(--dsw-alias-label-tertiary,#7d8798) 58%,transparent);border-bottom:1.5px solid color-mix(in srgb,var(--dsw-alias-label-tertiary,#7d8798) 58%,transparent);border-radius:0 0 2px}.dshcs-ball{position:fixed;width:38px;height:38px;padding:0;border:1px solid color-mix(in srgb,var(--dsw-alias-border-l2,#dfe3eb) 80%,transparent);border-radius:50%;display:grid;place-items:center;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none;z-index:2147483002;background:color-mix(in srgb,var(--dsw-alias-bg-layer-2,#f2f4f8) 88%,transparent);backdrop-filter:blur(8px) saturate(1.2);box-shadow:0 8px 20px rgba(13,22,38,.18),0 1px 2px rgba(13,22,38,.1);transition:transform .16s ease,box-shadow .16s ease,background .16s ease,border-color .16s ease}.dshcs-ball img,.dshcs-ball svg{-webkit-user-drag:none;user-drag:none}.dshcs-ball[data-dragging]{cursor:grabbing;transform:scale(1.06);box-shadow:0 14px 28px rgba(13,22,38,.28),0 2px 6px rgba(13,22,38,.16)}.dshcs-ball:hover{transform:scale(1.06);box-shadow:0 10px 24px rgba(13,22,38,.22),0 1px 2px rgba(13,22,38,.1)}.dshcs-ball:active{transform:scale(.94)}.dshcs-ball:focus-visible{outline:2px solid color-mix(in srgb,var(--dshcs-accent) 65%,transparent);outline-offset:2px}.dshcs-ball-open{background:color-mix(in srgb,var(--dshcs-accent) 14%,var(--dsw-alias-bg-layer-2,#f2f4f8));border-color:color-mix(in srgb,var(--dshcs-accent) 55%,var(--dsw-alias-border-l2,#dfe3eb));box-shadow:0 0 0 3px color-mix(in srgb,var(--dshcs-accent) 22%,transparent),0 0 20px color-mix(in srgb,var(--dshcs-accent) 38%,transparent),0 8px 20px rgba(13,22,38,.16);transform:scale(1.08)}.dshcs-ball-dot{position:absolute;top:-2px;right:-2px;width:9px;height:9px;border-radius:50%;background:#20a66a;border:2px solid var(--dsw-alias-bg-base,#fff)}.dshcs-ball-dot[data-status=starting]{background:#d78b25}.dshcs-ball-dot[data-status=error]{background:#f85149}.dshcs-ball-dot[data-status=idle]{background:#7d8798}.dshcs-ball-dot[data-status=running]::after{content:"";position:absolute;inset:-4px;border-radius:50%;border:1px solid currentColor;opacity:.3;animation:dshcs-pulse 2s ease-out infinite}@keyframes dshcs-pulse{0%{transform:scale(.7);opacity:.35}70%,100%{transform:scale(1.65);opacity:0}}',Jl="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(Jl)+"]")===null&&(mn=document.createElement("style"),mn.setAttribute("data-dshcs",Jl),mn.textContent=lm,document.head.appendChild(mn));var mn;function cm(t){var[e,r]=y.useState(!1),o=y.useRef(t.url);return y.useEffect(function(){o.current!==t.url&&(o.current=t.url,r(!1))},[t.url]),t.url!=null&&e!==!0?y.createElement("img",{src:t.url,key:"img-"+t.url,alt:"","aria-hidden":!0,draggable:!1,onError:function(){r(!0)},style:{width:20,height:20,display:"block",objectFit:"contain",borderRadius:3,WebkitUserDrag:"none",userSelect:"none"}}):y.createElement("svg",{viewBox:"0 0 18 18","aria-hidden":!0,style:{width:17,height:17}},y.createElement("rect",{x:"3",y:"3",width:"12",height:"12",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:1.4}),y.createElement("path",{d:"M3 7h12M7 3v12",fill:"none",stroke:"currentColor",strokeWidth:1.4}))}var Ql=38,We=8,ic="dshcs-ball-pos";function Ni(t){var e=Math.max(We,window.innerWidth-We-Ql),r=Math.max(We,window.innerHeight-We-Ql);return{x:Math.min(e,Math.max(We,t.x)),y:Math.min(r,Math.max(We,t.y))}}function um(){try{var t=window.localStorage.getItem(ic);if(t==null)return null;var e=JSON.parse(t);if(e!=null&&typeof e.x=="number"&&typeof e.y=="number"&&isFinite(e.x)&&isFinite(e.y))return Ni(e)}catch(r){}return null}function fm(t){try{window.localStorage.setItem(ic,JSON.stringify(t))}catch(e){}}function mm(t){var e=ec(),r=e.status,o=r!=null?r.env:null,n=r!=null&&r.running===!0,s=n?"running":r!=null&&r.status==="starting"?"starting":r!=null&&r.status==="error"?"error":"idle",i=nc(r!=null?r.reserveComposer:!0),a=e.open===!0,c=n&&r!=null&&typeof r.url=="string"?r.url+"_static/src/browser/media/favicon-dark-support.svg":null,[u,l]=y.useState(um),[f,m]=y.useState(!1),p=y.useRef(null),d=y.useRef(!1);if(y.useEffect(function(){var v=function(){l(function(S){return S==null?S:Ni(S)})};return window.addEventListener("resize",v),function(){window.removeEventListener("resize",v)}},[]),o!=null&&o.ok!==!0)return null;var h=function(v){if(v.button===0){var S=v.currentTarget,C=S.getBoundingClientRect();p.current={pointerId:v.pointerId,dx:v.clientX-C.left,dy:v.clientY-C.top,moved:!1},d.current=!1,m(!0);try{S.setPointerCapture(v.pointerId)}catch(A){}}},g=function(v){var S=p.current;if(!(S==null||v.pointerId!==S.pointerId)){var C=v.clientX-S.dx,A=v.clientY-S.dy;(Math.abs(C-(u!=null?u.x:0))>2||Math.abs(A-(u!=null?u.y:0))>2)&&(S.moved=!0),l(Ni({x:C,y:A}))}},x=function(){var v=p.current;p.current=null,m(!1),v!=null&&v.moved===!0&&(d.current=!0),v!=null&&v.moved===!0&&l(function(S){return S!=null&&fm(S),S})},w=function(){if(d.current===!0){d.current=!1;return}Bt({open:!a})},b=u!=null?{left:u.x,top:u.y}:{right:14,bottom:i>0?i+10:18};return tc.createPortal(y.createElement("button",{type:"button",className:"dshcs-ball"+(a?" dshcs-ball-open":""),style:b,"data-dragging":f===!0?"":void 0,title:a?"\u6536\u8D77 Code Server(Esc)":"\u6253\u5F00 Code Server(\u53EF\u62D6\u52A8)","aria-label":a?"\u6536\u8D77 Code Server(Esc)":"\u6253\u5F00 Code Server","aria-expanded":a,onPointerDown:h,onPointerMove:g,onPointerUp:x,onPointerCancel:x,onDragStart:function(v){v&&v.preventDefault&&v.preventDefault()},onClick:w},y.createElement(cm,{url:c}),y.createElement("span",{className:"dshcs-ball-dot","data-status":s,"aria-hidden":!0})),document.body)}function pm(t){var e=ec(),r=e.status,o=r!=null&&r.ok===!0&&r.running===!0,n=r!=null&&r.status==="starting",s=r!=null&&r.ok===!1,i=tm(t&&t.useSessions,t&&t.useWorkspaces),a=y.useRef(void 0),[c,u]=y.useState(0),l=nc(r!=null?r.reserveComposer:!0),[f,m]=y.useState(!1),[p,d]=y.useState(null),[h,g]=y.useState(function(){return nm(0,Ct(),l)}),x=y.useRef(h),w=y.useRef(function(){});x.current=h,y.useEffect(function(){var D=function(){g(function(J){return f?fn(Ct(),l):Ue(J,Ct(),l)})};return window.addEventListener("resize",D),function(){window.removeEventListener("resize",D)}},[f,l]),y.useEffect(function(){g(function(D){return Ue(D,Ct(),l)})},[l]),y.useEffect(function(){return function(){w.current()}},[]);var b=12,v=4,[S,C]=y.useState(!1),A=y.useRef(null),V=function(D,J){if(D.button===0){D.preventDefault(),D.stopPropagation(),w.current();var nt=D.currentTarget.ownerDocument.defaultView;if(nt!==null){var mt=D.pointerId,Or=D.currentTarget,ji=f,He=ji?fn(Ct(),l):x.current,lc=He.width>0?(D.clientX-He.x)/He.width:0,cc=Math.min(14,Math.max(0,D.clientY-He.y)),N={pointerId:mt,origin:{x:D.clientX,y:D.clientY},start:He,ratio:lc,grabY:cc,wasMaximized:ji,restored:!1,snapped:!1,moved:!1};A.current=N,d(J);try{Or.setPointerCapture(mt)}catch(lt){}var zi=function(lt){if(lt.pointerId===mt){if(J!=="move"){g(am(N.start,J,lt.clientX-N.origin.x,lt.clientY-N.origin.y,Ct(),l));return}var Wi=lt.clientX-N.origin.x,Nr=lt.clientY-N.origin.y;if(Math.abs(Wi)+Math.abs(Nr)>3&&(N.moved=!0),N.wasMaximized&&!N.restored){if(Nr<v)return;var gn=x.current,jr={x:lt.clientX-gn.width*Math.min(.9,Math.max(.1,N.ratio)),y:lt.clientY-N.grabY,width:gn.width,height:gn.height};jr=Ue(jr,Ct(),l),N.restored=!0,N.start=jr,N.origin={x:lt.clientX,y:lt.clientY},m(!1),g(jr);return}var uc=N.start.y+Nr,fc=sm(N.start,Wi,Nr,Ct(),l);g(fc);var xn=uc<=b;xn!==N.snapped&&(N.snapped=xn,C(xn))}},Gi=function(){nt.removeEventListener("pointermove",zi),nt.removeEventListener("pointerup",Fr),nt.removeEventListener("pointercancel",Fr),w.current=function(){},A.current=null;try{Or.releasePointerCapture(mt)}catch(lt){}},Fr=function(lt){lt.pointerId===mt&&(Gi(),d(null),(!N.wasMaximized||N.restored===!0)&&(N.snapped===!0&&N.moved===!0&&m(!0),N.snapped===!0&&C(!1)))};w.current=Gi,nt.addEventListener("pointermove",zi),nt.addEventListener("pointerup",Fr),nt.addEventListener("pointercancel",Fr)}}},L=function(){m(function(D){return!D})},P=function(D){D.target.closest("[data-window-control]")===null&&V(D,"move")},B=function(D){D.target.closest("[data-window-control]")===null&&L()};if(y.useEffect(function(){if(!e.open)return;var D=!1;async function J(){Bt({busy:!0});var nt=await Jt("/code-server/status");if(!D){if(nt!=null&&nt.ok===!0&&nt.running===!0){Bt({status:nt,busy:!1});return}var mt=await Jt("/code-server/start",typeof i=="string"?{cwd:i}:{});D||Bt({status:mt,busy:!1})}}return J(),function(){D=!0}},[e.open]),y.useEffect(function(){if(!e.open||typeof i!="string"||i===""||a.current===i)return;var D=a.current!==void 0&&a.current!==i;a.current=i;var J=!1;async function nt(){Bt({busy:!0});var mt=await Jt("/code-server/start",{cwd:i});J||(Bt({status:mt,busy:!1}),D&&mt!=null&&mt.ok===!0&&mt.running===!0&&u(function(Or){return Or+1}))}return nt(),function(){J=!0}},[e.open,i]),y.useEffect(function(){e.open||(a.current=void 0)},[e.open]),y.useEffect(function(){if(e.open){var D=window.setInterval(function(){Jt("/code-server/status").then(function(J){Bt({status:J})})},3e3);return function(){window.clearInterval(D)}}},[e.open]),y.useEffect(function(){if(!e.open)return;function D(J){J.key==="Escape"&&Bt({open:!1})}return window.addEventListener("keydown",D),function(){window.removeEventListener("keydown",D)}},[e.open]),!e.open)return null;var R=r!=null&&typeof r.url=="string"?r.url:null,Z=o&&r!=null&&typeof r.cwd=="string"&&r.cwd!==""?r.cwd:null,I=null;if(Z!==null){var tt=Z.replace(/\\/g,"/");I=tt,(/^[A-Za-z]:\//.test(tt)||tt.charCodeAt(0)!==47)&&(I="/"+tt)}var at=R!==null?R+(I!==null?"?folder="+encodeURIComponent(I):""):null,Ir;if(o&&at!==null)Ir=y.createElement("iframe",{key:c,className:"dshcs-frame",src:at,title:"code-server",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock"});else{var K=s&&r!=null&&r.error?r.error:n?"\u6B63\u5728\u542F\u52A8 code-server\u2026":"code-server \u672A\u8FD0\u884C";Ir=y.createElement("div",{className:"dshcs-empty"},y.createElement("div",{className:"dshcs-emptybox"},y.createElement("div",null,n?"\u6B63\u5728\u542F\u52A8 code-server\u2026":s?"code-server \u542F\u52A8\u5931\u8D25":"code-server \u672A\u8FD0\u884C"),y.createElement("pre",{className:"dshcs-error"},K),y.createElement("p",{className:"dshcs-hint"},"\u5B89\u88C5\u547D\u4EE4(Windows \u539F\u751F):npm install -g code-server@latest(\u9700\u914D\u5957\u6700\u65B0\u7248 node-gyp \u4E0E VS Spectre \u7F13\u89E3\u5E93);\u6216\u5728 cordis.patch.yml \u7684 code-server config \u4E2D\u8BBE\u7F6E bin \u6307\u5411\u5DF2\u5B89\u88C5\u4F4D\u7F6E\u3002\u7AEF\u53E3 "+(r!=null?r.port:"8090")+" \u88AB\u5360\u7528\u65F6\u8BF7\u91CA\u653E\u6216\u4FEE\u6539 port \u914D\u7F6E\u3002")))}var ot=["dshcs-win",f?"dshcs-win-max":"",S?"dshcs-win-snap":""].filter(Boolean).join(" "),ft=f?fn(Ct(),l):h,Ot={x:ft.x,y:ft.y,width:ft.width,height:ft.height},hn=p!==null?{duration:0}:{type:"spring",stiffness:430,damping:42,mass:.9},sc=y.createElement(Bi.section,{className:ot,style:{left:0,top:0},animate:Ot,initial:!1,transition:hn,"data-interaction":p!==null?p:void 0,role:"dialog","aria-label":"Code Server"},y.createElement("span",{className:"dshcs-drag",title:"\u62D6\u52A8\u79FB\u52A8 / \u53CC\u51FB\u6700\u5927\u5316",onPointerDown:P,onDoubleClick:B}),y.createElement("div",{className:"dshcs-body"},Ir),f?null:em.map(function(D){return y.createElement("span",{key:D,className:"dshcs-resize dshcs-resize-"+D,"data-direction":D,onPointerDown:function(J){V(J,D)}})})),Br=fn(Ct(),l),ac=y.createElement(Bi.div,{className:"dshcs-snapghost",initial:!1,animate:{opacity:S===!0?1:0,x:Br.x,y:Br.y,width:Br.width,height:Br.height},transition:S===!0?{type:"spring",stiffness:500,damping:44,mass:.9}:{duration:.14}},y.createElement("span",{className:"dshcs-snapghint"},"\u677E\u5F00\u4EE5\u6700\u5927\u5316"));return tc.createPortal(y.createElement(y.Fragment,null,sc,ac),document.body)}var dm=".dshcs-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dshcs-card:hover{border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dshcs-cardHeader:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.dshcs-cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dshcs-cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.dshcs-cardDescription{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:13px;line-height:1.5}.dshcs-cardChevron{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));flex:none;transition:transform .16s;display:inline-flex}.dshcs-cardChevronOpen{transform:rotate(180deg)}.dshcs-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.dshcs-cardReadOnly{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:12px 0 0;font-size:12px;line-height:1.5}.dshcs-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-cardFooter{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.dshcs-cardFailed{min-width:0;color:var(--dsw-alias-label-error,var(--dsw-alias-state-error-primary));flex:1;margin:0;font-size:12px;line-height:1.5}.dshcs-cbtn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;border:1px solid transparent;transition:color .12s ease,background .12s ease}.dshcs-cbtn:disabled{opacity:.4;cursor:default}.dshcs-cbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.dshcs-cbtnOutline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.dshcs-cbtnOutline:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover,transparent)}.dshcs-cbtnPrimary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary);font-weight:600}.dshcs-cbtnPrimary:hover:not(:disabled){filter:brightness(.95)}.dshcs-cbtnPrimary:active:not(:disabled){filter:brightness(.9)}.dshcs-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.dshcs-field+.dshcs-field{border-top:1px solid var(--dsw-alias-border-l2)}.dshcs-fieldHead{align-items:center;gap:8px;display:flex}.dshcs-fieldLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.dshcs-hint{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:0;font-size:12px;line-height:1.5}.dshcs-check{display:flex;align-items:center;gap:8px;cursor:pointer}.dshcs-check input{accent-color:var(--dsw-alias-brand-primary);width:15px;height:15px;margin:0;flex:none}.dshcs-check input:disabled{cursor:default}.dshcs-badges{align-items:center;gap:8px;display:inline-flex}.dshcs-badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.dshcs-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshcs-reset:disabled{cursor:default}",hm="dsh-code-server/Card.module.css";function gm(t,e){if(typeof document!="undefined"&&document.querySelector("style[data-plugin-css="+JSON.stringify(t)+"]")===null){var r=document.createElement("style");r.dataset.plugin="dsh-code-server",r.dataset.pluginCss=t,r.textContent=e,document.head.appendChild(r)}}gm(hm,dm);function xm(t){return y.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,className:t.className},y.createElement("path",{d:"M3.5 5.25L7 8.75L10.5 5.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))}function pn(t){return y.createElement("button",{type:"button",className:"dshcs-cbtn "+(t.variant==="primary"?"dshcs-cbtnPrimary":"dshcs-cbtnOutline"),disabled:t.disabled===!0,onClick:t.onClick},t.children)}function ym(t){return y.createElement("label",{className:"dshcs-check"},y.createElement("input",{type:"checkbox",checked:t.checked===!0,disabled:t.disabled===!0,onChange:function(e){t.onChange(e.target.checked)}}),y.createElement("span",{className:"dshcs-hint"},t.children))}function vm(t){var e=[];return t.overridden===!0&&(e.push(y.createElement("span",{className:"dshcs-badge"},t.overriddenLabel)),e.push(y.createElement("button",{type:"button",className:"dshcs-reset",disabled:t.disabled===!0,onClick:t.onReset},t.resetLabel))),e.length===0?null:y.createElement("span",{className:"dshcs-badges"},...e)}function bm(t){var[e,r]=y.useState(!1),o=t.state;if(o==null||o.available!==!0)return null;var n=t.title,s=o.dirty!==!0||o.invalid===!0||o.saving===!0;return y.createElement("li",{className:"dshcs-card"+(e?" dshcs-cardOpen":"")},y.createElement("button",{type:"button",className:"dshcs-cardHeader","aria-expanded":e,onClick:function(){r(!e)}},y.createElement("span",{className:"dshcs-cardHeadText"},y.createElement("span",{className:"dshcs-cardName"},n),y.createElement("span",{className:"dshcs-cardDescription"},t.description)),o.dirty===!0?y.createElement("span",{className:"dshcs-pending"},t.unsavedLabel):null,y.createElement(xm,{className:"dshcs-cardChevron"+(e?" dshcs-cardChevronOpen":"")})),e===!0?y.createElement("div",{className:"dshcs-cardBody"},o.writable!==!0?y.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},t.readOnlyLabel):null,t.children,y.createElement("div",{className:"dshcs-cardFooter"},o.failed===!0?y.createElement("p",{className:"dshcs-cardFailed",role:"status"},t.saveFailedLabel):null,y.createElement(pn,{disabled:o.dirty!==!0||o.saving===!0,onClick:t.onDiscard},t.discardLabel),y.createElement(pn,{variant:"primary",disabled:s,onClick:t.onSave},o.saving===!0?t.savingLabel:t.saveLabel))):null)}function wm(t){try{var e=t.scope,[r,o]=y.useState(function(){return e!==void 0?e.getSnapshot():null}),[n,s]=y.useState(null),[i,a]=y.useState(!1),[c,u]=y.useState(!1);if(y.useEffect(function(){if(e===void 0||typeof e.subscribe!="function")return;function R(){try{o(e.getSnapshot())}catch(I){}}var Z=e.subscribe(R);return function(){typeof Z=="function"&&Z()}},[e]),e===void 0)return console.error("[code-server] card scope missing"),null;if(r==null||r.status!=="ready")return r!=null&&r.status==="unavailable"&&console.warn("[code-server] settings scope unavailable:",r.status),null;var l=r.value!==void 0&&r.value!==null?r.value:{},f=r.user,m=l.reserveComposer===!0,p=f!=null&&Object.prototype.hasOwnProperty.call(f,"reserveComposer"),d=n!==null&&n!==m,h=!d||i,g={available:!0,writable:r.writable,dirty:d,invalid:!1,saving:i,failed:c,reserveComposer:{text:n!==null?n:m,overridden:p}};async function L(){if(d&&!i){a(!0),u(!1);try{await t.scope.set("reserveComposer",n===!0),s(null)}catch(R){u(!0)}a(!1)}}async function P(){if(!(i||r.writable!==!0)){a(!0),u(!1);try{typeof t.scope.unset=="function"?await t.scope.unset("reserveComposer"):await t.scope.set("reserveComposer",l.reserveComposer===void 0||l.reserveComposer===null?!0:l.reserveComposer),s(null)}catch(R){u(!0)}a(!1)}}var[x,w]=y.useState(null),[b,v]=y.useState(!1),[S,C]=y.useState(null),A=y.useRef(!0);y.useEffect(function(){return A.current=!0,function(){A.current=!1}},[]);async function B(){if(b)return;v(!0),C(null);var R=await Jt("/code-server/setup",{});if(R==null||R.ok!==!0){C(R!=null&&R.error?R.error:"\u542F\u52A8\u5B89\u88C5\u5931\u8D25"),v(!1);return}C("\u73AF\u5883\u5B89\u88C5\u5DF2\u5728\u540E\u53F0\u5F00\u59CB,\u5B8C\u6210\u540E\u81EA\u52A8\u5237\u65B0\u2026");function Z(){A.current===!0&&Jt("/code-server/status").then(function(I){if(A.current===!0){if(I==null||I.setup==null){v(!1);return}if(I.setup.running===!0){setTimeout(Z,2e3);return}v(!1),w(I.env!=null?I.env:{error:"status \u672A\u8FD4\u56DE env"}),C(I.setup.ok===!0?"\u73AF\u5883\u5B89\u88C5\u5B8C\u6210":`\u73AF\u5883\u5B89\u88C5\u5931\u8D25:
3
+ `+(I.setup.logTail!=null?I.setup.logTail.slice(-600):"(\u65E0\u65E5\u5FD7)"))}})}Z()}var V=y.createElement("div",{className:"dshcs-field"},y.createElement("div",{className:"dshcs-fieldHead"},y.createElement("span",{className:"dshcs-fieldLabel"},"\u73AF\u5883\u68C0\u6D4B"),y.createElement("span",{className:"dshcs-badges"},y.createElement(pn,{variant:"primary",disabled:b,onClick:async function(){v(!0),C(null);var R=await Jt("/code-server/status");w(R!=null&&R.env!=null?R.env:{error:"status \u672A\u8FD4\u56DE env"}),v(!1)}},"\u68C0\u6D4B\u73AF\u5883"),y.createElement(pn,{disabled:b,onClick:function(){B()}},b?"\u5B89\u88C5\u4E2D\u2026":"\u5B89\u88C5\u73AF\u5883"))),x!=null?y.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},x.error!=null?y.createElement("span",null,"\u68C0\u6D4B\u5931\u8D25: "+x.error):y.createElement("span",null,"\u72B6\u6001: "+(x.ok===!0?"\u2705 \u5C31\u7EEA":"\u274C \u4E0D\u901A\u8FC7")+(x.entry!=null?" \xB7 \u5165\u53E3: "+x.entry:" \xB7 \u5165\u53E3\u7F3A\u5931")+" \xB7 native: "+(x.native===!0?"\u2705":"\u274C")+" \xB7 VS Code \u5185\u90E8\u4F9D\u8D56: "+(x.vscodeInner===!0?"\u2705":"\u274C"))):y.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},'\u70B9\u51FB"\u68C0\u6D4B\u73AF\u5883"\u67E5\u770B code-server \u5B89\u88C5\u72B6\u6001'),S!=null?y.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},S):null,y.createElement("div",{className:"dshcs-hint",style:{marginTop:10,color:"var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary))"}},"\u5B89\u88C5\u4F4D\u7F6E: "+(x!=null&&x.entry!=null?x.entry:"(profile)\\.code-server-app(\u5F85\u5B89\u88C5\u540E\u53EF\u67E5\u770B)")+`
4
+ \u5378\u8F7D: \u5148\u624B\u52A8\u5220\u9664 .code-server-app \u76EE\u5F55,\u518D dsh plugin --profile web remove dsh-code-server-app`));return y.createElement(bm,{title:"Code Server",description:"\u7A97\u53E3\u884C\u4E3A:\u662F\u5426\u4FDD\u7559\u8F93\u5165\u6846\u4E0A\u65B9\u7A7A\u95F4(\u4E0D\u906E\u6321 composer)",state:g,unsavedLabel:"\u672A\u4FDD\u5B58",readOnlyLabel:"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002",saveFailedLabel:"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002",discardLabel:"\u653E\u5F03\u4FEE\u6539",saveLabel:"\u4FDD\u5B58",savingLabel:"\u4FDD\u5B58\u4E2D\u2026",onSave:L,onDiscard:function(){s(null),u(!1)}},y.createElement("div",{className:"dshcs-field"},y.createElement("div",{className:"dshcs-fieldHead"},y.createElement("span",{className:"dshcs-fieldLabel"},"\u4FDD\u7559\u8F93\u5165\u6846\u4E0A\u65B9\u7A7A\u95F4"),p===!0?y.createElement(vm,{overridden:!0,disabled:r.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){P()}}):null),y.createElement(ym,{checked:n!==null?n:m,disabled:r.writable!==!0,onChange:function(R){s(R===!0),u(!1)}},"\u5F00\u542F\u65F6\u7A97\u53E3\u521D\u59CB/\u7F29\u653E/\u6700\u5927\u5316\u6B62\u4E8E\u8F93\u5165\u6846\u4E0A\u65B9;\u5173\u95ED\u540E\u5141\u8BB8\u76D6\u4F4F\u8F93\u5165\u6846(\u6700\u5927\u5316\u5230\u89C6\u53E3\u5E95)")),V)}catch(L){return console.error("[code-server] card render error:",L!=null&&L.message!==void 0?L.message:String(L)),null}}function Tm(t){try{Sm(t)}catch(e){console.error("[code-server] apply failed:",e&&e.stack?e.stack:String(e));try{document.title="CS-ERR "+(e&&e.message||String(e))}catch(r){}}}function Sm(t){var e=t.get("slots");if(e===void 0){console.error("[code-server] slots service unavailable");return}Jt("/code-server/status").then(function(n){Bt({status:n})}).catch(function(){}),e.inject("shell.overlay",()=>e.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},n=>y.createElement(y.Fragment,null,y.createElement(mm,n),y.createElement(pm,n))));var r=t.settingsScope;if(r===void 0||typeof r.bind!="function"){console.error("[code-server] settingsScope unavailable (inject missing?); settings card disabled");return}var o=r.bind({namespace:"code-server"});e.inject("settings.plugin.item",()=>e.register({name:"settings.plugin.item",key:"code-server",label:"Code Server",inject:function(){return{scope:o}}},wm)),console.log("[code-server] client bundle registered (floating ball + window + settings card)")}var Vm=["slots","settingsScope"],Pm="code-server";
5
+ return module.exports;}});
30
6
 
31
- // ---------- 模块级共享 store(两个 occupant 之间同步 open/status) ----------
32
- var listeners = new Set()
33
- var state = { open: false, status: null, busy: false }
34
- function setState(patch) {
35
- state = Object.assign({}, state, patch)
36
- listeners.forEach(function (fn) { fn() })
37
- }
38
- function subscribe(fn) {
39
- listeners.add(fn)
40
- return function () { listeners.delete(fn) }
41
- }
42
- function getState() { return state }
43
- function useStore() {
44
- return React.useSyncExternalStore(subscribe, getState)
45
- }
46
-
47
- // ---------- /code-server API ----------
48
- async function api(path, body) {
49
- var options = { method: body === undefined ? 'GET' : 'POST', headers: {} }
50
- if (body !== undefined) {
51
- options.headers['content-type'] = 'application/json'
52
- options.body = JSON.stringify(body)
53
- }
54
- var res = await fetch(path, options)
55
- var text = await res.text()
56
- var data = null
57
- try { data = text === '' ? null : JSON.parse(text) } catch (e) { data = null }
58
- if (!res.ok) return { ok: false, error: 'HTTP ' + res.status + (data !== null && data.error !== undefined ? ': ' + data.error : '') }
59
- return data !== null ? data : { ok: false, error: 'invalid JSON response' }
60
- }
61
-
62
- // 解析当前活动工作区目录,优先级:
63
- // 1. 当前会话的 cwd(useSessions.byId[current].cwd)
64
- // 2. 当前会话所属 workspace 的 path(workspace.sessionIds 含 current)
65
- // 3. recentWorkspaceId 对应 workspace 的 path
66
- // 4. 第一个 workspace 的 path
67
- // 均缺失时返回 undefined(调用方不传 cwd,由 host 保留当前目录)。
68
- function activeWorkspaceCwd(useSessions, useWorkspaces) {
69
- try {
70
- var list = useSessions(function (s) { return s })
71
- var wsList = useWorkspaces === null ? null : (typeof useWorkspaces === 'function' ? useWorkspaces(function (s) { return s }) : null)
72
- var current = list != null ? list.current : undefined
73
- if (current !== undefined && list != null && list.byId != null) {
74
- var cur = list.byId[current]
75
- if (cur != null && typeof cur.cwd === 'string' && cur.cwd !== '') return cur.cwd
76
- }
77
- var items = wsList != null && Array.isArray(wsList.items) ? wsList.items : []
78
- if (current !== undefined) {
79
- for (var i = 0; i < items.length; i++) {
80
- var w = items[i]
81
- if (w.sessionIds != null && w.sessionIds.indexOf(current) !== -1 && typeof w.path === 'string' && w.path !== '') return w.path
82
- }
83
- }
84
- var recentId = wsList != null ? wsList.recentWorkspaceId : undefined
85
- if (recentId !== undefined) {
86
- for (var j = 0; j < items.length; j++) {
87
- if (items[j].workspaceId === recentId && typeof items[j].path === 'string' && items[j].path !== '') return items[j].path
88
- }
89
- }
90
- if (items.length > 0 && typeof items[0].path === 'string' && items[0].path !== '') return items[0].path
91
- } catch (e) { /* props 未提供时静默 */ }
92
- return undefined
93
- }
94
-
95
- // ---------- 窗口几何(复刻 univer-office 的 fit/move/resize) ----------
96
- // 底部预留输入栏高度(可在设置卡片切换):true 时窗口初始/缩放/最大化
97
- // 都止于输入框上方,不遮挡 composer;false 时允许盖住输入框(最大化到视口底)。
98
- var RESIZE_DIRECTIONS = ['nw', 'n', 'ne', 'w', 'e', 'sw', 's', 'se']
99
- var VIEWPORT_GUTTER = 12
100
- var DEFAULT_WIDTH = 720
101
- var DEFAULT_HEIGHT = 520
102
- var MIN_WIDTH = 360
103
- var MIN_HEIGHT = 260
104
- var CASCADE_OFFSET = 24
105
- var COMPOSER_RESERVE_DEFAULT = 148 // 输入框 + 下发 dock 的近似高度(测量失败时的回退)
106
-
107
- /** 输入区预留:flag=false(用户允许)不保留 → 0。
108
- * flag=true(默认)时:若 composer 贴住视口底(会话页/对话中),让最大化窗口
109
- * 底边贴到 composer 输入卡顶部——窗口压住消息区,下面只露出输入框;
110
- * 若 composer 不在底部(hero 页/新会话描述画面),输入框在页面中间,
111
- * 最大化直接全屏(0),避免在输入框下方露出页面背景渐变。 */
112
- function reserveOf(flag) {
113
- if (flag === false) return 0
114
- try {
115
- if (typeof document === 'undefined') return 0
116
- var seats = document.querySelectorAll('[data-composer-seat]')
117
- if (seats === null || seats.length === 0) return 0 // 无 composer:全屏
118
- var top = Number.POSITIVE_INFINITY
119
- var bottom = 0
120
- for (var i = 0; i < seats.length; i++) {
121
- var rect = seats[i].getBoundingClientRect()
122
- if (rect === null || rect.width <= 0) continue
123
- if (rect.top < top) top = rect.top
124
- if (rect.bottom > bottom) bottom = rect.bottom
125
- }
126
- if (!isFinite(top) || bottom <= 0) return 0
127
- var viewportBottom = window.innerHeight
128
- // composer 未贴底(hero 页,seat 底沿离视口底 > 24px)→ 全屏
129
- if (viewportBottom - bottom > 24) return 0
130
- // 会话页:窗口底边 = 输入卡顶部,下面只留输入框(+ 8px 呼吸边距)
131
- return Math.min(Math.max(1, viewportBottom - top + 8), 420)
132
- } catch (e) {
133
- return 0
134
- }
135
- }
136
- function viewportSize() {
137
- return { width: Math.max(1, window.innerWidth), height: Math.max(1, window.innerHeight) }
138
- }
139
- /** 窗口可用的最大高度:视口高 - 上下 gutter - 输入栏预留(reserve 设为 0 时不预留)。 */
140
- function usableViewport(viewport, reserve) {
141
- return {
142
- width: Math.max(1, viewport.width - VIEWPORT_GUTTER * 2),
143
- height: Math.max(1, viewport.height - VIEWPORT_GUTTER * 2 - reserve),
144
- }
145
- }
146
- function clamp(value, min, max) {
147
- return Math.min(max, Math.max(min, value))
148
- }
149
- function fitRect(rect, viewport, reserve) {
150
- const available = usableViewport(viewport, reserve)
151
- const width = clamp(rect.width, Math.min(MIN_WIDTH, available.width), available.width)
152
- const height = clamp(rect.height, Math.min(MIN_HEIGHT, available.height), available.height)
153
- return {
154
- x: clamp(rect.x, VIEWPORT_GUTTER, Math.max(VIEWPORT_GUTTER, viewport.width - VIEWPORT_GUTTER - width)),
155
- y: clamp(rect.y, VIEWPORT_GUTTER, Math.max(VIEWPORT_GUTTER, viewport.height - VIEWPORT_GUTTER - reserve - height)),
156
- width, height,
157
- }
158
- }
159
- function initialRect(stackIndex, viewport, reserve) {
160
- const available = usableViewport(viewport, reserve)
161
- const width = Math.min(DEFAULT_WIDTH, available.width)
162
- const height = Math.min(DEFAULT_HEIGHT, available.height)
163
- // 初始位置:输入框上方、靠右(右下偏上),级联偏移。
164
- // reserve=0(允许盖住)时初始仍在输入框上方(有效下沿 = composer 顶部,
165
- // 若 composer 贴底则留输入框高度,避免开局就压住输入框);用户想盖住
166
- // 输入框时点"最大化"(或拖到底部)即可,最大化才允许占满视口底。
167
- const composerTop = composerTopOf()
168
- const bottomLimit = composerTop > 0
169
- ? composerTop - 8
170
- : viewport.height - VIEWPORT_GUTTER - reserve
171
- return fitRect({
172
- x: viewport.width - VIEWPORT_GUTTER - width - stackIndex * CASCADE_OFFSET,
173
- y: Math.max(VIEWPORT_GUTTER, bottomLimit - height - stackIndex * CASCADE_OFFSET),
174
- width, height,
175
- }, viewport, reserve)
176
- }
177
- /** composer 输入区顶部(视口坐标);无 composer 时返回 -1。 */
178
- function composerTopOf() {
179
- try {
180
- if (typeof document === 'undefined') return -1
181
- var seats = document.querySelectorAll('[data-composer-seat]')
182
- if (seats === null || seats.length === 0) return -1
183
- var top = Number.POSITIVE_INFINITY
184
- for (var i = 0; i < seats.length; i++) {
185
- var rect = seats[i].getBoundingClientRect()
186
- if (rect !== null && rect.width > 0 && rect.top < top) top = rect.top
187
- }
188
- return isFinite(top) ? top : -1
189
- } catch (e) {
190
- return -1
191
- }
192
- }
193
- function moveRect(start, dx, dy, viewport, reserve) {
194
- return fitRect({ ...start, x: start.x + dx, y: start.y + dy }, viewport, reserve)
195
- }
196
- function resizeRect(start, direction, dx, dy, viewport, reserve) {
197
- const fitted = fitRect(start, viewport, reserve)
198
- const available = usableViewport(viewport, reserve)
199
- const minWidth = Math.min(MIN_WIDTH, available.width)
200
- const minHeight = Math.min(MIN_HEIGHT, available.height)
201
- const bottomLimit = viewport.height - VIEWPORT_GUTTER - reserve
202
- let left = fitted.x
203
- let right = fitted.x + fitted.width
204
- let top = fitted.y
205
- let bottom = fitted.y + fitted.height
206
- if (direction.includes('w')) left = clamp(fitted.x + dx, VIEWPORT_GUTTER, right - minWidth)
207
- if (direction.includes('e')) right = clamp(right + dx, left + minWidth, viewport.width - VIEWPORT_GUTTER)
208
- if (direction.includes('n')) top = clamp(fitted.y + dy, VIEWPORT_GUTTER, bottom - minHeight)
209
- if (direction.includes('s')) bottom = clamp(bottom + dy, top + minHeight, bottomLimit)
210
- return { x: left, y: top, width: right - left, height: bottom - top }
211
- }
212
- /** 最大化矩形:占满"输入栏上方"区域(reserve=0 时到视口底)。 */
213
- function maximizedRect(viewport, reserve) {
214
- const available = usableViewport(viewport, reserve)
215
- return {
216
- x: VIEWPORT_GUTTER,
217
- y: VIEWPORT_GUTTER,
218
- width: available.width,
219
- height: available.height,
220
- }
221
- }
222
-
223
- // ---------- 样式(主题变量 + 兜底值;仅覆盖窗口自身结构) ----------
224
- var CSS =
225
- '.dshcs-root{position:fixed;inset:0;z-index:2147483000;pointer-events:none}' +
226
- '.dshcs-win{--dshcs-accent:#5b6cff;pointer-events:auto;position:fixed;isolation:isolate;z-index:2147483000;display:flex;flex-direction:column;min-width:1px;min-height:1px;overflow:hidden;color:var(--dsw-alias-label-primary,#172033);background:var(--dsw-alias-bg-base,#fff);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:16px;box-shadow:0 1px 2px rgba(13,22,38,.08),0 18px 48px rgba(13,22,38,.2),0 0 0 1px rgba(255,255,255,.4) inset;transition:border-color .16s ease,box-shadow .16s ease}' +
227
- '.dshcs-win:hover{border-color:color-mix(in srgb,var(--dshcs-accent) 28%,var(--dsw-alias-border-l2,#dfe3eb));box-shadow:0 2px 5px rgba(13,22,38,.1),0 22px 58px rgba(13,22,38,.24),0 0 0 1px rgba(255,255,255,.5) inset}' +
228
- '.dshcs-win[data-interaction]{transition:none;user-select:none}' +
229
- '.dshcs-win[data-interaction]::after{content:"";position:absolute;inset:0;z-index:18;background:transparent}' +
230
- '.dshcs-win-folded{height:48px!important}' +
231
- '.dshcs-win-max{border-radius:18px;z-index:2147483001;box-shadow:0 1px 2px rgba(13,22,38,.06),0 8px 24px rgba(13,22,38,.12)}' +
232
- '.dshcs-win-max:hover{box-shadow:0 1px 2px rgba(13,22,38,.06),0 10px 28px rgba(13,22,38,.14)}' +
233
- '.dshcs-header{position:relative;z-index:10;display:flex;align-items:center;gap:10px;height:48px;padding:0 8px 0 10px;flex:none;cursor:grab;touch-action:none;user-select:none;background:linear-gradient(180deg,color-mix(in srgb,var(--dsw-alias-bg-base,#fff) 96%,#7583ff),color-mix(in srgb,var(--dsw-alias-bg-base,#fff) 92%,#dfe3f5));border-bottom:1px solid color-mix(in srgb,var(--dsw-alias-border-l2,#dfe3eb) 78%,transparent)}' +
234
- '.dshcs-win[data-interaction=move] .dshcs-header{cursor:grabbing}.dshcs-win-max .dshcs-header{cursor:default}.dshcs-win-folded .dshcs-header{border-bottom:0}' +
235
- '.dshcs-glyph{display:grid;place-items:center;width:22px;height:22px;flex:none;border-radius:6px;color:#fff;background:transparent}' +
236
- '.dshcs-identity{display:flex;flex-direction:column;justify-content:center;min-width:0;flex:1;line-height:1.2}' +
237
- '.dshcs-title,.dshcs-sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dshcs-title{font-size:12.5px;font-weight:650;letter-spacing:.01em;color:var(--dsw-alias-label-primary,#172033)}.dshcs-sub{margin-top:2px;font-size:10.5px;color:var(--dsw-alias-label-tertiary,#7d8798)}' +
238
- '.dshcs-chip{display:inline-flex;align-items:center;gap:6px;flex:none;padding:3px 8px;border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:999px;font-size:10.5px;font-weight:600;line-height:16px;color:var(--dsw-alias-label-secondary,#566174);background:color-mix(in srgb,var(--dsw-alias-bg-base,#fff) 75%,transparent)}' +
239
- '.dshcs-chip[data-status=running]{color:#16784d;border-color:color-mix(in srgb,#20a66a 30%,var(--dsw-alias-border-l2,#dfe3eb));background:color-mix(in srgb,#20a66a 8%,var(--dsw-alias-bg-base,#fff))}' +
240
- '.dshcs-chip[data-status=starting]{color:#9a6114;border-color:color-mix(in srgb,#d78b25 34%,var(--dsw-alias-border-l2,#dfe3eb));background:color-mix(in srgb,#d78b25 9%,var(--dsw-alias-bg-base,#fff))}' +
241
- '.dshcs-chip[data-status=error]{color:#b42318;border-color:color-mix(in srgb,#f85149 30%,var(--dsw-alias-border-l2,#dfe3eb));background:color-mix(in srgb,#f85149 8%,var(--dsw-alias-bg-base,#fff))}' +
242
- '.dshcs-dot,.dshcs-pulse{position:relative;width:7px;height:7px;border-radius:50%;background:#20a66a;flex:none}.dshcs-pulse::after{content:"";position:absolute;inset:-3px;border-radius:50%;border:1px solid currentColor;opacity:.24;animation:dshcs-pulse 2s ease-out infinite}' +
243
- '.dshcs-chip[data-status=starting] .dshcs-dot{background:#d78b25}.dshcs-chip[data-status=starting] .dshcs-dot::after{content:"";position:absolute;inset:-3px;border-radius:50%;border:1px solid currentColor;opacity:.24;animation:dshcs-pulse 2s ease-out infinite}' +
244
- '.dshcs-chip[data-status=error] .dshcs-dot{background:#f85149}.dshcs-chip[data-status=idle] .dshcs-dot{background:#7d8798}' +
245
- '@keyframes dshcs-pulse{0%{transform:scale(.7);opacity:.35}70%,100%{transform:scale(1.65);opacity:0}}' +
246
- '.dshcs-controls{display:flex;align-items:center;gap:3px;flex:none}' +
247
- '.dshcs-ctl{display:grid;place-items:center;width:28px;height:28px;padding:0;border:0;border-radius:8px;color:var(--dsw-alias-label-secondary,#566174);background:transparent;cursor:pointer;transition:color .12s ease,background .12s ease,transform .12s ease}' +
248
- '.dshcs-ctl:hover{color:var(--dsw-alias-label-primary,#172033);background:color-mix(in srgb,var(--dsw-alias-label-primary,#172033) 8%,transparent)}' +
249
- '.dshcs-ctl:active{transform:scale(.92)}.dshcs-ctl:focus-visible{outline:2px solid color-mix(in srgb,var(--dshcs-accent) 65%,transparent);outline-offset:1px}' +
250
- '.dshcs-ctl[data-danger]:hover{color:#d94242;background:rgba(217,66,66,.1)}' +
251
- '.dshcs-ctl svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}' +
252
- '.dshcs-body{display:flex;flex:1;min-width:0;min-height:0;flex-direction:column;background:var(--dsw-alias-bg-base,#fff)}.dshcs-body[hidden]{display:none}' +
253
- '.dshcs-frame{display:block;flex:1;min-width:0;min-height:0;width:100%;height:100%;border:0;background:var(--dsw-alias-bg-base,#fff)}' +
254
- '.dshcs-empty{flex:1;display:flex;align-items:center;justify-content:center;padding:24px}' +
255
- '.dshcs-emptybox{max-width:560px;text-align:left;background:var(--dsw-alias-bg-layer-2,#f7f8fb);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;padding:16px 18px}' +
256
- '.dshcs-error{color:var(--dsw-alias-label-error,#d92d20);white-space:pre-wrap;word-break:break-all;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin:8px 0 0}' +
257
- '.dshcs-hint{color:var(--dsw-alias-label-tertiary,#7d8798);font-size:12px;margin:6px 0 0}' +
258
- '.dshcs-resize{position:absolute;z-index:20;display:block;touch-action:none}' +
259
- '.dshcs-resize-n,.dshcs-resize-s{left:16px;right:16px;height:10px;cursor:ns-resize}.dshcs-resize-n{top:0}.dshcs-resize-s{bottom:0}' +
260
- '.dshcs-resize-w,.dshcs-resize-e{top:16px;bottom:16px;width:10px;cursor:ew-resize}.dshcs-resize-w{left:0}.dshcs-resize-e{right:0}' +
261
- '.dshcs-resize-nw,.dshcs-resize-ne,.dshcs-resize-sw,.dshcs-resize-se{width:18px;height:18px}' +
262
- '.dshcs-resize-nw{left:0;top:0;cursor:nwse-resize}.dshcs-resize-ne{right:0;top:0;cursor:nesw-resize}.dshcs-resize-sw{left:0;bottom:0;cursor:nesw-resize}.dshcs-resize-se{right:0;bottom:0;cursor:nwse-resize}' +
263
- '.dshcs-resize-se::after{content:"";position:absolute;right:4px;bottom:4px;width:7px;height:7px;border-right:1.5px solid color-mix(in srgb,var(--dsw-alias-label-tertiary,#7d8798) 58%,transparent);border-bottom:1.5px solid color-mix(in srgb,var(--dsw-alias-label-tertiary,#7d8798) 58%,transparent);border-radius:0 0 2px}'
264
- var CSS_TAG = 'dsh-code-server/styles'
265
- if (typeof document !== 'undefined' && document.querySelector('style[data-dshcs=' + JSON.stringify(CSS_TAG) + ']') === null) {
266
- var tag = document.createElement('style')
267
- tag.setAttribute('data-dshcs', CSS_TAG)
268
- tag.textContent = CSS
269
- document.head.appendChild(tag)
270
- }
271
-
272
- // ---------- 小图标 ----------
273
- // code-server 官方徽标:经 _static 路径从运行中的服务取(favicon-dark-support.svg
274
- // 为官方 SVG,支持深色模式);运行 URL 为空时回退自绘格子图标。
275
- function Glyph(props) {
276
- var baseUrl = props && props.baseUrl
277
- var official = typeof baseUrl === 'string' && baseUrl !== ''
278
- ? baseUrl + '_static/src/browser/media/favicon-dark-support.svg'
279
- : null
280
- if (official !== null) {
281
- return React.createElement('img', {
282
- src: official, alt: '', 'aria-hidden': true,
283
- style: { width: 18, height: 18, display: 'block', objectFit: 'contain' },
284
- })
285
- }
286
- // 无运行时 URL(未运行):自绘格子徽标
287
- return React.createElement('svg', { viewBox: '0 0 18 18', 'aria-hidden': true },
288
- React.createElement('rect', { x: '3', y: '3', width: '12', height: '12', rx: '2' }),
289
- React.createElement('path', { d: 'M3 7h12M7 3v12' })
290
- )
291
- }
292
- function FoldIcon(props) {
293
- return React.createElement('svg', { viewBox: '0 0 16 16', 'aria-hidden': true },
294
- props.expanded
295
- ? React.createElement('path', { d: 'm4 10 4-4 4 4' })
296
- : React.createElement('path', { d: 'M4 9h8' })
297
- )
298
- }
299
- function MaximizeIcon(props) {
300
- return React.createElement('svg', { viewBox: '0 0 16 16', 'aria-hidden': true },
301
- props.restored
302
- ? React.createElement(React.Fragment, null,
303
- React.createElement('rect', { x: '3', y: '5', width: '8', height: '8', rx: '1' }),
304
- React.createElement('path', { d: 'M5 5V3h8v8h-2' })
305
- )
306
- : React.createElement('rect', { x: '3', y: '3', width: '10', height: '10', rx: '1.5' })
307
- )
308
- }
309
- function CloseIcon() {
310
- return React.createElement('svg', { viewBox: '0 0 16 16', 'aria-hidden': true },
311
- React.createElement('path', { d: 'm4 4 8 8m0-8-8 8' })
312
- )
313
- }
314
-
315
- // ---------- 侧栏按钮 ----------
316
- // 环境检测不通过时不显示(检测未返回或 ok=false 均隐藏);
317
- // 首次状态由 apply 里的预拉取填充,避免按钮闪烁。
318
- function SidebarAction(props) {
319
- var store = useStore()
320
- var env = store.status != null ? store.status.env : null
321
- if (env == null || env.ok !== true) return null
322
- function openPanel() {
323
- setState({ open: true })
324
- }
325
- var label = store.open ? 'Code Server…' : 'Code Server'
326
- return React.createElement(
327
- 'button',
328
- { type: 'button', onClick: openPanel, title: '在 DSH 内打开 code-server(VS Code 网页版)', style: { display: 'flex', alignItems: 'center', gap: 8 } },
329
- React.createElement('span', { 'aria-hidden': true, style: { fontSize: 14 } }, '⌘'),
330
- props && props.wide === true ? React.createElement('span', null, label) : null
331
- )
332
- }
333
-
334
- // ---------- 内部浮动窗口(参照 univer-office WorktreeWindow) ----------
335
- function Window(props) {
336
- var store = useStore()
337
- var status = store.status
338
- var running = status != null && status.ok === true && status.running === true
339
- var starting = status != null && status.status === 'starting'
340
- var errored = status != null && status.ok === false
341
- var cwd = activeWorkspaceCwd(props && props.useSessions, props && props.useWorkspaces)
342
- // 上次同步(或打开服务)时的工作区;变化时自动重启并刷新 iframe
343
- var lastSyncedCwdRef = React.useRef(undefined)
344
- var [reloadTick, setReloadTick] = React.useState(0)
345
-
346
- // ---- 窗口状态与手势(复刻 univer-office 的 WorktreeWindow) ----
347
- // reserveComposer(设置卡片):true 不盖输入框;false 允许盖住(最大化到视口底)。
348
- var reserve = reserveOf(status != null ? status.reserveComposer : true)
349
- var [folded, setFolded] = React.useState(false)
350
- var [maximized, setMaximized] = React.useState(false)
351
- var [interaction, setInteraction] = React.useState(null)
352
- var [rect, setRect] = React.useState(function () { return initialRect(0, viewportSize(), reserve) })
353
- var rectRef = React.useRef(rect)
354
- var cancelPointerSessionRef = React.useRef(function () {})
355
- rectRef.current = rect
356
- React.useEffect(function () {
357
- var onViewportResize = function () {
358
- setRect(function (current) {
359
- // 最大化时保持占满"输入栏上方"区域;否则仅 fit 防止越界
360
- return maximized ? maximizedRect(viewportSize(), reserve) : fitRect(current, viewportSize(), reserve)
361
- })
362
- }
363
- window.addEventListener('resize', onViewportResize)
364
- return function () { window.removeEventListener('resize', onViewportResize) }
365
- }, [maximized, reserve])
366
- // 设置变化(reserve 切换)时重新 fit 当前 rect(立即生效,不遮挡/不越界)
367
- React.useEffect(function () {
368
- setRect(function (current) { return fitRect(current, viewportSize(), reserve) })
369
- }, [reserve])
370
- React.useEffect(function () {
371
- return function () { cancelPointerSessionRef.current() }
372
- }, [])
373
-
374
- var beginPointerSession = function (event, kind) {
375
- if (event.button !== 0 || maximized) return
376
- event.preventDefault()
377
- event.stopPropagation()
378
- cancelPointerSessionRef.current()
379
- var view = event.currentTarget.ownerDocument.defaultView
380
- if (view === null) return
381
- var pointerId = event.pointerId
382
- var origin = { x: event.clientX, y: event.clientY }
383
- var start = rectRef.current
384
- var element = event.currentTarget
385
- setInteraction(kind)
386
- try { element.setPointerCapture(pointerId) } catch (e) { /* capture 失败仍可跟随 */ }
387
- var move = function (next) {
388
- if (next.pointerId !== pointerId) return
389
- var dx = next.clientX - origin.x
390
- var dy = next.clientY - origin.y
391
- setRect(kind === 'move' ? moveRect(start, dx, dy, viewportSize(), reserve) : resizeRect(start, kind, dx, dy, viewportSize(), reserve))
392
- }
393
- var cleanup = function () {
394
- view.removeEventListener('pointermove', move)
395
- view.removeEventListener('pointerup', finish)
396
- view.removeEventListener('pointercancel', finish)
397
- cancelPointerSessionRef.current = function () {}
398
- try { element.releasePointerCapture(pointerId) } catch (e) { /* ignore */ }
399
- }
400
- var finish = function (next) {
401
- if (next.pointerId !== pointerId) return
402
- cleanup()
403
- setInteraction(null)
404
- }
405
- cancelPointerSessionRef.current = cleanup
406
- view.addEventListener('pointermove', move)
407
- view.addEventListener('pointerup', finish)
408
- view.addEventListener('pointercancel', finish)
409
- }
410
-
411
- var toggleFolded = function () {
412
- setMaximized(false)
413
- setFolded(function (current) { return !current })
414
- }
415
- var toggleMaximized = function () {
416
- setFolded(false)
417
- setMaximized(function (current) { return !current })
418
- }
419
- var onHeaderPointerDown = function (event) {
420
- if (event.target.closest('[data-window-control]') !== null) return
421
- beginPointerSession(event, 'move')
422
- }
423
- var onHeaderDoubleClick = function (event) {
424
- if (event.target.closest('[data-window-control]') === null) toggleMaximized()
425
- }
426
-
427
- // ---- 生命周期/数据同步(与原全屏浮层一致) ----
428
- // 打开时:拉状态;未运行则尝试启动(带当前会话 cwd)
429
- React.useEffect(function () {
430
- if (!store.open) return
431
- var cancelled = false
432
- async function boot() {
433
- setState({ busy: true })
434
- var s = await api('/code-server/status')
435
- if (cancelled) return
436
- if (s != null && s.ok === true && s.running === true) {
437
- setState({ status: s, busy: false })
438
- return
439
- }
440
- var started = await api('/code-server/start', typeof cwd === 'string' ? { cwd: cwd } : {})
441
- if (cancelled) return
442
- setState({ status: started, busy: false })
443
- }
444
- boot()
445
- return function () { cancelled = true }
446
- // eslint-disable-next-line react-hooks/exhaustive-deps
447
- }, [store.open])
448
-
449
- // 跟随活动工作区:快照变化(切换会话/工作区)自动重启到新目录,成功后刷新 iframe
450
- React.useEffect(function () {
451
- if (!store.open) return
452
- if (typeof cwd !== 'string' || cwd === '') return
453
- if (lastSyncedCwdRef.current === cwd) return
454
- var changed = lastSyncedCwdRef.current !== undefined && lastSyncedCwdRef.current !== cwd
455
- lastSyncedCwdRef.current = cwd
456
- var cancelled = false
457
- async function sync() {
458
- setState({ busy: true })
459
- var s = await api('/code-server/start', { cwd: cwd })
460
- if (cancelled) return
461
- setState({ status: s, busy: false })
462
- if (changed && s != null && s.ok === true && s.running === true) {
463
- setReloadTick(function (t) { return t + 1 })
464
- }
465
- }
466
- sync()
467
- return function () { cancelled = true }
468
- }, [store.open, cwd])
469
-
470
- // 窗口关闭时重置跟随基线,下次打开重新对齐
471
- React.useEffect(function () {
472
- if (!store.open) lastSyncedCwdRef.current = undefined
473
- }, [store.open])
474
-
475
- // 打开期间每 3s 轮询状态
476
- React.useEffect(function () {
477
- if (!store.open) return
478
- var timer = window.setInterval(function () {
479
- api('/code-server/status').then(function (s) { setState({ status: s }) })
480
- }, 3000)
481
- return function () { window.clearInterval(timer) }
482
- }, [store.open])
483
-
484
- // Esc 关闭
485
- React.useEffect(function () {
486
- if (!store.open) return
487
- function onKey(e) {
488
- if (e.key === 'Escape') setState({ open: false })
489
- }
490
- window.addEventListener('keydown', onKey)
491
- return function () { window.removeEventListener('keydown', onKey) }
492
- }, [store.open])
493
-
494
- if (!store.open) return null
495
-
496
- var statusKind = running ? 'running' : starting ? 'starting' : errored ? 'error' : 'idle'
497
- var statusLabel = running ? '运行中' : starting ? '启动中…' : errored ? '错误' : '未运行'
498
-
499
- var baseUrl = status != null && typeof status.url === 'string' ? status.url : null
500
- // code-server 前端记住"最近工作区"并自行恢复;必须用 ?folder= 显式指定
501
- // 打开目录,否则 iframe 裸根 URL 会显示上一次的工具区(不跟随切换)。
502
- //
503
- // folder 参数格式(实测):VS Code web 要求以 "/" 开头的平台路径——Windows
504
- // 盘符路径必须统一为正斜杠并加前导 "/"(/C:/Users/...)。裸 Windows 路径
505
- // (C:\Users\...) 会被前端当 URI scheme 解析而剥掉盘符,file:/// 形式则报
506
- // "Workspace does not exist"。
507
- var activeDir = running && status != null && typeof status.cwd === 'string' && status.cwd !== '' ? status.cwd : null
508
- var folderParam = null
509
- if (activeDir !== null) {
510
- var normalized = activeDir.replace(/\\/g, '/')
511
- folderParam = normalized
512
- if (/^[A-Za-z]:\//.test(normalized)) folderParam = '/' + normalized
513
- else if (normalized.charCodeAt(0) !== 47) folderParam = '/' + normalized
514
- }
515
- var pageUrl = baseUrl !== null
516
- ? baseUrl + (folderParam !== null ? '?folder=' + encodeURIComponent(folderParam) : '')
517
- : null
518
-
519
- var metaBits = []
520
- if (status != null) {
521
- if (status.host != null) metaBits.push(String(status.host) + ':' + String(status.port))
522
- if (status.cwd != null) metaBits.push('cwd: ' + status.cwd)
523
- if (status.adopted === true) metaBits.push('接管既有实例')
524
- }
525
- if (typeof cwd === 'string' && cwd !== '') {
526
- metaBits.push(running && status != null && typeof status.cwd === 'string' && status.cwd !== cwd
527
- ? '目标: ' + cwd + '(切换即重启)'
528
- : '跟随: ' + cwd)
529
- }
530
-
531
- var body
532
- if (running && pageUrl !== null) {
533
- body = React.createElement('iframe', {
534
- key: reloadTick,
535
- className: 'dshcs-frame',
536
- src: pageUrl,
537
- title: 'code-server',
538
- sandbox: 'allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock',
539
- })
540
- } else {
541
- var errText = errored && status != null && status.error
542
- ? status.error
543
- : (starting ? '正在启动 code-server…' : 'code-server 未运行')
544
- body = React.createElement('div', { className: 'dshcs-empty' },
545
- React.createElement('div', { className: 'dshcs-emptybox' },
546
- React.createElement('div', null, starting ? '正在启动 code-server…' : errored ? 'code-server 启动失败' : 'code-server 未运行'),
547
- React.createElement('pre', { className: 'dshcs-error' }, errText),
548
- React.createElement('p', { className: 'dshcs-hint' },
549
- '安装命令(Windows 原生):npm install -g code-server@latest(需配套最新版 node-gyp 与 VS Spectre 缓解库);' +
550
- '或在 cordis.patch.yml 的 code-server config 中设置 bin 指向已安装位置。' +
551
- '端口 ' + (status != null ? status.port : '8090') + ' 被占用时请释放或修改 port 配置。')
552
- ))
553
- }
554
-
555
- var className = ['dshcs-win', folded ? 'dshcs-win-folded' : '', maximized ? 'dshcs-win-max' : ''].filter(Boolean).join(' ')
556
- // 最大化由 rect 驱动(maximizedRect 占满"输入栏上方"区域),不用 CSS inset;
557
- // 还原时回到拖动前的位置。
558
- var shownRect = maximized ? maximizedRect(viewportSize(), reserve) : rect
559
- var style = { left: shownRect.x, top: shownRect.y, width: shownRect.width, height: shownRect.height }
560
-
561
- var windowTree = React.createElement('section', {
562
- className: className,
563
- style: style,
564
- 'data-interaction': interaction !== null ? interaction : undefined,
565
- role: 'dialog',
566
- 'aria-label': 'Code Server',
567
- },
568
- React.createElement('header', {
569
- className: 'dshcs-header',
570
- onPointerDown: onHeaderPointerDown,
571
- onDoubleClick: onHeaderDoubleClick,
572
- },
573
- React.createElement('span', { className: 'dshcs-glyph', 'aria-hidden': true }, React.createElement(Glyph, { baseUrl: baseUrl })),
574
- React.createElement('span', { className: 'dshcs-identity' },
575
- React.createElement('span', { className: 'dshcs-title' }, 'Code Server'),
576
- React.createElement('span', { className: 'dshcs-sub' }, metaBits.length > 0 ? metaBits.join(' · ') : 'VS Code 网页版')
577
- ),
578
- React.createElement('span', { className: 'dshcs-chip', 'data-status': statusKind },
579
- React.createElement('span', { className: 'dshcs-dot', 'aria-hidden': true }),
580
- statusLabel
581
- ),
582
- React.createElement('span', { className: 'dshcs-controls' },
583
- React.createElement('button', {
584
- type: 'button', className: 'dshcs-ctl', 'data-window-control': '', title: folded ? '展开' : '折叠',
585
- 'aria-label': folded ? '展开' : '折叠', onClick: toggleFolded,
586
- }, React.createElement(FoldIcon, { expanded: folded })),
587
- React.createElement('button', {
588
- type: 'button', className: 'dshcs-ctl', 'data-window-control': '', title: maximized ? '还原' : '最大化',
589
- 'aria-label': maximized ? '还原' : '最大化', onClick: toggleMaximized,
590
- }, React.createElement(MaximizeIcon, { restored: maximized })),
591
- React.createElement('button', {
592
- type: 'button', className: 'dshcs-ctl', 'data-window-control': '', 'data-danger': '', title: '关闭(Esc)',
593
- 'aria-label': '关闭', onClick: function () { setState({ open: false }) },
594
- }, React.createElement(CloseIcon, null))
595
- )
596
- ),
597
- React.createElement('div', { className: 'dshcs-body', hidden: folded },
598
- body
599
- ),
600
- !folded && !maximized
601
- ? RESIZE_DIRECTIONS.map(function (direction) {
602
- return React.createElement('span', {
603
- key: direction,
604
- className: 'dshcs-resize dshcs-resize-' + direction,
605
- 'data-direction': direction,
606
- onPointerDown: function (event) { beginPointerSession(event, direction) },
607
- })
608
- })
609
- : null
610
- )
611
- // portal 到 document.body:脱离 shell.overlay(z-index 20)的 stacking context,
612
- // 让窗口真正覆盖到 DSH 输入框区(输入框不再透出)。
613
- return ReactDOM.createPortal(windowTree, document.body)
614
- }
615
-
616
- // ---------- 设置卡片(参照 auto-open-web 的自绘卡片模式) ----------
617
- // 数据通道:settingsScope(官方 settings 域,命名空间 code-server);
618
- // 插槽:settings.plugin.item(keyed 注册,卡片自绘,观感对齐官方设计令牌)。
619
- var CARD_CSS =
620
- '.dshcs-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}' +
621
- '.dshcs-card:hover{border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}' +
622
- '.dshcs-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}' +
623
- '.dshcs-cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}' +
624
- '.dshcs-cardHeader:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}' +
625
- '.dshcs-cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}' +
626
- '.dshcs-cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}' +
627
- '.dshcs-cardDescription{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:13px;line-height:1.5}' +
628
- '.dshcs-cardChevron{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));flex:none;transition:transform .16s;display:inline-flex}' +
629
- '.dshcs-cardChevronOpen{transform:rotate(180deg)}' +
630
- '.dshcs-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}' +
631
- '.dshcs-cardReadOnly{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:12px 0 0;font-size:12px;line-height:1.5}' +
632
- '.dshcs-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}' +
633
- '.dshcs-cardFooter{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}' +
634
- '.dshcs-cardFailed{min-width:0;color:var(--dsw-alias-label-error,var(--dsw-alias-state-error-primary));flex:1;margin:0;font-size:12px;line-height:1.5}' +
635
- '.dshcs-cbtn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;border:1px solid transparent;transition:color .12s ease,background .12s ease}' +
636
- '.dshcs-cbtn:disabled{opacity:.4;cursor:default}' +
637
- '.dshcs-cbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}' +
638
- '.dshcs-cbtnOutline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}' +
639
- '.dshcs-cbtnOutline:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover,transparent)}' +
640
- '.dshcs-cbtnPrimary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary);font-weight:600}' +
641
- '.dshcs-cbtnPrimary:hover:not(:disabled){filter:brightness(.95)}' +
642
- '.dshcs-cbtnPrimary:active:not(:disabled){filter:brightness(.9)}' +
643
- '.dshcs-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}' +
644
- '.dshcs-field+.dshcs-field{border-top:1px solid var(--dsw-alias-border-l2)}' +
645
- '.dshcs-fieldHead{align-items:center;gap:8px;display:flex}' +
646
- '.dshcs-fieldLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}' +
647
- '.dshcs-hint{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:0;font-size:12px;line-height:1.5}' +
648
- '.dshcs-check{display:flex;align-items:center;gap:8px;cursor:pointer}' +
649
- '.dshcs-check input{accent-color:var(--dsw-alias-brand-primary);width:15px;height:15px;margin:0;flex:none}' +
650
- '.dshcs-check input:disabled{cursor:default}' +
651
- '.dshcs-badges{align-items:center;gap:8px;display:inline-flex}' +
652
- '.dshcs-badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}' +
653
- '.dshcs-reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}' +
654
- '.dshcs-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}' +
655
- '.dshcs-reset:disabled{cursor:default}'
656
- var CARD_TAG = 'dsh-code-server/Card.module.css'
657
- function injectCss(tagId, css) {
658
- if (typeof document === 'undefined') return
659
- if (document.querySelector('style[data-plugin-css=' + JSON.stringify(tagId) + ']') !== null) return
660
- var tag = document.createElement('style')
661
- tag.dataset.plugin = 'dsh-code-server'
662
- tag.dataset.pluginCss = tagId
663
- tag.textContent = css
664
- document.head.appendChild(tag)
665
- }
666
- injectCss(CARD_TAG, CARD_CSS)
667
-
668
- function csIconChevron(props) {
669
- return React.createElement('svg', {
670
- width: 14, height: 14, viewBox: '0 0 14 14', fill: 'none', 'aria-hidden': true, className: props.className,
671
- },
672
- React.createElement('path', {
673
- d: 'M3.5 5.25L7 8.75L10.5 5.25', stroke: 'currentColor', strokeWidth: 1.5, strokeLinecap: 'round', strokeLinejoin: 'round',
674
- })
675
- )
676
- }
677
- function csBtn(props) {
678
- return React.createElement('button', {
679
- type: 'button',
680
- className: 'dshcs-cbtn ' + (props.variant === 'primary' ? 'dshcs-cbtnPrimary' : 'dshcs-cbtnOutline'),
681
- disabled: props.disabled === true,
682
- onClick: props.onClick,
683
- }, props.children)
684
- }
685
- function csCheck(props) {
686
- return React.createElement('label', { className: 'dshcs-check' },
687
- React.createElement('input', {
688
- type: 'checkbox', checked: props.checked === true, disabled: props.disabled === true,
689
- onChange: function (event) { props.onChange(event.target.checked) },
690
- }),
691
- React.createElement('span', { className: 'dshcs-hint' }, props.children)
692
- )
693
- }
694
- function csBadges(props) {
695
- var children = []
696
- if (props.overridden === true) {
697
- children.push(React.createElement('span', { className: 'dshcs-badge' }, props.overriddenLabel))
698
- children.push(React.createElement('button', { type: 'button', className: 'dshcs-reset', disabled: props.disabled === true, onClick: props.onReset }, props.resetLabel))
699
- }
700
- if (children.length === 0) return null
701
- return React.createElement('span', { className: 'dshcs-badges' }, ...children)
702
- }
703
- function csCard(props) {
704
- var [open, setOpen] = React.useState(false)
705
- var state = props.state
706
- if (state === null || state === undefined || state.available !== true) return null
707
- var title = props.title
708
- var saveDisabled = state.dirty !== true || state.invalid === true || state.saving === true
709
- return React.createElement('li', { className: 'dshcs-card' + (open ? ' dshcs-cardOpen' : '') },
710
- React.createElement('button', {
711
- type: 'button', className: 'dshcs-cardHeader', 'aria-expanded': open,
712
- onClick: function () { setOpen(!open) },
713
- },
714
- React.createElement('span', { className: 'dshcs-cardHeadText' },
715
- React.createElement('span', { className: 'dshcs-cardName' }, title),
716
- React.createElement('span', { className: 'dshcs-cardDescription' }, props.description)
717
- ),
718
- state.dirty === true ? React.createElement('span', { className: 'dshcs-pending' }, props.unsavedLabel) : null,
719
- React.createElement(csIconChevron, { className: 'dshcs-cardChevron' + (open ? ' dshcs-cardChevronOpen' : '') })
720
- ),
721
- open === true ? React.createElement('div', { className: 'dshcs-cardBody' },
722
- state.writable !== true ? React.createElement('p', { className: 'dshcs-cardReadOnly', role: 'status' }, props.readOnlyLabel) : null,
723
- props.children,
724
- React.createElement('div', { className: 'dshcs-cardFooter' },
725
- state.failed === true ? React.createElement('p', { className: 'dshcs-cardFailed', role: 'status' }, props.saveFailedLabel) : null,
726
- React.createElement(csBtn, { disabled: state.dirty !== true || state.saving === true, onClick: props.onDiscard }, props.discardLabel),
727
- React.createElement(csBtn, { variant: 'primary', disabled: saveDisabled, onClick: props.onSave }, state.saving === true ? props.savingLabel : props.saveLabel)
728
- )
729
- ) : null
730
- )
731
- }
732
-
733
- /** 设置卡片页面:useState+useEffect 订阅 settingsScope(不投机 useSyncExternalStore
734
- * 对 snapshot 引用稳定性的要求;不建中间 store)。 */
735
- function csSettingsPage(props) {
736
- try {
737
- var scope = props.scope
738
- var [snapshot, setSnapshot] = React.useState(function () { return scope !== undefined ? scope.getSnapshot() : null })
739
- var [draft, setDraft] = React.useState(null) // null | boolean(未保存草稿)
740
- var [saving, setSaving] = React.useState(false)
741
- var [failed, setFailed] = React.useState(false)
742
- React.useEffect(function () {
743
- if (scope === undefined || typeof scope.subscribe !== 'function') return
744
- function onUpdate() {
745
- try { setSnapshot(scope.getSnapshot()) } catch (e) { /* ignore */ }
746
- }
747
- var dispose = scope.subscribe(onUpdate)
748
- return function () { if (typeof dispose === 'function') dispose() }
749
- }, [scope])
750
- if (scope === undefined) {
751
- console.error('[code-server] card scope missing')
752
- return null
753
- }
754
- if (snapshot === null || snapshot === undefined || snapshot.status !== 'ready') {
755
- // 尚未就绪(连接/镜像加载中):静默留空,官方插槽边界接管;不显示占位
756
- if (snapshot !== null && snapshot !== undefined && snapshot.status === 'unavailable') {
757
- console.warn('[code-server] settings scope unavailable:', snapshot.status)
758
- }
759
- return null
760
- }
761
- var value = snapshot.value !== undefined && snapshot.value !== null ? snapshot.value : {}
762
- var user = snapshot.user
763
- var loaded = value.reserveComposer === true
764
- var overridden = user !== undefined && user !== null && Object.prototype.hasOwnProperty.call(user, 'reserveComposer')
765
- var dirty = draft !== null && draft !== loaded
766
- var saveDisabled = !dirty || saving
767
- var state = {
768
- available: true,
769
- writable: snapshot.writable,
770
- dirty: dirty,
771
- invalid: false,
772
- saving: saving,
773
- failed: failed,
774
- reserveComposer: { text: draft !== null ? draft : loaded, overridden: overridden },
775
- }
776
- async function doSave() {
777
- if (dirty && !saving) {
778
- setSaving(true); setFailed(false)
779
- try {
780
- await props.scope.set('reserveComposer', draft === true)
781
- setDraft(null)
782
- } catch (e) {
783
- setFailed(true)
784
- }
785
- setSaving(false)
786
- }
787
- }
788
- async function doReset() {
789
- if (saving || snapshot.writable !== true) return
790
- setSaving(true); setFailed(false)
791
- try {
792
- // unset 清除 user 覆盖层 → 回到 base 默认值;成功后镜像同步
793
- if (typeof props.scope.unset === 'function') await props.scope.unset('reserveComposer')
794
- else await props.scope.set('reserveComposer', value.reserveComposer === undefined || value.reserveComposer === null ? true : value.reserveComposer)
795
- setDraft(null)
796
- } catch (e) {
797
- setFailed(true)
798
- }
799
- setSaving(false)
800
- }
801
- // ---- 环境检测/安装(host /code-server/status.env + /code-server/setup) ----
802
- var [envInfo, setEnvInfo] = React.useState(null) // null=待检测 | { ok, entry, native, vscodeInner, pathToSetup } | { error }
803
- var [setupBusy, setSetupBusy] = React.useState(false)
804
- var [setupMsg, setSetupMsg] = React.useState(null)
805
- var envAliveRef = React.useRef(true) // 组件卸载后停止轮询(不向已卸载组件 setState)
806
- React.useEffect(function () {
807
- envAliveRef.current = true
808
- return function () { envAliveRef.current = false }
809
- }, [])
810
- async function doInstallEnv() {
811
- if (setupBusy) return
812
- setSetupBusy(true); setSetupMsg(null)
813
- // api 无 body 时发 GET;setup 是 POST 路由 — 传空对象强制 POST
814
- var s = await api('/code-server/setup', {})
815
- if (s == null || s.ok !== true) {
816
- setSetupMsg(s != null && s.error ? s.error : '启动安装失败')
817
- setSetupBusy(false)
818
- return
819
- }
820
- setSetupMsg('环境安装已在后台开始,完成后自动刷新…')
821
- // 轮询 status.setup 直到安装结束:成功后刷新 env 检测,失败显示日志尾部
822
- function poll() {
823
- if (envAliveRef.current !== true) return
824
- api('/code-server/status').then(function (st) {
825
- if (envAliveRef.current !== true) return
826
- if (st == null || st.setup == null) { setSetupBusy(false); return }
827
- if (st.setup.running === true) { setTimeout(poll, 2000); return }
828
- setSetupBusy(false)
829
- setEnvInfo(st.env != null ? st.env : { error: 'status 未返回 env' })
830
- setSetupMsg(st.setup.ok === true
831
- ? '环境安装完成'
832
- : '环境安装失败:\n' + (st.setup.logTail != null ? st.setup.logTail.slice(-600) : '(无日志)'))
833
- })
834
- }
835
- poll()
836
- }
837
- var envSection = React.createElement('div', { className: 'dshcs-field' },
838
- React.createElement('div', { className: 'dshcs-fieldHead' },
839
- React.createElement('span', { className: 'dshcs-fieldLabel' }, '环境检测'),
840
- React.createElement('span', { className: 'dshcs-badges' },
841
- React.createElement(csBtn, { variant: 'primary', disabled: setupBusy, onClick: async function () {
842
- setSetupBusy(true); setSetupMsg(null)
843
- var s = await api('/code-server/status')
844
- setEnvInfo(s != null && s.env != null ? s.env : { error: 'status 未返回 env' })
845
- setSetupBusy(false)
846
- } }, '检测环境'),
847
- React.createElement(csBtn, { disabled: setupBusy, onClick: function () { doInstallEnv() } }, setupBusy ? '安装中…' : '安装环境')
848
- )
849
- ),
850
- envInfo != null
851
- ? React.createElement('div', { className: 'dshcs-hint', style: { marginTop: 6 } },
852
- envInfo.error != null
853
- ? React.createElement('span', null, '检测失败: ' + envInfo.error)
854
- : React.createElement('span', null,
855
- '状态: ' + (envInfo.ok === true ? '✅ 就绪' : '❌ 不通过') +
856
- (envInfo.entry != null ? ' · 入口: ' + envInfo.entry : ' · 入口缺失') +
857
- ' · native: ' + (envInfo.native === true ? '✅' : '❌') +
858
- ' · VS Code 内部依赖: ' + (envInfo.vscodeInner === true ? '✅' : '❌'))
859
- )
860
- : React.createElement('div', { className: 'dshcs-hint', style: { marginTop: 6 } }, '点击"检测环境"查看 code-server 安装状态')
861
- ,
862
- setupMsg != null
863
- ? React.createElement('div', { className: 'dshcs-hint', style: { marginTop: 6 } }, setupMsg)
864
- : null,
865
- React.createElement('div', { className: 'dshcs-hint', style: { marginTop: 10, color: 'var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary))' } },
866
- '安装位置: ' + (envInfo != null && envInfo.entry != null ? envInfo.entry : '(profile)\\.code-server-app(待安装后可查看)') +
867
- '\n卸载: 先手动删除 .code-server-app 目录,再 dsh plugin --profile web remove dsh-code-server-app'
868
- )
869
- )
870
- return React.createElement(csCard, {
871
- title: 'Code Server',
872
- description: '窗口行为:是否保留输入框上方空间(不遮挡 composer)',
873
- state: state,
874
- unsavedLabel: '未保存', readOnlyLabel: '本部署的设置为只读。',
875
- saveFailedLabel: '本部署没有接受这些值,已保留供你修改。',
876
- discardLabel: '放弃修改', saveLabel: '保存', savingLabel: '保存中…',
877
- onSave: doSave, onDiscard: function () { setDraft(null); setFailed(false) },
878
- },
879
- React.createElement('div', { className: 'dshcs-field' },
880
- React.createElement('div', { className: 'dshcs-fieldHead' },
881
- React.createElement('span', { className: 'dshcs-fieldLabel' }, '保留输入框上方空间'),
882
- overridden === true
883
- ? React.createElement(csBadges, {
884
- overridden: true, disabled: snapshot.writable !== true,
885
- overriddenLabel: '已覆盖', resetLabel: '恢复默认',
886
- onReset: function () { doReset() },
887
- })
888
- : null
889
- ),
890
- React.createElement(csCheck, {
891
- checked: draft !== null ? draft : loaded,
892
- disabled: snapshot.writable !== true,
893
- onChange: function (v) { setDraft(v === true); setFailed(false) },
894
- }, '开启时窗口初始/缩放/最大化止于输入框上方;关闭后允许盖住输入框(最大化到视口底)')
895
- ),
896
- envSection
897
- )
898
- } catch (e) {
899
- // 渲染异常:记日志不打断;官方插槽对异常有边界,卡片留空即可
900
- console.error('[code-server] card render error:', e !== null && e !== undefined && e.message !== undefined ? e.message : String(e))
901
- return null
902
- }
903
- }
904
-
905
- // ---------- 插件注册 ----------
906
- function apply(ctx) {
907
- var slots = ctx.get('slots')
908
- if (slots === undefined) {
909
- console.error('[code-server] slots service unavailable')
910
- return
911
- }
912
- // 预拉取 status:让侧栏按钮首帧就有 env(检测通过才显示,不闪烁)
913
- api('/code-server/status').then(function (s) {
914
- setState({ status: s })
915
- }).catch(function () { /* 首次失败由后续轮询补救 */ })
916
- slots.inject('sidebar.footer.action', () => slots.register(
917
- { name: 'sidebar.footer.action', id: 'code-server-panel', order: 60, label: 'Code Server' },
918
- (props) => React.createElement(SidebarAction, props)
919
- ))
920
- slots.inject('shell.overlay', () => slots.register(
921
- { name: 'shell.overlay', id: 'code-server', order: 70, label: 'Code Server' },
922
- (props) => React.createElement(Window, props)
923
- ))
924
-
925
- // ---- 设置卡片(settings.plugin.item 插槽 + settingsScope 命名空间) ----
926
- var settingsScope = ctx.settingsScope
927
- if (settingsScope === undefined || typeof settingsScope.bind !== 'function') {
928
- console.error('[code-server] settingsScope unavailable (inject missing?); settings card disabled')
929
- return
930
- }
931
- var scope = settingsScope.bind({ namespace: 'code-server' })
932
- slots.inject('settings.plugin.item', () => slots.register(
933
- { name: 'settings.plugin.item', key: 'code-server', label: 'Code Server', inject: function () { return { scope: scope } } },
934
- csSettingsPage
935
- ))
936
-
937
- console.log('[code-server] client bundle registered (sidebar action + floating window + settings card)')
938
- }
939
-
940
- exports.apply = apply
941
- exports.inject = ['slots', 'settingsScope']
942
- exports.name = 'code-server'
943
- return module.exports
944
- }
945
- })