@rainbow-robotics/preview-host 0.10.1-dev.0 → 0.10.1-dev.1

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.
Files changed (27) hide show
  1. package/dist/assets/{AmrCapabilityControl.BsPcogIn.js → AmrCapabilityControl.oytFydB2.js} +1 -1
  2. package/dist/assets/{__federation_expose_App.DoTw5M1G.js → __federation_expose_App.BvIAEUou.js} +6 -6
  3. package/dist/assets/__federation_fn_import.DdkEuT6t.js +2 -2
  4. package/dist/assets/{cssMode.r5_yWnhF.js → cssMode.z2-NHYcV.js} +1 -1
  5. package/dist/assets/{freemarker2.DCx4k8go.js → freemarker2.Bt8q4fBg.js} +1 -1
  6. package/dist/assets/{handlebars.BludBZv4.js → handlebars.BoqVl5GV.js} +1 -1
  7. package/dist/assets/{html.C-reJSx7.js → html.8ZwYdhzS.js} +1 -1
  8. package/dist/assets/{htmlMode.HtihP2HZ.js → htmlMode.DPTRrtXh.js} +1 -1
  9. package/dist/assets/{index.DdneTN7b.js → index.Bfb-Nfl_.js} +1 -1
  10. package/dist/assets/{index.UK8d_UfV.js → index.C-pJrSSC.js} +1 -1
  11. package/dist/assets/{index.C7SAsNe2.js → index.Di1B_zOl.js} +1 -1
  12. package/dist/assets/{javascript.BtXUGP6j.js → javascript.CIU7xZo3.js} +1 -1
  13. package/dist/assets/{jsonMode.mx3rzMj6.js → jsonMode.D1_Izqyt.js} +1 -1
  14. package/dist/assets/{liquid.BKDdGihc.js → liquid.DCMgNe71.js} +1 -1
  15. package/dist/assets/{lspLanguageFeatures.CiDbxSjV.js → lspLanguageFeatures.DWKaU1VK.js} +1 -1
  16. package/dist/assets/{mdx.C8GBeJOc.js → mdx.8gVroNDk.js} +1 -1
  17. package/dist/assets/{python.LxZo3-5L.js → python.RKnDkd3D.js} +1 -1
  18. package/dist/assets/{razor.D95WY7jF.js → razor.uyZvm_ly.js} +1 -1
  19. package/dist/assets/remoteEntry.js +1 -1
  20. package/dist/assets/{tsMode.BbJpvH--.js → tsMode.BniqA017.js} +1 -1
  21. package/dist/assets/{typescript.DdC-A9nd.js → typescript.BZLvAXt-.js} +1 -1
  22. package/dist/assets/{useFileDownload.DoxMuZkp.js → useFileDownload.BuzVN3F3.js} +1 -1
  23. package/dist/assets/{xml.DmJRBsLI.js → xml.IzNtcHww.js} +1 -1
  24. package/dist/assets/{yaml.Du5J4UhC.js → yaml.PJSBTl4g.js} +1 -1
  25. package/dist/index.html +5 -5
  26. package/package.json +1 -1
  27. /package/dist/assets/{RbLocalizationProvider.OVSr2Odo.js → RbLocalizationProvider.CI7oesfV.js} +0 -0
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.C7SAsNe2.js","assets/useFileDownload.DoxMuZkp.js","assets/RbLocalizationProvider.OVSr2Odo.js","assets/__federation_fn_import.DdkEuT6t.js","assets/jsx-runtime.CBqCNPYB.js","assets/index.P6snMalu.js","assets/emotion-styled-base.browser.esm.BIcjgOzg.js","assets/AmrCapabilityControl.BsPcogIn.js","assets/index.DdneTN7b.js","assets/cssMode.r5_yWnhF.js","assets/lspLanguageFeatures.CiDbxSjV.js","assets/htmlMode.HtihP2HZ.js","assets/jsonMode.mx3rzMj6.js","assets/javascript.BtXUGP6j.js","assets/typescript.DdC-A9nd.js"])))=>i.map(i=>d[i]);
2
- import{importShared as F}from"./__federation_fn_import.DdkEuT6t.js";import{c as Hn,b as Q7,a as dD,d as uD,e as j7e,f as OI,u as G7e,R as q7e,g as C0,A as eLe,P as tLe,h as K7e,i as nLe,k as iLe,l as LE,m as sLe,n as J7e,o as Y7e,p as X7e,q as Q7e,F as Z7e,D as e$e,C as t$e,r as n$e,s as i$e,t as s$e,v as o$e,O as r$e,w as a$e,j as u,x as P,L as l$e,T as c$e,y as d$e,z as u$e,B as oLe,E as h$e,S as qm,G as Mu,H as x,I as g$e,J as m$e,K as f$e,M as p$e,N as _$e,Q as b$e,U as H,V as J,W as rLe,X as g9,Y as v$e,Z as aLe,_ as lh,$ as lLe,a0 as cLe,a1 as y$e,a2 as dLe,a3 as uLe,a4 as w$e,a5 as hLe,a6 as gLe,a7 as C$e,a8 as mLe,a9 as ia,aa as S$e,ab as x$e,ac as N$e,ad as I$e,ae as fLe,af as m9,ag as Sie,ah as xie,ai as pLe,aj as _Le,ak as bLe,al as k$e,am as L$e,an as D$e,ao as T$e,ap as E$e,aq as P$e,ar as R$e,as as M$e,at as A$e,au as O$e,av as _o,aw as F$e,ax as B$e,ay as V$e,az as z$e,aA as W$e,aB as H$e,aC as $$e,aD as U$e,aE as j$e,aF as G$e,aG as q$e,aH as iA,aI as K$e,aJ as sA,aK as J$e,aL as hu,aM as vLe,aN as Y$e,aO as X$e,aP as Q$e,aQ as f9,aR as Z$e,aS as e8e,aT as t8e,aU as n8e,aV as oA,aW as gK,aX as Yt,aY as i8e,aZ as Nie,a_ as s8e,a$ as se,b0 as o8e,b1 as r8e,b2 as a8e,b3 as l8e,b4 as c8e,b5 as d8e,b6 as u8e,b7 as h8e,b8 as g8e,b9 as m8e,ba as f8e,bb as p8e,bc as _8e,bd as b8e,be as v8e,bf as y8e,bg as td,bh as w8e,bi as rA,bj as yLe,bk as wLe,bl as C8e,bm as S0,bn as S8e,bo as CLe,bp as mK,bq as SLe,br as fK,bs as ae,bt as x8e,bu as xLe,bv as N8e,bw as I8e,bx as k8e,by as L8e,bz as D8e,bA as T8e,bB as E8e,bC as P8e,bD as R8e,bE as M8e,bF as Iie,bG as NLe,bH as Ms,bI as aw,bJ as tr,bK as ILe,bL as kie,bM as A8e,bN as O8e,bO as F8e,bP as B8e,bQ as V8e,bR as z8e,bS as W8e,bT as H8e,bU as $8e,bV as Lie,bW as me,bX as U8e,bY as et,bZ as j8e,b_ as G8e,b$ as q8e,c0 as J0,c1 as U,c2 as K8e,c3 as J8e,c4 as Y8e,c5 as X8e,c6 as Q8e,c7 as Z8e,c8 as eUe,c9 as tUe,ca as nUe,cb as iUe,cc as kLe,cd as sUe,ce as oUe,cf as rUe,cg as aUe,ch as lUe,ci as cUe,cj as dUe,ck as uUe,cl as hUe,cm as Hk,cn as tt,co as q,cp as Km,cq as Die,cr as ls,cs as gUe,ct as qr,cu as rt,cv as Ti,cw as ir,cx as dB,cy as dt,cz as Cr,cA as Vi,cB as mUe,cC as rn,cD as LLe,cE as Ce,cF as DLe,cG as Tie,cH as yt,cI as ON,cJ as fUe,cK as pUe,cL as Sd,cM as TLe,cN as Mg,cO as ELe,cP as _Ue,cQ as $k,cR as Eie,cS as Pie,cT as Rie,cU as Mie,cV as bUe,cW as vUe,cX as yUe,cY as wUe,cZ as CUe,c_ as SUe,c$ as PLe,d0 as xUe,d1 as Z7,d2 as Aie,d3 as RLe,d4 as Ty,d5 as NUe,d6 as uB,d7 as at,d8 as p9,d9 as Y0,da as IUe,db as MLe,dc as ALe,dd as kUe,de as LUe,df as OLe,dg as FLe,dh as DUe,di as TUe,dj as EUe,dk as PUe,dl as BLe,dm as RUe,dn as MUe,dp as VLe,dq as AUe,dr as OUe,ds as FUe,dt as zLe,du as BUe,dv as VUe,dw as zUe,dx as WUe,dy as HUe,dz as $Ue,dA as UUe,dB as WLe,dC as jUe,dD as GUe,dE as qUe,dF as KUe,dG as HLe,dH as $Le,dI as JUe,dJ as Aue,dK as YUe,dL as XUe,dM as QUe,dN as ZUe,dO as eje,dP as tje,dQ as ULe,dR as jLe,dS as GLe,dT as nje,dU as ije,dV as sje,dW as oje,dX as rje,dY as aje,dZ as lje,d_ as cje,d$ as dje,e0 as uje,e1 as hje,e2 as qLe,e3 as gje,e4 as mje,e5 as fje,e6 as pje,e7 as _je,e8 as bje,e9 as vje,ea as yje,eb as wje,ec as Cje,ed as Sje,ee as xje,ef as Nje,eg as Y2,eh as Ije,ei as hB,ej as DE,ek as X0,el as KLe,em as aA,en as FI,eo as _9,ep as JLe,eq as Ey,er as YLe,es as XLe,et as QLe,eu as kje,ev as Lje,ew as Mm,ex as Nb,ey as ZLe,ez as eDe,eA as tDe,eB as Dje,eC as Tje,eD as Oue,eE as b9,eF as Oie,eG as Eje,eH as pK,eI as Pje,eJ as Rje,eK as Mje,eL as sb,eM as Aje,eN as Oje,eO as Fje,eP as Fue,eQ as Bje,eR as Vje,eS as zje,eT as Wje,eU as lA,eV as Hje,eW as $je,eX as Uje,eY as jje,eZ as Gje,e_ as qje,e$ as Kje,f0 as Jje,f1 as Yje,f2 as Uk,f3 as Xje,f4 as Qje,f5 as Zje,f6 as eGe,f7 as tGe,f8 as nGe,f9 as nDe,fa as iGe,fb as sGe,fc as oGe,fd as rGe,fe as aGe,ff as lGe,fg as iDe,fh as Fie,fi as Bie,fj as cGe,fk as dGe,fl as uGe,fm as hGe,fn as sDe,fo as gGe,fp as jk,fq as mGe,fr as Q0,fs as Z0,ft as Ao,fu as fGe,fv as Vie,fw as pGe,fx as _Ge,fy as bGe,fz as oDe,fA as rDe,fB as aDe,fC as vGe,fD as yGe,fE as wGe,fF as CGe,fG as SGe,fH as v9,fI as gB,fJ as xGe,fK as NGe,fL as IGe,fM as kGe,fN as LGe,fO as DGe,fP as TGe,fQ as EGe,fR as PGe,fS as RGe,fT as MGe,fU as Bue,fV as AGe,fW as OGe,fX as l_,fY as Vue,fZ as FGe,f_ as zue,f$ as BGe,g0 as VGe,g1 as lDe,g2 as zGe,g3 as WGe,g4 as HGe,g5 as $Ge,g6 as UGe,g7 as iv,g8 as jGe,g9 as GGe,ga as qGe,gb as KGe,gc as JGe}from"./RbLocalizationProvider.OVSr2Odo.js";import{j as nr,J as YGe}from"./jsx-runtime.CBqCNPYB.js";import{g as cA,a as cDe,r as XGe}from"./index.P6snMalu.js";import{r as QGe}from"./index.B3zY1kf7.js";import{R as ZGe,l as eqe,a as tqe,M as dDe,b as Qf,c as nqe,A as iqe,S as sqe,N as oqe,B as uDe,C as y9,L as _K,V as Ve,d as bl,e as os,f as Io,g as Au,h as ro,i as ob,P as dA,j as Ld,T as zx,D as YP,k as hDe,m as rqe,F as Wue,n as mB,o as zie,p as Wie,q as TE,r as gDe,s as aqe,t as lqe,u as Py,G as wg,v as zc,w as Hue,x as EE,y as mDe,Q as $s,O as $ue,E as cqe,z as dqe,H as uqe,I as FN,J as fDe,U as pDe,K as _De,W as hqe,X as gqe,Y as bDe,Z as vDe,_ as yDe,$ as wDe,a0 as mqe,a1 as fqe,a2 as pqe,a3 as CDe,a4 as _qe,a5 as bqe,a6 as SDe,a7 as xDe,a8 as vqe,a9 as BI,aa as yqe,ab as wqe,ac as Cqe,ad as Sqe,ae as xqe,af as Nqe,ag as Iqe,ah as CS,ai as Uue,aj as X2,ak as kqe,al as Hie,am as e$,an as Lqe,ao as Dqe,ap as Tqe,aq as NDe,ar as IDe,as as Eqe,at as SS,au as Pqe,av as xc,aw as Rqe,ax as fB,ay as kDe,az as LDe,aA as DDe,aB as Mqe,aC as Aqe,aD as TDe,aE as Oqe,aF as Fqe,aG as Bqe,aH as Vqe,aI as zqe,aJ as Wqe,aK as Hqe,aL as $qe,aM as Uqe,aN as jqe,aO as Gqe,aP as qqe,aQ as Kqe,aR as Jqe,aS as Yqe,aT as Xqe,aU as Qqe,aV as Zqe,aW as eKe,aX as tKe,aY as EDe,aZ as nKe,a_ as iKe}from"./useFileDownload.DoxMuZkp.js";import{l as $ie,c as Ut,m as Dt,a as Ls,r as Pa,L as w9,b as uA,f as Jv,i as Yl,M as Uie,d as hA,e as gA,g as C9,h as sKe,j as oKe,k as PDe,u as Ib,n as RDe,J as ng,o as rKe,p as aKe,q as lKe,s as cKe,t as dKe,v as MDe,w as jue,x as Gue,y as ADe,z as uKe,A as hKe,R as gKe,B as mKe,C as ODe,D as fKe,E as pKe}from"./index.DdneTN7b.js";import{s as _Ke,h as bKe,E as vKe,a as yKe,c as S9,_ as que}from"./emotion-styled-base.browser.esm.BIcjgOzg.js";function wKe(i,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in i)){const o=Object.getOwnPropertyDescriptor(n,s);o&&Object.defineProperty(i,s,o.get?o:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var Q2={},Kue;function CKe(){if(Kue)return Q2;Kue=1;var i=QGe();return Q2.createRoot=i.createRoot,Q2.hydrateRoot=i.hydrateRoot,Q2}var FDe=CKe();const SKe=cA(FDe),xKe=wKe({__proto__:null,default:SKe},[FDe]),Jue=await F("react");var Yue=function(e,t){var n=arguments;if(t==null||!bKe.call(t,"css"))return Jue.createElement.apply(void 0,n);var s=n.length,o=new Array(s);o[0]=vKe,o[1]=yKe(e,t);for(var r=2;r<s;r++)o[r]=n[r];return Jue.createElement.apply(null,o)};(function(i){var e;e||(e=i.JSX||(i.JSX={}))})(Yue||(Yue={}));function NKe(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return _Ke(e)}function jie(){var i=NKe.apply(void 0,arguments),e="animation-"+i.name;return{name:e,styles:"@keyframes "+e+"{"+i.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.Di1B_zOl.js","assets/useFileDownload.BuzVN3F3.js","assets/RbLocalizationProvider.CI7oesfV.js","assets/__federation_fn_import.DdkEuT6t.js","assets/jsx-runtime.CBqCNPYB.js","assets/index.P6snMalu.js","assets/emotion-styled-base.browser.esm.BIcjgOzg.js","assets/AmrCapabilityControl.oytFydB2.js","assets/index.Bfb-Nfl_.js","assets/cssMode.z2-NHYcV.js","assets/lspLanguageFeatures.DWKaU1VK.js","assets/htmlMode.DPTRrtXh.js","assets/jsonMode.D1_Izqyt.js","assets/javascript.CIU7xZo3.js","assets/typescript.BZLvAXt-.js"])))=>i.map(i=>d[i]);
2
+ import{importShared as F}from"./__federation_fn_import.DdkEuT6t.js";import{c as Hn,b as Q7,a as dD,d as uD,e as j7e,f as OI,u as G7e,R as q7e,g as C0,A as eLe,P as tLe,h as K7e,i as nLe,k as iLe,l as LE,m as sLe,n as J7e,o as Y7e,p as X7e,q as Q7e,F as Z7e,D as e$e,C as t$e,r as n$e,s as i$e,t as s$e,v as o$e,O as r$e,w as a$e,j as u,x as P,L as l$e,T as c$e,y as d$e,z as u$e,B as oLe,E as h$e,S as qm,G as Mu,H as x,I as g$e,J as m$e,K as f$e,M as p$e,N as _$e,Q as b$e,U as H,V as J,W as rLe,X as g9,Y as v$e,Z as aLe,_ as lh,$ as lLe,a0 as cLe,a1 as y$e,a2 as dLe,a3 as uLe,a4 as w$e,a5 as hLe,a6 as gLe,a7 as C$e,a8 as mLe,a9 as ia,aa as S$e,ab as x$e,ac as N$e,ad as I$e,ae as fLe,af as m9,ag as Sie,ah as xie,ai as pLe,aj as _Le,ak as bLe,al as k$e,am as L$e,an as D$e,ao as T$e,ap as E$e,aq as P$e,ar as R$e,as as M$e,at as A$e,au as O$e,av as _o,aw as F$e,ax as B$e,ay as V$e,az as z$e,aA as W$e,aB as H$e,aC as $$e,aD as U$e,aE as j$e,aF as G$e,aG as q$e,aH as iA,aI as K$e,aJ as sA,aK as J$e,aL as hu,aM as vLe,aN as Y$e,aO as X$e,aP as Q$e,aQ as f9,aR as Z$e,aS as e8e,aT as t8e,aU as n8e,aV as oA,aW as gK,aX as Yt,aY as i8e,aZ as Nie,a_ as s8e,a$ as se,b0 as o8e,b1 as r8e,b2 as a8e,b3 as l8e,b4 as c8e,b5 as d8e,b6 as u8e,b7 as h8e,b8 as g8e,b9 as m8e,ba as f8e,bb as p8e,bc as _8e,bd as b8e,be as v8e,bf as y8e,bg as td,bh as w8e,bi as rA,bj as yLe,bk as wLe,bl as C8e,bm as S0,bn as S8e,bo as CLe,bp as mK,bq as SLe,br as fK,bs as ae,bt as x8e,bu as xLe,bv as N8e,bw as I8e,bx as k8e,by as L8e,bz as D8e,bA as T8e,bB as E8e,bC as P8e,bD as R8e,bE as M8e,bF as Iie,bG as NLe,bH as Ms,bI as aw,bJ as tr,bK as ILe,bL as kie,bM as A8e,bN as O8e,bO as F8e,bP as B8e,bQ as V8e,bR as z8e,bS as W8e,bT as H8e,bU as $8e,bV as Lie,bW as me,bX as U8e,bY as et,bZ as j8e,b_ as G8e,b$ as q8e,c0 as J0,c1 as U,c2 as K8e,c3 as J8e,c4 as Y8e,c5 as X8e,c6 as Q8e,c7 as Z8e,c8 as eUe,c9 as tUe,ca as nUe,cb as iUe,cc as kLe,cd as sUe,ce as oUe,cf as rUe,cg as aUe,ch as lUe,ci as cUe,cj as dUe,ck as uUe,cl as hUe,cm as Hk,cn as tt,co as q,cp as Km,cq as Die,cr as ls,cs as gUe,ct as qr,cu as rt,cv as Ti,cw as ir,cx as dB,cy as dt,cz as Cr,cA as Vi,cB as mUe,cC as rn,cD as LLe,cE as Ce,cF as DLe,cG as Tie,cH as yt,cI as ON,cJ as fUe,cK as pUe,cL as Sd,cM as TLe,cN as Mg,cO as ELe,cP as _Ue,cQ as $k,cR as Eie,cS as Pie,cT as Rie,cU as Mie,cV as bUe,cW as vUe,cX as yUe,cY as wUe,cZ as CUe,c_ as SUe,c$ as PLe,d0 as xUe,d1 as Z7,d2 as Aie,d3 as RLe,d4 as Ty,d5 as NUe,d6 as uB,d7 as at,d8 as p9,d9 as Y0,da as IUe,db as MLe,dc as ALe,dd as kUe,de as LUe,df as OLe,dg as FLe,dh as DUe,di as TUe,dj as EUe,dk as PUe,dl as BLe,dm as RUe,dn as MUe,dp as VLe,dq as AUe,dr as OUe,ds as FUe,dt as zLe,du as BUe,dv as VUe,dw as zUe,dx as WUe,dy as HUe,dz as $Ue,dA as UUe,dB as WLe,dC as jUe,dD as GUe,dE as qUe,dF as KUe,dG as HLe,dH as $Le,dI as JUe,dJ as Aue,dK as YUe,dL as XUe,dM as QUe,dN as ZUe,dO as eje,dP as tje,dQ as ULe,dR as jLe,dS as GLe,dT as nje,dU as ije,dV as sje,dW as oje,dX as rje,dY as aje,dZ as lje,d_ as cje,d$ as dje,e0 as uje,e1 as hje,e2 as qLe,e3 as gje,e4 as mje,e5 as fje,e6 as pje,e7 as _je,e8 as bje,e9 as vje,ea as yje,eb as wje,ec as Cje,ed as Sje,ee as xje,ef as Nje,eg as Y2,eh as Ije,ei as hB,ej as DE,ek as X0,el as KLe,em as aA,en as FI,eo as _9,ep as JLe,eq as Ey,er as YLe,es as XLe,et as QLe,eu as kje,ev as Lje,ew as Mm,ex as Nb,ey as ZLe,ez as eDe,eA as tDe,eB as Dje,eC as Tje,eD as Oue,eE as b9,eF as Oie,eG as Eje,eH as pK,eI as Pje,eJ as Rje,eK as Mje,eL as sb,eM as Aje,eN as Oje,eO as Fje,eP as Fue,eQ as Bje,eR as Vje,eS as zje,eT as Wje,eU as lA,eV as Hje,eW as $je,eX as Uje,eY as jje,eZ as Gje,e_ as qje,e$ as Kje,f0 as Jje,f1 as Yje,f2 as Uk,f3 as Xje,f4 as Qje,f5 as Zje,f6 as eGe,f7 as tGe,f8 as nGe,f9 as nDe,fa as iGe,fb as sGe,fc as oGe,fd as rGe,fe as aGe,ff as lGe,fg as iDe,fh as Fie,fi as Bie,fj as cGe,fk as dGe,fl as uGe,fm as hGe,fn as sDe,fo as gGe,fp as jk,fq as mGe,fr as Q0,fs as Z0,ft as Ao,fu as fGe,fv as Vie,fw as pGe,fx as _Ge,fy as bGe,fz as oDe,fA as rDe,fB as aDe,fC as vGe,fD as yGe,fE as wGe,fF as CGe,fG as SGe,fH as v9,fI as gB,fJ as xGe,fK as NGe,fL as IGe,fM as kGe,fN as LGe,fO as DGe,fP as TGe,fQ as EGe,fR as PGe,fS as RGe,fT as MGe,fU as Bue,fV as AGe,fW as OGe,fX as l_,fY as Vue,fZ as FGe,f_ as zue,f$ as BGe,g0 as VGe,g1 as lDe,g2 as zGe,g3 as WGe,g4 as HGe,g5 as $Ge,g6 as UGe,g7 as iv,g8 as jGe,g9 as GGe,ga as qGe,gb as KGe,gc as JGe}from"./RbLocalizationProvider.CI7oesfV.js";import{j as nr,J as YGe}from"./jsx-runtime.CBqCNPYB.js";import{g as cA,a as cDe,r as XGe}from"./index.P6snMalu.js";import{r as QGe}from"./index.B3zY1kf7.js";import{R as ZGe,l as eqe,a as tqe,M as dDe,b as Qf,c as nqe,A as iqe,S as sqe,N as oqe,B as uDe,C as y9,L as _K,V as Ve,d as bl,e as os,f as Io,g as Au,h as ro,i as ob,P as dA,j as Ld,T as zx,D as YP,k as hDe,m as rqe,F as Wue,n as mB,o as zie,p as Wie,q as TE,r as gDe,s as aqe,t as lqe,u as Py,G as wg,v as zc,w as Hue,x as EE,y as mDe,Q as $s,O as $ue,E as cqe,z as dqe,H as uqe,I as FN,J as fDe,U as pDe,K as _De,W as hqe,X as gqe,Y as bDe,Z as vDe,_ as yDe,$ as wDe,a0 as mqe,a1 as fqe,a2 as pqe,a3 as CDe,a4 as _qe,a5 as bqe,a6 as SDe,a7 as xDe,a8 as vqe,a9 as BI,aa as yqe,ab as wqe,ac as Cqe,ad as Sqe,ae as xqe,af as Nqe,ag as Iqe,ah as CS,ai as Uue,aj as X2,ak as kqe,al as Hie,am as e$,an as Lqe,ao as Dqe,ap as Tqe,aq as NDe,ar as IDe,as as Eqe,at as SS,au as Pqe,av as xc,aw as Rqe,ax as fB,ay as kDe,az as LDe,aA as DDe,aB as Mqe,aC as Aqe,aD as TDe,aE as Oqe,aF as Fqe,aG as Bqe,aH as Vqe,aI as zqe,aJ as Wqe,aK as Hqe,aL as $qe,aM as Uqe,aN as jqe,aO as Gqe,aP as qqe,aQ as Kqe,aR as Jqe,aS as Yqe,aT as Xqe,aU as Qqe,aV as Zqe,aW as eKe,aX as tKe,aY as EDe,aZ as nKe,a_ as iKe}from"./useFileDownload.BuzVN3F3.js";import{l as $ie,c as Ut,m as Dt,a as Ls,r as Pa,L as w9,b as uA,f as Jv,i as Yl,M as Uie,d as hA,e as gA,g as C9,h as sKe,j as oKe,k as PDe,u as Ib,n as RDe,J as ng,o as rKe,p as aKe,q as lKe,s as cKe,t as dKe,v as MDe,w as jue,x as Gue,y as ADe,z as uKe,A as hKe,R as gKe,B as mKe,C as ODe,D as fKe,E as pKe}from"./index.Bfb-Nfl_.js";import{s as _Ke,h as bKe,E as vKe,a as yKe,c as S9,_ as que}from"./emotion-styled-base.browser.esm.BIcjgOzg.js";function wKe(i,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in i)){const o=Object.getOwnPropertyDescriptor(n,s);o&&Object.defineProperty(i,s,o.get?o:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var Q2={},Kue;function CKe(){if(Kue)return Q2;Kue=1;var i=QGe();return Q2.createRoot=i.createRoot,Q2.hydrateRoot=i.hydrateRoot,Q2}var FDe=CKe();const SKe=cA(FDe),xKe=wKe({__proto__:null,default:SKe},[FDe]),Jue=await F("react");var Yue=function(e,t){var n=arguments;if(t==null||!bKe.call(t,"css"))return Jue.createElement.apply(void 0,n);var s=n.length,o=new Array(s);o[0]=vKe,o[1]=yKe(e,t);for(var r=2;r<s;r++)o[r]=n[r];return Jue.createElement.apply(null,o)};(function(i){var e;e||(e=i.JSX||(i.JSX={}))})(Yue||(Yue={}));function NKe(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return _Ke(e)}function jie(){var i=NKe.apply(void 0,arguments),e="animation-"+i.name;return{name:e,styles:"@keyframes "+e+"{"+i.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}/**
3
3
  * @license lucide-react v0.486.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -371,9 +371,9 @@ Execution control:
371
371
  pause() # pause the script step
372
372
  stop() # stop the script step
373
373
  check_stop() # check if the script step is stopped
374
- """`}}},Tgt={label:"program.button.variables",command:"Variables",icon:UUe,data:{method:"Variables",summary:"",funcName:"rb_program_sdk.set_variables",args:{variables:[]}}},Zu={label:"program.button.preProgram",command:"ActionPre",icon:AUe,data:{method:"ActionPre",name:"PreProgram"},requireChildren:!0,isStrict:!0,notAllowChildren:["Move","MoveJ","MoveL","MoveJB","MoveLB","MoveXB","Point","ForceControl","Conveyor","Weaving"]},Ya={label:"program.button.postProgram",command:"ActionPost",icon:OUe,data:{method:"ActionPost",name:"PostProgram"},requireChildren:!0,isStrict:!0,notAllowChildren:["Move","MoveJ","MoveL","MoveJB","MoveLB","MoveXB","Point","ForceControl","Conveyor","Weaving"]},Egt={label:"program.button.subTask",command:"SubTask",icon:FUe,confirmModal:Wht},vRe={label:"program.button.sync",command:"Sync",icon:RUe,disabled:Yl(),data:{method:"Sync",summary:"Flag => 1",args:{flag:"1",timeout:null}}},a4={label:"program.button.thread",command:"Thread",icon:VLe,confirmModal:$ht,factoryDataFn:async i=>({method:"Thread",taskId:dt.uniqueId(),summary:"",memo:"",name:"General Thread",args:{thread_type:"GENERAL",disable_pause:!1}}),requireChildren:!0,isStrict:!0,notAllowChildren:["Move","MoveJ","MoveL","MoveJB","MoveLB","MoveXB","Point","ForceControl","Conveyor","Weaving","Thread","CallEvent","ActionPost"]},zB={label:"program.button.callEventThread",command:"CallEvent",icon:VLe,factoryDataFn:i=>({method:"CallEvent",summary:"Call: Ev Th 1",name:"Call Event Thread",args:{index:0}}),requireChildren:!1,isStrict:!1,notAllowChildren:[]},Pgt={label:"program.button.interface",command:"Interface",icon:qUe,data:{method:"Interface",summary:"",funcName:"rb_program_sdk.interface",args:{option:"MODBUS_CLIENT",data:{type:"WRITE",server_ip:"",server_port:502,function_code:6,timeout_sec:null,register_addr:null,number_of_read:null,payload:null,return_variable_name:null,resolve_option:"SKIP"}}}},Rgt={label:"program.button.vision",command:"Vision",icon:hje,data:{method:"Vision",summary:"",funcName:"rb_manipulate_sdk.vision.vision",args:{option:"MECHMIND_INTERFACE",data:{type:"CONNECT",function_code:99,timeout_sec:null,server_ip:"",server_port:5e4,resolve_option:"SKIP"}}}},Mgt={label:"program.button.userInput",command:"UserInput",icon:GUe,data:{method:"UserInput",funcName:"rb_program_sdk.user_input",summary:"",args:{mode:"USER_INPUT",var_form:"STRING",var_selection:void 0}}},yRe={label:"program.button.changeProgram",command:"ChangeProgram",icon:KUe,confirmModal:ygt,disabled:Yl()},DA=[xgt,vRe,{...Xme,data:{...Xme.data,funcName:"rb_program_sdk.alarm_or_halt"}},a4,Zu,Ya,Egt,r4,Ngt,vJ,Lgt,_J,kgt,bJ,bRe,Tgt,Dgt,Igt,Mgt,Pgt,yRe],By=[{label:"program.button.movej",command:"MoveJ",icon:HLe,data:{method:"MoveJ",args:{robot_model:"",move_type:"J",orientation:null,running_mode:null}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.movel",command:"MoveL",icon:$Le,data:{method:"MoveL",args:{robot_model:"",move_type:"L",orientation:null,running_mode:null}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.movejb",command:"MoveJB",icon:JUe,data:{method:"MoveJB",funcName:"rb_manipulate_sdk.move.call_move_jb_clr",postFuncName:"rb_manipulate_sdk.move.call_move_jb_run",args:{robot_model:"",move_type:"JB",orientation:null,running_mode:null}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.movelb",command:"MoveLB",icon:Aue,data:{method:"MoveLB",funcName:"rb_manipulate_sdk.move.call_move_lb_clr",postFuncName:"rb_manipulate_sdk.move.call_move_lb_run",args:{robot_model:"",move_type:"LB",orientation:0,running_mode:null}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.movepb",command:"MovePB",icon:Aue,data:{method:"MovePB",funcName:"rb_manipulate_sdk.move.call_move_pb_clr",postFuncName:"rb_manipulate_sdk.move.call_move_pb_run",args:{robot_model:"",move_type:"PB",orientation:0,running_mode:null}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.movexb",command:"MoveXB",icon:YUe,data:{method:"MoveXB",funcName:"rb_manipulate_sdk.move.call_move_xb_clr",postFuncName:"rb_manipulate_sdk.move.call_move_xb_run",args:{robot_model:"",move_type:"XB",orientation:null,running_mode:0}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.point",command:"Point",icon:XUe,allowParents:["MoveJ","MoveL","MoveJB","MoveLB","MoveXB"],requireParent:!0,factoryDataFn:async i=>{let e=[0,0,0,0,0,0,0],t=-1;i?.args?.move_type?.startsWith("J")?t=-1:i?.args?.move_type?.startsWith("L")&&(t=0);try{const{jointQRef:s,carteXRef:o}=await e0({robot_model:i.args?.robot_model});s&&t===-1&&(e=s.map(r=>Number(r.toFixed(3)))),o&&t===0&&(e=o.map(r=>Number(r.toFixed(3))))}catch(s){console.error("Error fetching jointQRef",s)}return{method:"Point",summary:`${UN[0].summary} , ${e.map(s=>s.toFixed(3)).join(", ")}`,funcName:"rb_manipulate_sdk.point.set_point",args:{robot_model:"$parent.robot_model",move_type:"$parent.move_type",input_method:0,pnt_para:100,pnt_type:0,tar_frame:t,tar_unit:0,tar_values:e,spd_mode:0,spd_vel_para:.4,spd_acc_para:.1,tcp_num:-1,orientation:"$parent.orientation",running_mode:"$parent.running_mode",method:0}}}},{label:"program.button.pinPoint",command:"PinPoint",icon:QUe,factoryDataFn:async(i,e)=>{let t=[0,0,0,0,0,0,0];try{const{carteXRef:n}=await e0({robot_model:e});n&&(t=n.map(s=>Number(s.toFixed(3))))}catch(n){console.error("Error fetching carteXRef",n)}return{method:"PinPoint",summary:`${UN[0].summary} , ${t.map(n=>n.toFixed(3)).join(", ")}`,funcName:"rb_manipulate_sdk.program.set_pin_point_or_joint",args:{input_method:0,pin_type:"POINT",target:{tar_frame:0,tar_unit:0,tar_values:t}}}}},{label:"program.button.pinJoint",command:"PinJoint",icon:ZUe,factoryDataFn:async(i,e)=>{let t=[0,0,0,0,0,0,0];try{const{jointQRef:n}=await e0({robot_model:e});n&&(t=n.map(s=>Number(s.toFixed(3))))}catch(n){console.error("Error fetching jointQRef",n)}return{method:"PinJoint",summary:`${UN[0].summary} , ${t.map(n=>n.toFixed(3)).join(", ")}`,funcName:"rb_manipulate_sdk.program.set_pin_point_or_joint",args:{input_method:0,pin_type:"JOINT",target:{tar_frame:-1,tar_unit:0,tar_values:t}}}}},{label:"program.button.home",command:"PosHome",icon:eje,data:{method:"PosHome",funcName:"rb_manipulate_sdk.move.call_move_home",summary:"Move-J, Top-Level (Main) Project",args:{home_type:0,move_type:0,speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1}}}},{label:"program.button.motionMacro",command:"MotionMacro",icon:tje,data:{method:"MotionMacro",summary:"Flat Surface",funcName:"rb_manipulate_sdk.service.call_move_macro",args:{type:0,corner_pnts:["RB_JOINT_REF","RB_JOINT_REF","RB_JOINT_REF","RB_JOINT_REF"],speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1},rotation_mode:0,gap_num:0,margin_h_1:0,margin_h_2:0,margin_w_1:0,margin_w_2:0,margin_over:0,margin_over_para:0}}},{label:"program.button.circle",command:"Circle",icon:ULe,factoryDataFn:async(i,e)=>{let t=[0,0,0,0,0,0,0];try{const{carteXRef:n}=await e0({robot_model:e});n&&(t=n.map(s=>Number(s.toFixed(3))))}catch(n){console.error("Error fetching carteXRef",n)}return{method:"Circle",funcName:"rb_manipulate_sdk.move.call_move_cir_axis",summary:Xv[0].summary,args:{center:{input_method:0,tar_frame:0,tar_unit:0,tar_values:t,ref_point:""},axis:{input_method:0,tar_frame:0,tar_unit:0,tar_values:t,ref_point:""},angle:0,mode:0,speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1},radius_option:0,radius_para:0}}}},{label:"program.button.gcode",command:"Gcode",icon:WLe,data:{method:"Gcode",funcName:"rb_manipulate_sdk.service.call_move_gcode",args:{filename:"",gcodeframe:0,feed_spd_default:0,feed_spd_rapid:0,feed_spd_limit:0,feed_spd_rotation:0,default_plane:0,offset_x:0,offset_y:0,offset_z:0}}},{label:"program.button.replay",command:"Replay",icon:jLe,data:{method:"Replay",summary:"",funcName:"rb_manipulate_sdk.service.call_replay_motion_run",args:{filename:"",type:0,speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1}}}},{label:"program.button.set",command:"Setting",icon:GLe,data:{method:"Setting",summary:"Out Collision - Off",name:"Set",funcName:"rb_manipulate_sdk.program.setting",args:{option:"OUT_COLLISION",out_collision:{onoff:0,react_mode:0,threshold:0}}}},{label:"program.button.tcpSet",command:"TcpSetting",icon:nje,factoryDataFn:async(i,e)=>{let t="";try{const{tConfigs0:n}=await fEe({robot_model:e});t=n.toolName}catch(n){console.error("Error fetching tool list",n)}return{method:"TcpSetting",summary:t,name:"TCP Set",funcName:"rb_manipulate_sdk.config.set_toollist_num",args:{tool_num:0}}}},{label:"program.button.timer",command:"Timer",icon:BLe,data:{method:"Timer",summary:"Timer 0, Reset Time: 0sec",funcName:"rb_manipulate_sdk.service.call_timer_function",args:{timer_no:0,reset_time:0,option_increase:0,option_action:0}}},{label:"program.button.weaving",command:"Weaving",icon:ije,data:{method:"Weaving",summary:"Off",funcName:"rb_manipulate_sdk.move.call_tcp_weaving_off",args:{}}},{label:"program.button.arcSensing",command:"ArcSensing",icon:sje,data:{method:"ArcSensing",summary:"Off",funcName:"rb_manipulate_sdk.move.call_arc_sensing_off"}},{label:"program.button.conveyor",command:"Conveyor",icon:oje,data:{method:"Conveyor",summary:um[0].summary,funcName:"rb_manipulate_sdk.move.call_base_conveyor_off",args:{stop_time_sec:0}}},{label:"program.button.forceCtrl",command:"ForceControl",icon:rje,data:{method:"ForceControl",funcName:"rb_manipulate_sdk.move.call_admittance_force_off"}},{label:"program.button.dout",command:"DOut",icon:aje,data:{method:"DOut",summary:`${pJ[0].summary}: ${gRe.GENERAL.summary}`,memo:"",funcName:"rb_manipulate_sdk.io.call_multiple_side_dout",args:{side_dout_args:BB}}},{label:"program.button.aout",command:"AOut",icon:lje,data:{method:"AOut",summary:"",memo:"",funcName:"rb_manipulate_sdk.io.call_multiple_side_aout",args:{side_aout_args:_Re}}},{label:"program.button.toolout",command:"ToolOut",icon:cje,data:{method:"ToolOut",summary:`${AB[0].label}, ${VB.map((i,e)=>`${e}: Bypass`).join(", ")}`,memo:"",funcName:"rb_manipulate_sdk.program.tool_out",args:{tool_voltage:"-1",tool_dout_args:VB}}},{label:"program.button.gripper",command:"Gripper",icon:dje,factoryDataFn:async(i,e)=>{let t;try{const{attachOption:n}=await fRe({robot_model:e});n<0?t=0:t=n}catch(n){console.error("Error fetching gripper",n),t=0}return{method:"Gripper",summary:`${UI[t].label} - Initialize`,funcName:"rb_manipulate_sdk.service.call_gripper_action",args:{gripper_type:t,function_list:0,payload:UI[t].initPayload}}}},{label:"program.button.welder",command:"Welding",icon:uje,data:{method:"Welding",summary:t0[0].summary,funcName:"rb_manipulate_sdk.service.call_weld_arc_off",args:{time_start:0,cond_mode:0,cond_option:0,cond_jobno:1,cond_current:0,cond_voltage:0,cond_feedrate:0,cond_arccontrol:0,cond_arclength:0,cond_para1:0,cond_para2:0,time_crator:0,time_ending:0}}},Rgt,{label:"program.button.functionCall",command:"FunctionCall",icon:qLe,data:{method:"FunctionCall",summary:"",funcName:"rb_manipulate_sdk.get_data.call_functions",args:{calls:[]}}},{label:"program.button.pattern",command:"Pattern",icon:gje,data:{method:"Pattern",summary:`ID 0, ${MB[0].summary}`,funcName:"rb_manipulate_sdk.service.call_pattern_on",postFuncName:"rb_manipulate_sdk.service.call_pattern_off",args:{id:0,type:0,count_x:2,count_y:2,count_z:2,anchor_pnt:"RB_JOINT_REF",incremental:1,corner_pnts:["RB_JOINT_REF","RB_JOINT_REF"]},postArgs:{id:0}},requireChildren:!0},{label:"progarm.button.rs485",command:"SerialCommunication",icon:mje,disabled:!0},{label:"program.button.touchSensing",command:"TouchSensing",icon:fje,disabled:!0}],n6=[{label:"amr.button.goal",command:"Goal",icon:pje,data:(()=>{const i={robot_model:"",goal_id:"",goal_name:"",preset:0,method:"pp"};return{method:"Goal",summary:`Move Goal - Goal Id: ${i.goal_id}, Preset: ${i.preset}, Method: ${i.method}`,funcName:"rb_amr_sdk.move.send_move_goal",args:i}})()},{label:"amr.button.target",command:"Target",icon:_je,data:(()=>{const i={robot_model:"",x:0,y:0,z:0,rz:0,method:"pp",preset:0};return{method:"Target",funcName:"rb_amr_sdk.move.send_move_target",summary:`Move Target - X: ${i.x}m, Y: ${i.y}m, Z: ${i.z}m, ${i.rz}deg`,args:i}})()},{label:"amr.button.linear",command:"Linear",icon:bje,data:(()=>{const i={robot_model:"",axis_option:"x",target:0,speed:0};return{method:"Linear",funcName:"rb_amr_sdk.move.send_move_x_linear",summary:`Move Linear - Axis: ${i.axis_option.toUpperCase()}, Target: ${i.target}m, Speed: ${i.speed}m/s`,args:i}})()},{label:"amr.button.rotate",command:"Rotate",icon:ULe,data:(()=>{const i={robot_model:"",target:0,speed:0};return{method:"Rotate",funcName:"rb_amr_sdk.move.send_move_rotate",summary:`Move Rotate - Target: ${i.target}m, Speed: ${i.speed}m/s`,args:i}})()},{label:"amr.button.map_load",command:"MapLoad",icon:vje,data:(()=>{const i={robot_model:"",map_name:""};return{method:"MapLoad",funcName:"rb_amr_sdk.map.map_load",summary:`Map Load - ${i.map_name}`,args:i}})()},{label:"amr.button.loc_init",command:"LocalizationInit",icon:yje,data:(()=>{const i={robot_model:"",x:0,y:0,z:0,rz:0};return{name:"Localization Init",method:"LocalizationInit",funcName:"rb_amr_sdk.localization.localization_init",summary:`${Ux[0].summary} ${`X: ${i.x}, Y: ${i.y}, Z: ${i.z}, RZ: ${i.rz}`}`,args:i}})()},{label:"amr.button.loc_control",command:"LocalizationControl",icon:wje,data:{name:"Localization Start",method:"LocalizationControl",funcName:"rb_amr_sdk.localization.localization_start",summary:"Localization "+J3[0].summary,args:{robot_model:""}}},{label:"amr.button.hw_control",command:"HardwareCtrl",icon:GLe,data:{method:"HardwareCtrl",funcName:"rb_amr_sdk.control.control_set_motor",summary:Xg[0].summary+": Off",args:{robot_model:"",switch:!1}}},{label:"amr.button.dock",command:"Dock",icon:Cje,data:{method:"Dock",funcName:"rb_amr_sdk.control.control_dock",summary:VK[0].summary,args:{robot_model:""}}},{label:"amr.button.obs_box",command:"SetObsBox",icon:Sje,data:(()=>{const i={robot_model:"",min_x:0,min_y:0,min_z:0,max_x:1,max_y:1,max_z:1,map_range:0};return{name:"OBS Box",method:"SetObsBox",funcName:"rb_amr_sdk.control.control_set_obs_box",summary:`Min - [X: ${i.min_x}, Y: ${i.min_y}, Z: ${i.min_z}], Max - [X: ${i.max_x}, Y: ${i.max_y}, Z: ${i.max_z}], Map Range: ${i.map_range}`,args:i}})()},{label:"amr.button.set_safety",command:"SetSafety",icon:xje,data:(()=>{const i={robot_model:"",safety_field:0};return{method:"SetSafety",funcName:"rb_amr_sdk.control.control_set_safety_field",summary:Sf[0].summary+": "+i.safety_field,args:i}})()},{label:"program.button.canBus",command:"CANBus",icon:Nje,iconClassName:"w-10 h-8 object-contain object-center",data:{method:"CANBus",summary:eg[0].summary,funcName:eg[0].value,args:{channel:null,bitrate:1e6,fd:!1,dataBitrate:0,receiveOwnMessages:0,interface:tRe}}},{label:"amr.button.stream",command:"Stream",icon:jLe,data:{method:"Stream",funcName:"rb_amr_sdk.control.control_stream_frequency",args:{robot_model:"",target:"camera",frequency:0}},disabled:!0}],Yse=[{label:"program.button.movel",command:"MoveL_Y1",icon:$Le,data:{method:"MoveL_Y1",funcName:"rb_rby1_sdk.move_l",args:{type:"l",target:{},minimum_time:3}}},{label:"program.button.movej",command:"MoveJ_Y1",icon:HLe,data:{method:"MoveJ_Y1",funcName:"rb_rby1_sdk.move_j",args:{type:"j",target:{},minimum_time:3}}}];let yJ=!1;const Agt=100,Ogt=100,Fgt={initialInfo:{programInfo:null,beginInfo:null,treeItems:null,subTreeItems:null},programInfo:null,beginInfo:null,multiSelectMode:!1,selectedItems:null,showItem:null,copiedItems:[],treeItems:null,subTreeItems:null,undoStack:[],redoStack:[],isChanged:!1},Bgt={getItem:async i=>{const e=await Ntt(i);return typeof e=="string"?e:null},setItem:async(i,e)=>{yJ&&await Itt(i,e)},removeItem:async i=>{await ktt(i)}},Kh=(i,e,t,n,s)=>{if(O9(e?.programId))return!1;const o=dt.cloneDeep(n),r=dt.cloneDeep(i.treeItems),a=dt.cloneDeep(s),l=dt.cloneDeep(i.subTreeItems),c=h=>{if(h)for(const g of h)delete g.state,delete g.collapsed,g.children&&c(g.children)},d=h=>{if(h)for(const g of h)c(g.steps)};for(const h of Object.keys(o??{}))c(o[h]);for(const h of Object.keys(r??{}))c(r[h]);for(const h of Object.keys(a??{}))d(a[h]);for(const h of Object.keys(l??{}))d(l[h]);return!uEe({...i,treeItems:r,subTreeItems:l},{programInfo:e,beginInfo:t,treeItems:o,subTreeItems:a})},Vgt=gse()(dEe(fse((i,e)=>({...Fgt,setInitialInfo:(t,n=!1)=>{const s=e().programInfo,o=e().treeItems,r=e().subTreeItems,a=e().showItem,l=e().selectedItems,c=e().copiedItems,d=e().undoStack,h=e().redoStack,g=e().beginInfo,m=dt.cloneDeep(t),f=m.treeItems?Object.entries(m.treeItems).reduce((_,[b,v])=>(_[b]=v.length===0?[{...Za,stepId:dt.uniqueId(),taskId:b,programId:m.programInfo?.programId}]:v,_),{}):null,p=m.subTreeItems?dt.cloneDeep(m.subTreeItems):null;i({initialInfo:{...m,treeItems:f,subTreeItems:p},programInfo:n?m.programInfo:s,beginInfo:n?m.beginInfo:g,treeItems:n?f:o,subTreeItems:n?p:r,showItem:n?null:a,selectedItems:n?null:l,copiedItems:n?[]:c,undoStack:n?[]:d,redoStack:n?[]:h,isChanged:n?!1:Kh(m,s,g,o,r)})},setProgramInfo:t=>{i({programInfo:t,isChanged:Kh(e().initialInfo,t,e().beginInfo,e().treeItems,e().subTreeItems)})},setBeginInfo:(t,n)=>{n&&!n.speed_ratio&&(n.speed_ratio=null),i({beginInfo:{...e().beginInfo,[t]:n},isChanged:Kh(e().initialInfo,e().programInfo,{...e().beginInfo,[t]:n},e().treeItems,e().subTreeItems)})},setSelectedItems:t=>{const n=e().selectedItems,s=n?.find(o=>o.stepId===t.stepId);if(e().multiSelectMode){if(n?.some(r=>r.parentStepId!==t.parentStepId)){rt.openToast({title:Y2("program.select.notAllowed.title"),content:Y2("program.select.notAllowed.differentParent"),type:"basic",variant:"warning"});return}if(t.groupId){const a=sl(dt.cloneDeep(e().treeItems?.[t.taskId]??[]),{excludeEmpty:!0}).filter(c=>c.groupId===t.groupId);if(!(a?.length>0&&a?.[0]?.stepId===t.stepId)){rt.openToast({title:Y2("program.select.notAllowed.title"),content:Y2("program.select.notAllowed.selectFirstGroupItem"),type:"basic",variant:"warning"});return}}i(s?{selectedItems:dt.sortBy(n?.filter(r=>r.stepId!==t.stepId),"order")}:{selectedItems:dt.sortBy([...n??[],t],"order")})}else i({selectedItems:[t],showItem:s&&t.method!==Za.method?t:null})},setShowItem:t=>{i({showItem:t})},resetSelectedItems:()=>{i({selectedItems:[],showItem:null})},setTreeItems:(t,n)=>{const s={...Za,stepId:dt.uniqueId(),taskId:t,programId:e().programInfo?.programId},o=n.length===0?[s]:n;wl(o),i(r=>({treeItems:{...r.treeItems,[t]:o},selectedItems:n.length===0?[s]:r.selectedItems,isChanged:Kh(r.initialInfo,r.programInfo,r.beginInfo,{...r.treeItems,[t]:o},r.subTreeItems)}))},setOneTreeItem:(t,n,s)=>{const o=e().treeItems[t]?.length?e().treeItems[t]:[{...Za,stepId:dt.uniqueId(),taskId:t,programId:e().programInfo?.programId}],r=dt.cloneDeep(o),a=dt.cloneDeep(e().selectedItems);wl(r);const l=h=>{for(let g=0;g<h.length;g++){const m=h[g];if(m.stepId===n)return h[g]={...s},!0;if(m.children&&m.children.length>0&&l(m.children))return!0}return!1};if(!l(r))return;const d={...e().treeItems,[t]:r};i({treeItems:d,selectedItems:a?.map(h=>h.stepId===n?s:h)??null,isChanged:Kh(e().initialInfo,e().programInfo,e().beginInfo,d,e().subTreeItems)})},setAllTreeItems:t=>{const n=dt.cloneDeep(e().treeItems),s=Object.keys(t??{});for(const o of s)uEe(n[o],t[o])||(n[o]=t[o]?.length===0?[{...Za,stepId:dt.uniqueId(),taskId:o,programId:e().programInfo?.programId}]:t[o],wl(n[o]));i({treeItems:n,isChanged:Kh(e().initialInfo,e().programInfo,e().beginInfo,n,e().subTreeItems)})},setSubTreeItems:(t,n)=>{for(const s of n)wl(s.steps);i(s=>({subTreeItems:{...s.subTreeItems,[t]:n??[]},isChanged:Kh(s.initialInfo,s.programInfo,s.beginInfo,s.treeItems,{...s.subTreeItems,[t]:n})}))},setOneSubTreeStepItem:(t,n,s,o)=>{const r=e().subTreeItems?.[t]?.find(f=>f.taskId===n)?.steps?.length?e().subTreeItems?.[t]?.find(f=>f.taskId===n)?.steps:[{...Za,stepId:dt.uniqueId(),taskId:n,programId:e().programInfo?.programId}],a=dt.cloneDeep(r),l=dt.cloneDeep(e().selectedItems);wl(a);const c=f=>{for(let p=0;p<f.length;p++){const _=f[p];if(_.stepId===s)return f[p]={...o},!0;if(_.children&&_.children.length>0&&c(_.children))return!0}return!1};if(!c(a))return;const h=[...e().subTreeItems?.[t]??[]],g=h.findIndex(f=>f.taskId===n);g===-1?h.push({taskId:n,steps:a}):h[g]={taskId:n,steps:a};const m={...e().subTreeItems,[t]:h};i({subTreeItems:m,selectedItems:l?.map(f=>f.stepId===s?o:f)??null,isChanged:Kh(e().initialInfo,e().programInfo,e().beginInfo,e().treeItems,m)})},setOneSubTreeItem:(t,n,s)=>{if(s?.steps?.length===0){const c=e().subTreeItems[t]?.filter(h=>h.taskId!==n),d={...e().subTreeItems,[t]:c};i({subTreeItems:d,isChanged:Kh(e().initialInfo,e().programInfo,e().beginInfo,e().treeItems,d)});return}const r=e().subTreeItems?.[t]?.findIndex(c=>c.taskId===n)??-1,a=[...e().subTreeItems?.[t]??[]];wl(s.steps),r===-1?a.push(s):a[r]=s;const l={...e().subTreeItems,[t]:a};i({subTreeItems:l,isChanged:Kh(e().initialInfo,e().programInfo,e().beginInfo,e().treeItems,l)})},setAllSubTreeItems:t=>{for(const n of Object.values(t??{}))for(const s of n)wl(s.steps);i(n=>({subTreeItems:t??{},isChanged:Kh(n.initialInfo,n.programInfo,n.beginInfo,n.treeItems,t)}))},setAllTreeItemsToIdle:()=>{const t=dt.cloneDeep(e().treeItems);if(!t)return;const n=o=>{for(const r of o)r.state="idle",r.children&&n(r.children)},s=Object.keys(t??{});for(const o of s)n(t[o]);i({treeItems:t})},setStepInfo:(t,n,s,o)=>{const r=!!e().treeItems[t];let a=r?t:"";Object.entries(e().subTreeItems??{}).forEach(([l,c])=>{Array.isArray(c)&&c.find(d=>d.taskId===t)&&(a=l)}),r?e().setOneTreeItem(t,n,s):e().setOneSubTreeStepItem(a,t,n,s),o?.resetShowItem&&e().setShowItem(null)},setCopiedItems:t=>{i({copiedItems:t})},setMultiSelectMode:t=>{i(n=>({...n,multiSelectMode:t,selectedItems:!t&&n.multiSelectMode?[]:n.selectedItems}))},setUndoStack:t=>{t.length>Agt&&t.shift(),i({undoStack:t})},setRedoStack:t=>{t.length>Ogt&&t.shift(),i({redoStack:t})}}),{name:"program-store",storage:mse(()=>Bgt),partialize:i=>({initialInfo:i.initialInfo,programInfo:i.programInfo,beginInfo:i.beginInfo,treeItems:i.treeItems,subTreeItems:i.subTreeItems,isChanged:i.isChanged}),onRehydrateStorage:()=>(console.log("[program-store] rehydrate start"),yJ=!1,(i,e)=>{if(e){console.warn("[program-store] rehydrate error",e);return}yJ=!0,console.log("[program-store] rehydrate success",i)})}),{name:"program-store",store:"program-store",enabled:!1})),ie=Vgt,{useMutation:zgt}=await F("@tanstack/react-query"),Wgt="/program/edit",Hgt=async i=>await Ut.put(Wgt,i),wRe=()=>zgt({mutationFn:Hgt}),{useMutation:$gt}=await F("@tanstack/react-query"),Ugt="/program/delete/{program_id}",jgt=async i=>{const{program_id:e}=i,t=Ugt.replace("{program_id}",e);return await Ut.delete(t)},Ggt=()=>$gt({mutationFn:jgt}),qgt=()=>{const{t:i}=q(),e=ie(d=>d.programInfo),t=ie(d=>d.setInitialInfo),{confirmDialog:n}=jn(),s=ir(),{refetch:o}=As(),{mutateAsync:r,isPending:a}=Ggt();return{handleDeleteProgram:async d=>{const{programId:h,programName:g}=d;if(!h)return;if(await n({title:i("program.delete.confirm.title"),content:u(U,{className:"gap-1",children:u("p",{className:"text-base",children:i("program.delete.confirm.content",{programName:g})})})}))try{await r({program_id:h}),rt.openToast({title:i("program.delete.toast.successTitle"),content:i("program.delete.toast.successContent"),type:"basic",variant:"success"}),e?.programId===h&&(await o(),t({programInfo:null,treeItems:null,subTreeItems:null,beginInfo:null},!0),s("./",{replace:!0}))}catch(f){throw rt.openToast({title:i("program.delete.toast.failTitle"),content:i("program.delete.toast.failContent"),type:"basic",variant:"danger"}),f}},isLoading:a}},{useMutation:Kgt}=await F("@tanstack/react-query"),Jgt="/program/load",Ygt=async i=>await Ut.post(Jgt,i),CRe=()=>Kgt({mutationFn:Ygt}),{useCallback:Qme,useRef:Xgt,useState:Qgt}=await F("react"),SRe=()=>{const i=Xgt(!1),{t:e}=q(),t=ie(h=>h.isChanged),n=ie(h=>h.setInitialInfo),{confirmDialog:s}=jn(),{refetch:o}=As(),[r,a]=Qgt(!1),{mutateAsync:l}=CRe(),c=Qme(h=>{a(h),i.current=h},[]);return{handleLoadProgram:Qme(async(h,g)=>{const{programId:m,programName:f}=h;if(!m&&i.current)return;if(g?!0:await s({title:e("program.modal.button.load"),content:x(U,{className:"gap-1",children:[u("p",{className:"text-base",children:e("program.load.confirm.content",{programName:f})}),u("span",{className:"text-sm text-slate-400",children:t?e("program.load.confirm.unsavedNotice"):""})]})}))try{c(!0);const{program:_,mainSteps:b,subSteps:v,mainTasks:w}=await l({programId:m});n({programInfo:_,treeItems:b,subTreeItems:v,beginInfo:w.reduce((y,S)=>(y[S.taskId]=S.begin,y),{})},!0),o()}catch(_){rt.openToast({title:e("program.load.toast.failTitle"),content:e("program.load.toast.failContent"),type:"basic",variant:"danger"}),console.error(_)}finally{c(!1)}},[s,t,l,o,n,c,e]),isLoading:r}},Zgt=({className:i,programItem:e,selectedProgramId:t,handleSelectProgram:n})=>{const{t:s}=q();return x(U,{"data-pad-focus":"true",className:P("LoadProgramItem","bg-fill-inverse-subtle/40 cursor-pointer gap-2 rounded-lg border-2 border-transparent px-3 py-2",{"border-navy-stronger":t===e.programId},i),onClick:()=>n(e.programId),children:[x(H,{justifyContent:"space-between",alignItems:"center",children:[u("h5",{className:"typo-compact-xs2-semibold text-fg-default",children:e.name}),x(H,{justifyContent:"space-between",alignItems:"center",className:"typo-compact-2xs-normal gap-1",children:[u("h6",{className:"text-fg-subtle",children:s("program.modal.button.lastLoadedAt")}),u("h6",{className:"text-fg-default text-end",children:Cr(e.lastLoadedAt,"YYYY-MM-DD")})]})]}),x(H,{justifyContent:"space-between",alignItems:"center",children:[x(H,{justifyContent:"space-between",alignItems:"center",className:"gap-1",children:[u("h6",{className:"text-fg-subtle typo-compact-xs-normal",children:s("program.modal.desc.repeatCount")}),u("h6",{className:"text-fg-default typo-compact-xs-semibold text-end",children:e.repeatCnt===-1?"Infinite":e.repeatCnt})]}),x(H,{justifyContent:"space-between",alignItems:"center",className:"typo-compact-2xs-normal gap-1",children:[u("h6",{className:"text-fg-subtle",children:s("program.modal.button.createdAt")}),u("h6",{className:"text-fg-default text-end",children:Cr(e.createdAt,"YYYY-MM-DD")})]})]})]},e.programId)},xRe=async i=>({file:dt.get(i,"target.files[0]",null)??null}),emt=(i,e="")=>{const t=window.URL.createObjectURL(new Blob([i.data])),n=document.createElement("a");if(!e){e="unknown";const s=i.headers["content-disposition"];if(s){const[o]=s.split(";").filter(r=>r.includes("filename"));o&&([,e]=o.split("="))}}n.href=t,n.setAttribute("download",decodeURI(e)),n.style.cssText="display:none",document.body.appendChild(n),n.click(),n.remove()},{useMutation:tmt}=await F("@tanstack/react-query"),nmt="/program/export/{program_key}",imt=async({programId:i,programName:e,taskId:t})=>{const n=nmt.replace("{program_key}",i),s=await Ije.get(`${Uie}/common${n}`,{params:{taskId:t},responseType:"blob"});emt(s,`muscat_program_${e}.zip`)},smt=()=>tmt({mutationFn:imt}),{useMemo:Zme,useState:KO}=await F("react"),v8=[{key:"lastLoadedAt",label:"program.modal.button.lastLoadedAt"},{key:"createdAt",label:"program.modal.button.createdAt"},{key:"updatedAt",label:"program.modal.button.updatedAt"}],i6=({className:i,open:e,onOpenChange:t,close:n,resolve:s})=>{const{t:o}=q(),r=ie(M=>M.programInfo),[a,l]=KO(""),[c,d]=KO(""),[h,g]=KO(null),[m,f]=KO(0),{coreSwList:p}=Fi(),{data:_,refetch:b}=lRe({search_name:"",last_load_order:!0}),{handleDeleteProgram:v,isLoading:w}=qgt(),{handleLoadProgram:y,isLoading:S}=SRe(),{mutateAsync:C}=smt(),N=Zme(()=>{if(!_?.programs)return[];const M=_.programs.filter(B=>B.name.toLowerCase().includes(a.toLowerCase())),O=v8[m].key;return[...M].sort((B,z)=>{const Y=new Date(B[O]).getTime();return new Date(z[O]).getTime()-Y})},[_,a,m]),k=Zme(()=>o(v8[m].label),[o,m]),L=()=>{f(M=>(M+1)%v8.length)},D=M=>{l(M.toString()),g(null)},T=M=>{g(M)},E=async()=>{await y({programId:h,programName:N?.find(M=>M.programId===h)?.name}),s(h)},R=async()=>{if(h)try{await v({programId:h,programName:N?.find(M=>M.programId===h)?.name}),b(),r?.programId===h&&n(),g(null)}catch(M){console.error(M)}},A=async()=>{if(h)try{await C({programId:h,programName:_?.programs?.find(M=>M.programId===h)?.name})}catch(M){console.error(M)}};return u(Uo,{className:P(i,"block w-[80vw] !max-w-230 border-none p-0"),open:e,onOpenChange:t,disableAutoFocus:!0,header:{title:o("program.modal.title.load"),description:o("program.modal.desc.load")},footer:x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[x(H,{className:P("[&_button]:typo-compact-xs2-semibold gap-1 [&_button]:h-8"),alignItems:"center",children:[u(se,{className:"",variant:"outlined",leadingIcon:u(aJe,{className:"w-3.5"}),disabled:!h,loading:w,onClick:A,children:o("program.modal.button.export")}),u(se,{className:"w-20",variant:"outlined",leadingIcon:u(Y0,{}),disabled:!h,loading:w,onClick:R,children:o("program.modal.button.delete")}),u(se,{className:"w-35",variant:"soft",disabled:N?.length===0,loading:S,onClick:L,children:`${o("program.modal.button.order")}: ${k}`})]}),x(H,{className:"gap-1",alignItems:"center",children:[u(se,{variant:"outlined",size:"sm",onClick:n,children:o("program.modal.button.cancel")}),u(se,{variant:"brand",size:"sm",disabled:!h,loading:S,onClick:E,children:o("program.modal.button.load")})]})]}),children:x(H,{className:"h-100 max-h-[80vh] gap-4 px-4 pt-3 pb-0",children:[x(U,{className:"h-full w-90",children:[u(et,{className:"mb-2.5 h-10 w-full",type:"search",placeholder:o("program.modal.placeholder.search"),autoFocus:!1,value:a,handleChange:D}),u(U,{className:"bg-raised relative max-h-[50vh] min-h-60 flex-1 gap-1.5 overflow-y-auto rounded-sm p-2",children:u(qr,{list:N,loadingWrapperClassName:P("h-full","[&>svg]:size-8"),noDataMsgClassName:P("h-full flex-1","[&_.no-data-text]:typo-compact-sm-normal"),noDataMsg:"Program not found",children:({item:M})=>u(Zgt,{programItem:M,selectedProgramId:h,handleSelectProgram:T},M.programId)})})]}),u(cRe,{className:"h-full",robotModel:c,robotModelList:p,selectedProgramId:h,onRobotModelChange:d})]})})},{useState:omt}=await F("react"),rmt=({className:i,open:e,onOpenChange:t,resolve:n,close:s})=>{const{t:o}=q(),r=ie(m=>m.programInfo),a=ie(m=>m.setProgramInfo),[l,c]=omt({name:r?.name||"",repeatType:r?.repeatCnt===-1?"infinite":"direct",repeatCnt:r?.repeatCnt||1}),d=!l.name||!l.repeatCnt,h=(m,f)=>{if(f==="repeatType"){c(p=>({...p,repeatCnt:m==="infinite"?-1:1,repeatType:m}));return}c(p=>({...p,[f]:m}))},g=async()=>{const m={...r,name:l.name,repeatCnt:l.repeatCnt};a(m),n(m)};return u(Uo,{className:P(i,"block border-none p-0"),open:e,onOpenChange:t,disableAutoFocus:!0,header:{title:o("program.modal.title.edit"),description:o("program.modal.desc.edit")},footer:x(H,{className:"h-8 w-full gap-1",alignItems:"center",justifyContent:"flex-end",children:[u(se,{variant:"outlined",size:"sm",onClick:s,children:o("program.modal.button.cancel")}),u(se,{variant:"brand",size:"sm",disabled:d,onClick:g,children:o("settings.button.edit")})]}),children:x(U,{className:"gap-4 px-4 pt-3 pb-4",children:[x(U,{className:"gap-1.5",children:[u("h6",{className:"typo-compact-xs-semibold text-fg-default",children:o("program.modal.label.programName")}),u(et,{className:"h-10 w-full",name:"name",type:"text",value:l.name,handleChange:h,validate:/^[a-zA-Z0-9_-]+$/})]}),x(U,{className:"gap-1.5",children:[u("h6",{className:"typo-compact-xs-semibold text-fg-default",children:o("program.modal.desc.repeatCount")}),x("div",{className:"grid w-full grid-cols-[9.375rem_1fr] gap-2",children:[u("div",{className:"min-w-0",children:x(ae,{name:"repeatType",className:"w-full",value:l.repeatType,handleChange:h,children:[u(J,{value:"direct",children:o("program.modal.label.directInput")}),u(J,{value:"infinite",children:o("dashboard.content.infinite")})]})}),u("div",{className:"min-w-0",children:u(et,{className:"h-10 w-full",name:"repeatCnt",type:"number",validate:l.repeatType==="direct"?/^[1-9]\d*$/:void 0,value:l.repeatCnt,disabled:l.repeatType==="infinite",handleChange:h})})]})]})]})})},{useState:amt}=await F("react"),y8=({className:i,axisKey:e,values:t})=>{const{theme:n}=tt(),s=e.every(l=>typeof l=="number"),[o,r]=amt({tcp_enc:!1,tcp_ref:!1,joint_ref:!1,joint_enc:!1,joint_Esti:!1,joint_TMeas:!1,joint_temper:!1,box_output:!1,box_input:!1,ext_output:!1,ext_input:!1,tool_output:!1,tool_input:!1}),a=l=>{r(c=>({...c,[l]:!c[l]}))};return u("div",{className:P("ManipulateValuesCard",n==="light"?"bg-white":"bg-alt-1","w-full rounded-md px-2 py-1.5",i),children:x(U,{className:"gap-0.5",children:[x("div",{className:P("typo-compact-xs-semibold grid grid-cols-[7rem_repeat(7,minmax(0,1fr))] items-center pt-0.5 pb-1 text-center",{"grid-cols-[7rem_repeat(16,minmax(0,1fr))]":s}),children:[u("h6",{}),e.map(l=>typeof l=="string"?u("h6",{className:P("text-fg-default",{"text-fg-danger":l.includes("x"),"text-fg-success":l.includes("y"),"text-fg-information":l.includes("z"),"text-fg-caution":l.includes("aa")}),children:l.toUpperCase()},l):u("h6",{className:"text-fg-default",children:l}))]}),u(_o,{className:"w-full"}),Object.entries(t).map(([l,c])=>x("div",{onClick:()=>a(l),className:P("grid grid-cols-[7rem_repeat(7,minmax(0,1fr))] place-items-center","border border-transparent py-1","typo-compact-xs-medium text-fg-subtle","hover:cursor-pointer",{"border-subtle bg-fill-subtle rounded-md text-white":o[l],"grid-cols-[7rem_repeat(16,minmax(0,1fr))]":s}),children:[u("h6",{className:"justify-self-start pl-1.5",children:l.toUpperCase()}),Object.keys(c).map(d=>s?u("div",{className:P("aspect-square size-2 self-center rounded-sm",{"bg-fg-danger":c[d]===0,"bg-fg-success":c[d]===1})},d):u("span",{className:"text-center",children:l.includes("temper")?c[d]+"℃":l.includes("ref")||l.includes("enc")?c[d].toFixed(3)+"º":c[d].toFixed(3)},d))]},l))]})})},{useMemo:ED}=await F("react"),lmt=({className:i,robotModel:e})=>{const{carteXRef:t,carteXEnc:n,jointQRef:s,jointQEnc:o,jointTEsti:r,jointTMeas:a,jointTemper:l,cboxDigitalOutput:c,cboxDigitalInput:d,exDigitalInput:h,exDigitalOutput:g,toolDigitalInput:m,toolDigitalOutput:f}=ws(e,y=>({carteXRef:y.carteXRef,carteXEnc:y.carteXEnc,jointQRef:y.jointQRef,jointQEnc:y.jointQEnc,jointTEsti:y.jointTEsti,jointTMeas:y.jointTMeas,jointTemper:y.jointTemper,cboxDigitalOutput:y.cboxDigitalOutput,cboxDigitalInput:y.cboxDigitalInput,exDigitalInput:y.exDigitalInput,exDigitalOutput:y.exDigitalOutput,toolDigitalInput:y.toolDigitalInput,toolDigitalOutput:y.toolDigitalOutput})),p=ED(()=>({tcp_enc:k0.filter(y=>y!=="").reduce((y,S,C)=>(y[S]=n?.[C]??0,y),{}),tcp_ref:k0.filter(y=>y!=="").reduce((y,S,C)=>(y[S]=t?.[C]??0,y),{})}),[t,n]),_=ED(()=>["j0","j1","j2","j3","j4","j5","j6"],[]),b=ED(()=>({joint_ref:_.reduce((y,S,C)=>(y[S]=s?.[C]??0,y),{}),joint_enc:_.reduce((y,S,C)=>(y[S]=o?.[C]??0,y),{}),joint_Esti:_.reduce((y,S,C)=>(y[S]=r?.[C]??0,y),{}),joint_TMeas:_.reduce((y,S,C)=>(y[S]=a?.[C]??0,y),{}),joint_temper:_.reduce((y,S,C)=>(y[S]=l?.[C]??0,y),{})}),[s,o,r,a,l,_]),v=ED(()=>Array.from({length:16},(S,C)=>C),[]),w=ED(()=>{const y=c?.u,S=d?.u,C=g?.u,N=h?.u,k=f?.u,L=m?.u;return{box_output:v.reduce((D,T,E)=>(D[T]=y?.[E]??0,D),{}),box_input:v.reduce((D,T,E)=>(D[T]=S?.[E]??0,D),{}),ext_output:v.reduce((D,T,E)=>(D[T]=C?.[E]??0,D),{}),ext_input:v.reduce((D,T,E)=>(D[T]=N?.[E]??0,D),{}),tool_output:v.reduce((D,T,E)=>(D[T]=k?.[E]??0,D),{}),tool_input:v.reduce((D,T,E)=>(D[T]=L?.[E]??0,D),{})}},[c,d,h,g,m,f,v]);return u("div",{className:P("ManipulateDetailInfo","bg-bg-overlay rounded-b-lg [&_div]:!outline-none",i),children:u("div",{className:"px-4 pb-4",children:x(U,{className:"gap-2",children:[u(y8,{axisKey:k0,values:p}),u(y8,{axisKey:_,values:b}),u(y8,{axisKey:v,values:w})]})})})},cmt=({className:i,infoKeys:e,values:t})=>u("div",{className:P("AmrMotorValuesCard","bg-bg-alt-1 w-full rounded-md px-2 py-1.5",i),children:x(U,{className:"gap-0.5",children:[x("div",{className:P("typo-compact-2xs-semibold grid grid-cols-[5rem_repeat(4,minmax(0,1fr))] items-center pt-0.5 pb-1 text-center"),children:[u("h6",{}),e.map(n=>u("h6",{className:"text-fg-default",children:"Motor_"+n},n))]}),u(_o,{className:"w-full"}),Object.keys(Object.values(t)[0]||{}).map(n=>x("div",{className:"typo-compact-2xs-medium grid grid-cols-[5rem_repeat(4,minmax(0,1fr))] items-center py-1 text-center",children:[u("h6",{className:"text-fg-subtle justify-self-start pl-1.5 capitalize",children:n}),e.map(s=>{const r=t[Number(s)]?.[n],a=typeof r=="number";let l=String(r);return n.includes("temp")&&a?l=`${r.toFixed(1)}℃`:n.includes("current")&&a?l=`${r.toFixed(1)}A`:n==="connection"&&(l=r?"ON":"OFF"),u("span",{className:P("text-default",{"text-fg-success":n==="connection"&&r===!0,"text-fg-danger":n==="connection"&&r===!1}),children:l},`${s}-${n}`)})]},n))]})}),df=({className:i,title:e,value:t})=>x(H,{className:P("AmrDetailValues","typo-compact-xs-medium py-1",i),justifyContent:"space-between",alignItems:"center",children:[u("h6",{className:"text-fg-subtle justify-self-start pl-1.5",children:e}),u("span",{className:"text-fg-subtler",children:t})]}),{useMemo:dmt}=await F("react"),umt=({className:i,robotModel:e})=>{const{motor:t,power:n,robotState:s}=Jk(e,r=>({motor:r.motor,power:r.power,robotState:r.robotState})),o=dmt(()=>Object.keys(t),[t]);return u("div",{className:P("AmrDetailInfo","bg-bg-overlay rounded-b-lg [&_div]:!outline-none",i),children:u("div",{className:"px-4 pb-4",children:x(U,{className:"gap-2",children:[u(cmt,{infoKeys:o,values:t}),x(H,{className:"gap-2",children:[u("div",{className:"bg-bg-alt-1 w-full rounded-md px-2 py-1.5",children:x(U,{className:"gap-0.5",children:[u(df,{title:"Total Power",value:n.totalPower.toFixed(0)}),u(df,{title:"Power",value:n.power.toFixed(0)}),u(df,{title:"Battery In/Out",value:`${n.batIn.toFixed(2)} / ${n.batOut.toFixed(2)}`}),u(df,{title:"Battery Current",value:n.batCurrent.toFixed(2)}),u(df,{title:"Battery Percentage",value:n.batPercent.toFixed(0)+"%"})]})}),u("div",{className:"bg-bg-alt-1 w-full rounded-md px-2 py-1.5",children:x(U,{className:"gap-0.5",children:[u(df,{title:"EMO",value:s.emo.toString()}),u(df,{title:"Robot State Power",value:s.power.toString()}),u(df,{title:"SF Bumper Detect",value:s.sfBumperDetect.toString()}),u(df,{title:"SF Obs Detect",value:s.sfObsDetect.toString()}),u(df,{title:"SF Operational Stop",value:s.sfOperationalStop.toString()})]})})]})]})})})},NRe=({className:i,robotModel:e,service:t,open:n,onOpenChange:s})=>{const{t:o}=q();return u(Uo,{className:P(i,"!max-h-140 w-160 max-w-full border-none p-0"),enableDimClose:!1,open:n,onOpenChange:s,header:{title:e},children:t===""?u(rn,{children:u("div",{className:"flex min-h-100 items-center justify-center text-2xl",children:o("dashboard.detail.robotNotConnected")})}):t==="manipulate"?u(lmt,{robotModel:e}):t==="amr"?u(umt,{robotModel:e}):null})},{useMemo:efe}=await F("react"),hmt=({className:i,robotModel:e})=>{const{t}=q(),{modal:n}=Vi(),{theme:s}=tt(),o=ie(w=>w.treeItems),r=ie(w=>w.subTreeItems),a=ie(w=>w.beginInfo),l=ie(w=>w.setInitialInfo),{data:c}=As(),{data:d,refetch:h}=Sp({programId:c?.info?.programId||""}),{playState:g}=nL(),{mutateAsync:m}=wRe(),f=efe(()=>d?.program,[d?.program]),p=efe(()=>({state:g,lampType:g==="idle"?"normal":g==="play"?"success":g==="waiting"?"warning":"danger"}),[g]),_=()=>{n({component:i6})},b=async()=>{const w=await n({component:rmt});w&&(await m({programId:w.programId,name:w.name,repeatCnt:w.repeatCnt}),l({programInfo:w,treeItems:o,subTreeItems:r,beginInfo:a}),h())},v=()=>{n({component:NRe,props:{robotModel:e,service:c?.modelInfo?.be_service}})};return u(My,{className:P("RobotInfo",i),children:x(U,{className:"bg-bg-surface-3 h-full",children:[u("div",{className:"relative flex w-full flex-1",children:u(Ym,{className:"absolute top-0 left-0 z-[1] size-full",robotModel:e,cameraPositionKey:"robot-info"})}),u("div",{className:"h-fit w-full p-3",children:x(U,{className:P("gap-2","[&>div]:flex-1 [&>div]:gap-7"),children:[x(H,{children:[u(NS,{title:t("dashboard.content.alias"),content:c?.modelInfo?.alias||"-"}),u(NS,{testId:"robot-info-model",title:t("dashboard.content.model"),content:c?.modelInfo?.model||"-"})]}),x(H,{children:[u(NS,{testId:"robot-info-serial",title:"S/N",content:c?.info?.serialNumber||"-"}),u(NS,{title:t("menu.title.program"),content:f?x(H,{className:"h-full gap-1",alignItems:"center","data-testid":"robot-info-program",children:[u("span",{children:f?.name}),u(Yt,{variant:"soft",size:"3xs",className:s==="light"?"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy":void 0,"data-testid":"robot-info-program-load",icon:u(Ty,{}),onClick:_})]}):u("span",{className:"text-fg-subtle",children:"-"})})]}),x(H,{children:[u(NS,{title:t("dashboard.content.status"),content:x(H,{className:"h-full gap-1",alignItems:"center",children:[u(QP,{lampType:p.lampType}),u("span",{className:"text-fg-default font-['Pretendard_Variable'] text-sm leading-5 font-semibold",children:p.state?.toUpperCase()})]})}),u(NS,{title:t("dashboard.content.repeat"),content:f?x(H,{className:"h-full gap-1",alignItems:"center","data-testid":"robot-info-repeat",children:[u("span",{children:f?.repeatCnt===-1?t("dashboard.content.infinite"):f?.repeatCnt}),u(Yt,{"data-pad-focus":"true",variant:"soft",size:"3xs",className:s==="light"?"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy":void 0,"data-testid":"robot-info-repeat-edit",icon:u(Ty,{}),onClick:b})]}):"-"})]})]})}),c?.info?.components?.length===1&&u(H,{className:"h-fit w-full gap-2 p-2",children:u(se,{"data-pad-focus":"true",className:"h-7 w-full",variant:"outlined",size:"xs",onClick:v,children:t("dashboard.button.detail")})})]})})},{useQuery:gmt,useQueryClient:mmt}=await F("@tanstack/react-query"),{useMemo:fmt}=await F("react"),IRe="/list",pmt=async i=>{const{fromDate:e,toDate:t}={...i},n={...i,fromDate:e?hB(e):void 0,toDate:t?hB(t):void 0};return $ie.get(IRe,{params:n})},Xse=(i,e={})=>{const t=mmt(),n=fmt(()=>[IRe,i],[i]);return{...gmt({queryKey:n,queryFn:async()=>{try{return await pmt(i)}catch(o){throw t.setQueryData(n,{items:[],totalCount:0,hasNext:!1}),o}},gcTime:0,staleTime:0,...e}),queryKey:n}},{useEffect:_mt,useState:bmt}=await F("react"),kRe=i=>i?Array.isArray(i)?i:[i]:[],vmt=()=>{const{data:i,loading:e,changeData:t}=ls("log/state_log"),[n,s]=bmt([]);return _mt(()=>{const o=kRe(i);o.length>0&&s(r=>[...[...o].reverse(),...r].slice(0,30))},[i]),{realTimeLogList:n,logData:i,loading:e,changeData:t}},{useCallback:ymt,useEffect:tfe,useState:nfe}=await F("react"),Qse=i=>{const{logData:e,changeData:t}=vmt(),{data:n}=Xse(i,{gcTime:0,staleTime:100}),[s,o]=nfe("play"),[r,a]=nfe(null),l=ymt(c=>{o(c)},[]);return tfe(()=>{if(e&&s==="play"){const c=kRe(e).filter(d=>!i?.swName||i.swName==="RRS"||d.swName===i.swName).map(d=>({...d,_id:dt.uniqueId()}));c.length>0&&a(d=>d&&[...c.reverse(),...d])}t(null)},[e,s,t,i.swName]),tfe(()=>{n&&a(n.items??[])},[n]),{realTimeLogList:r,playStatus:s,handlePlayStatus:l}},Zse=["info","warning","error","user","debug","general"],eoe=Zse.reduce((i,e,t)=>(i[t]=e,i),{});Zse.reduce((i,e,t)=>(i[e]=t,i),{});const WB={info:u(DE,{className:"text-fg-information size-full"}),warning:u(X0,{className:"text-fg-warning size-full"}),debug:u(KLe,{className:"text-fg-subtler size-full"}),user:u(DE,{className:"text-fg-information size-full"}),error:u(X0,{className:"text-fg-danger size-full"}),general:u(DE,{className:"text-fg-information size-full"})},LRe=({className:i,logList:e,showDetail:t})=>{const{theme:n}=tt();return u(U,{className:P("SimpleLogList",n==="light"?"text-fg-default":"text-fg-subtle","typo-code-xs-normal gap-1 px-3 py-2.5",i),children:u(qr,{list:e,noDataMsg:"There is no log.",noDataMsgClassName:"min-h-[17rem] [&_.no-data-text]:typo-compact-sm-medium",children:({item:s})=>x(H,{children:[x(H,{className:"gap-1",children:[u("span",{className:"size-3.5",children:WB[String(s.level).toLowerCase()]||WB[eoe[Number(s.level)]]}),u("span",{className:"min-w-[4.375rem]",children:t?Cr(s.createdAt,"YYYY-MM-DD HH:mm:ss"):Cr(s.createdAt,"HH:mm:ss")})]}),x("p",{className:"line-clamp-2",children:["[",s.swName,"] ",s.contents]})]},s._id)})})},wmt=({className:i,open:e,onOpenChange:t,limit:n})=>{const{t:s}=q(),o=ir(),{realTimeLogList:r,playStatus:a,handlePlayStatus:l}=Qse({limit:n}),c=()=>{o(w9)};return u(Uo,{className:P(i,"block !max-w-[70vw] border-none p-0"),open:e,onOpenChange:t,header:{title:s("dashboard.title.recentLogs")},footer:x(H,{className:"h-8 w-full",alignItems:"center",justifyContent:"space-between",children:[u(se,{variant:"outlined",leadingIcon:a==="play"?u(aA,{}):u(FI,{}),onClick:()=>l(a==="play"?"pause":"play"),children:s(a==="play"?"dashboard.button.stop":"dashboard.button.play")}),u(se,{variant:"brand",onClick:c,children:s("dashboard.button.viewAllLogs")})]}),children:u("div",{className:"!bg-bg-alt-2 flex h-full flex-col justify-between",children:u(Km,{className:"h-[calc(var(--vh,1vh)*70)]",children:u(LRe,{logList:r})})})})},Cmt=({className:i,limit:e=100,logListClassName:t})=>{const{t:n}=q(),{theme:s}=tt(),{modal:o}=Vi(),r=ir(),{realTimeLogList:a,playStatus:l,handlePlayStatus:c}=Qse({limit:e}),d=()=>{o({component:wmt,props:{limit:100}})},h=()=>{r(w9)};return u(My,{className:P(i),testId:"recent-logs",contentsScrollable:!0,title:n("dashboard.title.recentLogs"),lightTitleClassName:"bg-overlay",childrenClassName:s==="light"?"bg-white":"bg-alt-2",titleButton:u(Yt,{"data-testid":"recent-logs-expand",icon:u(_9,{}),variant:"transparent",size:"3xs",onClick:d}),footer:x(H,{className:P("gap-1","[&_button]:h-7 [&_button]:w-full [&_button]:px-2"),children:[u(se,{size:"xs",variant:"outlined",onClick:()=>c(l==="play"?"pause":"play"),children:n(l==="play"?"dashboard.button.stop":"dashboard.button.play")}),u(se,{className:s==="light"?"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy":void 0,size:"xs",variant:"soft",onClick:h,children:n("dashboard.button.viewAllLogs")})]}),children:u("div",{className:P("RecentLogs","h-full","flex flex-col","justify-between"),children:u(LRe,{className:P(t),logList:a})})})},{useQueries:Smt,useQuery:xmt}=await F("@tanstack/react-query"),DRe="{robot_model}/call_whoami",TRe=async({namespace:i})=>{try{const e=DRe.replace("{robot_model}",i);return Ut.get(e,{skipErrorToast:!0})}catch(e){console.error(e)}},ERe=i=>[DRe,i],Nmt=(i,{enabled:e=!0,...t}={})=>xmt({queryKey:ERe(i),queryFn:()=>TRe(i),retry:1,staleTime:1e3,...t,refetchOnMount:!0,enabled:!!i?.namespace&&!!e}),Imt=(i,{enabled:e=!0,...t}={})=>Smt({queries:i.map(n=>({queryKey:ERe(n),queryFn:()=>TRe(n),...t,refetchOnMount:!0,enabled:!!n?.namespace&&!!e}))}),PRe=i=>{const{data:e,loading:t}=ls("common/state_core",{selector:i});return{...e,loading:t}},{useMemo:kmt}=await F("react"),RRe=({className:i,model:e,alias:t,beService:n,connectedStatus:s,programTaskExecuteState:o,setSelectedRobotModel:r,componentSize:a="md"})=>{const{theme:l}=tt(),{t:c}=q(),{modal:d}=Vi(),h=ir(),{data:g}=Nmt({namespace:e}),m=a==="md",f={containerPadding:m?"px-2.5 py-3":"",gridCols:m?"grid-cols-2":"grid-cols-4",actionWidth:m?"w-20":"w-36",actionLayout:m?U:H,aliasTypo:m?"typo-compact-sm-semibold":"typo-compact-xs2-semibold"},p=f.actionLayout,{isRealMode:_,motorTempers:b}=PRe(N=>({isRealMode:N?.[e]?.statusIsRefon===1,motorTempers:N?.[e]?.jointTemper??[],toolName:N?.[e]?.toolName||""})),{motor:v,isAmrRealMode:w}=Jk(e,N=>({motor:N.motor,isAmrRealMode:N.robotState.simul===!1})),y=kmt(()=>{const N={mode:"",motorAvgTemp:0,type:"",lampType:"information"};switch(o){case"idle":N.lampType="normal";break;case"paused":case"stopped":case"error":N.lampType="danger";break;case"waiting":N.lampType="warning";break;default:N.lampType="success";break}const k=n==="manipulate"?_:w;return N.mode=k?"Real":"Simulation",N.motorAvgTemp=Number(n==="manipulate"?(b&&b.length>0?b.reduce((L,D)=>L+D,0)/b.length:0).toFixed(2):(v&&v.length>0?v.reduce((L,D)=>L+(D.temp||0),0)/v.length:0).toFixed(2)),N.type=n,N},[n,_,w,b,v,o]),S=()=>{r(e),h("/muscat/app/move")},C=()=>{d({component:NRe,props:{robotModel:e,service:n}})};return u("div",{className:P("RobotComponentItem",l==="light"?"bg-white":"bg-alt-2",f.containerPadding,i),children:x("div",{className:"justify-between",children:[x(H,{className:"mb-2",alignItems:"center",justifyContent:"space-between",children:[x(H,{className:"gap-1",alignItems:"center",children:[u("span",{className:P(f.aliasTypo,"text-fg-default"),children:t||"-"}),u("span",{className:"typo-compact-xs-medium text-slate-400",children:e?`(${e})`:""})]}),x(H,{className:"gap-2",alignItems:"center",children:[!m&&x(H,{className:"gap-0.5",alignItems:"center",children:[u(QP,{lampType:y?.lampType,size:"sm"}),u("span",{className:"typo-compact-xs2-semibold text-fg-default",children:o})]}),u(CA,{status:s,size:m?"xs":"2xs"})]})]}),x(H,{className:"gap-1",alignItems:"flex-end",justifyContent:"space-between",children:[x("div",{className:P("grid flex-1 grid-cols-4 gap-1",f.gridCols,"[&_.robot-info-item>span:first-child]:typo-compact-2xs-normal [&_.robot-info-item>span:first-child]:text-fg-subtler","[&_.robot-info-item>span:last-child]:typo-compact-xs2-semibold [&_.robot-info-item>span:last-child]:text-fg-default",{"grid-cols-2":m,"[&_.robot-info-item>span:last-child]:typo-compact-xs2-semibold":m}),children:[x(U,{className:"robot-info-item",children:[u("span",{children:c("dashboard.content.type")}),u("span",{children:n||"-"})]}),x(U,{className:"robot-info-item",children:[u("span",{children:c("dashboard.content.motorAvgTmp")}),u("span",{children:(Number.isNaN(y?.motorAvgTemp)?"":y?.motorAvgTemp)+(Number.isNaN(y?.motorAvgTemp)?"-":"°C")})]}),x(U,{className:"robot-info-item",children:[u("span",{children:c("dashboard.content.mode")}),u("span",{children:y?.mode||"-"})]}),x(U,{className:"robot-info-item",children:[u("span",{children:c("dashboard.content.version")}),u("span",{children:g?.version||"-"})]}),m&&x(H,{className:"gap-0.5",alignItems:"center",children:[u(QP,{lampType:y?.lampType,size:"sm"}),u("span",{className:"typo-compact-2xs-semibold text-fg-default uppercase",children:o})]})]}),x(p,{className:P(f.actionWidth,"gap-1","[&_>button]:h-6 [&_>button]:px-1.5"),children:[u(se,{className:"w-full",variant:"outlined",size:"2xs",onClick:S,children:c("dashboard.button.moveControl")}),u(se,{className:P("w-full",l==="light"&&"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy"),variant:"soft",size:"2xs",disabled:s==="DISCONNECT",onClick:C,children:c("dashboard.button.detail")})]})]})]})})},{useQuery:Lmt}=await F("@tanstack/react-query"),MRe="/program/executor/state",Dmt=()=>Ut.get(MRe),toe=(i={})=>Lmt({queryKey:[MRe],queryFn:Dmt,...i}),{useEffect:Tmt,useMemo:Emt}=await F("react"),Pmt=({className:i,open:e,onOpenChange:t,systemStateData:n,setSelectedRobotModel:s})=>{const{t:o}=q(),{data:r,refetch:a}=toe({enabled:!1}),{playState:l}=Xm(d=>({playState:d?.playState})),c=Emt(()=>{const d={};return Object.entries(r?.byRobotModel??{}).forEach(([h,g])=>{console.log(g);const m=Object.values(g??{}).find(f=>f.isMainTask);m&&(d[h]=m)}),d},[r]);return Tmt(()=>{a()},[l,a]),u(Uo,{className:P(i,"block !w-[34.375rem] max-w-full border-none p-0"),open:e,onOpenChange:t,header:{title:o("dashboard.title.robotComponents")},children:u("div",{className:"bg-bg-alt-2 flex max-h-121 flex-col justify-between px-4 pt-3 pb-4",children:u(qr,{list:n.core_sw_list,noDataMsg:"No Robot Components",noDataMsgClassName:"w-full text-center",loadingWrapperClassName:"[&_svg]:text-[#eee] [&_svg]:size-[2.5rem]",children:({item:d,index:h})=>x("div",{children:[u(RRe,{componentSize:"lg",model:d.model,alias:d.alias,beService:d.be_service,programTaskExecuteState:c?.[d.model]?.state??"idle",connectedStatus:d.connected,setSelectedRobotModel:s},d.model),h!==n.core_sw_list.length-1&&u(_o,{className:"my-2.5"})]})})})})},{useEffect:Rmt,useMemo:Mmt}=await F("react"),Amt=({className:i})=>{const{theme:e}=tt(),{modal:t}=Vi(),{t:n}=q(),{setSelectedRobotModel:s}=ui(),{data:o}=Jm(h=>({core_sw_list:h?.core_sw_list})),{data:r,refetch:a}=toe({enabled:!1}),{playState:l}=Xm(h=>({playState:h?.playState})),c=Mmt(()=>{const h={};return Object.entries(r?.byRobotModel??{}).forEach(([g,m])=>{console.log(m);const f=Object.values(m??{}).find(p=>p.isMainTask);f&&(h[g]=f)}),h},[r]),d=()=>{t({component:Pmt,props:{systemStateData:o,setSelectedRobotModel:s}})};return Rmt(()=>{a()},[l,a]),u(My,{className:P("RobotComponents",i),title:n("dashboard.title.robotComponents"),lightTitleClassName:"bg-overlay",childrenClassName:e==="light"?"bg-white":"bg-alt-2",titleButton:u(Yt,{"data-testid":"robot-components-expand",icon:u(_9,{}),variant:"transparent",size:"3xs",onClick:d}),contentsScrollable:!0,children:u("div",{className:P("bg-bg-surface-2 overflow-y-auto","[&>*]:border-border-subtle [&>*]:border-b"),children:u(qr,{list:o.core_sw_list,noDataMsg:"No Robot Components",noDataMsgClassName:"w-full text-center",loadingWrapperClassName:"[&_svg]:text-[#eee] [&_svg]:size-[2.5rem]",children:({item:h})=>u("div",{children:u(RRe,{model:h.model,alias:h.alias,beService:h.be_service,programTaskExecuteState:c?.[h.model]?.state??"idle",connectedStatus:h.connected,setSelectedRobotModel:s},h.model)})})})})},{useCallback:Omt,useMemo:Fmt}=await F("react"),xp=i=>{const{data:e}=Ph(),{joint_states:t}=dw(i,o=>({joint_states:o?.joint_states})),n=Fmt(()=>{const o=e?.components?.[i];return o?.type!=="array"?[]:o?.mapper??[]},[i,e?.components]),s=Omt(o=>o.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase()),[]);return{jointStates:t,jointNames:n,toJointNameText:s}},{useMutation:Bmt}=await F("@tanstack/react-query"),Vmt="/{robot_model}/power",zmt=({robotModel:i,...e})=>Pa.post(Vmt.replace("{robot_model}",i),e),Wmt=()=>Bmt({mutationFn:zmt}),{useMutation:Hmt}=await F("@tanstack/react-query"),$mt="/{robot_model}/servo",Umt=({robotModel:i,...e})=>Pa.post($mt.replace("{robot_model}",i),e),jmt=()=>Hmt({mutationFn:Umt}),{useMutation:Gmt}=await F("@tanstack/react-query"),qmt="/{robot_model}/control_manager",Kmt=({robotModel:i,...e})=>Pa.post(qmt.replace("{robot_model}",i),e),Jmt=()=>Gmt({mutationFn:Kmt}),{useMutation:Ymt}=await F("@tanstack/react-query"),Xmt="/{robot_model}/tool_flange_power",Qmt=({robotModel:i,...e})=>Pa.post(Xmt.replace("{robot_model}",i),e),Zmt=()=>Ymt({mutationFn:Qmt}),{useMutation:eft}=await F("@tanstack/react-query"),tft="/{robot_model}/brake",nft=({robotModel:i,...e})=>Pa.post(tft.replace("{robot_model}",i),e),ift=()=>eft({mutationFn:nft}),ab=[{label:"Head",value:"head",jointPrefix:"head_",component:"head",tcpGizmo:!1},{label:"Torso",value:"torso",jointPrefix:"torso_",component:"torso",tcpGizmo:!0},{label:"Left",value:"left",jointPrefix:"left_arm_",component:"left_arm",tcpGizmo:!0},{label:"Right",value:"right",jointPrefix:"right_arm_",component:"right_arm",tcpGizmo:!0}],dR=i=>ab.find(({jointPrefix:e})=>i.startsWith(e)),{useMemo:w8,useState:sft}=await F("react"),ife=[{label:"Torso",component:"torso"},{label:"Right Arm",component:"right_arm"},{label:"Left Arm",component:"left_arm"},{label:"Head",component:"head"}],C8=[{label:"24V",value:24},{label:"12V",value:12},{label:"OFF",value:0}],PD=({className:i,title:e,count:t,extra:n,action:s,children:o})=>x(U,{className:P("gap-1.5 px-3 py-2",i),children:[x(H,{justifyContent:"space-between",alignItems:"center",children:[x(H,{className:"gap-1.5",alignItems:"center",children:[u("span",{className:"text-fg-default text-sm font-bold",children:e}),t&&u("span",{className:"text-fg-subtle text-xs",children:t}),n]}),s]}),o]}),sfe=({label:i,sub:e,checked:t,disabled:n,onCheckedChange:s})=>x(H,{className:"bg-bg-alt-1 h-8 gap-1 rounded-md px-2.5",justifyContent:"space-between",alignItems:"center",children:[x("span",{className:P("text-sm font-semibold whitespace-nowrap",t?"text-fg-default":"text-fg-subtle"),children:[i,e&&u("span",{className:"text-fg-subtle pl-1 text-xs",children:e})]}),u(tr,{checked:t,disabled:n,onCheckedChange:s})]}),S8="border-border-subtle text-fg-default h-8 shrink-0 rounded-md border px-3 text-xs font-semibold disabled:cursor-not-allowed",ofe=({items:i,active:e,activeClassName:t="bg-bg-overlay text-fg-default",disabled:n,onSelect:s})=>u(H,{className:"bg-bg-alt-1 h-8 flex-1 gap-1 rounded-md p-0.5",children:i.map(o=>x("button",{type:"button",disabled:n,className:P("flex h-full flex-1 items-center justify-center gap-1.5 rounded text-xs font-semibold disabled:cursor-not-allowed",o===e?t:"text-fg-subtle hover:text-fg-default"),onClick:()=>o!==e&&s(o),children:[o===e&&o==="ENABLE"&&u("span",{className:"size-1.5 rounded-full bg-green-500"}),o]},o))}),oft=({className:i,robotModel:e})=>{const{t}=q(),{jointNames:n}=xp(e),[s,o]=sft([]),r=w8(()=>ife.map(A=>({...A,joints:n.filter(M=>dR(M)?.component===A.component)})).filter(A=>A.joints.length>0),[n]),a=r.reduce((A,M)=>A+M.joints.length,0),l=a>0&&s.length===a,{powerStates:c,jointStates:d,controlManager:h,toolFlange:g}=dw(e,A=>({powerStates:A?.power_states,jointStates:A?.joint_states,controlManager:A?.control_manager,toolFlange:A?.tool_flange})),m=["left","right"].map(A=>({side:A,label:A==="left"?"Left Arm":"Right Arm",active:C8.find(M=>M.value===g?.[A])?.label})),{mutate:f,isPending:p}=Wmt(),{mutate:_,isPending:b}=jmt(),{mutate:v,isPending:w}=Jmt(),{mutate:y,isPending:S}=Zmt(),{mutate:C,isPending:N}=ift(),k=w8(()=>c&&!Array.isArray(c)?Object.entries(c).map(([A,M])=>({device:A,label:A.toUpperCase(),on:M})):[],[c]),L=w8(()=>[...ife,{label:"Wheel",component:"wheel"}].map(A=>{const M=n.map((O,B)=>({name:O,i:B})).filter(({name:O})=>A.component==="wheel"?O.includes("wheel"):dR(O)?.component===A.component).map(({i:O})=>!!d?.[O]?.is_ready);return{...A,count:M.length,on:M.length>0&&M.every(Boolean)}}).filter(A=>A.count>0),[n,d]),D=k.length>0&&k.every(A=>A.on),T=L.length>0&&L.every(A=>A.on),E=h?.state==="Enabled",R=(A,M,O)=>u("button",{type:"button",className:"text-fg-subtle hover:text-fg-default text-xs font-semibold disabled:opacity-50",disabled:M,onClick:O,children:t(A?"dashboard.button.allOff":"dashboard.button.allOn")});return k.length===0&&L.length===0?u(My,{className:P("RBY1ControlPanel",i),children:u(U,{className:"h-full",justifyContent:"center",children:u(rA,{className:"w-full",size:"sm",nullText:t("dashboard.detail.robotNotConnected")})})}):u(My,{className:P("RBY1ControlPanel",i),children:x(U,{className:"[&>*]:border-border-subtle h-full overflow-y-auto",children:[u(PD,{className:"border-b",title:t("dashboard.title.power"),count:`${k.filter(A=>A.on).length}/${k.length}`,action:R(D,p,()=>f({robotModel:e,status:D?"off":"on"})),children:u("div",{className:"grid grid-cols-2 gap-2",children:k.map(A=>u(sfe,{label:A.label,checked:A.on,disabled:p,onCheckedChange:M=>f({robotModel:e,device:A.device,status:M?"on":"off"})},A.device))})}),u(PD,{className:"border-b",title:t("dashboard.title.servo"),count:`${L.filter(A=>A.on).length}/${L.length}`,action:R(T,b,()=>_({robotModel:e,status:T?"off":"on"})),children:u("div",{className:"grid grid-cols-2 gap-2",children:L.map(A=>u(sfe,{label:A.label,sub:t("dashboard.content.axisCount",{count:A.count}),checked:A.on,disabled:b,onCheckedChange:M=>_({robotModel:e,part:A.component,status:M?"on":"off"})},A.component))})}),u(PD,{className:"border-b",title:t("dashboard.title.toolFlangePower"),children:m.map(A=>x(H,{className:"gap-2",alignItems:"center",children:[x(H,{className:"w-24 shrink-0 gap-1.5",alignItems:"center",children:[u("span",{className:P("size-1.5 rounded-full",A.active&&A.active!=="OFF"?"bg-green-500":"bg-fg-subtle")}),u("span",{className:"text-fg-default text-sm font-semibold",children:A.label})]}),u(ofe,{items:C8.map(M=>M.label),active:A.active,activeClassName:A.active==="OFF"?void 0:"bg-fill-brand text-white",disabled:S,onSelect:M=>y({robotModel:e,side:A.side,voltage:C8.find(O=>O.label===M).value})})]},A.side))}),u(PD,{title:t("dashboard.title.brake"),count:`${s.length}/${a}`,extra:u("button",{type:"button",className:"text-fg-subtle hover:text-fg-default pl-2 text-xs font-semibold",onClick:()=>o(l?[]:r.flatMap(A=>A.joints)),children:t(l?"dashboard.button.deselectAll":"dashboard.button.selectAll")}),action:u(H,{className:"gap-1.5",children:["engage","release"].map(A=>u("button",{type:"button",disabled:!s.length||N,className:P(S8,"disabled:opacity-50"),onClick:()=>C({robotModel:e,action:A,joints:s}),children:A.toUpperCase()},A))}),children:u(U,{className:"bg-bg-alt-1 gap-1 rounded-md px-2.5 py-2",children:r.map(A=>x(H,{className:"gap-2",alignItems:"center",children:[u("span",{className:"text-fg-default w-24 shrink-0 text-xs font-semibold",children:A.label}),u("div",{className:"grid flex-1 grid-cols-7 gap-1",children:A.joints.map(M=>u(ia,{size:"xs",checkValue:!0,value:s.includes(M),handleChange:O=>o(B=>O?[...B,M]:B.filter(z=>z!==M)),children:M.split("_").pop()},M))})]},A.component))})}),x(PD,{className:"mt-auto border-t",title:t("dashboard.title.controlManager"),children:[u(H,{children:u(ofe,{items:["ENABLE","DISABLE"],active:E?"ENABLE":"DISABLE",disabled:w,onSelect:A=>v({robotModel:e,action:A==="ENABLE"?"enable":"disable"})})}),x("div",{className:"grid grid-cols-2 gap-2",children:[u("button",{type:"button",disabled:w,className:S8,onClick:()=>v({robotModel:e,action:"reset"}),children:"RESET"}),u("button",{type:"button",disabled:w,className:P(S8,"border-yellow-500/50 text-yellow-500",h?.unlimited_mode_enabled&&"bg-yellow-500/15"),onClick:()=>v({robotModel:e,action:"unlimit"}),children:"UNLIMIT"})]})]})]})})},rft=({className:i,robotModel:e,hideRobotComponents:t})=>{const{data:n}=As(),s=n?.modelInfo?.be_service==="rby1";return x(H,{className:P("RobotOverview","gap-2.5","[&>*]:w-full [&>*]:flex-1",i),children:[u(hmt,{className:"h-full",robotModel:e}),s&&u(oft,{className:"h-full",robotModel:e}),!t&&u(Amt,{className:"h-full"}),u(Cmt,{className:"h-full"})]})},{useQuery:aft,useQueryClient:lft}=await F("@tanstack/react-query"),{useMemo:cft}=await F("react"),ARe="/move/getLogs",dft=async i=>Ls.get(ARe,{params:i}),noe=(i,e={})=>{const t=lft(),n=cft(()=>[ARe,i],[i]);return{...aft({queryKey:n,queryFn:async()=>{try{return await dft(i)}catch(o){throw t.setQueryData(n,{items:[],pageInfo:{limit:0,mode:"",order:"",page:0,pages:0,sort:"",total:0}}),o}},gcTime:0,staleTime:0,...e}),queryKey:n}},{useMemo:uft}=await F("react"),ORe=({className:i,amrHistoryList:e})=>{const t=uft(()=>e?.map(n=>{let s=n.message;const o=n.command;if(o==="goal")s=`Move Goal: ${n.goalId||n.goalName}`;else if(o==="rotate")s=`Move Rotate: ${n.target?.toFixed(1)??0}deg`;else if(o==="target"){const r=n.goalPose;s=r?`Move Target: ${r.x?.toFixed(3)??0}, ${r.y?.toFixed(3)??0}, ${r.z?.toFixed(3)??0}`:n.message||"Move Target: -"}else o==="circular"?s=`Move Circular: ${n.target?.toFixed(1)??0}deg`:s=`Move Linear: ${n.target?.toFixed(1)??0}m`;return{command:o,result:n.result,createdAt:n.createdAt,message:s}}),[e]);return u(U,{className:P("SimpleMoveHistory","text-fg-subtle gap-1 px-3 py-2.5",i),children:u(qr,{list:t,noDataMsg:"There is no movement history.",noDataMsgClassName:"min-h-[15rem] [&_.no-data-text]:typo-compact-sm-medium",children:({item:n,index:s})=>x(H,{children:[u("span",{className:"typo-code-xs-normal text-fg-subtle w-15",children:Cr(n.createdAt,"YY-MM-DD HH:mm:ss")}),x(U,{className:"gap-0.5",children:[u("span",{className:"typo-code-xs-normal text-fg-default",children:n.message||"-"}),x(H,{className:P("typo-code-xs-normal text-fg-subtle","[&>span:after]:bg-border-subtle [&>span:after]:mx-2 [&>span:after]:inline-block [&>span:after]:h-2 [&>span:after]:w-px [&>span:after]:content-[''] [&>span:last-child:after]:hidden"),children:[u("span",{children:n.command}),n.result&&u("span",{className:P({"text-fg-success":n.result==="success","text-fg-danger":n.result==="fail","text-fg-information":n.result==="start","text-fg-disabled":n.result==="cancel"}),children:n.result})]})]})]},s)})})},hft=({className:i,open:e,onOpenChange:t,limit:n,handleAllHistory:s})=>{const{t:o}=q(),{data:r}=noe({limit:n,page:1,searchText:"",sort:"createdAt",order:"DESC",filter:{},fields:{}});return u(Uo,{className:P(i,"block !max-w-[50vw] border-none p-0"),open:e,onOpenChange:t,header:{title:o("dashboard.title.amrMoveHistory")},footer:u(H,{className:"h-8 w-full",alignItems:"center",justifyContent:"end",children:u(se,{variant:"brand",onClick:s,children:o("dashboard.button.viewAllHistory")})}),children:u("div",{className:"!bg-bg-alt-2 flex h-full flex-col justify-between",children:u(Km,{className:"h-[calc(var(--vh,1vh)*70)]",children:u(ORe,{amrHistoryList:r?.items??null})})})})},gft=({className:i,robotModel:e,connected:t})=>{const n=ir(),{t:s}=q(),{theme:o}=tt(),{modal:r}=Vi(),{setSelectedRobotModel:a}=ui(),{data:l}=noe({limit:30,page:1,searchText:"",sort:"createdAt",order:"DESC",filter:{},fields:{}},{enabled:t,...t?{}:{retry:!1}}),c=()=>{r({component:hft,props:{limit:100,handleAllHistory:d}})},d=()=>{n("/muscat/app/move"),a(e)};return u(My,{className:P(i),title:s("dashboard.title.amrMoveHistory"),lightTitleClassName:"bg-overlay",titleButton:u(Yt,{icon:u(_9,{}),variant:"transparent",size:"3xs",onClick:c}),contentsScrollable:!0,footer:u(H,{className:"w-full",children:u(se,{className:P("w-full",o==="light"&&"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy"),size:"xs",variant:"soft",onClick:d,children:s("dashboard.button.viewAllHistory")})}),children:u(ORe,{className:P("px-3 py-2.5"),amrHistoryList:l?.items??null})})},{useQuery:mft}=await F("@tanstack/react-query"),FRe="/{robot_model}/status",fft=async({robot_model:i})=>{const e=FRe.replace("{robot_model}",i);return Ls.get(e)},pft=({robot_model:i},e={})=>mft({queryKey:[FRe,i],queryFn:()=>fft({robot_model:i}),...e}),{useQuery:_ft}=await F("@tanstack/react-query"),BRe="/getUrl",bft=()=>Die.get(BRe),VRe=()=>_ft({queryKey:[BRe],queryFn:()=>bft()}),{useQuery:vft}=await F("@tanstack/react-query"),zRe="/network/getInfo",yft=()=>Die.get(zRe),wft=()=>vft({queryKey:[zRe],queryFn:()=>yft()}),{useMemo:Cft}=await F("react"),Sft=({className:i,moveStatus:e})=>{const t=Cft(()=>{switch(e){case"move":return"success";case"error":return"danger";case"stop":return"danger";case"pause":return"information";case"not ready":return"normal";case"vir":return"warning";default:return"normal"}},[e]);return x(H,{className:P("AMRLampMoveStatus","gap-0.5",i),alignItems:"center",children:[u(QP,{className:"size-3",lampType:t}),u("span",{className:"text-fg-default typo-compact-sm-semibold uppercase",children:e})]})},{useQuery:xft}=await F("@tanstack/react-query"),WRe="/{robot_model}/map/current",ioe=({robot_model:i})=>[WRe,i],Nft=async({robot_model:i})=>{const e=WRe.replace("{robot_model}",i);return Ls.get(e)},soe=({robot_model:i},e={})=>xft({queryKey:ioe({robot_model:i}),queryFn:()=>Nft({robot_model:i}),...e}),{useMemo:Ift}=await F("react"),{useQuery:kft}=await F("@tanstack/react-query"),HB="/{robot_model}/map/getTopology",Lft=async({robot_model:i,mapName:e})=>{const t=HB.replace("{robot_model}",i),n=await Ls.get(t,{params:{mapName:e,pageSize:999}});return{...n,format_version:n.format_version??fB,metadata:n.metadata,nodes:n.nodes??[],links:n.links??[],zones:n.zones??[]}},HRe=(i,e={})=>{const t=Ift(()=>[HB,i],[i]);return{...kft({queryKey:t,queryFn:()=>Lft(i),enabled:!!i.mapName,...e}),queryKey:t}},{useRef:Dft}=await F("react"),rfe={data:[],pose:{x:"0",y:"0",rz:"0"}},$Re=(i,e=!0)=>{const{data:t=rfe,loading:n}=ls(`amr/${i}/socket/lidar2d`,{defaultValue:rfe,disabled:!e}),{data:s,pose:o}=t,r=Dft({data:s,pose:o,loading:n});return r.current.data=s,r.current.pose=o,n!==r.current.loading&&(r.current.loading=n),r.current},Tft={data:[],time:0},URe=(i,e=!0)=>{const{data:t,loading:n}=ls(`amr/${i}/socket/mappingCloud`,{defaultValue:Tft,disabled:!e,equalityFn:(s,o)=>dt.isEqual(s,o)});return{...t,loading:n}},{useMemo:Eft}=await F("react"),{useQuery:Pft}=await F("@tanstack/react-query"),jRe="/{robot_model}/map/getCloud",Rft=async({robot_model:i,mapName:e,fileName:t})=>{const n=jRe.replace("{robot_model}",i);return Ls.get(n,{params:{mapName:e,fileName:t}})},GRe=(i,e={})=>{const t=Eft(()=>[jRe,i],[i]);return{...Pft({queryKey:t,queryFn:()=>Rft(i),...e}),queryKey:t}},Mft={moveState:{autoMove:"stop",dockMove:"",jogMove:"none",obs:"none",pathState:"none",step:0,multiId:"",multiState:""},pose:{x:0,y:0,rz:0},vel:{vx:0,vy:0,wz:0},curNode:{id:"",name:"",pose:{x:0,y:0,rz:0}},goalNode:{id:"",name:"",pose:{x:0,y:0,rz:0}}};function ooe(i,e,t=!0){const{data:n,loading:s,isDefaultData:o}=ls(`amr/${i}/moveStatus`,{defaultValue:Mft,selector:e,disabled:!t});return{...n,isDefaultData:o,loading:s}}const{useRef:Aft}=await F("react"),qRe=({className:i,robotModel:e,enabled:t=!0})=>{const n=Aft(null),{worldStudioStateProps:s}=kDe(),{data:o}=soe({robot_model:e},{enabled:t&&!!e,...t?{}:{retry:!1}}),{data:r}=URe(e,!1),a=$Re(e,t),{data:l}=a,{pose:c}=ooe(e,g=>({pose:g?.pose}),t),{data:d}=GRe({robot_model:e,mapName:o?.mapName??"",fileName:"cloud.csv"},{enabled:t&&!!o?.mapName,...t?{}:{retry:!1}}),{data:h}=HRe({robot_model:e,mapName:o?.mapName??""},{enabled:t&&!!o?.mapName,...t?{}:{retry:!1}});return u("div",{className:P("MuscatSimpleAMRMap",i),children:u(LDe,{ref:n,...s,cameraPositionKey:DDe,pointsData:d?.data,topoData:h,lidarPoints:l,mappingPoints:r,robotPose:c,showGrid:!0,showNodeLabels:!1,showLidar:!0,viewportCameraMode:"topView",robot:e})})},{useQuery:Oft}=await F("@tanstack/react-query"),{useMemo:Fft}=await F("react"),KRe="/{robot_model}/moveStatus",Bft=async({robot_model:i})=>{const e=KRe.replace("{robot_model}",i);return Ls.get(e)},Vft=({robot_model:i},e={})=>{const t=Fft(()=>[KRe,i],[i]);return{...Oft({queryKey:t,queryFn:()=>Bft({robot_model:i}),...e}),queryKey:t}},{useQueryClient:zft}=await F("@tanstack/react-query"),{useEffect:Wft}=await F("react"),Hft=(i,e,t=!0)=>{const n=zft(),{data:s,queryKey:o,...r}=Vft({robot_model:i},{enabled:t&&!!i,...t?{}:{retry:!1}}),{isDefaultData:a,loading:l,...c}=ooe(i,e,t);return Wft(()=>{!l&&c&&!a&&n.setQueryData(o,d=>({...d,...c}))},[c,o,a,l,n]),{data:s,...r}},{useMemo:afe}=await F("react"),$ft=({className:i,robotModel:e,connected:t})=>{const n=ir(),{t:s}=q(),{theme:o}=tt(),{setSelectedRobotModel:r}=ui(),{data:a}=Hft(e,p=>({moveState:p.moveState,vel:p.vel,curNode:{id:p.curNode.id,name:p.curNode.name},goalNode:{id:p.goalNode.id,name:p.goalNode.name}}),t),{data:l}=pft({robot_model:e},{enabled:t&&!!e,...t?{}:{retry:!1}}),{data:c}=VRe(),{data:d}=wft(),h=afe(()=>{const p=a?.moveState;return{autoMove:p?.autoMove??"-",obs:p?.obs??"none"}},[a?.moveState]),g=afe(()=>{const p=a?.vel;return{vx:p?.vx??0,vy:p?.vy??0,wz:p?.wz??0}},[a?.vel]),m=()=>{n("/muscat/app/move"),r(e)},f=()=>{n("/muscat/app/move"),r(e)};return u(My,{className:P("AMRNavStatus",i),children:x(H,{className:"h-full p-2",children:[x(U,{className:"flex h-full w-[50%] flex-1 gap-2",children:[u(qRe,{className:"relative flex h-full flex-1 overflow-hidden rounded",robotModel:e,enabled:t}),x(H,{className:P("gap-1","[&_button]:h-8 [&_button]:w-full [&_button]:px-2"),children:[u(se,{variant:"outlined",size:"xs",onClick:m,children:s("dashboard.content.localization")}),u(se,{className:o==="light"?"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy":void 0,variant:"soft",size:"xs",onClick:f,children:s("dashboard.content.mapEditor")})]})]}),x(U,{className:"relative w-full flex-1 gap-6 px-2.5 py-4",children:[u(Sft,{className:"absolute top-0.5 right-0.5 z-[2]",moveStatus:h.autoMove}),u(Mqe,{currentNode:a?.curNode?.name??a?.curNode?.id??"",targetNode:a?.goalNode?.name??a?.goalNode?.id??"",moveStatus:h.autoMove}),x(U,{className:"relative gap-4 pl-7",children:[x(U,{className:"border-border-subtle gap-0.5 border-t pt-3",children:[u("span",{className:"text-fg-subtle typo-compact-xs-normal",children:s("dashboard.content.mapName")}),u("div",{className:"text-fg-default typo-compact-sm-semibold",children:`${l?.mapState?.mapName??"none"}`})]}),x("div",{className:P("grid grid-cols-2 gap-3","[&>div]:gap-0.5","[&>div>span]:text-fg-subtle [&>div>span]:typo-compact-xs-normal","[&>div>div]:text-fg-default [&>div>div]:typo-compact-sm-semibold"),children:[x(U,{children:[x("span",{children:[s("dashboard.content.linearSpeed")," (Vx, Vy)"]}),u("div",{children:`${g.vx.toFixed(1)}m/s | ${g.vy.toFixed(1)}m/s`})]}),x(U,{children:[u("span",{children:s("dashboard.content.rotationSpeed")}),u("div",{children:`${g.wz.toFixed(2)}deg/s`})]}),x(U,{children:[u("span",{children:s("dashboard.content.localizationStatus")}),u("div",{className:P("!text-fg-subtle",{"!text-fg-information":l?.locState?.locStatus==="good","!text-fg-warning":l?.locState?.locStatus==="none","!text-fg-danger":l?.locState?.locStatus==="fail"}),children:l?.locState?.locStatus||"-"})]}),x(U,{children:[u("span",{children:s("dashboard.content.obstacle")}),u("div",{className:P("!text-fg-subtle",{"!text-fg-warning":h.obs==="none","!text-fg-danger":h.obs==="near","!text-fg-information":h.obs==="far","!text-fg-caution":h.obs==="vir"}),children:h.obs||"-"})]}),x(U,{children:[u("span",{children:"Path State"}),u("div",{className:P("!text-fg-subtle",{"!text-fg-warning":a?.moveState?.pathState==="none","!text-fg-success":a?.moveState?.pathState==="req_path","!text-fg-information":a?.moveState?.pathState==="recv_path"}),children:a?.moveState?.pathState||"-"})]}),x(U,{children:[u("span",{children:"FRS IPv4"}),x("div",{className:"!text-fg-information",children:[c?.ip??"0.0.0.0",` (${d?.wifi?.signal??0})`]})]})]})]})]})]})})},Uft=({className:i,robotModel:e,connected:t})=>x(H,{className:P("AMROverviewCard","gap-2.5",i),children:[u($ft,{className:"h-full flex-2",robotModel:e,connected:t}),u(gft,{className:"h-full flex-1",robotModel:e,connected:t})]}),{useCallback:lfe,useMemo:jft,useRef:Gft,useState:qft}=await F("react"),Kft=({className:i})=>{const e=Gft(null),{t}=q(),{data:n}=M9(),[s,o]=qft(0),r=jft(()=>n.core_sw_list?.filter(c=>c.be_service==="amr")??[],[n.core_sw_list]),a=lfe(c=>{o(c.activeIndex)},[]),l=lfe(c=>{e.current?.slideTo(c)},[]);return x(U,{className:P("AMROverview","gap-2",i),children:[x(H,{alignItems:"center",justifyContent:"space-between",children:[u("h4",{className:"typo-title-03-bold text-fg-default",children:t("dashboard.title.amrNavStatus")}),u(H,{className:"gap-1.5",alignItems:"center",children:r.length>1&&r.map((c,d)=>u("button",{className:"relative !size-2 overflow-hidden rounded-full",onClick:()=>l(d),children:u("div",{className:P("bg-fg-subtler size-full",{"bg-fg-default":s===d})})},d))})]}),u(JLe,{ref:e,onSlideChange:a,children:r.map(c=>u(Uft,{className:"h-90 w-full",robotModel:c.model,connected:c.connected!=="DISCONNECT"},c.model))})]})},{useMemo:cfe}=await F("react"),Jft=({className:i})=>{const{data:e}=As(),{data:t}=M9(),n=cfe(()=>[...new Set(t?.core_sw_list?.map(r=>r.be_service)??[])],[t]),s=cfe(()=>n.includes("amr"),[n]),o=n.length<=1;return u("div",{className:P("DashboardPage","p-5",i),children:x(U,{className:"mx-auto max-w-[1536px] gap-3",children:[u(htt,{}),Yl()?u(U,{className:"bg-bg-raised text-fg-subtle h-[calc(var(--vh,1vh)*100-13rem-1px)] w-full rounded-md text-xl",alignItems:"center",justifyContent:"center",children:"Preview"}):x(rn,{children:[u(rft,{className:P("h-[26.875rem] max-h-[1000px]",{"h-[calc(var(--vh,1vh)*100-13rem-1px)]":o&&!s}),robotModel:e?.modelInfo?.model||"",hideRobotComponents:o}),s&&u(Kft,{})]})]})})},l4={x:100,y:100,z:100},roe=[{type:"box",nameKey:"move.workspace.addMenu.box",dimensions:l4},{type:"cylinder",nameKey:"move.workspace.addMenu.cylinder",dimensions:l4},{type:"sphere",nameKey:"move.workspace.addMenu.sphere",dimensions:l4}],dfe="mm",Yft="°",Xft=1,Qft=0,Zft=.1,ept=2,tpt=1,npt=0,JRe={x:0,y:0,z:0},aoe={rx:0,ry:0,rz:0},uR={x:1,y:1,z:1},YRe=(i,e)=>{const{scale:t,position:n,...s}=e,o={...s,...n&&{position:n}};return i.kind!=="shape"?{...i,...o}:{...i,...o,...t&&{scale:t}}},ipt=(i,e,t)=>{const n=i.toLowerCase();return n.includes("right")?{key:"move.workspace.tab.toolRight"}:n.includes("left")?{key:"move.workspace.tab.toolLeft"}:t<=1?{key:"move.workspace.tab.tool"}:{key:"move.workspace.tab.toolIndexed",params:{index:e+1}}},spt=5,ufe=(i,e,t,n)=>{const s=t.trim().toLowerCase();return n&&s===n.trim().toLowerCase()?!1:i.some(o=>o.modelType===e.modelType&&(e.attachment?o.attachment?.parentJointName===e.attachment.parentJointName:!0)&&o.workspace?.name.trim().toLowerCase()===s)},opt=i=>{const e=new Map;for(const t of i){const n=t.workspace?.name;if(!n)continue;const s=e.get(n)??[];s.push(t),e.set(n,s)}return Array.from(e.entries()).map(([t,n])=>({name:t,models:n}))},x8=i=>{const e=i.map(t=>t.createdAt).sort();return e[e.length-1]},GN=i=>typeof i=="number"&&Number.isFinite(i),hfe=i=>!!i&&typeof i=="object"&&GN(i.x)&&GN(i.y)&&GN(i.z),rpt=i=>!!i&&typeof i=="object"&&GN(i.rx)&&GN(i.ry)&&GN(i.rz),apt=i=>{if(!i||typeof i!="object")return!1;const e=i;return typeof e.id!="string"||typeof e.name!="string"||e.modelId!==void 0&&typeof e.modelId!="string"||!hfe(e.position)||!rpt(e.rotation)?!1:e.kind==="shape"?typeof e.shapeType=="string"&&hfe(e.scale):e.kind==="custom"?typeof e.fileId=="string"&&typeof e.fileName=="string":!1},gfe=i=>Array.isArray(i)&&i.every(apt),lpt=i=>{if(!i||typeof i!="object")return!1;const e=i;return(e.stage==="empty"||e.stage==="build")&&(e.workspaceName===null||typeof e.workspaceName=="string")&&(e.lastSyncedWorkspaceName===null||typeof e.lastSyncedWorkspaceName=="string")&&gfe(e.items)&&gfe(e.lastSyncedItems)&&Array.isArray(e.hiddenItemIds)&&e.hiddenItemIds.every(t=>typeof t=="string")},JO=150,cpt={x:200,y:200},dpt=50,upt=i=>{if(i===0)return[[0,0]];const e=[[i,0],[0,i],[-i,0],[0,-i]];for(let t=1;t<i;t++)e.push([i,t],[i,-t],[-i,t],[-i,-t],[t,i],[-t,i],[t,-i],[-t,-i]);return e.push([i,i],[-i,i],[-i,-i],[i,-i]),e},hpt=(i,e)=>i==="base"?"base":`tool:${e}`,gpt=i=>i==="tool",mpt=(i,e,t=dpt)=>{for(let n=0;n<=t;n++)for(const[s,o]of upt(n)){const r=e.x+s*JO,a=e.y+o*JO;if(!i.some(c=>Math.abs(c.position.x-r)<JO/2&&Math.abs(c.position.y-a)<JO/2))return{x:r,y:a}}return{...e}},fpt=(i,e,t,n,s,o)=>i.map(r=>{const a=r.kind==="shape"?{kind:"primitive",shape:r.shapeType}:{kind:"file",url:`${Uie}/common/files/models/${encodeURIComponent(r.fileName)}`,fileName:r.fileName};return{id:`${e}:${r.id}`,source:a,displayName:r.name,transform:{x:r.position.x/Pn,y:r.position.y/Pn,z:r.position.z/Pn,rx:r.rotation.rx,ry:r.rotation.ry,rz:r.rotation.rz,scale:r.kind==="shape"?{x:r.scale.x,y:r.scale.y,z:r.scale.z}:1},mountJointName:t||void 0,visible:!o?.has(r.id),onLoad:n?()=>n(r.id):void 0,onLoadError:s?()=>s(r.id):void 0}}),XRe="local:",loe=()=>`${XRe}${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,mfe=i=>i.startsWith(XRe),YO=(i,e)=>{const t=new Set(e.filter(o=>!mfe(o))),n=new Set(i.filter(o=>!mfe(o))),s=[];for(const o of n)t.has(o)||s.push({modelId:o,isLoaded:!1});for(const o of t)s.push({modelId:o,isLoaded:!0});return s},ppt=(i,e,t=new Set)=>new Set(i.filter(n=>n.kind==="custom"&&!e.has(n.id)&&!t.has(n.id)).map(n=>n.id)),ffe=(i,e)=>{const t=new Set(e.map(s=>s.id)),n=Array.from(i).filter(s=>t.has(s));return n.length===i.size?i:new Set(n)},QRe=(i,e)=>i.name===e.name&&i.position.x===e.position.x&&i.position.y===e.position.y&&i.position.z===e.position.z&&i.rotation.rx===e.rotation.rx&&i.rotation.ry===e.rotation.ry&&i.rotation.rz===e.rotation.rz?i.kind==="shape"?e.kind==="shape"&&i.shapeType===e.shapeType&&i.scale.x===e.scale.x&&i.scale.y===e.scale.y&&i.scale.z===e.scale.z:e.kind==="custom"&&i.fileId===e.fileId&&i.fileName===e.fileName:!1,_pt=(i,e)=>i.id===e.id&&QRe(i,e),bpt=(i,e)=>{const t=new Map;for(const n of e){if(!n.modelId)return!1;t.set(n.modelId,n)}if(t.size!==i.length)return!1;for(const n of i){if(!n.modelId)return!1;const s=t.get(n.modelId);if(!s||!QRe(n,s))return!1}return!0},ZRe=(i,e)=>{const t=[],n=new Set(i.map(s=>s.id));for(const s of i){if(!s.modelId){t.push({kind:"create",item:s});continue}const o=e.get(s.id);if(!o){t.push({kind:"create",item:s});continue}_pt(o,s)||t.push({kind:"update",item:s,modelId:s.modelId})}for(const[s,o]of e)!n.has(s)&&o.modelId&&t.push({kind:"delete",modelId:o.modelId});return t},vpt=(i,e,t,n)=>{const s=ZRe(i,e);if(!(t!==n))return s;const r=new Set(s.filter(l=>l.kind!=="delete").map(l=>l.item.id)),a=i.filter(l=>!!l.modelId&&!r.has(l.id)).map(l=>({kind:"update",item:l,modelId:l.modelId}));return[...s,...a]},ypt=(i,e,t,n)=>ZRe(i,e).length>0||t!==n,BE=(i,e)=>i===e?!0:i.length!==e.length?!1:i.length===0&&e.length===0?!0:JSON.stringify(i)===JSON.stringify(e),wpt=i=>({id:loe(),modelId:i.modelId,name:i.name??i.fileInfo.fileName.replace(/\.[^.]+$/,""),kind:"custom",fileName:i.fileInfo.fileName,fileId:i.fileId,position:{...JRe},rotation:{...aoe,rx:i.pose?.rx??0,ry:i.pose?.ry??0,rz:i.pose?.rz??0}}),pfe=i=>{const e={id:loe(),modelId:i.modelId,position:{x:Math.round(i.pose.x*Pn),y:Math.round(i.pose.y*Pn),z:Math.round(i.pose.z*Pn)},rotation:{rx:i.pose.rx,ry:i.pose.ry,rz:i.pose.rz}};if(i.shapeType!==null)return{...e,name:i.name??i.shapeType,kind:"shape",shapeType:i.shapeType,scale:i.scale??uR};const t=i.fileInfo?.fileName??"";return{...e,name:i.name??t.replace(/\.[^.]+$/,""),kind:"custom",fileId:i.fileId??"",fileName:t}},wJ="application/x-rb-workspace-shape",Cpt=i=>{switch(i){case"cylinder":return u(QLe,{className:"text-fg-subtle group-hover:text-fg-navy size-4.5 shrink-0 transition-colors"});case"sphere":return u(XLe,{className:"text-fg-subtle group-hover:text-fg-navy size-4.5 shrink-0 transition-colors"});default:return u(YLe,{className:"text-fg-subtle group-hover:text-fg-navy size-4.5 shrink-0 transition-colors"})}},Spt=({onAddShape:i,limitReached:e,isCustomFileUploading:t=!1,onOpenCustomFilePicker:n,draggable:s=!1,className:o})=>{const{t:r}=q();return x(U,{className:P("border-border-subtle/70 bg-bg-alt-1/40 w-full gap-1.5 rounded-lg border p-1.5 shadow-2xs transition-all",o),children:[x("div",{className:"grid grid-cols-2 gap-1.5",children:[roe.map(a=>x("button",{type:"button",disabled:e,draggable:s&&!e,onDragStart:c=>{c.dataTransfer.setData(wJ,a.type),c.dataTransfer.effectAllowed="copy"},onClick:()=>i(a.type),className:P("group border-border-subtle/80 bg-bg-default relative flex h-9 items-center gap-2 rounded-md border px-2.5 shadow-2xs transition-all duration-150 select-none","hover:border-border-navy-stronger hover:bg-fill-navy-subtler active:bg-fill-navy-subtle active:scale-[0.99]","focus-visible:ring-border-navy-stronger focus-visible:ring-2 focus-visible:outline-hidden",e&&"hover:border-border-subtle/80 hover:bg-bg-default cursor-not-allowed opacity-40"),children:[Cpt(a.type),u("span",{className:"typo-compact-xs-medium text-fg-default group-hover:text-fg-navy truncate transition-colors",children:r(a.nameKey)})]},a.type)),x("button",{type:"button",disabled:t,onClick:n,className:P("group border-border-subtle/80 bg-bg-default relative flex h-9 items-center gap-2 rounded-md border px-2.5 shadow-2xs transition-all duration-150 select-none","hover:border-border-navy-stronger hover:bg-fill-navy-subtler active:bg-fill-navy-subtle active:scale-[0.99]","focus-visible:ring-border-navy-stronger focus-visible:ring-2 focus-visible:outline-hidden",t&&"cursor-not-allowed opacity-50"),children:[t?u(aw,{size:"1rem",className:"text-fg-subtle shrink-0"}):u(Ey,{className:"text-fg-subtle group-hover:text-fg-navy size-4.5 shrink-0 transition-colors"}),u("span",{className:"typo-compact-xs-medium text-fg-default group-hover:text-fg-navy truncate transition-colors",children:r("move.workspace.addMenu.customFile")})]})]}),e&&u("span",{className:"typo-compact-2xs-normal text-fg-danger px-1",children:r("move.workspace.shapeLimitReached")})]})},{useCallback:uf,useEffect:N8,useMemo:I8,useRef:XO,useState:$w}=await F("react"),xpt=({detailRobotModel:i,tcpJoints:e,urdfViewerRef:t,assetGizmoDisabled:n=!1,assetPicker:s})=>{const[o,r]=$w([]),[a,l]=$w(!1),[c,d]=$w("translate"),h=XO(null),[g,m]=$w([]),[f,p]=$w([]),_=uf(($,Z)=>{m(K=>BE(K,$)?K:$),p(K=>BE(K,Z)?K:Z)},[]),[b,v]=$w(null),w=uf($=>{v($)},[]),y=uf($=>{h.current={x:$.clientX,y:$.clientY}},[]),S=uf($=>{const Z=h.current;if(h.current=null,!Z||Math.abs($.clientX-Z.x)>5||Math.abs($.clientY-Z.y)>5||t.current?.isAssetGizmoDragging())return;if(s?.isActive){const V=t.current?.getAssetIdAtPointer?.($.nativeEvent);if(V){s.onPick(V);return}}if(n)return;const K=t.current?.selectAssetAtPointer($.nativeEvent);r(K?.assetIds??[]),l(K?.selectionMode??!1)},[n,s,t]),C=uf($=>{if($===null){t.current?.clearAssetSelection(),r([]),l(!1);return}r([$]),l(!1),!n&&t.current?.setSelectedAssetIds([$],!1)},[n,t]),N=uf(($,Z)=>{r($),l(Z),!n&&t.current?.setSelectedAssetIds($,Z)},[n,t]),k=XO([]);N8(()=>{k.current=o},[o]);const L=uf($=>{n||a||k.current.length===1&&k.current[0]===$&&t.current?.setSelectedAssetIds([$],!1)},[n,a,t]),D=XO({id:null,mode:"translate"});N8(()=>{if(!o.length||o.length>1){D.current={id:null,mode:"translate"};return}const $=o[0];if([...g,...f].find(V=>V.id===$)?.source.kind==="file"&&c==="scale"){d("translate");return}D.current.id===$&&D.current.mode===c||(D.current={id:$,mode:c},t.current?.setAssetGizmoMode(c))},[c,o,g,f,t]);const T=uf(()=>{t.current?.clearAssetSelection(),r([]),l(!1)},[t]);N8(()=>{n&&T()},[n,T]);const[E,R]=$w(null),A=XO(0),M=uf($=>{$.dataTransfer.types.includes(wJ)&&($.preventDefault(),$.dataTransfer.dropEffect="copy")},[]),O=uf($=>{const Z=$.dataTransfer.getData(wJ);if(!Z)return;$.preventDefault();const K=t.current?.screenToGroundPoint({clientX:$.clientX,clientY:$.clientY});K&&(A.current+=1,R({type:Z,at:{x:Math.round(K.x*Pn),y:Math.round(K.y*Pn)},nonce:A.current}))},[t]),B=I8(()=>({detailRobotModel:i,tcpJoints:e,gizmoSelectedAssetIds:o,selectionMode:a,onAssetsChange:_,assetTransformEvent:b,shapeDropRequest:E,onRequestSceneAssetSelect:C,onRequestSceneSelectionChange:N,onAssetLoaded:L}),[i,e,o,a,_,b,E,C,N,L]),z=I8(()=>({onPointerDown:y,onPointerUp:S,onDragOver:M,onDrop:O}),[y,S,M,O]),Y=I8(()=>({onAssetTransformChange:w,onAssetSelectionChange:$=>{r($.assetIds),l($.selectionMode)}}),[w]);return{baseAssets:g,toolAssets:f,gizmoSelectedAssetIds:o,selectionMode:a,assetGizmoMode:c,setAssetGizmoMode:d,clearGizmoSelection:T,workspaceControlProps:B,requestMenuId:o.length?"workspace":void 0,requestMenuToken:o.join(","),sceneHandlers:z,viewerProps:Y}},CJ=({className:i,id:e,icon:t,active:n,label:s,expended:o,onClick:r})=>{const{theme:a}=tt();return u(se,{className:P("MoveMenuItem","text-fg-subtle h-7 w-full justify-start gap-1.5","[&_img]:size-3.5 [&_svg]:size-3.5","hover:bg-fill-subtler text-fg-default",n&&(a==="light"?"bg-fill-navy-subtlest text-fg-navy":"bg-fill-subtler"),i,{"hover:bg-fill-navy-subtlest":a==="light"}),size:"xs",variant:"transparent",leadingIcon:typeof t=="string"?u("img",{src:t}):t,onClick:r,"data-testid":e?`menu-item-${e}`:void 0,children:!!o&&s})},{useState:Npt,useCallback:Ipt,useEffect:kpt}=await F("react"),Lb=({ui:i,...e})=>{const{usePluginManifest:t}=Fu(),[n,s]=Npt([]),{data:o}=t(),{data:r,refetch:a}=kA(e),l=Ipt(c=>{const d=Jv(c.contributes,i||e.point);return{id:"id"in c?c.id:c.pluginId,name:c.name,isPreview:"id"in c,icon:typeof c.icons=="object"?c.icons?.["16"]:c.icons,enabled:"id"in c?!0:c.enabled,toolbar:"id"in c?!0:c.toolbar,contribute:d}},[e.point,i]);return kpt(()=>{const c=r?.plugins?.filter(d=>i==="toolbar"?d.toolbar:!0)?.map(d=>l(d))??[];hA()&&o&&Jv(o.contributes,i||e?.point)&&c.unshift(l(o)),s(c)},[l,e?.point,e?.toolbar,i,r?.plugins,o]),{list:n,setList:s,makeToolbarItem:l,originInstalledList:r?.plugins,previewPlugin:o,refetchPluginInstalledList:a}},Lpt=({className:i,robotModel:e,currentMenuId:t,expendedMenu:n,onMenuClick:s})=>{const{currentLanguage:o}=q(),{getAssetUrl:r}=Fu(),{list:a}=Lb({robotModel:e,point:"move.panel"});return u("div",{className:P("PluginMoveMenuList",i),children:a.map(l=>u(CJ,{icon:r(l.id,uA(l.contribute?.icon,16)),label:gA(l.contribute?.label,o)||l.name,active:t===l.id,expended:n,onClick:()=>s(l.id)},l.id))})},{useCallback:Dpt,useEffect:coe,useMemo:SJ,useRef:$B,useState:xJ}=await F("react");function eMe(i){return{"data-muscat-plugin-root":"","data-muscat-plugin-id":i}}function Tpt(i,e,t){const n=$B(null),s=$B(""),o=`${i}::${e}`;return s.current!==o&&(s.current=o,n.current=R9.connect(i,e)),SJ(()=>XTe(n.current,W1(),{...t,pluginId:e}),[o])}function Ept({source:i,socketUrl:e,pluginId:t,mount:n}){const s=Tpt(e,t,n),[o,r]=xJ(null),[a,l]=xJ(null);return coe(()=>{let c=!1;return r(null),l(null),import(i.entryUrl).then(d=>{if(!c){if(!d.default)throw new Error(`plugin entry ${i.entryUrl} has no default export`);r(()=>d.default)}}).catch(d=>{c||l(d instanceof Error?d:new Error(String(d)))}),()=>{c=!0}},[i.entryUrl]),a?x("div",{className:"text-fg-danger p-4 text-sm",children:["Failed to load plugin: ",a.message]}):o?u("div",{...eMe(t),children:u(rse.Provider,{value:s,children:u(o,{})})}):u("div",{className:"flex items-center justify-center p-4",children:u("div",{className:"border-default size-5 animate-spin rounded-full border-2 border-t-transparent"})})}function Ppt({source:i,socketUrl:e,pluginId:t,mount:n}){const s=$B(null),[o,r]=xJ(null);return coe(()=>{const a=s.current;if(!a)return;let l,c=!1;const d=()=>queueMicrotask(()=>l?.());return import(i.bootstrapUrl).then(h=>{c||(l=h.mount(a,{socketUrl:e,pluginId:t,hostServices:W1(),data:n.data,onSave:n.onSave}))}).catch(h=>{c||r(h instanceof Error?h:new Error(String(h)))}),()=>{c=!0,d()}},[i.bootstrapUrl,e,t]),o?x("div",{className:"text-fg-danger p-4 text-sm",children:["Failed to load plugin (dev): ",o.message]}):u("div",{ref:s,...eMe(t)})}function s6({pluginId:i,ui:e,data:t,onRegisterSave:n}){const{getModuleSource:s,getSocketUrl:o}=Fu(),r=SJ(()=>s(i,e),[s,i,e]),a=o(i),l=$B(null),c=Dpt(h=>(l.current=h,()=>{l.current===h&&(l.current=null)}),[]);coe(()=>{n?.(()=>l.current?.())},[n]);const d=SJ(()=>({data:t,onSave:c}),[c]);return r.kind==="dev"?u(Ppt,{source:r,socketUrl:a,pluginId:i,mount:d}):u(Ept,{source:r,socketUrl:a,pluginId:i,mount:d})}const{forwardRef:Rpt,useCallback:QO,useEffect:k8,useMemo:Mpt,useRef:L8,useState:_fe}=await F("react"),o6=Rpt(function({className:e,rightIconPanels:t,menus:n,auxiliaryPanel:s,beService:o,children:r,viewportFullscreen:a,viewportClassName:l,onBeforeMenuChange:c,persistentMenu:d,requestMenuId:h,requestMenuToken:g},m){const{t:f}=q(),{theme:p}=tt(),_=ir(),[b]=xc(),{data:v}=As(),{list:w}=Lb({robotModel:v?.info?.robotModel,point:"move.panel"}),y=L8(o),S=QO(O=>{const B=[...n.map(z=>z.id),...w?.map(z=>z.id)??[]];return O&&B.includes(O)?O:n[0]?.id||w?.[0]?.id||""},[n,w]),[C,N]=_fe(()=>S(b.get("menu"))),[k,L]=_fe(b.get("expended")!=="0"),D=Mpt(()=>{const O=w?.map(B=>({...B,content:u(s6,{pluginId:B.id,ui:B.contribute?.ui})}))??[];return[...n,...O].find(B=>B.id===C)},[n,w,C]),T=QO(O=>{_({pathname:"/muscat/app/move",search:O.toString()},{replace:!0})},[_]),E=QO(async O=>{if(O===C||!(await c?.({currentMenuId:C,nextMenuId:O})??!0))return;N(O);const z=new URLSearchParams(b);z.set("menu",O),z.set("expended",k?"1":"0"),T(z)},[C,k,T,c,b]),R=L8(!1),A=L8(null);k8(()=>{if(!h){A.current=null;return}const O=A.current;if(O&&O.id===h&&O.token===g)return;A.current={id:h,token:g};const B=S(h);if(!B||B===C)return;N(B),R.current=!0;const z=new URLSearchParams(b);z.set("menu",B),z.set("expended",k?"1":"0"),T(z)},[h,g,C,k,b,T,S]);const M=QO(()=>{const O=!k;L(O);const B=new URLSearchParams(b);B.set("menu",C),B.set("expended",O?"1":"0"),T(B)},[C,k,T,b]);return k8(()=>{if(R.current){R.current=!1;return}const O=S(b.get("menu"));if(N(O),L(b.get("expended")!=="0"),O&&O!==b.get("menu")){const B=new URLSearchParams(b);B.set("menu",O),T(B)}},[b,n,w]),k8(()=>{o!==y.current&&(y.current=o,_({pathname:"./",search:""}))},[o]),x("div",{className:P("MoveLayout","relative h-full","[--move-menu-width:2.75rem] [--move-panel-width:17.5rem]","[--move-debug-panel-width:0rem]","min-[1280px]:[--move-panel-width:20rem]",s?.open&&"[--move-debug-panel-width:calc(var(--move-panel-width)*2)]",k&&"[--move-menu-width:8rem]",e),children:[u("div",{className:"relative h-full pr-[calc(var(--move-panel-width)+var(--move-debug-panel-width))] transition-[padding-right] duration-200",children:x("div",{className:"relative h-full pr-(--move-menu-width) transition-[padding-right] duration-200",children:[x("div",{ref:m,"data-slot":"move-viewport","data-state":a?"fullscreen":"windowed",className:P("overflow-hidden",a?"fixed inset-0":"absolute inset-0",l),children:[r,u("div",{"data-flyout-anchor":!0,className:P("text-default absolute top-2 z-11 flex flex-col gap-1.5",a?"right-2":k?"right-33":"right-12"),children:t?.map(O=>u("div",{children:O.element},O.key))})]}),x(U,{className:"bg-translucent border-disabled absolute top-0 right-0 z-1 h-full w-(--move-menu-width) border-r border-l p-1.5 transition-[width] duration-200",alignItems:k?"flex-start":"center",children:[u(se,{className:"text-fg-subtle h-7 w-full justify-start",size:"xs",variant:"transparent",leadingIcon:k?u(kje,{className:"size-3.5"}):u(Lje,{className:"size-3.5"}),onClick:M,children:!!k&&f("move.menu.button.label.collapse")}),u(_o,{type:"horizontal",className:"bg-border-disabled/10",spaceSize:6}),x(U,{className:"w-full gap-2",alignItems:"center",children:[n.map(O=>u(CJ,{id:O.id,icon:O.icon,label:O.label,active:C===O.id,expended:k,onClick:()=>E(O.id)},O.id)),s?u(CJ,{icon:s.icon,label:s.label,active:s.open,expended:k,onClick:s.onToggle}):null,u(Lpt,{robotModel:v?.info?.robotModel,expendedMenu:k,currentMenuId:C,onMenuClick:E})]})]})]})}),u("div",{className:P(p==="light"?"bg-white":"bg-alt-1","absolute top-0 right-(--move-debug-panel-width) z-2 h-full w-(--move-panel-width) transition-[right,width] duration-200"),children:x("div",{className:"h-full overflow-y-auto",children:[d&&u("div",{className:P("h-full",C!==d.id&&"hidden"),children:d.content}),(!d||C!==d.id)&&D?.content]})}),s?.open?u("div",{className:P(p==="light"?"bg-white":"bg-alt-1","border-disabled absolute top-0 right-0 z-2 h-full w-(--move-debug-panel-width) border-l transition-[width] duration-200"),children:u("div",{className:"h-full overflow-hidden",children:s.content})}):null]})}),{useMutation:Apt}=await F("@tanstack/react-query"),Opt="/{robot_model}/call_referencecontrol",Fpt=async i=>{const{robot_model:e,...t}=i,n=Opt.replace("{robot_model}",e),s=await Dt.post(n,t);if(s.returnValue)throw Error(`[Error] error Return value: ${s.returnValue}`);return s},Bpt=()=>Apt({mutationFn:async i=>Fpt(i)}),Ag=({className:i,subject:e})=>u("h6",{className:P("MoveRightPannelSubject","typo-compact-sm-semibold text-fg-default pb-2",i),children:e}),D8=({className:i,title:e,dataList:t})=>x(H,{className:P("ToolItemValue","flex w-full gap-4",i),alignItems:"center",justifyContent:"space-between",children:[u("h6",{className:"typo-compact-xs-medium text-fg-subtler w-30 shrink-0 whitespace-nowrap",children:e}),u("div",{className:P("grid flex-1 grid-cols-3 gap-6","*:gap-1"),children:Object.entries(t).map(([n,s])=>x(H,{className:"h-4 gap-1",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:P("typo-compact-xs-semibold w-2",{"text-fg-danger":n.includes("x"),"text-fg-success":n.includes("y"),"text-fg-information":n.includes("z")}),children:n.toUpperCase()}),x("span",{className:"typo-compact-xs-medium text-fg-subtle",children:[Ti(s),n.includes("r")?"º":"mm"]})]},`${e}-${n}`))})]}),{forwardRef:Vpt}=await F("react"),tMe=Vpt(({className:i,selectedToolNumber:e,toolNumber:t,toolName:n,weight:s,centerOfGravity:o,tcpPosition:r,tcpRotation:a,onSelectNumber:l},c)=>{const d=()=>{l?.(t)};return x(U,{ref:c,className:P("TcpToolItem","bg-fill-inverse-subtle relative z-1 cursor-pointer gap-1.5 rounded-md p-2.5 outline-2 outline-transparent",{"outline-border-navy-stronger":e===t},i),"data-slot":`tcp-tool-item-${t}`,onClick:d,children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("h6",{className:"typo-compact-xs-semibold text-fg-default",children:n}),x("span",{className:"typo-compact-xs-medium text-fg-subtle",children:[Ti(s),"KG"]})]}),x(U,{children:[u(D8,{title:"Center of Gravity",dataList:o}),u(D8,{title:"TCP Position",dataList:r}),u(D8,{title:"TCP Rotation",dataList:a})]})]})});tMe.displayName="TcpToolItem";const{useMutation:zpt}=await F("@tanstack/react-query"),Wpt="/{robot_model}/set_toollist_num",Hpt=async i=>{const e=Wpt.replace("{robot_model}",i.robotModel);return Dt.post(e,i)},$pt=()=>zpt({mutationFn:Hpt}),lv=(i,e)=>({toolName:i,comMass:e,comOffset:{v:[0,0,0]},tcpOffset:{v:[0,0,0]},tcpEuler:{v:[0,0,0]},boxType:0,boxParameter:{f:[0,0,0,0,0,0,0,0,0]}}),Upt={tConfigs0:lv("tool_1",1),tConfigs1:lv("tool_2",2),tConfigs2:lv("tool_3",3),tConfigs3:lv("tool_4",4),tConfigs4:lv("tool_5",5),tConfigs5:lv("tool_6",6),tConfigs6:lv("tool_7",7),tConfigs7:lv("tool_8",8)},jpt=i=>({userfName:i,userfOffset:{v:[0,0,0]},userfEuler:{v:[0,0,0]}}),nMe={user_frames:Array.from({length:8}).map((i,e)=>jpt(`user_frame_${e}`))},iMe={name:Array.from({length:16},(i,e)=>`pp_${e}`),pinJ:Array.from({length:16},()=>({tarValues:[0,0,0,0,0,0,0],tarFrame:0,tarUnit:0})),pinL:Array.from({length:16},()=>({tarValues:[0,0,0,0,0,0,0],tarFrame:0,tarUnit:0}))},{useEffect:Gpt,useMemo:qpt,useRef:bfe,useState:Kpt}=await F("react"),sMe=({className:i,open:e,robotModel:t,selectedToolNumber:n,onOpenChange:s,isUseSimulator:o,onToolSelected:r,resolve:a,close:l})=>{const{t:c}=q(),d=bfe(null),h=bfe([]),[g,m]=Kpt(n),{data:f}=uw({robot_model:t}),{mutateAsync:p,isPending:_}=$pt(),b=qpt(()=>!f&&!o?null:Object.values(o&&!f?Upt:f).map((C,N)=>({toolNumber:N,toolName:C.toolName,weight:Ti(C.comMass.toFixed(2)),centerOfGravity:{x:Ti(C.comOffset.v[0].toFixed(3)),y:Ti(C.comOffset.v[1].toFixed(3)),z:Ti(C.comOffset.v[2].toFixed(3))},tcpPosition:{x:Ti(C.tcpOffset.v[0].toFixed(3)),y:Ti(C.tcpOffset.v[1].toFixed(3)),z:Ti(C.tcpOffset.v[2].toFixed(3))},tcpRotation:{rx:Ti(C.tcpEuler.v[0].toFixed(3)),ry:Ti(C.tcpEuler.v[1].toFixed(3)),rz:Ti(C.tcpEuler.v[2].toFixed(3))}})),[f,o]),v=C=>{if(!d.current){const N=Number(getComputedStyle(C).paddingTop?.replace("px","")??0),k=C.offsetTop,L=h.current[n]?.offsetTop;L&&C.scrollTo({top:L-N-k-30}),d.current=C}},w=C=>{m(C)},y=async()=>{if(o&&!f){r?.(g),a?.(g);return}await p({robotModel:t,targetToolNum:g}),r?.(g),a?.(g)},S=()=>{l?.()};return Gpt(()=>{m(n)},[n]),u(td,{disableAutoFocus:$k.isDesktop,className:P(i,"flex max-h-140! w-137.5! flex-col gap-0 border-none p-0"),open:e,onOpenChange:s,header:{title:c("move.tool.modal.title")},footer:x(H,{className:"h-8 w-full gap-1",alignItems:"center",justifyContent:"flex-end",children:[u(se,{variant:"outlined",onClick:S,children:c("common.button.cancel")}),u(se,{variant:"brand",disabled:g===void 0,loading:_,onClick:y,children:c("common.button.confirm")})]}),children:u(U,{ref:C=>{v(C)},className:"bg-bg-overlay min-h-20 px-4",children:u(Km,{className:"h-full overflow-y-auto",children:u(U,{className:"gap-1.5 p-1",children:u(qr,{list:b,children:({item:C,index:N})=>u(tMe,{ref:k=>{h.current[N]=k},selectedToolNumber:g,toolNumber:C.toolNumber,toolName:C.toolName,weight:C.weight,centerOfGravity:C.centerOfGravity,tcpPosition:C.tcpPosition,tcpRotation:C.tcpRotation,onSelectNumber:w},N)})})})})})},{useMemo:Jpt}=await F("react"),Ypt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{modal:s}=Vi(),{selectedRobot:o}=Fi(e),{toolName:r}=ws(e,d=>({toolName:d.toolName})),{data:a}=uw({robot_model:e}),l=Jpt(()=>{const d=Object.values(a??[]),h=d.findIndex(g=>g.toolName===r);return h!==-1?{...d[h],toolNumber:h}:null},[r,a]),c=()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),s({component:sMe,props:{robotModel:e,selectedToolNumber:l?.toolNumber}})};return x("div",{className:P("TCPToolControl","p-2.5",i),children:[u(Ag,{subject:t("move.menu.button.label.tcpTool")}),u(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:l?x(rn,{children:[x(H,{className:"typo-compact-xs-medium gap-1.5",justifyContent:"space-between",alignItems:"center",children:[u("b",{className:"text-fg-default font-semibold",children:l.toolName}),x("span",{className:"typo-compact-xs-medium text-fg-subtle",children:[Ti(l.comMass),"KG"]})]}),x(U,{className:P("gap-2","[&>.info-box>.label]:typo-compact-2xs-medium [&>.info-box>.label]:text-fg-subtler [&>.info-box>.label]:mb-0.5","[&_.value-group]:gap-2.5","[&_.value-box]:typo-compact-xs-medium [&_.value-box]:text-fg-default [&_.value-box]:w-full","[&_.value-box:nth-child(1)_.value-label]:text-fg-danger [&_.value-box:nth-child(2)_.value-label]:text-fg-success [&_.value-box:nth-child(3)_.value-label]:text-fg-information"),children:[x(U,{className:"info-box",children:[u("span",{className:"label",children:t("settings.tool.title.centerOfGravity")}),x(H,{className:"value-group",children:[x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"X"}),x("span",{className:"value-value",children:[Ti(l.comOffset.v[0].toFixed(3)),"mm"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"Y"}),x("span",{className:"value-value",children:[Ti(l.comOffset.v[1].toFixed(3)),"mm"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"Z"}),x("span",{className:"value-value",children:[Ti(l.comOffset.v[2].toFixed(3)),"mm"]})]})]})]}),x(U,{className:"info-box",children:[u("span",{className:"label",children:`TCP ${t("settings.tool.title.position")}`}),x(H,{className:"value-group",children:[x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"X"}),x("span",{className:"value-value",children:[Ti(l.tcpOffset.v[0].toFixed(3)),"mm"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"Y"}),x("span",{className:"value-value",children:[Ti(l.tcpOffset.v[1].toFixed(3)),"mm"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"Z"}),x("span",{className:"value-value",children:[Ti(l.tcpOffset.v[2].toFixed(3)),"mm"]})]})]})]}),x(U,{className:"info-box",children:[u("span",{className:"label",children:`TCP ${t("settings.tool.title.rotation")}`}),x(H,{className:"value-group",children:[x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"RX"}),x("span",{className:"value-value",children:[Ti(l.tcpEuler.v[0].toFixed(3)),"°"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"RY"}),x("span",{className:"value-value",children:[Ti(l.tcpEuler.v[1].toFixed(3)),"°"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"RZ"}),x("span",{className:"value-value",children:[Ti(l.tcpEuler.v[2].toFixed(3)),"°"]})]})]})]})]})]}):u(Pie,{className:"[&_.no-data-text]:typo-compact-xs-medium h-30",nullText:t("move.menu.msg.tcpTool")})}),u(se,{className:"mt-2 w-full",variant:n==="light"?"brand":"soft",size:"xs",disabled:o?.connected==="DISCONNECT",onClick:c,children:t("move.button.change")})]})},{useCallback:T8,useEffect:Xpt,useRef:Qpt}=await F("react"),Dd=({className:i,variant:e,onButtonDown:t,onButtonUp:n,onButtonCancel:s,...o})=>{const r=Qpt(!1),{theme:a}=tt(),l=T8(()=>{r.current||(t?.(),r.current=!0)},[t]),c=T8(()=>{r.current&&(r.current=!1,n?.())},[n]),d=T8(()=>{r.current&&(r.current=!1,s?s():n?.())},[s,n]);return Xpt(()=>{const h=()=>{c?.()},g=()=>{d()};return window.addEventListener("pointerup",h),window.addEventListener("pointercancel",g),()=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",g)}},[c,d]),u(se,{variant:e,className:P("NxPointerHoldButton",a==="light"&&e==="outlined"&&"outline-fg-navy text-fg-navy",i),...o,onContextMenu:h=>{h.preventDefault()},onPointerDown:h=>{h.currentTarget.setPointerCapture?.(h.pointerId),l()},onPointerUp:c,onPointerCancel:d,children:o.children})},{useCallback:vfe,useMemo:Zpt,useState:e_t}=await F("react"),t_t=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{selectedRobot:s}=Fi(e),[o,r]=e_t(null),{jointLength:a,isMoving:l,jointInfo:c}=U9({tabType:"joint",tickModeInput:null,robotModel:e}),d=Zpt(()=>l||s?.connected==="DISCONNECT",[l,s?.connected]),{mutate:h}=K9(),{mutate:g}=J9(),m=vfe((p,_)=>{const b=Array.from({length:a},(w,y)=>c.values[y]);let v=[];p==="all"?v=Array(b.length).fill(0):v=b.map((w,y)=>y===_?0:typeof w=="number"?Number(w.toFixed(3)):0),r(_),h({robot_model:e,type:"j",target:{tar_values:v,tar_frame:-1,tar_unit:0},speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1}})},[h,a,e,c]),f=vfe(()=>{r(null),g({robot_model:e,stoptime:.3})},[g,e]);return u("div",{className:P("ZeroPoseControl","h-full",i),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:t("move.menu.button.label.zeroPose")}),Array.from({length:a}).map((p,_)=>u(Dd,{className:"typo-compact-xs-semibold",size:"sm",variant:"outlined",disabled:d&&o!==_,onButtonDown:()=>m("single",_),onButtonUp:f,children:`${t("move.menu.button.label.moveOrigin",{index:_})}`},`j${_}`)),u(Dd,{className:"typo-compact-xs-semibold",size:"sm",variant:n==="light"?"brand":"soft",disabled:d&&o!==-1,onButtonDown:()=>m("all",-1),onButtonUp:f,children:t("move.menu.button.label.moveAllOrigin")})]})})},{createContext:n_t,useContext:i_t}=await F("react"),oMe=n_t(null),kr=()=>{const i=i_t(oMe);if(!i)throw new Error("Available only inside GripperControl.");return i},{useMutation:s_t}=await F("@tanstack/react-query"),o_t="/{robot_model}/call_gripper_action",r_t=async i=>{const{robot_model:e,...t}=i,n=o_t.replace("{robot_model}",e);return await Dt.post(n,t)},si=()=>s_t({mutationFn:async i=>r_t(i)}),a_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,1,0,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.motorType"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:"General"},"motor-general"),u(J,{value:1,children:"XM-Series"},"motor-xm")]})})}),u(me,{label:e("program.field.label.controlMode"),children:u(oe,{control:n,name:"payload.3",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:e("settings.devices.welding.convMap.title.current")},"control-curr"),u(J,{value:1,children:e("settings.amr.collection.position")},"control-pos"),u(J,{value:2,children:e("program.gripper.option.currBasePos")},"control-curr-pos")]})})})]})]})},l_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalCurrent")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetCurrent")} (mA)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},c_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (Tick)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},d_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:0,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(a_t,{onPreview:s},"initialize");case 1:return u(l_t,{onPreview:s},"set-goal-current");case 2:return u(c_t,{onPreview:s},"set-goal-position")}};return u("div",{className:P("DynamixelMotor",i),children:o()})},u_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,1,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.initializeType"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:e("program.gripper.option.simpleInit")},"pg/cg-simple"),u(J,{value:1,children:e("program.gripper.option.fullInit")},"pg/cg-full")]})})})]})]})},h_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},g_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0,0,0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},m_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:1,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(u_t,{onPreview:s},"initialize");case 1:return u(h_t,{onPreview:s},"set-goal-position");case 2:return u(g_t,{onPreview:s},"set-3-params")}};return u("div",{className:P("DHPGSeries",i),children:o()})},f_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,1,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.initializeType"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:e("program.gripper.option.simpleInit")},"ag-simple"),u(J,{value:1,children:e("program.gripper.option.fullInit")},"ag-full")]})})})]})]})},p_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},__t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0,0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},b_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:2,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(f_t,{onPreview:s},"initialize");case 1:return u(p_t,{onPreview:s},"set-goal-position");case 2:return u(__t,{onPreview:s},"set-goal-pos-force")}};return u("div",{className:P("DHAGSeries",i),children:o()})},v_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,9]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},ZO=({onPreview:i,title:e,functionNum:t})=>{const{t:n}=q();return u(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:()=>{i(t,[])},children:n("program.button.preview")})]})})},y_t=({className:i})=>{const{t:e}=q(),{functionType:t,robotModel:n}=kr(),{mutate:s}=si(),o=(a,l)=>{s({robot_model:n,gripper_type:3,function_list:a,payload:l})},r=()=>{switch(t){case 0:return u(v_t,{onPreview:o},"initialize");case 1:return u(ZO,{onPreview:o,title:e("program.gripper.option.reset"),functionNum:1},"reset");case 2:return u(ZO,{onPreview:o,title:e("program.gripper.option.suction"),functionNum:2},"suction");case 3:return u(ZO,{onPreview:o,title:e("program.gripper.option.release"),functionNum:3},"release");case 4:return u(ZO,{onPreview:o,title:e("program.gripper.option.hold"),functionNum:4},"hold")}};return u("div",{className:P("RobotiqEPick",i),children:r()})},w_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,9]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},C_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},S_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0,0,0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},x_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:4,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(w_t,{onPreview:s},"initialize");case 1:return u(C_t,{onPreview:s},"set-goal-position");case 2:return u(S_t,{onPreview:s},"set-3-params")}};return u("div",{className:P("Robotiq2FSeries",i),children:o()})},N_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,9]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},I_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},k_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0,0,0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},L_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:5,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(N_t,{onPreview:s},"initialize");case 1:return u(I_t,{onPreview:s},"set-goal-position");case 2:return u(k_t,{onPreview:s},"set-3-params")}};return u("div",{className:P("RobotiqHandESeries",i),children:o()})},D_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,1]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},T_t=[{label:"program.gripper.option.laserOn",value:0},{label:"program.gripper.option.laserOff",value:1},{label:"program.gripper.option.setZeroPos",value:2},{label:"program.gripper.option.facotryReset",value:3}],E_t=({onPreview:i})=>{const{t:e}=q(),{control:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.gripper.option.functionCall")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:e("program.field.label.functionList"),children:u(oe,{control:t,name:"payload.0",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:T_t.map(r=>u(J,{value:r.value,children:e(r.label)},r.label))})})})})]})},P_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:6,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(D_t,{onPreview:s},"initialize");case 1:return u(E_t,{onPreview:s},"function-call")}};return u("div",{className:P("BaumerLDS",i),children:o()})},R_t=[{label:"program.gripper.option.inward",value:0},{label:"program.gripper.option.outward",value:1}],M_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,0,0,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerOrient"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:R_t.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.fingerLength")} (mm)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerTipWidth"),children:u(ot,{className:"w-full",name:"payload.4",register:t,allowNegative:!0})})]})]})},rMe=[{label:"program.gripper.option.extGrip",value:0},{label:"program.gripper.option.interGrip",value:1},{label:"program.gripper.option.stop",value:2}],A_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.gripDirection"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:rMe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},O_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0,0]}}),o=()=>{const r=n();i(2,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.gripDirection"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:rMe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},F_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:7,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(M_t,{onPreview:s},"initialize");case 1:return u(A_t,{onPreview:s},"set-goal-position");case 2:return u(O_t,{onPreview:s},"set-3-params")}};return u("div",{className:P("OnRobot2FG7",i),children:o()})},B_t=[{label:"program.gripper.option.inward",value:0},{label:"program.gripper.option.outward",value:1}],V_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,0,0,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerOrient"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:B_t.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.fingerLength")} (mm)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerTipWidth"),children:u(ot,{className:"w-full",name:"payload.4",register:t,allowNegative:!0})})]})]})},aMe=[{label:"program.gripper.option.extGrip",value:0},{label:"program.gripper.option.interGrip",value:1},{label:"program.gripper.option.stop",value:2}],z_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.gripDirection"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:aMe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},W_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0,0]}}),o=()=>{const r=n();i(2,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.gripDirection"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:aMe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},H_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:8,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(V_t,{onPreview:s},"initialize");case 1:return u(z_t,{onPreview:s},"set-goal-position");case 2:return u(W_t,{onPreview:s},"set-3-params")}};return u("div",{className:P("OnRobot2FG14",i),children:o()})},$_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},U_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.moveType"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:e("program.gripper.option.grip")},"grip"),u(J,{value:1,children:e("program.gripper.option.stop")},"stop")]})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},j_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:9,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u($_t,{onPreview:s},"initialize");case 1:return u(U_t,{onPreview:s},"set-goal-pos-force")}};return u("div",{className:P("OnRobotRG2",i),children:o()})},G_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},q_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.moveType"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:e("program.gripper.option.grip")},"grip"),u(J,{value:1,children:e("program.gripper.option.stop")},"stop")]})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},K_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:10,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(G_t,{onPreview:s},"initialize");case 1:return u(q_t,{onPreview:s},"set-goal-pos-force")}};return u("div",{className:P("OnRobotRG6",i),children:o()})},J_t=[{label:"program.gripper.option.extGrip",value:0},{label:"program.gripper.option.interGrip",value:1}],Y_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,49,0,13.5,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.fingerLength")} (mm)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerPosition"),children:u(oe,{control:n,name:"payload.3",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[1,2,3].map((a,l)=>u(J,{value:l,children:`Install-${a}`},`install-${a}`))})})}),u(me,{label:`${e("program.field.label.fingerDiameter")} (mm)`,children:u(ot,{className:"w-full",name:"payload.4",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.gripType"),children:u(oe,{control:n,name:"payload.5",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:J_t.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})})]})]})},X_t=[{label:"Grip",value:0},{label:"Move",value:1},{label:"Stop",value:2},{label:"Flexible",value:3}],Q_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.moveType"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:X_t.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},Z_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:11,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Y_t,{onPreview:s},"initialize");case 1:return u(Q_t,{onPreview:s},"set-goal-pos-force")}};return u("div",{className:P("OnRobot3FG15",i),children:o()})},ebt=[{label:"program.gripper.option.extGrip",value:0},{label:"program.gripper.option.interGrip",value:1}],tbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,49,0,13.5,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.fingerLength")} (mm)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerPosition"),children:u(oe,{control:n,name:"payload.3",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[1,2,3].map((a,l)=>u(J,{value:l,children:`Install-${a}`},`install-${a}`))})})}),u(me,{label:`${e("program.field.label.fingerDiameter")} (mm)`,children:u(ot,{className:"w-full",name:"payload.4",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.gripType"),children:u(oe,{control:n,name:"payload.5",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:ebt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})})]})]})},nbt=[{label:"Grip",value:0},{label:"Move",value:1},{label:"Stop",value:2},{label:"Flexible",value:3}],ibt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.moveType"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:nbt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},sbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:12,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(tbt,{onPreview:s},"initialize");case 1:return u(ibt,{onPreview:s},"set-goal-pos-force")}};return u("div",{className:P("OnRobot3FG25",i),children:o()})},obt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,100]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.powerConsumption")} (%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0})})]})]})},yfe=[{label:"Release",value:0},{label:"Grip",value:1},{label:"Idle",value:2}],rbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,100,0,100]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.chFunction",{msg:"A"}),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:yfe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.chPressure",{msg:"A"})} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:e("program.field.label.chFunction",{msg:"B"}),children:u(oe,{control:s,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:yfe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.chPressure",{msg:"B"})} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},abt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:13,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(obt,{onPreview:s},"initialize");case 1:return u(rbt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotVG10",i),children:o()})},lbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,100]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.powerConsumption")} (%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0})})]})]})},wfe=[{label:"Release",value:0},{label:"Grip",value:1},{label:"Idle",value:2}],cbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,100,0,100]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.chFunction",{msg:"A"}),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:wfe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.chPressure",{msg:"A"})} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:e("program.field.label.chFunction",{msg:"B"}),children:u(oe,{control:s,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:wfe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.chPressure",{msg:"B"})} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},dbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:14,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(lbt,{onPreview:s},"initialize");case 1:return u(cbt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotVGC10",i),children:o()})},ubt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},hbt=[{label:"Disengage",value:0},{label:"Engage",value:1},{label:"Engage + Smart Grip",value:2},{label:"Auto-Calibration",value:3}],gbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.cmdMode"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:hbt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.magneticStrength")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},mbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:15,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(ubt,{onPreview:s},"initialize");case 1:return u(gbt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotMG10",i),children:o()})},fbt=[{label:"program.gripper.option.none",value:0},{label:"Type a-h",value:1},{label:"Type a-s",value:2},{label:"Type b-H",value:3}],pbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.siliconModel"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:fbt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})})]})]})},_bt=[{label:"program.gripper.option.move",value:0},{label:"program.gripper.option.stop",value:1}],bbt=[{label:"General Mode",value:0},{label:"Gentle Grip Mode",value:1}],vbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetWidth")} (mm)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:e("program.field.label.cmdMode"),children:u(oe,{control:s,name:"payload.1",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:_bt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:e("program.field.label.gripMode"),children:u(oe,{control:s,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:bbt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})})]})]})},ybt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:16,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(pbt,{onPreview:s},"initialize");case 1:return u(vbt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotSoftGripper",i),children:o()})},{Fragment:wbt}=await F("react"),Cbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},Sbt=[{label:"program.gripper.option.use",value:0},{label:"program.gripper.option.notUse",value:1}],xbt=[{label:"program.gripper.option.active",value:0},{label:"program.gripper.option.ignore",value:1}],Nbt=[{label:"A",base:0},{label:"B",base:3},{label:"C",base:6},{label:"D",base:9}],Ibt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0,0,0,0,0,0,0,0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:Nbt.map(r=>x(wbt,{children:[u(me,{label:`${e("program.field.label.channel")}-${r.label} ${e("program.field.label.pressure")} (0~100%)`,children:u(ot,{className:"w-full",name:`payload.${r.base}`,register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.channel")}-${r.label} ${e("program.field.label.timeOutput")}`,children:u(oe,{control:s,name:`payload.${r.base+1}`,render:({field:a})=>u(ae,{className:"w-full",size:"sm",value:a.value,onChange:l=>a.onChange(Number(l.target.value)),children:Sbt.map(l=>u(J,{value:l.value,children:e(l.label)},l.label))})})}),u(me,{label:`${e("program.field.label.channel")}-${r.label} ${e("program.gripper.option.active")}/${e("program.gripper.option.ignore")}`,children:u(oe,{control:s,name:`payload.${r.base+2}`,render:({field:a})=>u(ae,{className:"w-full",size:"sm",value:a.value,onChange:l=>a.onChange(Number(l.target.value)),children:xbt.map(l=>u(J,{value:l.value,children:e(l.label)},l.label))})})})]},`channel-${r.label}`))})]})},kbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:17,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Cbt,{onPreview:s},"initialize");case 1:return u(Ibt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotVGP20",i),children:o()})},Lbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,300,10]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.rpmDeviLevel")} (RPM)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.vibLimitLevel")} (g)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0})})]})]})},Dbt=[{label:"program.gripper.option.motorStop",value:0},{label:"program.gripper.option.motorStart",value:1},{label:"program.gripper.option.ledOff",value:2},{label:"program.gripper.option.ledOn",value:3}],Tbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,1500]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.cmdMode"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:Dbt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetRPM")} (RPM)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},Ebt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:18,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Lbt,{onPreview:s},"initialize");case 1:return u(Tbt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotSander",i),children:o()})},Pbt=[{label:"JEGB 4285",value:0},{label:"JEGB 42140",value:1}],Rbt=({onPreview:i})=>{const{t:e}=q(),{control:t,getValues:n}=he({defaultValues:{payload:[0,0]}}),s=()=>{const o=n();i(0,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:t,name:"payload.0",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.productModel"),children:u(oe,{control:t,name:"payload.1",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>{o.onChange(Number(r.target.value))},children:Pbt.map(r=>u(J,{value:r.value,children:r.label},r.label))})})})]})]})},Mbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[80,80,80]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setParam")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.speed")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.acceleration")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.force")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},Abt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.gotoTarget")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")}`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},Obt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:19,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Rbt,{onPreview:s},"initialize");case 1:return u(Mbt,{onPreview:s},"set-parameter");case 2:return u(Abt,{onPreview:s},"goto-target")}};return u("div",{className:P("JrtJEGB",i),children:o()})},Fbt=[{label:"JEGG 2008",value:0},{label:"JEGG 2510",value:1},{label:"JEGG 3521",value:2},{label:"JEGG 4230",value:3}],Bbt=({onPreview:i})=>{const{t:e}=q(),{control:t,getValues:n}=he({defaultValues:{payload:[0,0]}}),s=()=>{const o=n();i(0,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:t,name:"payload.0",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.productModel"),children:u(oe,{control:t,name:"payload.1",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:Fbt.map(r=>u(J,{value:r.value,children:r.label},r.label))})})})]})]})},Vbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[80,80,80]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setParam")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.speed")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.acceleration")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.force")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},zbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.gotoTarget")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")}`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},Wbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:20,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Bbt,{onPreview:s},"initialize");case 1:return u(Vbt,{onPreview:s},"set-parameter");case 2:return u(zbt,{onPreview:s},"goto-target")}};return u("div",{className:P("JrtJEGG",i),children:o()})},Hbt=[{label:"JEGC 2870",value:0},{label:"JEGC 28150",value:1}],$bt=({onPreview:i})=>{const{t:e}=q(),{control:t,getValues:n}=he({defaultValues:{payload:[0,0]}}),s=()=>{const o=n();i(0,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:t,name:"payload.0",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.productModel"),children:u(oe,{control:t,name:"payload.1",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:Hbt.map(r=>u(J,{value:r.value,children:r.label},r.label))})})})]})]})},Ubt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[80,80,80]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setParam")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.speed")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.acceleration")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.force")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},jbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.gotoTarget")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")}`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},Gbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:21,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u($bt,{onPreview:s},"initialize");case 1:return u(Ubt,{onPreview:s},"set-parameter");case 2:return u(jbt,{onPreview:s},"goto-target")}};return u("div",{className:P("JrtJEGC",i),children:o()})},qbt=[{label:"JEGH 3520",value:0},{label:"JEGH 4232",value:1},{label:"JEGH 4226",value:2}],Kbt=({onPreview:i})=>{const{t:e}=q(),{control:t,getValues:n}=he({defaultValues:{payload:[0,0]}}),s=()=>{const o=n();i(0,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:t,name:"payload.0",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.productModel"),children:u(oe,{control:t,name:"payload.1",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:qbt.map(r=>u(J,{value:r.value,children:r.label},r.label))})})})]})]})},Jbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[80,80,80]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setParam")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.speed")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.acceleration")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.force")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},Ybt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.gotoTarget")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")}`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},Xbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:22,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Kbt,{onPreview:s},"initialize");case 1:return u(Jbt,{onPreview:s},"set-parameter");case 2:return u(Ybt,{onPreview:s},"goto-target")}};return u("div",{className:P("JrtJEGH",i),children:o()})},Qbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,1]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},Zbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},evt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0,0,0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},tvt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:23,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Qbt,{onPreview:s},"initialize");case 1:return u(Zbt,{onPreview:s},"set-goal-position");case 2:return u(evt,{onPreview:s},"set-3-params")}};return u("div",{className:P("Aidin2FG",i),children:o()})},{useMemo:Cfe,useState:nvt}=await F("react"),Sfe=-1,ivt={0:d_t,1:m_t,2:b_t,3:y_t,4:x_t,5:L_t,6:P_t,7:F_t,8:H_t,9:j_t,10:K_t,11:Z_t,12:sbt,13:abt,14:dbt,15:mbt,16:ybt,17:kbt,18:Ebt,19:Obt,20:Wbt,21:Gbt,22:Xbt,23:tvt},svt=({className:i,robotModel:e})=>{const{t}=q(),{data:n,isLoading:s}=pRe({robot_model:e}),o=n?.attachOption??Sfe,[r,a]=nvt({gripperType:o,functionType:0}),l=r.gripperType===o?r.functionType:0,c=Cfe(()=>o===-1?"settings.box.option.notMounted":UI[o]?.label,[o]),d=Cfe(()=>({functionType:l,robotModel:e}),[l,e]),h=Jse[o]??[],g=ivt[o],m=o!==Sfe&&!!g,f=()=>s?u("div",{className:"bg-raised flex h-30 w-full items-center justify-center gap-3 rounded-md p-2.5",children:u(aw,{size:"1rem",className:"text-fg-subtle shrink-0"})}):m?x(oMe.Provider,{value:d,children:[u(me,{label:t("program.field.label.functionList"),children:u(ae,{className:"w-full",size:"sm",value:l,onChange:p=>a({gripperType:o,functionType:Number(p.target.value)}),children:h.map(p=>u(J,{value:p.value,children:t(p.label)},p.value))})}),u(_o,{}),u(g,{},o)]}):u("div",{className:"bg-raised flex h-30 w-full items-center justify-center gap-3 rounded-md p-2.5",children:u("p",{className:"typo-compact-xs-medium text-fg-subtle",children:t("move.gripper.notMountDesc")})});return u("div",{className:P("GripperControl","h-full",i),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:`${t("move.menu.button.label.gripper")} (${t(c)})`}),f()]})})},{useQuery:ovt}=await F("@tanstack/react-query"),lMe="/{robot_model}/call_config_globpinlist",rvt=async({robot_model:i})=>{const e=lMe.replace("{robot_model}",i);return Dt.get(e)},cMe=(i,e={})=>ovt({queryKey:[lMe,i],queryFn:()=>rvt(i),...e}),{useMutation:avt}=await F("@tanstack/react-query"),lvt="/{robot_model}/save_globpin_parameter",cvt=async i=>{const{robot_model:e,...t}=i,n=lvt.replace("{robot_model}",e),s=await Dt.post(n,t);if(s.return_value)throw Error(`[Error] error Return value: ${s.return_value}`);return s},dvt=()=>{const{alertDialog:i,closeDialog:e}=jn();return avt({mutationFn:async t=>cvt(t),onError:t=>{i({modalId:"setGlobalPinPointParameterError",title:"Error",content:"User Parameter Error: "+(t?.message||t),onConfirm:()=>e("setGlobalPinPointParameterError")})}})},{useCallback:xfe,useEffect:uvt,useMemo:hvt,useState:Nfe}=await F("react"),gvt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{selectedRobot:s}=Fi(e),[o,r]=Nfe(null),{data:a,refetch:l}=cMe({robot_model:e}),{mutateAsync:c,isPending:d}=dvt(),{motionMode:h}=ws(e,S=>({motionMode:S.motionMode})),{mutate:g}=K9(),{mutate:m}=J9(),[f,p]=Nfe(a??iMe),_=hvt(()=>h!==0||s?.connected==="DISCONNECT",[h,s?.connected]),b=(S,C)=>{p(N=>{const k={...N},L=[...N.name];return L[S]=C,k.name=L,k})},v=xfe((S,C,N)=>{const k=C.split(",").map(L=>Number(L.trim()));r(`${S}-${N}`),g({robot_model:e,type:S,target:{tar_values:k,tar_frame:S==="j"?-1:0,tar_unit:0},speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1}})},[g,e]),w=xfe(()=>{r(null),m({robot_model:e,stoptime:.3})},[m,e]),y=async(S,C)=>{await c({robot_model:e,pin_num:S,pin_name:C}),l()};return uvt(()=>{a&&p(a)},[a]),x(Km,{className:P("GlobalPinPointControl","relative h-full w-full px-3 py-2.5"),children:[u("div",{className:"sticky top-0 z-10",children:u(Ag,{subject:t("move.menu.button.label.pinpoint")})}),u(U,{className:"w-full max-w-full gap-3 overflow-hidden",children:f&&f?.name?.map((S,C)=>{const N=S,k=f.pinJ[C].tarValues?.map(D=>D.toFixed(2)).join(", "),L=f.pinL[C].tarValues?.map(D=>D.toFixed(2)).join(", ");return x(U,{className:P("gap-2 self-stretch rounded-md p-2.5",n==="light"?"border-fill-navy-subtle border":"bg-bg-alt-2"),children:[x(H,{className:"w-full gap-1.5",alignItems:"center",children:[u("span",{className:"typo-compact-xs-semibold text-fg-subtle min-w-8 shrink-0",children:t("settings.tool.title.name")}),u(et,{className:"w-0 min-w-0 flex-1",size:"xs2",type:"text",inputMode:"text",value:N,onChange:D=>b(C,D.target.value)})]}),x(U,{className:"typo-compact-2xs-normal text-fg-default w-full gap-0.5",children:[u("span",{children:`J: ${k}`}),u("span",{children:`L: ${L}`})]}),x(H,{className:"w-full gap-1",alignItems:"center",children:[u(Dd,{className:P("w-[33%]"),variant:n==="light"?"outlined":"soft",size:"xs",disabled:_&&o!==`j-${C}`,onButtonDown:()=>v("j",k,C),onButtonUp:w,children:t("program.button.movej")}),u(Dd,{className:P("w-[33%]"),variant:n==="light"?"outlined":"soft",size:"xs",disabled:_&&o!==`l-${C}`,onButtonDown:()=>v("l",L,C),onButtonUp:w,children:t("program.button.movel")}),u(se,{className:"w-[33%]",variant:"brand",size:"xs",disabled:_,loading:d,onClick:()=>y(C,N),children:t("settings.button.save")})]})]},`pp-${C}`)})})]})},{useCallback:RD,useRef:mvt,useState:fvt}=await F("react"),pvt=500,_vt=800,bvt=(i=[],e)=>{const[t,n]=fvt(()=>({stack:e?.historyStack??[i],index:e?.historyIndex??0})),s=!!e?.onCommit,o=s?e?.items??t.stack[t.index]:t.stack[t.index],r=s?(e?.historyIndex??0)>0:t.index>0,a=s?(e?.historyIndex??0)<(e?.historyStack?.length??1)-1:t.index<t.stack.length-1,l=mvt(null),c=RD((f,p)=>{const _=Date.now(),b=l.current,v=!!p&&!!b&&b.key===p&&_-b.time<_vt;l.current=p?{key:p,time:_}:null;const w=e?.historyStack??t.stack,y=e?.historyIndex??t.index,S=w.slice(0,y+1);let C,N;v&&S.length>1?(S[S.length-1]=f,C=S,N=S.length-1):(S.push(f),S.length>pvt&&S.shift(),C=S,N=S.length-1),e?.onCommit?e.onCommit(f,C,N):n({stack:C,index:N})},[e,t]),d=RD(f=>{const p=e?.historyStack??t.stack,_=e?.historyIndex??t.index,b=p.slice();b[_]=f,l.current=null,e?.onCommit?e.onCommit(f,b,_):n({stack:b,index:_})},[e,t]),h=RD(f=>{l.current=null,e?.onReset?e.onReset(f):n({stack:[f],index:0})},[e]),g=RD(()=>{l.current=null;const f=e?.historyIndex??t.index;if(f<=0)return;const p=f-1,b=(e?.historyStack??t.stack)[p];e?.onUndo?e.onUndo(b,p):n(v=>({...v,index:p}))},[e,t]),m=RD(()=>{l.current=null;const f=e?.historyIndex??t.index,p=e?.historyStack??t.stack;if(f>=p.length-1)return;const _=f+1,b=p[_];e?.onRedo?e.onRedo(b,_):n(v=>({...v,index:_}))},[e,t]);return{items:o,canUndo:r,canRedo:a,commit:c,replaceCurrent:d,resetHistory:h,undo:g,redo:m}},{useCallback:E8,useEffect:P8,useMemo:Ife,useRef:vvt,useState:eF}=await F("react"),yvt=3e5,wvt=({items:i,tabKind:e,mountJointName:t,hiddenItemIds:n})=>{const[s,o]=eF(()=>new Set),[r,a]=eF(()=>new Set),[l,c]=eF(null),[d,h]=eF(null),g=vvt(new Map),m=E8(v=>{o(w=>w.has(v)?w:new Set(w).add(v)),a(w=>{if(!w.has(v))return w;const y=new Set(w);return y.delete(v),y}),h({assetId:`${e}:${v}`,nonce:Date.now()})},[e]),f=E8(v=>{a(w=>w.has(v)?w:new Set(w).add(v))},[]),p=E8(v=>{a(w=>w.has(v)?w:new Set(w).add(v)),c({itemId:v,nonce:Date.now()})},[]);P8(()=>{o(v=>ffe(v,i)),a(v=>ffe(v,i))},[i]);const _=Ife(()=>ppt(i,s,r),[i,s,r]);return P8(()=>{const v=g.current;for(const w of _)v.has(w)||v.set(w,setTimeout(()=>{v.delete(w),p(w)},yvt));for(const[w,y]of v)_.has(w)||(clearTimeout(y),v.delete(w))},[_,p]),P8(()=>{const v=g.current;return()=>{for(const w of v.values())clearTimeout(w);v.clear()}},[]),{assets:Ife(()=>fpt(i,e,t,m,f,n),[i,e,t,m,f,n]),loadingItemIds:_,loadFailedItemIds:r,loadTimeoutEvent:l,assetLoadedEvent:d}},{useMutation:Cvt}=await F("@tanstack/react-query"),Svt=1,xvt={x:0,y:0,z:0,rx:0,ry:0,rz:0},Nvt=i=>{const e=i??Svt;return typeof e=="number"?{x:e,y:e,z:e}:e},NJ=i=>Ut.post("/model/",{robotModel:i.robotModel,detailRobotModel:i.detailRobotModel,modelType:i.modelType,scale:Nvt(i.scale),pose:i.pose??xvt,name:i.name??void 0,workspace:i.workspace,attachment:i.attachment??void 0,...i.fileId!==void 0?{fileId:i.fileId}:{shapeType:i.shapeType}}),Ivt=()=>Cvt({mutationFn:NJ}),{useMutation:eVn}=await F("@tanstack/react-query"),doe=({modelId:i,...e})=>Ut.patch(`/model/${i}`,e),{useMutation:kvt}=await F("@tanstack/react-query"),dMe=i=>Ut.delete(`/model/${i}`),uoe=()=>kvt({mutationFn:dMe}),{useQuery:Lvt}=await F("@tanstack/react-query"),uMe="/model/robot",i1=(i,e)=>[uMe,i,e],Dvt=async(i,e)=>{try{return(await Ut.get(`/model/robot/${i}/detail/${e}`)).models}catch(t){if(t?.response?.status===404)return[];throw t}},r6=(i,e,t={})=>Lvt({queryKey:i1(i,e),queryFn:()=>Dvt(i,e),...t,enabled:!!(i&&e)&&(t.enabled??!0)}),{useMutation:Tvt,useQueryClient:Evt}=await F("@tanstack/react-query"),kfe=i=>{if(typeof i!="object"||i===null)return;const{response:e,status:t}=i;if(typeof e?.status=="number")return e.status;if(typeof t=="number")return t},hMe=i=>({x:i.position.x/Pn,y:i.position.y/Pn,z:i.position.z/Pn,rx:i.rotation.rx,ry:i.rotation.ry,rz:i.rotation.rz}),Lfe=(i,{robotModel:e,detailRobotModel:t,modelType:n,attachment:s,workspaceName:o})=>({robotModel:e,detailRobotModel:t,modelType:n,scale:i.kind==="shape"?i.scale:uR,name:i.name,workspace:{name:o},pose:hMe(i),attachment:s,...i.kind==="shape"?{shapeType:i.shapeType}:{fileId:i.fileId}}),Pvt=async({changes:i,robotModel:e,detailRobotModel:t,modelType:n,attachment:s,workspaceName:o})=>{const r=[];for(const a of i)try{if(a.kind==="create"){const l=a.item,c=await NJ(Lfe(l,{robotModel:e,detailRobotModel:t,modelType:n,attachment:s,workspaceName:o}));r.push({id:l.id,status:"created",modelId:c.modelId})}else if(a.kind==="update")try{await doe({modelId:a.modelId,name:a.item.name,workspace:{name:o},pose:hMe(a.item),...a.item.kind==="shape"&&{scale:a.item.scale}}),r.push({id:a.item.id,status:"updated"})}catch(l){if(kfe(l)===404){const c=a.item,d=await NJ(Lfe(c,{robotModel:e,detailRobotModel:t,modelType:n,attachment:s,workspaceName:o}));r.push({id:c.id,status:"created",modelId:d.modelId})}else throw l}else{try{await dMe(a.modelId)}catch(l){if(kfe(l)!==404)throw l}r.push({id:a.modelId,status:"deleted"})}}catch(l){const c=a.kind==="delete"?a.modelId:a.item.id;r.push({id:c,status:"failed",error:l})}return r},Rvt=({changes:i,results:e,libraryModels:t,modelType:n})=>{const s=new Set(e.filter(a=>a.status==="created"||a.status==="updated").map(a=>a.id)),o=new Map;for(const a of i){if(a.kind==="delete")continue;const{item:l}=a;l.kind!=="custom"||!s.has(l.id)||o.set(l.fileId,l.rotation)}const r=[];for(const[a,l]of o){const c=t.find(f=>!f.workspace&&f.shapeType===null&&f.fileId===a&&f.modelType===n);if(!c)continue;const{rx:d,ry:h,rz:g}=l;c.pose.rx===d&&c.pose.ry===h&&c.pose.rz===g||r.push({modelId:c.modelId,pose:{...c.pose,rx:d,ry:h,rz:g}})}return r},Mvt=()=>{const i=Evt();return Tvt({mutationFn:async e=>{const t=await Pvt(e),n=i.getQueryData(i1(e.robotModel,e.detailRobotModel))??[],s=Rvt({changes:e.changes,results:t,libraryModels:n,modelType:e.modelType});return await Promise.allSettled(s.map(o=>doe({modelId:o.modelId,pose:o.pose}))),t},onSuccess:(e,t)=>{i.invalidateQueries({queryKey:i1(t.robotModel,t.detailRobotModel)})}})},{useMutation:Avt,useQueryClient:Ovt}=await F("@tanstack/react-query"),Fvt=async i=>i.length===0?null:Ut.patch("/model/loaded/change",{models:i}),Bvt=()=>{const{t:i}=q(),e=Ovt();return Avt({mutationFn:Fvt,onSuccess:()=>{e.invalidateQueries({queryKey:[uMe]})},onError:()=>{rt.openToast({type:"basic",variant:"warning",content:i("move.workspace.toast.loadedSyncFailed"),position:"top-right"})}})},Vvt=5e3,Dfe="unknown",IJ=new Map,zvt=(i,e)=>(IJ.set(i,e),()=>{IJ.delete(i)}),Wvt=async(i=Vvt)=>({failed:(await Promise.all(Array.from(IJ.entries()).map(async([t,n])=>{let s;try{return await Promise.race([t().then(()=>!0),new Promise(r=>{s=setTimeout(()=>r(!1),i)})])?null:n??Dfe}catch{return n??Dfe}finally{clearTimeout(s)}}))).filter(t=>t!==null)}),{useCallback:Wp,useEffect:cv,useMemo:Tfe,useRef:MD,useState:R8}=await F("react"),Hvt=1e3,$vt=({robotModel:i,detailRobotModel:e,modelType:t,attachment:n,items:s,commit:o,replaceCurrent:r,resetHistory:a,setSelectedItemId:l,setHiddenItemIds:c,setStage:d,isActive:h=!0,isStoreHydrated:g=!1,lastChangeSourceRef:m,workspaceName:f,lastSyncedWorkspaceName:p,lastSyncedItems:_,onWorkspaceNameChange:b,onLastSyncedChange:v})=>{const{t:w}=q(),y=MD(new Map(_.map(Ie=>[Ie.id,Ie])));cv(()=>{y.current=new Map(_.map(Ie=>[Ie.id,Ie]))},[_]);const[S,C]=R8(0),[N,k]=R8(!1),[L,D]=R8(()=>new Set),T=Wp(Ie=>{const Te=typeof Ie=="function"?Ie(f):Ie;b(Te)},[b,f]),{mutateAsync:E,isPending:R}=Mvt(),{mutate:A}=Bvt(),M=Wp(Ie=>{T(Ie)},[T]),O=Wp(()=>{o(Array.from(y.current.values())),T(p),l(null)},[o,p,l,T]),B=Wp((Ie=[])=>{A(YO(Ie,[])),a([]),T(null),l(null),c(new Set),y.current=new Map,v(null,[]),C(Te=>Te+1),d("empty")},[a,A,l,c,d,T,v]),z=Wp(Ie=>{a([]),T(Ie),l(null),c(new Set),y.current=new Map,v(null,[]),C(Te=>Te+1),d("build")},[a,l,c,d,T,v]),Y=Wp((Ie,Te,lt=[])=>{const it=Ie.map(Ct=>pfe(Ct));a(it),A(YO(lt,it.map(Ct=>Ct.modelId).filter(Ct=>Ct!==void 0))),T(Te),l(null),c(new Set),y.current=new Map(it.map(Ct=>[Ct.id,Ct])),v(Te,it),C(Ct=>Ct+1),d("build")},[a,A,l,c,d,T,v]),$=Wp(async()=>{if(!f)throw new Error("Cannot save a workspace without a name");const Ie=f,Te=vpt(s,y.current,f,p),lt=await E({changes:Te,robotModel:i,detailRobotModel:e,modelType:t,attachment:n,workspaceName:Ie}),it=new Set;let Ct=s;for(const Mt of lt){if(Mt.status==="failed"){it.add(Mt.id);continue}Mt.status==="created"&&(Ct=Ct.map(Ht=>Ht.id===Mt.id?{...Ht,modelId:Mt.modelId}:Ht))}const ft=new Set(lt.filter(Mt=>Mt.status==="deleted").map(Mt=>Mt.id)),Xt=new Map(y.current);for(const[Mt,Ht]of y.current)Ht.modelId&&ft.has(Ht.modelId)&&Xt.delete(Mt);for(const Mt of lt){if(Mt.status==="failed"||Mt.status==="deleted")continue;const Ht=Ct.find(Mn=>Mn.id===Mt.id);Ht&&Xt.set(Ht.id,Ht)}if(y.current=Xt,v(Ie,Array.from(Xt.values())),D(it),T(Ie),Ct!==s&&r(Ct),C(Mt=>Mt+1),A(YO([],Ct.map(Mt=>Mt.modelId).filter(Mt=>Mt!==void 0))),it.size>0)throw new Error(`${it.size} item(s) failed to save`)},[s,f,p,i,e,t,n,E,r,A,v,T]),Z=Wp(async(Ie,Te=[])=>{const lt=s.map(Mt=>({kind:"create",item:Mt})),it=await E({changes:lt,robotModel:i,detailRobotModel:e,modelType:t,attachment:n,workspaceName:Ie}),Ct=new Set;let ft=s;for(const Mt of it){if(Mt.status==="failed"){Ct.add(Mt.id);continue}Mt.status==="created"&&(ft=ft.map(Ht=>Ht.id===Mt.id?{...Ht,modelId:Mt.modelId}:Ht))}const Xt=new Map;for(const Mt of it){if(Mt.status==="failed"||Mt.status==="deleted")continue;const Ht=ft.find(Mn=>Mn.id===Mt.id);Ht&&Xt.set(Ht.id,Ht)}if(y.current=Xt,v(Ie,Array.from(Xt.values())),D(Ct),T(Ie),ft!==s&&r(ft),C(Mt=>Mt+1),A(YO(Te,ft.map(Mt=>Mt.modelId).filter(Mt=>Mt!==void 0))),Ct.size>0)throw new Error(`${Ct.size} item(s) failed to save`)},[s,i,e,t,n,E,r,A,v,T]),K=Tfe(()=>ypt(s,y.current,f,p),[s,S,f,p]),V=MD(null),fe=Wp((Ie,Te)=>{V.current=Te,console.error("[useManiWorkspaceSync] Auto-save failed:",Ie),rt.openToast({type:"basic",variant:"danger",content:w("move.workspace.toast.saveFailed"),position:"top-right"})},[w]),{data:Q}=r6(i,e),re=Tfe(()=>!Q||!p?null:Q.filter(Ie=>Ie.modelType===t&&(n?Ie.attachment?.parentJointName===n.parentJointName:!0)&&Ie.workspace?.name===p),[Q,p,t,n]),ve=MD(!1);cv(()=>{if(!g||ve.current)return;if(!f||!K){ve.current=!0,k(!1);return}if(!Q){k(!0);return}if(ve.current=!0,k(!1),!p){rt.openToast({type:"basic",variant:"success",content:w("move.workspace.toast.recovered"),position:"top-right"});return}const Ie=re??[];if(bpt(_,Ie.map(pfe))){rt.openToast({type:"basic",variant:"success",content:w("move.workspace.toast.recovered"),position:"top-right"});return}const Te=s.map(lt=>lt.modelId).filter(lt=>lt!==void 0);if(Ie.length===0){B(Te),rt.openToast({type:"basic",variant:"warning",content:w("move.workspace.toast.recoveryRemoved"),position:"top-right"});return}Y(Ie,p,Te),rt.openToast({type:"basic",variant:"warning",content:w("move.workspace.toast.recoveryDiscarded"),position:"top-right"})},[g,f,K,Q,p,_,re,s,B,Y,w]),cv(()=>{if(N||!K||R||m?.current==="navigation"||V.current===s)return;const Ie=setTimeout(()=>{$().catch(Te=>fe(Te,s))},Hvt);return()=>clearTimeout(Ie)},[N,K,s,f,R,$,m,fe]);const _e=MD(h);cv(()=>{const Ie=_e.current;_e.current=h,!(!Ie||h)&&(N||!K||R||$().catch(Te=>fe(Te,s)))},[h,N,K,R,s,$,fe]),cv(()=>{const Ie=()=>{document.visibilityState==="hidden"&&(N||!K||R||$().catch(Te=>fe(Te,s)))};return document.addEventListener("visibilitychange",Ie),()=>document.removeEventListener("visibilitychange",Ie)},[N,K,R,s,$,fe]);const Le=MD(R);return cv(()=>{Le.current=R},[R]),cv(()=>{const Ie=Te=>{Le.current&&(Te.preventDefault(),Te.returnValue="")};return window.addEventListener("beforeunload",Ie),()=>window.removeEventListener("beforeunload",Ie)},[]),cv(()=>zvt(async()=>{if(!N&&!(!K||R))try{await $()}catch(Ie){throw V.current=s,Ie}},f??void 0),[N,K,R,s,$,f]),{workspaceName:f,isRecoveryPending:N,renameWorkspace:M,hasUnsavedChanges:K,failedItemIds:L,isSaving:R,save:$,saveAs:Z,resetToSaved:O,closeWorkspace:B,createNew:z,loadFromModels:Y}},Uvt=i=>{let e=!1;const t=i?.debounceMs??0;let n=null,s=null,o=null;const r=(d,h)=>{try{window.localStorage.setItem(d,h)}catch(g){i?.onError?.(g)}},a=()=>{if(o&&(clearTimeout(o),o=null),n!==null&&s!==null){const d=n,h=s;n=null,s=null,r(d,h)}};return typeof window<"u"&&window.addEventListener("beforeunload",()=>{a()}),{storage:{getItem:d=>n===d&&s!==null?s:window.localStorage.getItem(d),setItem:(d,h)=>{if(e){if(t<=0){r(d,h);return}n=d,s=h,o&&clearTimeout(o),o=setTimeout(()=>{o=null,a()},t)}},removeItem:d=>{o&&(clearTimeout(o),o=null),n===d&&(n=null,s=null),window.localStorage.removeItem(d)}},isHydrated:()=>e,flush:a,createRehydrateStorageHandler:()=>(e=!1,(d,h)=>{if(h){i?.name&&console.warn(`[${i.name}] rehydrate error`,h),i?.onError?.(h);return}e=!0,i?.name,i?.onHydrated?.()})}},{useEffect:jvt,useState:Gvt}=await F("react"),UB={stage:"empty",workspaceName:null,lastSyncedWorkspaceName:null,items:[],lastSyncedItems:[],historyStack:[[]],historyIndex:0,selectedItemId:null,hiddenItemIds:[]},qvt=i=>({stage:i.stage,workspaceName:i.workspaceName,lastSyncedWorkspaceName:i.lastSyncedWorkspaceName,items:i.items,lastSyncedItems:i.lastSyncedItems,hiddenItemIds:i.hiddenItemIds}),Kvt=i=>({...UB,...i,historyStack:[i.items],historyIndex:0,selectedItemId:null}),Efe=Uvt({name:"workspace-store",debounceMs:100}),Jvt=gse()(dEe(fse((i,e)=>({tabStates:{},getTabState:t=>e().tabStates[t]??{...UB},setTabState:(t,n)=>{i(s=>{const o=s.tabStates[t]??{...UB},r=typeof n=="function"?n(o):n;return{tabStates:{...s.tabStates,[t]:{...o,...r}}}})},resetTabState:t=>{i(n=>{const s={...n.tabStates};return delete s[t],{tabStates:s}})},clearAllTabs:()=>{i({tabStates:{}})}}),{name:"workspace-store",storage:mse(()=>Efe.storage),partialize:i=>({tabStates:Object.fromEntries(Object.entries(i.tabStates).map(([e,t])=>[e,qvt(t)]))}),merge:(i,e)=>{const t=i?.tabStates??{},n={};for(const[s,o]of Object.entries(t))lpt(o)&&(n[s]=Kvt(o));return{...e,tabStates:{...e.tabStates,...n}}},onRehydrateStorage:Efe.createRehydrateStorageHandler}),{name:"workspace-store",store:"workspace-store",enabled:!1})),qN=Jvt,Yvt=()=>{const[i,e]=Gvt(()=>qN.persist.hasHydrated());return jvt(()=>(e(qN.persist.hasHydrated()),qN.persist.onFinishHydration(()=>e(!0))),[]),i},{useCallback:_a,useMemo:Pfe,useRef:Xvt}=await F("react"),Qvt=({robotModel:i,detailRobotModel:e,modelType:t,mountJointName:n,isActive:s=!0})=>{const o=hpt(t,n),r=`${i}:${o}`,a=qN(Re=>Re.tabStates[r]??UB),l=qN(Re=>Re.setTabState),c=qN(Re=>Re.resetTabState),d=Yvt(),h=a.stage,g=_a(Re=>{l(r,We=>({stage:typeof Re=="function"?Re(We.stage):Re}))},[l,r]),m=a.selectedItemId,f=_a(Re=>{l(r,We=>({selectedItemId:typeof Re=="function"?Re(We.selectedItemId):Re}))},[l,r]),p=Pfe(()=>new Set(a.hiddenItemIds),[a.hiddenItemIds]),_=_a(Re=>{l(r,We=>{const ct=new Set(We.hiddenItemIds),gn=typeof Re=="function"?Re(ct):Re;return{hiddenItemIds:Array.from(gn)}})},[l,r]),b=Pfe(()=>t==="tool"&&n?{parentJointName:n}:null,[t,n]),v=Xvt("edit"),w=_a((Re,We,ct)=>{v.current="edit",l(r,{items:Re,historyStack:We,historyIndex:ct})},[l,r]),y=_a(Re=>{l(r,{items:Re,historyStack:[Re],historyIndex:0})},[l,r]),S=_a((Re,We)=>{v.current="navigation",l(r,{items:Re,historyIndex:We})},[l,r]),C=_a((Re,We)=>{v.current="navigation",l(r,{items:Re,historyIndex:We})},[l,r]),{items:N,canUndo:k,canRedo:L,commit:D,replaceCurrent:T,resetHistory:E,undo:R,redo:A}=bvt(a.items,{items:a.items,historyStack:a.historyStack,historyIndex:a.historyIndex,onCommit:w,onReset:y,onUndo:S,onRedo:C}),M=N.filter(Re=>Re.kind==="shape").length,O=gpt(t)&&M>=spt,B=N.some(Re=>Re.kind==="custom"),{assets:z,loadingItemIds:Y,loadFailedItemIds:$,loadTimeoutEvent:Z,assetLoadedEvent:K}=wvt({items:N,tabKind:o,mountJointName:n,hiddenItemIds:p}),V=_a(Re=>{l(r,{workspaceName:Re})},[l,r]),fe=_a((Re,We)=>{l(r,{lastSyncedWorkspaceName:Re,lastSyncedItems:We})},[l,r]),{workspaceName:Q,renameWorkspace:re,hasUnsavedChanges:ve,failedItemIds:_e,isSaving:Le,save:Ie,saveAs:Te,resetToSaved:lt,closeWorkspace:it,createNew:Ct,loadFromModels:ft}=$vt({robotModel:i,detailRobotModel:e,modelType:t,attachment:b,items:N,commit:D,replaceCurrent:T,resetHistory:E,setSelectedItemId:f,setHiddenItemIds:_,setStage:g,isActive:s,isStoreHydrated:d,lastChangeSourceRef:v,workspaceName:a.workspaceName,lastSyncedWorkspaceName:a.lastSyncedWorkspaceName,lastSyncedItems:a.lastSyncedItems,onWorkspaceNameChange:V,onLastSyncedChange:fe}),Xt=_a(Re=>{it(Re),c(r)},[it,c,r]),Mt=_a((Re,We)=>{if(O)return;const ct=roe.find(Xn=>Xn.type===Re);if(!ct)return;const gn=N.filter(Xn=>Xn.kind==="shape"&&Xn.shapeType===Re).length+1,Ln=We??mpt(N,t==="base"?cpt:{x:0,y:0}),yi=t==="base"?ct.dimensions.z/2:0,oi={id:loe(),name:`${Re}_${gn}`,kind:"shape",shapeType:Re,position:{x:Ln.x,y:Ln.y,z:We?.z??yi},rotation:{...aoe},scale:{...uR}};return D([...N,oi]),f(oi.id),oi.id},[N,O,t,D,f]),Ht=_a(Re=>{const We=wpt(Re);return D([...N.filter(ct=>ct.kind!=="custom"),We]),f(We.id),We.id},[N,D,f]),Mn=_a(Re=>{f(Re)},[f]),Cs=_a(Re=>{const We=!p.has(Re);_(ct=>{const gn=new Set(ct);return We?gn.add(Re):gn.delete(Re),gn}),We&&f(ct=>ct===Re?null:ct)},[p,_,f]),or=_a((Re,We)=>{D(N.map(ct=>ct.id===Re?{...ct,name:We}:ct),`rename:${Re}`)},[N,D]),ge=_a((Re,We,ct)=>{D(N.map(gn=>gn.id===Re?YRe(gn,We):gn),ct)},[N,D]),Ue=_a((Re,We,ct)=>{D(N.map(gn=>gn.id===Re&&gn.kind==="custom"?{...gn,fileName:We,name:ct}:gn))},[N,D]),Ee=_a(Re=>{D(N.filter(We=>We.id!==Re)),f(We=>We===Re?null:We)},[N,D,f]),Ne=_a(Re=>{const We=new Set(Re);D(N.filter(ct=>!We.has(ct.id))),f(ct=>ct!==null&&We.has(ct)?null:ct)},[N,D,f]),le=_a(Re=>{const We=new Set(Re);_(ct=>{const gn=new Set(ct);for(const $n of We)gn.add($n);return gn}),f(ct=>ct!==null&&We.has(ct)?null:ct)},[_,f]),Pe=_a(()=>{D([]),f(null),_(new Set)},[D,_,f]);return{stage:h,createNew:Ct,loadFromModels:ft,closeWorkspace:Xt,workspaceName:Q,renameWorkspace:re,hasUnsavedChanges:ve,isSaving:Le,save:Ie,saveAs:Te,canUndo:k,canRedo:L,undo:R,redo:A,resetToSaved:lt,items:N,selectedItemId:m,selectItem:Mn,loadingItemIds:Y,loadFailedItemIds:$,failedItemIds:_e,hiddenItemIds:p,toggleItemVisibility:Cs,addShape:Mt,addCustomFile:Ht,hasCustomFile:B,isLimitReached:O,renameItem:or,removeItem:Ee,removeItems:Ne,hideItems:le,clearItems:Pe,updateItemTransform:ge,applyCustomFileRename:Ue,assets:z,loadTimeoutEvent:Z,assetLoadedEvent:K}},{useRef:Zvt}=await F("react"),{useMutation:eyt}=await F("@tanstack/react-query"),Rfe=i=>{if(!(i instanceof Error))return"unknown";const e=i;return i.name==="AbortError"||i.name==="CanceledError"||i.message.includes("aborted")||e.code==="ERR_CANCELED"?"abort":"unknown"},tyt=i=>({abort:i("move.modal.workspace.file.upload.abort"),unknown:i("move.modal.workspace.file.upload.unknown")}),nyt=async({file:i,fileName:e},t)=>{const n=new FormData;return n.append("file",i),e&&n.append("fileName",e),Ut.post("/file/upload/model",n,{headers:{"Content-Type":"multipart/form-data"},signal:t})},iyt=()=>{const{t:i}=q(),e=Zvt(null),t=tyt(i);return{...eyt({mutationFn:async s=>{e.current=new AbortController;try{return await nyt(s,e.current.signal)}catch(o){if(Rfe(o)==="abort")return null;throw o}},onError:s=>{const o=t[Rfe(s)];rt.openToast({type:"basic",variant:"warning",content:o,position:"top-right"})}}),abort:()=>{e.current?.abort(),rt.openToast({type:"basic",variant:"warning",content:t.abort,position:"top-right"})}}},{useMutation:tVn}=await F("@tanstack/react-query"),syt=({fileId:i,...e})=>Ut.patch(`/file/${i}`,e),{useMutation:oyt,useQueryClient:ryt}=await F("@tanstack/react-query"),ayt=async i=>{if(!i.fileId)throw new Error("renameAssetModel requires fileId to rename the file.");const e=await syt({fileId:i.fileId,fileName:i.fileName});try{await doe({modelId:i.modelId,name:i.fileName})}catch(t){console.warn(`[useRenameAssetModel] failed to sync model name after file rename: modelId=${i.modelId}`,t)}return e},lyt=()=>{const{t:i}=q(),e=ryt();return oyt({mutationFn:ayt,onSuccess:(t,n)=>{const s=i1(n.robotModel,n.detailRobotModel);e.setQueryData(s,o=>o?o.map(r=>r.modelId===n.modelId?{...r,fileInfo:r.fileInfo?{...r.fileInfo,fileName:n.fileName}:r.fileInfo}:r):[]),rt.openToast({type:"basic",variant:"success",content:i("move.workspace.toast.renameSuccess"),position:"top-right"})},onError:()=>{rt.openToast({type:"basic",variant:"warning",content:i("move.workspace.toast.renameFailed"),position:"top-right"})}})},{useEffect:Mfe,useRef:cyt}=await F("react"),dyt=({selectedItemId:i,gizmoSelectedAssetIds:e,selectionMode:t,tabKind:n,onRequestSceneAssetSelect:s,selectItem:o})=>{const r=cyt(i);Mfe(()=>{t||i!==r.current&&(r.current=i,s?.(i?`${n}:${i}`:null))},[i,n,s,t]),Mfe(()=>{if(t)return;const a=e[0]??null;if(a===null){r.current!==null&&(r.current=null,o(null));return}if(!a.startsWith(`${n}:`))return;const l=a.slice(n.length+1);l!==r.current&&(r.current=l,o(l))},[e,n,o,t])},Afe=[".stl",".stp",".step",".obj",".glb",".gltf",".dae"],uyt=50*1024*1024,tF=10,hyt=/[\\/:*?"<>|#%]/,c4=hyt,jB=i=>i.trim(),gMe=(i,e,t)=>{const n=jB(e);return n?i.some(s=>s.modelId!==t&&jB(s.fileInfo.fileName)===n):!1},gyt=i=>i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`,myt=i=>{let e=0;return i.traverse(t=>{if(t instanceof os){const n=t.geometry;n.index?e+=n.index.count/3:n.attributes.position&&(e+=n.attributes.position.count/3)}}),Math.round(e)},fyt=i=>i>=1e6?`${(i/1e6).toFixed(2)}M`:i>=1e3?`${(i/1e3).toFixed(1)}K`:`${i}`,pyt=(i,e)=>{const t=new Set(i);return t.has(e)?t.delete(e):t.add(e),t},mMe=({items:i,getId:e,targetId:t,selectedIds:n,anchorId:s,selectionMode:o,isRangeSelect:r,isToggleSelect:a=!1})=>{if(r&&s){const l=i.findIndex(d=>e(d)===s),c=i.findIndex(d=>e(d)===t);if(l!==-1&&c!==-1){const d=Math.min(l,c),h=Math.max(l,c);return{selectedIds:new Set(i.slice(d,h+1).map(e)),anchorId:s}}}return a||o?{selectedIds:pyt(n,t),anchorId:t}:{selectedIds:new Set([t]),anchorId:t}},{useEffect:_yt,useMemo:Ofe,useRef:byt,useState:M8}=await F("react"),fMe=({items:i,getId:e,getSearchText:t,open:n})=>{const[s,o]=M8(""),[r,a]=M8(()=>new Set),[l,c]=M8(!1),d=byt(null);_yt(()=>{n&&(o(""),a(new Set),c(!1),d.current=null)},[n]);const h=Ofe(()=>{const w=s.trim().toLowerCase();return w?i.filter(y=>t(y).toLowerCase().includes(w)):i},[i,s,t]),g=()=>{c(w=>!w),a(new Set),d.current=null},m=()=>{a(new Set),d.current=null},f=(w,y)=>{a(S=>{const C=mMe({items:h,getId:e,targetId:e(w),selectedIds:S,anchorId:d.current,selectionMode:l,isRangeSelect:y.shiftKey,isToggleSelect:y.ctrlKey||y.metaKey});return d.current=C.anchorId,C.selectedIds})},p=Ofe(()=>h.filter(w=>r.has(e(w))),[h,r,e]),_=r.size===1?p[0]??null:null,b=l||r.size>1;return{items:h,searchQuery:s,setSearchQuery:o,selectionMode:l,selectedIds:r,setSelectedIds:a,selectedItems:p,soleSelected:_,isMultiSelectActive:b,toggleSelectionMode:g,exitMultiSelect:l?g:m,clearSelection:m,onItemClick:f}},pMe=({open:i,onOpenChange:e,title:t,className:n,children:s,footerHint:o,isMultiSelectActive:r,selectedCount:a,isBusy:l=!1,deleteSelectedLabel:c,confirmDisabled:d,onDeleteSelected:h,onExitMultiSelect:g,onCancel:m,onConfirm:f})=>{const{t:p}=q();return u(td,{open:i,onOpenChange:e,header:{title:t},className:P("flex max-h-140! max-w-none! flex-col gap-0 border-none p-0",n),footer:x(H,{className:"h-8 w-full gap-1",alignItems:"center",justifyContent:"space-between",children:[x(H,{alignItems:"center",className:"gap-1",children:[u(LLe,{className:"text-fg-subtler size-3.5 shrink-0"}),u("span",{className:"typo-compact-2xs-normal text-fg-subtle",children:o})]}),x(H,{alignItems:"center",className:"gap-1",children:[r?x(rn,{children:[u(se,{variant:"danger",disabled:a===0||l,onClick:h,children:c}),u(se,{variant:"outlined",onClick:g,children:p("move.modal.workspace.button.selectExit")})]}):u(se,{variant:"outlined",onClick:m,children:p("common.button.cancel")}),u(se,{variant:"brand",disabled:d,onClick:f,children:p("move.modal.workspace.button.confirm")})]})]}),children:s})},_Me=({searchQuery:i,onSearchQueryChange:e,searchPlaceholder:t,selectionMode:n,onToggleSelectionMode:s,primaryActionLabel:o,onPrimaryAction:r,isUploading:a=!1,onCancelUpload:l})=>{const{t:c}=q();return x(H,{className:"items-center gap-3",children:[u(et,{className:"h-8 flex-1",type:"search",placeholder:t??c("move.modal.workspace.file.search.placeholder"),value:i,onChange:d=>e(d.target.value)}),a?x(H,{alignItems:"center",className:"gap-2",children:[u(aw,{size:"1rem",className:"text-fg-warning"}),u("span",{className:"typo-compact-xs-semibold text-fg-warning animate-pulse",children:c("move.modal.workspace.file.slotLoading")}),u(se,{variant:"danger",size:"xs",onClick:l,children:c("move.modal.workspace.file.button.cancelUpload")})]}):x(rn,{children:[n!==void 0&&s&&u(se,{variant:n?"outlined":"transparent",size:"xs",onClick:s,children:c(n?"move.modal.workspace.button.selectExit":"move.modal.workspace.button.select")}),o&&r&&u(se,{variant:"transparent",size:"xs",leadingIcon:u(Mm,{}),onClick:r,children:o})]})]})},bMe=({className:i,isLoading:e,isEmpty:t,emptyMessage:n,children:s})=>u(Km,{className:P("h-80 overflow-y-auto",i),children:e?u(U,{alignItems:"center",justifyContent:"center",className:"h-24",children:u(aw,{size:"1.25rem",className:"text-fg-subtle"})}):t?u(U,{alignItems:"center",justifyContent:"center",className:"h-24",children:u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:n})}):u("div",{className:"grid grid-cols-3 gap-2 p-1",children:s})}),vMe=({className:i,isSelected:e,selectionMode:t,isBusy:n=!1,name:s,metaText:o,onClick:r,onDoubleClick:a,onDelete:l,deleteAriaLabel:c})=>x(U,{className:P("bg-fill-inverse-subtle relative z-1 cursor-pointer rounded-md p-2.5 outline-2 outline-transparent",{"outline-border-navy-stronger":e},i),onClick:r,onDoubleClick:a,children:[x(U,{className:"w-full gap-1",children:[x(H,{alignItems:"center",className:"min-w-0 gap-0.5 pr-10",children:[t&&u(ia,{size:"xs",readOnly:!0,value:e,className:"-ml-1 shrink-0"}),u("span",{className:"typo-compact-xs-semibold text-fg-default min-w-0 flex-1 truncate",children:s})]}),u("span",{className:"typo-compact-2xs-normal text-fg-subtle w-full overflow-hidden pr-6 text-ellipsis whitespace-nowrap",children:o})]}),!t&&u("div",{className:P("absolute top-1 right-1 flex items-center gap-0.5",n&&"pointer-events-none opacity-50"),onClick:d=>d.stopPropagation(),children:u(Yt,{variant:"transparent",size:"3xs",icon:u(Nb,{className:"size-3.5"}),onClick:l,"aria-label":c})})]}),{useMemo:Ffe,useState:vyt}=await F("react"),{useQueryClient:yyt}=await F("@tanstack/react-query"),wyt=({className:i,open:e,onOpenChange:t,robotModel:n,detailRobotModel:s,modelType:o,attachment:r,resolve:a,close:l,onGroupsDeleted:c})=>{const{t:d,currentLanguage:h}=q(),{confirmDialog:g}=jn(),m=yyt(),f=i1(n,s),{data:p,isLoading:_}=r6(n,s),{mutateAsync:b}=uoe(),[v,w]=vyt(!1),y=Ffe(()=>(p??[]).filter(L=>L.modelType===o&&(r?L.attachment?.parentJointName===r.parentJointName:!0)),[p,o,r]),S=Ffe(()=>[...opt(y)].sort((D,T)=>new Date(x8(T.models)).getTime()-new Date(x8(D.models)).getTime()),[y]),C=fMe({items:S,getId:L=>L.name,getSearchText:L=>L.name,open:e}),N=async L=>{let D=0;for(const T of L)for(const E of T.models)try{await b(E.modelId)}catch(R){console.error("Failed to delete model:",R),D+=1}await m.invalidateQueries({queryKey:f}),C.setSelectedIds(T=>{const E=new Set(T);return L.forEach(R=>E.delete(R.name)),E}),c?.(L.map(T=>T.name)),D>0&&rt.openToast({type:"basic",variant:"warning",content:d("move.modal.workspace.toast.deletePartialFailure",{failed:D,total:L.reduce((T,E)=>T+E.models.length,0)}),position:"top-right"})},k=async L=>{if(L.length===0)return;const D=L.length>1;if(await g({title:d("move.modal.workspace.confirmDelete.title"),content:D?d("move.modal.workspace.confirmDelete.multiContent",{count:L.length}):d("move.modal.workspace.confirmDelete.content",{name:L[0].name}),buttonText:{yes:d("move.modal.workspace.button.delete"),no:d("common.button.cancel")}})){w(!0);try{await N(L)}finally{w(!1)}}};return u(pMe,{open:e,onOpenChange:t,className:P("w-137.5!",i),title:d("move.modal.workspace.title"),footerHint:d("move.modal.workspace.footer.hint"),isMultiSelectActive:C.isMultiSelectActive,selectedCount:C.selectedIds.size,isBusy:v,deleteSelectedLabel:d("move.modal.workspace.button.deleteSelected",{count:C.selectedIds.size}),confirmDisabled:C.selectedIds.size!==1,onDeleteSelected:()=>void k(C.selectedItems),onExitMultiSelect:C.exitMultiSelect,onCancel:l,onConfirm:()=>{C.soleSelected&&a?.(C.soleSelected)},children:x(U,{className:"gap-3 px-4 py-3",children:[u(_Me,{searchQuery:C.searchQuery,onSearchQueryChange:C.setSearchQuery,searchPlaceholder:d("move.modal.workspace.search.placeholder"),selectionMode:C.selectionMode,onToggleSelectionMode:C.toggleSelectionMode}),u(bMe,{isLoading:_,isEmpty:C.items.length===0,emptyMessage:C.searchQuery.trim()?d("move.modal.workspace.empty.noFound"):d("move.modal.workspace.empty.noAvailable"),children:C.items.map(L=>{const D=L.models.filter(E=>E.shapeType!==null).length,T=L.models.length-D;return u(vMe,{isSelected:C.selectedIds.has(L.name),selectionMode:C.isMultiSelectActive,name:L.name,metaText:`${d("move.modal.workspace.card.itemCount",{shapeCount:D,fileCount:T})} · ${ZLe(x8(L.models),h)}`,onClick:E=>C.onItemClick(L,E),onDoubleClick:()=>{C.isMultiSelectActive||a?.(L)},onDelete:()=>void k([L]),deleteAriaLabel:d("move.modal.workspace.card.deleteLabel")},L.name)})})]})})},{useQueryClient:Cyt}=await F("@tanstack/react-query"),Syt=({filteredModels:i,selectedModelIds:e,setSelectedModelIds:t,modelsQueryKey:n,deleteOne:s,wrapExecution:o=a=>a(),onDeleted:r})=>{const{t:a}=q(),{confirmDialog:l}=jn(),c=Cyt();return async(h,g)=>{h.stopPropagation();const m=e.has(g.modelId)&&e.size>1,f=m?i.filter(_=>e.has(_.modelId)):[g];await l({title:a("move.modal.workspace.file.deleteTitle"),content:m?a("move.modal.workspace.file.confirmDelete.multiContent",{count:f.length}):a("move.modal.workspace.file.confirmDelete.content",{name:g.fileInfo.fileName}),buttonText:{yes:a("move.modal.workspace.button.delete"),no:a("common.button.cancel")}})&&(await o(async()=>{for(const _ of f)await s(_)}),c.setQueryData(n,_=>_?_.filter(b=>!f.some(v=>v.modelId===b.modelId)):[]),t(_=>{const b=new Set(_);return f.forEach(v=>b.delete(v.modelId)),b}),r?.(f))}},xyt="/file/list",Nyt=async i=>(await Ut.get(xyt,{params:{fileName:i,fileType:"3d_model",limit:50}})).files.find(n=>n.fileName.trim()===i.trim())?.fileId??null,{useRef:A8,useState:Bfe,useEffect:Vfe}=await F("react"),Iyt=({model:i,isMultiSelected:e,className:t})=>{const{t:n}=q(),s=A8(null),o=A8(null),r=A8(new Ose),[a,l]=Bfe("idle"),[c,d]=Bfe(null);return Vfe(()=>{const h=s.current;if(!h)return;const g=r.current,m=new zlt(h,{disposeObject:f=>g.disposeObject(f)});return o.current=m,()=>{m.dispose(),o.current=null}},[]),Vfe(()=>{const h=o.current;if(!h)return;if(h.setObject(null),!i){l("idle"),d(null);return}const g=i.fileInfo.fileName;l("loading"),d(null);const m=new AbortController,f=r.current,p=v=>{if(m.signal.aborted){f.disposeObject(v);return}h.setObject(v,i.pose),d(myt(v)),l("success")},_=v=>{v instanceof DOMException&&v.name==="AbortError"||m.signal.aborted||l("error")},b=`${Uie}/common/files/models/${encodeURIComponent(g)}`;return f.loadObject(b,g,m.signal,{detectSurfaceFeatures:!1}).then(p).catch(_),()=>{m.abort()}},[i]),x(U,{className:P("bg-bg-alt-1 relative overflow-hidden",t),children:[u("div",{ref:s,className:"h-full w-full"}),a==="idle"&&u(U,{className:"absolute inset-0 items-center justify-center px-4 text-center",children:u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:n(e?"move.modal.workspace.file.preview.multiSelectUnsupported":"move.modal.workspace.file.preview.selectPrompt")})}),a==="loading"&&u(U,{className:"absolute inset-0 items-center justify-center",children:u(aw,{size:"1.5rem",className:"text-fg-subtle"})}),a==="error"&&u(U,{className:"absolute inset-0 items-center justify-center px-4 text-center",children:u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:n("move.modal.workspace.file.preview.error")})}),i&&a!=="idle"&&x("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-black/70 to-transparent px-4 pt-10 pb-3",children:[u("span",{className:"typo-compact-sm-semibold block truncate text-white",children:i.fileInfo.fileName}),x("span",{className:"typo-compact-2xs-normal mt-0.5 flex items-center gap-1 text-white/70",children:[u("span",{"aria-hidden":"true",children:"△"}),c!==null?x("span",{children:[fyt(c)," ",n("move.modal.workspace.file.preview.triangles")]}):u("span",{"aria-hidden":"true",children:"-"})]})]})]})},{useMemo:O8}=await F("react"),{useQueryClient:kyt}=await F("@tanstack/react-query"),Lyt=({className:i,open:e,onOpenChange:t,robotModel:n,detailRobotModel:s,modelType:o,attachment:r,resolve:a,close:l,uploadAssetFiles:c,isUploading:d,onCancelUpload:h,onModelsDeleted:g})=>{const{t:m,currentLanguage:f}=q(),p=kyt(),{isDragging:_,dropProps:b,inputProps:v,open:w}=eDe({onFiles:z=>B(z),accept:Afe,onRejected:z=>z.forEach(Y=>M(Y,"move.modal.workspace.file.upload.invalidFormat"))}),y=i1(n,s),{data:S,isLoading:C}=r6(n,s),{mutateAsync:N,isPending:k}=uoe(),{mutateAsync:L}=Ivt(),D=O8(()=>S??[],[S]),T=O8(()=>D.filter(z=>z.modelType===o&&!z.workspace&&z.shapeType===null&&(r?z.attachment?.parentJointName===r.parentJointName:!0)).sort((z,Y)=>z.createdAt.localeCompare(Y.createdAt)),[D,o,r]),E=fMe({items:T,getId:z=>z.modelId,getSearchText:z=>z.fileInfo.fileName,open:e}),R=O8(()=>{if(E.selectedIds.size!==1)return null;const[z]=E.selectedIds;return T.find(Y=>Y.modelId===z)??null},[E.selectedIds,T]),A=Syt({filteredModels:E.items,selectedModelIds:E.selectedIds,setSelectedModelIds:E.setSelectedIds,modelsQueryKey:y,deleteOne:async z=>{try{await N(z.modelId)}catch(Y){console.error("Failed to delete model:",Y)}},onDeleted:z=>g?.(z.map(Y=>({modelId:Y.modelId,fileId:Y.fileId})))}),M=(z,Y)=>{rt.openToast({type:"basic",variant:"warning",title:z.name,content:m(Y),position:"top-right"})},O=async(z,Y)=>{try{const $=await L({robotModel:n,detailRobotModel:s,fileId:Y,modelType:o,attachment:r??null});await p.invalidateQueries({queryKey:y}),E.setSelectedIds(new Set([$.modelId]))}catch($){console.error("Create model failed:",$),M(z,"move.modal.workspace.file.upload.createFailed")}},B=async z=>{const Y=z.slice(0,tF);z.length>tF&&rt.openToast({type:"basic",variant:"warning",content:m("move.modal.workspace.file.upload.maxFilesExceeded",{count:tF}),position:"top-right"});const $=new Set;for(const Z of Y){const K=jB(Z.name),V=`.${Z.name.split(".").pop()?.toLowerCase()??""}`;if(c4.test(Z.name)){M(Z,"move.workspace.toast.invalidCharacters");continue}if(!Afe.includes(V)){M(Z,"move.modal.workspace.file.upload.invalidFormat");continue}if(Z.size>uyt){M(Z,"move.modal.workspace.file.upload.tooLarge");continue}if($.has(K)){M(Z,"move.modal.workspace.file.upload.duplicateName");continue}if(gMe(T,Z.name)){M(Z,"move.modal.workspace.file.upload.duplicateName");continue}const fe=D.find(Q=>jB(Q.fileInfo?.fileName??"")===K)?.fileId??await Nyt(Z.name);if(fe){$.add(K),await O(Z,fe);continue}try{const Q=await c({file:Z,fileName:Z.name});if(!Q)continue;$.add(K),await O(Z,Q.fileId)}catch(Q){console.error("Upload failed:",Q)}}};return x(rn,{children:[u("input",{...v}),u(pMe,{open:e,onOpenChange:t,className:P("w-4xl!",i),title:m("move.modal.workspace.file.title"),footerHint:m("move.modal.workspace.file.upload.maxFilesExceeded",{count:tF}),isMultiSelectActive:E.isMultiSelectActive,selectedCount:E.selectedIds.size,isBusy:k,deleteSelectedLabel:m("move.modal.workspace.button.deleteSelected",{count:E.selectedIds.size}),confirmDisabled:E.selectedIds.size!==1,onDeleteSelected:z=>{E.selectedItems[0]&&A(z,E.selectedItems[0])},onExitMultiSelect:E.exitMultiSelect,onCancel:l,onConfirm:()=>{E.soleSelected&&a?.(E.soleSelected)},children:x(H,{className:"min-h-0 flex-1 items-stretch overflow-hidden",children:[x(U,{className:"bg-bg-overlay w-137.5 shrink-0 gap-3 px-4 py-3",children:[u(_Me,{searchQuery:E.searchQuery,onSearchQueryChange:E.setSearchQuery,selectionMode:E.selectionMode,onToggleSelectionMode:E.toggleSelectionMode,primaryActionLabel:m("move.modal.asset.button.add"),onPrimaryAction:w,isUploading:d,onCancelUpload:h}),x("div",{className:P("relative rounded-lg border-2 border-dashed transition-colors duration-200",_?"border-border-navy-stronger":"border-transparent"),...b,children:[_&&x("div",{className:"bg-fill-navy-subtlest/60 pointer-events-none absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-lg backdrop-blur-[2px]",children:[u(Ey,{className:"text-fg-navy size-8"}),u("span",{className:"typo-compact-xs-semibold text-fg-navy",children:m("move.modal.workspace.file.dropLabel")})]}),u(bMe,{isLoading:C,isEmpty:E.items.length===0,emptyMessage:E.searchQuery.trim()?m("move.modal.workspace.file.empty.noFound"):m("move.modal.workspace.file.empty.noAvailable"),children:E.items.map(z=>u(vMe,{isSelected:E.selectedIds.has(z.modelId),selectionMode:E.isMultiSelectActive,isBusy:k,name:z.fileInfo.fileName,metaText:`${gyt(z.fileInfo.fileSize)} · ${ZLe(z.fileInfo.createdAt,f)}`,onClick:Y=>E.onItemClick(z,Y),onDoubleClick:()=>{E.isMultiSelectActive||a?.(z)},onDelete:Y=>void A(Y,z),deleteAriaLabel:`${m("move.modal.workspace.file.deleteTitle")} ${z.fileInfo.fileName}`},z.modelId))})]})]}),u(Iyt,{model:R,isMultiSelected:E.selectedIds.size>1,className:"mr-4 min-w-0 flex-1"})]})})]})},{forwardRef:Dyt}=await F("react"),yMe=Dyt(function({value:e,onChange:t,onCommit:n,onCancel:s,ariaLabel:o,className:r},a){return u("input",{ref:a,type:"text",autoFocus:!0,value:e,onClick:l=>l.stopPropagation(),onDoubleClick:l=>l.stopPropagation(),onPointerDown:l=>l.stopPropagation(),onFocus:l=>l.currentTarget.select(),onChange:l=>t(l.target.value),onBlur:n,onKeyDown:l=>{l.stopPropagation(),l.key==="Enter"&&(l.preventDefault(),n()),l.key==="Escape"&&(l.preventDefault(),s())},"aria-label":o,className:P("text-fg-default bg-bg-default border-border-brand focus:border-border-brand focus:ring-fill-brand/25 selection:bg-fill-brand-subtle h-7 w-full min-w-0 rounded border selection:text-white focus:ring-2 focus:outline-hidden",r)})}),{useEffect:F8,useRef:nF,useState:B8}=await F("react"),Tyt=({workspaceName:i,hasUnsavedChanges:e,onRename:t,canUndo:n,canRedo:s,onUndo:o,onRedo:r,isSaving:a=!1,hasItems:l=!1,onDuplicate:c,onSaveAs:d,onCreateNew:h,onOpenPicker:g,onDelete:m,onClearAll:f,onReset:p})=>{const{t:_}=q(),[b,v]=B8(!1),w=nF(!1),[y,S]=B8(i??""),C=nF(null),[N,k]=B8("idle"),L=nF(!1),D=nF(null),T=c??d;F8(()=>{a?(D.current&&(clearTimeout(D.current),D.current=null),L.current=!0):L.current&&(L.current=!1,k("saved"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{k("idle"),D.current=null},1500))},[a]),F8(()=>()=>{D.current&&clearTimeout(D.current)},[]),F8(()=>{w.current=b,b&&(S(i??""),requestAnimationFrame(()=>C.current?.select()))},[b,i]);const E=()=>{const M=y.trim();if(w.current=!1,v(!1),!M){rt.openToast({type:"basic",variant:"warning",content:_("move.workspace.toast.renameInvalid"),position:"top-right"});return}M!==i&&t(M)},R=()=>{b||(S(i??""),w.current=!0,v(!0))},A=()=>{R()};return x(H,{alignItems:"center",className:"w-full shrink-0 gap-1 pb-2",children:[x("div",{className:P("flex h-9 min-w-0 flex-1 items-center gap-1.5 rounded px-2 transition-colors",!b&&"hover:bg-bg-alt-1 cursor-pointer select-none"),onDoubleClick:A,children:[u(tDe,{width:16,height:16,className:"text-fg-subtle pointer-events-none shrink-0"}),b?u(yMe,{ref:C,value:y,onChange:S,onCommit:E,onCancel:()=>{w.current=!1,v(!1)},ariaLabel:_("move.workspace.header.renameLabel"),className:"typo-compact-xs-semibold px-2"}):x(rn,{children:[u("span",{className:"typo-compact-xs-semibold text-fg-default pointer-events-none min-w-0 flex-1 truncate",children:i??_("move.workspace.jsonSlot.empty")}),e?x("span",{className:"text-fg-warning flex shrink-0 items-center gap-1 px-1 py-0.5",children:[u(ETe,{className:"size-3.5 shrink-0"}),u("span",{className:"typo-compact-sm-medium",children:_("move.workspace.header.unsaved")})]}):N==="saved"?x("span",{className:"text-fg-success pointer-events-none flex shrink-0 items-center gap-1 transition-opacity duration-200",children:[u(TTe,{className:"size-3.5 shrink-0"}),u("span",{className:"typo-compact-sm-medium",children:_("move.workspace.header.saved")})]}):null]})]}),x(H,{alignItems:"center",className:"shrink-0 gap-0.5",children:[u(Yt,{variant:"transparent",size:"sm",disabled:!n,onClick:o,icon:u(GDe,{className:"size-3.5"}),"aria-label":_("move.workspace.header.undo")}),u(Yt,{variant:"transparent",size:"sm",disabled:!s,onClick:r,icon:u(UDe,{className:"size-3.5"}),"aria-label":_("move.workspace.header.redo")}),x(iA,{children:[u(oA,{asChild:!0,children:u(Yt,{variant:"transparent",size:"sm",icon:u(Dje,{width:16,height:16,className:"text-fg-subtle"}),"aria-label":_("move.workspace.header.menu")})}),x(sA,{align:"end",className:"w-40",onCloseAutoFocus:M=>{w.current&&(M.preventDefault(),C.current?.select())},children:[u(hu,{className:"h-10",onClick:h,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.createNew")})}),u(hu,{className:"h-10",onClick:g,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.open")})}),u(hu,{className:"h-10",onSelect:R,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.rename")})}),T&&u(hu,{className:"h-10",onClick:T,disabled:a||!l,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.duplicate")})}),m&&u(hu,{className:"h-10",onClick:m,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.delete")})}),u(f9,{}),f&&u(hu,{className:"h-10",onClick:f,disabled:!l,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.clearAll")})}),u(hu,{className:"h-10",onClick:p,disabled:!e,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.reset")})})]})]})]})]})},{useEffect:zfe,useRef:iF,useState:Eyt}=await F("react"),Wfe=300,Pyt=50,V8=({label:i,labelColor:e,unit:t,value:n,step:s,min:o,max:r,disabled:a,precision:l=2,onChange:c})=>{const d=k=>{if(k===""||k==="-"||k.endsWith("."))return;const L=parseFloat(k);isNaN(L)||c(L)},h=k=>{const L=parseFloat(k);isNaN(L)||c(L)},g=iF(n);zfe(()=>{g.current=n},[n]);const m=iF(void 0),f=iF(void 0),p=iF(Wfe),[_,b]=Eyt(!1),v=()=>{window.clearTimeout(m.current),window.clearTimeout(f.current),p.current=Wfe},w=()=>{v(),b(!1)};zfe(()=>v,[]);const y=k=>{const L=k==="up"?s:-s;let D=Number((g.current+L).toFixed(l));o!==void 0&&(D=Math.max(o,D)),r!==void 0&&(D=Math.min(r,D)),g.current=D,c(D)},S=k=>{y(k),window.clearTimeout(f.current),f.current=window.setTimeout(()=>{S(k),p.current>Pyt&&(p.current-=p.current/6)},p.current)},C=k=>{if(a||k.key!=="ArrowUp"&&k.key!=="ArrowDown"||(k.preventDefault(),k.repeat))return;b(!0);const L=k.key==="ArrowUp"?"up":"down";y(L),m.current=window.setTimeout(()=>{S(L)},p.current)},N=k=>{k.key!=="ArrowUp"&&k.key!=="ArrowDown"||w()};return x(U,{className:P("AxisNumberInput","gap-1"),children:[x(H,{className:"typo-compact-xs-medium gap-1",children:[u("span",{className:P("text-fg-default",e),children:i.toUpperCase()}),u("span",{className:"text-fg-subtle",children:t?`(${t})`:""})]}),u("div",{onKeyDown:C,onKeyUp:N,onBlur:w,children:u(Vse,{value:String((n??0).toFixed(l)),step:s,digit:l,fixedDigit:l,enableArrowKeys:!1,enableWheel:!0,min:o!==void 0?String(o):void 0,max:r!==void 0?String(r):void 0,disabled:a,isDirect:!0,bypassFocusSync:_,notAllowedEmptyValue:!0,onFocus:k=>k.target.select(),handleChange:d,handleEnter:h})})]})},Ryt=({className:i,item:e,onChange:t})=>{const{t:n}=q(),s=e?.kind==="shape";if(!e)return x(U,{className:P("border-border-subtle w-full gap-2 border-t pt-3",i),children:[u(H,{alignItems:"center",className:"h-9 w-full px-1",children:u("span",{className:"typo-compact-xs-semibold text-fg-default",children:n("move.workspace.properties.title")})}),u("div",{className:"border-border-subtle flex h-24 items-center justify-center rounded-md border border-dashed",children:u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:n("move.workspace.properties.selectItem")})})]});const r=(e.kind==="shape"?roe.find(f=>f.type===e.shapeType):void 0)?.dimensions??l4,a=e.kind==="shape"?e.scale:uR,l=f=>a[f]*r[f],c=(f,p)=>t(e.id,{scale:{...a,[f]:p/r[f]}},`scale:${e.id}:${f}`),d=[{key:"x",label:"X",color:xi.x},{key:"y",label:"Y",color:xi.y},{key:"z",label:"Z",color:xi.z}],h=[{key:"rx",label:"RX",color:xi.rx},{key:"ry",label:"RY",color:xi.ry},{key:"rz",label:"RZ",color:xi.rz}],g=[{key:"x",label:"SX",color:xi.x},{key:"y",label:"SY",color:xi.y},{key:"z",label:"SZ",color:xi.z}],m=()=>{e&&t(e.id,{position:{...JRe},rotation:{...aoe},...s&&{scale:{...uR}}},`resetTransform:${e.id}`)};return x(U,{className:P("border-border-subtle w-full gap-2 border-t pt-3",i),children:[x(H,{alignItems:"center",justifyContent:"space-between",className:"h-9 w-full px-1",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:n("move.workspace.properties.title")}),u(Nie,{size:"xs",className:"text-fg-subtle hover:text-fg-default",onClick:m,children:n("move.workspace.properties.resetTransform")})]}),x("div",{className:"grid w-full grid-cols-2 gap-2",children:[x(U,{className:"min-w-0 gap-2",children:[u("div",{className:"typo-compact-2xs-medium text-fg-subtle mt-0.5 flex h-5 items-center px-1",children:n("move.workspace.properties.translate")}),d.map(({key:f,label:p,color:_})=>u(V8,{label:p,unit:dfe,labelColor:_,value:e.position[f],step:Xft,precision:Qft,onChange:b=>t(e.id,{position:{...e.position,[f]:b}},`position:${e.id}:${f}`)},f))]}),x(U,{className:"min-w-0 gap-2",children:[u("div",{className:"typo-compact-2xs-medium text-fg-subtle mt-0.5 flex h-5 items-center px-1",children:n("move.workspace.properties.rotate")}),h.map(({key:f,label:p,color:_})=>u(V8,{label:p,unit:Yft,labelColor:_,value:e.rotation[f],step:Zft,precision:ept,onChange:b=>t(e.id,{rotation:{...e.rotation,[f]:b}},`rotation:${e.id}:${f}`)},f))]})]}),u("div",{className:P("grid transition-[grid-template-rows] duration-200 ease-out",s?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:u("div",{className:"grid min-h-0 w-full grid-cols-2 gap-2 overflow-hidden",children:x(U,{className:"min-w-0 gap-2",children:[u("div",{className:"typo-compact-2xs-medium text-fg-subtle mt-1 flex h-5 items-center px-1",children:n("move.workspace.properties.scale")}),g.map(({key:f,label:p,color:_})=>u(V8,{label:p,unit:dfe,labelColor:_,value:l(f),step:tpt,precision:npt,onChange:b=>c(f,b)},f))]})})})]})},{useState:Hfe,useEffect:z8,useRef:sF}=await F("react"),Myt=i=>{if(i.kind==="custom")return u(Ey,{width:16,height:16});switch(i.shapeType){case"cylinder":return u(QLe,{className:"size-4"});case"sphere":return u(XLe,{className:"size-4"});case"box":return u(YLe,{className:"size-4"});default:return u(b9,{className:"size-4"})}},Ayt=i=>{if(i.kind!=="custom")return null;const e=i.fileName.match(/\.[^.]+$/)?.[0];return e?i.name.toLowerCase().endsWith(e.toLowerCase())?null:e:null},Oyt=({items:i,isActive:e=!0,addPanel:t,isAddPanelOpen:n=!1,onToggleAddPanel:s,selectedId:o,onSelect:r,onDeselect:a,selectionMode:l,checkedIds:c,onSelectionModeChange:d,onCheckedIdsChange:h,loadingIds:g,hiddenIds:m,failedIds:f,loadFailedIds:p,onToggleVisibility:_,onRename:b,onRenameCommit:v,onDelete:w,onBulkDelete:y,onBulkHide:S})=>{const{t:C}=q(),[N,k]=Hfe(null),L=sF(null),[D,T]=Hfe(""),E=sF(null),R=sF(null),A=()=>{L.current&&K(L.current),d(!0),R.current=null},M=()=>{d(!1),R.current=null},O=Q=>{h(re=>{const ve=new Set(re);return ve.has(Q)?ve.delete(Q):ve.add(Q),ve}),R.current=Q},B=(Q,re,ve)=>{const _e=ve.shiftKey;h(Le=>{const Ie=mMe({items:re,getId:Te=>Te.id,targetId:Q.id,selectedIds:Le,anchorId:R.current,selectionMode:!0,isRangeSelect:_e});return R.current=Ie.anchorId,Ie.selectedIds})},z=()=>{y?.(Array.from(c)),M()},Y=()=>{S?.(Array.from(c)),M()},$=sF(null);z8(()=>{if(!o||!e)return;let Q=0,re=30;const ve=()=>{const _e=$.current?.querySelector(`[data-item-id="${o}"]`);if(_e?.scrollIntoView){_e.scrollIntoView({behavior:"smooth",block:"nearest"});return}re-- >0&&(Q=requestAnimationFrame(ve))};return Q=requestAnimationFrame(ve),()=>cancelAnimationFrame(Q)},[o,e]),z8(()=>{L.current=N,N&&requestAnimationFrame(()=>{E.current?.focus(),E.current?.select()})},[N]),z8(()=>{if(!e)return;const Q=re=>{const ve=document.activeElement;ve instanceof HTMLInputElement||ve instanceof HTMLTextAreaElement||ve?.getAttribute("contenteditable")==="true"||l||!o||L.current||(re.key==="Delete"||re.key==="Backspace")&&(re.preventDefault(),w(o))};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[e,o,l,w]);const Z=Q=>{T(Q.name),L.current=Q.id,k(Q.id)},K=Q=>{b(Q,D),L.current=null,k(null)},V=Q=>{L.current=null,k(null);const re=i.find(_e=>_e.id===Q),ve=re?.name.trim()??"";if(!re||!ve){rt.openToast({type:"basic",variant:"warning",content:C("move.workspace.toast.renameInvalid"),position:"top-right"}),b(Q,D);return}ve!==re.name&&b(Q,ve),v?.(Q,D)},fe=[...i].sort((Q,re)=>Q.kind===re.kind?0:Q.kind==="custom"?-1:1);return x(U,{className:"w-full gap-1.5",children:[x(H,{alignItems:"center",justifyContent:"space-between",className:"w-full gap-2 px-1",children:[x("span",{className:"typo-compact-xs-semibold text-fg-default",children:[C("move.workspace.itemList.title"),i.length>0&&u("span",{className:"text-fg-subtle ml-1",children:i.length})]}),x(H,{alignItems:"center",className:"gap-1",children:[i.length>0&&u(Nie,{size:"xs",className:"text-fg-subtle hover:text-fg-default",onClick:()=>l?M():A(),children:C(l?"move.workspace.itemList.selectionExit":"move.workspace.itemList.selectionMode")}),s?u(Yt,{variant:"transparent",size:"sm",onClick:s,icon:u(Mm,{className:P("text-fg-default size-3.5 transition-transform duration-200 ease-out",n?"rotate-45":"rotate-0")}),"aria-label":C(n?"common.button.close":"move.workspace.addMenu.trigger"),className:"text-fg-default hover:bg-bg-alt-1 active:bg-bg-alt-2 rounded-md transition-colors"}):null]})]}),u("div",{className:P("grid w-full transition-[grid-template-rows,opacity] duration-200 ease-out",n?"grid-rows-[1fr] opacity-100":"pointer-events-none grid-rows-[0fr] opacity-0"),children:u("div",{className:"min-h-0 overflow-hidden",children:t})}),i.length===0?u("div",{className:"border-border-subtle flex h-16 items-center justify-center rounded-md border border-dashed",children:u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:C("move.workspace.itemList.empty")})}):u(U,{ref:$,className:"border-border-subtle/70 bg-bg-alt-1/40 max-h-52 w-full gap-1 overflow-y-auto rounded-lg border p-1.5 [scrollbar-gutter:stable]",onClick:Q=>{Q.target===Q.currentTarget&&a?.()},children:fe.map(Q=>{const re=Q.id===o,ve=Q.id===N,_e=m?.has(Q.id)??!1,Le=c.has(Q.id),Ie=Ayt(Q),Te=g?.has(Q.id)??!1,lt=f?.has(Q.id)??!1,it=p?.has(Q.id)??!1,Ct=C("move.workspace.itemList.loadFailedLabel");return x("div",{"data-item-id":Q.id,role:"button",tabIndex:0,onClick:ft=>{if(l){B(Q,fe,ft);return}ve||r(Q.id)},onDoubleClick:()=>{!ve&&!l&&Z(Q)},onKeyDown:ft=>{ve||(ft.key==="Enter"||ft.key===" ")&&(ft.preventDefault(),l?O(Q.id):r(Q.id))},className:P("group relative z-1 flex h-9 w-full shrink-0 cursor-pointer items-center justify-between gap-1 rounded-md border pr-0.5 pl-2 transition-all duration-150 select-none",(l?Le:re)?"border-border-navy-stronger bg-fill-navy-subtler ring-border-navy-stronger ring-1 ring-inset":"border-border-subtle/80 bg-bg-default hover:border-border-navy-stronger hover:bg-fill-navy-subtler active:border-border-navy-stronger active:bg-fill-navy-subtler active:ring-border-navy-stronger shadow-2xs active:ring-1 active:ring-inset",_e&&"opacity-45"),children:[x("div",{className:"flex h-full min-w-0 flex-1 items-center gap-1.5 pr-1",children:[l&&u(ia,{size:"xs",readOnly:!0,value:Le,className:"-ml-1 shrink-0"}),u("span",{className:P("pointer-events-none shrink-0 transition-colors",(l?Le:re)?"text-fg-navy":"text-fg-subtle group-hover:text-fg-navy group-active:text-fg-navy"),children:Myt(Q)}),ve?u(yMe,{ref:E,value:Q.name,onChange:ft=>b(Q.id,ft),onCommit:()=>V(Q.id),onCancel:()=>K(Q.id),ariaLabel:C("move.workspace.header.rename"),className:"typo-compact-xs-medium px-1.5"}):x("span",{className:P("pointer-events-none min-w-0 truncate transition-colors",(l?Le:re)?"typo-compact-xs-semibold text-fg-navy":"typo-compact-xs-medium text-fg-default group-hover:text-fg-navy group-active:typo-compact-xs-semibold group-active:text-fg-navy"),children:[Q.name,Ie]}),_e&&u(Tje,{width:14,height:14,className:"text-fg-subtle shrink-0","aria-label":C("move.workspace.itemList.hiddenLabel"),title:C("move.workspace.itemList.hiddenLabel")}),Te&&u(aw,{size:"0.75rem",className:"text-fg-subtle shrink-0"}),lt&&u(Oue,{className:"text-fg-danger size-3.5 shrink-0","aria-label":C("move.workspace.itemList.saveFailedLabel"),title:C("move.workspace.itemList.saveFailedLabel")}),it&&u(Oue,{className:"text-fg-danger size-3.5 shrink-0","aria-label":Ct,title:Ct})]}),!l&&u("div",{className:"shrink-0",onClick:ft=>ft.stopPropagation(),onPointerDown:ft=>ft.stopPropagation(),children:x(iA,{modal:!1,children:[u(oA,{asChild:!0,children:u(Yt,{variant:"transparent",size:"xs",className:"text-fg-subtle hover:text-fg-navy flex h-8.5! min-h-8.5! w-8.5! min-w-8.5! items-center justify-center rounded p-0",icon:u(WDe,{className:"size-4"}),"aria-label":C("move.workspace.itemList.actions")})}),x(sA,{align:"end",className:"w-36",onCloseAutoFocus:ft=>{L.current&&(ft.preventDefault(),E.current?.select())},children:[u(hu,{className:"h-10",onSelect:()=>Z(Q),children:u("span",{className:"typo-compact-xs-medium",children:C("move.workspace.header.rename")})}),_&&u(hu,{className:"h-10",onSelect:()=>_(Q.id),children:u("span",{className:"typo-compact-xs-medium",children:C(_e?"move.workspace.itemList.showLabel":"move.workspace.itemList.hideLabel")})}),u(hu,{className:"h-10",onSelect:()=>w(Q.id),children:u("span",{className:"typo-compact-xs-medium",children:C("move.workspace.itemList.deleteLabel")})})]})]})})]},Q.id)})}),l&&x(H,{alignItems:"center",justifyContent:"space-between",className:"w-full gap-2 px-1",children:[u("span",{className:"typo-compact-xs-medium text-fg-subtle",children:C("move.workspace.itemList.selectionCount",{count:c.size})}),x(H,{alignItems:"center",className:"gap-1",children:[u(se,{size:"xs2",variant:"outlined",disabled:c.size===0,onClick:Y,children:C("move.workspace.itemList.hideSelected",{count:c.size})}),u(se,{size:"xs2",variant:"danger",disabled:c.size===0,onClick:z,children:C("move.workspace.itemList.deleteSelected",{count:c.size})})]})]})]})},{useCallback:$fe,useEffect:W8,useMemo:Ufe,useRef:H8,useState:oF}=await F("react"),{useQueryClient:Fyt}=await F("@tanstack/react-query"),jfe=i=>i.some(e=>{const t=e.fileInfo?.fileName?.split(".").pop()?.toLowerCase();return t==="stp"||t==="step"}),Byt=({workspace:i,robotModel:e,detailRobotModel:t,modelType:n,mountJointName:s,gizmoSelectedAssetIds:o,selectionMode:r,tabKind:a,onRequestSceneAssetSelect:l,onRequestSceneSelectionChange:c,isActive:d=!0})=>{const{t:h}=q(),{theme:g}=tt(),{confirmDialog:m,promptDialog:f}=jn(),[p,_]=oF(!1),[b,v]=oF(!1),[w,y]=oF(!1),{mutateAsync:S,isPending:C,abort:N}=iyt(),{data:k}=r6(e,t),{mutateAsync:L}=lyt(),D=Ufe(()=>(k??[]).filter(Ne=>Ne.modelType===n&&(s?Ne.attachment?.parentJointName===s:!0)),[k,n,s]),T=Ufe(()=>D.filter(Ne=>Ne.isLoaded).map(Ne=>Ne.modelId),[D]),E=H8(new Set),{stage:R,loadFromModels:A,selectItem:M}=i,O=$fe(()=>{rt.openToast({type:"basic",variant:"warning",title:h("move.workspace.stepFormatWarning.title"),content:h("move.workspace.stepFormatWarning.message"),position:"top-right"})},[h]);W8(()=>{if(R!=="empty"||!k)return;const Ne=D.filter(ct=>ct.isLoaded);if(Ne.length===0){E.current.clear();return}const Re=Ne.filter(ct=>!E.current.has(ct.modelId))[0]?.workspace?.name;if(!Re)return;const We=D.filter(ct=>ct.workspace?.name===Re);jfe(We)&&O(),A(We,Re,T)},[R,k,D,T,A,O]);const B=Ne=>{rt.openToast({type:"basic",variant:"warning",content:h(Ne),position:"top-right"})},z=async({title:Ne,initialValue:le="",excludeName:Pe})=>{const Re=await f({title:Ne,content:h("move.workspace.dialog.namePlaceholder"),placeholder:h("move.workspace.dialog.namePlaceholder"),value:le,autoFocus:!0,inputElement:u(et,{className:"[&_input]:selection:bg-fill-brand-subtle [&_input]:selection:text-white",onFocus:ct=>ct.target.select()}),buttonText:{yes:h("common.button.confirm"),no:h("common.button.cancel")}});if(Re==null)return null;const We=Re.trim();return We?c4.test(We)?(B("move.workspace.toast.invalidCharacters"),null):We===Pe?null:ufe(k??[],{modelType:n,attachment:s?{parentJointName:s}:null},We,Pe??void 0)?(B("move.workspace.toast.nameDuplicate"),null):We:(B("move.workspace.toast.renameInvalid"),null)},Y=H8(null);W8(()=>{const Ne=i.loadTimeoutEvent;if(!Ne||Y.current===Ne)return;Y.current=Ne;const le=i.items.find(Pe=>Pe.id===Ne.itemId);rt.openToast({type:"basic",variant:"warning",content:h("move.workspace.toast.loadTimeout",{name:le?.name??""}),position:"top-right"})},[i.loadTimeoutEvent,i.items,h]);const $=async()=>{const Ne=await z({title:h("move.workspace.dialog.saveAsTitle")});if(Ne)try{await i.saveAs(Ne,T),rt.openToast({type:"basic",variant:"success",content:h("move.workspace.toast.saveSuccess"),position:"top-right"})}catch{i.failedItemIds.size>0?rt.openToast({type:"basic",variant:"warning",content:h("move.workspace.toast.saveFailedPartial",{count:i.failedItemIds.size}),position:"top-right"}):B("move.workspace.toast.saveFailed")}},Z=async()=>{try{await i.save(),rt.openToast({type:"basic",variant:"success",content:h("move.workspace.toast.saveSuccess"),position:"top-right"})}catch{i.failedItemIds.size>0?rt.openToast({type:"basic",variant:"warning",content:h("move.workspace.toast.saveFailedPartial",{count:i.failedItemIds.size}),position:"top-right"}):B("move.workspace.toast.saveFailed")}},K=Ne=>{if(v(!1),i.items.find(Re=>Re.kind==="custom")?.modelId===Ne.modelId)return;const Pe=`.${Ne.fileInfo.fileName.split(".").pop()?.toLowerCase()??""}`;(Pe===".stp"||Pe===".step")&&O();try{const Re=i.addCustomFile(Ne);Re&&l?.(`${a}:${Re}`)}catch{B("move.workspace.toast.uploadFailed")}},V=Ne=>{const le=new Set(Ne.map(We=>We.modelId)),Pe=new Set(Ne.map(We=>We.fileId).filter(We=>!!We)),Re=i.items.filter(We=>We.kind==="custom"&&(We.modelId!=null&&le.has(We.modelId)||We.fileId!=null&&Pe.has(We.fileId))).map(We=>We.id);Re.length!==0&&(i.selectedItemId&&Re.includes(i.selectedItemId)&&l?.(null),i.removeItems(Re))},fe=async()=>{i.hasCustomFile&&!await m({title:h("move.workspace.confirm.replaceFileTitle"),content:h("move.workspace.confirm.replaceFileContent"),buttonText:{yes:h("move.workspace.button.continue"),no:h("common.button.cancel")}})||v(!0)},Q=async(Ne,le)=>{const Pe=i.items.find($n=>$n.id===Ne);if(!Pe)return;const Re=Pe.name.trim();if(!Re){B("move.workspace.toast.renameInvalid"),i.renameItem(Ne,le);return}if(Pe.kind!=="custom"||!Pe.fileId){Re!==le&&i.renameItem(Ne,Re);return}if(c4.test(Re)){B("move.workspace.toast.invalidCharacters"),i.renameItem(Ne,le);return}if(Re===le)return;const We=Pe.fileName.match(/\.[^.]+$/)?.[0]??"",ct=We&&!Re.toLowerCase().endsWith(We.toLowerCase())?`${Re}${We}`:Re,gn=D.filter($n=>$n.shapeType===null&&!$n.workspace);if(gMe(gn,ct,Pe.modelId)){B("move.modal.workspace.file.upload.duplicateName"),i.renameItem(Ne,le);return}if(!Pe.modelId){i.renameItem(Ne,Re);return}try{await L({robotModel:e,detailRobotModel:t,modelId:Pe.modelId,fileId:Pe.fileId,fileName:ct}),i.applyCustomFileRename(Ne,ct,Re)}catch{i.renameItem(Ne,le)}},re=Ne=>{const le=Ne.trim();if(!le){B("move.workspace.toast.renameInvalid");return}if(c4.test(le)){B("move.workspace.toast.invalidCharacters");return}if(ufe(k??[],{modelType:n,attachment:s?{parentJointName:s}:null},le,i.workspaceName??void 0)){B("move.workspace.toast.nameDuplicate");return}i.renameWorkspace(le)},ve=Fyt(),{mutateAsync:_e}=uoe(),Le=async()=>{const Ne=i.workspaceName;if(!Ne||!await m({title:h("move.workspace.confirm.deleteTitle"),content:h("move.workspace.confirm.deleteContent",{name:Ne}),buttonText:{yes:h("move.modal.workspace.button.delete"),no:h("common.button.cancel")}}))return;const Pe=D.filter(Re=>Re.workspace?.name===Ne);try{await Promise.all(Pe.map(We=>_e(We.modelId)));const Re=i1(e,t);await ve.invalidateQueries({queryKey:Re}),i.closeWorkspace(T),rt.openToast({type:"basic",variant:"success",content:h("move.workspace.toast.deleteSuccess"),position:"top-right"})}catch{rt.openToast({type:"basic",variant:"danger",content:h("move.workspace.toast.deleteFailed"),position:"top-right"})}},Ie=async()=>{if(i.hasUnsavedChanges&&!await m({title:h("move.workspace.confirm.closeTitle"),content:h("move.workspace.confirm.closeContent"),buttonText:{yes:h("move.workspace.button.closeWithoutSaving"),no:h("common.button.cancel")}}))return;const Ne=D.filter(le=>le.isLoaded);for(const le of Ne)E.current.add(le.modelId);i.closeWorkspace(T)},Te=()=>{_(!0)},lt=()=>{i.clearItems()},it=async Ne=>{if(Ne.name===i.workspaceName){_(!1);return}i.hasUnsavedChanges&&!await m({title:h("move.workspace.confirm.openTitle"),content:h("move.workspace.confirm.openContent"),buttonText:{yes:h("move.workspace.button.continue"),no:h("common.button.cancel")}})||(E.current.clear(),_(!1),jfe(Ne.models)&&O(),i.loadFromModels(Ne.models,Ne.name,T))},Ct=async()=>{const Ne=await z({title:h("move.workspace.dialog.createTitle")});Ne&&i.createNew(Ne)},ft=Ne=>{!i.workspaceName||!Ne.includes(i.workspaceName)||(D.filter(le=>le.isLoaded).forEach(le=>E.current.add(le.modelId)),l?.(null),i.closeWorkspace(T))};dyt({selectedItemId:i.selectedItemId,gizmoSelectedAssetIds:o,selectionMode:r,tabKind:a,onRequestSceneAssetSelect:l,selectItem:M});const[Xt,Mt]=oF(new Set),Ht=H8({mode:!1,idsKey:""}),Mn=$fe(Ne=>Ne.filter(le=>le.startsWith(`${a}:`)).map(le=>le.slice(a.length+1)),[a]),Cs=Ne=>[...Ne].sort().join(",");W8(()=>{if(!r){Ht.current.mode!==!1&&(Ht.current={mode:!1,idsKey:""},Mt(new Set));return}const Ne=Mn(o),le=Cs(Ne),Pe=Ht.current;Pe.mode===!0&&Pe.idsKey===le||(Ht.current={mode:!0,idsKey:le},Mt(new Set(Ne)))},[o,r,a,Mn]);const or=Ne=>{Mt(le=>{const Pe=typeof Ne=="function"?Ne(le):Ne,Re=Cs(Pe);return Ht.current={mode:!0,idsKey:Re},c?.([...Pe].map(We=>`${a}:${We}`),!0),Pe})},ge=Ne=>{Ne?(Ht.current={mode:!0,idsKey:""},c?.([],!0)):(Ht.current={mode:!1,idsKey:""},Mt(new Set),c?.([],!1))},Ue=u(wyt,{open:p,onOpenChange:_,robotModel:e,detailRobotModel:t,modelType:n,attachment:s?{parentJointName:s}:null,resolve:it,close:()=>_(!1),onGroupsDeleted:ft}),Ee=i.items.find(Ne=>Ne.id===i.selectedItemId)??null;return i.stage==="empty"?x(rn,{children:[u(U,{className:"w-full gap-2 pb-2.5",children:x(H,{className:"w-full gap-2 p-1",children:[u(se,{variant:"outlined",size:"xs2",className:"flex-1",leadingIcon:u(Mm,{}),onClick:()=>void Ct(),children:h("move.workspace.header.createNew")}),u(se,{variant:"brand",size:"xs2",className:"flex-1",leadingIcon:u(tDe,{}),onClick:()=>_(!0),children:h("move.workspace.header.open")})]})}),Ue]}):x(rn,{children:[x(U,{className:"w-full gap-3",children:[u(Tyt,{workspaceName:i.workspaceName,hasUnsavedChanges:i.hasUnsavedChanges,onRename:re,canUndo:i.canUndo,canRedo:i.canRedo,onUndo:i.undo,onRedo:i.redo,isSaving:i.isSaving,hasItems:i.items.length>0,onDuplicate:()=>void $(),onCreateNew:()=>void Ct(),onOpenPicker:()=>void Te(),onDelete:()=>void Le(),onClearAll:lt,onReset:i.resetToSaved}),x(H,{className:P("border-border-subtle -mt-1.5 w-full shrink-0 gap-2 border-b pb-3",g==="light"?"bg-white":"bg-alt-1"),children:[u(se,{className:"flex-1",size:"xs2",variant:"outlined",onClick:()=>void Ie(),children:h("move.workspace.header.close")}),u(se,{className:"flex-1",size:"xs2",variant:"brand",disabled:i.isSaving||!i.hasUnsavedChanges,onClick:()=>void Z(),children:h("move.workspace.header.saveNow")})]}),u(Oyt,{items:i.items,isActive:d,isAddPanelOpen:w,onToggleAddPanel:()=>y(Ne=>!Ne),addPanel:u(Spt,{onAddShape:Ne=>{const le=i.addShape(Ne);le&&l?.(`${a}:${le}`)},limitReached:i.isLimitReached,isCustomFileUploading:C,onOpenCustomFilePicker:()=>void fe(),draggable:n==="base"}),selectedId:i.selectedItemId,onSelect:Ne=>{if(i.selectedItemId===Ne){i.selectItem(null),l?.(null);return}i.selectItem(Ne),l?.(`${a}:${Ne}`)},onDeselect:()=>{i.selectItem(null),l?.(null)},selectionMode:r,checkedIds:Xt,onSelectionModeChange:ge,onCheckedIdsChange:or,loadingIds:i.loadingItemIds,hiddenIds:i.hiddenItemIds,failedIds:i.failedItemIds,loadFailedIds:i.loadFailedItemIds,onToggleVisibility:Ne=>{i.selectedItemId===Ne&&!i.hiddenItemIds.has(Ne)&&l?.(null),i.toggleItemVisibility(Ne)},onRename:i.renameItem,onRenameCommit:(Ne,le)=>void Q(Ne,le),onDelete:i.removeItem,onBulkDelete:i.removeItems,onBulkHide:i.hideItems}),u(Ryt,{item:Ee,onChange:i.updateItemTransform}),u(Lyt,{open:b,onOpenChange:v,robotModel:e,detailRobotModel:t,modelType:n,attachment:s?{parentJointName:s}:null,resolve:K,close:()=>v(!1),uploadAssetFiles:S,isUploading:C,onCancelUpload:N,onModelsDeleted:V})]}),Ue]})},{useCallback:$8,useEffect:c_,useLayoutEffect:Vyt,useMemo:wMe,useRef:GB,useState:d4}=await F("react"),Gfe=({robotModel:i,detailRobotModel:e,modelType:t,mountJointName:n,gizmoSelectedAssetIds:s,selectionMode:o,isActive:r,tabKey:a,onAssetsChange:l,assetTransformEvent:c,onRequestSceneAssetSelect:d,onRequestSceneSelectionChange:h,onAssetLoaded:g,shapeDropRequest:m,onLoadingChange:f})=>{const p=Qvt({robotModel:i,detailRobotModel:e,modelType:t,mountJointName:n,isActive:r}),_=t==="base"?"base":`tool:${n}`;c_(()=>{l(a,p.assets)},[p.assets,l,a]),c_(()=>{f(a,p.loadingItemIds.size>0)},[p.loadingItemIds,f,a]),c_(()=>{const N=p.assetLoadedEvent;N&&g?.(N.assetId)},[p.assetLoadedEvent,g]);const b=GB(r);c_(()=>{const N=b.current;b.current=r,!(!N||r||!s.some(L=>L.startsWith(`${_}:`)))&&(o?h?.([],!1):d?.(null))},[r,s,o,_,d,h]);const v=GB({workspace:p,shapeDropRequest:m});c_(()=>{v.current={workspace:p,shapeDropRequest:m}});const[w,y]=d4(null);c_(()=>{if(!c?.assetId.startsWith(`${_}:`))return;const N=c.assetId.slice(_.length+1),{transform:k,final:L}=c,{workspace:D}=v.current,T=D.items.find(R=>R.id===N),E={position:{x:Math.round(k.x*Pn),y:Math.round(k.y*Pn),z:Math.round(k.z*Pn)},rotation:{rx:parseFloat(k.rx.toFixed(2)),ry:parseFloat(k.ry.toFixed(2)),rz:parseFloat(k.rz.toFixed(2))},...T?.kind==="shape"&&typeof k.scale!="number"&&{scale:{x:parseFloat(k.scale.x.toFixed(2)),y:parseFloat(k.scale.y.toFixed(2)),z:parseFloat(k.scale.z.toFixed(2))}}};if(!L){y({itemId:N,update:E});return}y(null),D.updateItemTransform(N,E,`drag:${N}`)},[c,_]);const S=wMe(()=>w?{...p,items:p.items.map(N=>N.id===w.itemId?YRe(N,w.update):N)}:p,[p,w]),C=m?.nonce;return c_(()=>{const{workspace:N,shapeDropRequest:k}=v.current;if(!k||N.stage!=="build")return;const L=N.addShape(k.type,k.at);L&&d?.(`${_}:${L}`)},[C,_,d]),u("div",{className:P(!r&&"hidden"),children:u(Byt,{workspace:S,robotModel:i,detailRobotModel:e,modelType:t,mountJointName:n,gizmoSelectedAssetIds:s,selectionMode:o,tabKind:_,onRequestSceneAssetSelect:d,onRequestSceneSelectionChange:h,isActive:r})})},zyt=({className:i,detailRobotModel:e,tcpJoints:t,gizmoSelectedAssetIds:n=[],selectionMode:s=!1,onAssetsChange:o,assetTransformEvent:r,shapeDropRequest:a,onRequestSceneAssetSelect:l,onRequestSceneSelectionChange:c,onAssetLoaded:d,isMenuActive:h=!0})=>{const{t:g}=q(),{theme:m}=tt(),f=wMe(()=>{const T=R=>{const A=R.toLowerCase();return A.includes("right")?0:A.includes("left")?1:2},E=t.map((R,A)=>({tcp:R,index:A})).sort((R,A)=>T(R.tcp.jointName)-T(A.tcp.jointName)||R.index-A.index);return[{key:"base",label:g("move.workspace.tab.base"),componentModel:e},...E.map(({tcp:R,index:A})=>{const{key:M,params:O}=ipt(R.jointName,A,E.length);return{key:`tool:${R.jointName}`,label:g(M,O),componentModel:R.componentModel}})]},[t,e,g]),[p,_]=d4(f[0].key);c_(()=>{f.some(T=>T.key===p)||_(f[0].key)},[f,p]);const b=$8(T=>f.find(E=>T.startsWith(`${E.key}:`)),[f]),v=n[0]??null;Vyt(()=>{if(!v)return;const T=b(v);T&&_(E=>T.key!==E?T.key:E)},[v,b]);const[w,y]=d4({}),S=$8((T,E)=>{y(R=>BE(R[T]??[],E)?R:{...R,[T]:E})},[]),[C,N]=d4({}),k=$8((T,E)=>{N(R=>R[T]===E?R:{...R,[T]:E})},[]),L=GB([]),D=GB([]);return c_(()=>{const T=w.base??[],E=f.filter(R=>R.key!=="base").flatMap(R=>w[R.key]??[]);BE(L.current,T)&&BE(D.current,E)||(L.current=T,D.current=E,o(T,E))},[w,f,o]),u("div",{className:P("WorkspaceControl","h-full overflow-y-auto [scrollbar-gutter:stable]",i),children:x(U,{className:"gap-3 px-3 pt-2.5",children:[x(U,{className:"gap-2",children:[u(Ag,{subject:g("move.workspace.title")}),u(bA,{value:p,onValueChange:_,className:"w-full",children:u(vA,{className:P("h-7 w-full rounded-md border-none",m==="light"?"bg-fill-navy-subtlest":"bg-fill-subtlest"),children:f.map(({key:T,label:E})=>x(yA,{value:T,className:P("typo-compact-xs2-medium flex-1 items-center gap-1 rounded",m==="light"?["text-fg-subtle","data-[state=active]:bg-fill-navy","data-[state=active]:text-white"]:["text-fg-subtle","data-[state=active]:bg-fill-subtler","data-[state=active]:text-fg-default"]),children:[E,C[T]&&u("span",{className:"bg-fill-warning size-1.5 shrink-0 animate-pulse rounded-full","aria-label":g("move.workspace.tab.loadingLabel"),title:g("move.workspace.tab.loadingLabel")})]},T))})})]}),f.map(({key:T,componentModel:E})=>T==="base"?u(Gfe,{robotModel:e,detailRobotModel:e,modelType:"base",gizmoSelectedAssetIds:n,selectionMode:s,isActive:h&&T===p,tabKey:T,onAssetsChange:S,onLoadingChange:k,assetTransformEvent:r,shapeDropRequest:T===p?a:null,onRequestSceneAssetSelect:l,onRequestSceneSelectionChange:c,onAssetLoaded:d},T):u(Gfe,{robotModel:E,detailRobotModel:e,modelType:"tool",mountJointName:T.slice(5),gizmoSelectedAssetIds:n,selectionMode:s,isActive:h&&T===p,tabKey:T,onAssetsChange:S,onLoadingChange:k,assetTransformEvent:r,onRequestSceneAssetSelect:l,onRequestSceneSelectionChange:c,onAssetLoaded:d},T))]})})},{useMutation:Wyt}=await F("@tanstack/react-query"),Hyt="/{robot_model}/call_replay_motion_rec_start",$yt=i=>{const{robot_model:e,...t}=i,n=Hyt.replace("{robot_model}",e);return Dt.post(n,t)},Uyt=()=>Wyt({mutationFn:i=>$yt(i)}),{useMutation:jyt}=await F("@tanstack/react-query"),Gyt="/{robot_model}/call_replay_motion_rec_stop",qyt=i=>{const{robot_model:e}=i,t=Gyt.replace("{robot_model}",e);return Dt.post(t,{})},Kyt=()=>jyt({mutationFn:qyt}),{useMemo:qfe}=await F("react"),Jyt=[{label:"move.menu.options.option.noSave",value:"0"},{label:"move.menu.options.option.realTime",value:"1"},{label:"move.menu.options.option.mileStone",value:"2"}],Yyt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{isUseSimulator:s}=ui(),{selectedRobot:o}=Fi(e),{motionMode:r}=ws(e,C=>({motionMode:C.motionMode})),{mutate:a,isPending:l}=Uyt(),{mutate:c,isPending:d}=Kyt(),{register:h,setValue:g,handleSubmit:m,watch:f,control:p}=he({defaultValues:{mode:0,frequency:1,filename:""}}),_=f("frequency"),b=qfe(()=>r!==0,[r]),v=qfe(()=>b||o?.connected==="DISCONNECT"&&!s,[b,o?.connected,s]),w=(C,N)=>{g(C,N)},y=C=>{a({robot_model:e,mode:Number(C.mode),frequency:Number(C.frequency),filename:C.filename})},S=()=>{c({robot_model:e})};return u("div",{className:P("RecordControl","h-full",i),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:t("move.menu.button.label.record")}),x(U,{className:"w-full gap-4",children:[u(me,{label:t("dashboard.content.mode"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(oe,{name:"mode",control:p,render:({field:C})=>u(ae,{className:"w-full",size:"sm",...C,onChange:N=>C.onChange(N),children:Jyt.map(N=>u(J,{value:N.value,children:t(N.label)},N.label))})})}),u(me,{label:t("move.menu.label.mileStoneFreq"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(Iie,{size:"sm",className:"w-full",type:"nx-number",name:"frequency",handleChange:C=>w("frequency",Number(C)),value:String(_)})}),u(me,{label:t("move.menu.label.fileName"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(et,{size:"sm",className:"w-full",type:"text",inputMode:"text",...h("filename",{onChange:C=>w("filename",C.target.value)})})})]}),x(H,{className:"mt-2 w-full gap-1.5",children:[u(se,{className:"typo-compact-xs-semibold w-full",size:"sm",variant:n==="light"?"danger":"soft",loading:l||d,onClick:S,children:t("move.menu.button.label.recordStop")}),u(se,{className:"typo-compact-xs-semibold w-full",size:"sm",variant:"brand",disabled:v,loading:l||d,onClick:m(y),children:t("move.menu.button.label.recordStart")})]})]})})},{useMutation:Xyt}=await F("@tanstack/react-query"),Qyt="/{robot_model}/call_weld_wire",Zyt=i=>{const{robot_model:e,...t}=i,n=Qyt.replace("{robot_model}",e);return Dt.post(n,t)},ewt=()=>Xyt({mutationFn:Zyt}),{useMutation:twt}=await F("@tanstack/react-query"),nwt="/{robot_model}/call_weld_gas",iwt=i=>{const{robot_model:e,...t}=i,n=nwt.replace("{robot_model}",e);return Dt.post(n,t)},swt=()=>twt({mutationFn:iwt}),{useCallback:rF,useMemo:owt}=await F("react"),rwt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{isUseSimulator:s}=ui(),{selectedRobot:o}=Fi(e),{isMoving:r}=U9({tabType:"joint",tickModeInput:null,robotModel:e}),a=owt(()=>r||o?.connected==="DISCONNECT"&&!s,[r,o?.connected,s]),{mutate:l}=ewt(),{mutate:c}=swt(),d=rF(f=>{l({robot_model:e,direction:f})},[l,e]),h=rF(()=>{l({robot_model:e,direction:0})},[l,e]),g=rF(()=>{c({robot_model:e,gas_onoff:1})},[c,e]),m=rF(()=>{c({robot_model:e,gas_onoff:0})},[c,e]);return u("div",{className:P("WeldControl","h-full",i),children:x(U,{className:P("gap-2 px-3 py-2.5","[&_button>span]:typo-compact-xs-semibold"),children:[u(Ag,{subject:t("move.menu.button.label.weld")}),x(H,{className:"gap-2",children:[u(Dd,{className:"w-full",size:"sm",variant:n==="light"?"outlined":"soft",disabled:a,onButtonDown:()=>d(1),onButtonUp:h,children:t("move.menu.button.label.weldForward")}),u(Dd,{className:"w-full",size:"sm",variant:n==="light"?"outlined":"soft",disabled:a,onButtonDown:()=>d(-1),onButtonUp:h,children:t("move.menu.button.label.weldBackward")})]}),u(Dd,{size:"sm",variant:n==="light"?"brand":"soft",disabled:a,onButtonDown:g,onButtonUp:m,children:t("move.menu.button.label.gasPurge")})]})})},{useMutation:awt}=await F("@tanstack/react-query"),lwt="/{robot_model}/call_calib_tcp_position",cwt=i=>{const{robot_model:e,...t}=i,n=lwt.replace("{robot_model}",e);return Dt.post(n,t)},dwt=()=>awt({mutationFn:i=>cwt(i)}),uwt=({className:i,robotModel:e,jointRef:t,isDisabled:n})=>{const{theme:s}=tt(),{t:o}=q(),{mutate:r,isPending:a}=dwt(),{setValue:l,getValues:c,control:d}=he({defaultValues:{tcpPosition:{joints:[]}}}),{fields:h,append:g,remove:m}=cl({control:d,name:"tcpPosition.joints"}),f=async()=>{g({tar_values:t?.map(_=>Number(_.toFixed(3)))??[0,0,0,0,0,0,0],tar_frame:-1,tar_unit:0})},p=()=>{const _=c().tcpPosition;r({robot_model:e,joints:_.joints})};return x(U,{className:P("TCPPosCalibaration","w-full gap-2.5",i),children:[x(U,{className:"w-full gap-1",children:[x(H,{className:"w-full gap-1.5",children:[u(se,{className:"w-full",size:"xs",variant:"outlined",disabled:n,loading:a,onClick:()=>l("tcpPosition.joints",[]),children:o("settings.button.settingsReset")}),u(se,{className:P("w-full",s==="light"&&"outline-fg-navy text-fg-navy"),size:"xs",variant:s==="light"?"outlined":"soft",disabled:n,loading:a,onClick:()=>f(),children:o("program.button.add")})]}),u(se,{className:"w-full",size:"xs2",variant:"brand",disabled:n||h.length===0,loading:a,onClick:()=>p(),children:o("settings.button.set")})]}),u("div",{className:P("bg-bg-raised flex flex-col justify-center gap-2 rounded-md p-2"),children:u(U,{className:"gap-2",children:u(qr,{list:h,noDataMsg:u(U,{className:"min-h-40 gap-4 py-4",alignItems:"center",justifyContent:"center",children:u("p",{className:"typo-compact-xs-medium text-fg-subtler",children:o("move.menu.calibTCPPos.desc")})}),children:({item:_,index:b})=>x(U,{className:"bg-bg-card gap-0.5 rounded-md px-2.5 py-1.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"text-fg-default typo-compact-xs-semibold",children:`P${b+1}`}),u(Yt,{size:"3xs",variant:"transparent",icon:u(Nb,{className:"size-3"}),onClick:()=>m(b)})]}),u("div",{className:"flex-1",children:u(oe,{control:d,name:`tcpPosition.joints.${b}.tar_values`,render:({field:v})=>u("span",{className:"text-fg-subtle typo-compact-2xs-normal w-full",children:v.value.map(w=>w.toFixed(3)+"º").join(", ")},`j-${b}`)})})]},_.id)})})})]})},{useMutation:hwt}=await F("@tanstack/react-query"),gwt="/{robot_model}/call_calib_tcp_orientation",mwt=i=>{const{robot_model:e,...t}=i,n=gwt.replace("{robot_model}",e);return Dt.post(n,t)},fwt=()=>hwt({mutationFn:i=>mwt(i)}),pwt=[{label:"program.options.frame.global",value:0},{label:"program.options.frame.local",value:1},{label:"program.options.frame.user",value:2}],_wt=({className:i,robotModel:e,isDisabled:t})=>{const{t:n}=q(),{mutate:s,isPending:o}=fwt(),{register:r,getValues:a}=he({defaultValues:{tcpOrientation:{frame_option:0}}}),l=()=>{const c=a().tcpOrientation;s({robot_model:e,frame_option:Number(c.frame_option)})};return u(U,{className:P("TCPOrientCalibration","w-full gap-1",i),children:u(me,{label:n("program.field.option"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:x(H,{className:"w-full gap-1.5",alignItems:"center",children:[u(ae,{className:"w-full flex-1",size:"xs2",...r("tcpOrientation.frame_option",{valueAsNumber:!0}),children:pwt.map(c=>u(J,{value:c.value,children:n(c.label)},c.label))}),u(se,{className:"typo-compact-xs-semibold w-20",size:"xs2",variant:"brand",disabled:t,loading:o,onClick:()=>l(),children:n("settings.button.set")})]})})})},{createContext:bwt,useContext:vwt,useEffect:ywt,useRef:wwt}=await F("react"),CMe=bwt(null),iL=()=>{const i=vwt(CMe);if(!i)throw new Error("ManiSetCommand 내부에서만 사용 가능합니다.");return i},co=(i,e)=>{const{registerSection:t,unregisterSection:n}=iL(),s=wwt(e);s.current=e,ywt(()=>(t(i,()=>s.current()),()=>n(i)),[i,t,n])},Ft={OUT_COLLISION:"OUT_COLLISION",SELF_COLLISION:"SELF_COLLISION",USER_FRAME_SELECTION:"USER_FRAME_SELECTION",FIXED_SPEED:"FIXED_SPEED",TARGET_SHIFT:"TARGET_SHIFT",SPEED_BAR:"SPEED_BAR",TIME_CONSTRAINT:"TIME_CONSTRAINT",ASCII_FUNCTION_CALL:"ASCII_FUNCTION_CALL",JOINT_IMPEDANCE:"JOINT_IMPEDANCE",FREE_DRIVE:"FREE_DRIVE",MASTER_MODE:"MASTER_MODE",USER_FRAME_6DOF:"USER_FRAME_6DOF",USER_FRAME_TCP:"USER_FRAME_TCP",USER_FRAME_3POINTS:"USER_FRAME_3POINTS",TARGET_SHIFT_LANDMARK:"TARGET_SHIFT_LANDMARK",PROGRAM_FLOW_MANAGE:"PROGRAM_FLOW_MANAGE",DIN_FUNCTION_MASK:"DIN_FUNCTION_MASK",DOUT_FUNCTION_MASK:"DOUT_FUNCTION_MASK",JACOBIAN_BASED_SPEED_CONTROL:"JACOBIAN_BASED_SPEED_CONTROL",SELF_VIBRATION_MODE:"SELF_VIBRATION_MODE",VIBRATION_MOTION_BASED:"VIBRATION_MOTION_BASED",EXTERNAL_AXIS_SYNC:"EXTERNAL_AXIS_SYNC",TCP_SPEED_BOUND:"TCP_SPEED_BOUND",MOVE_BREAK_BLOCK:"MOVE_BREAK_BLOCK",JOINT_REFERENCE_FILTER:"JOINT_REFERENCE_FILTER",SELF_COLL_DETECT_BLIND:"SELF_COLL_DETECT_BLIND",JOINT_ORIGIN_CALIBRATION:"JOINT_ORIGIN_CALIBRATION",WRIST_SINGULARITY_MODE:"WRIST_SINGULARITY_MODE",OPERATION_RANGE_CHECK:"OPERATION_RANGE_CHECK",EXTFT_SOFTWARE_NULLING:"EXTFT_SOFTWARE_NULLING"},Cwt=[{label:"program.box.out_collision_detection",value:Ft.OUT_COLLISION},{label:"program.box.self_collision_detection",value:Ft.SELF_COLLISION},{label:"program.box.fixed_speed",value:Ft.FIXED_SPEED},{label:"program.box.speed_bar",value:Ft.SPEED_BAR},{label:"program.box.time_constraint",value:Ft.TIME_CONSTRAINT},{label:"program.box.ascii_function_call",value:Ft.ASCII_FUNCTION_CALL},{label:"program.box.joint_impedance_control",value:Ft.JOINT_IMPEDANCE},{label:"program.box.free_drive_mode",value:Ft.FREE_DRIVE},{label:"program.box.master_mode_selection",value:Ft.MASTER_MODE},{label:"program.box.user_frame_selection",value:Ft.USER_FRAME_SELECTION},{label:"program.box.user_frame_set_via_xyz",value:Ft.USER_FRAME_6DOF},{label:"program.box.user_frame_set_via_tcp",value:Ft.USER_FRAME_TCP},{label:"program.box.user_frame_set_via_3_points",value:Ft.USER_FRAME_3POINTS},{label:"program.box.target_shift_set_via_manual",value:Ft.TARGET_SHIFT},{label:"program.box.target_shift_set_via_landmark",value:Ft.TARGET_SHIFT_LANDMARK},{label:"program.box.program_flow_change",value:Ft.PROGRAM_FLOW_MANAGE},{label:"program.box.digital_input_function_mask",value:Ft.DIN_FUNCTION_MASK},{label:"program.box.digital_output_function_mask",value:Ft.DOUT_FUNCTION_MASK},{label:"program.box.jacobian_based_speed_ctrl",value:Ft.JACOBIAN_BASED_SPEED_CONTROL},{label:"program.box.vibration_torque_based",value:Ft.SELF_VIBRATION_MODE},{label:"program.box.vibration_motion_based",value:Ft.VIBRATION_MOTION_BASED},{label:"program.box.ext_axis_sync",value:Ft.EXTERNAL_AXIS_SYNC},{label:"program.box.tcp_speed_bound",value:Ft.TCP_SPEED_BOUND},{label:"program.box.move_break_block",value:Ft.MOVE_BREAK_BLOCK},{label:"program.box.joint_ref_filter",value:Ft.JOINT_REFERENCE_FILTER},{label:"program.box.self_coll_detect_blind",value:Ft.SELF_COLL_DETECT_BLIND},{label:"program.box.joint_origin_calibration",value:Ft.JOINT_ORIGIN_CALIBRATION},{label:"program.box.wrist_singularity_mode",value:Ft.WRIST_SINGULARITY_MODE},{label:"program.box.operation_range_check",value:Ft.OPERATION_RANGE_CHECK},{label:"program.box.ft_sensor_software_nulling",value:Ft.EXTFT_SOFTWARE_NULLING}],{useMemo:Swt}=await F("react"),jI=[{label:"program.options.user_frame.restore_saved",value:0},{label:"program.options.user_frame.apply_target_temporary",value:1},{label:"program.options.user_frame.save_target_permanently",value:2}],Kfe=[{label:"program.options.frame.global",value:0},{label:"program.options.frame.local",value:1},{label:"program.options.frame.user",value:2}],Jfe=({register:i,fieldKeys:e})=>u(U,{className:"w-full flex-1 gap-4",children:e.map(t=>{const n=t.split("_")[1],s=n.includes("r");return x(H,{className:"gap-2",alignItems:"center",children:[x(H,{className:"typo-compact-xs-semibold w-16 gap-1",children:[u("span",{className:xi[n],children:n.toUpperCase()}),u("span",{className:"text-fg-subtle",children:s?" (deg)":" (mm)"})]}),u(ye,{register:i,name:t})]},t)})}),xwt=({className:i,robotModel:e})=>{const{theme:t}=tt(),{t:n}=q(),{userFrameNameList:s}=iL(),a=(ie(g=>g.showItem)?.args).user_frame_6dof,l=Swt(()=>({user_frame_num:a?.user_frame_num??0,setting_option:a?.setting_option??0,target_frame:a?.target_frame??0,target_x:a?.target_x??0,target_y:a?.target_y??0,target_z:a?.target_z??0,target_rx:a?.target_rx??0,target_ry:a?.target_ry??0,target_rz:a?.target_rz??0}),[a]),{control:c,register:d,getValues:h}=he({values:l});return co(Ft.USER_FRAME_6DOF,()=>{const g=h(),m={...g,target_x:Ce(g.target_x),target_y:Ce(g.target_y),target_z:Ce(g.target_z),target_rx:Ce(g.target_rx),target_ry:Ce(g.target_ry),target_rz:Ce(g.target_rz)},f=`User Frame: Set via XYZ - ${s[g.user_frame_num]}, ${n(jI[g.setting_option].label,{lng:"en"})}, Target Frame: ${n(Kfe[g.target_frame].label,{lng:"en"})}, X: ${m.target_x}mm, Y: ${m.target_y}mm, Z: ${m.target_z}mm, RX: ${m.target_rx}deg, RY: ${m.target_ry}deg, RZ: ${m.target_rz}deg`;return{user_frame_6dof:m,treeName:f}}),x(be,{className:P("SetCmdUserFrame6Dof",i),title:n("program.box.user_frame_set_via_xyz"),children:[x($e,{children:[u(G,{label:n("program.field.user_frame"),children:u(oe,{name:"user_frame_num",control:c,render:({field:g})=>u(ae,{...g,className:"w-full",size:"sm",onChange:m=>{g.onChange(He(m.target.value,0))},children:s.map((m,f)=>u(J,{value:f,children:m},m))})})}),u(G,{label:n("program.field.setting_option"),children:u(oe,{name:"setting_option",control:c,render:({field:g})=>u(ae,{...g,className:"w-full",size:"sm",onChange:m=>{g.onChange(He(m.target.value,0))},children:jI.map((m,f)=>u(J,{value:f,children:n(m.label)},m.label))})})})]}),x(G,{label:n("program.field.target_frame"),className:"pr-5",children:[" ",u(oe,{name:"target_frame",control:c,render:({field:g})=>u(ae,{...g,className:"w-[50%]!",size:"sm",onChange:m=>{g.onChange(He(m.target.value,0))},children:Kfe.map((m,f)=>u(J,{value:f,children:n(m.label)},m.label))})})]}),u("div",{className:P("overflow-hidden rounded-md p-3",t!=="light"&&"bg-bg-alt-1"),children:x(H,{className:"grid grid-cols-2 gap-8",children:[u(Jfe,{register:d,fieldKeys:["target_x","target_y","target_z"]}),u(Jfe,{register:d,fieldKeys:["target_rx","target_ry","target_rz"]})]})})]})},{useMemo:Nwt}=await F("react"),SMe=[{label:"program.options.point_order.origin_x_axis_xy_plane",value:0},{label:"program.options.point_order.origin_y_axis_yz_plane",value:1},{label:"program.options.point_order.origin_z_axis_zx_plane",value:2}],Iwt=["x","y","z"],U8=({register:i,fieldKeys:e,groupNum:t})=>{const{t:n}=q();return x(H,{className:"w-full gap-4",alignItems:"center",children:[x("span",{className:"typo-compact-sm-semibold text-fg-default min-w-16 shrink-0",children:[n("program.button.point")," ",t]}),u("div",{className:"flex min-w-0 flex-1 gap-2",children:e.map((s,o)=>{const r=Iwt[o];return x(U,{className:"min-w-0 flex-1 gap-2",alignItems:"center",children:[x(H,{className:"typo-compact-2xs-semibold w-16 gap-1",children:[u("span",{className:xi[r],children:r.toUpperCase()}),u("span",{className:"text-fg-subtle",children:"(mm)"})]}),u(ye,{register:i,name:s})]},s)})})]})},kwt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{userFrameNameList:s}=iL(),a=(ie(g=>g.showItem)?.args).user_frame_3points,l=Nwt(()=>({user_frame_num:He(a?.user_frame_num,0),setting_option:He(a?.setting_option,0),order_option:He(a?.order_option,0),point_1_x:Ce(a?.point_1_x??""),point_1_y:Ce(a?.point_1_y??""),point_1_z:Ce(a?.point_1_z??""),point_2_x:Ce(a?.point_2_x??""),point_2_y:Ce(a?.point_2_y??""),point_2_z:Ce(a?.point_2_z??""),point_3_x:Ce(a?.point_3_x??""),point_3_y:Ce(a?.point_3_y??""),point_3_z:Ce(a?.point_3_z??"")}),[a]),{control:c,getValues:d,register:h}=he({values:l});return co(Ft.USER_FRAME_3POINTS,()=>{const g=d(),m={...g,point_1_x:Ce(g.point_1_x)||0,point_1_y:Ce(g.point_1_y)||0,point_1_z:Ce(g.point_1_z)||0,point_2_x:Ce(g.point_2_x)||0,point_2_y:Ce(g.point_2_y)||0,point_2_z:Ce(g.point_2_z)||0,point_3_x:Ce(g.point_3_x)||0,point_3_y:Ce(g.point_3_y)||0,point_3_z:Ce(g.point_3_z)||0},f=`User Frame: Set via 3 Points - ${s[m.user_frame_num]}, ${t(jI[m.setting_option].label,{lng:"en"})}`;return{user_frame_3points:m,treeName:f}}),x(be,{className:P("SetCmdUserFrame3Points",i),title:t("program.box.user_frame_set_via_3_points"),children:[x($e,{children:[u(G,{label:t("program.field.user_frame"),children:u(oe,{name:"user_frame_num",control:c,render:({field:g})=>u(ae,{...g,className:"w-full",size:"sm",onChange:m=>{g.onChange(Ce(m.target.value))},children:s.map((m,f)=>u(J,{value:f,children:m},m))})})}),u(G,{label:t("program.field.setting_option"),children:u(oe,{name:"setting_option",control:c,render:({field:g})=>u(ae,{...g,className:"w-full",size:"sm",onChange:m=>{g.onChange(Ce(m.target.value))},children:jI.map((m,f)=>u(J,{value:f,children:t(m.label)},m.label))})})})]}),u(G,{label:t("program.field.point_ordering"),className:"pr-5",children:u(oe,{name:"order_option",control:c,render:({field:g})=>u(ae,{...g,className:"w-[50%]!",size:"sm",onChange:m=>{g.onChange(Ce(m.target.value))},children:SMe.map((m,f)=>u(J,{value:f,children:t(m.label)},m.label))})})}),u("div",{className:P("overflow-hidden rounded-md p-3",n!=="light"&&"bg-bg-alt-1"),children:x(U,{className:"w-full gap-8",children:[u(U8,{register:h,fieldKeys:["point_1_x","point_1_y","point_1_z"],groupNum:1}),u(U8,{register:h,fieldKeys:["point_2_x","point_2_y","point_2_z"],groupNum:2}),u(U8,{register:h,fieldKeys:["point_3_x","point_3_y","point_3_z"],groupNum:3})]})})]})},{useMutation:Lwt}=await F("@tanstack/react-query"),Dwt="/{robot_model}/set_userframe_3points",Twt=i=>{const{robot_model:e,...t}=i,n=Dwt.replace("{robot_model}",e);return Dt.post(n,t)},Ewt=()=>Lwt({mutationFn:i=>Twt(i)}),j8=({targetData:i,register:e,onFieldChange:t,onGetCurrentValues:n,errors:s,isDisabled:o,isPending:r,groupNum:a})=>{const{t:l}=q();return x(U,{className:"w-full gap-2",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[x("span",{className:"typo-compact-xs-semibold text-fg-default min-w-[3rem] shrink-0",children:[l("program.button.point")," ",a]}),u(se,{className:"self-end px-2",size:"2xs",variant:"outlined",disabled:o,loading:r,onClick:()=>n(a),children:l("move.menu.button.get")})]}),u(H,{className:"gap-1.5",alignItems:"center",children:u("div",{className:"flex min-w-0 flex-1 gap-1",children:i.map(c=>x(U,{className:P("min-w-0 flex-1 gap-1",{"pointer-events-none invisible":!c.label}),alignItems:"center",children:[x(H,{className:"typo-compact-2xs-semibold w-[4rem] gap-1",children:[u("span",{className:xi[c.label],children:c.label.toUpperCase()}),u("span",{className:"text-fg-subtle",children:"(mm)"})]}),u(et,{className:"w-full",size:"xs2",type:"nx-number",inputMode:"text",error:!!dt.get(s,c.fieldKey)?.message,...e(c.fieldKey,{validate:d=>Number.isNaN(Number(d))?"This value is invalid":void 0,onChange:d=>{t(c.fieldKey,d.target.value)}})})]},c.label))})})]})},Pwt=({className:i,tcpRef:e,robotModel:t,isDisabled:n,userFrameNameList:s})=>{const{t:o}=q(),{register:r,setValue:a,watch:l,getValues:c,control:d,trigger:h,formState:{errors:g}}=he({defaultValues:{user3Points:{user_frame_num:0,order_option:0,point_1_x:0,point_1_y:0,point_1_z:0,point_2_x:0,point_2_y:0,point_2_z:0,point_3_x:0,point_3_y:0,point_3_z:0}}}),{mutate:m,isPending:f}=Ewt(),p=l("user3Points.order_option"),_=[{label:"x",fieldKey:"user3Points.point_1_x"},{label:"y",fieldKey:"user3Points.point_1_y"},{label:"z",fieldKey:"user3Points.point_1_z"},{label:"x",fieldKey:"user3Points.point_2_x"},{label:"y",fieldKey:"user3Points.point_2_y"},{label:"z",fieldKey:"user3Points.point_2_z"},{label:"x",fieldKey:"user3Points.point_3_x"},{label:"y",fieldKey:"user3Points.point_3_y"},{label:"z",fieldKey:"user3Points.point_3_z"}],b=async w=>{const y=e?.map(S=>Number(S.toFixed(3)));switch(w){case 1:_.slice(0,3).forEach((S,C)=>{a(S.fieldKey,y[C])});break;case 2:_.slice(3,6).forEach((S,C)=>{a(S.fieldKey,y[C])});break;case 3:_.slice(6).forEach((S,C)=>{a(S.fieldKey,y[C])});break}},v=async()=>{const w=c().user3Points;if(!await h("user3Points",{shouldFocus:!0})){rt.openToast({type:"basic",variant:"warning",title:"Invalid value",content:"Please enter valid values"});return}m({robot_model:t,user_frame_num:Number(w.user_frame_num),order_option:Number(w.order_option),setting_option:2,point_1_x:Number(w.point_1_x),point_1_y:Number(w.point_1_y),point_1_z:Number(w.point_1_z),point_2_x:Number(w.point_2_x),point_2_y:Number(w.point_2_y),point_2_z:Number(w.point_2_z),point_3_x:Number(w.point_3_x),point_3_y:Number(w.point_3_y),point_3_z:Number(w.point_3_z)})};return x(U,{className:P("User3PointsCalibration","w-full gap-2.5",i),children:[u(me,{label:o("program.field.user_frame"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(oe,{control:d,name:"user3Points.user_frame_num",render:({field:w})=>u(ae,{className:"w-full",size:"xs2",value:w.value,onChange:y=>{const S=y.target.value;w.onChange(S.trim()===""?0:Number(S)),a("user3Points.user_frame_num",S.trim()===""?0:Number(S))},children:Array.from({length:8},(y,S)=>u(J,{value:S,children:`User ${S} (${s[S]})`},`user-3points-${S}`))})})}),u(me,{label:o("program.field.point_ordering"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(oe,{control:d,name:"user3Points.order_option",render:({field:w})=>u(ae,{className:"w-full",size:"xs2",value:w.value,onChange:y=>{const S=y.target.value;w.onChange(S.trim()===""?0:Number(S)),a("user3Points.order_option",S.trim()===""?0:Number(S))},children:SMe.map((y,S)=>u(J,{value:S,children:o(y.label)},y.label))})})}),u("div",{className:"flex items-center justify-center",children:u("img",{className:"w-50",src:yt(`nexus/move/calibration/option_${p}.png`)})}),u("div",{className:"bg-bg-raised overflow-hidden rounded-md p-3",children:x(U,{className:"w-full gap-0",children:[u(j8,{targetData:_.slice(0,3),register:r,onFieldChange:a,onGetCurrentValues:b,isDisabled:n,errors:g,isPending:f,groupNum:1}),u(_o,{size:1,thickness:"thin",spaceSize:12}),u(j8,{targetData:_.slice(3,6),register:r,onFieldChange:a,onGetCurrentValues:b,isDisabled:n,errors:g,isPending:f,groupNum:2}),u(_o,{size:1,thickness:"thin",spaceSize:12}),u(j8,{targetData:_.slice(6),register:r,onFieldChange:a,onGetCurrentValues:b,isDisabled:n,errors:g,isPending:f,groupNum:3})]})}),u(se,{className:"typo-compact-xs-semibold w-full",size:"sm",variant:"brand",disabled:n,loading:f,onClick:()=>v(),children:o("program.button.save")})]})},{useMutation:Rwt}=await F("@tanstack/react-query"),Mwt="/{robot_model}/set_userframe_tcp",Awt=i=>{const{robot_model:e,...t}=i,n=Mwt.replace("{robot_model}",e);return Dt.post(n,t)},Owt=()=>Rwt({mutationFn:i=>Awt(i)}),Fwt=({className:i,robotModel:e,isDisabled:t,userFrameNameList:n})=>{const{t:s}=q(),{mutate:o,isPending:r}=Owt(),{setValue:a,getValues:l,control:c}=he({defaultValues:{userTCPFrame:{user_frame_num:0}}}),d=()=>{const h=l().userTCPFrame;o({robot_model:e,user_frame_num:Number(h.user_frame_num),setting_option:2})};return u(U,{className:P("UserTCPCalibration","w-full gap-1",i),children:u(me,{label:s("program.field.user_frame"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:x(H,{className:"w-full gap-1.5",alignItems:"center",children:[u(oe,{control:c,name:"userTCPFrame.user_frame_num",render:({field:h})=>u(ae,{className:"w-full",size:"xs2",value:h.value,onChange:g=>{const m=g.target.value;h.onChange(m.trim()===""?0:Number(m)),a("userTCPFrame.user_frame_num",m.trim()===""?0:Number(m))},children:Array.from({length:8},(g,m)=>u(J,{value:m,children:`User ${m} (${n[m]})`},`user-tcp-${m}`))})}),u(se,{className:"typo-compact-xs-semibold w-20",size:"xs2",variant:"brand",disabled:t,loading:r,onClick:()=>d(),children:s("program.button.save")})]})})})},{useMutation:Bwt}=await F("@tanstack/react-query"),Vwt="/{robot_model}/call_extaxis_calib_{command}",zwt=i=>{const{robot_model:e,command:t,...n}=i,s=Vwt.replace("{robot_model}",e).replace("{command}",t);return Dt.post(s,n)},Wwt=()=>Bwt({mutationFn:zwt}),Hwt=({className:i,robotModel:e,isDisabled:t})=>{const{t:n}=q(),{mutate:s,isPending:o}=Wwt(),{setValue:r,getValues:a,control:l}=he({defaultValues:{externalAxis:{joint_no:0}}}),c=d=>{const h=a().externalAxis.joint_no;s({robot_model:e,command:d,joint_no:Number(h)})};return x(U,{className:P("ExternalAxisCalibration","w-full gap-3",i),children:[u(me,{label:n("move.field.label.jointNumber"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(H,{className:"w-full gap-1.5",alignItems:"center",children:u(oe,{control:l,name:"externalAxis.joint_no",render:({field:d})=>u(ae,{className:"w-full",size:"xs2",value:d.value,onChange:h=>{const g=h.target.value;d.onChange(g.trim()===""?0:Number(g)),r("externalAxis.joint_no",g.trim()===""?0:Number(g))},children:Array.from({length:7},(h,g)=>u(J,{value:g,children:`External Axis ${g}`},`ext-axis-${g}`))})})})}),x(U,{className:"gap-1",children:[u(se,{className:"typo-compact-xs-semibold",size:"xs2",variant:"outlined",disabled:t,loading:o,onClick:()=>c("clr"),children:"Calibration Start"}),u(se,{className:"typo-compact-xs-semibold",size:"xs2",variant:"outlined",disabled:t,loading:o,onClick:()=>c("add"),children:"Calibration Add+"}),u(se,{className:"typo-compact-xs-semibold",size:"xs2",variant:"outlined",disabled:t,loading:o,onClick:()=>c("run"),children:"Calibration Finish"})]})]})},{useMemo:$wt}=await F("react"),Yfe=[{label:"move.menu.options.option.tcpPosCalib",value:"tcp_pos"},{label:"move.menu.options.option.tcpOriCalib",value:"tcp_ori"},{label:"move.menu.options.option.user3Points",value:"user_3points"},{label:"move.menu.options.option.userTCPFrame",value:"user_tcp"},{label:"move.menu.options.option.extAxis",value:"ext_axis"}],Uwt=({className:i,robotModel:e,userFrameNameList:t})=>{const{t:n}=q(),{selectedRobot:s}=Fi(e),{motionMode:o,jointQRef:r,carteXRef:a}=ws(e,p=>({motionMode:p.motionMode,jointQRef:p.jointQRef,carteXRef:p.carteXRef})),{register:l,setValue:c,watch:d,clearErrors:h}=he({defaultValues:{mode:Yfe[0].value}}),g=d("mode"),m=$wt(()=>o!==0||s?.connected==="DISCONNECT",[o,s?.connected]),f=(p,_)=>{c(p,_),h()};return x("div",{className:P("CalibrationControl","h-full px-3",i),children:[u("div",{className:"sticky top-0 z-10",children:u(Ag,{className:"pt-2",subject:n("move.menu.button.label.calibration")})}),x(U,{className:"gap-2 pb-3",children:[u(ae,{className:"w-full",size:"sm",...l("mode",{onChange:p=>f("mode",p.target.value)}),children:Yfe.map(p=>u(J,{value:p.value,children:n(p.label)},p.label))}),g==="tcp_pos"&&u(uwt,{jointRef:r,robotModel:e,isDisabled:m}),g==="tcp_ori"&&u(_wt,{robotModel:e,isDisabled:m}),g==="user_3points"&&u(Pwt,{tcpRef:a,robotModel:e,isDisabled:m,userFrameNameList:t}),g==="user_tcp"&&u(Fwt,{robotModel:e,isDisabled:m,userFrameNameList:t}),g==="ext_axis"&&u(Hwt,{robotModel:e,isDisabled:m})]})]})},{useMemo:aF}=await F("react"),jwt=["translate","rotate","surfaceTeach"],hoe=i=>{const{data:e}=Ph(),t=aF(()=>e?.urdfFileName?.replace(/\.urdf$/,"")??"",[e]),n=aF(()=>e?.components?.[i]?.tcpJointName??[],[e,i]),s=aF(()=>/^rby/i.test(t)?n:void 0,[t,n]),o=aF(()=>TPe(i,e?.components)??void 0,[e,i]),r=(o?.length??0)>=6&&n.length>0,a=/^rby/i.test(t)&&n.length===0&&(o?.length??0)>0;return{detailRobotModel:t,tcpJointNames:n,ghostActiveTcpAnchors:s,ghostDraggableJointNames:o,isGhostRobotSupported:r,isJointOnlyGhost:a,disabledGizmoTypes:a?jwt:void 0}},{useCallback:Xfe,useState:AD}=await F("react"),goe=()=>{const[i,e]=AD(!1),[t,n]=AD("translate"),[s,o]=AD("local"),[r,a]=AD(.7),[l,c]=AD({x:!0,y:!0,z:!0}),d=Xfe((g,m)=>{c(f=>({...f,[g]:m}))},[]),h=Xfe(g=>{n(m=>m===g?"none":g)},[]);return{isGhostRobot:i,setIsGhostRobot:e,gizmoType:t,handleGizmoTypeChange:h,gizmoSpace:s,setGizmoSpace:o,gizmoSize:r,setGizmoSize:a,axisEnabled:l,handleAxisEnabledChange:d}},{useCallback:Gwt,useState:qwt}=await F("react"),moe=i=>{const[e,t]=qwt(),n=Gwt(s=>t(s),[]);return{ghostJointValues:i?e:void 0,handleGhostRobotJointsChanged:n}},{useCallback:Kwt}=await F("react"),foe=({gizmo:i,ghostRobotIK:e,isMoving:t,gizmoType:n=i.gizmoType,onGizmoTypeChange:s=i.handleGizmoTypeChange,activeTcpAnchors:o,draggableJointNames:r,onGhostRobotJointsChanged:a})=>{const{setIsGhostRobot:l}=i,{handleGhostRobotChange:c}=e,d=Kwt(h=>{l(h),c(h)},[l,c]);return{viewerProps:{showGhostRobot:i.isGhostRobot,ghostRobotTcpOffset:e.ghostRobotTcpOffset,ghostRobotIkOptions:e.ghostRobotIkOptions,ghostRobotActiveTcpAnchors:o,ghostRobotDraggableJointNames:r,ghostRobotGizmoType:n,ghostRobotGizmoSpace:i.gizmoSpace,ghostRobotGizmoSize:i.gizmoSize,ghostRobotAxisEnabled:i.axisEnabled,onIKDragMove:e.handleIKDragMove,onRobotDraggingChanged:e.handleRobotDraggingChanged,onGhostRobotJointsChanged:a},itemProps:{isMoving:t,isGhostRobot:i.isGhostRobot,onGhostRobotChange:d,gizmoType:n,onGizmoTypeChange:s,gizmoSpace:i.gizmoSpace,onGizmoSpaceChange:i.setGizmoSpace,gizmoSize:i.gizmoSize,onGizmoSizeChange:i.setGizmoSize,axisEnabled:i.axisEnabled,onAxisEnabledChange:i.handleAxisEnabledChange,onReset:e.handleGhostRobotReset,onUndo:e.handleGhostRobotUndo,canUndo:e.canUndo,onRedo:e.handleGhostRobotRedo,canRedo:e.canRedo}}},{useCallback:G8,useLayoutEffect:Jwt,useMemo:Qfe,useState:lF}=await F("react"),Ywt=({urdfViewerRef:i,isGhostRobot:e,gizmoType:t})=>{const{t:n}=q(),[s,o]=lF(!1),[r,a]=lF("free"),[l,c]=lF(!1),[d,h]=lF(!0),g=G8(()=>{rt.openToast({type:"basic",variant:"warning",title:"Warning",content:n("move.ghostRobot.surface.unreachable")})},[n]),m=G8(()=>{if(!e||t!=="surfaceTeach")return;const w=i.current?.getSurfaceFeatureSupport()??!1;c(w),i.current?.setSurfaceTeachFilter(r)},[e,t,r,i]);Jwt(()=>{if(!e||t!=="surfaceTeach"){c(!1);return}m()},[e,t,m]);const f=G8(w=>{a(w),i.current?.setSurfaceTeachFilter(w)},[i]),p=e&&t==="surfaceTeach"&&r==="cylinder",_=p&&d,b=Qfe(()=>({onSurfaceTeachAvailableChange:o,surfaceTeachFilter:r,surfaceTeachShowRings:_,onSurfaceTeachUnreachable:g}),[r,_,g]),v=Qfe(()=>({surfaceTeachAvailable:s,surfaceFilter:r,onSurfaceFilterChange:f,surfaceFeatureSupport:l,surfaceShowRings:_,surfaceShowRingsAvailable:p,onSurfaceShowRingsChange:h}),[s,r,f,l,_,p]);return{viewerProps:b,itemProps:v,handleCheckFeatureSupport:m}},KS=({className:i,title:e,currentSignal:t,functionSignal:n,targetSignal:s,onClick:o,onPreview:r})=>{const{t:a}=q(),l=c=>{n&&n[c]!==0||o(c)};return x(U,{className:P("MoveDigitalIOSignal","gap-2.5",i),children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:e}),u(me,{label:a("move.menu.title.currentSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(H,{className:"grid grid-cols-16 gap-1",children:Array.from({length:16}).map((c,d)=>x(U,{className:"w-full gap-1",alignContent:"center",children:[u("span",{className:"typo-compact-xs-medium text-fg-subtler text-center",children:d}),u("div",{className:P("size-3 self-center rounded-[50%]",{"bg-fg-subtler":t[d]===-1,"bg-fg-danger":t[d]===0,"bg-fg-success":t[d]===1})})]},`${e}-curr-${d}`))})}),s&&u(me,{label:a("move.menu.title.targetSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:x(U,{className:"gap-2.5",children:[u(H,{className:"grid grid-cols-16 gap-1",children:Array.from({length:16}).map((c,d)=>u(se,{className:P("size-3 justify-self-center rounded-[50%] border-none !p-0",{"bg-fg-subtler":s[d]===-1,"bg-fg-danger":s[d]===0,"bg-fg-success":s[d]===1,"pointer-none bg-fg-caution":n&&n[d]!==0},{"hover:bg-fg-subtler/80":s[d]===-1,"hover:bg-fg-danger/80":s[d]===0,"hover:bg-fg-success/80":s[d]===1,"pointer-none bg-fg-caution":n&&n[d]!==0}),onClick:()=>l(d),children:""},`${e}-editable-${d}`))}),u(se,{className:"w-25 self-end",size:"xs2",leadingIcon:u(at,{className:"size-4"}),variant:"outlined",onClick:r,children:a("program.button.preview")})]})})]})},{useMutation:Xwt}=await F("@tanstack/react-query"),Qwt=async i=>{const{robot_model:e,location:t,...n}=i,s=`/${e}/call_multiple_${t}_aout`;return await Dt.post(s,n)},xMe=()=>Xwt({mutationFn:async i=>Qwt(i)}),OD=({className:i,title:e,currentSignal:t,targetSignal:n,onChange:s,onPreview:o,isChecked:r,onCheckedChange:a})=>{const{t:l}=q();return x(U,{className:P("MoveAnalogIOSignal","gap-2.5",i),children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:e}),u(me,{label:l("move.menu.title.currentSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(H,{className:"grid grid-cols-4 gap-1",children:t.map((c,d)=>x(U,{alignItems:"flex-start",justifyContent:"center",className:"w-full gap-1",children:[u("span",{className:"typo-compact-xs-medium text-fg-subtle w-full shrink-0 px-1 text-center",children:d}),u(et,{size:"xs2",className:"w-full",value:c.toFixed(1),readOnly:!0})]},`${e}-curr-${d}`))})}),n&&u(me,{label:l("move.menu.title.targetSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:x(U,{className:"gap-2.5",children:[u(H,{className:"grid grid-cols-4 gap-1",children:Array.from({length:4}).map((c,d)=>{const h=r[d];return x(U,{className:"w-full gap-1",justifyContent:"center",alignItems:"center",children:[u(et,{size:"xs2",className:"w-full",type:"nx-number",value:n[d]===-1?"":n[d],disabled:!r[d],onChange:g=>s(g,d)}),u(ia,{size:"sm",checkValue:!0,value:h,handleChange:g=>{a(!!g,d)}})]},`${e}-editable-${d}`)})}),u(se,{className:"w-25 self-end",size:"xs2",leadingIcon:u(at,{className:"size-4"}),variant:"outlined",onClick:o,children:l("program.button.preview")})]})})]})},{useMemo:Zfe,useState:q8}=await F("react"),epe=[{label:"move.menu.tab.lable.controlBox",value:"cb"},{label:"settings.menu.title.tool",value:"tool"},{label:"move.menu.tab.lable.extBoard",value:"ext"}],Hp=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],JS=[-1,-1,-1,-1],Zwt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{cboxDigitalInput:s,cboxDigitalOutput:o,cboxAnalogInput:r,cboxAnalogOutput:a,toolDigitalInput:l,toolDigitalOutput:c,toolAnalogInput:d,toolVoltageOutput:h,exDigitalInput:g,exDigitalOutput:m,exAnalogInput:f,exAnalogOutput:p}=ws(e,_e=>({cboxDigitalInput:_e.cboxDigitalInput,cboxDigitalOutput:_e.cboxDigitalOutput,cboxAnalogInput:_e.cboxAnalogInput,cboxAnalogOutput:_e.cboxAnalogOutput,toolDigitalInput:_e.toolDigitalInput,toolDigitalOutput:_e.toolDigitalOutput,toolAnalogInput:_e.toolAnalogInput,toolVoltageOutput:_e.toolVoltageOutput,exDigitalInput:_e.exDigitalInput,exDigitalOutput:_e.exDigitalOutput,exAnalogInput:_e.exAnalogInput,exAnalogOutput:_e.exAnalogOutput})),{data:_}=Ou({robot_model:e}),{mutate:b}=Kse(),{mutate:v}=xMe(),{mutate:w}=ZPe(),{mutate:y}=QPe(),[S,C]=q8(epe[0].value),{control:N,setValue:k,getValues:L}=he({defaultValues:{cbTargetDout:Hp,cbTargetAout:JS,toolTargetDout:Hp,toolTargetVoltage:-1,extTargetDout:Hp,extTargetAout:JS}}),D=Ul({control:N,name:"cbTargetDout"}),T=Ul({control:N,name:"cbTargetAout"}),E=Ul({control:N,name:"toolTargetDout"}),R=Ul({control:N,name:"toolTargetVoltage"}),A=Ul({control:N,name:"extTargetDout"}),M=Ul({control:N,name:"extTargetAout"}),[O,B]=q8(T.map(_e=>_e!==-1)),[z,Y]=q8(M.map(_e=>_e!==-1)),$=Zfe(()=>({cbFunctionDout:_?.doutSpecialFunc?.b??Array(16).fill(0),cbFunctionDin:_?.dinSpecialFunc?.b??Array(16).fill(0),extFunctionDout:_?.eoutSpecialFunc?.b??Array(16).fill(0),extFunctionDin:_?.einSpecialFunc?.b??Array(16).fill(0)}),[_]),Z=Zfe(()=>({cbCurrDin:s?.u??Hp,cbCurrDout:o?.u??Hp,cbCurrAin:r?.f??JS,cbCurrAout:a?.f??JS,toolCurrDin:l?.u??Hp,toolCurrDout:c?.u??Hp,toolCurrAin:d?.f??[-1,-1],toolCurrVoltage:h??-1,extCurrDin:g?.u??Hp,extCurrDout:m?.u??Hp,extCurrAin:f?.f??JS,extCurrAout:p?.f??JS}),[o?.u,s?.u,r?.f,a?.f,l?.u,c?.u,d?.f,h,g?.u,m?.u,f?.f,p?.f]),K=(_e,Le)=>{B(Ie=>{const Te=[...Ie];return Te[Le]=_e,Te}),k(`cbTargetAout.${Le}`,_e?Z.cbCurrAout[Le]:-1)},V=(_e,Le)=>{Y(Ie=>{const Te=[...Ie];return Te[Le]=_e,Te}),k(`extTargetAout.${Le}`,_e?Z.extCurrAout[Le]:-1)},fe=(_e,Le)=>{b({robot_model:e,location:_e,side_dout_args:OB(Le)})},Q=_e=>{w({robot_model:e,flange_dout_args:OB(_e)})},re=_e=>{y({robot_model:e,desired_voltage:_e})},ve=(_e,Le,Ie)=>{const Te=Le.reduce((lt,it,Ct)=>(Ie[Ct]&&lt.push({port_num:Ct,desired_voltage:Number(it.toFixed(1))}),lt),[]);v({robot_model:e,location:_e,side_aout_args:Te})};return u("div",{className:P("ManipulateIOControl","h-full",i),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:t("settings.menu.title.io")}),x(bA,{defaultValue:S,className:"flex h-full gap-0",children:[u("div",{className:"h-full flex-1 overflow-y-auto",children:u("div",{className:"sticky top-0 left-0 z-[2] mb-2.5",children:u("div",{children:u(vA,{className:P("h-7 w-full rounded-md border-none",n==="light"?"bg-fill-navy-subtlest":"bg-fill-subtlest"),children:epe.map((_e,Le)=>u(yA,{value:_e.value,className:P("typo-compact-xs2-medium rounded",n==="light"?["text-fg-subtle","data-[state=active]:bg-fill-navy","data-[state=active]:text-white"]:["text-fg-subtle","data-[state=active]:bg-fill-subtler","data-[state=active]:text-fg-default"]),onClick:()=>{C(_e.value)},children:t(_e.label)},Le))})})})}),u(ZC,{value:"cb",className:"w-full",children:x(U,{className:"gap-2.5",children:[u(KS,{title:t("move.menu.label.digitalInput",{loc:t("program.options.d.output_location.side")}),currentSignal:Z.cbCurrDin,functionSignal:$.cbFunctionDin}),u(oe,{control:N,name:"cbTargetDout",render:({field:_e})=>u(KS,{title:t("move.menu.label.digitalOutput",{loc:t("program.options.d.output_location.side")}),currentSignal:Z.cbCurrDout,functionSignal:$.cbFunctionDout,targetSignal:D,onClick:Le=>{const Ie=[..._e.value];Ie[Le]=o4[_e.value[Le]],k("cbTargetDout",Ie,{shouldDirty:!0,shouldValidate:!0})},onPreview:()=>{const Le=L();fe("side",Le.cbTargetDout)}})}),u(_o,{}),u(OD,{title:t("move.menu.label.analogInput",{loc:t("program.options.d.output_location.side")}),currentSignal:Z.cbCurrAin}),u(oe,{control:N,name:"cbTargetAout",render:({field:_e})=>u(OD,{title:t("move.menu.label.analogOutput",{loc:t("program.options.d.output_location.side")}),currentSignal:Z.cbCurrAout,targetSignal:T,isChecked:O,onCheckedChange:K,onChange:(Le,Ie)=>{const Te=Le.target.value,lt=Te.trim()===""?-1:Number(Te),it=[..._e.value||[]];it[Ie]=lt,_e.onChange(it)},onPreview:()=>{const Le=L();ve("side",Le.cbTargetAout,O)}})})]})}),u(ZC,{value:"tool",className:"w-full",children:x(U,{className:"gap-2.5",children:[u(KS,{title:t("move.menu.label.digitalInput",{loc:t("settings.menu.title.tool")}),currentSignal:Z.toolCurrDin}),u(oe,{control:N,name:"toolTargetDout",render:({field:_e})=>u(KS,{title:t("move.menu.label.digitalOutput",{loc:t("settings.menu.title.tool")}),currentSignal:Z.toolCurrDout,targetSignal:E,onClick:Le=>{const Ie=[..._e.value];Ie[Le]=o4[_e.value[Le]],k("toolTargetDout",Ie,{shouldDirty:!0,shouldValidate:!0})},onPreview:()=>{const Le=L();Q(Le.toolTargetDout)}})}),u(_o,{}),u(OD,{title:t("move.menu.label.analogInput",{loc:t("settings.menu.title.tool")}),currentSignal:Z.toolCurrAin}),x(U,{className:"gap-2.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:`${t("move.menu.label.toolVoltageOutput")} (V)`}),u(me,{label:t("move.menu.title.currentSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(et,{size:"xs2",className:"w-[calc(100%-104px)]",value:Z.toolCurrVoltage,readOnly:!0})}),u(me,{label:t("move.menu.title.targetSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:x(H,{className:"gap-1",children:[u(oe,{control:N,name:"toolTargetVoltage",render:({field:_e})=>u(ae,{className:"flex-1",size:"xs2",value:_e.value,onChange:_e.onChange,children:AB.map(Le=>u(J,{value:Le.value,children:Le.label},Le.value))})}),u(se,{className:"w-25 self-end",size:"xs2",leadingIcon:u(at,{className:"size-4"}),variant:"outlined",onClick:()=>re(R),children:t("program.button.preview")})]})})]})]})}),u(ZC,{value:"ext",className:"w-full",children:x(U,{className:"gap-2.5",children:[u(KS,{title:t("move.menu.label.digitalInput",{loc:t("program.options.d.output_location.ext")}),currentSignal:Z.extCurrDin,functionSignal:$.extFunctionDin}),u(oe,{control:N,name:"extTargetDout",render:({field:_e})=>u(KS,{title:t("move.menu.label.digitalOutput",{loc:t("program.options.d.output_location.ext")}),currentSignal:Z.extCurrDout,functionSignal:$.extFunctionDout,targetSignal:A,onClick:Le=>{const Ie=[..._e.value];Ie[Le]=o4[_e.value[Le]],k("extTargetDout",Ie,{shouldDirty:!0,shouldValidate:!0})},onPreview:()=>{const Le=L();fe("ext",Le.extTargetDout)}})}),u(_o,{}),u(OD,{title:t("move.menu.label.analogInput",{loc:t("program.options.a.output_location.ext")}),currentSignal:Z.extCurrAin}),u(oe,{control:N,name:"extTargetAout",render:({field:_e})=>u(OD,{title:t("move.menu.label.analogOutput",{loc:t("program.options.a.output_location.ext")}),currentSignal:Z.extCurrAout,targetSignal:M,isChecked:z,onCheckedChange:V,onChange:(Le,Ie)=>{const Te=Le.target.value,lt=Te.trim()===""?-1:Number(Te),it=[..._e.value||[]];it[Ie]=lt,_e.onChange(it)},onPreview:()=>{const Le=L();ve("ext",Le.extTargetAout,z)}})})]})})]})]})})},{useMemo:eCt}=await F("react"),tCt=({className:i,robotModel:e,mode:t="real",onChangeMode:n})=>{const{t:s}=q(),{selectedRobot:o}=Fi(e),{theme:r}=tt(),a=eCt(()=>o?.connected==="DISCONNECT",[o]),l=c=>{n(c)};return x("div",{className:P("MoveControlModeSwitch","bg-bg-alt-1 inline-flex w-fit gap-1 rounded-md p-1","[&_button]:typo-compact-xs-medium [&_button]:bg-fill-transparent [&_button]:h-5 [&_button]:min-w-[4.125rem] [&_button]:rounded-sm [&_button]:px-1.5 [&_button]:py-0.5 [&_button]:text-white",i),children:[u(se,{className:P({"!bg-fill-navy":t==="real",[r==="light"&&"!text-fg-subtlest"]:t!=="real"}),variant:"transparent",disabled:a,onClick:()=>l("real"),children:s("move.button.label.real")}),u(se,{className:P({[r==="light"&&"!text-fg-subtlest"]:t!=="simulation",[r==="light"?"!bg-orange-500":"!bg-fill-subtler"]:t==="simulation",[r==="light"&&"!bg-orange-200"]:a&&t==="simulation"}),variant:"transparent",disabled:a,onClick:()=>l("simulation"),children:s("move.button.label.simulation")})]})},{useMemo:tpe}=await F("react"),NMe=({className:i,robotModel:e,isShowEdit:t=!0,size:n="md"})=>{const{t:s}=q(),{isUseSimulator:o}=ui(),{modal:r}=Vi(),{selectedRobot:a}=Fi(e),{toolName:l,motionMode:c}=ws(e,f=>({toolName:f?.toolName,motionMode:f?.motionMode})),{data:d}=uw({robot_model:e}),h=tpe(()=>c!==0,[c]),g=tpe(()=>{const f=Object.values(d??[]),p=f.findIndex(_=>_.toolName===l);return p!==-1?{...f[p],toolNumber:p}:null},[l,d]),m=()=>{r({component:sMe,props:{robotModel:e,selectedToolNumber:g?.toolNumber,isUseSimulator:o}})};return u("div",{className:P("TCPToolInfo","w-fit",i),children:x(H,{className:P("gap-1.5",{"typo-compact-xs2-medium":n==="md","typo-compact-2xs-medium":n==="sm"}),inline:!0,alignItems:"center",children:[u("span",{className:"text-fg-subtle",children:`${s("move.menu.button.label.tcpTool")}: `}),u("span",{className:"text-fg-default",children:g?`Tool ${g.toolNumber} (${g.toolName})`:"-"}),t&&u(Yt,{"data-testId":"tcp-tool-select-button",className:"ml-0.5",variant:"transparent",size:"sm",disabled:a?.connected==="DISCONNECT"||h,onClick:m,children:u(Oie,{})})]})})},{useMemo:npe}=await F("react"),IMe=({className:i,robotModel:e,isShowEdit:t=!0,size:n="md"})=>{const{t:s}=q(),{modal:o}=Vi(),{selectedRobot:r}=Fi(e),{userfSelectionNo:a,motionMode:l}=ws(e,m=>({userfSelectionNo:m?.userfSelectionNo,motionMode:m?.motionMode})),{data:c}=Xk({robot_model:e}),d=npe(()=>l!==0,[l]),h=npe(()=>c?.user_frames[a]?.userfName,[c,a]),g=()=>{o({component:OPe,props:{robotModel:e,selectedUserFrameNumber:a}})};return u("div",{className:P("UserFrameInfo","w-fit",i),children:x(H,{className:P("gap-1.5",{"typo-compact-xs2-medium":n==="md","typo-compact-2xs-medium":n==="sm"}),inline:!0,alignItems:"center",children:[u("span",{className:"text-fg-subtle",children:`${s("program.options.coordinate.user_space")}: `}),u("span",{className:"text-fg-default",children:c?`User ${a} (${h})`:"-"}),t&&u(Yt,{"data-testId":"user-frame-select-button",className:"ml-0.5",variant:"transparent",size:"sm",disabled:r?.connected==="DISCONNECT"||d,onClick:g,children:u(Oie,{})})]})})},{useCallback:nCt,useState:qB}=await F("react"),iCt=({className:i,isDrawTrajectory:e,maxAgeSeconds:t,onDrawTrajectoryChange:n})=>{const{t:s}=q(),o=e!==void 0,[r,a]=qB(!1),l=o?e:r,[c,d]=qB(t??""),h=f=>{d(f)},g=()=>{const f=Number(c);if(isNaN(f)||!f){d("");return}n?.({maxAgeSeconds:f}),d(f)},m=nCt(f=>{o||a(f),n?.({isDrawTrajectory:f})},[o,n]);return x(G9,{className:P("DrawTrajectoryController gap-2 px-3 py-2.5",i),children:[x(H,{className:"text-fg-default typo-compact-xs-semibold gap-1",alignItems:"center",justifyContent:"space-between",children:[u("p",{className:"typo-compact-xs-semibold text-fg-default",children:"Trajectory Drawing"}),u(tr,{className:"mx-1",checked:l,onCheckedChange:m})]}),x("div",{className:"text-fg-subtle typo-compact-xs-normal grid w-full grid-cols-[1fr_auto] items-center gap-x-1 gap-y-0.5",children:[u(et,{className:P("w-50"),size:"xs2",type:"nx-number",useSetButton:!0,hideBtnReset:!0,disabled:!l,value:c??0,handleChange:h,onBlur:g}),u("span",{className:"typo-compact-xs-semibold",children:s("common.unit.seconds")}),u("p",{className:"typo-compact-2xs-normal col-span-2",children:s("move.trajectory.description")})]})]})},kMe=({handleChangeDrawTrajectory:i})=>{const{t:e}=q(),[t,n]=qB(!1),[s,o]=qB(""),r=a=>{a.isDrawTrajectory!==void 0&&n(a.isDrawTrajectory),a.maxAgeSeconds!==void 0&&o(a.maxAgeSeconds),i(a)};return u(j9,{id:"trajectory-tooltip",label:e("move.panel.trajectory"),icon:u(zJe,{className:"relative z-10 h-4 w-4"}),isActive:t,children:u(iCt,{isDrawTrajectory:t,maxAgeSeconds:s,onDrawTrajectoryChange:r})})},sCt=[{id:"center",labelKey:"move.measure.mode.center"},{id:"min",labelKey:"move.measure.mode.min"}],oCt=({label:i,ariaLabel:e,emptyPrompt:t,assetId:n,name:s,onDeselect:o,disabled:r})=>{const{slotBgCls:a}=hw();return x(U,{className:"gap-1",children:[u("p",{className:"typo-compact-2xs-semibold text-fg-disabled",children:i}),n?x(H,{alignItems:"center",justifyContent:"space-between",className:P("border-border-subtle gap-1.5 rounded border px-2 py-1.5",a),children:[u(AKe,{className:"text-fg-subtle size-3.5 shrink-0"}),u("span",{className:"typo-compact-xs-medium text-fg-default min-w-0 flex-1 truncate",children:s}),u("button",{type:"button","aria-label":e,disabled:r,onClick:()=>o(n),className:"text-fg-subtle hover:text-fg-default disabled:text-fg-disabled cursor-pointer rounded p-0.5 transition-colors disabled:cursor-not-allowed",children:u(Eje,{className:"size-3.5"})})]}):u("div",{className:"border-border-subtle text-fg-disabled typo-compact-2xs-normal flex items-center justify-center rounded border border-dashed px-2 py-1.5 text-center",children:t})]})},rCt=({isMeasureActive:i,onMeasureActiveChange:e,selectedAssetIds:t=[],onDeselectAsset:n,measureMode:s,onMeasureModeChange:o,measureResult:r,onReset:a,getAssetName:l,labelScale:c,onLabelScaleChange:d,className:h,disabled:g=!1})=>{const{t:m}=q(),f=p=>l?.(p)||p;return x(G9,{className:P("MeasureDistanceController",h),children:[x(H,{alignItems:"center",justifyContent:"space-between",className:"px-3 pt-2.5 pb-2",children:[x(U,{className:"gap-0.5",children:[u("p",{className:"typo-compact-xs-semibold text-fg-default",children:m("move.measure.title")}),u("p",{className:"typo-compact-2xs-normal text-fg-subtle",children:m("move.measure.activate")})]}),u(tr,{className:"ml-2 shrink-0",checked:i,disabled:g,onCheckedChange:e})]}),u($f,{children:u(U,{className:"gap-2",children:[{label:m("move.measure.target1"),emptyPrompt:m("move.measure.selectFirstPrompt")},{label:m("move.measure.target2"),emptyPrompt:m("move.measure.selectSecondPrompt")}].map(({label:p,emptyPrompt:_},b)=>{const v=t[b];return u(oCt,{label:p,ariaLabel:`${p} ${m("common.button.cancel")}`,emptyPrompt:_,assetId:v,name:v?f(v):"",onDeselect:n,disabled:g},b)})})}),i&&u($f,{children:u(FPe,{options:sCt.map(({id:p,labelKey:_})=>({id:p,label:m(_)})),value:s,onChange:p=>o(p),disabled:g})}),i&&u($f,{children:x(U,{className:"gap-1.5",children:[x(H,{alignItems:"center",justifyContent:"space-between",children:[u("p",{className:"typo-compact-2xs-semibold text-fg-subtle",children:"Label Size"}),u("span",{className:"typo-compact-2xs-normal text-fg-subtle w-8 shrink-0 text-right",children:c.toFixed(1)})]}),u(Ms,{className:"w-full",min:fPe,max:pPe,step:.1,value:[c],disabled:g,onValueChange:([p])=>d(p)})]})}),i&&t.length>=2&&r&&u($f,{children:x(U,{className:"gap-0.5",children:[u("span",{className:"typo-compact-2xs-semibold text-fg-subtle",children:m(s==="min"?"move.measure.mode.min":"move.measure.mode.center")}),x("span",{className:"typo-compact-md-semibold text-fg-default font-bold",children:[r.distance.toFixed(2)," mm"]})]})}),u($f,{children:u(se,{size:"xs",variant:"outlined",className:"w-full",disabled:g||t.length===0,onClick:a,leadingIcon:u(BJe,{className:"size-3.5"}),children:m("move.measure.reset")})})]})},aCt=({isMoving:i,isMeasureActive:e,onMeasureActiveChange:t,selectedAssetIds:n,onDeselectAsset:s,measureMode:o,onMeasureModeChange:r,measureResult:a,onReset:l,getAssetName:c,labelScale:d,onLabelScaleChange:h,className:g})=>{const{t:m}=q();return u(j9,{id:"measure-distance-tooltip",label:m("move.panel.measureDistance"),icon:u(jDe,{className:"relative z-10 h-4 w-4"}),isActive:e,disabled:i,anchorToPanelTop:!0,children:u(rCt,{isMeasureActive:e,onMeasureActiveChange:t,selectedAssetIds:n,onDeselectAsset:s,measureMode:o,onMeasureModeChange:r,measureResult:a,onReset:l,getAssetName:c,labelScale:d,onLabelScaleChange:h,className:g,disabled:i})})},{useCallback:ipe,useMemo:lCt,useRef:cCt,useState:dCt}=await F("react"),LMe=()=>{const[i,e]=dCt(!1),t=cCt(null),n=ipe(o=>{t.current=o},[]),s=ipe(o=>{t.current?.(o)},[]);return lCt(()=>({isActive:i,setIsActive:e,onPick:s,setPickHandler:n}),[i,s,n])},{useCallback:YS,useEffect:cF,useRef:uCt,useState:dF}=await F("react"),hCt=1e3,gCt=i=>i?i.replace(/^(?:base|tool):/,"").replace(/^local:/,""):"",mCt=({urdfViewerRef:i,baseAssets:e=[],toolAssets:t=[],picker:n})=>{const s=LMe(),o=n??s,{isActive:r,setIsActive:a}=o,[l,c]=dF([]),[d,h]=dF("center"),[g,m]=dF(null),[f,p]=dF(H9),_=YS(k=>{p(k),i.current?.setMeasureLabelScale(k)},[i]),b=uCt(!1),v=YS(k=>{k&&c(L=>L.includes(k)?L.filter(D=>D!==k):L.length>=2?[L[L.length-1],k]:[...L,k])},[]),{setPickHandler:w}=o;cF(()=>(w(v),()=>w(null)),[w,v]);const y=YS(k=>{c(L=>L.filter(D=>D!==k))},[]),S=YS(()=>{c([]),m(null),i.current?.clearMeasureDistance(),r&&i.current?.setSelectedAssetIds([],!0)},[i,r]),C=YS(k=>{r&&m(k)},[r]),N=YS(k=>{const L=e.find(D=>D.id===k)??t.find(D=>D.id===k);return L?.displayName?.trim()?L.displayName:gCt(k)},[e,t]);return cF(()=>{if((e.length>0||t.length>0)&&(b.current=!0),!b.current)return;const k=window.setTimeout(()=>{const L=new Set([...e.map(D=>D.id),...t.map(D=>D.id)]);c(D=>{const T=D.filter(E=>L.has(E));return T.length===D.length?D:T})},hCt);return()=>window.clearTimeout(k)},[e,t]),cF(()=>{const k=i.current;if(k?.setMeasureDistanceActive(r),!!r)return()=>{k?.setSelectedAssetIds([],!1),k?.clearAssetSelection?.(),c([]),m(null)}},[r,i]),cF(()=>{if(!r)return;const k=i.current;k?.setSelectedAssetIds(l,!0),l.length===2?m(k?.setMeasureDistanceTargets(l,d)??null):(k?.clearMeasureDistance(),m(null))},[r,l,d,i]),{isMeasureActive:r,setIsMeasureActive:a,selectedAssetIds:l,measureMode:d,setMeasureMode:h,measureResult:g,labelScale:f,setLabelScale:_,handleSelectAsset:v,handleDeselectAsset:y,handleReset:S,handleMeasureResultChange:C,getAssetName:N}},{useMemo:fCt}=await F("react"),pCt=(i,e)=>{const{isMeasureActive:t,setIsMeasureActive:n,selectedAssetIds:s,handleDeselectAsset:o,measureMode:r,setMeasureMode:a,measureResult:l,handleReset:c,getAssetName:d,handleMeasureResultChange:h,labelScale:g,setLabelScale:m}=i;return fCt(()=>({viewerProps:{onMeasureResultChange:h},itemProps:{isMoving:e,isMeasureActive:t,onMeasureActiveChange:n,selectedAssetIds:s,onDeselectAsset:o,measureMode:r,onMeasureModeChange:a,measureResult:l,onReset:c,getAssetName:d,labelScale:g,onLabelScaleChange:m}}),[e,t,n,s,o,r,a,l,c,d,h,g,m])},{memo:_Ct,useMemo:bCt}=await F("react"),vCt=({className:i,mode:e,onModeChange:t,modes:n})=>{const{t:s}=q(),o=bCt(()=>{const r=Aqe.map(l=>{const c=l.id==="move"?"translate":l.id;return{id:c,icon:l.icon,label:s(`move.workspace.properties.${c}`)}});return[n?r.filter(l=>n.includes(l.id)):r]},[s,n]);return u(TDe,{className:i,selectedTool:e,onToolChange:t,toolGroups:o})},yCt=_Ct(vCt),{useMutation:wCt}=await F("@tanstack/react-query"),CCt="/{robot_model}/set_master_mode",SCt=async i=>{const{robot_model:e,...t}=i,n=CCt.replace("{robot_model}",e),s=await Dt.post(n,t);if(s.returnValue)throw Error(`[Error] error Return value: ${s.returnValue}`);return s},xCt=()=>wCt({mutationFn:async i=>SCt(i)}),K8={STOP:0,MODE_J:1,MODE_L:2},NCt=({robotModel:i,className:e})=>{const{t}=q(),{theme:n}=tt(),{selectedRobot:s}=Fi(i),{mutate:o,isPending:r}=xCt(),a=n==="light"?"brand":"soft",l=s?.connected==="DISCONNECT",c=d=>{o({robot_model:i,mode:d})};return u("div",{className:P("ManipulateMasterControl","h-full",e),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:t("move.menu.button.label.masterMode")}),x(U,{className:P("gap-2","[&_button>span]:typo-compact-xs-semibold"),children:[x("div",{className:"grid grid-cols-2 gap-2",children:[u(se,{className:"w-full",variant:a,size:"sm",disabled:l,loading:r,onClick:()=>c(K8.MODE_J),children:t("move.menu.button.label.master.modeJ")}),u(se,{className:"w-full",variant:a,size:"sm",disabled:l,loading:r,onClick:()=>c(K8.MODE_L),children:t("move.menu.button.label.master.modeL")})]}),u(se,{className:"w-full",variant:a,size:"sm",disabled:l,loading:r,onClick:()=>c(K8.STOP),children:t("move.menu.button.label.master.stop")})]})]})})},vv=i=>e=>e[i],hf=(i,e)=>t=>t[i]?.[e]??NaN,kJ=(i,e)=>t=>{const n=t[i];return n?("u"in n?n.u:n.f)[e]??NaN:NaN},J8=[{key:"x",label:"X",field:"X"},{key:"y",label:"Y",field:"Y"},{key:"z",label:"Z",field:"Z"},{key:"rx",label:"RX",field:"Rx"},{key:"ry",label:"RY",field:"Ry"},{key:"rz",label:"RZ",field:"Rz"},{key:"aa",label:"AA",field:"AA"}],spe=[{key:"x",label:"X",field:"X"},{key:"y",label:"Y",field:"Y"},{key:"z",label:"Z",field:"Z"},{key:"rx",label:"RX",field:"Rx"},{key:"ry",label:"RY",field:"Ry"},{key:"rz",label:"RZ",field:"Rz"}],ICt=(i,e=70,t=60)=>Array.from({length:i},(n,s)=>`hsl(${Math.round(s*137.508%360)}, ${e}%, ${t}%)`),ope=ao.length,rpe=$Pe.length,kCt=Adt.length,LCt=Mdt.length,ape=2,uF=(i,e,t,n,s,o)=>({key:i,subTitle:o,subclass:[{key:"in",label:"In",legend:`${e}_IN`},{key:"out",label:"Out",legend:`${e}_OUT`,dash:[4,3]}],rows:Array.from({length:t}).map((r,a)=>({key:`${i}-${a}`,label:`${a}`,prefix:e,cells:{in:kJ(n,a),out:kJ(s,a)}}))}),hF=(i,e,t,n,s)=>({key:i,subTitle:s,rows:Array.from({length:t}).map((o,r)=>({key:`${i}-${r}`,label:`${e} ${r}`,read:kJ(n,r)}))}),Uw=(i,e,t)=>({key:i,subTitle:t,rows:e.map(({key:n,label:s,field:o,legend:r})=>({key:n,label:s,legend:r,read:vv(o)}))}),DCt=(i,e,t)=>[{key:"jointQ",subTitle:"Joint",subclass:[{key:"ref",label:"Ref",legend:"REF"},{key:"enc",label:"Enc",legend:"ENC",dash:[4,3]}],rows:Array.from({length:i}).map((n,s)=>({key:`j${s}`,label:`J${s}`,cells:{ref:hf("jointQRef",s),enc:hf("jointQEnc",s)}}))},{key:"jointT",subclass:[{key:"esti",label:"Estimated",legend:"ESTI"},{key:"meas",label:"Measured",legend:"MEAS",dash:[4,3]}],rows:Array.from({length:i}).map((n,s)=>({key:`jT${s}`,label:`J${s} Torque`,cells:{esti:hf("jointTEsti",s),meas:hf("jointTMeas",s)}}))},{key:"jointTemper",rows:Array.from({length:i}).map((n,s)=>({key:`jointTemper${s}`,label:`J${s} Temp.`,read:hf("jointTemper",s)}))},{key:"carteX",subTitle:"TCP",subclass:[{key:"ref",label:"Ref",legend:"REF"},{key:"enc",label:"Enc",legend:"ENC",dash:[4,3]}],rows:J8.slice(0,i).map(({key:n,label:s},o)=>({key:`tcp-${n}`,label:s,prefix:"TCP",labelClassName:xi[n],cells:{ref:hf("carteXRef",o),enc:hf("carteXEnc",o)}}))},{key:"carteSpeed",subclass:[{key:"spdRef",label:"Ref",legend:"SPD_REF"},{key:"spdEnc",label:"Enc",legend:"SPD_ENC",dash:[4,3]}],rows:J8.slice(0,i).map(({key:n,label:s},o)=>({key:`tcp-spd-${n}`,label:s,prefix:"TCP Spd",labelClassName:xi[n],cells:{spdRef:hf("carteSpeedRef",o),spdEnc:hf("carteSpeedEnc",o)}}))},{key:"userfXRef",subTitle:"User",rows:J8.slice(0,i).map(({key:n,label:s},o)=>({key:`user-${n}`,label:s,prefix:`User ${e}`,legend:`USER_${s}`,read:hf("userfXRef",o)}))},{key:"toolTcp",subTitle:"Tool",rows:spe.map(({key:n,label:s,field:o})=>({key:`tool-tcp-${n}`,label:s,prefix:`Tool ${t}`,legend:`TOOL_${s}`,read:vv(`toolTcp${o}`)}))},Uw("toolComX",[{key:"toolComX",label:`Tool ${t} COM X`,field:"toolComX",legend:"TOOL_COM_X"}]),Uw("toolComY",[{key:"toolComY",label:`Tool ${t} COM Y`,field:"toolComY",legend:"TOOL_COM_Y"}]),Uw("toolComZ",[{key:"toolComZ",label:`Tool ${t} COM Z`,field:"toolComZ",legend:"TOOL_COM_Z"}]),uF("cboxDigital","CB Digital",ope,"cboxDigitalInput","cboxDigitalOutput","CB I/O"),uF("cboxAnalog","CB Analog",rpe,"cboxAnalogInput","cboxAnalogOutput"),uF("exDigital","EX Digital",ope,"exDigitalInput","exDigitalOutput","External I/O"),uF("exAnalog","EX Analog",rpe,"exAnalogInput","exAnalogOutput"),hF("toolDigitalIn","Tool D.In",kCt,"toolDigitalInput","Tool I/O"),hF("toolDigitalOut","Tool D.Out",LCt,"toolDigitalOutput"),hF("toolAnalogIn","Tool A.In",ape,"toolAnalogInput"),hF("toolAnalogOut","Tool A.Out",ape,"toolAnalogOutput"),Uw("toolVoltageOutput",[{key:"toolVoltageOutput",label:"Tool Voltage",field:"toolVoltageOutput",legend:"TOOL_VOL"}]),Uw("motion",[{key:"mode",label:"Motion Mode",field:"motionMode"},{key:"executionResult",label:"Exec Result",field:"motionExecutionResult"},{key:"speedBar",label:"Speed Bar",field:"motionSpeedBar"},{key:"isPause",label:"Is Pause",field:"motionIsPause"}],"Motion"),Uw("status",[{key:"lan2can",label:"Lan2Can",field:"statusLan2can"},{key:"switchEmg",label:"Switch EMG",field:"statusSwitchEmg"},{key:"powerOut",label:"Power Out",field:"statusPowerOut"},{key:"servoNum",label:"Servo Num",field:"statusServoNum"},{key:"isRefon",label:"Is RefOn",field:"statusIsRefon"},{key:"outColl",label:"Out Coll",field:"statusOutColl"},{key:"selfColl",label:"Self Coll",field:"statusSelfColl"},{key:"dtMode",label:"DT Mode",field:"statusDtMode"},{key:"pyfmState",label:"PYFM State",field:"statusPyfmState"}],"Status"),{key:"forcetorque",subTitle:"F/T Sensor",subclass:[{key:"ext",label:"External",legend:"FT_EXT"},{key:"int",label:"Internal",legend:"FT_INT",dash:[4,3]}],rows:spe.map(({key:n,label:s,field:o})=>({key:n,label:s,prefix:"FT",labelClassName:xi[n],cells:{ext:vv(`forcetorqueExt${o}`),int:vv(`forcetorqueInt${o}`)}}))},{key:"extAxis",subTitle:"Ext.Axis",subclass:[{key:"extRef",label:"Ref",legend:"EXT_REF"},{key:"extEnc",label:"Enc",legend:"EXT_ENC",dash:[4,3]}],rows:Array.from({length:i}).map((n,s)=>({key:`ext-${s}`,label:`Ext.Axis ${s}`,cells:{extRef:vv(`extAxisRef${s}`),extEnc:vv(`extAxisEnc${s}`)}}))},Uw("additionalSystemInfo",[{key:"0",label:"Info 0",field:"additionalSystemInfo0",legend:"SYS_INFO_0"},{key:"1",label:"Info 1",field:"additionalSystemInfo1",legend:"SYS_INFO_1"},{key:"2",label:"Info 2",field:"additionalSystemInfo2",legend:"SYS_INFO_2"},{key:"3",label:"Info 3",field:"additionalSystemInfo3",legend:"SYS_INFO_3"},{key:"4",label:"Info 4",field:"additionalSystemInfo4",legend:"SYS_INFO_4"},{key:"5",label:"Info 5",field:"additionalSystemInfo5",legend:"SYS_INFO_5"}],"Additional System Info"),{key:"weldInfo",subTitle:"Weld",subclass:[{key:"tx",label:"Tx",legend:"WELD_TX"},{key:"rx",label:"Rx",legend:"WELD_RX",dash:[4,3]}],rows:[{key:"chunk",label:"Chunk",field:"Chunk"},{key:"current",label:"Current",field:"Current"},{key:"voltage",label:"Voltage",field:"Voltage"},{key:"feedrate",label:"Feedrate",field:"Feedrate"}].map(({key:n,label:s,field:o})=>({key:n,label:s,cells:{tx:vv(`weldInfoTx${o}`),rx:vv(`weldInfoRx${o}`)}}))}],VE=(i,e,t)=>t?`${i}.${e}.${t}`:`${i}.${e}`,DMe=i=>{const e=i.flatMap(s=>s.rows),t=ICt(e.length),n=new Map(e.map((s,o)=>[s,t[o]]));return i.flatMap(s=>s.subclass?s.subclass.flatMap(o=>s.rows.flatMap(r=>{const a=r.cells?.[o.key];return a?[{id:VE(s.key,r.key,o.key),label:`${o.legend??o.label}_${r.label}`,color:n.get(r),dash:o.dash,read:a}]:[]})):s.rows.flatMap(o=>o.read?[{id:VE(s.key,o.key),label:o.legend??o.label,color:n.get(o),read:o.read}]:[]))},{useCallback:lpe,useEffect:TCt,useState:KB}=await F("react"),ECt=16,cpe=2,PCt=({className:i,groups:e,chartMode:t,onDrawChartChange:n,selectedChannelIds:s,onSelectedChannelIdsChange:o})=>{const{t:r}=q(),{theme:a}=tt(),l=t!==void 0,[c,d]=KB("off"),h=l?t:c,g=s!==void 0,[m,f]=KB([]),p=g?s:m,_=lpe(v=>{if(v==="2d"&&p.length>cpe){rt.openToast({type:"basic",variant:"warning",title:"경고",content:"2D 차트에서는 2개의 데이터만 사용 가능합니다.",position:"top-right"});return}l||d(v),n?.({isDrawChart:v!=="off",chartMode:v})},[l,n,p.length]),b=lpe((v,w)=>{const y=h==="2d"&&w&&p.length>=cpe?p.slice(1):p;if(w&&y.length>=ECt){rt.openToast({type:"basic",variant:"warning",title:"경고",content:"한번에 볼 수 있는 차트의 최대 갯수는 16개 입니다.",position:"top-right"});return}const S=w?[...y.filter(C=>C!==v),v]:y.filter(C=>C!==v);g||f(S),o?.(S)},[p,g,o,h]);return x(G9,{className:P("DrawChartController gap-2 px-3 py-1.5",i),children:[x(H,{className:"text-fg-default typo-compact-xs-semibold gap-1",alignItems:"center",justifyContent:"space-between",children:[u("p",{className:"typo-compact-xs-semibold text-fg-default",children:r("move.chart.title")}),x("div",{className:P("bg-bg-alt-2 inline-flex w-fit gap-1 rounded-md p-1","[&_button]:typo-compact-xs-medium! [&_button]:bg-fill-transparent [&_button]:text-fg-default [&_button]:h-5 [&_button]:min-w-10 [&_button]:rounded-sm [&_button]:px-1.5 [&_button]:py-0.5"),children:[u(se,{className:P({"text-fg-subtlest!":h!=="off",[a==="light"&&"text-fg-subtlest!"]:h!=="off","bg-fill-subtler!":h==="off"}),variant:"transparent",onClick:()=>_("off"),children:r("move.button.off")}),u(se,{className:P({"text-fg-subtlest!":h!=="time",[a==="light"&&"text-fg-subtlest!"]:h!=="time","bg-fill-subtler!":h==="time"}),variant:"transparent",onClick:()=>_("time"),children:r("move.button.time")}),u(se,{className:P({"text-fg-subtlest!":h!=="2d",[a==="light"&&"text-fg-subtlest!"]:h!=="2d","bg-fill-subtler!":h==="2d"}),variant:"transparent",onClick:()=>_("2d"),children:"2D"})]})]}),u(Km,{className:"h-full w-full",children:u(U,{className:"h-100 gap-1.5",children:e.map(v=>{const w={gridTemplateColumns:v.subclass?`repeat(${v.subclass.length+1}, minmax(0, 1fr))`:"minmax(0, 1fr) minmax(0, 2fr)"};return x(rn,{children:[v.subTitle&&x(rn,{children:[v.subTitle!=="Joint"&&u(_o,{}),u("span",{className:"text-fg-default typo-compact-xs-semibold mt-1",children:v.subTitle})]}),x(U,{className:"text-fg-subtle typo-compact-xs-normal w-full items-center gap-x-1 gap-y-0.5",children:[v.title&&u("p",{className:"typo-compact-xs-semibold text-fg-default w-full",children:r(v.title)}),v.subclass&&x(H,{className:"grid w-full place-items-center",style:w,alignItems:"center",children:[u("div",{}),v.subclass.map(y=>u("span",{className:"w-15 text-center",children:r(y.label)},y.key))]}),v.rows.map(y=>x(H,{className:"grid w-full place-items-center [&>*:first-child]:justify-self-start [&>*:first-child]:text-start",style:w,alignItems:"center",children:[x(H,{className:"gap-1",children:[y.prefix&&u("span",{children:y.prefix}),u("span",{className:y.labelClassName,children:r(y.label)})]}),v.subclass?v.subclass.map(S=>{const C=VE(v.key,y.key,S.key);return u(ia,{className:"mx-1",value:p.includes(C),handleChange:N=>b(C,N)},S.key)}):u(ia,{className:"mx-1",value:p.includes(VE(v.key,y.key)),handleChange:S=>b(VE(v.key,y.key),S)})]},y.key))]},v.key)]})})})})]})},RCt=({chartGroups:i,handleChangeStateCoreChart:e,onSelectedChannelIdsChange:t})=>{const{t:n}=q(),[s,o]=KB("off"),[r,a]=KB([]),l=d=>{d.chartMode!==void 0&&o(d.chartMode),e(d)},c=d=>{a(d),t?.(d)};return TCt(()=>{const d=new Set(DMe(i).map(({id:g})=>g)),h=r.filter(g=>d.has(g));h.length!==r.length&&(a(h),t?.(h))},[i]),u(j9,{id:"chart-tooltip",label:n("move.chart.title"),icon:u(WKe,{className:"relative z-10 h-4 w-4"}),isActive:s!=="off",anchorToPanelTop:!0,children:u(PCt,{groups:i,chartMode:s,onDrawChartChange:l,selectedChannelIds:r,onSelectedChannelIdsChange:c})})};class MCt{constructor(e,t=10){this.channelCount=e,this.windowSec=t,this.ys=Array.from({length:e},()=>[])}xs=[];ys=[];version=0;push(e,t=Date.now()/1e3){this.xs.push(t);for(let n=0;n<this.channelCount;n++)this.ys[n].push(e[n]??NaN);this.trim(t),this.version++}clear(){this.xs=[],this.ys=Array.from({length:this.channelCount},()=>[]),this.version++}stats(){return this.ys.map(e=>{let t=1/0,n=-1/0;for(const s of e)Number.isNaN(s)||(s<t&&(t=s),s>n&&(n=s));return t===1/0?null:{min:t,max:n,range:n-t}})}trim(e){const t=e-this.windowSec;let n=0;for(;n<this.xs.length&&this.xs[n]<t;)n++;if(n!==0){this.xs.splice(0,n);for(const s of this.ys)s.splice(0,n)}}}const ACt=!0,Ol="u-",OCt="uplot",FCt=Ol+"hz",BCt=Ol+"vt",VCt=Ol+"title",zCt=Ol+"wrap",WCt=Ol+"under",HCt=Ol+"over",$Ct=Ol+"axis",EC=Ol+"off",UCt=Ol+"select",jCt=Ol+"cursor-x",GCt=Ol+"cursor-y",qCt=Ol+"cursor-pt",KCt=Ol+"legend",JCt=Ol+"live",YCt=Ol+"inline",XCt=Ol+"series",QCt=Ol+"marker",dpe=Ol+"label",ZCt=Ol+"value",XT="width",QT="height",FD="top",upe="bottom",XS="left",Y8="right",poe="#000",hpe=poe+"0",X8="mousemove",gpe="mousedown",Q8="mouseup",mpe="mouseenter",fpe="mouseleave",ppe="dblclick",e0t="resize",t0t="scroll",_pe="change",JB="dppxchange",_oe="--",sL=typeof window<"u",LJ=sL?document:null,KN=sL?window:null,n0t=sL?navigator:null;let Hs,gF;function DJ(){let i=devicePixelRatio;Hs!=i&&(Hs=i,gF&&EJ(_pe,gF,DJ),gF=matchMedia(`(min-resolution: ${Hs-.001}dppx) and (max-resolution: ${Hs+.001}dppx)`),D0(_pe,gF,DJ),KN.dispatchEvent(new CustomEvent(JB)))}function Xu(i,e){if(e!=null){let t=i.classList;!t.contains(e)&&t.add(e)}}function TJ(i,e){let t=i.classList;t.contains(e)&&t.remove(e)}function cr(i,e,t){i.style[e]=t+"px"}function Zg(i,e,t,n){let s=LJ.createElement(i);return e!=null&&Xu(s,e),t?.insertBefore(s,n),s}function Jh(i,e){return Zg("div",i,e)}const bpe=new WeakMap;function gf(i,e,t,n,s){let o="translate("+e+"px,"+t+"px)",r=bpe.get(i);o!=r&&(i.style.transform=o,bpe.set(i,o),e<0||t<0||e>n||t>s?Xu(i,EC):TJ(i,EC))}const vpe=new WeakMap;function ype(i,e,t){let n=e+t,s=vpe.get(i);n!=s&&(vpe.set(i,n),i.style.background=e,i.style.borderColor=t)}const wpe=new WeakMap;function Cpe(i,e,t,n){let s=e+""+t,o=wpe.get(i);s!=o&&(wpe.set(i,s),i.style.height=t+"px",i.style.width=e+"px",i.style.marginLeft=n?-e/2+"px":0,i.style.marginTop=n?-t/2+"px":0)}const boe={passive:!0},i0t={...boe,capture:!0};function D0(i,e,t,n){e.addEventListener(i,t,n?i0t:boe)}function EJ(i,e,t,n){e.removeEventListener(i,t,boe)}sL&&DJ();function hm(i,e,t,n){let s;t=t||0,n=n||e.length-1;let o=n<=2147483647;for(;n-t>1;)s=o?t+n>>1:vh((t+n)/2),e[s]<i?t=s:n=s;return i-e[t]<=e[n]-i?t:n}function TMe(i){return(t,n,s)=>{let o=-1,r=-1;for(let a=n;a<=s;a++)if(i(t[a])){o=a;break}for(let a=s;a>=n;a--)if(i(t[a])){r=a;break}return[o,r]}}const EMe=i=>i!=null,PMe=i=>i!=null&&i>0,a6=TMe(EMe),s0t=TMe(PMe);function o0t(i,e,t,n=0,s=!1){let o=s?s0t:a6,r=s?PMe:EMe;[e,t]=o(i,e,t);let a=i[e],l=i[e];if(e>-1)if(n==1)a=i[e],l=i[t];else if(n==-1)a=i[t],l=i[e];else for(let c=e;c<=t;c++){let d=i[c];r(d)&&(d<a?a=d:d>l&&(l=d))}return[a??Fo,l??-Fo]}function l6(i,e,t,n){let s=Npe(i),o=Npe(e);i==e&&(s==-1?(i*=t,e/=t):(i/=t,e*=t));let r=t==10?$_:RMe,a=s==1?vh:ag,l=o==1?ag:vh,c=a(r(yl(i))),d=l(r(yl(e))),h=GI(t,c),g=GI(t,d);return t==10&&(c<0&&(h=Bo(h,-c)),d<0&&(g=Bo(g,-d))),n||t==2?(i=h*s,e=g*o):(i=FMe(i,h),e=c6(e,g)),[i,e]}function voe(i,e,t,n){let s=l6(i,e,t,n);return i==0&&(s[0]=0),e==0&&(s[1]=0),s}const yoe=.1,Spe={mode:3,pad:yoe},zE={pad:0,soft:null,mode:0},r0t={min:zE,max:zE};function YB(i,e,t,n){return d6(t)?xpe(i,e,t):(zE.pad=t,zE.soft=n?0:null,zE.mode=n?3:0,xpe(i,e,r0t))}function Ps(i,e){return i??e}function a0t(i,e,t){for(e=Ps(e,0),t=Ps(t,i.length-1);e<=t;){if(i[e]!=null)return!0;e++}return!1}function xpe(i,e,t){let n=t.min,s=t.max,o=Ps(n.pad,0),r=Ps(s.pad,0),a=Ps(n.hard,-Fo),l=Ps(s.hard,Fo),c=Ps(n.soft,Fo),d=Ps(s.soft,-Fo),h=Ps(n.mode,0),g=Ps(s.mode,0),m=e-i,f=$_(m),p=xd(yl(i),yl(e)),_=$_(p),b=yl(_-f);(m<1e-24||b>10)&&(m=0,(i==0||e==0)&&(m=1e-24,h==2&&c!=Fo&&(o=0),g==2&&d!=-Fo&&(r=0)));let v=m||p||1e3,w=$_(v),y=GI(10,vh(w)),S=v*(m==0?i==0?.1:1:o),C=Bo(FMe(i-S,y/10),24),N=i>=c&&(h==1||h==3&&C<=c||h==2&&C>=c)?c:Fo,k=xd(a,C<N&&i>=N?N:Cm(N,C)),L=v*(m==0?e==0?.1:1:r),D=Bo(c6(e+L,y/10),24),T=e<=d&&(g==1||g==3&&D>=d||g==2&&D<=d)?d:-Fo,E=Cm(l,D>T&&e<=T?T:xd(T,D));return k==E&&k==0&&(E=100),[k,E]}const l0t=new Intl.NumberFormat(sL?n0t.language:"en-US"),woe=i=>l0t.format(i),Rh=Math,u4=Rh.PI,yl=Rh.abs,vh=Rh.floor,pl=Rh.round,ag=Rh.ceil,Cm=Rh.min,xd=Rh.max,GI=Rh.pow,Npe=Rh.sign,$_=Rh.log10,RMe=Rh.log2,c0t=(i,e=1)=>Rh.sinh(i)*e,Z8=(i,e=1)=>Rh.asinh(i/e),Fo=1/0;function Ipe(i){return($_((i^i>>31)-(i>>31))|0)+1}function PJ(i,e,t){return Cm(xd(i,e),t)}function MMe(i){return typeof i=="function"}function Ki(i){return MMe(i)?i:()=>i}const d0t=()=>{},AMe=i=>i,OMe=(i,e)=>e,u0t=i=>null,kpe=i=>!0,Lpe=(i,e)=>i==e,h0t=/\.\d*?(?=9{6,}|0{6,})/gm,s1=i=>{if(VMe(i)||Vy.has(i))return i;const e=`${i}`,t=e.match(h0t);if(t==null)return i;let n=t[0].length-1;if(e.indexOf("e-")!=-1){let[s,o]=e.split("e");return+`${s1(s)}e${o}`}return Bo(i,n)};function pC(i,e){return s1(Bo(s1(i/e))*e)}function c6(i,e){return s1(ag(s1(i/e))*e)}function FMe(i,e){return s1(vh(s1(i/e))*e)}function Bo(i,e=0){if(VMe(i))return i;let t=10**e,n=i*t*(1+Number.EPSILON);return pl(n)/t}const Vy=new Map;function BMe(i){return((""+i).split(".")[1]||"").length}function hR(i,e,t,n){let s=[],o=n.map(BMe);for(let r=e;r<t;r++){let a=yl(r),l=Bo(GI(i,r),a);for(let c=0;c<n.length;c++){let d=i==10?+`${n[c]}e${r}`:n[c]*l,h=(r>=0?0:a)+(r>=o[c]?0:o[c]),g=i==10?d:Bo(d,h);s.push(g),Vy.set(g,h)}}return s}const WE={},Coe=[],qI=[null,null],Tv=Array.isArray,VMe=Number.isInteger,g0t=i=>i===void 0;function Dpe(i){return typeof i=="string"}function d6(i){let e=!1;if(i!=null){let t=i.constructor;e=t==null||t==Object}return e}function m0t(i){return i!=null&&typeof i=="object"}const f0t=Object.getPrototypeOf(Uint8Array),zMe="__proto__";function KI(i,e=d6){let t;if(Tv(i)){let n=i.find(s=>s!=null);if(Tv(n)||e(n)){t=Array(i.length);for(let s=0;s<i.length;s++)t[s]=KI(i[s],e)}else t=i.slice()}else if(i instanceof f0t)t=i.slice();else if(e(i)){t={};for(let n in i)n!=zMe&&(t[n]=KI(i[n],e))}else t=i;return t}function Ja(i){let e=arguments;for(let t=1;t<e.length;t++){let n=e[t];for(let s in n)s!=zMe&&(d6(i[s])?Ja(i[s],KI(n[s])):i[s]=KI(n[s]))}return i}const p0t=0,_0t=1,b0t=2;function v0t(i,e,t){for(let n=0,s,o=-1;n<e.length;n++){let r=e[n];if(r>o){for(s=r-1;s>=0&&i[s]==null;)i[s--]=null;for(s=r+1;s<t&&i[s]==null;)i[o=s++]=null}}}function y0t(i,e){if(S0t(i)){let r=i[0].slice();for(let a=1;a<i.length;a++)r.push(...i[a].slice(1));return x0t(r[0])||(r=C0t(r)),r}let t=new Set;for(let r=0;r<i.length;r++){let l=i[r][0],c=l.length;for(let d=0;d<c;d++)t.add(l[d])}let n=[Array.from(t).sort((r,a)=>r-a)],s=n[0].length,o=new Map;for(let r=0;r<s;r++)o.set(n[0][r],r);for(let r=0;r<i.length;r++){let a=i[r],l=a[0];for(let c=1;c<a.length;c++){let d=a[c],h=Array(s).fill(void 0),g=e?e[r][c]:_0t,m=[];for(let f=0;f<d.length;f++){let p=d[f],_=o.get(l[f]);p===null?g!=p0t&&(h[_]=p,g==b0t&&m.push(_)):h[_]=p}v0t(h,m,s),n.push(h)}}return n}const w0t=typeof queueMicrotask>"u"?i=>Promise.resolve().then(i):queueMicrotask;function C0t(i){let e=i[0],t=e.length,n=Array(t);for(let o=0;o<n.length;o++)n[o]=o;n.sort((o,r)=>e[o]-e[r]);let s=[];for(let o=0;o<i.length;o++){let r=i[o],a=Array(t);for(let l=0;l<t;l++)a[l]=r[n[l]];s.push(a)}return s}function S0t(i){let e=i[0][0],t=e.length;for(let n=1;n<i.length;n++){let s=i[n][0];if(s.length!=t)return!1;if(s!=e){for(let o=0;o<t;o++)if(s[o]!=e[o])return!1}}return!0}function x0t(i,e=100){const t=i.length;if(t<=1)return!0;let n=0,s=t-1;for(;n<=s&&i[n]==null;)n++;for(;s>=n&&i[s]==null;)s--;if(s<=n)return!0;const o=xd(1,vh((s-n+1)/e));for(let r=i[n],a=n+o;a<=s;a+=o){const l=i[a];if(l!=null){if(l<=r)return!1;r=l}}return!0}const WMe=["January","February","March","April","May","June","July","August","September","October","November","December"],HMe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function $Me(i){return i.slice(0,3)}const N0t=HMe.map($Me),I0t=WMe.map($Me),k0t={MMMM:WMe,MMM:I0t,WWWW:HMe,WWW:N0t};function BD(i){return(i<10?"0":"")+i}function L0t(i){return(i<10?"00":i<100?"0":"")+i}const D0t={YYYY:i=>i.getFullYear(),YY:i=>(i.getFullYear()+"").slice(2),MMMM:(i,e)=>e.MMMM[i.getMonth()],MMM:(i,e)=>e.MMM[i.getMonth()],MM:i=>BD(i.getMonth()+1),M:i=>i.getMonth()+1,DD:i=>BD(i.getDate()),D:i=>i.getDate(),WWWW:(i,e)=>e.WWWW[i.getDay()],WWW:(i,e)=>e.WWW[i.getDay()],HH:i=>BD(i.getHours()),H:i=>i.getHours(),h:i=>{let e=i.getHours();return e==0?12:e>12?e-12:e},AA:i=>i.getHours()>=12?"PM":"AM",aa:i=>i.getHours()>=12?"pm":"am",a:i=>i.getHours()>=12?"p":"a",mm:i=>BD(i.getMinutes()),m:i=>i.getMinutes(),ss:i=>BD(i.getSeconds()),s:i=>i.getSeconds(),fff:i=>L0t(i.getMilliseconds())};function Soe(i,e){e=e||k0t;let t=[],n=/\{([a-z]+)\}|[^{]+/gi,s;for(;s=n.exec(i);)t.push(s[0][0]=="{"?D0t[s[1]]:s[0]);return o=>{let r="";for(let a=0;a<t.length;a++)r+=typeof t[a]=="string"?t[a]:t[a](o,e);return r}}const T0t=new Intl.DateTimeFormat().resolvedOptions().timeZone;function E0t(i,e){let t;return e=="UTC"||e=="Etc/UTC"?t=new Date(+i+i.getTimezoneOffset()*6e4):e==T0t?t=i:(t=new Date(i.toLocaleString("en-US",{timeZone:e})),t.setMilliseconds(i.getMilliseconds())),t}const UMe=i=>i%1==0,XB=[1,2,2.5,5],P0t=hR(10,-32,0,XB),jMe=hR(10,0,32,XB),R0t=jMe.filter(UMe),_C=P0t.concat(jMe),xoe=`
374
+ """`}}},Tgt={label:"program.button.variables",command:"Variables",icon:UUe,data:{method:"Variables",summary:"",funcName:"rb_program_sdk.set_variables",args:{variables:[]}}},Zu={label:"program.button.preProgram",command:"ActionPre",icon:AUe,data:{method:"ActionPre",name:"PreProgram"},requireChildren:!0,isStrict:!0,notAllowChildren:["Move","MoveJ","MoveL","MoveJB","MoveLB","MovePB","MoveXB","Point","ForceControl","Conveyor","Weaving"]},Ya={label:"program.button.postProgram",command:"ActionPost",icon:OUe,data:{method:"ActionPost",name:"PostProgram"},requireChildren:!0,isStrict:!0,notAllowChildren:["Move","MoveJ","MoveL","MoveJB","MoveLB","MovePB","MoveXB","Point","ForceControl","Conveyor","Weaving"]},Egt={label:"program.button.subTask",command:"SubTask",icon:FUe,confirmModal:Wht},vRe={label:"program.button.sync",command:"Sync",icon:RUe,disabled:Yl(),data:{method:"Sync",summary:"Flag => 1",args:{flag:"1",timeout:null}}},a4={label:"program.button.thread",command:"Thread",icon:VLe,confirmModal:$ht,factoryDataFn:async i=>({method:"Thread",taskId:dt.uniqueId(),summary:"",memo:"",name:"General Thread",args:{thread_type:"GENERAL",disable_pause:!1}}),requireChildren:!0,isStrict:!0,notAllowChildren:["Move","MoveJ","MoveL","MoveJB","MoveLB","MovePB","MoveXB","Point","ForceControl","Conveyor","Weaving","Thread","CallEvent","ActionPost"]},zB={label:"program.button.callEventThread",command:"CallEvent",icon:VLe,factoryDataFn:i=>({method:"CallEvent",summary:"Call: Ev Th 1",name:"Call Event Thread",args:{index:0}}),requireChildren:!1,isStrict:!1,notAllowChildren:[]},Pgt={label:"program.button.interface",command:"Interface",icon:qUe,data:{method:"Interface",summary:"",funcName:"rb_program_sdk.interface",args:{option:"MODBUS_CLIENT",data:{type:"WRITE",server_ip:"",server_port:502,function_code:6,timeout_sec:null,register_addr:null,number_of_read:null,payload:null,return_variable_name:null,resolve_option:"SKIP"}}}},Rgt={label:"program.button.vision",command:"Vision",icon:hje,data:{method:"Vision",summary:"",funcName:"rb_manipulate_sdk.vision.vision",args:{option:"MECHMIND_INTERFACE",data:{type:"CONNECT",function_code:99,timeout_sec:null,server_ip:"",server_port:5e4,resolve_option:"SKIP"}}}},Mgt={label:"program.button.userInput",command:"UserInput",icon:GUe,data:{method:"UserInput",funcName:"rb_program_sdk.user_input",summary:"",args:{mode:"USER_INPUT",var_form:"STRING",var_selection:void 0}}},yRe={label:"program.button.changeProgram",command:"ChangeProgram",icon:KUe,confirmModal:ygt,disabled:Yl()},DA=[xgt,vRe,{...Xme,data:{...Xme.data,funcName:"rb_program_sdk.alarm_or_halt"}},a4,Zu,Ya,Egt,r4,Ngt,vJ,Lgt,_J,kgt,bJ,bRe,Tgt,Dgt,Igt,Mgt,Pgt,yRe],By=[{label:"program.button.movej",command:"MoveJ",icon:HLe,data:{method:"MoveJ",args:{robot_model:"",move_type:"J",orientation:null,running_mode:null}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.movel",command:"MoveL",icon:$Le,data:{method:"MoveL",args:{robot_model:"",move_type:"L",orientation:null,running_mode:null}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.movejb",command:"MoveJB",icon:JUe,data:{method:"MoveJB",funcName:"rb_manipulate_sdk.move.call_move_jb_clr",postFuncName:"rb_manipulate_sdk.move.call_move_jb_run",args:{robot_model:"",move_type:"JB",orientation:null,running_mode:null}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.movelb",command:"MoveLB",icon:Aue,data:{method:"MoveLB",funcName:"rb_manipulate_sdk.move.call_move_lb_clr",postFuncName:"rb_manipulate_sdk.move.call_move_lb_run",args:{robot_model:"",move_type:"LB",orientation:0,running_mode:null}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.movepb",command:"MovePB",icon:Aue,data:{method:"MovePB",funcName:"rb_manipulate_sdk.move.call_move_pb_clr",postFuncName:"rb_manipulate_sdk.move.call_move_pb_run",args:{robot_model:"",move_type:"PB",orientation:0,running_mode:null}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.movexb",command:"MoveXB",icon:YUe,data:{method:"MoveXB",funcName:"rb_manipulate_sdk.move.call_move_xb_clr",postFuncName:"rb_manipulate_sdk.move.call_move_xb_run",args:{robot_model:"",move_type:"XB",orientation:null,running_mode:0}},requireChildren:!0,allowChildren:["Point"],childrenCommand:"Point"},{label:"program.button.point",command:"Point",icon:XUe,allowParents:["MoveJ","MoveL","MoveJB","MoveLB","MovePB","MoveXB"],requireParent:!0,factoryDataFn:async i=>{let e=[0,0,0,0,0,0,0],t=-1;i?.args?.move_type?.startsWith("J")?t=-1:i?.args?.move_type?.startsWith("L")&&(t=0);try{const{jointQRef:s,carteXRef:o}=await e0({robot_model:i.args?.robot_model});s&&t===-1&&(e=s.map(r=>Number(r.toFixed(3)))),o&&t===0&&(e=o.map(r=>Number(r.toFixed(3))))}catch(s){console.error("Error fetching jointQRef",s)}return{method:"Point",summary:`${UN[0].summary} , ${e.map(s=>s.toFixed(3)).join(", ")}`,funcName:"rb_manipulate_sdk.point.set_point",args:{robot_model:"$parent.robot_model",move_type:"$parent.move_type",input_method:0,pnt_para:100,pnt_type:0,tar_frame:t,tar_unit:0,tar_values:e,spd_mode:0,spd_vel_para:.4,spd_acc_para:.1,tcp_num:-1,orientation:"$parent.orientation",running_mode:"$parent.running_mode",method:0}}}},{label:"program.button.pinPoint",command:"PinPoint",icon:QUe,factoryDataFn:async(i,e)=>{let t=[0,0,0,0,0,0,0];try{const{carteXRef:n}=await e0({robot_model:e});n&&(t=n.map(s=>Number(s.toFixed(3))))}catch(n){console.error("Error fetching carteXRef",n)}return{method:"PinPoint",summary:`${UN[0].summary} , ${t.map(n=>n.toFixed(3)).join(", ")}`,funcName:"rb_manipulate_sdk.program.set_pin_point_or_joint",args:{input_method:0,pin_type:"POINT",target:{tar_frame:0,tar_unit:0,tar_values:t}}}}},{label:"program.button.pinJoint",command:"PinJoint",icon:ZUe,factoryDataFn:async(i,e)=>{let t=[0,0,0,0,0,0,0];try{const{jointQRef:n}=await e0({robot_model:e});n&&(t=n.map(s=>Number(s.toFixed(3))))}catch(n){console.error("Error fetching jointQRef",n)}return{method:"PinJoint",summary:`${UN[0].summary} , ${t.map(n=>n.toFixed(3)).join(", ")}`,funcName:"rb_manipulate_sdk.program.set_pin_point_or_joint",args:{input_method:0,pin_type:"JOINT",target:{tar_frame:-1,tar_unit:0,tar_values:t}}}}},{label:"program.button.home",command:"PosHome",icon:eje,data:{method:"PosHome",funcName:"rb_manipulate_sdk.move.call_move_home",summary:"Move-J, Top-Level (Main) Project",args:{home_type:0,move_type:0,speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1}}}},{label:"program.button.motionMacro",command:"MotionMacro",icon:tje,data:{method:"MotionMacro",summary:"Flat Surface",funcName:"rb_manipulate_sdk.service.call_move_macro",args:{type:0,corner_pnts:["RB_JOINT_REF","RB_JOINT_REF","RB_JOINT_REF","RB_JOINT_REF"],speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1},rotation_mode:0,gap_num:0,margin_h_1:0,margin_h_2:0,margin_w_1:0,margin_w_2:0,margin_over:0,margin_over_para:0}}},{label:"program.button.circle",command:"Circle",icon:ULe,factoryDataFn:async(i,e)=>{let t=[0,0,0,0,0,0,0];try{const{carteXRef:n}=await e0({robot_model:e});n&&(t=n.map(s=>Number(s.toFixed(3))))}catch(n){console.error("Error fetching carteXRef",n)}return{method:"Circle",funcName:"rb_manipulate_sdk.move.call_move_cir_axis",summary:Xv[0].summary,args:{center:{input_method:0,tar_frame:0,tar_unit:0,tar_values:t,ref_point:""},axis:{input_method:0,tar_frame:0,tar_unit:0,tar_values:t,ref_point:""},angle:0,mode:0,speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1},radius_option:0,radius_para:0}}}},{label:"program.button.gcode",command:"Gcode",icon:WLe,data:{method:"Gcode",funcName:"rb_manipulate_sdk.service.call_move_gcode",args:{filename:"",gcodeframe:0,feed_spd_default:0,feed_spd_rapid:0,feed_spd_limit:0,feed_spd_rotation:0,default_plane:0,offset_x:0,offset_y:0,offset_z:0}}},{label:"program.button.replay",command:"Replay",icon:jLe,data:{method:"Replay",summary:"",funcName:"rb_manipulate_sdk.service.call_replay_motion_run",args:{filename:"",type:0,speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1}}}},{label:"program.button.set",command:"Setting",icon:GLe,data:{method:"Setting",summary:"Out Collision - Off",name:"Set",funcName:"rb_manipulate_sdk.program.setting",args:{option:"OUT_COLLISION",out_collision:{onoff:0,react_mode:0,threshold:0}}}},{label:"program.button.tcpSet",command:"TcpSetting",icon:nje,factoryDataFn:async(i,e)=>{let t="";try{const{tConfigs0:n}=await fEe({robot_model:e});t=n.toolName}catch(n){console.error("Error fetching tool list",n)}return{method:"TcpSetting",summary:t,name:"TCP Set",funcName:"rb_manipulate_sdk.config.set_toollist_num",args:{tool_num:0}}}},{label:"program.button.timer",command:"Timer",icon:BLe,data:{method:"Timer",summary:"Timer 0, Reset Time: 0sec",funcName:"rb_manipulate_sdk.service.call_timer_function",args:{timer_no:0,reset_time:0,option_increase:0,option_action:0}}},{label:"program.button.weaving",command:"Weaving",icon:ije,data:{method:"Weaving",summary:"Off",funcName:"rb_manipulate_sdk.move.call_tcp_weaving_off",args:{}}},{label:"program.button.arcSensing",command:"ArcSensing",icon:sje,data:{method:"ArcSensing",summary:"Off",funcName:"rb_manipulate_sdk.move.call_arc_sensing_off"}},{label:"program.button.conveyor",command:"Conveyor",icon:oje,data:{method:"Conveyor",summary:um[0].summary,funcName:"rb_manipulate_sdk.move.call_base_conveyor_off",args:{stop_time_sec:0}}},{label:"program.button.forceCtrl",command:"ForceControl",icon:rje,data:{method:"ForceControl",funcName:"rb_manipulate_sdk.move.call_admittance_force_off"}},{label:"program.button.dout",command:"DOut",icon:aje,data:{method:"DOut",summary:`${pJ[0].summary}: ${gRe.GENERAL.summary}`,memo:"",funcName:"rb_manipulate_sdk.io.call_multiple_side_dout",args:{side_dout_args:BB}}},{label:"program.button.aout",command:"AOut",icon:lje,data:{method:"AOut",summary:"",memo:"",funcName:"rb_manipulate_sdk.io.call_multiple_side_aout",args:{side_aout_args:_Re}}},{label:"program.button.toolout",command:"ToolOut",icon:cje,data:{method:"ToolOut",summary:`${AB[0].label}, ${VB.map((i,e)=>`${e}: Bypass`).join(", ")}`,memo:"",funcName:"rb_manipulate_sdk.program.tool_out",args:{tool_voltage:"-1",tool_dout_args:VB}}},{label:"program.button.gripper",command:"Gripper",icon:dje,factoryDataFn:async(i,e)=>{let t;try{const{attachOption:n}=await fRe({robot_model:e});n<0?t=0:t=n}catch(n){console.error("Error fetching gripper",n),t=0}return{method:"Gripper",summary:`${UI[t].label} - Initialize`,funcName:"rb_manipulate_sdk.service.call_gripper_action",args:{gripper_type:t,function_list:0,payload:UI[t].initPayload}}}},{label:"program.button.welder",command:"Welding",icon:uje,data:{method:"Welding",summary:t0[0].summary,funcName:"rb_manipulate_sdk.service.call_weld_arc_off",args:{time_start:0,cond_mode:0,cond_option:0,cond_jobno:1,cond_current:0,cond_voltage:0,cond_feedrate:0,cond_arccontrol:0,cond_arclength:0,cond_para1:0,cond_para2:0,time_crator:0,time_ending:0}}},Rgt,{label:"program.button.functionCall",command:"FunctionCall",icon:qLe,data:{method:"FunctionCall",summary:"",funcName:"rb_manipulate_sdk.get_data.call_functions",args:{calls:[]}}},{label:"program.button.pattern",command:"Pattern",icon:gje,data:{method:"Pattern",summary:`ID 0, ${MB[0].summary}`,funcName:"rb_manipulate_sdk.service.call_pattern_on",postFuncName:"rb_manipulate_sdk.service.call_pattern_off",args:{id:0,type:0,count_x:2,count_y:2,count_z:2,anchor_pnt:"RB_JOINT_REF",incremental:1,corner_pnts:["RB_JOINT_REF","RB_JOINT_REF"]},postArgs:{id:0}},requireChildren:!0},{label:"progarm.button.rs485",command:"SerialCommunication",icon:mje,disabled:!0},{label:"program.button.touchSensing",command:"TouchSensing",icon:fje,disabled:!0}],n6=[{label:"amr.button.goal",command:"Goal",icon:pje,data:(()=>{const i={robot_model:"",goal_id:"",goal_name:"",preset:0,method:"pp"};return{method:"Goal",summary:`Move Goal - Goal Id: ${i.goal_id}, Preset: ${i.preset}, Method: ${i.method}`,funcName:"rb_amr_sdk.move.send_move_goal",args:i}})()},{label:"amr.button.target",command:"Target",icon:_je,data:(()=>{const i={robot_model:"",x:0,y:0,z:0,rz:0,method:"pp",preset:0};return{method:"Target",funcName:"rb_amr_sdk.move.send_move_target",summary:`Move Target - X: ${i.x}m, Y: ${i.y}m, Z: ${i.z}m, ${i.rz}deg`,args:i}})()},{label:"amr.button.linear",command:"Linear",icon:bje,data:(()=>{const i={robot_model:"",axis_option:"x",target:0,speed:0};return{method:"Linear",funcName:"rb_amr_sdk.move.send_move_x_linear",summary:`Move Linear - Axis: ${i.axis_option.toUpperCase()}, Target: ${i.target}m, Speed: ${i.speed}m/s`,args:i}})()},{label:"amr.button.rotate",command:"Rotate",icon:ULe,data:(()=>{const i={robot_model:"",target:0,speed:0};return{method:"Rotate",funcName:"rb_amr_sdk.move.send_move_rotate",summary:`Move Rotate - Target: ${i.target}m, Speed: ${i.speed}m/s`,args:i}})()},{label:"amr.button.map_load",command:"MapLoad",icon:vje,data:(()=>{const i={robot_model:"",map_name:""};return{method:"MapLoad",funcName:"rb_amr_sdk.map.map_load",summary:`Map Load - ${i.map_name}`,args:i}})()},{label:"amr.button.loc_init",command:"LocalizationInit",icon:yje,data:(()=>{const i={robot_model:"",x:0,y:0,z:0,rz:0};return{name:"Localization Init",method:"LocalizationInit",funcName:"rb_amr_sdk.localization.localization_init",summary:`${Ux[0].summary} ${`X: ${i.x}, Y: ${i.y}, Z: ${i.z}, RZ: ${i.rz}`}`,args:i}})()},{label:"amr.button.loc_control",command:"LocalizationControl",icon:wje,data:{name:"Localization Start",method:"LocalizationControl",funcName:"rb_amr_sdk.localization.localization_start",summary:"Localization "+J3[0].summary,args:{robot_model:""}}},{label:"amr.button.hw_control",command:"HardwareCtrl",icon:GLe,data:{method:"HardwareCtrl",funcName:"rb_amr_sdk.control.control_set_motor",summary:Xg[0].summary+": Off",args:{robot_model:"",switch:!1}}},{label:"amr.button.dock",command:"Dock",icon:Cje,data:{method:"Dock",funcName:"rb_amr_sdk.control.control_dock",summary:VK[0].summary,args:{robot_model:""}}},{label:"amr.button.obs_box",command:"SetObsBox",icon:Sje,data:(()=>{const i={robot_model:"",min_x:0,min_y:0,min_z:0,max_x:1,max_y:1,max_z:1,map_range:0};return{name:"OBS Box",method:"SetObsBox",funcName:"rb_amr_sdk.control.control_set_obs_box",summary:`Min - [X: ${i.min_x}, Y: ${i.min_y}, Z: ${i.min_z}], Max - [X: ${i.max_x}, Y: ${i.max_y}, Z: ${i.max_z}], Map Range: ${i.map_range}`,args:i}})()},{label:"amr.button.set_safety",command:"SetSafety",icon:xje,data:(()=>{const i={robot_model:"",safety_field:0};return{method:"SetSafety",funcName:"rb_amr_sdk.control.control_set_safety_field",summary:Sf[0].summary+": "+i.safety_field,args:i}})()},{label:"program.button.canBus",command:"CANBus",icon:Nje,iconClassName:"w-10 h-8 object-contain object-center",data:{method:"CANBus",summary:eg[0].summary,funcName:eg[0].value,args:{channel:null,bitrate:1e6,fd:!1,dataBitrate:0,receiveOwnMessages:0,interface:tRe}}},{label:"amr.button.stream",command:"Stream",icon:jLe,data:{method:"Stream",funcName:"rb_amr_sdk.control.control_stream_frequency",args:{robot_model:"",target:"camera",frequency:0}},disabled:!0}],Yse=[{label:"program.button.movel",command:"MoveL_Y1",icon:$Le,data:{method:"MoveL_Y1",funcName:"rb_rby1_sdk.move_l",args:{type:"l",target:{},minimum_time:3}}},{label:"program.button.movej",command:"MoveJ_Y1",icon:HLe,data:{method:"MoveJ_Y1",funcName:"rb_rby1_sdk.move_j",args:{type:"j",target:{},minimum_time:3}}}];let yJ=!1;const Agt=100,Ogt=100,Fgt={initialInfo:{programInfo:null,beginInfo:null,treeItems:null,subTreeItems:null},programInfo:null,beginInfo:null,multiSelectMode:!1,selectedItems:null,showItem:null,copiedItems:[],treeItems:null,subTreeItems:null,undoStack:[],redoStack:[],isChanged:!1},Bgt={getItem:async i=>{const e=await Ntt(i);return typeof e=="string"?e:null},setItem:async(i,e)=>{yJ&&await Itt(i,e)},removeItem:async i=>{await ktt(i)}},Kh=(i,e,t,n,s)=>{if(O9(e?.programId))return!1;const o=dt.cloneDeep(n),r=dt.cloneDeep(i.treeItems),a=dt.cloneDeep(s),l=dt.cloneDeep(i.subTreeItems),c=h=>{if(h)for(const g of h)delete g.state,delete g.collapsed,g.children&&c(g.children)},d=h=>{if(h)for(const g of h)c(g.steps)};for(const h of Object.keys(o??{}))c(o[h]);for(const h of Object.keys(r??{}))c(r[h]);for(const h of Object.keys(a??{}))d(a[h]);for(const h of Object.keys(l??{}))d(l[h]);return!uEe({...i,treeItems:r,subTreeItems:l},{programInfo:e,beginInfo:t,treeItems:o,subTreeItems:a})},Vgt=gse()(dEe(fse((i,e)=>({...Fgt,setInitialInfo:(t,n=!1)=>{const s=e().programInfo,o=e().treeItems,r=e().subTreeItems,a=e().showItem,l=e().selectedItems,c=e().copiedItems,d=e().undoStack,h=e().redoStack,g=e().beginInfo,m=dt.cloneDeep(t),f=m.treeItems?Object.entries(m.treeItems).reduce((_,[b,v])=>(_[b]=v.length===0?[{...Za,stepId:dt.uniqueId(),taskId:b,programId:m.programInfo?.programId}]:v,_),{}):null,p=m.subTreeItems?dt.cloneDeep(m.subTreeItems):null;i({initialInfo:{...m,treeItems:f,subTreeItems:p},programInfo:n?m.programInfo:s,beginInfo:n?m.beginInfo:g,treeItems:n?f:o,subTreeItems:n?p:r,showItem:n?null:a,selectedItems:n?null:l,copiedItems:n?[]:c,undoStack:n?[]:d,redoStack:n?[]:h,isChanged:n?!1:Kh(m,s,g,o,r)})},setProgramInfo:t=>{i({programInfo:t,isChanged:Kh(e().initialInfo,t,e().beginInfo,e().treeItems,e().subTreeItems)})},setBeginInfo:(t,n)=>{n&&!n.speed_ratio&&(n.speed_ratio=null),i({beginInfo:{...e().beginInfo,[t]:n},isChanged:Kh(e().initialInfo,e().programInfo,{...e().beginInfo,[t]:n},e().treeItems,e().subTreeItems)})},setSelectedItems:t=>{const n=e().selectedItems,s=n?.find(o=>o.stepId===t.stepId);if(e().multiSelectMode){if(n?.some(r=>r.parentStepId!==t.parentStepId)){rt.openToast({title:Y2("program.select.notAllowed.title"),content:Y2("program.select.notAllowed.differentParent"),type:"basic",variant:"warning"});return}if(t.groupId){const a=sl(dt.cloneDeep(e().treeItems?.[t.taskId]??[]),{excludeEmpty:!0}).filter(c=>c.groupId===t.groupId);if(!(a?.length>0&&a?.[0]?.stepId===t.stepId)){rt.openToast({title:Y2("program.select.notAllowed.title"),content:Y2("program.select.notAllowed.selectFirstGroupItem"),type:"basic",variant:"warning"});return}}i(s?{selectedItems:dt.sortBy(n?.filter(r=>r.stepId!==t.stepId),"order")}:{selectedItems:dt.sortBy([...n??[],t],"order")})}else i({selectedItems:[t],showItem:s&&t.method!==Za.method?t:null})},setShowItem:t=>{i({showItem:t})},resetSelectedItems:()=>{i({selectedItems:[],showItem:null})},setTreeItems:(t,n)=>{const s={...Za,stepId:dt.uniqueId(),taskId:t,programId:e().programInfo?.programId},o=n.length===0?[s]:n;wl(o),i(r=>({treeItems:{...r.treeItems,[t]:o},selectedItems:n.length===0?[s]:r.selectedItems,isChanged:Kh(r.initialInfo,r.programInfo,r.beginInfo,{...r.treeItems,[t]:o},r.subTreeItems)}))},setOneTreeItem:(t,n,s)=>{const o=e().treeItems[t]?.length?e().treeItems[t]:[{...Za,stepId:dt.uniqueId(),taskId:t,programId:e().programInfo?.programId}],r=dt.cloneDeep(o),a=dt.cloneDeep(e().selectedItems);wl(r);const l=h=>{for(let g=0;g<h.length;g++){const m=h[g];if(m.stepId===n)return h[g]={...s},!0;if(m.children&&m.children.length>0&&l(m.children))return!0}return!1};if(!l(r))return;const d={...e().treeItems,[t]:r};i({treeItems:d,selectedItems:a?.map(h=>h.stepId===n?s:h)??null,isChanged:Kh(e().initialInfo,e().programInfo,e().beginInfo,d,e().subTreeItems)})},setAllTreeItems:t=>{const n=dt.cloneDeep(e().treeItems),s=Object.keys(t??{});for(const o of s)uEe(n[o],t[o])||(n[o]=t[o]?.length===0?[{...Za,stepId:dt.uniqueId(),taskId:o,programId:e().programInfo?.programId}]:t[o],wl(n[o]));i({treeItems:n,isChanged:Kh(e().initialInfo,e().programInfo,e().beginInfo,n,e().subTreeItems)})},setSubTreeItems:(t,n)=>{for(const s of n)wl(s.steps);i(s=>({subTreeItems:{...s.subTreeItems,[t]:n??[]},isChanged:Kh(s.initialInfo,s.programInfo,s.beginInfo,s.treeItems,{...s.subTreeItems,[t]:n})}))},setOneSubTreeStepItem:(t,n,s,o)=>{const r=e().subTreeItems?.[t]?.find(f=>f.taskId===n)?.steps?.length?e().subTreeItems?.[t]?.find(f=>f.taskId===n)?.steps:[{...Za,stepId:dt.uniqueId(),taskId:n,programId:e().programInfo?.programId}],a=dt.cloneDeep(r),l=dt.cloneDeep(e().selectedItems);wl(a);const c=f=>{for(let p=0;p<f.length;p++){const _=f[p];if(_.stepId===s)return f[p]={...o},!0;if(_.children&&_.children.length>0&&c(_.children))return!0}return!1};if(!c(a))return;const h=[...e().subTreeItems?.[t]??[]],g=h.findIndex(f=>f.taskId===n);g===-1?h.push({taskId:n,steps:a}):h[g]={taskId:n,steps:a};const m={...e().subTreeItems,[t]:h};i({subTreeItems:m,selectedItems:l?.map(f=>f.stepId===s?o:f)??null,isChanged:Kh(e().initialInfo,e().programInfo,e().beginInfo,e().treeItems,m)})},setOneSubTreeItem:(t,n,s)=>{if(s?.steps?.length===0){const c=e().subTreeItems[t]?.filter(h=>h.taskId!==n),d={...e().subTreeItems,[t]:c};i({subTreeItems:d,isChanged:Kh(e().initialInfo,e().programInfo,e().beginInfo,e().treeItems,d)});return}const r=e().subTreeItems?.[t]?.findIndex(c=>c.taskId===n)??-1,a=[...e().subTreeItems?.[t]??[]];wl(s.steps),r===-1?a.push(s):a[r]=s;const l={...e().subTreeItems,[t]:a};i({subTreeItems:l,isChanged:Kh(e().initialInfo,e().programInfo,e().beginInfo,e().treeItems,l)})},setAllSubTreeItems:t=>{for(const n of Object.values(t??{}))for(const s of n)wl(s.steps);i(n=>({subTreeItems:t??{},isChanged:Kh(n.initialInfo,n.programInfo,n.beginInfo,n.treeItems,t)}))},setAllTreeItemsToIdle:()=>{const t=dt.cloneDeep(e().treeItems);if(!t)return;const n=o=>{for(const r of o)r.state="idle",r.children&&n(r.children)},s=Object.keys(t??{});for(const o of s)n(t[o]);i({treeItems:t})},setStepInfo:(t,n,s,o)=>{const r=!!e().treeItems[t];let a=r?t:"";Object.entries(e().subTreeItems??{}).forEach(([l,c])=>{Array.isArray(c)&&c.find(d=>d.taskId===t)&&(a=l)}),r?e().setOneTreeItem(t,n,s):e().setOneSubTreeStepItem(a,t,n,s),o?.resetShowItem&&e().setShowItem(null)},setCopiedItems:t=>{i({copiedItems:t})},setMultiSelectMode:t=>{i(n=>({...n,multiSelectMode:t,selectedItems:!t&&n.multiSelectMode?[]:n.selectedItems}))},setUndoStack:t=>{t.length>Agt&&t.shift(),i({undoStack:t})},setRedoStack:t=>{t.length>Ogt&&t.shift(),i({redoStack:t})}}),{name:"program-store",storage:mse(()=>Bgt),partialize:i=>({initialInfo:i.initialInfo,programInfo:i.programInfo,beginInfo:i.beginInfo,treeItems:i.treeItems,subTreeItems:i.subTreeItems,isChanged:i.isChanged}),onRehydrateStorage:()=>(console.log("[program-store] rehydrate start"),yJ=!1,(i,e)=>{if(e){console.warn("[program-store] rehydrate error",e);return}yJ=!0,console.log("[program-store] rehydrate success",i)})}),{name:"program-store",store:"program-store",enabled:!1})),ie=Vgt,{useMutation:zgt}=await F("@tanstack/react-query"),Wgt="/program/edit",Hgt=async i=>await Ut.put(Wgt,i),wRe=()=>zgt({mutationFn:Hgt}),{useMutation:$gt}=await F("@tanstack/react-query"),Ugt="/program/delete/{program_id}",jgt=async i=>{const{program_id:e}=i,t=Ugt.replace("{program_id}",e);return await Ut.delete(t)},Ggt=()=>$gt({mutationFn:jgt}),qgt=()=>{const{t:i}=q(),e=ie(d=>d.programInfo),t=ie(d=>d.setInitialInfo),{confirmDialog:n}=jn(),s=ir(),{refetch:o}=As(),{mutateAsync:r,isPending:a}=Ggt();return{handleDeleteProgram:async d=>{const{programId:h,programName:g}=d;if(!h)return;if(await n({title:i("program.delete.confirm.title"),content:u(U,{className:"gap-1",children:u("p",{className:"text-base",children:i("program.delete.confirm.content",{programName:g})})})}))try{await r({program_id:h}),rt.openToast({title:i("program.delete.toast.successTitle"),content:i("program.delete.toast.successContent"),type:"basic",variant:"success"}),e?.programId===h&&(await o(),t({programInfo:null,treeItems:null,subTreeItems:null,beginInfo:null},!0),s("./",{replace:!0}))}catch(f){throw rt.openToast({title:i("program.delete.toast.failTitle"),content:i("program.delete.toast.failContent"),type:"basic",variant:"danger"}),f}},isLoading:a}},{useMutation:Kgt}=await F("@tanstack/react-query"),Jgt="/program/load",Ygt=async i=>await Ut.post(Jgt,i),CRe=()=>Kgt({mutationFn:Ygt}),{useCallback:Qme,useRef:Xgt,useState:Qgt}=await F("react"),SRe=()=>{const i=Xgt(!1),{t:e}=q(),t=ie(h=>h.isChanged),n=ie(h=>h.setInitialInfo),{confirmDialog:s}=jn(),{refetch:o}=As(),[r,a]=Qgt(!1),{mutateAsync:l}=CRe(),c=Qme(h=>{a(h),i.current=h},[]);return{handleLoadProgram:Qme(async(h,g)=>{const{programId:m,programName:f}=h;if(!m&&i.current)return;if(g?!0:await s({title:e("program.modal.button.load"),content:x(U,{className:"gap-1",children:[u("p",{className:"text-base",children:e("program.load.confirm.content",{programName:f})}),u("span",{className:"text-sm text-slate-400",children:t?e("program.load.confirm.unsavedNotice"):""})]})}))try{c(!0);const{program:_,mainSteps:b,subSteps:v,mainTasks:w}=await l({programId:m});n({programInfo:_,treeItems:b,subTreeItems:v,beginInfo:w.reduce((y,S)=>(y[S.taskId]=S.begin,y),{})},!0),o()}catch(_){rt.openToast({title:e("program.load.toast.failTitle"),content:e("program.load.toast.failContent"),type:"basic",variant:"danger"}),console.error(_)}finally{c(!1)}},[s,t,l,o,n,c,e]),isLoading:r}},Zgt=({className:i,programItem:e,selectedProgramId:t,handleSelectProgram:n})=>{const{t:s}=q();return x(U,{"data-pad-focus":"true",className:P("LoadProgramItem","bg-fill-inverse-subtle/40 cursor-pointer gap-2 rounded-lg border-2 border-transparent px-3 py-2",{"border-navy-stronger":t===e.programId},i),onClick:()=>n(e.programId),children:[x(H,{justifyContent:"space-between",alignItems:"center",children:[u("h5",{className:"typo-compact-xs2-semibold text-fg-default",children:e.name}),x(H,{justifyContent:"space-between",alignItems:"center",className:"typo-compact-2xs-normal gap-1",children:[u("h6",{className:"text-fg-subtle",children:s("program.modal.button.lastLoadedAt")}),u("h6",{className:"text-fg-default text-end",children:Cr(e.lastLoadedAt,"YYYY-MM-DD")})]})]}),x(H,{justifyContent:"space-between",alignItems:"center",children:[x(H,{justifyContent:"space-between",alignItems:"center",className:"gap-1",children:[u("h6",{className:"text-fg-subtle typo-compact-xs-normal",children:s("program.modal.desc.repeatCount")}),u("h6",{className:"text-fg-default typo-compact-xs-semibold text-end",children:e.repeatCnt===-1?"Infinite":e.repeatCnt})]}),x(H,{justifyContent:"space-between",alignItems:"center",className:"typo-compact-2xs-normal gap-1",children:[u("h6",{className:"text-fg-subtle",children:s("program.modal.button.createdAt")}),u("h6",{className:"text-fg-default text-end",children:Cr(e.createdAt,"YYYY-MM-DD")})]})]})]},e.programId)},xRe=async i=>({file:dt.get(i,"target.files[0]",null)??null}),emt=(i,e="")=>{const t=window.URL.createObjectURL(new Blob([i.data])),n=document.createElement("a");if(!e){e="unknown";const s=i.headers["content-disposition"];if(s){const[o]=s.split(";").filter(r=>r.includes("filename"));o&&([,e]=o.split("="))}}n.href=t,n.setAttribute("download",decodeURI(e)),n.style.cssText="display:none",document.body.appendChild(n),n.click(),n.remove()},{useMutation:tmt}=await F("@tanstack/react-query"),nmt="/program/export/{program_key}",imt=async({programId:i,programName:e,taskId:t})=>{const n=nmt.replace("{program_key}",i),s=await Ije.get(`${Uie}/common${n}`,{params:{taskId:t},responseType:"blob"});emt(s,`muscat_program_${e}.zip`)},smt=()=>tmt({mutationFn:imt}),{useMemo:Zme,useState:KO}=await F("react"),v8=[{key:"lastLoadedAt",label:"program.modal.button.lastLoadedAt"},{key:"createdAt",label:"program.modal.button.createdAt"},{key:"updatedAt",label:"program.modal.button.updatedAt"}],i6=({className:i,open:e,onOpenChange:t,close:n,resolve:s})=>{const{t:o}=q(),r=ie(M=>M.programInfo),[a,l]=KO(""),[c,d]=KO(""),[h,g]=KO(null),[m,f]=KO(0),{coreSwList:p}=Fi(),{data:_,refetch:b}=lRe({search_name:"",last_load_order:!0}),{handleDeleteProgram:v,isLoading:w}=qgt(),{handleLoadProgram:y,isLoading:S}=SRe(),{mutateAsync:C}=smt(),N=Zme(()=>{if(!_?.programs)return[];const M=_.programs.filter(B=>B.name.toLowerCase().includes(a.toLowerCase())),O=v8[m].key;return[...M].sort((B,z)=>{const Y=new Date(B[O]).getTime();return new Date(z[O]).getTime()-Y})},[_,a,m]),k=Zme(()=>o(v8[m].label),[o,m]),L=()=>{f(M=>(M+1)%v8.length)},D=M=>{l(M.toString()),g(null)},T=M=>{g(M)},E=async()=>{await y({programId:h,programName:N?.find(M=>M.programId===h)?.name}),s(h)},R=async()=>{if(h)try{await v({programId:h,programName:N?.find(M=>M.programId===h)?.name}),b(),r?.programId===h&&n(),g(null)}catch(M){console.error(M)}},A=async()=>{if(h)try{await C({programId:h,programName:_?.programs?.find(M=>M.programId===h)?.name})}catch(M){console.error(M)}};return u(Uo,{className:P(i,"block w-[80vw] !max-w-230 border-none p-0"),open:e,onOpenChange:t,disableAutoFocus:!0,header:{title:o("program.modal.title.load"),description:o("program.modal.desc.load")},footer:x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[x(H,{className:P("[&_button]:typo-compact-xs2-semibold gap-1 [&_button]:h-8"),alignItems:"center",children:[u(se,{className:"",variant:"outlined",leadingIcon:u(aJe,{className:"w-3.5"}),disabled:!h,loading:w,onClick:A,children:o("program.modal.button.export")}),u(se,{className:"w-20",variant:"outlined",leadingIcon:u(Y0,{}),disabled:!h,loading:w,onClick:R,children:o("program.modal.button.delete")}),u(se,{className:"w-35",variant:"soft",disabled:N?.length===0,loading:S,onClick:L,children:`${o("program.modal.button.order")}: ${k}`})]}),x(H,{className:"gap-1",alignItems:"center",children:[u(se,{variant:"outlined",size:"sm",onClick:n,children:o("program.modal.button.cancel")}),u(se,{variant:"brand",size:"sm",disabled:!h,loading:S,onClick:E,children:o("program.modal.button.load")})]})]}),children:x(H,{className:"h-100 max-h-[80vh] gap-4 px-4 pt-3 pb-0",children:[x(U,{className:"h-full w-90",children:[u(et,{className:"mb-2.5 h-10 w-full",type:"search",placeholder:o("program.modal.placeholder.search"),autoFocus:!1,value:a,handleChange:D}),u(U,{className:"bg-raised relative max-h-[50vh] min-h-60 flex-1 gap-1.5 overflow-y-auto rounded-sm p-2",children:u(qr,{list:N,loadingWrapperClassName:P("h-full","[&>svg]:size-8"),noDataMsgClassName:P("h-full flex-1","[&_.no-data-text]:typo-compact-sm-normal"),noDataMsg:"Program not found",children:({item:M})=>u(Zgt,{programItem:M,selectedProgramId:h,handleSelectProgram:T},M.programId)})})]}),u(cRe,{className:"h-full",robotModel:c,robotModelList:p,selectedProgramId:h,onRobotModelChange:d})]})})},{useState:omt}=await F("react"),rmt=({className:i,open:e,onOpenChange:t,resolve:n,close:s})=>{const{t:o}=q(),r=ie(m=>m.programInfo),a=ie(m=>m.setProgramInfo),[l,c]=omt({name:r?.name||"",repeatType:r?.repeatCnt===-1?"infinite":"direct",repeatCnt:r?.repeatCnt||1}),d=!l.name||!l.repeatCnt,h=(m,f)=>{if(f==="repeatType"){c(p=>({...p,repeatCnt:m==="infinite"?-1:1,repeatType:m}));return}c(p=>({...p,[f]:m}))},g=async()=>{const m={...r,name:l.name,repeatCnt:l.repeatCnt};a(m),n(m)};return u(Uo,{className:P(i,"block border-none p-0"),open:e,onOpenChange:t,disableAutoFocus:!0,header:{title:o("program.modal.title.edit"),description:o("program.modal.desc.edit")},footer:x(H,{className:"h-8 w-full gap-1",alignItems:"center",justifyContent:"flex-end",children:[u(se,{variant:"outlined",size:"sm",onClick:s,children:o("program.modal.button.cancel")}),u(se,{variant:"brand",size:"sm",disabled:d,onClick:g,children:o("settings.button.edit")})]}),children:x(U,{className:"gap-4 px-4 pt-3 pb-4",children:[x(U,{className:"gap-1.5",children:[u("h6",{className:"typo-compact-xs-semibold text-fg-default",children:o("program.modal.label.programName")}),u(et,{className:"h-10 w-full",name:"name",type:"text",value:l.name,handleChange:h,validate:/^[a-zA-Z0-9_-]+$/})]}),x(U,{className:"gap-1.5",children:[u("h6",{className:"typo-compact-xs-semibold text-fg-default",children:o("program.modal.desc.repeatCount")}),x("div",{className:"grid w-full grid-cols-[9.375rem_1fr] gap-2",children:[u("div",{className:"min-w-0",children:x(ae,{name:"repeatType",className:"w-full",value:l.repeatType,handleChange:h,children:[u(J,{value:"direct",children:o("program.modal.label.directInput")}),u(J,{value:"infinite",children:o("dashboard.content.infinite")})]})}),u("div",{className:"min-w-0",children:u(et,{className:"h-10 w-full",name:"repeatCnt",type:"number",validate:l.repeatType==="direct"?/^[1-9]\d*$/:void 0,value:l.repeatCnt,disabled:l.repeatType==="infinite",handleChange:h})})]})]})]})})},{useState:amt}=await F("react"),y8=({className:i,axisKey:e,values:t})=>{const{theme:n}=tt(),s=e.every(l=>typeof l=="number"),[o,r]=amt({tcp_enc:!1,tcp_ref:!1,joint_ref:!1,joint_enc:!1,joint_Esti:!1,joint_TMeas:!1,joint_temper:!1,box_output:!1,box_input:!1,ext_output:!1,ext_input:!1,tool_output:!1,tool_input:!1}),a=l=>{r(c=>({...c,[l]:!c[l]}))};return u("div",{className:P("ManipulateValuesCard",n==="light"?"bg-white":"bg-alt-1","w-full rounded-md px-2 py-1.5",i),children:x(U,{className:"gap-0.5",children:[x("div",{className:P("typo-compact-xs-semibold grid grid-cols-[7rem_repeat(7,minmax(0,1fr))] items-center pt-0.5 pb-1 text-center",{"grid-cols-[7rem_repeat(16,minmax(0,1fr))]":s}),children:[u("h6",{}),e.map(l=>typeof l=="string"?u("h6",{className:P("text-fg-default",{"text-fg-danger":l.includes("x"),"text-fg-success":l.includes("y"),"text-fg-information":l.includes("z"),"text-fg-caution":l.includes("aa")}),children:l.toUpperCase()},l):u("h6",{className:"text-fg-default",children:l}))]}),u(_o,{className:"w-full"}),Object.entries(t).map(([l,c])=>x("div",{onClick:()=>a(l),className:P("grid grid-cols-[7rem_repeat(7,minmax(0,1fr))] place-items-center","border border-transparent py-1","typo-compact-xs-medium text-fg-subtle","hover:cursor-pointer",{"border-subtle bg-fill-subtle rounded-md text-white":o[l],"grid-cols-[7rem_repeat(16,minmax(0,1fr))]":s}),children:[u("h6",{className:"justify-self-start pl-1.5",children:l.toUpperCase()}),Object.keys(c).map(d=>s?u("div",{className:P("aspect-square size-2 self-center rounded-sm",{"bg-fg-danger":c[d]===0,"bg-fg-success":c[d]===1})},d):u("span",{className:"text-center",children:l.includes("temper")?c[d]+"℃":l.includes("ref")||l.includes("enc")?c[d].toFixed(3)+"º":c[d].toFixed(3)},d))]},l))]})})},{useMemo:ED}=await F("react"),lmt=({className:i,robotModel:e})=>{const{carteXRef:t,carteXEnc:n,jointQRef:s,jointQEnc:o,jointTEsti:r,jointTMeas:a,jointTemper:l,cboxDigitalOutput:c,cboxDigitalInput:d,exDigitalInput:h,exDigitalOutput:g,toolDigitalInput:m,toolDigitalOutput:f}=ws(e,y=>({carteXRef:y.carteXRef,carteXEnc:y.carteXEnc,jointQRef:y.jointQRef,jointQEnc:y.jointQEnc,jointTEsti:y.jointTEsti,jointTMeas:y.jointTMeas,jointTemper:y.jointTemper,cboxDigitalOutput:y.cboxDigitalOutput,cboxDigitalInput:y.cboxDigitalInput,exDigitalInput:y.exDigitalInput,exDigitalOutput:y.exDigitalOutput,toolDigitalInput:y.toolDigitalInput,toolDigitalOutput:y.toolDigitalOutput})),p=ED(()=>({tcp_enc:k0.filter(y=>y!=="").reduce((y,S,C)=>(y[S]=n?.[C]??0,y),{}),tcp_ref:k0.filter(y=>y!=="").reduce((y,S,C)=>(y[S]=t?.[C]??0,y),{})}),[t,n]),_=ED(()=>["j0","j1","j2","j3","j4","j5","j6"],[]),b=ED(()=>({joint_ref:_.reduce((y,S,C)=>(y[S]=s?.[C]??0,y),{}),joint_enc:_.reduce((y,S,C)=>(y[S]=o?.[C]??0,y),{}),joint_Esti:_.reduce((y,S,C)=>(y[S]=r?.[C]??0,y),{}),joint_TMeas:_.reduce((y,S,C)=>(y[S]=a?.[C]??0,y),{}),joint_temper:_.reduce((y,S,C)=>(y[S]=l?.[C]??0,y),{})}),[s,o,r,a,l,_]),v=ED(()=>Array.from({length:16},(S,C)=>C),[]),w=ED(()=>{const y=c?.u,S=d?.u,C=g?.u,N=h?.u,k=f?.u,L=m?.u;return{box_output:v.reduce((D,T,E)=>(D[T]=y?.[E]??0,D),{}),box_input:v.reduce((D,T,E)=>(D[T]=S?.[E]??0,D),{}),ext_output:v.reduce((D,T,E)=>(D[T]=C?.[E]??0,D),{}),ext_input:v.reduce((D,T,E)=>(D[T]=N?.[E]??0,D),{}),tool_output:v.reduce((D,T,E)=>(D[T]=k?.[E]??0,D),{}),tool_input:v.reduce((D,T,E)=>(D[T]=L?.[E]??0,D),{})}},[c,d,h,g,m,f,v]);return u("div",{className:P("ManipulateDetailInfo","bg-bg-overlay rounded-b-lg [&_div]:!outline-none",i),children:u("div",{className:"px-4 pb-4",children:x(U,{className:"gap-2",children:[u(y8,{axisKey:k0,values:p}),u(y8,{axisKey:_,values:b}),u(y8,{axisKey:v,values:w})]})})})},cmt=({className:i,infoKeys:e,values:t})=>u("div",{className:P("AmrMotorValuesCard","bg-bg-alt-1 w-full rounded-md px-2 py-1.5",i),children:x(U,{className:"gap-0.5",children:[x("div",{className:P("typo-compact-2xs-semibold grid grid-cols-[5rem_repeat(4,minmax(0,1fr))] items-center pt-0.5 pb-1 text-center"),children:[u("h6",{}),e.map(n=>u("h6",{className:"text-fg-default",children:"Motor_"+n},n))]}),u(_o,{className:"w-full"}),Object.keys(Object.values(t)[0]||{}).map(n=>x("div",{className:"typo-compact-2xs-medium grid grid-cols-[5rem_repeat(4,minmax(0,1fr))] items-center py-1 text-center",children:[u("h6",{className:"text-fg-subtle justify-self-start pl-1.5 capitalize",children:n}),e.map(s=>{const r=t[Number(s)]?.[n],a=typeof r=="number";let l=String(r);return n.includes("temp")&&a?l=`${r.toFixed(1)}℃`:n.includes("current")&&a?l=`${r.toFixed(1)}A`:n==="connection"&&(l=r?"ON":"OFF"),u("span",{className:P("text-default",{"text-fg-success":n==="connection"&&r===!0,"text-fg-danger":n==="connection"&&r===!1}),children:l},`${s}-${n}`)})]},n))]})}),df=({className:i,title:e,value:t})=>x(H,{className:P("AmrDetailValues","typo-compact-xs-medium py-1",i),justifyContent:"space-between",alignItems:"center",children:[u("h6",{className:"text-fg-subtle justify-self-start pl-1.5",children:e}),u("span",{className:"text-fg-subtler",children:t})]}),{useMemo:dmt}=await F("react"),umt=({className:i,robotModel:e})=>{const{motor:t,power:n,robotState:s}=Jk(e,r=>({motor:r.motor,power:r.power,robotState:r.robotState})),o=dmt(()=>Object.keys(t),[t]);return u("div",{className:P("AmrDetailInfo","bg-bg-overlay rounded-b-lg [&_div]:!outline-none",i),children:u("div",{className:"px-4 pb-4",children:x(U,{className:"gap-2",children:[u(cmt,{infoKeys:o,values:t}),x(H,{className:"gap-2",children:[u("div",{className:"bg-bg-alt-1 w-full rounded-md px-2 py-1.5",children:x(U,{className:"gap-0.5",children:[u(df,{title:"Total Power",value:n.totalPower.toFixed(0)}),u(df,{title:"Power",value:n.power.toFixed(0)}),u(df,{title:"Battery In/Out",value:`${n.batIn.toFixed(2)} / ${n.batOut.toFixed(2)}`}),u(df,{title:"Battery Current",value:n.batCurrent.toFixed(2)}),u(df,{title:"Battery Percentage",value:n.batPercent.toFixed(0)+"%"})]})}),u("div",{className:"bg-bg-alt-1 w-full rounded-md px-2 py-1.5",children:x(U,{className:"gap-0.5",children:[u(df,{title:"EMO",value:s.emo.toString()}),u(df,{title:"Robot State Power",value:s.power.toString()}),u(df,{title:"SF Bumper Detect",value:s.sfBumperDetect.toString()}),u(df,{title:"SF Obs Detect",value:s.sfObsDetect.toString()}),u(df,{title:"SF Operational Stop",value:s.sfOperationalStop.toString()})]})})]})]})})})},NRe=({className:i,robotModel:e,service:t,open:n,onOpenChange:s})=>{const{t:o}=q();return u(Uo,{className:P(i,"!max-h-140 w-160 max-w-full border-none p-0"),enableDimClose:!1,open:n,onOpenChange:s,header:{title:e},children:t===""?u(rn,{children:u("div",{className:"flex min-h-100 items-center justify-center text-2xl",children:o("dashboard.detail.robotNotConnected")})}):t==="manipulate"?u(lmt,{robotModel:e}):t==="amr"?u(umt,{robotModel:e}):null})},{useMemo:efe}=await F("react"),hmt=({className:i,robotModel:e})=>{const{t}=q(),{modal:n}=Vi(),{theme:s}=tt(),o=ie(w=>w.treeItems),r=ie(w=>w.subTreeItems),a=ie(w=>w.beginInfo),l=ie(w=>w.setInitialInfo),{data:c}=As(),{data:d,refetch:h}=Sp({programId:c?.info?.programId||""}),{playState:g}=nL(),{mutateAsync:m}=wRe(),f=efe(()=>d?.program,[d?.program]),p=efe(()=>({state:g,lampType:g==="idle"?"normal":g==="play"?"success":g==="waiting"?"warning":"danger"}),[g]),_=()=>{n({component:i6})},b=async()=>{const w=await n({component:rmt});w&&(await m({programId:w.programId,name:w.name,repeatCnt:w.repeatCnt}),l({programInfo:w,treeItems:o,subTreeItems:r,beginInfo:a}),h())},v=()=>{n({component:NRe,props:{robotModel:e,service:c?.modelInfo?.be_service}})};return u(My,{className:P("RobotInfo",i),children:x(U,{className:"bg-bg-surface-3 h-full",children:[u("div",{className:"relative flex w-full flex-1",children:u(Ym,{className:"absolute top-0 left-0 z-[1] size-full",robotModel:e,cameraPositionKey:"robot-info"})}),u("div",{className:"h-fit w-full p-3",children:x(U,{className:P("gap-2","[&>div]:flex-1 [&>div]:gap-7"),children:[x(H,{children:[u(NS,{title:t("dashboard.content.alias"),content:c?.modelInfo?.alias||"-"}),u(NS,{testId:"robot-info-model",title:t("dashboard.content.model"),content:c?.modelInfo?.model||"-"})]}),x(H,{children:[u(NS,{testId:"robot-info-serial",title:"S/N",content:c?.info?.serialNumber||"-"}),u(NS,{title:t("menu.title.program"),content:f?x(H,{className:"h-full gap-1",alignItems:"center","data-testid":"robot-info-program",children:[u("span",{children:f?.name}),u(Yt,{variant:"soft",size:"3xs",className:s==="light"?"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy":void 0,"data-testid":"robot-info-program-load",icon:u(Ty,{}),onClick:_})]}):u("span",{className:"text-fg-subtle",children:"-"})})]}),x(H,{children:[u(NS,{title:t("dashboard.content.status"),content:x(H,{className:"h-full gap-1",alignItems:"center",children:[u(QP,{lampType:p.lampType}),u("span",{className:"text-fg-default font-['Pretendard_Variable'] text-sm leading-5 font-semibold",children:p.state?.toUpperCase()})]})}),u(NS,{title:t("dashboard.content.repeat"),content:f?x(H,{className:"h-full gap-1",alignItems:"center","data-testid":"robot-info-repeat",children:[u("span",{children:f?.repeatCnt===-1?t("dashboard.content.infinite"):f?.repeatCnt}),u(Yt,{"data-pad-focus":"true",variant:"soft",size:"3xs",className:s==="light"?"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy":void 0,"data-testid":"robot-info-repeat-edit",icon:u(Ty,{}),onClick:b})]}):"-"})]})]})}),c?.info?.components?.length===1&&u(H,{className:"h-fit w-full gap-2 p-2",children:u(se,{"data-pad-focus":"true",className:"h-7 w-full",variant:"outlined",size:"xs",onClick:v,children:t("dashboard.button.detail")})})]})})},{useQuery:gmt,useQueryClient:mmt}=await F("@tanstack/react-query"),{useMemo:fmt}=await F("react"),IRe="/list",pmt=async i=>{const{fromDate:e,toDate:t}={...i},n={...i,fromDate:e?hB(e):void 0,toDate:t?hB(t):void 0};return $ie.get(IRe,{params:n})},Xse=(i,e={})=>{const t=mmt(),n=fmt(()=>[IRe,i],[i]);return{...gmt({queryKey:n,queryFn:async()=>{try{return await pmt(i)}catch(o){throw t.setQueryData(n,{items:[],totalCount:0,hasNext:!1}),o}},gcTime:0,staleTime:0,...e}),queryKey:n}},{useEffect:_mt,useState:bmt}=await F("react"),kRe=i=>i?Array.isArray(i)?i:[i]:[],vmt=()=>{const{data:i,loading:e,changeData:t}=ls("log/state_log"),[n,s]=bmt([]);return _mt(()=>{const o=kRe(i);o.length>0&&s(r=>[...[...o].reverse(),...r].slice(0,30))},[i]),{realTimeLogList:n,logData:i,loading:e,changeData:t}},{useCallback:ymt,useEffect:tfe,useState:nfe}=await F("react"),Qse=i=>{const{logData:e,changeData:t}=vmt(),{data:n}=Xse(i,{gcTime:0,staleTime:100}),[s,o]=nfe("play"),[r,a]=nfe(null),l=ymt(c=>{o(c)},[]);return tfe(()=>{if(e&&s==="play"){const c=kRe(e).filter(d=>!i?.swName||i.swName==="RRS"||d.swName===i.swName).map(d=>({...d,_id:dt.uniqueId()}));c.length>0&&a(d=>d&&[...c.reverse(),...d])}t(null)},[e,s,t,i.swName]),tfe(()=>{n&&a(n.items??[])},[n]),{realTimeLogList:r,playStatus:s,handlePlayStatus:l}},Zse=["info","warning","error","user","debug","general"],eoe=Zse.reduce((i,e,t)=>(i[t]=e,i),{});Zse.reduce((i,e,t)=>(i[e]=t,i),{});const WB={info:u(DE,{className:"text-fg-information size-full"}),warning:u(X0,{className:"text-fg-warning size-full"}),debug:u(KLe,{className:"text-fg-subtler size-full"}),user:u(DE,{className:"text-fg-information size-full"}),error:u(X0,{className:"text-fg-danger size-full"}),general:u(DE,{className:"text-fg-information size-full"})},LRe=({className:i,logList:e,showDetail:t})=>{const{theme:n}=tt();return u(U,{className:P("SimpleLogList",n==="light"?"text-fg-default":"text-fg-subtle","typo-code-xs-normal gap-1 px-3 py-2.5",i),children:u(qr,{list:e,noDataMsg:"There is no log.",noDataMsgClassName:"min-h-[17rem] [&_.no-data-text]:typo-compact-sm-medium",children:({item:s})=>x(H,{children:[x(H,{className:"gap-1",children:[u("span",{className:"size-3.5",children:WB[String(s.level).toLowerCase()]||WB[eoe[Number(s.level)]]}),u("span",{className:"min-w-[4.375rem]",children:t?Cr(s.createdAt,"YYYY-MM-DD HH:mm:ss"):Cr(s.createdAt,"HH:mm:ss")})]}),x("p",{className:"line-clamp-2",children:["[",s.swName,"] ",s.contents]})]},s._id)})})},wmt=({className:i,open:e,onOpenChange:t,limit:n})=>{const{t:s}=q(),o=ir(),{realTimeLogList:r,playStatus:a,handlePlayStatus:l}=Qse({limit:n}),c=()=>{o(w9)};return u(Uo,{className:P(i,"block !max-w-[70vw] border-none p-0"),open:e,onOpenChange:t,header:{title:s("dashboard.title.recentLogs")},footer:x(H,{className:"h-8 w-full",alignItems:"center",justifyContent:"space-between",children:[u(se,{variant:"outlined",leadingIcon:a==="play"?u(aA,{}):u(FI,{}),onClick:()=>l(a==="play"?"pause":"play"),children:s(a==="play"?"dashboard.button.stop":"dashboard.button.play")}),u(se,{variant:"brand",onClick:c,children:s("dashboard.button.viewAllLogs")})]}),children:u("div",{className:"!bg-bg-alt-2 flex h-full flex-col justify-between",children:u(Km,{className:"h-[calc(var(--vh,1vh)*70)]",children:u(LRe,{logList:r})})})})},Cmt=({className:i,limit:e=100,logListClassName:t})=>{const{t:n}=q(),{theme:s}=tt(),{modal:o}=Vi(),r=ir(),{realTimeLogList:a,playStatus:l,handlePlayStatus:c}=Qse({limit:e}),d=()=>{o({component:wmt,props:{limit:100}})},h=()=>{r(w9)};return u(My,{className:P(i),testId:"recent-logs",contentsScrollable:!0,title:n("dashboard.title.recentLogs"),lightTitleClassName:"bg-overlay",childrenClassName:s==="light"?"bg-white":"bg-alt-2",titleButton:u(Yt,{"data-testid":"recent-logs-expand",icon:u(_9,{}),variant:"transparent",size:"3xs",onClick:d}),footer:x(H,{className:P("gap-1","[&_button]:h-7 [&_button]:w-full [&_button]:px-2"),children:[u(se,{size:"xs",variant:"outlined",onClick:()=>c(l==="play"?"pause":"play"),children:n(l==="play"?"dashboard.button.stop":"dashboard.button.play")}),u(se,{className:s==="light"?"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy":void 0,size:"xs",variant:"soft",onClick:h,children:n("dashboard.button.viewAllLogs")})]}),children:u("div",{className:P("RecentLogs","h-full","flex flex-col","justify-between"),children:u(LRe,{className:P(t),logList:a})})})},{useQueries:Smt,useQuery:xmt}=await F("@tanstack/react-query"),DRe="{robot_model}/call_whoami",TRe=async({namespace:i})=>{try{const e=DRe.replace("{robot_model}",i);return Ut.get(e,{skipErrorToast:!0})}catch(e){console.error(e)}},ERe=i=>[DRe,i],Nmt=(i,{enabled:e=!0,...t}={})=>xmt({queryKey:ERe(i),queryFn:()=>TRe(i),retry:1,staleTime:1e3,...t,refetchOnMount:!0,enabled:!!i?.namespace&&!!e}),Imt=(i,{enabled:e=!0,...t}={})=>Smt({queries:i.map(n=>({queryKey:ERe(n),queryFn:()=>TRe(n),...t,refetchOnMount:!0,enabled:!!n?.namespace&&!!e}))}),PRe=i=>{const{data:e,loading:t}=ls("common/state_core",{selector:i});return{...e,loading:t}},{useMemo:kmt}=await F("react"),RRe=({className:i,model:e,alias:t,beService:n,connectedStatus:s,programTaskExecuteState:o,setSelectedRobotModel:r,componentSize:a="md"})=>{const{theme:l}=tt(),{t:c}=q(),{modal:d}=Vi(),h=ir(),{data:g}=Nmt({namespace:e}),m=a==="md",f={containerPadding:m?"px-2.5 py-3":"",gridCols:m?"grid-cols-2":"grid-cols-4",actionWidth:m?"w-20":"w-36",actionLayout:m?U:H,aliasTypo:m?"typo-compact-sm-semibold":"typo-compact-xs2-semibold"},p=f.actionLayout,{isRealMode:_,motorTempers:b}=PRe(N=>({isRealMode:N?.[e]?.statusIsRefon===1,motorTempers:N?.[e]?.jointTemper??[],toolName:N?.[e]?.toolName||""})),{motor:v,isAmrRealMode:w}=Jk(e,N=>({motor:N.motor,isAmrRealMode:N.robotState.simul===!1})),y=kmt(()=>{const N={mode:"",motorAvgTemp:0,type:"",lampType:"information"};switch(o){case"idle":N.lampType="normal";break;case"paused":case"stopped":case"error":N.lampType="danger";break;case"waiting":N.lampType="warning";break;default:N.lampType="success";break}const k=n==="manipulate"?_:w;return N.mode=k?"Real":"Simulation",N.motorAvgTemp=Number(n==="manipulate"?(b&&b.length>0?b.reduce((L,D)=>L+D,0)/b.length:0).toFixed(2):(v&&v.length>0?v.reduce((L,D)=>L+(D.temp||0),0)/v.length:0).toFixed(2)),N.type=n,N},[n,_,w,b,v,o]),S=()=>{r(e),h("/muscat/app/move")},C=()=>{d({component:NRe,props:{robotModel:e,service:n}})};return u("div",{className:P("RobotComponentItem",l==="light"?"bg-white":"bg-alt-2",f.containerPadding,i),children:x("div",{className:"justify-between",children:[x(H,{className:"mb-2",alignItems:"center",justifyContent:"space-between",children:[x(H,{className:"gap-1",alignItems:"center",children:[u("span",{className:P(f.aliasTypo,"text-fg-default"),children:t||"-"}),u("span",{className:"typo-compact-xs-medium text-slate-400",children:e?`(${e})`:""})]}),x(H,{className:"gap-2",alignItems:"center",children:[!m&&x(H,{className:"gap-0.5",alignItems:"center",children:[u(QP,{lampType:y?.lampType,size:"sm"}),u("span",{className:"typo-compact-xs2-semibold text-fg-default",children:o})]}),u(CA,{status:s,size:m?"xs":"2xs"})]})]}),x(H,{className:"gap-1",alignItems:"flex-end",justifyContent:"space-between",children:[x("div",{className:P("grid flex-1 grid-cols-4 gap-1",f.gridCols,"[&_.robot-info-item>span:first-child]:typo-compact-2xs-normal [&_.robot-info-item>span:first-child]:text-fg-subtler","[&_.robot-info-item>span:last-child]:typo-compact-xs2-semibold [&_.robot-info-item>span:last-child]:text-fg-default",{"grid-cols-2":m,"[&_.robot-info-item>span:last-child]:typo-compact-xs2-semibold":m}),children:[x(U,{className:"robot-info-item",children:[u("span",{children:c("dashboard.content.type")}),u("span",{children:n||"-"})]}),x(U,{className:"robot-info-item",children:[u("span",{children:c("dashboard.content.motorAvgTmp")}),u("span",{children:(Number.isNaN(y?.motorAvgTemp)?"":y?.motorAvgTemp)+(Number.isNaN(y?.motorAvgTemp)?"-":"°C")})]}),x(U,{className:"robot-info-item",children:[u("span",{children:c("dashboard.content.mode")}),u("span",{children:y?.mode||"-"})]}),x(U,{className:"robot-info-item",children:[u("span",{children:c("dashboard.content.version")}),u("span",{children:g?.version||"-"})]}),m&&x(H,{className:"gap-0.5",alignItems:"center",children:[u(QP,{lampType:y?.lampType,size:"sm"}),u("span",{className:"typo-compact-2xs-semibold text-fg-default uppercase",children:o})]})]}),x(p,{className:P(f.actionWidth,"gap-1","[&_>button]:h-6 [&_>button]:px-1.5"),children:[u(se,{className:"w-full",variant:"outlined",size:"2xs",onClick:S,children:c("dashboard.button.moveControl")}),u(se,{className:P("w-full",l==="light"&&"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy"),variant:"soft",size:"2xs",disabled:s==="DISCONNECT",onClick:C,children:c("dashboard.button.detail")})]})]})]})})},{useQuery:Lmt}=await F("@tanstack/react-query"),MRe="/program/executor/state",Dmt=()=>Ut.get(MRe),toe=(i={})=>Lmt({queryKey:[MRe],queryFn:Dmt,...i}),{useEffect:Tmt,useMemo:Emt}=await F("react"),Pmt=({className:i,open:e,onOpenChange:t,systemStateData:n,setSelectedRobotModel:s})=>{const{t:o}=q(),{data:r,refetch:a}=toe({enabled:!1}),{playState:l}=Xm(d=>({playState:d?.playState})),c=Emt(()=>{const d={};return Object.entries(r?.byRobotModel??{}).forEach(([h,g])=>{console.log(g);const m=Object.values(g??{}).find(f=>f.isMainTask);m&&(d[h]=m)}),d},[r]);return Tmt(()=>{a()},[l,a]),u(Uo,{className:P(i,"block !w-[34.375rem] max-w-full border-none p-0"),open:e,onOpenChange:t,header:{title:o("dashboard.title.robotComponents")},children:u("div",{className:"bg-bg-alt-2 flex max-h-121 flex-col justify-between px-4 pt-3 pb-4",children:u(qr,{list:n.core_sw_list,noDataMsg:"No Robot Components",noDataMsgClassName:"w-full text-center",loadingWrapperClassName:"[&_svg]:text-[#eee] [&_svg]:size-[2.5rem]",children:({item:d,index:h})=>x("div",{children:[u(RRe,{componentSize:"lg",model:d.model,alias:d.alias,beService:d.be_service,programTaskExecuteState:c?.[d.model]?.state??"idle",connectedStatus:d.connected,setSelectedRobotModel:s},d.model),h!==n.core_sw_list.length-1&&u(_o,{className:"my-2.5"})]})})})})},{useEffect:Rmt,useMemo:Mmt}=await F("react"),Amt=({className:i})=>{const{theme:e}=tt(),{modal:t}=Vi(),{t:n}=q(),{setSelectedRobotModel:s}=ui(),{data:o}=Jm(h=>({core_sw_list:h?.core_sw_list})),{data:r,refetch:a}=toe({enabled:!1}),{playState:l}=Xm(h=>({playState:h?.playState})),c=Mmt(()=>{const h={};return Object.entries(r?.byRobotModel??{}).forEach(([g,m])=>{console.log(m);const f=Object.values(m??{}).find(p=>p.isMainTask);f&&(h[g]=f)}),h},[r]),d=()=>{t({component:Pmt,props:{systemStateData:o,setSelectedRobotModel:s}})};return Rmt(()=>{a()},[l,a]),u(My,{className:P("RobotComponents",i),title:n("dashboard.title.robotComponents"),lightTitleClassName:"bg-overlay",childrenClassName:e==="light"?"bg-white":"bg-alt-2",titleButton:u(Yt,{"data-testid":"robot-components-expand",icon:u(_9,{}),variant:"transparent",size:"3xs",onClick:d}),contentsScrollable:!0,children:u("div",{className:P("bg-bg-surface-2 overflow-y-auto","[&>*]:border-border-subtle [&>*]:border-b"),children:u(qr,{list:o.core_sw_list,noDataMsg:"No Robot Components",noDataMsgClassName:"w-full text-center",loadingWrapperClassName:"[&_svg]:text-[#eee] [&_svg]:size-[2.5rem]",children:({item:h})=>u("div",{children:u(RRe,{model:h.model,alias:h.alias,beService:h.be_service,programTaskExecuteState:c?.[h.model]?.state??"idle",connectedStatus:h.connected,setSelectedRobotModel:s},h.model)})})})})},{useCallback:Omt,useMemo:Fmt}=await F("react"),xp=i=>{const{data:e}=Ph(),{joint_states:t}=dw(i,o=>({joint_states:o?.joint_states})),n=Fmt(()=>{const o=e?.components?.[i];return o?.type!=="array"?[]:o?.mapper??[]},[i,e?.components]),s=Omt(o=>o.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase()),[]);return{jointStates:t,jointNames:n,toJointNameText:s}},{useMutation:Bmt}=await F("@tanstack/react-query"),Vmt="/{robot_model}/power",zmt=({robotModel:i,...e})=>Pa.post(Vmt.replace("{robot_model}",i),e),Wmt=()=>Bmt({mutationFn:zmt}),{useMutation:Hmt}=await F("@tanstack/react-query"),$mt="/{robot_model}/servo",Umt=({robotModel:i,...e})=>Pa.post($mt.replace("{robot_model}",i),e),jmt=()=>Hmt({mutationFn:Umt}),{useMutation:Gmt}=await F("@tanstack/react-query"),qmt="/{robot_model}/control_manager",Kmt=({robotModel:i,...e})=>Pa.post(qmt.replace("{robot_model}",i),e),Jmt=()=>Gmt({mutationFn:Kmt}),{useMutation:Ymt}=await F("@tanstack/react-query"),Xmt="/{robot_model}/tool_flange_power",Qmt=({robotModel:i,...e})=>Pa.post(Xmt.replace("{robot_model}",i),e),Zmt=()=>Ymt({mutationFn:Qmt}),{useMutation:eft}=await F("@tanstack/react-query"),tft="/{robot_model}/brake",nft=({robotModel:i,...e})=>Pa.post(tft.replace("{robot_model}",i),e),ift=()=>eft({mutationFn:nft}),ab=[{label:"Head",value:"head",jointPrefix:"head_",component:"head",tcpGizmo:!1},{label:"Torso",value:"torso",jointPrefix:"torso_",component:"torso",tcpGizmo:!0},{label:"Left",value:"left",jointPrefix:"left_arm_",component:"left_arm",tcpGizmo:!0},{label:"Right",value:"right",jointPrefix:"right_arm_",component:"right_arm",tcpGizmo:!0}],dR=i=>ab.find(({jointPrefix:e})=>i.startsWith(e)),{useMemo:w8,useState:sft}=await F("react"),ife=[{label:"Torso",component:"torso"},{label:"Right Arm",component:"right_arm"},{label:"Left Arm",component:"left_arm"},{label:"Head",component:"head"}],C8=[{label:"24V",value:24},{label:"12V",value:12},{label:"OFF",value:0}],PD=({className:i,title:e,count:t,extra:n,action:s,children:o})=>x(U,{className:P("gap-1.5 px-3 py-2",i),children:[x(H,{justifyContent:"space-between",alignItems:"center",children:[x(H,{className:"gap-1.5",alignItems:"center",children:[u("span",{className:"text-fg-default text-sm font-bold",children:e}),t&&u("span",{className:"text-fg-subtle text-xs",children:t}),n]}),s]}),o]}),sfe=({label:i,sub:e,checked:t,disabled:n,onCheckedChange:s})=>x(H,{className:"bg-bg-alt-1 h-8 gap-1 rounded-md px-2.5",justifyContent:"space-between",alignItems:"center",children:[x("span",{className:P("text-sm font-semibold whitespace-nowrap",t?"text-fg-default":"text-fg-subtle"),children:[i,e&&u("span",{className:"text-fg-subtle pl-1 text-xs",children:e})]}),u(tr,{checked:t,disabled:n,onCheckedChange:s})]}),S8="border-border-subtle text-fg-default h-8 shrink-0 rounded-md border px-3 text-xs font-semibold disabled:cursor-not-allowed",ofe=({items:i,active:e,activeClassName:t="bg-bg-overlay text-fg-default",disabled:n,onSelect:s})=>u(H,{className:"bg-bg-alt-1 h-8 flex-1 gap-1 rounded-md p-0.5",children:i.map(o=>x("button",{type:"button",disabled:n,className:P("flex h-full flex-1 items-center justify-center gap-1.5 rounded text-xs font-semibold disabled:cursor-not-allowed",o===e?t:"text-fg-subtle hover:text-fg-default"),onClick:()=>o!==e&&s(o),children:[o===e&&o==="ENABLE"&&u("span",{className:"size-1.5 rounded-full bg-green-500"}),o]},o))}),oft=({className:i,robotModel:e})=>{const{t}=q(),{jointNames:n}=xp(e),[s,o]=sft([]),r=w8(()=>ife.map(A=>({...A,joints:n.filter(M=>dR(M)?.component===A.component)})).filter(A=>A.joints.length>0),[n]),a=r.reduce((A,M)=>A+M.joints.length,0),l=a>0&&s.length===a,{powerStates:c,jointStates:d,controlManager:h,toolFlange:g}=dw(e,A=>({powerStates:A?.power_states,jointStates:A?.joint_states,controlManager:A?.control_manager,toolFlange:A?.tool_flange})),m=["left","right"].map(A=>({side:A,label:A==="left"?"Left Arm":"Right Arm",active:C8.find(M=>M.value===g?.[A])?.label})),{mutate:f,isPending:p}=Wmt(),{mutate:_,isPending:b}=jmt(),{mutate:v,isPending:w}=Jmt(),{mutate:y,isPending:S}=Zmt(),{mutate:C,isPending:N}=ift(),k=w8(()=>c&&!Array.isArray(c)?Object.entries(c).map(([A,M])=>({device:A,label:A.toUpperCase(),on:M})):[],[c]),L=w8(()=>[...ife,{label:"Wheel",component:"wheel"}].map(A=>{const M=n.map((O,B)=>({name:O,i:B})).filter(({name:O})=>A.component==="wheel"?O.includes("wheel"):dR(O)?.component===A.component).map(({i:O})=>!!d?.[O]?.is_ready);return{...A,count:M.length,on:M.length>0&&M.every(Boolean)}}).filter(A=>A.count>0),[n,d]),D=k.length>0&&k.every(A=>A.on),T=L.length>0&&L.every(A=>A.on),E=h?.state==="Enabled",R=(A,M,O)=>u("button",{type:"button",className:"text-fg-subtle hover:text-fg-default text-xs font-semibold disabled:opacity-50",disabled:M,onClick:O,children:t(A?"dashboard.button.allOff":"dashboard.button.allOn")});return k.length===0&&L.length===0?u(My,{className:P("RBY1ControlPanel",i),children:u(U,{className:"h-full",justifyContent:"center",children:u(rA,{className:"w-full",size:"sm",nullText:t("dashboard.detail.robotNotConnected")})})}):u(My,{className:P("RBY1ControlPanel",i),children:x(U,{className:"[&>*]:border-border-subtle h-full overflow-y-auto",children:[u(PD,{className:"border-b",title:t("dashboard.title.power"),count:`${k.filter(A=>A.on).length}/${k.length}`,action:R(D,p,()=>f({robotModel:e,status:D?"off":"on"})),children:u("div",{className:"grid grid-cols-2 gap-2",children:k.map(A=>u(sfe,{label:A.label,checked:A.on,disabled:p,onCheckedChange:M=>f({robotModel:e,device:A.device,status:M?"on":"off"})},A.device))})}),u(PD,{className:"border-b",title:t("dashboard.title.servo"),count:`${L.filter(A=>A.on).length}/${L.length}`,action:R(T,b,()=>_({robotModel:e,status:T?"off":"on"})),children:u("div",{className:"grid grid-cols-2 gap-2",children:L.map(A=>u(sfe,{label:A.label,sub:t("dashboard.content.axisCount",{count:A.count}),checked:A.on,disabled:b,onCheckedChange:M=>_({robotModel:e,part:A.component,status:M?"on":"off"})},A.component))})}),u(PD,{className:"border-b",title:t("dashboard.title.toolFlangePower"),children:m.map(A=>x(H,{className:"gap-2",alignItems:"center",children:[x(H,{className:"w-24 shrink-0 gap-1.5",alignItems:"center",children:[u("span",{className:P("size-1.5 rounded-full",A.active&&A.active!=="OFF"?"bg-green-500":"bg-fg-subtle")}),u("span",{className:"text-fg-default text-sm font-semibold",children:A.label})]}),u(ofe,{items:C8.map(M=>M.label),active:A.active,activeClassName:A.active==="OFF"?void 0:"bg-fill-brand text-white",disabled:S,onSelect:M=>y({robotModel:e,side:A.side,voltage:C8.find(O=>O.label===M).value})})]},A.side))}),u(PD,{title:t("dashboard.title.brake"),count:`${s.length}/${a}`,extra:u("button",{type:"button",className:"text-fg-subtle hover:text-fg-default pl-2 text-xs font-semibold",onClick:()=>o(l?[]:r.flatMap(A=>A.joints)),children:t(l?"dashboard.button.deselectAll":"dashboard.button.selectAll")}),action:u(H,{className:"gap-1.5",children:["engage","release"].map(A=>u("button",{type:"button",disabled:!s.length||N,className:P(S8,"disabled:opacity-50"),onClick:()=>C({robotModel:e,action:A,joints:s}),children:A.toUpperCase()},A))}),children:u(U,{className:"bg-bg-alt-1 gap-1 rounded-md px-2.5 py-2",children:r.map(A=>x(H,{className:"gap-2",alignItems:"center",children:[u("span",{className:"text-fg-default w-24 shrink-0 text-xs font-semibold",children:A.label}),u("div",{className:"grid flex-1 grid-cols-7 gap-1",children:A.joints.map(M=>u(ia,{size:"xs",checkValue:!0,value:s.includes(M),handleChange:O=>o(B=>O?[...B,M]:B.filter(z=>z!==M)),children:M.split("_").pop()},M))})]},A.component))})}),x(PD,{className:"mt-auto border-t",title:t("dashboard.title.controlManager"),children:[u(H,{children:u(ofe,{items:["ENABLE","DISABLE"],active:E?"ENABLE":"DISABLE",disabled:w,onSelect:A=>v({robotModel:e,action:A==="ENABLE"?"enable":"disable"})})}),x("div",{className:"grid grid-cols-2 gap-2",children:[u("button",{type:"button",disabled:w,className:S8,onClick:()=>v({robotModel:e,action:"reset"}),children:"RESET"}),u("button",{type:"button",disabled:w,className:P(S8,"border-yellow-500/50 text-yellow-500",h?.unlimited_mode_enabled&&"bg-yellow-500/15"),onClick:()=>v({robotModel:e,action:"unlimit"}),children:"UNLIMIT"})]})]})]})})},rft=({className:i,robotModel:e,hideRobotComponents:t})=>{const{data:n}=As(),s=n?.modelInfo?.be_service==="rby1";return x(H,{className:P("RobotOverview","gap-2.5","[&>*]:w-full [&>*]:flex-1",i),children:[u(hmt,{className:"h-full",robotModel:e}),s&&u(oft,{className:"h-full",robotModel:e}),!t&&u(Amt,{className:"h-full"}),u(Cmt,{className:"h-full"})]})},{useQuery:aft,useQueryClient:lft}=await F("@tanstack/react-query"),{useMemo:cft}=await F("react"),ARe="/move/getLogs",dft=async i=>Ls.get(ARe,{params:i}),noe=(i,e={})=>{const t=lft(),n=cft(()=>[ARe,i],[i]);return{...aft({queryKey:n,queryFn:async()=>{try{return await dft(i)}catch(o){throw t.setQueryData(n,{items:[],pageInfo:{limit:0,mode:"",order:"",page:0,pages:0,sort:"",total:0}}),o}},gcTime:0,staleTime:0,...e}),queryKey:n}},{useMemo:uft}=await F("react"),ORe=({className:i,amrHistoryList:e})=>{const t=uft(()=>e?.map(n=>{let s=n.message;const o=n.command;if(o==="goal")s=`Move Goal: ${n.goalId||n.goalName}`;else if(o==="rotate")s=`Move Rotate: ${n.target?.toFixed(1)??0}deg`;else if(o==="target"){const r=n.goalPose;s=r?`Move Target: ${r.x?.toFixed(3)??0}, ${r.y?.toFixed(3)??0}, ${r.z?.toFixed(3)??0}`:n.message||"Move Target: -"}else o==="circular"?s=`Move Circular: ${n.target?.toFixed(1)??0}deg`:s=`Move Linear: ${n.target?.toFixed(1)??0}m`;return{command:o,result:n.result,createdAt:n.createdAt,message:s}}),[e]);return u(U,{className:P("SimpleMoveHistory","text-fg-subtle gap-1 px-3 py-2.5",i),children:u(qr,{list:t,noDataMsg:"There is no movement history.",noDataMsgClassName:"min-h-[15rem] [&_.no-data-text]:typo-compact-sm-medium",children:({item:n,index:s})=>x(H,{children:[u("span",{className:"typo-code-xs-normal text-fg-subtle w-15",children:Cr(n.createdAt,"YY-MM-DD HH:mm:ss")}),x(U,{className:"gap-0.5",children:[u("span",{className:"typo-code-xs-normal text-fg-default",children:n.message||"-"}),x(H,{className:P("typo-code-xs-normal text-fg-subtle","[&>span:after]:bg-border-subtle [&>span:after]:mx-2 [&>span:after]:inline-block [&>span:after]:h-2 [&>span:after]:w-px [&>span:after]:content-[''] [&>span:last-child:after]:hidden"),children:[u("span",{children:n.command}),n.result&&u("span",{className:P({"text-fg-success":n.result==="success","text-fg-danger":n.result==="fail","text-fg-information":n.result==="start","text-fg-disabled":n.result==="cancel"}),children:n.result})]})]})]},s)})})},hft=({className:i,open:e,onOpenChange:t,limit:n,handleAllHistory:s})=>{const{t:o}=q(),{data:r}=noe({limit:n,page:1,searchText:"",sort:"createdAt",order:"DESC",filter:{},fields:{}});return u(Uo,{className:P(i,"block !max-w-[50vw] border-none p-0"),open:e,onOpenChange:t,header:{title:o("dashboard.title.amrMoveHistory")},footer:u(H,{className:"h-8 w-full",alignItems:"center",justifyContent:"end",children:u(se,{variant:"brand",onClick:s,children:o("dashboard.button.viewAllHistory")})}),children:u("div",{className:"!bg-bg-alt-2 flex h-full flex-col justify-between",children:u(Km,{className:"h-[calc(var(--vh,1vh)*70)]",children:u(ORe,{amrHistoryList:r?.items??null})})})})},gft=({className:i,robotModel:e,connected:t})=>{const n=ir(),{t:s}=q(),{theme:o}=tt(),{modal:r}=Vi(),{setSelectedRobotModel:a}=ui(),{data:l}=noe({limit:30,page:1,searchText:"",sort:"createdAt",order:"DESC",filter:{},fields:{}},{enabled:t,...t?{}:{retry:!1}}),c=()=>{r({component:hft,props:{limit:100,handleAllHistory:d}})},d=()=>{n("/muscat/app/move"),a(e)};return u(My,{className:P(i),title:s("dashboard.title.amrMoveHistory"),lightTitleClassName:"bg-overlay",titleButton:u(Yt,{icon:u(_9,{}),variant:"transparent",size:"3xs",onClick:c}),contentsScrollable:!0,footer:u(H,{className:"w-full",children:u(se,{className:P("w-full",o==="light"&&"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy"),size:"xs",variant:"soft",onClick:d,children:s("dashboard.button.viewAllHistory")})}),children:u(ORe,{className:P("px-3 py-2.5"),amrHistoryList:l?.items??null})})},{useQuery:mft}=await F("@tanstack/react-query"),FRe="/{robot_model}/status",fft=async({robot_model:i})=>{const e=FRe.replace("{robot_model}",i);return Ls.get(e)},pft=({robot_model:i},e={})=>mft({queryKey:[FRe,i],queryFn:()=>fft({robot_model:i}),...e}),{useQuery:_ft}=await F("@tanstack/react-query"),BRe="/getUrl",bft=()=>Die.get(BRe),VRe=()=>_ft({queryKey:[BRe],queryFn:()=>bft()}),{useQuery:vft}=await F("@tanstack/react-query"),zRe="/network/getInfo",yft=()=>Die.get(zRe),wft=()=>vft({queryKey:[zRe],queryFn:()=>yft()}),{useMemo:Cft}=await F("react"),Sft=({className:i,moveStatus:e})=>{const t=Cft(()=>{switch(e){case"move":return"success";case"error":return"danger";case"stop":return"danger";case"pause":return"information";case"not ready":return"normal";case"vir":return"warning";default:return"normal"}},[e]);return x(H,{className:P("AMRLampMoveStatus","gap-0.5",i),alignItems:"center",children:[u(QP,{className:"size-3",lampType:t}),u("span",{className:"text-fg-default typo-compact-sm-semibold uppercase",children:e})]})},{useQuery:xft}=await F("@tanstack/react-query"),WRe="/{robot_model}/map/current",ioe=({robot_model:i})=>[WRe,i],Nft=async({robot_model:i})=>{const e=WRe.replace("{robot_model}",i);return Ls.get(e)},soe=({robot_model:i},e={})=>xft({queryKey:ioe({robot_model:i}),queryFn:()=>Nft({robot_model:i}),...e}),{useMemo:Ift}=await F("react"),{useQuery:kft}=await F("@tanstack/react-query"),HB="/{robot_model}/map/getTopology",Lft=async({robot_model:i,mapName:e})=>{const t=HB.replace("{robot_model}",i),n=await Ls.get(t,{params:{mapName:e,pageSize:999}});return{...n,format_version:n.format_version??fB,metadata:n.metadata,nodes:n.nodes??[],links:n.links??[],zones:n.zones??[]}},HRe=(i,e={})=>{const t=Ift(()=>[HB,i],[i]);return{...kft({queryKey:t,queryFn:()=>Lft(i),enabled:!!i.mapName,...e}),queryKey:t}},{useRef:Dft}=await F("react"),rfe={data:[],pose:{x:"0",y:"0",rz:"0"}},$Re=(i,e=!0)=>{const{data:t=rfe,loading:n}=ls(`amr/${i}/socket/lidar2d`,{defaultValue:rfe,disabled:!e}),{data:s,pose:o}=t,r=Dft({data:s,pose:o,loading:n});return r.current.data=s,r.current.pose=o,n!==r.current.loading&&(r.current.loading=n),r.current},Tft={data:[],time:0},URe=(i,e=!0)=>{const{data:t,loading:n}=ls(`amr/${i}/socket/mappingCloud`,{defaultValue:Tft,disabled:!e,equalityFn:(s,o)=>dt.isEqual(s,o)});return{...t,loading:n}},{useMemo:Eft}=await F("react"),{useQuery:Pft}=await F("@tanstack/react-query"),jRe="/{robot_model}/map/getCloud",Rft=async({robot_model:i,mapName:e,fileName:t})=>{const n=jRe.replace("{robot_model}",i);return Ls.get(n,{params:{mapName:e,fileName:t}})},GRe=(i,e={})=>{const t=Eft(()=>[jRe,i],[i]);return{...Pft({queryKey:t,queryFn:()=>Rft(i),...e}),queryKey:t}},Mft={moveState:{autoMove:"stop",dockMove:"",jogMove:"none",obs:"none",pathState:"none",step:0,multiId:"",multiState:""},pose:{x:0,y:0,rz:0},vel:{vx:0,vy:0,wz:0},curNode:{id:"",name:"",pose:{x:0,y:0,rz:0}},goalNode:{id:"",name:"",pose:{x:0,y:0,rz:0}}};function ooe(i,e,t=!0){const{data:n,loading:s,isDefaultData:o}=ls(`amr/${i}/moveStatus`,{defaultValue:Mft,selector:e,disabled:!t});return{...n,isDefaultData:o,loading:s}}const{useRef:Aft}=await F("react"),qRe=({className:i,robotModel:e,enabled:t=!0})=>{const n=Aft(null),{worldStudioStateProps:s}=kDe(),{data:o}=soe({robot_model:e},{enabled:t&&!!e,...t?{}:{retry:!1}}),{data:r}=URe(e,!1),a=$Re(e,t),{data:l}=a,{pose:c}=ooe(e,g=>({pose:g?.pose}),t),{data:d}=GRe({robot_model:e,mapName:o?.mapName??"",fileName:"cloud.csv"},{enabled:t&&!!o?.mapName,...t?{}:{retry:!1}}),{data:h}=HRe({robot_model:e,mapName:o?.mapName??""},{enabled:t&&!!o?.mapName,...t?{}:{retry:!1}});return u("div",{className:P("MuscatSimpleAMRMap",i),children:u(LDe,{ref:n,...s,cameraPositionKey:DDe,pointsData:d?.data,topoData:h,lidarPoints:l,mappingPoints:r,robotPose:c,showGrid:!0,showNodeLabels:!1,showLidar:!0,viewportCameraMode:"topView",robot:e})})},{useQuery:Oft}=await F("@tanstack/react-query"),{useMemo:Fft}=await F("react"),KRe="/{robot_model}/moveStatus",Bft=async({robot_model:i})=>{const e=KRe.replace("{robot_model}",i);return Ls.get(e)},Vft=({robot_model:i},e={})=>{const t=Fft(()=>[KRe,i],[i]);return{...Oft({queryKey:t,queryFn:()=>Bft({robot_model:i}),...e}),queryKey:t}},{useQueryClient:zft}=await F("@tanstack/react-query"),{useEffect:Wft}=await F("react"),Hft=(i,e,t=!0)=>{const n=zft(),{data:s,queryKey:o,...r}=Vft({robot_model:i},{enabled:t&&!!i,...t?{}:{retry:!1}}),{isDefaultData:a,loading:l,...c}=ooe(i,e,t);return Wft(()=>{!l&&c&&!a&&n.setQueryData(o,d=>({...d,...c}))},[c,o,a,l,n]),{data:s,...r}},{useMemo:afe}=await F("react"),$ft=({className:i,robotModel:e,connected:t})=>{const n=ir(),{t:s}=q(),{theme:o}=tt(),{setSelectedRobotModel:r}=ui(),{data:a}=Hft(e,p=>({moveState:p.moveState,vel:p.vel,curNode:{id:p.curNode.id,name:p.curNode.name},goalNode:{id:p.goalNode.id,name:p.goalNode.name}}),t),{data:l}=pft({robot_model:e},{enabled:t&&!!e,...t?{}:{retry:!1}}),{data:c}=VRe(),{data:d}=wft(),h=afe(()=>{const p=a?.moveState;return{autoMove:p?.autoMove??"-",obs:p?.obs??"none"}},[a?.moveState]),g=afe(()=>{const p=a?.vel;return{vx:p?.vx??0,vy:p?.vy??0,wz:p?.wz??0}},[a?.vel]),m=()=>{n("/muscat/app/move"),r(e)},f=()=>{n("/muscat/app/move"),r(e)};return u(My,{className:P("AMRNavStatus",i),children:x(H,{className:"h-full p-2",children:[x(U,{className:"flex h-full w-[50%] flex-1 gap-2",children:[u(qRe,{className:"relative flex h-full flex-1 overflow-hidden rounded",robotModel:e,enabled:t}),x(H,{className:P("gap-1","[&_button]:h-8 [&_button]:w-full [&_button]:px-2"),children:[u(se,{variant:"outlined",size:"xs",onClick:m,children:s("dashboard.content.localization")}),u(se,{className:o==="light"?"bg-fill-navy-subtlest hover:bg-fill-navy-subtler text-fg-navy":void 0,variant:"soft",size:"xs",onClick:f,children:s("dashboard.content.mapEditor")})]})]}),x(U,{className:"relative w-full flex-1 gap-6 px-2.5 py-4",children:[u(Sft,{className:"absolute top-0.5 right-0.5 z-[2]",moveStatus:h.autoMove}),u(Mqe,{currentNode:a?.curNode?.name??a?.curNode?.id??"",targetNode:a?.goalNode?.name??a?.goalNode?.id??"",moveStatus:h.autoMove}),x(U,{className:"relative gap-4 pl-7",children:[x(U,{className:"border-border-subtle gap-0.5 border-t pt-3",children:[u("span",{className:"text-fg-subtle typo-compact-xs-normal",children:s("dashboard.content.mapName")}),u("div",{className:"text-fg-default typo-compact-sm-semibold",children:`${l?.mapState?.mapName??"none"}`})]}),x("div",{className:P("grid grid-cols-2 gap-3","[&>div]:gap-0.5","[&>div>span]:text-fg-subtle [&>div>span]:typo-compact-xs-normal","[&>div>div]:text-fg-default [&>div>div]:typo-compact-sm-semibold"),children:[x(U,{children:[x("span",{children:[s("dashboard.content.linearSpeed")," (Vx, Vy)"]}),u("div",{children:`${g.vx.toFixed(1)}m/s | ${g.vy.toFixed(1)}m/s`})]}),x(U,{children:[u("span",{children:s("dashboard.content.rotationSpeed")}),u("div",{children:`${g.wz.toFixed(2)}deg/s`})]}),x(U,{children:[u("span",{children:s("dashboard.content.localizationStatus")}),u("div",{className:P("!text-fg-subtle",{"!text-fg-information":l?.locState?.locStatus==="good","!text-fg-warning":l?.locState?.locStatus==="none","!text-fg-danger":l?.locState?.locStatus==="fail"}),children:l?.locState?.locStatus||"-"})]}),x(U,{children:[u("span",{children:s("dashboard.content.obstacle")}),u("div",{className:P("!text-fg-subtle",{"!text-fg-warning":h.obs==="none","!text-fg-danger":h.obs==="near","!text-fg-information":h.obs==="far","!text-fg-caution":h.obs==="vir"}),children:h.obs||"-"})]}),x(U,{children:[u("span",{children:"Path State"}),u("div",{className:P("!text-fg-subtle",{"!text-fg-warning":a?.moveState?.pathState==="none","!text-fg-success":a?.moveState?.pathState==="req_path","!text-fg-information":a?.moveState?.pathState==="recv_path"}),children:a?.moveState?.pathState||"-"})]}),x(U,{children:[u("span",{children:"FRS IPv4"}),x("div",{className:"!text-fg-information",children:[c?.ip??"0.0.0.0",` (${d?.wifi?.signal??0})`]})]})]})]})]})]})})},Uft=({className:i,robotModel:e,connected:t})=>x(H,{className:P("AMROverviewCard","gap-2.5",i),children:[u($ft,{className:"h-full flex-2",robotModel:e,connected:t}),u(gft,{className:"h-full flex-1",robotModel:e,connected:t})]}),{useCallback:lfe,useMemo:jft,useRef:Gft,useState:qft}=await F("react"),Kft=({className:i})=>{const e=Gft(null),{t}=q(),{data:n}=M9(),[s,o]=qft(0),r=jft(()=>n.core_sw_list?.filter(c=>c.be_service==="amr")??[],[n.core_sw_list]),a=lfe(c=>{o(c.activeIndex)},[]),l=lfe(c=>{e.current?.slideTo(c)},[]);return x(U,{className:P("AMROverview","gap-2",i),children:[x(H,{alignItems:"center",justifyContent:"space-between",children:[u("h4",{className:"typo-title-03-bold text-fg-default",children:t("dashboard.title.amrNavStatus")}),u(H,{className:"gap-1.5",alignItems:"center",children:r.length>1&&r.map((c,d)=>u("button",{className:"relative !size-2 overflow-hidden rounded-full",onClick:()=>l(d),children:u("div",{className:P("bg-fg-subtler size-full",{"bg-fg-default":s===d})})},d))})]}),u(JLe,{ref:e,onSlideChange:a,children:r.map(c=>u(Uft,{className:"h-90 w-full",robotModel:c.model,connected:c.connected!=="DISCONNECT"},c.model))})]})},{useMemo:cfe}=await F("react"),Jft=({className:i})=>{const{data:e}=As(),{data:t}=M9(),n=cfe(()=>[...new Set(t?.core_sw_list?.map(r=>r.be_service)??[])],[t]),s=cfe(()=>n.includes("amr"),[n]),o=n.length<=1;return u("div",{className:P("DashboardPage","p-5",i),children:x(U,{className:"mx-auto max-w-[1536px] gap-3",children:[u(htt,{}),Yl()?u(U,{className:"bg-bg-raised text-fg-subtle h-[calc(var(--vh,1vh)*100-13rem-1px)] w-full rounded-md text-xl",alignItems:"center",justifyContent:"center",children:"Preview"}):x(rn,{children:[u(rft,{className:P("h-[26.875rem] max-h-[1000px]",{"h-[calc(var(--vh,1vh)*100-13rem-1px)]":o&&!s}),robotModel:e?.modelInfo?.model||"",hideRobotComponents:o}),s&&u(Kft,{})]})]})})},l4={x:100,y:100,z:100},roe=[{type:"box",nameKey:"move.workspace.addMenu.box",dimensions:l4},{type:"cylinder",nameKey:"move.workspace.addMenu.cylinder",dimensions:l4},{type:"sphere",nameKey:"move.workspace.addMenu.sphere",dimensions:l4}],dfe="mm",Yft="°",Xft=1,Qft=0,Zft=.1,ept=2,tpt=1,npt=0,JRe={x:0,y:0,z:0},aoe={rx:0,ry:0,rz:0},uR={x:1,y:1,z:1},YRe=(i,e)=>{const{scale:t,position:n,...s}=e,o={...s,...n&&{position:n}};return i.kind!=="shape"?{...i,...o}:{...i,...o,...t&&{scale:t}}},ipt=(i,e,t)=>{const n=i.toLowerCase();return n.includes("right")?{key:"move.workspace.tab.toolRight"}:n.includes("left")?{key:"move.workspace.tab.toolLeft"}:t<=1?{key:"move.workspace.tab.tool"}:{key:"move.workspace.tab.toolIndexed",params:{index:e+1}}},spt=5,ufe=(i,e,t,n)=>{const s=t.trim().toLowerCase();return n&&s===n.trim().toLowerCase()?!1:i.some(o=>o.modelType===e.modelType&&(e.attachment?o.attachment?.parentJointName===e.attachment.parentJointName:!0)&&o.workspace?.name.trim().toLowerCase()===s)},opt=i=>{const e=new Map;for(const t of i){const n=t.workspace?.name;if(!n)continue;const s=e.get(n)??[];s.push(t),e.set(n,s)}return Array.from(e.entries()).map(([t,n])=>({name:t,models:n}))},x8=i=>{const e=i.map(t=>t.createdAt).sort();return e[e.length-1]},GN=i=>typeof i=="number"&&Number.isFinite(i),hfe=i=>!!i&&typeof i=="object"&&GN(i.x)&&GN(i.y)&&GN(i.z),rpt=i=>!!i&&typeof i=="object"&&GN(i.rx)&&GN(i.ry)&&GN(i.rz),apt=i=>{if(!i||typeof i!="object")return!1;const e=i;return typeof e.id!="string"||typeof e.name!="string"||e.modelId!==void 0&&typeof e.modelId!="string"||!hfe(e.position)||!rpt(e.rotation)?!1:e.kind==="shape"?typeof e.shapeType=="string"&&hfe(e.scale):e.kind==="custom"?typeof e.fileId=="string"&&typeof e.fileName=="string":!1},gfe=i=>Array.isArray(i)&&i.every(apt),lpt=i=>{if(!i||typeof i!="object")return!1;const e=i;return(e.stage==="empty"||e.stage==="build")&&(e.workspaceName===null||typeof e.workspaceName=="string")&&(e.lastSyncedWorkspaceName===null||typeof e.lastSyncedWorkspaceName=="string")&&gfe(e.items)&&gfe(e.lastSyncedItems)&&Array.isArray(e.hiddenItemIds)&&e.hiddenItemIds.every(t=>typeof t=="string")},JO=150,cpt={x:200,y:200},dpt=50,upt=i=>{if(i===0)return[[0,0]];const e=[[i,0],[0,i],[-i,0],[0,-i]];for(let t=1;t<i;t++)e.push([i,t],[i,-t],[-i,t],[-i,-t],[t,i],[-t,i],[t,-i],[-t,-i]);return e.push([i,i],[-i,i],[-i,-i],[i,-i]),e},hpt=(i,e)=>i==="base"?"base":`tool:${e}`,gpt=i=>i==="tool",mpt=(i,e,t=dpt)=>{for(let n=0;n<=t;n++)for(const[s,o]of upt(n)){const r=e.x+s*JO,a=e.y+o*JO;if(!i.some(c=>Math.abs(c.position.x-r)<JO/2&&Math.abs(c.position.y-a)<JO/2))return{x:r,y:a}}return{...e}},fpt=(i,e,t,n,s,o)=>i.map(r=>{const a=r.kind==="shape"?{kind:"primitive",shape:r.shapeType}:{kind:"file",url:`${Uie}/common/files/models/${encodeURIComponent(r.fileName)}`,fileName:r.fileName};return{id:`${e}:${r.id}`,source:a,displayName:r.name,transform:{x:r.position.x/Pn,y:r.position.y/Pn,z:r.position.z/Pn,rx:r.rotation.rx,ry:r.rotation.ry,rz:r.rotation.rz,scale:r.kind==="shape"?{x:r.scale.x,y:r.scale.y,z:r.scale.z}:1},mountJointName:t||void 0,visible:!o?.has(r.id),onLoad:n?()=>n(r.id):void 0,onLoadError:s?()=>s(r.id):void 0}}),XRe="local:",loe=()=>`${XRe}${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,mfe=i=>i.startsWith(XRe),YO=(i,e)=>{const t=new Set(e.filter(o=>!mfe(o))),n=new Set(i.filter(o=>!mfe(o))),s=[];for(const o of n)t.has(o)||s.push({modelId:o,isLoaded:!1});for(const o of t)s.push({modelId:o,isLoaded:!0});return s},ppt=(i,e,t=new Set)=>new Set(i.filter(n=>n.kind==="custom"&&!e.has(n.id)&&!t.has(n.id)).map(n=>n.id)),ffe=(i,e)=>{const t=new Set(e.map(s=>s.id)),n=Array.from(i).filter(s=>t.has(s));return n.length===i.size?i:new Set(n)},QRe=(i,e)=>i.name===e.name&&i.position.x===e.position.x&&i.position.y===e.position.y&&i.position.z===e.position.z&&i.rotation.rx===e.rotation.rx&&i.rotation.ry===e.rotation.ry&&i.rotation.rz===e.rotation.rz?i.kind==="shape"?e.kind==="shape"&&i.shapeType===e.shapeType&&i.scale.x===e.scale.x&&i.scale.y===e.scale.y&&i.scale.z===e.scale.z:e.kind==="custom"&&i.fileId===e.fileId&&i.fileName===e.fileName:!1,_pt=(i,e)=>i.id===e.id&&QRe(i,e),bpt=(i,e)=>{const t=new Map;for(const n of e){if(!n.modelId)return!1;t.set(n.modelId,n)}if(t.size!==i.length)return!1;for(const n of i){if(!n.modelId)return!1;const s=t.get(n.modelId);if(!s||!QRe(n,s))return!1}return!0},ZRe=(i,e)=>{const t=[],n=new Set(i.map(s=>s.id));for(const s of i){if(!s.modelId){t.push({kind:"create",item:s});continue}const o=e.get(s.id);if(!o){t.push({kind:"create",item:s});continue}_pt(o,s)||t.push({kind:"update",item:s,modelId:s.modelId})}for(const[s,o]of e)!n.has(s)&&o.modelId&&t.push({kind:"delete",modelId:o.modelId});return t},vpt=(i,e,t,n)=>{const s=ZRe(i,e);if(!(t!==n))return s;const r=new Set(s.filter(l=>l.kind!=="delete").map(l=>l.item.id)),a=i.filter(l=>!!l.modelId&&!r.has(l.id)).map(l=>({kind:"update",item:l,modelId:l.modelId}));return[...s,...a]},ypt=(i,e,t,n)=>ZRe(i,e).length>0||t!==n,BE=(i,e)=>i===e?!0:i.length!==e.length?!1:i.length===0&&e.length===0?!0:JSON.stringify(i)===JSON.stringify(e),wpt=i=>({id:loe(),modelId:i.modelId,name:i.name??i.fileInfo.fileName.replace(/\.[^.]+$/,""),kind:"custom",fileName:i.fileInfo.fileName,fileId:i.fileId,position:{...JRe},rotation:{...aoe,rx:i.pose?.rx??0,ry:i.pose?.ry??0,rz:i.pose?.rz??0}}),pfe=i=>{const e={id:loe(),modelId:i.modelId,position:{x:Math.round(i.pose.x*Pn),y:Math.round(i.pose.y*Pn),z:Math.round(i.pose.z*Pn)},rotation:{rx:i.pose.rx,ry:i.pose.ry,rz:i.pose.rz}};if(i.shapeType!==null)return{...e,name:i.name??i.shapeType,kind:"shape",shapeType:i.shapeType,scale:i.scale??uR};const t=i.fileInfo?.fileName??"";return{...e,name:i.name??t.replace(/\.[^.]+$/,""),kind:"custom",fileId:i.fileId??"",fileName:t}},wJ="application/x-rb-workspace-shape",Cpt=i=>{switch(i){case"cylinder":return u(QLe,{className:"text-fg-subtle group-hover:text-fg-navy size-4.5 shrink-0 transition-colors"});case"sphere":return u(XLe,{className:"text-fg-subtle group-hover:text-fg-navy size-4.5 shrink-0 transition-colors"});default:return u(YLe,{className:"text-fg-subtle group-hover:text-fg-navy size-4.5 shrink-0 transition-colors"})}},Spt=({onAddShape:i,limitReached:e,isCustomFileUploading:t=!1,onOpenCustomFilePicker:n,draggable:s=!1,className:o})=>{const{t:r}=q();return x(U,{className:P("border-border-subtle/70 bg-bg-alt-1/40 w-full gap-1.5 rounded-lg border p-1.5 shadow-2xs transition-all",o),children:[x("div",{className:"grid grid-cols-2 gap-1.5",children:[roe.map(a=>x("button",{type:"button",disabled:e,draggable:s&&!e,onDragStart:c=>{c.dataTransfer.setData(wJ,a.type),c.dataTransfer.effectAllowed="copy"},onClick:()=>i(a.type),className:P("group border-border-subtle/80 bg-bg-default relative flex h-9 items-center gap-2 rounded-md border px-2.5 shadow-2xs transition-all duration-150 select-none","hover:border-border-navy-stronger hover:bg-fill-navy-subtler active:bg-fill-navy-subtle active:scale-[0.99]","focus-visible:ring-border-navy-stronger focus-visible:ring-2 focus-visible:outline-hidden",e&&"hover:border-border-subtle/80 hover:bg-bg-default cursor-not-allowed opacity-40"),children:[Cpt(a.type),u("span",{className:"typo-compact-xs-medium text-fg-default group-hover:text-fg-navy truncate transition-colors",children:r(a.nameKey)})]},a.type)),x("button",{type:"button",disabled:t,onClick:n,className:P("group border-border-subtle/80 bg-bg-default relative flex h-9 items-center gap-2 rounded-md border px-2.5 shadow-2xs transition-all duration-150 select-none","hover:border-border-navy-stronger hover:bg-fill-navy-subtler active:bg-fill-navy-subtle active:scale-[0.99]","focus-visible:ring-border-navy-stronger focus-visible:ring-2 focus-visible:outline-hidden",t&&"cursor-not-allowed opacity-50"),children:[t?u(aw,{size:"1rem",className:"text-fg-subtle shrink-0"}):u(Ey,{className:"text-fg-subtle group-hover:text-fg-navy size-4.5 shrink-0 transition-colors"}),u("span",{className:"typo-compact-xs-medium text-fg-default group-hover:text-fg-navy truncate transition-colors",children:r("move.workspace.addMenu.customFile")})]})]}),e&&u("span",{className:"typo-compact-2xs-normal text-fg-danger px-1",children:r("move.workspace.shapeLimitReached")})]})},{useCallback:uf,useEffect:N8,useMemo:I8,useRef:XO,useState:$w}=await F("react"),xpt=({detailRobotModel:i,tcpJoints:e,urdfViewerRef:t,assetGizmoDisabled:n=!1,assetPicker:s})=>{const[o,r]=$w([]),[a,l]=$w(!1),[c,d]=$w("translate"),h=XO(null),[g,m]=$w([]),[f,p]=$w([]),_=uf(($,Z)=>{m(K=>BE(K,$)?K:$),p(K=>BE(K,Z)?K:Z)},[]),[b,v]=$w(null),w=uf($=>{v($)},[]),y=uf($=>{h.current={x:$.clientX,y:$.clientY}},[]),S=uf($=>{const Z=h.current;if(h.current=null,!Z||Math.abs($.clientX-Z.x)>5||Math.abs($.clientY-Z.y)>5||t.current?.isAssetGizmoDragging())return;if(s?.isActive){const V=t.current?.getAssetIdAtPointer?.($.nativeEvent);if(V){s.onPick(V);return}}if(n)return;const K=t.current?.selectAssetAtPointer($.nativeEvent);r(K?.assetIds??[]),l(K?.selectionMode??!1)},[n,s,t]),C=uf($=>{if($===null){t.current?.clearAssetSelection(),r([]),l(!1);return}r([$]),l(!1),!n&&t.current?.setSelectedAssetIds([$],!1)},[n,t]),N=uf(($,Z)=>{r($),l(Z),!n&&t.current?.setSelectedAssetIds($,Z)},[n,t]),k=XO([]);N8(()=>{k.current=o},[o]);const L=uf($=>{n||a||k.current.length===1&&k.current[0]===$&&t.current?.setSelectedAssetIds([$],!1)},[n,a,t]),D=XO({id:null,mode:"translate"});N8(()=>{if(!o.length||o.length>1){D.current={id:null,mode:"translate"};return}const $=o[0];if([...g,...f].find(V=>V.id===$)?.source.kind==="file"&&c==="scale"){d("translate");return}D.current.id===$&&D.current.mode===c||(D.current={id:$,mode:c},t.current?.setAssetGizmoMode(c))},[c,o,g,f,t]);const T=uf(()=>{t.current?.clearAssetSelection(),r([]),l(!1)},[t]);N8(()=>{n&&T()},[n,T]);const[E,R]=$w(null),A=XO(0),M=uf($=>{$.dataTransfer.types.includes(wJ)&&($.preventDefault(),$.dataTransfer.dropEffect="copy")},[]),O=uf($=>{const Z=$.dataTransfer.getData(wJ);if(!Z)return;$.preventDefault();const K=t.current?.screenToGroundPoint({clientX:$.clientX,clientY:$.clientY});K&&(A.current+=1,R({type:Z,at:{x:Math.round(K.x*Pn),y:Math.round(K.y*Pn)},nonce:A.current}))},[t]),B=I8(()=>({detailRobotModel:i,tcpJoints:e,gizmoSelectedAssetIds:o,selectionMode:a,onAssetsChange:_,assetTransformEvent:b,shapeDropRequest:E,onRequestSceneAssetSelect:C,onRequestSceneSelectionChange:N,onAssetLoaded:L}),[i,e,o,a,_,b,E,C,N,L]),z=I8(()=>({onPointerDown:y,onPointerUp:S,onDragOver:M,onDrop:O}),[y,S,M,O]),Y=I8(()=>({onAssetTransformChange:w,onAssetSelectionChange:$=>{r($.assetIds),l($.selectionMode)}}),[w]);return{baseAssets:g,toolAssets:f,gizmoSelectedAssetIds:o,selectionMode:a,assetGizmoMode:c,setAssetGizmoMode:d,clearGizmoSelection:T,workspaceControlProps:B,requestMenuId:o.length?"workspace":void 0,requestMenuToken:o.join(","),sceneHandlers:z,viewerProps:Y}},CJ=({className:i,id:e,icon:t,active:n,label:s,expended:o,onClick:r})=>{const{theme:a}=tt();return u(se,{className:P("MoveMenuItem","text-fg-subtle h-7 w-full justify-start gap-1.5","[&_img]:size-3.5 [&_svg]:size-3.5","hover:bg-fill-subtler text-fg-default",n&&(a==="light"?"bg-fill-navy-subtlest text-fg-navy":"bg-fill-subtler"),i,{"hover:bg-fill-navy-subtlest":a==="light"}),size:"xs",variant:"transparent",leadingIcon:typeof t=="string"?u("img",{src:t}):t,onClick:r,"data-testid":e?`menu-item-${e}`:void 0,children:!!o&&s})},{useState:Npt,useCallback:Ipt,useEffect:kpt}=await F("react"),Lb=({ui:i,...e})=>{const{usePluginManifest:t}=Fu(),[n,s]=Npt([]),{data:o}=t(),{data:r,refetch:a}=kA(e),l=Ipt(c=>{const d=Jv(c.contributes,i||e.point);return{id:"id"in c?c.id:c.pluginId,name:c.name,isPreview:"id"in c,icon:typeof c.icons=="object"?c.icons?.["16"]:c.icons,enabled:"id"in c?!0:c.enabled,toolbar:"id"in c?!0:c.toolbar,contribute:d}},[e.point,i]);return kpt(()=>{const c=r?.plugins?.filter(d=>i==="toolbar"?d.toolbar:!0)?.map(d=>l(d))??[];hA()&&o&&Jv(o.contributes,i||e?.point)&&c.unshift(l(o)),s(c)},[l,e?.point,e?.toolbar,i,r?.plugins,o]),{list:n,setList:s,makeToolbarItem:l,originInstalledList:r?.plugins,previewPlugin:o,refetchPluginInstalledList:a}},Lpt=({className:i,robotModel:e,currentMenuId:t,expendedMenu:n,onMenuClick:s})=>{const{currentLanguage:o}=q(),{getAssetUrl:r}=Fu(),{list:a}=Lb({robotModel:e,point:"move.panel"});return u("div",{className:P("PluginMoveMenuList",i),children:a.map(l=>u(CJ,{icon:r(l.id,uA(l.contribute?.icon,16)),label:gA(l.contribute?.label,o)||l.name,active:t===l.id,expended:n,onClick:()=>s(l.id)},l.id))})},{useCallback:Dpt,useEffect:coe,useMemo:SJ,useRef:$B,useState:xJ}=await F("react");function eMe(i){return{"data-muscat-plugin-root":"","data-muscat-plugin-id":i}}function Tpt(i,e,t){const n=$B(null),s=$B(""),o=`${i}::${e}`;return s.current!==o&&(s.current=o,n.current=R9.connect(i,e)),SJ(()=>XTe(n.current,W1(),{...t,pluginId:e}),[o])}function Ept({source:i,socketUrl:e,pluginId:t,mount:n}){const s=Tpt(e,t,n),[o,r]=xJ(null),[a,l]=xJ(null);return coe(()=>{let c=!1;return r(null),l(null),import(i.entryUrl).then(d=>{if(!c){if(!d.default)throw new Error(`plugin entry ${i.entryUrl} has no default export`);r(()=>d.default)}}).catch(d=>{c||l(d instanceof Error?d:new Error(String(d)))}),()=>{c=!0}},[i.entryUrl]),a?x("div",{className:"text-fg-danger p-4 text-sm",children:["Failed to load plugin: ",a.message]}):o?u("div",{...eMe(t),children:u(rse.Provider,{value:s,children:u(o,{})})}):u("div",{className:"flex items-center justify-center p-4",children:u("div",{className:"border-default size-5 animate-spin rounded-full border-2 border-t-transparent"})})}function Ppt({source:i,socketUrl:e,pluginId:t,mount:n}){const s=$B(null),[o,r]=xJ(null);return coe(()=>{const a=s.current;if(!a)return;let l,c=!1;const d=()=>queueMicrotask(()=>l?.());return import(i.bootstrapUrl).then(h=>{c||(l=h.mount(a,{socketUrl:e,pluginId:t,hostServices:W1(),data:n.data,onSave:n.onSave}))}).catch(h=>{c||r(h instanceof Error?h:new Error(String(h)))}),()=>{c=!0,d()}},[i.bootstrapUrl,e,t]),o?x("div",{className:"text-fg-danger p-4 text-sm",children:["Failed to load plugin (dev): ",o.message]}):u("div",{ref:s,...eMe(t)})}function s6({pluginId:i,ui:e,data:t,onRegisterSave:n}){const{getModuleSource:s,getSocketUrl:o}=Fu(),r=SJ(()=>s(i,e),[s,i,e]),a=o(i),l=$B(null),c=Dpt(h=>(l.current=h,()=>{l.current===h&&(l.current=null)}),[]);coe(()=>{n?.(()=>l.current?.())},[n]);const d=SJ(()=>({data:t,onSave:c}),[c]);return r.kind==="dev"?u(Ppt,{source:r,socketUrl:a,pluginId:i,mount:d}):u(Ept,{source:r,socketUrl:a,pluginId:i,mount:d})}const{forwardRef:Rpt,useCallback:QO,useEffect:k8,useMemo:Mpt,useRef:L8,useState:_fe}=await F("react"),o6=Rpt(function({className:e,rightIconPanels:t,menus:n,auxiliaryPanel:s,beService:o,children:r,viewportFullscreen:a,viewportClassName:l,onBeforeMenuChange:c,persistentMenu:d,requestMenuId:h,requestMenuToken:g},m){const{t:f}=q(),{theme:p}=tt(),_=ir(),[b]=xc(),{data:v}=As(),{list:w}=Lb({robotModel:v?.info?.robotModel,point:"move.panel"}),y=L8(o),S=QO(O=>{const B=[...n.map(z=>z.id),...w?.map(z=>z.id)??[]];return O&&B.includes(O)?O:n[0]?.id||w?.[0]?.id||""},[n,w]),[C,N]=_fe(()=>S(b.get("menu"))),[k,L]=_fe(b.get("expended")!=="0"),D=Mpt(()=>{const O=w?.map(B=>({...B,content:u(s6,{pluginId:B.id,ui:B.contribute?.ui})}))??[];return[...n,...O].find(B=>B.id===C)},[n,w,C]),T=QO(O=>{_({pathname:"/muscat/app/move",search:O.toString()},{replace:!0})},[_]),E=QO(async O=>{if(O===C||!(await c?.({currentMenuId:C,nextMenuId:O})??!0))return;N(O);const z=new URLSearchParams(b);z.set("menu",O),z.set("expended",k?"1":"0"),T(z)},[C,k,T,c,b]),R=L8(!1),A=L8(null);k8(()=>{if(!h){A.current=null;return}const O=A.current;if(O&&O.id===h&&O.token===g)return;A.current={id:h,token:g};const B=S(h);if(!B||B===C)return;N(B),R.current=!0;const z=new URLSearchParams(b);z.set("menu",B),z.set("expended",k?"1":"0"),T(z)},[h,g,C,k,b,T,S]);const M=QO(()=>{const O=!k;L(O);const B=new URLSearchParams(b);B.set("menu",C),B.set("expended",O?"1":"0"),T(B)},[C,k,T,b]);return k8(()=>{if(R.current){R.current=!1;return}const O=S(b.get("menu"));if(N(O),L(b.get("expended")!=="0"),O&&O!==b.get("menu")){const B=new URLSearchParams(b);B.set("menu",O),T(B)}},[b,n,w]),k8(()=>{o!==y.current&&(y.current=o,_({pathname:"./",search:""}))},[o]),x("div",{className:P("MoveLayout","relative h-full","[--move-menu-width:2.75rem] [--move-panel-width:17.5rem]","[--move-debug-panel-width:0rem]","min-[1280px]:[--move-panel-width:20rem]",s?.open&&"[--move-debug-panel-width:calc(var(--move-panel-width)*2)]",k&&"[--move-menu-width:8rem]",e),children:[u("div",{className:"relative h-full pr-[calc(var(--move-panel-width)+var(--move-debug-panel-width))] transition-[padding-right] duration-200",children:x("div",{className:"relative h-full pr-(--move-menu-width) transition-[padding-right] duration-200",children:[x("div",{ref:m,"data-slot":"move-viewport","data-state":a?"fullscreen":"windowed",className:P("overflow-hidden",a?"fixed inset-0":"absolute inset-0",l),children:[r,u("div",{"data-flyout-anchor":!0,className:P("text-default absolute top-2 z-11 flex flex-col gap-1.5",a?"right-2":k?"right-33":"right-12"),children:t?.map(O=>u("div",{children:O.element},O.key))})]}),x(U,{className:"bg-translucent border-disabled absolute top-0 right-0 z-1 h-full w-(--move-menu-width) border-r border-l p-1.5 transition-[width] duration-200",alignItems:k?"flex-start":"center",children:[u(se,{className:"text-fg-subtle h-7 w-full justify-start",size:"xs",variant:"transparent",leadingIcon:k?u(kje,{className:"size-3.5"}):u(Lje,{className:"size-3.5"}),onClick:M,children:!!k&&f("move.menu.button.label.collapse")}),u(_o,{type:"horizontal",className:"bg-border-disabled/10",spaceSize:6}),x(U,{className:"w-full gap-2",alignItems:"center",children:[n.map(O=>u(CJ,{id:O.id,icon:O.icon,label:O.label,active:C===O.id,expended:k,onClick:()=>E(O.id)},O.id)),s?u(CJ,{icon:s.icon,label:s.label,active:s.open,expended:k,onClick:s.onToggle}):null,u(Lpt,{robotModel:v?.info?.robotModel,expendedMenu:k,currentMenuId:C,onMenuClick:E})]})]})]})}),u("div",{className:P(p==="light"?"bg-white":"bg-alt-1","absolute top-0 right-(--move-debug-panel-width) z-2 h-full w-(--move-panel-width) transition-[right,width] duration-200"),children:x("div",{className:"h-full overflow-y-auto",children:[d&&u("div",{className:P("h-full",C!==d.id&&"hidden"),children:d.content}),(!d||C!==d.id)&&D?.content]})}),s?.open?u("div",{className:P(p==="light"?"bg-white":"bg-alt-1","border-disabled absolute top-0 right-0 z-2 h-full w-(--move-debug-panel-width) border-l transition-[width] duration-200"),children:u("div",{className:"h-full overflow-hidden",children:s.content})}):null]})}),{useMutation:Apt}=await F("@tanstack/react-query"),Opt="/{robot_model}/call_referencecontrol",Fpt=async i=>{const{robot_model:e,...t}=i,n=Opt.replace("{robot_model}",e),s=await Dt.post(n,t);if(s.returnValue)throw Error(`[Error] error Return value: ${s.returnValue}`);return s},Bpt=()=>Apt({mutationFn:async i=>Fpt(i)}),Ag=({className:i,subject:e})=>u("h6",{className:P("MoveRightPannelSubject","typo-compact-sm-semibold text-fg-default pb-2",i),children:e}),D8=({className:i,title:e,dataList:t})=>x(H,{className:P("ToolItemValue","flex w-full gap-4",i),alignItems:"center",justifyContent:"space-between",children:[u("h6",{className:"typo-compact-xs-medium text-fg-subtler w-30 shrink-0 whitespace-nowrap",children:e}),u("div",{className:P("grid flex-1 grid-cols-3 gap-6","*:gap-1"),children:Object.entries(t).map(([n,s])=>x(H,{className:"h-4 gap-1",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:P("typo-compact-xs-semibold w-2",{"text-fg-danger":n.includes("x"),"text-fg-success":n.includes("y"),"text-fg-information":n.includes("z")}),children:n.toUpperCase()}),x("span",{className:"typo-compact-xs-medium text-fg-subtle",children:[Ti(s),n.includes("r")?"º":"mm"]})]},`${e}-${n}`))})]}),{forwardRef:Vpt}=await F("react"),tMe=Vpt(({className:i,selectedToolNumber:e,toolNumber:t,toolName:n,weight:s,centerOfGravity:o,tcpPosition:r,tcpRotation:a,onSelectNumber:l},c)=>{const d=()=>{l?.(t)};return x(U,{ref:c,className:P("TcpToolItem","bg-fill-inverse-subtle relative z-1 cursor-pointer gap-1.5 rounded-md p-2.5 outline-2 outline-transparent",{"outline-border-navy-stronger":e===t},i),"data-slot":`tcp-tool-item-${t}`,onClick:d,children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("h6",{className:"typo-compact-xs-semibold text-fg-default",children:n}),x("span",{className:"typo-compact-xs-medium text-fg-subtle",children:[Ti(s),"KG"]})]}),x(U,{children:[u(D8,{title:"Center of Gravity",dataList:o}),u(D8,{title:"TCP Position",dataList:r}),u(D8,{title:"TCP Rotation",dataList:a})]})]})});tMe.displayName="TcpToolItem";const{useMutation:zpt}=await F("@tanstack/react-query"),Wpt="/{robot_model}/set_toollist_num",Hpt=async i=>{const e=Wpt.replace("{robot_model}",i.robotModel);return Dt.post(e,i)},$pt=()=>zpt({mutationFn:Hpt}),lv=(i,e)=>({toolName:i,comMass:e,comOffset:{v:[0,0,0]},tcpOffset:{v:[0,0,0]},tcpEuler:{v:[0,0,0]},boxType:0,boxParameter:{f:[0,0,0,0,0,0,0,0,0]}}),Upt={tConfigs0:lv("tool_1",1),tConfigs1:lv("tool_2",2),tConfigs2:lv("tool_3",3),tConfigs3:lv("tool_4",4),tConfigs4:lv("tool_5",5),tConfigs5:lv("tool_6",6),tConfigs6:lv("tool_7",7),tConfigs7:lv("tool_8",8)},jpt=i=>({userfName:i,userfOffset:{v:[0,0,0]},userfEuler:{v:[0,0,0]}}),nMe={user_frames:Array.from({length:8}).map((i,e)=>jpt(`user_frame_${e}`))},iMe={name:Array.from({length:16},(i,e)=>`pp_${e}`),pinJ:Array.from({length:16},()=>({tarValues:[0,0,0,0,0,0,0],tarFrame:0,tarUnit:0})),pinL:Array.from({length:16},()=>({tarValues:[0,0,0,0,0,0,0],tarFrame:0,tarUnit:0}))},{useEffect:Gpt,useMemo:qpt,useRef:bfe,useState:Kpt}=await F("react"),sMe=({className:i,open:e,robotModel:t,selectedToolNumber:n,onOpenChange:s,isUseSimulator:o,onToolSelected:r,resolve:a,close:l})=>{const{t:c}=q(),d=bfe(null),h=bfe([]),[g,m]=Kpt(n),{data:f}=uw({robot_model:t}),{mutateAsync:p,isPending:_}=$pt(),b=qpt(()=>!f&&!o?null:Object.values(o&&!f?Upt:f).map((C,N)=>({toolNumber:N,toolName:C.toolName,weight:Ti(C.comMass.toFixed(2)),centerOfGravity:{x:Ti(C.comOffset.v[0].toFixed(3)),y:Ti(C.comOffset.v[1].toFixed(3)),z:Ti(C.comOffset.v[2].toFixed(3))},tcpPosition:{x:Ti(C.tcpOffset.v[0].toFixed(3)),y:Ti(C.tcpOffset.v[1].toFixed(3)),z:Ti(C.tcpOffset.v[2].toFixed(3))},tcpRotation:{rx:Ti(C.tcpEuler.v[0].toFixed(3)),ry:Ti(C.tcpEuler.v[1].toFixed(3)),rz:Ti(C.tcpEuler.v[2].toFixed(3))}})),[f,o]),v=C=>{if(!d.current){const N=Number(getComputedStyle(C).paddingTop?.replace("px","")??0),k=C.offsetTop,L=h.current[n]?.offsetTop;L&&C.scrollTo({top:L-N-k-30}),d.current=C}},w=C=>{m(C)},y=async()=>{if(o&&!f){r?.(g),a?.(g);return}await p({robotModel:t,targetToolNum:g}),r?.(g),a?.(g)},S=()=>{l?.()};return Gpt(()=>{m(n)},[n]),u(td,{disableAutoFocus:$k.isDesktop,className:P(i,"flex max-h-140! w-137.5! flex-col gap-0 border-none p-0"),open:e,onOpenChange:s,header:{title:c("move.tool.modal.title")},footer:x(H,{className:"h-8 w-full gap-1",alignItems:"center",justifyContent:"flex-end",children:[u(se,{variant:"outlined",onClick:S,children:c("common.button.cancel")}),u(se,{variant:"brand",disabled:g===void 0,loading:_,onClick:y,children:c("common.button.confirm")})]}),children:u(U,{ref:C=>{v(C)},className:"bg-bg-overlay min-h-20 px-4",children:u(Km,{className:"h-full overflow-y-auto",children:u(U,{className:"gap-1.5 p-1",children:u(qr,{list:b,children:({item:C,index:N})=>u(tMe,{ref:k=>{h.current[N]=k},selectedToolNumber:g,toolNumber:C.toolNumber,toolName:C.toolName,weight:C.weight,centerOfGravity:C.centerOfGravity,tcpPosition:C.tcpPosition,tcpRotation:C.tcpRotation,onSelectNumber:w},N)})})})})})},{useMemo:Jpt}=await F("react"),Ypt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{modal:s}=Vi(),{selectedRobot:o}=Fi(e),{toolName:r}=ws(e,d=>({toolName:d.toolName})),{data:a}=uw({robot_model:e}),l=Jpt(()=>{const d=Object.values(a??[]),h=d.findIndex(g=>g.toolName===r);return h!==-1?{...d[h],toolNumber:h}:null},[r,a]),c=()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),s({component:sMe,props:{robotModel:e,selectedToolNumber:l?.toolNumber}})};return x("div",{className:P("TCPToolControl","p-2.5",i),children:[u(Ag,{subject:t("move.menu.button.label.tcpTool")}),u(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:l?x(rn,{children:[x(H,{className:"typo-compact-xs-medium gap-1.5",justifyContent:"space-between",alignItems:"center",children:[u("b",{className:"text-fg-default font-semibold",children:l.toolName}),x("span",{className:"typo-compact-xs-medium text-fg-subtle",children:[Ti(l.comMass),"KG"]})]}),x(U,{className:P("gap-2","[&>.info-box>.label]:typo-compact-2xs-medium [&>.info-box>.label]:text-fg-subtler [&>.info-box>.label]:mb-0.5","[&_.value-group]:gap-2.5","[&_.value-box]:typo-compact-xs-medium [&_.value-box]:text-fg-default [&_.value-box]:w-full","[&_.value-box:nth-child(1)_.value-label]:text-fg-danger [&_.value-box:nth-child(2)_.value-label]:text-fg-success [&_.value-box:nth-child(3)_.value-label]:text-fg-information"),children:[x(U,{className:"info-box",children:[u("span",{className:"label",children:t("settings.tool.title.centerOfGravity")}),x(H,{className:"value-group",children:[x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"X"}),x("span",{className:"value-value",children:[Ti(l.comOffset.v[0].toFixed(3)),"mm"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"Y"}),x("span",{className:"value-value",children:[Ti(l.comOffset.v[1].toFixed(3)),"mm"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"Z"}),x("span",{className:"value-value",children:[Ti(l.comOffset.v[2].toFixed(3)),"mm"]})]})]})]}),x(U,{className:"info-box",children:[u("span",{className:"label",children:`TCP ${t("settings.tool.title.position")}`}),x(H,{className:"value-group",children:[x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"X"}),x("span",{className:"value-value",children:[Ti(l.tcpOffset.v[0].toFixed(3)),"mm"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"Y"}),x("span",{className:"value-value",children:[Ti(l.tcpOffset.v[1].toFixed(3)),"mm"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"Z"}),x("span",{className:"value-value",children:[Ti(l.tcpOffset.v[2].toFixed(3)),"mm"]})]})]})]}),x(U,{className:"info-box",children:[u("span",{className:"label",children:`TCP ${t("settings.tool.title.rotation")}`}),x(H,{className:"value-group",children:[x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"RX"}),x("span",{className:"value-value",children:[Ti(l.tcpEuler.v[0].toFixed(3)),"°"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"RY"}),x("span",{className:"value-value",children:[Ti(l.tcpEuler.v[1].toFixed(3)),"°"]})]}),x(U,{className:"value-box",children:[u("span",{className:"value-label",children:"RZ"}),x("span",{className:"value-value",children:[Ti(l.tcpEuler.v[2].toFixed(3)),"°"]})]})]})]})]})]}):u(Pie,{className:"[&_.no-data-text]:typo-compact-xs-medium h-30",nullText:t("move.menu.msg.tcpTool")})}),u(se,{className:"mt-2 w-full",variant:n==="light"?"brand":"soft",size:"xs",disabled:o?.connected==="DISCONNECT",onClick:c,children:t("move.button.change")})]})},{useCallback:T8,useEffect:Xpt,useRef:Qpt}=await F("react"),Dd=({className:i,variant:e,onButtonDown:t,onButtonUp:n,onButtonCancel:s,...o})=>{const r=Qpt(!1),{theme:a}=tt(),l=T8(()=>{r.current||(t?.(),r.current=!0)},[t]),c=T8(()=>{r.current&&(r.current=!1,n?.())},[n]),d=T8(()=>{r.current&&(r.current=!1,s?s():n?.())},[s,n]);return Xpt(()=>{const h=()=>{c?.()},g=()=>{d()};return window.addEventListener("pointerup",h),window.addEventListener("pointercancel",g),()=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",g)}},[c,d]),u(se,{variant:e,className:P("NxPointerHoldButton",a==="light"&&e==="outlined"&&"outline-fg-navy text-fg-navy",i),...o,onContextMenu:h=>{h.preventDefault()},onPointerDown:h=>{h.currentTarget.setPointerCapture?.(h.pointerId),l()},onPointerUp:c,onPointerCancel:d,children:o.children})},{useCallback:vfe,useMemo:Zpt,useState:e_t}=await F("react"),t_t=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{selectedRobot:s}=Fi(e),[o,r]=e_t(null),{jointLength:a,isMoving:l,jointInfo:c}=U9({tabType:"joint",tickModeInput:null,robotModel:e}),d=Zpt(()=>l||s?.connected==="DISCONNECT",[l,s?.connected]),{mutate:h}=K9(),{mutate:g}=J9(),m=vfe((p,_)=>{const b=Array.from({length:a},(w,y)=>c.values[y]);let v=[];p==="all"?v=Array(b.length).fill(0):v=b.map((w,y)=>y===_?0:typeof w=="number"?Number(w.toFixed(3)):0),r(_),h({robot_model:e,type:"j",target:{tar_values:v,tar_frame:-1,tar_unit:0},speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1}})},[h,a,e,c]),f=vfe(()=>{r(null),g({robot_model:e,stoptime:.3})},[g,e]);return u("div",{className:P("ZeroPoseControl","h-full",i),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:t("move.menu.button.label.zeroPose")}),Array.from({length:a}).map((p,_)=>u(Dd,{className:"typo-compact-xs-semibold",size:"sm",variant:"outlined",disabled:d&&o!==_,onButtonDown:()=>m("single",_),onButtonUp:f,children:`${t("move.menu.button.label.moveOrigin",{index:_})}`},`j${_}`)),u(Dd,{className:"typo-compact-xs-semibold",size:"sm",variant:n==="light"?"brand":"soft",disabled:d&&o!==-1,onButtonDown:()=>m("all",-1),onButtonUp:f,children:t("move.menu.button.label.moveAllOrigin")})]})})},{createContext:n_t,useContext:i_t}=await F("react"),oMe=n_t(null),kr=()=>{const i=i_t(oMe);if(!i)throw new Error("Available only inside GripperControl.");return i},{useMutation:s_t}=await F("@tanstack/react-query"),o_t="/{robot_model}/call_gripper_action",r_t=async i=>{const{robot_model:e,...t}=i,n=o_t.replace("{robot_model}",e);return await Dt.post(n,t)},si=()=>s_t({mutationFn:async i=>r_t(i)}),a_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,1,0,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.motorType"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:"General"},"motor-general"),u(J,{value:1,children:"XM-Series"},"motor-xm")]})})}),u(me,{label:e("program.field.label.controlMode"),children:u(oe,{control:n,name:"payload.3",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:e("settings.devices.welding.convMap.title.current")},"control-curr"),u(J,{value:1,children:e("settings.amr.collection.position")},"control-pos"),u(J,{value:2,children:e("program.gripper.option.currBasePos")},"control-curr-pos")]})})})]})]})},l_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalCurrent")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetCurrent")} (mA)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},c_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (Tick)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},d_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:0,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(a_t,{onPreview:s},"initialize");case 1:return u(l_t,{onPreview:s},"set-goal-current");case 2:return u(c_t,{onPreview:s},"set-goal-position")}};return u("div",{className:P("DynamixelMotor",i),children:o()})},u_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,1,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.initializeType"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:e("program.gripper.option.simpleInit")},"pg/cg-simple"),u(J,{value:1,children:e("program.gripper.option.fullInit")},"pg/cg-full")]})})})]})]})},h_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},g_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0,0,0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},m_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:1,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(u_t,{onPreview:s},"initialize");case 1:return u(h_t,{onPreview:s},"set-goal-position");case 2:return u(g_t,{onPreview:s},"set-3-params")}};return u("div",{className:P("DHPGSeries",i),children:o()})},f_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,1,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.initializeType"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:e("program.gripper.option.simpleInit")},"ag-simple"),u(J,{value:1,children:e("program.gripper.option.fullInit")},"ag-full")]})})})]})]})},p_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},__t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0,0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},b_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:2,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(f_t,{onPreview:s},"initialize");case 1:return u(p_t,{onPreview:s},"set-goal-position");case 2:return u(__t,{onPreview:s},"set-goal-pos-force")}};return u("div",{className:P("DHAGSeries",i),children:o()})},v_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,9]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},ZO=({onPreview:i,title:e,functionNum:t})=>{const{t:n}=q();return u(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:()=>{i(t,[])},children:n("program.button.preview")})]})})},y_t=({className:i})=>{const{t:e}=q(),{functionType:t,robotModel:n}=kr(),{mutate:s}=si(),o=(a,l)=>{s({robot_model:n,gripper_type:3,function_list:a,payload:l})},r=()=>{switch(t){case 0:return u(v_t,{onPreview:o},"initialize");case 1:return u(ZO,{onPreview:o,title:e("program.gripper.option.reset"),functionNum:1},"reset");case 2:return u(ZO,{onPreview:o,title:e("program.gripper.option.suction"),functionNum:2},"suction");case 3:return u(ZO,{onPreview:o,title:e("program.gripper.option.release"),functionNum:3},"release");case 4:return u(ZO,{onPreview:o,title:e("program.gripper.option.hold"),functionNum:4},"hold")}};return u("div",{className:P("RobotiqEPick",i),children:r()})},w_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,9]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},C_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},S_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0,0,0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},x_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:4,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(w_t,{onPreview:s},"initialize");case 1:return u(C_t,{onPreview:s},"set-goal-position");case 2:return u(S_t,{onPreview:s},"set-3-params")}};return u("div",{className:P("Robotiq2FSeries",i),children:o()})},N_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,9]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},I_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},k_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0,0,0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},L_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:5,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(N_t,{onPreview:s},"initialize");case 1:return u(I_t,{onPreview:s},"set-goal-position");case 2:return u(k_t,{onPreview:s},"set-3-params")}};return u("div",{className:P("RobotiqHandESeries",i),children:o()})},D_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,1]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},T_t=[{label:"program.gripper.option.laserOn",value:0},{label:"program.gripper.option.laserOff",value:1},{label:"program.gripper.option.setZeroPos",value:2},{label:"program.gripper.option.facotryReset",value:3}],E_t=({onPreview:i})=>{const{t:e}=q(),{control:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.gripper.option.functionCall")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:e("program.field.label.functionList"),children:u(oe,{control:t,name:"payload.0",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:T_t.map(r=>u(J,{value:r.value,children:e(r.label)},r.label))})})})})]})},P_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:6,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(D_t,{onPreview:s},"initialize");case 1:return u(E_t,{onPreview:s},"function-call")}};return u("div",{className:P("BaumerLDS",i),children:o()})},R_t=[{label:"program.gripper.option.inward",value:0},{label:"program.gripper.option.outward",value:1}],M_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,0,0,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerOrient"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:R_t.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.fingerLength")} (mm)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerTipWidth"),children:u(ot,{className:"w-full",name:"payload.4",register:t,allowNegative:!0})})]})]})},rMe=[{label:"program.gripper.option.extGrip",value:0},{label:"program.gripper.option.interGrip",value:1},{label:"program.gripper.option.stop",value:2}],A_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.gripDirection"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:rMe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},O_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0,0]}}),o=()=>{const r=n();i(2,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.gripDirection"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:rMe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},F_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:7,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(M_t,{onPreview:s},"initialize");case 1:return u(A_t,{onPreview:s},"set-goal-position");case 2:return u(O_t,{onPreview:s},"set-3-params")}};return u("div",{className:P("OnRobot2FG7",i),children:o()})},B_t=[{label:"program.gripper.option.inward",value:0},{label:"program.gripper.option.outward",value:1}],V_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,0,0,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerOrient"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:B_t.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.fingerLength")} (mm)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerTipWidth"),children:u(ot,{className:"w-full",name:"payload.4",register:t,allowNegative:!0})})]})]})},aMe=[{label:"program.gripper.option.extGrip",value:0},{label:"program.gripper.option.interGrip",value:1},{label:"program.gripper.option.stop",value:2}],z_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.gripDirection"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:aMe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},W_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0,0]}}),o=()=>{const r=n();i(2,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.gripDirection"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:aMe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},H_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:8,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(V_t,{onPreview:s},"initialize");case 1:return u(z_t,{onPreview:s},"set-goal-position");case 2:return u(W_t,{onPreview:s},"set-3-params")}};return u("div",{className:P("OnRobot2FG14",i),children:o()})},$_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},U_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.moveType"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:e("program.gripper.option.grip")},"grip"),u(J,{value:1,children:e("program.gripper.option.stop")},"stop")]})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},j_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:9,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u($_t,{onPreview:s},"initialize");case 1:return u(U_t,{onPreview:s},"set-goal-pos-force")}};return u("div",{className:P("OnRobotRG2",i),children:o()})},G_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},q_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.moveType"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>x(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[u(J,{value:0,children:e("program.gripper.option.grip")},"grip"),u(J,{value:1,children:e("program.gripper.option.stop")},"stop")]})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},K_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:10,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(G_t,{onPreview:s},"initialize");case 1:return u(q_t,{onPreview:s},"set-goal-pos-force")}};return u("div",{className:P("OnRobotRG6",i),children:o()})},J_t=[{label:"program.gripper.option.extGrip",value:0},{label:"program.gripper.option.interGrip",value:1}],Y_t=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,49,0,13.5,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.fingerLength")} (mm)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerPosition"),children:u(oe,{control:n,name:"payload.3",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[1,2,3].map((a,l)=>u(J,{value:l,children:`Install-${a}`},`install-${a}`))})})}),u(me,{label:`${e("program.field.label.fingerDiameter")} (mm)`,children:u(ot,{className:"w-full",name:"payload.4",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.gripType"),children:u(oe,{control:n,name:"payload.5",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:J_t.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})})]})]})},X_t=[{label:"Grip",value:0},{label:"Move",value:1},{label:"Stop",value:2},{label:"Flexible",value:3}],Q_t=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.moveType"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:X_t.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},Z_t=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:11,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Y_t,{onPreview:s},"initialize");case 1:return u(Q_t,{onPreview:s},"set-goal-pos-force")}};return u("div",{className:P("OnRobot3FG15",i),children:o()})},ebt=[{label:"program.gripper.option.extGrip",value:0},{label:"program.gripper.option.interGrip",value:1}],tbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,49,0,13.5,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.fingerLength")} (mm)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.fingerPosition"),children:u(oe,{control:n,name:"payload.3",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:[1,2,3].map((a,l)=>u(J,{value:l,children:`Install-${a}`},`install-${a}`))})})}),u(me,{label:`${e("program.field.label.fingerDiameter")} (mm)`,children:u(ot,{className:"w-full",name:"payload.4",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.gripType"),children:u(oe,{control:n,name:"payload.5",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:ebt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})})]})]})},nbt=[{label:"Grip",value:0},{label:"Move",value:1},{label:"Stop",value:2},{label:"Flexible",value:3}],ibt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.moveType"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:nbt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},sbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:12,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(tbt,{onPreview:s},"initialize");case 1:return u(ibt,{onPreview:s},"set-goal-pos-force")}};return u("div",{className:P("OnRobot3FG25",i),children:o()})},obt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,100]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.powerConsumption")} (%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0})})]})]})},yfe=[{label:"Release",value:0},{label:"Grip",value:1},{label:"Idle",value:2}],rbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,100,0,100]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.chFunction",{msg:"A"}),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:yfe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.chPressure",{msg:"A"})} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:e("program.field.label.chFunction",{msg:"B"}),children:u(oe,{control:s,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:yfe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.chPressure",{msg:"B"})} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},abt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:13,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(obt,{onPreview:s},"initialize");case 1:return u(rbt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotVG10",i),children:o()})},lbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,100]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.powerConsumption")} (%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0})})]})]})},wfe=[{label:"Release",value:0},{label:"Grip",value:1},{label:"Idle",value:2}],cbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,100,0,100]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.chFunction",{msg:"A"}),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:wfe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.chPressure",{msg:"A"})} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:e("program.field.label.chFunction",{msg:"B"}),children:u(oe,{control:s,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:wfe.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.chPressure",{msg:"B"})} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},dbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:14,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(lbt,{onPreview:s},"initialize");case 1:return u(cbt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotVGC10",i),children:o()})},ubt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},hbt=[{label:"Disengage",value:0},{label:"Engage",value:1},{label:"Engage + Smart Grip",value:2},{label:"Auto-Calibration",value:3}],gbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.cmdMode"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:hbt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.magneticStrength")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},mbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:15,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(ubt,{onPreview:s},"initialize");case 1:return u(gbt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotMG10",i),children:o()})},fbt=[{label:"program.gripper.option.none",value:0},{label:"Type a-h",value:1},{label:"Type a-s",value:2},{label:"Type b-H",value:3}],pbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,0]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:e("program.field.label.siliconModel"),children:u(oe,{control:n,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:fbt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})})]})]})},_bt=[{label:"program.gripper.option.move",value:0},{label:"program.gripper.option.stop",value:1}],bbt=[{label:"General Mode",value:0},{label:"Gentle Grip Mode",value:1}],vbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetWidth")} (mm)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:e("program.field.label.cmdMode"),children:u(oe,{control:s,name:"payload.1",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:_bt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:e("program.field.label.gripMode"),children:u(oe,{control:s,name:"payload.2",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:bbt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})})]})]})},ybt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:16,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(pbt,{onPreview:s},"initialize");case 1:return u(vbt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotSoftGripper",i),children:o()})},{Fragment:wbt}=await F("react"),Cbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},Sbt=[{label:"program.gripper.option.use",value:0},{label:"program.gripper.option.notUse",value:1}],xbt=[{label:"program.gripper.option.active",value:0},{label:"program.gripper.option.ignore",value:1}],Nbt=[{label:"A",base:0},{label:"B",base:3},{label:"C",base:6},{label:"D",base:9}],Ibt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,0,0,0,0,0,0,0,0,0,0,0]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:Nbt.map(r=>x(wbt,{children:[u(me,{label:`${e("program.field.label.channel")}-${r.label} ${e("program.field.label.pressure")} (0~100%)`,children:u(ot,{className:"w-full",name:`payload.${r.base}`,register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.channel")}-${r.label} ${e("program.field.label.timeOutput")}`,children:u(oe,{control:s,name:`payload.${r.base+1}`,render:({field:a})=>u(ae,{className:"w-full",size:"sm",value:a.value,onChange:l=>a.onChange(Number(l.target.value)),children:Sbt.map(l=>u(J,{value:l.value,children:e(l.label)},l.label))})})}),u(me,{label:`${e("program.field.label.channel")}-${r.label} ${e("program.gripper.option.active")}/${e("program.gripper.option.ignore")}`,children:u(oe,{control:s,name:`payload.${r.base+2}`,render:({field:a})=>u(ae,{className:"w-full",size:"sm",value:a.value,onChange:l=>a.onChange(Number(l.target.value)),children:xbt.map(l=>u(J,{value:l.value,children:e(l.label)},l.label))})})})]},`channel-${r.label}`))})]})},kbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:17,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Cbt,{onPreview:s},"initialize");case 1:return u(Ibt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotVGP20",i),children:o()})},Lbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,65,300,10]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.rpmDeviLevel")} (RPM)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0})}),u(me,{label:`${e("program.field.label.vibLimitLevel")} (g)`,children:u(ot,{className:"w-full",name:"payload.3",register:t,allowNegative:!0})})]})]})},Dbt=[{label:"program.gripper.option.motorStop",value:0},{label:"program.gripper.option.motorStart",value:1},{label:"program.gripper.option.ledOff",value:2},{label:"program.gripper.option.ledOn",value:3}],Tbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n,control:s}=he({defaultValues:{payload:[0,1500]}}),o=()=>{const r=n();i(1,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.action")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.cmdMode"),children:u(oe,{control:s,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:Dbt.map(a=>u(J,{value:a.value,children:e(a.label)},a.label))})})}),u(me,{label:`${e("program.field.label.targetRPM")} (RPM)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},Ebt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:18,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Lbt,{onPreview:s},"initialize");case 1:return u(Tbt,{onPreview:s},"action")}};return u("div",{className:P("OnRobotSander",i),children:o()})},Pbt=[{label:"JEGB 4285",value:0},{label:"JEGB 42140",value:1}],Rbt=({onPreview:i})=>{const{t:e}=q(),{control:t,getValues:n}=he({defaultValues:{payload:[0,0]}}),s=()=>{const o=n();i(0,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:t,name:"payload.0",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.productModel"),children:u(oe,{control:t,name:"payload.1",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>{o.onChange(Number(r.target.value))},children:Pbt.map(r=>u(J,{value:r.value,children:r.label},r.label))})})})]})]})},Mbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[80,80,80]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setParam")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.speed")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.acceleration")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.force")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},Abt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.gotoTarget")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")}`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},Obt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:19,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Rbt,{onPreview:s},"initialize");case 1:return u(Mbt,{onPreview:s},"set-parameter");case 2:return u(Abt,{onPreview:s},"goto-target")}};return u("div",{className:P("JrtJEGB",i),children:o()})},Fbt=[{label:"JEGG 2008",value:0},{label:"JEGG 2510",value:1},{label:"JEGG 3521",value:2},{label:"JEGG 4230",value:3}],Bbt=({onPreview:i})=>{const{t:e}=q(),{control:t,getValues:n}=he({defaultValues:{payload:[0,0]}}),s=()=>{const o=n();i(0,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:t,name:"payload.0",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.productModel"),children:u(oe,{control:t,name:"payload.1",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:Fbt.map(r=>u(J,{value:r.value,children:r.label},r.label))})})})]})]})},Vbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[80,80,80]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setParam")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.speed")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.acceleration")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.force")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},zbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.gotoTarget")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")}`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},Wbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:20,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Bbt,{onPreview:s},"initialize");case 1:return u(Vbt,{onPreview:s},"set-parameter");case 2:return u(zbt,{onPreview:s},"goto-target")}};return u("div",{className:P("JrtJEGG",i),children:o()})},Hbt=[{label:"JEGC 2870",value:0},{label:"JEGC 28150",value:1}],$bt=({onPreview:i})=>{const{t:e}=q(),{control:t,getValues:n}=he({defaultValues:{payload:[0,0]}}),s=()=>{const o=n();i(0,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:t,name:"payload.0",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.productModel"),children:u(oe,{control:t,name:"payload.1",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:Hbt.map(r=>u(J,{value:r.value,children:r.label},r.label))})})})]})]})},Ubt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[80,80,80]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setParam")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.speed")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.acceleration")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.force")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},jbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.gotoTarget")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")}`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},Gbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:21,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u($bt,{onPreview:s},"initialize");case 1:return u(Ubt,{onPreview:s},"set-parameter");case 2:return u(jbt,{onPreview:s},"goto-target")}};return u("div",{className:P("JrtJEGC",i),children:o()})},qbt=[{label:"JEGH 3520",value:0},{label:"JEGH 4232",value:1},{label:"JEGH 4226",value:2}],Kbt=({onPreview:i})=>{const{t:e}=q(),{control:t,getValues:n}=he({defaultValues:{payload:[0,0]}}),s=()=>{const o=n();i(0,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:t,name:"payload.0",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.productModel"),children:u(oe,{control:t,name:"payload.1",render:({field:o})=>u(ae,{className:"w-full",size:"sm",value:o.value,onChange:r=>o.onChange(Number(r.target.value)),children:qbt.map(r=>u(J,{value:r.value,children:r.label},r.label))})})})]})]})},Jbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[80,80,80]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setParam")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.speed")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.acceleration")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.force")} (0~100%)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},Ybt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.gotoTarget")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")}`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},Xbt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:22,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Kbt,{onPreview:s},"initialize");case 1:return u(Jbt,{onPreview:s},"set-parameter");case 2:return u(Ybt,{onPreview:s},"goto-target")}};return u("div",{className:P("JrtJEGH",i),children:o()})},Qbt=({onPreview:i})=>{const{t:e}=q(),{register:t,control:n,getValues:s}=he({defaultValues:{payload:[0,1]}}),o=()=>{const r=s();i(0,r.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.field.label.initialize")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:o,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:e("program.field.label.connectionPort"),children:u(oe,{control:n,name:"payload.0",render:({field:r})=>u(ae,{className:"w-full",size:"sm",value:r.value,onChange:a=>r.onChange(Number(a.target.value)),children:u(J,{value:0,children:"Tool-flange"},"conn-port")})})}),u(me,{label:e("program.field.label.deviceId"),children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0})})]})]})},Zbt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0]}}),s=()=>{const o=n();i(1,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPos")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),u(U,{className:"w-full gap-2",children:u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})})})]})},evt=({onPreview:i})=>{const{t:e}=q(),{register:t,getValues:n}=he({defaultValues:{payload:[0,0,0]}}),s=()=>{const o=n();i(2,o.payload)};return x(U,{className:"bg-raised gap-3 rounded-md p-2.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default",children:e("program.section.title.setGoalPosSpdForce")}),u(se,{size:"sm",className:"w-22",variant:"outlined",leadingIcon:u(at,{className:"size-4"}),onClick:s,children:e("program.button.preview")})]}),x(U,{className:"w-full gap-2",children:[u(me,{label:`${e("program.field.label.targetPosition")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.0",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetSpeed")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.1",register:t,allowNegative:!0,decimalPlaces:3})}),u(me,{label:`${e("program.field.label.targetForce")} (0~100)`,children:u(ot,{className:"w-full",name:"payload.2",register:t,allowNegative:!0,decimalPlaces:3})})]})]})},tvt=({className:i})=>{const{functionType:e,robotModel:t}=kr(),{mutate:n}=si(),s=(r,a)=>{n({robot_model:t,gripper_type:23,function_list:r,payload:a})},o=()=>{switch(e){case 0:return u(Qbt,{onPreview:s},"initialize");case 1:return u(Zbt,{onPreview:s},"set-goal-position");case 2:return u(evt,{onPreview:s},"set-3-params")}};return u("div",{className:P("Aidin2FG",i),children:o()})},{useMemo:Cfe,useState:nvt}=await F("react"),Sfe=-1,ivt={0:d_t,1:m_t,2:b_t,3:y_t,4:x_t,5:L_t,6:P_t,7:F_t,8:H_t,9:j_t,10:K_t,11:Z_t,12:sbt,13:abt,14:dbt,15:mbt,16:ybt,17:kbt,18:Ebt,19:Obt,20:Wbt,21:Gbt,22:Xbt,23:tvt},svt=({className:i,robotModel:e})=>{const{t}=q(),{data:n,isLoading:s}=pRe({robot_model:e}),o=n?.attachOption??Sfe,[r,a]=nvt({gripperType:o,functionType:0}),l=r.gripperType===o?r.functionType:0,c=Cfe(()=>o===-1?"settings.box.option.notMounted":UI[o]?.label,[o]),d=Cfe(()=>({functionType:l,robotModel:e}),[l,e]),h=Jse[o]??[],g=ivt[o],m=o!==Sfe&&!!g,f=()=>s?u("div",{className:"bg-raised flex h-30 w-full items-center justify-center gap-3 rounded-md p-2.5",children:u(aw,{size:"1rem",className:"text-fg-subtle shrink-0"})}):m?x(oMe.Provider,{value:d,children:[u(me,{label:t("program.field.label.functionList"),children:u(ae,{className:"w-full",size:"sm",value:l,onChange:p=>a({gripperType:o,functionType:Number(p.target.value)}),children:h.map(p=>u(J,{value:p.value,children:t(p.label)},p.value))})}),u(_o,{}),u(g,{},o)]}):u("div",{className:"bg-raised flex h-30 w-full items-center justify-center gap-3 rounded-md p-2.5",children:u("p",{className:"typo-compact-xs-medium text-fg-subtle",children:t("move.gripper.notMountDesc")})});return u("div",{className:P("GripperControl","h-full",i),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:`${t("move.menu.button.label.gripper")} (${t(c)})`}),f()]})})},{useQuery:ovt}=await F("@tanstack/react-query"),lMe="/{robot_model}/call_config_globpinlist",rvt=async({robot_model:i})=>{const e=lMe.replace("{robot_model}",i);return Dt.get(e)},cMe=(i,e={})=>ovt({queryKey:[lMe,i],queryFn:()=>rvt(i),...e}),{useMutation:avt}=await F("@tanstack/react-query"),lvt="/{robot_model}/save_globpin_parameter",cvt=async i=>{const{robot_model:e,...t}=i,n=lvt.replace("{robot_model}",e),s=await Dt.post(n,t);if(s.return_value)throw Error(`[Error] error Return value: ${s.return_value}`);return s},dvt=()=>{const{alertDialog:i,closeDialog:e}=jn();return avt({mutationFn:async t=>cvt(t),onError:t=>{i({modalId:"setGlobalPinPointParameterError",title:"Error",content:"User Parameter Error: "+(t?.message||t),onConfirm:()=>e("setGlobalPinPointParameterError")})}})},{useCallback:xfe,useEffect:uvt,useMemo:hvt,useState:Nfe}=await F("react"),gvt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{selectedRobot:s}=Fi(e),[o,r]=Nfe(null),{data:a,refetch:l}=cMe({robot_model:e}),{mutateAsync:c,isPending:d}=dvt(),{motionMode:h}=ws(e,S=>({motionMode:S.motionMode})),{mutate:g}=K9(),{mutate:m}=J9(),[f,p]=Nfe(a??iMe),_=hvt(()=>h!==0||s?.connected==="DISCONNECT",[h,s?.connected]),b=(S,C)=>{p(N=>{const k={...N},L=[...N.name];return L[S]=C,k.name=L,k})},v=xfe((S,C,N)=>{const k=C.split(",").map(L=>Number(L.trim()));r(`${S}-${N}`),g({robot_model:e,type:S,target:{tar_values:k,tar_frame:S==="j"?-1:0,tar_unit:0},speed:{spd_mode:0,spd_vel_para:.4,spd_acc_para:.1}})},[g,e]),w=xfe(()=>{r(null),m({robot_model:e,stoptime:.3})},[m,e]),y=async(S,C)=>{await c({robot_model:e,pin_num:S,pin_name:C}),l()};return uvt(()=>{a&&p(a)},[a]),x(Km,{className:P("GlobalPinPointControl","relative h-full w-full px-3 py-2.5"),children:[u("div",{className:"sticky top-0 z-10",children:u(Ag,{subject:t("move.menu.button.label.pinpoint")})}),u(U,{className:"w-full max-w-full gap-3 overflow-hidden",children:f&&f?.name?.map((S,C)=>{const N=S,k=f.pinJ[C].tarValues?.map(D=>D.toFixed(2)).join(", "),L=f.pinL[C].tarValues?.map(D=>D.toFixed(2)).join(", ");return x(U,{className:P("gap-2 self-stretch rounded-md p-2.5",n==="light"?"border-fill-navy-subtle border":"bg-bg-alt-2"),children:[x(H,{className:"w-full gap-1.5",alignItems:"center",children:[u("span",{className:"typo-compact-xs-semibold text-fg-subtle min-w-8 shrink-0",children:t("settings.tool.title.name")}),u(et,{className:"w-0 min-w-0 flex-1",size:"xs2",type:"text",inputMode:"text",value:N,onChange:D=>b(C,D.target.value)})]}),x(U,{className:"typo-compact-2xs-normal text-fg-default w-full gap-0.5",children:[u("span",{children:`J: ${k}`}),u("span",{children:`L: ${L}`})]}),x(H,{className:"w-full gap-1",alignItems:"center",children:[u(Dd,{className:P("w-[33%]"),variant:n==="light"?"outlined":"soft",size:"xs",disabled:_&&o!==`j-${C}`,onButtonDown:()=>v("j",k,C),onButtonUp:w,children:t("program.button.movej")}),u(Dd,{className:P("w-[33%]"),variant:n==="light"?"outlined":"soft",size:"xs",disabled:_&&o!==`l-${C}`,onButtonDown:()=>v("l",L,C),onButtonUp:w,children:t("program.button.movel")}),u(se,{className:"w-[33%]",variant:"brand",size:"xs",disabled:_,loading:d,onClick:()=>y(C,N),children:t("settings.button.save")})]})]},`pp-${C}`)})})]})},{useCallback:RD,useRef:mvt,useState:fvt}=await F("react"),pvt=500,_vt=800,bvt=(i=[],e)=>{const[t,n]=fvt(()=>({stack:e?.historyStack??[i],index:e?.historyIndex??0})),s=!!e?.onCommit,o=s?e?.items??t.stack[t.index]:t.stack[t.index],r=s?(e?.historyIndex??0)>0:t.index>0,a=s?(e?.historyIndex??0)<(e?.historyStack?.length??1)-1:t.index<t.stack.length-1,l=mvt(null),c=RD((f,p)=>{const _=Date.now(),b=l.current,v=!!p&&!!b&&b.key===p&&_-b.time<_vt;l.current=p?{key:p,time:_}:null;const w=e?.historyStack??t.stack,y=e?.historyIndex??t.index,S=w.slice(0,y+1);let C,N;v&&S.length>1?(S[S.length-1]=f,C=S,N=S.length-1):(S.push(f),S.length>pvt&&S.shift(),C=S,N=S.length-1),e?.onCommit?e.onCommit(f,C,N):n({stack:C,index:N})},[e,t]),d=RD(f=>{const p=e?.historyStack??t.stack,_=e?.historyIndex??t.index,b=p.slice();b[_]=f,l.current=null,e?.onCommit?e.onCommit(f,b,_):n({stack:b,index:_})},[e,t]),h=RD(f=>{l.current=null,e?.onReset?e.onReset(f):n({stack:[f],index:0})},[e]),g=RD(()=>{l.current=null;const f=e?.historyIndex??t.index;if(f<=0)return;const p=f-1,b=(e?.historyStack??t.stack)[p];e?.onUndo?e.onUndo(b,p):n(v=>({...v,index:p}))},[e,t]),m=RD(()=>{l.current=null;const f=e?.historyIndex??t.index,p=e?.historyStack??t.stack;if(f>=p.length-1)return;const _=f+1,b=p[_];e?.onRedo?e.onRedo(b,_):n(v=>({...v,index:_}))},[e,t]);return{items:o,canUndo:r,canRedo:a,commit:c,replaceCurrent:d,resetHistory:h,undo:g,redo:m}},{useCallback:E8,useEffect:P8,useMemo:Ife,useRef:vvt,useState:eF}=await F("react"),yvt=3e5,wvt=({items:i,tabKind:e,mountJointName:t,hiddenItemIds:n})=>{const[s,o]=eF(()=>new Set),[r,a]=eF(()=>new Set),[l,c]=eF(null),[d,h]=eF(null),g=vvt(new Map),m=E8(v=>{o(w=>w.has(v)?w:new Set(w).add(v)),a(w=>{if(!w.has(v))return w;const y=new Set(w);return y.delete(v),y}),h({assetId:`${e}:${v}`,nonce:Date.now()})},[e]),f=E8(v=>{a(w=>w.has(v)?w:new Set(w).add(v))},[]),p=E8(v=>{a(w=>w.has(v)?w:new Set(w).add(v)),c({itemId:v,nonce:Date.now()})},[]);P8(()=>{o(v=>ffe(v,i)),a(v=>ffe(v,i))},[i]);const _=Ife(()=>ppt(i,s,r),[i,s,r]);return P8(()=>{const v=g.current;for(const w of _)v.has(w)||v.set(w,setTimeout(()=>{v.delete(w),p(w)},yvt));for(const[w,y]of v)_.has(w)||(clearTimeout(y),v.delete(w))},[_,p]),P8(()=>{const v=g.current;return()=>{for(const w of v.values())clearTimeout(w);v.clear()}},[]),{assets:Ife(()=>fpt(i,e,t,m,f,n),[i,e,t,m,f,n]),loadingItemIds:_,loadFailedItemIds:r,loadTimeoutEvent:l,assetLoadedEvent:d}},{useMutation:Cvt}=await F("@tanstack/react-query"),Svt=1,xvt={x:0,y:0,z:0,rx:0,ry:0,rz:0},Nvt=i=>{const e=i??Svt;return typeof e=="number"?{x:e,y:e,z:e}:e},NJ=i=>Ut.post("/model/",{robotModel:i.robotModel,detailRobotModel:i.detailRobotModel,modelType:i.modelType,scale:Nvt(i.scale),pose:i.pose??xvt,name:i.name??void 0,workspace:i.workspace,attachment:i.attachment??void 0,...i.fileId!==void 0?{fileId:i.fileId}:{shapeType:i.shapeType}}),Ivt=()=>Cvt({mutationFn:NJ}),{useMutation:eVn}=await F("@tanstack/react-query"),doe=({modelId:i,...e})=>Ut.patch(`/model/${i}`,e),{useMutation:kvt}=await F("@tanstack/react-query"),dMe=i=>Ut.delete(`/model/${i}`),uoe=()=>kvt({mutationFn:dMe}),{useQuery:Lvt}=await F("@tanstack/react-query"),uMe="/model/robot",i1=(i,e)=>[uMe,i,e],Dvt=async(i,e)=>{try{return(await Ut.get(`/model/robot/${i}/detail/${e}`)).models}catch(t){if(t?.response?.status===404)return[];throw t}},r6=(i,e,t={})=>Lvt({queryKey:i1(i,e),queryFn:()=>Dvt(i,e),...t,enabled:!!(i&&e)&&(t.enabled??!0)}),{useMutation:Tvt,useQueryClient:Evt}=await F("@tanstack/react-query"),kfe=i=>{if(typeof i!="object"||i===null)return;const{response:e,status:t}=i;if(typeof e?.status=="number")return e.status;if(typeof t=="number")return t},hMe=i=>({x:i.position.x/Pn,y:i.position.y/Pn,z:i.position.z/Pn,rx:i.rotation.rx,ry:i.rotation.ry,rz:i.rotation.rz}),Lfe=(i,{robotModel:e,detailRobotModel:t,modelType:n,attachment:s,workspaceName:o})=>({robotModel:e,detailRobotModel:t,modelType:n,scale:i.kind==="shape"?i.scale:uR,name:i.name,workspace:{name:o},pose:hMe(i),attachment:s,...i.kind==="shape"?{shapeType:i.shapeType}:{fileId:i.fileId}}),Pvt=async({changes:i,robotModel:e,detailRobotModel:t,modelType:n,attachment:s,workspaceName:o})=>{const r=[];for(const a of i)try{if(a.kind==="create"){const l=a.item,c=await NJ(Lfe(l,{robotModel:e,detailRobotModel:t,modelType:n,attachment:s,workspaceName:o}));r.push({id:l.id,status:"created",modelId:c.modelId})}else if(a.kind==="update")try{await doe({modelId:a.modelId,name:a.item.name,workspace:{name:o},pose:hMe(a.item),...a.item.kind==="shape"&&{scale:a.item.scale}}),r.push({id:a.item.id,status:"updated"})}catch(l){if(kfe(l)===404){const c=a.item,d=await NJ(Lfe(c,{robotModel:e,detailRobotModel:t,modelType:n,attachment:s,workspaceName:o}));r.push({id:c.id,status:"created",modelId:d.modelId})}else throw l}else{try{await dMe(a.modelId)}catch(l){if(kfe(l)!==404)throw l}r.push({id:a.modelId,status:"deleted"})}}catch(l){const c=a.kind==="delete"?a.modelId:a.item.id;r.push({id:c,status:"failed",error:l})}return r},Rvt=({changes:i,results:e,libraryModels:t,modelType:n})=>{const s=new Set(e.filter(a=>a.status==="created"||a.status==="updated").map(a=>a.id)),o=new Map;for(const a of i){if(a.kind==="delete")continue;const{item:l}=a;l.kind!=="custom"||!s.has(l.id)||o.set(l.fileId,l.rotation)}const r=[];for(const[a,l]of o){const c=t.find(f=>!f.workspace&&f.shapeType===null&&f.fileId===a&&f.modelType===n);if(!c)continue;const{rx:d,ry:h,rz:g}=l;c.pose.rx===d&&c.pose.ry===h&&c.pose.rz===g||r.push({modelId:c.modelId,pose:{...c.pose,rx:d,ry:h,rz:g}})}return r},Mvt=()=>{const i=Evt();return Tvt({mutationFn:async e=>{const t=await Pvt(e),n=i.getQueryData(i1(e.robotModel,e.detailRobotModel))??[],s=Rvt({changes:e.changes,results:t,libraryModels:n,modelType:e.modelType});return await Promise.allSettled(s.map(o=>doe({modelId:o.modelId,pose:o.pose}))),t},onSuccess:(e,t)=>{i.invalidateQueries({queryKey:i1(t.robotModel,t.detailRobotModel)})}})},{useMutation:Avt,useQueryClient:Ovt}=await F("@tanstack/react-query"),Fvt=async i=>i.length===0?null:Ut.patch("/model/loaded/change",{models:i}),Bvt=()=>{const{t:i}=q(),e=Ovt();return Avt({mutationFn:Fvt,onSuccess:()=>{e.invalidateQueries({queryKey:[uMe]})},onError:()=>{rt.openToast({type:"basic",variant:"warning",content:i("move.workspace.toast.loadedSyncFailed"),position:"top-right"})}})},Vvt=5e3,Dfe="unknown",IJ=new Map,zvt=(i,e)=>(IJ.set(i,e),()=>{IJ.delete(i)}),Wvt=async(i=Vvt)=>({failed:(await Promise.all(Array.from(IJ.entries()).map(async([t,n])=>{let s;try{return await Promise.race([t().then(()=>!0),new Promise(r=>{s=setTimeout(()=>r(!1),i)})])?null:n??Dfe}catch{return n??Dfe}finally{clearTimeout(s)}}))).filter(t=>t!==null)}),{useCallback:Wp,useEffect:cv,useMemo:Tfe,useRef:MD,useState:R8}=await F("react"),Hvt=1e3,$vt=({robotModel:i,detailRobotModel:e,modelType:t,attachment:n,items:s,commit:o,replaceCurrent:r,resetHistory:a,setSelectedItemId:l,setHiddenItemIds:c,setStage:d,isActive:h=!0,isStoreHydrated:g=!1,lastChangeSourceRef:m,workspaceName:f,lastSyncedWorkspaceName:p,lastSyncedItems:_,onWorkspaceNameChange:b,onLastSyncedChange:v})=>{const{t:w}=q(),y=MD(new Map(_.map(Ie=>[Ie.id,Ie])));cv(()=>{y.current=new Map(_.map(Ie=>[Ie.id,Ie]))},[_]);const[S,C]=R8(0),[N,k]=R8(!1),[L,D]=R8(()=>new Set),T=Wp(Ie=>{const Te=typeof Ie=="function"?Ie(f):Ie;b(Te)},[b,f]),{mutateAsync:E,isPending:R}=Mvt(),{mutate:A}=Bvt(),M=Wp(Ie=>{T(Ie)},[T]),O=Wp(()=>{o(Array.from(y.current.values())),T(p),l(null)},[o,p,l,T]),B=Wp((Ie=[])=>{A(YO(Ie,[])),a([]),T(null),l(null),c(new Set),y.current=new Map,v(null,[]),C(Te=>Te+1),d("empty")},[a,A,l,c,d,T,v]),z=Wp(Ie=>{a([]),T(Ie),l(null),c(new Set),y.current=new Map,v(null,[]),C(Te=>Te+1),d("build")},[a,l,c,d,T,v]),Y=Wp((Ie,Te,lt=[])=>{const it=Ie.map(Ct=>pfe(Ct));a(it),A(YO(lt,it.map(Ct=>Ct.modelId).filter(Ct=>Ct!==void 0))),T(Te),l(null),c(new Set),y.current=new Map(it.map(Ct=>[Ct.id,Ct])),v(Te,it),C(Ct=>Ct+1),d("build")},[a,A,l,c,d,T,v]),$=Wp(async()=>{if(!f)throw new Error("Cannot save a workspace without a name");const Ie=f,Te=vpt(s,y.current,f,p),lt=await E({changes:Te,robotModel:i,detailRobotModel:e,modelType:t,attachment:n,workspaceName:Ie}),it=new Set;let Ct=s;for(const Mt of lt){if(Mt.status==="failed"){it.add(Mt.id);continue}Mt.status==="created"&&(Ct=Ct.map(Ht=>Ht.id===Mt.id?{...Ht,modelId:Mt.modelId}:Ht))}const ft=new Set(lt.filter(Mt=>Mt.status==="deleted").map(Mt=>Mt.id)),Xt=new Map(y.current);for(const[Mt,Ht]of y.current)Ht.modelId&&ft.has(Ht.modelId)&&Xt.delete(Mt);for(const Mt of lt){if(Mt.status==="failed"||Mt.status==="deleted")continue;const Ht=Ct.find(Mn=>Mn.id===Mt.id);Ht&&Xt.set(Ht.id,Ht)}if(y.current=Xt,v(Ie,Array.from(Xt.values())),D(it),T(Ie),Ct!==s&&r(Ct),C(Mt=>Mt+1),A(YO([],Ct.map(Mt=>Mt.modelId).filter(Mt=>Mt!==void 0))),it.size>0)throw new Error(`${it.size} item(s) failed to save`)},[s,f,p,i,e,t,n,E,r,A,v,T]),Z=Wp(async(Ie,Te=[])=>{const lt=s.map(Mt=>({kind:"create",item:Mt})),it=await E({changes:lt,robotModel:i,detailRobotModel:e,modelType:t,attachment:n,workspaceName:Ie}),Ct=new Set;let ft=s;for(const Mt of it){if(Mt.status==="failed"){Ct.add(Mt.id);continue}Mt.status==="created"&&(ft=ft.map(Ht=>Ht.id===Mt.id?{...Ht,modelId:Mt.modelId}:Ht))}const Xt=new Map;for(const Mt of it){if(Mt.status==="failed"||Mt.status==="deleted")continue;const Ht=ft.find(Mn=>Mn.id===Mt.id);Ht&&Xt.set(Ht.id,Ht)}if(y.current=Xt,v(Ie,Array.from(Xt.values())),D(Ct),T(Ie),ft!==s&&r(ft),C(Mt=>Mt+1),A(YO(Te,ft.map(Mt=>Mt.modelId).filter(Mt=>Mt!==void 0))),Ct.size>0)throw new Error(`${Ct.size} item(s) failed to save`)},[s,i,e,t,n,E,r,A,v,T]),K=Tfe(()=>ypt(s,y.current,f,p),[s,S,f,p]),V=MD(null),fe=Wp((Ie,Te)=>{V.current=Te,console.error("[useManiWorkspaceSync] Auto-save failed:",Ie),rt.openToast({type:"basic",variant:"danger",content:w("move.workspace.toast.saveFailed"),position:"top-right"})},[w]),{data:Q}=r6(i,e),re=Tfe(()=>!Q||!p?null:Q.filter(Ie=>Ie.modelType===t&&(n?Ie.attachment?.parentJointName===n.parentJointName:!0)&&Ie.workspace?.name===p),[Q,p,t,n]),ve=MD(!1);cv(()=>{if(!g||ve.current)return;if(!f||!K){ve.current=!0,k(!1);return}if(!Q){k(!0);return}if(ve.current=!0,k(!1),!p){rt.openToast({type:"basic",variant:"success",content:w("move.workspace.toast.recovered"),position:"top-right"});return}const Ie=re??[];if(bpt(_,Ie.map(pfe))){rt.openToast({type:"basic",variant:"success",content:w("move.workspace.toast.recovered"),position:"top-right"});return}const Te=s.map(lt=>lt.modelId).filter(lt=>lt!==void 0);if(Ie.length===0){B(Te),rt.openToast({type:"basic",variant:"warning",content:w("move.workspace.toast.recoveryRemoved"),position:"top-right"});return}Y(Ie,p,Te),rt.openToast({type:"basic",variant:"warning",content:w("move.workspace.toast.recoveryDiscarded"),position:"top-right"})},[g,f,K,Q,p,_,re,s,B,Y,w]),cv(()=>{if(N||!K||R||m?.current==="navigation"||V.current===s)return;const Ie=setTimeout(()=>{$().catch(Te=>fe(Te,s))},Hvt);return()=>clearTimeout(Ie)},[N,K,s,f,R,$,m,fe]);const _e=MD(h);cv(()=>{const Ie=_e.current;_e.current=h,!(!Ie||h)&&(N||!K||R||$().catch(Te=>fe(Te,s)))},[h,N,K,R,s,$,fe]),cv(()=>{const Ie=()=>{document.visibilityState==="hidden"&&(N||!K||R||$().catch(Te=>fe(Te,s)))};return document.addEventListener("visibilitychange",Ie),()=>document.removeEventListener("visibilitychange",Ie)},[N,K,R,s,$,fe]);const Le=MD(R);return cv(()=>{Le.current=R},[R]),cv(()=>{const Ie=Te=>{Le.current&&(Te.preventDefault(),Te.returnValue="")};return window.addEventListener("beforeunload",Ie),()=>window.removeEventListener("beforeunload",Ie)},[]),cv(()=>zvt(async()=>{if(!N&&!(!K||R))try{await $()}catch(Ie){throw V.current=s,Ie}},f??void 0),[N,K,R,s,$,f]),{workspaceName:f,isRecoveryPending:N,renameWorkspace:M,hasUnsavedChanges:K,failedItemIds:L,isSaving:R,save:$,saveAs:Z,resetToSaved:O,closeWorkspace:B,createNew:z,loadFromModels:Y}},Uvt=i=>{let e=!1;const t=i?.debounceMs??0;let n=null,s=null,o=null;const r=(d,h)=>{try{window.localStorage.setItem(d,h)}catch(g){i?.onError?.(g)}},a=()=>{if(o&&(clearTimeout(o),o=null),n!==null&&s!==null){const d=n,h=s;n=null,s=null,r(d,h)}};return typeof window<"u"&&window.addEventListener("beforeunload",()=>{a()}),{storage:{getItem:d=>n===d&&s!==null?s:window.localStorage.getItem(d),setItem:(d,h)=>{if(e){if(t<=0){r(d,h);return}n=d,s=h,o&&clearTimeout(o),o=setTimeout(()=>{o=null,a()},t)}},removeItem:d=>{o&&(clearTimeout(o),o=null),n===d&&(n=null,s=null),window.localStorage.removeItem(d)}},isHydrated:()=>e,flush:a,createRehydrateStorageHandler:()=>(e=!1,(d,h)=>{if(h){i?.name&&console.warn(`[${i.name}] rehydrate error`,h),i?.onError?.(h);return}e=!0,i?.name,i?.onHydrated?.()})}},{useEffect:jvt,useState:Gvt}=await F("react"),UB={stage:"empty",workspaceName:null,lastSyncedWorkspaceName:null,items:[],lastSyncedItems:[],historyStack:[[]],historyIndex:0,selectedItemId:null,hiddenItemIds:[]},qvt=i=>({stage:i.stage,workspaceName:i.workspaceName,lastSyncedWorkspaceName:i.lastSyncedWorkspaceName,items:i.items,lastSyncedItems:i.lastSyncedItems,hiddenItemIds:i.hiddenItemIds}),Kvt=i=>({...UB,...i,historyStack:[i.items],historyIndex:0,selectedItemId:null}),Efe=Uvt({name:"workspace-store",debounceMs:100}),Jvt=gse()(dEe(fse((i,e)=>({tabStates:{},getTabState:t=>e().tabStates[t]??{...UB},setTabState:(t,n)=>{i(s=>{const o=s.tabStates[t]??{...UB},r=typeof n=="function"?n(o):n;return{tabStates:{...s.tabStates,[t]:{...o,...r}}}})},resetTabState:t=>{i(n=>{const s={...n.tabStates};return delete s[t],{tabStates:s}})},clearAllTabs:()=>{i({tabStates:{}})}}),{name:"workspace-store",storage:mse(()=>Efe.storage),partialize:i=>({tabStates:Object.fromEntries(Object.entries(i.tabStates).map(([e,t])=>[e,qvt(t)]))}),merge:(i,e)=>{const t=i?.tabStates??{},n={};for(const[s,o]of Object.entries(t))lpt(o)&&(n[s]=Kvt(o));return{...e,tabStates:{...e.tabStates,...n}}},onRehydrateStorage:Efe.createRehydrateStorageHandler}),{name:"workspace-store",store:"workspace-store",enabled:!1})),qN=Jvt,Yvt=()=>{const[i,e]=Gvt(()=>qN.persist.hasHydrated());return jvt(()=>(e(qN.persist.hasHydrated()),qN.persist.onFinishHydration(()=>e(!0))),[]),i},{useCallback:_a,useMemo:Pfe,useRef:Xvt}=await F("react"),Qvt=({robotModel:i,detailRobotModel:e,modelType:t,mountJointName:n,isActive:s=!0})=>{const o=hpt(t,n),r=`${i}:${o}`,a=qN(Re=>Re.tabStates[r]??UB),l=qN(Re=>Re.setTabState),c=qN(Re=>Re.resetTabState),d=Yvt(),h=a.stage,g=_a(Re=>{l(r,We=>({stage:typeof Re=="function"?Re(We.stage):Re}))},[l,r]),m=a.selectedItemId,f=_a(Re=>{l(r,We=>({selectedItemId:typeof Re=="function"?Re(We.selectedItemId):Re}))},[l,r]),p=Pfe(()=>new Set(a.hiddenItemIds),[a.hiddenItemIds]),_=_a(Re=>{l(r,We=>{const ct=new Set(We.hiddenItemIds),gn=typeof Re=="function"?Re(ct):Re;return{hiddenItemIds:Array.from(gn)}})},[l,r]),b=Pfe(()=>t==="tool"&&n?{parentJointName:n}:null,[t,n]),v=Xvt("edit"),w=_a((Re,We,ct)=>{v.current="edit",l(r,{items:Re,historyStack:We,historyIndex:ct})},[l,r]),y=_a(Re=>{l(r,{items:Re,historyStack:[Re],historyIndex:0})},[l,r]),S=_a((Re,We)=>{v.current="navigation",l(r,{items:Re,historyIndex:We})},[l,r]),C=_a((Re,We)=>{v.current="navigation",l(r,{items:Re,historyIndex:We})},[l,r]),{items:N,canUndo:k,canRedo:L,commit:D,replaceCurrent:T,resetHistory:E,undo:R,redo:A}=bvt(a.items,{items:a.items,historyStack:a.historyStack,historyIndex:a.historyIndex,onCommit:w,onReset:y,onUndo:S,onRedo:C}),M=N.filter(Re=>Re.kind==="shape").length,O=gpt(t)&&M>=spt,B=N.some(Re=>Re.kind==="custom"),{assets:z,loadingItemIds:Y,loadFailedItemIds:$,loadTimeoutEvent:Z,assetLoadedEvent:K}=wvt({items:N,tabKind:o,mountJointName:n,hiddenItemIds:p}),V=_a(Re=>{l(r,{workspaceName:Re})},[l,r]),fe=_a((Re,We)=>{l(r,{lastSyncedWorkspaceName:Re,lastSyncedItems:We})},[l,r]),{workspaceName:Q,renameWorkspace:re,hasUnsavedChanges:ve,failedItemIds:_e,isSaving:Le,save:Ie,saveAs:Te,resetToSaved:lt,closeWorkspace:it,createNew:Ct,loadFromModels:ft}=$vt({robotModel:i,detailRobotModel:e,modelType:t,attachment:b,items:N,commit:D,replaceCurrent:T,resetHistory:E,setSelectedItemId:f,setHiddenItemIds:_,setStage:g,isActive:s,isStoreHydrated:d,lastChangeSourceRef:v,workspaceName:a.workspaceName,lastSyncedWorkspaceName:a.lastSyncedWorkspaceName,lastSyncedItems:a.lastSyncedItems,onWorkspaceNameChange:V,onLastSyncedChange:fe}),Xt=_a(Re=>{it(Re),c(r)},[it,c,r]),Mt=_a((Re,We)=>{if(O)return;const ct=roe.find(Xn=>Xn.type===Re);if(!ct)return;const gn=N.filter(Xn=>Xn.kind==="shape"&&Xn.shapeType===Re).length+1,Ln=We??mpt(N,t==="base"?cpt:{x:0,y:0}),yi=t==="base"?ct.dimensions.z/2:0,oi={id:loe(),name:`${Re}_${gn}`,kind:"shape",shapeType:Re,position:{x:Ln.x,y:Ln.y,z:We?.z??yi},rotation:{...aoe},scale:{...uR}};return D([...N,oi]),f(oi.id),oi.id},[N,O,t,D,f]),Ht=_a(Re=>{const We=wpt(Re);return D([...N.filter(ct=>ct.kind!=="custom"),We]),f(We.id),We.id},[N,D,f]),Mn=_a(Re=>{f(Re)},[f]),Cs=_a(Re=>{const We=!p.has(Re);_(ct=>{const gn=new Set(ct);return We?gn.add(Re):gn.delete(Re),gn}),We&&f(ct=>ct===Re?null:ct)},[p,_,f]),or=_a((Re,We)=>{D(N.map(ct=>ct.id===Re?{...ct,name:We}:ct),`rename:${Re}`)},[N,D]),ge=_a((Re,We,ct)=>{D(N.map(gn=>gn.id===Re?YRe(gn,We):gn),ct)},[N,D]),Ue=_a((Re,We,ct)=>{D(N.map(gn=>gn.id===Re&&gn.kind==="custom"?{...gn,fileName:We,name:ct}:gn))},[N,D]),Ee=_a(Re=>{D(N.filter(We=>We.id!==Re)),f(We=>We===Re?null:We)},[N,D,f]),Ne=_a(Re=>{const We=new Set(Re);D(N.filter(ct=>!We.has(ct.id))),f(ct=>ct!==null&&We.has(ct)?null:ct)},[N,D,f]),le=_a(Re=>{const We=new Set(Re);_(ct=>{const gn=new Set(ct);for(const $n of We)gn.add($n);return gn}),f(ct=>ct!==null&&We.has(ct)?null:ct)},[_,f]),Pe=_a(()=>{D([]),f(null),_(new Set)},[D,_,f]);return{stage:h,createNew:Ct,loadFromModels:ft,closeWorkspace:Xt,workspaceName:Q,renameWorkspace:re,hasUnsavedChanges:ve,isSaving:Le,save:Ie,saveAs:Te,canUndo:k,canRedo:L,undo:R,redo:A,resetToSaved:lt,items:N,selectedItemId:m,selectItem:Mn,loadingItemIds:Y,loadFailedItemIds:$,failedItemIds:_e,hiddenItemIds:p,toggleItemVisibility:Cs,addShape:Mt,addCustomFile:Ht,hasCustomFile:B,isLimitReached:O,renameItem:or,removeItem:Ee,removeItems:Ne,hideItems:le,clearItems:Pe,updateItemTransform:ge,applyCustomFileRename:Ue,assets:z,loadTimeoutEvent:Z,assetLoadedEvent:K}},{useRef:Zvt}=await F("react"),{useMutation:eyt}=await F("@tanstack/react-query"),Rfe=i=>{if(!(i instanceof Error))return"unknown";const e=i;return i.name==="AbortError"||i.name==="CanceledError"||i.message.includes("aborted")||e.code==="ERR_CANCELED"?"abort":"unknown"},tyt=i=>({abort:i("move.modal.workspace.file.upload.abort"),unknown:i("move.modal.workspace.file.upload.unknown")}),nyt=async({file:i,fileName:e},t)=>{const n=new FormData;return n.append("file",i),e&&n.append("fileName",e),Ut.post("/file/upload/model",n,{headers:{"Content-Type":"multipart/form-data"},signal:t})},iyt=()=>{const{t:i}=q(),e=Zvt(null),t=tyt(i);return{...eyt({mutationFn:async s=>{e.current=new AbortController;try{return await nyt(s,e.current.signal)}catch(o){if(Rfe(o)==="abort")return null;throw o}},onError:s=>{const o=t[Rfe(s)];rt.openToast({type:"basic",variant:"warning",content:o,position:"top-right"})}}),abort:()=>{e.current?.abort(),rt.openToast({type:"basic",variant:"warning",content:t.abort,position:"top-right"})}}},{useMutation:tVn}=await F("@tanstack/react-query"),syt=({fileId:i,...e})=>Ut.patch(`/file/${i}`,e),{useMutation:oyt,useQueryClient:ryt}=await F("@tanstack/react-query"),ayt=async i=>{if(!i.fileId)throw new Error("renameAssetModel requires fileId to rename the file.");const e=await syt({fileId:i.fileId,fileName:i.fileName});try{await doe({modelId:i.modelId,name:i.fileName})}catch(t){console.warn(`[useRenameAssetModel] failed to sync model name after file rename: modelId=${i.modelId}`,t)}return e},lyt=()=>{const{t:i}=q(),e=ryt();return oyt({mutationFn:ayt,onSuccess:(t,n)=>{const s=i1(n.robotModel,n.detailRobotModel);e.setQueryData(s,o=>o?o.map(r=>r.modelId===n.modelId?{...r,fileInfo:r.fileInfo?{...r.fileInfo,fileName:n.fileName}:r.fileInfo}:r):[]),rt.openToast({type:"basic",variant:"success",content:i("move.workspace.toast.renameSuccess"),position:"top-right"})},onError:()=>{rt.openToast({type:"basic",variant:"warning",content:i("move.workspace.toast.renameFailed"),position:"top-right"})}})},{useEffect:Mfe,useRef:cyt}=await F("react"),dyt=({selectedItemId:i,gizmoSelectedAssetIds:e,selectionMode:t,tabKind:n,onRequestSceneAssetSelect:s,selectItem:o})=>{const r=cyt(i);Mfe(()=>{t||i!==r.current&&(r.current=i,s?.(i?`${n}:${i}`:null))},[i,n,s,t]),Mfe(()=>{if(t)return;const a=e[0]??null;if(a===null){r.current!==null&&(r.current=null,o(null));return}if(!a.startsWith(`${n}:`))return;const l=a.slice(n.length+1);l!==r.current&&(r.current=l,o(l))},[e,n,o,t])},Afe=[".stl",".stp",".step",".obj",".glb",".gltf",".dae"],uyt=50*1024*1024,tF=10,hyt=/[\\/:*?"<>|#%]/,c4=hyt,jB=i=>i.trim(),gMe=(i,e,t)=>{const n=jB(e);return n?i.some(s=>s.modelId!==t&&jB(s.fileInfo.fileName)===n):!1},gyt=i=>i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`,myt=i=>{let e=0;return i.traverse(t=>{if(t instanceof os){const n=t.geometry;n.index?e+=n.index.count/3:n.attributes.position&&(e+=n.attributes.position.count/3)}}),Math.round(e)},fyt=i=>i>=1e6?`${(i/1e6).toFixed(2)}M`:i>=1e3?`${(i/1e3).toFixed(1)}K`:`${i}`,pyt=(i,e)=>{const t=new Set(i);return t.has(e)?t.delete(e):t.add(e),t},mMe=({items:i,getId:e,targetId:t,selectedIds:n,anchorId:s,selectionMode:o,isRangeSelect:r,isToggleSelect:a=!1})=>{if(r&&s){const l=i.findIndex(d=>e(d)===s),c=i.findIndex(d=>e(d)===t);if(l!==-1&&c!==-1){const d=Math.min(l,c),h=Math.max(l,c);return{selectedIds:new Set(i.slice(d,h+1).map(e)),anchorId:s}}}return a||o?{selectedIds:pyt(n,t),anchorId:t}:{selectedIds:new Set([t]),anchorId:t}},{useEffect:_yt,useMemo:Ofe,useRef:byt,useState:M8}=await F("react"),fMe=({items:i,getId:e,getSearchText:t,open:n})=>{const[s,o]=M8(""),[r,a]=M8(()=>new Set),[l,c]=M8(!1),d=byt(null);_yt(()=>{n&&(o(""),a(new Set),c(!1),d.current=null)},[n]);const h=Ofe(()=>{const w=s.trim().toLowerCase();return w?i.filter(y=>t(y).toLowerCase().includes(w)):i},[i,s,t]),g=()=>{c(w=>!w),a(new Set),d.current=null},m=()=>{a(new Set),d.current=null},f=(w,y)=>{a(S=>{const C=mMe({items:h,getId:e,targetId:e(w),selectedIds:S,anchorId:d.current,selectionMode:l,isRangeSelect:y.shiftKey,isToggleSelect:y.ctrlKey||y.metaKey});return d.current=C.anchorId,C.selectedIds})},p=Ofe(()=>h.filter(w=>r.has(e(w))),[h,r,e]),_=r.size===1?p[0]??null:null,b=l||r.size>1;return{items:h,searchQuery:s,setSearchQuery:o,selectionMode:l,selectedIds:r,setSelectedIds:a,selectedItems:p,soleSelected:_,isMultiSelectActive:b,toggleSelectionMode:g,exitMultiSelect:l?g:m,clearSelection:m,onItemClick:f}},pMe=({open:i,onOpenChange:e,title:t,className:n,children:s,footerHint:o,isMultiSelectActive:r,selectedCount:a,isBusy:l=!1,deleteSelectedLabel:c,confirmDisabled:d,onDeleteSelected:h,onExitMultiSelect:g,onCancel:m,onConfirm:f})=>{const{t:p}=q();return u(td,{open:i,onOpenChange:e,header:{title:t},className:P("flex max-h-140! max-w-none! flex-col gap-0 border-none p-0",n),footer:x(H,{className:"h-8 w-full gap-1",alignItems:"center",justifyContent:"space-between",children:[x(H,{alignItems:"center",className:"gap-1",children:[u(LLe,{className:"text-fg-subtler size-3.5 shrink-0"}),u("span",{className:"typo-compact-2xs-normal text-fg-subtle",children:o})]}),x(H,{alignItems:"center",className:"gap-1",children:[r?x(rn,{children:[u(se,{variant:"danger",disabled:a===0||l,onClick:h,children:c}),u(se,{variant:"outlined",onClick:g,children:p("move.modal.workspace.button.selectExit")})]}):u(se,{variant:"outlined",onClick:m,children:p("common.button.cancel")}),u(se,{variant:"brand",disabled:d,onClick:f,children:p("move.modal.workspace.button.confirm")})]})]}),children:s})},_Me=({searchQuery:i,onSearchQueryChange:e,searchPlaceholder:t,selectionMode:n,onToggleSelectionMode:s,primaryActionLabel:o,onPrimaryAction:r,isUploading:a=!1,onCancelUpload:l})=>{const{t:c}=q();return x(H,{className:"items-center gap-3",children:[u(et,{className:"h-8 flex-1",type:"search",placeholder:t??c("move.modal.workspace.file.search.placeholder"),value:i,onChange:d=>e(d.target.value)}),a?x(H,{alignItems:"center",className:"gap-2",children:[u(aw,{size:"1rem",className:"text-fg-warning"}),u("span",{className:"typo-compact-xs-semibold text-fg-warning animate-pulse",children:c("move.modal.workspace.file.slotLoading")}),u(se,{variant:"danger",size:"xs",onClick:l,children:c("move.modal.workspace.file.button.cancelUpload")})]}):x(rn,{children:[n!==void 0&&s&&u(se,{variant:n?"outlined":"transparent",size:"xs",onClick:s,children:c(n?"move.modal.workspace.button.selectExit":"move.modal.workspace.button.select")}),o&&r&&u(se,{variant:"transparent",size:"xs",leadingIcon:u(Mm,{}),onClick:r,children:o})]})]})},bMe=({className:i,isLoading:e,isEmpty:t,emptyMessage:n,children:s})=>u(Km,{className:P("h-80 overflow-y-auto",i),children:e?u(U,{alignItems:"center",justifyContent:"center",className:"h-24",children:u(aw,{size:"1.25rem",className:"text-fg-subtle"})}):t?u(U,{alignItems:"center",justifyContent:"center",className:"h-24",children:u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:n})}):u("div",{className:"grid grid-cols-3 gap-2 p-1",children:s})}),vMe=({className:i,isSelected:e,selectionMode:t,isBusy:n=!1,name:s,metaText:o,onClick:r,onDoubleClick:a,onDelete:l,deleteAriaLabel:c})=>x(U,{className:P("bg-fill-inverse-subtle relative z-1 cursor-pointer rounded-md p-2.5 outline-2 outline-transparent",{"outline-border-navy-stronger":e},i),onClick:r,onDoubleClick:a,children:[x(U,{className:"w-full gap-1",children:[x(H,{alignItems:"center",className:"min-w-0 gap-0.5 pr-10",children:[t&&u(ia,{size:"xs",readOnly:!0,value:e,className:"-ml-1 shrink-0"}),u("span",{className:"typo-compact-xs-semibold text-fg-default min-w-0 flex-1 truncate",children:s})]}),u("span",{className:"typo-compact-2xs-normal text-fg-subtle w-full overflow-hidden pr-6 text-ellipsis whitespace-nowrap",children:o})]}),!t&&u("div",{className:P("absolute top-1 right-1 flex items-center gap-0.5",n&&"pointer-events-none opacity-50"),onClick:d=>d.stopPropagation(),children:u(Yt,{variant:"transparent",size:"3xs",icon:u(Nb,{className:"size-3.5"}),onClick:l,"aria-label":c})})]}),{useMemo:Ffe,useState:vyt}=await F("react"),{useQueryClient:yyt}=await F("@tanstack/react-query"),wyt=({className:i,open:e,onOpenChange:t,robotModel:n,detailRobotModel:s,modelType:o,attachment:r,resolve:a,close:l,onGroupsDeleted:c})=>{const{t:d,currentLanguage:h}=q(),{confirmDialog:g}=jn(),m=yyt(),f=i1(n,s),{data:p,isLoading:_}=r6(n,s),{mutateAsync:b}=uoe(),[v,w]=vyt(!1),y=Ffe(()=>(p??[]).filter(L=>L.modelType===o&&(r?L.attachment?.parentJointName===r.parentJointName:!0)),[p,o,r]),S=Ffe(()=>[...opt(y)].sort((D,T)=>new Date(x8(T.models)).getTime()-new Date(x8(D.models)).getTime()),[y]),C=fMe({items:S,getId:L=>L.name,getSearchText:L=>L.name,open:e}),N=async L=>{let D=0;for(const T of L)for(const E of T.models)try{await b(E.modelId)}catch(R){console.error("Failed to delete model:",R),D+=1}await m.invalidateQueries({queryKey:f}),C.setSelectedIds(T=>{const E=new Set(T);return L.forEach(R=>E.delete(R.name)),E}),c?.(L.map(T=>T.name)),D>0&&rt.openToast({type:"basic",variant:"warning",content:d("move.modal.workspace.toast.deletePartialFailure",{failed:D,total:L.reduce((T,E)=>T+E.models.length,0)}),position:"top-right"})},k=async L=>{if(L.length===0)return;const D=L.length>1;if(await g({title:d("move.modal.workspace.confirmDelete.title"),content:D?d("move.modal.workspace.confirmDelete.multiContent",{count:L.length}):d("move.modal.workspace.confirmDelete.content",{name:L[0].name}),buttonText:{yes:d("move.modal.workspace.button.delete"),no:d("common.button.cancel")}})){w(!0);try{await N(L)}finally{w(!1)}}};return u(pMe,{open:e,onOpenChange:t,className:P("w-137.5!",i),title:d("move.modal.workspace.title"),footerHint:d("move.modal.workspace.footer.hint"),isMultiSelectActive:C.isMultiSelectActive,selectedCount:C.selectedIds.size,isBusy:v,deleteSelectedLabel:d("move.modal.workspace.button.deleteSelected",{count:C.selectedIds.size}),confirmDisabled:C.selectedIds.size!==1,onDeleteSelected:()=>void k(C.selectedItems),onExitMultiSelect:C.exitMultiSelect,onCancel:l,onConfirm:()=>{C.soleSelected&&a?.(C.soleSelected)},children:x(U,{className:"gap-3 px-4 py-3",children:[u(_Me,{searchQuery:C.searchQuery,onSearchQueryChange:C.setSearchQuery,searchPlaceholder:d("move.modal.workspace.search.placeholder"),selectionMode:C.selectionMode,onToggleSelectionMode:C.toggleSelectionMode}),u(bMe,{isLoading:_,isEmpty:C.items.length===0,emptyMessage:C.searchQuery.trim()?d("move.modal.workspace.empty.noFound"):d("move.modal.workspace.empty.noAvailable"),children:C.items.map(L=>{const D=L.models.filter(E=>E.shapeType!==null).length,T=L.models.length-D;return u(vMe,{isSelected:C.selectedIds.has(L.name),selectionMode:C.isMultiSelectActive,name:L.name,metaText:`${d("move.modal.workspace.card.itemCount",{shapeCount:D,fileCount:T})} · ${ZLe(x8(L.models),h)}`,onClick:E=>C.onItemClick(L,E),onDoubleClick:()=>{C.isMultiSelectActive||a?.(L)},onDelete:()=>void k([L]),deleteAriaLabel:d("move.modal.workspace.card.deleteLabel")},L.name)})})]})})},{useQueryClient:Cyt}=await F("@tanstack/react-query"),Syt=({filteredModels:i,selectedModelIds:e,setSelectedModelIds:t,modelsQueryKey:n,deleteOne:s,wrapExecution:o=a=>a(),onDeleted:r})=>{const{t:a}=q(),{confirmDialog:l}=jn(),c=Cyt();return async(h,g)=>{h.stopPropagation();const m=e.has(g.modelId)&&e.size>1,f=m?i.filter(_=>e.has(_.modelId)):[g];await l({title:a("move.modal.workspace.file.deleteTitle"),content:m?a("move.modal.workspace.file.confirmDelete.multiContent",{count:f.length}):a("move.modal.workspace.file.confirmDelete.content",{name:g.fileInfo.fileName}),buttonText:{yes:a("move.modal.workspace.button.delete"),no:a("common.button.cancel")}})&&(await o(async()=>{for(const _ of f)await s(_)}),c.setQueryData(n,_=>_?_.filter(b=>!f.some(v=>v.modelId===b.modelId)):[]),t(_=>{const b=new Set(_);return f.forEach(v=>b.delete(v.modelId)),b}),r?.(f))}},xyt="/file/list",Nyt=async i=>(await Ut.get(xyt,{params:{fileName:i,fileType:"3d_model",limit:50}})).files.find(n=>n.fileName.trim()===i.trim())?.fileId??null,{useRef:A8,useState:Bfe,useEffect:Vfe}=await F("react"),Iyt=({model:i,isMultiSelected:e,className:t})=>{const{t:n}=q(),s=A8(null),o=A8(null),r=A8(new Ose),[a,l]=Bfe("idle"),[c,d]=Bfe(null);return Vfe(()=>{const h=s.current;if(!h)return;const g=r.current,m=new zlt(h,{disposeObject:f=>g.disposeObject(f)});return o.current=m,()=>{m.dispose(),o.current=null}},[]),Vfe(()=>{const h=o.current;if(!h)return;if(h.setObject(null),!i){l("idle"),d(null);return}const g=i.fileInfo.fileName;l("loading"),d(null);const m=new AbortController,f=r.current,p=v=>{if(m.signal.aborted){f.disposeObject(v);return}h.setObject(v,i.pose),d(myt(v)),l("success")},_=v=>{v instanceof DOMException&&v.name==="AbortError"||m.signal.aborted||l("error")},b=`${Uie}/common/files/models/${encodeURIComponent(g)}`;return f.loadObject(b,g,m.signal,{detectSurfaceFeatures:!1}).then(p).catch(_),()=>{m.abort()}},[i]),x(U,{className:P("bg-bg-alt-1 relative overflow-hidden",t),children:[u("div",{ref:s,className:"h-full w-full"}),a==="idle"&&u(U,{className:"absolute inset-0 items-center justify-center px-4 text-center",children:u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:n(e?"move.modal.workspace.file.preview.multiSelectUnsupported":"move.modal.workspace.file.preview.selectPrompt")})}),a==="loading"&&u(U,{className:"absolute inset-0 items-center justify-center",children:u(aw,{size:"1.5rem",className:"text-fg-subtle"})}),a==="error"&&u(U,{className:"absolute inset-0 items-center justify-center px-4 text-center",children:u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:n("move.modal.workspace.file.preview.error")})}),i&&a!=="idle"&&x("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-linear-to-t from-black/70 to-transparent px-4 pt-10 pb-3",children:[u("span",{className:"typo-compact-sm-semibold block truncate text-white",children:i.fileInfo.fileName}),x("span",{className:"typo-compact-2xs-normal mt-0.5 flex items-center gap-1 text-white/70",children:[u("span",{"aria-hidden":"true",children:"△"}),c!==null?x("span",{children:[fyt(c)," ",n("move.modal.workspace.file.preview.triangles")]}):u("span",{"aria-hidden":"true",children:"-"})]})]})]})},{useMemo:O8}=await F("react"),{useQueryClient:kyt}=await F("@tanstack/react-query"),Lyt=({className:i,open:e,onOpenChange:t,robotModel:n,detailRobotModel:s,modelType:o,attachment:r,resolve:a,close:l,uploadAssetFiles:c,isUploading:d,onCancelUpload:h,onModelsDeleted:g})=>{const{t:m,currentLanguage:f}=q(),p=kyt(),{isDragging:_,dropProps:b,inputProps:v,open:w}=eDe({onFiles:z=>B(z),accept:Afe,onRejected:z=>z.forEach(Y=>M(Y,"move.modal.workspace.file.upload.invalidFormat"))}),y=i1(n,s),{data:S,isLoading:C}=r6(n,s),{mutateAsync:N,isPending:k}=uoe(),{mutateAsync:L}=Ivt(),D=O8(()=>S??[],[S]),T=O8(()=>D.filter(z=>z.modelType===o&&!z.workspace&&z.shapeType===null&&(r?z.attachment?.parentJointName===r.parentJointName:!0)).sort((z,Y)=>z.createdAt.localeCompare(Y.createdAt)),[D,o,r]),E=fMe({items:T,getId:z=>z.modelId,getSearchText:z=>z.fileInfo.fileName,open:e}),R=O8(()=>{if(E.selectedIds.size!==1)return null;const[z]=E.selectedIds;return T.find(Y=>Y.modelId===z)??null},[E.selectedIds,T]),A=Syt({filteredModels:E.items,selectedModelIds:E.selectedIds,setSelectedModelIds:E.setSelectedIds,modelsQueryKey:y,deleteOne:async z=>{try{await N(z.modelId)}catch(Y){console.error("Failed to delete model:",Y)}},onDeleted:z=>g?.(z.map(Y=>({modelId:Y.modelId,fileId:Y.fileId})))}),M=(z,Y)=>{rt.openToast({type:"basic",variant:"warning",title:z.name,content:m(Y),position:"top-right"})},O=async(z,Y)=>{try{const $=await L({robotModel:n,detailRobotModel:s,fileId:Y,modelType:o,attachment:r??null});await p.invalidateQueries({queryKey:y}),E.setSelectedIds(new Set([$.modelId]))}catch($){console.error("Create model failed:",$),M(z,"move.modal.workspace.file.upload.createFailed")}},B=async z=>{const Y=z.slice(0,tF);z.length>tF&&rt.openToast({type:"basic",variant:"warning",content:m("move.modal.workspace.file.upload.maxFilesExceeded",{count:tF}),position:"top-right"});const $=new Set;for(const Z of Y){const K=jB(Z.name),V=`.${Z.name.split(".").pop()?.toLowerCase()??""}`;if(c4.test(Z.name)){M(Z,"move.workspace.toast.invalidCharacters");continue}if(!Afe.includes(V)){M(Z,"move.modal.workspace.file.upload.invalidFormat");continue}if(Z.size>uyt){M(Z,"move.modal.workspace.file.upload.tooLarge");continue}if($.has(K)){M(Z,"move.modal.workspace.file.upload.duplicateName");continue}if(gMe(T,Z.name)){M(Z,"move.modal.workspace.file.upload.duplicateName");continue}const fe=D.find(Q=>jB(Q.fileInfo?.fileName??"")===K)?.fileId??await Nyt(Z.name);if(fe){$.add(K),await O(Z,fe);continue}try{const Q=await c({file:Z,fileName:Z.name});if(!Q)continue;$.add(K),await O(Z,Q.fileId)}catch(Q){console.error("Upload failed:",Q)}}};return x(rn,{children:[u("input",{...v}),u(pMe,{open:e,onOpenChange:t,className:P("w-4xl!",i),title:m("move.modal.workspace.file.title"),footerHint:m("move.modal.workspace.file.upload.maxFilesExceeded",{count:tF}),isMultiSelectActive:E.isMultiSelectActive,selectedCount:E.selectedIds.size,isBusy:k,deleteSelectedLabel:m("move.modal.workspace.button.deleteSelected",{count:E.selectedIds.size}),confirmDisabled:E.selectedIds.size!==1,onDeleteSelected:z=>{E.selectedItems[0]&&A(z,E.selectedItems[0])},onExitMultiSelect:E.exitMultiSelect,onCancel:l,onConfirm:()=>{E.soleSelected&&a?.(E.soleSelected)},children:x(H,{className:"min-h-0 flex-1 items-stretch overflow-hidden",children:[x(U,{className:"bg-bg-overlay w-137.5 shrink-0 gap-3 px-4 py-3",children:[u(_Me,{searchQuery:E.searchQuery,onSearchQueryChange:E.setSearchQuery,selectionMode:E.selectionMode,onToggleSelectionMode:E.toggleSelectionMode,primaryActionLabel:m("move.modal.asset.button.add"),onPrimaryAction:w,isUploading:d,onCancelUpload:h}),x("div",{className:P("relative rounded-lg border-2 border-dashed transition-colors duration-200",_?"border-border-navy-stronger":"border-transparent"),...b,children:[_&&x("div",{className:"bg-fill-navy-subtlest/60 pointer-events-none absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-lg backdrop-blur-[2px]",children:[u(Ey,{className:"text-fg-navy size-8"}),u("span",{className:"typo-compact-xs-semibold text-fg-navy",children:m("move.modal.workspace.file.dropLabel")})]}),u(bMe,{isLoading:C,isEmpty:E.items.length===0,emptyMessage:E.searchQuery.trim()?m("move.modal.workspace.file.empty.noFound"):m("move.modal.workspace.file.empty.noAvailable"),children:E.items.map(z=>u(vMe,{isSelected:E.selectedIds.has(z.modelId),selectionMode:E.isMultiSelectActive,isBusy:k,name:z.fileInfo.fileName,metaText:`${gyt(z.fileInfo.fileSize)} · ${ZLe(z.fileInfo.createdAt,f)}`,onClick:Y=>E.onItemClick(z,Y),onDoubleClick:()=>{E.isMultiSelectActive||a?.(z)},onDelete:Y=>void A(Y,z),deleteAriaLabel:`${m("move.modal.workspace.file.deleteTitle")} ${z.fileInfo.fileName}`},z.modelId))})]})]}),u(Iyt,{model:R,isMultiSelected:E.selectedIds.size>1,className:"mr-4 min-w-0 flex-1"})]})})]})},{forwardRef:Dyt}=await F("react"),yMe=Dyt(function({value:e,onChange:t,onCommit:n,onCancel:s,ariaLabel:o,className:r},a){return u("input",{ref:a,type:"text",autoFocus:!0,value:e,onClick:l=>l.stopPropagation(),onDoubleClick:l=>l.stopPropagation(),onPointerDown:l=>l.stopPropagation(),onFocus:l=>l.currentTarget.select(),onChange:l=>t(l.target.value),onBlur:n,onKeyDown:l=>{l.stopPropagation(),l.key==="Enter"&&(l.preventDefault(),n()),l.key==="Escape"&&(l.preventDefault(),s())},"aria-label":o,className:P("text-fg-default bg-bg-default border-border-brand focus:border-border-brand focus:ring-fill-brand/25 selection:bg-fill-brand-subtle h-7 w-full min-w-0 rounded border selection:text-white focus:ring-2 focus:outline-hidden",r)})}),{useEffect:F8,useRef:nF,useState:B8}=await F("react"),Tyt=({workspaceName:i,hasUnsavedChanges:e,onRename:t,canUndo:n,canRedo:s,onUndo:o,onRedo:r,isSaving:a=!1,hasItems:l=!1,onDuplicate:c,onSaveAs:d,onCreateNew:h,onOpenPicker:g,onDelete:m,onClearAll:f,onReset:p})=>{const{t:_}=q(),[b,v]=B8(!1),w=nF(!1),[y,S]=B8(i??""),C=nF(null),[N,k]=B8("idle"),L=nF(!1),D=nF(null),T=c??d;F8(()=>{a?(D.current&&(clearTimeout(D.current),D.current=null),L.current=!0):L.current&&(L.current=!1,k("saved"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{k("idle"),D.current=null},1500))},[a]),F8(()=>()=>{D.current&&clearTimeout(D.current)},[]),F8(()=>{w.current=b,b&&(S(i??""),requestAnimationFrame(()=>C.current?.select()))},[b,i]);const E=()=>{const M=y.trim();if(w.current=!1,v(!1),!M){rt.openToast({type:"basic",variant:"warning",content:_("move.workspace.toast.renameInvalid"),position:"top-right"});return}M!==i&&t(M)},R=()=>{b||(S(i??""),w.current=!0,v(!0))},A=()=>{R()};return x(H,{alignItems:"center",className:"w-full shrink-0 gap-1 pb-2",children:[x("div",{className:P("flex h-9 min-w-0 flex-1 items-center gap-1.5 rounded px-2 transition-colors",!b&&"hover:bg-bg-alt-1 cursor-pointer select-none"),onDoubleClick:A,children:[u(tDe,{width:16,height:16,className:"text-fg-subtle pointer-events-none shrink-0"}),b?u(yMe,{ref:C,value:y,onChange:S,onCommit:E,onCancel:()=>{w.current=!1,v(!1)},ariaLabel:_("move.workspace.header.renameLabel"),className:"typo-compact-xs-semibold px-2"}):x(rn,{children:[u("span",{className:"typo-compact-xs-semibold text-fg-default pointer-events-none min-w-0 flex-1 truncate",children:i??_("move.workspace.jsonSlot.empty")}),e?x("span",{className:"text-fg-warning flex shrink-0 items-center gap-1 px-1 py-0.5",children:[u(ETe,{className:"size-3.5 shrink-0"}),u("span",{className:"typo-compact-sm-medium",children:_("move.workspace.header.unsaved")})]}):N==="saved"?x("span",{className:"text-fg-success pointer-events-none flex shrink-0 items-center gap-1 transition-opacity duration-200",children:[u(TTe,{className:"size-3.5 shrink-0"}),u("span",{className:"typo-compact-sm-medium",children:_("move.workspace.header.saved")})]}):null]})]}),x(H,{alignItems:"center",className:"shrink-0 gap-0.5",children:[u(Yt,{variant:"transparent",size:"sm",disabled:!n,onClick:o,icon:u(GDe,{className:"size-3.5"}),"aria-label":_("move.workspace.header.undo")}),u(Yt,{variant:"transparent",size:"sm",disabled:!s,onClick:r,icon:u(UDe,{className:"size-3.5"}),"aria-label":_("move.workspace.header.redo")}),x(iA,{children:[u(oA,{asChild:!0,children:u(Yt,{variant:"transparent",size:"sm",icon:u(Dje,{width:16,height:16,className:"text-fg-subtle"}),"aria-label":_("move.workspace.header.menu")})}),x(sA,{align:"end",className:"w-40",onCloseAutoFocus:M=>{w.current&&(M.preventDefault(),C.current?.select())},children:[u(hu,{className:"h-10",onClick:h,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.createNew")})}),u(hu,{className:"h-10",onClick:g,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.open")})}),u(hu,{className:"h-10",onSelect:R,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.rename")})}),T&&u(hu,{className:"h-10",onClick:T,disabled:a||!l,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.duplicate")})}),m&&u(hu,{className:"h-10",onClick:m,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.delete")})}),u(f9,{}),f&&u(hu,{className:"h-10",onClick:f,disabled:!l,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.clearAll")})}),u(hu,{className:"h-10",onClick:p,disabled:!e,children:u("span",{className:"typo-compact-xs-medium",children:_("move.workspace.header.reset")})})]})]})]})]})},{useEffect:zfe,useRef:iF,useState:Eyt}=await F("react"),Wfe=300,Pyt=50,V8=({label:i,labelColor:e,unit:t,value:n,step:s,min:o,max:r,disabled:a,precision:l=2,onChange:c})=>{const d=k=>{if(k===""||k==="-"||k.endsWith("."))return;const L=parseFloat(k);isNaN(L)||c(L)},h=k=>{const L=parseFloat(k);isNaN(L)||c(L)},g=iF(n);zfe(()=>{g.current=n},[n]);const m=iF(void 0),f=iF(void 0),p=iF(Wfe),[_,b]=Eyt(!1),v=()=>{window.clearTimeout(m.current),window.clearTimeout(f.current),p.current=Wfe},w=()=>{v(),b(!1)};zfe(()=>v,[]);const y=k=>{const L=k==="up"?s:-s;let D=Number((g.current+L).toFixed(l));o!==void 0&&(D=Math.max(o,D)),r!==void 0&&(D=Math.min(r,D)),g.current=D,c(D)},S=k=>{y(k),window.clearTimeout(f.current),f.current=window.setTimeout(()=>{S(k),p.current>Pyt&&(p.current-=p.current/6)},p.current)},C=k=>{if(a||k.key!=="ArrowUp"&&k.key!=="ArrowDown"||(k.preventDefault(),k.repeat))return;b(!0);const L=k.key==="ArrowUp"?"up":"down";y(L),m.current=window.setTimeout(()=>{S(L)},p.current)},N=k=>{k.key!=="ArrowUp"&&k.key!=="ArrowDown"||w()};return x(U,{className:P("AxisNumberInput","gap-1"),children:[x(H,{className:"typo-compact-xs-medium gap-1",children:[u("span",{className:P("text-fg-default",e),children:i.toUpperCase()}),u("span",{className:"text-fg-subtle",children:t?`(${t})`:""})]}),u("div",{onKeyDown:C,onKeyUp:N,onBlur:w,children:u(Vse,{value:String((n??0).toFixed(l)),step:s,digit:l,fixedDigit:l,enableArrowKeys:!1,enableWheel:!0,min:o!==void 0?String(o):void 0,max:r!==void 0?String(r):void 0,disabled:a,isDirect:!0,bypassFocusSync:_,notAllowedEmptyValue:!0,onFocus:k=>k.target.select(),handleChange:d,handleEnter:h})})]})},Ryt=({className:i,item:e,onChange:t})=>{const{t:n}=q(),s=e?.kind==="shape";if(!e)return x(U,{className:P("border-border-subtle w-full gap-2 border-t pt-3",i),children:[u(H,{alignItems:"center",className:"h-9 w-full px-1",children:u("span",{className:"typo-compact-xs-semibold text-fg-default",children:n("move.workspace.properties.title")})}),u("div",{className:"border-border-subtle flex h-24 items-center justify-center rounded-md border border-dashed",children:u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:n("move.workspace.properties.selectItem")})})]});const r=(e.kind==="shape"?roe.find(f=>f.type===e.shapeType):void 0)?.dimensions??l4,a=e.kind==="shape"?e.scale:uR,l=f=>a[f]*r[f],c=(f,p)=>t(e.id,{scale:{...a,[f]:p/r[f]}},`scale:${e.id}:${f}`),d=[{key:"x",label:"X",color:xi.x},{key:"y",label:"Y",color:xi.y},{key:"z",label:"Z",color:xi.z}],h=[{key:"rx",label:"RX",color:xi.rx},{key:"ry",label:"RY",color:xi.ry},{key:"rz",label:"RZ",color:xi.rz}],g=[{key:"x",label:"SX",color:xi.x},{key:"y",label:"SY",color:xi.y},{key:"z",label:"SZ",color:xi.z}],m=()=>{e&&t(e.id,{position:{...JRe},rotation:{...aoe},...s&&{scale:{...uR}}},`resetTransform:${e.id}`)};return x(U,{className:P("border-border-subtle w-full gap-2 border-t pt-3",i),children:[x(H,{alignItems:"center",justifyContent:"space-between",className:"h-9 w-full px-1",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:n("move.workspace.properties.title")}),u(Nie,{size:"xs",className:"text-fg-subtle hover:text-fg-default",onClick:m,children:n("move.workspace.properties.resetTransform")})]}),x("div",{className:"grid w-full grid-cols-2 gap-2",children:[x(U,{className:"min-w-0 gap-2",children:[u("div",{className:"typo-compact-2xs-medium text-fg-subtle mt-0.5 flex h-5 items-center px-1",children:n("move.workspace.properties.translate")}),d.map(({key:f,label:p,color:_})=>u(V8,{label:p,unit:dfe,labelColor:_,value:e.position[f],step:Xft,precision:Qft,onChange:b=>t(e.id,{position:{...e.position,[f]:b}},`position:${e.id}:${f}`)},f))]}),x(U,{className:"min-w-0 gap-2",children:[u("div",{className:"typo-compact-2xs-medium text-fg-subtle mt-0.5 flex h-5 items-center px-1",children:n("move.workspace.properties.rotate")}),h.map(({key:f,label:p,color:_})=>u(V8,{label:p,unit:Yft,labelColor:_,value:e.rotation[f],step:Zft,precision:ept,onChange:b=>t(e.id,{rotation:{...e.rotation,[f]:b}},`rotation:${e.id}:${f}`)},f))]})]}),u("div",{className:P("grid transition-[grid-template-rows] duration-200 ease-out",s?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:u("div",{className:"grid min-h-0 w-full grid-cols-2 gap-2 overflow-hidden",children:x(U,{className:"min-w-0 gap-2",children:[u("div",{className:"typo-compact-2xs-medium text-fg-subtle mt-1 flex h-5 items-center px-1",children:n("move.workspace.properties.scale")}),g.map(({key:f,label:p,color:_})=>u(V8,{label:p,unit:dfe,labelColor:_,value:l(f),step:tpt,precision:npt,onChange:b=>c(f,b)},f))]})})})]})},{useState:Hfe,useEffect:z8,useRef:sF}=await F("react"),Myt=i=>{if(i.kind==="custom")return u(Ey,{width:16,height:16});switch(i.shapeType){case"cylinder":return u(QLe,{className:"size-4"});case"sphere":return u(XLe,{className:"size-4"});case"box":return u(YLe,{className:"size-4"});default:return u(b9,{className:"size-4"})}},Ayt=i=>{if(i.kind!=="custom")return null;const e=i.fileName.match(/\.[^.]+$/)?.[0];return e?i.name.toLowerCase().endsWith(e.toLowerCase())?null:e:null},Oyt=({items:i,isActive:e=!0,addPanel:t,isAddPanelOpen:n=!1,onToggleAddPanel:s,selectedId:o,onSelect:r,onDeselect:a,selectionMode:l,checkedIds:c,onSelectionModeChange:d,onCheckedIdsChange:h,loadingIds:g,hiddenIds:m,failedIds:f,loadFailedIds:p,onToggleVisibility:_,onRename:b,onRenameCommit:v,onDelete:w,onBulkDelete:y,onBulkHide:S})=>{const{t:C}=q(),[N,k]=Hfe(null),L=sF(null),[D,T]=Hfe(""),E=sF(null),R=sF(null),A=()=>{L.current&&K(L.current),d(!0),R.current=null},M=()=>{d(!1),R.current=null},O=Q=>{h(re=>{const ve=new Set(re);return ve.has(Q)?ve.delete(Q):ve.add(Q),ve}),R.current=Q},B=(Q,re,ve)=>{const _e=ve.shiftKey;h(Le=>{const Ie=mMe({items:re,getId:Te=>Te.id,targetId:Q.id,selectedIds:Le,anchorId:R.current,selectionMode:!0,isRangeSelect:_e});return R.current=Ie.anchorId,Ie.selectedIds})},z=()=>{y?.(Array.from(c)),M()},Y=()=>{S?.(Array.from(c)),M()},$=sF(null);z8(()=>{if(!o||!e)return;let Q=0,re=30;const ve=()=>{const _e=$.current?.querySelector(`[data-item-id="${o}"]`);if(_e?.scrollIntoView){_e.scrollIntoView({behavior:"smooth",block:"nearest"});return}re-- >0&&(Q=requestAnimationFrame(ve))};return Q=requestAnimationFrame(ve),()=>cancelAnimationFrame(Q)},[o,e]),z8(()=>{L.current=N,N&&requestAnimationFrame(()=>{E.current?.focus(),E.current?.select()})},[N]),z8(()=>{if(!e)return;const Q=re=>{const ve=document.activeElement;ve instanceof HTMLInputElement||ve instanceof HTMLTextAreaElement||ve?.getAttribute("contenteditable")==="true"||l||!o||L.current||(re.key==="Delete"||re.key==="Backspace")&&(re.preventDefault(),w(o))};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[e,o,l,w]);const Z=Q=>{T(Q.name),L.current=Q.id,k(Q.id)},K=Q=>{b(Q,D),L.current=null,k(null)},V=Q=>{L.current=null,k(null);const re=i.find(_e=>_e.id===Q),ve=re?.name.trim()??"";if(!re||!ve){rt.openToast({type:"basic",variant:"warning",content:C("move.workspace.toast.renameInvalid"),position:"top-right"}),b(Q,D);return}ve!==re.name&&b(Q,ve),v?.(Q,D)},fe=[...i].sort((Q,re)=>Q.kind===re.kind?0:Q.kind==="custom"?-1:1);return x(U,{className:"w-full gap-1.5",children:[x(H,{alignItems:"center",justifyContent:"space-between",className:"w-full gap-2 px-1",children:[x("span",{className:"typo-compact-xs-semibold text-fg-default",children:[C("move.workspace.itemList.title"),i.length>0&&u("span",{className:"text-fg-subtle ml-1",children:i.length})]}),x(H,{alignItems:"center",className:"gap-1",children:[i.length>0&&u(Nie,{size:"xs",className:"text-fg-subtle hover:text-fg-default",onClick:()=>l?M():A(),children:C(l?"move.workspace.itemList.selectionExit":"move.workspace.itemList.selectionMode")}),s?u(Yt,{variant:"transparent",size:"sm",onClick:s,icon:u(Mm,{className:P("text-fg-default size-3.5 transition-transform duration-200 ease-out",n?"rotate-45":"rotate-0")}),"aria-label":C(n?"common.button.close":"move.workspace.addMenu.trigger"),className:"text-fg-default hover:bg-bg-alt-1 active:bg-bg-alt-2 rounded-md transition-colors"}):null]})]}),u("div",{className:P("grid w-full transition-[grid-template-rows,opacity] duration-200 ease-out",n?"grid-rows-[1fr] opacity-100":"pointer-events-none grid-rows-[0fr] opacity-0"),children:u("div",{className:"min-h-0 overflow-hidden",children:t})}),i.length===0?u("div",{className:"border-border-subtle flex h-16 items-center justify-center rounded-md border border-dashed",children:u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:C("move.workspace.itemList.empty")})}):u(U,{ref:$,className:"border-border-subtle/70 bg-bg-alt-1/40 max-h-52 w-full gap-1 overflow-y-auto rounded-lg border p-1.5 [scrollbar-gutter:stable]",onClick:Q=>{Q.target===Q.currentTarget&&a?.()},children:fe.map(Q=>{const re=Q.id===o,ve=Q.id===N,_e=m?.has(Q.id)??!1,Le=c.has(Q.id),Ie=Ayt(Q),Te=g?.has(Q.id)??!1,lt=f?.has(Q.id)??!1,it=p?.has(Q.id)??!1,Ct=C("move.workspace.itemList.loadFailedLabel");return x("div",{"data-item-id":Q.id,role:"button",tabIndex:0,onClick:ft=>{if(l){B(Q,fe,ft);return}ve||r(Q.id)},onDoubleClick:()=>{!ve&&!l&&Z(Q)},onKeyDown:ft=>{ve||(ft.key==="Enter"||ft.key===" ")&&(ft.preventDefault(),l?O(Q.id):r(Q.id))},className:P("group relative z-1 flex h-9 w-full shrink-0 cursor-pointer items-center justify-between gap-1 rounded-md border pr-0.5 pl-2 transition-all duration-150 select-none",(l?Le:re)?"border-border-navy-stronger bg-fill-navy-subtler ring-border-navy-stronger ring-1 ring-inset":"border-border-subtle/80 bg-bg-default hover:border-border-navy-stronger hover:bg-fill-navy-subtler active:border-border-navy-stronger active:bg-fill-navy-subtler active:ring-border-navy-stronger shadow-2xs active:ring-1 active:ring-inset",_e&&"opacity-45"),children:[x("div",{className:"flex h-full min-w-0 flex-1 items-center gap-1.5 pr-1",children:[l&&u(ia,{size:"xs",readOnly:!0,value:Le,className:"-ml-1 shrink-0"}),u("span",{className:P("pointer-events-none shrink-0 transition-colors",(l?Le:re)?"text-fg-navy":"text-fg-subtle group-hover:text-fg-navy group-active:text-fg-navy"),children:Myt(Q)}),ve?u(yMe,{ref:E,value:Q.name,onChange:ft=>b(Q.id,ft),onCommit:()=>V(Q.id),onCancel:()=>K(Q.id),ariaLabel:C("move.workspace.header.rename"),className:"typo-compact-xs-medium px-1.5"}):x("span",{className:P("pointer-events-none min-w-0 truncate transition-colors",(l?Le:re)?"typo-compact-xs-semibold text-fg-navy":"typo-compact-xs-medium text-fg-default group-hover:text-fg-navy group-active:typo-compact-xs-semibold group-active:text-fg-navy"),children:[Q.name,Ie]}),_e&&u(Tje,{width:14,height:14,className:"text-fg-subtle shrink-0","aria-label":C("move.workspace.itemList.hiddenLabel"),title:C("move.workspace.itemList.hiddenLabel")}),Te&&u(aw,{size:"0.75rem",className:"text-fg-subtle shrink-0"}),lt&&u(Oue,{className:"text-fg-danger size-3.5 shrink-0","aria-label":C("move.workspace.itemList.saveFailedLabel"),title:C("move.workspace.itemList.saveFailedLabel")}),it&&u(Oue,{className:"text-fg-danger size-3.5 shrink-0","aria-label":Ct,title:Ct})]}),!l&&u("div",{className:"shrink-0",onClick:ft=>ft.stopPropagation(),onPointerDown:ft=>ft.stopPropagation(),children:x(iA,{modal:!1,children:[u(oA,{asChild:!0,children:u(Yt,{variant:"transparent",size:"xs",className:"text-fg-subtle hover:text-fg-navy flex h-8.5! min-h-8.5! w-8.5! min-w-8.5! items-center justify-center rounded p-0",icon:u(WDe,{className:"size-4"}),"aria-label":C("move.workspace.itemList.actions")})}),x(sA,{align:"end",className:"w-36",onCloseAutoFocus:ft=>{L.current&&(ft.preventDefault(),E.current?.select())},children:[u(hu,{className:"h-10",onSelect:()=>Z(Q),children:u("span",{className:"typo-compact-xs-medium",children:C("move.workspace.header.rename")})}),_&&u(hu,{className:"h-10",onSelect:()=>_(Q.id),children:u("span",{className:"typo-compact-xs-medium",children:C(_e?"move.workspace.itemList.showLabel":"move.workspace.itemList.hideLabel")})}),u(hu,{className:"h-10",onSelect:()=>w(Q.id),children:u("span",{className:"typo-compact-xs-medium",children:C("move.workspace.itemList.deleteLabel")})})]})]})})]},Q.id)})}),l&&x(H,{alignItems:"center",justifyContent:"space-between",className:"w-full gap-2 px-1",children:[u("span",{className:"typo-compact-xs-medium text-fg-subtle",children:C("move.workspace.itemList.selectionCount",{count:c.size})}),x(H,{alignItems:"center",className:"gap-1",children:[u(se,{size:"xs2",variant:"outlined",disabled:c.size===0,onClick:Y,children:C("move.workspace.itemList.hideSelected",{count:c.size})}),u(se,{size:"xs2",variant:"danger",disabled:c.size===0,onClick:z,children:C("move.workspace.itemList.deleteSelected",{count:c.size})})]})]})]})},{useCallback:$fe,useEffect:W8,useMemo:Ufe,useRef:H8,useState:oF}=await F("react"),{useQueryClient:Fyt}=await F("@tanstack/react-query"),jfe=i=>i.some(e=>{const t=e.fileInfo?.fileName?.split(".").pop()?.toLowerCase();return t==="stp"||t==="step"}),Byt=({workspace:i,robotModel:e,detailRobotModel:t,modelType:n,mountJointName:s,gizmoSelectedAssetIds:o,selectionMode:r,tabKind:a,onRequestSceneAssetSelect:l,onRequestSceneSelectionChange:c,isActive:d=!0})=>{const{t:h}=q(),{theme:g}=tt(),{confirmDialog:m,promptDialog:f}=jn(),[p,_]=oF(!1),[b,v]=oF(!1),[w,y]=oF(!1),{mutateAsync:S,isPending:C,abort:N}=iyt(),{data:k}=r6(e,t),{mutateAsync:L}=lyt(),D=Ufe(()=>(k??[]).filter(Ne=>Ne.modelType===n&&(s?Ne.attachment?.parentJointName===s:!0)),[k,n,s]),T=Ufe(()=>D.filter(Ne=>Ne.isLoaded).map(Ne=>Ne.modelId),[D]),E=H8(new Set),{stage:R,loadFromModels:A,selectItem:M}=i,O=$fe(()=>{rt.openToast({type:"basic",variant:"warning",title:h("move.workspace.stepFormatWarning.title"),content:h("move.workspace.stepFormatWarning.message"),position:"top-right"})},[h]);W8(()=>{if(R!=="empty"||!k)return;const Ne=D.filter(ct=>ct.isLoaded);if(Ne.length===0){E.current.clear();return}const Re=Ne.filter(ct=>!E.current.has(ct.modelId))[0]?.workspace?.name;if(!Re)return;const We=D.filter(ct=>ct.workspace?.name===Re);jfe(We)&&O(),A(We,Re,T)},[R,k,D,T,A,O]);const B=Ne=>{rt.openToast({type:"basic",variant:"warning",content:h(Ne),position:"top-right"})},z=async({title:Ne,initialValue:le="",excludeName:Pe})=>{const Re=await f({title:Ne,content:h("move.workspace.dialog.namePlaceholder"),placeholder:h("move.workspace.dialog.namePlaceholder"),value:le,autoFocus:!0,inputElement:u(et,{className:"[&_input]:selection:bg-fill-brand-subtle [&_input]:selection:text-white",onFocus:ct=>ct.target.select()}),buttonText:{yes:h("common.button.confirm"),no:h("common.button.cancel")}});if(Re==null)return null;const We=Re.trim();return We?c4.test(We)?(B("move.workspace.toast.invalidCharacters"),null):We===Pe?null:ufe(k??[],{modelType:n,attachment:s?{parentJointName:s}:null},We,Pe??void 0)?(B("move.workspace.toast.nameDuplicate"),null):We:(B("move.workspace.toast.renameInvalid"),null)},Y=H8(null);W8(()=>{const Ne=i.loadTimeoutEvent;if(!Ne||Y.current===Ne)return;Y.current=Ne;const le=i.items.find(Pe=>Pe.id===Ne.itemId);rt.openToast({type:"basic",variant:"warning",content:h("move.workspace.toast.loadTimeout",{name:le?.name??""}),position:"top-right"})},[i.loadTimeoutEvent,i.items,h]);const $=async()=>{const Ne=await z({title:h("move.workspace.dialog.saveAsTitle")});if(Ne)try{await i.saveAs(Ne,T),rt.openToast({type:"basic",variant:"success",content:h("move.workspace.toast.saveSuccess"),position:"top-right"})}catch{i.failedItemIds.size>0?rt.openToast({type:"basic",variant:"warning",content:h("move.workspace.toast.saveFailedPartial",{count:i.failedItemIds.size}),position:"top-right"}):B("move.workspace.toast.saveFailed")}},Z=async()=>{try{await i.save(),rt.openToast({type:"basic",variant:"success",content:h("move.workspace.toast.saveSuccess"),position:"top-right"})}catch{i.failedItemIds.size>0?rt.openToast({type:"basic",variant:"warning",content:h("move.workspace.toast.saveFailedPartial",{count:i.failedItemIds.size}),position:"top-right"}):B("move.workspace.toast.saveFailed")}},K=Ne=>{if(v(!1),i.items.find(Re=>Re.kind==="custom")?.modelId===Ne.modelId)return;const Pe=`.${Ne.fileInfo.fileName.split(".").pop()?.toLowerCase()??""}`;(Pe===".stp"||Pe===".step")&&O();try{const Re=i.addCustomFile(Ne);Re&&l?.(`${a}:${Re}`)}catch{B("move.workspace.toast.uploadFailed")}},V=Ne=>{const le=new Set(Ne.map(We=>We.modelId)),Pe=new Set(Ne.map(We=>We.fileId).filter(We=>!!We)),Re=i.items.filter(We=>We.kind==="custom"&&(We.modelId!=null&&le.has(We.modelId)||We.fileId!=null&&Pe.has(We.fileId))).map(We=>We.id);Re.length!==0&&(i.selectedItemId&&Re.includes(i.selectedItemId)&&l?.(null),i.removeItems(Re))},fe=async()=>{i.hasCustomFile&&!await m({title:h("move.workspace.confirm.replaceFileTitle"),content:h("move.workspace.confirm.replaceFileContent"),buttonText:{yes:h("move.workspace.button.continue"),no:h("common.button.cancel")}})||v(!0)},Q=async(Ne,le)=>{const Pe=i.items.find($n=>$n.id===Ne);if(!Pe)return;const Re=Pe.name.trim();if(!Re){B("move.workspace.toast.renameInvalid"),i.renameItem(Ne,le);return}if(Pe.kind!=="custom"||!Pe.fileId){Re!==le&&i.renameItem(Ne,Re);return}if(c4.test(Re)){B("move.workspace.toast.invalidCharacters"),i.renameItem(Ne,le);return}if(Re===le)return;const We=Pe.fileName.match(/\.[^.]+$/)?.[0]??"",ct=We&&!Re.toLowerCase().endsWith(We.toLowerCase())?`${Re}${We}`:Re,gn=D.filter($n=>$n.shapeType===null&&!$n.workspace);if(gMe(gn,ct,Pe.modelId)){B("move.modal.workspace.file.upload.duplicateName"),i.renameItem(Ne,le);return}if(!Pe.modelId){i.renameItem(Ne,Re);return}try{await L({robotModel:e,detailRobotModel:t,modelId:Pe.modelId,fileId:Pe.fileId,fileName:ct}),i.applyCustomFileRename(Ne,ct,Re)}catch{i.renameItem(Ne,le)}},re=Ne=>{const le=Ne.trim();if(!le){B("move.workspace.toast.renameInvalid");return}if(c4.test(le)){B("move.workspace.toast.invalidCharacters");return}if(ufe(k??[],{modelType:n,attachment:s?{parentJointName:s}:null},le,i.workspaceName??void 0)){B("move.workspace.toast.nameDuplicate");return}i.renameWorkspace(le)},ve=Fyt(),{mutateAsync:_e}=uoe(),Le=async()=>{const Ne=i.workspaceName;if(!Ne||!await m({title:h("move.workspace.confirm.deleteTitle"),content:h("move.workspace.confirm.deleteContent",{name:Ne}),buttonText:{yes:h("move.modal.workspace.button.delete"),no:h("common.button.cancel")}}))return;const Pe=D.filter(Re=>Re.workspace?.name===Ne);try{await Promise.all(Pe.map(We=>_e(We.modelId)));const Re=i1(e,t);await ve.invalidateQueries({queryKey:Re}),i.closeWorkspace(T),rt.openToast({type:"basic",variant:"success",content:h("move.workspace.toast.deleteSuccess"),position:"top-right"})}catch{rt.openToast({type:"basic",variant:"danger",content:h("move.workspace.toast.deleteFailed"),position:"top-right"})}},Ie=async()=>{if(i.hasUnsavedChanges&&!await m({title:h("move.workspace.confirm.closeTitle"),content:h("move.workspace.confirm.closeContent"),buttonText:{yes:h("move.workspace.button.closeWithoutSaving"),no:h("common.button.cancel")}}))return;const Ne=D.filter(le=>le.isLoaded);for(const le of Ne)E.current.add(le.modelId);i.closeWorkspace(T)},Te=()=>{_(!0)},lt=()=>{i.clearItems()},it=async Ne=>{if(Ne.name===i.workspaceName){_(!1);return}i.hasUnsavedChanges&&!await m({title:h("move.workspace.confirm.openTitle"),content:h("move.workspace.confirm.openContent"),buttonText:{yes:h("move.workspace.button.continue"),no:h("common.button.cancel")}})||(E.current.clear(),_(!1),jfe(Ne.models)&&O(),i.loadFromModels(Ne.models,Ne.name,T))},Ct=async()=>{const Ne=await z({title:h("move.workspace.dialog.createTitle")});Ne&&i.createNew(Ne)},ft=Ne=>{!i.workspaceName||!Ne.includes(i.workspaceName)||(D.filter(le=>le.isLoaded).forEach(le=>E.current.add(le.modelId)),l?.(null),i.closeWorkspace(T))};dyt({selectedItemId:i.selectedItemId,gizmoSelectedAssetIds:o,selectionMode:r,tabKind:a,onRequestSceneAssetSelect:l,selectItem:M});const[Xt,Mt]=oF(new Set),Ht=H8({mode:!1,idsKey:""}),Mn=$fe(Ne=>Ne.filter(le=>le.startsWith(`${a}:`)).map(le=>le.slice(a.length+1)),[a]),Cs=Ne=>[...Ne].sort().join(",");W8(()=>{if(!r){Ht.current.mode!==!1&&(Ht.current={mode:!1,idsKey:""},Mt(new Set));return}const Ne=Mn(o),le=Cs(Ne),Pe=Ht.current;Pe.mode===!0&&Pe.idsKey===le||(Ht.current={mode:!0,idsKey:le},Mt(new Set(Ne)))},[o,r,a,Mn]);const or=Ne=>{Mt(le=>{const Pe=typeof Ne=="function"?Ne(le):Ne,Re=Cs(Pe);return Ht.current={mode:!0,idsKey:Re},c?.([...Pe].map(We=>`${a}:${We}`),!0),Pe})},ge=Ne=>{Ne?(Ht.current={mode:!0,idsKey:""},c?.([],!0)):(Ht.current={mode:!1,idsKey:""},Mt(new Set),c?.([],!1))},Ue=u(wyt,{open:p,onOpenChange:_,robotModel:e,detailRobotModel:t,modelType:n,attachment:s?{parentJointName:s}:null,resolve:it,close:()=>_(!1),onGroupsDeleted:ft}),Ee=i.items.find(Ne=>Ne.id===i.selectedItemId)??null;return i.stage==="empty"?x(rn,{children:[u(U,{className:"w-full gap-2 pb-2.5",children:x(H,{className:"w-full gap-2 p-1",children:[u(se,{variant:"outlined",size:"xs2",className:"flex-1",leadingIcon:u(Mm,{}),onClick:()=>void Ct(),children:h("move.workspace.header.createNew")}),u(se,{variant:"brand",size:"xs2",className:"flex-1",leadingIcon:u(tDe,{}),onClick:()=>_(!0),children:h("move.workspace.header.open")})]})}),Ue]}):x(rn,{children:[x(U,{className:"w-full gap-3",children:[u(Tyt,{workspaceName:i.workspaceName,hasUnsavedChanges:i.hasUnsavedChanges,onRename:re,canUndo:i.canUndo,canRedo:i.canRedo,onUndo:i.undo,onRedo:i.redo,isSaving:i.isSaving,hasItems:i.items.length>0,onDuplicate:()=>void $(),onCreateNew:()=>void Ct(),onOpenPicker:()=>void Te(),onDelete:()=>void Le(),onClearAll:lt,onReset:i.resetToSaved}),x(H,{className:P("border-border-subtle -mt-1.5 w-full shrink-0 gap-2 border-b pb-3",g==="light"?"bg-white":"bg-alt-1"),children:[u(se,{className:"flex-1",size:"xs2",variant:"outlined",onClick:()=>void Ie(),children:h("move.workspace.header.close")}),u(se,{className:"flex-1",size:"xs2",variant:"brand",disabled:i.isSaving||!i.hasUnsavedChanges,onClick:()=>void Z(),children:h("move.workspace.header.saveNow")})]}),u(Oyt,{items:i.items,isActive:d,isAddPanelOpen:w,onToggleAddPanel:()=>y(Ne=>!Ne),addPanel:u(Spt,{onAddShape:Ne=>{const le=i.addShape(Ne);le&&l?.(`${a}:${le}`)},limitReached:i.isLimitReached,isCustomFileUploading:C,onOpenCustomFilePicker:()=>void fe(),draggable:n==="base"}),selectedId:i.selectedItemId,onSelect:Ne=>{if(i.selectedItemId===Ne){i.selectItem(null),l?.(null);return}i.selectItem(Ne),l?.(`${a}:${Ne}`)},onDeselect:()=>{i.selectItem(null),l?.(null)},selectionMode:r,checkedIds:Xt,onSelectionModeChange:ge,onCheckedIdsChange:or,loadingIds:i.loadingItemIds,hiddenIds:i.hiddenItemIds,failedIds:i.failedItemIds,loadFailedIds:i.loadFailedItemIds,onToggleVisibility:Ne=>{i.selectedItemId===Ne&&!i.hiddenItemIds.has(Ne)&&l?.(null),i.toggleItemVisibility(Ne)},onRename:i.renameItem,onRenameCommit:(Ne,le)=>void Q(Ne,le),onDelete:i.removeItem,onBulkDelete:i.removeItems,onBulkHide:i.hideItems}),u(Ryt,{item:Ee,onChange:i.updateItemTransform}),u(Lyt,{open:b,onOpenChange:v,robotModel:e,detailRobotModel:t,modelType:n,attachment:s?{parentJointName:s}:null,resolve:K,close:()=>v(!1),uploadAssetFiles:S,isUploading:C,onCancelUpload:N,onModelsDeleted:V})]}),Ue]})},{useCallback:$8,useEffect:c_,useLayoutEffect:Vyt,useMemo:wMe,useRef:GB,useState:d4}=await F("react"),Gfe=({robotModel:i,detailRobotModel:e,modelType:t,mountJointName:n,gizmoSelectedAssetIds:s,selectionMode:o,isActive:r,tabKey:a,onAssetsChange:l,assetTransformEvent:c,onRequestSceneAssetSelect:d,onRequestSceneSelectionChange:h,onAssetLoaded:g,shapeDropRequest:m,onLoadingChange:f})=>{const p=Qvt({robotModel:i,detailRobotModel:e,modelType:t,mountJointName:n,isActive:r}),_=t==="base"?"base":`tool:${n}`;c_(()=>{l(a,p.assets)},[p.assets,l,a]),c_(()=>{f(a,p.loadingItemIds.size>0)},[p.loadingItemIds,f,a]),c_(()=>{const N=p.assetLoadedEvent;N&&g?.(N.assetId)},[p.assetLoadedEvent,g]);const b=GB(r);c_(()=>{const N=b.current;b.current=r,!(!N||r||!s.some(L=>L.startsWith(`${_}:`)))&&(o?h?.([],!1):d?.(null))},[r,s,o,_,d,h]);const v=GB({workspace:p,shapeDropRequest:m});c_(()=>{v.current={workspace:p,shapeDropRequest:m}});const[w,y]=d4(null);c_(()=>{if(!c?.assetId.startsWith(`${_}:`))return;const N=c.assetId.slice(_.length+1),{transform:k,final:L}=c,{workspace:D}=v.current,T=D.items.find(R=>R.id===N),E={position:{x:Math.round(k.x*Pn),y:Math.round(k.y*Pn),z:Math.round(k.z*Pn)},rotation:{rx:parseFloat(k.rx.toFixed(2)),ry:parseFloat(k.ry.toFixed(2)),rz:parseFloat(k.rz.toFixed(2))},...T?.kind==="shape"&&typeof k.scale!="number"&&{scale:{x:parseFloat(k.scale.x.toFixed(2)),y:parseFloat(k.scale.y.toFixed(2)),z:parseFloat(k.scale.z.toFixed(2))}}};if(!L){y({itemId:N,update:E});return}y(null),D.updateItemTransform(N,E,`drag:${N}`)},[c,_]);const S=wMe(()=>w?{...p,items:p.items.map(N=>N.id===w.itemId?YRe(N,w.update):N)}:p,[p,w]),C=m?.nonce;return c_(()=>{const{workspace:N,shapeDropRequest:k}=v.current;if(!k||N.stage!=="build")return;const L=N.addShape(k.type,k.at);L&&d?.(`${_}:${L}`)},[C,_,d]),u("div",{className:P(!r&&"hidden"),children:u(Byt,{workspace:S,robotModel:i,detailRobotModel:e,modelType:t,mountJointName:n,gizmoSelectedAssetIds:s,selectionMode:o,tabKind:_,onRequestSceneAssetSelect:d,onRequestSceneSelectionChange:h,isActive:r})})},zyt=({className:i,detailRobotModel:e,tcpJoints:t,gizmoSelectedAssetIds:n=[],selectionMode:s=!1,onAssetsChange:o,assetTransformEvent:r,shapeDropRequest:a,onRequestSceneAssetSelect:l,onRequestSceneSelectionChange:c,onAssetLoaded:d,isMenuActive:h=!0})=>{const{t:g}=q(),{theme:m}=tt(),f=wMe(()=>{const T=R=>{const A=R.toLowerCase();return A.includes("right")?0:A.includes("left")?1:2},E=t.map((R,A)=>({tcp:R,index:A})).sort((R,A)=>T(R.tcp.jointName)-T(A.tcp.jointName)||R.index-A.index);return[{key:"base",label:g("move.workspace.tab.base"),componentModel:e},...E.map(({tcp:R,index:A})=>{const{key:M,params:O}=ipt(R.jointName,A,E.length);return{key:`tool:${R.jointName}`,label:g(M,O),componentModel:R.componentModel}})]},[t,e,g]),[p,_]=d4(f[0].key);c_(()=>{f.some(T=>T.key===p)||_(f[0].key)},[f,p]);const b=$8(T=>f.find(E=>T.startsWith(`${E.key}:`)),[f]),v=n[0]??null;Vyt(()=>{if(!v)return;const T=b(v);T&&_(E=>T.key!==E?T.key:E)},[v,b]);const[w,y]=d4({}),S=$8((T,E)=>{y(R=>BE(R[T]??[],E)?R:{...R,[T]:E})},[]),[C,N]=d4({}),k=$8((T,E)=>{N(R=>R[T]===E?R:{...R,[T]:E})},[]),L=GB([]),D=GB([]);return c_(()=>{const T=w.base??[],E=f.filter(R=>R.key!=="base").flatMap(R=>w[R.key]??[]);BE(L.current,T)&&BE(D.current,E)||(L.current=T,D.current=E,o(T,E))},[w,f,o]),u("div",{className:P("WorkspaceControl","h-full overflow-y-auto [scrollbar-gutter:stable]",i),children:x(U,{className:"gap-3 px-3 pt-2.5",children:[x(U,{className:"gap-2",children:[u(Ag,{subject:g("move.workspace.title")}),u(bA,{value:p,onValueChange:_,className:"w-full",children:u(vA,{className:P("h-7 w-full rounded-md border-none",m==="light"?"bg-fill-navy-subtlest":"bg-fill-subtlest"),children:f.map(({key:T,label:E})=>x(yA,{value:T,className:P("typo-compact-xs2-medium flex-1 items-center gap-1 rounded",m==="light"?["text-fg-subtle","data-[state=active]:bg-fill-navy","data-[state=active]:text-white"]:["text-fg-subtle","data-[state=active]:bg-fill-subtler","data-[state=active]:text-fg-default"]),children:[E,C[T]&&u("span",{className:"bg-fill-warning size-1.5 shrink-0 animate-pulse rounded-full","aria-label":g("move.workspace.tab.loadingLabel"),title:g("move.workspace.tab.loadingLabel")})]},T))})})]}),f.map(({key:T,componentModel:E})=>T==="base"?u(Gfe,{robotModel:e,detailRobotModel:e,modelType:"base",gizmoSelectedAssetIds:n,selectionMode:s,isActive:h&&T===p,tabKey:T,onAssetsChange:S,onLoadingChange:k,assetTransformEvent:r,shapeDropRequest:T===p?a:null,onRequestSceneAssetSelect:l,onRequestSceneSelectionChange:c,onAssetLoaded:d},T):u(Gfe,{robotModel:E,detailRobotModel:e,modelType:"tool",mountJointName:T.slice(5),gizmoSelectedAssetIds:n,selectionMode:s,isActive:h&&T===p,tabKey:T,onAssetsChange:S,onLoadingChange:k,assetTransformEvent:r,onRequestSceneAssetSelect:l,onRequestSceneSelectionChange:c,onAssetLoaded:d},T))]})})},{useMutation:Wyt}=await F("@tanstack/react-query"),Hyt="/{robot_model}/call_replay_motion_rec_start",$yt=i=>{const{robot_model:e,...t}=i,n=Hyt.replace("{robot_model}",e);return Dt.post(n,t)},Uyt=()=>Wyt({mutationFn:i=>$yt(i)}),{useMutation:jyt}=await F("@tanstack/react-query"),Gyt="/{robot_model}/call_replay_motion_rec_stop",qyt=i=>{const{robot_model:e}=i,t=Gyt.replace("{robot_model}",e);return Dt.post(t,{})},Kyt=()=>jyt({mutationFn:qyt}),{useMemo:qfe}=await F("react"),Jyt=[{label:"move.menu.options.option.noSave",value:"0"},{label:"move.menu.options.option.realTime",value:"1"},{label:"move.menu.options.option.mileStone",value:"2"}],Yyt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{isUseSimulator:s}=ui(),{selectedRobot:o}=Fi(e),{motionMode:r}=ws(e,C=>({motionMode:C.motionMode})),{mutate:a,isPending:l}=Uyt(),{mutate:c,isPending:d}=Kyt(),{register:h,setValue:g,handleSubmit:m,watch:f,control:p}=he({defaultValues:{mode:0,frequency:1,filename:""}}),_=f("frequency"),b=qfe(()=>r!==0,[r]),v=qfe(()=>b||o?.connected==="DISCONNECT"&&!s,[b,o?.connected,s]),w=(C,N)=>{g(C,N)},y=C=>{a({robot_model:e,mode:Number(C.mode),frequency:Number(C.frequency),filename:C.filename})},S=()=>{c({robot_model:e})};return u("div",{className:P("RecordControl","h-full",i),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:t("move.menu.button.label.record")}),x(U,{className:"w-full gap-4",children:[u(me,{label:t("dashboard.content.mode"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(oe,{name:"mode",control:p,render:({field:C})=>u(ae,{className:"w-full",size:"sm",...C,onChange:N=>C.onChange(N),children:Jyt.map(N=>u(J,{value:N.value,children:t(N.label)},N.label))})})}),u(me,{label:t("move.menu.label.mileStoneFreq"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(Iie,{size:"sm",className:"w-full",type:"nx-number",name:"frequency",handleChange:C=>w("frequency",Number(C)),value:String(_)})}),u(me,{label:t("move.menu.label.fileName"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(et,{size:"sm",className:"w-full",type:"text",inputMode:"text",...h("filename",{onChange:C=>w("filename",C.target.value)})})})]}),x(H,{className:"mt-2 w-full gap-1.5",children:[u(se,{className:"typo-compact-xs-semibold w-full",size:"sm",variant:n==="light"?"danger":"soft",loading:l||d,onClick:S,children:t("move.menu.button.label.recordStop")}),u(se,{className:"typo-compact-xs-semibold w-full",size:"sm",variant:"brand",disabled:v,loading:l||d,onClick:m(y),children:t("move.menu.button.label.recordStart")})]})]})})},{useMutation:Xyt}=await F("@tanstack/react-query"),Qyt="/{robot_model}/call_weld_wire",Zyt=i=>{const{robot_model:e,...t}=i,n=Qyt.replace("{robot_model}",e);return Dt.post(n,t)},ewt=()=>Xyt({mutationFn:Zyt}),{useMutation:twt}=await F("@tanstack/react-query"),nwt="/{robot_model}/call_weld_gas",iwt=i=>{const{robot_model:e,...t}=i,n=nwt.replace("{robot_model}",e);return Dt.post(n,t)},swt=()=>twt({mutationFn:iwt}),{useCallback:rF,useMemo:owt}=await F("react"),rwt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{isUseSimulator:s}=ui(),{selectedRobot:o}=Fi(e),{isMoving:r}=U9({tabType:"joint",tickModeInput:null,robotModel:e}),a=owt(()=>r||o?.connected==="DISCONNECT"&&!s,[r,o?.connected,s]),{mutate:l}=ewt(),{mutate:c}=swt(),d=rF(f=>{l({robot_model:e,direction:f})},[l,e]),h=rF(()=>{l({robot_model:e,direction:0})},[l,e]),g=rF(()=>{c({robot_model:e,gas_onoff:1})},[c,e]),m=rF(()=>{c({robot_model:e,gas_onoff:0})},[c,e]);return u("div",{className:P("WeldControl","h-full",i),children:x(U,{className:P("gap-2 px-3 py-2.5","[&_button>span]:typo-compact-xs-semibold"),children:[u(Ag,{subject:t("move.menu.button.label.weld")}),x(H,{className:"gap-2",children:[u(Dd,{className:"w-full",size:"sm",variant:n==="light"?"outlined":"soft",disabled:a,onButtonDown:()=>d(1),onButtonUp:h,children:t("move.menu.button.label.weldForward")}),u(Dd,{className:"w-full",size:"sm",variant:n==="light"?"outlined":"soft",disabled:a,onButtonDown:()=>d(-1),onButtonUp:h,children:t("move.menu.button.label.weldBackward")})]}),u(Dd,{size:"sm",variant:n==="light"?"brand":"soft",disabled:a,onButtonDown:g,onButtonUp:m,children:t("move.menu.button.label.gasPurge")})]})})},{useMutation:awt}=await F("@tanstack/react-query"),lwt="/{robot_model}/call_calib_tcp_position",cwt=i=>{const{robot_model:e,...t}=i,n=lwt.replace("{robot_model}",e);return Dt.post(n,t)},dwt=()=>awt({mutationFn:i=>cwt(i)}),uwt=({className:i,robotModel:e,jointRef:t,isDisabled:n})=>{const{theme:s}=tt(),{t:o}=q(),{mutate:r,isPending:a}=dwt(),{setValue:l,getValues:c,control:d}=he({defaultValues:{tcpPosition:{joints:[]}}}),{fields:h,append:g,remove:m}=cl({control:d,name:"tcpPosition.joints"}),f=async()=>{g({tar_values:t?.map(_=>Number(_.toFixed(3)))??[0,0,0,0,0,0,0],tar_frame:-1,tar_unit:0})},p=()=>{const _=c().tcpPosition;r({robot_model:e,joints:_.joints})};return x(U,{className:P("TCPPosCalibaration","w-full gap-2.5",i),children:[x(U,{className:"w-full gap-1",children:[x(H,{className:"w-full gap-1.5",children:[u(se,{className:"w-full",size:"xs",variant:"outlined",disabled:n,loading:a,onClick:()=>l("tcpPosition.joints",[]),children:o("settings.button.settingsReset")}),u(se,{className:P("w-full",s==="light"&&"outline-fg-navy text-fg-navy"),size:"xs",variant:s==="light"?"outlined":"soft",disabled:n,loading:a,onClick:()=>f(),children:o("program.button.add")})]}),u(se,{className:"w-full",size:"xs2",variant:"brand",disabled:n||h.length===0,loading:a,onClick:()=>p(),children:o("settings.button.set")})]}),u("div",{className:P("bg-bg-raised flex flex-col justify-center gap-2 rounded-md p-2"),children:u(U,{className:"gap-2",children:u(qr,{list:h,noDataMsg:u(U,{className:"min-h-40 gap-4 py-4",alignItems:"center",justifyContent:"center",children:u("p",{className:"typo-compact-xs-medium text-fg-subtler",children:o("move.menu.calibTCPPos.desc")})}),children:({item:_,index:b})=>x(U,{className:"bg-bg-card gap-0.5 rounded-md px-2.5 py-1.5",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"text-fg-default typo-compact-xs-semibold",children:`P${b+1}`}),u(Yt,{size:"3xs",variant:"transparent",icon:u(Nb,{className:"size-3"}),onClick:()=>m(b)})]}),u("div",{className:"flex-1",children:u(oe,{control:d,name:`tcpPosition.joints.${b}.tar_values`,render:({field:v})=>u("span",{className:"text-fg-subtle typo-compact-2xs-normal w-full",children:v.value.map(w=>w.toFixed(3)+"º").join(", ")},`j-${b}`)})})]},_.id)})})})]})},{useMutation:hwt}=await F("@tanstack/react-query"),gwt="/{robot_model}/call_calib_tcp_orientation",mwt=i=>{const{robot_model:e,...t}=i,n=gwt.replace("{robot_model}",e);return Dt.post(n,t)},fwt=()=>hwt({mutationFn:i=>mwt(i)}),pwt=[{label:"program.options.frame.global",value:0},{label:"program.options.frame.local",value:1},{label:"program.options.frame.user",value:2}],_wt=({className:i,robotModel:e,isDisabled:t})=>{const{t:n}=q(),{mutate:s,isPending:o}=fwt(),{register:r,getValues:a}=he({defaultValues:{tcpOrientation:{frame_option:0}}}),l=()=>{const c=a().tcpOrientation;s({robot_model:e,frame_option:Number(c.frame_option)})};return u(U,{className:P("TCPOrientCalibration","w-full gap-1",i),children:u(me,{label:n("program.field.option"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:x(H,{className:"w-full gap-1.5",alignItems:"center",children:[u(ae,{className:"w-full flex-1",size:"xs2",...r("tcpOrientation.frame_option",{valueAsNumber:!0}),children:pwt.map(c=>u(J,{value:c.value,children:n(c.label)},c.label))}),u(se,{className:"typo-compact-xs-semibold w-20",size:"xs2",variant:"brand",disabled:t,loading:o,onClick:()=>l(),children:n("settings.button.set")})]})})})},{createContext:bwt,useContext:vwt,useEffect:ywt,useRef:wwt}=await F("react"),CMe=bwt(null),iL=()=>{const i=vwt(CMe);if(!i)throw new Error("ManiSetCommand 내부에서만 사용 가능합니다.");return i},co=(i,e)=>{const{registerSection:t,unregisterSection:n}=iL(),s=wwt(e);s.current=e,ywt(()=>(t(i,()=>s.current()),()=>n(i)),[i,t,n])},Ft={OUT_COLLISION:"OUT_COLLISION",SELF_COLLISION:"SELF_COLLISION",USER_FRAME_SELECTION:"USER_FRAME_SELECTION",FIXED_SPEED:"FIXED_SPEED",TARGET_SHIFT:"TARGET_SHIFT",SPEED_BAR:"SPEED_BAR",TIME_CONSTRAINT:"TIME_CONSTRAINT",ASCII_FUNCTION_CALL:"ASCII_FUNCTION_CALL",JOINT_IMPEDANCE:"JOINT_IMPEDANCE",FREE_DRIVE:"FREE_DRIVE",MASTER_MODE:"MASTER_MODE",USER_FRAME_6DOF:"USER_FRAME_6DOF",USER_FRAME_TCP:"USER_FRAME_TCP",USER_FRAME_3POINTS:"USER_FRAME_3POINTS",TARGET_SHIFT_LANDMARK:"TARGET_SHIFT_LANDMARK",PROGRAM_FLOW_MANAGE:"PROGRAM_FLOW_MANAGE",DIN_FUNCTION_MASK:"DIN_FUNCTION_MASK",DOUT_FUNCTION_MASK:"DOUT_FUNCTION_MASK",JACOBIAN_BASED_SPEED_CONTROL:"JACOBIAN_BASED_SPEED_CONTROL",SELF_VIBRATION_MODE:"SELF_VIBRATION_MODE",VIBRATION_MOTION_BASED:"VIBRATION_MOTION_BASED",EXTERNAL_AXIS_SYNC:"EXTERNAL_AXIS_SYNC",TCP_SPEED_BOUND:"TCP_SPEED_BOUND",MOVE_BREAK_BLOCK:"MOVE_BREAK_BLOCK",JOINT_REFERENCE_FILTER:"JOINT_REFERENCE_FILTER",SELF_COLL_DETECT_BLIND:"SELF_COLL_DETECT_BLIND",JOINT_ORIGIN_CALIBRATION:"JOINT_ORIGIN_CALIBRATION",WRIST_SINGULARITY_MODE:"WRIST_SINGULARITY_MODE",OPERATION_RANGE_CHECK:"OPERATION_RANGE_CHECK",EXTFT_SOFTWARE_NULLING:"EXTFT_SOFTWARE_NULLING"},Cwt=[{label:"program.box.out_collision_detection",value:Ft.OUT_COLLISION},{label:"program.box.self_collision_detection",value:Ft.SELF_COLLISION},{label:"program.box.fixed_speed",value:Ft.FIXED_SPEED},{label:"program.box.speed_bar",value:Ft.SPEED_BAR},{label:"program.box.time_constraint",value:Ft.TIME_CONSTRAINT},{label:"program.box.ascii_function_call",value:Ft.ASCII_FUNCTION_CALL},{label:"program.box.joint_impedance_control",value:Ft.JOINT_IMPEDANCE},{label:"program.box.free_drive_mode",value:Ft.FREE_DRIVE},{label:"program.box.master_mode_selection",value:Ft.MASTER_MODE},{label:"program.box.user_frame_selection",value:Ft.USER_FRAME_SELECTION},{label:"program.box.user_frame_set_via_xyz",value:Ft.USER_FRAME_6DOF},{label:"program.box.user_frame_set_via_tcp",value:Ft.USER_FRAME_TCP},{label:"program.box.user_frame_set_via_3_points",value:Ft.USER_FRAME_3POINTS},{label:"program.box.target_shift_set_via_manual",value:Ft.TARGET_SHIFT},{label:"program.box.target_shift_set_via_landmark",value:Ft.TARGET_SHIFT_LANDMARK},{label:"program.box.program_flow_change",value:Ft.PROGRAM_FLOW_MANAGE},{label:"program.box.digital_input_function_mask",value:Ft.DIN_FUNCTION_MASK},{label:"program.box.digital_output_function_mask",value:Ft.DOUT_FUNCTION_MASK},{label:"program.box.jacobian_based_speed_ctrl",value:Ft.JACOBIAN_BASED_SPEED_CONTROL},{label:"program.box.vibration_torque_based",value:Ft.SELF_VIBRATION_MODE},{label:"program.box.vibration_motion_based",value:Ft.VIBRATION_MOTION_BASED},{label:"program.box.ext_axis_sync",value:Ft.EXTERNAL_AXIS_SYNC},{label:"program.box.tcp_speed_bound",value:Ft.TCP_SPEED_BOUND},{label:"program.box.move_break_block",value:Ft.MOVE_BREAK_BLOCK},{label:"program.box.joint_ref_filter",value:Ft.JOINT_REFERENCE_FILTER},{label:"program.box.self_coll_detect_blind",value:Ft.SELF_COLL_DETECT_BLIND},{label:"program.box.joint_origin_calibration",value:Ft.JOINT_ORIGIN_CALIBRATION},{label:"program.box.wrist_singularity_mode",value:Ft.WRIST_SINGULARITY_MODE},{label:"program.box.operation_range_check",value:Ft.OPERATION_RANGE_CHECK},{label:"program.box.ft_sensor_software_nulling",value:Ft.EXTFT_SOFTWARE_NULLING}],{useMemo:Swt}=await F("react"),jI=[{label:"program.options.user_frame.restore_saved",value:0},{label:"program.options.user_frame.apply_target_temporary",value:1},{label:"program.options.user_frame.save_target_permanently",value:2}],Kfe=[{label:"program.options.frame.global",value:0},{label:"program.options.frame.local",value:1},{label:"program.options.frame.user",value:2}],Jfe=({register:i,fieldKeys:e})=>u(U,{className:"w-full flex-1 gap-4",children:e.map(t=>{const n=t.split("_")[1],s=n.includes("r");return x(H,{className:"gap-2",alignItems:"center",children:[x(H,{className:"typo-compact-xs-semibold w-16 gap-1",children:[u("span",{className:xi[n],children:n.toUpperCase()}),u("span",{className:"text-fg-subtle",children:s?" (deg)":" (mm)"})]}),u(ye,{register:i,name:t})]},t)})}),xwt=({className:i,robotModel:e})=>{const{theme:t}=tt(),{t:n}=q(),{userFrameNameList:s}=iL(),a=(ie(g=>g.showItem)?.args).user_frame_6dof,l=Swt(()=>({user_frame_num:a?.user_frame_num??0,setting_option:a?.setting_option??0,target_frame:a?.target_frame??0,target_x:a?.target_x??0,target_y:a?.target_y??0,target_z:a?.target_z??0,target_rx:a?.target_rx??0,target_ry:a?.target_ry??0,target_rz:a?.target_rz??0}),[a]),{control:c,register:d,getValues:h}=he({values:l});return co(Ft.USER_FRAME_6DOF,()=>{const g=h(),m={...g,target_x:Ce(g.target_x),target_y:Ce(g.target_y),target_z:Ce(g.target_z),target_rx:Ce(g.target_rx),target_ry:Ce(g.target_ry),target_rz:Ce(g.target_rz)},f=`User Frame: Set via XYZ - ${s[g.user_frame_num]}, ${n(jI[g.setting_option].label,{lng:"en"})}, Target Frame: ${n(Kfe[g.target_frame].label,{lng:"en"})}, X: ${m.target_x}mm, Y: ${m.target_y}mm, Z: ${m.target_z}mm, RX: ${m.target_rx}deg, RY: ${m.target_ry}deg, RZ: ${m.target_rz}deg`;return{user_frame_6dof:m,treeName:f}}),x(be,{className:P("SetCmdUserFrame6Dof",i),title:n("program.box.user_frame_set_via_xyz"),children:[x($e,{children:[u(G,{label:n("program.field.user_frame"),children:u(oe,{name:"user_frame_num",control:c,render:({field:g})=>u(ae,{...g,className:"w-full",size:"sm",onChange:m=>{g.onChange(He(m.target.value,0))},children:s.map((m,f)=>u(J,{value:f,children:m},m))})})}),u(G,{label:n("program.field.setting_option"),children:u(oe,{name:"setting_option",control:c,render:({field:g})=>u(ae,{...g,className:"w-full",size:"sm",onChange:m=>{g.onChange(He(m.target.value,0))},children:jI.map((m,f)=>u(J,{value:f,children:n(m.label)},m.label))})})})]}),x(G,{label:n("program.field.target_frame"),className:"pr-5",children:[" ",u(oe,{name:"target_frame",control:c,render:({field:g})=>u(ae,{...g,className:"w-[50%]!",size:"sm",onChange:m=>{g.onChange(He(m.target.value,0))},children:Kfe.map((m,f)=>u(J,{value:f,children:n(m.label)},m.label))})})]}),u("div",{className:P("overflow-hidden rounded-md p-3",t!=="light"&&"bg-bg-alt-1"),children:x(H,{className:"grid grid-cols-2 gap-8",children:[u(Jfe,{register:d,fieldKeys:["target_x","target_y","target_z"]}),u(Jfe,{register:d,fieldKeys:["target_rx","target_ry","target_rz"]})]})})]})},{useMemo:Nwt}=await F("react"),SMe=[{label:"program.options.point_order.origin_x_axis_xy_plane",value:0},{label:"program.options.point_order.origin_y_axis_yz_plane",value:1},{label:"program.options.point_order.origin_z_axis_zx_plane",value:2}],Iwt=["x","y","z"],U8=({register:i,fieldKeys:e,groupNum:t})=>{const{t:n}=q();return x(H,{className:"w-full gap-4",alignItems:"center",children:[x("span",{className:"typo-compact-sm-semibold text-fg-default min-w-16 shrink-0",children:[n("program.button.point")," ",t]}),u("div",{className:"flex min-w-0 flex-1 gap-2",children:e.map((s,o)=>{const r=Iwt[o];return x(U,{className:"min-w-0 flex-1 gap-2",alignItems:"center",children:[x(H,{className:"typo-compact-2xs-semibold w-16 gap-1",children:[u("span",{className:xi[r],children:r.toUpperCase()}),u("span",{className:"text-fg-subtle",children:"(mm)"})]}),u(ye,{register:i,name:s})]},s)})})]})},kwt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{userFrameNameList:s}=iL(),a=(ie(g=>g.showItem)?.args).user_frame_3points,l=Nwt(()=>({user_frame_num:He(a?.user_frame_num,0),setting_option:He(a?.setting_option,0),order_option:He(a?.order_option,0),point_1_x:Ce(a?.point_1_x??""),point_1_y:Ce(a?.point_1_y??""),point_1_z:Ce(a?.point_1_z??""),point_2_x:Ce(a?.point_2_x??""),point_2_y:Ce(a?.point_2_y??""),point_2_z:Ce(a?.point_2_z??""),point_3_x:Ce(a?.point_3_x??""),point_3_y:Ce(a?.point_3_y??""),point_3_z:Ce(a?.point_3_z??"")}),[a]),{control:c,getValues:d,register:h}=he({values:l});return co(Ft.USER_FRAME_3POINTS,()=>{const g=d(),m={...g,point_1_x:Ce(g.point_1_x)||0,point_1_y:Ce(g.point_1_y)||0,point_1_z:Ce(g.point_1_z)||0,point_2_x:Ce(g.point_2_x)||0,point_2_y:Ce(g.point_2_y)||0,point_2_z:Ce(g.point_2_z)||0,point_3_x:Ce(g.point_3_x)||0,point_3_y:Ce(g.point_3_y)||0,point_3_z:Ce(g.point_3_z)||0},f=`User Frame: Set via 3 Points - ${s[m.user_frame_num]}, ${t(jI[m.setting_option].label,{lng:"en"})}`;return{user_frame_3points:m,treeName:f}}),x(be,{className:P("SetCmdUserFrame3Points",i),title:t("program.box.user_frame_set_via_3_points"),children:[x($e,{children:[u(G,{label:t("program.field.user_frame"),children:u(oe,{name:"user_frame_num",control:c,render:({field:g})=>u(ae,{...g,className:"w-full",size:"sm",onChange:m=>{g.onChange(Ce(m.target.value))},children:s.map((m,f)=>u(J,{value:f,children:m},m))})})}),u(G,{label:t("program.field.setting_option"),children:u(oe,{name:"setting_option",control:c,render:({field:g})=>u(ae,{...g,className:"w-full",size:"sm",onChange:m=>{g.onChange(Ce(m.target.value))},children:jI.map((m,f)=>u(J,{value:f,children:t(m.label)},m.label))})})})]}),u(G,{label:t("program.field.point_ordering"),className:"pr-5",children:u(oe,{name:"order_option",control:c,render:({field:g})=>u(ae,{...g,className:"w-[50%]!",size:"sm",onChange:m=>{g.onChange(Ce(m.target.value))},children:SMe.map((m,f)=>u(J,{value:f,children:t(m.label)},m.label))})})}),u("div",{className:P("overflow-hidden rounded-md p-3",n!=="light"&&"bg-bg-alt-1"),children:x(U,{className:"w-full gap-8",children:[u(U8,{register:h,fieldKeys:["point_1_x","point_1_y","point_1_z"],groupNum:1}),u(U8,{register:h,fieldKeys:["point_2_x","point_2_y","point_2_z"],groupNum:2}),u(U8,{register:h,fieldKeys:["point_3_x","point_3_y","point_3_z"],groupNum:3})]})})]})},{useMutation:Lwt}=await F("@tanstack/react-query"),Dwt="/{robot_model}/set_userframe_3points",Twt=i=>{const{robot_model:e,...t}=i,n=Dwt.replace("{robot_model}",e);return Dt.post(n,t)},Ewt=()=>Lwt({mutationFn:i=>Twt(i)}),j8=({targetData:i,register:e,onFieldChange:t,onGetCurrentValues:n,errors:s,isDisabled:o,isPending:r,groupNum:a})=>{const{t:l}=q();return x(U,{className:"w-full gap-2",children:[x(H,{className:"w-full",alignItems:"center",justifyContent:"space-between",children:[x("span",{className:"typo-compact-xs-semibold text-fg-default min-w-[3rem] shrink-0",children:[l("program.button.point")," ",a]}),u(se,{className:"self-end px-2",size:"2xs",variant:"outlined",disabled:o,loading:r,onClick:()=>n(a),children:l("move.menu.button.get")})]}),u(H,{className:"gap-1.5",alignItems:"center",children:u("div",{className:"flex min-w-0 flex-1 gap-1",children:i.map(c=>x(U,{className:P("min-w-0 flex-1 gap-1",{"pointer-events-none invisible":!c.label}),alignItems:"center",children:[x(H,{className:"typo-compact-2xs-semibold w-[4rem] gap-1",children:[u("span",{className:xi[c.label],children:c.label.toUpperCase()}),u("span",{className:"text-fg-subtle",children:"(mm)"})]}),u(et,{className:"w-full",size:"xs2",type:"nx-number",inputMode:"text",error:!!dt.get(s,c.fieldKey)?.message,...e(c.fieldKey,{validate:d=>Number.isNaN(Number(d))?"This value is invalid":void 0,onChange:d=>{t(c.fieldKey,d.target.value)}})})]},c.label))})})]})},Pwt=({className:i,tcpRef:e,robotModel:t,isDisabled:n,userFrameNameList:s})=>{const{t:o}=q(),{register:r,setValue:a,watch:l,getValues:c,control:d,trigger:h,formState:{errors:g}}=he({defaultValues:{user3Points:{user_frame_num:0,order_option:0,point_1_x:0,point_1_y:0,point_1_z:0,point_2_x:0,point_2_y:0,point_2_z:0,point_3_x:0,point_3_y:0,point_3_z:0}}}),{mutate:m,isPending:f}=Ewt(),p=l("user3Points.order_option"),_=[{label:"x",fieldKey:"user3Points.point_1_x"},{label:"y",fieldKey:"user3Points.point_1_y"},{label:"z",fieldKey:"user3Points.point_1_z"},{label:"x",fieldKey:"user3Points.point_2_x"},{label:"y",fieldKey:"user3Points.point_2_y"},{label:"z",fieldKey:"user3Points.point_2_z"},{label:"x",fieldKey:"user3Points.point_3_x"},{label:"y",fieldKey:"user3Points.point_3_y"},{label:"z",fieldKey:"user3Points.point_3_z"}],b=async w=>{const y=e?.map(S=>Number(S.toFixed(3)));switch(w){case 1:_.slice(0,3).forEach((S,C)=>{a(S.fieldKey,y[C])});break;case 2:_.slice(3,6).forEach((S,C)=>{a(S.fieldKey,y[C])});break;case 3:_.slice(6).forEach((S,C)=>{a(S.fieldKey,y[C])});break}},v=async()=>{const w=c().user3Points;if(!await h("user3Points",{shouldFocus:!0})){rt.openToast({type:"basic",variant:"warning",title:"Invalid value",content:"Please enter valid values"});return}m({robot_model:t,user_frame_num:Number(w.user_frame_num),order_option:Number(w.order_option),setting_option:2,point_1_x:Number(w.point_1_x),point_1_y:Number(w.point_1_y),point_1_z:Number(w.point_1_z),point_2_x:Number(w.point_2_x),point_2_y:Number(w.point_2_y),point_2_z:Number(w.point_2_z),point_3_x:Number(w.point_3_x),point_3_y:Number(w.point_3_y),point_3_z:Number(w.point_3_z)})};return x(U,{className:P("User3PointsCalibration","w-full gap-2.5",i),children:[u(me,{label:o("program.field.user_frame"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(oe,{control:d,name:"user3Points.user_frame_num",render:({field:w})=>u(ae,{className:"w-full",size:"xs2",value:w.value,onChange:y=>{const S=y.target.value;w.onChange(S.trim()===""?0:Number(S)),a("user3Points.user_frame_num",S.trim()===""?0:Number(S))},children:Array.from({length:8},(y,S)=>u(J,{value:S,children:`User ${S} (${s[S]})`},`user-3points-${S}`))})})}),u(me,{label:o("program.field.point_ordering"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(oe,{control:d,name:"user3Points.order_option",render:({field:w})=>u(ae,{className:"w-full",size:"xs2",value:w.value,onChange:y=>{const S=y.target.value;w.onChange(S.trim()===""?0:Number(S)),a("user3Points.order_option",S.trim()===""?0:Number(S))},children:SMe.map((y,S)=>u(J,{value:S,children:o(y.label)},y.label))})})}),u("div",{className:"flex items-center justify-center",children:u("img",{className:"w-50",src:yt(`nexus/move/calibration/option_${p}.png`)})}),u("div",{className:"bg-bg-raised overflow-hidden rounded-md p-3",children:x(U,{className:"w-full gap-0",children:[u(j8,{targetData:_.slice(0,3),register:r,onFieldChange:a,onGetCurrentValues:b,isDisabled:n,errors:g,isPending:f,groupNum:1}),u(_o,{size:1,thickness:"thin",spaceSize:12}),u(j8,{targetData:_.slice(3,6),register:r,onFieldChange:a,onGetCurrentValues:b,isDisabled:n,errors:g,isPending:f,groupNum:2}),u(_o,{size:1,thickness:"thin",spaceSize:12}),u(j8,{targetData:_.slice(6),register:r,onFieldChange:a,onGetCurrentValues:b,isDisabled:n,errors:g,isPending:f,groupNum:3})]})}),u(se,{className:"typo-compact-xs-semibold w-full",size:"sm",variant:"brand",disabled:n,loading:f,onClick:()=>v(),children:o("program.button.save")})]})},{useMutation:Rwt}=await F("@tanstack/react-query"),Mwt="/{robot_model}/set_userframe_tcp",Awt=i=>{const{robot_model:e,...t}=i,n=Mwt.replace("{robot_model}",e);return Dt.post(n,t)},Owt=()=>Rwt({mutationFn:i=>Awt(i)}),Fwt=({className:i,robotModel:e,isDisabled:t,userFrameNameList:n})=>{const{t:s}=q(),{mutate:o,isPending:r}=Owt(),{setValue:a,getValues:l,control:c}=he({defaultValues:{userTCPFrame:{user_frame_num:0}}}),d=()=>{const h=l().userTCPFrame;o({robot_model:e,user_frame_num:Number(h.user_frame_num),setting_option:2})};return u(U,{className:P("UserTCPCalibration","w-full gap-1",i),children:u(me,{label:s("program.field.user_frame"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:x(H,{className:"w-full gap-1.5",alignItems:"center",children:[u(oe,{control:c,name:"userTCPFrame.user_frame_num",render:({field:h})=>u(ae,{className:"w-full",size:"xs2",value:h.value,onChange:g=>{const m=g.target.value;h.onChange(m.trim()===""?0:Number(m)),a("userTCPFrame.user_frame_num",m.trim()===""?0:Number(m))},children:Array.from({length:8},(g,m)=>u(J,{value:m,children:`User ${m} (${n[m]})`},`user-tcp-${m}`))})}),u(se,{className:"typo-compact-xs-semibold w-20",size:"xs2",variant:"brand",disabled:t,loading:r,onClick:()=>d(),children:s("program.button.save")})]})})})},{useMutation:Bwt}=await F("@tanstack/react-query"),Vwt="/{robot_model}/call_extaxis_calib_{command}",zwt=i=>{const{robot_model:e,command:t,...n}=i,s=Vwt.replace("{robot_model}",e).replace("{command}",t);return Dt.post(s,n)},Wwt=()=>Bwt({mutationFn:zwt}),Hwt=({className:i,robotModel:e,isDisabled:t})=>{const{t:n}=q(),{mutate:s,isPending:o}=Wwt(),{setValue:r,getValues:a,control:l}=he({defaultValues:{externalAxis:{joint_no:0}}}),c=d=>{const h=a().externalAxis.joint_no;s({robot_model:e,command:d,joint_no:Number(h)})};return x(U,{className:P("ExternalAxisCalibration","w-full gap-3",i),children:[u(me,{label:n("move.field.label.jointNumber"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(H,{className:"w-full gap-1.5",alignItems:"center",children:u(oe,{control:l,name:"externalAxis.joint_no",render:({field:d})=>u(ae,{className:"w-full",size:"xs2",value:d.value,onChange:h=>{const g=h.target.value;d.onChange(g.trim()===""?0:Number(g)),r("externalAxis.joint_no",g.trim()===""?0:Number(g))},children:Array.from({length:7},(h,g)=>u(J,{value:g,children:`External Axis ${g}`},`ext-axis-${g}`))})})})}),x(U,{className:"gap-1",children:[u(se,{className:"typo-compact-xs-semibold",size:"xs2",variant:"outlined",disabled:t,loading:o,onClick:()=>c("clr"),children:"Calibration Start"}),u(se,{className:"typo-compact-xs-semibold",size:"xs2",variant:"outlined",disabled:t,loading:o,onClick:()=>c("add"),children:"Calibration Add+"}),u(se,{className:"typo-compact-xs-semibold",size:"xs2",variant:"outlined",disabled:t,loading:o,onClick:()=>c("run"),children:"Calibration Finish"})]})]})},{useMemo:$wt}=await F("react"),Yfe=[{label:"move.menu.options.option.tcpPosCalib",value:"tcp_pos"},{label:"move.menu.options.option.tcpOriCalib",value:"tcp_ori"},{label:"move.menu.options.option.user3Points",value:"user_3points"},{label:"move.menu.options.option.userTCPFrame",value:"user_tcp"},{label:"move.menu.options.option.extAxis",value:"ext_axis"}],Uwt=({className:i,robotModel:e,userFrameNameList:t})=>{const{t:n}=q(),{selectedRobot:s}=Fi(e),{motionMode:o,jointQRef:r,carteXRef:a}=ws(e,p=>({motionMode:p.motionMode,jointQRef:p.jointQRef,carteXRef:p.carteXRef})),{register:l,setValue:c,watch:d,clearErrors:h}=he({defaultValues:{mode:Yfe[0].value}}),g=d("mode"),m=$wt(()=>o!==0||s?.connected==="DISCONNECT",[o,s?.connected]),f=(p,_)=>{c(p,_),h()};return x("div",{className:P("CalibrationControl","h-full px-3",i),children:[u("div",{className:"sticky top-0 z-10",children:u(Ag,{className:"pt-2",subject:n("move.menu.button.label.calibration")})}),x(U,{className:"gap-2 pb-3",children:[u(ae,{className:"w-full",size:"sm",...l("mode",{onChange:p=>f("mode",p.target.value)}),children:Yfe.map(p=>u(J,{value:p.value,children:n(p.label)},p.label))}),g==="tcp_pos"&&u(uwt,{jointRef:r,robotModel:e,isDisabled:m}),g==="tcp_ori"&&u(_wt,{robotModel:e,isDisabled:m}),g==="user_3points"&&u(Pwt,{tcpRef:a,robotModel:e,isDisabled:m,userFrameNameList:t}),g==="user_tcp"&&u(Fwt,{robotModel:e,isDisabled:m,userFrameNameList:t}),g==="ext_axis"&&u(Hwt,{robotModel:e,isDisabled:m})]})]})},{useMemo:aF}=await F("react"),jwt=["translate","rotate","surfaceTeach"],hoe=i=>{const{data:e}=Ph(),t=aF(()=>e?.urdfFileName?.replace(/\.urdf$/,"")??"",[e]),n=aF(()=>e?.components?.[i]?.tcpJointName??[],[e,i]),s=aF(()=>/^rby/i.test(t)?n:void 0,[t,n]),o=aF(()=>TPe(i,e?.components)??void 0,[e,i]),r=(o?.length??0)>=6&&n.length>0,a=/^rby/i.test(t)&&n.length===0&&(o?.length??0)>0;return{detailRobotModel:t,tcpJointNames:n,ghostActiveTcpAnchors:s,ghostDraggableJointNames:o,isGhostRobotSupported:r,isJointOnlyGhost:a,disabledGizmoTypes:a?jwt:void 0}},{useCallback:Xfe,useState:AD}=await F("react"),goe=()=>{const[i,e]=AD(!1),[t,n]=AD("translate"),[s,o]=AD("local"),[r,a]=AD(.7),[l,c]=AD({x:!0,y:!0,z:!0}),d=Xfe((g,m)=>{c(f=>({...f,[g]:m}))},[]),h=Xfe(g=>{n(m=>m===g?"none":g)},[]);return{isGhostRobot:i,setIsGhostRobot:e,gizmoType:t,handleGizmoTypeChange:h,gizmoSpace:s,setGizmoSpace:o,gizmoSize:r,setGizmoSize:a,axisEnabled:l,handleAxisEnabledChange:d}},{useCallback:Gwt,useState:qwt}=await F("react"),moe=i=>{const[e,t]=qwt(),n=Gwt(s=>t(s),[]);return{ghostJointValues:i?e:void 0,handleGhostRobotJointsChanged:n}},{useCallback:Kwt}=await F("react"),foe=({gizmo:i,ghostRobotIK:e,isMoving:t,gizmoType:n=i.gizmoType,onGizmoTypeChange:s=i.handleGizmoTypeChange,activeTcpAnchors:o,draggableJointNames:r,onGhostRobotJointsChanged:a})=>{const{setIsGhostRobot:l}=i,{handleGhostRobotChange:c}=e,d=Kwt(h=>{l(h),c(h)},[l,c]);return{viewerProps:{showGhostRobot:i.isGhostRobot,ghostRobotTcpOffset:e.ghostRobotTcpOffset,ghostRobotIkOptions:e.ghostRobotIkOptions,ghostRobotActiveTcpAnchors:o,ghostRobotDraggableJointNames:r,ghostRobotGizmoType:n,ghostRobotGizmoSpace:i.gizmoSpace,ghostRobotGizmoSize:i.gizmoSize,ghostRobotAxisEnabled:i.axisEnabled,onIKDragMove:e.handleIKDragMove,onRobotDraggingChanged:e.handleRobotDraggingChanged,onGhostRobotJointsChanged:a},itemProps:{isMoving:t,isGhostRobot:i.isGhostRobot,onGhostRobotChange:d,gizmoType:n,onGizmoTypeChange:s,gizmoSpace:i.gizmoSpace,onGizmoSpaceChange:i.setGizmoSpace,gizmoSize:i.gizmoSize,onGizmoSizeChange:i.setGizmoSize,axisEnabled:i.axisEnabled,onAxisEnabledChange:i.handleAxisEnabledChange,onReset:e.handleGhostRobotReset,onUndo:e.handleGhostRobotUndo,canUndo:e.canUndo,onRedo:e.handleGhostRobotRedo,canRedo:e.canRedo}}},{useCallback:G8,useLayoutEffect:Jwt,useMemo:Qfe,useState:lF}=await F("react"),Ywt=({urdfViewerRef:i,isGhostRobot:e,gizmoType:t})=>{const{t:n}=q(),[s,o]=lF(!1),[r,a]=lF("free"),[l,c]=lF(!1),[d,h]=lF(!0),g=G8(()=>{rt.openToast({type:"basic",variant:"warning",title:"Warning",content:n("move.ghostRobot.surface.unreachable")})},[n]),m=G8(()=>{if(!e||t!=="surfaceTeach")return;const w=i.current?.getSurfaceFeatureSupport()??!1;c(w),i.current?.setSurfaceTeachFilter(r)},[e,t,r,i]);Jwt(()=>{if(!e||t!=="surfaceTeach"){c(!1);return}m()},[e,t,m]);const f=G8(w=>{a(w),i.current?.setSurfaceTeachFilter(w)},[i]),p=e&&t==="surfaceTeach"&&r==="cylinder",_=p&&d,b=Qfe(()=>({onSurfaceTeachAvailableChange:o,surfaceTeachFilter:r,surfaceTeachShowRings:_,onSurfaceTeachUnreachable:g}),[r,_,g]),v=Qfe(()=>({surfaceTeachAvailable:s,surfaceFilter:r,onSurfaceFilterChange:f,surfaceFeatureSupport:l,surfaceShowRings:_,surfaceShowRingsAvailable:p,onSurfaceShowRingsChange:h}),[s,r,f,l,_,p]);return{viewerProps:b,itemProps:v,handleCheckFeatureSupport:m}},KS=({className:i,title:e,currentSignal:t,functionSignal:n,targetSignal:s,onClick:o,onPreview:r})=>{const{t:a}=q(),l=c=>{n&&n[c]!==0||o(c)};return x(U,{className:P("MoveDigitalIOSignal","gap-2.5",i),children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:e}),u(me,{label:a("move.menu.title.currentSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(H,{className:"grid grid-cols-16 gap-1",children:Array.from({length:16}).map((c,d)=>x(U,{className:"w-full gap-1",alignContent:"center",children:[u("span",{className:"typo-compact-xs-medium text-fg-subtler text-center",children:d}),u("div",{className:P("size-3 self-center rounded-[50%]",{"bg-fg-subtler":t[d]===-1,"bg-fg-danger":t[d]===0,"bg-fg-success":t[d]===1})})]},`${e}-curr-${d}`))})}),s&&u(me,{label:a("move.menu.title.targetSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:x(U,{className:"gap-2.5",children:[u(H,{className:"grid grid-cols-16 gap-1",children:Array.from({length:16}).map((c,d)=>u(se,{className:P("size-3 justify-self-center rounded-[50%] border-none !p-0",{"bg-fg-subtler":s[d]===-1,"bg-fg-danger":s[d]===0,"bg-fg-success":s[d]===1,"pointer-none bg-fg-caution":n&&n[d]!==0},{"hover:bg-fg-subtler/80":s[d]===-1,"hover:bg-fg-danger/80":s[d]===0,"hover:bg-fg-success/80":s[d]===1,"pointer-none bg-fg-caution":n&&n[d]!==0}),onClick:()=>l(d),children:""},`${e}-editable-${d}`))}),u(se,{className:"w-25 self-end",size:"xs2",leadingIcon:u(at,{className:"size-4"}),variant:"outlined",onClick:r,children:a("program.button.preview")})]})})]})},{useMutation:Xwt}=await F("@tanstack/react-query"),Qwt=async i=>{const{robot_model:e,location:t,...n}=i,s=`/${e}/call_multiple_${t}_aout`;return await Dt.post(s,n)},xMe=()=>Xwt({mutationFn:async i=>Qwt(i)}),OD=({className:i,title:e,currentSignal:t,targetSignal:n,onChange:s,onPreview:o,isChecked:r,onCheckedChange:a})=>{const{t:l}=q();return x(U,{className:P("MoveAnalogIOSignal","gap-2.5",i),children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:e}),u(me,{label:l("move.menu.title.currentSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(H,{className:"grid grid-cols-4 gap-1",children:t.map((c,d)=>x(U,{alignItems:"flex-start",justifyContent:"center",className:"w-full gap-1",children:[u("span",{className:"typo-compact-xs-medium text-fg-subtle w-full shrink-0 px-1 text-center",children:d}),u(et,{size:"xs2",className:"w-full",value:c.toFixed(1),readOnly:!0})]},`${e}-curr-${d}`))})}),n&&u(me,{label:l("move.menu.title.targetSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:x(U,{className:"gap-2.5",children:[u(H,{className:"grid grid-cols-4 gap-1",children:Array.from({length:4}).map((c,d)=>{const h=r[d];return x(U,{className:"w-full gap-1",justifyContent:"center",alignItems:"center",children:[u(et,{size:"xs2",className:"w-full",type:"nx-number",value:n[d]===-1?"":n[d],disabled:!r[d],onChange:g=>s(g,d)}),u(ia,{size:"sm",checkValue:!0,value:h,handleChange:g=>{a(!!g,d)}})]},`${e}-editable-${d}`)})}),u(se,{className:"w-25 self-end",size:"xs2",leadingIcon:u(at,{className:"size-4"}),variant:"outlined",onClick:o,children:l("program.button.preview")})]})})]})},{useMemo:Zfe,useState:q8}=await F("react"),epe=[{label:"move.menu.tab.lable.controlBox",value:"cb"},{label:"settings.menu.title.tool",value:"tool"},{label:"move.menu.tab.lable.extBoard",value:"ext"}],Hp=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],JS=[-1,-1,-1,-1],Zwt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{cboxDigitalInput:s,cboxDigitalOutput:o,cboxAnalogInput:r,cboxAnalogOutput:a,toolDigitalInput:l,toolDigitalOutput:c,toolAnalogInput:d,toolVoltageOutput:h,exDigitalInput:g,exDigitalOutput:m,exAnalogInput:f,exAnalogOutput:p}=ws(e,_e=>({cboxDigitalInput:_e.cboxDigitalInput,cboxDigitalOutput:_e.cboxDigitalOutput,cboxAnalogInput:_e.cboxAnalogInput,cboxAnalogOutput:_e.cboxAnalogOutput,toolDigitalInput:_e.toolDigitalInput,toolDigitalOutput:_e.toolDigitalOutput,toolAnalogInput:_e.toolAnalogInput,toolVoltageOutput:_e.toolVoltageOutput,exDigitalInput:_e.exDigitalInput,exDigitalOutput:_e.exDigitalOutput,exAnalogInput:_e.exAnalogInput,exAnalogOutput:_e.exAnalogOutput})),{data:_}=Ou({robot_model:e}),{mutate:b}=Kse(),{mutate:v}=xMe(),{mutate:w}=ZPe(),{mutate:y}=QPe(),[S,C]=q8(epe[0].value),{control:N,setValue:k,getValues:L}=he({defaultValues:{cbTargetDout:Hp,cbTargetAout:JS,toolTargetDout:Hp,toolTargetVoltage:-1,extTargetDout:Hp,extTargetAout:JS}}),D=Ul({control:N,name:"cbTargetDout"}),T=Ul({control:N,name:"cbTargetAout"}),E=Ul({control:N,name:"toolTargetDout"}),R=Ul({control:N,name:"toolTargetVoltage"}),A=Ul({control:N,name:"extTargetDout"}),M=Ul({control:N,name:"extTargetAout"}),[O,B]=q8(T.map(_e=>_e!==-1)),[z,Y]=q8(M.map(_e=>_e!==-1)),$=Zfe(()=>({cbFunctionDout:_?.doutSpecialFunc?.b??Array(16).fill(0),cbFunctionDin:_?.dinSpecialFunc?.b??Array(16).fill(0),extFunctionDout:_?.eoutSpecialFunc?.b??Array(16).fill(0),extFunctionDin:_?.einSpecialFunc?.b??Array(16).fill(0)}),[_]),Z=Zfe(()=>({cbCurrDin:s?.u??Hp,cbCurrDout:o?.u??Hp,cbCurrAin:r?.f??JS,cbCurrAout:a?.f??JS,toolCurrDin:l?.u??Hp,toolCurrDout:c?.u??Hp,toolCurrAin:d?.f??[-1,-1],toolCurrVoltage:h??-1,extCurrDin:g?.u??Hp,extCurrDout:m?.u??Hp,extCurrAin:f?.f??JS,extCurrAout:p?.f??JS}),[o?.u,s?.u,r?.f,a?.f,l?.u,c?.u,d?.f,h,g?.u,m?.u,f?.f,p?.f]),K=(_e,Le)=>{B(Ie=>{const Te=[...Ie];return Te[Le]=_e,Te}),k(`cbTargetAout.${Le}`,_e?Z.cbCurrAout[Le]:-1)},V=(_e,Le)=>{Y(Ie=>{const Te=[...Ie];return Te[Le]=_e,Te}),k(`extTargetAout.${Le}`,_e?Z.extCurrAout[Le]:-1)},fe=(_e,Le)=>{b({robot_model:e,location:_e,side_dout_args:OB(Le)})},Q=_e=>{w({robot_model:e,flange_dout_args:OB(_e)})},re=_e=>{y({robot_model:e,desired_voltage:_e})},ve=(_e,Le,Ie)=>{const Te=Le.reduce((lt,it,Ct)=>(Ie[Ct]&&lt.push({port_num:Ct,desired_voltage:Number(it.toFixed(1))}),lt),[]);v({robot_model:e,location:_e,side_aout_args:Te})};return u("div",{className:P("ManipulateIOControl","h-full",i),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:t("settings.menu.title.io")}),x(bA,{defaultValue:S,className:"flex h-full gap-0",children:[u("div",{className:"h-full flex-1 overflow-y-auto",children:u("div",{className:"sticky top-0 left-0 z-[2] mb-2.5",children:u("div",{children:u(vA,{className:P("h-7 w-full rounded-md border-none",n==="light"?"bg-fill-navy-subtlest":"bg-fill-subtlest"),children:epe.map((_e,Le)=>u(yA,{value:_e.value,className:P("typo-compact-xs2-medium rounded",n==="light"?["text-fg-subtle","data-[state=active]:bg-fill-navy","data-[state=active]:text-white"]:["text-fg-subtle","data-[state=active]:bg-fill-subtler","data-[state=active]:text-fg-default"]),onClick:()=>{C(_e.value)},children:t(_e.label)},Le))})})})}),u(ZC,{value:"cb",className:"w-full",children:x(U,{className:"gap-2.5",children:[u(KS,{title:t("move.menu.label.digitalInput",{loc:t("program.options.d.output_location.side")}),currentSignal:Z.cbCurrDin,functionSignal:$.cbFunctionDin}),u(oe,{control:N,name:"cbTargetDout",render:({field:_e})=>u(KS,{title:t("move.menu.label.digitalOutput",{loc:t("program.options.d.output_location.side")}),currentSignal:Z.cbCurrDout,functionSignal:$.cbFunctionDout,targetSignal:D,onClick:Le=>{const Ie=[..._e.value];Ie[Le]=o4[_e.value[Le]],k("cbTargetDout",Ie,{shouldDirty:!0,shouldValidate:!0})},onPreview:()=>{const Le=L();fe("side",Le.cbTargetDout)}})}),u(_o,{}),u(OD,{title:t("move.menu.label.analogInput",{loc:t("program.options.d.output_location.side")}),currentSignal:Z.cbCurrAin}),u(oe,{control:N,name:"cbTargetAout",render:({field:_e})=>u(OD,{title:t("move.menu.label.analogOutput",{loc:t("program.options.d.output_location.side")}),currentSignal:Z.cbCurrAout,targetSignal:T,isChecked:O,onCheckedChange:K,onChange:(Le,Ie)=>{const Te=Le.target.value,lt=Te.trim()===""?-1:Number(Te),it=[..._e.value||[]];it[Ie]=lt,_e.onChange(it)},onPreview:()=>{const Le=L();ve("side",Le.cbTargetAout,O)}})})]})}),u(ZC,{value:"tool",className:"w-full",children:x(U,{className:"gap-2.5",children:[u(KS,{title:t("move.menu.label.digitalInput",{loc:t("settings.menu.title.tool")}),currentSignal:Z.toolCurrDin}),u(oe,{control:N,name:"toolTargetDout",render:({field:_e})=>u(KS,{title:t("move.menu.label.digitalOutput",{loc:t("settings.menu.title.tool")}),currentSignal:Z.toolCurrDout,targetSignal:E,onClick:Le=>{const Ie=[..._e.value];Ie[Le]=o4[_e.value[Le]],k("toolTargetDout",Ie,{shouldDirty:!0,shouldValidate:!0})},onPreview:()=>{const Le=L();Q(Le.toolTargetDout)}})}),u(_o,{}),u(OD,{title:t("move.menu.label.analogInput",{loc:t("settings.menu.title.tool")}),currentSignal:Z.toolCurrAin}),x(U,{className:"gap-2.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:`${t("move.menu.label.toolVoltageOutput")} (V)`}),u(me,{label:t("move.menu.title.currentSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(et,{size:"xs2",className:"w-[calc(100%-104px)]",value:Z.toolCurrVoltage,readOnly:!0})}),u(me,{label:t("move.menu.title.targetSignal"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:x(H,{className:"gap-1",children:[u(oe,{control:N,name:"toolTargetVoltage",render:({field:_e})=>u(ae,{className:"flex-1",size:"xs2",value:_e.value,onChange:_e.onChange,children:AB.map(Le=>u(J,{value:Le.value,children:Le.label},Le.value))})}),u(se,{className:"w-25 self-end",size:"xs2",leadingIcon:u(at,{className:"size-4"}),variant:"outlined",onClick:()=>re(R),children:t("program.button.preview")})]})})]})]})}),u(ZC,{value:"ext",className:"w-full",children:x(U,{className:"gap-2.5",children:[u(KS,{title:t("move.menu.label.digitalInput",{loc:t("program.options.d.output_location.ext")}),currentSignal:Z.extCurrDin,functionSignal:$.extFunctionDin}),u(oe,{control:N,name:"extTargetDout",render:({field:_e})=>u(KS,{title:t("move.menu.label.digitalOutput",{loc:t("program.options.d.output_location.ext")}),currentSignal:Z.extCurrDout,functionSignal:$.extFunctionDout,targetSignal:A,onClick:Le=>{const Ie=[..._e.value];Ie[Le]=o4[_e.value[Le]],k("extTargetDout",Ie,{shouldDirty:!0,shouldValidate:!0})},onPreview:()=>{const Le=L();fe("ext",Le.extTargetDout)}})}),u(_o,{}),u(OD,{title:t("move.menu.label.analogInput",{loc:t("program.options.a.output_location.ext")}),currentSignal:Z.extCurrAin}),u(oe,{control:N,name:"extTargetAout",render:({field:_e})=>u(OD,{title:t("move.menu.label.analogOutput",{loc:t("program.options.a.output_location.ext")}),currentSignal:Z.extCurrAout,targetSignal:M,isChecked:z,onCheckedChange:V,onChange:(Le,Ie)=>{const Te=Le.target.value,lt=Te.trim()===""?-1:Number(Te),it=[..._e.value||[]];it[Ie]=lt,_e.onChange(it)},onPreview:()=>{const Le=L();ve("ext",Le.extTargetAout,z)}})})]})})]})]})})},{useMemo:eCt}=await F("react"),tCt=({className:i,robotModel:e,mode:t="real",onChangeMode:n})=>{const{t:s}=q(),{selectedRobot:o}=Fi(e),{theme:r}=tt(),a=eCt(()=>o?.connected==="DISCONNECT",[o]),l=c=>{n(c)};return x("div",{className:P("MoveControlModeSwitch","bg-bg-alt-1 inline-flex w-fit gap-1 rounded-md p-1","[&_button]:typo-compact-xs-medium [&_button]:bg-fill-transparent [&_button]:h-5 [&_button]:min-w-[4.125rem] [&_button]:rounded-sm [&_button]:px-1.5 [&_button]:py-0.5 [&_button]:text-white",i),children:[u(se,{className:P({"!bg-fill-navy":t==="real",[r==="light"&&"!text-fg-subtlest"]:t!=="real"}),variant:"transparent",disabled:a,onClick:()=>l("real"),children:s("move.button.label.real")}),u(se,{className:P({[r==="light"&&"!text-fg-subtlest"]:t!=="simulation",[r==="light"?"!bg-orange-500":"!bg-fill-subtler"]:t==="simulation",[r==="light"&&"!bg-orange-200"]:a&&t==="simulation"}),variant:"transparent",disabled:a,onClick:()=>l("simulation"),children:s("move.button.label.simulation")})]})},{useMemo:tpe}=await F("react"),NMe=({className:i,robotModel:e,isShowEdit:t=!0,size:n="md"})=>{const{t:s}=q(),{isUseSimulator:o}=ui(),{modal:r}=Vi(),{selectedRobot:a}=Fi(e),{toolName:l,motionMode:c}=ws(e,f=>({toolName:f?.toolName,motionMode:f?.motionMode})),{data:d}=uw({robot_model:e}),h=tpe(()=>c!==0,[c]),g=tpe(()=>{const f=Object.values(d??[]),p=f.findIndex(_=>_.toolName===l);return p!==-1?{...f[p],toolNumber:p}:null},[l,d]),m=()=>{r({component:sMe,props:{robotModel:e,selectedToolNumber:g?.toolNumber,isUseSimulator:o}})};return u("div",{className:P("TCPToolInfo","w-fit",i),children:x(H,{className:P("gap-1.5",{"typo-compact-xs2-medium":n==="md","typo-compact-2xs-medium":n==="sm"}),inline:!0,alignItems:"center",children:[u("span",{className:"text-fg-subtle",children:`${s("move.menu.button.label.tcpTool")}: `}),u("span",{className:"text-fg-default",children:g?`Tool ${g.toolNumber} (${g.toolName})`:"-"}),t&&u(Yt,{"data-testId":"tcp-tool-select-button",className:"ml-0.5",variant:"transparent",size:"sm",disabled:a?.connected==="DISCONNECT"||h,onClick:m,children:u(Oie,{})})]})})},{useMemo:npe}=await F("react"),IMe=({className:i,robotModel:e,isShowEdit:t=!0,size:n="md"})=>{const{t:s}=q(),{modal:o}=Vi(),{selectedRobot:r}=Fi(e),{userfSelectionNo:a,motionMode:l}=ws(e,m=>({userfSelectionNo:m?.userfSelectionNo,motionMode:m?.motionMode})),{data:c}=Xk({robot_model:e}),d=npe(()=>l!==0,[l]),h=npe(()=>c?.user_frames[a]?.userfName,[c,a]),g=()=>{o({component:OPe,props:{robotModel:e,selectedUserFrameNumber:a}})};return u("div",{className:P("UserFrameInfo","w-fit",i),children:x(H,{className:P("gap-1.5",{"typo-compact-xs2-medium":n==="md","typo-compact-2xs-medium":n==="sm"}),inline:!0,alignItems:"center",children:[u("span",{className:"text-fg-subtle",children:`${s("program.options.coordinate.user_space")}: `}),u("span",{className:"text-fg-default",children:c?`User ${a} (${h})`:"-"}),t&&u(Yt,{"data-testId":"user-frame-select-button",className:"ml-0.5",variant:"transparent",size:"sm",disabled:r?.connected==="DISCONNECT"||d,onClick:g,children:u(Oie,{})})]})})},{useCallback:nCt,useState:qB}=await F("react"),iCt=({className:i,isDrawTrajectory:e,maxAgeSeconds:t,onDrawTrajectoryChange:n})=>{const{t:s}=q(),o=e!==void 0,[r,a]=qB(!1),l=o?e:r,[c,d]=qB(t??""),h=f=>{d(f)},g=()=>{const f=Number(c);if(isNaN(f)||!f){d("");return}n?.({maxAgeSeconds:f}),d(f)},m=nCt(f=>{o||a(f),n?.({isDrawTrajectory:f})},[o,n]);return x(G9,{className:P("DrawTrajectoryController gap-2 px-3 py-2.5",i),children:[x(H,{className:"text-fg-default typo-compact-xs-semibold gap-1",alignItems:"center",justifyContent:"space-between",children:[u("p",{className:"typo-compact-xs-semibold text-fg-default",children:"Trajectory Drawing"}),u(tr,{className:"mx-1",checked:l,onCheckedChange:m})]}),x("div",{className:"text-fg-subtle typo-compact-xs-normal grid w-full grid-cols-[1fr_auto] items-center gap-x-1 gap-y-0.5",children:[u(et,{className:P("w-50"),size:"xs2",type:"nx-number",useSetButton:!0,hideBtnReset:!0,disabled:!l,value:c??0,handleChange:h,onBlur:g}),u("span",{className:"typo-compact-xs-semibold",children:s("common.unit.seconds")}),u("p",{className:"typo-compact-2xs-normal col-span-2",children:s("move.trajectory.description")})]})]})},kMe=({handleChangeDrawTrajectory:i})=>{const{t:e}=q(),[t,n]=qB(!1),[s,o]=qB(""),r=a=>{a.isDrawTrajectory!==void 0&&n(a.isDrawTrajectory),a.maxAgeSeconds!==void 0&&o(a.maxAgeSeconds),i(a)};return u(j9,{id:"trajectory-tooltip",label:e("move.panel.trajectory"),icon:u(zJe,{className:"relative z-10 h-4 w-4"}),isActive:t,children:u(iCt,{isDrawTrajectory:t,maxAgeSeconds:s,onDrawTrajectoryChange:r})})},sCt=[{id:"center",labelKey:"move.measure.mode.center"},{id:"min",labelKey:"move.measure.mode.min"}],oCt=({label:i,ariaLabel:e,emptyPrompt:t,assetId:n,name:s,onDeselect:o,disabled:r})=>{const{slotBgCls:a}=hw();return x(U,{className:"gap-1",children:[u("p",{className:"typo-compact-2xs-semibold text-fg-disabled",children:i}),n?x(H,{alignItems:"center",justifyContent:"space-between",className:P("border-border-subtle gap-1.5 rounded border px-2 py-1.5",a),children:[u(AKe,{className:"text-fg-subtle size-3.5 shrink-0"}),u("span",{className:"typo-compact-xs-medium text-fg-default min-w-0 flex-1 truncate",children:s}),u("button",{type:"button","aria-label":e,disabled:r,onClick:()=>o(n),className:"text-fg-subtle hover:text-fg-default disabled:text-fg-disabled cursor-pointer rounded p-0.5 transition-colors disabled:cursor-not-allowed",children:u(Eje,{className:"size-3.5"})})]}):u("div",{className:"border-border-subtle text-fg-disabled typo-compact-2xs-normal flex items-center justify-center rounded border border-dashed px-2 py-1.5 text-center",children:t})]})},rCt=({isMeasureActive:i,onMeasureActiveChange:e,selectedAssetIds:t=[],onDeselectAsset:n,measureMode:s,onMeasureModeChange:o,measureResult:r,onReset:a,getAssetName:l,labelScale:c,onLabelScaleChange:d,className:h,disabled:g=!1})=>{const{t:m}=q(),f=p=>l?.(p)||p;return x(G9,{className:P("MeasureDistanceController",h),children:[x(H,{alignItems:"center",justifyContent:"space-between",className:"px-3 pt-2.5 pb-2",children:[x(U,{className:"gap-0.5",children:[u("p",{className:"typo-compact-xs-semibold text-fg-default",children:m("move.measure.title")}),u("p",{className:"typo-compact-2xs-normal text-fg-subtle",children:m("move.measure.activate")})]}),u(tr,{className:"ml-2 shrink-0",checked:i,disabled:g,onCheckedChange:e})]}),u($f,{children:u(U,{className:"gap-2",children:[{label:m("move.measure.target1"),emptyPrompt:m("move.measure.selectFirstPrompt")},{label:m("move.measure.target2"),emptyPrompt:m("move.measure.selectSecondPrompt")}].map(({label:p,emptyPrompt:_},b)=>{const v=t[b];return u(oCt,{label:p,ariaLabel:`${p} ${m("common.button.cancel")}`,emptyPrompt:_,assetId:v,name:v?f(v):"",onDeselect:n,disabled:g},b)})})}),i&&u($f,{children:u(FPe,{options:sCt.map(({id:p,labelKey:_})=>({id:p,label:m(_)})),value:s,onChange:p=>o(p),disabled:g})}),i&&u($f,{children:x(U,{className:"gap-1.5",children:[x(H,{alignItems:"center",justifyContent:"space-between",children:[u("p",{className:"typo-compact-2xs-semibold text-fg-subtle",children:"Label Size"}),u("span",{className:"typo-compact-2xs-normal text-fg-subtle w-8 shrink-0 text-right",children:c.toFixed(1)})]}),u(Ms,{className:"w-full",min:fPe,max:pPe,step:.1,value:[c],disabled:g,onValueChange:([p])=>d(p)})]})}),i&&t.length>=2&&r&&u($f,{children:x(U,{className:"gap-0.5",children:[u("span",{className:"typo-compact-2xs-semibold text-fg-subtle",children:m(s==="min"?"move.measure.mode.min":"move.measure.mode.center")}),x("span",{className:"typo-compact-md-semibold text-fg-default font-bold",children:[r.distance.toFixed(2)," mm"]})]})}),u($f,{children:u(se,{size:"xs",variant:"outlined",className:"w-full",disabled:g||t.length===0,onClick:a,leadingIcon:u(BJe,{className:"size-3.5"}),children:m("move.measure.reset")})})]})},aCt=({isMoving:i,isMeasureActive:e,onMeasureActiveChange:t,selectedAssetIds:n,onDeselectAsset:s,measureMode:o,onMeasureModeChange:r,measureResult:a,onReset:l,getAssetName:c,labelScale:d,onLabelScaleChange:h,className:g})=>{const{t:m}=q();return u(j9,{id:"measure-distance-tooltip",label:m("move.panel.measureDistance"),icon:u(jDe,{className:"relative z-10 h-4 w-4"}),isActive:e,disabled:i,anchorToPanelTop:!0,children:u(rCt,{isMeasureActive:e,onMeasureActiveChange:t,selectedAssetIds:n,onDeselectAsset:s,measureMode:o,onMeasureModeChange:r,measureResult:a,onReset:l,getAssetName:c,labelScale:d,onLabelScaleChange:h,className:g,disabled:i})})},{useCallback:ipe,useMemo:lCt,useRef:cCt,useState:dCt}=await F("react"),LMe=()=>{const[i,e]=dCt(!1),t=cCt(null),n=ipe(o=>{t.current=o},[]),s=ipe(o=>{t.current?.(o)},[]);return lCt(()=>({isActive:i,setIsActive:e,onPick:s,setPickHandler:n}),[i,s,n])},{useCallback:YS,useEffect:cF,useRef:uCt,useState:dF}=await F("react"),hCt=1e3,gCt=i=>i?i.replace(/^(?:base|tool):/,"").replace(/^local:/,""):"",mCt=({urdfViewerRef:i,baseAssets:e=[],toolAssets:t=[],picker:n})=>{const s=LMe(),o=n??s,{isActive:r,setIsActive:a}=o,[l,c]=dF([]),[d,h]=dF("center"),[g,m]=dF(null),[f,p]=dF(H9),_=YS(k=>{p(k),i.current?.setMeasureLabelScale(k)},[i]),b=uCt(!1),v=YS(k=>{k&&c(L=>L.includes(k)?L.filter(D=>D!==k):L.length>=2?[L[L.length-1],k]:[...L,k])},[]),{setPickHandler:w}=o;cF(()=>(w(v),()=>w(null)),[w,v]);const y=YS(k=>{c(L=>L.filter(D=>D!==k))},[]),S=YS(()=>{c([]),m(null),i.current?.clearMeasureDistance(),r&&i.current?.setSelectedAssetIds([],!0)},[i,r]),C=YS(k=>{r&&m(k)},[r]),N=YS(k=>{const L=e.find(D=>D.id===k)??t.find(D=>D.id===k);return L?.displayName?.trim()?L.displayName:gCt(k)},[e,t]);return cF(()=>{if((e.length>0||t.length>0)&&(b.current=!0),!b.current)return;const k=window.setTimeout(()=>{const L=new Set([...e.map(D=>D.id),...t.map(D=>D.id)]);c(D=>{const T=D.filter(E=>L.has(E));return T.length===D.length?D:T})},hCt);return()=>window.clearTimeout(k)},[e,t]),cF(()=>{const k=i.current;if(k?.setMeasureDistanceActive(r),!!r)return()=>{k?.setSelectedAssetIds([],!1),k?.clearAssetSelection?.(),c([]),m(null)}},[r,i]),cF(()=>{if(!r)return;const k=i.current;k?.setSelectedAssetIds(l,!0),l.length===2?m(k?.setMeasureDistanceTargets(l,d)??null):(k?.clearMeasureDistance(),m(null))},[r,l,d,i]),{isMeasureActive:r,setIsMeasureActive:a,selectedAssetIds:l,measureMode:d,setMeasureMode:h,measureResult:g,labelScale:f,setLabelScale:_,handleSelectAsset:v,handleDeselectAsset:y,handleReset:S,handleMeasureResultChange:C,getAssetName:N}},{useMemo:fCt}=await F("react"),pCt=(i,e)=>{const{isMeasureActive:t,setIsMeasureActive:n,selectedAssetIds:s,handleDeselectAsset:o,measureMode:r,setMeasureMode:a,measureResult:l,handleReset:c,getAssetName:d,handleMeasureResultChange:h,labelScale:g,setLabelScale:m}=i;return fCt(()=>({viewerProps:{onMeasureResultChange:h},itemProps:{isMoving:e,isMeasureActive:t,onMeasureActiveChange:n,selectedAssetIds:s,onDeselectAsset:o,measureMode:r,onMeasureModeChange:a,measureResult:l,onReset:c,getAssetName:d,labelScale:g,onLabelScaleChange:m}}),[e,t,n,s,o,r,a,l,c,d,h,g,m])},{memo:_Ct,useMemo:bCt}=await F("react"),vCt=({className:i,mode:e,onModeChange:t,modes:n})=>{const{t:s}=q(),o=bCt(()=>{const r=Aqe.map(l=>{const c=l.id==="move"?"translate":l.id;return{id:c,icon:l.icon,label:s(`move.workspace.properties.${c}`)}});return[n?r.filter(l=>n.includes(l.id)):r]},[s,n]);return u(TDe,{className:i,selectedTool:e,onToolChange:t,toolGroups:o})},yCt=_Ct(vCt),{useMutation:wCt}=await F("@tanstack/react-query"),CCt="/{robot_model}/set_master_mode",SCt=async i=>{const{robot_model:e,...t}=i,n=CCt.replace("{robot_model}",e),s=await Dt.post(n,t);if(s.returnValue)throw Error(`[Error] error Return value: ${s.returnValue}`);return s},xCt=()=>wCt({mutationFn:async i=>SCt(i)}),K8={STOP:0,MODE_J:1,MODE_L:2},NCt=({robotModel:i,className:e})=>{const{t}=q(),{theme:n}=tt(),{selectedRobot:s}=Fi(i),{mutate:o,isPending:r}=xCt(),a=n==="light"?"brand":"soft",l=s?.connected==="DISCONNECT",c=d=>{o({robot_model:i,mode:d})};return u("div",{className:P("ManipulateMasterControl","h-full",e),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:t("move.menu.button.label.masterMode")}),x(U,{className:P("gap-2","[&_button>span]:typo-compact-xs-semibold"),children:[x("div",{className:"grid grid-cols-2 gap-2",children:[u(se,{className:"w-full",variant:a,size:"sm",disabled:l,loading:r,onClick:()=>c(K8.MODE_J),children:t("move.menu.button.label.master.modeJ")}),u(se,{className:"w-full",variant:a,size:"sm",disabled:l,loading:r,onClick:()=>c(K8.MODE_L),children:t("move.menu.button.label.master.modeL")})]}),u(se,{className:"w-full",variant:a,size:"sm",disabled:l,loading:r,onClick:()=>c(K8.STOP),children:t("move.menu.button.label.master.stop")})]})]})})},vv=i=>e=>e[i],hf=(i,e)=>t=>t[i]?.[e]??NaN,kJ=(i,e)=>t=>{const n=t[i];return n?("u"in n?n.u:n.f)[e]??NaN:NaN},J8=[{key:"x",label:"X",field:"X"},{key:"y",label:"Y",field:"Y"},{key:"z",label:"Z",field:"Z"},{key:"rx",label:"RX",field:"Rx"},{key:"ry",label:"RY",field:"Ry"},{key:"rz",label:"RZ",field:"Rz"},{key:"aa",label:"AA",field:"AA"}],spe=[{key:"x",label:"X",field:"X"},{key:"y",label:"Y",field:"Y"},{key:"z",label:"Z",field:"Z"},{key:"rx",label:"RX",field:"Rx"},{key:"ry",label:"RY",field:"Ry"},{key:"rz",label:"RZ",field:"Rz"}],ICt=(i,e=70,t=60)=>Array.from({length:i},(n,s)=>`hsl(${Math.round(s*137.508%360)}, ${e}%, ${t}%)`),ope=ao.length,rpe=$Pe.length,kCt=Adt.length,LCt=Mdt.length,ape=2,uF=(i,e,t,n,s,o)=>({key:i,subTitle:o,subclass:[{key:"in",label:"In",legend:`${e}_IN`},{key:"out",label:"Out",legend:`${e}_OUT`,dash:[4,3]}],rows:Array.from({length:t}).map((r,a)=>({key:`${i}-${a}`,label:`${a}`,prefix:e,cells:{in:kJ(n,a),out:kJ(s,a)}}))}),hF=(i,e,t,n,s)=>({key:i,subTitle:s,rows:Array.from({length:t}).map((o,r)=>({key:`${i}-${r}`,label:`${e} ${r}`,read:kJ(n,r)}))}),Uw=(i,e,t)=>({key:i,subTitle:t,rows:e.map(({key:n,label:s,field:o,legend:r})=>({key:n,label:s,legend:r,read:vv(o)}))}),DCt=(i,e,t)=>[{key:"jointQ",subTitle:"Joint",subclass:[{key:"ref",label:"Ref",legend:"REF"},{key:"enc",label:"Enc",legend:"ENC",dash:[4,3]}],rows:Array.from({length:i}).map((n,s)=>({key:`j${s}`,label:`J${s}`,cells:{ref:hf("jointQRef",s),enc:hf("jointQEnc",s)}}))},{key:"jointT",subclass:[{key:"esti",label:"Estimated",legend:"ESTI"},{key:"meas",label:"Measured",legend:"MEAS",dash:[4,3]}],rows:Array.from({length:i}).map((n,s)=>({key:`jT${s}`,label:`J${s} Torque`,cells:{esti:hf("jointTEsti",s),meas:hf("jointTMeas",s)}}))},{key:"jointTemper",rows:Array.from({length:i}).map((n,s)=>({key:`jointTemper${s}`,label:`J${s} Temp.`,read:hf("jointTemper",s)}))},{key:"carteX",subTitle:"TCP",subclass:[{key:"ref",label:"Ref",legend:"REF"},{key:"enc",label:"Enc",legend:"ENC",dash:[4,3]}],rows:J8.slice(0,i).map(({key:n,label:s},o)=>({key:`tcp-${n}`,label:s,prefix:"TCP",labelClassName:xi[n],cells:{ref:hf("carteXRef",o),enc:hf("carteXEnc",o)}}))},{key:"carteSpeed",subclass:[{key:"spdRef",label:"Ref",legend:"SPD_REF"},{key:"spdEnc",label:"Enc",legend:"SPD_ENC",dash:[4,3]}],rows:J8.slice(0,i).map(({key:n,label:s},o)=>({key:`tcp-spd-${n}`,label:s,prefix:"TCP Spd",labelClassName:xi[n],cells:{spdRef:hf("carteSpeedRef",o),spdEnc:hf("carteSpeedEnc",o)}}))},{key:"userfXRef",subTitle:"User",rows:J8.slice(0,i).map(({key:n,label:s},o)=>({key:`user-${n}`,label:s,prefix:`User ${e}`,legend:`USER_${s}`,read:hf("userfXRef",o)}))},{key:"toolTcp",subTitle:"Tool",rows:spe.map(({key:n,label:s,field:o})=>({key:`tool-tcp-${n}`,label:s,prefix:`Tool ${t}`,legend:`TOOL_${s}`,read:vv(`toolTcp${o}`)}))},Uw("toolComX",[{key:"toolComX",label:`Tool ${t} COM X`,field:"toolComX",legend:"TOOL_COM_X"}]),Uw("toolComY",[{key:"toolComY",label:`Tool ${t} COM Y`,field:"toolComY",legend:"TOOL_COM_Y"}]),Uw("toolComZ",[{key:"toolComZ",label:`Tool ${t} COM Z`,field:"toolComZ",legend:"TOOL_COM_Z"}]),uF("cboxDigital","CB Digital",ope,"cboxDigitalInput","cboxDigitalOutput","CB I/O"),uF("cboxAnalog","CB Analog",rpe,"cboxAnalogInput","cboxAnalogOutput"),uF("exDigital","EX Digital",ope,"exDigitalInput","exDigitalOutput","External I/O"),uF("exAnalog","EX Analog",rpe,"exAnalogInput","exAnalogOutput"),hF("toolDigitalIn","Tool D.In",kCt,"toolDigitalInput","Tool I/O"),hF("toolDigitalOut","Tool D.Out",LCt,"toolDigitalOutput"),hF("toolAnalogIn","Tool A.In",ape,"toolAnalogInput"),hF("toolAnalogOut","Tool A.Out",ape,"toolAnalogOutput"),Uw("toolVoltageOutput",[{key:"toolVoltageOutput",label:"Tool Voltage",field:"toolVoltageOutput",legend:"TOOL_VOL"}]),Uw("motion",[{key:"mode",label:"Motion Mode",field:"motionMode"},{key:"executionResult",label:"Exec Result",field:"motionExecutionResult"},{key:"speedBar",label:"Speed Bar",field:"motionSpeedBar"},{key:"isPause",label:"Is Pause",field:"motionIsPause"}],"Motion"),Uw("status",[{key:"lan2can",label:"Lan2Can",field:"statusLan2can"},{key:"switchEmg",label:"Switch EMG",field:"statusSwitchEmg"},{key:"powerOut",label:"Power Out",field:"statusPowerOut"},{key:"servoNum",label:"Servo Num",field:"statusServoNum"},{key:"isRefon",label:"Is RefOn",field:"statusIsRefon"},{key:"outColl",label:"Out Coll",field:"statusOutColl"},{key:"selfColl",label:"Self Coll",field:"statusSelfColl"},{key:"dtMode",label:"DT Mode",field:"statusDtMode"},{key:"pyfmState",label:"PYFM State",field:"statusPyfmState"}],"Status"),{key:"forcetorque",subTitle:"F/T Sensor",subclass:[{key:"ext",label:"External",legend:"FT_EXT"},{key:"int",label:"Internal",legend:"FT_INT",dash:[4,3]}],rows:spe.map(({key:n,label:s,field:o})=>({key:n,label:s,prefix:"FT",labelClassName:xi[n],cells:{ext:vv(`forcetorqueExt${o}`),int:vv(`forcetorqueInt${o}`)}}))},{key:"extAxis",subTitle:"Ext.Axis",subclass:[{key:"extRef",label:"Ref",legend:"EXT_REF"},{key:"extEnc",label:"Enc",legend:"EXT_ENC",dash:[4,3]}],rows:Array.from({length:i}).map((n,s)=>({key:`ext-${s}`,label:`Ext.Axis ${s}`,cells:{extRef:vv(`extAxisRef${s}`),extEnc:vv(`extAxisEnc${s}`)}}))},Uw("additionalSystemInfo",[{key:"0",label:"Info 0",field:"additionalSystemInfo0",legend:"SYS_INFO_0"},{key:"1",label:"Info 1",field:"additionalSystemInfo1",legend:"SYS_INFO_1"},{key:"2",label:"Info 2",field:"additionalSystemInfo2",legend:"SYS_INFO_2"},{key:"3",label:"Info 3",field:"additionalSystemInfo3",legend:"SYS_INFO_3"},{key:"4",label:"Info 4",field:"additionalSystemInfo4",legend:"SYS_INFO_4"},{key:"5",label:"Info 5",field:"additionalSystemInfo5",legend:"SYS_INFO_5"}],"Additional System Info"),{key:"weldInfo",subTitle:"Weld",subclass:[{key:"tx",label:"Tx",legend:"WELD_TX"},{key:"rx",label:"Rx",legend:"WELD_RX",dash:[4,3]}],rows:[{key:"chunk",label:"Chunk",field:"Chunk"},{key:"current",label:"Current",field:"Current"},{key:"voltage",label:"Voltage",field:"Voltage"},{key:"feedrate",label:"Feedrate",field:"Feedrate"}].map(({key:n,label:s,field:o})=>({key:n,label:s,cells:{tx:vv(`weldInfoTx${o}`),rx:vv(`weldInfoRx${o}`)}}))}],VE=(i,e,t)=>t?`${i}.${e}.${t}`:`${i}.${e}`,DMe=i=>{const e=i.flatMap(s=>s.rows),t=ICt(e.length),n=new Map(e.map((s,o)=>[s,t[o]]));return i.flatMap(s=>s.subclass?s.subclass.flatMap(o=>s.rows.flatMap(r=>{const a=r.cells?.[o.key];return a?[{id:VE(s.key,r.key,o.key),label:`${o.legend??o.label}_${r.label}`,color:n.get(r),dash:o.dash,read:a}]:[]})):s.rows.flatMap(o=>o.read?[{id:VE(s.key,o.key),label:o.legend??o.label,color:n.get(o),read:o.read}]:[]))},{useCallback:lpe,useEffect:TCt,useState:KB}=await F("react"),ECt=16,cpe=2,PCt=({className:i,groups:e,chartMode:t,onDrawChartChange:n,selectedChannelIds:s,onSelectedChannelIdsChange:o})=>{const{t:r}=q(),{theme:a}=tt(),l=t!==void 0,[c,d]=KB("off"),h=l?t:c,g=s!==void 0,[m,f]=KB([]),p=g?s:m,_=lpe(v=>{if(v==="2d"&&p.length>cpe){rt.openToast({type:"basic",variant:"warning",title:"경고",content:"2D 차트에서는 2개의 데이터만 사용 가능합니다.",position:"top-right"});return}l||d(v),n?.({isDrawChart:v!=="off",chartMode:v})},[l,n,p.length]),b=lpe((v,w)=>{const y=h==="2d"&&w&&p.length>=cpe?p.slice(1):p;if(w&&y.length>=ECt){rt.openToast({type:"basic",variant:"warning",title:"경고",content:"한번에 볼 수 있는 차트의 최대 갯수는 16개 입니다.",position:"top-right"});return}const S=w?[...y.filter(C=>C!==v),v]:y.filter(C=>C!==v);g||f(S),o?.(S)},[p,g,o,h]);return x(G9,{className:P("DrawChartController gap-2 px-3 py-1.5",i),children:[x(H,{className:"text-fg-default typo-compact-xs-semibold gap-1",alignItems:"center",justifyContent:"space-between",children:[u("p",{className:"typo-compact-xs-semibold text-fg-default",children:r("move.chart.title")}),x("div",{className:P("bg-bg-alt-2 inline-flex w-fit gap-1 rounded-md p-1","[&_button]:typo-compact-xs-medium! [&_button]:bg-fill-transparent [&_button]:text-fg-default [&_button]:h-5 [&_button]:min-w-10 [&_button]:rounded-sm [&_button]:px-1.5 [&_button]:py-0.5"),children:[u(se,{className:P({"text-fg-subtlest!":h!=="off",[a==="light"&&"text-fg-subtlest!"]:h!=="off","bg-fill-subtler!":h==="off"}),variant:"transparent",onClick:()=>_("off"),children:r("move.button.off")}),u(se,{className:P({"text-fg-subtlest!":h!=="time",[a==="light"&&"text-fg-subtlest!"]:h!=="time","bg-fill-subtler!":h==="time"}),variant:"transparent",onClick:()=>_("time"),children:r("move.button.time")}),u(se,{className:P({"text-fg-subtlest!":h!=="2d",[a==="light"&&"text-fg-subtlest!"]:h!=="2d","bg-fill-subtler!":h==="2d"}),variant:"transparent",onClick:()=>_("2d"),children:"2D"})]})]}),u(Km,{className:"h-full w-full",children:u(U,{className:"h-100 gap-1.5",children:e.map(v=>{const w={gridTemplateColumns:v.subclass?`repeat(${v.subclass.length+1}, minmax(0, 1fr))`:"minmax(0, 1fr) minmax(0, 2fr)"};return x(rn,{children:[v.subTitle&&x(rn,{children:[v.subTitle!=="Joint"&&u(_o,{}),u("span",{className:"text-fg-default typo-compact-xs-semibold mt-1",children:v.subTitle})]}),x(U,{className:"text-fg-subtle typo-compact-xs-normal w-full items-center gap-x-1 gap-y-0.5",children:[v.title&&u("p",{className:"typo-compact-xs-semibold text-fg-default w-full",children:r(v.title)}),v.subclass&&x(H,{className:"grid w-full place-items-center",style:w,alignItems:"center",children:[u("div",{}),v.subclass.map(y=>u("span",{className:"w-15 text-center",children:r(y.label)},y.key))]}),v.rows.map(y=>x(H,{className:"grid w-full place-items-center [&>*:first-child]:justify-self-start [&>*:first-child]:text-start",style:w,alignItems:"center",children:[x(H,{className:"gap-1",children:[y.prefix&&u("span",{children:y.prefix}),u("span",{className:y.labelClassName,children:r(y.label)})]}),v.subclass?v.subclass.map(S=>{const C=VE(v.key,y.key,S.key);return u(ia,{className:"mx-1",value:p.includes(C),handleChange:N=>b(C,N)},S.key)}):u(ia,{className:"mx-1",value:p.includes(VE(v.key,y.key)),handleChange:S=>b(VE(v.key,y.key),S)})]},y.key))]},v.key)]})})})})]})},RCt=({chartGroups:i,handleChangeStateCoreChart:e,onSelectedChannelIdsChange:t})=>{const{t:n}=q(),[s,o]=KB("off"),[r,a]=KB([]),l=d=>{d.chartMode!==void 0&&o(d.chartMode),e(d)},c=d=>{a(d),t?.(d)};return TCt(()=>{const d=new Set(DMe(i).map(({id:g})=>g)),h=r.filter(g=>d.has(g));h.length!==r.length&&(a(h),t?.(h))},[i]),u(j9,{id:"chart-tooltip",label:n("move.chart.title"),icon:u(WKe,{className:"relative z-10 h-4 w-4"}),isActive:s!=="off",anchorToPanelTop:!0,children:u(PCt,{groups:i,chartMode:s,onDrawChartChange:l,selectedChannelIds:r,onSelectedChannelIdsChange:c})})};class MCt{constructor(e,t=10){this.channelCount=e,this.windowSec=t,this.ys=Array.from({length:e},()=>[])}xs=[];ys=[];version=0;push(e,t=Date.now()/1e3){this.xs.push(t);for(let n=0;n<this.channelCount;n++)this.ys[n].push(e[n]??NaN);this.trim(t),this.version++}clear(){this.xs=[],this.ys=Array.from({length:this.channelCount},()=>[]),this.version++}stats(){return this.ys.map(e=>{let t=1/0,n=-1/0;for(const s of e)Number.isNaN(s)||(s<t&&(t=s),s>n&&(n=s));return t===1/0?null:{min:t,max:n,range:n-t}})}trim(e){const t=e-this.windowSec;let n=0;for(;n<this.xs.length&&this.xs[n]<t;)n++;if(n!==0){this.xs.splice(0,n);for(const s of this.ys)s.splice(0,n)}}}const ACt=!0,Ol="u-",OCt="uplot",FCt=Ol+"hz",BCt=Ol+"vt",VCt=Ol+"title",zCt=Ol+"wrap",WCt=Ol+"under",HCt=Ol+"over",$Ct=Ol+"axis",EC=Ol+"off",UCt=Ol+"select",jCt=Ol+"cursor-x",GCt=Ol+"cursor-y",qCt=Ol+"cursor-pt",KCt=Ol+"legend",JCt=Ol+"live",YCt=Ol+"inline",XCt=Ol+"series",QCt=Ol+"marker",dpe=Ol+"label",ZCt=Ol+"value",XT="width",QT="height",FD="top",upe="bottom",XS="left",Y8="right",poe="#000",hpe=poe+"0",X8="mousemove",gpe="mousedown",Q8="mouseup",mpe="mouseenter",fpe="mouseleave",ppe="dblclick",e0t="resize",t0t="scroll",_pe="change",JB="dppxchange",_oe="--",sL=typeof window<"u",LJ=sL?document:null,KN=sL?window:null,n0t=sL?navigator:null;let Hs,gF;function DJ(){let i=devicePixelRatio;Hs!=i&&(Hs=i,gF&&EJ(_pe,gF,DJ),gF=matchMedia(`(min-resolution: ${Hs-.001}dppx) and (max-resolution: ${Hs+.001}dppx)`),D0(_pe,gF,DJ),KN.dispatchEvent(new CustomEvent(JB)))}function Xu(i,e){if(e!=null){let t=i.classList;!t.contains(e)&&t.add(e)}}function TJ(i,e){let t=i.classList;t.contains(e)&&t.remove(e)}function cr(i,e,t){i.style[e]=t+"px"}function Zg(i,e,t,n){let s=LJ.createElement(i);return e!=null&&Xu(s,e),t?.insertBefore(s,n),s}function Jh(i,e){return Zg("div",i,e)}const bpe=new WeakMap;function gf(i,e,t,n,s){let o="translate("+e+"px,"+t+"px)",r=bpe.get(i);o!=r&&(i.style.transform=o,bpe.set(i,o),e<0||t<0||e>n||t>s?Xu(i,EC):TJ(i,EC))}const vpe=new WeakMap;function ype(i,e,t){let n=e+t,s=vpe.get(i);n!=s&&(vpe.set(i,n),i.style.background=e,i.style.borderColor=t)}const wpe=new WeakMap;function Cpe(i,e,t,n){let s=e+""+t,o=wpe.get(i);s!=o&&(wpe.set(i,s),i.style.height=t+"px",i.style.width=e+"px",i.style.marginLeft=n?-e/2+"px":0,i.style.marginTop=n?-t/2+"px":0)}const boe={passive:!0},i0t={...boe,capture:!0};function D0(i,e,t,n){e.addEventListener(i,t,n?i0t:boe)}function EJ(i,e,t,n){e.removeEventListener(i,t,boe)}sL&&DJ();function hm(i,e,t,n){let s;t=t||0,n=n||e.length-1;let o=n<=2147483647;for(;n-t>1;)s=o?t+n>>1:vh((t+n)/2),e[s]<i?t=s:n=s;return i-e[t]<=e[n]-i?t:n}function TMe(i){return(t,n,s)=>{let o=-1,r=-1;for(let a=n;a<=s;a++)if(i(t[a])){o=a;break}for(let a=s;a>=n;a--)if(i(t[a])){r=a;break}return[o,r]}}const EMe=i=>i!=null,PMe=i=>i!=null&&i>0,a6=TMe(EMe),s0t=TMe(PMe);function o0t(i,e,t,n=0,s=!1){let o=s?s0t:a6,r=s?PMe:EMe;[e,t]=o(i,e,t);let a=i[e],l=i[e];if(e>-1)if(n==1)a=i[e],l=i[t];else if(n==-1)a=i[t],l=i[e];else for(let c=e;c<=t;c++){let d=i[c];r(d)&&(d<a?a=d:d>l&&(l=d))}return[a??Fo,l??-Fo]}function l6(i,e,t,n){let s=Npe(i),o=Npe(e);i==e&&(s==-1?(i*=t,e/=t):(i/=t,e*=t));let r=t==10?$_:RMe,a=s==1?vh:ag,l=o==1?ag:vh,c=a(r(yl(i))),d=l(r(yl(e))),h=GI(t,c),g=GI(t,d);return t==10&&(c<0&&(h=Bo(h,-c)),d<0&&(g=Bo(g,-d))),n||t==2?(i=h*s,e=g*o):(i=FMe(i,h),e=c6(e,g)),[i,e]}function voe(i,e,t,n){let s=l6(i,e,t,n);return i==0&&(s[0]=0),e==0&&(s[1]=0),s}const yoe=.1,Spe={mode:3,pad:yoe},zE={pad:0,soft:null,mode:0},r0t={min:zE,max:zE};function YB(i,e,t,n){return d6(t)?xpe(i,e,t):(zE.pad=t,zE.soft=n?0:null,zE.mode=n?3:0,xpe(i,e,r0t))}function Ps(i,e){return i??e}function a0t(i,e,t){for(e=Ps(e,0),t=Ps(t,i.length-1);e<=t;){if(i[e]!=null)return!0;e++}return!1}function xpe(i,e,t){let n=t.min,s=t.max,o=Ps(n.pad,0),r=Ps(s.pad,0),a=Ps(n.hard,-Fo),l=Ps(s.hard,Fo),c=Ps(n.soft,Fo),d=Ps(s.soft,-Fo),h=Ps(n.mode,0),g=Ps(s.mode,0),m=e-i,f=$_(m),p=xd(yl(i),yl(e)),_=$_(p),b=yl(_-f);(m<1e-24||b>10)&&(m=0,(i==0||e==0)&&(m=1e-24,h==2&&c!=Fo&&(o=0),g==2&&d!=-Fo&&(r=0)));let v=m||p||1e3,w=$_(v),y=GI(10,vh(w)),S=v*(m==0?i==0?.1:1:o),C=Bo(FMe(i-S,y/10),24),N=i>=c&&(h==1||h==3&&C<=c||h==2&&C>=c)?c:Fo,k=xd(a,C<N&&i>=N?N:Cm(N,C)),L=v*(m==0?e==0?.1:1:r),D=Bo(c6(e+L,y/10),24),T=e<=d&&(g==1||g==3&&D>=d||g==2&&D<=d)?d:-Fo,E=Cm(l,D>T&&e<=T?T:xd(T,D));return k==E&&k==0&&(E=100),[k,E]}const l0t=new Intl.NumberFormat(sL?n0t.language:"en-US"),woe=i=>l0t.format(i),Rh=Math,u4=Rh.PI,yl=Rh.abs,vh=Rh.floor,pl=Rh.round,ag=Rh.ceil,Cm=Rh.min,xd=Rh.max,GI=Rh.pow,Npe=Rh.sign,$_=Rh.log10,RMe=Rh.log2,c0t=(i,e=1)=>Rh.sinh(i)*e,Z8=(i,e=1)=>Rh.asinh(i/e),Fo=1/0;function Ipe(i){return($_((i^i>>31)-(i>>31))|0)+1}function PJ(i,e,t){return Cm(xd(i,e),t)}function MMe(i){return typeof i=="function"}function Ki(i){return MMe(i)?i:()=>i}const d0t=()=>{},AMe=i=>i,OMe=(i,e)=>e,u0t=i=>null,kpe=i=>!0,Lpe=(i,e)=>i==e,h0t=/\.\d*?(?=9{6,}|0{6,})/gm,s1=i=>{if(VMe(i)||Vy.has(i))return i;const e=`${i}`,t=e.match(h0t);if(t==null)return i;let n=t[0].length-1;if(e.indexOf("e-")!=-1){let[s,o]=e.split("e");return+`${s1(s)}e${o}`}return Bo(i,n)};function pC(i,e){return s1(Bo(s1(i/e))*e)}function c6(i,e){return s1(ag(s1(i/e))*e)}function FMe(i,e){return s1(vh(s1(i/e))*e)}function Bo(i,e=0){if(VMe(i))return i;let t=10**e,n=i*t*(1+Number.EPSILON);return pl(n)/t}const Vy=new Map;function BMe(i){return((""+i).split(".")[1]||"").length}function hR(i,e,t,n){let s=[],o=n.map(BMe);for(let r=e;r<t;r++){let a=yl(r),l=Bo(GI(i,r),a);for(let c=0;c<n.length;c++){let d=i==10?+`${n[c]}e${r}`:n[c]*l,h=(r>=0?0:a)+(r>=o[c]?0:o[c]),g=i==10?d:Bo(d,h);s.push(g),Vy.set(g,h)}}return s}const WE={},Coe=[],qI=[null,null],Tv=Array.isArray,VMe=Number.isInteger,g0t=i=>i===void 0;function Dpe(i){return typeof i=="string"}function d6(i){let e=!1;if(i!=null){let t=i.constructor;e=t==null||t==Object}return e}function m0t(i){return i!=null&&typeof i=="object"}const f0t=Object.getPrototypeOf(Uint8Array),zMe="__proto__";function KI(i,e=d6){let t;if(Tv(i)){let n=i.find(s=>s!=null);if(Tv(n)||e(n)){t=Array(i.length);for(let s=0;s<i.length;s++)t[s]=KI(i[s],e)}else t=i.slice()}else if(i instanceof f0t)t=i.slice();else if(e(i)){t={};for(let n in i)n!=zMe&&(t[n]=KI(i[n],e))}else t=i;return t}function Ja(i){let e=arguments;for(let t=1;t<e.length;t++){let n=e[t];for(let s in n)s!=zMe&&(d6(i[s])?Ja(i[s],KI(n[s])):i[s]=KI(n[s]))}return i}const p0t=0,_0t=1,b0t=2;function v0t(i,e,t){for(let n=0,s,o=-1;n<e.length;n++){let r=e[n];if(r>o){for(s=r-1;s>=0&&i[s]==null;)i[s--]=null;for(s=r+1;s<t&&i[s]==null;)i[o=s++]=null}}}function y0t(i,e){if(S0t(i)){let r=i[0].slice();for(let a=1;a<i.length;a++)r.push(...i[a].slice(1));return x0t(r[0])||(r=C0t(r)),r}let t=new Set;for(let r=0;r<i.length;r++){let l=i[r][0],c=l.length;for(let d=0;d<c;d++)t.add(l[d])}let n=[Array.from(t).sort((r,a)=>r-a)],s=n[0].length,o=new Map;for(let r=0;r<s;r++)o.set(n[0][r],r);for(let r=0;r<i.length;r++){let a=i[r],l=a[0];for(let c=1;c<a.length;c++){let d=a[c],h=Array(s).fill(void 0),g=e?e[r][c]:_0t,m=[];for(let f=0;f<d.length;f++){let p=d[f],_=o.get(l[f]);p===null?g!=p0t&&(h[_]=p,g==b0t&&m.push(_)):h[_]=p}v0t(h,m,s),n.push(h)}}return n}const w0t=typeof queueMicrotask>"u"?i=>Promise.resolve().then(i):queueMicrotask;function C0t(i){let e=i[0],t=e.length,n=Array(t);for(let o=0;o<n.length;o++)n[o]=o;n.sort((o,r)=>e[o]-e[r]);let s=[];for(let o=0;o<i.length;o++){let r=i[o],a=Array(t);for(let l=0;l<t;l++)a[l]=r[n[l]];s.push(a)}return s}function S0t(i){let e=i[0][0],t=e.length;for(let n=1;n<i.length;n++){let s=i[n][0];if(s.length!=t)return!1;if(s!=e){for(let o=0;o<t;o++)if(s[o]!=e[o])return!1}}return!0}function x0t(i,e=100){const t=i.length;if(t<=1)return!0;let n=0,s=t-1;for(;n<=s&&i[n]==null;)n++;for(;s>=n&&i[s]==null;)s--;if(s<=n)return!0;const o=xd(1,vh((s-n+1)/e));for(let r=i[n],a=n+o;a<=s;a+=o){const l=i[a];if(l!=null){if(l<=r)return!1;r=l}}return!0}const WMe=["January","February","March","April","May","June","July","August","September","October","November","December"],HMe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function $Me(i){return i.slice(0,3)}const N0t=HMe.map($Me),I0t=WMe.map($Me),k0t={MMMM:WMe,MMM:I0t,WWWW:HMe,WWW:N0t};function BD(i){return(i<10?"0":"")+i}function L0t(i){return(i<10?"00":i<100?"0":"")+i}const D0t={YYYY:i=>i.getFullYear(),YY:i=>(i.getFullYear()+"").slice(2),MMMM:(i,e)=>e.MMMM[i.getMonth()],MMM:(i,e)=>e.MMM[i.getMonth()],MM:i=>BD(i.getMonth()+1),M:i=>i.getMonth()+1,DD:i=>BD(i.getDate()),D:i=>i.getDate(),WWWW:(i,e)=>e.WWWW[i.getDay()],WWW:(i,e)=>e.WWW[i.getDay()],HH:i=>BD(i.getHours()),H:i=>i.getHours(),h:i=>{let e=i.getHours();return e==0?12:e>12?e-12:e},AA:i=>i.getHours()>=12?"PM":"AM",aa:i=>i.getHours()>=12?"pm":"am",a:i=>i.getHours()>=12?"p":"a",mm:i=>BD(i.getMinutes()),m:i=>i.getMinutes(),ss:i=>BD(i.getSeconds()),s:i=>i.getSeconds(),fff:i=>L0t(i.getMilliseconds())};function Soe(i,e){e=e||k0t;let t=[],n=/\{([a-z]+)\}|[^{]+/gi,s;for(;s=n.exec(i);)t.push(s[0][0]=="{"?D0t[s[1]]:s[0]);return o=>{let r="";for(let a=0;a<t.length;a++)r+=typeof t[a]=="string"?t[a]:t[a](o,e);return r}}const T0t=new Intl.DateTimeFormat().resolvedOptions().timeZone;function E0t(i,e){let t;return e=="UTC"||e=="Etc/UTC"?t=new Date(+i+i.getTimezoneOffset()*6e4):e==T0t?t=i:(t=new Date(i.toLocaleString("en-US",{timeZone:e})),t.setMilliseconds(i.getMilliseconds())),t}const UMe=i=>i%1==0,XB=[1,2,2.5,5],P0t=hR(10,-32,0,XB),jMe=hR(10,0,32,XB),R0t=jMe.filter(UMe),_C=P0t.concat(jMe),xoe=`
375
375
  `,GMe="{YYYY}",Tpe=xoe+GMe,qMe="{M}/{D}",ZT=xoe+qMe,mF=ZT+"/{YY}",KMe="{aa}",M0t="{h}:{mm}",Gx=M0t+KMe,Epe=xoe+Gx,Ppe=":{ss}",Zs=null;function JMe(i){let e=i*1e3,t=e*60,n=t*60,s=n*24,o=s*30,r=s*365,l=(i==1?hR(10,0,3,XB).filter(UMe):hR(10,-3,0,XB)).concat([e,e*5,e*10,e*15,e*30,t,t*5,t*10,t*15,t*30,n,n*2,n*3,n*4,n*6,n*8,n*12,s,s*2,s*3,s*4,s*5,s*6,s*7,s*8,s*9,s*10,s*15,o,o*2,o*3,o*4,o*6,r,r*2,r*5,r*10,r*25,r*50,r*100]);const c=[[r,GMe,Zs,Zs,Zs,Zs,Zs,Zs,1],[s*28,"{MMM}",Tpe,Zs,Zs,Zs,Zs,Zs,1],[s,qMe,Tpe,Zs,Zs,Zs,Zs,Zs,1],[n,"{h}"+KMe,mF,Zs,ZT,Zs,Zs,Zs,1],[t,Gx,mF,Zs,ZT,Zs,Zs,Zs,1],[e,Ppe,mF+" "+Gx,Zs,ZT+" "+Gx,Zs,Epe,Zs,1],[i,Ppe+".{fff}",mF+" "+Gx,Zs,ZT+" "+Gx,Zs,Epe,Zs,1]];function d(h){return(g,m,f,p,_,b)=>{let v=[],w=_>=r,y=_>=o&&_<r,S=h(f),C=Bo(S*i,3),N=eU(S.getFullYear(),w?0:S.getMonth(),y||w?1:S.getDate()),k=Bo(N*i,3);if(y||w){let L=y?_/o:0,D=w?_/r:0,T=C==k?C:Bo(eU(N.getFullYear()+D,N.getMonth()+L,1)*i,3),E=new Date(pl(T/i)),R=E.getFullYear(),A=E.getMonth();for(let M=0;T<=p;M++){let O=eU(R+D*M,A+L*M,1),B=O-h(Bo(O*i,3));T=Bo((+O+B)*i,3),T<=p&&v.push(T)}}else{let L=_>=s?s:_,D=vh(f)-vh(C),T=k+D+c6(C-k,L);v.push(T);let E=h(T),R=E.getHours()+E.getMinutes()/t+E.getSeconds()/n,A=_/n,M=g.axes[m]._space,O=b/M;for(;T=Bo(T+_,i==1?0:3),!(T>p);)if(A>1){let B=vh(Bo(R+A,6))%24,$=h(T).getHours()-B;$>1&&($=-1),T-=$*n,R=(R+A)%24;let Z=v[v.length-1];Bo((T-Z)/_,3)*O>=.7&&v.push(T)}else v.push(T)}return v}}return[l,c,d]}const[A0t,O0t,F0t]=JMe(1),[B0t,V0t,z0t]=JMe(.001);hR(2,-53,53,[1]);function Rpe(i,e){return i.map(t=>t.map((n,s)=>s==0||s==8||n==null?n:e(s==1||t[8]==0?n:t[1]+n)))}function Mpe(i,e){return(t,n,s,o,r)=>{let a=e.find(f=>r>=f[0])||e[e.length-1],l,c,d,h,g,m;return n.map(f=>{let p=i(f),_=p.getFullYear(),b=p.getMonth(),v=p.getDate(),w=p.getHours(),y=p.getMinutes(),S=p.getSeconds(),C=_!=l&&a[2]||b!=c&&a[3]||v!=d&&a[4]||w!=h&&a[5]||y!=g&&a[6]||S!=m&&a[7]||a[1];return l=_,c=b,d=v,h=w,g=y,m=S,C(p)})}}function W0t(i,e){let t=Soe(e);return(n,s,o,r,a)=>s.map(l=>t(i(l)))}function eU(i,e,t){return new Date(i,e,t)}function Ape(i,e){return e(i)}const H0t="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function Ope(i,e){return(t,n,s,o)=>o==null?_oe:e(i(n))}function $0t(i,e){let t=i.series[e];return t.width?t.stroke(i,e):t.points.width?t.points.stroke(i,e):null}function U0t(i,e){return i.series[e].fill(i,e)}const j0t={show:!0,live:!0,isolate:!1,mount:d0t,markers:{show:!0,width:2,stroke:$0t,fill:U0t,dash:"solid"},idx:null,idxs:null,values:[]};function G0t(i,e){let t=i.cursor.points,n=Jh(),s=t.size(i,e);cr(n,XT,s),cr(n,QT,s);let o=s/-2;cr(n,"marginLeft",o),cr(n,"marginTop",o);let r=t.width(i,e,s);return r&&cr(n,"borderWidth",r),n}function q0t(i,e){let t=i.series[e].points;return t._fill||t._stroke}function K0t(i,e){let t=i.series[e].points;return t._stroke||t._fill}function J0t(i,e){return i.series[e].points.size}const tU=[0,0];function Y0t(i,e,t){return tU[0]=e,tU[1]=t,tU}function fF(i,e,t,n=!0){return s=>{s.button==0&&(!n||s.target==e)&&t(s)}}function nU(i,e,t,n=!0){return s=>{(!n||s.target==e)&&t(s)}}const X0t={show:!0,x:!0,y:!0,lock:!1,move:Y0t,points:{one:!1,show:G0t,size:J0t,width:0,stroke:K0t,fill:q0t},bind:{mousedown:fF,mouseup:fF,click:fF,dblclick:fF,mousemove:nU,mouseleave:nU,mouseenter:nU},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(i,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(i,e,t,n,s)=>n-s,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},YMe={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Noe=Ja({},YMe,{filter:OMe}),XMe=Ja({},Noe,{size:10}),QMe=Ja({},YMe,{show:!1}),Ioe='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',ZMe="bold "+Ioe,eAe=1.5,Fpe={show:!0,scale:"x",stroke:poe,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:ZMe,side:2,grid:Noe,ticks:XMe,border:QMe,font:Ioe,lineGap:eAe,rotate:0},Q0t="Value",Z0t="Time",Bpe={show:!0,scale:"x",auto:!1,sorted:1,min:Fo,max:-Fo,idxs:[]};function e1t(i,e,t,n,s){return e.map(o=>o==null?"":woe(o))}function t1t(i,e,t,n,s,o,r){let a=[],l=Vy.get(s)||0;t=r?t:Bo(c6(t,s),l);for(let c=t;c<=n;c=Bo(c+s,l))a.push(Object.is(c,-0)?0:c);return a}function RJ(i,e,t,n,s,o,r){const a=[],l=i.scales[i.axes[e].scale].log,c=l==10?$_:RMe,d=vh(c(t));s=GI(l,d),l==10&&(s=_C[hm(s,_C)]);let h=t,g=s*l;l==10&&(g=_C[hm(g,_C)]);do a.push(h),h=h+s,l==10&&!Vy.has(h)&&(h=Bo(h,Vy.get(s))),h>=g&&(s=h,g=s*l,l==10&&(g=_C[hm(g,_C)]));while(h<=n);return a}function n1t(i,e,t,n,s,o,r){let l=i.scales[i.axes[e].scale].asinh,c=n>l?RJ(i,e,xd(l,t),n,s):[l],d=n>=0&&t<=0?[0]:[];return(t<-l?RJ(i,e,xd(l,-n),-t,s):[l]).reverse().map(g=>-g).concat(d,c)}const tAe=/./,i1t=/[12357]/,s1t=/[125]/,Vpe=/1/,MJ=(i,e,t,n)=>i.map((s,o)=>e==4&&s==0||o%n==0&&t.test(s.toExponential()[s<0?1:0])?s:null);function o1t(i,e,t,n,s){let o=i.axes[t],r=o.scale,a=i.scales[r],l=i.valToPos,c=o._space,d=l(10,r),h=l(9,r)-d>=c?tAe:l(7,r)-d>=c?i1t:l(5,r)-d>=c?s1t:Vpe;if(h==Vpe){let g=yl(l(1,r)-d);if(g<c)return MJ(e.slice().reverse(),a.distr,h,ag(c/g)).reverse()}return MJ(e,a.distr,h,1)}function r1t(i,e,t,n,s){let o=i.axes[t],r=o.scale,a=o._space,l=i.valToPos,c=yl(l(1,r)-l(2,r));return c<a?MJ(e.slice().reverse(),3,tAe,ag(a/c)).reverse():e}function a1t(i,e,t,n){return n==null?_oe:e==null?"":woe(e)}const zpe={show:!0,scale:"y",stroke:poe,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:ZMe,side:3,grid:Noe,ticks:XMe,border:QMe,font:Ioe,lineGap:eAe,rotate:0};function l1t(i,e){let t=3+(i||1)*2;return Bo(t*e,3)}function c1t(i,e){let{scale:t,idxs:n}=i.series[0],s=i._data[0],o=i.valToPos(s[n[0]],t,!0),r=i.valToPos(s[n[1]],t,!0),a=yl(r-o),l=i.series[e],c=a/(l.points.space*Hs);return n[1]-n[0]<=c}const Wpe={scale:null,auto:!0,sorted:0,min:Fo,max:-Fo},nAe=(i,e,t,n,s)=>s,Hpe={show:!0,auto:!0,sorted:0,gaps:nAe,alpha:1,facets:[Ja({},Wpe,{scale:"x"}),Ja({},Wpe,{scale:"y"})]},$pe={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:nAe,alpha:1,points:{show:c1t,filter:null},values:null,min:Fo,max:-Fo,idxs:[],path:null,clip:null};function d1t(i,e,t,n,s){return t/10}const iAe={time:ACt,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},u1t=Ja({},iAe,{time:!1,ori:1}),Upe={};function sAe(i,e){let t=Upe[i];return t||(t={key:i,plots:[],sub(n){t.plots.push(n)},unsub(n){t.plots=t.plots.filter(s=>s!=n)},pub(n,s,o,r,a,l,c){for(let d=0;d<t.plots.length;d++)t.plots[d]!=s&&t.plots[d].pub(n,s,o,r,a,l,c)}},i!=null&&(Upe[i]=t)),t}const JI=1,AJ=2;function j1(i,e,t){const n=i.mode,s=i.series[e],o=n==2?i._data[e]:i._data,r=i.scales,a=i.bbox;let l=o[0],c=n==2?o[1]:o[e],d=n==2?r[s.facets[0].scale]:r[i.series[0].scale],h=n==2?r[s.facets[1].scale]:r[s.scale],g=a.left,m=a.top,f=a.width,p=a.height,_=i.valToPosH,b=i.valToPosV;return d.ori==0?t(s,l,c,d,h,_,b,g,m,f,p,h6,oL,m6,rAe,lAe):t(s,l,c,d,h,b,_,m,g,p,f,g6,rL,Doe,aAe,cAe)}function koe(i,e){let t=0,n=0,s=Ps(i.bands,Coe);for(let o=0;o<s.length;o++){let r=s[o];r.series[0]==e?t=r.dir:r.series[1]==e&&(r.dir==1?n|=1:n|=2)}return[t,n==1?-1:n==2?1:n==3?2:0]}function h1t(i,e,t,n,s){let o=i.mode,r=i.series[e],a=o==2?r.facets[1].scale:r.scale,l=i.scales[a];return s==-1?l.min:s==1?l.max:l.distr==3?l.dir==1?l.min:l.max:0}function U_(i,e,t,n,s,o){return j1(i,e,(r,a,l,c,d,h,g,m,f,p,_)=>{let b=r.pxRound;const v=c.dir*(c.ori==0?1:-1),w=c.ori==0?oL:rL;let y,S;v==1?(y=t,S=n):(y=n,S=t);let C=b(h(a[y],c,p,m)),N=b(g(l[y],d,_,f)),k=b(h(a[S],c,p,m)),L=b(g(o==1?d.max:d.min,d,_,f)),D=new Path2D(s);return w(D,k,L),w(D,C,L),w(D,C,N),D})}function u6(i,e,t,n,s,o){let r=null;if(i.length>0){r=new Path2D;const a=e==0?m6:Doe;let l=t;for(let h=0;h<i.length;h++){let g=i[h];if(g[1]>g[0]){let m=g[0]-l;m>0&&a(r,l,n,m,n+o),l=g[1]}}let c=t+s-l,d=10;c>0&&a(r,l,n-d/2,c,n+o+d)}return r}function g1t(i,e,t){let n=i[i.length-1];n&&n[0]==e?n[1]=t:i.push([e,t])}function Loe(i,e,t,n,s,o,r){let a=[],l=i.length;for(let c=s==1?t:n;c>=t&&c<=n;c+=s)if(e[c]===null){let h=c,g=c;if(s==1)for(;++c<=n&&e[c]===null;)g=c;else for(;--c>=t&&e[c]===null;)g=c;let m=o(i[h]),f=g==h?m:o(i[g]),p=h-s;m=r<=0&&p>=0&&p<l?o(i[p]):m;let b=g+s;f=r>=0&&b>=0&&b<l?o(i[b]):f,f>=m&&a.push([m,f])}return a}function jpe(i){return i==0?AMe:i==1?pl:e=>pC(e,i)}function oAe(i){let e=i==0?h6:g6,t=i==0?(s,o,r,a,l,c)=>{s.arcTo(o,r,a,l,c)}:(s,o,r,a,l,c)=>{s.arcTo(r,o,l,a,c)},n=i==0?(s,o,r,a,l)=>{s.rect(o,r,a,l)}:(s,o,r,a,l)=>{s.rect(r,o,l,a)};return(s,o,r,a,l,c=0,d=0)=>{c==0&&d==0?n(s,o,r,a,l):(c=Cm(c,a/2,l/2),d=Cm(d,a/2,l/2),e(s,o+c,r),t(s,o+a,r,o+a,r+l,c),t(s,o+a,r+l,o,r+l,d),t(s,o,r+l,o,r,d),t(s,o,r,o+a,r,c),s.closePath())}}const h6=(i,e,t)=>{i.moveTo(e,t)},g6=(i,e,t)=>{i.moveTo(t,e)},oL=(i,e,t)=>{i.lineTo(e,t)},rL=(i,e,t)=>{i.lineTo(t,e)},m6=oAe(0),Doe=oAe(1),rAe=(i,e,t,n,s,o)=>{i.arc(e,t,n,s,o)},aAe=(i,e,t,n,s,o)=>{i.arc(t,e,n,s,o)},lAe=(i,e,t,n,s,o,r)=>{i.bezierCurveTo(e,t,n,s,o,r)},cAe=(i,e,t,n,s,o,r)=>{i.bezierCurveTo(t,e,s,n,r,o)};function dAe(i){return(e,t,n,s,o)=>j1(e,t,(r,a,l,c,d,h,g,m,f,p,_)=>{let{pxRound:b,points:v}=r,w,y;c.ori==0?(w=h6,y=rAe):(w=g6,y=aAe);const S=Bo(v.width*Hs,3);let C=(v.size-v.width)/2*Hs,N=Bo(C*2,3),k=new Path2D,L=new Path2D,{left:D,top:T,width:E,height:R}=e.bbox;m6(L,D-N,T-N,E+N*2,R+N*2);const A=M=>{if(l[M]!=null){let O=b(h(a[M],c,p,m)),B=b(g(l[M],d,_,f));w(k,O+C,B),y(k,O,B,C,0,u4*2)}};if(o)o.forEach(A);else for(let M=n;M<=s;M++)A(M);return{stroke:S>0?k:null,fill:k,clip:L,flags:JI|AJ}})}function uAe(i){return(e,t,n,s,o,r)=>{n!=s&&(o!=n&&r!=n&&i(e,t,n),o!=s&&r!=s&&i(e,t,s),i(e,t,r))}}const m1t=uAe(oL),f1t=uAe(rL);function hAe(i){const e=Ps(i?.alignGaps,0);return(t,n,s,o)=>j1(t,n,(r,a,l,c,d,h,g,m,f,p,_)=>{[s,o]=a6(l,s,o);let b=r.pxRound,v=R=>b(h(R,c,p,m)),w=R=>b(g(R,d,_,f)),y,S;c.ori==0?(y=oL,S=m1t):(y=rL,S=f1t);const C=c.dir*(c.ori==0?1:-1),N={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:JI},k=N.stroke;let L=!1;if(o-s>=p*4){let R=V=>t.posToVal(V,c.key,!0),A=null,M=null,O,B,z,Y=v(a[C==1?s:o]),$=v(a[s]),Z=v(a[o]),K=R(C==1?$+1:Z-1);for(let V=C==1?s:o;V>=s&&V<=o;V+=C){let fe=a[V],re=(C==1?fe<K:fe>K)?Y:v(fe),ve=l[V];re==Y?ve!=null?(B=ve,A==null?(y(k,re,w(B)),O=A=M=B):B<A?A=B:B>M&&(M=B)):ve===null&&(L=!0):(A!=null&&S(k,Y,w(A),w(M),w(O),w(B)),ve!=null?(B=ve,y(k,re,w(B)),A=M=O=B):(A=M=null,ve===null&&(L=!0)),Y=re,K=R(Y+C))}A!=null&&A!=M&&z!=Y&&S(k,Y,w(A),w(M),w(O),w(B))}else for(let R=C==1?s:o;R>=s&&R<=o;R+=C){let A=l[R];A===null?L=!0:A!=null&&y(k,v(a[R]),w(A))}let[T,E]=koe(t,n);if(r.fill!=null||T!=0){let R=N.fill=new Path2D(k),A=r.fillTo(t,n,r.min,r.max,T),M=w(A),O=v(a[s]),B=v(a[o]);C==-1&&([B,O]=[O,B]),y(R,B,M),y(R,O,M)}if(!r.spanGaps){let R=[];L&&R.push(...Loe(a,l,s,o,C,v,e)),N.gaps=R=r.gaps(t,n,s,o,R),N.clip=u6(R,c.ori,m,f,p,_)}return E!=0&&(N.band=E==2?[U_(t,n,s,o,k,-1),U_(t,n,s,o,k,1)]:U_(t,n,s,o,k,E)),N})}function p1t(i){const e=Ps(i.align,1),t=Ps(i.ascDesc,!1),n=Ps(i.alignGaps,0),s=Ps(i.extend,!1);return(o,r,a,l)=>j1(o,r,(c,d,h,g,m,f,p,_,b,v,w)=>{[a,l]=a6(h,a,l);let y=c.pxRound,{left:S,width:C}=o.bbox,N=$=>y(f($,g,v,_)),k=$=>y(p($,m,w,b)),L=g.ori==0?oL:rL;const D={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:JI},T=D.stroke,E=g.dir*(g.ori==0?1:-1);let R=k(h[E==1?a:l]),A=N(d[E==1?a:l]),M=A,O=A;s&&e==-1&&(O=S,L(T,O,R)),L(T,A,R);for(let $=E==1?a:l;$>=a&&$<=l;$+=E){let Z=h[$];if(Z==null)continue;let K=N(d[$]),V=k(Z);e==1?L(T,K,R):L(T,M,V),L(T,K,V),R=V,M=K}let B=M;s&&e==1&&(B=S+C,L(T,B,R));let[z,Y]=koe(o,r);if(c.fill!=null||z!=0){let $=D.fill=new Path2D(T),Z=c.fillTo(o,r,c.min,c.max,z),K=k(Z);L($,B,K),L($,O,K)}if(!c.spanGaps){let $=[];$.push(...Loe(d,h,a,l,E,N,n));let Z=c.width*Hs/2,K=t||e==1?Z:-Z,V=t||e==-1?-Z:Z;$.forEach(fe=>{fe[0]+=K,fe[1]+=V}),D.gaps=$=c.gaps(o,r,a,l,$),D.clip=u6($,g.ori,_,b,v,w)}return Y!=0&&(D.band=Y==2?[U_(o,r,a,l,T,-1),U_(o,r,a,l,T,1)]:U_(o,r,a,l,T,Y)),D})}function Gpe(i,e,t,n,s,o,r=Fo){if(i.length>1){let a=null;for(let l=0,c=1/0;l<i.length;l++)if(e[l]!==void 0){if(a!=null){let d=yl(i[l]-i[a]);d<c&&(c=d,r=yl(t(i[l],n,s,o)-t(i[a],n,s,o)))}a=l}}return r}function _1t(i){i=i||WE;const e=Ps(i.size,[.6,Fo,1]),t=i.align||0,n=i.gap||0;let s=i.radius;s=s==null?[0,0]:typeof s=="number"?[s,0]:s;const o=Ki(s),r=1-e[0],a=Ps(e[1],Fo),l=Ps(e[2],1),c=Ps(i.disp,WE),d=Ps(i.each,m=>{}),{fill:h,stroke:g}=c;return(m,f,p,_)=>j1(m,f,(b,v,w,y,S,C,N,k,L,D,T)=>{let E=b.pxRound,R=t,A=n*Hs,M=a*Hs,O=l*Hs,B,z;y.ori==0?[B,z]=o(m,f):[z,B]=o(m,f);const Y=y.dir*(y.ori==0?1:-1);let $=y.ori==0?m6:Doe,Z=y.ori==0?d:(Ne,le,Pe,Re,We,ct,gn)=>{d(Ne,le,Pe,We,Re,gn,ct)},K=Ps(m.bands,Coe).find(Ne=>Ne.series[0]==f),V=K!=null?K.dir:0,fe=b.fillTo(m,f,b.min,b.max,V),Q=E(N(fe,S,T,L)),re,ve,_e,Le=D,Ie=E(b.width*Hs),Te=!1,lt=null,it=null,Ct=null,ft=null;h!=null&&(Ie==0||g!=null)&&(Te=!0,lt=h.values(m,f,p,_),it=new Map,new Set(lt).forEach(Ne=>{Ne!=null&&it.set(Ne,new Path2D)}),Ie>0&&(Ct=g.values(m,f,p,_),ft=new Map,new Set(Ct).forEach(Ne=>{Ne!=null&&ft.set(Ne,new Path2D)})));let{x0:Xt,size:Mt}=c;if(Xt!=null&&Mt!=null){R=1,v=Xt.values(m,f,p,_),Xt.unit==2&&(v=v.map(Pe=>m.posToVal(k+Pe*D,y.key,!0)));let Ne=Mt.values(m,f,p,_);Mt.unit==2?ve=Ne[0]*D:ve=C(Ne[0],y,D,k)-C(0,y,D,k),Le=Gpe(v,w,C,y,D,k,Le),_e=Le-ve+A}else Le=Gpe(v,w,C,y,D,k,Le),_e=Le*r+A,ve=Le-_e;_e<1&&(_e=0),Ie>=ve/2&&(Ie=0),_e<5&&(E=AMe);let Ht=_e>0,Mn=Le-_e-(Ht?Ie:0);ve=E(PJ(Mn,O,M)),re=(R==0?ve/2:R==Y?0:ve)-R*Y*((R==0?A/2:0)+(Ht?Ie/2:0));const Cs={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},or=Te?null:new Path2D;let ge=null;if(K!=null)ge=m.data[K.series[1]];else{let{y0:Ne,y1:le}=c;Ne!=null&&le!=null&&(w=le.values(m,f,p,_),ge=Ne.values(m,f,p,_))}let Ue=B*ve,Ee=z*ve;for(let Ne=Y==1?p:_;Ne>=p&&Ne<=_;Ne+=Y){let le=w[Ne];if(le==null)continue;if(ge!=null){let yi=ge[Ne]??0;if(le-yi==0)continue;Q=N(yi,S,T,L)}let Pe=y.distr!=2||c!=null?v[Ne]:Ne,Re=C(Pe,y,D,k),We=N(Ps(le,fe),S,T,L),ct=E(Re-re),gn=E(xd(We,Q)),$n=E(Cm(We,Q)),Ln=gn-$n;if(le!=null){let yi=le<0?Ee:Ue,oi=le<0?Ue:Ee;Te?(Ie>0&&Ct[Ne]!=null&&$(ft.get(Ct[Ne]),ct,$n+vh(Ie/2),ve,xd(0,Ln-Ie),yi,oi),lt[Ne]!=null&&$(it.get(lt[Ne]),ct,$n+vh(Ie/2),ve,xd(0,Ln-Ie),yi,oi)):$(or,ct,$n+vh(Ie/2),ve,xd(0,Ln-Ie),yi,oi),Z(m,f,Ne,ct-Ie/2,$n,ve+Ie,Ln)}}return Ie>0?Cs.stroke=Te?ft:or:Te||(Cs._fill=b.width==0?b._fill:b._stroke??b._fill,Cs.width=0),Cs.fill=Te?it:or,Cs})}function b1t(i,e){const t=Ps(e?.alignGaps,0);return(n,s,o,r)=>j1(n,s,(a,l,c,d,h,g,m,f,p,_,b)=>{[o,r]=a6(c,o,r);let v=a.pxRound,w=B=>v(g(B,d,_,f)),y=B=>v(m(B,h,b,p)),S,C,N;d.ori==0?(S=h6,N=oL,C=lAe):(S=g6,N=rL,C=cAe);const k=d.dir*(d.ori==0?1:-1);let L=w(l[k==1?o:r]),D=L,T=[],E=[];for(let B=k==1?o:r;B>=o&&B<=r;B+=k)if(c[B]!=null){let Y=l[B],$=w(Y);T.push(D=$),E.push(y(c[B]))}const R={stroke:i(T,E,S,N,C,v),fill:null,clip:null,band:null,gaps:null,flags:JI},A=R.stroke;let[M,O]=koe(n,s);if(a.fill!=null||M!=0){let B=R.fill=new Path2D(A),z=a.fillTo(n,s,a.min,a.max,M),Y=y(z);N(B,D,Y),N(B,L,Y)}if(!a.spanGaps){let B=[];B.push(...Loe(l,c,o,r,k,w,t)),R.gaps=B=a.gaps(n,s,o,r,B),R.clip=u6(B,d.ori,f,p,_,b)}return O!=0&&(R.band=O==2?[U_(n,s,o,r,A,-1),U_(n,s,o,r,A,1)]:U_(n,s,o,r,A,O)),R})}function v1t(i){return b1t(y1t,i)}function y1t(i,e,t,n,s,o){const r=i.length;if(r<2)return null;const a=new Path2D;if(t(a,i[0],e[0]),r==2)n(a,i[1],e[1]);else{let l=Array(r),c=Array(r-1),d=Array(r-1),h=Array(r-1);for(let g=0;g<r-1;g++)d[g]=e[g+1]-e[g],h[g]=i[g+1]-i[g],c[g]=d[g]/h[g];l[0]=c[0];for(let g=1;g<r-1;g++)c[g]===0||c[g-1]===0||c[g-1]>0!=c[g]>0?l[g]=0:(l[g]=3*(h[g-1]+h[g])/((2*h[g]+h[g-1])/c[g-1]+(h[g]+2*h[g-1])/c[g]),isFinite(l[g])||(l[g]=0));l[r-1]=c[r-2];for(let g=0;g<r-1;g++)s(a,i[g]+h[g]/3,e[g]+l[g]*h[g]/3,i[g+1]-h[g]/3,e[g+1]-l[g+1]*h[g]/3,i[g+1],e[g+1])}return a}const OJ=new Set;function qpe(){for(let i of OJ)i.syncRect(!0)}sL&&(D0(e0t,KN,qpe),D0(t0t,KN,qpe,!0),D0(JB,KN,()=>{Xl.pxRatio=Hs}));const w1t=hAe(),C1t=dAe();function Kpe(i,e,t,n){return(n?[i[0],i[1]].concat(i.slice(2)):[i[0]].concat(i.slice(1))).map((o,r)=>FJ(o,r,e,t))}function S1t(i,e){return i.map((t,n)=>n==0?{}:Ja({},e,t))}function FJ(i,e,t,n){return Ja({},e==0?t:n,i)}function gAe(i,e,t){return e==null?qI:[e,t]}const x1t=gAe;function N1t(i,e,t){return e==null?qI:YB(e,t,yoe,!0)}function mAe(i,e,t,n){return e==null?qI:l6(e,t,i.scales[n].log,!1)}const I1t=mAe;function fAe(i,e,t,n){return e==null?qI:voe(e,t,i.scales[n].log,!1)}const k1t=fAe;function L1t(i,e,t,n,s){let o=xd(Ipe(i),Ipe(e)),r=e-i,a=hm(s/n*r,t);do{let l=t[a],c=n*l/r;if(c>=s&&o+(l<5?Vy.get(l):0)<=17)return[l,c]}while(++a<t.length);return[0,0]}function Jpe(i){let e,t;return i=i.replace(/(\d+)px/,(n,s)=>(e=pl((t=+s)*Hs))+"px"),[i,e,t]}function D1t(i){i.show&&[i.font,i.labelFont].forEach(e=>{let t=Bo(e[2]*Hs,1);e[0]=e[0].replace(/[0-9.]+px/,t+"px"),e[1]=t})}function Xl(i,e,t){const n={mode:Ps(i.mode,1)},s=n.mode;function o(X,ne,we,Se){let Be=ne.valToPct(X);return Se+we*(ne.dir==-1?1-Be:Be)}function r(X,ne,we,Se){let Be=ne.valToPct(X);return Se+we*(ne.dir==-1?Be:1-Be)}function a(X,ne,we,Se){return ne.ori==0?o(X,ne,we,Se):r(X,ne,we,Se)}n.valToPosH=o,n.valToPosV=r;let l=!1;n.status=0;const c=n.root=Jh(OCt);if(i.id!=null&&(c.id=i.id),Xu(c,i.class),i.title){let X=Jh(VCt,c);X.textContent=i.title}const d=Zg("canvas"),h=n.ctx=d.getContext("2d"),g=Jh(zCt,c);D0("click",g,X=>{X.target===f&&(To!=Xb||Go!=Qb)&&Ba.click(n,X)},!0);const m=n.under=Jh(WCt,g);g.appendChild(d);const f=n.over=Jh(HCt,g);i=KI(i);const p=+Ps(i.pxAlign,1),_=jpe(p);(i.plugins||[]).forEach(X=>{X.opts&&(i=X.opts(n,i)||i)});const b=i.ms||.001,v=n.series=s==1?Kpe(i.series||[],Bpe,$pe,!1):S1t(i.series||[null],Hpe),w=n.axes=Kpe(i.axes||[],Fpe,zpe,!0),y=n.scales={},S=n.bands=i.bands||[];S.forEach(X=>{X.fill=Ki(X.fill||null),X.dir=Ps(X.dir,-1)});const C=s==2?v[1].facets[0].scale:v[0].scale,N={axes:F2,series:M2},k=(i.drawOrder||["axes","series"]).map(X=>N[X]);function L(X){const ne=X.distr==3?we=>$_(we>0?we:X.clamp(n,we,X.min,X.max,X.key)):X.distr==4?we=>Z8(we,X.asinh):X.distr==100?we=>X.fwd(we):we=>we;return we=>{let Se=ne(we),{_min:Be,_max:Xe}=X,ut=Xe-Be;return(Se-Be)/ut}}function D(X){let ne=y[X];if(ne==null){let we=(i.scales||WE)[X]||WE;if(we.from!=null){D(we.from);let Se=Ja({},y[we.from],we,{key:X});Se.valToPct=L(Se),y[X]=Se}else{ne=y[X]=Ja({},X==C?iAe:u1t,we),ne.key=X;let Se=ne.time,Be=ne.range,Xe=Tv(Be);if((X!=C||s==2&&!Se)&&(Xe&&(Be[0]==null||Be[1]==null)&&(Be={min:Be[0]==null?Spe:{mode:1,hard:Be[0],soft:Be[0]},max:Be[1]==null?Spe:{mode:1,hard:Be[1],soft:Be[1]}},Xe=!1),!Xe&&d6(Be))){let ut=Be;Be=(kt,Bt,Qt)=>Bt==null?qI:YB(Bt,Qt,ut)}ne.range=Ki(Be||(Se?x1t:X==C?ne.distr==3?I1t:ne.distr==4?k1t:gAe:ne.distr==3?mAe:ne.distr==4?fAe:N1t)),ne.auto=Ki(Xe?!1:ne.auto),ne.clamp=Ki(ne.clamp||d1t),ne._min=ne._max=null,ne.valToPct=L(ne)}}}D("x"),D("y"),s==1&&v.forEach(X=>{D(X.scale)}),w.forEach(X=>{D(X.scale)});for(let X in i.scales)D(X);const T=y[C],E=T.distr;let R,A;T.ori==0?(Xu(c,FCt),R=o,A=r):(Xu(c,BCt),R=r,A=o);const M={};for(let X in y){let ne=y[X];(ne.min!=null||ne.max!=null)&&(M[X]={min:ne.min,max:ne.max},ne.min=ne.max=null)}const O=i.tzDate||(X=>new Date(pl(X/b))),B=i.fmtDate||Soe,z=b==1?F0t(O):z0t(O),Y=Mpe(O,Rpe(b==1?O0t:V0t,B)),$=Ope(O,Ape(H0t,B)),Z=[],K=n.legend=Ja({},j0t,i.legend),V=n.cursor=Ja({},X0t,{drag:{y:s==2}},i.cursor),fe=K.show,Q=V.show,re=K.markers;K.idxs=Z,re.width=Ki(re.width),re.dash=Ki(re.dash),re.stroke=Ki(re.stroke),re.fill=Ki(re.fill);let ve,_e,Le,Ie=[],Te=[],lt,it=!1,Ct={};if(K.live){const X=v[1]?v[1].values:null;it=X!=null,lt=it?X(n,1,0):{_:0};for(let ne in lt)Ct[ne]=_oe}if(fe)if(ve=Zg("table",KCt,c),Le=Zg("tbody",null,ve),K.mount(n,ve),it){_e=Zg("thead",null,ve,Le);let X=Zg("tr",null,_e);Zg("th",null,X);for(var ft in lt)Zg("th",dpe,X).textContent=ft}else Xu(ve,YCt),K.live&&Xu(ve,JCt);const Xt={show:!0},Mt={show:!1};function Ht(X,ne){if(ne==0&&(it||!K.live||s==2))return qI;let we=[],Se=Zg("tr",XCt,Le,Le.childNodes[ne]);Xu(Se,X.class),X.show||Xu(Se,EC);let Be=Zg("th",null,Se);if(re.show){let kt=Jh(QCt,Be);if(ne>0){let Bt=re.width(n,ne);Bt&&(kt.style.border=Bt+"px "+re.dash(n,ne)+" "+re.stroke(n,ne)),kt.style.background=re.fill(n,ne)}}let Xe=Jh(dpe,Be);X.label instanceof HTMLElement?Xe.appendChild(X.label):Xe.textContent=X.label,ne>0&&(re.show||(Xe.style.color=X.width>0?re.stroke(n,ne):re.fill(n,ne)),Cs("click",Be,kt=>{if(V._lock)return;ua(kt);let Bt=v.indexOf(X);if((kt.ctrlKey||kt.metaKey)!=K.isolate){let Qt=v.some((on,hn)=>hn>0&&hn!=Bt&&on.show);v.forEach((on,hn)=>{hn>0&&Wh(hn,Qt?hn==Bt?Xt:Mt:Xt,!0,gr.setSeries)})}else Wh(Bt,{show:!X.show},!0,gr.setSeries)},!1),Ei&&Cs(mpe,Be,kt=>{V._lock||(ua(kt),Wh(v.indexOf(X),tv,!0,gr.setSeries))},!1));for(var ut in lt){let kt=Zg("td",ZCt,Se);kt.textContent="--",we.push(kt)}return[Se,we]}const Mn=new Map;function Cs(X,ne,we,Se=!0){const Be=Mn.get(ne)||{},Xe=V.bind[X](n,ne,we,Se);Xe&&(D0(X,ne,Be[X]=Xe),Mn.set(ne,Be))}function or(X,ne,we){const Se=Mn.get(ne)||{};for(let Be in Se)(X==null||Be==X)&&(EJ(Be,ne,Se[Be]),delete Se[Be]);X==null&&Mn.delete(ne)}let ge=0,Ue=0,Ee=0,Ne=0,le=0,Pe=0,Re=le,We=Pe,ct=Ee,gn=Ne,$n=0,Ln=0,yi=0,oi=0;n.bbox={};let Xn=!1,go=!1,wo=!1,Kr=!1,hl=!1,da=!1;function gl(X,ne,we){(we||X!=n.width||ne!=n.height)&&jo(X,ne),Kb(!1),wo=!0,go=!0,Jb()}function jo(X,ne){n.width=ge=Ee=X,n.height=Ue=Ne=ne,le=Pe=0,Gd(),$u();let we=n.bbox;$n=we.left=pC(le*Hs,.5),Ln=we.top=pC(Pe*Hs,.5),yi=we.width=pC(Ee*Hs,.5),oi=we.height=pC(Ne*Hs,.5)}const Vh=3;function Ts(){let X=!1,ne=0;for(;!X;){ne++;let we=O2(ne),Se=W7(ne);X=ne==Vh||we&&Se,X||(jo(n.width,n.height),go=!0)}}function ad({width:X,height:ne}){gl(X,ne)}n.setSize=ad;function Gd(){let X=!1,ne=!1,we=!1,Se=!1;w.forEach((Be,Xe)=>{if(Be.show&&Be._show){let{side:ut,_size:kt}=Be,Bt=ut%2,Qt=Be.label!=null?Be.labelSize:0,on=kt+Qt;on>0&&(Bt?(Ee-=on,ut==3?(le+=on,Se=!0):we=!0):(Ne-=on,ut==0?(Pe+=on,X=!0):ne=!0))}}),Dr[0]=X,Dr[1]=we,Dr[2]=ne,Dr[3]=Se,Ee-=cn[1]+cn[3],le+=cn[3],Ne-=cn[2]+cn[0],Pe+=cn[0]}function $u(){let X=le+Ee,ne=Pe+Ne,we=le,Se=Pe;function Be(Xe,ut){switch(Xe){case 1:return X+=ut,X-ut;case 2:return ne+=ut,ne-ut;case 3:return we-=ut,we+ut;case 0:return Se-=ut,Se+ut}}w.forEach((Xe,ut)=>{if(Xe.show&&Xe._show){let kt=Xe.side;Xe._pos=Be(kt,Xe._size),Xe.label!=null&&(Xe._lpos=Be(kt,Xe.labelSize))}})}if(V.dataIdx==null){let X=V.hover,ne=X.skip=new Set(X.skip??[]);ne.add(void 0);let we=X.prox=Ki(X.prox),Se=X.bias??=0;V.dataIdx=(Be,Xe,ut,kt)=>{if(Xe==0)return ut;let Bt=ut,Qt=we(Be,Xe,ut,kt)??Fo,on=Qt>=0&&Qt<Fo,hn=T.ori==0?Ee:Ne,ti=V.left,xs=e[0],us=e[Xe];if(ne.has(us[ut])){Bt=null;let Ri=null,Vn=null,In;if(Se==0||Se==-1)for(In=ut;Ri==null&&In-- >0;)ne.has(us[In])||(Ri=In);if(Se==0||Se==1)for(In=ut;Vn==null&&In++<us.length;)ne.has(us[In])||(Vn=In);if(Ri!=null||Vn!=null)if(on){let Po=Ri==null?-1/0:R(xs[Ri],T,hn,0),mr=Vn==null?1/0:R(xs[Vn],T,hn,0),Pr=ti-Po,zs=mr-ti;Pr<=zs?Pr<=Qt&&(Bt=Ri):zs<=Qt&&(Bt=Vn)}else Bt=Vn==null?Ri:Ri==null?Vn:ut-Ri<=Vn-ut?Ri:Vn}else on&&yl(ti-R(xs[ut],T,hn,0))>Qt&&(Bt=null);return Bt}}const ua=X=>{V.event=X};V.idxs=Z,V._lock=!1;let es=V.points;es.show=Ki(es.show),es.size=Ki(es.size),es.stroke=Ki(es.stroke),es.width=Ki(es.width),es.fill=Ki(es.fill);const Lt=n.focus=Ja({},i.focus||{alpha:.3},V.focus),Ei=Lt.prox>=0,Ss=Ei&&es.one;let Pi=[],Jr=[],Oa=[];function Fa(X,ne){let we=es.show(n,ne);if(we instanceof HTMLElement)return Xu(we,qCt),Xu(we,X.class),gf(we,-10,-10,Ee,Ne),f.insertBefore(we,Pi[ne]),we}function Dn(X,ne){if(s==1||ne>0){let we=s==1&&y[X.scale].time,Se=X.value;X.value=we?Dpe(Se)?Ope(O,Ape(Se,B)):Se||$:Se||a1t,X.label=X.label||(we?Z0t:Q0t)}if(Ss||ne>0){X.width=X.width==null?1:X.width,X.paths=X.paths||w1t||u0t,X.fillTo=Ki(X.fillTo||h1t),X.pxAlign=+Ps(X.pxAlign,p),X.pxRound=jpe(X.pxAlign),X.stroke=Ki(X.stroke||null),X.fill=Ki(X.fill||null),X._stroke=X._fill=X._paths=X._focus=null;let we=l1t(xd(1,X.width),1),Se=X.points=Ja({},{size:we,width:xd(1,we*.2),stroke:X.stroke,space:we*2,paths:C1t,_stroke:null,_fill:null},X.points);Se.show=Ki(Se.show),Se.filter=Ki(Se.filter),Se.fill=Ki(Se.fill),Se.stroke=Ki(Se.stroke),Se.paths=Ki(Se.paths),Se.pxAlign=X.pxAlign}if(fe){let we=Ht(X,ne);Ie.splice(ne,0,we[0]),Te.splice(ne,0,we[1]),K.values.push(null)}if(Q){Z.splice(ne,0,null);let we=null;Ss?ne==0&&(we=Fa(X,ne)):ne>0&&(we=Fa(X,ne)),Pi.splice(ne,0,we),Jr.splice(ne,0,0),Oa.splice(ne,0,0)}ga("addSeries",ne)}function Lr(X,ne){ne=ne??v.length,X=s==1?FJ(X,ne,Bpe,$pe):FJ(X,ne,{},Hpe),v.splice(ne,0,X),Dn(v[ne],ne)}n.addSeries=Lr;function tf(X){if(v.splice(X,1),fe){K.values.splice(X,1),Te.splice(X,1);let ne=Ie.splice(X,1)[0];or(null,ne.firstChild),ne.remove()}Q&&(Z.splice(X,1),Pi.splice(X,1)[0].remove(),Jr.splice(X,1),Oa.splice(X,1)),ga("delSeries",X)}n.delSeries=tf;const Dr=[!1,!1,!1,!1];function Tr(X,ne){if(X._show=X.show,X.show){let we=X.side%2,Se=y[X.scale];Se==null&&(X.scale=we?v[1].scale:C,Se=y[X.scale]);let Be=Se.time;X.size=Ki(X.size),X.space=Ki(X.space),X.rotate=Ki(X.rotate),Tv(X.incrs)&&X.incrs.forEach(ut=>{!Vy.has(ut)&&Vy.set(ut,BMe(ut))}),X.incrs=Ki(X.incrs||(Se.distr==2?R0t:Be?b==1?A0t:B0t:_C)),X.splits=Ki(X.splits||(Be&&Se.distr==1?z:Se.distr==3?RJ:Se.distr==4?n1t:t1t)),X.stroke=Ki(X.stroke),X.grid.stroke=Ki(X.grid.stroke),X.ticks.stroke=Ki(X.ticks.stroke),X.border.stroke=Ki(X.border.stroke);let Xe=X.values;X.values=Tv(Xe)&&!Tv(Xe[0])?Ki(Xe):Be?Tv(Xe)?Mpe(O,Rpe(Xe,B)):Dpe(Xe)?W0t(O,Xe):Xe||Y:Xe||e1t,X.filter=Ki(X.filter||(Se.distr>=3&&Se.log==10?o1t:Se.distr==3&&Se.log==2?r1t:OMe)),X.font=Jpe(X.font),X.labelFont=Jpe(X.labelFont),X._size=X.size(n,null,ne,0),X._space=X._rotate=X._incrs=X._found=X._splits=X._values=null,X._size>0&&(Dr[ne]=!0,X._el=Jh($Ct,g))}}function ha(X,ne,we,Se){let[Be,Xe,ut,kt]=we,Bt=ne%2,Qt=0;return Bt==0&&(kt||Xe)&&(Qt=ne==0&&!Be||ne==2&&!ut?pl(Fpe.size/3):0),Bt==1&&(Be||ut)&&(Qt=ne==1&&!Xe||ne==3&&!kt?pl(zpe.size/2):0),Qt}const Hb=n.padding=(i.padding||[ha,ha,ha,ha]).map(X=>Ki(Ps(X,ha))),cn=n._padding=Hb.map((X,ne)=>X(n,ne,Dr,0));let Me,bt=null,Kt=null;const Vs=s==1?v[0].idxs:null;let Qs=null,Co=!1;function ml(X,ne){if(e=X??[],n.data=n._data=e,s==2){Me=0;for(let we=1;we<v.length;we++)Me+=e[we][0].length}else{e.length==0&&(n.data=n._data=e=[[]]),Qs=e[0],Me=Qs.length;let we=e;if(E==2){we=e.slice();let Se=we[0]=Array(Me);for(let Be=0;Be<Me;Be++)Se[Be]=Be}n._data=e=we}if(Kb(!0),ga("setData"),E==2&&(wo=!0),ne!==!1){let we=T;we.auto(n,Co)?ld():sf(C,we.min,we.max),Kr=Kr||V.left>=0,da=!0,Jb()}}n.setData=ml;function ld(){Co=!0;let X,ne;s==1&&(Me>0?(bt=Vs[0]=0,Kt=Vs[1]=Me-1,X=e[0][bt],ne=e[0][Kt],E==2?(X=bt,ne=Kt):X==ne&&(E==3?[X,ne]=l6(X,X,T.log,!1):E==4?[X,ne]=voe(X,X,T.log,!1):T.time?ne=X+pl(86400/b):[X,ne]=YB(X,ne,yoe,!0))):(bt=Vs[0]=X=null,Kt=Vs[1]=ne=null)),sf(C,X,ne)}let Uu,zh,Er,$b,Ub,$L,UL,jb,xw,Tc;function R2(X,ne,we,Se,Be,Xe){X??=hpe,we??=Coe,Se??="butt",Be??=hpe,Xe??="round",X!=Uu&&(h.strokeStyle=Uu=X),Be!=zh&&(h.fillStyle=zh=Be),ne!=Er&&(h.lineWidth=Er=ne),Xe!=Ub&&(h.lineJoin=Ub=Xe),Se!=$L&&(h.lineCap=$L=Se),we!=$b&&h.setLineDash($b=we)}function jL(X,ne,we,Se){ne!=zh&&(h.fillStyle=zh=ne),X!=UL&&(h.font=UL=X),we!=jb&&(h.textAlign=jb=we),Se!=xw&&(h.textBaseline=xw=Se)}function GL(X,ne,we,Se,Be=0){if(Se.length>0&&X.auto(n,Co)&&(ne==null||ne.min==null)){let Xe=Ps(bt,0),ut=Ps(Kt,Se.length-1),kt=we.min==null?o0t(Se,Xe,ut,Be,X.distr==3):[we.min,we.max];X.min=Cm(X.min,we.min=kt[0]),X.max=xd(X.max,we.max=kt[1])}}const qL={min:null,max:null};function z7(){for(let Se in y){let Be=y[Se];M[Se]==null&&(Be.min==null||M[C]!=null&&Be.auto(n,Co))&&(M[Se]=qL)}for(let Se in y){let Be=y[Se];M[Se]==null&&Be.from!=null&&M[Be.from]!=null&&(M[Se]=qL)}M[C]!=null&&Kb(!0);let X={};for(let Se in M){let Be=M[Se];if(Be!=null){let Xe=X[Se]=KI(y[Se],m0t);if(Be.min!=null)Ja(Xe,Be);else if(Se!=C||s==2)if(Me==0&&Xe.from==null){let ut=Xe.range(n,null,null,Se);Xe.min=ut[0],Xe.max=ut[1]}else Xe.min=Fo,Xe.max=-Fo}}if(Me>0){v.forEach((Se,Be)=>{if(s==1){let Xe=Se.scale,ut=M[Xe];if(ut==null)return;let kt=X[Xe];if(Be==0){let Bt=kt.range(n,kt.min,kt.max,Xe);kt.min=Bt[0],kt.max=Bt[1],bt=hm(kt.min,e[0]),Kt=hm(kt.max,e[0]),Kt-bt>1&&(e[0][bt]<kt.min&&bt++,e[0][Kt]>kt.max&&Kt--),Se.min=Qs[bt],Se.max=Qs[Kt]}else Se.show&&Se.auto&&GL(kt,ut,Se,e[Be],Se.sorted);Se.idxs[0]=bt,Se.idxs[1]=Kt}else if(Be>0&&Se.show&&Se.auto){let[Xe,ut]=Se.facets,kt=Xe.scale,Bt=ut.scale,[Qt,on]=e[Be],hn=X[kt],ti=X[Bt];hn!=null&&GL(hn,M[kt],Xe,Qt,Xe.sorted),ti!=null&&GL(ti,M[Bt],ut,on,ut.sorted),Se.min=ut.min,Se.max=ut.max}});for(let Se in X){let Be=X[Se],Xe=M[Se];if(Be.from==null&&(Xe==null||Xe.min==null)){let ut=Be.range(n,Be.min==Fo?null:Be.min,Be.max==-Fo?null:Be.max,Se);Be.min=ut[0],Be.max=ut[1]}}}for(let Se in X){let Be=X[Se];if(Be.from!=null){let Xe=X[Be.from];if(Xe.min==null)Be.min=Be.max=null;else{let ut=Be.range(n,Xe.min,Xe.max,Se);Be.min=ut[0],Be.max=ut[1]}}}let ne={},we=!1;for(let Se in X){let Be=X[Se],Xe=y[Se];if(Xe.min!=Be.min||Xe.max!=Be.max){Xe.min=Be.min,Xe.max=Be.max;let ut=Xe.distr;Xe._min=ut==3?$_(Xe.min):ut==4?Z8(Xe.min,Xe.asinh):ut==100?Xe.fwd(Xe.min):Xe.min,Xe._max=ut==3?$_(Xe.max):ut==4?Z8(Xe.max,Xe.asinh):ut==100?Xe.fwd(Xe.max):Xe.max,ne[Se]=we=!0}}if(we){v.forEach((Se,Be)=>{s==2?Be>0&&ne.y&&(Se._paths=null):ne[Se.scale]&&(Se._paths=null)});for(let Se in ne)wo=!0,ga("setScale",Se);Q&&V.left>=0&&(Kr=da=!0)}for(let Se in M)M[Se]=null}function Gb(X){let ne=PJ(bt-1,0,Me-1),we=PJ(Kt+1,0,Me-1);for(;X[ne]==null&&ne>0;)ne--;for(;X[we]==null&&we<Me-1;)we++;return[ne,we]}function M2(){if(Me>0){let X=v.some(ne=>ne._focus)&&Tc!=Lt.alpha;X&&(h.globalAlpha=Tc=Lt.alpha),v.forEach((ne,we)=>{if(we>0&&ne.show&&(pS(we,!1),pS(we,!0),ne._paths==null)){let Se=Tc;Tc!=ne.alpha&&(h.globalAlpha=Tc=ne.alpha);let Be=s==2?[0,e[we][0].length-1]:Gb(e[we]);ne._paths=ne.paths(n,we,Be[0],Be[1]),Tc!=Se&&(h.globalAlpha=Tc=Se)}}),v.forEach((ne,we)=>{if(we>0&&ne.show){let Se=Tc;Tc!=ne.alpha&&(h.globalAlpha=Tc=ne.alpha),ne._paths!=null&&qb(we,!1);{let Be=ne._paths!=null?ne._paths.gaps:null,Xe=ne.points.show(n,we,bt,Kt,Be),ut=ne.points.filter(n,we,Xe,Be);(Xe||ut)&&(ne.points._paths=ne.points.paths(n,we,bt,Kt,ut),qb(we,!0))}Tc!=Se&&(h.globalAlpha=Tc=Se),ga("drawSeries",we)}}),X&&(h.globalAlpha=Tc=1)}}function pS(X,ne){let we=ne?v[X].points:v[X];we._stroke=we.stroke(n,X),we._fill=we.fill(n,X)}function qb(X,ne){let we=ne?v[X].points:v[X],{stroke:Se,fill:Be,clip:Xe,flags:ut,_stroke:kt=we._stroke,_fill:Bt=we._fill,_width:Qt=we.width}=we._paths;Qt=Bo(Qt*Hs,3);let on=null,hn=Qt%2/2;ne&&Bt==null&&(Bt=Qt>0?"#fff":kt);let ti=we.pxAlign==1&&hn>0;if(ti&&h.translate(hn,hn),!ne){let xs=$n-Qt/2,us=Ln-Qt/2,Ri=yi+Qt,Vn=oi+Qt;on=new Path2D,on.rect(xs,us,Ri,Vn)}ne?Hg(kt,Qt,we.dash,we.cap,Bt,Se,Be,ut,Xe):_S(X,kt,Qt,we.dash,we.cap,Bt,Se,Be,ut,on,Xe),ti&&h.translate(-hn,-hn)}function _S(X,ne,we,Se,Be,Xe,ut,kt,Bt,Qt,on){let hn=!1;Bt!=0&&S.forEach((ti,xs)=>{if(ti.series[0]==X){let us=v[ti.series[1]],Ri=e[ti.series[1]],Vn=(us._paths||WE).band;Tv(Vn)&&(Vn=ti.dir==1?Vn[0]:Vn[1]);let In,Po=null;us.show&&Vn&&a0t(Ri,bt,Kt)?(Po=ti.fill(n,xs)||Xe,In=us._paths.clip):Vn=null,Hg(ne,we,Se,Be,Po,ut,kt,Bt,Qt,on,In,Vn),hn=!0}}),hn||Hg(ne,we,Se,Be,Xe,ut,kt,Bt,Qt,on)}const Wg=JI|AJ;function Hg(X,ne,we,Se,Be,Xe,ut,kt,Bt,Qt,on,hn){R2(X,ne,we,Se,Be),(Bt||Qt||hn)&&(h.save(),Bt&&h.clip(Bt),Qt&&h.clip(Qt)),hn?(kt&Wg)==Wg?(h.clip(hn),on&&h.clip(on),bS(Be,ut),Nw(X,Xe,ne)):kt&AJ?(bS(Be,ut),h.clip(hn),Nw(X,Xe,ne)):kt&JI&&(h.save(),h.clip(hn),on&&h.clip(on),bS(Be,ut),h.restore(),Nw(X,Xe,ne)):(bS(Be,ut),Nw(X,Xe,ne)),(Bt||Qt||hn)&&h.restore()}function Nw(X,ne,we){we>0&&(ne instanceof Map?ne.forEach((Se,Be)=>{h.strokeStyle=Uu=Be,h.stroke(Se)}):ne!=null&&X&&h.stroke(ne))}function bS(X,ne){ne instanceof Map?ne.forEach((we,Se)=>{h.fillStyle=zh=Se,h.fill(we)}):ne!=null&&X&&h.fill(ne)}function A2(X,ne,we,Se){let Be=w[X],Xe;if(Se<=0)Xe=[0,0];else{let ut=Be._space=Be.space(n,X,ne,we,Se),kt=Be._incrs=Be.incrs(n,X,ne,we,Se,ut);Xe=L1t(ne,we,kt,Se,ut)}return Be._found=Xe}function KL(X,ne,we,Se,Be,Xe,ut,kt,Bt,Qt){let on=ut%2/2;p==1&&h.translate(on,on),R2(kt,ut,Bt,Qt,kt),h.beginPath();let hn,ti,xs,us,Ri=Be+(Se==0||Se==3?-Xe:Xe);we==0?(ti=Be,us=Ri):(hn=Be,xs=Ri);for(let Vn=0;Vn<X.length;Vn++)ne[Vn]!=null&&(we==0?hn=xs=X[Vn]:ti=us=X[Vn],h.moveTo(hn,ti),h.lineTo(xs,us));h.stroke(),p==1&&h.translate(-on,-on)}function O2(X){let ne=!0;return w.forEach((we,Se)=>{if(!we.show)return;let Be=y[we.scale];if(Be.min==null){we._show&&(ne=!1,we._show=!1,Kb(!1));return}else we._show||(ne=!1,we._show=!0,Kb(!1));let Xe=we.side,ut=Xe%2,{min:kt,max:Bt}=Be,[Qt,on]=A2(Se,kt,Bt,ut==0?Ee:Ne);if(on==0)return;let hn=Be.distr==2,ti=we._splits=we.splits(n,Se,kt,Bt,Qt,on,hn),xs=Be.distr==2?ti.map(In=>Qs[In]):ti,us=Be.distr==2?Qs[ti[1]]-Qs[ti[0]]:Qt,Ri=we._values=we.values(n,we.filter(n,xs,Se,on,us),Se,on,us);we._rotate=Xe==2?we.rotate(n,Ri,Se,on):0;let Vn=we._size;we._size=ag(we.size(n,Ri,Se,X)),Vn!=null&&we._size!=Vn&&(ne=!1)}),ne}function W7(X){let ne=!0;return Hb.forEach((we,Se)=>{let Be=we(n,Se,Dr,X);Be!=cn[Se]&&(ne=!1),cn[Se]=Be}),ne}function F2(){for(let X=0;X<w.length;X++){let ne=w[X];if(!ne.show||!ne._show)continue;let we=ne.side,Se=we%2,Be,Xe,ut=ne.stroke(n,X),kt=we==0||we==3?-1:1,[Bt,Qt]=ne._found;if(ne.label!=null){let rr=ne.labelGap*kt,Wa=pl((ne._lpos+rr)*Hs);jL(ne.labelFont[0],ut,"center",we==2?FD:upe),h.save(),Se==1?(Be=Xe=0,h.translate(Wa,pl(Ln+oi/2)),h.rotate((we==3?-u4:u4)/2)):(Be=pl($n+yi/2),Xe=Wa);let fa=MMe(ne.label)?ne.label(n,X,Bt,Qt):ne.label;h.fillText(fa,Be,Xe),h.restore()}if(Qt==0)continue;let on=y[ne.scale],hn=Se==0?yi:oi,ti=Se==0?$n:Ln,xs=ne._splits,us=on.distr==2?xs.map(rr=>Qs[rr]):xs,Ri=on.distr==2?Qs[xs[1]]-Qs[xs[0]]:Bt,Vn=ne.ticks,In=ne.border,Po=Vn.show?Vn.size:0,mr=pl(Po*Hs),Pr=pl((ne.alignTo==2?ne._size-Po-ne.gap:ne.gap)*Hs),zs=ne._rotate*-u4/180,fr=_(ne._pos*Hs),cd=(mr+Pr)*kt,ic=fr+cd;Xe=Se==0?ic:0,Be=Se==1?ic:0;let ht=ne.font[0],Mi=ne.align==1?XS:ne.align==2?Y8:zs>0?XS:zs<0?Y8:Se==0?"center":we==3?Y8:XS,Es=zs||Se==1?"middle":we==2?FD:upe;jL(ht,ut,Mi,Es);let ma=ne.font[1]*ne.lineGap,mo=xs.map(rr=>_(a(rr,on,hn,ti))),Ro=ne._values;for(let rr=0;rr<Ro.length;rr++){let Wa=Ro[rr];if(Wa!=null){Se==0?Be=mo[rr]:Xe=mo[rr],Wa=""+Wa;let fa=Wa.indexOf(`
376
- `)==-1?[Wa]:Wa.split(/\n/gm);for(let Rr=0;Rr<fa.length;Rr++){let Mue=fa[Rr];zs?(h.save(),h.translate(Be,Xe+Rr*ma),h.rotate(zs),h.fillText(Mue,0,0),h.restore()):h.fillText(Mue,Be,Xe+Rr*ma)}}}Vn.show&&KL(mo,Vn.filter(n,us,X,Qt,Ri),Se,we,fr,mr,Bo(Vn.width*Hs,3),Vn.stroke(n,X),Vn.dash,Vn.cap);let qo=ne.grid;qo.show&&KL(mo,qo.filter(n,us,X,Qt,Ri),Se,Se==0?2:1,Se==0?Ln:$n,Se==0?oi:yi,Bo(qo.width*Hs,3),qo.stroke(n,X),qo.dash,qo.cap),In.show&&KL([fr],[1],Se==0?1:0,Se==0?1:2,Se==1?Ln:$n,Se==1?oi:yi,Bo(In.width*Hs,3),In.stroke(n,X),In.dash,In.cap)}ga("drawAxes")}function Kb(X){v.forEach((ne,we)=>{we>0&&(ne._paths=null,X&&(s==1?(ne.min=null,ne.max=null):ne.facets.forEach(Se=>{Se.min=null,Se.max=null})))})}let Iw=!1,JL=!1,kw=[];function H7(){JL=!1;for(let X=0;X<kw.length;X++)ga(...kw[X]);kw.length=0}function Jb(){Iw||(w0t(B2),Iw=!0)}function $7(X,ne=!1){Iw=!0,JL=ne,X(n),B2(),ne&&kw.length>0&&queueMicrotask(H7)}n.batch=$7;function B2(){if(Xn&&(z7(),Xn=!1),wo&&(Ts(),wo=!1),go){if(cr(m,XS,le),cr(m,FD,Pe),cr(m,XT,Ee),cr(m,QT,Ne),cr(f,XS,le),cr(f,FD,Pe),cr(f,XT,Ee),cr(f,QT,Ne),cr(g,XT,ge),cr(g,QT,Ue),d.width=pl(ge*Hs),d.height=pl(Ue*Hs),w.forEach(({_el:X,_show:ne,_size:we,_pos:Se,side:Be})=>{if(X!=null)if(ne){let Xe=Be===3||Be===0?we:0,ut=Be%2==1;cr(X,ut?"left":"top",Se-Xe),cr(X,ut?"width":"height",we),cr(X,ut?"top":"left",ut?Pe:le),cr(X,ut?"height":"width",ut?Ne:Ee),TJ(X,EC)}else Xu(X,EC)}),Uu=zh=Er=Ub=$L=UL=jb=xw=$b=null,Tc=1,Dw(!0),le!=Re||Pe!=We||Ee!=ct||Ne!=gn){Kb(!1);let X=Ee/ct,ne=Ne/gn;if(Q&&!Kr&&V.left>=0){V.left*=X,V.top*=ne,Yb&&gf(Yb,pl(V.left),0,Ee,Ne),Op&&gf(Op,0,pl(V.top),Ee,Ne);for(let we=0;we<Pi.length;we++){let Se=Pi[we];Se!=null&&(Jr[we]*=X,Oa[we]*=ne,gf(Se,ag(Jr[we]),ag(Oa[we]),Ee,Ne))}}if(Eo.show&&!hl&&Eo.left>=0&&Eo.width>0){Eo.left*=X,Eo.width*=X,Eo.top*=ne,Eo.height*=ne;for(let we in nD)cr(Zb,we,Eo[we])}Re=le,We=Pe,ct=Ee,gn=Ne}ga("setSize"),go=!1}ge>0&&Ue>0&&(h.clearRect(0,0,d.width,d.height),ga("drawClear"),k.forEach(X=>X()),ga("draw")),Eo.show&&hl&&(ev(Eo),hl=!1),Q&&Kr&&(Bp(null,!0,!1),Kr=!1),K.show&&K.live&&da&&(eD(),da=!1),l||(l=!0,n.status=1,ga("ready")),Co=!1,Iw=!1}n.redraw=(X,ne)=>{wo=ne||!1,X!==!1?sf(C,T.min,T.max):Jb()};function YL(X,ne){let we=y[X];if(we.from==null){if(Me==0){let Se=we.range(n,ne.min,ne.max,X);ne.min=Se[0],ne.max=Se[1]}if(ne.min>ne.max){let Se=ne.min;ne.min=ne.max,ne.max=Se}if(Me>1&&ne.min!=null&&ne.max!=null&&ne.max-ne.min<1e-16)return;X==C&&we.distr==2&&Me>0&&(ne.min=hm(ne.min,e[0]),ne.max=hm(ne.max,e[0]),ne.min==ne.max&&ne.max++),M[X]=ne,Xn=!0,Jb()}}n.setScale=YL;let XL,vS,Yb,Op,V2,z2,Xb,Qb,W2,H2,To,Go,nf=!1;const Ba=V.drag;let Va=Ba.x,za=Ba.y;Q&&(V.x&&(XL=Jh(jCt,f)),V.y&&(vS=Jh(GCt,f)),T.ori==0?(Yb=XL,Op=vS):(Yb=vS,Op=XL),To=V.left,Go=V.top);const Eo=n.select=Ja({show:!0,over:!0,left:0,width:0,top:0,height:0},i.select),Zb=Eo.show?Jh(UCt,Eo.over?f:m):null;function ev(X,ne){if(Eo.show){for(let we in X)Eo[we]=X[we],we in nD&&cr(Zb,we,X[we]);ne!==!1&&ga("setSelect")}}n.setSelect=ev;function QL(X){if(v[X].show)fe&&TJ(Ie[X],EC);else if(fe&&Xu(Ie[X],EC),Q){let we=Ss?Pi[0]:Pi[X];we!=null&&gf(we,-10,-10,Ee,Ne)}}function sf(X,ne,we){YL(X,{min:ne,max:we})}function Wh(X,ne,we,Se){ne.focus!=null&&q7(X),ne.show!=null&&v.forEach((Be,Xe)=>{Xe>0&&(X==Xe||X==null)&&(Be.show=ne.show,QL(Xe),s==2?(sf(Be.facets[0].scale,null,null),sf(Be.facets[1].scale,null,null)):sf(Be.scale,null,null),Jb())}),we!==!1&&ga("setSeries",X,ne),Se&&Pw("setSeries",n,X,ne)}n.setSeries=Wh;function U7(X,ne){Ja(S[X],ne)}function j7(X,ne){X.fill=Ki(X.fill||null),X.dir=Ps(X.dir,-1),ne=ne??S.length,S.splice(ne,0,X)}function of(X){X==null?S.length=0:S.splice(X,1)}n.addBand=j7,n.setBand=U7,n.delBand=of;function G7(X,ne){v[X].alpha=ne,Q&&Pi[X]!=null&&(Pi[X].style.opacity=ne),fe&&Ie[X]&&(Ie[X].style.opacity=ne)}let $g,rf,Fp;const tv={focus:!0};function q7(X){if(X!=Fp){let ne=X==null,we=Lt.alpha!=1;v.forEach((Se,Be)=>{if(s==1||Be>0){let Xe=ne||Be==0||Be==X;Se._focus=ne?null:Xe,we&&G7(Be,Xe?1:Lt.alpha)}}),Fp=X,we&&Jb()}}fe&&Ei&&Cs(fpe,ve,X=>{V._lock||(ua(X),Fp!=null&&Wh(null,tv,!0,gr.setSeries))});function qd(X,ne,we){let Se=y[ne];we&&(X=X/Hs-(Se.ori==1?Pe:le));let Be=Ee;Se.ori==1&&(Be=Ne,X=Be-X),Se.dir==-1&&(X=Be-X);let Xe=Se._min,ut=Se._max,kt=X/Be,Bt=Xe+(ut-Xe)*kt,Qt=Se.distr;return Qt==3?GI(10,Bt):Qt==4?c0t(Bt,Se.asinh):Qt==100?Se.bwd(Bt):Bt}function K7(X,ne){let we=qd(X,C,ne);return hm(we,e[0],bt,Kt)}n.valToIdx=X=>hm(X,e[0]),n.posToIdx=K7,n.posToVal=qd,n.valToPos=(X,ne,we)=>y[ne].ori==0?o(X,y[ne],we?yi:Ee,we?$n:0):r(X,y[ne],we?oi:Ne,we?Ln:0),n.setCursor=(X,ne,we)=>{To=X.left,Go=X.top,Bp(null,ne,we)};function ZL(X,ne){cr(Zb,XS,Eo.left=X),cr(Zb,XT,Eo.width=ne)}function $2(X,ne){cr(Zb,FD,Eo.top=X),cr(Zb,QT,Eo.height=ne)}let Lw=T.ori==0?ZL:$2,nv=T.ori==1?ZL:$2;function U2(){if(fe&&K.live)for(let X=s==2?1:0;X<v.length;X++){if(X==0&&it)continue;let ne=K.values[X],we=0;for(let Se in ne)Te[X][we++].firstChild.nodeValue=ne[Se]}}function eD(X,ne){if(X!=null&&(X.idxs?X.idxs.forEach((we,Se)=>{Z[Se]=we}):g0t(X.idx)||Z.fill(X.idx),K.idx=Z[0]),fe&&K.live){for(let we=0;we<v.length;we++)(we>0||s==1&&!it)&&J7(we,Z[we]);U2()}da=!1,ne!==!1&&ga("setLegend")}n.setLegend=eD;function J7(X,ne){let we=v[X],Se=X==0&&E==2?Qs:e[X],Be;it?Be=we.values(n,X,ne)??Ct:(Be=we.value(n,ne==null?null:Se[ne],X,ne),Be=Be==null?Ct:{_:Be}),K.values[X]=Be}function Bp(X,ne,we){W2=To,H2=Go,[To,Go]=V.move(n,To,Go),V.left=To,V.top=Go,Q&&(Yb&&gf(Yb,pl(To),0,Ee,Ne),Op&&gf(Op,0,pl(Go),Ee,Ne));let Se,Be=bt>Kt;$g=Fo,rf=null;let Xe=T.ori==0?Ee:Ne,ut=T.ori==1?Ee:Ne;if(To<0||Me==0||Be){Se=V.idx=null;for(let kt=0;kt<v.length;kt++){let Bt=Pi[kt];Bt!=null&&gf(Bt,-10,-10,Ee,Ne)}Ei&&Wh(null,tv,!0,X==null&&gr.setSeries),K.live&&(Z.fill(Se),da=!0)}else{let kt,Bt,Qt;s==1&&(kt=T.ori==0?To:Go,Bt=qd(kt,C),Se=V.idx=hm(Bt,e[0],bt,Kt),Qt=R(e[0][Se],T,Xe,0));let on=-10,hn=-10,ti=0,xs=0,us=!0,Ri="",Vn="";for(let In=s==2?1:0;In<v.length;In++){let Po=v[In],mr=Z[In],Pr=mr==null?null:s==1?e[In][mr]:e[In][1][mr],zs=V.dataIdx(n,In,Se,Bt),fr=zs==null?null:s==1?e[In][zs]:e[In][1][zs];if(da=da||fr!=Pr||zs!=mr,Z[In]=zs,In>0&&Po.show){let cd=zs==null?-10:zs==Se?Qt:R(s==1?e[0][zs]:e[In][0][zs],T,Xe,0),ic=fr==null?-10:A(fr,s==1?y[Po.scale]:y[Po.facets[1].scale],ut,0);if(Ei&&fr!=null){let ht=T.ori==1?To:Go,Mi=yl(Lt.dist(n,In,zs,ic,ht));if(Mi<$g){let Es=Lt.bias;if(Es!=0){let ma=qd(ht,Po.scale),mo=fr>=0?1:-1,Ro=ma>=0?1:-1;Ro==mo&&(Ro==1?Es==1?fr>=ma:fr<=ma:Es==1?fr<=ma:fr>=ma)&&($g=Mi,rf=In)}else $g=Mi,rf=In}}if(da||Ss){let ht,Mi;T.ori==0?(ht=cd,Mi=ic):(ht=ic,Mi=cd);let Es,ma,mo,Ro,qo,rr,Wa=!0,fa=es.bbox;if(fa!=null){Wa=!1;let Rr=fa(n,In);mo=Rr.left,Ro=Rr.top,Es=Rr.width,ma=Rr.height}else mo=ht,Ro=Mi,Es=ma=es.size(n,In);if(rr=es.fill(n,In),qo=es.stroke(n,In),Ss)In==rf&&$g<=Lt.prox&&(on=mo,hn=Ro,ti=Es,xs=ma,us=Wa,Ri=rr,Vn=qo);else{let Rr=Pi[In];Rr!=null&&(Jr[In]=mo,Oa[In]=Ro,Cpe(Rr,Es,ma,Wa),ype(Rr,rr,qo),gf(Rr,ag(mo),ag(Ro),Ee,Ne))}}}}if(Ss){let In=Lt.prox,Po=Fp==null?$g<=In:$g>In||rf!=Fp;if(da||Po){let mr=Pi[0];mr!=null&&(Jr[0]=on,Oa[0]=hn,Cpe(mr,ti,xs,us),ype(mr,Ri,Vn),gf(mr,ag(on),ag(hn),Ee,Ne))}}}if(Eo.show&&nf)if(X!=null){let[kt,Bt]=gr.scales,[Qt,on]=gr.match,[hn,ti]=X.cursor.sync.scales,xs=X.cursor.drag;if(Va=xs._x,za=xs._y,Va||za){let{left:us,top:Ri,width:Vn,height:In}=X.select,Po=X.scales[hn].ori,mr=X.posToVal,Pr,zs,fr,cd,ic,ht=kt!=null&&Qt(kt,hn),Mi=Bt!=null&&on(Bt,ti);ht&&Va?(Po==0?(Pr=us,zs=Vn):(Pr=Ri,zs=In),fr=y[kt],cd=R(mr(Pr,hn),fr,Xe,0),ic=R(mr(Pr+zs,hn),fr,Xe,0),Lw(Cm(cd,ic),yl(ic-cd))):Lw(0,Xe),Mi&&za?(Po==1?(Pr=us,zs=Vn):(Pr=Ri,zs=In),fr=y[Bt],cd=A(mr(Pr,ti),fr,ut,0),ic=A(mr(Pr+zs,ti),fr,ut,0),nv(Cm(cd,ic),yl(ic-cd))):nv(0,ut)}else iD()}else{let kt=yl(W2-V2),Bt=yl(H2-z2);if(T.ori==1){let ti=kt;kt=Bt,Bt=ti}Va=Ba.x&&kt>=Ba.dist,za=Ba.y&&Bt>=Ba.dist;let Qt=Ba.uni;Qt!=null?Va&&za&&(Va=kt>=Qt,za=Bt>=Qt,!Va&&!za&&(Bt>kt?za=!0:Va=!0)):Ba.x&&Ba.y&&(Va||za)&&(Va=za=!0);let on,hn;Va&&(T.ori==0?(on=Xb,hn=To):(on=Qb,hn=Go),Lw(Cm(on,hn),yl(hn-on)),za||nv(0,ut)),za&&(T.ori==1?(on=Xb,hn=To):(on=Qb,hn=Go),nv(Cm(on,hn),yl(hn-on)),Va||Lw(0,Xe)),!Va&&!za&&(Lw(0,0),nv(0,0))}if(Ba._x=Va,Ba._y=za,X==null){if(we){if(J2!=null){let[kt,Bt]=gr.scales;gr.values[0]=kt!=null?qd(T.ori==0?To:Go,kt):null,gr.values[1]=Bt!=null?qd(T.ori==1?To:Go,Bt):null}Pw(X8,n,To,Go,Ee,Ne,Se)}if(Ei){let kt=we&&gr.setSeries,Bt=Lt.prox;Fp==null?$g<=Bt&&Wh(rf,tv,!0,kt):$g>Bt?Wh(null,tv,!0,kt):rf!=Fp&&Wh(rf,tv,!0,kt)}}da&&(K.idx=Se,eD()),ne!==!1&&ga("setCursor")}let af=null;Object.defineProperty(n,"rect",{get(){return af==null&&Dw(!1),af}});function Dw(X=!1){X?af=null:(af=f.getBoundingClientRect(),ga("syncRect",af))}function j2(X,ne,we,Se,Be,Xe,ut){V._lock||nf&&X!=null&&X.movementX==0&&X.movementY==0||(tD(X,ne,we,Se,Be,Xe,ut,!1,X!=null),X!=null?Bp(null,!0,!0):Bp(ne,!0,!1))}function tD(X,ne,we,Se,Be,Xe,ut,kt,Bt){if(af==null&&Dw(!1),ua(X),X!=null)we=X.clientX-af.left,Se=X.clientY-af.top;else{if(we<0||Se<0){To=-10,Go=-10;return}let[Qt,on]=gr.scales,hn=ne.cursor.sync,[ti,xs]=hn.values,[us,Ri]=hn.scales,[Vn,In]=gr.match,Po=ne.axes[0].side%2==1,mr=T.ori==0?Ee:Ne,Pr=T.ori==1?Ee:Ne,zs=Po?Xe:Be,fr=Po?Be:Xe,cd=Po?Se:we,ic=Po?we:Se;if(us!=null?we=Vn(Qt,us)?a(ti,y[Qt],mr,0):-10:we=mr*(cd/zs),Ri!=null?Se=In(on,Ri)?a(xs,y[on],Pr,0):-10:Se=Pr*(ic/fr),T.ori==1){let ht=we;we=Se,Se=ht}}Bt&&(ne==null||ne.cursor.event.type==X8)&&((we<=1||we>=Ee-1)&&(we=pC(we,Ee)),(Se<=1||Se>=Ne-1)&&(Se=pC(Se,Ne))),kt?(V2=we,z2=Se,[Xb,Qb]=V.move(n,we,Se)):(To=we,Go=Se)}const nD={width:0,height:0,left:0,top:0};function iD(){ev(nD,!1)}let sD,oD,yS,G2;function q2(X,ne,we,Se,Be,Xe,ut){nf=!0,Va=za=Ba._x=Ba._y=!1,tD(X,ne,we,Se,Be,Xe,ut,!0,!1),X!=null&&(Cs(Q8,LJ,rD,!1),Pw(gpe,n,Xb,Qb,Ee,Ne,null));let{left:kt,top:Bt,width:Qt,height:on}=Eo;sD=kt,oD=Bt,yS=Qt,G2=on}function rD(X,ne,we,Se,Be,Xe,ut){nf=Ba._x=Ba._y=!1,tD(X,ne,we,Se,Be,Xe,ut,!1,!0);let{left:kt,top:Bt,width:Qt,height:on}=Eo,hn=Qt>0||on>0,ti=sD!=kt||oD!=Bt||yS!=Qt||G2!=on;if(hn&&ti&&ev(Eo),Ba.setScale&&hn&&ti){let xs=kt,us=Qt,Ri=Bt,Vn=on;if(T.ori==1&&(xs=Bt,us=on,Ri=kt,Vn=Qt),Va&&sf(C,qd(xs,C),qd(xs+us,C)),za)for(let In in y){let Po=y[In];In!=C&&Po.from==null&&Po.min!=Fo&&sf(In,qd(Ri+Vn,In),qd(Ri,In))}iD()}else V.lock&&(V._lock=!V._lock,Bp(ne,!0,X!=null));X!=null&&(or(Q8,LJ),Pw(Q8,n,To,Go,Ee,Ne,null))}function K2(X,ne,we,Se,Be,Xe,ut){if(V._lock)return;ua(X);let kt=nf;if(nf){let Bt=!0,Qt=!0,on=10,hn,ti;T.ori==0?(hn=Va,ti=za):(hn=za,ti=Va),hn&&ti&&(Bt=To<=on||To>=Ee-on,Qt=Go<=on||Go>=Ne-on),hn&&Bt&&(To=To<Xb?0:Ee),ti&&Qt&&(Go=Go<Qb?0:Ne),Bp(null,!0,!0),nf=!1}To=-10,Go=-10,Z.fill(null),Bp(null,!0,!0),kt&&(nf=kt)}function Tw(X,ne,we,Se,Be,Xe,ut){V._lock||(ua(X),ld(),iD(),X!=null&&Pw(ppe,n,To,Go,Ee,Ne,null))}function Ew(){w.forEach(D1t),gl(n.width,n.height,!0)}D0(JB,KN,Ew);const Vp={};Vp.mousedown=q2,Vp.mousemove=j2,Vp.mouseup=rD,Vp.dblclick=Tw,Vp.setSeries=(X,ne,we,Se)=>{let Be=gr.match[2];we=Be(n,ne,we),we!=-1&&Wh(we,Se,!0,!1)},Q&&(Cs(gpe,f,q2),Cs(X8,f,j2),Cs(mpe,f,X=>{ua(X),Dw(!1)}),Cs(fpe,f,K2),Cs(ppe,f,Tw),OJ.add(n),n.syncRect=Dw);const wS=n.hooks=i.hooks||{};function ga(X,ne,we){JL?kw.push([X,ne,we]):X in wS&&wS[X].forEach(Se=>{Se.call(null,n,ne,we)})}(i.plugins||[]).forEach(X=>{for(let ne in X.hooks)wS[ne]=(wS[ne]||[]).concat(X.hooks[ne])});const aD=(X,ne,we)=>we,gr=Ja({key:null,setSeries:!1,filters:{pub:kpe,sub:kpe},scales:[C,v[1]?v[1].scale:null],match:[Lpe,Lpe,aD],values:[null,null]},V.sync);gr.match.length==2&&gr.match.push(aD),V.sync=gr;const J2=gr.key,lD=sAe(J2);function Pw(X,ne,we,Se,Be,Xe,ut){gr.filters.pub(X,ne,we,Se,Be,Xe,ut)&&lD.pub(X,ne,we,Se,Be,Xe,ut)}lD.sub(n);function Y7(X,ne,we,Se,Be,Xe,ut){gr.filters.sub(X,ne,we,Se,Be,Xe,ut)&&Vp[X](null,ne,we,Se,Be,Xe,ut)}n.pub=Y7;function X7(){lD.unsub(n),OJ.delete(n),Mn.clear(),EJ(JB,KN,Ew),c.remove(),ve?.remove(),ga("destroy")}n.destroy=X7;function cD(){ga("init",i,e),ml(e||i.data,!1),M[C]?YL(C,M[C]):ld(),hl=Eo.show&&(Eo.width>0||Eo.height>0),Kr=da=!0,gl(i.width,i.height)}return v.forEach(Dn),w.forEach(Tr),t?t instanceof HTMLElement?(t.appendChild(c),cD()):t(n,cD):cD(),n}Xl.assign=Ja;Xl.fmtNum=woe;Xl.rangeNum=YB;Xl.rangeLog=l6;Xl.rangeAsinh=voe;Xl.orient=j1;Xl.pxRatio=Hs;Xl.join=y0t;Xl.fmtDate=Soe,Xl.tzDate=E0t;Xl.sync=sAe;{Xl.addGap=g1t,Xl.clipGaps=u6;let i=Xl.paths={points:dAe};i.linear=hAe,i.stepped=p1t,i.bars=_1t,i.spline=v1t}const T1t=30,E1t=1e3/T1t-1,eE=new Set;let BJ=0,Ype=0,pAe=Date.now()/1e3;const _Ae=i=>{BJ=requestAnimationFrame(_Ae),!(i-Ype<E1t)&&(Ype=i,pAe=Date.now()/1e3,eE.forEach(e=>e()))},Xpe=()=>pAe,bAe=i=>(eE.add(i),eE.size===1&&(BJ=requestAnimationFrame(_Ae)),()=>{eE.delete(i),eE.size===0&&cancelAnimationFrame(BJ)}),Qpe=(i,e,t)=>getComputedStyle(i).getPropertyValue(e).trim()||t,QB=i=>typeof i=="number"?i:Math.round(window.innerHeight*parseFloat(i)/100),vAe=i=>{const e=()=>({axis:Qpe(i,"--color-fg-subtle","#8b8b8b"),grid:Qpe(i,"--color-border-subtle","rgba(128,128,128,0.15)")});let t=e();return{axis:{stroke:()=>t.axis,grid:{stroke:()=>t.grid,width:1},ticks:{stroke:()=>t.grid,width:1}},refresh:()=>{t=e()}}},yAe=(i,e,t,n)=>{const s=new MutationObserver(()=>{n(),i.redraw(!1)});s.observe(document.body,{attributes:!0,attributeFilter:["data-theme"]});const o=new ResizeObserver(([a])=>{const l=Math.floor(a.contentRect.width);l>0&&i.setSize({width:l,height:QB(t)})});o.observe(e);const r=()=>i.setSize({width:i.width,height:QB(t)});return typeof t=="string"&&window.addEventListener("resize",r),()=>{s.disconnect(),o.disconnect(),window.removeEventListener("resize",r)}},h4=6,wAe=(i,e,t,n,s,o)=>{const r=s-t,a=o-n,l=r*r+a*a,c=l===0?0:Math.max(0,Math.min(1,((i-t)*r+(e-n)*a)/l));return{t:c,dist:Math.hypot(i-(t+c*r),e-(n+c*a))}},P1t=(i,e,t,n,s,o)=>wAe(i,e,t,n,s,o).dist,VJ=i=>Number.isInteger(i)?`${i}`:i.toFixed(3),CAe=i=>{let e=null;const t=()=>{e&&(e.style.display="none")};return{hooks:{init:n=>{e=document.createElement("div"),e.className="MultiDataChartTooltip bg-bg-default border-border-subtle text-fg-default typo-compact-xs-normal pointer-events-none absolute z-10 flex items-center gap-1.5 rounded-md border px-2 py-1 whitespace-nowrap",e.style.display="none",n.over.appendChild(e)},setCursor:n=>{const{left:s,top:o}=n.cursor;if(!e||s==null||o==null||s<0){t();return}const r=i(n,s,o);if(!r){t();return}e.replaceChildren();const a=document.createElement("span");a.className="inline-block size-2 shrink-0 rounded-full",a.style.backgroundColor=r.color??"currentColor";const l=document.createElement("span");l.textContent=r.text,e.append(a,l);const c=s>n.over.clientWidth/2;e.style.display="flex",e.style.left=`${s}px`,e.style.top=`${o}px`,e.style.transform=`translate(${c?"calc(-100% - 10px)":"10px"}, -50%)`}}}},{useEffect:R1t,useRef:Zpe,useState:M1t}=await F("react"),A1t=(i,e,t,n)=>{const s=i.data[0],o=d=>i.valToPos(s[d],"x");let r=e;for(;r>0&&o(r)>t-h4;)r--;let a=e;for(;a<s.length-1&&o(a)<t+h4;)a++;let l=null,c=h4;for(let d=1;d<i.series.length;d++){if(!i.series[d].show)continue;const h=i.data[d],g=f=>h[f]!=null&&!Number.isNaN(h[f]),m=f=>i.valToPos(h[f],"y");for(let f=r;f<=a;f++){if(!g(f))continue;const p=f<a&&g(f+1),_=p?P1t(t,n,o(f),m(f),o(f+1),m(f+1)):Math.hypot(t-o(f),n-m(f));if(_<=c){const b=p&&Math.hypot(t-o(f+1),n-m(f+1))<Math.hypot(t-o(f),n-m(f))?f+1:f;l={seriesIdx:d,value:h[b]},c=_}}}return l},O1t=i=>CAe((e,t,n)=>{const{idx:s}=e.cursor;if(s==null)return null;const o=A1t(e,s,t,n);if(!o)return null;const{label:r,color:a}=i[o.seriesIdx-1];return{color:a,text:`${r}: ${VJ(o.value)}`}}),F1t=({className:i,buffer:e,series:t,height:n=10,syncKey:s="sensors"})=>{const o=Zpe(null),[r,a]=M1t(!1),l=Zpe(null),c=()=>{const d=!r;l.current=d?Xpe():null,a(d)};return R1t(()=>{const d=o.current;if(!d)return;const{axis:h,refresh:g}=vAe(d),m={width:d.clientWidth/2,height:QB(n),legend:{show:!0,live:!0},plugins:[O1t(t)],cursor:{sync:{key:s}},scales:{x:{time:!0,range:()=>{const y=l.current??Xpe();return[y-e.windowSec,y]}}},axes:[{...h,label:"Time (sec)",labelSize:20,size:10,values:(y,S)=>S.map(()=>"")},h],series:[{},...t.map(({label:y,color:S,dash:C})=>({label:y,stroke:S,dash:C,width:1.5,points:{show:!1}}))]},f=[[],...t.map(()=>[])],p=new Xl(m,f,d);let _=-1,b=!1;const v=bAe(()=>{if(l.current!==null){if(b)return;b=!0,p.setData([e.xs.slice(),...t.map(({index:S})=>e.ys[S].slice())]);return}if(b&&(b=!1,_=-1),e.version===_)return;_=e.version,p.setData([e.xs,...t.map(({index:S})=>e.ys[S])]);const y=e.xs.length-1;(p.cursor.left??-1)<0&&y>=0&&p.setLegend({idx:y})}),w=yAe(p,d,n,g);return()=>{v(),w(),p.destroy()}},[e,t,n,s]),u("div",{ref:o,className:P("MultiDataChart","w-full min-w-0","[&_.u-legend]:text-fg-default [&_.u-legend_.u-series:first-child]:hidden!","[&_.u-legend_tbody]:grid! [&_.u-legend_tbody]:grid-cols-6!","[&_.u-legend_.u-series]:flex! [&_.u-legend_.u-series]:flex-col! [&_.u-legend_.u-series]:items-center!",i),children:u("div",{className:"flex justify-end",children:u(Yt,{type:"button",variant:"soft",className:"size-7",onClick:c,children:r?u(FI,{className:"size-3"}):u(aA,{className:"size-3"})})})})},{useEffect:B1t,useRef:e_e,useState:V1t}=await F("react"),z1t=.1,t_e=40,W1t=(i,e,t)=>{const{minX:n,maxX:s,minY:o,maxY:r}=i??{minX:0,maxX:1,minY:0,maxY:1},a=(n+s)/2,l=(o+r)/2;let c=Math.max((s-n)/e,(r-o)/t)*(1+z1t);c>0||(c=1/Math.min(e,t));const d=c*e/2,h=c*t/2;return{x:[a-d,a+d],y:[l-h,l+h]}},n_e=(i,e)=>{const t=[],n=[],s=Math.min(i.length,e.length);for(let l=0;l<s;l++)Number.isFinite(i[l])&&Number.isFinite(e[l])&&(t.push(i[l]),n.push(e[l]));const o=t.length-1,r=[null,[t,n],o>=0?[[t[o]],[n[o]]]:[[],[]]],a=o>=0?{minX:Math.min(...t),maxX:Math.max(...t),minY:Math.min(...n),maxY:Math.max(...n)}:null;return{data:r,bounds:a}},H1t=(i,e,t)=>{const[n,s]=i.data[1];if(!n?.length)return null;const o=c=>i.valToPos(n[c],"x"),r=c=>i.valToPos(s[c],"y");let a=null,l=h4;for(let c=0;c<n.length;c++){const d=c<n.length-1,{t:h,dist:g}=d?wAe(e,t,o(c),r(c),o(c+1),r(c+1)):{t:0,dist:Math.hypot(e-o(c),t-r(c))};g<=l&&(a=d?{x:n[c]+(n[c+1]-n[c])*h,y:s[c]+(s[c+1]-s[c])*h}:{x:n[c],y:s[c]},l=g)}return a},$1t=({className:i,buffer:e,xSeries:t,ySeries:n,height:s=10})=>{const o=e_e(null),[r,a]=V1t(!1),l=e_e(!1),c=()=>{const d=!r;l.current=d,a(d)};return B1t(()=>{const d=o.current;if(!d)return;const{axis:h,refresh:g}=vAe(d),m=n.color??t.color;let f=null,p={width:0,height:0};const _=L=>D=>{const T=D.bbox.width>0?D.bbox.width:D.width,E=D.bbox.height>0?D.bbox.height:D.height;return p={width:T,height:E},W1t(f,T,E)[L]},b={mode:2,width:d.clientWidth/2,height:QB(s),legend:{show:!1},cursor:{x:!1,y:!1,points:{show:!1},drag:{x:!1,y:!1,setScale:!1},dataIdx:()=>null},plugins:[CAe((L,D,T)=>{const E=H1t(L,D,T);return E?{color:m,text:`${t.label}: ${VJ(E.x)}, ${n.label}: ${VJ(E.y)}`}:null})],scales:{x:{time:!1,auto:!0,range:_("x")},y:{auto:!0,range:_("y")}},axes:[{...h,label:t.label,labelSize:20,space:t_e},{...h,label:n.label,labelSize:20,space:t_e}],series:[{},{label:"trajectory",stroke:m,width:1.5,facets:[{scale:"x",auto:!0},{scale:"y",auto:!0}],paths:Xl.paths.linear(),points:{show:!1}},{label:"current",stroke:m,fill:m,facets:[{scale:"x",auto:!0},{scale:"y",auto:!0}],paths:()=>null,points:{show:!0,size:8,filter:[0]}}]},v=new Xl(b,n_e([],[]).data,d),w=()=>{const L=n_e(e.ys[t.index],e.ys[n.index]);f=L.bounds,v.setData(L.data)},y=()=>{const{width:L,height:D}=v.bbox;(Math.abs(L-p.width)>1||Math.abs(D-p.height)>1)&&v.setData(v.data)};let S=-1,C=!1;const N=bAe(()=>{if(l.current){if(C){y();return}C=!0,w();return}if(C&&(C=!1,S=-1),e.version===S){y();return}S=e.version,w()}),k=yAe(v,d,s,g);return()=>{N(),k(),v.destroy()}},[e,t,n,s]),u("div",{ref:o,className:P("XYDataChart","w-full min-w-0",i),children:u("div",{className:"flex justify-end",children:u(Yt,{type:"button",variant:"soft",className:"size-7",onClick:c,children:r?u(FI,{className:"size-3"}):u(aA,{className:"size-3"})})})})},{useEffect:U1t,useMemo:pF,useRef:i_e}=await F("react"),j1t=10,G1t=i=>i,q1t=50,K1t=({className:i,robotModel:e,groups:t,selectedChannelIds:n,chartMode:s})=>{const{t:o}=q(),r=pF(()=>DMe(t),[t]),a=pF(()=>new MCt(r.length,j1t),[r]),l=i_e(a);l.current=a;const c=ws(e,G1t),d=i_e([]);d.current=r.map(({read:f})=>f(c)),U1t(()=>{const f=setInterval(()=>l.current.push(d.current),q1t);return()=>clearInterval(f)},[]);const h=pF(()=>r.flatMap(({id:f,label:p,color:_,dash:b},v)=>n.includes(f)?[{label:p,index:v,color:_,dash:b}]:[]),[r,n]),g=pF(()=>{if(n.length<2)return null;const[f,p]=n.slice(0,2).map(_=>{const b=r.findIndex(({id:S})=>S===_);if(b<0)return null;const{label:v,color:w,dash:y}=r[b];return{label:v,index:b,color:w,dash:y}});return f&&p?{x:f,y:p}:null},[r,n]),m=()=>s==="2d"?g?u($1t,{buffer:a,xSeries:g.x,ySeries:g.y,height:"55vh"}):u(s_e,{message:o("Select two data items for the X and Y axes")}):h.length>0?u(F1t,{buffer:a,series:h,height:"55vh"}):u(s_e,{message:o("move.chart.emptyDesc")});return u("div",{className:P("ChartPanelContent","flex w-full flex-col gap-3",i),children:m()})},s_e=({message:i})=>u("div",{className:"flex h-[55vh] w-full items-center justify-center",children:u("p",{className:"text-fg-subtle typo-compact-xs-normal py-4 text-center",children:i})}),J1t=i=>i.chartMode!=="off"?u(K1t,{...i}):null,{useMutation:Y1t}=await F("@tanstack/react-query"),X1t="/{robot_model}/call_move_push",Q1t=i=>{const{robot_model:e,...t}=i,n=X1t.replace("{robot_model}",e);return Dt.post(n,t)},Z1t=()=>Y1t({mutationFn:i=>Q1t(i)}),{useMutation:eSt}=await F("@tanstack/react-query"),tSt="/emergency_stop",nSt=async()=>await Ut.post(tSt),SAe=()=>eSt({mutationFn:nSt}),iSt=[{label:"move.options.interJoint",value:0},{label:"move.options.externalFt",value:1}],sSt=[{label:"move.box.option.global",value:0},{label:"move.box.option.local",value:1},{label:"move.box.option.user",value:2}],oSt=[{label:"X",name:"sensitivityX"},{label:"Y",name:"sensitivityY"},{label:"Z",name:"sensitivityZ"}],rSt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{mutate:s,isPending:o}=Z1t(),{mutate:r,isPending:a}=SAe(),{handleSubmit:l,control:c}=he({defaultValues:{forceType:0,frameType:0,sensitivityX:0,sensitivityY:0,sensitivityZ:0}}),d=h=>{s({robot_model:e,force_type:Number(h.forceType),frame_type:Number(h.frameType),sensitivity_x:Number(h.sensitivityX),sensitivity_y:Number(h.sensitivityY),sensitivity_z:Number(h.sensitivityZ)})};return u("div",{className:P("AdvancedJogControl","h-full",i),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:t("move.menu.title.planeConstJog")}),x(U,{className:"w-full gap-2",children:[u(me,{label:t("program.field.label.sensorType"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(oe,{name:"forceType",control:c,render:({field:h})=>u(ae,{className:"w-full",size:"sm",...h,onChange:g=>{h.onChange(He(g.target.value,0))},children:iSt.map(g=>u(J,{value:g.value,children:t(g.label)},g.label))})})}),u(me,{label:t("program.field.frameSelection"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(oe,{name:"frameType",control:c,render:({field:h})=>u(ae,{className:"w-full",size:"sm",...h,onChange:g=>{h.onChange(He(g.target.value,0))},children:sSt.map(g=>u(J,{value:g.value,children:t(g.label)},g.label))})})}),u(me,{label:t("move.field.label.sensitivity"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(U,{className:"gap-2",children:oSt.map(h=>x(U,{alignItems:"flex-start",className:"w-full flex-1 gap-1",children:[u("span",{className:P("typo-compact-xs-medium",xi[h.label.toLowerCase()]),children:t(h.label)}),u(H,{className:"w-full gap-2",alignItems:"center",children:u(oe,{name:h.name,control:c,render:({field:g})=>x(H,{className:"w-full gap-2",alignItems:"center",children:[u(Ms,{value:[g.value],min:0,max:1,step:.01,onValueChange:m=>g.onChange(m[0])}),x("span",{className:"typo-compact-xs-normal text-fg-default w-8 text-center",children:[(g.value*100).toFixed(0),"%"]})]})})})]},h.label))})}),x(H,{className:"mt-2 w-full gap-1.5",children:[u(se,{className:"typo-compact-xs-semibold w-full",size:"sm",variant:n==="light"?"danger":"soft",loading:a,onClick:()=>r(),children:t("move.button.stop")}),u(se,{className:"typo-compact-xs-semibold w-full",size:"sm",variant:"brand",loading:o,onClick:l(d),children:t("move.button.start")})]})]})]})})},{useCallback:QS,useEffect:aSt,useMemo:dv,useRef:lSt,useState:ZS}=await F("react"),cSt=({className:i,robotModel:e})=>{const{t}=q(),n=lSt(null),s=Zk(n),{data:o}=As(),[r]=xc(),{isUseSimulator:a,selectedRobotModel:l,setSelectedRobotModel:c}=ui(),[d,h]=ZS("global"),{data:g}=Ph(),m=IA(e,Object.keys(g?.components??{}).length),{detailRobotModel:f,ghostActiveTcpAnchors:p,ghostDraggableJointNames:_,isGhostRobotSupported:b,isJointOnlyGhost:v,disabledGizmoTypes:w}=hoe(e),y=b||v,S=dv(()=>Object.entries(g?.components??{}).flatMap(([Dn,Lr])=>(Lr.tcpJointName??[]).map(tf=>({componentModel:Dn,jointName:tf}))),[g]),C=goe(),{isGhostRobot:N,gizmoType:k,handleGizmoTypeChange:L}=C,D=v?k==="none"?"none":null:k,T=LMe(),{baseAssets:E,toolAssets:R,gizmoSelectedAssetIds:A,selectionMode:M,assetGizmoMode:O,setAssetGizmoMode:B,clearGizmoSelection:z,workspaceControlProps:Y,requestMenuId:$,requestMenuToken:Z,sceneHandlers:K,viewerProps:V}=xpt({detailRobotModel:f,tcpJoints:S,urdfViewerRef:n,assetGizmoDisabled:N||T.isActive,assetPicker:T}),fe=mCt({urdfViewerRef:n,baseAssets:E,toolAssets:R,picker:T}),[Q,re]=ZS(!1),[ve,_e]=ZS(!1),[Le,Ie]=ZS(0),[Te,lt]=ZS("off"),[it,Ct]=ZS([]),{viewerProps:ft,itemProps:Xt,handleCheckFeatureSupport:Mt}=Ywt({urdfViewerRef:n,isGhostRobot:N,gizmoType:D}),{userfSelectionNo:Ht,toolSelectionNo:Mn,statusIsRefon:Cs,carteXRef:or,jointQRef:ge,toolName:Ue,motionMode:Ee}=ws(e,Dn=>({userfSelectionNo:Dn.userfSelectionNo,toolSelectionNo:Dn.toolSelectionNo,statusIsRefon:Dn.statusIsRefon,carteXRef:Dn.carteXRef,jointQRef:Dn.jointQRef,toolName:Dn.toolName,motionMode:Dn.motionMode})),Ne=ge?.length??7,le=dv(()=>DCt(Ne,Ht,Mn),[Ne,Ht,Mn]),{data:Pe}=Xk({robot_model:e}),{pluginData:Re}=NA({robotModel:e,paintJointPath:ve?{recording:!0,maxAgeSeconds:Le}:void 0,options:{baseAssets:E,toolAssets:R,onAssetLoad:Mt,onAssetTransformUpdate:Mt}}),{selectedRobot:We,coreSwList:ct}=Fi(e),gn=We?.connected==="DISCONNECT",{mutate:$n}=Bpt(),Ln=r.get("menu")??"jog",yi=Cs===1,oi=dv(()=>Ee!==0,[Ee]),{viewerProps:Xn,itemProps:go}=pCt(fe,oi),wo=dv(()=>{if(d==="user")return Pe?.user_frames.filter((Dn,Lr)=>Lr===Ht).map(Dn=>({name:Dn.userfName,showLabel:!0,position:{x:Dn.userfOffset.v[0]/Pn,y:Dn.userfOffset.v[1]/Pn,z:Dn.userfOffset.v[2]/Pn},rotation:{rx:Dn.userfEuler.v[0],ry:Dn.userfEuler.v[1],rz:Dn.userfEuler.v[2]}}))},[Pe,Ht,d]),Kr=dv(()=>Pe?.user_frames.map(Dn=>Dn.userfName)??nMe.user_frames.map(Dn=>Dn.userfName),[Pe?.user_frames]),hl=Dn=>{$n({robot_model:e,refcontrol_option:Dn==="real"?1:0})},da=()=>{re(Dn=>!Dn)},gl=QS(Dn=>{Dn.isDrawTrajectory!==void 0&&_e(Dn.isDrawTrajectory),Dn.maxAgeSeconds!==void 0&&Ie(Dn.maxAgeSeconds)},[]),{ghostJointValues:jo,handleGhostRobotJointsChanged:Vh}=moe(N),Ts=zPe({robotModel:e,urdfViewerRef:n,carteXRef:or,jointQRef:ge,toolName:Ue,isDisconnected:gn,jointOnly:v,ghostJointValuesRad:jo}),ad=QS(Dn=>{L(Dn),Dn==="surfaceTeach"&&z()},[L,z]),{viewerProps:Gd,itemProps:$u}=foe({gizmo:C,ghostRobotIK:Ts,isMoving:oi,gizmoType:D,onGizmoTypeChange:ad,activeTcpAnchors:p,draggableJointNames:_,onGhostRobotJointsChanged:v?Vh:void 0}),{onGhostRobotChange:ua}=$u,{onMeasureActiveChange:es}=go,Lt=QS(Dn=>{Dn&&fe.isMeasureActive&&es(!1),ua(Dn)},[ua,es,fe.isMeasureActive]),Ei=QS(Dn=>{Dn&&N&&ua(!1),es(Dn)},[ua,es,N]),Ss=QS(Dn=>{const Lr=g?.components;if(!Lr||Object.keys(Lr).length<=1)return;for(const Dr of Dn.pathJointNames)for(const[Tr,ha]of Object.entries(Lr))if((ha.type==="array"?ha.mapper:Object.values(ha.mapper)).includes(Dr)||ha.tcpJointName?.includes(Dr)){Tr!==l&&c(Tr);return}for(const Dr of Dn.pathLinkNames)for(const[Tr,ha]of Object.entries(Lr)){const cn=(ha.type==="array"?ha.mapper:Object.values(ha.mapper))[0];if(cn){const Me=cn.charAt(0);if(Dr.startsWith(`${Me}link`)){Tr!==l&&c(Tr);return}}}if(Dn.pathLinkNames.some(Dr=>/^(mobile|amr|base_link|wheel)/i.test(Dr))){const Dr=ct?.find(Tr=>Tr.be_service==="amr"||/amr|mobile/i.test(Tr.model)||/amr|mobile/i.test(Tr.sw_name));if(Dr&&Dr.model!==l){c(Dr.model);return}}},[g,l,c,ct]),Pi=QS(Dn=>{Dn.chartMode!==void 0&&lt(Dn.chartMode)},[]);aSt(()=>{Ln==="jog"&&Q&&re(!1)},[Ln,Q]);const Jr=dv(()=>[{key:"zoom-in-out",element:u(H1,{onZoomIn:s.zoomIn,onZoomOut:s.zoomOut})},{key:"camera-view",element:u(xA,{onSetCameraView:s.setCameraView})},{key:"trajectory",element:u(kMe,{handleChangeDrawTrajectory:gl})},...y?[{key:"ghost-robot",element:u(q9,{...$u,...Xt,onGhostRobotChange:Lt,disabledGizmoTypes:w,gizmoOptionsDisabled:v})}]:[],{key:"measure-distance",element:u(aCt,{...go,onMeasureActiveChange:Ei})},{key:"state-core-chart",element:u(RCt,{chartGroups:le,handleChangeStateCoreChart:Pi,onSelectedChannelIdsChange:Ct})}],[s.zoomIn,s.zoomOut,s.setCameraView,gl,y,w,v,$u,Xt,Lt,go,Ei,Pi,le]),Oa=dv(()=>[{id:"jog",label:t("move.menu.button.label.jog"),icon:u(pK,{}),content:u(fJ,{robotModel:e,onTabChange:h})},{id:"advenced-jog",label:t("move.menu.button.label.advJog"),icon:u(pK,{}),content:u(rSt,{robotModel:e})},{id:"tcp-tool",label:t("move.menu.button.label.tcpTool"),icon:u(iYe,{}),content:u(Ypt,{robotModel:e})},{id:"gripper",label:t("move.menu.button.label.gripper"),icon:u(ZKe,{}),content:u(svt,{robotModel:e})},{id:"zero-pose",label:t("move.menu.button.label.zeroPose"),icon:u($De,{}),content:u(t_t,{robotModel:e})},{id:"global-pinpoint",label:t("move.menu.button.label.pinpoint"),icon:u(Pje,{}),content:u(gvt,{robotModel:e})},{id:"record",label:t("move.menu.button.label.record"),icon:u(Rje,{}),content:u(Yyt,{robotModel:e})},{id:"weld",label:t("move.menu.button.label.weld"),icon:u(Mje,{className:"rotate-180"}),content:u(rwt,{robotModel:e})},{id:"calibration",label:t("move.menu.button.label.calibration"),icon:u(jDe,{}),content:u(Uwt,{robotModel:e,userFrameNameList:Kr})},{id:"move-io",label:t("settings.menu.title.io"),icon:u(TKe,{}),content:u(Zwt,{robotModel:e})},{id:"master",label:t("move.menu.button.label.masterMode"),icon:u(fJe,{className:"size-5"}),content:u(NCt,{robotModel:e})},{id:"workspace",label:t("move.menu.button.label.assetManager"),icon:u(jJe,{className:"size-5"}),content:null}],[t,e,h,Kr]),Fa=dv(()=>({id:"workspace",content:u(zyt,{...Y,isMenuActive:Ln==="workspace"})}),[Y,Ln]);return x(o6,{className:P("ManipulateMove","relative overflow-hidden",i),rightIconPanels:Jr,menus:Oa,persistentMenu:Fa,beService:o?.modelInfo?.be_service,requestMenuId:$,requestMenuToken:Z,children:[x("div",{className:"h-full flex-1 p-2.5",children:[x("div",{className:"absolute top-0 left-0 z-1 size-full",...K,children:[u(Ym,{ref:n,className:"relative size-full",cameraPositionKey:"manipulate-move",showPerformanceHUD:!0,...V,robotModel:o?.info?.robotModel,etcAxesArr:wo,enablePanning:!0,plugin:Re,isRealMode:yi,outlinedLinkNames:m,...Gd,...ft,...Xn,onDoubleClickRobot:Ss}),A.length===1&&!M&&Ln==="workspace"&&u("div",{className:"animate-in fade-in absolute top-78 left-3 z-20 duration-200",children:u(yCt,{mode:O,onModeChange:B,modes:[...E,...R].find(Dn=>Dn.id===A[0])?.source.kind==="file"?["translate","rotate"]:["translate","rotate","scale"]})})]}),x(U,{className:"pointer-events-none relative z-2 h-full",children:[u(tCt,{className:"pointer-events-auto",robotModel:e,mode:yi?"real":"simulation",onChangeMode:hl}),u(SA,{className:"mt-3 mb-4",robotModel:e}),u(NMe,{className:"pointer-events-auto",robotModel:e},e),u(IMe,{className:"pointer-events-auto",robotModel:e})]})]}),u($9,{isGhostRobot:N,ghostRobotIK:Ts,btnHoverInteraction:$k.isDesktop,showControlPanelButton:Ln!=="jog",onToggleControlPanel:da,isPanelOpen:Ln!=="jog"&&Q,panelContent:u(fJ,{className:"w-full",robotModel:e,onTabChange:()=>{},isPanel:!0,isUseSimulator:a})}),u(J1t,{className:"bg-translucent pointer-events-auto absolute bottom-2 left-2 z-2 w-[calc(100%-12rem)] rounded-md p-2.5",chartMode:Te,groups:le,selectedChannelIds:it,robotModel:e})]})},{useEffect:dSt,useMemo:_F,useState:uSt}=await F("react"),hSt={dir:"all",method:"all"},gSt=(i,e)=>{const t=e.dir==="all"||e.dir==="forward"&&i.dir==="FORWARD"||e.dir==="reverse"&&i.dir==="REVERSE",n=e.method==="all"||i.method===e.method;return t&&n},mSt=({nodes:i,selectedLinks:e,focusedLinkId:t,onLinkVisibilityFilterChange:n})=>{const[s,o]=uSt(hSt),r=_F(()=>e.filter(d=>gSt(d,s)),[s,e]),a=_F(()=>t?r.find(d=>d.id===t)??null:null,[t,r]),l=_F(()=>r.map(d=>{const h=i.find(m=>m.id===d.from),g=i.find(m=>m.id===d.to);return{id:d.id,title:`${h?.name||d.from} -> ${g?.name||d.to}`,dir:d.dir,method:d.method,speed:d.speed}}),[i,r]),c=_F(()=>{if(!a)return null;const d=i.find(g=>g.id===a.from),h=i.find(g=>g.id===a.to);return!d||!h?null:new Ve((d.x+h.x)/2,(d.y+h.y)/2,(d.z+h.z)/2)},[i,a]);return dSt(()=>{n?.(s)},[s,n]),{linkVisibilityFilter:s,setLinkVisibilityFilter:o,visibleSelectedLinks:r,visibleFocusedLink:a,selectedLinkOverlayItems:l,focusedLinkAnchor:c}},{useMemo:bF}=await F("react"),fSt=i=>{if(!i||i.length===0)return null;let e=0,t=0,n=0;for(let o=0;o<i.length;o+=1){const r=i[o],a=i[(o+1)%i.length],l=r.x*a.y-a.x*r.y;e+=l,t+=(r.x+a.x)*l,n+=(r.y+a.y)*l}if(Math.abs(e)>Number.EPSILON)return new Ve(t/(3*e),n/(3*e),0);const s=i.reduce((o,r)=>({x:o.x+r.x,y:o.y+r.y}),{x:0,y:0});return new Ve(s.x/i.length,s.y/i.length,0)},pSt=({zones:i,selectedZoneIds:e,focusedZoneId:t})=>{const n=bF(()=>{if(!e||e.length===0)return[];const a=new Set(e);return(i??[]).filter(l=>a.has(l.id))},[e,i]),s=bF(()=>n.length===0?null:t?n.find(a=>a.id===t)??null:n[0]??null,[t,n]),o=bF(()=>n.map(a=>({id:a.id,title:a.name||a.id,type:a.type,pointCount:a.polygon.length})),[n]),r=bF(()=>s?fSt(s.polygon):null,[s]);return{selectedZones:n,focusedZone:s,selectedZoneOverlayItems:o,focusedZoneAnchor:r}},{useMemo:_St}=await F("react"),{useQuery:bSt}=await F("@tanstack/react-query"),xAe="/{robot_model}/setting/getSettingPresetList",vSt=async({robot_model:i,baseURL:e})=>{const t=xAe.replace("{robot_model}",i);return sb.get(t,void 0)},ySt=({robot_model:i,baseURL:e})=>[xAe,i,e??""],wSt=(i,e={},t)=>{const n=_St(()=>ySt({...i,baseURL:t}),[t,i]);return{...bSt({queryKey:n,queryFn:()=>vSt({...i,baseURL:t}),enabled:!!i.robot_model,...e}),queryKey:n}},{useMemo:CSt}=await F("react"),{useQuery:SSt}=await F("@tanstack/react-query"),NAe="/{robot_model}/info/category",xSt=async({robot_model:i})=>{const e=NAe.replace("{robot_model}",i);return sb.get(e)},NSt=({robot_model:i})=>[NAe,i],ISt=(i,e={})=>{const{robot_model:t}=i,{enabled:n=!0,...s}=e,o=CSt(()=>NSt({robot_model:t}),[t]);return{...SSt({queryKey:o,queryFn:()=>xSt(i),enabled:!!t&&n,...s}),queryKey:o}},{useMemo:kSt}=await F("react"),{useQuery:LSt}=await F("@tanstack/react-query"),IAe="/{robot_model}/setting/getSettingPreset",DSt=async({robot_model:i,level:e,presetId:t,baseURL:n})=>{const s=IAe.replace("{robot_model}",i);return sb.get(s,{params:{level:e,presetId:t}})},TSt=({robot_model:i,level:e,presetId:t,baseURL:n})=>[IAe,i,e,t,n??""],ESt=(i,e={},t)=>{const{robot_model:n,level:s,presetId:o}=i,r=kSt(()=>TSt({robot_model:n,level:s,presetId:o,baseURL:t}),[t,s,o,n]);return{...LSt({queryKey:r,queryFn:()=>DSt({...i,baseURL:t}),enabled:!!n&&typeof s=="number"&&!Number.isNaN(s)&&typeof o=="number"&&!Number.isNaN(o),...e}),queryKey:r}},{useMemo:nVn}=await F("react"),{useQuery:iVn}=await F("@tanstack/react-query"),{useMemo:sVn}=await F("react"),{useQuery:oVn}=await F("@tanstack/react-query"),{useQuery:PSt}=await F("@tanstack/react-query"),Toe="/{robot_model}/map/list",RSt=({robot_model:i,baseURL:e})=>[Toe,i,""],MSt=async({robot_model:i,baseURL:e})=>{const t=Toe.replace("{robot_model}",i);return sb.get(t,{})},ASt=({robot_model:i,enabled:e=!0},t={},n)=>{const{enabled:s=!0,...o}=t,r=RSt({robot_model:i,baseURL:n});return{...PSt({queryKey:r,queryFn:()=>MSt({robot_model:i,baseURL:n}),enabled:!!i&&e&&s,...o}),queryKey:r}},{useCallback:VD,useEffect:OSt,useMemo:FSt,useRef:o_e}=await F("react"),BSt=({robotModel:i,linearSpeed:e=.8,rotationSpeed:t=45})=>{const{socketEventEmit:n}=Mg(),s=o_e({vx:0,vy:0,wz:0}),o=o_e(null),r=FSt(()=>`amr/${i}/move/jog`,[i]),a=VD(()=>{n(r,{...s.current})},[r,n]),l=VD(()=>{typeof window>"u"||o.current&&(window.clearInterval(o.current),o.current=null)},[]),c=VD(()=>{typeof window>"u"||o.current||(o.current=window.setInterval(()=>{a()},200))},[a]),d=VD(g=>{switch(g){case"forward":s.current={vx:e,vy:0,wz:0};break;case"backward":s.current={vx:-e,vy:0,wz:0};break;case"left":s.current={vx:0,vy:e,wz:0};break;case"right":s.current={vx:0,vy:-e,wz:0};break;case"rotateLeft":s.current={vx:0,vy:0,wz:t};break;case"rotateRight":s.current={vx:0,vy:0,wz:-t};break;default:s.current={vx:0,vy:0,wz:0}}a(),g==="stop"?l():c()},[a,e,t,c,l]),h=VD(({type:g,data:m})=>{const f=Number((m.normalizedDistance.y*e).toFixed(2)),p=Number((m.normalizedDistance.x*e*-1).toFixed(2)),_=Math.max(-1,Math.min(1,m.normalizedDistance.x)),b=Number((_*-t).toFixed(0));g==="direction"?(s.current.vx=f,s.current.vy=p):s.current.wz=b,a()},[a,e,t]);return OSt(()=>()=>{l()},[l]),{handleJoystickMove:h,handleButtonMove:d}},VSt={obsBoxMinX:0,obsBoxMaxX:0,obsBoxMinY:0,obsBoxMaxY:0,stopMarginX:0,stopMarginY:0,slowMarginX:0,slowMarginY:0},r_e={layers:[],width:0,height:0,gridSize:0,safety:VSt},zSt=(i,e=!0)=>{const{data:t=r_e,loading:n}=ls(`amr/${i}/socket/obsMap`,{defaultValue:r_e,disabled:!e,selector:s=>({layers:s?.layers?.map(o=>({name:o?.name??"",data:o?.data??[]}))??[],width:s?.width??0,height:s?.height??0,gridSize:s?.gridSize??0,safety:{obsBoxMinX:s?.safety?.obsBoxMinX??0,obsBoxMaxX:s?.safety?.obsBoxMaxX??0,obsBoxMinY:s?.safety?.obsBoxMinY??0,obsBoxMaxY:s?.safety?.obsBoxMaxY??0,stopMarginX:s?.safety?.stopMarginX??0,stopMarginY:s?.safety?.stopMarginY??0,slowMarginX:s?.safety?.slowMarginX??0,slowMarginY:s?.safety?.slowMarginY??0}})});return{data:t,loading:n}},{useRef:WSt}=await F("react"),a_e={data:[]},HSt=(i,e=!0)=>{const{data:t=a_e,loading:n}=ls(`amr/${i}/socket/globalPath`,{defaultValue:a_e,disabled:!e,selector:o=>({data:o?.data??[]})}),s=WSt({...t,loading:n});return s.current.data=t.data,n!==s.current.loading&&(s.current.loading=n),s.current},{useRef:$St}=await F("react"),l_e={data:[]},USt=(i,e=!0)=>{const{data:t=l_e,loading:n}=ls(`amr/${i}/socket/trajectory`,{defaultValue:l_e,disabled:!e,selector:o=>({data:o?.data??[]})}),s=$St({...t,loading:n});return s.current.data=t.data,n!==s.current.loading&&(s.current.loading=n),s.current},{useRef:jSt}=await F("react"),c_e={data:[]},GSt=(i,e=!0)=>{const{data:t=c_e,loading:n}=ls(`amr/${i}/socket/localPath`,{defaultValue:c_e,disabled:!e,selector:o=>({data:o?.data??[]})}),s=jSt({...t,loading:n});return s.current.data=t.data,n!==s.current.loading&&(s.current.loading=n),s.current},{forwardRef:qSt}=await F("react"),kAe=qSt(({robotModel:i,...e},t)=>{const{data:n}=$Re(i),{data:s}=HSt(i),{data:o}=GSt(i),{data:r}=USt(i);return u(LDe,{ref:t,...e,lidarPoints:n,globalPath:s,localPath:o,trajectory:r})});kAe.displayName="AmrWorldStudio";const{useMutation:KSt}=await F("@tanstack/react-query"),JSt="/{robot_model}/map/setCloud",YSt=async({robot_model:i,mapName:e,fileName:t,data:n})=>{const s=JSt.replace("{robot_model}",i);return Ls.post(s,{mapName:e,fileName:t,data:n})},XSt=()=>KSt({mutationFn:YSt}),{useMutation:QSt}=await F("@tanstack/react-query"),ZSt="/{robot_model}/map/setTopology",ext=async({robot_model:i,mapName:e,nodes:t,links:n,zones:s})=>{const o=ZSt.replace("{robot_model}",i);return Ls.post(o,{mapName:e,nodes:t,links:n,zones:s})},txt=()=>QSt({mutationFn:ext}),{useCallback:iU}=await F("react"),nxt=i=>typeof i=="object"&&i!==null&&"isError"in i&&i.isError===!0,ixt=({selectedRobotModel:i,currentMapName:e,getMapPointsData:t,getTopologyData:n,loadMapAndRefreshCurrentMap:s,loadTopology:o,refreshTopologyData:r,onTopologySaved:a,onTopologyCanceled:l,onCloudSaved:c})=>{const{mutate:d}=XSt(),{mutate:h,isPending:g}=txt(),m=iU(()=>{if(!e)return;const _=n();h({robot_model:i,mapName:e,nodes:_.nodes,links:_.links,zones:_.zones},{onSuccess:async()=>{try{await o(e),a?.(),rt.openToast({type:"basic",variant:"success",title:"Topology Save Success",content:"Topology data has been saved"})}catch{rt.openToast({type:"basic",variant:"warning",title:"Topology Load Failed",content:"Topology was saved, but failed to load"})}}})},[e,n,o,a,h,i]),f=iU(async()=>{try{const _=await r?.();if(nxt(_))throw _.error;l?.()}catch{rt.openToast({type:"basic",variant:"warning",title:"Topology Cancel Failed",content:"Failed to revert topology changes"})}},[l,r]),p=iU(()=>{if(!e)return;const _=t();d({robot_model:i,mapName:e,fileName:"cloud.csv",data:_},{onSuccess:()=>{s(e),c?.(),rt.openToast({title:"Cloud Save Success",content:"Cloud data has been saved",type:"basic",variant:"success"})}})},[e,t,s,c,d,i]);return{handleSaveTopologyChanges:m,handleCancelTopologyChanges:f,handleSaveCloud:p,isTopologySaving:g}},{useMemo:sxt}=await F("react"),oxt=({currentMapName:i,mapListData:e})=>({currentMapInfo:sxt(()=>i&&e?.list?e.list.find(n=>n.mapName===i):null,[i,e?.list])}),{useMemo:rxt}=await F("react"),{useQuery:axt}=await F("@tanstack/react-query"),LAe="/{robot_model}/map/getCloudStream",lxt=async({robot_model:i,mapName:e,fileName:t,chunkSize:n})=>{const s=LAe.replace("{robot_model}",i);return Ls.get(s,{params:{mapName:e,fileName:t,chunkSize:n},headers:{Accept:"application/octet-stream"},responseType:"arraybuffer"})},cxt=(i,e={})=>{const t=rxt(()=>[LAe,i],[i]);return{...axt({queryKey:t,queryFn:()=>lxt(i),...e}),queryKey:t}},dxt=({selectedRobotModel:i,mapName:e="",pointCloudFormat:t})=>{const n=t==="csv",s=t==="las",{data:o,dataUpdatedAt:r}=GRe({robot_model:i,mapName:e,fileName:"cloud.csv"},{enabled:!!e&&n}),{data:a}=cxt({robot_model:i,mapName:e,fileName:"map.las"},{enabled:!!e&&s}),{data:l,dataUpdatedAt:c,refetch:d}=HRe({robot_model:i,mapName:e},{enabled:!!e});return{mapCloud:n?o:void 0,mapCloudUpdatedAt:n?r:0,mapCloudStream:s?a:void 0,topology:l,topologyUpdatedAt:c,refetchTopology:d}},{useEffect:uxt,useRef:hxt,useState:gxt}=await F("react"),d_e={data:null,error:null,loading:!1},mxt=i=>{const[e,t]=gxt(d_e),n=hxt(0);return uxt(()=>{if(!i){n.current+=1,t(d_e);return}const s=n.current+1;n.current=s,t({data:null,error:null,loading:!0});const o=new Worker(new URL("/assets/parseLasPointCloud.worker-BZeU-mt8.js",import.meta.url),{type:"module"});o.onmessage=a=>{n.current===a.data.id&&(a.data.type==="success"?t({data:a.data.data,error:null,loading:!1}):t({data:null,error:new Error(a.data.message),loading:!1}),o.terminate())},o.onerror=a=>{n.current===s&&t({data:null,error:new Error(a.message),loading:!1}),o.terminate()};const r=i.slice(0);return o.postMessage({id:s,buffer:r},[r]),()=>{o.terminate()}},[i]),e},{useMemo:fxt}=await F("react"),pxt=({currentMapName:i,createdAt:e,lastModified:t,mapCloudCount:n,mapBounds:s,topologyCount:o,nodeTypeCounts:r,mappingStatus:a,elapsedSeconds:l,completedKeyframeCount:c,totalKeyframePoints:d,onStartMapping:h,onStopMapping:g,onSaveMapping:m,onDiscard:f,mapList:p,isEraserEnabled:_,onEraserToggle:b,eraserRadius:v,setEraserRadius:w,eraseSelectedAreaDisabled:y,onEraseSelectedArea:S,onReleaseSelectedPoints:C,onSaveChanges:N,hasUnsavedCloudChanges:k,onDiscardCloudChanges:L,onLoadMap:D,loadMapDisabled:T,onDownloadMap:E,downloadMapDisabled:R})=>fxt(()=>({mapInfoProps:{currentMapName:i,createdAt:e,lastModified:t,mapCloudCount:n,mapBounds:s,topologyCount:o,nodeTypeCounts:r},mappingTabProps:{mappingStatus:a,elapsedSeconds:l,completedKeyframeCount:c,totalKeyframePoints:d,onStartMapping:h,onStopMapping:g,onSaveMapping:m,onDiscard:f,mapList:p},eraserTabProps:{isEraserEnabled:_,onEraserToggle:b,eraserRadius:v,setEraserRadius:w,eraseSelectedAreaDisabled:y,onEraseSelectedArea:S,onReleaseSelectedPoints:C,onSaveChanges:N},hasUnsavedCloudChanges:k,onDiscardCloudChanges:L,onLoadMap:D,loadMapDisabled:T,onDownloadMap:E,downloadMapDisabled:R}),[c,e,i,l,v,y,k,_,t,s,n,r,f,L,D,E,S,b,C,N,m,h,g,w,T,a,R,o,p,d]),{queryOptions:_xt,useQueries:bxt,useQuery:vxt}=await F("@tanstack/react-query"),DAe="/{robot_model}/setting/getSettingParam",TAe=async i=>{const{robot_model:e,...t}=i,n=DAe.replace("{robot_model}",e);return Ls.get(n,{params:t})},EAe=i=>[DAe,i],yxt=(i,e=!0)=>_xt({queryKey:EAe(i),queryFn:()=>TAe(i),enabled:e}),wxt=(i,e={})=>vxt({queryKey:EAe(i),queryFn:()=>TAe(i),...e}),Cxt=({robot_model:i,robotType:e,categories:t,level:n=2,enabled:s=!0})=>bxt({queries:t.map(o=>yxt({robot_model:i,robotType:e,category:o,level:n},s&&!!i&&!!e&&!!o))}),{useMemo:u_e}=await F("react"),Sxt=({robotModel:i,monitorStatusSnapshot:e,robotVersion:t,selectedTool:n,onToolChange:s,onStartLocalization:o,onInitLocalization:r,onSemiAutoInitLocalization:a,onStopLocalization:l,onBuildInfoOpenChange:c,onDock:d,onDockPause:h,onDockResume:g,onDockStop:m,onUndock:f,dockRejectMessage:p,taskLogData:_,amrMoveStatus:b,onSetMotorLocked:v,onClearSafetyFlag:w,onLidarFieldSave:y,onOssdDetectChange:S,safetyIo:C,safetyIoLoading:N,onSetSafetyIo:k})=>{const{data:L}=wxt({robot_model:i,robotType:i,category:"docking",level:2}),D=u_e(()=>{const T=L?.params?.find(E=>E.key==="DOCKING_RETRY_COUNT")?.value;return T!==void 0?Number(T):void 0},[L]);return u_e(()=>({robotModel:i,overviewProps:{amrStatus:e,robotVersion:t,selectedTool:n,onStartLocalization:o,onInitLocalization:r,onSemiAutoInitLocalization:a,onStopLocalization:l,onToolChange:s,onBuildInfoOpenChange:c},dockProps:{amrStatus:e,onDock:d,onPause:h,onResume:g,onStop:m,onUndock:f,maxRetryCount:D,rejectMessage:p??void 0},taskProps:{logData:_,moveStatus:b},pduProps:{amrStatus:e,setMotorLocked:v,onClearSafetyRecovery:w,onLidarFieldSave:y,onOssdDetectChange:S,safetyIo:C,safetyIoLoading:N,onSetSafetyIo:k}}),[b,D,e,t,w,y,S,C,N,k,d,h,g,p,m,c,r,a,v,o,l,s,f,n,_,i])},{useMemo:xxt}=await F("react"),Nxt=({overviewTabProps:i,nodeTabProps:e,linkTabProps:t,zoneTabProps:n})=>xxt(()=>({overviewTabProps:i,nodeTabProps:e,linkTabProps:t,zoneTabProps:n}),[t,e,i,n]),{useCallback:Bl}=await F("react"),Ixt=({emit:i,nodes:e,selectedObjects:t,selectedNodeType:n,onToolChange:s,setIsEraserEnabled:o,setEraserRadius:r})=>{const{createLinks:a,setLinkCreationSettings:l}=Oqe(),c=Bl(T=>{o(T),i("ui:eraser-toggle-requested",T),i("ui:pointer-action-set-requested",T?"erase":"inspect"),s(T?"disabled":"select")},[i,s,o]),d=Bl(()=>{i("ui:points-delete-requested",void 0)},[i]),h=Bl(()=>{i("ui:unselect-points-requested",void 0)},[i]),g=Bl(T=>{T>0&&(r(T),i("eraser:radius-changed",T))},[i,r]),m=Bl(T=>{switch(T){case"goal":return"GOAL";case"route":return"ROUTE";case"align":return"ALIGN"}},[]),f=Bl(()=>{i("ui:quick-add-node-requested",m(n))},[i,m,n]),p=Bl(()=>{i("ui:add-node-by-preview-requested",m(n))},[i,m,n]),_=Bl(()=>{const T=e[e.length-1]?.uuid;T&&(i("ui:selection-reset-requested",void 0),i("ui:node-selected",{nodeId:T,intent:"replace"}),i("ui:nodes-delete-requested",void 0))},[i,e]),b=Bl(()=>{const T=t[t.length-1]?.uuid??null;T&&(i("ui:selection-reset-requested",void 0),i("ui:node-selected",{nodeId:T,intent:"replace"}),i("ui:nodes-delete-requested",void 0))},[i,t]),v=Bl((T,E)=>{i("ui:node-updated",{nodeId:T,updates:E})},[i]),w=Bl((T,E)=>{i("ui:node-type-change-requested",{nodeId:T,type:m(E)})},[i,m]),y=Bl((T,E,R)=>{i(R==="delta"?"ui:nodes-transform-delta-requested":"ui:nodes-transform-absolute-requested",{target:T,value:E})},[i]),S=Bl((T,E,R)=>{if(!(t.length<2)){if(t.length===2||E==="sequential"){i("ui:link-nodes-requested",{nodes:t,strategy:"sequential",bidirectional:T,properties:R});return}i("ui:link-nodes-requested",{nodes:t,strategy:"complete",bidirectional:T,properties:R})}},[i,t]),C=Bl(()=>{a(S)},[a,S]),N=Bl(()=>{t.length<2||i("ui:unlink-nodes-requested",void 0)},[i,t]),k=Bl((T,E)=>{i("ui:link-updated",{linkId:T,updates:E})},[i]),L=Bl(T=>{i("ui:link-delete-requested",{linkId:T})},[i]),D=Bl(T=>{i("ui:link-focus-requested",{linkId:T})},[i]);return{handleEraserToggle:c,handleDeletePoints:d,handleReleasePoint:h,handleEraserRadiusChange:g,handleAddNodeAtRobot:f,handleAddNodeAtCursor:p,handleDeleteLastNode:_,handleDeleteLastSelectedNode:b,handleNodeUpdate:v,handleNodeTypeChange:w,handleSelectedNodesTransform:y,handleCreateLinks:S,handleCreateLinksByShortcut:C,setLinkCreationSettings:l,handleDeleteLinksBetweenSelected:N,handleLinkUpdate:k,handleLinkDelete:L,handleLinkFocus:D}},{useQuery:rVn}=await F("@tanstack/react-query"),kxt="/{robot_model}/capability/lidar2d",Lxt=async({robot_model:i})=>{const e=kxt.replace("{robot_model}",i);return Ls.get(e)},{useCallback:vF}=await F("react"),Dxt=({type:i,features:e})=>i?.toUpperCase()==="GOAL"&&Array.isArray(e)&&e.some(t=>t.toUpperCase()==="INIT"),Txt=({selectedRobotModel:i,currentMapName:e,currentMapInfo:t,mapListData:n,topologyNodes:s,hasUnsavedTopologyChanges:o,handleInitLocalization:r,handleSemiAutoInitLocalization:a})=>{const l=vF(()=>!e||!!n?.list?.length&&!t?(rt.openToast({type:"basic",variant:"warning",title:"Map Not Loaded",content:"Load a map before running localization init.",position:"top-right"}),!1):!0,[t,e,n?.list]),c=vF(async()=>{if(!i)return!1;try{return(await Lxt({robot_model:i})).info?.some(f=>f.connection)??!1?!0:(rt.openToast({type:"basic",variant:"warning",title:"LiDAR Disconnected",content:"Connect the 2D LiDAR before running localization init.",position:"top-right"}),!1)}catch{return rt.openToast({type:"basic",variant:"warning",title:"LiDAR Status Check Failed",content:"Failed to check 2D LiDAR connection status.",position:"top-right"}),!1}},[i]),d=vF(async()=>{l()&&await c()&&r()},[c,l,r]),h=vF(async()=>{if(!l()||!await c())return;if(o){rt.openToast({type:"basic",variant:"warning",title:"Unsaved Topology Changes",content:"Please save topology changes before running semi auto init.",position:"top-right"});return}if((s??[]).filter(Dxt).length===0){rt.openToast({type:"basic",variant:"warning",title:"Semi Auto Init Unavailable",content:"No goal node with INIT feature found in topology.",position:"top-right"});return}a()},[l,c,o,s,a]);return{handleInitLocalizationWithGuard:d,handleSemiAutoInitLocalizationWithGuard:h}},{useMutation:Ext}=await F("@tanstack/react-query"),Pxt="/{robot_model}/map/loadMap",Rxt=async({robot_model:i,mapName:e,baseURL:t})=>{const n=Pxt.replace("{robot_model}",i);return sb.post(n,{mapName:e},t?{baseURL:t}:void 0)},Mxt=()=>Ext({mutationFn:Rxt}),{useMutation:Axt}=await F("@tanstack/react-query"),Oxt="/{robot_model}/map/loadTopo",Fxt=async({robot_model:i,mapName:e,baseURL:t})=>{const n=Oxt.replace("{robot_model}",i);return sb.post(n,{mapName:e},t?{baseURL:t}:void 0)},Bxt=()=>Axt({mutationFn:Fxt}),{useMutation:Vxt}=await F("@tanstack/react-query"),zxt="/{robot_model}/localization/{command}",Wxt=async i=>{const{robot_model:e,command:t}=i,n=zxt.replace("{robot_model}",e).replace("{command}",t);return t==="semiAutoInit"?sb.post(n):sb.post(n,i.payload)},Hxt=()=>Vxt({mutationFn:Wxt}),{useMutation:$xt}=await F("@tanstack/react-query"),Uxt="/{robot_model}/setting/setSettingPreset";class zJ extends Error{constructor(e){super(e),this.name="SettingPresetRejectError"}}const jxt=i=>typeof i.result=="string"&&i.result.toLowerCase()!=="accept",Gxt=async i=>{const{robot_model:e,baseURL:t,...n}=i,s=Uxt.replace("{robot_model}",e),o=await sb.post(s,n,t?{baseURL:t}:void 0);if(jxt(o))throw new zJ(o.message||"setSettingPreset: 요청이 거절되었습니다.");return o},qxt=()=>$xt({mutationFn:i=>Gxt(i)}),{useMutation:aVn}=await F("@tanstack/react-query"),{useCallback:zD}=await F("react"),Kxt=({selectedRobotModel:i,getPreviewTransform:e})=>{const{mutate:t}=Hxt(),n=zD(l=>{const c=e();c&&t({robot_model:i,command:l,payload:{pose:c}})},[e,t,i]),s=zD(()=>{t({robot_model:i,command:"semiAutoInit"})},[t,i]),o=zD(()=>{n("start")},[n]),r=zD(()=>{n("init")},[n]),a=zD(()=>{n("stop")},[n]);return{handleStartLocalization:o,handleInitLocalization:r,handleSemiAutoInitLocalization:s,handleStopLocalization:a}},{useCallback:sU}=await F("react"),{useQueryClient:Jxt}=await F("@tanstack/react-query"),Yxt=({selectedRobotModel:i})=>{const e=Jxt(),{mutateAsync:t}=Mxt(),{mutateAsync:n}=Bxt(),s=sU(async a=>{const l=await t({robot_model:i,mapName:a});return e.invalidateQueries({queryKey:ioe({robot_model:i})}),l},[t,e,i]),o=sU(async a=>{const l=await n({robot_model:i,mapName:a});if(l.result!=="accept")throw new Error(l.message||"Failed to load topology");return l},[n,i]),r=sU(async a=>{await s(a)},[s]);return{loadMapAndRefreshCurrentMap:s,loadTopology:o,handleLoadMap:r}},Xxt=i=>{const{data:e}=ASt({robot_model:i});return{mapListData:e}},{useMutation:oU}=await F("@tanstack/react-query"),Qxt="/{robot_model}/mapping/start",Zxt="/{robot_model}/mapping/stop",eNt="/{robot_model}/mapping/save",tNt=i=>i==="accept",nNt=async({robot_model:i})=>{const e=Qxt.replace("{robot_model}",i);return Ls.post(e)},iNt=async({robot_model:i})=>{const e=Zxt.replace("{robot_model}",i);return Ls.post(e)},sNt=async({robot_model:i,mapName:e})=>{const t=eNt.replace("{robot_model}",i);return Ls.post(t,{mapName:e})},oNt=()=>{const i=oU({mutationFn:nNt}),e=oU({mutationFn:iNt});return{saveMapping:oU({mutationFn:sNt,onSuccess:n=>{if(tNt(n.result)){rt.openToast({type:"basic",variant:"success",title:"Map Save Success",content:"Map data has been saved",position:"top-right"});return}rt.openToast({type:"basic",variant:"warning",title:"Map Save Failed",content:n.message||"Failed to save map",position:"top-right"})},onError:()=>{rt.openToast({type:"basic",variant:"warning",title:"Map Save Failed",content:"Failed to save map",position:"top-right"})}}).mutateAsync,stopMapping:e.mutateAsync,startMapping:i.mutateAsync}},h_e={data:[],chunkNum:0,chunkId:0},rNt=(i,e=!0)=>{const{data:t=h_e,loading:n}=ls(`amr/${i}/socket/mappingKeyFRM`,{defaultValue:h_e,disabled:!e,selector:s=>({data:s?.data??[],chunkNum:s?.chunkNum??0,chunkId:s?.chunkId??0})});return{...t,loading:n}},{useCallback:WD,useEffect:yF,useRef:HD,useState:ex}=await F("react"),{useQueryClient:aNt}=await F("@tanstack/react-query"),g_e=i=>i==="accept",lNt=i=>i==="accept",cNt=({selectedRobotModel:i,emit:e,loadMapAndRefreshCurrentMap:t})=>{const n=aNt(),{data:s}=soe({robot_model:i}),o=s?.mapName,{startMapping:r,stopMapping:a,saveMapping:l}=oNt(),[c,d]=ex("idle"),h=HD("idle"),[g,m]=ex(null),[f,p]=ex(0),[_,b]=ex(!1),[v,w]=ex(0),[y,S]=ex(0),C=HD(null),N=HD(new Set),k=HD(new Map),L=HD(!1),{data:D}=URe(i,_),T=rNt(i,_);yF(()=>{h.current=c},[c]),yF(()=>{if(c!=="recording"||g===null)return;const B=window.setInterval(()=>{const z=Math.floor((Date.now()-g)/1e3);p(z)},1e3);return()=>{window.clearInterval(B)}},[g,c]);const E=WD(()=>{d("idle"),m(null),p(0),b(!1),w(0),S(0),C.current=null,N.current.clear(),k.current.clear(),L.current=!1},[]);yF(()=>{if(!_||h.current!=="recording"||!T||T.chunkNum<=0)return;const{chunkNum:B,chunkId:z,data:Y}=T;if(z<0||z>=B||((z===0||C.current===null||C.current!==B)&&(C.current=B,N.current.clear(),k.current.clear(),L.current=!1),L.current)||(N.current.add(z),k.current.set(z,Y.length),N.current.size!==B))return;const $=Array.from(k.current.values()).reduce((Z,K)=>Z+K,0);L.current=!0,w(Z=>Z+1),S(Z=>Z+$)},[T,_]);const R=WD(async()=>{if(h.current!=="idle")return!1;try{const B=await r({robot_model:i}),z=g_e(B.result);return z&&(d("recording"),m(Date.now()),p(0),b(!0),w(0),S(0),C.current=null,N.current.clear(),k.current.clear(),L.current=!1,e("ui:mapping-start-requested",void 0)),z}catch{return!1}},[e,i,r]),A=WD(async()=>{if(h.current!=="recording")return!1;try{const B=await a({robot_model:i}),z=g_e(B.result);return z&&(d("stopped"),b(!1)),z}catch{return!1}},[i,a]),M=WD(async B=>{if(h.current==="saving")return{ok:!1,reason:"save-failed"};d("saving");try{const z=await l({robot_model:i,mapName:B});if(n.invalidateQueries({queryKey:[Toe,i]}),!lNt(z.result))return d("stopped"),{ok:!1,reason:"save-failed"};try{return await t(B),E(),{ok:!0}}catch{return d("stopped"),{ok:!1,reason:"load-failed"}}}catch{return d("stopped"),{ok:!1,reason:"save-failed"}}finally{e("ui:mapping-stop-requested",void 0)}},[e,t,n,E,l,i]),O=WD(async()=>{const B=h.current;if(B!=="discarding"){d("discarding"),b(!1);try{if(B==="recording")try{await a({robot_model:i})}catch(z){console.error("Failed to stop mapping during discard:",z)}e("ui:mapping-stop-requested",void 0),o&&await t(o)}finally{E()}}},[o,e,t,E,i,a]);return yF(()=>()=>{const B=h.current;B!=="idle"&&(b(!1),e("ui:mapping-stop-requested",void 0),B==="recording"&&a({robot_model:i}))},[e,i,a]),{mappingPoints:D,mappingKeyFrame:T,mappingStatus:c,elapsedSeconds:f,mappingSocketEnabled:_,completedKeyframeCount:v,totalKeyframePoints:y,handleStartMapping:R,handleStopMapping:A,handleSaveMapping:M,handleDiscardMapping:O}},{useEffect:dNt,useRef:uNt}=await F("react"),{useQueryClient:hNt}=await F("@tanstack/react-query"),gNt=({robotModel:i,mapName:e})=>{const t=hNt(),n=uNt(void 0);dNt(()=>{if(!e){n.current=void 0;return}n.current!==e&&(n.current=e,t.invalidateQueries({queryKey:ioe({robot_model:i})}))},[e,t,i])};function mNt(i,e,t=!0){const{data:n,loading:s,isDefaultData:o}=ls(`amr/${i}/infoStatus`,{defaultValue:{infos:[]},selector:e,disabled:!t});return{data:n,loading:s,isDefaultData:o}}const PAe=/MCU\s*([0-9]+).*?(DIN|DIO|INPUT|OUTPUT|DI|DO|입력|출력|_IN|_OUT)[\s_-]*([0-9]+)/i,fNt=(i,e)=>{const t=i.toUpperCase();return t==="DIO"||t==="DO"?t:t==="DIN"||t==="DI"||t==="INPUT"||t==="입력"?"DIN":t==="OUTPUT"||t==="출력"?"DIO":e==="din"?"DIN":"DIO"},pNt=(i,e)=>i.replace(/[\s_-]*[0-9]+\s*$/,"").trim()||e,_Nt=(i,e)=>Object.entries(i).reduce((t,[n,s])=>{if(typeof s!="string"||s.length===0)return t;const o=s.match(PAe);return o&&(t[n]=pNt(o[0],e)),t},{}),bNt=(i,e)=>{if(!(i!==0&&i!==1))return`mcu${i}${e==="din"?"Din":"Dio"}`},vNt=i=>{const e=i.trim().toLowerCase();if(e==="1"||e==="true"||e==="on")return!0;if(e==="0"||e==="false"||e==="off")return!1},yNt=i=>Object.values(i).filter(e=>typeof e=="string"&&e.length>0),wNt=i=>{for(const e of yNt(i)){const t=e.match(PAe);if(!t)continue;const n=Number(t[1]),s=t[2],o=s.toUpperCase(),r=Number(t[3]),a=o==="DI"||o==="DIN"||o==="INPUT"||o==="입력"||o==="_IN"?"din":"dio",l=`MCU${n}`,c=fNt(s,a),d=`${l} ${c}`,h=_Nt(i,d);return{key:bNt(n,a),rowKey:`mcu${n}-${a}`,label:h,mcu:n,kind:a,pin:r}}return null},$D=i=>{const e=Array.from(i.values()).sort((t,n)=>t.pin-n.pin);return e.length>0?e:void 0},CNt=i=>{const e={mcu0Dio:new Map,mcu1Dio:new Map,mcu0Din:new Map,mcu1Din:new Map},t=new Map;for(const o of i?.infos??[]){if(o.categoryId!=="io")continue;const r=wNt(o.name),a=vNt(o.value);if(!r||a===void 0)continue;const l={pin:r.pin,value:a,rawValue:o.value};r.key&&e[r.key].set(r.pin,l);const c=t.get(r.rowKey);c?c.bits.set(r.pin,l):t.set(r.rowKey,{key:r.rowKey,label:r.label,mcu:r.mcu,kind:r.kind,bits:new Map([[r.pin,l]])})}const n=Array.from(t.values()).map(o=>({...o,bits:$D(o.bits)??[]})).filter(o=>o.bits.length>0).sort((o,r)=>o.kind!==r.kind?o.kind==="din"?-1:1:o.mcu-r.mcu),s={rows:n.length>0?n:void 0,mcu0Dio:$D(e.mcu0Dio),mcu1Dio:$D(e.mcu1Dio),mcu0Din:$D(e.mcu0Din),mcu1Din:$D(e.mcu1Din)};return n.length>0?s:void 0},{useMemo:wF}=await F("react"),SNt=({selectedRobotModel:i,enableInfoStatus:e=!1,enableTaskLogRefetch:t=!1})=>{const n=Jk(i);gNt({robotModel:i,mapName:n.mapState?.mapName});const s=ooe(i),o=mNt(i,void 0,e),{data:r}=noe({limit:10,page:1,searchText:"",sort:"createdAt",order:"DESC",filter:{},fields:{}},{refetchInterval:t?2e3:0,refetchIntervalInBackground:!1}),a=wF(()=>{if(r)return{...r,items:r.items?.map(h=>({...h}))}},[r]),l=wF(()=>({...n,pose:s.pose,vel:s.vel,autoMove:s.moveState?.autoMove,obsState:s.moveState?.obs}),[n,s.pose,s.vel,s.moveState?.autoMove,s.moveState?.obs]),c=wF(()=>{const h=s.pose,g=s.vel;return{localizationStatus:n.locState?.locStatus??"none",autoMove:s.moveState?.autoMove,obsState:s.moveState?.obs??"none",poseX:Number(h?.x??0),poseY:Number(h?.y??0),poseZ:0,poseYaw:Number(h?.rz??0),speed:Math.hypot(g?.vx??0,g?.vy??0),velocityX:g?.vx??0,velocityY:g?.vy??0,velocityWz:g?.wz??0,roll:n.imu?.imuRx??0,pitch:n.imu?.imuRy??0,imuYaw:n.imu?.imuRz??0,angularVelocity:n.imu?.gyrZ??0,inlierError:n.locState?.inlierError??0,inlierRatio:n.locState?.inlierRatio??0}},[s.pose,s.vel,s.moveState?.autoMove,s.moveState?.obs,n.imu?.gyrZ,n.imu?.imuRx,n.imu?.imuRy,n.imu?.imuRz,n.locState?.locStatus,n.locState?.inlierError,n.locState?.inlierRatio]),d=wF(()=>CNt(o.data),[o.data]);return{baseAmrStatus:n,amrMoveStatus:s,amrInfoStatus:o,amrSafetyIoStatus:d,taskLogData:a,monitorStatusSnapshot:l,hudStatusSnapshot:c}},{useMutation:xNt}=await F("@tanstack/react-query"),NNt="/{robot_model}/move/{axis}",INt=i=>i==="x"?"xLinear":"yLinear",kNt=async i=>{const{robot_model:e,axis:t,...n}=i,s=NNt.replace("{robot_model}",e).replace("{axis}",INt(t));return Ls.post(s,n)},LNt=()=>xNt({mutationFn:kNt}),{useMutation:DNt}=await F("@tanstack/react-query"),TNt="/{robot_model}/move/target",ENt=async({robot_model:i,goalPose:e,method:t,preset:n=0})=>{const s=TNt.replace("{robot_model}",i);return Ls.post(s,{goalPose:e,method:t,preset:n})},PNt=()=>DNt({mutationFn:ENt}),{useMutation:RNt}=await F("@tanstack/react-query"),MNt="/{robot_model}/move/goal",ANt=async({robot_model:i,goalId:e,goalName:t,method:n})=>{const s=MNt.replace("{robot_model}",i);return Ls.post(s,{goalId:e,...t!==void 0&&{goalName:t},...n!==void 0&&{method:n}})},ONt=()=>RNt({mutationFn:ANt}),{useMutation:FNt}=await F("@tanstack/react-query"),BNt="/{robot_model}/control/dock",VNt=async({robot_model:i})=>{const e=BNt.replace("{robot_model}",i);return Ls.post(e)},zNt=()=>FNt({mutationFn:VNt}),{useMutation:WNt}=await F("@tanstack/react-query"),HNt="/{robot_model}/call_pause",$Nt=async({robot_model:i})=>{const e=HNt.replace("{robot_model}",i);return Ls.post(e)},UNt=()=>WNt({mutationFn:$Nt}),{useMutation:jNt}=await F("@tanstack/react-query"),GNt="/{robot_model}/call_resume",qNt=async({robot_model:i})=>{const e=GNt.replace("{robot_model}",i);return Ls.post(e)},KNt=()=>jNt({mutationFn:qNt}),{useMutation:JNt}=await F("@tanstack/react-query"),YNt="/{robot_model}/control/dockStop",XNt=async({robot_model:i})=>{const e=YNt.replace("{robot_model}",i);return Ls.post(e)},QNt=()=>JNt({mutationFn:XNt}),{useMutation:ZNt}=await F("@tanstack/react-query"),eIt="/{robot_model}/control/undock",tIt=async({robot_model:i})=>{const e=eIt.replace("{robot_model}",i);return Ls.post(e)},nIt=()=>ZNt({mutationFn:tIt}),{useMutation:iIt}=await F("@tanstack/react-query"),sIt="/{robot_model}/control/setDetectMode",oIt=()=>iIt({mutationFn:({robot_model:i,switch:e})=>{const t=sIt.replace("{robot_model}",i);return Ls.post(t,{switch:e})}}),{useMutation:rIt}=await F("@tanstack/react-query"),aIt="/{robot_model}/control/setSafetyField",lIt=()=>rIt({mutationFn:({robot_model:i,safetyField:e})=>{const t=aIt.replace("{robot_model}",i);return Ls.post(t,{safetyField:e})}}),{useMutation:cIt}=await F("@tanstack/react-query"),dIt="/{robot_model}/control/setSafetyFlag",uIt=()=>cIt({mutationFn:({robot_model:i,name:e})=>{const t=dIt.replace("{robot_model}",i);return Ls.post(t,{safetyFlag:[{name:e,value:!1}]})}}),{useMutation:hIt}=await F("@tanstack/react-query"),gIt="/{robot_model}/control/setSafetyIo",mIt=()=>hIt({mutationFn:async({robot_model:i,mcu0Din:e,mcu1Din:t})=>{const n=gIt.replace("{robot_model}",i),s=await Ls.post(n,{mcu0Din:e,mcu1Din:t});if(s.result==="reject")throw new Error(s.message);return s}}),{useCallback:Gu}=await F("react"),RAe="move.amr.toast.moveReject.title",fIt={"not localized":"move.amr.toast.moveReject.localizationUnavailable","same goal":"move.amr.toast.moveReject.sameTarget","out of bounds":"move.amr.toast.moveReject.outOfMapRange","marker node":"move.amr.toast.moveReject.markerNode","module not ready":"move.amr.toast.moveReject.robotNotReady","map not loaded":"move.amr.toast.moveReject.noMap","goal not found":"move.amr.toast.moveReject.targetNodeNotFound","path not found":"move.amr.toast.moveReject.noLink"},CF=i=>{if(!i||typeof i!="object")return"";const e=i,t=e.response?.data;return typeof t?.message=="string"?t.message:Array.isArray(t?.detail)?t.detail.map(n=>n&&typeof n=="object"&&"msg"in n?String(n.msg??""):"").filter(Boolean).join(" "):typeof e.message=="string"?e.message:""},pIt=(i,e)=>{const t=i?.trim()??"",n=t.startsWith("move.amr.toast.moveReject.")&&t!==RAe?t:fIt[t];return(n?e(n):void 0)||t||e("move.amr.toast.moveReject.default")},uv=(i,e)=>{rt.openToast({type:"basic",variant:"danger",title:e(RAe),content:pIt(i,e)})},_It=({selectedRobotModel:i})=>{const{t:e}=q(),{mutateAsync:t}=rEe(),{mutateAsync:n}=uIt(),{mutateAsync:s}=lIt(),{mutateAsync:o}=mIt(),{mutateAsync:r}=oIt(),{mutate:a}=zNt(),{mutate:l}=UNt(),{mutate:c}=KNt(),{mutate:d}=QNt(),{mutate:h}=nIt(),{mutate:g}=PNt(),{mutate:m}=ONt(),{mutate:f}=LNt(),p=Gu(E=>t({robot_model:i,value:!E}),[i,t]),_=Gu(E=>{g({robot_model:i,...E},{onSuccess:R=>{R?.result!=="accept"&&uv(R?.message,e)},onError:R=>{uv(CF(R),e)}})},[g,i,e]),b=Gu(E=>{m({robot_model:i,...E},{onSuccess:R=>{R?.result!=="accept"&&uv(R?.message,e)},onError:R=>{uv(CF(R),e)}})},[m,i,e]),v=Gu(E=>{if(E.axis==="y"){const R=E.direction??(E.target>=0?"right":"left");f({robot_model:i,axis:"y",direction:R,target:Math.abs(E.target),speed:E.speed},{onSuccess:A=>{A?.result!=="accept"&&uv(A?.message,e)},onError:A=>{uv(CF(A),e)}});return}f({robot_model:i,axis:"x",target:E.target,speed:E.speed},{onSuccess:R=>{R?.result!=="accept"&&uv(R?.message,e)},onError:R=>{uv(CF(R),e)}})},[f,i,e]),w=Gu(E=>{a({robot_model:i},{onSuccess:R=>{if(R?.result==="reject"){const A=R.message||e("move.amr.toast.dockReject.default");E?.(A)}}})},[a,i,e]),y=Gu(()=>{h({robot_model:i})},[i,h]),S=Gu(()=>{l({robot_model:i})},[l,i]),C=Gu(()=>{c({robot_model:i})},[c,i]),N=Gu(()=>{d({robot_model:i})},[d,i]),k=Gu(E=>n({robot_model:i,name:E}),[i,n]),L=Gu(E=>s({robot_model:i,safetyField:E}),[i,s]),D=Gu(E=>r({robot_model:i,switch:E}),[i,r]),T=Gu(E=>o({robot_model:i,...E}),[i,o]);return{handleSetMotorLocked:p,handleMoveTarget:_,handleMoveGoal:b,handleMoveLinear:v,handleDock:w,handleDockPause:S,handleDockResume:C,handleDockStop:N,handleUndock:y,handleClearSafetyFlag:k,handleSetSafetyField:L,handleSetSafetyIo:T,handleSetDetectMode:D}},MAe=()=>({GOAL:0,ROUTE:0,ALIGN:0}),bIt=i=>{const e=i.toUpperCase();return e==="GOAL"?"GOAL":e==="ROUTE"?"ROUTE":e==="ALIGN"?"ALIGN":null},m_e=i=>{const e=MAe();return i.forEach(t=>{const n=bIt(t);n&&(e[n]+=1)}),e},{useMemo:vIt}=await F("react"),yIt=({nodes:i,topologyData:e})=>{const t=vIt(()=>i.length>0?m_e(i.map(s=>s.type)):e?.length?m_e(e.map(s=>s.type)):MAe(),[i,e]),n=i.length>0?i.length:e?.length??0;return{nodeTypeCounts:t,topologyCount:n}},{useState:f_e}=await F("react"),wIt=()=>{const[i,e]=f_e(.3),[t,n]=f_e(15);return{linearJogSpeed:i,setLinearJogSpeed:e,rotationJogSpeed:t,setRotationJogSpeed:n}},{useCallback:p_e,useEffect:__e,useState:jw}=await F("react"),CIt=({editorReady:i,worldStudioRef:e})=>{const[t,n]=jw(!1),[s,o]=jw(.5),[r,a]=jw("goal"),[l,c]=jw("cursor"),[d,h]=jw(!1),[g,m]=jw(0),[f,p]=jw(!1),_=p_e(()=>{h(!0)},[]),b=p_e(()=>{h(!1)},[]);return __e(()=>{i?.editor&&o(e.current?.getEraserRadius()??.5)},[i?.editor,e]),__e(()=>{if(i?.editor)return e.current?.onTopologyChanged(_)},[i?.editor,e,_]),{isEraserEnabled:t,setIsEraserEnabled:n,eraserRadius:s,setEraserRadius:o,selectedNodeType:r,setSelectedNodeType:a,selectedNodePlacementType:l,setSelectedNodePlacementType:c,hasUnsavedTopologyChanges:d,markTopologyDirty:_,resetTopologyDirty:b,selectedEraserPointsCount:g,setSelectedEraserPointsCount:m,hasUnsavedCloudChanges:f,setHasUnsavedCloudChanges:p}},{useMemo:SIt}=await F("react"),{useQuery:xIt}=await F("@tanstack/react-query"),AAe="topology.json",OAe="/{robot_model}/map/getTopology",NIt=999,IIt=i=>({...i,format_version:i.format_version??fB,metadata:i.metadata,nodes:i.nodes??[],links:i.links??[],zones:i.zones??[]}),b_e=async({robot_model:i,mapName:e,pageNo:t})=>{const n=OAe.replace("{robot_model}",i),s=await Ls.get(n,{params:{mapName:e,fileName:AAe,pageNo:t,pageSize:NIt}});return IIt(s)},kIt=async({robot_model:i,mapName:e})=>{const t=await b_e({robot_model:i,mapName:e,pageNo:1}),n=Math.max(t.totalPage??1,1);if(n===1)return t;const s=await Promise.all(Array.from({length:n-1},(o,r)=>b_e({robot_model:i,mapName:e,pageNo:r+2})));return{...t,nodes:[t,...s].flatMap(o=>o.nodes),links:[t,...s].flatMap(o=>o.links),zones:[t,...s].flatMap(o=>o.zones)}},LIt=(i,e={})=>{const t=SIt(()=>[OAe,{...i,fileName:AAe}],[i]);return{...xIt({queryKey:t,queryFn:()=>kIt(i),enabled:!!i.mapName,...e}),queryKey:t}},DIt="modulepreload",TIt=function(i){return"/"+i},v_e={},Nt=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){let r=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");s=r(t.map(c=>{if(c=TIt(c),c in v_e)return;v_e[c]=!0;const d=c.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const g=document.createElement("link");if(g.rel=d?"stylesheet":DIt,d||(g.as="script"),g.crossOrigin="",g.href=c,l&&g.setAttribute("nonce",l),document.head.appendChild(g),d)return new Promise((m,f)=>{g.addEventListener("load",m),g.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(r){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r}return s.then(r=>{for(const a of r||[])a.status==="rejected"&&o(a.reason);return e().catch(o)})},{lazy:TA,memo:EIt,Suspense:PIt,useEffect:RIt,useState:y_e}=await F("react"),MIt=TA(()=>Nt(()=>import("./index.C7SAsNe2.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.Overview}))),AIt=TA(()=>Nt(()=>import("./index.C7SAsNe2.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.TaskInformation}))),OIt=TA(()=>Nt(()=>import("./index.C7SAsNe2.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.PduInfo}))),FIt=TA(()=>Nt(()=>import("./index.C7SAsNe2.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.DockControl}))),BIt=TA(()=>Nt(()=>import("./AmrCapabilityControl.BsPcogIn.js"),__vite__mapDeps([7,3,2,4,5,6,8]))),VIt=[{label:"move.amr.rightPanel.monitor.tab.overview",value:"overview"},{label:"move.amr.rightPanel.monitor.tab.task",value:"task"},{label:"move.amr.rightPanel.monitor.tab.pdu",value:"pdu"},{label:"move.amr.rightPanel.monitor.tab.dock",value:"dock"},{label:"move.amr.rightPanel.monitor.tab.capability",value:"capability"}],w_e=i=>i==="overview"||i==="task"||i==="pdu"||i==="dock"||i==="capability",SF=()=>{},zIt=({className:i,robotModel:e,overviewProps:t,taskProps:n,pduProps:s,dockProps:o})=>{const[r,a]=xc(),l=ir(),{t:c}=q(),{theme:d}=tt(),[h,g]=y_e(()=>{const k=r.get("monitor_tab");return k==="motor"?"pdu":k&&w_e(k)?k:"overview"}),[m,f]=y_e(!1);RIt(()=>{f(!1)},[e]);const p=()=>rt.openToast({type:"basic",variant:"success",title:c("move.amr.pdu.toast.motorConnect.title"),content:c("move.amr.pdu.toast.motorConnect.content")}),_=()=>rt.openToast({type:"basic",variant:"danger",title:c("common.toast.apiError.title"),content:c("common.toast.apiError.content")}),b=()=>{l("../settings?group=drive&menu=docking&expended=1")},v=k=>{g(k);const L=new URLSearchParams(r);L.set("monitor_tab",k),a(L,{replace:!0})},w=()=>{f(!1),o.onDock?.()},y=()=>{f(!0),o.onPause?.()},S=()=>{f(!1),o.onResume?.()},C=()=>{f(!1),o.onStop?.()},N=()=>{f(!1),o.onUndock?.()};return u("div",{className:P("AmrMonitorControl","h-full",i),children:u("div",{className:"flex h-full gap-0",children:x("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-x-hidden",children:[u("div",{className:P("shrink-0",d==="light"?"bg-default":"bg-alt-1"),children:u(m9,{tabItems:VIt.map(k=>({key:k.value,label:c(k.label)})),activeKey:h,handleChange:k=>{w_e(k)&&v(k)},size:"xs",tabBtnClassName:"typo-compact-xs-bold light:bg-white light:[&.active]:bg-fill-navy! light:[&.active]:text-white!"})}),u(U,{className:"min-h-0 flex-1 overflow-y-auto",children:x(PIt,{fallback:null,children:[h==="overview"&&u(MIt,{amrStatus:t.amrStatus,robotVersion:t.robotVersion,onStartLocalization:t.onStartLocalization??SF,onInitLocalization:t.onInitLocalization??SF,onSemiAutoInitLocalization:t.onSemiAutoInitLocalization??SF,onStopLocalization:t.onStopLocalization??SF,selectedTool:t.selectedTool,onToolChange:t.onToolChange,onBuildInfoOpenChange:t.onBuildInfoOpenChange}),h==="task"&&u(AIt,{logData:n.logData,moveStatus:n.moveStatus}),h==="pdu"&&u(OIt,{amrStatus:s.amrStatus,setMotorLocked:s.setMotorLocked,onClearSafetyRecovery:s.onClearSafetyRecovery,onLidarFieldSave:s.onLidarFieldSave,onOssdDetectChange:s.onOssdDetectChange,safetyIo:s.safetyIo,safetyIoLoading:s.safetyIoLoading,onSetSafetyIo:s.onSetSafetyIo,onSafetyIoSetError:_,onMotorConnectSuccess:p,onLidarSaveSuccess:()=>rt.openToast({type:"basic",variant:"success",title:c("move.amr.pdu.toast.lidarSave.title"),content:c("move.amr.pdu.toast.lidarSave.content")}),onMotorConnectError:_,onLidarSaveError:_}),h==="dock"&&u(FIt,{amrStatus:o.amrStatus,isPaused:m,onDock:w,onPause:y,onResume:S,onStop:C,onUndock:N,maxRetryCount:o.maxRetryCount,rejectMessage:o.rejectMessage,onOpenRetrySettings:b,dockDisabled:e.startsWith("S100")}),h==="capability"&&u(BIt,{robotModel:e})]})})]})})})},WIt=EIt(zIt),{lazy:Eoe,memo:HIt,Suspense:$It,useEffect:UIt,useState:jIt}=await F("react"),GIt=Eoe(()=>Nt(()=>import("./index.C7SAsNe2.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.EraserTab}))),qIt=Eoe(()=>Nt(()=>import("./index.C7SAsNe2.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.MapInfo}))),KIt=Eoe(()=>Nt(()=>import("./index.C7SAsNe2.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.MappingTab}))),JIt=[{label:"move.amr.rightPanel.map.tab.info",value:"info"},{label:"move.amr.rightPanel.map.tab.mapping",value:"mapping"},{label:"move.amr.rightPanel.map.tab.erasing",value:"erasing"}],rU="map_tab",aU=i=>i==="info"||i==="mapping"||i==="erasing",YIt=({className:i,mapInfoProps:e,mappingTabProps:{mapList:t,...n},eraserTabProps:s,hasUnsavedCloudChanges:o=!1,onDiscardCloudChanges:r,onLoadMap:a,loadMapDisabled:l,onDownloadMap:c,downloadMapDisabled:d})=>{const{theme:h}=tt(),{t:g}=q(),{confirmDialog:m}=jn(),[f,p]=xc(),[_,b]=jIt(()=>{const w=f.get(rU)??"";return aU(w)?w:"info"});UIt(()=>{const w=f.get(rU)??"",y=aU(w)?w:"info";b(S=>S!==y?y:S)},[f]);const v=async w=>{if(w===_)return;const y=n?.mappingStatus??"idle",S=_==="mapping"&&w!=="mapping",C=_==="erasing"&&w!=="erasing";if(S){if(y==="saving"||y==="discarding")return;if(y!=="idle"){if(!await m({title:g("move.amr.rightPanel.map.dialog.discardMapping.title"),content:g("move.amr.rightPanel.map.dialog.discardMapping.content"),buttonText:{yes:g("move.amr.rightPanel.map.dialog.discardMapping.yes"),no:g("move.amr.rightPanel.common.cancel")}}))return;await n?.onDiscard?.()}}if(C&&o){if(!await m({title:"Discard erasing changes?",content:"Leaving the erasing tab will discard erased point changes.",buttonText:{yes:g("move.amr.rightPanel.map.dialog.discardMapping.yes"),no:g("move.amr.rightPanel.common.cancel")}}))return;await r?.()}b(w);const N=new URLSearchParams(f);N.set(rU,w),p(N,{replace:!0})};return x(U,{className:P("AmrMapControl","h-full","overflow-x-hidden",i),children:[u("div",{className:P("sticky top-0 left-0 z-2",h==="light"?"bg-default":"bg-alt-1"),children:u(m9,{tabItems:JIt.map(w=>({key:w.value,label:g(w.label)})),activeKey:_,handleChange:w=>{aU(w)&&v(w)},size:"xs",tabBtnClassName:"typo-compact-xs-bold light:bg-white light:[&.active]:bg-fill-navy! light:[&.active]:text-white!"})}),u(U,{className:"min-h-0 flex-1",children:x($It,{fallback:null,children:[_==="info"&&u(qIt,{currentMapName:e?.currentMapName??"",createdAt:e?.createdAt,lastModified:e?.lastModified,mapCloudCount:e?.mapCloudCount??0,mapBounds:e?.mapBounds,topologyCount:e?.topologyCount??0,nodeTypeCounts:e?.nodeTypeCounts,onLoadMap:a,loadMapDisabled:l,onDownloadMap:c,downloadMapDisabled:d}),_==="mapping"&&u(KIt,{mappingStatus:n?.mappingStatus,elapsedSeconds:n?.elapsedSeconds,completedKeyframeCount:n?.completedKeyframeCount,totalKeyframePoints:n?.totalKeyframePoints,onStartMapping:n?.onStartMapping,onStopMapping:n?.onStopMapping,onSaveMapping:n?.onSaveMapping,onDiscard:n?.onDiscard,mapList:t}),_==="erasing"&&u(GIt,{...s})]})})]})},XIt=HIt(YIt),{lazy:QIt,memo:ZIt,Suspense:ekt,useState:tkt}=await F("react"),nkt=QIt(()=>Nt(()=>import("./index.C7SAsNe2.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.MarkerControl}))),ikt=[{label:"move.amr.rightPanel.marker.tab.register",value:"register"},{label:"move.amr.rightPanel.marker.tab.teaching",value:"teaching"}],skt=({className:i,markerProps:e})=>{const{theme:t}=tt(),{t:n}=q(),[s,o]=tkt("register");return u("div",{className:P("AmrMarkerControl","h-full",i),children:u("div",{className:"flex h-full gap-0",children:x("div",{className:"flex h-full flex-1 flex-col overflow-hidden",children:[u("div",{className:P("sticky top-0 left-0 z-2",t==="light"?"bg-default":"bg-alt-1"),children:u(m9,{tabItems:ikt.map(r=>({key:r.value,label:n(r.label)})),activeKey:s,handleChange:r=>o(r),size:"xs",tabBtnClassName:"typo-compact-xs-bold light:bg-white light:[&.active]:bg-fill-navy! light:[&.active]:text-white!"})}),u(U,{className:"h-full",children:u(ekt,{fallback:null,children:u(nkt,{mode:s,isScanning:e.isScanning,detections:e.detections,onScanStart:e.onScanStart,onScanStop:e.onScanStop,onRegisterMarker:e.onRegisterMarker,isRegisterPending:e.isRegisterPending,lastRegisteredMarkerId:e.lastRegisteredMarkerId,registeredMarkers:e.registeredMarkers,capturedPose:e.capturedPose,capturedDetection:e.capturedDetection,onCapturePose:e.onCapturePose,onTeachTarget:e.onTeachTarget})})})]})})})},okt=ZIt(skt),rkt={detections:[],stamp:0},akt=i=>({camId:i.camId,markerId:i.markerId,type:i.type,pose:i.pose?{x:i.pose.x,y:i.pose.y,z:i.pose.z,rx:i.pose.rx,ry:i.pose.ry,rz:i.pose.rz}:void 0,confidence:i.confidence,distM:i.distM}),lkt=(i,e=!1)=>{const{data:t}=ls(`amr/${i}/marker/detected`,{defaultValue:rkt,disabled:!e});return{detections:t.detections.map(akt),stamp:t.stamp}},{useMutation:ckt}=await F("@tanstack/react-query"),dkt="/{robot_model}/marker/scanStart",ukt=async({robot_model:i})=>{const e=dkt.replace("{robot_model}",i);return Ls.post(e)},hkt=()=>ckt({mutationFn:ukt}),{useMutation:gkt}=await F("@tanstack/react-query"),mkt="/{robot_model}/marker/scanStop",fkt=async({robot_model:i})=>{const e=mkt.replace("{robot_model}",i);return Ls.post(e)},pkt=()=>gkt({mutationFn:fkt}),{useMutation:_kt}=await F("@tanstack/react-query"),bkt="/{robot_model}/marker/register",vkt=async({robot_model:i,...e})=>{const t=bkt.replace("{robot_model}",i);return Ls.post(t,e)},ykt=()=>_kt({mutationFn:vkt}),{useMutation:wkt}=await F("@tanstack/react-query"),Ckt="/{robot_model}/marker/setPrecisionNode",Skt=async({robot_model:i,...e})=>{const t=Ckt.replace("{robot_model}",i);return Ls.post(t,e)},xkt=()=>wkt({mutationFn:Skt}),{useCallback:UD,useEffect:Nkt,useMemo:Ikt,useState:xF}=await F("react"),{useQueryClient:kkt}=await F("@tanstack/react-query"),FAe=i=>{if(!i)return{markerId:NaN,mount:""};const e=t=>{const n=i.match(new RegExp(`${t}=([^;]+)`));return n?n[1]:""};return{markerId:parseInt(e("marker"),10),mount:e("mount")}},Lkt=i=>{if(!i.features.includes("PRECISION"))return null;const{markerId:e}=FAe(i.context);return isNaN(e)?null:{markerId:e,nodeId:i.id,nodeName:i.name,pose:{x:i.pose.x,y:i.pose.y,rz:i.pose.rz},context:i.context}},Dkt=(i,e)=>{const t=i.features.includes("APRIL"),n=i.features.includes("ARUCO");if(!t&&!n)return null;const{markerId:s,mount:o}=FAe(i.context);return isNaN(s)?null:{markerId:s,nodeId:i.id,type:t?"APRIL":"ARUCO",mount:o||"WALL",targets:[],precisionTarget:e.get(s)??null}},Tkt=({robotModel:i,enabled:e=!1,mapName:t,topology:n,robotPose:s,onNodeRegistered:o})=>{const{t:r}=q(),a=kkt(),[l,c]=xF(!1),[d,h]=xF(null),[g,m]=xF(null),[f,p]=xF(null),_=Ikt(()=>{const R=n?.nodes??[],A=new Map;for(const M of R){const O=Lkt(M);O&&A.set(O.markerId,O)}return R.filter(M=>M.type==="ALIGN").flatMap(M=>{const O=Dkt(M,A);return O?[O]:[]})},[n]),{detections:b}=lkt(i,l),{locState:v}=Jk(i,R=>({locState:R.locState})),{mutate:w}=hkt(),{mutate:y}=pkt(),{mutate:S,isPending:C}=ykt(),{mutate:N}=xkt(),k=UD((R=!0)=>{if(v?.locStatus!=="good"){R&&rt.openToast({title:r("move.amr.toast.markerScanReject.title"),content:r("move.amr.toast.markerScanReject.localizationUnavailable"),type:"basic",variant:"warning"});return}w({robot_model:i},{onSuccess:()=>c(!0)})},[v?.locStatus,i,w,r]),L=UD(()=>{y({robot_model:i},{onSuccess:()=>c(!1)})},[i,y]);Nkt(()=>{if(e){!l&&v?.locStatus==="good"&&k(!1);return}l&&L()},[e,k,L,l,v?.locStatus]);const D=UD(R=>{S({robot_model:i,...R},{onSuccess:A=>{if(!(A.result!=="success"&&A.result!=="accept")&&(h(R.markerId),rt.openToast({title:r("move.amr.toast.markerRegister.title"),content:r("move.amr.toast.markerRegister.success",{markerId:R.markerId}),type:"basic",variant:"success"}),A.node&&(o?.(A.node),t))){const M=[HB,{robot_model:i,mapName:t}];a.setQueryData(M,O=>!O||O.nodes.some(B=>B.id===A.node.id)?O:{...O,nodes:[...O.nodes,A.node]}),a.invalidateQueries({queryKey:M})}}})},[t,o,a,i,S,r]),T=UD(()=>{s&&m({x:s.x,y:s.y,rz:s.rz})},[s]),E=UD(R=>{N({robot_model:i,markerId:R.markerId,nodeName:R.nodeName},{onSuccess:A=>{if(A.result==="reject"){A.message==="marker_not_visible"&&rt.openToast({title:r("move.amr.toast.markerTeach.title"),content:r("move.amr.toast.markerTeach.reject.markerNotVisible"),type:"basic",variant:"danger"});return}if(!(A.result!=="success"&&A.result!=="accept")){if(A.node&&(rt.openToast({title:r("move.amr.toast.markerTeach.title"),content:"",type:"basic",variant:"success"}),o?.(A.node),t)){const M=[HB,{robot_model:i,mapName:t}];a.setQueryData(M,O=>!O||O.nodes.some(B=>B.id===A.node.id)?O:{...O,nodes:[...O.nodes,A.node]}),a.invalidateQueries({queryKey:M})}m(null),p(null)}}})},[i,N,t,o,a,r]);return{isScanning:l,detections:b,onScanStart:k,onScanStop:L,onRegisterMarker:D,isRegisterPending:C,lastRegisteredMarkerId:d,registeredMarkers:_,capturedPose:g,capturedDetection:f,onCapturePose:T,onTeachTarget:E}},{memo:Ekt,useCallback:C_e,useEffect:Pkt,useMemo:jD,useRef:Gw,useState:NF}=await F("react"),IF={width:630,height:480},kF={width:420,height:240},S_e=24,lU=(i,e,t)=>Math.min(Math.max(i,e),t),Rkt=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),Mkt=i=>Rkt(i)&&("name"in i||"value"in i),gR=(i,e)=>{if(!i)return"";if(typeof i=="string")return i;const t=e.split("-")[0];return i[t]??i.en??i.ko??Object.values(i).find(s=>!!s)??""},Akt=(i,e,t)=>gR(t.get(i),e)||i,Okt=i=>{const e=i?.infos;return{items:Array.isArray(e)?e.filter(Mkt):[]}},Poe=i=>i==null||i===""?"-":typeof i=="boolean"?i?"true":"false":String(i),Fkt=i=>i.trim().toLowerCase(),Bkt=i=>{const e=Poe(i.value);return i.type===2?{color:e==="1"?"green":"gray",label:e==="1"?"ON":e==="0"?"OFF":e}:i.type===1?{color:"blue",label:e}:null},Vkt=({item:i,currentLanguage:e})=>{const t=gR(i.name,e)||i.categoryId||"unknown",n=gR(i.description,e),s=Poe(i.value),o=Bkt(i);return x("div",{className:"bg-fill-disabled flex w-full min-w-0 shrink-0 items-start justify-between gap-2 rounded-md px-2.5 py-2",children:[x("div",{className:"min-w-0 flex-1",children:[x(H,{className:"min-w-0 items-center gap-1.5",children:[i.color?u("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:i.color}}):null,u("p",{className:"typo-compact-xs2-normal text-fg-subtle min-w-0 break-words",children:t})]}),n?u("p",{className:"typo-compact-2xs-normal text-fg-subtler mt-0.5 min-w-0 break-words",children:n}):null]}),u("div",{className:"flex max-w-[45%] shrink-0 flex-col items-end gap-1",children:o?u(lh,{type:"soft",color:o.color,className:"max-w-full",children:u("span",{className:"max-w-full min-w-0 break-all",children:o.label})}):u("p",{className:"typo-compact-xs2-medium text-fg-default max-w-full min-w-0 text-right font-mono break-all",title:s,children:s})})]})},zkt=(i,e,t)=>{const n=i(e);return n===e?t:n},Wkt=({infoStatus:i,infoCategories:e,infoStatusLoading:t=!1,infoStatusIsDefault:n=!0,onClose:s})=>{const[o,r]=NF(""),[a,l]=NF({x:0,y:0}),[c,d]=NF(IF),[h,g]=NF(80),m=Gw(null),f=Gw({x:0,y:0}),p=Gw(IF),_=Gw(!1),b=Gw(!1),v=Gw({mouseX:0,mouseY:0,panelX:0,panelY:0}),w=Gw({mouseX:0,mouseY:0,panelX:0,panelY:0,width:IF.width,height:IF.height}),{t:y,currentLanguage:S}=q(),C=jD(()=>(M,O)=>zkt(y,M,O),[y]),N=C_e(M=>{M.preventDefault(),!b.current&&(_.current=!0,document.body.style.cursor="grabbing",document.body.style.userSelect="none",v.current={mouseX:M.clientX,mouseY:M.clientY,panelX:f.current.x,panelY:f.current.y})},[]),k=C_e(M=>{M.preventDefault(),M.stopPropagation();const O=m.current?.getBoundingClientRect();b.current=!0,document.body.style.cursor="se-resize",document.body.style.userSelect="none",w.current={mouseX:M.clientX,mouseY:M.clientY,panelX:f.current.x,panelY:f.current.y,width:O?.width??p.current.width,height:O?.height??p.current.height}},[]);Pkt(()=>{const M=B=>{if(_.current){const z=v.current.panelX+(B.clientX-v.current.mouseX),Y=v.current.panelY+(B.clientY-v.current.mouseY);f.current={x:z,y:Y},m.current&&(m.current.style.transform=`translate(${z}px, ${Y}px)`)}if(b.current){const z=lU(w.current.width+(B.clientX-w.current.mouseX),kF.width,Math.max(kF.width,window.innerWidth-S_e)),Y=lU(w.current.height+(B.clientY-w.current.mouseY),kF.height,Math.max(kF.height,window.innerHeight-S_e)),$={width:z,height:Y},Z={x:w.current.panelX+(z-w.current.width),y:w.current.panelY+(Y-w.current.height)};p.current=$,f.current=Z,d($),l(Z)}},O=()=>{_.current&&(_.current=!1,l({...f.current})),b.current&&(b.current=!1),document.body.style.cursor="",document.body.style.userSelect=""};return window.addEventListener("mousemove",M),window.addEventListener("mouseup",O),()=>{window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",O),document.body.style.cursor="",document.body.style.userSelect=""}},[]);const{items:L}=jD(()=>Okt(i),[i]),D=jD(()=>{const M=new Map;for(const O of e??[])M.set(O.categoryId,O.name);return M},[e]),T=jD(()=>{const M=new Map;for(const O of L){const B=O.categoryId||"uncategorized",z=M.get(B)??[];z.push(O),M.set(B,z)}return Array.from(M.entries()).map(([O,B])=>({id:O,label:Akt(O,S,D),items:B}))},[D,S,L]),E=jD(()=>{const M=Fkt(o);return M?T.map(O=>{const B=O.items.filter(z=>[O.id,O.label,z.categoryId,z.groupId,gR(z.name,S),gR(z.description,S),Poe(z.value)].filter(Boolean).join(" ").toLowerCase().includes(M));return{...O,items:B}}).filter(O=>O.items.length>0):T},[T,S,o]),R=!n&&i!==void 0&&L.length>0,A=u(lh,{type:"soft",color:t?"blue":R?"green":"gray",className:"max-w-24 shrink-0",children:u("span",{className:"break-all",children:t?C("move.amr.rightPanel.debug.state.loading","Loading"):R?C("move.amr.rightPanel.debug.state.receiving","Receiving"):C("move.amr.rightPanel.debug.state.waiting","Waiting")})});return u("div",{className:"pointer-events-auto",children:x("div",{ref:m,className:"border-subtle shadow-down-lg relative flex flex-col overflow-hidden rounded-lg border",style:{backgroundColor:`color-mix(in srgb, var(--color-bg-alt-1) ${lU(h,0,100)}%, transparent)`,transform:`translate(${a.x}px, ${a.y}px)`,width:c.width,height:c.height},children:[x("div",{className:"border-subtle flex shrink-0 cursor-grab items-center justify-start gap-2 border-b py-1 pr-2 pl-3 select-none active:cursor-grabbing",onMouseDown:N,children:[u("p",{className:"typo-compact-xs2-semibold text-fg-default min-w-0 flex-1",children:C("move.amr.rightPanel.debug.title","Debug")}),x("div",{className:"flex h-8 shrink-0 cursor-default items-center gap-2",onMouseDown:M=>M.stopPropagation(),onPointerDown:M=>M.stopPropagation(),children:[u("p",{className:"typo-compact-xs2-normal text-fg-subtle",children:y("move.amr.rightPanel.controlPanel.transparency")}),x("p",{className:"typo-compact-xs2-semibold text-fg-default w-8 text-right",children:[h,"%"]}),u(Ms,{value:[h],min:0,max:100,step:1,onValueChange:M=>g(M[0]),className:"w-24"})]}),u(Yt,{icon:u(Nb,{}),variant:"transparent",size:"2xs",onClick:s,onMouseDown:M=>M.stopPropagation()})]}),x(U,{className:"min-h-0 w-full max-w-full min-w-0 flex-1",children:[R?x(H,{className:"shrink-0 items-center gap-2 px-3 py-2",children:[u(et,{className:"min-w-0 flex-1",size:"xs2",type:"search",value:o,placeholder:C("move.amr.rightPanel.debug.search","Search"),handleChange:M=>r(String(M??"")),handleReset:()=>r("")}),A]}):u(H,{className:"shrink-0 justify-end px-3 py-2",children:A}),u(U,{className:"min-h-0 w-full max-w-full min-w-0 flex-1 overflow-x-hidden overflow-y-auto",children:R?E.length>0?E.map(M=>x(U,{className:"border-subtler w-full max-w-full min-w-0 shrink-0 gap-2 border-b px-5 py-4",children:[x(H,{className:"min-w-0 items-center justify-between gap-2",children:[u("div",{className:"min-w-0 flex-1",children:u("p",{className:"typo-compact-sm2-semibold text-fg-subtle min-w-0 break-words",children:M.label})}),u(lh,{type:"soft",color:"gray",className:"shrink-0",children:M.items.length})]}),u("div",{className:"grid w-full min-w-0 shrink-0 grid-cols-2 gap-1.5",children:M.items.map((O,B)=>u(Vkt,{item:O,currentLanguage:S},`${M.id}-${B}`))})]},M.id)):u(gK,{className:"h-full min-h-40 shrink-0 [&_[data-slot='empty-view-section']]:h-full",type:"icon",message:C("move.amr.rightPanel.debug.noSearchResults","No matching debug items.")}):u(gK,{className:"h-full min-h-40 shrink-0 [&_[data-slot='empty-view-section']]:h-full",type:"icon",message:C("move.amr.rightPanel.debug.waitingInfoStatus","Waiting for infoStatus data.")})})]}),u("div",{"aria-label":"Resize AMR debug panel",className:"absolute right-0 bottom-0 z-10 flex size-5 cursor-se-resize items-end justify-end p-1",role:"separator",onMouseDown:k,children:u("span",{className:"border-fg-subtlest block size-2.5 border-r-2 border-b-2 opacity-70"})})]})})},Hkt=Ekt(Wkt),$kt=({isFullscreen:i,onToggle:e})=>{const{t}=q();return u(Qk,{id:"fullscreen-toggle-tooltip",label:t(i?"move.amr.panel.fullscreen.exit":"move.amr.panel.fullscreen.enter"),icon:i?u(Aje,{className:"h-4 w-4"}):u(_9,{className:"h-4 w-4"}),onClick:e})},Ukt=({showJoysticks:i,setShowJoysticks:e})=>{const{t}=q();return u(Qk,{id:"joystick-toggle-tooltip",label:t("move.amr.panel.virtualJoysticks"),icon:u(TLe,{className:"relative z-10 h-4 w-4"}),onClick:()=>e(!i),isOpen:i})},{useRef:jkt}=await F("react"),Gkt=({showViewControls:i,setShowViewControls:e,...t})=>{const{t:n}=q(),s=jkt(null);return Oje(s,()=>{e(!1)}),x("div",{ref:s,className:"relative",children:[u(Qk,{id:"view-controls-tooltip",label:n("move.amr.panel.viewportVisibility"),icon:u(Eie,{className:"relative z-10 h-4 w-4"}),onClick:()=>e(!i),isOpen:i}),i?u(Fqe,{...t,className:"absolute -top-20 right-full mr-2"}):null]})},{useCallback:Ns,useEffect:tx,useMemo:cU,useRef:LF,useState:mf}=await F("react"),dU={fullscreen:"right-6",menuExpanded:"right-113",menuCollapsed:"right-92"},uU={fullscreen:"right-2",menuExpanded:"right-[8.25rem]",menuCollapsed:"right-[3.25rem]"},qkt=({isFullscreen:i,isMenuExpanded:e})=>i?dU.fullscreen:e?dU.menuExpanded:dU.menuCollapsed,x_e=(i,e)=>{const t=new URL(i.startsWith("http")?i:`http://${i}`);return t.port=String(e),t.pathname="",t.search="",t.hash="",t.toString().replace(/\/$/,"")},Kkt=({robotModel:i})=>{const{t:e}=q(),{selectedRobot:t}=Fi(i),{data:n}=Jm(),[s,o]=mf(!1),{data:r}=Fje({robot_model:i,enabled:s}),[a,l]=xc(),c=a.get("expended")==="1",d=a.get("debug")==="1",h=a.get("menu")||"monitor",g=a.get("monitor_tab"),m=h==="monitor"&&(g==="pdu"||g==="motor"),f=h==="monitor"&&g==="task",{data:p}=ISt({robot_model:i},{enabled:d}),_=LF(null),[b,v]=mf(!1),[w,y]=mf(!1),[S,C]=mf(!1),[N,k]=mf(!1),[L,D]=mf(!1),T=N||L,{data:E,loading:R}=zSt(i,w),[A,M]=mf(null),[O,B]=mf(!1),[z,Y]=mf({}),$=LF({}),{modal:Z}=Vi(),{confirmDialog:K}=jn(),V=LF(null),{ready:fe,selectedObjects:Q,selectedNode:re,selectedNodeTransform:ve,focusedLinkId:_e,selectedLinks:Le,selectedZoneIds:Ie,focusedZoneId:Te,nodes:lt,links:it,zones:Ct,mapBounds:ft,zoneDraft:Xt,worldStudioStateProps:Mt}=kDe(),Ht=Ns((ht,Mi)=>{V.current?.emit(ht,Mi)},[]),Mn=Ns(ht=>{Ht("ui:link-visibility-filter-requested",{filter:ht})},[Ht]),{linkVisibilityFilter:Cs,setLinkVisibilityFilter:or,visibleSelectedLinks:ge,visibleFocusedLink:Ue,selectedLinkOverlayItems:Ee,focusedLinkAnchor:Ne}=mSt({nodes:lt,selectedLinks:Le,focusedLinkId:_e,onLinkVisibilityFilterChange:Mn}),{focusedZone:le,selectedZoneOverlayItems:Pe,focusedZoneAnchor:Re}=pSt({zones:Ct,selectedZoneIds:Ie,focusedZoneId:Te}),We=Bqe({anchorObject:Ue||le?null:re,anchorWorldPosition:Ue?Ne:le?Re:null,worldStudioRef:V,viewportHostRef:_}),ct=Ns(()=>V.current?.getPreviewTransform()??null,[]),gn=Ns(()=>V.current?.getMapPointsData()??[],[]),$n=Ns(()=>V.current?.getTopologyData()??{format_version:fB,nodes:[],links:[],zones:[]},[]);tx(()=>{o(!1)},[i]);const[Ln,yi]=mf(null),{baseAmrStatus:oi,amrMoveStatus:Xn,amrInfoStatus:go,amrSafetyIoStatus:wo,taskLogData:Kr,monitorStatusSnapshot:hl,hudStatusSnapshot:da}=SNt({selectedRobotModel:i,enableInfoStatus:d||m,enableTaskLogRefetch:f}),{data:gl}=soe({robot_model:i},{enabled:!!i}),jo=gl?.mapName,Vh=gl?.result==="accept"?gl.message==="las"?"las":"csv":void 0,{mapListData:Ts}=Xxt(i),ad=cU(()=>Ts?.list?.map(ht=>ht.mapName),[Ts?.list]),{mapCloud:Gd,mapCloudUpdatedAt:$u,mapCloudStream:ua,topology:es,topologyUpdatedAt:Lt,refetchTopology:Ei}=dxt({selectedRobotModel:i,mapName:jo,pointCloudFormat:Vh}),{data:Ss}=mxt(ua),{currentMapInfo:Pi}=oxt({currentMapName:jo,mapListData:Ts}),{nodeTypeCounts:Jr,topologyCount:Oa}=yIt({nodes:lt,topologyData:es?.nodes}),Fa=es?.metadata?.created_at??es?.metadata?.createdAt??null,{downloadJsonFile:Dn,downloadCsvFile:Lr}=Vqe(),{refetch:tf,isFetching:Dr}=LIt({robot_model:i,mapName:jo??""},{enabled:!1}),{selectedTool:Tr,onToolChange:ha}=zqe(),{showGrid:Hb,showJoysticks:cn,setShowJoysticks:Me,showViewControls:bt,setShowViewControls:Kt,showNodeLabels:Vs,showSimpleNodes:Qs,showLidar:Co,showMapBoundary:ml,lidarPointSize:ld,viewportCameraMode:Uu,visibilityItems:zh,cameraModeControl:Er,cameraMoveControl:$b,renderingSettingItems:Ub,mapPointHeightClip:$L,pointCloudHeightClipControl:UL}=Wqe(ft),{isEraserEnabled:jb,setIsEraserEnabled:xw,eraserRadius:Tc,setEraserRadius:R2,selectedNodeType:jL,setSelectedNodeType:GL,selectedNodePlacementType:qL,setSelectedNodePlacementType:z7,hasUnsavedTopologyChanges:Gb,resetTopologyDirty:M2,selectedEraserPointsCount:pS,setSelectedEraserPointsCount:qb,hasUnsavedCloudChanges:_S,setHasUnsavedCloudChanges:Wg}=CIt({editorReady:fe,worldStudioRef:V}),Hg=Ns(ht=>{if(jb){if(ht!=="select"&&ht!=="target")return;xw(!1),Ht("ui:eraser-toggle-requested",!1)}ha(ht)},[Ht,jb,ha,xw]);tx(()=>{Ie.length>0&&(Tr==="rotate"||Tr==="scale")&&Hg("move")},[Hg,Tr,Ie.length]);const{linearJogSpeed:Nw,setLinearJogSpeed:bS,rotationJogSpeed:A2,setRotationJogSpeed:KL}=wIt(),{handleJoystickMove:O2,handleButtonMove:W7}=BSt({robotModel:i,linearSpeed:Nw,rotationSpeed:A2}),{loadMapAndRefreshCurrentMap:F2,loadTopology:Kb,handleLoadMap:Iw}=Yxt({selectedRobotModel:i}),{handleStartLocalization:JL,handleInitLocalization:kw,handleSemiAutoInitLocalization:H7,handleStopLocalization:Jb}=Kxt({selectedRobotModel:i,getPreviewTransform:ct}),{handleInitLocalizationWithGuard:$7,handleSemiAutoInitLocalizationWithGuard:B2}=Txt({selectedRobotModel:i,currentMapName:jo,currentMapInfo:Pi,mapListData:Ts,topologyNodes:es?.nodes,hasUnsavedTopologyChanges:Gb,handleInitLocalization:kw,handleSemiAutoInitLocalization:H7}),{handleSetMotorLocked:YL,handleMoveTarget:XL,handleMoveGoal:vS,handleMoveLinear:Yb,handleDock:Op,handleDockPause:V2,handleDockResume:z2,handleDockStop:Xb,handleUndock:Qb,handleClearSafetyFlag:W2,handleSetSafetyField:H2,handleSetSafetyIo:To,handleSetDetectMode:Go}=_It({selectedRobotModel:i}),nf=Ns(()=>{if(!re)return;if(Gb){rt.openToast({type:"basic",variant:"warning",title:"Unsaved Topology Changes",content:"Please save topology changes before moving the robot.",position:"top-right"});return}const ht=re.userData?.id;typeof ht=="string"&&vS({goalId:ht})},[vS,Gb,re]),Ba=Ns(()=>{Q.length!==0&&Ht("ui:nodes-delete-requested",void 0)},[Ht,Q.length]),Va=Ns(()=>{V.current?.moveCamera("focus")},[]),za=Ns(async()=>{const{data:ht}=await tf();ht&&Dn("topology.json",{format_version:ht.format_version??fB,metadata:ht.metadata,nodes:ht.nodes,links:ht.links,zones:ht.zones})},[Dn,tf]),Eo=Ns(()=>{const ht=gn();if(!ht?.length){rt.openToast({type:"basic",variant:"warning",title:e("move.amr.toast.title.mapDownload.fail"),content:e("move.amr.toast.content.mapDownload.fail"),position:"top-right"});return}const Mi=jo?`${jo}_cloud.csv`:"cloud.csv";Lr(Mi,ht)},[jo,Lr,gn,e]),Zb=Ns(()=>{Ht("ui:map-points-erase-history-clear-requested",void 0),Wg(!1)},[Ht,Wg]),{handleSaveTopologyChanges:ev,handleCancelTopologyChanges:QL,handleSaveCloud:sf,isTopologySaving:Wh}=ixt({selectedRobotModel:i,currentMapName:jo,getMapPointsData:gn,getTopologyData:$n,loadMapAndRefreshCurrentMap:F2,loadTopology:Kb,refreshTopologyData:Ei,onTopologySaved:M2,onTopologyCanceled:M2,onCloudSaved:Zb}),{mappingPoints:U7,mappingKeyFrame:j7,mappingStatus:of,elapsedSeconds:G7,completedKeyframeCount:$g,totalKeyframePoints:rf,handleStartMapping:Fp,handleStopMapping:tv,handleSaveMapping:q7,handleDiscardMapping:qd}=cNt({selectedRobotModel:i,emit:Ht,loadMapAndRefreshCurrentMap:F2}),{handleEraserToggle:K7,handleDeletePoints:ZL,handleReleasePoint:$2,handleEraserRadiusChange:Lw,handleAddNodeAtRobot:nv,handleAddNodeAtCursor:U2,handleDeleteLastSelectedNode:eD,handleNodeUpdate:J7,handleNodeTypeChange:Bp,handleSelectedNodesTransform:af,handleCreateLinks:Dw,handleCreateLinksByShortcut:j2,setLinkCreationSettings:tD,handleDeleteLinksBetweenSelected:nD,handleLinkUpdate:iD,handleLinkDelete:sD,handleLinkFocus:oD}=Ixt({emit:Ht,nodes:lt,selectedObjects:Q,selectedNodeType:jL,onToolChange:ha,setIsEraserEnabled:xw,setEraserRadius:R2}),yS=Ns(()=>{Ht("ui:map-points-restore-requested",void 0),qb(0),Wg(!1)},[Ht,Wg,qb]),G2=Ns(()=>{qb(0),Wg(!1)},[Wg,qb]),q2=Ns(()=>{pS!==0&&(ZL(),Wg(!0))},[ZL,pS,Wg]);Hqe({tools:{selectedTool:Tr,onToolChange:Hg,hasSelectedNode:Q.length>0,hasSelectedZone:Ie.length>0},topology:{selectedNodePlacementType:qL,onAddNodeAtRobot:nv,onAddNodeAtCursor:U2},selection:{hasSelectedNodes:Q.length>0,onDeleteSelectedNodes:Ba},camera:{hasSelectedNode:Q.length>0,onFocusSelectedNode:Va},link:{selectedNodeCount:Q.length,onCreateLinks:j2},zone:{state:Xt.state,pointCount:Xt.pointCount,onCloseDraft:()=>{V.current?.closeZoneDraft()}}});const rD=LF(Xn.moveState?.pathState);tx(()=>{const ht=rD.current,Mi=Xn.moveState?.pathState;Mi!==void 0&&(ht==="req_path"&&Mi==="none"&&rt.openToast({type:"basic",variant:"danger",title:"Move Failed",content:"No path to target. Check topology or robot position.",position:"top-right"}),rD.current=Mi)},[Xn.moveState?.pathState]);const K2=$qe({loading:oi.loading,isDefaultData:oi.isDefaultData,mapCloud:Gd,topology:es,nodes:lt,links:it}),Tw=Ns(async(ht,Mi)=>of==="saving"||of==="discarding"?!1:of==="idle"?!0:await K({title:e("move.amr.rightPanel.map.dialog.discardMapping.title"),content:ht,buttonText:{yes:Mi,no:e("move.amr.rightPanel.common.cancel")}})?(await qd(),!0):!1,[K,qd,of,e]),Ew=Ns(async(ht,Mi)=>_S?await K({title:"Discard erasing changes?",content:ht,buttonText:{yes:Mi,no:e("move.amr.rightPanel.common.cancel")}})?(yS(),!0):!1:!0,[K,yS,_S,e]),Vp=Ns(async()=>Xt.state!=="drawing"&&Xt.state!=="closed"?!0:await K({title:"Leave Zone",content:"Leaving Topology will discard the current zone draft. Continue?",buttonText:{yes:"Leave",no:e("move.amr.rightPanel.common.cancel")}})?(V.current?.cancelZoneDraft(),!0):!1,[K,e,Xt.state]),wS=Ns(async({currentMenuId:ht,nextMenuId:Mi})=>{switch(ht){case"map":return await Tw(e("move.amr.rightPanel.map.dialog.discardMapping.leaveMenuContent"),e("move.amr.rightPanel.map.dialog.discardMapping.yes"))?Ew("Leaving the map menu will discard erased point changes.",e("move.amr.rightPanel.map.dialog.discardMapping.yes")):!1;case"topology":return Mi!==ht&&(Xt.state==="drawing"||Xt.state==="closed")?Vp():!0;default:return!0}},[Ew,Tw,Vp,Xt.state,e]),ga=Ns(async()=>{of==="saving"||of==="discarding"||!await Tw(e("move.amr.rightPanel.map.dialog.discardMapping.loadMapContent"),e("move.amr.rightPanel.map.dialog.discardMapping.loadYes"))||!await Ew("Loading another map will discard erased point changes.",e("move.amr.rightPanel.map.dialog.discardMapping.loadYes"))||Z({component:Uqe,props:{currentMap:jo??"",onLoadMap:Iw,mapList:Ts}})},[Tw,Ew,jo,Iw,Ts,of,Z,e]),aD=Ns(()=>{C(ht=>!ht)},[]),gr=Ns(()=>{const ht=new URLSearchParams(a);d?ht.delete("debug"):ht.set("debug","1"),l(ht,{replace:!0})},[d,a,l]),J2=Ns(()=>{const ht=new URLSearchParams(a);ht.set("menu","topology"),ht.set("topology_tab","node"),ht.set("expended",c?"1":"0"),l(ht,{replace:!0})},[c,a,l]),lD=Ns(()=>{const ht=new URLSearchParams(a);ht.set("menu","topology"),ht.set("topology_tab","link"),ht.set("expended",c?"1":"0"),l(ht,{replace:!0})},[c,a,l]),Pw=Ns(()=>{const ht=new URLSearchParams(a);ht.set("menu","topology"),ht.set("topology_tab","zone"),ht.set("expended",c?"1":"0"),l(ht,{replace:!0})},[c,a,l]),Y7=Ns((ht,Mi="replace")=>{Ht("ui:node-selected",{nodeId:ht,intent:Mi})},[Ht]),X7=Ns(()=>{V.current?.moveCamera("zoomin")},[]),cD=Ns(()=>{V.current?.moveCamera("zoomout")},[]),X=Ns(ht=>{V.current?.moveCamera(ht)},[]),ne=Ns(()=>{if(!(oi?.motor?.[0]?.status===1&&oi?.motor?.[1]?.status===1&&oi?.robotState?.power)){rt.openToast({type:"basic",variant:"warning",title:"Motor Not Initialized",content:"Please initialize the motor before docking.",position:"top-right"});return}yi(null),Op(yi)},[oi?.motor,oi?.robotState?.power,Op]),we=Ns(()=>{const ht=_.current;if(ht){if(document.fullscreenElement===ht){document.exitFullscreen();return}if(L){D(!1);return}if(document.fullscreenEnabled&&ht.requestFullscreen){ht.requestFullscreen().catch(()=>{D(!0)});return}D(!0)}},[L]);tx(()=>{const ht=()=>{k(document.fullscreenElement===_.current)};return document.addEventListener("fullscreenchange",ht),()=>{document.removeEventListener("fullscreenchange",ht)}},[]);const Se=Sxt({robotModel:i,monitorStatusSnapshot:hl,robotVersion:r,selectedTool:Tr,onToolChange:Hg,onStartLocalization:JL,onInitLocalization:$7,onSemiAutoInitLocalization:B2,onStopLocalization:Jb,onBuildInfoOpenChange:o,onDock:ne,onDockPause:V2,onDockResume:z2,onDockStop:Xb,onUndock:Qb,dockRejectMessage:Ln,taskLogData:Kr,amrMoveStatus:Xn,onSetMotorLocked:YL,onClearSafetyFlag:W2,onLidarFieldSave:H2,onOssdDetectChange:Go,safetyIo:wo,safetyIoLoading:go.loading,onSetSafetyIo:To}),Be=pxt({currentMapName:jo??"",createdAt:Pi?.createdAt,lastModified:Pi?.updatedAt,mapCloudCount:Vh==="las"?Ss?.pointCount??0:Gd?.rowCount??Gd?.data?.length??0,mapBounds:ft,topologyCount:Oa,nodeTypeCounts:Jr,mappingStatus:of,elapsedSeconds:G7,completedKeyframeCount:$g,totalKeyframePoints:rf,onStartMapping:Fp,onStopMapping:tv,onSaveMapping:q7,onDiscard:qd,mapList:ad,isEraserEnabled:jb,onEraserToggle:K7,eraserRadius:Tc,setEraserRadius:Lw,eraseSelectedAreaDisabled:pS===0,onEraseSelectedArea:q2,onReleaseSelectedPoints:$2,onSaveChanges:sf,hasUnsavedCloudChanges:_S,onDiscardCloudChanges:yS,onLoadMap:ga,loadMapDisabled:!1,onDownloadMap:Eo,downloadMapDisabled:_S||!jo}),Xe=Nxt({overviewTabProps:{createdAt:Fa,downloadDisabled:Gb||Dr||!jo,downloadHelpText:Gb?"Save topology changes before downloading the server topology.json file.":void 0,onDownloadTopology:za},nodeTabProps:{nodes:lt,selectedObjects:Q,selectedNodeTransform:ve,robotPose:Xn?.pose??null,onNodeSelected:Y7,selectedTool:Tr,onToolChange:Hg,selectedNodeType:jL,onSelectNodeType:GL,selectedNodePlacementType:qL,onSelectNodePlacementType:z7,onAddNodeAtRobot:nv,onAddNodeAtCursor:U2,onUpdateNode:J7,onChangeNodeType:Bp,onTransformSelectedNodes:af,onDeleteSelectedNodes:Ba,onSaveTopologyChanges:ev,onCancelTopologyChanges:QL},linkTabProps:{selectedObjects:Q,focusedLinkId:_e,linkVisibilityFilter:Cs,nodes:lt,links:it,visibleSelectedLinks:ge,onFocusedLinkChange:oD,onLinkVisibilityFilterChange:or,onToolChange:Hg,onCreateLinks:Dw,onLinkCreationSettingsChange:tD,onUpdateLink:iD,onDeleteLink:sD,onDeleteLinksBetweenSelected:nD,onSaveTopologyChanges:ev,onCancelTopologyChanges:QL},zoneTabProps:{draft:Xt,selectedZoneIds:Ie,focusedZoneId:Te,zones:Ct,onDraftStart:ht=>{V.current?.startZoneDraft(ht)},onDraftCancel:()=>{V.current?.cancelZoneDraft()},onDraftClear:()=>{V.current?.clearZoneDraft()},onDraftUndo:()=>{V.current?.undoZoneDraft()},onDraftClose:()=>{V.current?.closeZoneDraft()},onDraftReopen:()=>{V.current?.reopenZoneDraft()},onDraftCommit:()=>{V.current?.commitZoneDraft()},onDraftMetaChange:ht=>{V.current?.updateZoneDraftMeta(ht)},onDeleteZone:ht=>{V.current?.deleteTopologyZone(ht)},onEditZone:ht=>{V.current?.startZoneEdit(ht)},onFocusedZoneChange:ht=>{V.current?.focusActiveTopologyZone(ht)},hasUnsavedTopologyChanges:Gb,isTopologySaving:Wh,onSaveTopologyChanges:ev,onCancelTopologyChanges:QL}}),ut=Ns(ht=>{const Mi=V.current?.getTopologyData();Mi&&(Mi.nodes.some(Es=>Es.id===ht.id)||Ht("ui:topo-update-requested",{topoData:{...Mi,nodes:[...Mi.nodes,ht]}}))},[Ht]),kt=Tkt({robotModel:i,enabled:h==="marker",mapName:jo,topology:es,robotPose:Xn?.pose?{x:Number(Xn.pose.x??0),y:Number(Xn.pose.y??0),rz:Number(Xn.pose.rz??0)}:null,onNodeRegistered:ut}),Bt=cU(()=>({...K2,showRobotControlBtn:!S,onToggleRobotControl:aD,showCameraStreams:b,onToggleCameraStreams:()=>v(ht=>!ht),showObstacleMap:w,onToggleObstacleMap:()=>y(ht=>!ht),showDebugPanel:d,onToggleDebugPanel:gr,isFullscreen:T,isMenuExpended:c}),[K2,aD,gr,d,S,w,b,T,c]),Qt=qkt({isFullscreen:T,isMenuExpanded:c}),on=T?uU.fullscreen:c?uU.menuExpanded:uU.menuCollapsed,hn=P("bottom-21 z-[60] flex flex-col items-end gap-1",T?"absolute":"fixed",Qt),ti=P("z-[70]",T?"absolute bottom-11 left-1/2 -translate-x-1/2":P("fixed bottom-21",Qt)),xs=P("z-50",T?"absolute bottom-11 left-1/2 -translate-x-1/2":P("fixed bottom-21",Qt)),us=P("z-[70] flex items-end justify-end gap-1",T?"absolute bottom-11 left-1/2 -translate-x-1/2":P("fixed bottom-21",Qt)),Ri=C9()||window.location.hostname,Vn=S||Number(b)+Number(w)+Number(d)>1,In=3e3,Po=8889,mr=n?.ip||Ri,Pr=x_e(Ri,In),zs=x_e(mr,Po);tx(()=>{if(!b)return;const ht=new AbortController;return(async()=>{B(!0);try{const Es=await fetch(`${Pr}/amr/${i}/capability/camera`,{signal:ht.signal});if(!Es.ok)throw new Error(`bad status code ${Es.status}`);const ma=await Es.json();if(ht.signal.aborted)return;M(ma),Y(mo=>{const Ro={...mo},qo=ma.rtspInfo??[];for(const rr of qo){const Wa=qo.filter(fa=>fa.camId===rr.camId).map(fa=>fa.quality);(Ro[rr.camId]===void 0||!Wa.includes(Ro[rr.camId]))&&(Ro[rr.camId]=Wa.find(fa=>fa==="low")??Wa[0]??rr.quality)}return Ro})}catch(Es){ht.signal.aborted||(console.error(Es),M(null))}finally{ht.signal.aborted||B(!1)}})(),()=>ht.abort()},[Pr,i,b]),tx(()=>{if(!b){$.current={};return}if(!A)return;const ht=A.rtspInfo??[],Mi=Array.from(new Set(ht.map(Es=>Es.camId)));for(const Es of Mi){const ma=ht.filter(qo=>qo.camId===Es).map(qo=>qo.quality),mo=z[Es],Ro=mo&&ma.includes(mo)?mo:ma.find(qo=>qo==="low")??ma[0];Ro&&$.current[Es]!==Ro&&($.current[Es]=Ro,fetch(`${Pr}/amr/${i}/sensor/rtsp/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({camId:Es,quality:Ro})}).catch(qo=>{console.error(qo)}))}},[Pr,A,i,z,b]);const fr=cU(()=>{if(!A)return[];const ht=A.rtspInfo??[],Mi=new Set(ht.map(mo=>mo.camId)),Es=A.info.map(mo=>mo.camId);return(A.camNum>0?Array.from({length:A.camNum},(mo,Ro)=>Ro):Array.from(new Set([...Es,...Mi]))).map(mo=>{const Ro=ht.filter(Rr=>Rr.camId===mo),qo=Ro.map(Rr=>Rr.quality),rr=z[mo],Wa=rr&&qo.includes(rr)?rr:qo.find(Rr=>Rr==="low")??qo[0]??"low",fa=Ro.find(Rr=>Rr.quality===Wa)??Ro[0];return{id:`cam${mo}`,camId:mo,name:e("move.amr.rightPanel.cameraPanel.cameraName",{index:mo+1}),status:fa?"live":"disconnected",resolution:fa?`${fa.width}x${fa.height} ${fa.fps}fps`:"-",streamUrl:fa?`${zs}/${fa.name}`:void 0,quality:Wa,qualityOptions:qo}})},[A,z,e,zs]),cd=Ns((ht,Mi)=>{Y(Es=>({...Es,[ht]:Mi}))},[]),ic=()=>We?Ue?u(Qqe,{x:We.x,y:We.y,placement:We.placement,items:Ee,activeItemId:Ue.id,onSelectItem:oD,onEdit:lD,onDelete:()=>{sD(Ue.id)}}):le&&Xt.state==="idle"?u(Zqe,{x:We.x,y:We.y,placement:We.placement,items:Pe,activeItemId:le.id,onSelectItem:ht=>{V.current?.focusActiveTopologyZone(ht)},onEdit:()=>{Pw(),V.current?.startZoneEdit(le.id)},onDelete:async()=>{await K({title:"Delete Zone",content:"Delete this selected zone?",buttonText:{yes:"Delete",no:"Keep"}})&&V.current?.deleteTopologyZone(le.id)}}):re?u(eKe,{x:We.x,y:We.y,placement:We.placement,currentX:re.position.x,currentY:re.position.y,currentRz:re.rotation.z,nodeName:re.name||"-",onEdit:J2,onDelete:eD,onMove:nf}):null:null;return x(o6,{className:P("AmrMove","overflow-x-hidden"),menus:[{id:"monitor",label:e("move.amr.rightPanel.menu.monitor"),icon:u(Bje,{}),content:u(WIt,{...Se})},{id:"map",label:e("move.amr.rightPanel.menu.map"),icon:u(Vje,{}),content:u(XIt,{...Be})},{id:"topology",label:e("move.amr.rightPanel.menu.topology"),icon:u(zje,{}),content:u(Xqe,{...Xe})},{id:"marker",label:e("move.amr.rightPanel.menu.marker"),icon:u(Wje,{}),content:u(okt,{markerProps:kt})}],rightIconPanels:[{key:"zoom-in-out",element:u(H1,{onZoomIn:X7,onZoomOut:cD})},{key:"fullscreen-toggle",element:u($kt,{isFullscreen:T,onToggle:we})},{key:"joystick-toggle",element:u(Ukt,{showJoysticks:cn,setShowJoysticks:Me})},{key:"view-controls",element:u(Gkt,{showViewControls:bt,setShowViewControls:Kt,visibilityItems:zh,cameraModeControl:Er,cameraMoveControl:{...$b,onMove:X},numberItems:Ub,pointCloudHeightClipControl:UL})}],beService:t?.be_service,onBeforeMenuChange:wS,ref:_,viewportFullscreen:T,viewportClassName:"data-[state=fullscreen]:z-[1000] data-[state=fullscreen]:h-[100dvh] data-[state=fullscreen]:w-[100dvw]",children:[u(jqe,{...da}),u(Gqe,{mapName:jo??"",onMapNameClick:ga}),u(kAe,{ref:V,...Mt,cameraPositionKey:DDe,robotModel:i,pointsData:Gd?.data,parsedPointCloudData:Ss??void 0,topoData:es,mapCloudUpdatedAt:$u,topologyUpdatedAt:Lt,mappingPoints:U7,mappingKeyFrame:j7,robotPose:Xn?.pose,selectedTool:Tr,showGrid:Hb,showNodeLabels:Vs,nodeRenderMode:Qs?"simple":"default",showLidar:Co,showMapBoundary:ml,mapPointHeightClip:$L,lidarPointSize:ld,viewportCameraMode:Uu,onEraserHistoryInvalidated:G2,onEraserSelectionChange:qb,robot:i}),ic(),!jb&&u("div",{className:"absolute top-60 left-3 z-20",children:u(TDe,{selectedTool:Tr,onToolChange:Hg,hasSelectedNode:Q.length>0,hasSelectedZone:Ie.length>0})}),cn&&x("div",{className:P("pointer-events-none absolute bottom-21 left-0 flex flex-row justify-between",on),children:[u(Fue,{joystickType:"direction",buttonsDirection:"left",disableDiagonal:!0,className:"pointer-events-auto ml-4 flex items-center justify-center",onJoystickMove:({data:ht})=>{O2({type:"direction",data:ht})}}),u(Fue,{xOnly:!0,joystickType:"curved",buttonsDirection:"right",className:"pointer-events-auto",onJoystickMove:({data:ht})=>O2({type:"curved",data:ht})})]}),(b||w||S||d)&&x("div",{className:S?hn:"pointer-events-none contents",children:[x("div",{className:Vn?S?"flex items-end justify-end gap-1":us:"contents",children:[b&&u("div",{className:Vn?"relative z-70":ti,children:u(qqe,{cameras:fr,onQualityChange:cd,onClose:()=>v(!1)})}),w&&u("div",{className:Vn?"relative z-50":xs,children:u(Kqe,{layers:E.layers,width:E.width,height:E.height,gridSize:E.gridSize,safety:E.safety,loading:R,onClose:()=>y(!1)})}),d&&u("div",{className:Vn?"relative z-60":ti,children:u(Hkt,{onClose:gr,infoStatus:go.data,infoCategories:p?.categories,infoStatusLoading:go.loading,infoStatusIsDefault:go.isDefaultData})})]}),S&&u(Jqe,{robotPose:{x:Number(Xn?.pose?.x??0),y:Number(Xn?.pose?.y??0),yaw:Number(Xn?.pose?.rz??0)},handleButtonJog:W7,onClose:()=>C(!1),onMoveTarget:XL,onMoveLinear:Yb,linearSpeed:Nw,setLinearSpeed:bS,rotationSpeed:A2,setRotationSpeed:KL})]}),u(Yqe,{...Bt})]})},Jkt=({className:i})=>{const{t:e}=q();return u(o6,{className:P("PreviewMove",i),beService:"",menus:[],children:u(U,{className:"h-full",alignItems:"center",justifyContent:"center",children:x("div",{className:"text-fg-subtle text-center text-lg",children:[x("div",{children:[e("move.preview.descriptionLine1"),u("br",{})," ",e("move.preview.descriptionLine2")]}),x("div",{className:"text-fg-subtler text-base",children:[u("br",{})," ",e("move.preview.connectionGuideBefore"),u("br",{})," ",u("span",{className:"bg-fg-brand-hovered rounded-sm px-1.5 py-0.5 text-white",children:"muscat-pk dev"})," ",e("move.preview.connectionGuideAfter")]})]})})})},BAe=({className:i,value:e,disabled:t,onChange:n})=>{const{t:s}=q(),{theme:o}=tt();return x("div",{"data-testid":"rby1-source-switch",className:P("RBY1ControlSourceSwitch","bg-bg-alt-1 inline-flex w-fit gap-1 rounded-md p-1","[&_button]:typo-compact-xs-medium [&_button]:bg-fill-transparent [&_button]:h-5 [&_button]:min-w-[4.125rem] [&_button]:rounded-sm [&_button]:px-1.5 [&_button]:py-0.5 [&_button]:text-white",i),children:[u(se,{className:P({"!bg-fill-navy":e==="real",[o==="light"&&"!text-fg-subtlest"]:e!=="real"}),variant:"transparent",disabled:t,"aria-pressed":e==="real",onClick:()=>n("real"),children:s("move.button.label.real")}),u(se,{className:P({[o==="light"&&"!text-fg-subtlest"]:e!=="ghost",[o==="light"?"!bg-orange-500":"!bg-fill-subtler"]:e==="ghost"}),variant:"transparent",disabled:t,"aria-pressed":e==="ghost",onClick:()=>n("ghost"),children:s("move.rby1.source.ghost")})]})},aL=i=>{const{isMoving:e,isEmergencyStop:t}=dw(i,n=>({isMoving:n?.control_manager?.control_state==="Executing",isEmergencyStop:n?.emo_states?.some(s=>s?.state==="Pressed")}));return{isMoving:e,isEmergencyStop:t}},VAe=()=>ls("common/speedbar"),{useMutation:Ykt}=await F("@tanstack/react-query"),Xkt="/{robot_model}/move_j",Qkt=({robotModel:i,...e})=>Pa.post(Xkt.replace("{robot_model}",i),e),Zkt=()=>Ykt({mutationFn:Qkt}),{useMutation:eLt}=await F("@tanstack/react-query"),tLt="/{robot_model}/move_l",nLt=({robotModel:i,...e})=>Pa.post(tLt.replace("{robot_model}",i),e),iLt=()=>eLt({mutationFn:nLt}),sLt="rby1-minimum-time",oLt=3;function mR(){const i=Number(MLe(sLt));return i>0?i:oLt}const YI=["x","y","z","rx","ry","rz"];function lL(i,e){const t={},n=new Set;return i.forEach((s,o)=>{const r=dR(s)?.component;if(!r)return;const a=e(o,s);a==null?n.add(r):(t[r]??=[]).push(a)}),n.forEach(s=>delete t[s]),t}function ZB(i,e,t){const n=lL(e,s=>t(s)||null);return Object.fromEntries(Object.entries(i).filter(([s])=>s in n))}const zy=(i,e)=>lL(i,(t,n)=>{const s=e(t,n);return s==null?s:Sd(s)});function zAe(i,e){const t={},n={};for(const s of i){const o=dR(s)?.component;if(!o)continue;const r=t[o]??0;t[o]=r+1;const a=e[o]?.[r];a!=null&&(n[s]=ON(a))}return n}const rLt=i=>i==="left_arm"?"right_arm":i==="right_arm"?"left_arm":void 0,WAe=(i,e)=>{const t=e?rLt(i):void 0;return t?[i,t]:[i]},HAe=new Set([0,3,5]),aLt=i=>i.map((e,t)=>HAe.has(t)?e:-e),$Ae=new Set([1,3,5]),lLt=i=>i.map((e,t)=>$Ae.has(t)?-e:e);function cLt({groups:i,component:e,index:t,deltaDeg:n,bothArms:s}){const o={};for(const r of WAe(e,s)){const a=i[r];if(!a||t>=a.length)continue;const l=r!==e&&!HAe.has(t)?-n:n;o[r]=a.map((c,d)=>d===t?c+l:c)}return o}function dLt({cartesians:i,component:e,axis:t,delta:n,bothArms:s}){const o={};for(const r of WAe(e,s)){const a=i[r];if(!a)continue;const l=[...a];l[t]+=r!==e&&$Ae.has(t)?-n:n,o[r]=l}return o}function UAe(i,e,t){return i==="base"?e??{}:{torso:e?.torso??null,right_arm:t?.right_arm??null,left_arm:t?.left_arm??null}}const{useCallback:GD,useEffect:uLt,useMemo:nx,useRef:N_e}=await F("react"),hU={jointDeg:.49,linearMm:1.49,rotDeg:.349},hLt=3,gLt=50,mLt=300,fLt=100,pLt=({robotModel:i,mode:e,component:t,reference:n,bothArms:s,tickModeInput:o,source:r,ghostJointValuesRad:a,onGhostJointsChange:l})=>{const{jointNames:c,jointStates:d}=xp(i),{mutateAsync:h}=Zkt(),{mutateAsync:g}=iLt(),{socketEventEmit:m}=Mg(),f=GD(O=>`rby1/${i}/${O}`,[i]),p=r==="ghost",_=nx(()=>p?zy(c,(O,B)=>a?.[B]):zy(c,O=>d?.[O]?.position),[p,c,a,d]),b=nx(()=>lL(c,O=>p?!0:!!d?.[O]?.is_ready),[p,c,d]),{cartesian_states:v,cartesian_states_torso:w}=dw(i,O=>({cartesian_states:O?.cartesian_states,cartesian_states_torso:O?.cartesian_states_torso}),e==="cartesian"),y=nx(()=>UAe(n,v,w),[n,v,w]),S=nx(()=>e==="joint"?_[t]??[]:y[t]??[],[e,_,y,t]),C=nx(()=>e==="joint"?b[t]??[]:S.map(()=>!0),[e,b,t,S]),N=nx(()=>e==="joint"?c.filter(O=>dR(O)?.component===t):[...YI],[e,c,t]),k=N_e({groups:_,refCartesians:y});k.current={groups:_,refCartesians:y};const L=N_e(null),{data:D}=VAe(),T=Math.min(Math.max(D?.speedbar??1,0),1),E=GD((O,B,z,Y,$=s)=>{if(e==="joint"){const K=cLt({groups:z.groups,component:t,index:O,deltaDeg:B,bothArms:$});return Object.keys(K).length===0?Promise.resolve(void 0):p?(l?.(zAe(c,K)),Promise.resolve(void 0)):Y==="smooth"?(m(f("call_smoothjog_j"),{target:K}),Promise.resolve(void 0)):h({robotModel:i,target:K,minimumTime:mR()})}if(p)return Promise.resolve(void 0);const Z=dLt({cartesians:z.refCartesians,component:t,axis:O,delta:B,bothArms:$});return Object.keys(Z).length===0?Promise.resolve(void 0):Y==="smooth"?(m(f("call_smoothjog_l"),{target:Z,reference:n}),Promise.resolve(void 0)):g({robotModel:i,target:Z,reference:n,minimumTime:mR()})},[e,t,s,p,l,c,h,g,m,f,n,i]),R=GD(()=>{const O=L.current;O&&(O.timer&&(clearTimeout(O.timer),clearInterval(O.timer)),O.release(),L.current=null,!p&&m(f("call_smoothjog_stop"),{}))},[p,m,f]),A=GD(({type:O,index:B})=>{const z=O==="up"?1:-1,Y=(e==="joint"?p?hLt:hU.jointDeg:B<3?hU.linearMm:hU.rotDeg)*T,$=e==="joint"?o?.joint:B<3?o?.distance:o?.rotation,Z=o?$??0:Y,K=k.current;if(!Z)return;if(o&&!p){E(B,z*Z,K,"move").catch(()=>{});return}R();const V=()=>R();window.addEventListener("pointerup",V),window.addEventListener("pointercancel",V),window.addEventListener("blur",V);const fe={timer:null,base:K,delta:0,release:()=>{window.removeEventListener("pointerup",V),window.removeEventListener("pointercancel",V),window.removeEventListener("blur",V)}},Q=()=>{fe.delta+=z*Z,E(B,fe.delta,fe.base,"smooth")};L.current=fe,Q(),o?fe.timer=setTimeout(()=>{L.current===fe&&(fe.timer=setInterval(Q,fLt))},mLt):fe.timer=setInterval(Q,gLt)},[e,o,p,T,E,R]);lA({topic:"common/message",callback:O=>{const B=L.current;!B||p||O?.type!==2||O.sw_name!==i||(B.base=k.current,B.delta=0)},options:{equalityFn:()=>!1}});const M=GD(async(O,B)=>{const z=S[O]??0,Y=await E(O,B-z,k.current,"move",!1);if(Y&&"finish_code"in Y&&Y.finish_code!=="Ok")throw new Error(Y.finish_code)},[S,E]);return uLt(()=>R,[e,n,t,o,R]),{values:S,ready:C,keys:N,handleJogStart:A,handleJogStop:R,handleInputValueChange:M}},eV=({className:i,value:e,items:t,size:n="default",onChange:s})=>{const{theme:o}=tt();return u(bA,{className:P("RBY1SegmentTabs",i),value:e,onValueChange:r=>s(r),children:u(vA,{className:P("w-full rounded-md border-none",n==="sm"?"h-6":"h-7",o==="light"?"bg-fill-navy-subtlest":"bg-fill-subtlest"),children:t.map(r=>u(yA,{value:r.value,disabled:r.disabled,className:P("rounded",n==="sm"?"typo-compact-2xs-medium px-2":"typo-compact-xs2-medium","text-fg-subtle",o==="light"?"data-[state=active]:bg-fill-navy data-[state=active]:text-white":"data-[state=active]:bg-fill-subtler data-[state=active]:text-fg-default"),children:r.label},r.value))})})},{useCallback:I_e,useEffect:k_e,useMemo:_Lt,useState:gU}=await F("react"),bLt=[{value:"joint",labelKey:"move.rby1.jogMode.joint"},{value:"cartesian",labelKey:"move.rby1.jogMode.cartesian"}],vLt=[{value:"base",label:"Base"},{value:"link_torso_5",label:"T5"}],jAe=({className:i,robotModel:e,source:t,ghostJointValuesRad:n,onGhostJointsChange:s})=>{const{t:o}=q(),{theme:r}=tt(),{confirmDialog:a}=jn(),[l,c]=xc(),d=l.get("rby1_jog")??"joint",h=l.get("rby1_tab")??"head",g=l.get("rby1_ref")??"base",m=I_e((K,V)=>{c(fe=>{const Q=new URLSearchParams(fe);return Q.set(K,V),Q},{replace:!0})},[c]),[f,p]=gU(!1),[_,b]=gU(null),[v,w]=gU({}),y=t==="ghost",S=_Lt(()=>ab.filter(K=>d==="joint"||K.value!=="head"),[d]),C=ab.find(K=>K.value===h),N=h==="left"||h==="right";k_e(()=>{y&&d==="cartesian"&&m("rby1_jog","joint")},[y,d,m]),k_e(()=>{d==="cartesian"&&h==="head"&&m("rby1_tab","torso")},[d,h,m]);const{toJointNameText:k}=xp(e),{isMoving:L,isEmergencyStop:D}=aL(e),{selectedRobot:T}=Fi(e),E=T?.connected==="DISCONNECT",{values:R,ready:A,keys:M,handleJogStart:O,handleJogStop:B,handleInputValueChange:z}=pLt({robotModel:e,mode:d,component:C.component,reference:g,bothArms:f,tickModeInput:_,source:t,ghostJointValuesRad:n,onGhostJointsChange:s}),Y=y?!1:L||D||E,$=I_e(async(K,V)=>{const{value:fe,readOnly:Q}=V.target;if(Q)return;const re=Number(fe.replace(/,/g,"")),ve=R[K];if(ve===void 0||!Number.isFinite(re)||Math.abs(re-ve)<5e-4)return;const _e=()=>w(Le=>({...Le,[K]:!Le[K]}));if(console.log("isGhost",y,"next",re,"current",ve),!y&&!await a({title:o("move.rby1.inputMove.title"),content:o("move.rby1.inputMove.content",{key:d==="joint"?k(M[K]):`${k(C.component)} ${M[K].toUpperCase()}`,value:`${re}${d==="joint"||K>2?"°":"mm"}`}),buttonText:{yes:o("common.button.confirm"),no:o("common.button.cancel")}}))return _e();try{await z(K,re)}catch{_e()}},[z,R,y,a,o,d,M,C.component,k]),Z=P("border-border-subtle w-full border-t p-2.5",r==="light"?"bg-default":"bg-alt-2");return u("div",{className:P("RBY1JogControl","h-full",i),children:x(U,{className:"h-full",justifyContent:"space-between",children:[x("div",{className:"h-full flex-1 overflow-y-auto",children:[x(U,{className:P("sticky top-0 left-0 z-2 gap-2.5 p-2.5 pb-2.5",r==="light"?"bg-default":"bg-alt-1"),children:[x(H,{"data-testid":"rby1-jog-mode",alignItems:"center",justifyContent:"space-between",children:[u(ae,{className:"w-36",size:"xs2",value:d,handleChange:K=>m("rby1_jog",String(K)),children:bLt.map(K=>u(J,{value:K.value,disabled:y&&K.value==="cartesian",children:o(K.labelKey)},K.value))}),d==="cartesian"&&u(eV,{className:"w-auto",size:"sm",value:g,items:vLt,onChange:K=>m("rby1_ref",K)})]}),u(eV,{value:h,items:S,onChange:K=>m("rby1_tab",K)})]}),u(U,{className:"gap-2 px-2.5 pb-2",children:M.map((K,V)=>{const fe=R[V],Q=d==="joint"?k(K):K.toUpperCase(),re=d==="joint"||V>2?"°":"mm";return x(U,{className:"gap-1",children:[x(H,{className:"typo-compact-xs-medium gap-1",children:[u("span",{className:P("text-fg-default",d==="cartesian"&&xi[K]),children:Q}),x("span",{className:"text-fg-subtle",children:["(",re,")"]})]}),u(Vse,{step:0,inputMode:"numeric",value:fe===void 0?"":fe.toFixed(3),notAllowedEmptyValue:!0,disableAutoAccel:!0,disableLongPress:!0,detectDobleClick:!0,autoComplete:"off",disabled:Y||fe===void 0||!A[V],inputDisabled:_!==null,onBlur:ve=>$(V,ve),onButtonPointerDown:ve=>O({type:ve,index:V}),onButtonPointerUp:B})]},`${K}-${v[V]??0}`)})})]}),N&&u("div",{className:Z,children:x(H,{className:"gap-2",alignItems:"center",children:[u(tr,{"data-testid":"rby1-both-arms",size:"default",checked:f,onCheckedChange:p}),u("span",{className:"typo-compact-sm-medium text-fg-default",children:o("move.rby1.switch.bothArms")})]})}),u(PPe,{className:Z,currentTab:d==="joint"?"joint":"cartesian",tickModeInput:_,disabled:E&&!y,onChangeTickModeInput:b})]})})},{useMutation:yLt}=await F("@tanstack/react-query"),wLt="/{robot_model}/approach_j",CLt=({robotModel:i,...e})=>Pa.post(wLt.replace("{robot_model}",i),e),Roe=()=>yLt({mutationFn:CLt}),{useMutation:SLt}=await F("@tanstack/react-query"),xLt="/{robot_model}/approach_stop",NLt=({robotModel:i})=>Pa.post(xLt.replace("{robot_model}",i),{}),f6=()=>SLt({mutationFn:NLt}),{useCallback:L_e,useMemo:mU,useState:D_e}=await F("react"),ILt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),[s,o]=D_e("head"),[r,a]=D_e(null),l=ab.find(E=>E.value===s),{jointNames:c,jointStates:d,toJointNameText:h}=xp(e),{isMoving:g,isEmergencyStop:m}=aL(e),{selectedRobot:f}=Fi(e),p=g||m||f?.connected==="DISCONNECT",_=mU(()=>zy(c,E=>d?.[E]?.position),[c,d]),b=mU(()=>lL(c,()=>0),[c]),v=b[l.component]?.length??0,w=mU(()=>ZB(b,c,E=>d?.[E]?.is_ready),[c,d,b]),y=l.component in w,{mutate:S}=Roe(),{mutate:C}=f6(),N=L_e((E,R)=>{Object.keys(R).length!==0&&(a(E),S({robotModel:e,target:R,minimumTime:3}))},[S,e]),k=L_e(()=>{a(null),C({robotModel:e})},[C,e]),L=E=>{const R=_[l.component];return R?{[l.component]:R.map((A,M)=>M===E?0:A)}:{}},D="typo-compact-xs-semibold",T=(p||Object.keys(w).length===0)&&r!=="all";return u("div",{className:P("RBY1ZeroPoseControl","h-full",i),children:x(U,{className:"h-full",justifyContent:"space-between",children:[x(U,{className:"flex-1 gap-2 overflow-y-auto px-3 py-2.5",children:[u(Ag,{subject:t("move.menu.button.label.zeroPose")}),u(eV,{className:"mb-1",value:s,items:ab,onChange:o}),Array.from({length:v},(E,R)=>{const A=`${l.component}-${R}`;return u(Dd,{className:D,size:"sm",variant:"outlined",disabled:(p||!y)&&r!==A,onButtonDown:()=>N(A,L(R)),onButtonUp:k,children:t("move.menu.button.label.moveOrigin",{index:R})},A)}),u(Dd,{className:D,size:"sm",variant:"soft",disabled:(p||!y)&&r!==l.component,onButtonDown:()=>N(l.component,{[l.component]:b[l.component]}),onButtonUp:k,children:t("move.rby1.zeroPose.partAll",{part:h(l.component)})})]}),u("div",{className:P("border-border-subtle w-full border-t p-3",n==="light"?"bg-default":"bg-alt-2"),children:u(Dd,{className:P(D,"w-full"),size:"md",variant:n==="light"?"brand":T?"soft":"inverse",disabled:T,onButtonDown:()=>N("all",w),onButtonUp:k,children:t("move.menu.button.label.moveAllOrigin")})})]})})},{useMemo:kLt}=await F("react"),LLt=i=>{const{jointNames:e,jointStates:t}=xp(i),{cartesian_states:n}=dw(i,s=>({cartesian_states:s?.cartesian_states}));return kLt(()=>{const s=zy(e,h=>t?.[h]?.position),o=Object.keys(lL(e,()=>0)),r=o.length>0&&o.every(h=>h in s),{torso:a,left_arm:l,right_arm:c}=n??{};return{joints:s,cartesians:a&&l&&c?{torso:a,left_arm:l,right_arm:c}:null,complete:r}},[e,t,n])},{useQuery:DLt}=await F("@tanstack/react-query"),EA="/{robot_model}/poses",TLt=({robotModel:i})=>Pa.get(EA.replace("{robot_model}",i)),GAe=(i,e={})=>DLt({queryKey:[EA,i],queryFn:()=>TLt(i),...e}),{useMutation:ELt,useQueryClient:PLt}=await F("@tanstack/react-query"),RLt="/{robot_model}/poses/create",MLt=({robotModel:i,...e})=>Pa.post(RLt.replace("{robot_model}",i),e),ALt=()=>{const i=PLt();return ELt({mutationFn:MLt,onSuccess:()=>{i.invalidateQueries({queryKey:[EA]})}})},{useMutation:OLt,useQueryClient:FLt}=await F("@tanstack/react-query"),BLt="/{robot_model}/poses/{pose_id}/update",VLt=({robotModel:i,poseId:e,...t})=>Pa.put(BLt.replace("{robot_model}",i).replace("{pose_id}",e),t),zLt=()=>{const i=FLt();return OLt({mutationFn:VLt,onSuccess:()=>{i.invalidateQueries({queryKey:[EA]})}})},{useMutation:WLt,useQueryClient:HLt}=await F("@tanstack/react-query"),$Lt="/{robot_model}/poses/{pose_id}/delete",ULt=({robotModel:i,poseId:e})=>Pa.delete($Lt.replace("{robot_model}",i).replace("{pose_id}",e)),jLt=()=>{const i=HLt();return WLt({mutationFn:ULt,onSuccess:()=>{i.invalidateQueries({queryKey:[EA]})}})},{useMutation:GLt}=await F("@tanstack/react-query"),qLt="/{robot_model}/poses/{pose_id}/approach",KLt=({robotModel:i,poseId:e,...t})=>Pa.post(qLt.replace("{robot_model}",i).replace("{pose_id}",e),t),JLt=()=>GLt({mutationFn:KLt}),YLt=.1,qAe=i=>Object.values(i).reduce((e,t)=>e+(t?.length??0),0);function XLt(i,e,t=YLt){const n=Object.keys(i);return n.length===0?!1:n.every(s=>{const o=i[s],r=e[s];return!!o&&!!r&&o.length===r.length&&o.every((a,l)=>Math.abs(a-r[l])<=t)})}const QLt="–",DF="px-px py-1 text-right whitespace-nowrap",KAe=({className:i,mode:e,joints:t,cartesians:n})=>{const{t:s}=q(),o=e==="joint",r=ab.filter(c=>o||c.component!=="head"),a=o?Array.from({length:Math.max(0,...Object.values(t).map(c=>c?.length??0))},(c,d)=>String(d)):YI.map(c=>c),l=c=>o?t[c]:c==="head"?void 0:n?.[c];return u("div",{className:P("RBY1PoseValueTable","overflow-x-auto",i),children:x("table",{className:"typo-code-2xs-medium w-full border-collapse",children:[u("thead",{children:x("tr",{className:"typo-compact-2xs-medium text-fg-subtle",children:[u("th",{className:P(DF,"text-left font-normal"),children:s(o?"move.rby1.monitor.joint":"move.rby1.monitor.tcp")}),a.map(c=>u("th",{className:P(DF,"font-normal",!o&&xi[c]),children:o?c:c.toUpperCase()},c))]})}),u("tbody",{children:r.map(c=>{const d=l(c.component);return x("tr",{className:"border-border-subtle border-t first:border-t-0",children:[u("td",{className:P(DF,"text-fg-default text-left"),children:c.label}),a.map((h,g)=>{const m=d?.[g];return u("td",{className:P(DF,m===void 0?"text-fg-subtlest":"text-fg-default font-semibold"),children:m===void 0?QLt:m.toFixed(1)},h)})]},c.value)})})]})})},{useMemo:ZLt}=await F("react"),JAe=({className:i,pose:e,cameraPositionKey:t})=>{const{data:n}=As(),{data:s}=Ph(),o=ZLt(()=>{const r=e&&s?.components?.[e.robotModel],a=r?.type==="array"?r.mapper:[];return{real:e?zAe(a,e.joints):{}}},[s,e]);return u("div",{className:P("RBY1PoseViewer","bg-bg-alt-1 relative overflow-hidden rounded-lg",i),children:u(Ym,{className:"relative size-full",cameraPositionKey:t,robotModel:n?.info?.robotModel,enablePanning:!0,jointValuesRad:o})})},eDt=({className:i,pose:e,open:t,onOpenChange:n})=>u(Uo,{className:P(i,"w-fit max-w-[90vw]!"),enableDimClose:!0,header:{title:e.name},open:t,onOpenChange:n,children:u(JAe,{className:"m-4 mt-0 h-[60vh] w-[40rem]",pose:e,cameraPositionKey:"rby1-pose-view"})}),{useState:T_e}=await F("react"),tDt=({className:i,pose:e,isCurrent:t,moveDisabled:n,canUpdateToCurrent:s,onApproachStart:o,onApproachStop:r,onRename:a,onUpdateToCurrent:l,onDelete:c})=>{const{t:d}=q(),{modal:h}=Vi(),[g,m]=T_e("joint"),[f,p]=T_e(null),_=f!==null,b=f?.trim()??"",v=[d("move.rby1.savedPose.axisCount",{count:qAe(e.joints)}),Cr(e.updatedAt,"MM-DD HH:mm"),t&&d("move.rby1.savedPose.current")].filter(Boolean).join(" · ");return x(U,{"data-testid":"rby1-saved-pose-card",className:P("RBY1SavedPoseCard","bg-bg-alt-1 gap-3 rounded-lg border p-3",t?"border-border-success":"border-border-subtle",i),children:[_?x(H,{className:"gap-1",alignItems:"center",children:[u(et,{className:"flex-1",size:"sm",value:f,hideBtnReset:!0,handleChange:w=>p(String(w)),handleEnter:()=>{b&&(a(b),p(null))}}),u(Yt,{"aria-label":"confirm",variant:"transparent",size:"xs",disabled:!b,onClick:()=>{a(b),p(null)},children:u($Ke,{className:"text-fg-success size-4"})}),u(Yt,{"aria-label":"cancel",variant:"transparent",size:"xs",onClick:()=>p(null),children:u(Nb,{})})]}):x(H,{justifyContent:"space-between",alignItems:"flex-start",children:[x(U,{className:"min-w-0 gap-1",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default truncate",children:e.name}),u("span",{className:"typo-code-2xs-medium text-fg-subtle",children:v})]}),x(H,{className:"shrink-0 gap-0.5",children:[u(Yt,{"aria-label":"view pose",variant:"transparent",size:"xs",onClick:()=>h({component:eDt,props:{pose:e}}),children:u(Hje,{})}),u(Yt,{"aria-label":"edit",variant:"transparent",size:"xs",onClick:()=>p(e.name),children:u(Oie,{})}),u(Yt,{"aria-label":"delete",variant:"transparent",size:"xs",onClick:c,children:u(Y0,{})})]})]}),x(U,{className:"bg-bg-alt-2 gap-2 rounded-md p-2",children:[x(H,{justifyContent:"space-between",alignItems:"center",children:[u("span",{className:"typo-compact-2xs-medium text-fg-subtle",children:d(g==="joint"?"move.rby1.savedPose.jointTitle":"move.rby1.savedPose.tcpTitle")}),u(eV,{className:"w-auto",size:"sm",value:g,items:[{value:"joint",label:d("move.menu.label.joint")},{value:"cartesian",label:d("move.rby1.savedPose.cartesian"),disabled:!e.cartesians}],onChange:m})]}),u(KAe,{mode:g,joints:e.joints,cartesians:e.cartesians})]}),_?u(se,{className:"w-full",size:"sm",variant:"soft",leadingIcon:u(PLe,{className:"size-4"}),disabled:!b||!s,onClick:()=>{l(b),p(null)},children:d("move.rby1.savedPose.updateToCurrent")}):u(Dd,{className:"w-full",size:"sm",variant:"brand",leadingIcon:u(FLe,{}),disabled:n,onButtonDown:()=>o(g),onButtonUp:r,children:d("move.rby1.savedPose.approach")})]})},{useCallback:E_e,useMemo:nDt,useState:fU}=await F("react"),iDt=({className:i,robotModel:e})=>{const{t}=q(),{confirmDialog:n}=jn(),[s,o]=fU(""),[r,a]=fU(""),[l,c]=fU(null),{data:d=[]}=GAe({robotModel:e}),h=LLt(e),{isMoving:g,isEmergencyStop:m}=aL(e),{selectedRobot:f}=Fi(e),p=f?.connected==="DISCONNECT",_=g||m||p,{mutate:b,isPending:v}=ALt(),{mutate:w}=zLt(),{mutate:y}=jLt(),{mutate:S}=JLt(),{mutate:C}=f6(),N=nDt(()=>{const R=r.trim().toLowerCase();return R?d.filter(A=>A.name.toLowerCase().includes(R)):d},[d,r]),k=()=>({joints:h.joints,cartesians:h.cartesians??void 0}),L=()=>{const R=s.trim();!R||!h.complete||b({robotModel:e,name:R,...k()},{onSuccess:()=>o("")})},D=E_e((R,A)=>{c(R),S({robotModel:e,poseId:R,mode:A,reference:"base",minimumTime:mR()})},[S,e]),T=E_e(()=>{c(null),C({robotModel:e})},[C,e]),E=async R=>{await n({title:t("move.rby1.savedPose.deleteTitle"),content:t("move.rby1.savedPose.deleteContent",{name:R.name}),buttonText:{yes:t("move.rby1.savedPose.delete"),no:t("common.button.cancel")}})&&y({robotModel:e,poseId:R.poseId})};return u("div",{className:P("RBY1SavedPoseControl","h-full",i),children:x(U,{className:"h-full gap-3 overflow-y-auto px-3 py-2.5",children:[x(H,{className:"gap-2",alignItems:"baseline",children:[u("h6",{className:"typo-compact-sm-semibold text-fg-default",children:t("move.rby1.menu.savedPose")}),u("span",{className:"typo-compact-xs-medium text-fg-subtle",children:t("move.rby1.savedPose.count",{count:d.length})})]}),x(U,{className:"border-border-subtle bg-bg-alt-1 gap-2 rounded-lg border p-3",children:[u("span",{className:"typo-compact-xs-medium text-fg-subtle",children:t("move.rby1.savedPose.saveDesc")}),x(H,{className:"gap-2",children:[u(et,{"data-testid":"rby1-saved-pose-name",className:"flex-1",size:"sm",value:s,placeholder:t("move.rby1.savedPose.namePlaceholder"),handleChange:R=>o(String(R??"")),handleEnter:L}),u(se,{size:"sm",variant:"brand",leadingIcon:u(Mm,{}),disabled:!s.trim()||!h.complete||p||v,onClick:L,children:t("move.rby1.savedPose.save")})]})]}),u(et,{className:"w-full",type:"search",size:"md",value:r,placeholder:t("move.rby1.savedPose.searchPlaceholder"),handleChange:R=>a(String(R??""))}),N.length===0?u("span",{className:"typo-compact-xs-medium text-fg-subtle py-6 text-center",children:t("move.rby1.savedPose.empty")}):N.map(R=>u(tDt,{pose:R,isCurrent:XLt(R.joints,h.joints),moveDisabled:_&&l!==R.poseId,canUpdateToCurrent:h.complete&&!p,onApproachStart:A=>D(R.poseId,A),onApproachStop:T,onRename:A=>w({robotModel:e,poseId:R.poseId,name:A}),onUpdateToCurrent:A=>w({robotModel:e,poseId:R.poseId,name:A,...k()}),onDelete:()=>E(R)},R.poseId))]})})},{useMemo:P_e}=await F("react"),sDt=["torso","left_arm","right_arm"],R_e="–",oDt=["mm","mm","mm","°","°","°"],p6=({className:i,robotModel:e,mode:t="joint",source:n="real",ghostJointValuesRad:s})=>{const{t:o}=q(),{jointNames:r,jointStates:a,toJointNameText:l}=xp(e),c=n==="ghost",d=t==="cartesian"&&!c,h=P_e(()=>c?zy(r,(p,_)=>s?.[_]):zy(r,p=>a?.[p]?.position),[c,r,s,a]),g=P_e(()=>Math.max(0,...Object.values(lL(r,()=>1)).map(p=>p.length)),[r]),{cartesian_states:m}=dw(e,p=>({cartesian_states:p?.cartesian_states}),d),f="px-1.5 py-0.5 text-left whitespace-nowrap";return x(U,{className:P("RBY1JogMonitoring","gap-3",i),children:[x("table",{"data-testid":"rby1-joint-table",className:"typo-compact-2xs-medium border-separate border-spacing-0",children:[u("thead",{children:x("tr",{className:"text-fg-subtle font-normal",children:[x("th",{className:P(f,"min-w-16 font-normal"),children:[o("move.rby1.monitor.joint")," (°)"]}),Array.from({length:g},(p,_)=>x("th",{className:P(f,"min-w-14 font-normal"),children:["J",_]},_))]})}),u("tbody",{children:ab.map(p=>{const _=h[p.component]??[];return x("tr",{children:[u("td",{className:P(f,"text-fg-default"),children:l(p.component)}),Array.from({length:g},(b,v)=>u("td",{className:P(f,_[v]===void 0?"text-fg-subtlest":"text-fg-default font-semibold"),children:_[v]===void 0?R_e:_[v].toFixed(3)},v))]},p.value)})})]}),d&&x("table",{"data-testid":"rby1-tcp-table",className:"typo-compact-2xs-medium border-separate border-spacing-0",children:[u("thead",{children:x("tr",{className:"text-fg-subtle font-normal",children:[u("th",{className:P(f,"min-w-16 font-normal"),children:"Base"}),YI.map((p,_)=>u("th",{className:P(f,"min-w-14 font-normal"),children:x(H,{className:"gap-1",children:[u("span",{className:P("font-semibold",xi[p]),children:p.toUpperCase()}),u("span",{children:oDt[_]})]})},p))]})}),u("tbody",{children:sDt.map(p=>{const _=m?.[p];return x("tr",{children:[u("td",{className:P(f,"text-fg-default"),children:l(p)}),YI.map((b,v)=>u("td",{className:P(f,_?"text-fg-default font-semibold":"text-fg-subtlest"),children:_?_[v].toFixed(3):R_e},b))]},p)})})]})]})},{useMutation:rDt}=await F("@tanstack/react-query"),aDt="/{robot_model}/approach_l",lDt=({robotModel:i,...e})=>Pa.post(aDt.replace("{robot_model}",i),e),YAe=()=>rDt({mutationFn:lDt});function cDt({components:i,cartesians:e,poseOf:t}){const n={};for(const s of i){const o=t(s),r=e[s];if(!o?.real||!o.ghost||!r)continue;const a=BPe({target:o.ghost,reference:o.real,referenceCarteX:r});n[s]=[a.x,a.y,a.z,a.rx,a.ry,a.rz]}return n}const{useCallback:pU,useMemo:M_e,useRef:dDt}=await F("react"),uDt=["torso","right_arm","left_arm"],XAe=({robotModel:i,urdfViewerRef:e,isDisconnected:t,tcpJointNames:n,isTorsoScope:s,torsoAnchors:o,torsoConstraintMode:r})=>{const{jointNames:a,jointStates:l}=xp(i),c=M_e(()=>a.map((k,L)=>Sd(l?.[L]?.position??0)),[a,l]),{ik:d,helpers:h}=VPe({robotModel:i,urdfViewerRef:e,isDisconnected:t,jointQDeg:c}),{getRealRobotJointAngles:g,guardConnected:m}=h,{cartesian_states:f}=dw(i,k=>({cartesian_states:k?.cartesian_states})),{mutate:p}=Roe(),{mutate:_}=YAe(),{mutate:b}=f6(),v=dDt(!1),w=pU(k=>{if(!m())return;const L=e.current?.getGhostRobotJointValues()??k.jointAngles,D=ZB(zy(a,(T,E)=>L[E]),a,T=>l?.[T]?.is_ready);Object.keys(D).length!==0&&(v.current=!0,p({robotModel:i,target:D,minimumTime:mR()}))},[m,e,a,l,p,i]),y=pU(()=>{if(!m())return;const k=e.current,L=g();if(!k||!L)return;const D=cDt({components:uDt,cartesians:f??{},poseOf:E=>{const R=ab.find(M=>M.component===E),A=n.find(M=>!!R&&M.toLowerCase().includes(R.value));return A?{ghost:k.getGhostTcpPoseInChainBase(A),real:k.getGhostTcpPoseInChainBase(A,L)}:null}}),T=ZB(D,a,E=>l?.[E]?.is_ready);Object.keys(T).length!==0&&(v.current=!0,_({robotModel:i,target:T,reference:"base",minimumTime:mR()}))},[m,e,g,f,n,a,l,_,i]),S=pU(()=>{v.current&&(v.current=!1,b({robotModel:i}))},[b,i]),C=s&&r==="constrained",N=M_e(()=>({...d.ghostRobotIkOptions,pinnedAnchorJointNamesByAnchor:k=>k!==void 0&&o.includes(k)&&!C?[]:void 0}),[d.ghostRobotIkOptions,o,C]);return{...d,ghostRobotIkOptions:N,ghostRobotTcpOffset:null,handleIKMoveJStart:w,handleIKMoveJStop:S,handleIKMoveLStart:y,handleIKMoveLStop:S}},hDt=[{id:"all",label:"All",groups:["left","right","torso"]},{id:"right",groups:["right"]},{id:"left",groups:["left"]},{id:"torso",groups:["torso"]},{id:"head",groups:["head"]}];function gDt(i,e){return hDt.flatMap(({id:t,label:n,groups:s})=>{const o=s.flatMap(l=>{const c=ab.find(d=>d.value===l);return c?[{group:c,jointNames:e.filter(d=>d.startsWith(c.jointPrefix))}]:[]}),r=n??o[0]?.group.label;if(!r||o.length!==s.length||o.some(l=>l.jointNames.length===0))return[];const a=o.every(({group:l})=>l.tcpGizmo);return[{id:t,label:r,tcpGizmo:a,anchors:a?o.flatMap(({group:l})=>i.filter(c=>c.toLowerCase().includes(l.value))):[],jointNames:o.flatMap(l=>l.jointNames)}]})}function mDt(i,e){return[...new Set([...i,...e])]}function fDt(i,e){return i.find(t=>t.id===e)??i[0]}const{useMemo:A_e,useState:O_e}=await F("react"),QAe=(i,e)=>{const t=A_e(()=>gDt(i,e??[]),[i,e]),[n,s]=O_e(null),[o,r]=O_e("constrained"),a=fDt(t,n),l=a?.id==="torso",c=A_e(()=>t.find(d=>d.id==="torso")?.anchors??[],[t]);return{options:t,selectedId:a?.id,setSelectedId:s,activeAnchors:a?.anchors,tcpGizmo:a?.tcpGizmo??!0,scopeJointNames:a?.jointNames,isTorsoScope:l,torsoAnchors:c,torsoConstraintMode:o,setTorsoConstraintMode:r}};function Moe(i,e,t="position"){const n={};if(!e)return n;for(let s=0;s<i.length&&!(s>=e.length);s++){const o=e[s]?.[t];o!=null&&(n[i[s]]=o)}return n}const{useCallback:F_e,useMemo:_U,useRef:pDt,useState:_Dt}=await F("react"),bDt=["translate","rotate"],vDt=({className:i,robotModel:e})=>{const t=pDt(null),{t:n}=q(),[s]=xc(),o=s.get("rby1_jog")??"joint",{data:r}=As(),a=Zk(t),{isMoving:l}=aL(e),{jointNames:c,jointStates:d}=xp(e),h=_U(()=>({real:Moe(c,d)}),[c,d]),{selectedRobot:g}=Fi(e),m=g?.connected==="DISCONNECT",{tcpJointNames:f,ghostDraggableJointNames:p,isGhostRobotSupported:_}=hoe(e),[b,v]=_Dt([]),w=_U(()=>mDt(f,b),[f,b]),y=QAe(w,p),S=goe(),{ghostJointValues:C,handleGhostRobotJointsChanged:N}=moe(S.isGhostRobot),k=y.tcpGizmo?S.gizmoType:S.gizmoType==="none"?"none":null,L=XAe({robotModel:e,urdfViewerRef:t,isDisconnected:m,isTorsoScope:y.isTorsoScope,torsoAnchors:y.torsoAnchors,torsoConstraintMode:y.torsoConstraintMode,tcpJointNames:f}),{viewerProps:D,itemProps:T}=foe({gizmo:S,ghostRobotIK:L,isMoving:l,gizmoType:k,activeTcpAnchors:y.activeAnchors,draggableJointNames:y.scopeJointNames??p,onGhostRobotJointsChanged:N}),E=S.isGhostRobot?"ghost":"real",{onGhostRobotChange:R}=T,A=F_e(B=>R?.(B==="ghost"),[R]),M=F_e(B=>{t.current?.setGhostRobotJointValues(B),t.current?.resetIKTransform()},[]),O=_U(()=>[{key:"zoom-in-out",element:u(H1,{onZoomIn:a.zoomIn,onZoomOut:a.zoomOut},"zoom-in-out")},{key:"camera-view",element:u(xA,{onSetCameraView:a.setCameraView},"camera-view")},..._?[{key:"ghost-robot",element:u(q9,{...T,disabledGizmoTypes:y.tcpGizmo?void 0:bDt,gizmoOptionsDisabled:!y.tcpGizmo,scopeOptions:y.options,scopeValue:y.selectedId,onScopeChange:y.setSelectedId,isTorsoScope:y.isTorsoScope,torsoConstraintMode:y.torsoConstraintMode,onTorsoConstraintModeChange:y.setTorsoConstraintMode},"ghost-robot")}]:[]],[a.zoomIn,a.zoomOut,a.setCameraView,_,T,y.tcpGizmo,y.options,y.selectedId,y.setSelectedId,y.isTorsoScope,y.torsoConstraintMode,y.setTorsoConstraintMode]);return x(o6,{className:P("RBY1Move",i),rightIconPanels:O,menus:[{id:"jog",label:n("move.menu.button.label.jog"),icon:u(pK,{}),content:u(jAe,{robotModel:e,source:E,ghostJointValuesRad:C,onGhostJointsChange:M})},{id:"zero-pose",label:n("move.menu.button.label.zeroPose"),icon:u($De,{}),content:u(ILt,{robotModel:e})},{id:"saved-pose",label:n("move.rby1.menu.savedPose"),icon:u(RKe,{}),content:u(iDt,{robotModel:e})}],beService:r?.modelInfo?.be_service,children:[u("div",{className:"h-full flex-1 p-2.5",children:x("div",{className:"absolute top-0 left-0 z-1 size-full",children:[u(Ym,{ref:t,className:"relative size-full",cameraPositionKey:"rby1-move",robotModel:r?.info?.robotModel,enablePanning:!0,jointValuesRad:h,onToolJointNamesChange:v,...D}),x(U,{className:"absolute top-0 left-0 z-10 gap-3 p-4",children:[u(BAe,{className:"pointer-events-auto",value:E,disabled:!_,onChange:A}),u(p6,{robotModel:e,mode:o,source:E,ghostJointValuesRad:C})]})]})}),u($9,{isGhostRobot:S.isGhostRobot,ghostRobotIK:L,btnHoverInteraction:$k.isDesktop})]})},yDt=({className:i})=>{const{connected:e}=Mg(),{selectedRobotModel:t}=ui(),{selectedRobot:n}=Fi(t);return u("div",{className:P("MovePage","h-full",i),children:u(H,{justifyContent:"space-between",className:"relative h-full",children:u("div",{className:"size-full flex-1",children:Yl()?u(Jkt,{}):e?x(rn,{children:[n?.be_service==="manipulate"&&u(cSt,{robotModel:t}),n?.be_service==="amr"&&u(Kkt,{robotModel:t}),n?.be_service==="rby1"&&u(vDt,{robotModel:t})]}):u("div",{className:"text-fg-default flex size-full items-center justify-center",children:u(qm,{className:"text-fg-default size-8"})})})})})},wDt=({className:i})=>{const{theme:e}=tt(),{data:t}=Jm(s=>({all_connected:s?.all_connected})),n=P("text-fg-inverse",e==="light"&&"text-white");return x("div",{className:P("HeaderConnectStatusBtn",i),"data-testid":"header-connect-status",children:[x(n1,{className:P("bg-fill-success outline-border-subtle/20 inline-flex h-8 items-center justify-start self-stretch rounded-md pl-2.5 outline outline-1 outline-offset-[-1px]",{"bg-fill-success":t?.all_connected==="STABLE","bg-fill-caution":t?.all_connected==="UNSTABLE","bg-fill-danger":t?.all_connected==="DISCONNECT"}),"data-pad-focus":"true",anchorId:"robot-connection-status",popoverElement:u(aEe,{}),popoverStyle:{top:"0.4rem",left:"-0.7rem"},children:[x("div",{className:"flex flex-1 items-center justify-start gap-1",children:[x("div",{className:"relative h-4 w-4 overflow-hidden",children:[u("div",{className:P("absolute top-[50%] left-[50%] h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",e==="light"?"bg-white/30":"bg-fill-inverse-subtle-hovered/30")}),u("div",{className:P("absolute top-[50%] left-[50%] h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full",e==="light"?"bg-white/40":"bg-fill-inverse-subtle/40")})]}),u("div",{className:"flex flex-1 items-center justify-start overflow-hidden pr-2",children:u("div",{className:P(n,"min-w-17 justify-center text-left font-['Pretendard_Variable'] text-xs leading-4 font-semibold"),children:t?.all_connected})})]}),u(U,{className:"relative size-8 overflow-hidden",alignItems:"center",justifyContent:"center",children:u(Ty,{className:P(n,"absolute top-[50%] left-[50%] size-4 -translate-x-1/2 -translate-y-1/2")})})]}),u("div",{id:"robot-connection-status"})]})},{useCallback:CDt,useEffect:SDt,useRef:B_e}=await F("react"),xDt=({className:i})=>{const e=B_e(null),t=B_e(null),n=CDt(()=>{e.current&&t.current&&(e.current.textContent=Cr(Date.now(),"MM-DD"),t.current.textContent=Cr(Date.now(),"HH:mm"))},[]);return SDt(()=>{n();const s=setInterval(n,1e3);return()=>clearInterval(s)},[n]),x(H,{className:P("HeaderWatch","text-fg-subtle typo-compact-xs-medium h-6 gap-1",i),alignItems:"center",justifyContent:"flex-start",children:[u("span",{ref:e}),u("span",{ref:t})]})},V_e="header-network-badge",NDt=()=>{const{t:i}=q(),{theme:e}=tt(),{data:t,isPending:n}=ZTe({refetchInterval:6e4,refetchOnWindowFocus:!0});if(n)return null;const s=!!t?.internet;return x(rn,{children:[u("span",{id:V_e,className:"inline-flex size-8 items-center justify-center",children:u($je,{className:P("size-5",s?e==="light"?"text-fg-default":"text-fg-information":"text-fg-subtlest")})}),u(pEe,{anchorId:V_e,className:"[&_.speech-bubble]:w-max!",place:"bottom",space:12,children:i(s?"header.title.externalNetwork":"header.title.closedNetwork")})]})},IDt=[{shortLabel:"ENG",label:"ENGLISH",value:"en"},{shortLabel:"KOR",label:"한국어",value:"ko"}],kDt=({className:i})=>{const{changeLanguage:e,currentLanguage:t}=q();return u("div",{className:P("LanguageSelect",i),children:u(ae,{className:"bg-fill-transparent-hovered hover:bg-fill-transparent-hovered! h-8 min-w-0 outline-0! [&_label_span]:text-xs",size:"sm",enableModal:!0,enableGamepadFocus:!0,value:t,onChange:n=>e(n.target.value),children:IDt.map(n=>u(J,{value:n.value,label:u(H,{alignItems:"center",className:"gap-1.5",children:u("span",{children:n.shortLabel})}),children:n.label},n.value))})})},{useQuery:LDt}=await F("@tanstack/react-query"),ZAe="/battery_state",DDt=async()=>Ut.get(ZAe),TDt=(i={})=>LDt({queryKey:[ZAe],queryFn:()=>DDt(),...i}),EDt=i=>{const{data:e,loading:t}=ls("common/battery_state",{selector:i});return{data:e,loading:t}},{useMemo:PDt}=await F("react"),RDt=()=>{const{data:i}=TDt(),{data:e}=EDt();return{batteryState:PDt(()=>({...i,...e}),[i,e])}},{useQuery:MDt}=await F("@tanstack/react-query"),e2e="/version.json",ADt=async()=>{const e=await(await fetch(`${e2e}?t=${Date.now()}`)).json();return{...e,current:e.total??e.current}},ODt=()=>MDt({queryKey:[e2e],queryFn:ADt,staleTime:1e3,gcTime:60*1e3,refetchInterval:60*1e3}),FDt=({className:i})=>{const{theme:e,setThemeData:t}=tt(),n=e==="dark";return u(Yt,{size:"xs2",variant:"transparent",className:P(i),onClick:()=>t(n?"light":"dark"),children:x("span",{className:"relative block h-4 w-4 overflow-hidden",children:[u(Uje,{className:P("absolute inset-0 h-4 w-4 transition-all duration-500 ease-out",n?"translate-y-0 rotate-0 opacity-100":"translate-y-full rotate-90 opacity-0")}),u(jje,{className:P("absolute inset-0 h-4 w-4 transition-all duration-500 ease-out",n?"-translate-y-full -rotate-90 opacity-0":"translate-y-0 rotate-0 opacity-100")})]})})},{useQuery:BDt}=await F("@tanstack/react-query"),t2e="/plugin/{pluginId}",VDt=({pluginId:i})=>{const e=t2e.replace("{pluginId}",i);return Ut.get(e)},cL=(i,e)=>BDt({queryKey:[t2e,i.pluginId],queryFn:()=>VDt(i),enabled:!!i.pluginId,...e}),{useMutation:zDt,useQueryClient:WDt}=await F("@tanstack/react-query"),HDt="/plugin/installed/{pluginId}/enabled",$Dt=({pluginId:i,...e})=>{const t=HDt.replace("{pluginId}",i);return Ut.patch(t,e)},Aoe=()=>{const i=WDt();return zDt({mutationFn:$Dt,onSuccess:(e,{pluginId:t})=>{i.invalidateQueries({queryKey:["/plugin/installed/list"]}),i.invalidateQueries({queryKey:["/plugin/{pluginId}",t]})}})},n2e=({className:i,pluginId:e,pluginName:t,uiContent:n,isPreview:s})=>{const{theme:o}=tt(),{data:r}=cL({pluginId:e},{enabled:!s}),{mutateAsync:a,isPending:l}=Aoe(),c=s||!!r?.enabled,d=async h=>{await a({pluginId:e,enabled:h})};return x(U,{className:P("PluginToolbarContent","bg-bg-overlay text-default",i,{"bg-alt-1":o==="light"}),"data-theme":o,draggable:!1,children:[x(H,{className:"typo-compact-xs2-semibold text-default w-full gap-4 px-3 py-3",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"whitespace-pre",children:t}),u(tr,{size:"default",disabled:s||l,checked:c,onCheckedChange:d})]}),!!n&&u("div",{className:P("bg-alt-2 min-h-0 overflow-y-auto",{"pointer-events-none opacity-40 select-none":!c}),"aria-disabled":!c,children:u(s6,{pluginId:e,ui:n},e)})]})},UDt=({className:i,pluginId:e,pluginName:t,uiContent:n,isPreview:s})=>{const{theme:o}=tt();return u(nse,{className:P("PopoverToolbarContent",i),children:u(n2e,{className:"max-h-[calc(var(--vh,1vh)*70)] min-w-50 rounded-sm",pluginId:e,pluginName:t,uiContent:n,isPreview:s})})},jDt=({className:i,pluginId:e,pluginName:t,uiContent:n,isPreview:s,open:o,onOpenChange:r})=>u(Uo,{className:P("rounded-none",i),type:"right-sheet",hideCloseButton:!0,open:o,onOpenChange:r,children:u(n2e,{pluginId:e,pluginName:t,uiContent:n,isPreview:s})}),i2e=(i,e)=>ls("common/muscat/plugin/resources",{selector:t=>t?.[i],disabled:e}),{useMutation:GDt,useQueryClient:qDt}=await F("@tanstack/react-query"),KDt="/plugin/installed/{pluginId}",JDt=({pluginId:i})=>{const e=KDt.replace("{pluginId}",i);return Ut.delete(e)},Ooe=()=>{const i=qDt();return GDt({mutationFn:JDt,onSuccess:()=>{i.invalidateQueries({queryKey:["/plugin/installed/list"]})}})},{useEffect:bU,useRef:YDt,useState:XDt}=await F("react"),{createPortal:QDt}=await F("react-dom"),ZDt=({className:i,robotModel:e,pluginId:t,disabled:n})=>{const{theme:s}=tt(),{t:o}=q(),r=YDt(null),a=ir(),[l,c]=XDt(!1),{refs:d,floatingStyles:h,update:g}=Gje({placement:"right-start",middleware:[qje(8),Kje(),Jje()]}),{refetchPluginInstalledList:m}=Lb({robotModel:e,ui:"toolbar"}),{mutateAsync:f}=Ooe(),p=()=>{a(`/muscat/app/plugin/${t}?from=toolbar`)},_=()=>{a(`/muscat/app/plugin/${t}?from=toolbar&tab=logs`)},b=async()=>{const{deleted:C}=await f({pluginId:t});C&&m()};bU(()=>{if(!(!l||!d.reference.current||!d.floating.current))return Yje(d.reference.current,d.floating.current,g)},[l,d.reference,d.floating,g]),bU(()=>{r.current=document.querySelector(".modal-container")},[]),bU(()=>{if(!l)return;const C=N=>{!d.floating.current?.contains(N.target)&&!d.reference.current?.contains(N.target)&&c(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l,d.floating,d.reference]);const v="typo-compact-xs-medium h-8 w-full justify-start rounded-md px-2.5",w=()=>{c(!1),d.reference.current?.focus()},y=C=>()=>{c(!1),C()},S=C=>{if(C.key==="Escape"){C.stopPropagation(),w();return}if(C.key!=="ArrowDown"&&C.key!=="ArrowUp")return;C.preventDefault();const N=Array.from(C.currentTarget.querySelectorAll('[role="menuitem"]')),k=N.indexOf(document.activeElement),L=C.key==="ArrowDown"?1:-1;N[(k+L+N.length)%N.length]?.focus()};return x(rn,{children:[u(Yt,{ref:d.setReference,className:P("inline-flex size-6 items-center justify-center rounded-sm",{"bg-fill-subtlest":l},i),variant:"transparent",icon:u(WDe,{className:"size-4"}),"aria-label":o("plugin.options.ariaLabel.more"),"aria-haspopup":"menu","aria-expanded":l,disabled:n,onClick:()=>c(C=>!C)}),l&&QDt(u("div",{ref:d.setFloating,"data-theme":s,style:h,className:"z-200",children:x("div",{role:"menu",className:"bg-bg-raised shadow-down-xl border-border-subtler flex w-37 flex-col rounded-lg border-1 p-1",onKeyDown:S,children:[u(se,{variant:"transparent",size:"sm",role:"menuitem",autoFocus:!0,className:P(v,"text-fg-default focus-visible:bg-fill-subtlest"),onClick:y(p),children:o("plugin.options.button.detailInfo")}),u(se,{variant:"transparent",size:"sm",role:"menuitem",className:P(v,"text-fg-default focus-visible:bg-fill-subtlest"),onClick:y(_),children:o("plugin.options.button.viewLogs")}),u("div",{role:"separator",className:"bg-border-subtler mx-1.5 my-1 h-px"}),u(se,{variant:"transparent",size:"sm",role:"menuitem",className:P(v,"text-fg-danger hover:!bg-fill-danger-subtlest focus-visible:bg-fill-danger-subtlest"),onClick:y(b),children:o("plugin.options.button.uninstall")})]})}),r.current??document.body)]})},{useMutation:eTt}=await F("@tanstack/react-query"),tTt="/plugin/installed/{pluginId}/toolbar",nTt=({pluginId:i,...e})=>{const t=tTt.replace("{pluginId}",i);return Ut.patch(t,e)},iTt=()=>eTt({mutationFn:nTt}),{useState:sTt}=await F("react"),oTt=({className:i,icon:e,name:t,pluginId:n,enabled:s,toolbar:o,isPreview:r,robotModel:a,onPluginClick:l})=>{const{t:c}=q(),{getAssetUrl:d}=Fu(),{refetchPluginInstalledList:h}=Lb({robotModel:a,ui:"toolbar"}),{data:g}=i2e(n,r),[m,f]=sTt(!!o),{mutateAsync:p}=iTt(),_=async()=>{await p({pluginId:n,toolbar:!m}),h(),f(v=>!v)},b=()=>{l?.(n)};return x(H,{className:P("PluginSimpleInstalledItem","hover:bg-fill-subtlest-hovered gap-3 rounded-lg py-2 pr-1 pl-2 transition-colors duration-120 ease-[cubic-bezier(0.2,0,0,1)]",i),alignItems:"center",children:[x(se,{variant:"transparent",className:"h-auto min-w-0 flex-1 justify-start gap-3 !p-0 text-left hover:!bg-transparent [&>[data-slot=label-button-text]]:min-w-0 [&>[data-slot=label-button-text]]:gap-3",onClick:b,children:[u("img",{className:P("size-9 shrink-0 overflow-hidden rounded-lg object-cover object-center",{grayscale:!s}),src:d(n,e),alt:""}),x(U,{className:"min-w-0",alignItems:"flex-start",children:[u("span",{className:"typo-compact-xs2-semibold text-fg-default w-full truncate",children:t}),x(H,{className:"typo-compact-xs-normal text-fg-subtle gap-2 whitespace-nowrap tabular-nums",alignItems:"center",children:[x("span",{children:["CPU ",sKe(g?.cpuPercent)]}),u("span",{className:"bg-border-subtle h-2.5 w-px"}),x("span",{children:["MEM ",oKe(g?.memoryBytes)]})]})]})]}),x(H,{alignItems:"center",children:[u(Yt,{icon:u(TJe,{className:P("size-3.75",{"text-fg-brand fill-current":m,"text-fg-subtle":!m})}),variant:"transparent",size:"2xs",disabled:r,"aria-label":c(m?"plugin.options.ariaLabel.unpin":"plugin.options.ariaLabel.pin"),"aria-pressed":m,onClick:_}),u(ZDt,{pluginId:n,robotModel:a,disabled:r})]})]},n)},{useEffect:rTt,useMemo:aTt}=await F("react"),lTt=({className:i,robotModel:e,onPluginClick:t,close:n})=>{const{t:s}=q(),o=ir(),{usePluginManifest:r}=Fu(),{data:a}=r(),{data:l,isFetched:c}=kA({robotModel:e}),d=aTt(()=>{const m=l?.plugins?.map(f=>({pluginId:f.pluginId,name:f.name,isPreview:!1,uiContent:Jv(f.contributes,"toolbar")?.ui,icon:typeof f.icons=="object"?f.icons?.["16"]:f.icons,toolbar:f.toolbar,enabled:f.enabled,openType:Jv(f.contributes,"toolbar")?.opens}))??[];return hA()&&a&&m.unshift({pluginId:a.id,name:a.name,uiContent:Jv(a.contributes,"toolbar")?.ui,isPreview:!0,toolbar:!0,enabled:!0,icon:typeof a.icons=="string"?a.icons:a.icons?.["16"],openType:Jv(a.contributes,"toolbar")?.opens}),m},[l?.plugins,a]),h=m=>{t?.(m),n?.()},g=()=>{o("/muscat/app/plugin?installed=1"),n?.()};return rTt(()=>{const m=f=>{f.key==="Escape"&&n?.()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),u(nse,{className:P("PopoverInstalledPluginList","bg-bg-raised text-default overflow-visible rounded-xl shadow-[inset_0_0_0_0.0625rem_rgba(250,250,250,0.08),0_0.75rem_2rem_rgba(9,9,11,0.55)]",i),children:x(U,{className:"w-85",role:"dialog","aria-label":s("plugin.tab.registryList"),children:[x(H,{className:"pt-4 pr-2.5 pb-2 pl-4",justifyContent:"space-between",alignItems:"flex-start",children:[x(U,{className:"gap-0.5",children:[u("h6",{className:"typo-compact-sm-semibold text-fg-default tracking-[-0.01em]",children:s("plugin.tab.registryList")}),u("p",{className:"typo-compact-xs-normal text-fg-subtle",children:s("plugin.popover.installedList.desc")})]}),u(Yt,{className:"size-7 rounded-md",icon:u(Nb,{className:"size-4"}),variant:"transparent",size:"2xs","aria-label":s("plugin.popover.ariaLabel.close"),onClick:n})]}),c&&d.length===0?x(U,{className:"px-8 pt-7 pb-8 text-center",alignItems:"center",children:[u("div",{className:"bg-fill-subtlest-hovered mb-3 flex size-14 items-center justify-center rounded-[0.875rem] shadow-[inset_0_0_0_0.0625rem_rgba(250,250,250,0.1)]",children:u(b9,{className:"text-fg-subtle size-6"})}),u("p",{className:"typo-compact-sm-semibold text-fg-default mb-1",children:s("plugin.popover.installedList.empty")}),u("p",{className:"typo-body-xs-normal text-fg-subtle",children:s("plugin.popover.installedList.emptyDesc")})]}):x(rn,{children:[u(U,{className:"max-h-[calc(var(--vh,1vh)*40)] !overflow-x-visible overflow-y-auto px-2 pt-1 pb-3",children:d.map(m=>u(oTt,{pluginId:m.pluginId,name:m.name,icon:m.icon,enabled:m.enabled,toolbar:m.toolbar,isPreview:m.isPreview,robotModel:e,onPluginClick:h},m.pluginId))}),u("div",{className:"px-3 pb-3",children:u(se,{className:"typo-compact-xs-semibold h-9 w-full rounded-md",leadingIcon:u(qJe,{className:"mr-1 size-4"}),variant:"soft",size:"sm",onClick:g,children:s("plugin.popover.button.manageInstalled")})})]})]})})};var vU={exports:{}};/**!
376
+ `)==-1?[Wa]:Wa.split(/\n/gm);for(let Rr=0;Rr<fa.length;Rr++){let Mue=fa[Rr];zs?(h.save(),h.translate(Be,Xe+Rr*ma),h.rotate(zs),h.fillText(Mue,0,0),h.restore()):h.fillText(Mue,Be,Xe+Rr*ma)}}}Vn.show&&KL(mo,Vn.filter(n,us,X,Qt,Ri),Se,we,fr,mr,Bo(Vn.width*Hs,3),Vn.stroke(n,X),Vn.dash,Vn.cap);let qo=ne.grid;qo.show&&KL(mo,qo.filter(n,us,X,Qt,Ri),Se,Se==0?2:1,Se==0?Ln:$n,Se==0?oi:yi,Bo(qo.width*Hs,3),qo.stroke(n,X),qo.dash,qo.cap),In.show&&KL([fr],[1],Se==0?1:0,Se==0?1:2,Se==1?Ln:$n,Se==1?oi:yi,Bo(In.width*Hs,3),In.stroke(n,X),In.dash,In.cap)}ga("drawAxes")}function Kb(X){v.forEach((ne,we)=>{we>0&&(ne._paths=null,X&&(s==1?(ne.min=null,ne.max=null):ne.facets.forEach(Se=>{Se.min=null,Se.max=null})))})}let Iw=!1,JL=!1,kw=[];function H7(){JL=!1;for(let X=0;X<kw.length;X++)ga(...kw[X]);kw.length=0}function Jb(){Iw||(w0t(B2),Iw=!0)}function $7(X,ne=!1){Iw=!0,JL=ne,X(n),B2(),ne&&kw.length>0&&queueMicrotask(H7)}n.batch=$7;function B2(){if(Xn&&(z7(),Xn=!1),wo&&(Ts(),wo=!1),go){if(cr(m,XS,le),cr(m,FD,Pe),cr(m,XT,Ee),cr(m,QT,Ne),cr(f,XS,le),cr(f,FD,Pe),cr(f,XT,Ee),cr(f,QT,Ne),cr(g,XT,ge),cr(g,QT,Ue),d.width=pl(ge*Hs),d.height=pl(Ue*Hs),w.forEach(({_el:X,_show:ne,_size:we,_pos:Se,side:Be})=>{if(X!=null)if(ne){let Xe=Be===3||Be===0?we:0,ut=Be%2==1;cr(X,ut?"left":"top",Se-Xe),cr(X,ut?"width":"height",we),cr(X,ut?"top":"left",ut?Pe:le),cr(X,ut?"height":"width",ut?Ne:Ee),TJ(X,EC)}else Xu(X,EC)}),Uu=zh=Er=Ub=$L=UL=jb=xw=$b=null,Tc=1,Dw(!0),le!=Re||Pe!=We||Ee!=ct||Ne!=gn){Kb(!1);let X=Ee/ct,ne=Ne/gn;if(Q&&!Kr&&V.left>=0){V.left*=X,V.top*=ne,Yb&&gf(Yb,pl(V.left),0,Ee,Ne),Op&&gf(Op,0,pl(V.top),Ee,Ne);for(let we=0;we<Pi.length;we++){let Se=Pi[we];Se!=null&&(Jr[we]*=X,Oa[we]*=ne,gf(Se,ag(Jr[we]),ag(Oa[we]),Ee,Ne))}}if(Eo.show&&!hl&&Eo.left>=0&&Eo.width>0){Eo.left*=X,Eo.width*=X,Eo.top*=ne,Eo.height*=ne;for(let we in nD)cr(Zb,we,Eo[we])}Re=le,We=Pe,ct=Ee,gn=Ne}ga("setSize"),go=!1}ge>0&&Ue>0&&(h.clearRect(0,0,d.width,d.height),ga("drawClear"),k.forEach(X=>X()),ga("draw")),Eo.show&&hl&&(ev(Eo),hl=!1),Q&&Kr&&(Bp(null,!0,!1),Kr=!1),K.show&&K.live&&da&&(eD(),da=!1),l||(l=!0,n.status=1,ga("ready")),Co=!1,Iw=!1}n.redraw=(X,ne)=>{wo=ne||!1,X!==!1?sf(C,T.min,T.max):Jb()};function YL(X,ne){let we=y[X];if(we.from==null){if(Me==0){let Se=we.range(n,ne.min,ne.max,X);ne.min=Se[0],ne.max=Se[1]}if(ne.min>ne.max){let Se=ne.min;ne.min=ne.max,ne.max=Se}if(Me>1&&ne.min!=null&&ne.max!=null&&ne.max-ne.min<1e-16)return;X==C&&we.distr==2&&Me>0&&(ne.min=hm(ne.min,e[0]),ne.max=hm(ne.max,e[0]),ne.min==ne.max&&ne.max++),M[X]=ne,Xn=!0,Jb()}}n.setScale=YL;let XL,vS,Yb,Op,V2,z2,Xb,Qb,W2,H2,To,Go,nf=!1;const Ba=V.drag;let Va=Ba.x,za=Ba.y;Q&&(V.x&&(XL=Jh(jCt,f)),V.y&&(vS=Jh(GCt,f)),T.ori==0?(Yb=XL,Op=vS):(Yb=vS,Op=XL),To=V.left,Go=V.top);const Eo=n.select=Ja({show:!0,over:!0,left:0,width:0,top:0,height:0},i.select),Zb=Eo.show?Jh(UCt,Eo.over?f:m):null;function ev(X,ne){if(Eo.show){for(let we in X)Eo[we]=X[we],we in nD&&cr(Zb,we,X[we]);ne!==!1&&ga("setSelect")}}n.setSelect=ev;function QL(X){if(v[X].show)fe&&TJ(Ie[X],EC);else if(fe&&Xu(Ie[X],EC),Q){let we=Ss?Pi[0]:Pi[X];we!=null&&gf(we,-10,-10,Ee,Ne)}}function sf(X,ne,we){YL(X,{min:ne,max:we})}function Wh(X,ne,we,Se){ne.focus!=null&&q7(X),ne.show!=null&&v.forEach((Be,Xe)=>{Xe>0&&(X==Xe||X==null)&&(Be.show=ne.show,QL(Xe),s==2?(sf(Be.facets[0].scale,null,null),sf(Be.facets[1].scale,null,null)):sf(Be.scale,null,null),Jb())}),we!==!1&&ga("setSeries",X,ne),Se&&Pw("setSeries",n,X,ne)}n.setSeries=Wh;function U7(X,ne){Ja(S[X],ne)}function j7(X,ne){X.fill=Ki(X.fill||null),X.dir=Ps(X.dir,-1),ne=ne??S.length,S.splice(ne,0,X)}function of(X){X==null?S.length=0:S.splice(X,1)}n.addBand=j7,n.setBand=U7,n.delBand=of;function G7(X,ne){v[X].alpha=ne,Q&&Pi[X]!=null&&(Pi[X].style.opacity=ne),fe&&Ie[X]&&(Ie[X].style.opacity=ne)}let $g,rf,Fp;const tv={focus:!0};function q7(X){if(X!=Fp){let ne=X==null,we=Lt.alpha!=1;v.forEach((Se,Be)=>{if(s==1||Be>0){let Xe=ne||Be==0||Be==X;Se._focus=ne?null:Xe,we&&G7(Be,Xe?1:Lt.alpha)}}),Fp=X,we&&Jb()}}fe&&Ei&&Cs(fpe,ve,X=>{V._lock||(ua(X),Fp!=null&&Wh(null,tv,!0,gr.setSeries))});function qd(X,ne,we){let Se=y[ne];we&&(X=X/Hs-(Se.ori==1?Pe:le));let Be=Ee;Se.ori==1&&(Be=Ne,X=Be-X),Se.dir==-1&&(X=Be-X);let Xe=Se._min,ut=Se._max,kt=X/Be,Bt=Xe+(ut-Xe)*kt,Qt=Se.distr;return Qt==3?GI(10,Bt):Qt==4?c0t(Bt,Se.asinh):Qt==100?Se.bwd(Bt):Bt}function K7(X,ne){let we=qd(X,C,ne);return hm(we,e[0],bt,Kt)}n.valToIdx=X=>hm(X,e[0]),n.posToIdx=K7,n.posToVal=qd,n.valToPos=(X,ne,we)=>y[ne].ori==0?o(X,y[ne],we?yi:Ee,we?$n:0):r(X,y[ne],we?oi:Ne,we?Ln:0),n.setCursor=(X,ne,we)=>{To=X.left,Go=X.top,Bp(null,ne,we)};function ZL(X,ne){cr(Zb,XS,Eo.left=X),cr(Zb,XT,Eo.width=ne)}function $2(X,ne){cr(Zb,FD,Eo.top=X),cr(Zb,QT,Eo.height=ne)}let Lw=T.ori==0?ZL:$2,nv=T.ori==1?ZL:$2;function U2(){if(fe&&K.live)for(let X=s==2?1:0;X<v.length;X++){if(X==0&&it)continue;let ne=K.values[X],we=0;for(let Se in ne)Te[X][we++].firstChild.nodeValue=ne[Se]}}function eD(X,ne){if(X!=null&&(X.idxs?X.idxs.forEach((we,Se)=>{Z[Se]=we}):g0t(X.idx)||Z.fill(X.idx),K.idx=Z[0]),fe&&K.live){for(let we=0;we<v.length;we++)(we>0||s==1&&!it)&&J7(we,Z[we]);U2()}da=!1,ne!==!1&&ga("setLegend")}n.setLegend=eD;function J7(X,ne){let we=v[X],Se=X==0&&E==2?Qs:e[X],Be;it?Be=we.values(n,X,ne)??Ct:(Be=we.value(n,ne==null?null:Se[ne],X,ne),Be=Be==null?Ct:{_:Be}),K.values[X]=Be}function Bp(X,ne,we){W2=To,H2=Go,[To,Go]=V.move(n,To,Go),V.left=To,V.top=Go,Q&&(Yb&&gf(Yb,pl(To),0,Ee,Ne),Op&&gf(Op,0,pl(Go),Ee,Ne));let Se,Be=bt>Kt;$g=Fo,rf=null;let Xe=T.ori==0?Ee:Ne,ut=T.ori==1?Ee:Ne;if(To<0||Me==0||Be){Se=V.idx=null;for(let kt=0;kt<v.length;kt++){let Bt=Pi[kt];Bt!=null&&gf(Bt,-10,-10,Ee,Ne)}Ei&&Wh(null,tv,!0,X==null&&gr.setSeries),K.live&&(Z.fill(Se),da=!0)}else{let kt,Bt,Qt;s==1&&(kt=T.ori==0?To:Go,Bt=qd(kt,C),Se=V.idx=hm(Bt,e[0],bt,Kt),Qt=R(e[0][Se],T,Xe,0));let on=-10,hn=-10,ti=0,xs=0,us=!0,Ri="",Vn="";for(let In=s==2?1:0;In<v.length;In++){let Po=v[In],mr=Z[In],Pr=mr==null?null:s==1?e[In][mr]:e[In][1][mr],zs=V.dataIdx(n,In,Se,Bt),fr=zs==null?null:s==1?e[In][zs]:e[In][1][zs];if(da=da||fr!=Pr||zs!=mr,Z[In]=zs,In>0&&Po.show){let cd=zs==null?-10:zs==Se?Qt:R(s==1?e[0][zs]:e[In][0][zs],T,Xe,0),ic=fr==null?-10:A(fr,s==1?y[Po.scale]:y[Po.facets[1].scale],ut,0);if(Ei&&fr!=null){let ht=T.ori==1?To:Go,Mi=yl(Lt.dist(n,In,zs,ic,ht));if(Mi<$g){let Es=Lt.bias;if(Es!=0){let ma=qd(ht,Po.scale),mo=fr>=0?1:-1,Ro=ma>=0?1:-1;Ro==mo&&(Ro==1?Es==1?fr>=ma:fr<=ma:Es==1?fr<=ma:fr>=ma)&&($g=Mi,rf=In)}else $g=Mi,rf=In}}if(da||Ss){let ht,Mi;T.ori==0?(ht=cd,Mi=ic):(ht=ic,Mi=cd);let Es,ma,mo,Ro,qo,rr,Wa=!0,fa=es.bbox;if(fa!=null){Wa=!1;let Rr=fa(n,In);mo=Rr.left,Ro=Rr.top,Es=Rr.width,ma=Rr.height}else mo=ht,Ro=Mi,Es=ma=es.size(n,In);if(rr=es.fill(n,In),qo=es.stroke(n,In),Ss)In==rf&&$g<=Lt.prox&&(on=mo,hn=Ro,ti=Es,xs=ma,us=Wa,Ri=rr,Vn=qo);else{let Rr=Pi[In];Rr!=null&&(Jr[In]=mo,Oa[In]=Ro,Cpe(Rr,Es,ma,Wa),ype(Rr,rr,qo),gf(Rr,ag(mo),ag(Ro),Ee,Ne))}}}}if(Ss){let In=Lt.prox,Po=Fp==null?$g<=In:$g>In||rf!=Fp;if(da||Po){let mr=Pi[0];mr!=null&&(Jr[0]=on,Oa[0]=hn,Cpe(mr,ti,xs,us),ype(mr,Ri,Vn),gf(mr,ag(on),ag(hn),Ee,Ne))}}}if(Eo.show&&nf)if(X!=null){let[kt,Bt]=gr.scales,[Qt,on]=gr.match,[hn,ti]=X.cursor.sync.scales,xs=X.cursor.drag;if(Va=xs._x,za=xs._y,Va||za){let{left:us,top:Ri,width:Vn,height:In}=X.select,Po=X.scales[hn].ori,mr=X.posToVal,Pr,zs,fr,cd,ic,ht=kt!=null&&Qt(kt,hn),Mi=Bt!=null&&on(Bt,ti);ht&&Va?(Po==0?(Pr=us,zs=Vn):(Pr=Ri,zs=In),fr=y[kt],cd=R(mr(Pr,hn),fr,Xe,0),ic=R(mr(Pr+zs,hn),fr,Xe,0),Lw(Cm(cd,ic),yl(ic-cd))):Lw(0,Xe),Mi&&za?(Po==1?(Pr=us,zs=Vn):(Pr=Ri,zs=In),fr=y[Bt],cd=A(mr(Pr,ti),fr,ut,0),ic=A(mr(Pr+zs,ti),fr,ut,0),nv(Cm(cd,ic),yl(ic-cd))):nv(0,ut)}else iD()}else{let kt=yl(W2-V2),Bt=yl(H2-z2);if(T.ori==1){let ti=kt;kt=Bt,Bt=ti}Va=Ba.x&&kt>=Ba.dist,za=Ba.y&&Bt>=Ba.dist;let Qt=Ba.uni;Qt!=null?Va&&za&&(Va=kt>=Qt,za=Bt>=Qt,!Va&&!za&&(Bt>kt?za=!0:Va=!0)):Ba.x&&Ba.y&&(Va||za)&&(Va=za=!0);let on,hn;Va&&(T.ori==0?(on=Xb,hn=To):(on=Qb,hn=Go),Lw(Cm(on,hn),yl(hn-on)),za||nv(0,ut)),za&&(T.ori==1?(on=Xb,hn=To):(on=Qb,hn=Go),nv(Cm(on,hn),yl(hn-on)),Va||Lw(0,Xe)),!Va&&!za&&(Lw(0,0),nv(0,0))}if(Ba._x=Va,Ba._y=za,X==null){if(we){if(J2!=null){let[kt,Bt]=gr.scales;gr.values[0]=kt!=null?qd(T.ori==0?To:Go,kt):null,gr.values[1]=Bt!=null?qd(T.ori==1?To:Go,Bt):null}Pw(X8,n,To,Go,Ee,Ne,Se)}if(Ei){let kt=we&&gr.setSeries,Bt=Lt.prox;Fp==null?$g<=Bt&&Wh(rf,tv,!0,kt):$g>Bt?Wh(null,tv,!0,kt):rf!=Fp&&Wh(rf,tv,!0,kt)}}da&&(K.idx=Se,eD()),ne!==!1&&ga("setCursor")}let af=null;Object.defineProperty(n,"rect",{get(){return af==null&&Dw(!1),af}});function Dw(X=!1){X?af=null:(af=f.getBoundingClientRect(),ga("syncRect",af))}function j2(X,ne,we,Se,Be,Xe,ut){V._lock||nf&&X!=null&&X.movementX==0&&X.movementY==0||(tD(X,ne,we,Se,Be,Xe,ut,!1,X!=null),X!=null?Bp(null,!0,!0):Bp(ne,!0,!1))}function tD(X,ne,we,Se,Be,Xe,ut,kt,Bt){if(af==null&&Dw(!1),ua(X),X!=null)we=X.clientX-af.left,Se=X.clientY-af.top;else{if(we<0||Se<0){To=-10,Go=-10;return}let[Qt,on]=gr.scales,hn=ne.cursor.sync,[ti,xs]=hn.values,[us,Ri]=hn.scales,[Vn,In]=gr.match,Po=ne.axes[0].side%2==1,mr=T.ori==0?Ee:Ne,Pr=T.ori==1?Ee:Ne,zs=Po?Xe:Be,fr=Po?Be:Xe,cd=Po?Se:we,ic=Po?we:Se;if(us!=null?we=Vn(Qt,us)?a(ti,y[Qt],mr,0):-10:we=mr*(cd/zs),Ri!=null?Se=In(on,Ri)?a(xs,y[on],Pr,0):-10:Se=Pr*(ic/fr),T.ori==1){let ht=we;we=Se,Se=ht}}Bt&&(ne==null||ne.cursor.event.type==X8)&&((we<=1||we>=Ee-1)&&(we=pC(we,Ee)),(Se<=1||Se>=Ne-1)&&(Se=pC(Se,Ne))),kt?(V2=we,z2=Se,[Xb,Qb]=V.move(n,we,Se)):(To=we,Go=Se)}const nD={width:0,height:0,left:0,top:0};function iD(){ev(nD,!1)}let sD,oD,yS,G2;function q2(X,ne,we,Se,Be,Xe,ut){nf=!0,Va=za=Ba._x=Ba._y=!1,tD(X,ne,we,Se,Be,Xe,ut,!0,!1),X!=null&&(Cs(Q8,LJ,rD,!1),Pw(gpe,n,Xb,Qb,Ee,Ne,null));let{left:kt,top:Bt,width:Qt,height:on}=Eo;sD=kt,oD=Bt,yS=Qt,G2=on}function rD(X,ne,we,Se,Be,Xe,ut){nf=Ba._x=Ba._y=!1,tD(X,ne,we,Se,Be,Xe,ut,!1,!0);let{left:kt,top:Bt,width:Qt,height:on}=Eo,hn=Qt>0||on>0,ti=sD!=kt||oD!=Bt||yS!=Qt||G2!=on;if(hn&&ti&&ev(Eo),Ba.setScale&&hn&&ti){let xs=kt,us=Qt,Ri=Bt,Vn=on;if(T.ori==1&&(xs=Bt,us=on,Ri=kt,Vn=Qt),Va&&sf(C,qd(xs,C),qd(xs+us,C)),za)for(let In in y){let Po=y[In];In!=C&&Po.from==null&&Po.min!=Fo&&sf(In,qd(Ri+Vn,In),qd(Ri,In))}iD()}else V.lock&&(V._lock=!V._lock,Bp(ne,!0,X!=null));X!=null&&(or(Q8,LJ),Pw(Q8,n,To,Go,Ee,Ne,null))}function K2(X,ne,we,Se,Be,Xe,ut){if(V._lock)return;ua(X);let kt=nf;if(nf){let Bt=!0,Qt=!0,on=10,hn,ti;T.ori==0?(hn=Va,ti=za):(hn=za,ti=Va),hn&&ti&&(Bt=To<=on||To>=Ee-on,Qt=Go<=on||Go>=Ne-on),hn&&Bt&&(To=To<Xb?0:Ee),ti&&Qt&&(Go=Go<Qb?0:Ne),Bp(null,!0,!0),nf=!1}To=-10,Go=-10,Z.fill(null),Bp(null,!0,!0),kt&&(nf=kt)}function Tw(X,ne,we,Se,Be,Xe,ut){V._lock||(ua(X),ld(),iD(),X!=null&&Pw(ppe,n,To,Go,Ee,Ne,null))}function Ew(){w.forEach(D1t),gl(n.width,n.height,!0)}D0(JB,KN,Ew);const Vp={};Vp.mousedown=q2,Vp.mousemove=j2,Vp.mouseup=rD,Vp.dblclick=Tw,Vp.setSeries=(X,ne,we,Se)=>{let Be=gr.match[2];we=Be(n,ne,we),we!=-1&&Wh(we,Se,!0,!1)},Q&&(Cs(gpe,f,q2),Cs(X8,f,j2),Cs(mpe,f,X=>{ua(X),Dw(!1)}),Cs(fpe,f,K2),Cs(ppe,f,Tw),OJ.add(n),n.syncRect=Dw);const wS=n.hooks=i.hooks||{};function ga(X,ne,we){JL?kw.push([X,ne,we]):X in wS&&wS[X].forEach(Se=>{Se.call(null,n,ne,we)})}(i.plugins||[]).forEach(X=>{for(let ne in X.hooks)wS[ne]=(wS[ne]||[]).concat(X.hooks[ne])});const aD=(X,ne,we)=>we,gr=Ja({key:null,setSeries:!1,filters:{pub:kpe,sub:kpe},scales:[C,v[1]?v[1].scale:null],match:[Lpe,Lpe,aD],values:[null,null]},V.sync);gr.match.length==2&&gr.match.push(aD),V.sync=gr;const J2=gr.key,lD=sAe(J2);function Pw(X,ne,we,Se,Be,Xe,ut){gr.filters.pub(X,ne,we,Se,Be,Xe,ut)&&lD.pub(X,ne,we,Se,Be,Xe,ut)}lD.sub(n);function Y7(X,ne,we,Se,Be,Xe,ut){gr.filters.sub(X,ne,we,Se,Be,Xe,ut)&&Vp[X](null,ne,we,Se,Be,Xe,ut)}n.pub=Y7;function X7(){lD.unsub(n),OJ.delete(n),Mn.clear(),EJ(JB,KN,Ew),c.remove(),ve?.remove(),ga("destroy")}n.destroy=X7;function cD(){ga("init",i,e),ml(e||i.data,!1),M[C]?YL(C,M[C]):ld(),hl=Eo.show&&(Eo.width>0||Eo.height>0),Kr=da=!0,gl(i.width,i.height)}return v.forEach(Dn),w.forEach(Tr),t?t instanceof HTMLElement?(t.appendChild(c),cD()):t(n,cD):cD(),n}Xl.assign=Ja;Xl.fmtNum=woe;Xl.rangeNum=YB;Xl.rangeLog=l6;Xl.rangeAsinh=voe;Xl.orient=j1;Xl.pxRatio=Hs;Xl.join=y0t;Xl.fmtDate=Soe,Xl.tzDate=E0t;Xl.sync=sAe;{Xl.addGap=g1t,Xl.clipGaps=u6;let i=Xl.paths={points:dAe};i.linear=hAe,i.stepped=p1t,i.bars=_1t,i.spline=v1t}const T1t=30,E1t=1e3/T1t-1,eE=new Set;let BJ=0,Ype=0,pAe=Date.now()/1e3;const _Ae=i=>{BJ=requestAnimationFrame(_Ae),!(i-Ype<E1t)&&(Ype=i,pAe=Date.now()/1e3,eE.forEach(e=>e()))},Xpe=()=>pAe,bAe=i=>(eE.add(i),eE.size===1&&(BJ=requestAnimationFrame(_Ae)),()=>{eE.delete(i),eE.size===0&&cancelAnimationFrame(BJ)}),Qpe=(i,e,t)=>getComputedStyle(i).getPropertyValue(e).trim()||t,QB=i=>typeof i=="number"?i:Math.round(window.innerHeight*parseFloat(i)/100),vAe=i=>{const e=()=>({axis:Qpe(i,"--color-fg-subtle","#8b8b8b"),grid:Qpe(i,"--color-border-subtle","rgba(128,128,128,0.15)")});let t=e();return{axis:{stroke:()=>t.axis,grid:{stroke:()=>t.grid,width:1},ticks:{stroke:()=>t.grid,width:1}},refresh:()=>{t=e()}}},yAe=(i,e,t,n)=>{const s=new MutationObserver(()=>{n(),i.redraw(!1)});s.observe(document.body,{attributes:!0,attributeFilter:["data-theme"]});const o=new ResizeObserver(([a])=>{const l=Math.floor(a.contentRect.width);l>0&&i.setSize({width:l,height:QB(t)})});o.observe(e);const r=()=>i.setSize({width:i.width,height:QB(t)});return typeof t=="string"&&window.addEventListener("resize",r),()=>{s.disconnect(),o.disconnect(),window.removeEventListener("resize",r)}},h4=6,wAe=(i,e,t,n,s,o)=>{const r=s-t,a=o-n,l=r*r+a*a,c=l===0?0:Math.max(0,Math.min(1,((i-t)*r+(e-n)*a)/l));return{t:c,dist:Math.hypot(i-(t+c*r),e-(n+c*a))}},P1t=(i,e,t,n,s,o)=>wAe(i,e,t,n,s,o).dist,VJ=i=>Number.isInteger(i)?`${i}`:i.toFixed(3),CAe=i=>{let e=null;const t=()=>{e&&(e.style.display="none")};return{hooks:{init:n=>{e=document.createElement("div"),e.className="MultiDataChartTooltip bg-bg-default border-border-subtle text-fg-default typo-compact-xs-normal pointer-events-none absolute z-10 flex items-center gap-1.5 rounded-md border px-2 py-1 whitespace-nowrap",e.style.display="none",n.over.appendChild(e)},setCursor:n=>{const{left:s,top:o}=n.cursor;if(!e||s==null||o==null||s<0){t();return}const r=i(n,s,o);if(!r){t();return}e.replaceChildren();const a=document.createElement("span");a.className="inline-block size-2 shrink-0 rounded-full",a.style.backgroundColor=r.color??"currentColor";const l=document.createElement("span");l.textContent=r.text,e.append(a,l);const c=s>n.over.clientWidth/2;e.style.display="flex",e.style.left=`${s}px`,e.style.top=`${o}px`,e.style.transform=`translate(${c?"calc(-100% - 10px)":"10px"}, -50%)`}}}},{useEffect:R1t,useRef:Zpe,useState:M1t}=await F("react"),A1t=(i,e,t,n)=>{const s=i.data[0],o=d=>i.valToPos(s[d],"x");let r=e;for(;r>0&&o(r)>t-h4;)r--;let a=e;for(;a<s.length-1&&o(a)<t+h4;)a++;let l=null,c=h4;for(let d=1;d<i.series.length;d++){if(!i.series[d].show)continue;const h=i.data[d],g=f=>h[f]!=null&&!Number.isNaN(h[f]),m=f=>i.valToPos(h[f],"y");for(let f=r;f<=a;f++){if(!g(f))continue;const p=f<a&&g(f+1),_=p?P1t(t,n,o(f),m(f),o(f+1),m(f+1)):Math.hypot(t-o(f),n-m(f));if(_<=c){const b=p&&Math.hypot(t-o(f+1),n-m(f+1))<Math.hypot(t-o(f),n-m(f))?f+1:f;l={seriesIdx:d,value:h[b]},c=_}}}return l},O1t=i=>CAe((e,t,n)=>{const{idx:s}=e.cursor;if(s==null)return null;const o=A1t(e,s,t,n);if(!o)return null;const{label:r,color:a}=i[o.seriesIdx-1];return{color:a,text:`${r}: ${VJ(o.value)}`}}),F1t=({className:i,buffer:e,series:t,height:n=10,syncKey:s="sensors"})=>{const o=Zpe(null),[r,a]=M1t(!1),l=Zpe(null),c=()=>{const d=!r;l.current=d?Xpe():null,a(d)};return R1t(()=>{const d=o.current;if(!d)return;const{axis:h,refresh:g}=vAe(d),m={width:d.clientWidth/2,height:QB(n),legend:{show:!0,live:!0},plugins:[O1t(t)],cursor:{sync:{key:s}},scales:{x:{time:!0,range:()=>{const y=l.current??Xpe();return[y-e.windowSec,y]}}},axes:[{...h,label:"Time (sec)",labelSize:20,size:10,values:(y,S)=>S.map(()=>"")},h],series:[{},...t.map(({label:y,color:S,dash:C})=>({label:y,stroke:S,dash:C,width:1.5,points:{show:!1}}))]},f=[[],...t.map(()=>[])],p=new Xl(m,f,d);let _=-1,b=!1;const v=bAe(()=>{if(l.current!==null){if(b)return;b=!0,p.setData([e.xs.slice(),...t.map(({index:S})=>e.ys[S].slice())]);return}if(b&&(b=!1,_=-1),e.version===_)return;_=e.version,p.setData([e.xs,...t.map(({index:S})=>e.ys[S])]);const y=e.xs.length-1;(p.cursor.left??-1)<0&&y>=0&&p.setLegend({idx:y})}),w=yAe(p,d,n,g);return()=>{v(),w(),p.destroy()}},[e,t,n,s]),u("div",{ref:o,className:P("MultiDataChart","w-full min-w-0","[&_.u-legend]:text-fg-default [&_.u-legend_.u-series:first-child]:hidden!","[&_.u-legend_tbody]:grid! [&_.u-legend_tbody]:grid-cols-6!","[&_.u-legend_.u-series]:flex! [&_.u-legend_.u-series]:flex-col! [&_.u-legend_.u-series]:items-center!",i),children:u("div",{className:"flex justify-end",children:u(Yt,{type:"button",variant:"soft",className:"size-7",onClick:c,children:r?u(FI,{className:"size-3"}):u(aA,{className:"size-3"})})})})},{useEffect:B1t,useRef:e_e,useState:V1t}=await F("react"),z1t=.1,t_e=40,W1t=(i,e,t)=>{const{minX:n,maxX:s,minY:o,maxY:r}=i??{minX:0,maxX:1,minY:0,maxY:1},a=(n+s)/2,l=(o+r)/2;let c=Math.max((s-n)/e,(r-o)/t)*(1+z1t);c>0||(c=1/Math.min(e,t));const d=c*e/2,h=c*t/2;return{x:[a-d,a+d],y:[l-h,l+h]}},n_e=(i,e)=>{const t=[],n=[],s=Math.min(i.length,e.length);for(let l=0;l<s;l++)Number.isFinite(i[l])&&Number.isFinite(e[l])&&(t.push(i[l]),n.push(e[l]));const o=t.length-1,r=[null,[t,n],o>=0?[[t[o]],[n[o]]]:[[],[]]],a=o>=0?{minX:Math.min(...t),maxX:Math.max(...t),minY:Math.min(...n),maxY:Math.max(...n)}:null;return{data:r,bounds:a}},H1t=(i,e,t)=>{const[n,s]=i.data[1];if(!n?.length)return null;const o=c=>i.valToPos(n[c],"x"),r=c=>i.valToPos(s[c],"y");let a=null,l=h4;for(let c=0;c<n.length;c++){const d=c<n.length-1,{t:h,dist:g}=d?wAe(e,t,o(c),r(c),o(c+1),r(c+1)):{t:0,dist:Math.hypot(e-o(c),t-r(c))};g<=l&&(a=d?{x:n[c]+(n[c+1]-n[c])*h,y:s[c]+(s[c+1]-s[c])*h}:{x:n[c],y:s[c]},l=g)}return a},$1t=({className:i,buffer:e,xSeries:t,ySeries:n,height:s=10})=>{const o=e_e(null),[r,a]=V1t(!1),l=e_e(!1),c=()=>{const d=!r;l.current=d,a(d)};return B1t(()=>{const d=o.current;if(!d)return;const{axis:h,refresh:g}=vAe(d),m=n.color??t.color;let f=null,p={width:0,height:0};const _=L=>D=>{const T=D.bbox.width>0?D.bbox.width:D.width,E=D.bbox.height>0?D.bbox.height:D.height;return p={width:T,height:E},W1t(f,T,E)[L]},b={mode:2,width:d.clientWidth/2,height:QB(s),legend:{show:!1},cursor:{x:!1,y:!1,points:{show:!1},drag:{x:!1,y:!1,setScale:!1},dataIdx:()=>null},plugins:[CAe((L,D,T)=>{const E=H1t(L,D,T);return E?{color:m,text:`${t.label}: ${VJ(E.x)}, ${n.label}: ${VJ(E.y)}`}:null})],scales:{x:{time:!1,auto:!0,range:_("x")},y:{auto:!0,range:_("y")}},axes:[{...h,label:t.label,labelSize:20,space:t_e},{...h,label:n.label,labelSize:20,space:t_e}],series:[{},{label:"trajectory",stroke:m,width:1.5,facets:[{scale:"x",auto:!0},{scale:"y",auto:!0}],paths:Xl.paths.linear(),points:{show:!1}},{label:"current",stroke:m,fill:m,facets:[{scale:"x",auto:!0},{scale:"y",auto:!0}],paths:()=>null,points:{show:!0,size:8,filter:[0]}}]},v=new Xl(b,n_e([],[]).data,d),w=()=>{const L=n_e(e.ys[t.index],e.ys[n.index]);f=L.bounds,v.setData(L.data)},y=()=>{const{width:L,height:D}=v.bbox;(Math.abs(L-p.width)>1||Math.abs(D-p.height)>1)&&v.setData(v.data)};let S=-1,C=!1;const N=bAe(()=>{if(l.current){if(C){y();return}C=!0,w();return}if(C&&(C=!1,S=-1),e.version===S){y();return}S=e.version,w()}),k=yAe(v,d,s,g);return()=>{N(),k(),v.destroy()}},[e,t,n,s]),u("div",{ref:o,className:P("XYDataChart","w-full min-w-0",i),children:u("div",{className:"flex justify-end",children:u(Yt,{type:"button",variant:"soft",className:"size-7",onClick:c,children:r?u(FI,{className:"size-3"}):u(aA,{className:"size-3"})})})})},{useEffect:U1t,useMemo:pF,useRef:i_e}=await F("react"),j1t=10,G1t=i=>i,q1t=50,K1t=({className:i,robotModel:e,groups:t,selectedChannelIds:n,chartMode:s})=>{const{t:o}=q(),r=pF(()=>DMe(t),[t]),a=pF(()=>new MCt(r.length,j1t),[r]),l=i_e(a);l.current=a;const c=ws(e,G1t),d=i_e([]);d.current=r.map(({read:f})=>f(c)),U1t(()=>{const f=setInterval(()=>l.current.push(d.current),q1t);return()=>clearInterval(f)},[]);const h=pF(()=>r.flatMap(({id:f,label:p,color:_,dash:b},v)=>n.includes(f)?[{label:p,index:v,color:_,dash:b}]:[]),[r,n]),g=pF(()=>{if(n.length<2)return null;const[f,p]=n.slice(0,2).map(_=>{const b=r.findIndex(({id:S})=>S===_);if(b<0)return null;const{label:v,color:w,dash:y}=r[b];return{label:v,index:b,color:w,dash:y}});return f&&p?{x:f,y:p}:null},[r,n]),m=()=>s==="2d"?g?u($1t,{buffer:a,xSeries:g.x,ySeries:g.y,height:"55vh"}):u(s_e,{message:o("Select two data items for the X and Y axes")}):h.length>0?u(F1t,{buffer:a,series:h,height:"55vh"}):u(s_e,{message:o("move.chart.emptyDesc")});return u("div",{className:P("ChartPanelContent","flex w-full flex-col gap-3",i),children:m()})},s_e=({message:i})=>u("div",{className:"flex h-[55vh] w-full items-center justify-center",children:u("p",{className:"text-fg-subtle typo-compact-xs-normal py-4 text-center",children:i})}),J1t=i=>i.chartMode!=="off"?u(K1t,{...i}):null,{useMutation:Y1t}=await F("@tanstack/react-query"),X1t="/{robot_model}/call_move_push",Q1t=i=>{const{robot_model:e,...t}=i,n=X1t.replace("{robot_model}",e);return Dt.post(n,t)},Z1t=()=>Y1t({mutationFn:i=>Q1t(i)}),{useMutation:eSt}=await F("@tanstack/react-query"),tSt="/emergency_stop",nSt=async()=>await Ut.post(tSt),SAe=()=>eSt({mutationFn:nSt}),iSt=[{label:"move.options.interJoint",value:0},{label:"move.options.externalFt",value:1}],sSt=[{label:"move.box.option.global",value:0},{label:"move.box.option.local",value:1},{label:"move.box.option.user",value:2}],oSt=[{label:"X",name:"sensitivityX"},{label:"Y",name:"sensitivityY"},{label:"Z",name:"sensitivityZ"}],rSt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),{mutate:s,isPending:o}=Z1t(),{mutate:r,isPending:a}=SAe(),{handleSubmit:l,control:c}=he({defaultValues:{forceType:0,frameType:0,sensitivityX:0,sensitivityY:0,sensitivityZ:0}}),d=h=>{s({robot_model:e,force_type:Number(h.forceType),frame_type:Number(h.frameType),sensitivity_x:Number(h.sensitivityX),sensitivity_y:Number(h.sensitivityY),sensitivity_z:Number(h.sensitivityZ)})};return u("div",{className:P("AdvancedJogControl","h-full",i),children:x(U,{className:"gap-2 px-3 py-2.5",children:[u(Ag,{subject:t("move.menu.title.planeConstJog")}),x(U,{className:"w-full gap-2",children:[u(me,{label:t("program.field.label.sensorType"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(oe,{name:"forceType",control:c,render:({field:h})=>u(ae,{className:"w-full",size:"sm",...h,onChange:g=>{h.onChange(He(g.target.value,0))},children:iSt.map(g=>u(J,{value:g.value,children:t(g.label)},g.label))})})}),u(me,{label:t("program.field.frameSelection"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(oe,{name:"frameType",control:c,render:({field:h})=>u(ae,{className:"w-full",size:"sm",...h,onChange:g=>{h.onChange(He(g.target.value,0))},children:sSt.map(g=>u(J,{value:g.value,children:t(g.label)},g.label))})})}),u(me,{label:t("move.field.label.sensitivity"),labelClassName:"[&_[data-slot='text-label-text']]:text-fg-subtle",children:u(U,{className:"gap-2",children:oSt.map(h=>x(U,{alignItems:"flex-start",className:"w-full flex-1 gap-1",children:[u("span",{className:P("typo-compact-xs-medium",xi[h.label.toLowerCase()]),children:t(h.label)}),u(H,{className:"w-full gap-2",alignItems:"center",children:u(oe,{name:h.name,control:c,render:({field:g})=>x(H,{className:"w-full gap-2",alignItems:"center",children:[u(Ms,{value:[g.value],min:0,max:1,step:.01,onValueChange:m=>g.onChange(m[0])}),x("span",{className:"typo-compact-xs-normal text-fg-default w-8 text-center",children:[(g.value*100).toFixed(0),"%"]})]})})})]},h.label))})}),x(H,{className:"mt-2 w-full gap-1.5",children:[u(se,{className:"typo-compact-xs-semibold w-full",size:"sm",variant:n==="light"?"danger":"soft",loading:a,onClick:()=>r(),children:t("move.button.stop")}),u(se,{className:"typo-compact-xs-semibold w-full",size:"sm",variant:"brand",loading:o,onClick:l(d),children:t("move.button.start")})]})]})]})})},{useCallback:QS,useEffect:aSt,useMemo:dv,useRef:lSt,useState:ZS}=await F("react"),cSt=({className:i,robotModel:e})=>{const{t}=q(),n=lSt(null),s=Zk(n),{data:o}=As(),[r]=xc(),{isUseSimulator:a,selectedRobotModel:l,setSelectedRobotModel:c}=ui(),[d,h]=ZS("global"),{data:g}=Ph(),m=IA(e,Object.keys(g?.components??{}).length),{detailRobotModel:f,ghostActiveTcpAnchors:p,ghostDraggableJointNames:_,isGhostRobotSupported:b,isJointOnlyGhost:v,disabledGizmoTypes:w}=hoe(e),y=b||v,S=dv(()=>Object.entries(g?.components??{}).flatMap(([Dn,Lr])=>(Lr.tcpJointName??[]).map(tf=>({componentModel:Dn,jointName:tf}))),[g]),C=goe(),{isGhostRobot:N,gizmoType:k,handleGizmoTypeChange:L}=C,D=v?k==="none"?"none":null:k,T=LMe(),{baseAssets:E,toolAssets:R,gizmoSelectedAssetIds:A,selectionMode:M,assetGizmoMode:O,setAssetGizmoMode:B,clearGizmoSelection:z,workspaceControlProps:Y,requestMenuId:$,requestMenuToken:Z,sceneHandlers:K,viewerProps:V}=xpt({detailRobotModel:f,tcpJoints:S,urdfViewerRef:n,assetGizmoDisabled:N||T.isActive,assetPicker:T}),fe=mCt({urdfViewerRef:n,baseAssets:E,toolAssets:R,picker:T}),[Q,re]=ZS(!1),[ve,_e]=ZS(!1),[Le,Ie]=ZS(0),[Te,lt]=ZS("off"),[it,Ct]=ZS([]),{viewerProps:ft,itemProps:Xt,handleCheckFeatureSupport:Mt}=Ywt({urdfViewerRef:n,isGhostRobot:N,gizmoType:D}),{userfSelectionNo:Ht,toolSelectionNo:Mn,statusIsRefon:Cs,carteXRef:or,jointQRef:ge,toolName:Ue,motionMode:Ee}=ws(e,Dn=>({userfSelectionNo:Dn.userfSelectionNo,toolSelectionNo:Dn.toolSelectionNo,statusIsRefon:Dn.statusIsRefon,carteXRef:Dn.carteXRef,jointQRef:Dn.jointQRef,toolName:Dn.toolName,motionMode:Dn.motionMode})),Ne=ge?.length??7,le=dv(()=>DCt(Ne,Ht,Mn),[Ne,Ht,Mn]),{data:Pe}=Xk({robot_model:e}),{pluginData:Re}=NA({robotModel:e,paintJointPath:ve?{recording:!0,maxAgeSeconds:Le}:void 0,options:{baseAssets:E,toolAssets:R,onAssetLoad:Mt,onAssetTransformUpdate:Mt}}),{selectedRobot:We,coreSwList:ct}=Fi(e),gn=We?.connected==="DISCONNECT",{mutate:$n}=Bpt(),Ln=r.get("menu")??"jog",yi=Cs===1,oi=dv(()=>Ee!==0,[Ee]),{viewerProps:Xn,itemProps:go}=pCt(fe,oi),wo=dv(()=>{if(d==="user")return Pe?.user_frames.filter((Dn,Lr)=>Lr===Ht).map(Dn=>({name:Dn.userfName,showLabel:!0,position:{x:Dn.userfOffset.v[0]/Pn,y:Dn.userfOffset.v[1]/Pn,z:Dn.userfOffset.v[2]/Pn},rotation:{rx:Dn.userfEuler.v[0],ry:Dn.userfEuler.v[1],rz:Dn.userfEuler.v[2]}}))},[Pe,Ht,d]),Kr=dv(()=>Pe?.user_frames.map(Dn=>Dn.userfName)??nMe.user_frames.map(Dn=>Dn.userfName),[Pe?.user_frames]),hl=Dn=>{$n({robot_model:e,refcontrol_option:Dn==="real"?1:0})},da=()=>{re(Dn=>!Dn)},gl=QS(Dn=>{Dn.isDrawTrajectory!==void 0&&_e(Dn.isDrawTrajectory),Dn.maxAgeSeconds!==void 0&&Ie(Dn.maxAgeSeconds)},[]),{ghostJointValues:jo,handleGhostRobotJointsChanged:Vh}=moe(N),Ts=zPe({robotModel:e,urdfViewerRef:n,carteXRef:or,jointQRef:ge,toolName:Ue,isDisconnected:gn,jointOnly:v,ghostJointValuesRad:jo}),ad=QS(Dn=>{L(Dn),Dn==="surfaceTeach"&&z()},[L,z]),{viewerProps:Gd,itemProps:$u}=foe({gizmo:C,ghostRobotIK:Ts,isMoving:oi,gizmoType:D,onGizmoTypeChange:ad,activeTcpAnchors:p,draggableJointNames:_,onGhostRobotJointsChanged:v?Vh:void 0}),{onGhostRobotChange:ua}=$u,{onMeasureActiveChange:es}=go,Lt=QS(Dn=>{Dn&&fe.isMeasureActive&&es(!1),ua(Dn)},[ua,es,fe.isMeasureActive]),Ei=QS(Dn=>{Dn&&N&&ua(!1),es(Dn)},[ua,es,N]),Ss=QS(Dn=>{const Lr=g?.components;if(!Lr||Object.keys(Lr).length<=1)return;for(const Dr of Dn.pathJointNames)for(const[Tr,ha]of Object.entries(Lr))if((ha.type==="array"?ha.mapper:Object.values(ha.mapper)).includes(Dr)||ha.tcpJointName?.includes(Dr)){Tr!==l&&c(Tr);return}for(const Dr of Dn.pathLinkNames)for(const[Tr,ha]of Object.entries(Lr)){const cn=(ha.type==="array"?ha.mapper:Object.values(ha.mapper))[0];if(cn){const Me=cn.charAt(0);if(Dr.startsWith(`${Me}link`)){Tr!==l&&c(Tr);return}}}if(Dn.pathLinkNames.some(Dr=>/^(mobile|amr|base_link|wheel)/i.test(Dr))){const Dr=ct?.find(Tr=>Tr.be_service==="amr"||/amr|mobile/i.test(Tr.model)||/amr|mobile/i.test(Tr.sw_name));if(Dr&&Dr.model!==l){c(Dr.model);return}}},[g,l,c,ct]),Pi=QS(Dn=>{Dn.chartMode!==void 0&&lt(Dn.chartMode)},[]);aSt(()=>{Ln==="jog"&&Q&&re(!1)},[Ln,Q]);const Jr=dv(()=>[{key:"zoom-in-out",element:u(H1,{onZoomIn:s.zoomIn,onZoomOut:s.zoomOut})},{key:"camera-view",element:u(xA,{onSetCameraView:s.setCameraView})},{key:"trajectory",element:u(kMe,{handleChangeDrawTrajectory:gl})},...y?[{key:"ghost-robot",element:u(q9,{...$u,...Xt,onGhostRobotChange:Lt,disabledGizmoTypes:w,gizmoOptionsDisabled:v})}]:[],{key:"measure-distance",element:u(aCt,{...go,onMeasureActiveChange:Ei})},{key:"state-core-chart",element:u(RCt,{chartGroups:le,handleChangeStateCoreChart:Pi,onSelectedChannelIdsChange:Ct})}],[s.zoomIn,s.zoomOut,s.setCameraView,gl,y,w,v,$u,Xt,Lt,go,Ei,Pi,le]),Oa=dv(()=>[{id:"jog",label:t("move.menu.button.label.jog"),icon:u(pK,{}),content:u(fJ,{robotModel:e,onTabChange:h})},{id:"advenced-jog",label:t("move.menu.button.label.advJog"),icon:u(pK,{}),content:u(rSt,{robotModel:e})},{id:"tcp-tool",label:t("move.menu.button.label.tcpTool"),icon:u(iYe,{}),content:u(Ypt,{robotModel:e})},{id:"gripper",label:t("move.menu.button.label.gripper"),icon:u(ZKe,{}),content:u(svt,{robotModel:e})},{id:"zero-pose",label:t("move.menu.button.label.zeroPose"),icon:u($De,{}),content:u(t_t,{robotModel:e})},{id:"global-pinpoint",label:t("move.menu.button.label.pinpoint"),icon:u(Pje,{}),content:u(gvt,{robotModel:e})},{id:"record",label:t("move.menu.button.label.record"),icon:u(Rje,{}),content:u(Yyt,{robotModel:e})},{id:"weld",label:t("move.menu.button.label.weld"),icon:u(Mje,{className:"rotate-180"}),content:u(rwt,{robotModel:e})},{id:"calibration",label:t("move.menu.button.label.calibration"),icon:u(jDe,{}),content:u(Uwt,{robotModel:e,userFrameNameList:Kr})},{id:"move-io",label:t("settings.menu.title.io"),icon:u(TKe,{}),content:u(Zwt,{robotModel:e})},{id:"master",label:t("move.menu.button.label.masterMode"),icon:u(fJe,{className:"size-5"}),content:u(NCt,{robotModel:e})},{id:"workspace",label:t("move.menu.button.label.assetManager"),icon:u(jJe,{className:"size-5"}),content:null}],[t,e,h,Kr]),Fa=dv(()=>({id:"workspace",content:u(zyt,{...Y,isMenuActive:Ln==="workspace"})}),[Y,Ln]);return x(o6,{className:P("ManipulateMove","relative overflow-hidden",i),rightIconPanels:Jr,menus:Oa,persistentMenu:Fa,beService:o?.modelInfo?.be_service,requestMenuId:$,requestMenuToken:Z,children:[x("div",{className:"h-full flex-1 p-2.5",children:[x("div",{className:"absolute top-0 left-0 z-1 size-full",...K,children:[u(Ym,{ref:n,className:"relative size-full",cameraPositionKey:"manipulate-move",showPerformanceHUD:!0,...V,robotModel:o?.info?.robotModel,etcAxesArr:wo,enablePanning:!0,plugin:Re,isRealMode:yi,outlinedLinkNames:m,...Gd,...ft,...Xn,onDoubleClickRobot:Ss}),A.length===1&&!M&&Ln==="workspace"&&u("div",{className:"animate-in fade-in absolute top-78 left-3 z-20 duration-200",children:u(yCt,{mode:O,onModeChange:B,modes:[...E,...R].find(Dn=>Dn.id===A[0])?.source.kind==="file"?["translate","rotate"]:["translate","rotate","scale"]})})]}),x(U,{className:"pointer-events-none relative z-2 h-full",children:[u(tCt,{className:"pointer-events-auto",robotModel:e,mode:yi?"real":"simulation",onChangeMode:hl}),u(SA,{className:"mt-3 mb-4",robotModel:e}),u(NMe,{className:"pointer-events-auto",robotModel:e},e),u(IMe,{className:"pointer-events-auto",robotModel:e})]})]}),u($9,{isGhostRobot:N,ghostRobotIK:Ts,btnHoverInteraction:$k.isDesktop,showControlPanelButton:Ln!=="jog",onToggleControlPanel:da,isPanelOpen:Ln!=="jog"&&Q,panelContent:u(fJ,{className:"w-full",robotModel:e,onTabChange:()=>{},isPanel:!0,isUseSimulator:a})}),u(J1t,{className:"bg-translucent pointer-events-auto absolute bottom-2 left-2 z-2 w-[calc(100%-12rem)] rounded-md p-2.5",chartMode:Te,groups:le,selectedChannelIds:it,robotModel:e})]})},{useEffect:dSt,useMemo:_F,useState:uSt}=await F("react"),hSt={dir:"all",method:"all"},gSt=(i,e)=>{const t=e.dir==="all"||e.dir==="forward"&&i.dir==="FORWARD"||e.dir==="reverse"&&i.dir==="REVERSE",n=e.method==="all"||i.method===e.method;return t&&n},mSt=({nodes:i,selectedLinks:e,focusedLinkId:t,onLinkVisibilityFilterChange:n})=>{const[s,o]=uSt(hSt),r=_F(()=>e.filter(d=>gSt(d,s)),[s,e]),a=_F(()=>t?r.find(d=>d.id===t)??null:null,[t,r]),l=_F(()=>r.map(d=>{const h=i.find(m=>m.id===d.from),g=i.find(m=>m.id===d.to);return{id:d.id,title:`${h?.name||d.from} -> ${g?.name||d.to}`,dir:d.dir,method:d.method,speed:d.speed}}),[i,r]),c=_F(()=>{if(!a)return null;const d=i.find(g=>g.id===a.from),h=i.find(g=>g.id===a.to);return!d||!h?null:new Ve((d.x+h.x)/2,(d.y+h.y)/2,(d.z+h.z)/2)},[i,a]);return dSt(()=>{n?.(s)},[s,n]),{linkVisibilityFilter:s,setLinkVisibilityFilter:o,visibleSelectedLinks:r,visibleFocusedLink:a,selectedLinkOverlayItems:l,focusedLinkAnchor:c}},{useMemo:bF}=await F("react"),fSt=i=>{if(!i||i.length===0)return null;let e=0,t=0,n=0;for(let o=0;o<i.length;o+=1){const r=i[o],a=i[(o+1)%i.length],l=r.x*a.y-a.x*r.y;e+=l,t+=(r.x+a.x)*l,n+=(r.y+a.y)*l}if(Math.abs(e)>Number.EPSILON)return new Ve(t/(3*e),n/(3*e),0);const s=i.reduce((o,r)=>({x:o.x+r.x,y:o.y+r.y}),{x:0,y:0});return new Ve(s.x/i.length,s.y/i.length,0)},pSt=({zones:i,selectedZoneIds:e,focusedZoneId:t})=>{const n=bF(()=>{if(!e||e.length===0)return[];const a=new Set(e);return(i??[]).filter(l=>a.has(l.id))},[e,i]),s=bF(()=>n.length===0?null:t?n.find(a=>a.id===t)??null:n[0]??null,[t,n]),o=bF(()=>n.map(a=>({id:a.id,title:a.name||a.id,type:a.type,pointCount:a.polygon.length})),[n]),r=bF(()=>s?fSt(s.polygon):null,[s]);return{selectedZones:n,focusedZone:s,selectedZoneOverlayItems:o,focusedZoneAnchor:r}},{useMemo:_St}=await F("react"),{useQuery:bSt}=await F("@tanstack/react-query"),xAe="/{robot_model}/setting/getSettingPresetList",vSt=async({robot_model:i,baseURL:e})=>{const t=xAe.replace("{robot_model}",i);return sb.get(t,void 0)},ySt=({robot_model:i,baseURL:e})=>[xAe,i,e??""],wSt=(i,e={},t)=>{const n=_St(()=>ySt({...i,baseURL:t}),[t,i]);return{...bSt({queryKey:n,queryFn:()=>vSt({...i,baseURL:t}),enabled:!!i.robot_model,...e}),queryKey:n}},{useMemo:CSt}=await F("react"),{useQuery:SSt}=await F("@tanstack/react-query"),NAe="/{robot_model}/info/category",xSt=async({robot_model:i})=>{const e=NAe.replace("{robot_model}",i);return sb.get(e)},NSt=({robot_model:i})=>[NAe,i],ISt=(i,e={})=>{const{robot_model:t}=i,{enabled:n=!0,...s}=e,o=CSt(()=>NSt({robot_model:t}),[t]);return{...SSt({queryKey:o,queryFn:()=>xSt(i),enabled:!!t&&n,...s}),queryKey:o}},{useMemo:kSt}=await F("react"),{useQuery:LSt}=await F("@tanstack/react-query"),IAe="/{robot_model}/setting/getSettingPreset",DSt=async({robot_model:i,level:e,presetId:t,baseURL:n})=>{const s=IAe.replace("{robot_model}",i);return sb.get(s,{params:{level:e,presetId:t}})},TSt=({robot_model:i,level:e,presetId:t,baseURL:n})=>[IAe,i,e,t,n??""],ESt=(i,e={},t)=>{const{robot_model:n,level:s,presetId:o}=i,r=kSt(()=>TSt({robot_model:n,level:s,presetId:o,baseURL:t}),[t,s,o,n]);return{...LSt({queryKey:r,queryFn:()=>DSt({...i,baseURL:t}),enabled:!!n&&typeof s=="number"&&!Number.isNaN(s)&&typeof o=="number"&&!Number.isNaN(o),...e}),queryKey:r}},{useMemo:nVn}=await F("react"),{useQuery:iVn}=await F("@tanstack/react-query"),{useMemo:sVn}=await F("react"),{useQuery:oVn}=await F("@tanstack/react-query"),{useQuery:PSt}=await F("@tanstack/react-query"),Toe="/{robot_model}/map/list",RSt=({robot_model:i,baseURL:e})=>[Toe,i,""],MSt=async({robot_model:i,baseURL:e})=>{const t=Toe.replace("{robot_model}",i);return sb.get(t,{})},ASt=({robot_model:i,enabled:e=!0},t={},n)=>{const{enabled:s=!0,...o}=t,r=RSt({robot_model:i,baseURL:n});return{...PSt({queryKey:r,queryFn:()=>MSt({robot_model:i,baseURL:n}),enabled:!!i&&e&&s,...o}),queryKey:r}},{useCallback:VD,useEffect:OSt,useMemo:FSt,useRef:o_e}=await F("react"),BSt=({robotModel:i,linearSpeed:e=.8,rotationSpeed:t=45})=>{const{socketEventEmit:n}=Mg(),s=o_e({vx:0,vy:0,wz:0}),o=o_e(null),r=FSt(()=>`amr/${i}/move/jog`,[i]),a=VD(()=>{n(r,{...s.current})},[r,n]),l=VD(()=>{typeof window>"u"||o.current&&(window.clearInterval(o.current),o.current=null)},[]),c=VD(()=>{typeof window>"u"||o.current||(o.current=window.setInterval(()=>{a()},200))},[a]),d=VD(g=>{switch(g){case"forward":s.current={vx:e,vy:0,wz:0};break;case"backward":s.current={vx:-e,vy:0,wz:0};break;case"left":s.current={vx:0,vy:e,wz:0};break;case"right":s.current={vx:0,vy:-e,wz:0};break;case"rotateLeft":s.current={vx:0,vy:0,wz:t};break;case"rotateRight":s.current={vx:0,vy:0,wz:-t};break;default:s.current={vx:0,vy:0,wz:0}}a(),g==="stop"?l():c()},[a,e,t,c,l]),h=VD(({type:g,data:m})=>{const f=Number((m.normalizedDistance.y*e).toFixed(2)),p=Number((m.normalizedDistance.x*e*-1).toFixed(2)),_=Math.max(-1,Math.min(1,m.normalizedDistance.x)),b=Number((_*-t).toFixed(0));g==="direction"?(s.current.vx=f,s.current.vy=p):s.current.wz=b,a()},[a,e,t]);return OSt(()=>()=>{l()},[l]),{handleJoystickMove:h,handleButtonMove:d}},VSt={obsBoxMinX:0,obsBoxMaxX:0,obsBoxMinY:0,obsBoxMaxY:0,stopMarginX:0,stopMarginY:0,slowMarginX:0,slowMarginY:0},r_e={layers:[],width:0,height:0,gridSize:0,safety:VSt},zSt=(i,e=!0)=>{const{data:t=r_e,loading:n}=ls(`amr/${i}/socket/obsMap`,{defaultValue:r_e,disabled:!e,selector:s=>({layers:s?.layers?.map(o=>({name:o?.name??"",data:o?.data??[]}))??[],width:s?.width??0,height:s?.height??0,gridSize:s?.gridSize??0,safety:{obsBoxMinX:s?.safety?.obsBoxMinX??0,obsBoxMaxX:s?.safety?.obsBoxMaxX??0,obsBoxMinY:s?.safety?.obsBoxMinY??0,obsBoxMaxY:s?.safety?.obsBoxMaxY??0,stopMarginX:s?.safety?.stopMarginX??0,stopMarginY:s?.safety?.stopMarginY??0,slowMarginX:s?.safety?.slowMarginX??0,slowMarginY:s?.safety?.slowMarginY??0}})});return{data:t,loading:n}},{useRef:WSt}=await F("react"),a_e={data:[]},HSt=(i,e=!0)=>{const{data:t=a_e,loading:n}=ls(`amr/${i}/socket/globalPath`,{defaultValue:a_e,disabled:!e,selector:o=>({data:o?.data??[]})}),s=WSt({...t,loading:n});return s.current.data=t.data,n!==s.current.loading&&(s.current.loading=n),s.current},{useRef:$St}=await F("react"),l_e={data:[]},USt=(i,e=!0)=>{const{data:t=l_e,loading:n}=ls(`amr/${i}/socket/trajectory`,{defaultValue:l_e,disabled:!e,selector:o=>({data:o?.data??[]})}),s=$St({...t,loading:n});return s.current.data=t.data,n!==s.current.loading&&(s.current.loading=n),s.current},{useRef:jSt}=await F("react"),c_e={data:[]},GSt=(i,e=!0)=>{const{data:t=c_e,loading:n}=ls(`amr/${i}/socket/localPath`,{defaultValue:c_e,disabled:!e,selector:o=>({data:o?.data??[]})}),s=jSt({...t,loading:n});return s.current.data=t.data,n!==s.current.loading&&(s.current.loading=n),s.current},{forwardRef:qSt}=await F("react"),kAe=qSt(({robotModel:i,...e},t)=>{const{data:n}=$Re(i),{data:s}=HSt(i),{data:o}=GSt(i),{data:r}=USt(i);return u(LDe,{ref:t,...e,lidarPoints:n,globalPath:s,localPath:o,trajectory:r})});kAe.displayName="AmrWorldStudio";const{useMutation:KSt}=await F("@tanstack/react-query"),JSt="/{robot_model}/map/setCloud",YSt=async({robot_model:i,mapName:e,fileName:t,data:n})=>{const s=JSt.replace("{robot_model}",i);return Ls.post(s,{mapName:e,fileName:t,data:n})},XSt=()=>KSt({mutationFn:YSt}),{useMutation:QSt}=await F("@tanstack/react-query"),ZSt="/{robot_model}/map/setTopology",ext=async({robot_model:i,mapName:e,nodes:t,links:n,zones:s})=>{const o=ZSt.replace("{robot_model}",i);return Ls.post(o,{mapName:e,nodes:t,links:n,zones:s})},txt=()=>QSt({mutationFn:ext}),{useCallback:iU}=await F("react"),nxt=i=>typeof i=="object"&&i!==null&&"isError"in i&&i.isError===!0,ixt=({selectedRobotModel:i,currentMapName:e,getMapPointsData:t,getTopologyData:n,loadMapAndRefreshCurrentMap:s,loadTopology:o,refreshTopologyData:r,onTopologySaved:a,onTopologyCanceled:l,onCloudSaved:c})=>{const{mutate:d}=XSt(),{mutate:h,isPending:g}=txt(),m=iU(()=>{if(!e)return;const _=n();h({robot_model:i,mapName:e,nodes:_.nodes,links:_.links,zones:_.zones},{onSuccess:async()=>{try{await o(e),a?.(),rt.openToast({type:"basic",variant:"success",title:"Topology Save Success",content:"Topology data has been saved"})}catch{rt.openToast({type:"basic",variant:"warning",title:"Topology Load Failed",content:"Topology was saved, but failed to load"})}}})},[e,n,o,a,h,i]),f=iU(async()=>{try{const _=await r?.();if(nxt(_))throw _.error;l?.()}catch{rt.openToast({type:"basic",variant:"warning",title:"Topology Cancel Failed",content:"Failed to revert topology changes"})}},[l,r]),p=iU(()=>{if(!e)return;const _=t();d({robot_model:i,mapName:e,fileName:"cloud.csv",data:_},{onSuccess:()=>{s(e),c?.(),rt.openToast({title:"Cloud Save Success",content:"Cloud data has been saved",type:"basic",variant:"success"})}})},[e,t,s,c,d,i]);return{handleSaveTopologyChanges:m,handleCancelTopologyChanges:f,handleSaveCloud:p,isTopologySaving:g}},{useMemo:sxt}=await F("react"),oxt=({currentMapName:i,mapListData:e})=>({currentMapInfo:sxt(()=>i&&e?.list?e.list.find(n=>n.mapName===i):null,[i,e?.list])}),{useMemo:rxt}=await F("react"),{useQuery:axt}=await F("@tanstack/react-query"),LAe="/{robot_model}/map/getCloudStream",lxt=async({robot_model:i,mapName:e,fileName:t,chunkSize:n})=>{const s=LAe.replace("{robot_model}",i);return Ls.get(s,{params:{mapName:e,fileName:t,chunkSize:n},headers:{Accept:"application/octet-stream"},responseType:"arraybuffer"})},cxt=(i,e={})=>{const t=rxt(()=>[LAe,i],[i]);return{...axt({queryKey:t,queryFn:()=>lxt(i),...e}),queryKey:t}},dxt=({selectedRobotModel:i,mapName:e="",pointCloudFormat:t})=>{const n=t==="csv",s=t==="las",{data:o,dataUpdatedAt:r}=GRe({robot_model:i,mapName:e,fileName:"cloud.csv"},{enabled:!!e&&n}),{data:a}=cxt({robot_model:i,mapName:e,fileName:"map.las"},{enabled:!!e&&s}),{data:l,dataUpdatedAt:c,refetch:d}=HRe({robot_model:i,mapName:e},{enabled:!!e});return{mapCloud:n?o:void 0,mapCloudUpdatedAt:n?r:0,mapCloudStream:s?a:void 0,topology:l,topologyUpdatedAt:c,refetchTopology:d}},{useEffect:uxt,useRef:hxt,useState:gxt}=await F("react"),d_e={data:null,error:null,loading:!1},mxt=i=>{const[e,t]=gxt(d_e),n=hxt(0);return uxt(()=>{if(!i){n.current+=1,t(d_e);return}const s=n.current+1;n.current=s,t({data:null,error:null,loading:!0});const o=new Worker(new URL("/assets/parseLasPointCloud.worker-BZeU-mt8.js",import.meta.url),{type:"module"});o.onmessage=a=>{n.current===a.data.id&&(a.data.type==="success"?t({data:a.data.data,error:null,loading:!1}):t({data:null,error:new Error(a.data.message),loading:!1}),o.terminate())},o.onerror=a=>{n.current===s&&t({data:null,error:new Error(a.message),loading:!1}),o.terminate()};const r=i.slice(0);return o.postMessage({id:s,buffer:r},[r]),()=>{o.terminate()}},[i]),e},{useMemo:fxt}=await F("react"),pxt=({currentMapName:i,createdAt:e,lastModified:t,mapCloudCount:n,mapBounds:s,topologyCount:o,nodeTypeCounts:r,mappingStatus:a,elapsedSeconds:l,completedKeyframeCount:c,totalKeyframePoints:d,onStartMapping:h,onStopMapping:g,onSaveMapping:m,onDiscard:f,mapList:p,isEraserEnabled:_,onEraserToggle:b,eraserRadius:v,setEraserRadius:w,eraseSelectedAreaDisabled:y,onEraseSelectedArea:S,onReleaseSelectedPoints:C,onSaveChanges:N,hasUnsavedCloudChanges:k,onDiscardCloudChanges:L,onLoadMap:D,loadMapDisabled:T,onDownloadMap:E,downloadMapDisabled:R})=>fxt(()=>({mapInfoProps:{currentMapName:i,createdAt:e,lastModified:t,mapCloudCount:n,mapBounds:s,topologyCount:o,nodeTypeCounts:r},mappingTabProps:{mappingStatus:a,elapsedSeconds:l,completedKeyframeCount:c,totalKeyframePoints:d,onStartMapping:h,onStopMapping:g,onSaveMapping:m,onDiscard:f,mapList:p},eraserTabProps:{isEraserEnabled:_,onEraserToggle:b,eraserRadius:v,setEraserRadius:w,eraseSelectedAreaDisabled:y,onEraseSelectedArea:S,onReleaseSelectedPoints:C,onSaveChanges:N},hasUnsavedCloudChanges:k,onDiscardCloudChanges:L,onLoadMap:D,loadMapDisabled:T,onDownloadMap:E,downloadMapDisabled:R}),[c,e,i,l,v,y,k,_,t,s,n,r,f,L,D,E,S,b,C,N,m,h,g,w,T,a,R,o,p,d]),{queryOptions:_xt,useQueries:bxt,useQuery:vxt}=await F("@tanstack/react-query"),DAe="/{robot_model}/setting/getSettingParam",TAe=async i=>{const{robot_model:e,...t}=i,n=DAe.replace("{robot_model}",e);return Ls.get(n,{params:t})},EAe=i=>[DAe,i],yxt=(i,e=!0)=>_xt({queryKey:EAe(i),queryFn:()=>TAe(i),enabled:e}),wxt=(i,e={})=>vxt({queryKey:EAe(i),queryFn:()=>TAe(i),...e}),Cxt=({robot_model:i,robotType:e,categories:t,level:n=2,enabled:s=!0})=>bxt({queries:t.map(o=>yxt({robot_model:i,robotType:e,category:o,level:n},s&&!!i&&!!e&&!!o))}),{useMemo:u_e}=await F("react"),Sxt=({robotModel:i,monitorStatusSnapshot:e,robotVersion:t,selectedTool:n,onToolChange:s,onStartLocalization:o,onInitLocalization:r,onSemiAutoInitLocalization:a,onStopLocalization:l,onBuildInfoOpenChange:c,onDock:d,onDockPause:h,onDockResume:g,onDockStop:m,onUndock:f,dockRejectMessage:p,taskLogData:_,amrMoveStatus:b,onSetMotorLocked:v,onClearSafetyFlag:w,onLidarFieldSave:y,onOssdDetectChange:S,safetyIo:C,safetyIoLoading:N,onSetSafetyIo:k})=>{const{data:L}=wxt({robot_model:i,robotType:i,category:"docking",level:2}),D=u_e(()=>{const T=L?.params?.find(E=>E.key==="DOCKING_RETRY_COUNT")?.value;return T!==void 0?Number(T):void 0},[L]);return u_e(()=>({robotModel:i,overviewProps:{amrStatus:e,robotVersion:t,selectedTool:n,onStartLocalization:o,onInitLocalization:r,onSemiAutoInitLocalization:a,onStopLocalization:l,onToolChange:s,onBuildInfoOpenChange:c},dockProps:{amrStatus:e,onDock:d,onPause:h,onResume:g,onStop:m,onUndock:f,maxRetryCount:D,rejectMessage:p??void 0},taskProps:{logData:_,moveStatus:b},pduProps:{amrStatus:e,setMotorLocked:v,onClearSafetyRecovery:w,onLidarFieldSave:y,onOssdDetectChange:S,safetyIo:C,safetyIoLoading:N,onSetSafetyIo:k}}),[b,D,e,t,w,y,S,C,N,k,d,h,g,p,m,c,r,a,v,o,l,s,f,n,_,i])},{useMemo:xxt}=await F("react"),Nxt=({overviewTabProps:i,nodeTabProps:e,linkTabProps:t,zoneTabProps:n})=>xxt(()=>({overviewTabProps:i,nodeTabProps:e,linkTabProps:t,zoneTabProps:n}),[t,e,i,n]),{useCallback:Bl}=await F("react"),Ixt=({emit:i,nodes:e,selectedObjects:t,selectedNodeType:n,onToolChange:s,setIsEraserEnabled:o,setEraserRadius:r})=>{const{createLinks:a,setLinkCreationSettings:l}=Oqe(),c=Bl(T=>{o(T),i("ui:eraser-toggle-requested",T),i("ui:pointer-action-set-requested",T?"erase":"inspect"),s(T?"disabled":"select")},[i,s,o]),d=Bl(()=>{i("ui:points-delete-requested",void 0)},[i]),h=Bl(()=>{i("ui:unselect-points-requested",void 0)},[i]),g=Bl(T=>{T>0&&(r(T),i("eraser:radius-changed",T))},[i,r]),m=Bl(T=>{switch(T){case"goal":return"GOAL";case"route":return"ROUTE";case"align":return"ALIGN"}},[]),f=Bl(()=>{i("ui:quick-add-node-requested",m(n))},[i,m,n]),p=Bl(()=>{i("ui:add-node-by-preview-requested",m(n))},[i,m,n]),_=Bl(()=>{const T=e[e.length-1]?.uuid;T&&(i("ui:selection-reset-requested",void 0),i("ui:node-selected",{nodeId:T,intent:"replace"}),i("ui:nodes-delete-requested",void 0))},[i,e]),b=Bl(()=>{const T=t[t.length-1]?.uuid??null;T&&(i("ui:selection-reset-requested",void 0),i("ui:node-selected",{nodeId:T,intent:"replace"}),i("ui:nodes-delete-requested",void 0))},[i,t]),v=Bl((T,E)=>{i("ui:node-updated",{nodeId:T,updates:E})},[i]),w=Bl((T,E)=>{i("ui:node-type-change-requested",{nodeId:T,type:m(E)})},[i,m]),y=Bl((T,E,R)=>{i(R==="delta"?"ui:nodes-transform-delta-requested":"ui:nodes-transform-absolute-requested",{target:T,value:E})},[i]),S=Bl((T,E,R)=>{if(!(t.length<2)){if(t.length===2||E==="sequential"){i("ui:link-nodes-requested",{nodes:t,strategy:"sequential",bidirectional:T,properties:R});return}i("ui:link-nodes-requested",{nodes:t,strategy:"complete",bidirectional:T,properties:R})}},[i,t]),C=Bl(()=>{a(S)},[a,S]),N=Bl(()=>{t.length<2||i("ui:unlink-nodes-requested",void 0)},[i,t]),k=Bl((T,E)=>{i("ui:link-updated",{linkId:T,updates:E})},[i]),L=Bl(T=>{i("ui:link-delete-requested",{linkId:T})},[i]),D=Bl(T=>{i("ui:link-focus-requested",{linkId:T})},[i]);return{handleEraserToggle:c,handleDeletePoints:d,handleReleasePoint:h,handleEraserRadiusChange:g,handleAddNodeAtRobot:f,handleAddNodeAtCursor:p,handleDeleteLastNode:_,handleDeleteLastSelectedNode:b,handleNodeUpdate:v,handleNodeTypeChange:w,handleSelectedNodesTransform:y,handleCreateLinks:S,handleCreateLinksByShortcut:C,setLinkCreationSettings:l,handleDeleteLinksBetweenSelected:N,handleLinkUpdate:k,handleLinkDelete:L,handleLinkFocus:D}},{useQuery:rVn}=await F("@tanstack/react-query"),kxt="/{robot_model}/capability/lidar2d",Lxt=async({robot_model:i})=>{const e=kxt.replace("{robot_model}",i);return Ls.get(e)},{useCallback:vF}=await F("react"),Dxt=({type:i,features:e})=>i?.toUpperCase()==="GOAL"&&Array.isArray(e)&&e.some(t=>t.toUpperCase()==="INIT"),Txt=({selectedRobotModel:i,currentMapName:e,currentMapInfo:t,mapListData:n,topologyNodes:s,hasUnsavedTopologyChanges:o,handleInitLocalization:r,handleSemiAutoInitLocalization:a})=>{const l=vF(()=>!e||!!n?.list?.length&&!t?(rt.openToast({type:"basic",variant:"warning",title:"Map Not Loaded",content:"Load a map before running localization init.",position:"top-right"}),!1):!0,[t,e,n?.list]),c=vF(async()=>{if(!i)return!1;try{return(await Lxt({robot_model:i})).info?.some(f=>f.connection)??!1?!0:(rt.openToast({type:"basic",variant:"warning",title:"LiDAR Disconnected",content:"Connect the 2D LiDAR before running localization init.",position:"top-right"}),!1)}catch{return rt.openToast({type:"basic",variant:"warning",title:"LiDAR Status Check Failed",content:"Failed to check 2D LiDAR connection status.",position:"top-right"}),!1}},[i]),d=vF(async()=>{l()&&await c()&&r()},[c,l,r]),h=vF(async()=>{if(!l()||!await c())return;if(o){rt.openToast({type:"basic",variant:"warning",title:"Unsaved Topology Changes",content:"Please save topology changes before running semi auto init.",position:"top-right"});return}if((s??[]).filter(Dxt).length===0){rt.openToast({type:"basic",variant:"warning",title:"Semi Auto Init Unavailable",content:"No goal node with INIT feature found in topology.",position:"top-right"});return}a()},[l,c,o,s,a]);return{handleInitLocalizationWithGuard:d,handleSemiAutoInitLocalizationWithGuard:h}},{useMutation:Ext}=await F("@tanstack/react-query"),Pxt="/{robot_model}/map/loadMap",Rxt=async({robot_model:i,mapName:e,baseURL:t})=>{const n=Pxt.replace("{robot_model}",i);return sb.post(n,{mapName:e},t?{baseURL:t}:void 0)},Mxt=()=>Ext({mutationFn:Rxt}),{useMutation:Axt}=await F("@tanstack/react-query"),Oxt="/{robot_model}/map/loadTopo",Fxt=async({robot_model:i,mapName:e,baseURL:t})=>{const n=Oxt.replace("{robot_model}",i);return sb.post(n,{mapName:e},t?{baseURL:t}:void 0)},Bxt=()=>Axt({mutationFn:Fxt}),{useMutation:Vxt}=await F("@tanstack/react-query"),zxt="/{robot_model}/localization/{command}",Wxt=async i=>{const{robot_model:e,command:t}=i,n=zxt.replace("{robot_model}",e).replace("{command}",t);return t==="semiAutoInit"?sb.post(n):sb.post(n,i.payload)},Hxt=()=>Vxt({mutationFn:Wxt}),{useMutation:$xt}=await F("@tanstack/react-query"),Uxt="/{robot_model}/setting/setSettingPreset";class zJ extends Error{constructor(e){super(e),this.name="SettingPresetRejectError"}}const jxt=i=>typeof i.result=="string"&&i.result.toLowerCase()!=="accept",Gxt=async i=>{const{robot_model:e,baseURL:t,...n}=i,s=Uxt.replace("{robot_model}",e),o=await sb.post(s,n,t?{baseURL:t}:void 0);if(jxt(o))throw new zJ(o.message||"setSettingPreset: 요청이 거절되었습니다.");return o},qxt=()=>$xt({mutationFn:i=>Gxt(i)}),{useMutation:aVn}=await F("@tanstack/react-query"),{useCallback:zD}=await F("react"),Kxt=({selectedRobotModel:i,getPreviewTransform:e})=>{const{mutate:t}=Hxt(),n=zD(l=>{const c=e();c&&t({robot_model:i,command:l,payload:{pose:c}})},[e,t,i]),s=zD(()=>{t({robot_model:i,command:"semiAutoInit"})},[t,i]),o=zD(()=>{n("start")},[n]),r=zD(()=>{n("init")},[n]),a=zD(()=>{n("stop")},[n]);return{handleStartLocalization:o,handleInitLocalization:r,handleSemiAutoInitLocalization:s,handleStopLocalization:a}},{useCallback:sU}=await F("react"),{useQueryClient:Jxt}=await F("@tanstack/react-query"),Yxt=({selectedRobotModel:i})=>{const e=Jxt(),{mutateAsync:t}=Mxt(),{mutateAsync:n}=Bxt(),s=sU(async a=>{const l=await t({robot_model:i,mapName:a});return e.invalidateQueries({queryKey:ioe({robot_model:i})}),l},[t,e,i]),o=sU(async a=>{const l=await n({robot_model:i,mapName:a});if(l.result!=="accept")throw new Error(l.message||"Failed to load topology");return l},[n,i]),r=sU(async a=>{await s(a)},[s]);return{loadMapAndRefreshCurrentMap:s,loadTopology:o,handleLoadMap:r}},Xxt=i=>{const{data:e}=ASt({robot_model:i});return{mapListData:e}},{useMutation:oU}=await F("@tanstack/react-query"),Qxt="/{robot_model}/mapping/start",Zxt="/{robot_model}/mapping/stop",eNt="/{robot_model}/mapping/save",tNt=i=>i==="accept",nNt=async({robot_model:i})=>{const e=Qxt.replace("{robot_model}",i);return Ls.post(e)},iNt=async({robot_model:i})=>{const e=Zxt.replace("{robot_model}",i);return Ls.post(e)},sNt=async({robot_model:i,mapName:e})=>{const t=eNt.replace("{robot_model}",i);return Ls.post(t,{mapName:e})},oNt=()=>{const i=oU({mutationFn:nNt}),e=oU({mutationFn:iNt});return{saveMapping:oU({mutationFn:sNt,onSuccess:n=>{if(tNt(n.result)){rt.openToast({type:"basic",variant:"success",title:"Map Save Success",content:"Map data has been saved",position:"top-right"});return}rt.openToast({type:"basic",variant:"warning",title:"Map Save Failed",content:n.message||"Failed to save map",position:"top-right"})},onError:()=>{rt.openToast({type:"basic",variant:"warning",title:"Map Save Failed",content:"Failed to save map",position:"top-right"})}}).mutateAsync,stopMapping:e.mutateAsync,startMapping:i.mutateAsync}},h_e={data:[],chunkNum:0,chunkId:0},rNt=(i,e=!0)=>{const{data:t=h_e,loading:n}=ls(`amr/${i}/socket/mappingKeyFRM`,{defaultValue:h_e,disabled:!e,selector:s=>({data:s?.data??[],chunkNum:s?.chunkNum??0,chunkId:s?.chunkId??0})});return{...t,loading:n}},{useCallback:WD,useEffect:yF,useRef:HD,useState:ex}=await F("react"),{useQueryClient:aNt}=await F("@tanstack/react-query"),g_e=i=>i==="accept",lNt=i=>i==="accept",cNt=({selectedRobotModel:i,emit:e,loadMapAndRefreshCurrentMap:t})=>{const n=aNt(),{data:s}=soe({robot_model:i}),o=s?.mapName,{startMapping:r,stopMapping:a,saveMapping:l}=oNt(),[c,d]=ex("idle"),h=HD("idle"),[g,m]=ex(null),[f,p]=ex(0),[_,b]=ex(!1),[v,w]=ex(0),[y,S]=ex(0),C=HD(null),N=HD(new Set),k=HD(new Map),L=HD(!1),{data:D}=URe(i,_),T=rNt(i,_);yF(()=>{h.current=c},[c]),yF(()=>{if(c!=="recording"||g===null)return;const B=window.setInterval(()=>{const z=Math.floor((Date.now()-g)/1e3);p(z)},1e3);return()=>{window.clearInterval(B)}},[g,c]);const E=WD(()=>{d("idle"),m(null),p(0),b(!1),w(0),S(0),C.current=null,N.current.clear(),k.current.clear(),L.current=!1},[]);yF(()=>{if(!_||h.current!=="recording"||!T||T.chunkNum<=0)return;const{chunkNum:B,chunkId:z,data:Y}=T;if(z<0||z>=B||((z===0||C.current===null||C.current!==B)&&(C.current=B,N.current.clear(),k.current.clear(),L.current=!1),L.current)||(N.current.add(z),k.current.set(z,Y.length),N.current.size!==B))return;const $=Array.from(k.current.values()).reduce((Z,K)=>Z+K,0);L.current=!0,w(Z=>Z+1),S(Z=>Z+$)},[T,_]);const R=WD(async()=>{if(h.current!=="idle")return!1;try{const B=await r({robot_model:i}),z=g_e(B.result);return z&&(d("recording"),m(Date.now()),p(0),b(!0),w(0),S(0),C.current=null,N.current.clear(),k.current.clear(),L.current=!1,e("ui:mapping-start-requested",void 0)),z}catch{return!1}},[e,i,r]),A=WD(async()=>{if(h.current!=="recording")return!1;try{const B=await a({robot_model:i}),z=g_e(B.result);return z&&(d("stopped"),b(!1)),z}catch{return!1}},[i,a]),M=WD(async B=>{if(h.current==="saving")return{ok:!1,reason:"save-failed"};d("saving");try{const z=await l({robot_model:i,mapName:B});if(n.invalidateQueries({queryKey:[Toe,i]}),!lNt(z.result))return d("stopped"),{ok:!1,reason:"save-failed"};try{return await t(B),E(),{ok:!0}}catch{return d("stopped"),{ok:!1,reason:"load-failed"}}}catch{return d("stopped"),{ok:!1,reason:"save-failed"}}finally{e("ui:mapping-stop-requested",void 0)}},[e,t,n,E,l,i]),O=WD(async()=>{const B=h.current;if(B!=="discarding"){d("discarding"),b(!1);try{if(B==="recording")try{await a({robot_model:i})}catch(z){console.error("Failed to stop mapping during discard:",z)}e("ui:mapping-stop-requested",void 0),o&&await t(o)}finally{E()}}},[o,e,t,E,i,a]);return yF(()=>()=>{const B=h.current;B!=="idle"&&(b(!1),e("ui:mapping-stop-requested",void 0),B==="recording"&&a({robot_model:i}))},[e,i,a]),{mappingPoints:D,mappingKeyFrame:T,mappingStatus:c,elapsedSeconds:f,mappingSocketEnabled:_,completedKeyframeCount:v,totalKeyframePoints:y,handleStartMapping:R,handleStopMapping:A,handleSaveMapping:M,handleDiscardMapping:O}},{useEffect:dNt,useRef:uNt}=await F("react"),{useQueryClient:hNt}=await F("@tanstack/react-query"),gNt=({robotModel:i,mapName:e})=>{const t=hNt(),n=uNt(void 0);dNt(()=>{if(!e){n.current=void 0;return}n.current!==e&&(n.current=e,t.invalidateQueries({queryKey:ioe({robot_model:i})}))},[e,t,i])};function mNt(i,e,t=!0){const{data:n,loading:s,isDefaultData:o}=ls(`amr/${i}/infoStatus`,{defaultValue:{infos:[]},selector:e,disabled:!t});return{data:n,loading:s,isDefaultData:o}}const PAe=/MCU\s*([0-9]+).*?(DIN|DIO|INPUT|OUTPUT|DI|DO|입력|출력|_IN|_OUT)[\s_-]*([0-9]+)/i,fNt=(i,e)=>{const t=i.toUpperCase();return t==="DIO"||t==="DO"?t:t==="DIN"||t==="DI"||t==="INPUT"||t==="입력"?"DIN":t==="OUTPUT"||t==="출력"?"DIO":e==="din"?"DIN":"DIO"},pNt=(i,e)=>i.replace(/[\s_-]*[0-9]+\s*$/,"").trim()||e,_Nt=(i,e)=>Object.entries(i).reduce((t,[n,s])=>{if(typeof s!="string"||s.length===0)return t;const o=s.match(PAe);return o&&(t[n]=pNt(o[0],e)),t},{}),bNt=(i,e)=>{if(!(i!==0&&i!==1))return`mcu${i}${e==="din"?"Din":"Dio"}`},vNt=i=>{const e=i.trim().toLowerCase();if(e==="1"||e==="true"||e==="on")return!0;if(e==="0"||e==="false"||e==="off")return!1},yNt=i=>Object.values(i).filter(e=>typeof e=="string"&&e.length>0),wNt=i=>{for(const e of yNt(i)){const t=e.match(PAe);if(!t)continue;const n=Number(t[1]),s=t[2],o=s.toUpperCase(),r=Number(t[3]),a=o==="DI"||o==="DIN"||o==="INPUT"||o==="입력"||o==="_IN"?"din":"dio",l=`MCU${n}`,c=fNt(s,a),d=`${l} ${c}`,h=_Nt(i,d);return{key:bNt(n,a),rowKey:`mcu${n}-${a}`,label:h,mcu:n,kind:a,pin:r}}return null},$D=i=>{const e=Array.from(i.values()).sort((t,n)=>t.pin-n.pin);return e.length>0?e:void 0},CNt=i=>{const e={mcu0Dio:new Map,mcu1Dio:new Map,mcu0Din:new Map,mcu1Din:new Map},t=new Map;for(const o of i?.infos??[]){if(o.categoryId!=="io")continue;const r=wNt(o.name),a=vNt(o.value);if(!r||a===void 0)continue;const l={pin:r.pin,value:a,rawValue:o.value};r.key&&e[r.key].set(r.pin,l);const c=t.get(r.rowKey);c?c.bits.set(r.pin,l):t.set(r.rowKey,{key:r.rowKey,label:r.label,mcu:r.mcu,kind:r.kind,bits:new Map([[r.pin,l]])})}const n=Array.from(t.values()).map(o=>({...o,bits:$D(o.bits)??[]})).filter(o=>o.bits.length>0).sort((o,r)=>o.kind!==r.kind?o.kind==="din"?-1:1:o.mcu-r.mcu),s={rows:n.length>0?n:void 0,mcu0Dio:$D(e.mcu0Dio),mcu1Dio:$D(e.mcu1Dio),mcu0Din:$D(e.mcu0Din),mcu1Din:$D(e.mcu1Din)};return n.length>0?s:void 0},{useMemo:wF}=await F("react"),SNt=({selectedRobotModel:i,enableInfoStatus:e=!1,enableTaskLogRefetch:t=!1})=>{const n=Jk(i);gNt({robotModel:i,mapName:n.mapState?.mapName});const s=ooe(i),o=mNt(i,void 0,e),{data:r}=noe({limit:10,page:1,searchText:"",sort:"createdAt",order:"DESC",filter:{},fields:{}},{refetchInterval:t?2e3:0,refetchIntervalInBackground:!1}),a=wF(()=>{if(r)return{...r,items:r.items?.map(h=>({...h}))}},[r]),l=wF(()=>({...n,pose:s.pose,vel:s.vel,autoMove:s.moveState?.autoMove,obsState:s.moveState?.obs}),[n,s.pose,s.vel,s.moveState?.autoMove,s.moveState?.obs]),c=wF(()=>{const h=s.pose,g=s.vel;return{localizationStatus:n.locState?.locStatus??"none",autoMove:s.moveState?.autoMove,obsState:s.moveState?.obs??"none",poseX:Number(h?.x??0),poseY:Number(h?.y??0),poseZ:0,poseYaw:Number(h?.rz??0),speed:Math.hypot(g?.vx??0,g?.vy??0),velocityX:g?.vx??0,velocityY:g?.vy??0,velocityWz:g?.wz??0,roll:n.imu?.imuRx??0,pitch:n.imu?.imuRy??0,imuYaw:n.imu?.imuRz??0,angularVelocity:n.imu?.gyrZ??0,inlierError:n.locState?.inlierError??0,inlierRatio:n.locState?.inlierRatio??0}},[s.pose,s.vel,s.moveState?.autoMove,s.moveState?.obs,n.imu?.gyrZ,n.imu?.imuRx,n.imu?.imuRy,n.imu?.imuRz,n.locState?.locStatus,n.locState?.inlierError,n.locState?.inlierRatio]),d=wF(()=>CNt(o.data),[o.data]);return{baseAmrStatus:n,amrMoveStatus:s,amrInfoStatus:o,amrSafetyIoStatus:d,taskLogData:a,monitorStatusSnapshot:l,hudStatusSnapshot:c}},{useMutation:xNt}=await F("@tanstack/react-query"),NNt="/{robot_model}/move/{axis}",INt=i=>i==="x"?"xLinear":"yLinear",kNt=async i=>{const{robot_model:e,axis:t,...n}=i,s=NNt.replace("{robot_model}",e).replace("{axis}",INt(t));return Ls.post(s,n)},LNt=()=>xNt({mutationFn:kNt}),{useMutation:DNt}=await F("@tanstack/react-query"),TNt="/{robot_model}/move/target",ENt=async({robot_model:i,goalPose:e,method:t,preset:n=0})=>{const s=TNt.replace("{robot_model}",i);return Ls.post(s,{goalPose:e,method:t,preset:n})},PNt=()=>DNt({mutationFn:ENt}),{useMutation:RNt}=await F("@tanstack/react-query"),MNt="/{robot_model}/move/goal",ANt=async({robot_model:i,goalId:e,goalName:t,method:n})=>{const s=MNt.replace("{robot_model}",i);return Ls.post(s,{goalId:e,...t!==void 0&&{goalName:t},...n!==void 0&&{method:n}})},ONt=()=>RNt({mutationFn:ANt}),{useMutation:FNt}=await F("@tanstack/react-query"),BNt="/{robot_model}/control/dock",VNt=async({robot_model:i})=>{const e=BNt.replace("{robot_model}",i);return Ls.post(e)},zNt=()=>FNt({mutationFn:VNt}),{useMutation:WNt}=await F("@tanstack/react-query"),HNt="/{robot_model}/call_pause",$Nt=async({robot_model:i})=>{const e=HNt.replace("{robot_model}",i);return Ls.post(e)},UNt=()=>WNt({mutationFn:$Nt}),{useMutation:jNt}=await F("@tanstack/react-query"),GNt="/{robot_model}/call_resume",qNt=async({robot_model:i})=>{const e=GNt.replace("{robot_model}",i);return Ls.post(e)},KNt=()=>jNt({mutationFn:qNt}),{useMutation:JNt}=await F("@tanstack/react-query"),YNt="/{robot_model}/control/dockStop",XNt=async({robot_model:i})=>{const e=YNt.replace("{robot_model}",i);return Ls.post(e)},QNt=()=>JNt({mutationFn:XNt}),{useMutation:ZNt}=await F("@tanstack/react-query"),eIt="/{robot_model}/control/undock",tIt=async({robot_model:i})=>{const e=eIt.replace("{robot_model}",i);return Ls.post(e)},nIt=()=>ZNt({mutationFn:tIt}),{useMutation:iIt}=await F("@tanstack/react-query"),sIt="/{robot_model}/control/setDetectMode",oIt=()=>iIt({mutationFn:({robot_model:i,switch:e})=>{const t=sIt.replace("{robot_model}",i);return Ls.post(t,{switch:e})}}),{useMutation:rIt}=await F("@tanstack/react-query"),aIt="/{robot_model}/control/setSafetyField",lIt=()=>rIt({mutationFn:({robot_model:i,safetyField:e})=>{const t=aIt.replace("{robot_model}",i);return Ls.post(t,{safetyField:e})}}),{useMutation:cIt}=await F("@tanstack/react-query"),dIt="/{robot_model}/control/setSafetyFlag",uIt=()=>cIt({mutationFn:({robot_model:i,name:e})=>{const t=dIt.replace("{robot_model}",i);return Ls.post(t,{safetyFlag:[{name:e,value:!1}]})}}),{useMutation:hIt}=await F("@tanstack/react-query"),gIt="/{robot_model}/control/setSafetyIo",mIt=()=>hIt({mutationFn:async({robot_model:i,mcu0Din:e,mcu1Din:t})=>{const n=gIt.replace("{robot_model}",i),s=await Ls.post(n,{mcu0Din:e,mcu1Din:t});if(s.result==="reject")throw new Error(s.message);return s}}),{useCallback:Gu}=await F("react"),RAe="move.amr.toast.moveReject.title",fIt={"not localized":"move.amr.toast.moveReject.localizationUnavailable","same goal":"move.amr.toast.moveReject.sameTarget","out of bounds":"move.amr.toast.moveReject.outOfMapRange","marker node":"move.amr.toast.moveReject.markerNode","module not ready":"move.amr.toast.moveReject.robotNotReady","map not loaded":"move.amr.toast.moveReject.noMap","goal not found":"move.amr.toast.moveReject.targetNodeNotFound","path not found":"move.amr.toast.moveReject.noLink"},CF=i=>{if(!i||typeof i!="object")return"";const e=i,t=e.response?.data;return typeof t?.message=="string"?t.message:Array.isArray(t?.detail)?t.detail.map(n=>n&&typeof n=="object"&&"msg"in n?String(n.msg??""):"").filter(Boolean).join(" "):typeof e.message=="string"?e.message:""},pIt=(i,e)=>{const t=i?.trim()??"",n=t.startsWith("move.amr.toast.moveReject.")&&t!==RAe?t:fIt[t];return(n?e(n):void 0)||t||e("move.amr.toast.moveReject.default")},uv=(i,e)=>{rt.openToast({type:"basic",variant:"danger",title:e(RAe),content:pIt(i,e)})},_It=({selectedRobotModel:i})=>{const{t:e}=q(),{mutateAsync:t}=rEe(),{mutateAsync:n}=uIt(),{mutateAsync:s}=lIt(),{mutateAsync:o}=mIt(),{mutateAsync:r}=oIt(),{mutate:a}=zNt(),{mutate:l}=UNt(),{mutate:c}=KNt(),{mutate:d}=QNt(),{mutate:h}=nIt(),{mutate:g}=PNt(),{mutate:m}=ONt(),{mutate:f}=LNt(),p=Gu(E=>t({robot_model:i,value:!E}),[i,t]),_=Gu(E=>{g({robot_model:i,...E},{onSuccess:R=>{R?.result!=="accept"&&uv(R?.message,e)},onError:R=>{uv(CF(R),e)}})},[g,i,e]),b=Gu(E=>{m({robot_model:i,...E},{onSuccess:R=>{R?.result!=="accept"&&uv(R?.message,e)},onError:R=>{uv(CF(R),e)}})},[m,i,e]),v=Gu(E=>{if(E.axis==="y"){const R=E.direction??(E.target>=0?"right":"left");f({robot_model:i,axis:"y",direction:R,target:Math.abs(E.target),speed:E.speed},{onSuccess:A=>{A?.result!=="accept"&&uv(A?.message,e)},onError:A=>{uv(CF(A),e)}});return}f({robot_model:i,axis:"x",target:E.target,speed:E.speed},{onSuccess:R=>{R?.result!=="accept"&&uv(R?.message,e)},onError:R=>{uv(CF(R),e)}})},[f,i,e]),w=Gu(E=>{a({robot_model:i},{onSuccess:R=>{if(R?.result==="reject"){const A=R.message||e("move.amr.toast.dockReject.default");E?.(A)}}})},[a,i,e]),y=Gu(()=>{h({robot_model:i})},[i,h]),S=Gu(()=>{l({robot_model:i})},[l,i]),C=Gu(()=>{c({robot_model:i})},[c,i]),N=Gu(()=>{d({robot_model:i})},[d,i]),k=Gu(E=>n({robot_model:i,name:E}),[i,n]),L=Gu(E=>s({robot_model:i,safetyField:E}),[i,s]),D=Gu(E=>r({robot_model:i,switch:E}),[i,r]),T=Gu(E=>o({robot_model:i,...E}),[i,o]);return{handleSetMotorLocked:p,handleMoveTarget:_,handleMoveGoal:b,handleMoveLinear:v,handleDock:w,handleDockPause:S,handleDockResume:C,handleDockStop:N,handleUndock:y,handleClearSafetyFlag:k,handleSetSafetyField:L,handleSetSafetyIo:T,handleSetDetectMode:D}},MAe=()=>({GOAL:0,ROUTE:0,ALIGN:0}),bIt=i=>{const e=i.toUpperCase();return e==="GOAL"?"GOAL":e==="ROUTE"?"ROUTE":e==="ALIGN"?"ALIGN":null},m_e=i=>{const e=MAe();return i.forEach(t=>{const n=bIt(t);n&&(e[n]+=1)}),e},{useMemo:vIt}=await F("react"),yIt=({nodes:i,topologyData:e})=>{const t=vIt(()=>i.length>0?m_e(i.map(s=>s.type)):e?.length?m_e(e.map(s=>s.type)):MAe(),[i,e]),n=i.length>0?i.length:e?.length??0;return{nodeTypeCounts:t,topologyCount:n}},{useState:f_e}=await F("react"),wIt=()=>{const[i,e]=f_e(.3),[t,n]=f_e(15);return{linearJogSpeed:i,setLinearJogSpeed:e,rotationJogSpeed:t,setRotationJogSpeed:n}},{useCallback:p_e,useEffect:__e,useState:jw}=await F("react"),CIt=({editorReady:i,worldStudioRef:e})=>{const[t,n]=jw(!1),[s,o]=jw(.5),[r,a]=jw("goal"),[l,c]=jw("cursor"),[d,h]=jw(!1),[g,m]=jw(0),[f,p]=jw(!1),_=p_e(()=>{h(!0)},[]),b=p_e(()=>{h(!1)},[]);return __e(()=>{i?.editor&&o(e.current?.getEraserRadius()??.5)},[i?.editor,e]),__e(()=>{if(i?.editor)return e.current?.onTopologyChanged(_)},[i?.editor,e,_]),{isEraserEnabled:t,setIsEraserEnabled:n,eraserRadius:s,setEraserRadius:o,selectedNodeType:r,setSelectedNodeType:a,selectedNodePlacementType:l,setSelectedNodePlacementType:c,hasUnsavedTopologyChanges:d,markTopologyDirty:_,resetTopologyDirty:b,selectedEraserPointsCount:g,setSelectedEraserPointsCount:m,hasUnsavedCloudChanges:f,setHasUnsavedCloudChanges:p}},{useMemo:SIt}=await F("react"),{useQuery:xIt}=await F("@tanstack/react-query"),AAe="topology.json",OAe="/{robot_model}/map/getTopology",NIt=999,IIt=i=>({...i,format_version:i.format_version??fB,metadata:i.metadata,nodes:i.nodes??[],links:i.links??[],zones:i.zones??[]}),b_e=async({robot_model:i,mapName:e,pageNo:t})=>{const n=OAe.replace("{robot_model}",i),s=await Ls.get(n,{params:{mapName:e,fileName:AAe,pageNo:t,pageSize:NIt}});return IIt(s)},kIt=async({robot_model:i,mapName:e})=>{const t=await b_e({robot_model:i,mapName:e,pageNo:1}),n=Math.max(t.totalPage??1,1);if(n===1)return t;const s=await Promise.all(Array.from({length:n-1},(o,r)=>b_e({robot_model:i,mapName:e,pageNo:r+2})));return{...t,nodes:[t,...s].flatMap(o=>o.nodes),links:[t,...s].flatMap(o=>o.links),zones:[t,...s].flatMap(o=>o.zones)}},LIt=(i,e={})=>{const t=SIt(()=>[OAe,{...i,fileName:AAe}],[i]);return{...xIt({queryKey:t,queryFn:()=>kIt(i),enabled:!!i.mapName,...e}),queryKey:t}},DIt="modulepreload",TIt=function(i){return"/"+i},v_e={},Nt=function(e,t,n){let s=Promise.resolve();if(t&&t.length>0){let r=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");s=r(t.map(c=>{if(c=TIt(c),c in v_e)return;v_e[c]=!0;const d=c.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const g=document.createElement("link");if(g.rel=d?"stylesheet":DIt,d||(g.as="script"),g.crossOrigin="",g.href=c,l&&g.setAttribute("nonce",l),document.head.appendChild(g),d)return new Promise((m,f)=>{g.addEventListener("load",m),g.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(r){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r}return s.then(r=>{for(const a of r||[])a.status==="rejected"&&o(a.reason);return e().catch(o)})},{lazy:TA,memo:EIt,Suspense:PIt,useEffect:RIt,useState:y_e}=await F("react"),MIt=TA(()=>Nt(()=>import("./index.Di1B_zOl.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.Overview}))),AIt=TA(()=>Nt(()=>import("./index.Di1B_zOl.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.TaskInformation}))),OIt=TA(()=>Nt(()=>import("./index.Di1B_zOl.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.PduInfo}))),FIt=TA(()=>Nt(()=>import("./index.Di1B_zOl.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.DockControl}))),BIt=TA(()=>Nt(()=>import("./AmrCapabilityControl.oytFydB2.js"),__vite__mapDeps([7,3,2,4,5,6,8]))),VIt=[{label:"move.amr.rightPanel.monitor.tab.overview",value:"overview"},{label:"move.amr.rightPanel.monitor.tab.task",value:"task"},{label:"move.amr.rightPanel.monitor.tab.pdu",value:"pdu"},{label:"move.amr.rightPanel.monitor.tab.dock",value:"dock"},{label:"move.amr.rightPanel.monitor.tab.capability",value:"capability"}],w_e=i=>i==="overview"||i==="task"||i==="pdu"||i==="dock"||i==="capability",SF=()=>{},zIt=({className:i,robotModel:e,overviewProps:t,taskProps:n,pduProps:s,dockProps:o})=>{const[r,a]=xc(),l=ir(),{t:c}=q(),{theme:d}=tt(),[h,g]=y_e(()=>{const k=r.get("monitor_tab");return k==="motor"?"pdu":k&&w_e(k)?k:"overview"}),[m,f]=y_e(!1);RIt(()=>{f(!1)},[e]);const p=()=>rt.openToast({type:"basic",variant:"success",title:c("move.amr.pdu.toast.motorConnect.title"),content:c("move.amr.pdu.toast.motorConnect.content")}),_=()=>rt.openToast({type:"basic",variant:"danger",title:c("common.toast.apiError.title"),content:c("common.toast.apiError.content")}),b=()=>{l("../settings?group=drive&menu=docking&expended=1")},v=k=>{g(k);const L=new URLSearchParams(r);L.set("monitor_tab",k),a(L,{replace:!0})},w=()=>{f(!1),o.onDock?.()},y=()=>{f(!0),o.onPause?.()},S=()=>{f(!1),o.onResume?.()},C=()=>{f(!1),o.onStop?.()},N=()=>{f(!1),o.onUndock?.()};return u("div",{className:P("AmrMonitorControl","h-full",i),children:u("div",{className:"flex h-full gap-0",children:x("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-x-hidden",children:[u("div",{className:P("shrink-0",d==="light"?"bg-default":"bg-alt-1"),children:u(m9,{tabItems:VIt.map(k=>({key:k.value,label:c(k.label)})),activeKey:h,handleChange:k=>{w_e(k)&&v(k)},size:"xs",tabBtnClassName:"typo-compact-xs-bold light:bg-white light:[&.active]:bg-fill-navy! light:[&.active]:text-white!"})}),u(U,{className:"min-h-0 flex-1 overflow-y-auto",children:x(PIt,{fallback:null,children:[h==="overview"&&u(MIt,{amrStatus:t.amrStatus,robotVersion:t.robotVersion,onStartLocalization:t.onStartLocalization??SF,onInitLocalization:t.onInitLocalization??SF,onSemiAutoInitLocalization:t.onSemiAutoInitLocalization??SF,onStopLocalization:t.onStopLocalization??SF,selectedTool:t.selectedTool,onToolChange:t.onToolChange,onBuildInfoOpenChange:t.onBuildInfoOpenChange}),h==="task"&&u(AIt,{logData:n.logData,moveStatus:n.moveStatus}),h==="pdu"&&u(OIt,{amrStatus:s.amrStatus,setMotorLocked:s.setMotorLocked,onClearSafetyRecovery:s.onClearSafetyRecovery,onLidarFieldSave:s.onLidarFieldSave,onOssdDetectChange:s.onOssdDetectChange,safetyIo:s.safetyIo,safetyIoLoading:s.safetyIoLoading,onSetSafetyIo:s.onSetSafetyIo,onSafetyIoSetError:_,onMotorConnectSuccess:p,onLidarSaveSuccess:()=>rt.openToast({type:"basic",variant:"success",title:c("move.amr.pdu.toast.lidarSave.title"),content:c("move.amr.pdu.toast.lidarSave.content")}),onMotorConnectError:_,onLidarSaveError:_}),h==="dock"&&u(FIt,{amrStatus:o.amrStatus,isPaused:m,onDock:w,onPause:y,onResume:S,onStop:C,onUndock:N,maxRetryCount:o.maxRetryCount,rejectMessage:o.rejectMessage,onOpenRetrySettings:b,dockDisabled:e.startsWith("S100")}),h==="capability"&&u(BIt,{robotModel:e})]})})]})})})},WIt=EIt(zIt),{lazy:Eoe,memo:HIt,Suspense:$It,useEffect:UIt,useState:jIt}=await F("react"),GIt=Eoe(()=>Nt(()=>import("./index.Di1B_zOl.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.EraserTab}))),qIt=Eoe(()=>Nt(()=>import("./index.Di1B_zOl.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.MapInfo}))),KIt=Eoe(()=>Nt(()=>import("./index.Di1B_zOl.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.MappingTab}))),JIt=[{label:"move.amr.rightPanel.map.tab.info",value:"info"},{label:"move.amr.rightPanel.map.tab.mapping",value:"mapping"},{label:"move.amr.rightPanel.map.tab.erasing",value:"erasing"}],rU="map_tab",aU=i=>i==="info"||i==="mapping"||i==="erasing",YIt=({className:i,mapInfoProps:e,mappingTabProps:{mapList:t,...n},eraserTabProps:s,hasUnsavedCloudChanges:o=!1,onDiscardCloudChanges:r,onLoadMap:a,loadMapDisabled:l,onDownloadMap:c,downloadMapDisabled:d})=>{const{theme:h}=tt(),{t:g}=q(),{confirmDialog:m}=jn(),[f,p]=xc(),[_,b]=jIt(()=>{const w=f.get(rU)??"";return aU(w)?w:"info"});UIt(()=>{const w=f.get(rU)??"",y=aU(w)?w:"info";b(S=>S!==y?y:S)},[f]);const v=async w=>{if(w===_)return;const y=n?.mappingStatus??"idle",S=_==="mapping"&&w!=="mapping",C=_==="erasing"&&w!=="erasing";if(S){if(y==="saving"||y==="discarding")return;if(y!=="idle"){if(!await m({title:g("move.amr.rightPanel.map.dialog.discardMapping.title"),content:g("move.amr.rightPanel.map.dialog.discardMapping.content"),buttonText:{yes:g("move.amr.rightPanel.map.dialog.discardMapping.yes"),no:g("move.amr.rightPanel.common.cancel")}}))return;await n?.onDiscard?.()}}if(C&&o){if(!await m({title:"Discard erasing changes?",content:"Leaving the erasing tab will discard erased point changes.",buttonText:{yes:g("move.amr.rightPanel.map.dialog.discardMapping.yes"),no:g("move.amr.rightPanel.common.cancel")}}))return;await r?.()}b(w);const N=new URLSearchParams(f);N.set(rU,w),p(N,{replace:!0})};return x(U,{className:P("AmrMapControl","h-full","overflow-x-hidden",i),children:[u("div",{className:P("sticky top-0 left-0 z-2",h==="light"?"bg-default":"bg-alt-1"),children:u(m9,{tabItems:JIt.map(w=>({key:w.value,label:g(w.label)})),activeKey:_,handleChange:w=>{aU(w)&&v(w)},size:"xs",tabBtnClassName:"typo-compact-xs-bold light:bg-white light:[&.active]:bg-fill-navy! light:[&.active]:text-white!"})}),u(U,{className:"min-h-0 flex-1",children:x($It,{fallback:null,children:[_==="info"&&u(qIt,{currentMapName:e?.currentMapName??"",createdAt:e?.createdAt,lastModified:e?.lastModified,mapCloudCount:e?.mapCloudCount??0,mapBounds:e?.mapBounds,topologyCount:e?.topologyCount??0,nodeTypeCounts:e?.nodeTypeCounts,onLoadMap:a,loadMapDisabled:l,onDownloadMap:c,downloadMapDisabled:d}),_==="mapping"&&u(KIt,{mappingStatus:n?.mappingStatus,elapsedSeconds:n?.elapsedSeconds,completedKeyframeCount:n?.completedKeyframeCount,totalKeyframePoints:n?.totalKeyframePoints,onStartMapping:n?.onStartMapping,onStopMapping:n?.onStopMapping,onSaveMapping:n?.onSaveMapping,onDiscard:n?.onDiscard,mapList:t}),_==="erasing"&&u(GIt,{...s})]})})]})},XIt=HIt(YIt),{lazy:QIt,memo:ZIt,Suspense:ekt,useState:tkt}=await F("react"),nkt=QIt(()=>Nt(()=>import("./index.Di1B_zOl.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(i=>({default:i.MarkerControl}))),ikt=[{label:"move.amr.rightPanel.marker.tab.register",value:"register"},{label:"move.amr.rightPanel.marker.tab.teaching",value:"teaching"}],skt=({className:i,markerProps:e})=>{const{theme:t}=tt(),{t:n}=q(),[s,o]=tkt("register");return u("div",{className:P("AmrMarkerControl","h-full",i),children:u("div",{className:"flex h-full gap-0",children:x("div",{className:"flex h-full flex-1 flex-col overflow-hidden",children:[u("div",{className:P("sticky top-0 left-0 z-2",t==="light"?"bg-default":"bg-alt-1"),children:u(m9,{tabItems:ikt.map(r=>({key:r.value,label:n(r.label)})),activeKey:s,handleChange:r=>o(r),size:"xs",tabBtnClassName:"typo-compact-xs-bold light:bg-white light:[&.active]:bg-fill-navy! light:[&.active]:text-white!"})}),u(U,{className:"h-full",children:u(ekt,{fallback:null,children:u(nkt,{mode:s,isScanning:e.isScanning,detections:e.detections,onScanStart:e.onScanStart,onScanStop:e.onScanStop,onRegisterMarker:e.onRegisterMarker,isRegisterPending:e.isRegisterPending,lastRegisteredMarkerId:e.lastRegisteredMarkerId,registeredMarkers:e.registeredMarkers,capturedPose:e.capturedPose,capturedDetection:e.capturedDetection,onCapturePose:e.onCapturePose,onTeachTarget:e.onTeachTarget})})})]})})})},okt=ZIt(skt),rkt={detections:[],stamp:0},akt=i=>({camId:i.camId,markerId:i.markerId,type:i.type,pose:i.pose?{x:i.pose.x,y:i.pose.y,z:i.pose.z,rx:i.pose.rx,ry:i.pose.ry,rz:i.pose.rz}:void 0,confidence:i.confidence,distM:i.distM}),lkt=(i,e=!1)=>{const{data:t}=ls(`amr/${i}/marker/detected`,{defaultValue:rkt,disabled:!e});return{detections:t.detections.map(akt),stamp:t.stamp}},{useMutation:ckt}=await F("@tanstack/react-query"),dkt="/{robot_model}/marker/scanStart",ukt=async({robot_model:i})=>{const e=dkt.replace("{robot_model}",i);return Ls.post(e)},hkt=()=>ckt({mutationFn:ukt}),{useMutation:gkt}=await F("@tanstack/react-query"),mkt="/{robot_model}/marker/scanStop",fkt=async({robot_model:i})=>{const e=mkt.replace("{robot_model}",i);return Ls.post(e)},pkt=()=>gkt({mutationFn:fkt}),{useMutation:_kt}=await F("@tanstack/react-query"),bkt="/{robot_model}/marker/register",vkt=async({robot_model:i,...e})=>{const t=bkt.replace("{robot_model}",i);return Ls.post(t,e)},ykt=()=>_kt({mutationFn:vkt}),{useMutation:wkt}=await F("@tanstack/react-query"),Ckt="/{robot_model}/marker/setPrecisionNode",Skt=async({robot_model:i,...e})=>{const t=Ckt.replace("{robot_model}",i);return Ls.post(t,e)},xkt=()=>wkt({mutationFn:Skt}),{useCallback:UD,useEffect:Nkt,useMemo:Ikt,useState:xF}=await F("react"),{useQueryClient:kkt}=await F("@tanstack/react-query"),FAe=i=>{if(!i)return{markerId:NaN,mount:""};const e=t=>{const n=i.match(new RegExp(`${t}=([^;]+)`));return n?n[1]:""};return{markerId:parseInt(e("marker"),10),mount:e("mount")}},Lkt=i=>{if(!i.features.includes("PRECISION"))return null;const{markerId:e}=FAe(i.context);return isNaN(e)?null:{markerId:e,nodeId:i.id,nodeName:i.name,pose:{x:i.pose.x,y:i.pose.y,rz:i.pose.rz},context:i.context}},Dkt=(i,e)=>{const t=i.features.includes("APRIL"),n=i.features.includes("ARUCO");if(!t&&!n)return null;const{markerId:s,mount:o}=FAe(i.context);return isNaN(s)?null:{markerId:s,nodeId:i.id,type:t?"APRIL":"ARUCO",mount:o||"WALL",targets:[],precisionTarget:e.get(s)??null}},Tkt=({robotModel:i,enabled:e=!1,mapName:t,topology:n,robotPose:s,onNodeRegistered:o})=>{const{t:r}=q(),a=kkt(),[l,c]=xF(!1),[d,h]=xF(null),[g,m]=xF(null),[f,p]=xF(null),_=Ikt(()=>{const R=n?.nodes??[],A=new Map;for(const M of R){const O=Lkt(M);O&&A.set(O.markerId,O)}return R.filter(M=>M.type==="ALIGN").flatMap(M=>{const O=Dkt(M,A);return O?[O]:[]})},[n]),{detections:b}=lkt(i,l),{locState:v}=Jk(i,R=>({locState:R.locState})),{mutate:w}=hkt(),{mutate:y}=pkt(),{mutate:S,isPending:C}=ykt(),{mutate:N}=xkt(),k=UD((R=!0)=>{if(v?.locStatus!=="good"){R&&rt.openToast({title:r("move.amr.toast.markerScanReject.title"),content:r("move.amr.toast.markerScanReject.localizationUnavailable"),type:"basic",variant:"warning"});return}w({robot_model:i},{onSuccess:()=>c(!0)})},[v?.locStatus,i,w,r]),L=UD(()=>{y({robot_model:i},{onSuccess:()=>c(!1)})},[i,y]);Nkt(()=>{if(e){!l&&v?.locStatus==="good"&&k(!1);return}l&&L()},[e,k,L,l,v?.locStatus]);const D=UD(R=>{S({robot_model:i,...R},{onSuccess:A=>{if(!(A.result!=="success"&&A.result!=="accept")&&(h(R.markerId),rt.openToast({title:r("move.amr.toast.markerRegister.title"),content:r("move.amr.toast.markerRegister.success",{markerId:R.markerId}),type:"basic",variant:"success"}),A.node&&(o?.(A.node),t))){const M=[HB,{robot_model:i,mapName:t}];a.setQueryData(M,O=>!O||O.nodes.some(B=>B.id===A.node.id)?O:{...O,nodes:[...O.nodes,A.node]}),a.invalidateQueries({queryKey:M})}}})},[t,o,a,i,S,r]),T=UD(()=>{s&&m({x:s.x,y:s.y,rz:s.rz})},[s]),E=UD(R=>{N({robot_model:i,markerId:R.markerId,nodeName:R.nodeName},{onSuccess:A=>{if(A.result==="reject"){A.message==="marker_not_visible"&&rt.openToast({title:r("move.amr.toast.markerTeach.title"),content:r("move.amr.toast.markerTeach.reject.markerNotVisible"),type:"basic",variant:"danger"});return}if(!(A.result!=="success"&&A.result!=="accept")){if(A.node&&(rt.openToast({title:r("move.amr.toast.markerTeach.title"),content:"",type:"basic",variant:"success"}),o?.(A.node),t)){const M=[HB,{robot_model:i,mapName:t}];a.setQueryData(M,O=>!O||O.nodes.some(B=>B.id===A.node.id)?O:{...O,nodes:[...O.nodes,A.node]}),a.invalidateQueries({queryKey:M})}m(null),p(null)}}})},[i,N,t,o,a,r]);return{isScanning:l,detections:b,onScanStart:k,onScanStop:L,onRegisterMarker:D,isRegisterPending:C,lastRegisteredMarkerId:d,registeredMarkers:_,capturedPose:g,capturedDetection:f,onCapturePose:T,onTeachTarget:E}},{memo:Ekt,useCallback:C_e,useEffect:Pkt,useMemo:jD,useRef:Gw,useState:NF}=await F("react"),IF={width:630,height:480},kF={width:420,height:240},S_e=24,lU=(i,e,t)=>Math.min(Math.max(i,e),t),Rkt=i=>typeof i=="object"&&i!==null&&!Array.isArray(i),Mkt=i=>Rkt(i)&&("name"in i||"value"in i),gR=(i,e)=>{if(!i)return"";if(typeof i=="string")return i;const t=e.split("-")[0];return i[t]??i.en??i.ko??Object.values(i).find(s=>!!s)??""},Akt=(i,e,t)=>gR(t.get(i),e)||i,Okt=i=>{const e=i?.infos;return{items:Array.isArray(e)?e.filter(Mkt):[]}},Poe=i=>i==null||i===""?"-":typeof i=="boolean"?i?"true":"false":String(i),Fkt=i=>i.trim().toLowerCase(),Bkt=i=>{const e=Poe(i.value);return i.type===2?{color:e==="1"?"green":"gray",label:e==="1"?"ON":e==="0"?"OFF":e}:i.type===1?{color:"blue",label:e}:null},Vkt=({item:i,currentLanguage:e})=>{const t=gR(i.name,e)||i.categoryId||"unknown",n=gR(i.description,e),s=Poe(i.value),o=Bkt(i);return x("div",{className:"bg-fill-disabled flex w-full min-w-0 shrink-0 items-start justify-between gap-2 rounded-md px-2.5 py-2",children:[x("div",{className:"min-w-0 flex-1",children:[x(H,{className:"min-w-0 items-center gap-1.5",children:[i.color?u("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:i.color}}):null,u("p",{className:"typo-compact-xs2-normal text-fg-subtle min-w-0 break-words",children:t})]}),n?u("p",{className:"typo-compact-2xs-normal text-fg-subtler mt-0.5 min-w-0 break-words",children:n}):null]}),u("div",{className:"flex max-w-[45%] shrink-0 flex-col items-end gap-1",children:o?u(lh,{type:"soft",color:o.color,className:"max-w-full",children:u("span",{className:"max-w-full min-w-0 break-all",children:o.label})}):u("p",{className:"typo-compact-xs2-medium text-fg-default max-w-full min-w-0 text-right font-mono break-all",title:s,children:s})})]})},zkt=(i,e,t)=>{const n=i(e);return n===e?t:n},Wkt=({infoStatus:i,infoCategories:e,infoStatusLoading:t=!1,infoStatusIsDefault:n=!0,onClose:s})=>{const[o,r]=NF(""),[a,l]=NF({x:0,y:0}),[c,d]=NF(IF),[h,g]=NF(80),m=Gw(null),f=Gw({x:0,y:0}),p=Gw(IF),_=Gw(!1),b=Gw(!1),v=Gw({mouseX:0,mouseY:0,panelX:0,panelY:0}),w=Gw({mouseX:0,mouseY:0,panelX:0,panelY:0,width:IF.width,height:IF.height}),{t:y,currentLanguage:S}=q(),C=jD(()=>(M,O)=>zkt(y,M,O),[y]),N=C_e(M=>{M.preventDefault(),!b.current&&(_.current=!0,document.body.style.cursor="grabbing",document.body.style.userSelect="none",v.current={mouseX:M.clientX,mouseY:M.clientY,panelX:f.current.x,panelY:f.current.y})},[]),k=C_e(M=>{M.preventDefault(),M.stopPropagation();const O=m.current?.getBoundingClientRect();b.current=!0,document.body.style.cursor="se-resize",document.body.style.userSelect="none",w.current={mouseX:M.clientX,mouseY:M.clientY,panelX:f.current.x,panelY:f.current.y,width:O?.width??p.current.width,height:O?.height??p.current.height}},[]);Pkt(()=>{const M=B=>{if(_.current){const z=v.current.panelX+(B.clientX-v.current.mouseX),Y=v.current.panelY+(B.clientY-v.current.mouseY);f.current={x:z,y:Y},m.current&&(m.current.style.transform=`translate(${z}px, ${Y}px)`)}if(b.current){const z=lU(w.current.width+(B.clientX-w.current.mouseX),kF.width,Math.max(kF.width,window.innerWidth-S_e)),Y=lU(w.current.height+(B.clientY-w.current.mouseY),kF.height,Math.max(kF.height,window.innerHeight-S_e)),$={width:z,height:Y},Z={x:w.current.panelX+(z-w.current.width),y:w.current.panelY+(Y-w.current.height)};p.current=$,f.current=Z,d($),l(Z)}},O=()=>{_.current&&(_.current=!1,l({...f.current})),b.current&&(b.current=!1),document.body.style.cursor="",document.body.style.userSelect=""};return window.addEventListener("mousemove",M),window.addEventListener("mouseup",O),()=>{window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",O),document.body.style.cursor="",document.body.style.userSelect=""}},[]);const{items:L}=jD(()=>Okt(i),[i]),D=jD(()=>{const M=new Map;for(const O of e??[])M.set(O.categoryId,O.name);return M},[e]),T=jD(()=>{const M=new Map;for(const O of L){const B=O.categoryId||"uncategorized",z=M.get(B)??[];z.push(O),M.set(B,z)}return Array.from(M.entries()).map(([O,B])=>({id:O,label:Akt(O,S,D),items:B}))},[D,S,L]),E=jD(()=>{const M=Fkt(o);return M?T.map(O=>{const B=O.items.filter(z=>[O.id,O.label,z.categoryId,z.groupId,gR(z.name,S),gR(z.description,S),Poe(z.value)].filter(Boolean).join(" ").toLowerCase().includes(M));return{...O,items:B}}).filter(O=>O.items.length>0):T},[T,S,o]),R=!n&&i!==void 0&&L.length>0,A=u(lh,{type:"soft",color:t?"blue":R?"green":"gray",className:"max-w-24 shrink-0",children:u("span",{className:"break-all",children:t?C("move.amr.rightPanel.debug.state.loading","Loading"):R?C("move.amr.rightPanel.debug.state.receiving","Receiving"):C("move.amr.rightPanel.debug.state.waiting","Waiting")})});return u("div",{className:"pointer-events-auto",children:x("div",{ref:m,className:"border-subtle shadow-down-lg relative flex flex-col overflow-hidden rounded-lg border",style:{backgroundColor:`color-mix(in srgb, var(--color-bg-alt-1) ${lU(h,0,100)}%, transparent)`,transform:`translate(${a.x}px, ${a.y}px)`,width:c.width,height:c.height},children:[x("div",{className:"border-subtle flex shrink-0 cursor-grab items-center justify-start gap-2 border-b py-1 pr-2 pl-3 select-none active:cursor-grabbing",onMouseDown:N,children:[u("p",{className:"typo-compact-xs2-semibold text-fg-default min-w-0 flex-1",children:C("move.amr.rightPanel.debug.title","Debug")}),x("div",{className:"flex h-8 shrink-0 cursor-default items-center gap-2",onMouseDown:M=>M.stopPropagation(),onPointerDown:M=>M.stopPropagation(),children:[u("p",{className:"typo-compact-xs2-normal text-fg-subtle",children:y("move.amr.rightPanel.controlPanel.transparency")}),x("p",{className:"typo-compact-xs2-semibold text-fg-default w-8 text-right",children:[h,"%"]}),u(Ms,{value:[h],min:0,max:100,step:1,onValueChange:M=>g(M[0]),className:"w-24"})]}),u(Yt,{icon:u(Nb,{}),variant:"transparent",size:"2xs",onClick:s,onMouseDown:M=>M.stopPropagation()})]}),x(U,{className:"min-h-0 w-full max-w-full min-w-0 flex-1",children:[R?x(H,{className:"shrink-0 items-center gap-2 px-3 py-2",children:[u(et,{className:"min-w-0 flex-1",size:"xs2",type:"search",value:o,placeholder:C("move.amr.rightPanel.debug.search","Search"),handleChange:M=>r(String(M??"")),handleReset:()=>r("")}),A]}):u(H,{className:"shrink-0 justify-end px-3 py-2",children:A}),u(U,{className:"min-h-0 w-full max-w-full min-w-0 flex-1 overflow-x-hidden overflow-y-auto",children:R?E.length>0?E.map(M=>x(U,{className:"border-subtler w-full max-w-full min-w-0 shrink-0 gap-2 border-b px-5 py-4",children:[x(H,{className:"min-w-0 items-center justify-between gap-2",children:[u("div",{className:"min-w-0 flex-1",children:u("p",{className:"typo-compact-sm2-semibold text-fg-subtle min-w-0 break-words",children:M.label})}),u(lh,{type:"soft",color:"gray",className:"shrink-0",children:M.items.length})]}),u("div",{className:"grid w-full min-w-0 shrink-0 grid-cols-2 gap-1.5",children:M.items.map((O,B)=>u(Vkt,{item:O,currentLanguage:S},`${M.id}-${B}`))})]},M.id)):u(gK,{className:"h-full min-h-40 shrink-0 [&_[data-slot='empty-view-section']]:h-full",type:"icon",message:C("move.amr.rightPanel.debug.noSearchResults","No matching debug items.")}):u(gK,{className:"h-full min-h-40 shrink-0 [&_[data-slot='empty-view-section']]:h-full",type:"icon",message:C("move.amr.rightPanel.debug.waitingInfoStatus","Waiting for infoStatus data.")})})]}),u("div",{"aria-label":"Resize AMR debug panel",className:"absolute right-0 bottom-0 z-10 flex size-5 cursor-se-resize items-end justify-end p-1",role:"separator",onMouseDown:k,children:u("span",{className:"border-fg-subtlest block size-2.5 border-r-2 border-b-2 opacity-70"})})]})})},Hkt=Ekt(Wkt),$kt=({isFullscreen:i,onToggle:e})=>{const{t}=q();return u(Qk,{id:"fullscreen-toggle-tooltip",label:t(i?"move.amr.panel.fullscreen.exit":"move.amr.panel.fullscreen.enter"),icon:i?u(Aje,{className:"h-4 w-4"}):u(_9,{className:"h-4 w-4"}),onClick:e})},Ukt=({showJoysticks:i,setShowJoysticks:e})=>{const{t}=q();return u(Qk,{id:"joystick-toggle-tooltip",label:t("move.amr.panel.virtualJoysticks"),icon:u(TLe,{className:"relative z-10 h-4 w-4"}),onClick:()=>e(!i),isOpen:i})},{useRef:jkt}=await F("react"),Gkt=({showViewControls:i,setShowViewControls:e,...t})=>{const{t:n}=q(),s=jkt(null);return Oje(s,()=>{e(!1)}),x("div",{ref:s,className:"relative",children:[u(Qk,{id:"view-controls-tooltip",label:n("move.amr.panel.viewportVisibility"),icon:u(Eie,{className:"relative z-10 h-4 w-4"}),onClick:()=>e(!i),isOpen:i}),i?u(Fqe,{...t,className:"absolute -top-20 right-full mr-2"}):null]})},{useCallback:Ns,useEffect:tx,useMemo:cU,useRef:LF,useState:mf}=await F("react"),dU={fullscreen:"right-6",menuExpanded:"right-113",menuCollapsed:"right-92"},uU={fullscreen:"right-2",menuExpanded:"right-[8.25rem]",menuCollapsed:"right-[3.25rem]"},qkt=({isFullscreen:i,isMenuExpanded:e})=>i?dU.fullscreen:e?dU.menuExpanded:dU.menuCollapsed,x_e=(i,e)=>{const t=new URL(i.startsWith("http")?i:`http://${i}`);return t.port=String(e),t.pathname="",t.search="",t.hash="",t.toString().replace(/\/$/,"")},Kkt=({robotModel:i})=>{const{t:e}=q(),{selectedRobot:t}=Fi(i),{data:n}=Jm(),[s,o]=mf(!1),{data:r}=Fje({robot_model:i,enabled:s}),[a,l]=xc(),c=a.get("expended")==="1",d=a.get("debug")==="1",h=a.get("menu")||"monitor",g=a.get("monitor_tab"),m=h==="monitor"&&(g==="pdu"||g==="motor"),f=h==="monitor"&&g==="task",{data:p}=ISt({robot_model:i},{enabled:d}),_=LF(null),[b,v]=mf(!1),[w,y]=mf(!1),[S,C]=mf(!1),[N,k]=mf(!1),[L,D]=mf(!1),T=N||L,{data:E,loading:R}=zSt(i,w),[A,M]=mf(null),[O,B]=mf(!1),[z,Y]=mf({}),$=LF({}),{modal:Z}=Vi(),{confirmDialog:K}=jn(),V=LF(null),{ready:fe,selectedObjects:Q,selectedNode:re,selectedNodeTransform:ve,focusedLinkId:_e,selectedLinks:Le,selectedZoneIds:Ie,focusedZoneId:Te,nodes:lt,links:it,zones:Ct,mapBounds:ft,zoneDraft:Xt,worldStudioStateProps:Mt}=kDe(),Ht=Ns((ht,Mi)=>{V.current?.emit(ht,Mi)},[]),Mn=Ns(ht=>{Ht("ui:link-visibility-filter-requested",{filter:ht})},[Ht]),{linkVisibilityFilter:Cs,setLinkVisibilityFilter:or,visibleSelectedLinks:ge,visibleFocusedLink:Ue,selectedLinkOverlayItems:Ee,focusedLinkAnchor:Ne}=mSt({nodes:lt,selectedLinks:Le,focusedLinkId:_e,onLinkVisibilityFilterChange:Mn}),{focusedZone:le,selectedZoneOverlayItems:Pe,focusedZoneAnchor:Re}=pSt({zones:Ct,selectedZoneIds:Ie,focusedZoneId:Te}),We=Bqe({anchorObject:Ue||le?null:re,anchorWorldPosition:Ue?Ne:le?Re:null,worldStudioRef:V,viewportHostRef:_}),ct=Ns(()=>V.current?.getPreviewTransform()??null,[]),gn=Ns(()=>V.current?.getMapPointsData()??[],[]),$n=Ns(()=>V.current?.getTopologyData()??{format_version:fB,nodes:[],links:[],zones:[]},[]);tx(()=>{o(!1)},[i]);const[Ln,yi]=mf(null),{baseAmrStatus:oi,amrMoveStatus:Xn,amrInfoStatus:go,amrSafetyIoStatus:wo,taskLogData:Kr,monitorStatusSnapshot:hl,hudStatusSnapshot:da}=SNt({selectedRobotModel:i,enableInfoStatus:d||m,enableTaskLogRefetch:f}),{data:gl}=soe({robot_model:i},{enabled:!!i}),jo=gl?.mapName,Vh=gl?.result==="accept"?gl.message==="las"?"las":"csv":void 0,{mapListData:Ts}=Xxt(i),ad=cU(()=>Ts?.list?.map(ht=>ht.mapName),[Ts?.list]),{mapCloud:Gd,mapCloudUpdatedAt:$u,mapCloudStream:ua,topology:es,topologyUpdatedAt:Lt,refetchTopology:Ei}=dxt({selectedRobotModel:i,mapName:jo,pointCloudFormat:Vh}),{data:Ss}=mxt(ua),{currentMapInfo:Pi}=oxt({currentMapName:jo,mapListData:Ts}),{nodeTypeCounts:Jr,topologyCount:Oa}=yIt({nodes:lt,topologyData:es?.nodes}),Fa=es?.metadata?.created_at??es?.metadata?.createdAt??null,{downloadJsonFile:Dn,downloadCsvFile:Lr}=Vqe(),{refetch:tf,isFetching:Dr}=LIt({robot_model:i,mapName:jo??""},{enabled:!1}),{selectedTool:Tr,onToolChange:ha}=zqe(),{showGrid:Hb,showJoysticks:cn,setShowJoysticks:Me,showViewControls:bt,setShowViewControls:Kt,showNodeLabels:Vs,showSimpleNodes:Qs,showLidar:Co,showMapBoundary:ml,lidarPointSize:ld,viewportCameraMode:Uu,visibilityItems:zh,cameraModeControl:Er,cameraMoveControl:$b,renderingSettingItems:Ub,mapPointHeightClip:$L,pointCloudHeightClipControl:UL}=Wqe(ft),{isEraserEnabled:jb,setIsEraserEnabled:xw,eraserRadius:Tc,setEraserRadius:R2,selectedNodeType:jL,setSelectedNodeType:GL,selectedNodePlacementType:qL,setSelectedNodePlacementType:z7,hasUnsavedTopologyChanges:Gb,resetTopologyDirty:M2,selectedEraserPointsCount:pS,setSelectedEraserPointsCount:qb,hasUnsavedCloudChanges:_S,setHasUnsavedCloudChanges:Wg}=CIt({editorReady:fe,worldStudioRef:V}),Hg=Ns(ht=>{if(jb){if(ht!=="select"&&ht!=="target")return;xw(!1),Ht("ui:eraser-toggle-requested",!1)}ha(ht)},[Ht,jb,ha,xw]);tx(()=>{Ie.length>0&&(Tr==="rotate"||Tr==="scale")&&Hg("move")},[Hg,Tr,Ie.length]);const{linearJogSpeed:Nw,setLinearJogSpeed:bS,rotationJogSpeed:A2,setRotationJogSpeed:KL}=wIt(),{handleJoystickMove:O2,handleButtonMove:W7}=BSt({robotModel:i,linearSpeed:Nw,rotationSpeed:A2}),{loadMapAndRefreshCurrentMap:F2,loadTopology:Kb,handleLoadMap:Iw}=Yxt({selectedRobotModel:i}),{handleStartLocalization:JL,handleInitLocalization:kw,handleSemiAutoInitLocalization:H7,handleStopLocalization:Jb}=Kxt({selectedRobotModel:i,getPreviewTransform:ct}),{handleInitLocalizationWithGuard:$7,handleSemiAutoInitLocalizationWithGuard:B2}=Txt({selectedRobotModel:i,currentMapName:jo,currentMapInfo:Pi,mapListData:Ts,topologyNodes:es?.nodes,hasUnsavedTopologyChanges:Gb,handleInitLocalization:kw,handleSemiAutoInitLocalization:H7}),{handleSetMotorLocked:YL,handleMoveTarget:XL,handleMoveGoal:vS,handleMoveLinear:Yb,handleDock:Op,handleDockPause:V2,handleDockResume:z2,handleDockStop:Xb,handleUndock:Qb,handleClearSafetyFlag:W2,handleSetSafetyField:H2,handleSetSafetyIo:To,handleSetDetectMode:Go}=_It({selectedRobotModel:i}),nf=Ns(()=>{if(!re)return;if(Gb){rt.openToast({type:"basic",variant:"warning",title:"Unsaved Topology Changes",content:"Please save topology changes before moving the robot.",position:"top-right"});return}const ht=re.userData?.id;typeof ht=="string"&&vS({goalId:ht})},[vS,Gb,re]),Ba=Ns(()=>{Q.length!==0&&Ht("ui:nodes-delete-requested",void 0)},[Ht,Q.length]),Va=Ns(()=>{V.current?.moveCamera("focus")},[]),za=Ns(async()=>{const{data:ht}=await tf();ht&&Dn("topology.json",{format_version:ht.format_version??fB,metadata:ht.metadata,nodes:ht.nodes,links:ht.links,zones:ht.zones})},[Dn,tf]),Eo=Ns(()=>{const ht=gn();if(!ht?.length){rt.openToast({type:"basic",variant:"warning",title:e("move.amr.toast.title.mapDownload.fail"),content:e("move.amr.toast.content.mapDownload.fail"),position:"top-right"});return}const Mi=jo?`${jo}_cloud.csv`:"cloud.csv";Lr(Mi,ht)},[jo,Lr,gn,e]),Zb=Ns(()=>{Ht("ui:map-points-erase-history-clear-requested",void 0),Wg(!1)},[Ht,Wg]),{handleSaveTopologyChanges:ev,handleCancelTopologyChanges:QL,handleSaveCloud:sf,isTopologySaving:Wh}=ixt({selectedRobotModel:i,currentMapName:jo,getMapPointsData:gn,getTopologyData:$n,loadMapAndRefreshCurrentMap:F2,loadTopology:Kb,refreshTopologyData:Ei,onTopologySaved:M2,onTopologyCanceled:M2,onCloudSaved:Zb}),{mappingPoints:U7,mappingKeyFrame:j7,mappingStatus:of,elapsedSeconds:G7,completedKeyframeCount:$g,totalKeyframePoints:rf,handleStartMapping:Fp,handleStopMapping:tv,handleSaveMapping:q7,handleDiscardMapping:qd}=cNt({selectedRobotModel:i,emit:Ht,loadMapAndRefreshCurrentMap:F2}),{handleEraserToggle:K7,handleDeletePoints:ZL,handleReleasePoint:$2,handleEraserRadiusChange:Lw,handleAddNodeAtRobot:nv,handleAddNodeAtCursor:U2,handleDeleteLastSelectedNode:eD,handleNodeUpdate:J7,handleNodeTypeChange:Bp,handleSelectedNodesTransform:af,handleCreateLinks:Dw,handleCreateLinksByShortcut:j2,setLinkCreationSettings:tD,handleDeleteLinksBetweenSelected:nD,handleLinkUpdate:iD,handleLinkDelete:sD,handleLinkFocus:oD}=Ixt({emit:Ht,nodes:lt,selectedObjects:Q,selectedNodeType:jL,onToolChange:ha,setIsEraserEnabled:xw,setEraserRadius:R2}),yS=Ns(()=>{Ht("ui:map-points-restore-requested",void 0),qb(0),Wg(!1)},[Ht,Wg,qb]),G2=Ns(()=>{qb(0),Wg(!1)},[Wg,qb]),q2=Ns(()=>{pS!==0&&(ZL(),Wg(!0))},[ZL,pS,Wg]);Hqe({tools:{selectedTool:Tr,onToolChange:Hg,hasSelectedNode:Q.length>0,hasSelectedZone:Ie.length>0},topology:{selectedNodePlacementType:qL,onAddNodeAtRobot:nv,onAddNodeAtCursor:U2},selection:{hasSelectedNodes:Q.length>0,onDeleteSelectedNodes:Ba},camera:{hasSelectedNode:Q.length>0,onFocusSelectedNode:Va},link:{selectedNodeCount:Q.length,onCreateLinks:j2},zone:{state:Xt.state,pointCount:Xt.pointCount,onCloseDraft:()=>{V.current?.closeZoneDraft()}}});const rD=LF(Xn.moveState?.pathState);tx(()=>{const ht=rD.current,Mi=Xn.moveState?.pathState;Mi!==void 0&&(ht==="req_path"&&Mi==="none"&&rt.openToast({type:"basic",variant:"danger",title:"Move Failed",content:"No path to target. Check topology or robot position.",position:"top-right"}),rD.current=Mi)},[Xn.moveState?.pathState]);const K2=$qe({loading:oi.loading,isDefaultData:oi.isDefaultData,mapCloud:Gd,topology:es,nodes:lt,links:it}),Tw=Ns(async(ht,Mi)=>of==="saving"||of==="discarding"?!1:of==="idle"?!0:await K({title:e("move.amr.rightPanel.map.dialog.discardMapping.title"),content:ht,buttonText:{yes:Mi,no:e("move.amr.rightPanel.common.cancel")}})?(await qd(),!0):!1,[K,qd,of,e]),Ew=Ns(async(ht,Mi)=>_S?await K({title:"Discard erasing changes?",content:ht,buttonText:{yes:Mi,no:e("move.amr.rightPanel.common.cancel")}})?(yS(),!0):!1:!0,[K,yS,_S,e]),Vp=Ns(async()=>Xt.state!=="drawing"&&Xt.state!=="closed"?!0:await K({title:"Leave Zone",content:"Leaving Topology will discard the current zone draft. Continue?",buttonText:{yes:"Leave",no:e("move.amr.rightPanel.common.cancel")}})?(V.current?.cancelZoneDraft(),!0):!1,[K,e,Xt.state]),wS=Ns(async({currentMenuId:ht,nextMenuId:Mi})=>{switch(ht){case"map":return await Tw(e("move.amr.rightPanel.map.dialog.discardMapping.leaveMenuContent"),e("move.amr.rightPanel.map.dialog.discardMapping.yes"))?Ew("Leaving the map menu will discard erased point changes.",e("move.amr.rightPanel.map.dialog.discardMapping.yes")):!1;case"topology":return Mi!==ht&&(Xt.state==="drawing"||Xt.state==="closed")?Vp():!0;default:return!0}},[Ew,Tw,Vp,Xt.state,e]),ga=Ns(async()=>{of==="saving"||of==="discarding"||!await Tw(e("move.amr.rightPanel.map.dialog.discardMapping.loadMapContent"),e("move.amr.rightPanel.map.dialog.discardMapping.loadYes"))||!await Ew("Loading another map will discard erased point changes.",e("move.amr.rightPanel.map.dialog.discardMapping.loadYes"))||Z({component:Uqe,props:{currentMap:jo??"",onLoadMap:Iw,mapList:Ts}})},[Tw,Ew,jo,Iw,Ts,of,Z,e]),aD=Ns(()=>{C(ht=>!ht)},[]),gr=Ns(()=>{const ht=new URLSearchParams(a);d?ht.delete("debug"):ht.set("debug","1"),l(ht,{replace:!0})},[d,a,l]),J2=Ns(()=>{const ht=new URLSearchParams(a);ht.set("menu","topology"),ht.set("topology_tab","node"),ht.set("expended",c?"1":"0"),l(ht,{replace:!0})},[c,a,l]),lD=Ns(()=>{const ht=new URLSearchParams(a);ht.set("menu","topology"),ht.set("topology_tab","link"),ht.set("expended",c?"1":"0"),l(ht,{replace:!0})},[c,a,l]),Pw=Ns(()=>{const ht=new URLSearchParams(a);ht.set("menu","topology"),ht.set("topology_tab","zone"),ht.set("expended",c?"1":"0"),l(ht,{replace:!0})},[c,a,l]),Y7=Ns((ht,Mi="replace")=>{Ht("ui:node-selected",{nodeId:ht,intent:Mi})},[Ht]),X7=Ns(()=>{V.current?.moveCamera("zoomin")},[]),cD=Ns(()=>{V.current?.moveCamera("zoomout")},[]),X=Ns(ht=>{V.current?.moveCamera(ht)},[]),ne=Ns(()=>{if(!(oi?.motor?.[0]?.status===1&&oi?.motor?.[1]?.status===1&&oi?.robotState?.power)){rt.openToast({type:"basic",variant:"warning",title:"Motor Not Initialized",content:"Please initialize the motor before docking.",position:"top-right"});return}yi(null),Op(yi)},[oi?.motor,oi?.robotState?.power,Op]),we=Ns(()=>{const ht=_.current;if(ht){if(document.fullscreenElement===ht){document.exitFullscreen();return}if(L){D(!1);return}if(document.fullscreenEnabled&&ht.requestFullscreen){ht.requestFullscreen().catch(()=>{D(!0)});return}D(!0)}},[L]);tx(()=>{const ht=()=>{k(document.fullscreenElement===_.current)};return document.addEventListener("fullscreenchange",ht),()=>{document.removeEventListener("fullscreenchange",ht)}},[]);const Se=Sxt({robotModel:i,monitorStatusSnapshot:hl,robotVersion:r,selectedTool:Tr,onToolChange:Hg,onStartLocalization:JL,onInitLocalization:$7,onSemiAutoInitLocalization:B2,onStopLocalization:Jb,onBuildInfoOpenChange:o,onDock:ne,onDockPause:V2,onDockResume:z2,onDockStop:Xb,onUndock:Qb,dockRejectMessage:Ln,taskLogData:Kr,amrMoveStatus:Xn,onSetMotorLocked:YL,onClearSafetyFlag:W2,onLidarFieldSave:H2,onOssdDetectChange:Go,safetyIo:wo,safetyIoLoading:go.loading,onSetSafetyIo:To}),Be=pxt({currentMapName:jo??"",createdAt:Pi?.createdAt,lastModified:Pi?.updatedAt,mapCloudCount:Vh==="las"?Ss?.pointCount??0:Gd?.rowCount??Gd?.data?.length??0,mapBounds:ft,topologyCount:Oa,nodeTypeCounts:Jr,mappingStatus:of,elapsedSeconds:G7,completedKeyframeCount:$g,totalKeyframePoints:rf,onStartMapping:Fp,onStopMapping:tv,onSaveMapping:q7,onDiscard:qd,mapList:ad,isEraserEnabled:jb,onEraserToggle:K7,eraserRadius:Tc,setEraserRadius:Lw,eraseSelectedAreaDisabled:pS===0,onEraseSelectedArea:q2,onReleaseSelectedPoints:$2,onSaveChanges:sf,hasUnsavedCloudChanges:_S,onDiscardCloudChanges:yS,onLoadMap:ga,loadMapDisabled:!1,onDownloadMap:Eo,downloadMapDisabled:_S||!jo}),Xe=Nxt({overviewTabProps:{createdAt:Fa,downloadDisabled:Gb||Dr||!jo,downloadHelpText:Gb?"Save topology changes before downloading the server topology.json file.":void 0,onDownloadTopology:za},nodeTabProps:{nodes:lt,selectedObjects:Q,selectedNodeTransform:ve,robotPose:Xn?.pose??null,onNodeSelected:Y7,selectedTool:Tr,onToolChange:Hg,selectedNodeType:jL,onSelectNodeType:GL,selectedNodePlacementType:qL,onSelectNodePlacementType:z7,onAddNodeAtRobot:nv,onAddNodeAtCursor:U2,onUpdateNode:J7,onChangeNodeType:Bp,onTransformSelectedNodes:af,onDeleteSelectedNodes:Ba,onSaveTopologyChanges:ev,onCancelTopologyChanges:QL},linkTabProps:{selectedObjects:Q,focusedLinkId:_e,linkVisibilityFilter:Cs,nodes:lt,links:it,visibleSelectedLinks:ge,onFocusedLinkChange:oD,onLinkVisibilityFilterChange:or,onToolChange:Hg,onCreateLinks:Dw,onLinkCreationSettingsChange:tD,onUpdateLink:iD,onDeleteLink:sD,onDeleteLinksBetweenSelected:nD,onSaveTopologyChanges:ev,onCancelTopologyChanges:QL},zoneTabProps:{draft:Xt,selectedZoneIds:Ie,focusedZoneId:Te,zones:Ct,onDraftStart:ht=>{V.current?.startZoneDraft(ht)},onDraftCancel:()=>{V.current?.cancelZoneDraft()},onDraftClear:()=>{V.current?.clearZoneDraft()},onDraftUndo:()=>{V.current?.undoZoneDraft()},onDraftClose:()=>{V.current?.closeZoneDraft()},onDraftReopen:()=>{V.current?.reopenZoneDraft()},onDraftCommit:()=>{V.current?.commitZoneDraft()},onDraftMetaChange:ht=>{V.current?.updateZoneDraftMeta(ht)},onDeleteZone:ht=>{V.current?.deleteTopologyZone(ht)},onEditZone:ht=>{V.current?.startZoneEdit(ht)},onFocusedZoneChange:ht=>{V.current?.focusActiveTopologyZone(ht)},hasUnsavedTopologyChanges:Gb,isTopologySaving:Wh,onSaveTopologyChanges:ev,onCancelTopologyChanges:QL}}),ut=Ns(ht=>{const Mi=V.current?.getTopologyData();Mi&&(Mi.nodes.some(Es=>Es.id===ht.id)||Ht("ui:topo-update-requested",{topoData:{...Mi,nodes:[...Mi.nodes,ht]}}))},[Ht]),kt=Tkt({robotModel:i,enabled:h==="marker",mapName:jo,topology:es,robotPose:Xn?.pose?{x:Number(Xn.pose.x??0),y:Number(Xn.pose.y??0),rz:Number(Xn.pose.rz??0)}:null,onNodeRegistered:ut}),Bt=cU(()=>({...K2,showRobotControlBtn:!S,onToggleRobotControl:aD,showCameraStreams:b,onToggleCameraStreams:()=>v(ht=>!ht),showObstacleMap:w,onToggleObstacleMap:()=>y(ht=>!ht),showDebugPanel:d,onToggleDebugPanel:gr,isFullscreen:T,isMenuExpended:c}),[K2,aD,gr,d,S,w,b,T,c]),Qt=qkt({isFullscreen:T,isMenuExpanded:c}),on=T?uU.fullscreen:c?uU.menuExpanded:uU.menuCollapsed,hn=P("bottom-21 z-[60] flex flex-col items-end gap-1",T?"absolute":"fixed",Qt),ti=P("z-[70]",T?"absolute bottom-11 left-1/2 -translate-x-1/2":P("fixed bottom-21",Qt)),xs=P("z-50",T?"absolute bottom-11 left-1/2 -translate-x-1/2":P("fixed bottom-21",Qt)),us=P("z-[70] flex items-end justify-end gap-1",T?"absolute bottom-11 left-1/2 -translate-x-1/2":P("fixed bottom-21",Qt)),Ri=C9()||window.location.hostname,Vn=S||Number(b)+Number(w)+Number(d)>1,In=3e3,Po=8889,mr=n?.ip||Ri,Pr=x_e(Ri,In),zs=x_e(mr,Po);tx(()=>{if(!b)return;const ht=new AbortController;return(async()=>{B(!0);try{const Es=await fetch(`${Pr}/amr/${i}/capability/camera`,{signal:ht.signal});if(!Es.ok)throw new Error(`bad status code ${Es.status}`);const ma=await Es.json();if(ht.signal.aborted)return;M(ma),Y(mo=>{const Ro={...mo},qo=ma.rtspInfo??[];for(const rr of qo){const Wa=qo.filter(fa=>fa.camId===rr.camId).map(fa=>fa.quality);(Ro[rr.camId]===void 0||!Wa.includes(Ro[rr.camId]))&&(Ro[rr.camId]=Wa.find(fa=>fa==="low")??Wa[0]??rr.quality)}return Ro})}catch(Es){ht.signal.aborted||(console.error(Es),M(null))}finally{ht.signal.aborted||B(!1)}})(),()=>ht.abort()},[Pr,i,b]),tx(()=>{if(!b){$.current={};return}if(!A)return;const ht=A.rtspInfo??[],Mi=Array.from(new Set(ht.map(Es=>Es.camId)));for(const Es of Mi){const ma=ht.filter(qo=>qo.camId===Es).map(qo=>qo.quality),mo=z[Es],Ro=mo&&ma.includes(mo)?mo:ma.find(qo=>qo==="low")??ma[0];Ro&&$.current[Es]!==Ro&&($.current[Es]=Ro,fetch(`${Pr}/amr/${i}/sensor/rtsp/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({camId:Es,quality:Ro})}).catch(qo=>{console.error(qo)}))}},[Pr,A,i,z,b]);const fr=cU(()=>{if(!A)return[];const ht=A.rtspInfo??[],Mi=new Set(ht.map(mo=>mo.camId)),Es=A.info.map(mo=>mo.camId);return(A.camNum>0?Array.from({length:A.camNum},(mo,Ro)=>Ro):Array.from(new Set([...Es,...Mi]))).map(mo=>{const Ro=ht.filter(Rr=>Rr.camId===mo),qo=Ro.map(Rr=>Rr.quality),rr=z[mo],Wa=rr&&qo.includes(rr)?rr:qo.find(Rr=>Rr==="low")??qo[0]??"low",fa=Ro.find(Rr=>Rr.quality===Wa)??Ro[0];return{id:`cam${mo}`,camId:mo,name:e("move.amr.rightPanel.cameraPanel.cameraName",{index:mo+1}),status:fa?"live":"disconnected",resolution:fa?`${fa.width}x${fa.height} ${fa.fps}fps`:"-",streamUrl:fa?`${zs}/${fa.name}`:void 0,quality:Wa,qualityOptions:qo}})},[A,z,e,zs]),cd=Ns((ht,Mi)=>{Y(Es=>({...Es,[ht]:Mi}))},[]),ic=()=>We?Ue?u(Qqe,{x:We.x,y:We.y,placement:We.placement,items:Ee,activeItemId:Ue.id,onSelectItem:oD,onEdit:lD,onDelete:()=>{sD(Ue.id)}}):le&&Xt.state==="idle"?u(Zqe,{x:We.x,y:We.y,placement:We.placement,items:Pe,activeItemId:le.id,onSelectItem:ht=>{V.current?.focusActiveTopologyZone(ht)},onEdit:()=>{Pw(),V.current?.startZoneEdit(le.id)},onDelete:async()=>{await K({title:"Delete Zone",content:"Delete this selected zone?",buttonText:{yes:"Delete",no:"Keep"}})&&V.current?.deleteTopologyZone(le.id)}}):re?u(eKe,{x:We.x,y:We.y,placement:We.placement,currentX:re.position.x,currentY:re.position.y,currentRz:re.rotation.z,nodeName:re.name||"-",onEdit:J2,onDelete:eD,onMove:nf}):null:null;return x(o6,{className:P("AmrMove","overflow-x-hidden"),menus:[{id:"monitor",label:e("move.amr.rightPanel.menu.monitor"),icon:u(Bje,{}),content:u(WIt,{...Se})},{id:"map",label:e("move.amr.rightPanel.menu.map"),icon:u(Vje,{}),content:u(XIt,{...Be})},{id:"topology",label:e("move.amr.rightPanel.menu.topology"),icon:u(zje,{}),content:u(Xqe,{...Xe})},{id:"marker",label:e("move.amr.rightPanel.menu.marker"),icon:u(Wje,{}),content:u(okt,{markerProps:kt})}],rightIconPanels:[{key:"zoom-in-out",element:u(H1,{onZoomIn:X7,onZoomOut:cD})},{key:"fullscreen-toggle",element:u($kt,{isFullscreen:T,onToggle:we})},{key:"joystick-toggle",element:u(Ukt,{showJoysticks:cn,setShowJoysticks:Me})},{key:"view-controls",element:u(Gkt,{showViewControls:bt,setShowViewControls:Kt,visibilityItems:zh,cameraModeControl:Er,cameraMoveControl:{...$b,onMove:X},numberItems:Ub,pointCloudHeightClipControl:UL})}],beService:t?.be_service,onBeforeMenuChange:wS,ref:_,viewportFullscreen:T,viewportClassName:"data-[state=fullscreen]:z-[1000] data-[state=fullscreen]:h-[100dvh] data-[state=fullscreen]:w-[100dvw]",children:[u(jqe,{...da}),u(Gqe,{mapName:jo??"",onMapNameClick:ga}),u(kAe,{ref:V,...Mt,cameraPositionKey:DDe,robotModel:i,pointsData:Gd?.data,parsedPointCloudData:Ss??void 0,topoData:es,mapCloudUpdatedAt:$u,topologyUpdatedAt:Lt,mappingPoints:U7,mappingKeyFrame:j7,robotPose:Xn?.pose,selectedTool:Tr,showGrid:Hb,showNodeLabels:Vs,nodeRenderMode:Qs?"simple":"default",showLidar:Co,showMapBoundary:ml,mapPointHeightClip:$L,lidarPointSize:ld,viewportCameraMode:Uu,onEraserHistoryInvalidated:G2,onEraserSelectionChange:qb,robot:i}),ic(),!jb&&u("div",{className:"absolute top-60 left-3 z-20",children:u(TDe,{selectedTool:Tr,onToolChange:Hg,hasSelectedNode:Q.length>0,hasSelectedZone:Ie.length>0})}),cn&&x("div",{className:P("pointer-events-none absolute bottom-21 left-0 flex flex-row justify-between",on),children:[u(Fue,{joystickType:"direction",buttonsDirection:"left",disableDiagonal:!0,className:"pointer-events-auto ml-4 flex items-center justify-center",onJoystickMove:({data:ht})=>{O2({type:"direction",data:ht})}}),u(Fue,{xOnly:!0,joystickType:"curved",buttonsDirection:"right",className:"pointer-events-auto",onJoystickMove:({data:ht})=>O2({type:"curved",data:ht})})]}),(b||w||S||d)&&x("div",{className:S?hn:"pointer-events-none contents",children:[x("div",{className:Vn?S?"flex items-end justify-end gap-1":us:"contents",children:[b&&u("div",{className:Vn?"relative z-70":ti,children:u(qqe,{cameras:fr,onQualityChange:cd,onClose:()=>v(!1)})}),w&&u("div",{className:Vn?"relative z-50":xs,children:u(Kqe,{layers:E.layers,width:E.width,height:E.height,gridSize:E.gridSize,safety:E.safety,loading:R,onClose:()=>y(!1)})}),d&&u("div",{className:Vn?"relative z-60":ti,children:u(Hkt,{onClose:gr,infoStatus:go.data,infoCategories:p?.categories,infoStatusLoading:go.loading,infoStatusIsDefault:go.isDefaultData})})]}),S&&u(Jqe,{robotPose:{x:Number(Xn?.pose?.x??0),y:Number(Xn?.pose?.y??0),yaw:Number(Xn?.pose?.rz??0)},handleButtonJog:W7,onClose:()=>C(!1),onMoveTarget:XL,onMoveLinear:Yb,linearSpeed:Nw,setLinearSpeed:bS,rotationSpeed:A2,setRotationSpeed:KL})]}),u(Yqe,{...Bt})]})},Jkt=({className:i})=>{const{t:e}=q();return u(o6,{className:P("PreviewMove",i),beService:"",menus:[],children:u(U,{className:"h-full",alignItems:"center",justifyContent:"center",children:x("div",{className:"text-fg-subtle text-center text-lg",children:[x("div",{children:[e("move.preview.descriptionLine1"),u("br",{})," ",e("move.preview.descriptionLine2")]}),x("div",{className:"text-fg-subtler text-base",children:[u("br",{})," ",e("move.preview.connectionGuideBefore"),u("br",{})," ",u("span",{className:"bg-fg-brand-hovered rounded-sm px-1.5 py-0.5 text-white",children:"muscat-pk dev"})," ",e("move.preview.connectionGuideAfter")]})]})})})},BAe=({className:i,value:e,disabled:t,onChange:n})=>{const{t:s}=q(),{theme:o}=tt();return x("div",{"data-testid":"rby1-source-switch",className:P("RBY1ControlSourceSwitch","bg-bg-alt-1 inline-flex w-fit gap-1 rounded-md p-1","[&_button]:typo-compact-xs-medium [&_button]:bg-fill-transparent [&_button]:h-5 [&_button]:min-w-[4.125rem] [&_button]:rounded-sm [&_button]:px-1.5 [&_button]:py-0.5 [&_button]:text-white",i),children:[u(se,{className:P({"!bg-fill-navy":e==="real",[o==="light"&&"!text-fg-subtlest"]:e!=="real"}),variant:"transparent",disabled:t,"aria-pressed":e==="real",onClick:()=>n("real"),children:s("move.button.label.real")}),u(se,{className:P({[o==="light"&&"!text-fg-subtlest"]:e!=="ghost",[o==="light"?"!bg-orange-500":"!bg-fill-subtler"]:e==="ghost"}),variant:"transparent",disabled:t,"aria-pressed":e==="ghost",onClick:()=>n("ghost"),children:s("move.rby1.source.ghost")})]})},aL=i=>{const{isMoving:e,isEmergencyStop:t}=dw(i,n=>({isMoving:n?.control_manager?.control_state==="Executing",isEmergencyStop:n?.emo_states?.some(s=>s?.state==="Pressed")}));return{isMoving:e,isEmergencyStop:t}},VAe=()=>ls("common/speedbar"),{useMutation:Ykt}=await F("@tanstack/react-query"),Xkt="/{robot_model}/move_j",Qkt=({robotModel:i,...e})=>Pa.post(Xkt.replace("{robot_model}",i),e),Zkt=()=>Ykt({mutationFn:Qkt}),{useMutation:eLt}=await F("@tanstack/react-query"),tLt="/{robot_model}/move_l",nLt=({robotModel:i,...e})=>Pa.post(tLt.replace("{robot_model}",i),e),iLt=()=>eLt({mutationFn:nLt}),sLt="rby1-minimum-time",oLt=3;function mR(){const i=Number(MLe(sLt));return i>0?i:oLt}const YI=["x","y","z","rx","ry","rz"];function lL(i,e){const t={},n=new Set;return i.forEach((s,o)=>{const r=dR(s)?.component;if(!r)return;const a=e(o,s);a==null?n.add(r):(t[r]??=[]).push(a)}),n.forEach(s=>delete t[s]),t}function ZB(i,e,t){const n=lL(e,s=>t(s)||null);return Object.fromEntries(Object.entries(i).filter(([s])=>s in n))}const zy=(i,e)=>lL(i,(t,n)=>{const s=e(t,n);return s==null?s:Sd(s)});function zAe(i,e){const t={},n={};for(const s of i){const o=dR(s)?.component;if(!o)continue;const r=t[o]??0;t[o]=r+1;const a=e[o]?.[r];a!=null&&(n[s]=ON(a))}return n}const rLt=i=>i==="left_arm"?"right_arm":i==="right_arm"?"left_arm":void 0,WAe=(i,e)=>{const t=e?rLt(i):void 0;return t?[i,t]:[i]},HAe=new Set([0,3,5]),aLt=i=>i.map((e,t)=>HAe.has(t)?e:-e),$Ae=new Set([1,3,5]),lLt=i=>i.map((e,t)=>$Ae.has(t)?-e:e);function cLt({groups:i,component:e,index:t,deltaDeg:n,bothArms:s}){const o={};for(const r of WAe(e,s)){const a=i[r];if(!a||t>=a.length)continue;const l=r!==e&&!HAe.has(t)?-n:n;o[r]=a.map((c,d)=>d===t?c+l:c)}return o}function dLt({cartesians:i,component:e,axis:t,delta:n,bothArms:s}){const o={};for(const r of WAe(e,s)){const a=i[r];if(!a)continue;const l=[...a];l[t]+=r!==e&&$Ae.has(t)?-n:n,o[r]=l}return o}function UAe(i,e,t){return i==="base"?e??{}:{torso:e?.torso??null,right_arm:t?.right_arm??null,left_arm:t?.left_arm??null}}const{useCallback:GD,useEffect:uLt,useMemo:nx,useRef:N_e}=await F("react"),hU={jointDeg:.49,linearMm:1.49,rotDeg:.349},hLt=3,gLt=50,mLt=300,fLt=100,pLt=({robotModel:i,mode:e,component:t,reference:n,bothArms:s,tickModeInput:o,source:r,ghostJointValuesRad:a,onGhostJointsChange:l})=>{const{jointNames:c,jointStates:d}=xp(i),{mutateAsync:h}=Zkt(),{mutateAsync:g}=iLt(),{socketEventEmit:m}=Mg(),f=GD(O=>`rby1/${i}/${O}`,[i]),p=r==="ghost",_=nx(()=>p?zy(c,(O,B)=>a?.[B]):zy(c,O=>d?.[O]?.position),[p,c,a,d]),b=nx(()=>lL(c,O=>p?!0:!!d?.[O]?.is_ready),[p,c,d]),{cartesian_states:v,cartesian_states_torso:w}=dw(i,O=>({cartesian_states:O?.cartesian_states,cartesian_states_torso:O?.cartesian_states_torso}),e==="cartesian"),y=nx(()=>UAe(n,v,w),[n,v,w]),S=nx(()=>e==="joint"?_[t]??[]:y[t]??[],[e,_,y,t]),C=nx(()=>e==="joint"?b[t]??[]:S.map(()=>!0),[e,b,t,S]),N=nx(()=>e==="joint"?c.filter(O=>dR(O)?.component===t):[...YI],[e,c,t]),k=N_e({groups:_,refCartesians:y});k.current={groups:_,refCartesians:y};const L=N_e(null),{data:D}=VAe(),T=Math.min(Math.max(D?.speedbar??1,0),1),E=GD((O,B,z,Y,$=s)=>{if(e==="joint"){const K=cLt({groups:z.groups,component:t,index:O,deltaDeg:B,bothArms:$});return Object.keys(K).length===0?Promise.resolve(void 0):p?(l?.(zAe(c,K)),Promise.resolve(void 0)):Y==="smooth"?(m(f("call_smoothjog_j"),{target:K}),Promise.resolve(void 0)):h({robotModel:i,target:K,minimumTime:mR()})}if(p)return Promise.resolve(void 0);const Z=dLt({cartesians:z.refCartesians,component:t,axis:O,delta:B,bothArms:$});return Object.keys(Z).length===0?Promise.resolve(void 0):Y==="smooth"?(m(f("call_smoothjog_l"),{target:Z,reference:n}),Promise.resolve(void 0)):g({robotModel:i,target:Z,reference:n,minimumTime:mR()})},[e,t,s,p,l,c,h,g,m,f,n,i]),R=GD(()=>{const O=L.current;O&&(O.timer&&(clearTimeout(O.timer),clearInterval(O.timer)),O.release(),L.current=null,!p&&m(f("call_smoothjog_stop"),{}))},[p,m,f]),A=GD(({type:O,index:B})=>{const z=O==="up"?1:-1,Y=(e==="joint"?p?hLt:hU.jointDeg:B<3?hU.linearMm:hU.rotDeg)*T,$=e==="joint"?o?.joint:B<3?o?.distance:o?.rotation,Z=o?$??0:Y,K=k.current;if(!Z)return;if(o&&!p){E(B,z*Z,K,"move").catch(()=>{});return}R();const V=()=>R();window.addEventListener("pointerup",V),window.addEventListener("pointercancel",V),window.addEventListener("blur",V);const fe={timer:null,base:K,delta:0,release:()=>{window.removeEventListener("pointerup",V),window.removeEventListener("pointercancel",V),window.removeEventListener("blur",V)}},Q=()=>{fe.delta+=z*Z,E(B,fe.delta,fe.base,"smooth")};L.current=fe,Q(),o?fe.timer=setTimeout(()=>{L.current===fe&&(fe.timer=setInterval(Q,fLt))},mLt):fe.timer=setInterval(Q,gLt)},[e,o,p,T,E,R]);lA({topic:"common/message",callback:O=>{const B=L.current;!B||p||O?.type!==2||O.sw_name!==i||(B.base=k.current,B.delta=0)},options:{equalityFn:()=>!1}});const M=GD(async(O,B)=>{const z=S[O]??0,Y=await E(O,B-z,k.current,"move",!1);if(Y&&"finish_code"in Y&&Y.finish_code!=="Ok")throw new Error(Y.finish_code)},[S,E]);return uLt(()=>R,[e,n,t,o,R]),{values:S,ready:C,keys:N,handleJogStart:A,handleJogStop:R,handleInputValueChange:M}},eV=({className:i,value:e,items:t,size:n="default",onChange:s})=>{const{theme:o}=tt();return u(bA,{className:P("RBY1SegmentTabs",i),value:e,onValueChange:r=>s(r),children:u(vA,{className:P("w-full rounded-md border-none",n==="sm"?"h-6":"h-7",o==="light"?"bg-fill-navy-subtlest":"bg-fill-subtlest"),children:t.map(r=>u(yA,{value:r.value,disabled:r.disabled,className:P("rounded",n==="sm"?"typo-compact-2xs-medium px-2":"typo-compact-xs2-medium","text-fg-subtle",o==="light"?"data-[state=active]:bg-fill-navy data-[state=active]:text-white":"data-[state=active]:bg-fill-subtler data-[state=active]:text-fg-default"),children:r.label},r.value))})})},{useCallback:I_e,useEffect:k_e,useMemo:_Lt,useState:gU}=await F("react"),bLt=[{value:"joint",labelKey:"move.rby1.jogMode.joint"},{value:"cartesian",labelKey:"move.rby1.jogMode.cartesian"}],vLt=[{value:"base",label:"Base"},{value:"link_torso_5",label:"T5"}],jAe=({className:i,robotModel:e,source:t,ghostJointValuesRad:n,onGhostJointsChange:s})=>{const{t:o}=q(),{theme:r}=tt(),{confirmDialog:a}=jn(),[l,c]=xc(),d=l.get("rby1_jog")??"joint",h=l.get("rby1_tab")??"head",g=l.get("rby1_ref")??"base",m=I_e((K,V)=>{c(fe=>{const Q=new URLSearchParams(fe);return Q.set(K,V),Q},{replace:!0})},[c]),[f,p]=gU(!1),[_,b]=gU(null),[v,w]=gU({}),y=t==="ghost",S=_Lt(()=>ab.filter(K=>d==="joint"||K.value!=="head"),[d]),C=ab.find(K=>K.value===h),N=h==="left"||h==="right";k_e(()=>{y&&d==="cartesian"&&m("rby1_jog","joint")},[y,d,m]),k_e(()=>{d==="cartesian"&&h==="head"&&m("rby1_tab","torso")},[d,h,m]);const{toJointNameText:k}=xp(e),{isMoving:L,isEmergencyStop:D}=aL(e),{selectedRobot:T}=Fi(e),E=T?.connected==="DISCONNECT",{values:R,ready:A,keys:M,handleJogStart:O,handleJogStop:B,handleInputValueChange:z}=pLt({robotModel:e,mode:d,component:C.component,reference:g,bothArms:f,tickModeInput:_,source:t,ghostJointValuesRad:n,onGhostJointsChange:s}),Y=y?!1:L||D||E,$=I_e(async(K,V)=>{const{value:fe,readOnly:Q}=V.target;if(Q)return;const re=Number(fe.replace(/,/g,"")),ve=R[K];if(ve===void 0||!Number.isFinite(re)||Math.abs(re-ve)<5e-4)return;const _e=()=>w(Le=>({...Le,[K]:!Le[K]}));if(console.log("isGhost",y,"next",re,"current",ve),!y&&!await a({title:o("move.rby1.inputMove.title"),content:o("move.rby1.inputMove.content",{key:d==="joint"?k(M[K]):`${k(C.component)} ${M[K].toUpperCase()}`,value:`${re}${d==="joint"||K>2?"°":"mm"}`}),buttonText:{yes:o("common.button.confirm"),no:o("common.button.cancel")}}))return _e();try{await z(K,re)}catch{_e()}},[z,R,y,a,o,d,M,C.component,k]),Z=P("border-border-subtle w-full border-t p-2.5",r==="light"?"bg-default":"bg-alt-2");return u("div",{className:P("RBY1JogControl","h-full",i),children:x(U,{className:"h-full",justifyContent:"space-between",children:[x("div",{className:"h-full flex-1 overflow-y-auto",children:[x(U,{className:P("sticky top-0 left-0 z-2 gap-2.5 p-2.5 pb-2.5",r==="light"?"bg-default":"bg-alt-1"),children:[x(H,{"data-testid":"rby1-jog-mode",alignItems:"center",justifyContent:"space-between",children:[u(ae,{className:"w-36",size:"xs2",value:d,handleChange:K=>m("rby1_jog",String(K)),children:bLt.map(K=>u(J,{value:K.value,disabled:y&&K.value==="cartesian",children:o(K.labelKey)},K.value))}),d==="cartesian"&&u(eV,{className:"w-auto",size:"sm",value:g,items:vLt,onChange:K=>m("rby1_ref",K)})]}),u(eV,{value:h,items:S,onChange:K=>m("rby1_tab",K)})]}),u(U,{className:"gap-2 px-2.5 pb-2",children:M.map((K,V)=>{const fe=R[V],Q=d==="joint"?k(K):K.toUpperCase(),re=d==="joint"||V>2?"°":"mm";return x(U,{className:"gap-1",children:[x(H,{className:"typo-compact-xs-medium gap-1",children:[u("span",{className:P("text-fg-default",d==="cartesian"&&xi[K]),children:Q}),x("span",{className:"text-fg-subtle",children:["(",re,")"]})]}),u(Vse,{step:0,inputMode:"numeric",value:fe===void 0?"":fe.toFixed(3),notAllowedEmptyValue:!0,disableAutoAccel:!0,disableLongPress:!0,detectDobleClick:!0,autoComplete:"off",disabled:Y||fe===void 0||!A[V],inputDisabled:_!==null,onBlur:ve=>$(V,ve),onButtonPointerDown:ve=>O({type:ve,index:V}),onButtonPointerUp:B})]},`${K}-${v[V]??0}`)})})]}),N&&u("div",{className:Z,children:x(H,{className:"gap-2",alignItems:"center",children:[u(tr,{"data-testid":"rby1-both-arms",size:"default",checked:f,onCheckedChange:p}),u("span",{className:"typo-compact-sm-medium text-fg-default",children:o("move.rby1.switch.bothArms")})]})}),u(PPe,{className:Z,currentTab:d==="joint"?"joint":"cartesian",tickModeInput:_,disabled:E&&!y,onChangeTickModeInput:b})]})})},{useMutation:yLt}=await F("@tanstack/react-query"),wLt="/{robot_model}/approach_j",CLt=({robotModel:i,...e})=>Pa.post(wLt.replace("{robot_model}",i),e),Roe=()=>yLt({mutationFn:CLt}),{useMutation:SLt}=await F("@tanstack/react-query"),xLt="/{robot_model}/approach_stop",NLt=({robotModel:i})=>Pa.post(xLt.replace("{robot_model}",i),{}),f6=()=>SLt({mutationFn:NLt}),{useCallback:L_e,useMemo:mU,useState:D_e}=await F("react"),ILt=({className:i,robotModel:e})=>{const{t}=q(),{theme:n}=tt(),[s,o]=D_e("head"),[r,a]=D_e(null),l=ab.find(E=>E.value===s),{jointNames:c,jointStates:d,toJointNameText:h}=xp(e),{isMoving:g,isEmergencyStop:m}=aL(e),{selectedRobot:f}=Fi(e),p=g||m||f?.connected==="DISCONNECT",_=mU(()=>zy(c,E=>d?.[E]?.position),[c,d]),b=mU(()=>lL(c,()=>0),[c]),v=b[l.component]?.length??0,w=mU(()=>ZB(b,c,E=>d?.[E]?.is_ready),[c,d,b]),y=l.component in w,{mutate:S}=Roe(),{mutate:C}=f6(),N=L_e((E,R)=>{Object.keys(R).length!==0&&(a(E),S({robotModel:e,target:R,minimumTime:3}))},[S,e]),k=L_e(()=>{a(null),C({robotModel:e})},[C,e]),L=E=>{const R=_[l.component];return R?{[l.component]:R.map((A,M)=>M===E?0:A)}:{}},D="typo-compact-xs-semibold",T=(p||Object.keys(w).length===0)&&r!=="all";return u("div",{className:P("RBY1ZeroPoseControl","h-full",i),children:x(U,{className:"h-full",justifyContent:"space-between",children:[x(U,{className:"flex-1 gap-2 overflow-y-auto px-3 py-2.5",children:[u(Ag,{subject:t("move.menu.button.label.zeroPose")}),u(eV,{className:"mb-1",value:s,items:ab,onChange:o}),Array.from({length:v},(E,R)=>{const A=`${l.component}-${R}`;return u(Dd,{className:D,size:"sm",variant:"outlined",disabled:(p||!y)&&r!==A,onButtonDown:()=>N(A,L(R)),onButtonUp:k,children:t("move.menu.button.label.moveOrigin",{index:R})},A)}),u(Dd,{className:D,size:"sm",variant:"soft",disabled:(p||!y)&&r!==l.component,onButtonDown:()=>N(l.component,{[l.component]:b[l.component]}),onButtonUp:k,children:t("move.rby1.zeroPose.partAll",{part:h(l.component)})})]}),u("div",{className:P("border-border-subtle w-full border-t p-3",n==="light"?"bg-default":"bg-alt-2"),children:u(Dd,{className:P(D,"w-full"),size:"md",variant:n==="light"?"brand":T?"soft":"inverse",disabled:T,onButtonDown:()=>N("all",w),onButtonUp:k,children:t("move.menu.button.label.moveAllOrigin")})})]})})},{useMemo:kLt}=await F("react"),LLt=i=>{const{jointNames:e,jointStates:t}=xp(i),{cartesian_states:n}=dw(i,s=>({cartesian_states:s?.cartesian_states}));return kLt(()=>{const s=zy(e,h=>t?.[h]?.position),o=Object.keys(lL(e,()=>0)),r=o.length>0&&o.every(h=>h in s),{torso:a,left_arm:l,right_arm:c}=n??{};return{joints:s,cartesians:a&&l&&c?{torso:a,left_arm:l,right_arm:c}:null,complete:r}},[e,t,n])},{useQuery:DLt}=await F("@tanstack/react-query"),EA="/{robot_model}/poses",TLt=({robotModel:i})=>Pa.get(EA.replace("{robot_model}",i)),GAe=(i,e={})=>DLt({queryKey:[EA,i],queryFn:()=>TLt(i),...e}),{useMutation:ELt,useQueryClient:PLt}=await F("@tanstack/react-query"),RLt="/{robot_model}/poses/create",MLt=({robotModel:i,...e})=>Pa.post(RLt.replace("{robot_model}",i),e),ALt=()=>{const i=PLt();return ELt({mutationFn:MLt,onSuccess:()=>{i.invalidateQueries({queryKey:[EA]})}})},{useMutation:OLt,useQueryClient:FLt}=await F("@tanstack/react-query"),BLt="/{robot_model}/poses/{pose_id}/update",VLt=({robotModel:i,poseId:e,...t})=>Pa.put(BLt.replace("{robot_model}",i).replace("{pose_id}",e),t),zLt=()=>{const i=FLt();return OLt({mutationFn:VLt,onSuccess:()=>{i.invalidateQueries({queryKey:[EA]})}})},{useMutation:WLt,useQueryClient:HLt}=await F("@tanstack/react-query"),$Lt="/{robot_model}/poses/{pose_id}/delete",ULt=({robotModel:i,poseId:e})=>Pa.delete($Lt.replace("{robot_model}",i).replace("{pose_id}",e)),jLt=()=>{const i=HLt();return WLt({mutationFn:ULt,onSuccess:()=>{i.invalidateQueries({queryKey:[EA]})}})},{useMutation:GLt}=await F("@tanstack/react-query"),qLt="/{robot_model}/poses/{pose_id}/approach",KLt=({robotModel:i,poseId:e,...t})=>Pa.post(qLt.replace("{robot_model}",i).replace("{pose_id}",e),t),JLt=()=>GLt({mutationFn:KLt}),YLt=.1,qAe=i=>Object.values(i).reduce((e,t)=>e+(t?.length??0),0);function XLt(i,e,t=YLt){const n=Object.keys(i);return n.length===0?!1:n.every(s=>{const o=i[s],r=e[s];return!!o&&!!r&&o.length===r.length&&o.every((a,l)=>Math.abs(a-r[l])<=t)})}const QLt="–",DF="px-px py-1 text-right whitespace-nowrap",KAe=({className:i,mode:e,joints:t,cartesians:n})=>{const{t:s}=q(),o=e==="joint",r=ab.filter(c=>o||c.component!=="head"),a=o?Array.from({length:Math.max(0,...Object.values(t).map(c=>c?.length??0))},(c,d)=>String(d)):YI.map(c=>c),l=c=>o?t[c]:c==="head"?void 0:n?.[c];return u("div",{className:P("RBY1PoseValueTable","overflow-x-auto",i),children:x("table",{className:"typo-code-2xs-medium w-full border-collapse",children:[u("thead",{children:x("tr",{className:"typo-compact-2xs-medium text-fg-subtle",children:[u("th",{className:P(DF,"text-left font-normal"),children:s(o?"move.rby1.monitor.joint":"move.rby1.monitor.tcp")}),a.map(c=>u("th",{className:P(DF,"font-normal",!o&&xi[c]),children:o?c:c.toUpperCase()},c))]})}),u("tbody",{children:r.map(c=>{const d=l(c.component);return x("tr",{className:"border-border-subtle border-t first:border-t-0",children:[u("td",{className:P(DF,"text-fg-default text-left"),children:c.label}),a.map((h,g)=>{const m=d?.[g];return u("td",{className:P(DF,m===void 0?"text-fg-subtlest":"text-fg-default font-semibold"),children:m===void 0?QLt:m.toFixed(1)},h)})]},c.value)})})]})})},{useMemo:ZLt}=await F("react"),JAe=({className:i,pose:e,cameraPositionKey:t})=>{const{data:n}=As(),{data:s}=Ph(),o=ZLt(()=>{const r=e&&s?.components?.[e.robotModel],a=r?.type==="array"?r.mapper:[];return{real:e?zAe(a,e.joints):{}}},[s,e]);return u("div",{className:P("RBY1PoseViewer","bg-bg-alt-1 relative overflow-hidden rounded-lg",i),children:u(Ym,{className:"relative size-full",cameraPositionKey:t,robotModel:n?.info?.robotModel,enablePanning:!0,jointValuesRad:o})})},eDt=({className:i,pose:e,open:t,onOpenChange:n})=>u(Uo,{className:P(i,"w-fit max-w-[90vw]!"),enableDimClose:!0,header:{title:e.name},open:t,onOpenChange:n,children:u(JAe,{className:"m-4 mt-0 h-[60vh] w-[40rem]",pose:e,cameraPositionKey:"rby1-pose-view"})}),{useState:T_e}=await F("react"),tDt=({className:i,pose:e,isCurrent:t,moveDisabled:n,canUpdateToCurrent:s,onApproachStart:o,onApproachStop:r,onRename:a,onUpdateToCurrent:l,onDelete:c})=>{const{t:d}=q(),{modal:h}=Vi(),[g,m]=T_e("joint"),[f,p]=T_e(null),_=f!==null,b=f?.trim()??"",v=[d("move.rby1.savedPose.axisCount",{count:qAe(e.joints)}),Cr(e.updatedAt,"MM-DD HH:mm"),t&&d("move.rby1.savedPose.current")].filter(Boolean).join(" · ");return x(U,{"data-testid":"rby1-saved-pose-card",className:P("RBY1SavedPoseCard","bg-bg-alt-1 gap-3 rounded-lg border p-3",t?"border-border-success":"border-border-subtle",i),children:[_?x(H,{className:"gap-1",alignItems:"center",children:[u(et,{className:"flex-1",size:"sm",value:f,hideBtnReset:!0,handleChange:w=>p(String(w)),handleEnter:()=>{b&&(a(b),p(null))}}),u(Yt,{"aria-label":"confirm",variant:"transparent",size:"xs",disabled:!b,onClick:()=>{a(b),p(null)},children:u($Ke,{className:"text-fg-success size-4"})}),u(Yt,{"aria-label":"cancel",variant:"transparent",size:"xs",onClick:()=>p(null),children:u(Nb,{})})]}):x(H,{justifyContent:"space-between",alignItems:"flex-start",children:[x(U,{className:"min-w-0 gap-1",children:[u("span",{className:"typo-compact-sm-semibold text-fg-default truncate",children:e.name}),u("span",{className:"typo-code-2xs-medium text-fg-subtle",children:v})]}),x(H,{className:"shrink-0 gap-0.5",children:[u(Yt,{"aria-label":"view pose",variant:"transparent",size:"xs",onClick:()=>h({component:eDt,props:{pose:e}}),children:u(Hje,{})}),u(Yt,{"aria-label":"edit",variant:"transparent",size:"xs",onClick:()=>p(e.name),children:u(Oie,{})}),u(Yt,{"aria-label":"delete",variant:"transparent",size:"xs",onClick:c,children:u(Y0,{})})]})]}),x(U,{className:"bg-bg-alt-2 gap-2 rounded-md p-2",children:[x(H,{justifyContent:"space-between",alignItems:"center",children:[u("span",{className:"typo-compact-2xs-medium text-fg-subtle",children:d(g==="joint"?"move.rby1.savedPose.jointTitle":"move.rby1.savedPose.tcpTitle")}),u(eV,{className:"w-auto",size:"sm",value:g,items:[{value:"joint",label:d("move.menu.label.joint")},{value:"cartesian",label:d("move.rby1.savedPose.cartesian"),disabled:!e.cartesians}],onChange:m})]}),u(KAe,{mode:g,joints:e.joints,cartesians:e.cartesians})]}),_?u(se,{className:"w-full",size:"sm",variant:"soft",leadingIcon:u(PLe,{className:"size-4"}),disabled:!b||!s,onClick:()=>{l(b),p(null)},children:d("move.rby1.savedPose.updateToCurrent")}):u(Dd,{className:"w-full",size:"sm",variant:"brand",leadingIcon:u(FLe,{}),disabled:n,onButtonDown:()=>o(g),onButtonUp:r,children:d("move.rby1.savedPose.approach")})]})},{useCallback:E_e,useMemo:nDt,useState:fU}=await F("react"),iDt=({className:i,robotModel:e})=>{const{t}=q(),{confirmDialog:n}=jn(),[s,o]=fU(""),[r,a]=fU(""),[l,c]=fU(null),{data:d=[]}=GAe({robotModel:e}),h=LLt(e),{isMoving:g,isEmergencyStop:m}=aL(e),{selectedRobot:f}=Fi(e),p=f?.connected==="DISCONNECT",_=g||m||p,{mutate:b,isPending:v}=ALt(),{mutate:w}=zLt(),{mutate:y}=jLt(),{mutate:S}=JLt(),{mutate:C}=f6(),N=nDt(()=>{const R=r.trim().toLowerCase();return R?d.filter(A=>A.name.toLowerCase().includes(R)):d},[d,r]),k=()=>({joints:h.joints,cartesians:h.cartesians??void 0}),L=()=>{const R=s.trim();!R||!h.complete||b({robotModel:e,name:R,...k()},{onSuccess:()=>o("")})},D=E_e((R,A)=>{c(R),S({robotModel:e,poseId:R,mode:A,reference:"base",minimumTime:mR()})},[S,e]),T=E_e(()=>{c(null),C({robotModel:e})},[C,e]),E=async R=>{await n({title:t("move.rby1.savedPose.deleteTitle"),content:t("move.rby1.savedPose.deleteContent",{name:R.name}),buttonText:{yes:t("move.rby1.savedPose.delete"),no:t("common.button.cancel")}})&&y({robotModel:e,poseId:R.poseId})};return u("div",{className:P("RBY1SavedPoseControl","h-full",i),children:x(U,{className:"h-full gap-3 overflow-y-auto px-3 py-2.5",children:[x(H,{className:"gap-2",alignItems:"baseline",children:[u("h6",{className:"typo-compact-sm-semibold text-fg-default",children:t("move.rby1.menu.savedPose")}),u("span",{className:"typo-compact-xs-medium text-fg-subtle",children:t("move.rby1.savedPose.count",{count:d.length})})]}),x(U,{className:"border-border-subtle bg-bg-alt-1 gap-2 rounded-lg border p-3",children:[u("span",{className:"typo-compact-xs-medium text-fg-subtle",children:t("move.rby1.savedPose.saveDesc")}),x(H,{className:"gap-2",children:[u(et,{"data-testid":"rby1-saved-pose-name",className:"flex-1",size:"sm",value:s,placeholder:t("move.rby1.savedPose.namePlaceholder"),handleChange:R=>o(String(R??"")),handleEnter:L}),u(se,{size:"sm",variant:"brand",leadingIcon:u(Mm,{}),disabled:!s.trim()||!h.complete||p||v,onClick:L,children:t("move.rby1.savedPose.save")})]})]}),u(et,{className:"w-full",type:"search",size:"md",value:r,placeholder:t("move.rby1.savedPose.searchPlaceholder"),handleChange:R=>a(String(R??""))}),N.length===0?u("span",{className:"typo-compact-xs-medium text-fg-subtle py-6 text-center",children:t("move.rby1.savedPose.empty")}):N.map(R=>u(tDt,{pose:R,isCurrent:XLt(R.joints,h.joints),moveDisabled:_&&l!==R.poseId,canUpdateToCurrent:h.complete&&!p,onApproachStart:A=>D(R.poseId,A),onApproachStop:T,onRename:A=>w({robotModel:e,poseId:R.poseId,name:A}),onUpdateToCurrent:A=>w({robotModel:e,poseId:R.poseId,name:A,...k()}),onDelete:()=>E(R)},R.poseId))]})})},{useMemo:P_e}=await F("react"),sDt=["torso","left_arm","right_arm"],R_e="–",oDt=["mm","mm","mm","°","°","°"],p6=({className:i,robotModel:e,mode:t="joint",source:n="real",ghostJointValuesRad:s})=>{const{t:o}=q(),{jointNames:r,jointStates:a,toJointNameText:l}=xp(e),c=n==="ghost",d=t==="cartesian"&&!c,h=P_e(()=>c?zy(r,(p,_)=>s?.[_]):zy(r,p=>a?.[p]?.position),[c,r,s,a]),g=P_e(()=>Math.max(0,...Object.values(lL(r,()=>1)).map(p=>p.length)),[r]),{cartesian_states:m}=dw(e,p=>({cartesian_states:p?.cartesian_states}),d),f="px-1.5 py-0.5 text-left whitespace-nowrap";return x(U,{className:P("RBY1JogMonitoring","gap-3",i),children:[x("table",{"data-testid":"rby1-joint-table",className:"typo-compact-2xs-medium border-separate border-spacing-0",children:[u("thead",{children:x("tr",{className:"text-fg-subtle font-normal",children:[x("th",{className:P(f,"min-w-16 font-normal"),children:[o("move.rby1.monitor.joint")," (°)"]}),Array.from({length:g},(p,_)=>x("th",{className:P(f,"min-w-14 font-normal"),children:["J",_]},_))]})}),u("tbody",{children:ab.map(p=>{const _=h[p.component]??[];return x("tr",{children:[u("td",{className:P(f,"text-fg-default"),children:l(p.component)}),Array.from({length:g},(b,v)=>u("td",{className:P(f,_[v]===void 0?"text-fg-subtlest":"text-fg-default font-semibold"),children:_[v]===void 0?R_e:_[v].toFixed(3)},v))]},p.value)})})]}),d&&x("table",{"data-testid":"rby1-tcp-table",className:"typo-compact-2xs-medium border-separate border-spacing-0",children:[u("thead",{children:x("tr",{className:"text-fg-subtle font-normal",children:[u("th",{className:P(f,"min-w-16 font-normal"),children:"Base"}),YI.map((p,_)=>u("th",{className:P(f,"min-w-14 font-normal"),children:x(H,{className:"gap-1",children:[u("span",{className:P("font-semibold",xi[p]),children:p.toUpperCase()}),u("span",{children:oDt[_]})]})},p))]})}),u("tbody",{children:sDt.map(p=>{const _=m?.[p];return x("tr",{children:[u("td",{className:P(f,"text-fg-default"),children:l(p)}),YI.map((b,v)=>u("td",{className:P(f,_?"text-fg-default font-semibold":"text-fg-subtlest"),children:_?_[v].toFixed(3):R_e},b))]},p)})})]})]})},{useMutation:rDt}=await F("@tanstack/react-query"),aDt="/{robot_model}/approach_l",lDt=({robotModel:i,...e})=>Pa.post(aDt.replace("{robot_model}",i),e),YAe=()=>rDt({mutationFn:lDt});function cDt({components:i,cartesians:e,poseOf:t}){const n={};for(const s of i){const o=t(s),r=e[s];if(!o?.real||!o.ghost||!r)continue;const a=BPe({target:o.ghost,reference:o.real,referenceCarteX:r});n[s]=[a.x,a.y,a.z,a.rx,a.ry,a.rz]}return n}const{useCallback:pU,useMemo:M_e,useRef:dDt}=await F("react"),uDt=["torso","right_arm","left_arm"],XAe=({robotModel:i,urdfViewerRef:e,isDisconnected:t,tcpJointNames:n,isTorsoScope:s,torsoAnchors:o,torsoConstraintMode:r})=>{const{jointNames:a,jointStates:l}=xp(i),c=M_e(()=>a.map((k,L)=>Sd(l?.[L]?.position??0)),[a,l]),{ik:d,helpers:h}=VPe({robotModel:i,urdfViewerRef:e,isDisconnected:t,jointQDeg:c}),{getRealRobotJointAngles:g,guardConnected:m}=h,{cartesian_states:f}=dw(i,k=>({cartesian_states:k?.cartesian_states})),{mutate:p}=Roe(),{mutate:_}=YAe(),{mutate:b}=f6(),v=dDt(!1),w=pU(k=>{if(!m())return;const L=e.current?.getGhostRobotJointValues()??k.jointAngles,D=ZB(zy(a,(T,E)=>L[E]),a,T=>l?.[T]?.is_ready);Object.keys(D).length!==0&&(v.current=!0,p({robotModel:i,target:D,minimumTime:mR()}))},[m,e,a,l,p,i]),y=pU(()=>{if(!m())return;const k=e.current,L=g();if(!k||!L)return;const D=cDt({components:uDt,cartesians:f??{},poseOf:E=>{const R=ab.find(M=>M.component===E),A=n.find(M=>!!R&&M.toLowerCase().includes(R.value));return A?{ghost:k.getGhostTcpPoseInChainBase(A),real:k.getGhostTcpPoseInChainBase(A,L)}:null}}),T=ZB(D,a,E=>l?.[E]?.is_ready);Object.keys(T).length!==0&&(v.current=!0,_({robotModel:i,target:T,reference:"base",minimumTime:mR()}))},[m,e,g,f,n,a,l,_,i]),S=pU(()=>{v.current&&(v.current=!1,b({robotModel:i}))},[b,i]),C=s&&r==="constrained",N=M_e(()=>({...d.ghostRobotIkOptions,pinnedAnchorJointNamesByAnchor:k=>k!==void 0&&o.includes(k)&&!C?[]:void 0}),[d.ghostRobotIkOptions,o,C]);return{...d,ghostRobotIkOptions:N,ghostRobotTcpOffset:null,handleIKMoveJStart:w,handleIKMoveJStop:S,handleIKMoveLStart:y,handleIKMoveLStop:S}},hDt=[{id:"all",label:"All",groups:["left","right","torso"]},{id:"right",groups:["right"]},{id:"left",groups:["left"]},{id:"torso",groups:["torso"]},{id:"head",groups:["head"]}];function gDt(i,e){return hDt.flatMap(({id:t,label:n,groups:s})=>{const o=s.flatMap(l=>{const c=ab.find(d=>d.value===l);return c?[{group:c,jointNames:e.filter(d=>d.startsWith(c.jointPrefix))}]:[]}),r=n??o[0]?.group.label;if(!r||o.length!==s.length||o.some(l=>l.jointNames.length===0))return[];const a=o.every(({group:l})=>l.tcpGizmo);return[{id:t,label:r,tcpGizmo:a,anchors:a?o.flatMap(({group:l})=>i.filter(c=>c.toLowerCase().includes(l.value))):[],jointNames:o.flatMap(l=>l.jointNames)}]})}function mDt(i,e){return[...new Set([...i,...e])]}function fDt(i,e){return i.find(t=>t.id===e)??i[0]}const{useMemo:A_e,useState:O_e}=await F("react"),QAe=(i,e)=>{const t=A_e(()=>gDt(i,e??[]),[i,e]),[n,s]=O_e(null),[o,r]=O_e("constrained"),a=fDt(t,n),l=a?.id==="torso",c=A_e(()=>t.find(d=>d.id==="torso")?.anchors??[],[t]);return{options:t,selectedId:a?.id,setSelectedId:s,activeAnchors:a?.anchors,tcpGizmo:a?.tcpGizmo??!0,scopeJointNames:a?.jointNames,isTorsoScope:l,torsoAnchors:c,torsoConstraintMode:o,setTorsoConstraintMode:r}};function Moe(i,e,t="position"){const n={};if(!e)return n;for(let s=0;s<i.length&&!(s>=e.length);s++){const o=e[s]?.[t];o!=null&&(n[i[s]]=o)}return n}const{useCallback:F_e,useMemo:_U,useRef:pDt,useState:_Dt}=await F("react"),bDt=["translate","rotate"],vDt=({className:i,robotModel:e})=>{const t=pDt(null),{t:n}=q(),[s]=xc(),o=s.get("rby1_jog")??"joint",{data:r}=As(),a=Zk(t),{isMoving:l}=aL(e),{jointNames:c,jointStates:d}=xp(e),h=_U(()=>({real:Moe(c,d)}),[c,d]),{selectedRobot:g}=Fi(e),m=g?.connected==="DISCONNECT",{tcpJointNames:f,ghostDraggableJointNames:p,isGhostRobotSupported:_}=hoe(e),[b,v]=_Dt([]),w=_U(()=>mDt(f,b),[f,b]),y=QAe(w,p),S=goe(),{ghostJointValues:C,handleGhostRobotJointsChanged:N}=moe(S.isGhostRobot),k=y.tcpGizmo?S.gizmoType:S.gizmoType==="none"?"none":null,L=XAe({robotModel:e,urdfViewerRef:t,isDisconnected:m,isTorsoScope:y.isTorsoScope,torsoAnchors:y.torsoAnchors,torsoConstraintMode:y.torsoConstraintMode,tcpJointNames:f}),{viewerProps:D,itemProps:T}=foe({gizmo:S,ghostRobotIK:L,isMoving:l,gizmoType:k,activeTcpAnchors:y.activeAnchors,draggableJointNames:y.scopeJointNames??p,onGhostRobotJointsChanged:N}),E=S.isGhostRobot?"ghost":"real",{onGhostRobotChange:R}=T,A=F_e(B=>R?.(B==="ghost"),[R]),M=F_e(B=>{t.current?.setGhostRobotJointValues(B),t.current?.resetIKTransform()},[]),O=_U(()=>[{key:"zoom-in-out",element:u(H1,{onZoomIn:a.zoomIn,onZoomOut:a.zoomOut},"zoom-in-out")},{key:"camera-view",element:u(xA,{onSetCameraView:a.setCameraView},"camera-view")},..._?[{key:"ghost-robot",element:u(q9,{...T,disabledGizmoTypes:y.tcpGizmo?void 0:bDt,gizmoOptionsDisabled:!y.tcpGizmo,scopeOptions:y.options,scopeValue:y.selectedId,onScopeChange:y.setSelectedId,isTorsoScope:y.isTorsoScope,torsoConstraintMode:y.torsoConstraintMode,onTorsoConstraintModeChange:y.setTorsoConstraintMode},"ghost-robot")}]:[]],[a.zoomIn,a.zoomOut,a.setCameraView,_,T,y.tcpGizmo,y.options,y.selectedId,y.setSelectedId,y.isTorsoScope,y.torsoConstraintMode,y.setTorsoConstraintMode]);return x(o6,{className:P("RBY1Move",i),rightIconPanels:O,menus:[{id:"jog",label:n("move.menu.button.label.jog"),icon:u(pK,{}),content:u(jAe,{robotModel:e,source:E,ghostJointValuesRad:C,onGhostJointsChange:M})},{id:"zero-pose",label:n("move.menu.button.label.zeroPose"),icon:u($De,{}),content:u(ILt,{robotModel:e})},{id:"saved-pose",label:n("move.rby1.menu.savedPose"),icon:u(RKe,{}),content:u(iDt,{robotModel:e})}],beService:r?.modelInfo?.be_service,children:[u("div",{className:"h-full flex-1 p-2.5",children:x("div",{className:"absolute top-0 left-0 z-1 size-full",children:[u(Ym,{ref:t,className:"relative size-full",cameraPositionKey:"rby1-move",robotModel:r?.info?.robotModel,enablePanning:!0,jointValuesRad:h,onToolJointNamesChange:v,...D}),x(U,{className:"absolute top-0 left-0 z-10 gap-3 p-4",children:[u(BAe,{className:"pointer-events-auto",value:E,disabled:!_,onChange:A}),u(p6,{robotModel:e,mode:o,source:E,ghostJointValuesRad:C})]})]})}),u($9,{isGhostRobot:S.isGhostRobot,ghostRobotIK:L,btnHoverInteraction:$k.isDesktop})]})},yDt=({className:i})=>{const{connected:e}=Mg(),{selectedRobotModel:t}=ui(),{selectedRobot:n}=Fi(t);return u("div",{className:P("MovePage","h-full",i),children:u(H,{justifyContent:"space-between",className:"relative h-full",children:u("div",{className:"size-full flex-1",children:Yl()?u(Jkt,{}):e?x(rn,{children:[n?.be_service==="manipulate"&&u(cSt,{robotModel:t}),n?.be_service==="amr"&&u(Kkt,{robotModel:t}),n?.be_service==="rby1"&&u(vDt,{robotModel:t})]}):u("div",{className:"text-fg-default flex size-full items-center justify-center",children:u(qm,{className:"text-fg-default size-8"})})})})})},wDt=({className:i})=>{const{theme:e}=tt(),{data:t}=Jm(s=>({all_connected:s?.all_connected})),n=P("text-fg-inverse",e==="light"&&"text-white");return x("div",{className:P("HeaderConnectStatusBtn",i),"data-testid":"header-connect-status",children:[x(n1,{className:P("bg-fill-success outline-border-subtle/20 inline-flex h-8 items-center justify-start self-stretch rounded-md pl-2.5 outline outline-1 outline-offset-[-1px]",{"bg-fill-success":t?.all_connected==="STABLE","bg-fill-caution":t?.all_connected==="UNSTABLE","bg-fill-danger":t?.all_connected==="DISCONNECT"}),"data-pad-focus":"true",anchorId:"robot-connection-status",popoverElement:u(aEe,{}),popoverStyle:{top:"0.4rem",left:"-0.7rem"},children:[x("div",{className:"flex flex-1 items-center justify-start gap-1",children:[x("div",{className:"relative h-4 w-4 overflow-hidden",children:[u("div",{className:P("absolute top-[50%] left-[50%] h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",e==="light"?"bg-white/30":"bg-fill-inverse-subtle-hovered/30")}),u("div",{className:P("absolute top-[50%] left-[50%] h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full",e==="light"?"bg-white/40":"bg-fill-inverse-subtle/40")})]}),u("div",{className:"flex flex-1 items-center justify-start overflow-hidden pr-2",children:u("div",{className:P(n,"min-w-17 justify-center text-left font-['Pretendard_Variable'] text-xs leading-4 font-semibold"),children:t?.all_connected})})]}),u(U,{className:"relative size-8 overflow-hidden",alignItems:"center",justifyContent:"center",children:u(Ty,{className:P(n,"absolute top-[50%] left-[50%] size-4 -translate-x-1/2 -translate-y-1/2")})})]}),u("div",{id:"robot-connection-status"})]})},{useCallback:CDt,useEffect:SDt,useRef:B_e}=await F("react"),xDt=({className:i})=>{const e=B_e(null),t=B_e(null),n=CDt(()=>{e.current&&t.current&&(e.current.textContent=Cr(Date.now(),"MM-DD"),t.current.textContent=Cr(Date.now(),"HH:mm"))},[]);return SDt(()=>{n();const s=setInterval(n,1e3);return()=>clearInterval(s)},[n]),x(H,{className:P("HeaderWatch","text-fg-subtle typo-compact-xs-medium h-6 gap-1",i),alignItems:"center",justifyContent:"flex-start",children:[u("span",{ref:e}),u("span",{ref:t})]})},V_e="header-network-badge",NDt=()=>{const{t:i}=q(),{theme:e}=tt(),{data:t,isPending:n}=ZTe({refetchInterval:6e4,refetchOnWindowFocus:!0});if(n)return null;const s=!!t?.internet;return x(rn,{children:[u("span",{id:V_e,className:"inline-flex size-8 items-center justify-center",children:u($je,{className:P("size-5",s?e==="light"?"text-fg-default":"text-fg-information":"text-fg-subtlest")})}),u(pEe,{anchorId:V_e,className:"[&_.speech-bubble]:w-max!",place:"bottom",space:12,children:i(s?"header.title.externalNetwork":"header.title.closedNetwork")})]})},IDt=[{shortLabel:"ENG",label:"ENGLISH",value:"en"},{shortLabel:"KOR",label:"한국어",value:"ko"}],kDt=({className:i})=>{const{changeLanguage:e,currentLanguage:t}=q();return u("div",{className:P("LanguageSelect",i),children:u(ae,{className:"bg-fill-transparent-hovered hover:bg-fill-transparent-hovered! h-8 min-w-0 outline-0! [&_label_span]:text-xs",size:"sm",enableModal:!0,enableGamepadFocus:!0,value:t,onChange:n=>e(n.target.value),children:IDt.map(n=>u(J,{value:n.value,label:u(H,{alignItems:"center",className:"gap-1.5",children:u("span",{children:n.shortLabel})}),children:n.label},n.value))})})},{useQuery:LDt}=await F("@tanstack/react-query"),ZAe="/battery_state",DDt=async()=>Ut.get(ZAe),TDt=(i={})=>LDt({queryKey:[ZAe],queryFn:()=>DDt(),...i}),EDt=i=>{const{data:e,loading:t}=ls("common/battery_state",{selector:i});return{data:e,loading:t}},{useMemo:PDt}=await F("react"),RDt=()=>{const{data:i}=TDt(),{data:e}=EDt();return{batteryState:PDt(()=>({...i,...e}),[i,e])}},{useQuery:MDt}=await F("@tanstack/react-query"),e2e="/version.json",ADt=async()=>{const e=await(await fetch(`${e2e}?t=${Date.now()}`)).json();return{...e,current:e.total??e.current}},ODt=()=>MDt({queryKey:[e2e],queryFn:ADt,staleTime:1e3,gcTime:60*1e3,refetchInterval:60*1e3}),FDt=({className:i})=>{const{theme:e,setThemeData:t}=tt(),n=e==="dark";return u(Yt,{size:"xs2",variant:"transparent",className:P(i),onClick:()=>t(n?"light":"dark"),children:x("span",{className:"relative block h-4 w-4 overflow-hidden",children:[u(Uje,{className:P("absolute inset-0 h-4 w-4 transition-all duration-500 ease-out",n?"translate-y-0 rotate-0 opacity-100":"translate-y-full rotate-90 opacity-0")}),u(jje,{className:P("absolute inset-0 h-4 w-4 transition-all duration-500 ease-out",n?"-translate-y-full -rotate-90 opacity-0":"translate-y-0 rotate-0 opacity-100")})]})})},{useQuery:BDt}=await F("@tanstack/react-query"),t2e="/plugin/{pluginId}",VDt=({pluginId:i})=>{const e=t2e.replace("{pluginId}",i);return Ut.get(e)},cL=(i,e)=>BDt({queryKey:[t2e,i.pluginId],queryFn:()=>VDt(i),enabled:!!i.pluginId,...e}),{useMutation:zDt,useQueryClient:WDt}=await F("@tanstack/react-query"),HDt="/plugin/installed/{pluginId}/enabled",$Dt=({pluginId:i,...e})=>{const t=HDt.replace("{pluginId}",i);return Ut.patch(t,e)},Aoe=()=>{const i=WDt();return zDt({mutationFn:$Dt,onSuccess:(e,{pluginId:t})=>{i.invalidateQueries({queryKey:["/plugin/installed/list"]}),i.invalidateQueries({queryKey:["/plugin/{pluginId}",t]})}})},n2e=({className:i,pluginId:e,pluginName:t,uiContent:n,isPreview:s})=>{const{theme:o}=tt(),{data:r}=cL({pluginId:e},{enabled:!s}),{mutateAsync:a,isPending:l}=Aoe(),c=s||!!r?.enabled,d=async h=>{await a({pluginId:e,enabled:h})};return x(U,{className:P("PluginToolbarContent","bg-bg-overlay text-default",i,{"bg-alt-1":o==="light"}),"data-theme":o,draggable:!1,children:[x(H,{className:"typo-compact-xs2-semibold text-default w-full gap-4 px-3 py-3",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"whitespace-pre",children:t}),u(tr,{size:"default",disabled:s||l,checked:c,onCheckedChange:d})]}),!!n&&u("div",{className:P("bg-alt-2 min-h-0 overflow-y-auto",{"pointer-events-none opacity-40 select-none":!c}),"aria-disabled":!c,children:u(s6,{pluginId:e,ui:n},e)})]})},UDt=({className:i,pluginId:e,pluginName:t,uiContent:n,isPreview:s})=>{const{theme:o}=tt();return u(nse,{className:P("PopoverToolbarContent",i),children:u(n2e,{className:"max-h-[calc(var(--vh,1vh)*70)] min-w-50 rounded-sm",pluginId:e,pluginName:t,uiContent:n,isPreview:s})})},jDt=({className:i,pluginId:e,pluginName:t,uiContent:n,isPreview:s,open:o,onOpenChange:r})=>u(Uo,{className:P("rounded-none",i),type:"right-sheet",hideCloseButton:!0,open:o,onOpenChange:r,children:u(n2e,{pluginId:e,pluginName:t,uiContent:n,isPreview:s})}),i2e=(i,e)=>ls("common/muscat/plugin/resources",{selector:t=>t?.[i],disabled:e}),{useMutation:GDt,useQueryClient:qDt}=await F("@tanstack/react-query"),KDt="/plugin/installed/{pluginId}",JDt=({pluginId:i})=>{const e=KDt.replace("{pluginId}",i);return Ut.delete(e)},Ooe=()=>{const i=qDt();return GDt({mutationFn:JDt,onSuccess:()=>{i.invalidateQueries({queryKey:["/plugin/installed/list"]})}})},{useEffect:bU,useRef:YDt,useState:XDt}=await F("react"),{createPortal:QDt}=await F("react-dom"),ZDt=({className:i,robotModel:e,pluginId:t,disabled:n})=>{const{theme:s}=tt(),{t:o}=q(),r=YDt(null),a=ir(),[l,c]=XDt(!1),{refs:d,floatingStyles:h,update:g}=Gje({placement:"right-start",middleware:[qje(8),Kje(),Jje()]}),{refetchPluginInstalledList:m}=Lb({robotModel:e,ui:"toolbar"}),{mutateAsync:f}=Ooe(),p=()=>{a(`/muscat/app/plugin/${t}?from=toolbar`)},_=()=>{a(`/muscat/app/plugin/${t}?from=toolbar&tab=logs`)},b=async()=>{const{deleted:C}=await f({pluginId:t});C&&m()};bU(()=>{if(!(!l||!d.reference.current||!d.floating.current))return Yje(d.reference.current,d.floating.current,g)},[l,d.reference,d.floating,g]),bU(()=>{r.current=document.querySelector(".modal-container")},[]),bU(()=>{if(!l)return;const C=N=>{!d.floating.current?.contains(N.target)&&!d.reference.current?.contains(N.target)&&c(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l,d.floating,d.reference]);const v="typo-compact-xs-medium h-8 w-full justify-start rounded-md px-2.5",w=()=>{c(!1),d.reference.current?.focus()},y=C=>()=>{c(!1),C()},S=C=>{if(C.key==="Escape"){C.stopPropagation(),w();return}if(C.key!=="ArrowDown"&&C.key!=="ArrowUp")return;C.preventDefault();const N=Array.from(C.currentTarget.querySelectorAll('[role="menuitem"]')),k=N.indexOf(document.activeElement),L=C.key==="ArrowDown"?1:-1;N[(k+L+N.length)%N.length]?.focus()};return x(rn,{children:[u(Yt,{ref:d.setReference,className:P("inline-flex size-6 items-center justify-center rounded-sm",{"bg-fill-subtlest":l},i),variant:"transparent",icon:u(WDe,{className:"size-4"}),"aria-label":o("plugin.options.ariaLabel.more"),"aria-haspopup":"menu","aria-expanded":l,disabled:n,onClick:()=>c(C=>!C)}),l&&QDt(u("div",{ref:d.setFloating,"data-theme":s,style:h,className:"z-200",children:x("div",{role:"menu",className:"bg-bg-raised shadow-down-xl border-border-subtler flex w-37 flex-col rounded-lg border-1 p-1",onKeyDown:S,children:[u(se,{variant:"transparent",size:"sm",role:"menuitem",autoFocus:!0,className:P(v,"text-fg-default focus-visible:bg-fill-subtlest"),onClick:y(p),children:o("plugin.options.button.detailInfo")}),u(se,{variant:"transparent",size:"sm",role:"menuitem",className:P(v,"text-fg-default focus-visible:bg-fill-subtlest"),onClick:y(_),children:o("plugin.options.button.viewLogs")}),u("div",{role:"separator",className:"bg-border-subtler mx-1.5 my-1 h-px"}),u(se,{variant:"transparent",size:"sm",role:"menuitem",className:P(v,"text-fg-danger hover:!bg-fill-danger-subtlest focus-visible:bg-fill-danger-subtlest"),onClick:y(b),children:o("plugin.options.button.uninstall")})]})}),r.current??document.body)]})},{useMutation:eTt}=await F("@tanstack/react-query"),tTt="/plugin/installed/{pluginId}/toolbar",nTt=({pluginId:i,...e})=>{const t=tTt.replace("{pluginId}",i);return Ut.patch(t,e)},iTt=()=>eTt({mutationFn:nTt}),{useState:sTt}=await F("react"),oTt=({className:i,icon:e,name:t,pluginId:n,enabled:s,toolbar:o,isPreview:r,robotModel:a,onPluginClick:l})=>{const{t:c}=q(),{getAssetUrl:d}=Fu(),{refetchPluginInstalledList:h}=Lb({robotModel:a,ui:"toolbar"}),{data:g}=i2e(n,r),[m,f]=sTt(!!o),{mutateAsync:p}=iTt(),_=async()=>{await p({pluginId:n,toolbar:!m}),h(),f(v=>!v)},b=()=>{l?.(n)};return x(H,{className:P("PluginSimpleInstalledItem","hover:bg-fill-subtlest-hovered gap-3 rounded-lg py-2 pr-1 pl-2 transition-colors duration-120 ease-[cubic-bezier(0.2,0,0,1)]",i),alignItems:"center",children:[x(se,{variant:"transparent",className:"h-auto min-w-0 flex-1 justify-start gap-3 !p-0 text-left hover:!bg-transparent [&>[data-slot=label-button-text]]:min-w-0 [&>[data-slot=label-button-text]]:gap-3",onClick:b,children:[u("img",{className:P("size-9 shrink-0 overflow-hidden rounded-lg object-cover object-center",{grayscale:!s}),src:d(n,e),alt:""}),x(U,{className:"min-w-0",alignItems:"flex-start",children:[u("span",{className:"typo-compact-xs2-semibold text-fg-default w-full truncate",children:t}),x(H,{className:"typo-compact-xs-normal text-fg-subtle gap-2 whitespace-nowrap tabular-nums",alignItems:"center",children:[x("span",{children:["CPU ",sKe(g?.cpuPercent)]}),u("span",{className:"bg-border-subtle h-2.5 w-px"}),x("span",{children:["MEM ",oKe(g?.memoryBytes)]})]})]})]}),x(H,{alignItems:"center",children:[u(Yt,{icon:u(TJe,{className:P("size-3.75",{"text-fg-brand fill-current":m,"text-fg-subtle":!m})}),variant:"transparent",size:"2xs",disabled:r,"aria-label":c(m?"plugin.options.ariaLabel.unpin":"plugin.options.ariaLabel.pin"),"aria-pressed":m,onClick:_}),u(ZDt,{pluginId:n,robotModel:a,disabled:r})]})]},n)},{useEffect:rTt,useMemo:aTt}=await F("react"),lTt=({className:i,robotModel:e,onPluginClick:t,close:n})=>{const{t:s}=q(),o=ir(),{usePluginManifest:r}=Fu(),{data:a}=r(),{data:l,isFetched:c}=kA({robotModel:e}),d=aTt(()=>{const m=l?.plugins?.map(f=>({pluginId:f.pluginId,name:f.name,isPreview:!1,uiContent:Jv(f.contributes,"toolbar")?.ui,icon:typeof f.icons=="object"?f.icons?.["16"]:f.icons,toolbar:f.toolbar,enabled:f.enabled,openType:Jv(f.contributes,"toolbar")?.opens}))??[];return hA()&&a&&m.unshift({pluginId:a.id,name:a.name,uiContent:Jv(a.contributes,"toolbar")?.ui,isPreview:!0,toolbar:!0,enabled:!0,icon:typeof a.icons=="string"?a.icons:a.icons?.["16"],openType:Jv(a.contributes,"toolbar")?.opens}),m},[l?.plugins,a]),h=m=>{t?.(m),n?.()},g=()=>{o("/muscat/app/plugin?installed=1"),n?.()};return rTt(()=>{const m=f=>{f.key==="Escape"&&n?.()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[n]),u(nse,{className:P("PopoverInstalledPluginList","bg-bg-raised text-default overflow-visible rounded-xl shadow-[inset_0_0_0_0.0625rem_rgba(250,250,250,0.08),0_0.75rem_2rem_rgba(9,9,11,0.55)]",i),children:x(U,{className:"w-85",role:"dialog","aria-label":s("plugin.tab.registryList"),children:[x(H,{className:"pt-4 pr-2.5 pb-2 pl-4",justifyContent:"space-between",alignItems:"flex-start",children:[x(U,{className:"gap-0.5",children:[u("h6",{className:"typo-compact-sm-semibold text-fg-default tracking-[-0.01em]",children:s("plugin.tab.registryList")}),u("p",{className:"typo-compact-xs-normal text-fg-subtle",children:s("plugin.popover.installedList.desc")})]}),u(Yt,{className:"size-7 rounded-md",icon:u(Nb,{className:"size-4"}),variant:"transparent",size:"2xs","aria-label":s("plugin.popover.ariaLabel.close"),onClick:n})]}),c&&d.length===0?x(U,{className:"px-8 pt-7 pb-8 text-center",alignItems:"center",children:[u("div",{className:"bg-fill-subtlest-hovered mb-3 flex size-14 items-center justify-center rounded-[0.875rem] shadow-[inset_0_0_0_0.0625rem_rgba(250,250,250,0.1)]",children:u(b9,{className:"text-fg-subtle size-6"})}),u("p",{className:"typo-compact-sm-semibold text-fg-default mb-1",children:s("plugin.popover.installedList.empty")}),u("p",{className:"typo-body-xs-normal text-fg-subtle",children:s("plugin.popover.installedList.emptyDesc")})]}):x(rn,{children:[u(U,{className:"max-h-[calc(var(--vh,1vh)*40)] !overflow-x-visible overflow-y-auto px-2 pt-1 pb-3",children:d.map(m=>u(oTt,{pluginId:m.pluginId,name:m.name,icon:m.icon,enabled:m.enabled,toolbar:m.toolbar,isPreview:m.isPreview,robotModel:e,onPluginClick:h},m.pluginId))}),u("div",{className:"px-3 pb-3",children:u(se,{className:"typo-compact-xs-semibold h-9 w-full rounded-md",leadingIcon:u(qJe,{className:"mr-1 size-4"}),variant:"soft",size:"sm",onClick:g,children:s("plugin.popover.button.manageInstalled")})})]})]})})};var vU={exports:{}};/**!
377
377
  * Sortable 1.15.7
378
378
  * @author RubaXa <trash@rubaxa.org>
379
379
  * @author owenm <owen23355@gmail.com>
@@ -1299,7 +1299,7 @@ ${e.toString()}`}}class GW{constructor(e=new kL,t=!1,n,s=cun){this._services=e,t
1299
1299
  `:`\r
1300
1300
  `}};Mne=Pp([zo(0,ln)],Mne);class wun{publicLog2(){}}class JW{static{this.SCHEME="inmemory"}constructor(){const e=Tt.from({scheme:JW.SCHEME,authority:"model",path:"/"});this.workspace={id:sBe,folders:[new Oqt({uri:e,name:"",index:0})]}}getWorkspace(){return this.workspace}getWorkspaceFolder(e){return e&&e.scheme===JW.SCHEME?this.workspace.folders[0]:null}}function YW(i,e,t){if(!e||!(i instanceof KW))return;const n=[];Object.keys(e).forEach(s=>{eKt(s)&&n.push([`editor.${s}`,e[s]]),t&&tKt(s)&&n.push([`diffEditor.${s}`,e[s]])}),n.length>0&&i.updateValues(n)}let Ane=class{constructor(e){this._modelService=e}hasPreviewHandler(){return!1}async apply(e,t){const n=Array.isArray(e)?e:_le.convert(e),s=new Map;for(const a of n){if(!(a instanceof ky))throw new Error("bad edit - only text edits are supported");const l=this._modelService.getModel(a.resource);if(!l)throw new Error("bad edit - model not found");if(typeof a.versionId=="number"&&l.getVersionId()!==a.versionId)throw new Error("bad state - model changed in the meantime");let c=s.get(l);c||(c=[],s.set(l,c)),c.push(io.replaceMove(j.lift(a.textEdit.range),a.textEdit.text))}let o=0,r=0;for(const[a,l]of s)a.pushStackElement(),a.pushEditOperations([],l,()=>[]),a.pushStackElement(),r+=1,o+=l.length;return{ariaSummary:d1(Uee.bulkEditServiceSummary,o,r),isApplied:o>0}}};Ane=Pp([zo(0,Os)],Ane);class Cun{getUriLabel(e,t){return e.scheme==="file"?e.fsPath:e.path}getUriBasenameLabel(e){return Lh(e)}}let One=class extends Bcn{constructor(e,t){super(e),this._codeEditorService=t}showContextView(e,t,n){if(!t){const s=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();s&&(t=s.getContainerDomNode())}return super.showContextView(e,t,n)}};One=Pp([zo(0,Dp),zo(1,Jn)],One);class Sun{constructor(){this._neverEmitter=new ue,this.onDidChangeTrust=this._neverEmitter.event}isWorkspaceTrusted(){return!0}}class xun extends VW{constructor(){super()}}class Nun extends mun{constructor(){super(new LFt)}}let Fne=class extends ane{constructor(e,t,n,s,o,r){super(e,t,n,s,o,r),this.configure({blockMouse:!1})}};Fne=Pp([zo(0,Fl),zo(1,ho),zo(2,Mb),zo(3,ei),zo(4,Mh),zo(5,jt)],Fne);const Iun={esmModuleLocation:void 0,label:"editorWorkerService"};let Bne=class extends Jte{constructor(e,t,n,s,o){super(Iun,e,t,n,s,o)}};Bne=Pp([zo(0,Os),zo(1,d7),zo(2,Xi),zo(3,Fs),zo(4,_t)],Bne);class kun{async playSignal(e,t){}}kn(Xi,Nun,0);kn(ln,KW,0);kn(d7,Rne,0);kn(sWe,Mne,0);kn(yb,JW,0);kn(M1,Cun,0);kn(Fl,wun,0);kn(L2,vun,0);kn(Lle,bun,0);kn(ho,qW,0);kn(Tp,XC,0);kn(uo,xun,0);kn(Wu,Dln,0);kn(Os,gne,0);kn($re,hne,0);kn(jt,Tne,0);kn(E3e,_un,0);kn(bb,Nde,0);kn(nc,vGt,0);kn(od,Bne,0);kn(g2,Ane,0);kn(pWe,Sun,0);kn(tc,Ene,0);kn(Ra,kne,0);kn(Bh,kXt,0);kn(Zi,Pne,0);kn(ei,Bk,0);kn(Ml,Ine,0);kn(Mb,One,0);kn(Ab,une,0);kn(zd,Dne,0);kn(zu,Fne,0);kn(Mh,ZX,0);kn(Pb,kun,0);kn(Pae,fun,0);kn(oFe,PFt,0);kn(Sce,$en,0);var en;(function(i){const e=new kL;for(const[l,c]of Ive())e.set(l,c);const t=new GW(e,!0);e.set(St,t);function n(l){s||r({});const c=e.get(l);if(!c)throw new Error("Missing service "+l);return c instanceof Vf?t.invokeFunction(d=>d.get(l)):c}i.get=n;let s=!1;const o=new ue;function r(l){if(s)return t;s=!0;for(const[d,h]of Ive())e.get(d)||e.set(d,h);for(const d in l)if(l.hasOwnProperty(d)){const h=pn(d);e.get(h)instanceof Vf&&e.set(h,l[d])}const c=OKt();for(const d of c)try{t.createInstance(d)}catch(h){Zt(h)}return o.fire(),t}i.initialize=r;function a(l){if(s)return l();const c=new Ae,d=c.add(o.event(()=>{d.dispose(),c.add(l())}));return c}i.withServices=a})(en||(en={}));var Lun=function(i,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,n);else for(var a=i.length-1;a>=0;a--)(r=i[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},lxe=function(i,e){return function(t,n){e(t,n,i)}},sB;let Vne=class{static{sB=this}static{this._ttpTokenizer=kp("tokenizeToString",{createHTML(e){return e}})}constructor(e,t){this._configurationService=e,this._languageService=t}async renderCodeBlock(e,t,n){const s=Um(n.context)?n.context:void 0;let o;e?o=this._languageService.getLanguageIdByLanguageName(e):s&&(o=s.getModel()?.getLanguageId()),o||(o=Du);const r=await A7t(this._languageService,t,o),a=sB._ttpTokenizer?sB._ttpTokenizer.createHTML(r)??r:r,l=document.createElement("span");l.innerHTML=a;const c=l.querySelector(".monaco-tokenized-source");return lo(c)?(ra(c,this.getFontInfo(s)),l):document.createElement("span")}getFontInfo(e){return e?e.getOption(59):u4t({fontFamily:this._configurationService.getValue("editor").fontFamily},1)}};Vne=sB=Lun([lxe(0,ln),lxe(1,uo)],Vne);var Ide=function(i,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,n);else for(var a=i.length-1;a>=0;a--)(r=i[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Ui=function(i,e){return function(t,n){e(t,n,i)}};let Dun=0,cxe=!1;function Tun(i){if(!i){if(cxe)return;cxe=!0}qOt(i||Ni.document.body)}let XW=class extends v1{constructor(e,t,n,s,o,r,a,l,c,d,h,g,m,f){const p={...t};p.ariaLabel=p.ariaLabel||Hee.editorViewAccessibleLabel,super(e,p,{},n,s,o,r,c,d,h,g,m),l instanceof Bk?this._standaloneKeybindingService=l:this._standaloneKeybindingService=null,Tun(p.ariaContainerElement),w$t((_,b)=>n.createInstance(vk,_,{instantHover:b},{})),EUt(a),f.setDefaultCodeBlockRenderer(n.createInstance(Vne))}addCommand(e,t,n){if(!this._standaloneKeybindingService)return console.warn("Cannot add command because the editor is configured with an unrecognized KeybindingService"),null;const s="DYNAMIC_"+ ++Dun,o=ze.deserialize(n);return this._standaloneKeybindingService.addDynamicKeybinding(s,e,t,o),s}createContextKey(e,t){return this._contextKeyService.createKey(e,t)}addAction(e){if(typeof e.id!="string"||typeof e.label!="string"||typeof e.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");if(!this._standaloneKeybindingService)return console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),pe.None;const t=e.id,n=e.label,s=ze.and(ze.equals("editorId",this.getId()),ze.deserialize(e.precondition)),o=e.keybindings,r=ze.and(s,ze.deserialize(e.keybindingContext)),a=e.contextMenuGroupId||null,l=e.contextMenuOrder||0,c=(m,...f)=>Promise.resolve(e.run(this,...f)),d=new Ae,h=this.getId()+":"+t;if(d.add(Wn.registerCommand(h,c)),a){const m={command:{id:h,title:n},when:s,group:a,order:l};d.add(oa.appendMenuItem(de.EditorContext,m))}if(Array.isArray(o))for(const m of o)d.add(this._standaloneKeybindingService.addDynamicKeybinding(h,m,c,r));const g=new t3e(h,n,n,void 0,s,(...m)=>Promise.resolve(e.run(this,...m)),this._contextKeyService);return this._actions.set(t,g),d.add(vt(()=>{this._actions.delete(t)})),d}_triggerCommand(e,t){if(this._codeEditorService instanceof RW)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};XW=Ide([Ui(2,St),Ui(3,Jn),Ui(4,Zi),Ui(5,jt),Ui(6,kc),Ui(7,ei),Ui(8,Ys),Ui(9,ho),Ui(10,Ra),Ui(11,Fs),Ui(12,_t),Ui(13,zg)],XW);let zne=class extends XW{constructor(e,t,n,s,o,r,a,l,c,d,h,g,m,f,p,_,b){const v={...t};YW(h,v,!1);const w=c.registerEditorContainer(e);typeof v.theme=="string"&&c.setTheme(v.theme),typeof v.autoDetectHighContrast<"u"&&c.setAutoDetectHighContrast(!!v.autoDetectHighContrast);const y=v.model;delete v.model,super(e,v,n,s,o,r,a,l,c,d,g,p,_,b),this._configurationService=h,this._standaloneThemeService=c,this._register(w);let S;if(typeof y>"u"){const C=f.getLanguageIdByMimeType(v.language)||v.language||Du;S=c9e(m,f,v.value||"",C,void 0),this._ownsModel=!0}else S=y,this._ownsModel=!1;if(this._attachModel(S),S){const C={oldModelUrl:null,newModelUrl:S.uri};this._onDidChangeModel.fire(C)}}dispose(){super.dispose()}updateOptions(e){YW(this._configurationService,e,!1),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_postDetachModelCleanup(e){super._postDetachModelCleanup(e),e&&this._ownsModel&&(e.dispose(),this._ownsModel=!1)}};zne=Ide([Ui(2,St),Ui(3,Jn),Ui(4,Zi),Ui(5,jt),Ui(6,kc),Ui(7,ei),Ui(8,Wu),Ui(9,ho),Ui(10,ln),Ui(11,Ra),Ui(12,Os),Ui(13,uo),Ui(14,Fs),Ui(15,_t),Ui(16,zg)],zne);let Wne=class extends _p{constructor(e,t,n,s,o,r,a,l,c,d,h,g){const m={...t};YW(l,m,!0);const f=r.registerEditorContainer(e);typeof m.theme=="string"&&r.setTheme(m.theme),typeof m.autoDetectHighContrast<"u"&&r.setAutoDetectHighContrast(!!m.autoDetectHighContrast),super(e,m,{},s,n,o,g,d),this._configurationService=l,this._standaloneThemeService=r,this._register(f)}dispose(){super.dispose()}updateOptions(e){YW(this._configurationService,e,!0),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_createInnerEditor(e,t,n){return e.createInstance(XW,t,n)}getOriginalEditor(){return super.getOriginalEditor()}getModifiedEditor(){return super.getModifiedEditor()}addCommand(e,t,n){return this.getModifiedEditor().addCommand(e,t,n)}createContextKey(e,t){return this.getModifiedEditor().createContextKey(e,t)}addAction(e){return this.getModifiedEditor().addAction(e)}};Wne=Ide([Ui(2,St),Ui(3,jt),Ui(4,Jn),Ui(5,Wu),Ui(6,ho),Ui(7,ln),Ui(8,zu),Ui(9,bb),Ui(10,zd),Ui(11,Pb)],Wne);function c9e(i,e,t,n,s){if(t=t||"",!n){const o=t.indexOf(`
1301
1301
  `);let r=t;return o!==-1&&(r=t.substring(0,o)),dxe(i,t,e.createByFilepathOrFirstLine(s||null,r),s)}return dxe(i,t,e.createById(n),s)}function dxe(i,e,t,n){return i.createModel(e,t,n)}ee("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},I(142,"The background color of the diff editor's header"));ee("multiDiffEditor.background",Lo,I(143,"The background color of the multi file diff editor"));ee("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},I(144,"The border color of the multi file diff editor"));var Eun=function(i,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,n);else for(var a=i.length-1;a>=0;a--)(r=i[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},uxe=function(i,e){return function(t,n){e(t,n,i)}};class Pun{constructor(e,t){this.viewModel=e,this.deltaScrollVertical=t}getId(){return this.viewModel}}let Hne=class extends pe{constructor(e,t,n,s,o){super(),this._container=e,this._overflowWidgetsDomNode=t,this._workbenchUIElementFactory=n,this._instantiationService=s,this._viewModel=$t(this,void 0),this._collapsed=Oe(this,l=>this._viewModel.read(l)?.collapsed.read(l)),this._editorContentHeight=$t(this,500),this.contentHeight=Oe(this,l=>(this._collapsed.read(l)?0:this._editorContentHeight.read(l))+this._outerEditorHeight),this._modifiedContentWidth=$t(this,0),this._modifiedWidth=$t(this,0),this._originalContentWidth=$t(this,0),this._originalWidth=$t(this,0),this.maxScroll=Oe(this,l=>{const c=this._modifiedContentWidth.read(l)-this._modifiedWidth.read(l),d=this._originalContentWidth.read(l)-this._originalWidth.read(l);return c>d?{maxScroll:c,width:this._modifiedWidth.read(l)}:{maxScroll:d,width:this._originalWidth.read(l)}}),this._elements=qn("div.multiDiffEntry",[qn("div.header@header",[qn("div.header-content",[qn("div.collapse-button@collapseButton"),qn("div.file-path",[qn("div.title.modified.show-file-icons@primaryPath",[]),qn("div.status.deleted@status",["R"]),qn("div.title.original.show-file-icons@secondaryPath",[])]),qn("div.actions@actions")])]),qn("div.editorParent",[qn("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(_p,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode,fixedOverflowWidgets:!0},{})),this.isModifedFocused=Rs(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=Rs(this.editor.getOriginalEditor()).isFocused,this.isFocused=Oe(this,l=>this.isModifedFocused.read(l)||this.isOriginalFocused.read(l)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new Ae),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;const r=new Rz(this._elements.collapseButton,{});this._register(zt(l=>{r.element.className="",r.icon=this._collapsed.read(l)?je.chevronRight:je.chevronDown})),this._register(r.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._register(zt(l=>{this._elements.editor.style.display=this._collapsed.read(l)?"none":"block"})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(l=>{const c=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(c,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(l=>{const c=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(c,void 0)})),this._register(this.editor.onDidContentSizeChange(l=>{rE(c=>{this._editorContentHeight.set(l.contentHeight,c),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),c),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),c)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(l=>{if(this._isSettingScrollTop||!l.scrollTopChanged||!this._data)return;const c=l.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(c)})),this._register(zt(l=>{const c=this._viewModel.read(l)?.isActive.read(l);this._elements.root.classList.toggle("active",c)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(o.createScoped(this._elements.actions));const a=this._register(this._instantiationService.createChild(new kL([jt,this._contextKeyService])));this._register(a.createInstance(hM,this._elements.actions,de.MultiDiffEditorFileToolbar,{actionRunner:this._register(new U4e(()=>this._viewModel.get()?.modifiedUri??this._viewModel.get()?.originalUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:l=>l.startsWith("navigation")},actionViewItemProvider:(l,c)=>fle(a,l,c)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){this._data=e;function t(s){return{...s,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(!e){rE(s=>{this._viewModel.set(void 0,s),this.editor.setDiffModel(null,s),this._dataStore.clear()});return}const n=e.viewModel.documentDiffItem;if(rE(s=>{this._resourceLabel?.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:e.viewModel.modifiedUri===void 0});let o=!1,r=!1,a=!1,l="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(l="R",o=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(l="A",a=!0):(l="D",r=!0),this._elements.status.classList.toggle("renamed",o),this._elements.status.classList.toggle("deleted",r),this._elements.status.classList.toggle("added",a),this._elements.status.innerText=l,this._resourceLabel2?.setUri(o?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,s),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,s),this.editor.updateOptions(t(n.options??{}))}),n.onOptionsDidChange&&this._dataStore.add(n.onOptionsDidChange(()=>{this.editor.updateOptions(t(n.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,s=>{s||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(const[s,o]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(s,o)}render(e,t,n,s){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";const o=e.length-this._headerHeight,r=Math.max(0,Math.min(s.start-e.start,o));this._elements.header.style.transform=`translateY(${r}px)`,rE(a=>{this.editor.layout({width:t-16-2,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=n,this.editor.getOriginalEditor().setScrollTop(n)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",r>0||n>0),this._elements.header.classList.toggle("collapsed",r===o)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};Hne=Eun([uxe(3,St),uxe(4,jt)],Hne);class Run{constructor(e){this._create=e,this._unused=new Set,this._used=new Set,this._itemData=new Map}getUnusedObj(e){let t;if(this._unused.size===0)t=this._create(e),this._itemData.set(t,e);else{const n=[...this._unused.values()];t=n.find(s=>this._itemData.get(s).getId()===e.getId())??n[0],this._unused.delete(t),this._itemData.set(t,e),t.setData(e)}return this._used.add(t),{object:t,dispose:()=>{this._used.delete(t),this._unused.size>5?t.dispose():this._unused.add(t)}}}dispose(){for(const e of this._used)e.dispose();for(const e of this._unused)e.dispose();this._used.clear(),this._unused.clear()}}var Mun=function(i,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,n);else for(var a=i.length-1;a>=0;a--)(r=i[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},hxe=function(i,e){return function(t,n){e(t,n,i)}};let $ne=class extends pe{constructor(e,t,n,s,o,r){super(),this._element=e,this._dimension=t,this._viewModel=n,this._workbenchUIElementFactory=s,this._parentContextKeyService=o,this._parentInstantiationService=r,this._scrollableElements=qn("div.scrollContent",[qn("div@content",{style:{overflow:"hidden"}}),qn("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new NL({forceIntegerValues:!1,scheduleAtNextAnimationFrame:c=>Xc(xt(this._element),c),smoothScrollDuration:100})),this._scrollableElement=this._register(new rH(this._scrollableElements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this._elements=qn("div.monaco-component.multiDiffEditor",{},[qn("div",{},[this._scrollableElement.getDomNode()]),qn("div.placeholder@placeholder",{},[qn("div")])]),this._sizeObserver=this._register(new x4e(this._element,void 0)),this._objectPool=this._register(new Run(c=>{const d=this._instantiationService.createInstance(Hne,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return d.setData(c),d})),this.scrollTop=li(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=li(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=Oe(this,c=>{const d=this._viewModel.read(c);if(!d)return{items:[],getItem:f=>{throw new Pt}};const h=d.items.read(c),g=new Map;return{items:h.map(f=>{const p=c.store.add(new Oun(f,this._objectPool,this.scrollLeft,b=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+b})})),_=this._lastDocStates?.[p.getKey()];return _&&Gi(b=>{p.setViewState(_,b)}),g.set(f,p),p}),getItem:f=>g.get(f)}}),this._viewItems=this._viewItemsInfo.map(this,c=>c.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(c,d)=>c.reduce((h,g)=>h+g.contentHeight.read(d)+this._spaceBetweenPx,0)),this.activeControl=Oe(this,c=>{const d=this._viewModel.read(c)?.activeDiffItem.read(c);return d?this._viewItemsInfo.read(c).getItem(d).template.read(c)?.editor:void 0}),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new kL([jt,this._contextKeyService]))),this._contextKeyService.createKey(te.inMultiDiffEditor.key,!0),this._lastDocStates={},this._register(Pl((c,d)=>{const h=this._viewModel.read(c);if(h&&h.contextKeys)for(const[g,m]of Object.entries(h.contextKeys)){const f=this._contextKeyService.createKey(g,void 0);f.set(m),d.add(vt(()=>f.reset()))}}));const a=this._parentContextKeyService.createKey(te.multiDiffEditorAllCollapsed.key,!1);this._register(zt(c=>{const d=this._viewModel.read(c);if(d){const h=d.items.read(c).every(g=>g.collapsed.read(c));a.set(h)}})),this._register(zt(c=>{const d=this._dimension.read(c);this._sizeObserver.observe(d)}));const l=Oe(c=>{if(this._viewItems.read(c).length>0)return;const h=this._viewModel.read(c);return!h||h.isLoading.read(c)?I(145,"Loading..."):I(146,"No Changed Files")});this._register(zt(c=>{const d=l.read(c);this._elements.placeholder.innerText=d??"",this._elements.placeholder.classList.toggle("visible",!!d)})),this._scrollableElements.content.style.position="relative",this._register(zt(c=>{const d=this._sizeObserver.height.read(c);this._scrollableElements.root.style.height=`${d}px`;const h=this._totalHeight.read(c);this._scrollableElements.content.style.height=`${h}px`;const g=this._sizeObserver.width.read(c);let m=g;const f=this._viewItems.read(c),p=cae(f,al(_=>_.maxScroll.read(c).maxScroll,Td));if(p){const _=p.maxScroll.read(c);m=g+_.maxScroll}this._scrollableElement.setScrollDimensions({width:g,height:d,scrollHeight:h,scrollWidth:m})})),e.replaceChildren(this._elements.root),this._register(vt(()=>{e.replaceChildren()})),this._register(zt(c=>{const d=this._viewModel.read(c);if(d&&!d.isLoading.read(c)){if(d.items.read(c).length===0||d.activeDiffItem.read(c))return;this.goToNextChange()}})),this._register(this._register(zt(c=>{rE(d=>{this.render(c)})})))}reveal(e,t){const n=this._viewItems.get(),s=n.findIndex(c=>c.viewModel.originalUri?.toString()===e.original?.toString()&&c.viewModel.modifiedUri?.toString()===e.modified?.toString());if(s===-1)throw new Pt("Resource not found in diff editor");const o=n[s];this._viewModel.get().activeDiffItem.setCache(o.viewModel,void 0);let r=0;for(let c=0;c<s;c++)r+=n[c].contentHeight.get()+this._spaceBetweenPx;this._scrollableElement.setScrollPosition({scrollTop:r});const a=o.template.get()?.editor,l="original"in e?a?.getOriginalEditor():a?.getModifiedEditor();l&&t?.range&&(l.revealRangeInCenter(t.range),Aun(l,t.range))}goToNextChange(){this._navigateToChange("next")}_navigateToChange(e){const t=this._viewItems.get();if(t.length===0)return;const n=this._viewModel.get()?.activeDiffItem.get(),s=n?t.findIndex(l=>l.viewModel===n):-1;if(s===-1){this._goToFile(0,"first");return}const o=t[s];o.viewModel.collapsed.get()&&o.viewModel.collapsed.set(!1,void 0);const r=o.template.get()?.editor;if(r?.getDiffComputationResult()?.changes2?.length){const l=r.getModifiedEditor().getPosition()?.lineNumber||1,c=r.getDiffComputationResult().changes2;if(e==="next"?c.some(h=>h.modified.startLineNumber>l):c.some(h=>h.modified.endLineNumberExclusive<=l)){r.goToDiff(e);return}}const a=(s+(e==="next"?1:-1)+t.length)%t.length;this._goToFile(a,e==="next"?"first":"last")}_goToFile(e,t){const n=this._viewItems.get()[e];n.viewModel.collapsed.get()&&n.viewModel.collapsed.set(!1,void 0),this.reveal({original:n.viewModel.originalUri,modified:n.viewModel.modifiedUri});const s=n.template.get()?.editor;if(s?.getDiffComputationResult()?.changes2?.length)if(t==="first")s.revealFirstDiff();else{const o=s.getDiffComputationResult().changes2.at(-1),r=s.getModifiedEditor();r.setPosition({lineNumber:o.modified.startLineNumber,column:1}),r.revealLineInCenter(o.modified.startLineNumber)}s?.focus()}render(e){const t=this.scrollTop.read(e);let n=0,s=0,o=0;const r=this._sizeObserver.height.read(e),a=wt.ofStartAndLength(t,r),l=this._sizeObserver.width.read(e);for(const c of this._viewItems.read(e)){const d=c.contentHeight.read(e),h=Math.min(d,r),g=wt.ofStartAndLength(s,h),m=wt.ofStartAndLength(o,d);if(m.isBefore(a))n-=d-h,c.hide();else if(m.isAfter(a))c.hide();else{const f=Math.max(0,Math.min(a.start-m.start,d-h));n-=f;const p=wt.ofStartAndLength(t+n,r);c.render(g,f,l,p)}s+=h+this._spaceBetweenPx,o+=d+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+n)}px)`}};$ne=Mun([hxe(4,jt),hxe(5,St)],$ne);function Aun(i,e){const t=i.getModel(),n=i.createDecorationsCollection([{range:e,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{i.getModel()===t&&n.clear()},350)}class Oun extends pe{constructor(e,t,n,s){super(),this.viewModel=e,this._objectPool=t,this._scrollLeft=n,this._deltaScrollVertical=s,this._templateRef=this._register(Sre(this,void 0)),this.contentHeight=Oe(this,o=>this._templateRef.read(o)?.object.contentHeight?.read(o)??this.viewModel.lastTemplateData.read(o).contentHeight),this.maxScroll=Oe(this,o=>this._templateRef.read(o)?.object.maxScroll.read(o)??{maxScroll:0,scrollWidth:0}),this.template=Oe(this,o=>this._templateRef.read(o)?.object),this._isHidden=$t(this,!1),this._isFocused=Oe(this,o=>this.template.read(o)?.isFocused.read(o)??!1),this.viewModel.setIsFocused(this._isFocused,void 0),this._register(zt(o=>{const r=this._scrollLeft.read(o);this._templateRef.read(o)?.object.setScrollLeft(r)})),this._register(zt(o=>{const r=this._templateRef.read(o);!r||!this._isHidden.read(o)||r.object.isFocused.read(o)||this._clear()}))}dispose(){this._clear(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.documentDiffItem.modified?.uri.toString()})`}getKey(){return this.viewModel.getKey()}setViewState(e,t){this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);const n=this.viewModel.lastTemplateData.get(),s=e.selections?.map(gt.liftSelection);this.viewModel.lastTemplateData.set({...n,selections:s},t);const o=this._templateRef.get();o&&s&&o.object.editor.setSelections(s)}_updateTemplateData(e){const t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){const e=this._templateRef.get();e&&Gi(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,n,s){this._isHidden.set(!1,void 0);let o=this._templateRef.get();if(!o){o=this._objectPool.getUnusedObj(new Pun(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(o,void 0);const r=this.viewModel.lastTemplateData.get().selections;r&&o.object.editor.setSelections(r)}o.object.render(e,n,t,s)}}var Fun=function(i,e,t,n){var s=arguments.length,o=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(i,e,t,n);else for(var a=i.length-1;a>=0;a--)(r=i[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Bun=function(i,e){return function(t,n){e(t,n,i)}};let Une=class extends pe{constructor(e,t,n){super(),this._element=e,this._workbenchUIElementFactory=t,this._instantiationService=n,this._dimension=$t(this,void 0),this._viewModel=$t(this,void 0),this._widgetImpl=Oe(this,s=>s.store.add(this._instantiationService.createInstance(o_($ne),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory))),this._register(nk(this._widgetImpl))}};Une=Fun([Bun(2,St)],Une);function Vun(i,e,t){return en.initialize(t||{}).createInstance(zne,i,e)}function zun(i){return en.get(Jn).onCodeEditorAdd(t=>{i(t)})}function Wun(i){return en.get(Jn).onDiffEditorAdd(t=>{i(t)})}function Hun(){return en.get(Jn).listCodeEditors()}function $un(){return en.get(Jn).listDiffEditors()}function Uun(i,e,t){return en.initialize(t||{}).createInstance(Wne,i,e)}function jun(i,e){const t=en.initialize(e||{});return new Une(i,{},t)}function Gun(i){if(typeof i.id!="string"||typeof i.run!="function")throw new Error("Invalid command descriptor, `id` and `run` are required properties!");return Wn.registerCommand(i.id,i.run)}function qun(i){if(typeof i.id!="string"||typeof i.label!="string"||typeof i.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");const e=ze.deserialize(i.precondition),t=(s,...o)=>Ir.runEditorCommand(s,o,e,(r,a,l)=>Promise.resolve(i.run(a,...l))),n=new Ae;if(n.add(Wn.registerCommand(i.id,t)),i.contextMenuGroupId){const s={command:{id:i.id,title:i.label},when:e,group:i.contextMenuGroupId,order:i.contextMenuOrder||0};n.add(oa.appendMenuItem(de.EditorContext,s))}if(Array.isArray(i.keybindings)){const s=en.get(ei);if(!(s instanceof Bk))console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");else{const o=ze.and(e,ze.deserialize(i.keybindingContext));n.add(s.addDynamicKeybindings(i.keybindings.map(r=>({keybinding:r,command:i.id,when:o}))))}}return n}function Kun(i){return d9e([i])}function d9e(i){const e=en.get(ei);return e instanceof Bk?e.addDynamicKeybindings(i.map(t=>({keybinding:t.keybinding,command:t.command,commandArgs:t.commandArgs,when:ze.deserialize(t.when)}))):(console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),pe.None)}function Jun(i,e,t){const n=en.get(uo),s=n.getLanguageIdByMimeType(e)||e;return c9e(en.get(Os),n,i,s,t)}function Yun(i,e){const t=en.get(uo),n=t.getLanguageIdByMimeType(e)||e||Du;i.setLanguage(t.createById(n))}function Xun(i,e,t){i&&en.get(Tp).changeOne(e,i.uri,t)}function Qun(i){en.get(Tp).changeAll(i,[])}function Zun(i){return en.get(Tp).read(i)}function ehn(i){return en.get(Tp).onMarkerChanged(i)}function thn(i){return en.get(Os).getModel(i)}function nhn(){return en.get(Os).getModels()}function ihn(i){return en.get(Os).onModelAdded(i)}function shn(i){return en.get(Os).onModelRemoved(i)}function ohn(i){return en.get(Os).onModelLanguageChanged(t=>{i({model:t.model,oldLanguage:t.oldLanguageId})})}function rhn(i){return ucn(en.get(Os),i)}function ahn(i,e){const t=en.get(uo),n=en.get(Wu);return _de.colorizeElement(n,t,i,e).then(()=>{n.registerEditorContainer(i)})}function lhn(i,e,t){const n=en.get(uo);return en.get(Wu).registerEditorContainer(Ni.document.body),_de.colorize(n,i,e,t)}function chn(i,e,t=4){return en.get(Wu).registerEditorContainer(Ni.document.body),_de.colorizeModelLine(i,e,t)}function dhn(i){const e=no.get(i);return e||{getInitialState:()=>pk,tokenize:(t,n,s)=>Eae(i,s)}}function uhn(i,e){no.getOrCreate(e);const t=dhn(e),n=Fd(i),s=[];let o=t.getInitialState();for(let r=0,a=n.length;r<a;r++){const l=n[r],c=t.tokenize(l,!0,o);s[r]=c.tokens,o=c.endState}return s}function hhn(i,e){en.get(Wu).defineTheme(i,e)}function ghn(i){en.get(Wu).setTheme(i)}function mhn(){RY.clearAllFontInfos()}function fhn(i,e){return Wn.registerCommand({id:i,handler:e})}function phn(i){return en.get(Ab).registerOpener({async open(t){return typeof t=="string"&&(t=Tt.parse(t)),i.open(t)}})}function _hn(i){return en.get(Jn).registerCodeEditorOpenHandler(async(t,n,s)=>{if(!n)return null;const o=t.options?.selection;let r;return o&&typeof o.endLineNumber=="number"&&typeof o.endColumn=="number"?r=o:o&&(r={lineNumber:o.startLineNumber,column:o.startColumn}),await i.openCodeEditor(n,t.resource,r)?n:null})}function bhn(){return{create:Vun,getEditors:Hun,getDiffEditors:$un,onDidCreateEditor:zun,onDidCreateDiffEditor:Wun,createDiffEditor:Uun,addCommand:Gun,addEditorAction:qun,addKeybindingRule:Kun,addKeybindingRules:d9e,createModel:Jun,setModelLanguage:Yun,setModelMarkers:Xun,getModelMarkers:Zun,removeAllMarkers:Qun,onDidChangeMarkers:ehn,getModels:nhn,getModel:thn,onDidCreateModel:ihn,onWillDisposeModel:shn,onDidChangeModelLanguage:ohn,createWebWorker:rhn,colorizeElement:ahn,colorize:lhn,colorizeModelLine:chn,tokenize:uhn,defineTheme:hhn,setTheme:ghn,remeasureFonts:mhn,registerCommand:fhn,registerLinkOpener:phn,registerEditorOpener:_hn,AccessibilitySupport:ete,ContentWidgetPositionPreference:rte,CursorChangeReason:ate,DefaultEndOfLine:lte,EditorAutoIndentStrategy:dte,EditorOption:ute,EndOfLinePreference:hte,EndOfLineSequence:gte,MinimapPosition:Nte,MinimapSectionHeaderStyle:Ite,MouseTargetType:kte,OverlayWidgetPositionPreference:Tte,OverviewRulerLane:Ete,GlyphMarginLane:mte,RenderLineNumbersType:Mte,RenderMinimap:Ate,ScrollbarVisibility:Fte,ScrollType:Ote,TextEditorCursorBlinkingStyle:Ute,TextEditorCursorStyle:jte,TrackedRangeStickiness:Gte,WrappingIndent:qte,InjectedTextCursorStops:_te,PositionAffinity:Rte,ShowLightbulbIconMode:Vte,TextDirection:$te,ConfigurationChangedEvent:OFe,BareFontInfo:g1,FontInfo:BV,TextModelResolvedOptions:k4,FindMatch:TR,ApplyUpdateResult:QE,EditorZoom:hh,createMultiFileDiffEditor:jun,EditorType:t2,EditorOptions:$l}}function vhn(i,e){if(!e||!Array.isArray(e))return!1;for(const t of e)if(!i(t))return!1;return!0}function d3(i,e){return typeof i=="boolean"?i:e}function gxe(i,e){return typeof i=="string"?i:e}function yhn(i){const e={};for(const t of i)e[t]=!0;return e}function mxe(i,e=!1){e&&(i=i.map(function(n){return n.toLowerCase()}));const t=yhn(i);return e?function(n){return t[n.toLowerCase()]!==void 0&&t.hasOwnProperty(n.toLowerCase())}:function(n){return t[n]!==void 0&&t.hasOwnProperty(n)}}function jne(i,e,t){e=e.replace(/@@/g,"");let n=0,s;do s=!1,e=e.replace(/@(\w+)/g,function(r,a){s=!0;let l="";if(typeof i[a]=="string")l=i[a];else if(i[a]&&i[a]instanceof RegExp)l=i[a].source;else throw i[a]===void 0?gs(i,"language definition does not contain attribute '"+a+"', used at: "+e):gs(i,"attribute reference '"+a+"' must be a string, used at: "+e);return JC(l)?"":"(?:"+l+")"}),n++;while(s&&n<5);e=e.replace(/\x01/g,"@");const o=(i.ignoreCase?"i":"")+(i.unicode?"u":"");if(t&&e.match(/\$[sS](\d\d?)/g)){let a=null,l=null;return c=>(l&&a===c||(a=c,l=new RegExp(pcn(i,e,c),o)),l)}return new RegExp(e,o)}function whn(i,e,t,n){if(n<0)return i;if(n<e.length)return e[n];if(n>=100){n=n-100;const s=t.split(".");if(s.unshift(t),n<s.length)return s[n]}return null}function Chn(i,e,t,n){let s=-1,o=t,r=t.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);r&&(r[3]&&(s=parseInt(r[3]),r[2]&&(s=s+100)),o=r[4]);let a="~",l=o;!o||o.length===0?(a="!=",l=""):/^\w*$/.test(l)?a="==":(r=o.match(/^(@|!@|~|!~|==|!=)(.*)$/),r&&(a=r[1],l=r[2]));let c;if((a==="~"||a==="!~")&&/^(\w|\|)*$/.test(l)){const d=mxe(l.split("|"),i.ignoreCase);c=function(h){return a==="~"?d(h):!d(h)}}else if(a==="@"||a==="!@"){const d=i[l];if(!d)throw gs(i,"the @ match target '"+l+"' is not defined, in rule: "+e);if(!vhn(function(g){return typeof g=="string"},d))throw gs(i,"the @ match target '"+l+"' must be an array of strings, in rule: "+e);const h=mxe(d,i.ignoreCase);c=function(g){return a==="@"?h(g):!h(g)}}else if(a==="~"||a==="!~")if(l.indexOf("$")<0){const d=jne(i,"^"+l+"$",!1);c=function(h){return a==="~"?d.test(h):!d.test(h)}}else c=function(d,h,g,m){return jne(i,"^"+qv(i,l,h,g,m)+"$",!1).test(d)};else if(l.indexOf("$")<0){const d=nb(i,l);c=function(h){return a==="=="?h===d:h!==d}}else{const d=nb(i,l);c=function(h,g,m,f,p){const _=qv(i,d,g,m,f);return a==="=="?h===_:h!==_}}return s===-1?{name:t,value:n,test:function(d,h,g,m){return c(d,d,h,g,m)}}:{name:t,value:n,test:function(d,h,g,m){const f=whn(d,h,g,s);return c(f||"",d,h,g,m)}}}function Gne(i,e,t){if(t){if(typeof t=="string")return t;if(t.token||t.token===""){if(typeof t.token!="string")throw gs(i,"a 'token' attribute must be of type string, in rule: "+e);{const n={token:t.token};if(t.token.indexOf("$")>=0&&(n.tokenSubst=!0),typeof t.bracket=="string")if(t.bracket==="@open")n.bracket=1;else if(t.bracket==="@close")n.bracket=-1;else throw gs(i,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw gs(i,"the next state must be a string value in rule: "+e);{let s=t.next;if(!/^(@pop|@push|@popall)$/.test(s)&&(s[0]==="@"&&(s=s.substr(1)),s.indexOf("$")<0&&!_cn(i,qv(i,s,"",[],""))))throw gs(i,"the next state '"+t.next+"' is not defined in rule: "+e);n.next=s}}return typeof t.goBack=="number"&&(n.goBack=t.goBack),typeof t.switchTo=="string"&&(n.switchTo=t.switchTo),typeof t.log=="string"&&(n.log=t.log),typeof t.nextEmbedded=="string"&&(n.nextEmbedded=t.nextEmbedded,i.usesEmbedded=!0),n}}else if(Array.isArray(t)){const n=[];for(let s=0,o=t.length;s<o;s++)n[s]=Gne(i,e,t[s]);return{group:n}}else if(t.cases){const n=[];let s=!1;for(const r in t.cases)if(t.cases.hasOwnProperty(r)){const a=Gne(i,e,t.cases[r]);r==="@default"||r==="@"||r===""?n.push({test:void 0,value:a,name:r}):r==="@eos"?n.push({test:function(l,c,d,h){return h},value:a,name:r}):n.push(Chn(i,e,r,a)),s||(s=!$r(a)&&(a.hasEmbeddedEndInCases||["@pop","@popall"].includes(a.nextEmbedded||"")))}const o=i.defaultToken;return{hasEmbeddedEndInCases:s,test:function(r,a,l,c){for(const d of n)if(!d.test||d.test(r,a,l,c))return d.value;return o}}}else throw gs(i,"an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: "+e)}else return{token:""}}class Shn{constructor(e){this.regex=new RegExp(""),this.action={token:""},this.matchOnlyAtLineStart=!1,this.name="",this.name=e}setRegex(e,t){let n;if(typeof t=="string")n=t;else if(t instanceof RegExp)n=t.source;else throw gs(e,"rules must start with a match string or regular expression: "+this.name);this.matchOnlyAtLineStart=n.length>0&&n[0]==="^",this.name=this.name+": "+n,this.regex=jne(e,"^(?:"+(this.matchOnlyAtLineStart?n.substr(1):n)+")",!0)}setAction(e,t){this.action=Gne(e,this.name,t)}resolveRegex(e){return this.regex instanceof RegExp?this.regex:this.regex(e)}}function u9e(i,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");const t={languageId:i,includeLF:d3(e.includeLF,!1),noThrow:!1,maxStack:100,start:typeof e.start=="string"?e.start:null,ignoreCase:d3(e.ignoreCase,!1),unicode:d3(e.unicode,!1),tokenPostfix:gxe(e.tokenPostfix,"."+i),defaultToken:gxe(e.defaultToken,"source"),usesEmbedded:!1,stateNames:{},tokenizer:{},brackets:[]},n=e;n.languageId=i,n.includeLF=t.includeLF,n.ignoreCase=t.ignoreCase,n.unicode=t.unicode,n.noThrow=t.noThrow,n.usesEmbedded=t.usesEmbedded,n.stateNames=e.tokenizer,n.defaultToken=t.defaultToken;function s(r,a,l){for(const c of l){let d=c.include;if(d){if(typeof d!="string")throw gs(t,"an 'include' attribute must be a string at: "+r);if(d[0]==="@"&&(d=d.substr(1)),!e.tokenizer[d])throw gs(t,"include target '"+d+"' is not defined at: "+r);s(r+"."+d,a,e.tokenizer[d])}else{const h=new Shn(r);if(Array.isArray(c)&&c.length>=1&&c.length<=3)if(h.setRegex(n,c[0]),c.length>=3)if(typeof c[1]=="string")h.setAction(n,{token:c[1],next:c[2]});else if(typeof c[1]=="object"){const g=c[1];g.next=c[2],h.setAction(n,g)}else throw gs(t,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+r);else h.setAction(n,c[1]);else{if(!c.regex)throw gs(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+r);c.name&&typeof c.name=="string"&&(h.name=c.name),c.matchOnlyAtStart&&(h.matchOnlyAtLineStart=d3(c.matchOnlyAtLineStart,!1)),h.setRegex(n,c.regex),h.setAction(n,c.action)}a.push(h)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw gs(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(const r in e.tokenizer)if(e.tokenizer.hasOwnProperty(r)){t.start||(t.start=r);const a=e.tokenizer[r];t.tokenizer[r]=new Array,s("tokenizer."+r,t.tokenizer[r],a)}if(t.usesEmbedded=n.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw gs(t,"the 'brackets' attribute must be defined as an array")}else e.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];const o=[];for(const r of e.brackets){let a=r;if(a&&Array.isArray(a)&&a.length===3&&(a={token:a[2],open:a[0],close:a[1]}),a.open===a.close)throw gs(t,"open and close brackets in a 'brackets' attribute must be different: "+a.open+`
1302
- hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")o.push({token:a.token+t.tokenPostfix,open:nb(t,a.open),close:nb(t,a.close)});else throw gs(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=o,t.noThrow=!0,t}function xhn(i){sk.registerLanguage(i)}function Nhn(){let i=[];return i=i.concat(sk.getLanguages()),i}function Ihn(i){return en.get(uo).languageIdCodec.encodeLanguageId(i)}function khn(i,e){return en.withServices(()=>{const n=en.get(uo).onDidRequestRichLanguageFeatures(s=>{s===i&&(n.dispose(),e())});return n})}function Lhn(i,e){return en.withServices(()=>{const n=en.get(uo).onDidRequestBasicLanguageFeatures(s=>{s===i&&(n.dispose(),e())});return n})}function Dhn(i,e){if(!en.get(uo).isRegisteredLanguageId(i))throw new Error(`Cannot set configuration for unknown language ${i}`);return en.get(Fs).register(i,e,100)}class Thn{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,n){if(typeof this._actual.tokenize=="function")return ZM.adaptTokenize(this._languageId,this._actual,e,n);throw new Error("Not supported!")}tokenizeEncoded(e,t,n){const s=this._actual.tokenizeEncoded(e,n);return new hH(s.tokens,s.endState)}}class ZM{constructor(e,t,n,s){this._languageId=e,this._actual=t,this._languageService=n,this._standaloneThemeService=s}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const n=[];let s=0;for(let o=0,r=e.length;o<r;o++){const a=e[o];let l=a.startIndex;o===0?l=0:l<s&&(l=s),n[o]=new UR(l,a.scopes,t),s=l}return n}static adaptTokenize(e,t,n,s){const o=t.tokenize(n,s),r=ZM._toClassicTokens(o.tokens,e);let a;return o.endState.equals(s)?a=s:a=o.endState,new uae(r,a)}tokenize(e,t,n){return ZM.adaptTokenize(this._languageId,this._actual,e,n)}_toBinaryTokens(e,t){const n=e.encodeLanguageId(this._languageId),s=this._standaloneThemeService.getColorTheme().tokenTheme,o=[];let r=0,a=0;for(let c=0,d=t.length;c<d;c++){const h=t[c],g=s.match(n,h.scopes)|1024;if(r>0&&o[r-1]===g)continue;let m=h.startIndex;c===0?m=0:m<a&&(m=a),o[r++]=m,o[r++]=g,a=m}const l=new Uint32Array(r);for(let c=0;c<r;c++)l[c]=o[c];return l}tokenizeEncoded(e,t,n){const s=this._actual.tokenize(e,n),o=this._toBinaryTokens(this._languageService.languageIdCodec,s.tokens);let r;return s.endState.equals(n)?r=n:r=s.endState,new hH(o,r)}}function Ehn(i){return typeof i.getInitialState=="function"}function Phn(i){return"tokenizeEncoded"in i}function h9e(i){return i&&typeof i.then=="function"}function Rhn(i){const e=en.get(Wu);if(i){const t=[null];for(let n=1,s=i.length;n<s;n++)t[n]=De.fromHex(i[n]);e.setColorMapOverride(t)}else e.setColorMapOverride(null)}function g9e(i,e){return Phn(e)?new Thn(i,e):new ZM(i,e,en.get(uo),en.get(Wu))}function kde(i,e){const t=new kWt(async()=>{const n=await Promise.resolve(e.create());return n?Ehn(n)?g9e(i,n):new GM(en.get(uo),en.get(Wu),i,u9e(i,n),en.get(ln)):null});return no.registerFactory(i,t)}function Mhn(i,e){if(!en.get(uo).isRegisteredLanguageId(i))throw new Error(`Cannot set tokens provider for unknown language ${i}`);return h9e(e)?kde(i,{create:()=>e}):no.register(i,g9e(i,e))}function Ahn(i,e){const t=n=>new GM(en.get(uo),en.get(Wu),i,u9e(i,n),en.get(ln));return h9e(e)?kde(i,{create:()=>e}):no.register(i,t(e))}function Ohn(i,e){return en.get(_t).referenceProvider.register(i,e)}function Fhn(i,e){return en.get(_t).renameProvider.register(i,e)}function Bhn(i,e){return en.get(_t).newSymbolNamesProvider.register(i,e)}function Vhn(i,e){return en.get(_t).signatureHelpProvider.register(i,e)}function zhn(i,e){return en.get(_t).hoverProvider.register(i,{provideHover:async(n,s,o,r)=>{const a=n.getWordAtPosition(s);return Promise.resolve(e.provideHover(n,s,o,r)).then(l=>{if(l)return!l.range&&a&&(l.range=new j(s.lineNumber,a.startColumn,s.lineNumber,a.endColumn)),l.range||(l.range=new j(s.lineNumber,s.column,s.lineNumber,s.column)),l})}})}function Whn(i,e){return en.get(_t).documentSymbolProvider.register(i,e)}function Hhn(i,e){return en.get(_t).documentHighlightProvider.register(i,e)}function $hn(i,e){return en.get(_t).linkedEditingRangeProvider.register(i,e)}function Uhn(i,e){return en.get(_t).definitionProvider.register(i,e)}function jhn(i,e){return en.get(_t).implementationProvider.register(i,e)}function Ghn(i,e){return en.get(_t).typeDefinitionProvider.register(i,e)}function qhn(i,e){return en.get(_t).codeLensProvider.register(i,e)}function Khn(i,e,t){return en.get(_t).codeActionProvider.register(i,{providedCodeActionKinds:t?.providedCodeActionKinds,documentation:t?.documentation,provideCodeActions:(s,o,r,a)=>{const c=en.get(Tp).read({resource:s.uri}).filter(d=>j.areIntersectingOrTouching(d,o));return e.provideCodeActions(s,o,{markers:c,only:r.only,trigger:r.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function Jhn(i,e){return en.get(_t).documentFormattingEditProvider.register(i,e)}function Yhn(i,e){return en.get(_t).documentRangeFormattingEditProvider.register(i,e)}function Xhn(i,e){return en.get(_t).onTypeFormattingEditProvider.register(i,e)}function Qhn(i,e){return en.get(_t).linkProvider.register(i,e)}function Zhn(i,e){return en.get(_t).completionProvider.register(i,e)}function egn(i,e){return en.get(_t).colorProvider.register(i,e)}function tgn(i,e){return en.get(_t).foldingRangeProvider.register(i,e)}function ngn(i,e){return en.get(_t).declarationProvider.register(i,e)}function ign(i,e){return en.get(_t).selectionRangeProvider.register(i,e)}function sgn(i,e){return en.get(_t).documentSemanticTokensProvider.register(i,e)}function ogn(i,e){return en.get(_t).documentRangeSemanticTokensProvider.register(i,e)}function rgn(i,e){return en.get(_t).inlineCompletionsProvider.register(i,e)}function agn(i,e){return en.get(_t).inlayHintsProvider.register(i,e)}function lgn(){return{register:xhn,getLanguages:Nhn,onLanguage:khn,onLanguageEncountered:Lhn,getEncodedLanguageId:Ihn,setLanguageConfiguration:Dhn,setColorMap:Rhn,registerTokensProviderFactory:kde,setTokensProvider:Mhn,setMonarchTokensProvider:Ahn,registerReferenceProvider:Ohn,registerRenameProvider:Fhn,registerNewSymbolNameProvider:Bhn,registerCompletionItemProvider:Zhn,registerSignatureHelpProvider:Vhn,registerHoverProvider:zhn,registerDocumentSymbolProvider:Whn,registerDocumentHighlightProvider:Hhn,registerLinkedEditingRangeProvider:$hn,registerDefinitionProvider:Uhn,registerImplementationProvider:jhn,registerTypeDefinitionProvider:Ghn,registerCodeLensProvider:qhn,registerCodeActionProvider:Khn,registerDocumentFormattingEditProvider:Jhn,registerDocumentRangeFormattingEditProvider:Yhn,registerOnTypeFormattingEditProvider:Xhn,registerLinkProvider:Qhn,registerColorProvider:egn,registerFoldingRangeProvider:tgn,registerDeclarationProvider:ngn,registerSelectionRangeProvider:ign,registerDocumentSemanticTokensProvider:sgn,registerDocumentRangeSemanticTokensProvider:ogn,registerInlineCompletionsProvider:rgn,registerInlayHintsProvider:agn,DocumentHighlightKind:cte,CompletionItemKind:ite,CompletionItemTag:ste,CompletionItemInsertTextRule:nte,SymbolKind:Wte,SymbolTag:Hte,IndentAction:pte,CompletionTriggerKind:ote,SignatureHelpTriggerKind:zte,InlayHintKind:bte,InlineCompletionTriggerKind:wte,CodeActionTriggerType:tte,NewSymbolNameTag:Lte,NewSymbolNameTriggerKind:Dte,PartialAcceptTriggerKind:Pte,HoverVerbosityAction:fte,InlineCompletionEndOfLifeReasonKind:vte,InlineCompletionHintStyle:yte,FoldingRangeKind:tS,SelectedSuggestionInfo:z5e,EditDeltaInfo:nM}}$l.wrappingIndent.defaultValue=0;$l.glyphMargin.defaultValue=!1;$l.autoIndent.defaultValue=3;$l.overviewRulerLanes.defaultValue=2;Dk.setFormatterSelector((i,e,t)=>Promise.resolve(i[0]));const Dc=zWe();Dc.editor=bhn();Dc.languages=lgn();const m9e=Dc.CancellationTokenSource,sw=Dc.Emitter,f9e=Dc.KeyCode,p9e=Dc.KeyMod,Vb=Dc.Position,FL=Dc.Range,_9e=Dc.Selection,b9e=Dc.SelectionDirection,yg=Dc.MarkerSeverity,QW=Dc.MarkerTag,x7=Dc.Uri,v9e=Dc.Token,rp=Dc.editor,pt=Dc.languages,cgn=qoe(),DI=globalThis;(cgn?.globalAPI||typeof DI.define=="function"&&DI.define.amd)&&(DI.monaco=Dc);typeof DI.require<"u"&&typeof DI.require.config=="function"&&DI.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});const dgn=Object.freeze(Object.defineProperty({__proto__:null,CancellationTokenSource:m9e,Emitter:sw,KeyCode:f9e,KeyMod:p9e,MarkerSeverity:yg,MarkerTag:QW,Position:Vb,Range:FL,Selection:_9e,SelectionDirection:b9e,Token:v9e,Uri:x7,editor:rp,languages:pt},Symbol.toStringTag,{value:"Module"}));let Lde=class{constructor(e,t,n){this._onDidChange=new sw,this._languageId=e,this.setOptions(t),this.setModeConfiguration(n)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const Dde={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},Tde={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},y9e=new Lde("css",Dde,Tde),w9e=new Lde("scss",Dde,Tde),C9e=new Lde("less",Dde,Tde);function Ede(){return Nt(()=>import("./cssMode.r5_yWnhF.js"),__vite__mapDeps([9,10]))}pt.onLanguage("less",()=>{Ede().then(i=>i.setupMode(C9e))});pt.onLanguage("scss",()=>{Ede().then(i=>i.setupMode(w9e))});pt.onLanguage("css",()=>{Ede().then(i=>i.setupMode(y9e))});const S9e=Object.freeze(Object.defineProperty({__proto__:null,cssDefaults:y9e,lessDefaults:C9e,scssDefaults:w9e},Symbol.toStringTag,{value:"Module"}));let ugn=class{constructor(e,t,n){this._onDidChange=new sw,this._languageId=e,this.setOptions(t),this.setModeConfiguration(n)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const hgn={tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},N7={format:hgn,suggest:{},data:{useDefaultDataProvider:!0}};function I7(i){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:i===$P,documentFormattingEdits:i===$P,documentRangeFormattingEdits:i===$P}}const $P="html",fxe="handlebars",pxe="razor",x9e=k7($P,N7,I7($P)),ggn=x9e.defaults,N9e=k7(fxe,N7,I7(fxe)),mgn=N9e.defaults,I9e=k7(pxe,N7,I7(pxe)),fgn=I9e.defaults;function pgn(){return Nt(()=>import("./htmlMode.HtihP2HZ.js"),__vite__mapDeps([11,10]))}function k7(i,e=N7,t=I7(i)){const n=new ugn(i,e,t);let s;const o=pt.onLanguage(i,async()=>{s=(await pgn()).setupMode(n)});return{defaults:n,dispose(){o.dispose(),s?.dispose(),s=void 0}}}const k9e=Object.freeze(Object.defineProperty({__proto__:null,handlebarDefaults:mgn,handlebarLanguageService:N9e,htmlDefaults:ggn,htmlLanguageService:x9e,razorDefaults:fgn,razorLanguageService:I9e,registerHTMLLanguageService:k7},Symbol.toStringTag,{value:"Module"}));let _gn=class{constructor(e,t,n){this._onDidChange=new sw,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(n)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const bgn={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},vgn={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},L9e=new _gn("json",bgn,vgn),ygn=()=>D9e().then(i=>i.getWorker());function D9e(){return Nt(()=>import("./jsonMode.mx3rzMj6.js"),__vite__mapDeps([12,10]))}pt.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});pt.onLanguage("json",()=>{D9e().then(i=>i.setupMode(L9e))});const T9e=Object.freeze(Object.defineProperty({__proto__:null,getWorker:ygn,jsonDefaults:L9e},Symbol.toStringTag,{value:"Module"})),wgn="5.9.3";var E9e=(i=>(i[i.None=0]="None",i[i.CommonJS=1]="CommonJS",i[i.AMD=2]="AMD",i[i.UMD=3]="UMD",i[i.System=4]="System",i[i.ES2015=5]="ES2015",i[i.ESNext=99]="ESNext",i))(E9e||{}),P9e=(i=>(i[i.None=0]="None",i[i.Preserve=1]="Preserve",i[i.React=2]="React",i[i.ReactNative=3]="ReactNative",i[i.ReactJSX=4]="ReactJSX",i[i.ReactJSXDev=5]="ReactJSXDev",i))(P9e||{}),R9e=(i=>(i[i.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",i[i.LineFeed=1]="LineFeed",i))(R9e||{}),M9e=(i=>(i[i.ES3=0]="ES3",i[i.ES5=1]="ES5",i[i.ES2015=2]="ES2015",i[i.ES2016=3]="ES2016",i[i.ES2017=4]="ES2017",i[i.ES2018=5]="ES2018",i[i.ES2019=6]="ES2019",i[i.ES2020=7]="ES2020",i[i.ESNext=99]="ESNext",i[i.JSON=100]="JSON",i[i.Latest=99]="Latest",i))(M9e||{}),A9e=(i=>(i[i.Classic=1]="Classic",i[i.NodeJs=2]="NodeJs",i))(A9e||{});class O9e{constructor(e,t,n,s,o){this._onDidChange=new sw,this._onDidExtraLibsChange=new sw,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(e),this.setDiagnosticsOptions(t),this.setWorkerOptions(n),this.setInlayHintsOptions(s),this.setModeConfiguration(o),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(e,t){let n;if(typeof t>"u"?n=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:n=t,this._extraLibs[n]&&this._extraLibs[n].content===e)return{dispose:()=>{}};let s=1;return this._removedExtraLibs[n]&&(s=this._removedExtraLibs[n]+1),this._extraLibs[n]&&(s=this._extraLibs[n].version+1),this._extraLibs[n]={content:e,version:s},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let o=this._extraLibs[n];o&&o.version===s&&(delete this._extraLibs[n],this._removedExtraLibs[n]=s,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(e){for(const t in this._extraLibs)this._removedExtraLibs[t]=this._extraLibs[t].version;if(this._extraLibs=Object.create(null),e&&e.length>0)for(const t of e){const n=t.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,s=t.content;let o=1;this._removedExtraLibs[n]&&(o=this._removedExtraLibs[n]+1),this._extraLibs[n]={content:s,version:o}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(e){this._compilerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(e){this._workerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(e){this._inlayHintsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(e){}setEagerModelSync(e){this._eagerModelSync=e}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(void 0)}}const Cgn=wgn,F9e={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},B9e=new O9e({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},F9e),V9e=new O9e({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},F9e),Sgn=()=>L7().then(i=>i.getTypeScriptWorker()),xgn=()=>L7().then(i=>i.getJavaScriptWorker());function L7(){return Nt(()=>import("./tsMode.BbJpvH--.js"),[])}pt.onLanguage("typescript",()=>L7().then(i=>i.setupTypeScript(B9e)));pt.onLanguage("javascript",()=>L7().then(i=>i.setupJavaScript(V9e)));const z9e=Object.freeze(Object.defineProperty({__proto__:null,JsxEmit:P9e,ModuleKind:E9e,ModuleResolutionKind:A9e,NewLineKind:R9e,ScriptTarget:M9e,getJavaScriptWorker:xgn,getTypeScriptWorker:Sgn,javascriptDefaults:V9e,typescriptDefaults:B9e,typescriptVersion:Cgn},Symbol.toStringTag,{value:"Module"})),W9e={},pq={};class Pde{static getOrCreate(e){return pq[e]||(pq[e]=new Pde(e)),pq[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((t,n)=>{this._lazyLoadPromiseResolve=t,this._lazyLoadPromiseReject=n})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,W9e[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}}function Vt(i){const e=i.id;W9e[e]=i,pt.register(i);const t=Pde.getOrCreate(e);pt.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),pt.onLanguageEncountered(e,async()=>{const n=await t.load();pt.setLanguageConfiguration(e,n.conf)})}Vt({id:"abap",extensions:[".abap"],aliases:["abap","ABAP"],loader:()=>Nt(()=>import("./abap.DLDM7-KI.js"),[])});Vt({id:"apex",extensions:[".cls"],aliases:["Apex","apex"],mimetypes:["text/x-apex-source","text/x-apex"],loader:()=>Nt(()=>import("./apex.DNDY2TF8.js"),[])});Vt({id:"azcli",extensions:[".azcli"],aliases:["Azure CLI","azcli"],loader:()=>Nt(()=>import("./azcli.Y6nb8tq_.js"),[])});Vt({id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],loader:()=>Nt(()=>import("./bat.BwHxbl9M.js"),[])});Vt({id:"bicep",extensions:[".bicep"],aliases:["Bicep"],loader:()=>Nt(()=>import("./bicep.CFznDFnq.js"),[])});Vt({id:"cameligo",extensions:[".mligo"],aliases:["Cameligo"],loader:()=>Nt(()=>import("./cameligo.Bf6VGUru.js"),[])});Vt({id:"clojure",extensions:[".clj",".cljs",".cljc",".edn"],aliases:["clojure","Clojure"],loader:()=>Nt(()=>import("./clojure.Dnu-v4kV.js"),[])});Vt({id:"coffeescript",extensions:[".coffee"],aliases:["CoffeeScript","coffeescript","coffee"],mimetypes:["text/x-coffeescript","text/coffeescript"],loader:()=>Nt(()=>import("./coffee.Bd8akH9Z.js"),[])});Vt({id:"c",extensions:[".c",".h"],aliases:["C","c"],loader:()=>Nt(()=>import("./cpp.BbWJElDN.js"),[])});Vt({id:"cpp",extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],aliases:["C++","Cpp","cpp"],loader:()=>Nt(()=>import("./cpp.BbWJElDN.js"),[])});Vt({id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],loader:()=>Nt(()=>import("./csharp.Co3qMtFm.js"),[])});Vt({id:"csp",extensions:[".csp"],aliases:["CSP","csp"],loader:()=>Nt(()=>import("./csp.D-4FJmMZ.js"),[])});Vt({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>Nt(()=>import("./css.DdJfP1eB.js"),[])});Vt({id:"cypher",extensions:[".cypher",".cyp"],aliases:["Cypher","OpenCypher"],loader:()=>Nt(()=>import("./cypher.cTPe9QuQ.js"),[])});Vt({id:"dart",extensions:[".dart"],aliases:["Dart","dart"],mimetypes:["text/x-dart-source","text/x-dart"],loader:()=>Nt(()=>import("./dart.BOtBlQCF.js"),[])});Vt({id:"dockerfile",extensions:[".dockerfile"],filenames:["Dockerfile"],aliases:["Dockerfile"],loader:()=>Nt(()=>import("./dockerfile.BG73LgW2.js"),[])});Vt({id:"ecl",extensions:[".ecl"],aliases:["ECL","Ecl","ecl"],loader:()=>Nt(()=>import("./ecl.BEgZUVRK.js"),[])});Vt({id:"elixir",extensions:[".ex",".exs"],aliases:["Elixir","elixir","ex"],loader:()=>Nt(()=>import("./elixir.BkW5O-1t.js"),[])});Vt({id:"flow9",extensions:[".flow"],aliases:["Flow9","Flow","flow9","flow"],loader:()=>Nt(()=>import("./flow9.BeJ5waoc.js"),[])});Vt({id:"fsharp",extensions:[".fs",".fsi",".ml",".mli",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],loader:()=>Nt(()=>import("./fsharp.PahG7c26.js"),[])});Vt({id:"freemarker2",extensions:[".ftl",".ftlh",".ftlx"],aliases:["FreeMarker2","Apache FreeMarker2"],loader:()=>Nt(()=>import("./freemarker2.DCx4k8go.js"),[]).then(i=>i.TagAutoInterpolationDollar)});Vt({id:"freemarker2.tag-angle.interpolation-dollar",aliases:["FreeMarker2 (Angle/Dollar)","Apache FreeMarker2 (Angle/Dollar)"],loader:()=>Nt(()=>import("./freemarker2.DCx4k8go.js"),[]).then(i=>i.TagAngleInterpolationDollar)});Vt({id:"freemarker2.tag-bracket.interpolation-dollar",aliases:["FreeMarker2 (Bracket/Dollar)","Apache FreeMarker2 (Bracket/Dollar)"],loader:()=>Nt(()=>import("./freemarker2.DCx4k8go.js"),[]).then(i=>i.TagBracketInterpolationDollar)});Vt({id:"freemarker2.tag-angle.interpolation-bracket",aliases:["FreeMarker2 (Angle/Bracket)","Apache FreeMarker2 (Angle/Bracket)"],loader:()=>Nt(()=>import("./freemarker2.DCx4k8go.js"),[]).then(i=>i.TagAngleInterpolationBracket)});Vt({id:"freemarker2.tag-bracket.interpolation-bracket",aliases:["FreeMarker2 (Bracket/Bracket)","Apache FreeMarker2 (Bracket/Bracket)"],loader:()=>Nt(()=>import("./freemarker2.DCx4k8go.js"),[]).then(i=>i.TagBracketInterpolationBracket)});Vt({id:"freemarker2.tag-auto.interpolation-dollar",aliases:["FreeMarker2 (Auto/Dollar)","Apache FreeMarker2 (Auto/Dollar)"],loader:()=>Nt(()=>import("./freemarker2.DCx4k8go.js"),[]).then(i=>i.TagAutoInterpolationDollar)});Vt({id:"freemarker2.tag-auto.interpolation-bracket",aliases:["FreeMarker2 (Auto/Bracket)","Apache FreeMarker2 (Auto/Bracket)"],loader:()=>Nt(()=>import("./freemarker2.DCx4k8go.js"),[]).then(i=>i.TagAutoInterpolationBracket)});Vt({id:"go",extensions:[".go"],aliases:["Go"],loader:()=>Nt(()=>import("./go.acbASCJo.js"),[])});Vt({id:"graphql",extensions:[".graphql",".gql"],aliases:["GraphQL","graphql","gql"],mimetypes:["application/graphql"],loader:()=>Nt(()=>import("./graphql.BxJiqAUM.js"),[])});Vt({id:"handlebars",extensions:[".handlebars",".hbs"],aliases:["Handlebars","handlebars","hbs"],mimetypes:["text/x-handlebars-template"],loader:()=>Nt(()=>import("./handlebars.BludBZv4.js"),[])});Vt({id:"hcl",extensions:[".tf",".tfvars",".hcl"],aliases:["Terraform","tf","HCL","hcl"],loader:()=>Nt(()=>import("./hcl.DtV1sZF8.js"),[])});Vt({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>Nt(()=>import("./html.C-reJSx7.js"),[])});Vt({id:"ini",extensions:[".ini",".properties",".gitconfig"],filenames:["config",".gitattributes",".gitconfig",".editorconfig"],aliases:["Ini","ini"],loader:()=>Nt(()=>import("./ini.Kd9XrMLS.js"),[])});Vt({id:"java",extensions:[".java",".jav"],aliases:["Java","java"],mimetypes:["text/x-java-source","text/x-java"],loader:()=>Nt(()=>import("./java.CXBNlu9o.js"),[])});Vt({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>Nt(()=>import("./javascript.BtXUGP6j.js"),__vite__mapDeps([13,14]))});Vt({id:"julia",extensions:[".jl"],aliases:["julia","Julia"],loader:()=>Nt(()=>import("./julia.cl7-CwDS.js"),[])});Vt({id:"kotlin",extensions:[".kt",".kts"],aliases:["Kotlin","kotlin"],mimetypes:["text/x-kotlin-source","text/x-kotlin"],loader:()=>Nt(()=>import("./kotlin.s7OhZKlX.js"),[])});Vt({id:"less",extensions:[".less"],aliases:["Less","less"],mimetypes:["text/x-less","text/less"],loader:()=>Nt(()=>import("./less.9HpZscsL.js"),[])});Vt({id:"lexon",extensions:[".lex"],aliases:["Lexon"],loader:()=>Nt(()=>import("./lexon.OrD6JF1K.js"),[])});Vt({id:"lua",extensions:[".lua"],aliases:["Lua","lua"],loader:()=>Nt(()=>import("./lua.Cyyb5UIc.js"),[])});Vt({id:"liquid",extensions:[".liquid",".html.liquid"],aliases:["Liquid","liquid"],mimetypes:["application/liquid"],loader:()=>Nt(()=>import("./liquid.BKDdGihc.js"),[])});Vt({id:"m3",extensions:[".m3",".i3",".mg",".ig"],aliases:["Modula-3","Modula3","modula3","m3"],loader:()=>Nt(()=>import("./m3.B8OfTtLu.js"),[])});Vt({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>Nt(()=>import("./markdown.BFxVWTOG.js"),[])});Vt({id:"mdx",extensions:[".mdx"],aliases:["MDX","mdx"],loader:()=>Nt(()=>import("./mdx.C8GBeJOc.js"),[])});Vt({id:"mips",extensions:[".s"],aliases:["MIPS","MIPS-V"],mimetypes:["text/x-mips","text/mips","text/plaintext"],loader:()=>Nt(()=>import("./mips.CiqrrVzr.js"),[])});Vt({id:"msdax",extensions:[".dax",".msdax"],aliases:["DAX","MSDAX"],loader:()=>Nt(()=>import("./msdax.DmeGPVcC.js"),[])});Vt({id:"mysql",extensions:[],aliases:["MySQL","mysql"],loader:()=>Nt(()=>import("./mysql.C_tMU-Nz.js"),[])});Vt({id:"objective-c",extensions:[".m"],aliases:["Objective-C"],loader:()=>Nt(()=>import("./objective-c.BDtDVThU.js"),[])});Vt({id:"pascal",extensions:[".pas",".p",".pp"],aliases:["Pascal","pas"],mimetypes:["text/x-pascal-source","text/x-pascal"],loader:()=>Nt(()=>import("./pascal.vHIfCaH5.js"),[])});Vt({id:"pascaligo",extensions:[".ligo"],aliases:["Pascaligo","ligo"],loader:()=>Nt(()=>import("./pascaligo.DtZ0uQbO.js"),[])});Vt({id:"perl",extensions:[".pl",".pm"],aliases:["Perl","pl"],loader:()=>Nt(()=>import("./perl.Ub6l9XKa.js"),[])});Vt({id:"pgsql",extensions:[],aliases:["PostgreSQL","postgres","pg","postgre"],loader:()=>Nt(()=>import("./pgsql.BlNEE0v7.js"),[])});Vt({id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],mimetypes:["application/x-php"],loader:()=>Nt(()=>import("./php.BBUBE1dy.js"),[])});Vt({id:"pla",extensions:[".pla"],loader:()=>Nt(()=>import("./pla.DSh2-awV.js"),[])});Vt({id:"postiats",extensions:[".dats",".sats",".hats"],aliases:["ATS","ATS/Postiats"],loader:()=>Nt(()=>import("./postiats.CocnycG-.js"),[])});Vt({id:"powerquery",extensions:[".pq",".pqm"],aliases:["PQ","M","Power Query","Power Query M"],loader:()=>Nt(()=>import("./powerquery.tScXyioY.js"),[])});Vt({id:"powershell",extensions:[".ps1",".psm1",".psd1"],aliases:["PowerShell","powershell","ps","ps1"],loader:()=>Nt(()=>import("./powershell.COWaemsV.js"),[])});Vt({id:"proto",extensions:[".proto"],aliases:["protobuf","Protocol Buffers"],loader:()=>Nt(()=>import("./protobuf.Brw8urJB.js"),[])});Vt({id:"pug",extensions:[".jade",".pug"],aliases:["Pug","Jade","jade"],loader:()=>Nt(()=>import("./pug.8SOpv6rk.js"),[])});Vt({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>Nt(()=>import("./python.LxZo3-5L.js"),[])});Vt({id:"qsharp",extensions:[".qs"],aliases:["Q#","qsharp"],loader:()=>Nt(()=>import("./qsharp.Bw9ernYp.js"),[])});Vt({id:"r",extensions:[".r",".rhistory",".rmd",".rprofile",".rt"],aliases:["R","r"],loader:()=>Nt(()=>import("./r.j7ic8hl3.js"),[])});Vt({id:"razor",extensions:[".cshtml"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],loader:()=>Nt(()=>import("./razor.D95WY7jF.js"),[])});Vt({id:"redis",extensions:[".redis"],aliases:["redis"],loader:()=>Nt(()=>import("./redis.Bu5POkcn.js"),[])});Vt({id:"redshift",extensions:[],aliases:["Redshift","redshift"],loader:()=>Nt(()=>import("./redshift.Bs9aos_-.js"),[])});Vt({id:"restructuredtext",extensions:[".rst"],aliases:["reStructuredText","restructuredtext"],loader:()=>Nt(()=>import("./restructuredtext.CqXO7rUv.js"),[])});Vt({id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".pp"],filenames:["rakefile","Gemfile"],aliases:["Ruby","rb"],loader:()=>Nt(()=>import("./ruby.zBfavPgS.js"),[])});Vt({id:"rust",extensions:[".rs",".rlib"],aliases:["Rust","rust"],loader:()=>Nt(()=>import("./rust.BzKRNQWT.js"),[])});Vt({id:"sb",extensions:[".sb"],aliases:["Small Basic","sb"],loader:()=>Nt(()=>import("./sb.BBc9UKZt.js"),[])});Vt({id:"scala",extensions:[".scala",".sc",".sbt"],aliases:["Scala","scala","SBT","Sbt","sbt","Dotty","dotty"],mimetypes:["text/x-scala-source","text/x-scala","text/x-sbt","text/x-dotty"],loader:()=>Nt(()=>import("./scala.D9hQfWCl.js"),[])});Vt({id:"scheme",extensions:[".scm",".ss",".sch",".rkt"],aliases:["scheme","Scheme"],loader:()=>Nt(()=>import("./scheme.BPhDTwHR.js"),[])});Vt({id:"scss",extensions:[".scss"],aliases:["Sass","sass","scss"],mimetypes:["text/x-scss","text/scss"],loader:()=>Nt(()=>import("./scss.CBJaRo0y.js"),[])});Vt({id:"shell",extensions:[".sh",".bash"],aliases:["Shell","sh"],loader:()=>Nt(()=>import("./shell.DiJ1NA_G.js"),[])});Vt({id:"sol",extensions:[".sol"],aliases:["sol","solidity","Solidity"],loader:()=>Nt(()=>import("./solidity.Db0IVjzk.js"),[])});Vt({id:"aes",extensions:[".aes"],aliases:["aes","sophia","Sophia"],loader:()=>Nt(()=>import("./sophia.CnS9iZB_.js"),[])});Vt({id:"sparql",extensions:[".rq"],aliases:["sparql","SPARQL"],loader:()=>Nt(()=>import("./sparql.CJmd_6j2.js"),[])});Vt({id:"sql",extensions:[".sql"],aliases:["SQL"],loader:()=>Nt(()=>import("./sql.ClhHkBeG.js"),[])});Vt({id:"st",extensions:[".st",".iecst",".iecplc",".lc3lib",".TcPOU",".TcDUT",".TcGVL",".TcIO"],aliases:["StructuredText","scl","stl"],loader:()=>Nt(()=>import("./st.CHwy0fLd.js"),[])});Vt({id:"swift",aliases:["Swift","swift"],extensions:[".swift"],mimetypes:["text/swift"],loader:()=>Nt(()=>import("./swift.Bqt4WxQ4.js"),[])});Vt({id:"systemverilog",extensions:[".sv",".svh"],aliases:["SV","sv","SystemVerilog","systemverilog"],loader:()=>Nt(()=>import("./systemverilog.Bs9z6M-B.js"),[])});Vt({id:"verilog",extensions:[".v",".vh"],aliases:["V","v","Verilog","verilog"],loader:()=>Nt(()=>import("./systemverilog.Bs9z6M-B.js"),[])});Vt({id:"tcl",extensions:[".tcl"],aliases:["tcl","Tcl","tcltk","TclTk","tcl/tk","Tcl/Tk"],loader:()=>Nt(()=>import("./tcl.Dm6ycUr_.js"),[])});Vt({id:"twig",extensions:[".twig"],aliases:["Twig","twig"],mimetypes:["text/x-twig"],loader:()=>Nt(()=>import("./twig.Csy3S7wG.js"),[])});Vt({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>Nt(()=>import("./typescript.DdC-A9nd.js"),[])});Vt({id:"typespec",extensions:[".tsp"],aliases:["TypeSpec"],loader:()=>Nt(()=>import("./typespec.Btyra-wh.js"),[])});Vt({id:"vb",extensions:[".vb"],aliases:["Visual Basic","vb"],loader:()=>Nt(()=>import("./vb.Db0cS2oM.js"),[])});Vt({id:"wgsl",extensions:[".wgsl"],aliases:["WebGPU Shading Language","WGSL","wgsl"],loader:()=>Nt(()=>import("./wgsl.DumH7NcR.js"),[])});Vt({id:"xml",extensions:[".xml",".xsd",".dtd",".ascx",".csproj",".config",".props",".targets",".wxi",".wxl",".wxs",".xaml",".svg",".svgz",".opf",".xslt",".xsl"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],mimetypes:["text/xml","application/xml","application/xaml+xml","application/xml-dtd"],loader:()=>Nt(()=>import("./xml.DmJRBsLI.js"),[])});Vt({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>Nt(()=>import("./yaml.Du5J4UhC.js"),[])});var Ngn=Object.defineProperty,Ign=(i,e,t)=>e in i?Ngn(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Rt=(i,e,t)=>Ign(i,typeof e!="symbol"?e+"":e,t),u3,_xe,h3,_q,g3;function kgn(i){return i.method!==void 0}var bxe;(function(i){function e(t){return t}i.create=e})(bxe||(bxe={}));var fg;(function(i){i.parseError=-32700,i.invalidRequest=-32600,i.methodNotFound=-32601,i.invalidParams=-32602,i.internalError=-32603;function e(o){return-32099<=o&&o<=-32e3}i.isServerError=e;function t(o){if(!e(o))throw new Error("Invalid range for a server error.");return o}i.serverError=t,i.unexpectedServerError=-32e3;function n(o){return!0}i.isApplicationError=n;function s(o){return o}i.applicationError=s,i.genericApplicationError=-320100})(fg||(fg={}));var Rde=class{constructor(){Rt(this,"listeners",new Set),Rt(this,"event",i=>(this.listeners.add(i),{dispose:()=>{this.listeners.delete(i)}}))}fire(i){this.listeners.forEach(e=>e(i))}},Lgn=class{constructor(i){Rt(this,"_value"),Rt(this,"eventEmitter"),this._value=i,this.eventEmitter=new Rde}get value(){return this._value}set value(i){this._value!==i&&(this._value=i,this.eventEmitter.fire(i))}get onChange(){return this.eventEmitter.event}};function Dgn(i,e){const t=setTimeout(e,i);return{dispose:()=>clearTimeout(t)}}function bq(i,e,t){return i instanceof Set?(i.add(e),{dispose:()=>i.delete(e)}):(i.set(e,t),{dispose:()=>i.delete(e)})}var Tgn=class{constructor(){Rt(this,"_state","none"),Rt(this,"promise"),Rt(this,"resolve",()=>{}),Rt(this,"reject",()=>{}),this.promise=new Promise((i,e)=>{this.resolve=i,this.reject=e})}get state(){return this._state}},H9e=(u3=class{constructor(){Rt(this,"_unprocessedMessages",[]),Rt(this,"_messageListener"),Rt(this,"id",u3.id++),Rt(this,"_state",new Lgn({state:"open"})),Rt(this,"state",this._state)}setListener(i){if(this._messageListener=i,!!i)for(;this._unprocessedMessages.length>0&&this._messageListener!==void 0;){const e=this._unprocessedMessages.shift();this._messageListener(e)}}send(i){return this._sendImpl(i)}_dispatchReceivedMessage(i){this._unprocessedMessages.length===0&&this._messageListener?this._messageListener(i):this._unprocessedMessages.push(i)}_onConnectionClosed(){this._state.value={state:"closed",error:void 0}}log(i){return new Egn(this,i??new Pgn)}},Rt(u3,"id",0),u3),Egn=class{constructor(i,e){Rt(this,"baseStream"),Rt(this,"logger"),this.baseStream=i,this.logger=e}get state(){return this.baseStream.state}setListener(i){if(i===void 0){this.baseStream.setListener(void 0);return}this.baseStream.setListener(e=>{this.logger.log(this.baseStream,"incoming",e),i(e)})}send(i){return this.logger.log(this.baseStream,"outgoing",i),this.baseStream.send(i)}toString(){return`StreamLogger/${this.baseStream.toString()}`}},Pgn=class{log(i,e,t){console.log(`${e==="incoming"?"<-":"->"} [${i.toString()}] ${JSON.stringify(t)}`)}},Rgn=class $9e{constructor(e){Rt(this,"connect"),this.connect=e}mapContext(e){return new $9e(t=>this.connect(t?Mgn(t,e):void 0))}};function Mgn(i,e){return{handleNotification:(t,n)=>i.handleNotification(t,e(n)),handleRequest:(t,n,s)=>i.handleRequest(t,n,e(s))}}var Agn=class U9e{constructor(e,t,n){Rt(this,"_stream"),Rt(this,"_listener"),Rt(this,"_logger"),Rt(this,"_unprocessedResponses",new Map),Rt(this,"_lastUsedRequestId",0),this._stream=e,this._listener=t,this._logger=n,this._stream.setListener(s=>{kgn(s)?s.id===void 0?this._processNotification(s):this._processRequest(s):this._processResponse(s)})}static createChannel(e,t){let n=!1;return new Rgn(s=>{if(n)throw new Error(`A channel to the stream ${e} was already constructed!`);return n=!0,new U9e(e,s,t)})}get state(){return this._stream.state}async _processNotification(e){if(e.id!==void 0)throw new Error;if(!this._listener){this._logger&&this._logger.debug({text:"Notification ignored",message:e});return}try{await this._listener.handleNotification({method:e.method,params:e.params||null})}catch(t){this._logger&&this._logger.warn({text:`Exception was thrown while handling notification: ${t}`,exception:t,message:e})}}async _processRequest(e){if(e.id===void 0)throw new Error;let t;if(this._listener)try{t=await this._listener.handleRequest({method:e.method,params:e.params||null},e.id)}catch(s){this._logger&&this._logger.warn({text:`Exception was thrown while handling request: ${s}`,message:e,exception:s}),t={error:{code:fg.internalError,message:"An unexpected exception was thrown.",data:void 0}}}else this._logger&&this._logger.debug({text:"Received request even though not listening for requests",message:e}),t={error:{code:fg.methodNotFound,message:"This endpoint does not listen for requests or notifications.",data:void 0}};let n;"result"in t?n={jsonrpc:"2.0",id:e.id,result:t.result}:n={jsonrpc:"2.0",id:e.id,error:t.error},await this._stream.send(n)}_processResponse(e){const t=""+e.id,n=this._unprocessedResponses.get(t);if(!n){this._logger&&this._logger.debug({text:"Got an unexpected response message",message:e});return}this._unprocessedResponses.delete(t),n(e)}_newRequestId(){return this._lastUsedRequestId++}sendRequest(e,t,n){const s={jsonrpc:"2.0",id:this._newRequestId(),method:e.method,params:e.params||void 0};return n&&n(s.id),new Promise((o,r)=>{const a=""+s.id;this._unprocessedResponses.set(a,l=>{"result"in l?o({result:l.result}):(l.error||r(new Error("Response had neither 'result' nor 'error' field set.")),o({error:l.error}))}),this._stream.send(s).then(void 0,l=>{this._unprocessedResponses.delete(a),r(l)})})}sendNotification(e,t){const n={jsonrpc:"2.0",id:void 0,method:e.method,params:e.params||void 0};return this._stream.send(n)}toString(){return"StreamChannel/"+this._stream.toString()}},TI;(function(i){function e(){return{deserializeFromJson:s=>({hasErrors:!1,value:s}),serializeToJson:s=>s}}i.sAny=e;function t(){return{deserializeFromJson:s=>({hasErrors:!1,value:{}}),serializeToJson:s=>({})}}i.sEmptyObject=t;function n(){return{deserializeFromJson:s=>({hasErrors:!1,value:void 0}),serializeToJson:s=>null}}i.sVoidFromNull=n})(TI||(TI={}));const j9e=Symbol("OptionalMethodNotFound");var G9e=class{contextualize(i){return new Ogn(this,i)}},Ogn=class extends G9e{constructor(i,e){super(),Rt(this,"underylingTypedChannel"),Rt(this,"converters"),this.underylingTypedChannel=i,this.converters=e}async request(i,e,t){const n=await this.converters.getSendContext(t);return this.underylingTypedChannel.request(i,e,n)}async notify(i,e,t){const n=await this.converters.getSendContext(t);return this.underylingTypedChannel.notify(i,e,n)}registerNotificationHandler(i,e){return this.underylingTypedChannel.registerNotificationHandler(i,async(t,n)=>await e(t,await this.converters.getNewContext(n)))}registerRequestHandler(i,e){return this.underylingTypedChannel.registerRequestHandler(i,async(t,n,s)=>await e(t,n,await this.converters.getNewContext(s)))}},qne=class q9e extends G9e{constructor(e,t={}){super(),Rt(this,"channelCtor"),Rt(this,"_requestSender"),Rt(this,"_handler",new Map),Rt(this,"_unknownNotificationHandler",new Set),Rt(this,"_timeout"),Rt(this,"sendExceptionDetails",!1),Rt(this,"_logger"),Rt(this,"listeningDeferred",new Tgn),Rt(this,"onListening",this.listeningDeferred.promise),Rt(this,"_requestDidErrorEventEmitter",new Rde),Rt(this,"onRequestDidError",this._requestDidErrorEventEmitter.event),this.channelCtor=e,this._logger=t.logger,this.sendExceptionDetails=!!t.sendExceptionDetails,this._timeout=Dgn(1e3,()=>{this._requestSender||console.warn(`"${this.startListen.name}" has not been called within 1 second after construction of this channel. Did you forget to call it?`,this)})}static fromTransport(e,t={}){return new q9e(Agn.createChannel(e,t.logger),t)}startListen(){if(this._requestSender)throw new Error(`"${this.startListen.name}" can be called only once, but it already has been called.`);this._timeout&&(this._timeout.dispose(),this._timeout=void 0),this._requestSender=this.channelCtor.connect({handleRequest:(e,t,n)=>this.handleRequest(e,t,n),handleNotification:(e,t)=>this.handleNotification(e,t)}),this.listeningDeferred.resolve()}checkChannel(e){if(!e)throw new Error(`"${this.startListen.name}" must be called before any messages can be sent or received.`);return!0}async handleRequest(e,t,n){const s=this._handler.get(e.method);if(!s)return this._logger&&this._logger.debug({text:`No request handler for "${e.method}".`,data:{requestObject:e}}),{error:{code:fg.methodNotFound,message:`No request handler for "${e.method}".`,data:{method:e.method}}};if(s.kind!="request"){const r=`"${e.method}" is registered as notification, but was sent as request.`;return this._logger&&this._logger.debug({text:r,data:{requestObject:e}}),{error:{code:fg.invalidRequest,message:r,data:{method:e.method}}}}const o=s.requestType.paramsSerializer.deserializeFromJson(e.params);if(o.hasErrors){const r=`Got invalid params: ${o.errorMessage}`;return this._logger&&this._logger.debug({text:r,data:{requestObject:e,errorMessage:o.errorMessage}}),{error:{code:fg.invalidParams,message:r,data:{errors:o.errorMessage}}}}else{const r=o.value;let a;try{const l=await s.handler(r,t,n);if("error"in l||"errorMessage"in l){const c=l.error?s.requestType.errorSerializer.serializeToJson(l.error):void 0;a={error:{code:l.errorCode||fg.genericApplicationError,message:l.errorMessage||"An error was returned",data:c}}}else a={result:s.requestType.resultSerializer.serializeToJson(l.ok)}}catch(l){l instanceof yxe?a={error:{code:l.code,message:l.message}}:(this._logger&&this._logger.warn({text:`An exception was thrown while handling a request: ${l}.`,exception:l,data:{requestObject:e}}),a={error:{code:fg.unexpectedServerError,message:this.sendExceptionDetails?`An exception was thrown while handling a request: ${l}.`:"Server has thrown an unexpected exception"}})}return a}}async handleNotification(e,t){const n=this._handler.get(e.method);if(!n){for(const r of this._unknownNotificationHandler)r(e);this._unknownNotificationHandler.size===0&&this._logger&&this._logger.debug({text:`Unhandled notification "${e.method}"`,data:{requestObject:e}});return}if(n.kind!="notification"){this._logger&&this._logger.debug({text:`"${e.method}" is registered as request, but was sent as notification.`,data:{requestObject:e}});return}const s=n.notificationType.paramsSerializer.deserializeFromJson(e.params);if(s.hasErrors){this._logger&&this._logger.debug({text:`Got invalid params: ${s}`,data:{requestObject:e,errorMessage:s.errorMessage}});return}const o=s.value;for(const r of n.handlers)try{r(o,t)}catch(a){this._logger&&this._logger.warn({text:`An exception was thrown while handling a notification: ${a}.`,exception:a,data:{requestObject:e}})}}registerUnknownNotificationHandler(e){return bq(this._unknownNotificationHandler,e)}registerRequestHandler(e,t){if(this._handler.get(e.method))throw new Error(`Handler with method "${e.method}" already registered.`);return bq(this._handler,e.method,{kind:"request",requestType:e,handler:t})}registerNotificationHandler(e,t){let n=this._handler.get(e.method);if(!n)n={kind:"notification",notificationType:e,handlers:new Set},this._handler.set(e.method,n);else{if(n.kind!=="notification")throw new Error(`Method "${e.method}" was already registered as request handler.`);if(n.notificationType!==e)throw new Error(`Method "${e.method}" was registered for a different type.`)}return bq(n.handlers,t)}getRegisteredTypes(){const e=[];for(const t of this._handler.values())t.kind==="notification"?e.push(t.notificationType):t.kind==="request"&&e.push(t.requestType);return e}async request(e,t,n){if(!this.checkChannel(this._requestSender))throw new Error("Impossible");const s=e.paramsSerializer.serializeToJson(t);vxe(s);const o=await this._requestSender.sendRequest({method:e.method,params:s},n);if("error"in o){if(e.isOptional&&o.error.code===fg.methodNotFound)return j9e;let r;if(o.error.data!==void 0){const l=e.errorSerializer.deserializeFromJson(o.error.data);if(l.hasErrors)throw new Error(l.errorMessage);r=l.value}else r=void 0;const a=new yxe(o.error.message,r,o.error.code);throw this._requestDidErrorEventEmitter.fire({error:a}),a}else{const r=e.resultSerializer.deserializeFromJson(o.result);if(r.hasErrors)throw new Error("Could not deserialize response: "+r.errorMessage+`
1302
+ hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")o.push({token:a.token+t.tokenPostfix,open:nb(t,a.open),close:nb(t,a.close)});else throw gs(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=o,t.noThrow=!0,t}function xhn(i){sk.registerLanguage(i)}function Nhn(){let i=[];return i=i.concat(sk.getLanguages()),i}function Ihn(i){return en.get(uo).languageIdCodec.encodeLanguageId(i)}function khn(i,e){return en.withServices(()=>{const n=en.get(uo).onDidRequestRichLanguageFeatures(s=>{s===i&&(n.dispose(),e())});return n})}function Lhn(i,e){return en.withServices(()=>{const n=en.get(uo).onDidRequestBasicLanguageFeatures(s=>{s===i&&(n.dispose(),e())});return n})}function Dhn(i,e){if(!en.get(uo).isRegisteredLanguageId(i))throw new Error(`Cannot set configuration for unknown language ${i}`);return en.get(Fs).register(i,e,100)}class Thn{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,n){if(typeof this._actual.tokenize=="function")return ZM.adaptTokenize(this._languageId,this._actual,e,n);throw new Error("Not supported!")}tokenizeEncoded(e,t,n){const s=this._actual.tokenizeEncoded(e,n);return new hH(s.tokens,s.endState)}}class ZM{constructor(e,t,n,s){this._languageId=e,this._actual=t,this._languageService=n,this._standaloneThemeService=s}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const n=[];let s=0;for(let o=0,r=e.length;o<r;o++){const a=e[o];let l=a.startIndex;o===0?l=0:l<s&&(l=s),n[o]=new UR(l,a.scopes,t),s=l}return n}static adaptTokenize(e,t,n,s){const o=t.tokenize(n,s),r=ZM._toClassicTokens(o.tokens,e);let a;return o.endState.equals(s)?a=s:a=o.endState,new uae(r,a)}tokenize(e,t,n){return ZM.adaptTokenize(this._languageId,this._actual,e,n)}_toBinaryTokens(e,t){const n=e.encodeLanguageId(this._languageId),s=this._standaloneThemeService.getColorTheme().tokenTheme,o=[];let r=0,a=0;for(let c=0,d=t.length;c<d;c++){const h=t[c],g=s.match(n,h.scopes)|1024;if(r>0&&o[r-1]===g)continue;let m=h.startIndex;c===0?m=0:m<a&&(m=a),o[r++]=m,o[r++]=g,a=m}const l=new Uint32Array(r);for(let c=0;c<r;c++)l[c]=o[c];return l}tokenizeEncoded(e,t,n){const s=this._actual.tokenize(e,n),o=this._toBinaryTokens(this._languageService.languageIdCodec,s.tokens);let r;return s.endState.equals(n)?r=n:r=s.endState,new hH(o,r)}}function Ehn(i){return typeof i.getInitialState=="function"}function Phn(i){return"tokenizeEncoded"in i}function h9e(i){return i&&typeof i.then=="function"}function Rhn(i){const e=en.get(Wu);if(i){const t=[null];for(let n=1,s=i.length;n<s;n++)t[n]=De.fromHex(i[n]);e.setColorMapOverride(t)}else e.setColorMapOverride(null)}function g9e(i,e){return Phn(e)?new Thn(i,e):new ZM(i,e,en.get(uo),en.get(Wu))}function kde(i,e){const t=new kWt(async()=>{const n=await Promise.resolve(e.create());return n?Ehn(n)?g9e(i,n):new GM(en.get(uo),en.get(Wu),i,u9e(i,n),en.get(ln)):null});return no.registerFactory(i,t)}function Mhn(i,e){if(!en.get(uo).isRegisteredLanguageId(i))throw new Error(`Cannot set tokens provider for unknown language ${i}`);return h9e(e)?kde(i,{create:()=>e}):no.register(i,g9e(i,e))}function Ahn(i,e){const t=n=>new GM(en.get(uo),en.get(Wu),i,u9e(i,n),en.get(ln));return h9e(e)?kde(i,{create:()=>e}):no.register(i,t(e))}function Ohn(i,e){return en.get(_t).referenceProvider.register(i,e)}function Fhn(i,e){return en.get(_t).renameProvider.register(i,e)}function Bhn(i,e){return en.get(_t).newSymbolNamesProvider.register(i,e)}function Vhn(i,e){return en.get(_t).signatureHelpProvider.register(i,e)}function zhn(i,e){return en.get(_t).hoverProvider.register(i,{provideHover:async(n,s,o,r)=>{const a=n.getWordAtPosition(s);return Promise.resolve(e.provideHover(n,s,o,r)).then(l=>{if(l)return!l.range&&a&&(l.range=new j(s.lineNumber,a.startColumn,s.lineNumber,a.endColumn)),l.range||(l.range=new j(s.lineNumber,s.column,s.lineNumber,s.column)),l})}})}function Whn(i,e){return en.get(_t).documentSymbolProvider.register(i,e)}function Hhn(i,e){return en.get(_t).documentHighlightProvider.register(i,e)}function $hn(i,e){return en.get(_t).linkedEditingRangeProvider.register(i,e)}function Uhn(i,e){return en.get(_t).definitionProvider.register(i,e)}function jhn(i,e){return en.get(_t).implementationProvider.register(i,e)}function Ghn(i,e){return en.get(_t).typeDefinitionProvider.register(i,e)}function qhn(i,e){return en.get(_t).codeLensProvider.register(i,e)}function Khn(i,e,t){return en.get(_t).codeActionProvider.register(i,{providedCodeActionKinds:t?.providedCodeActionKinds,documentation:t?.documentation,provideCodeActions:(s,o,r,a)=>{const c=en.get(Tp).read({resource:s.uri}).filter(d=>j.areIntersectingOrTouching(d,o));return e.provideCodeActions(s,o,{markers:c,only:r.only,trigger:r.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function Jhn(i,e){return en.get(_t).documentFormattingEditProvider.register(i,e)}function Yhn(i,e){return en.get(_t).documentRangeFormattingEditProvider.register(i,e)}function Xhn(i,e){return en.get(_t).onTypeFormattingEditProvider.register(i,e)}function Qhn(i,e){return en.get(_t).linkProvider.register(i,e)}function Zhn(i,e){return en.get(_t).completionProvider.register(i,e)}function egn(i,e){return en.get(_t).colorProvider.register(i,e)}function tgn(i,e){return en.get(_t).foldingRangeProvider.register(i,e)}function ngn(i,e){return en.get(_t).declarationProvider.register(i,e)}function ign(i,e){return en.get(_t).selectionRangeProvider.register(i,e)}function sgn(i,e){return en.get(_t).documentSemanticTokensProvider.register(i,e)}function ogn(i,e){return en.get(_t).documentRangeSemanticTokensProvider.register(i,e)}function rgn(i,e){return en.get(_t).inlineCompletionsProvider.register(i,e)}function agn(i,e){return en.get(_t).inlayHintsProvider.register(i,e)}function lgn(){return{register:xhn,getLanguages:Nhn,onLanguage:khn,onLanguageEncountered:Lhn,getEncodedLanguageId:Ihn,setLanguageConfiguration:Dhn,setColorMap:Rhn,registerTokensProviderFactory:kde,setTokensProvider:Mhn,setMonarchTokensProvider:Ahn,registerReferenceProvider:Ohn,registerRenameProvider:Fhn,registerNewSymbolNameProvider:Bhn,registerCompletionItemProvider:Zhn,registerSignatureHelpProvider:Vhn,registerHoverProvider:zhn,registerDocumentSymbolProvider:Whn,registerDocumentHighlightProvider:Hhn,registerLinkedEditingRangeProvider:$hn,registerDefinitionProvider:Uhn,registerImplementationProvider:jhn,registerTypeDefinitionProvider:Ghn,registerCodeLensProvider:qhn,registerCodeActionProvider:Khn,registerDocumentFormattingEditProvider:Jhn,registerDocumentRangeFormattingEditProvider:Yhn,registerOnTypeFormattingEditProvider:Xhn,registerLinkProvider:Qhn,registerColorProvider:egn,registerFoldingRangeProvider:tgn,registerDeclarationProvider:ngn,registerSelectionRangeProvider:ign,registerDocumentSemanticTokensProvider:sgn,registerDocumentRangeSemanticTokensProvider:ogn,registerInlineCompletionsProvider:rgn,registerInlayHintsProvider:agn,DocumentHighlightKind:cte,CompletionItemKind:ite,CompletionItemTag:ste,CompletionItemInsertTextRule:nte,SymbolKind:Wte,SymbolTag:Hte,IndentAction:pte,CompletionTriggerKind:ote,SignatureHelpTriggerKind:zte,InlayHintKind:bte,InlineCompletionTriggerKind:wte,CodeActionTriggerType:tte,NewSymbolNameTag:Lte,NewSymbolNameTriggerKind:Dte,PartialAcceptTriggerKind:Pte,HoverVerbosityAction:fte,InlineCompletionEndOfLifeReasonKind:vte,InlineCompletionHintStyle:yte,FoldingRangeKind:tS,SelectedSuggestionInfo:z5e,EditDeltaInfo:nM}}$l.wrappingIndent.defaultValue=0;$l.glyphMargin.defaultValue=!1;$l.autoIndent.defaultValue=3;$l.overviewRulerLanes.defaultValue=2;Dk.setFormatterSelector((i,e,t)=>Promise.resolve(i[0]));const Dc=zWe();Dc.editor=bhn();Dc.languages=lgn();const m9e=Dc.CancellationTokenSource,sw=Dc.Emitter,f9e=Dc.KeyCode,p9e=Dc.KeyMod,Vb=Dc.Position,FL=Dc.Range,_9e=Dc.Selection,b9e=Dc.SelectionDirection,yg=Dc.MarkerSeverity,QW=Dc.MarkerTag,x7=Dc.Uri,v9e=Dc.Token,rp=Dc.editor,pt=Dc.languages,cgn=qoe(),DI=globalThis;(cgn?.globalAPI||typeof DI.define=="function"&&DI.define.amd)&&(DI.monaco=Dc);typeof DI.require<"u"&&typeof DI.require.config=="function"&&DI.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]});const dgn=Object.freeze(Object.defineProperty({__proto__:null,CancellationTokenSource:m9e,Emitter:sw,KeyCode:f9e,KeyMod:p9e,MarkerSeverity:yg,MarkerTag:QW,Position:Vb,Range:FL,Selection:_9e,SelectionDirection:b9e,Token:v9e,Uri:x7,editor:rp,languages:pt},Symbol.toStringTag,{value:"Module"}));let Lde=class{constructor(e,t,n){this._onDidChange=new sw,this._languageId=e,this.setOptions(t),this.setModeConfiguration(n)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(e){this.setOptions(e)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const Dde={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},Tde={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},y9e=new Lde("css",Dde,Tde),w9e=new Lde("scss",Dde,Tde),C9e=new Lde("less",Dde,Tde);function Ede(){return Nt(()=>import("./cssMode.z2-NHYcV.js"),__vite__mapDeps([9,10]))}pt.onLanguage("less",()=>{Ede().then(i=>i.setupMode(C9e))});pt.onLanguage("scss",()=>{Ede().then(i=>i.setupMode(w9e))});pt.onLanguage("css",()=>{Ede().then(i=>i.setupMode(y9e))});const S9e=Object.freeze(Object.defineProperty({__proto__:null,cssDefaults:y9e,lessDefaults:C9e,scssDefaults:w9e},Symbol.toStringTag,{value:"Module"}));let ugn=class{constructor(e,t,n){this._onDidChange=new sw,this._languageId=e,this.setOptions(t),this.setModeConfiguration(n)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(e){this._options=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const hgn={tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},N7={format:hgn,suggest:{},data:{useDefaultDataProvider:!0}};function I7(i){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:i===$P,documentFormattingEdits:i===$P,documentRangeFormattingEdits:i===$P}}const $P="html",fxe="handlebars",pxe="razor",x9e=k7($P,N7,I7($P)),ggn=x9e.defaults,N9e=k7(fxe,N7,I7(fxe)),mgn=N9e.defaults,I9e=k7(pxe,N7,I7(pxe)),fgn=I9e.defaults;function pgn(){return Nt(()=>import("./htmlMode.DPTRrtXh.js"),__vite__mapDeps([11,10]))}function k7(i,e=N7,t=I7(i)){const n=new ugn(i,e,t);let s;const o=pt.onLanguage(i,async()=>{s=(await pgn()).setupMode(n)});return{defaults:n,dispose(){o.dispose(),s?.dispose(),s=void 0}}}const k9e=Object.freeze(Object.defineProperty({__proto__:null,handlebarDefaults:mgn,handlebarLanguageService:N9e,htmlDefaults:ggn,htmlLanguageService:x9e,razorDefaults:fgn,razorLanguageService:I9e,registerHTMLLanguageService:k7},Symbol.toStringTag,{value:"Module"}));let _gn=class{constructor(e,t,n){this._onDidChange=new sw,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(n)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}};const bgn={validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},vgn={documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0},L9e=new _gn("json",bgn,vgn),ygn=()=>D9e().then(i=>i.getWorker());function D9e(){return Nt(()=>import("./jsonMode.D1_Izqyt.js"),__vite__mapDeps([12,10]))}pt.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});pt.onLanguage("json",()=>{D9e().then(i=>i.setupMode(L9e))});const T9e=Object.freeze(Object.defineProperty({__proto__:null,getWorker:ygn,jsonDefaults:L9e},Symbol.toStringTag,{value:"Module"})),wgn="5.9.3";var E9e=(i=>(i[i.None=0]="None",i[i.CommonJS=1]="CommonJS",i[i.AMD=2]="AMD",i[i.UMD=3]="UMD",i[i.System=4]="System",i[i.ES2015=5]="ES2015",i[i.ESNext=99]="ESNext",i))(E9e||{}),P9e=(i=>(i[i.None=0]="None",i[i.Preserve=1]="Preserve",i[i.React=2]="React",i[i.ReactNative=3]="ReactNative",i[i.ReactJSX=4]="ReactJSX",i[i.ReactJSXDev=5]="ReactJSXDev",i))(P9e||{}),R9e=(i=>(i[i.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",i[i.LineFeed=1]="LineFeed",i))(R9e||{}),M9e=(i=>(i[i.ES3=0]="ES3",i[i.ES5=1]="ES5",i[i.ES2015=2]="ES2015",i[i.ES2016=3]="ES2016",i[i.ES2017=4]="ES2017",i[i.ES2018=5]="ES2018",i[i.ES2019=6]="ES2019",i[i.ES2020=7]="ES2020",i[i.ESNext=99]="ESNext",i[i.JSON=100]="JSON",i[i.Latest=99]="Latest",i))(M9e||{}),A9e=(i=>(i[i.Classic=1]="Classic",i[i.NodeJs=2]="NodeJs",i))(A9e||{});class O9e{constructor(e,t,n,s,o){this._onDidChange=new sw,this._onDidExtraLibsChange=new sw,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(e),this.setDiagnosticsOptions(t),this.setWorkerOptions(n),this.setInlayHintsOptions(s),this.setModeConfiguration(o),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(e,t){let n;if(typeof t>"u"?n=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:n=t,this._extraLibs[n]&&this._extraLibs[n].content===e)return{dispose:()=>{}};let s=1;return this._removedExtraLibs[n]&&(s=this._removedExtraLibs[n]+1),this._extraLibs[n]&&(s=this._extraLibs[n].version+1),this._extraLibs[n]={content:e,version:s},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let o=this._extraLibs[n];o&&o.version===s&&(delete this._extraLibs[n],this._removedExtraLibs[n]=s,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(e){for(const t in this._extraLibs)this._removedExtraLibs[t]=this._extraLibs[t].version;if(this._extraLibs=Object.create(null),e&&e.length>0)for(const t of e){const n=t.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,s=t.content;let o=1;this._removedExtraLibs[n]&&(o=this._removedExtraLibs[n]+1),this._extraLibs[n]={content:s,version:o}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(e){this._compilerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(e){this._workerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(e){this._inlayHintsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(e){}setEagerModelSync(e){this._eagerModelSync=e}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(void 0)}}const Cgn=wgn,F9e={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},B9e=new O9e({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},F9e),V9e=new O9e({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},F9e),Sgn=()=>L7().then(i=>i.getTypeScriptWorker()),xgn=()=>L7().then(i=>i.getJavaScriptWorker());function L7(){return Nt(()=>import("./tsMode.BniqA017.js"),[])}pt.onLanguage("typescript",()=>L7().then(i=>i.setupTypeScript(B9e)));pt.onLanguage("javascript",()=>L7().then(i=>i.setupJavaScript(V9e)));const z9e=Object.freeze(Object.defineProperty({__proto__:null,JsxEmit:P9e,ModuleKind:E9e,ModuleResolutionKind:A9e,NewLineKind:R9e,ScriptTarget:M9e,getJavaScriptWorker:xgn,getTypeScriptWorker:Sgn,javascriptDefaults:V9e,typescriptDefaults:B9e,typescriptVersion:Cgn},Symbol.toStringTag,{value:"Module"})),W9e={},pq={};class Pde{static getOrCreate(e){return pq[e]||(pq[e]=new Pde(e)),pq[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((t,n)=>{this._lazyLoadPromiseResolve=t,this._lazyLoadPromiseReject=n})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,W9e[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}}function Vt(i){const e=i.id;W9e[e]=i,pt.register(i);const t=Pde.getOrCreate(e);pt.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),pt.onLanguageEncountered(e,async()=>{const n=await t.load();pt.setLanguageConfiguration(e,n.conf)})}Vt({id:"abap",extensions:[".abap"],aliases:["abap","ABAP"],loader:()=>Nt(()=>import("./abap.DLDM7-KI.js"),[])});Vt({id:"apex",extensions:[".cls"],aliases:["Apex","apex"],mimetypes:["text/x-apex-source","text/x-apex"],loader:()=>Nt(()=>import("./apex.DNDY2TF8.js"),[])});Vt({id:"azcli",extensions:[".azcli"],aliases:["Azure CLI","azcli"],loader:()=>Nt(()=>import("./azcli.Y6nb8tq_.js"),[])});Vt({id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],loader:()=>Nt(()=>import("./bat.BwHxbl9M.js"),[])});Vt({id:"bicep",extensions:[".bicep"],aliases:["Bicep"],loader:()=>Nt(()=>import("./bicep.CFznDFnq.js"),[])});Vt({id:"cameligo",extensions:[".mligo"],aliases:["Cameligo"],loader:()=>Nt(()=>import("./cameligo.Bf6VGUru.js"),[])});Vt({id:"clojure",extensions:[".clj",".cljs",".cljc",".edn"],aliases:["clojure","Clojure"],loader:()=>Nt(()=>import("./clojure.Dnu-v4kV.js"),[])});Vt({id:"coffeescript",extensions:[".coffee"],aliases:["CoffeeScript","coffeescript","coffee"],mimetypes:["text/x-coffeescript","text/coffeescript"],loader:()=>Nt(()=>import("./coffee.Bd8akH9Z.js"),[])});Vt({id:"c",extensions:[".c",".h"],aliases:["C","c"],loader:()=>Nt(()=>import("./cpp.BbWJElDN.js"),[])});Vt({id:"cpp",extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],aliases:["C++","Cpp","cpp"],loader:()=>Nt(()=>import("./cpp.BbWJElDN.js"),[])});Vt({id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],loader:()=>Nt(()=>import("./csharp.Co3qMtFm.js"),[])});Vt({id:"csp",extensions:[".csp"],aliases:["CSP","csp"],loader:()=>Nt(()=>import("./csp.D-4FJmMZ.js"),[])});Vt({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>Nt(()=>import("./css.DdJfP1eB.js"),[])});Vt({id:"cypher",extensions:[".cypher",".cyp"],aliases:["Cypher","OpenCypher"],loader:()=>Nt(()=>import("./cypher.cTPe9QuQ.js"),[])});Vt({id:"dart",extensions:[".dart"],aliases:["Dart","dart"],mimetypes:["text/x-dart-source","text/x-dart"],loader:()=>Nt(()=>import("./dart.BOtBlQCF.js"),[])});Vt({id:"dockerfile",extensions:[".dockerfile"],filenames:["Dockerfile"],aliases:["Dockerfile"],loader:()=>Nt(()=>import("./dockerfile.BG73LgW2.js"),[])});Vt({id:"ecl",extensions:[".ecl"],aliases:["ECL","Ecl","ecl"],loader:()=>Nt(()=>import("./ecl.BEgZUVRK.js"),[])});Vt({id:"elixir",extensions:[".ex",".exs"],aliases:["Elixir","elixir","ex"],loader:()=>Nt(()=>import("./elixir.BkW5O-1t.js"),[])});Vt({id:"flow9",extensions:[".flow"],aliases:["Flow9","Flow","flow9","flow"],loader:()=>Nt(()=>import("./flow9.BeJ5waoc.js"),[])});Vt({id:"fsharp",extensions:[".fs",".fsi",".ml",".mli",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],loader:()=>Nt(()=>import("./fsharp.PahG7c26.js"),[])});Vt({id:"freemarker2",extensions:[".ftl",".ftlh",".ftlx"],aliases:["FreeMarker2","Apache FreeMarker2"],loader:()=>Nt(()=>import("./freemarker2.Bt8q4fBg.js"),[]).then(i=>i.TagAutoInterpolationDollar)});Vt({id:"freemarker2.tag-angle.interpolation-dollar",aliases:["FreeMarker2 (Angle/Dollar)","Apache FreeMarker2 (Angle/Dollar)"],loader:()=>Nt(()=>import("./freemarker2.Bt8q4fBg.js"),[]).then(i=>i.TagAngleInterpolationDollar)});Vt({id:"freemarker2.tag-bracket.interpolation-dollar",aliases:["FreeMarker2 (Bracket/Dollar)","Apache FreeMarker2 (Bracket/Dollar)"],loader:()=>Nt(()=>import("./freemarker2.Bt8q4fBg.js"),[]).then(i=>i.TagBracketInterpolationDollar)});Vt({id:"freemarker2.tag-angle.interpolation-bracket",aliases:["FreeMarker2 (Angle/Bracket)","Apache FreeMarker2 (Angle/Bracket)"],loader:()=>Nt(()=>import("./freemarker2.Bt8q4fBg.js"),[]).then(i=>i.TagAngleInterpolationBracket)});Vt({id:"freemarker2.tag-bracket.interpolation-bracket",aliases:["FreeMarker2 (Bracket/Bracket)","Apache FreeMarker2 (Bracket/Bracket)"],loader:()=>Nt(()=>import("./freemarker2.Bt8q4fBg.js"),[]).then(i=>i.TagBracketInterpolationBracket)});Vt({id:"freemarker2.tag-auto.interpolation-dollar",aliases:["FreeMarker2 (Auto/Dollar)","Apache FreeMarker2 (Auto/Dollar)"],loader:()=>Nt(()=>import("./freemarker2.Bt8q4fBg.js"),[]).then(i=>i.TagAutoInterpolationDollar)});Vt({id:"freemarker2.tag-auto.interpolation-bracket",aliases:["FreeMarker2 (Auto/Bracket)","Apache FreeMarker2 (Auto/Bracket)"],loader:()=>Nt(()=>import("./freemarker2.Bt8q4fBg.js"),[]).then(i=>i.TagAutoInterpolationBracket)});Vt({id:"go",extensions:[".go"],aliases:["Go"],loader:()=>Nt(()=>import("./go.acbASCJo.js"),[])});Vt({id:"graphql",extensions:[".graphql",".gql"],aliases:["GraphQL","graphql","gql"],mimetypes:["application/graphql"],loader:()=>Nt(()=>import("./graphql.BxJiqAUM.js"),[])});Vt({id:"handlebars",extensions:[".handlebars",".hbs"],aliases:["Handlebars","handlebars","hbs"],mimetypes:["text/x-handlebars-template"],loader:()=>Nt(()=>import("./handlebars.BoqVl5GV.js"),[])});Vt({id:"hcl",extensions:[".tf",".tfvars",".hcl"],aliases:["Terraform","tf","HCL","hcl"],loader:()=>Nt(()=>import("./hcl.DtV1sZF8.js"),[])});Vt({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>Nt(()=>import("./html.8ZwYdhzS.js"),[])});Vt({id:"ini",extensions:[".ini",".properties",".gitconfig"],filenames:["config",".gitattributes",".gitconfig",".editorconfig"],aliases:["Ini","ini"],loader:()=>Nt(()=>import("./ini.Kd9XrMLS.js"),[])});Vt({id:"java",extensions:[".java",".jav"],aliases:["Java","java"],mimetypes:["text/x-java-source","text/x-java"],loader:()=>Nt(()=>import("./java.CXBNlu9o.js"),[])});Vt({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>Nt(()=>import("./javascript.CIU7xZo3.js"),__vite__mapDeps([13,14]))});Vt({id:"julia",extensions:[".jl"],aliases:["julia","Julia"],loader:()=>Nt(()=>import("./julia.cl7-CwDS.js"),[])});Vt({id:"kotlin",extensions:[".kt",".kts"],aliases:["Kotlin","kotlin"],mimetypes:["text/x-kotlin-source","text/x-kotlin"],loader:()=>Nt(()=>import("./kotlin.s7OhZKlX.js"),[])});Vt({id:"less",extensions:[".less"],aliases:["Less","less"],mimetypes:["text/x-less","text/less"],loader:()=>Nt(()=>import("./less.9HpZscsL.js"),[])});Vt({id:"lexon",extensions:[".lex"],aliases:["Lexon"],loader:()=>Nt(()=>import("./lexon.OrD6JF1K.js"),[])});Vt({id:"lua",extensions:[".lua"],aliases:["Lua","lua"],loader:()=>Nt(()=>import("./lua.Cyyb5UIc.js"),[])});Vt({id:"liquid",extensions:[".liquid",".html.liquid"],aliases:["Liquid","liquid"],mimetypes:["application/liquid"],loader:()=>Nt(()=>import("./liquid.DCMgNe71.js"),[])});Vt({id:"m3",extensions:[".m3",".i3",".mg",".ig"],aliases:["Modula-3","Modula3","modula3","m3"],loader:()=>Nt(()=>import("./m3.B8OfTtLu.js"),[])});Vt({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>Nt(()=>import("./markdown.BFxVWTOG.js"),[])});Vt({id:"mdx",extensions:[".mdx"],aliases:["MDX","mdx"],loader:()=>Nt(()=>import("./mdx.8gVroNDk.js"),[])});Vt({id:"mips",extensions:[".s"],aliases:["MIPS","MIPS-V"],mimetypes:["text/x-mips","text/mips","text/plaintext"],loader:()=>Nt(()=>import("./mips.CiqrrVzr.js"),[])});Vt({id:"msdax",extensions:[".dax",".msdax"],aliases:["DAX","MSDAX"],loader:()=>Nt(()=>import("./msdax.DmeGPVcC.js"),[])});Vt({id:"mysql",extensions:[],aliases:["MySQL","mysql"],loader:()=>Nt(()=>import("./mysql.C_tMU-Nz.js"),[])});Vt({id:"objective-c",extensions:[".m"],aliases:["Objective-C"],loader:()=>Nt(()=>import("./objective-c.BDtDVThU.js"),[])});Vt({id:"pascal",extensions:[".pas",".p",".pp"],aliases:["Pascal","pas"],mimetypes:["text/x-pascal-source","text/x-pascal"],loader:()=>Nt(()=>import("./pascal.vHIfCaH5.js"),[])});Vt({id:"pascaligo",extensions:[".ligo"],aliases:["Pascaligo","ligo"],loader:()=>Nt(()=>import("./pascaligo.DtZ0uQbO.js"),[])});Vt({id:"perl",extensions:[".pl",".pm"],aliases:["Perl","pl"],loader:()=>Nt(()=>import("./perl.Ub6l9XKa.js"),[])});Vt({id:"pgsql",extensions:[],aliases:["PostgreSQL","postgres","pg","postgre"],loader:()=>Nt(()=>import("./pgsql.BlNEE0v7.js"),[])});Vt({id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],mimetypes:["application/x-php"],loader:()=>Nt(()=>import("./php.BBUBE1dy.js"),[])});Vt({id:"pla",extensions:[".pla"],loader:()=>Nt(()=>import("./pla.DSh2-awV.js"),[])});Vt({id:"postiats",extensions:[".dats",".sats",".hats"],aliases:["ATS","ATS/Postiats"],loader:()=>Nt(()=>import("./postiats.CocnycG-.js"),[])});Vt({id:"powerquery",extensions:[".pq",".pqm"],aliases:["PQ","M","Power Query","Power Query M"],loader:()=>Nt(()=>import("./powerquery.tScXyioY.js"),[])});Vt({id:"powershell",extensions:[".ps1",".psm1",".psd1"],aliases:["PowerShell","powershell","ps","ps1"],loader:()=>Nt(()=>import("./powershell.COWaemsV.js"),[])});Vt({id:"proto",extensions:[".proto"],aliases:["protobuf","Protocol Buffers"],loader:()=>Nt(()=>import("./protobuf.Brw8urJB.js"),[])});Vt({id:"pug",extensions:[".jade",".pug"],aliases:["Pug","Jade","jade"],loader:()=>Nt(()=>import("./pug.8SOpv6rk.js"),[])});Vt({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>Nt(()=>import("./python.RKnDkd3D.js"),[])});Vt({id:"qsharp",extensions:[".qs"],aliases:["Q#","qsharp"],loader:()=>Nt(()=>import("./qsharp.Bw9ernYp.js"),[])});Vt({id:"r",extensions:[".r",".rhistory",".rmd",".rprofile",".rt"],aliases:["R","r"],loader:()=>Nt(()=>import("./r.j7ic8hl3.js"),[])});Vt({id:"razor",extensions:[".cshtml"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],loader:()=>Nt(()=>import("./razor.uyZvm_ly.js"),[])});Vt({id:"redis",extensions:[".redis"],aliases:["redis"],loader:()=>Nt(()=>import("./redis.Bu5POkcn.js"),[])});Vt({id:"redshift",extensions:[],aliases:["Redshift","redshift"],loader:()=>Nt(()=>import("./redshift.Bs9aos_-.js"),[])});Vt({id:"restructuredtext",extensions:[".rst"],aliases:["reStructuredText","restructuredtext"],loader:()=>Nt(()=>import("./restructuredtext.CqXO7rUv.js"),[])});Vt({id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".pp"],filenames:["rakefile","Gemfile"],aliases:["Ruby","rb"],loader:()=>Nt(()=>import("./ruby.zBfavPgS.js"),[])});Vt({id:"rust",extensions:[".rs",".rlib"],aliases:["Rust","rust"],loader:()=>Nt(()=>import("./rust.BzKRNQWT.js"),[])});Vt({id:"sb",extensions:[".sb"],aliases:["Small Basic","sb"],loader:()=>Nt(()=>import("./sb.BBc9UKZt.js"),[])});Vt({id:"scala",extensions:[".scala",".sc",".sbt"],aliases:["Scala","scala","SBT","Sbt","sbt","Dotty","dotty"],mimetypes:["text/x-scala-source","text/x-scala","text/x-sbt","text/x-dotty"],loader:()=>Nt(()=>import("./scala.D9hQfWCl.js"),[])});Vt({id:"scheme",extensions:[".scm",".ss",".sch",".rkt"],aliases:["scheme","Scheme"],loader:()=>Nt(()=>import("./scheme.BPhDTwHR.js"),[])});Vt({id:"scss",extensions:[".scss"],aliases:["Sass","sass","scss"],mimetypes:["text/x-scss","text/scss"],loader:()=>Nt(()=>import("./scss.CBJaRo0y.js"),[])});Vt({id:"shell",extensions:[".sh",".bash"],aliases:["Shell","sh"],loader:()=>Nt(()=>import("./shell.DiJ1NA_G.js"),[])});Vt({id:"sol",extensions:[".sol"],aliases:["sol","solidity","Solidity"],loader:()=>Nt(()=>import("./solidity.Db0IVjzk.js"),[])});Vt({id:"aes",extensions:[".aes"],aliases:["aes","sophia","Sophia"],loader:()=>Nt(()=>import("./sophia.CnS9iZB_.js"),[])});Vt({id:"sparql",extensions:[".rq"],aliases:["sparql","SPARQL"],loader:()=>Nt(()=>import("./sparql.CJmd_6j2.js"),[])});Vt({id:"sql",extensions:[".sql"],aliases:["SQL"],loader:()=>Nt(()=>import("./sql.ClhHkBeG.js"),[])});Vt({id:"st",extensions:[".st",".iecst",".iecplc",".lc3lib",".TcPOU",".TcDUT",".TcGVL",".TcIO"],aliases:["StructuredText","scl","stl"],loader:()=>Nt(()=>import("./st.CHwy0fLd.js"),[])});Vt({id:"swift",aliases:["Swift","swift"],extensions:[".swift"],mimetypes:["text/swift"],loader:()=>Nt(()=>import("./swift.Bqt4WxQ4.js"),[])});Vt({id:"systemverilog",extensions:[".sv",".svh"],aliases:["SV","sv","SystemVerilog","systemverilog"],loader:()=>Nt(()=>import("./systemverilog.Bs9z6M-B.js"),[])});Vt({id:"verilog",extensions:[".v",".vh"],aliases:["V","v","Verilog","verilog"],loader:()=>Nt(()=>import("./systemverilog.Bs9z6M-B.js"),[])});Vt({id:"tcl",extensions:[".tcl"],aliases:["tcl","Tcl","tcltk","TclTk","tcl/tk","Tcl/Tk"],loader:()=>Nt(()=>import("./tcl.Dm6ycUr_.js"),[])});Vt({id:"twig",extensions:[".twig"],aliases:["Twig","twig"],mimetypes:["text/x-twig"],loader:()=>Nt(()=>import("./twig.Csy3S7wG.js"),[])});Vt({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>Nt(()=>import("./typescript.BZLvAXt-.js"),[])});Vt({id:"typespec",extensions:[".tsp"],aliases:["TypeSpec"],loader:()=>Nt(()=>import("./typespec.Btyra-wh.js"),[])});Vt({id:"vb",extensions:[".vb"],aliases:["Visual Basic","vb"],loader:()=>Nt(()=>import("./vb.Db0cS2oM.js"),[])});Vt({id:"wgsl",extensions:[".wgsl"],aliases:["WebGPU Shading Language","WGSL","wgsl"],loader:()=>Nt(()=>import("./wgsl.DumH7NcR.js"),[])});Vt({id:"xml",extensions:[".xml",".xsd",".dtd",".ascx",".csproj",".config",".props",".targets",".wxi",".wxl",".wxs",".xaml",".svg",".svgz",".opf",".xslt",".xsl"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],mimetypes:["text/xml","application/xml","application/xaml+xml","application/xml-dtd"],loader:()=>Nt(()=>import("./xml.IzNtcHww.js"),[])});Vt({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>Nt(()=>import("./yaml.PJSBTl4g.js"),[])});var Ngn=Object.defineProperty,Ign=(i,e,t)=>e in i?Ngn(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Rt=(i,e,t)=>Ign(i,typeof e!="symbol"?e+"":e,t),u3,_xe,h3,_q,g3;function kgn(i){return i.method!==void 0}var bxe;(function(i){function e(t){return t}i.create=e})(bxe||(bxe={}));var fg;(function(i){i.parseError=-32700,i.invalidRequest=-32600,i.methodNotFound=-32601,i.invalidParams=-32602,i.internalError=-32603;function e(o){return-32099<=o&&o<=-32e3}i.isServerError=e;function t(o){if(!e(o))throw new Error("Invalid range for a server error.");return o}i.serverError=t,i.unexpectedServerError=-32e3;function n(o){return!0}i.isApplicationError=n;function s(o){return o}i.applicationError=s,i.genericApplicationError=-320100})(fg||(fg={}));var Rde=class{constructor(){Rt(this,"listeners",new Set),Rt(this,"event",i=>(this.listeners.add(i),{dispose:()=>{this.listeners.delete(i)}}))}fire(i){this.listeners.forEach(e=>e(i))}},Lgn=class{constructor(i){Rt(this,"_value"),Rt(this,"eventEmitter"),this._value=i,this.eventEmitter=new Rde}get value(){return this._value}set value(i){this._value!==i&&(this._value=i,this.eventEmitter.fire(i))}get onChange(){return this.eventEmitter.event}};function Dgn(i,e){const t=setTimeout(e,i);return{dispose:()=>clearTimeout(t)}}function bq(i,e,t){return i instanceof Set?(i.add(e),{dispose:()=>i.delete(e)}):(i.set(e,t),{dispose:()=>i.delete(e)})}var Tgn=class{constructor(){Rt(this,"_state","none"),Rt(this,"promise"),Rt(this,"resolve",()=>{}),Rt(this,"reject",()=>{}),this.promise=new Promise((i,e)=>{this.resolve=i,this.reject=e})}get state(){return this._state}},H9e=(u3=class{constructor(){Rt(this,"_unprocessedMessages",[]),Rt(this,"_messageListener"),Rt(this,"id",u3.id++),Rt(this,"_state",new Lgn({state:"open"})),Rt(this,"state",this._state)}setListener(i){if(this._messageListener=i,!!i)for(;this._unprocessedMessages.length>0&&this._messageListener!==void 0;){const e=this._unprocessedMessages.shift();this._messageListener(e)}}send(i){return this._sendImpl(i)}_dispatchReceivedMessage(i){this._unprocessedMessages.length===0&&this._messageListener?this._messageListener(i):this._unprocessedMessages.push(i)}_onConnectionClosed(){this._state.value={state:"closed",error:void 0}}log(i){return new Egn(this,i??new Pgn)}},Rt(u3,"id",0),u3),Egn=class{constructor(i,e){Rt(this,"baseStream"),Rt(this,"logger"),this.baseStream=i,this.logger=e}get state(){return this.baseStream.state}setListener(i){if(i===void 0){this.baseStream.setListener(void 0);return}this.baseStream.setListener(e=>{this.logger.log(this.baseStream,"incoming",e),i(e)})}send(i){return this.logger.log(this.baseStream,"outgoing",i),this.baseStream.send(i)}toString(){return`StreamLogger/${this.baseStream.toString()}`}},Pgn=class{log(i,e,t){console.log(`${e==="incoming"?"<-":"->"} [${i.toString()}] ${JSON.stringify(t)}`)}},Rgn=class $9e{constructor(e){Rt(this,"connect"),this.connect=e}mapContext(e){return new $9e(t=>this.connect(t?Mgn(t,e):void 0))}};function Mgn(i,e){return{handleNotification:(t,n)=>i.handleNotification(t,e(n)),handleRequest:(t,n,s)=>i.handleRequest(t,n,e(s))}}var Agn=class U9e{constructor(e,t,n){Rt(this,"_stream"),Rt(this,"_listener"),Rt(this,"_logger"),Rt(this,"_unprocessedResponses",new Map),Rt(this,"_lastUsedRequestId",0),this._stream=e,this._listener=t,this._logger=n,this._stream.setListener(s=>{kgn(s)?s.id===void 0?this._processNotification(s):this._processRequest(s):this._processResponse(s)})}static createChannel(e,t){let n=!1;return new Rgn(s=>{if(n)throw new Error(`A channel to the stream ${e} was already constructed!`);return n=!0,new U9e(e,s,t)})}get state(){return this._stream.state}async _processNotification(e){if(e.id!==void 0)throw new Error;if(!this._listener){this._logger&&this._logger.debug({text:"Notification ignored",message:e});return}try{await this._listener.handleNotification({method:e.method,params:e.params||null})}catch(t){this._logger&&this._logger.warn({text:`Exception was thrown while handling notification: ${t}`,exception:t,message:e})}}async _processRequest(e){if(e.id===void 0)throw new Error;let t;if(this._listener)try{t=await this._listener.handleRequest({method:e.method,params:e.params||null},e.id)}catch(s){this._logger&&this._logger.warn({text:`Exception was thrown while handling request: ${s}`,message:e,exception:s}),t={error:{code:fg.internalError,message:"An unexpected exception was thrown.",data:void 0}}}else this._logger&&this._logger.debug({text:"Received request even though not listening for requests",message:e}),t={error:{code:fg.methodNotFound,message:"This endpoint does not listen for requests or notifications.",data:void 0}};let n;"result"in t?n={jsonrpc:"2.0",id:e.id,result:t.result}:n={jsonrpc:"2.0",id:e.id,error:t.error},await this._stream.send(n)}_processResponse(e){const t=""+e.id,n=this._unprocessedResponses.get(t);if(!n){this._logger&&this._logger.debug({text:"Got an unexpected response message",message:e});return}this._unprocessedResponses.delete(t),n(e)}_newRequestId(){return this._lastUsedRequestId++}sendRequest(e,t,n){const s={jsonrpc:"2.0",id:this._newRequestId(),method:e.method,params:e.params||void 0};return n&&n(s.id),new Promise((o,r)=>{const a=""+s.id;this._unprocessedResponses.set(a,l=>{"result"in l?o({result:l.result}):(l.error||r(new Error("Response had neither 'result' nor 'error' field set.")),o({error:l.error}))}),this._stream.send(s).then(void 0,l=>{this._unprocessedResponses.delete(a),r(l)})})}sendNotification(e,t){const n={jsonrpc:"2.0",id:void 0,method:e.method,params:e.params||void 0};return this._stream.send(n)}toString(){return"StreamChannel/"+this._stream.toString()}},TI;(function(i){function e(){return{deserializeFromJson:s=>({hasErrors:!1,value:s}),serializeToJson:s=>s}}i.sAny=e;function t(){return{deserializeFromJson:s=>({hasErrors:!1,value:{}}),serializeToJson:s=>({})}}i.sEmptyObject=t;function n(){return{deserializeFromJson:s=>({hasErrors:!1,value:void 0}),serializeToJson:s=>null}}i.sVoidFromNull=n})(TI||(TI={}));const j9e=Symbol("OptionalMethodNotFound");var G9e=class{contextualize(i){return new Ogn(this,i)}},Ogn=class extends G9e{constructor(i,e){super(),Rt(this,"underylingTypedChannel"),Rt(this,"converters"),this.underylingTypedChannel=i,this.converters=e}async request(i,e,t){const n=await this.converters.getSendContext(t);return this.underylingTypedChannel.request(i,e,n)}async notify(i,e,t){const n=await this.converters.getSendContext(t);return this.underylingTypedChannel.notify(i,e,n)}registerNotificationHandler(i,e){return this.underylingTypedChannel.registerNotificationHandler(i,async(t,n)=>await e(t,await this.converters.getNewContext(n)))}registerRequestHandler(i,e){return this.underylingTypedChannel.registerRequestHandler(i,async(t,n,s)=>await e(t,n,await this.converters.getNewContext(s)))}},qne=class q9e extends G9e{constructor(e,t={}){super(),Rt(this,"channelCtor"),Rt(this,"_requestSender"),Rt(this,"_handler",new Map),Rt(this,"_unknownNotificationHandler",new Set),Rt(this,"_timeout"),Rt(this,"sendExceptionDetails",!1),Rt(this,"_logger"),Rt(this,"listeningDeferred",new Tgn),Rt(this,"onListening",this.listeningDeferred.promise),Rt(this,"_requestDidErrorEventEmitter",new Rde),Rt(this,"onRequestDidError",this._requestDidErrorEventEmitter.event),this.channelCtor=e,this._logger=t.logger,this.sendExceptionDetails=!!t.sendExceptionDetails,this._timeout=Dgn(1e3,()=>{this._requestSender||console.warn(`"${this.startListen.name}" has not been called within 1 second after construction of this channel. Did you forget to call it?`,this)})}static fromTransport(e,t={}){return new q9e(Agn.createChannel(e,t.logger),t)}startListen(){if(this._requestSender)throw new Error(`"${this.startListen.name}" can be called only once, but it already has been called.`);this._timeout&&(this._timeout.dispose(),this._timeout=void 0),this._requestSender=this.channelCtor.connect({handleRequest:(e,t,n)=>this.handleRequest(e,t,n),handleNotification:(e,t)=>this.handleNotification(e,t)}),this.listeningDeferred.resolve()}checkChannel(e){if(!e)throw new Error(`"${this.startListen.name}" must be called before any messages can be sent or received.`);return!0}async handleRequest(e,t,n){const s=this._handler.get(e.method);if(!s)return this._logger&&this._logger.debug({text:`No request handler for "${e.method}".`,data:{requestObject:e}}),{error:{code:fg.methodNotFound,message:`No request handler for "${e.method}".`,data:{method:e.method}}};if(s.kind!="request"){const r=`"${e.method}" is registered as notification, but was sent as request.`;return this._logger&&this._logger.debug({text:r,data:{requestObject:e}}),{error:{code:fg.invalidRequest,message:r,data:{method:e.method}}}}const o=s.requestType.paramsSerializer.deserializeFromJson(e.params);if(o.hasErrors){const r=`Got invalid params: ${o.errorMessage}`;return this._logger&&this._logger.debug({text:r,data:{requestObject:e,errorMessage:o.errorMessage}}),{error:{code:fg.invalidParams,message:r,data:{errors:o.errorMessage}}}}else{const r=o.value;let a;try{const l=await s.handler(r,t,n);if("error"in l||"errorMessage"in l){const c=l.error?s.requestType.errorSerializer.serializeToJson(l.error):void 0;a={error:{code:l.errorCode||fg.genericApplicationError,message:l.errorMessage||"An error was returned",data:c}}}else a={result:s.requestType.resultSerializer.serializeToJson(l.ok)}}catch(l){l instanceof yxe?a={error:{code:l.code,message:l.message}}:(this._logger&&this._logger.warn({text:`An exception was thrown while handling a request: ${l}.`,exception:l,data:{requestObject:e}}),a={error:{code:fg.unexpectedServerError,message:this.sendExceptionDetails?`An exception was thrown while handling a request: ${l}.`:"Server has thrown an unexpected exception"}})}return a}}async handleNotification(e,t){const n=this._handler.get(e.method);if(!n){for(const r of this._unknownNotificationHandler)r(e);this._unknownNotificationHandler.size===0&&this._logger&&this._logger.debug({text:`Unhandled notification "${e.method}"`,data:{requestObject:e}});return}if(n.kind!="notification"){this._logger&&this._logger.debug({text:`"${e.method}" is registered as request, but was sent as notification.`,data:{requestObject:e}});return}const s=n.notificationType.paramsSerializer.deserializeFromJson(e.params);if(s.hasErrors){this._logger&&this._logger.debug({text:`Got invalid params: ${s}`,data:{requestObject:e,errorMessage:s.errorMessage}});return}const o=s.value;for(const r of n.handlers)try{r(o,t)}catch(a){this._logger&&this._logger.warn({text:`An exception was thrown while handling a notification: ${a}.`,exception:a,data:{requestObject:e}})}}registerUnknownNotificationHandler(e){return bq(this._unknownNotificationHandler,e)}registerRequestHandler(e,t){if(this._handler.get(e.method))throw new Error(`Handler with method "${e.method}" already registered.`);return bq(this._handler,e.method,{kind:"request",requestType:e,handler:t})}registerNotificationHandler(e,t){let n=this._handler.get(e.method);if(!n)n={kind:"notification",notificationType:e,handlers:new Set},this._handler.set(e.method,n);else{if(n.kind!=="notification")throw new Error(`Method "${e.method}" was already registered as request handler.`);if(n.notificationType!==e)throw new Error(`Method "${e.method}" was registered for a different type.`)}return bq(n.handlers,t)}getRegisteredTypes(){const e=[];for(const t of this._handler.values())t.kind==="notification"?e.push(t.notificationType):t.kind==="request"&&e.push(t.requestType);return e}async request(e,t,n){if(!this.checkChannel(this._requestSender))throw new Error("Impossible");const s=e.paramsSerializer.serializeToJson(t);vxe(s);const o=await this._requestSender.sendRequest({method:e.method,params:s},n);if("error"in o){if(e.isOptional&&o.error.code===fg.methodNotFound)return j9e;let r;if(o.error.data!==void 0){const l=e.errorSerializer.deserializeFromJson(o.error.data);if(l.hasErrors)throw new Error(l.errorMessage);r=l.value}else r=void 0;const a=new yxe(o.error.message,r,o.error.code);throw this._requestDidErrorEventEmitter.fire({error:a}),a}else{const r=e.resultSerializer.deserializeFromJson(o.result);if(r.hasErrors)throw new Error("Could not deserialize response: "+r.errorMessage+`
1303
1303
 
1304
1304
  ${JSON.stringify(o,null,2)}`);return r.value}}async notify(e,t,n){if(!this.checkChannel(this._requestSender))throw new Error;const s=e.paramsSerializer.serializeToJson(t);vxe(s),this._requestSender.sendNotification({method:e.method,params:s},n)}};function vxe(i){if(i!==null&&Array.isArray(i)&&typeof i!="object")throw new Error("Invalid value! Only null, array and object is allowed.")}var yxe=class K9e extends Error{constructor(e,t,n=fg.genericApplicationError){super(e),Rt(this,"data"),Rt(this,"code"),this.data=t,this.code=n,Object.setPrototypeOf(this,K9e.prototype)}},Fgn=class Kne{constructor(e,t,n,s,o=!1){Rt(this,"method"),Rt(this,"paramsSerializer"),Rt(this,"resultSerializer"),Rt(this,"errorSerializer"),Rt(this,"isOptional"),Rt(this,"kind","request"),this.method=e,this.paramsSerializer=t,this.resultSerializer=n,this.errorSerializer=s,this.isOptional=o}withMethod(e){return new Kne(e,this.paramsSerializer,this.resultSerializer,this.errorSerializer)}optional(){return new Kne(this.method,this.paramsSerializer,this.resultSerializer,this.errorSerializer,!0)}},Bgn=class J9e{constructor(e,t){Rt(this,"method"),Rt(this,"paramsSerializer"),Rt(this,"kind","notification"),this.method=e,this.paramsSerializer=t}withMethod(e){return new J9e(e,this.paramsSerializer)}};function mn(i){return new Fgn((i||{}).method,TI.sAny(),TI.sAny(),TI.sAny())}function So(i){return new Bgn((i||{}).method,TI.sAny())}const Vgn=Symbol();var wxe=(_xe=Vgn,h3=class{constructor(i){Rt(this,"error"),Rt(this,_xe),this.error=i}},Rt(h3,"factory",i=>new h3(i)),h3);function zgn(i){const e=Cxe(i.server),t=Cxe(i.client);return new Wgn(i.tags||[],e,t)}function Cxe(i){const e={};for(const[t,n]of Object.entries(i)){const s=n.method?n.method:t;e[t]=n.withMethod(s)}return e}var Wgn=class Y9e{constructor(e=[],t,n){Rt(this,"tags"),Rt(this,"server"),Rt(this,"client"),this.tags=e,this.server=t,this.client=n}_onlyDesignTime(){return new Error("This property is not meant to be accessed at runtime")}get TContractObject(){throw this._onlyDesignTime()}get TClientInterface(){throw this._onlyDesignTime()}get TServerInterface(){throw this._onlyDesignTime()}get TClientHandler(){throw this._onlyDesignTime()}get TServerHandler(){throw this._onlyDesignTime()}get TTags(){throw this._onlyDesignTime()}getInterface(e,t,n,s){const o=this.buildCounterpart(e,n),r=this.registerHandlers(e,t,s,o);return{counterpart:o,dispose:()=>r.dispose()}}buildCounterpart(e,t){const n={};for(const[s,o]of Object.entries(t)){let r;o.kind==="request"?o.isOptional?r=async(a,l)=>{a===void 0&&(a={});try{return await e.request(o,a,l)}catch(c){if(c&&c.code===fg.methodNotFound)return j9e;throw c}}:r=(a,l)=>(a===void 0&&(a={}),e.request(o,a,l)):r=(a,l)=>(a===void 0&&(a={}),e.notify(o,a,l)),n[s]=r}return n}registerHandlers(e,t,n,s){const o=[];for(const[r,a]of Object.entries(t))if(a.kind==="request"){let l=n[r];if(!l)continue;const c=this.createRequestHandler(s,l);o.push(e.registerRequestHandler(a,c))}else{const l=n[r];l&&o.push(e.registerNotificationHandler(a,(c,d)=>{l(c,{context:d,counterpart:s})}))}return{dispose:()=>o.forEach(r=>r.dispose())}}createRequestHandler(e,t){return async(n,s,o)=>{const r=await t(n,{context:o,counterpart:e,newErr:wxe.factory,requestId:s});return r instanceof wxe?r.error:{ok:r}}}static getServerFromStream(e,t,n,s){const o=qne.fromTransport(t,n),{server:r}=e.getServer(o,s);return o.startListen(),{channel:o,server:r}}static registerServerToStream(e,t,n,s){const o=qne.fromTransport(t,n),{client:r}=e.registerServer(o,s);return o.startListen(),{channel:o,client:r}}getServer(e,t){const{counterpart:n,dispose:s}=this.getInterface(e,this.client,this.server,t);return{server:n,dispose:s}}registerServer(e,t){const{counterpart:n,dispose:s}=this.getInterface(e,this.server,this.client,t);return{client:n,dispose:s}}withContext(){return new Y9e(this.tags,this.server,this.client)}};let EI=(function(i){return i.Comment="comment",i.Imports="imports",i.Region="region",i})({}),Ko=(function(i){return i[i.File=1]="File",i[i.Module=2]="Module",i[i.Namespace=3]="Namespace",i[i.Package=4]="Package",i[i.Class=5]="Class",i[i.Method=6]="Method",i[i.Property=7]="Property",i[i.Field=8]="Field",i[i.Constructor=9]="Constructor",i[i.Enum=10]="Enum",i[i.Interface=11]="Interface",i[i.Function=12]="Function",i[i.Variable=13]="Variable",i[i.Constant=14]="Constant",i[i.String=15]="String",i[i.Number=16]="Number",i[i.Boolean=17]="Boolean",i[i.Array=18]="Array",i[i.Object=19]="Object",i[i.Key=20]="Key",i[i.Null=21]="Null",i[i.EnumMember=22]="EnumMember",i[i.Struct=23]="Struct",i[i.Event=24]="Event",i[i.Operator=25]="Operator",i[i.TypeParameter=26]="TypeParameter",i})({}),X9e=(function(i){return i[i.Deprecated=1]="Deprecated",i})({}),Sxe=(function(i){return i[i.Type=1]="Type",i[i.Parameter=2]="Parameter",i})({}),Hgn=(function(i){return i[i.None=0]="None",i[i.Full=1]="Full",i[i.Incremental=2]="Incremental",i})({}),ar=(function(i){return i[i.Text=1]="Text",i[i.Method=2]="Method",i[i.Function=3]="Function",i[i.Constructor=4]="Constructor",i[i.Field=5]="Field",i[i.Variable=6]="Variable",i[i.Class=7]="Class",i[i.Interface=8]="Interface",i[i.Module=9]="Module",i[i.Property=10]="Property",i[i.Unit=11]="Unit",i[i.Value=12]="Value",i[i.Enum=13]="Enum",i[i.Keyword=14]="Keyword",i[i.Snippet=15]="Snippet",i[i.Color=16]="Color",i[i.File=17]="File",i[i.Reference=18]="Reference",i[i.Folder=19]="Folder",i[i.EnumMember=20]="EnumMember",i[i.Constant=21]="Constant",i[i.Struct=22]="Struct",i[i.Event=23]="Event",i[i.Operator=24]="Operator",i[i.TypeParameter=25]="TypeParameter",i})({}),$gn=(function(i){return i[i.Deprecated=1]="Deprecated",i})({}),Ugn=(function(i){return i[i.PlainText=1]="PlainText",i[i.Snippet=2]="Snippet",i})({}),vq=(function(i){return i[i.Text=1]="Text",i[i.Read=2]="Read",i[i.Write=3]="Write",i})({}),t_=(function(i){return i.Empty="",i.QuickFix="quickfix",i.Refactor="refactor",i.RefactorExtract="refactor.extract",i.RefactorInline="refactor.inline",i.RefactorRewrite="refactor.rewrite",i.Source="source",i.SourceOrganizeImports="source.organizeImports",i.SourceFixAll="source.fixAll",i})({}),ZW=(function(i){return i.PlainText="plaintext",i.Markdown="markdown",i})({}),z_=(function(i){return i[i.Error=1]="Error",i[i.Warning=2]="Warning",i[i.Information=3]="Information",i[i.Hint=4]="Hint",i})({}),xxe=(function(i){return i[i.Unnecessary=1]="Unnecessary",i[i.Deprecated=2]="Deprecated",i})({}),oB=(function(i){return i[i.Invoked=1]="Invoked",i[i.TriggerCharacter=2]="TriggerCharacter",i[i.TriggerForIncompleteCompletions=3]="TriggerForIncompleteCompletions",i})({}),rB=(function(i){return i[i.Invoked=1]="Invoked",i[i.TriggerCharacter=2]="TriggerCharacter",i[i.ContentChange=3]="ContentChange",i})({}),Jne=(function(i){return i[i.Invoked=1]="Invoked",i[i.Automatic=2]="Automatic",i})({}),jgn=(function(i){return i.Relative="relative",i})({});var ni=class{constructor(i){this.method=i}};const An={textDocumentImplementation:new ni("textDocument/implementation"),textDocumentTypeDefinition:new ni("textDocument/typeDefinition"),textDocumentDocumentColor:new ni("textDocument/documentColor"),textDocumentColorPresentation:new ni("textDocument/colorPresentation"),textDocumentFoldingRange:new ni("textDocument/foldingRange"),textDocumentDeclaration:new ni("textDocument/declaration"),textDocumentSelectionRange:new ni("textDocument/selectionRange"),textDocumentPrepareCallHierarchy:new ni("textDocument/prepareCallHierarchy"),textDocumentSemanticTokensFull:new ni("textDocument/semanticTokens/full"),textDocumentSemanticTokensFullDelta:new ni("textDocument/semanticTokens/full/delta"),textDocumentLinkedEditingRange:new ni("textDocument/linkedEditingRange"),workspaceWillCreateFiles:new ni("workspace/willCreateFiles"),workspaceWillRenameFiles:new ni("workspace/willRenameFiles"),workspaceWillDeleteFiles:new ni("workspace/willDeleteFiles"),textDocumentMoniker:new ni("textDocument/moniker"),textDocumentPrepareTypeHierarchy:new ni("textDocument/prepareTypeHierarchy"),textDocumentInlineValue:new ni("textDocument/inlineValue"),textDocumentInlayHint:new ni("textDocument/inlayHint"),textDocumentDiagnostic:new ni("textDocument/diagnostic"),textDocumentInlineCompletion:new ni("textDocument/inlineCompletion"),textDocumentWillSaveWaitUntil:new ni("textDocument/willSaveWaitUntil"),textDocumentCompletion:new ni("textDocument/completion"),textDocumentHover:new ni("textDocument/hover"),textDocumentSignatureHelp:new ni("textDocument/signatureHelp"),textDocumentDefinition:new ni("textDocument/definition"),textDocumentReferences:new ni("textDocument/references"),textDocumentDocumentHighlight:new ni("textDocument/documentHighlight"),textDocumentDocumentSymbol:new ni("textDocument/documentSymbol"),textDocumentCodeAction:new ni("textDocument/codeAction"),workspaceSymbol:new ni("workspace/symbol"),textDocumentCodeLens:new ni("textDocument/codeLens"),textDocumentDocumentLink:new ni("textDocument/documentLink"),textDocumentFormatting:new ni("textDocument/formatting"),textDocumentRangeFormatting:new ni("textDocument/rangeFormatting"),textDocumentRangesFormatting:new ni("textDocument/rangesFormatting"),textDocumentOnTypeFormatting:new ni("textDocument/onTypeFormatting"),textDocumentRename:new ni("textDocument/rename"),workspaceExecuteCommand:new ni("workspace/executeCommand"),workspaceDidCreateFiles:new ni("workspace/didCreateFiles"),workspaceDidRenameFiles:new ni("workspace/didRenameFiles"),workspaceDidDeleteFiles:new ni("workspace/didDeleteFiles"),workspaceDidChangeConfiguration:new ni("workspace/didChangeConfiguration"),textDocumentDidOpen:new ni("textDocument/didOpen"),textDocumentDidChange:new ni("textDocument/didChange"),textDocumentDidClose:new ni("textDocument/didClose"),textDocumentDidSave:new ni("textDocument/didSave"),textDocumentWillSave:new ni("textDocument/willSave"),workspaceDidChangeWatchedFiles:new ni("workspace/didChangeWatchedFiles")},eA=zgn({server:{textDocumentImplementation:mn({method:"textDocument/implementation"}),textDocumentTypeDefinition:mn({method:"textDocument/typeDefinition"}),textDocumentDocumentColor:mn({method:"textDocument/documentColor"}),textDocumentColorPresentation:mn({method:"textDocument/colorPresentation"}),textDocumentFoldingRange:mn({method:"textDocument/foldingRange"}),textDocumentDeclaration:mn({method:"textDocument/declaration"}),textDocumentSelectionRange:mn({method:"textDocument/selectionRange"}),textDocumentPrepareCallHierarchy:mn({method:"textDocument/prepareCallHierarchy"}),callHierarchyIncomingCalls:mn({method:"callHierarchy/incomingCalls"}),callHierarchyOutgoingCalls:mn({method:"callHierarchy/outgoingCalls"}),textDocumentSemanticTokensFull:mn({method:"textDocument/semanticTokens/full"}),textDocumentSemanticTokensFullDelta:mn({method:"textDocument/semanticTokens/full/delta"}),textDocumentSemanticTokensRange:mn({method:"textDocument/semanticTokens/range"}),textDocumentLinkedEditingRange:mn({method:"textDocument/linkedEditingRange"}),workspaceWillCreateFiles:mn({method:"workspace/willCreateFiles"}),workspaceWillRenameFiles:mn({method:"workspace/willRenameFiles"}),workspaceWillDeleteFiles:mn({method:"workspace/willDeleteFiles"}),textDocumentMoniker:mn({method:"textDocument/moniker"}),textDocumentPrepareTypeHierarchy:mn({method:"textDocument/prepareTypeHierarchy"}),typeHierarchySupertypes:mn({method:"typeHierarchy/supertypes"}),typeHierarchySubtypes:mn({method:"typeHierarchy/subtypes"}),textDocumentInlineValue:mn({method:"textDocument/inlineValue"}),textDocumentInlayHint:mn({method:"textDocument/inlayHint"}),inlayHintResolve:mn({method:"inlayHint/resolve"}),textDocumentDiagnostic:mn({method:"textDocument/diagnostic"}),workspaceDiagnostic:mn({method:"workspace/diagnostic"}),textDocumentInlineCompletion:mn({method:"textDocument/inlineCompletion"}),initialize:mn({method:"initialize"}),shutdown:mn({method:"shutdown"}),textDocumentWillSaveWaitUntil:mn({method:"textDocument/willSaveWaitUntil"}),textDocumentCompletion:mn({method:"textDocument/completion"}),completionItemResolve:mn({method:"completionItem/resolve"}),textDocumentHover:mn({method:"textDocument/hover"}),textDocumentSignatureHelp:mn({method:"textDocument/signatureHelp"}),textDocumentDefinition:mn({method:"textDocument/definition"}),textDocumentReferences:mn({method:"textDocument/references"}),textDocumentDocumentHighlight:mn({method:"textDocument/documentHighlight"}),textDocumentDocumentSymbol:mn({method:"textDocument/documentSymbol"}),textDocumentCodeAction:mn({method:"textDocument/codeAction"}),codeActionResolve:mn({method:"codeAction/resolve"}),workspaceSymbol:mn({method:"workspace/symbol"}),workspaceSymbolResolve:mn({method:"workspaceSymbol/resolve"}),textDocumentCodeLens:mn({method:"textDocument/codeLens"}),codeLensResolve:mn({method:"codeLens/resolve"}),textDocumentDocumentLink:mn({method:"textDocument/documentLink"}),documentLinkResolve:mn({method:"documentLink/resolve"}),textDocumentFormatting:mn({method:"textDocument/formatting"}),textDocumentRangeFormatting:mn({method:"textDocument/rangeFormatting"}),textDocumentRangesFormatting:mn({method:"textDocument/rangesFormatting"}),textDocumentOnTypeFormatting:mn({method:"textDocument/onTypeFormatting"}),textDocumentRename:mn({method:"textDocument/rename"}),textDocumentPrepareRename:mn({method:"textDocument/prepareRename"}),workspaceExecuteCommand:mn({method:"workspace/executeCommand"}),workspaceDidChangeWorkspaceFolders:So({method:"workspace/didChangeWorkspaceFolders"}),windowWorkDoneProgressCancel:So({method:"window/workDoneProgress/cancel"}),workspaceDidCreateFiles:So({method:"workspace/didCreateFiles"}),workspaceDidRenameFiles:So({method:"workspace/didRenameFiles"}),workspaceDidDeleteFiles:So({method:"workspace/didDeleteFiles"}),notebookDocumentDidOpen:So({method:"notebookDocument/didOpen"}),notebookDocumentDidChange:So({method:"notebookDocument/didChange"}),notebookDocumentDidSave:So({method:"notebookDocument/didSave"}),notebookDocumentDidClose:So({method:"notebookDocument/didClose"}),initialized:So({method:"initialized"}),exit:So({method:"exit"}),workspaceDidChangeConfiguration:So({method:"workspace/didChangeConfiguration"}),textDocumentDidOpen:So({method:"textDocument/didOpen"}),textDocumentDidChange:So({method:"textDocument/didChange"}),textDocumentDidClose:So({method:"textDocument/didClose"}),textDocumentDidSave:So({method:"textDocument/didSave"}),textDocumentWillSave:So({method:"textDocument/willSave"}),workspaceDidChangeWatchedFiles:So({method:"workspace/didChangeWatchedFiles"}),setTrace:So({method:"$/setTrace"}),cancelRequest:So({method:"$/cancelRequest"}),progress:So({method:"$/progress"})},client:{workspaceWorkspaceFolders:mn({method:"workspace/workspaceFolders"}).optional(),workspaceConfiguration:mn({method:"workspace/configuration"}).optional(),workspaceFoldingRangeRefresh:mn({method:"workspace/foldingRange/refresh"}).optional(),windowWorkDoneProgressCreate:mn({method:"window/workDoneProgress/create"}).optional(),workspaceSemanticTokensRefresh:mn({method:"workspace/semanticTokens/refresh"}).optional(),windowShowDocument:mn({method:"window/showDocument"}).optional(),workspaceInlineValueRefresh:mn({method:"workspace/inlineValue/refresh"}).optional(),workspaceInlayHintRefresh:mn({method:"workspace/inlayHint/refresh"}).optional(),workspaceDiagnosticRefresh:mn({method:"workspace/diagnostic/refresh"}).optional(),clientRegisterCapability:mn({method:"client/registerCapability"}).optional(),clientUnregisterCapability:mn({method:"client/unregisterCapability"}).optional(),windowShowMessageRequest:mn({method:"window/showMessageRequest"}).optional(),workspaceCodeLensRefresh:mn({method:"workspace/codeLens/refresh"}).optional(),workspaceApplyEdit:mn({method:"workspace/applyEdit"}).optional(),windowShowMessage:So({method:"window/showMessage"}),windowLogMessage:So({method:"window/logMessage"}),telemetryEvent:So({method:"telemetry/event"}),textDocumentPublishDiagnostics:So({method:"textDocument/publishDiagnostics"}),logTrace:So({method:"$/logTrace"}),cancelRequest:So({method:"$/cancelRequest"}),progress:So({method:"$/progress"})}});function q0(i,e){if(i.textModel!==e)throw new Error(`Expected text model to be ${e}, but got ${i.textModel}`);return i}var sr=(_q=class{constructor(){Rt(this,"_store",new Mde)}dispose(){this._store.dispose()}_register(i){if(i===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(i)}},Rt(_q,"None",Object.freeze({dispose(){}})),_q),Mde=(g3=class{constructor(){Rt(this,"_toDispose",new Set),Rt(this,"_isDisposed",!1)}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}clear(){if(this._toDispose.size!==0)try{for(const i of this._toDispose)i.dispose()}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?g3.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(i),i}},Rt(g3,"DISABLE_DISPOSED_WARNING",!1),g3);const Q9e=new Map([[t_.Empty,""],[t_.QuickFix,"quickfix"],[t_.Refactor,"refactor"],[t_.RefactorExtract,"refactor.extract"],[t_.RefactorInline,"refactor.inline"],[t_.RefactorRewrite,"refactor.rewrite"],[t_.Source,"source"],[t_.SourceOrganizeImports,"source.organizeImports"],[t_.SourceFixAll,"source.fixAll"]]);function Ggn(i){if(i)return Q9e.get(i)??i}const qgn=new Map([[pt.CodeActionTriggerType.Invoke,Jne.Invoked],[pt.CodeActionTriggerType.Auto,Jne.Automatic]]);function Kgn(i){return qgn.get(i)??Jne.Invoked}const Z9e=new Map([[ar.Text,pt.CompletionItemKind.Text],[ar.Method,pt.CompletionItemKind.Method],[ar.Function,pt.CompletionItemKind.Function],[ar.Constructor,pt.CompletionItemKind.Constructor],[ar.Field,pt.CompletionItemKind.Field],[ar.Variable,pt.CompletionItemKind.Variable],[ar.Class,pt.CompletionItemKind.Class],[ar.Interface,pt.CompletionItemKind.Interface],[ar.Module,pt.CompletionItemKind.Module],[ar.Property,pt.CompletionItemKind.Property],[ar.Unit,pt.CompletionItemKind.Unit],[ar.Value,pt.CompletionItemKind.Value],[ar.Enum,pt.CompletionItemKind.Enum],[ar.Keyword,pt.CompletionItemKind.Keyword],[ar.Snippet,pt.CompletionItemKind.Snippet],[ar.Color,pt.CompletionItemKind.Color],[ar.File,pt.CompletionItemKind.File],[ar.Reference,pt.CompletionItemKind.Reference],[ar.Folder,pt.CompletionItemKind.Folder],[ar.EnumMember,pt.CompletionItemKind.EnumMember],[ar.Constant,pt.CompletionItemKind.Constant],[ar.Struct,pt.CompletionItemKind.Struct],[ar.Event,pt.CompletionItemKind.Event],[ar.Operator,pt.CompletionItemKind.Operator],[ar.TypeParameter,pt.CompletionItemKind.TypeParameter]]);function Jgn(i){return i?Z9e.get(i)??pt.CompletionItemKind.Text:pt.CompletionItemKind.Text}const e6e=new Map([[$gn.Deprecated,pt.CompletionItemTag.Deprecated]]);function Ygn(i){return e6e.get(i)}const Xgn=new Map([[pt.CompletionTriggerKind.Invoke,oB.Invoked],[pt.CompletionTriggerKind.TriggerCharacter,oB.TriggerCharacter],[pt.CompletionTriggerKind.TriggerForIncompleteCompletions,oB.TriggerForIncompleteCompletions]]);function Qgn(i){return Xgn.get(i)??oB.Invoked}const Zgn=new Map([[Ugn.Snippet,pt.CompletionItemInsertTextRule.InsertAsSnippet]]);function emn(i){if(i)return Zgn.get(i)}const t6e=new Map([[Ko.File,pt.SymbolKind.File],[Ko.Module,pt.SymbolKind.Module],[Ko.Namespace,pt.SymbolKind.Namespace],[Ko.Package,pt.SymbolKind.Package],[Ko.Class,pt.SymbolKind.Class],[Ko.Method,pt.SymbolKind.Method],[Ko.Property,pt.SymbolKind.Property],[Ko.Field,pt.SymbolKind.Field],[Ko.Constructor,pt.SymbolKind.Constructor],[Ko.Enum,pt.SymbolKind.Enum],[Ko.Interface,pt.SymbolKind.Interface],[Ko.Function,pt.SymbolKind.Function],[Ko.Variable,pt.SymbolKind.Variable],[Ko.Constant,pt.SymbolKind.Constant],[Ko.String,pt.SymbolKind.String],[Ko.Number,pt.SymbolKind.Number],[Ko.Boolean,pt.SymbolKind.Boolean],[Ko.Array,pt.SymbolKind.Array],[Ko.Object,pt.SymbolKind.Object],[Ko.Key,pt.SymbolKind.Key],[Ko.Null,pt.SymbolKind.Null],[Ko.EnumMember,pt.SymbolKind.EnumMember],[Ko.Struct,pt.SymbolKind.Struct],[Ko.Event,pt.SymbolKind.Event],[Ko.Operator,pt.SymbolKind.Operator],[Ko.TypeParameter,pt.SymbolKind.TypeParameter]]);function n6e(i){return t6e.get(i)??pt.SymbolKind.File}const tmn=new Map([[X9e.Deprecated,pt.SymbolTag.Deprecated]]);function i6e(i){return tmn.get(i)}const nmn=new Map([[vq.Text,pt.DocumentHighlightKind.Text],[vq.Read,pt.DocumentHighlightKind.Read],[vq.Write,pt.DocumentHighlightKind.Write]]);function imn(i){return i?nmn.get(i)??pt.DocumentHighlightKind.Text:pt.DocumentHighlightKind.Text}const smn=new Map([[EI.Comment,pt.FoldingRangeKind.Comment],[EI.Imports,pt.FoldingRangeKind.Imports],[EI.Region,pt.FoldingRangeKind.Region]]);function omn(i){if(i)return smn.get(i)}const rmn=new Map([[yg.Error,z_.Error],[yg.Warning,z_.Warning],[yg.Info,z_.Information],[yg.Hint,z_.Hint]]);function amn(i){return rmn.get(i)??z_.Error}const lmn=new Map([[z_.Error,yg.Error],[z_.Warning,yg.Warning],[z_.Information,yg.Info],[z_.Hint,yg.Hint]]);function cmn(i){return i?lmn.get(i)??yg.Error:yg.Error}const s6e=new Map([[xxe.Unnecessary,QW.Unnecessary],[xxe.Deprecated,QW.Deprecated]]);function dmn(i){return s6e.get(i)}const umn=new Map([[pt.SignatureHelpTriggerKind.Invoke,rB.Invoked],[pt.SignatureHelpTriggerKind.TriggerCharacter,rB.TriggerCharacter],[pt.SignatureHelpTriggerKind.ContentChange,rB.ContentChange]]);function hmn(i){return umn.get(i)??rB.Invoked}function PI(i){if(i)return{id:i.command,title:i.title,arguments:i.arguments}}const gmn=new Map([[Sxe.Type,pt.InlayHintKind.Type],[Sxe.Parameter,pt.InlayHintKind.Parameter]]);function mmn(i){return i?gmn.get(i)??pt.InlayHintKind.Type:pt.InlayHintKind.Type}function ow(i,e){if("targetUri"in i){const t=e.bridge.translateBackRange({uri:i.targetUri},i.targetRange);return{uri:t.textModel.uri,range:t.range,originSelectionRange:i.originSelectionRange?e.bridge.translateBackRange({uri:i.targetUri},i.originSelectionRange).range:void 0,targetSelectionRange:i.targetSelectionRange?e.bridge.translateBackRange({uri:i.targetUri},i.targetSelectionRange).range:void 0}}else{const t=e.bridge.translateBackRange({uri:i.uri},i.range);return{uri:t.textModel.uri,range:t.range}}}function Aa(i){return!i||i.length===0?{language:"*"}:i.map(e=>"notebook"in e?typeof e.notebook=="string"?{notebookType:e.notebook,language:e.language}:{notebookType:e.notebook.notebookType,language:e.language,pattern:e.notebook.pattern,scheme:e.notebook.scheme}:{language:e.language,pattern:e.pattern,scheme:e.scheme})}function fmn(i,e){if(!e)return!0;const t=i.getLanguageId();if(i.uri.toString(!0),!e||e.length===0)return!0;for(const n of e)if(!(n.language&&n.language!=="*"&&n.language!==t))return!0;return!1}function Yne(i){const e={severity:cmn(i.severity),startLineNumber:i.range.start.line+1,startColumn:i.range.start.character+1,endLineNumber:i.range.end.line+1,endColumn:i.range.end.character+1,message:i.message,source:i.source,code:typeof i.code=="string"?i.code:i.code?.toString()};return i.tags&&(e.tags=i.tags.map(t=>dmn(t)).filter(t=>t!==void 0)),i.relatedInformation&&(e.relatedInformation=i.relatedInformation.map(t=>({resource:x7.parse(t.location.uri),startLineNumber:t.location.range.start.line+1,startColumn:t.location.range.start.character+1,endLineNumber:t.location.range.end.line+1,endColumn:t.location.range.end.character+1,message:t.message}))),e}var pmn=class extends sr{constructor(i){super(),this._connection=i,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{completion:{dynamicRegistration:!0,contextSupport:!0,completionItemKind:{valueSet:Array.from(Z9e.keys())},completionItem:{tagSupport:{valueSet:Array.from(e6e.keys())},commitCharactersSupport:!0,deprecatedSupport:!0,preselectSupport:!0}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(An.textDocumentCompletion,!0,e=>pt.registerCompletionItemProvider(Aa(e.documentSelector),new _mn(this._connection,e))))}},_mn=class{constructor(i,e){Rt(this,"resolveCompletionItem"),this._client=i,this._capabilities=e,e.resolveProvider&&(this.resolveCompletionItem=async(t,n)=>(o6e(t,await this._client.server.completionItemResolve(t._lspItem),this._client.bridge,t._translated,t._model),t))}get triggerCharacters(){return this._capabilities.triggerCharacters}async provideCompletionItems(i,e,t,n){const s=this._client.bridge.translate(i,e),o=await this._client.server.textDocumentCompletion({textDocument:s.textDocument,position:s.position,context:t.triggerCharacter?{triggerKind:Qgn(t.triggerKind),triggerCharacter:t.triggerCharacter}:void 0});return o?{suggestions:(Array.isArray(o)?o:o.items).map(r=>({...bmn(r,this._client.bridge,s,i,e),_lspItem:r,_translated:s,_model:i}))}:{suggestions:[]}}};function bmn(i,e,t,n,s){let o=i.insertText||i.label,r;i.textEdit&&("range"in i.textEdit?(o=i.textEdit.newText,r=q0(e.translateBackRange(t.textDocument,i.textEdit.range),n).range):(o=i.textEdit.newText,r={insert:q0(e.translateBackRange(t.textDocument,i.textEdit.insert),n).range,replace:q0(e.translateBackRange(t.textDocument,i.textEdit.replace),n).range})),r||(r=FL.fromPositions(s,s));const a={label:i.label,kind:Jgn(i.kind),insertText:o,sortText:i.sortText,filterText:i.filterText,preselect:i.preselect,commitCharacters:i.commitCharacters,range:r};return o6e(a,i,e,t,n),a}function o6e(i,e,t,n,s){e.detail!==void 0&&(i.detail=e.detail),e.documentation!==void 0&&(i.documentation=vmn(e.documentation)),e.insertTextFormat!==void 0&&(i.insertTextRules=emn(e.insertTextFormat)),e.tags&&e.tags.length>0&&(i.tags=e.tags.map(Ygn).filter(o=>o!==void 0)),e.additionalTextEdits&&e.additionalTextEdits.length>0&&(i.additionalTextEdits=e.additionalTextEdits.map(o=>({range:q0(t.translateBackRange(n.textDocument,o.range),s).range,text:o.newText}))),e.command&&(i.command=PI(e.command))}function vmn(i){if(i)return typeof i=="string"?i:{value:i.value,isTrusted:!0}}var ymn=class extends sr{constructor(i){super(),this._connection=i,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{hover:{dynamicRegistration:!0,contentFormat:[ZW.Markdown,ZW.PlainText]}}})),this._register(this._connection.capabilities.registerCapabilityHandler(An.textDocumentHover,!0,e=>pt.registerHoverProvider(Aa(e.documentSelector),new wmn(this._connection,e))))}},wmn=class{constructor(i,e){this._client=i,this._capabilities=e}async provideHover(i,e,t){const n=this._client.bridge.translate(i,e),s=await this._client.server.textDocumentHover({textDocument:n.textDocument,position:n.position});return!s||!s.contents?null:{contents:Cmn(s.contents),range:s.range?this._client.bridge.translateBackRange(n.textDocument,s.range).range:void 0}}};function Cmn(i){return Array.isArray(i)?i.map(e=>Nxe(e)):[Nxe(i)]}function Nxe(i){return typeof i=="string"?{value:i,isTrusted:!0}:"kind"in i?{value:i.value,isTrusted:!0}:{value:`\`\`\`${i.language}
1305
1305
  ${i.value}
@@ -1313,7 +1313,7 @@ Please exit multi-select mode to add a command.`,variant:"caution",type:"basic"}
1313
1313
  box-shadow: 0 0 0 8px rgba(43, 127, 255, 0);
1314
1314
  }
1315
1315
  `,mSn=S9("span",{target:"ev4uxlf0"})("position:absolute;inset:0;border-radius:inherit;pointer-events:none;animation:",gSn," 2s ease-out infinite;"),fSn=({className:i,mainTaskId:e,subTaskId:t,subTaskType:n})=>{const{modal:s}=Vi(),{data:o}=X6e({taskId:t}),r=()=>{s({component:hSn,props:{mainTaskId:e}})};return x("button",{className:P("SubTaskLabel","typo-compact-xs-semibold bg-fill-information text-fg-default absolute right-3 bottom-3 z-1 rounded-md px-2.5 py-1","shadow-[0_1px_6px_rgba(9,9,21,0.35)] transition-[background-color,box-shadow,transform] duration-150","hover:bg-fill-information-hovered active:scale-[0.99]",i),onClick:r,children:[u(mSn,{}),"Sub Task: ",o?.programName||"Unkown"," (",n==="CHANGE"?"Change":"Load",")"]})},{useCallback:pv,useEffect:QNe,useLayoutEffect:pSn,useMemo:zq,useRef:T3,useState:_Sn}=await F("react"),ZNe=.15;let Wq=null,E3=null;const Q6e=({className:i,index:e,mainTask:t,editTaskId:n,editMode:s,isEditMode:o,style:r,onChangeEditMode:a})=>{const l=T3(null),c=T3(null),d=T3(null),h=T3(!1),[g,m]=_Sn(!1),{data:f}=t6({programId:t.programId}),{data:p}=Jm(B=>({core_sw_list:B?.core_sw_list})),{playState:_}=nL(),{programTaskState:b}=nue(t.taskId),{lastSubTaskId:v,lastSubTaskType:w}=K6e(t.taskId),{data:y}=tL(t.taskId),{theme:S}=tt(),C=zq(()=>b?.state==="running"||b?.state==="completed"?"PLAYING":b?.state==="post_start"?"POST ACTION":b?.state==="waiting"?b?.stepMode?"WAITING (Step Mode)":"WAITING":b?.state==="paused"?"PAUSED":"IDLE",[b?.state,b?.stepMode]),N=zq(()=>p?.core_sw_list?.find(B=>B.model===t.robotModel),[p?.core_sw_list,t.robotModel]),k=zq(()=>p?.core_sw_list?.map(B=>({robotModel:B.model,robotAlias:B.alias})),[p?.core_sw_list]),L=pv(()=>{if(l.current){const B=l.current,Y=B.parentElement?.children.length??0,$=.375,Z=.375;B.style.paddingRight=`${Z}rem`,B.style.width=`calc((100% - ${$}rem) / ${Y})`,B.style.maxWidth="",B.style.minWidth="",B.style.height=`calc(100% - ${$*2}rem)`,B.style.position="absolute",B.style.top=`${$}rem`,B.style.zIndex=`${e+1}`;const{offsetWidth:K}=B;B.style.left=`calc(${K*e}px + ${$}rem)`}},[e]),D=pv(()=>{if(l.current){const B=l.current;if(B.dataset.resized==="1")return;const z=h.current||Wq===t.taskId;B.style.transitionDuration=z?"0ms":`${500-e*10}ms`,B.style.width="30%",B.style.maxWidth="50%",B.style.minWidth="25rem",B.style.left="0",B.style.top="0",B.style.height="100%",B.style.zIndex="9",B.style.paddingRight=""}},[e,t.taskId]),T=pv(()=>{o||f?.tasks?.length===1?D():L()},[o,D,L,f?.tasks?.length]),E=pv(B=>{D(),a?.({isEditMode:!0,editMode:B,mainTaskId:t.taskId})},[D,t.taskId,a]),R=pv(()=>{L(),a?.({isEditMode:!1,mainTaskId:null})},[L,a]),A=pv(()=>{b?.state!=="idle"&&m(!0)},[b?.state]),M=pv(()=>{m(!1)},[]),O=pv(B=>{const z=f?.tasks?.find(Y=>Y.robotModel===B);z&&(h.current=!0,Wq=z.taskId,E3&&window.clearTimeout(E3),a?.({isEditMode:!0,editMode:"add-command",mainTaskId:z.taskId}),E3=window.setTimeout(()=>{h.current=!1,Wq=null,E3=null},600))},[f?.tasks,a]);return QNe(()=>{if(y){const B=d.current?.querySelector(".main-tree-container .active");B&&!g&&c.current?.scrollTo(B)}},[y,g]),QNe(()=>{b?.state==="idle"&&m(!1)},[b?.state]),pSn(()=>(T(),window.addEventListener("resize",T),()=>{window.removeEventListener("resize",T)}),[T]),u("div",{ref:B=>{l.current=B,!o&&!n&&L()},className:P("ProgramTreeBox","relative h-full min-w-[18.75rem] transition-[left,top,height] duration-500 ease-in-out will-change-[left,width,height,top]",{"transition-none":f?.tasks.length===1,"selected-tree-item":o&&n===t.taskId},i),style:r,children:x(U,{className:P(S==="light"?"border bg-white":"bg-overlay","border-subtle relative h-full gap-1.5 overflow-hidden rounded-md border-t p-1.5 transition-[background-color] duration-500 ease-in-out","before:absolute before:top-0 before:left-0 before:z-1 before:size-full before:content-['']","after:pointer-events-none after:absolute after:top-0 after:left-0 after:z-2 after:size-full after:rounded-[inherit] after:border-2 after:border-transparent after:content-['']",{"rounded-none border-t-0! border-b-0! border-l-0!":o,"before:bg-fill-success-subtler bg-bg-default":b?.state==="running"||b?.state==="completed"||b?.state==="post_start","before:bg-fill-warning-subtler bg-bg-default":b?.state==="waiting","before:bg-fill-caution-subtle bg-bg-default":b?.state==="paused"}),children:[x(U,{className:"relative z-2 gap-[0.188rem] px-1",children:[x(H,{className:"gap-4",alignItems:"center",justifyContent:"space-between",children:[x(H,{alignItems:"center",children:[o&&f?.tasks.length>1&&u(Yt,{className:"mr-2 ml-[-0.25rem]",variant:"transparent",size:"3xs",icon:u(DGe,{}),onClick:R}),u("div",{className:"typo-compact-sm2-semibold text-fg-default line-clamp-1 flex-1 break-all",children:N?.alias??t.robotModel}),o&&k?.length>1&&x("div",{children:[u(n1,{anchorId:`program-tree-box-popover-${t.taskId}`,className:"text-fg-default bg-fill-subtler ml-1 size-5 rounded",popoverElementClassName:"[&_.popover-element]:!bg-transparent",popoverElement:u(nSn,{list:k,selectedRobotModel:t.robotModel,onSelectRobot:O}),popoverStyle:{top:"0.4rem",left:"-0.7rem"},children:u(Ty,{className:"size-3.5"})}),u("div",{id:`program-tree-box-popover-${t.taskId}`})]})]}),x(H,{className:P("gap-0.5","[&_button.active]:bg-fill-inverse-subtle",{"[&_button.active]:text-fg-success":b?.state==="running"||b?.state==="completed"||b?.state==="post_start","[&_button.active]:text-fg-warning":b?.state==="waiting","[&_button.active]:text-fg-caution":b?.state==="paused"}),alignItems:"center",children:[u(Yt,{className:P({active:s==="add-command"&&n===t.taskId}),variant:"transparent",size:"xs",icon:u(TGe,{}),disabled:_!=="idle",onClick:()=>E("add-command")}),u(Yt,{className:P({active:s==="simulation"&&n===t.taskId}),variant:"transparent",size:"xs",icon:u(EGe,{}),disabled:Yl(),onClick:()=>E("simulation")}),u(Yt,{className:P({active:s==="script-view"&&n===t.taskId}),variant:"transparent",size:"xs",icon:u(PGe,{}),onClick:()=>E("script-view")})]})]}),x(H,{className:"gap-2",alignItems:"center",justifyContent:"space-between",children:[u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:N?.model||"-"}),b?.state==="idle"||!b?.state?u(CA,{status:N?.connected,variant:"only-text",size:"2xs"}):u("span",{className:P("typo-compact-2xs-semibold text-fg-subtle",{"text-fg-success":b?.state==="running"||b?.state==="completed"||b?.state==="post_start","text-fg-warning":b?.state==="waiting","text-fg-caution":b?.state==="paused"}),children:C})]})]}),x("div",{ref:d,className:P(S==="light"?"border-fill-navy-subtlest border-2":"border border-transparent","bg-default scrollbar-x-lg relative z-2 h-[calc(100%-2.25rem)] overflow-x-hidden overflow-y-auto rounded-md p-3",{"border-success-stronger":b?.state==="running"||b?.state==="completed"||b?.state==="post_start","border-warning-stronger":b?.state==="waiting","border-caution-stronger":b?.state==="paused"}),children:[x(U,{className:"absolute top-2 right-2 z-[2]",children:[u(Yt,{className:"text-fg-subtle p-0.5",variant:"transparent",size:"xs",icon:u(EDe,{className:"text-fg-subtler size-3"}),onClick:M}),u(Yt,{className:"text-fg-subtle p-0.5",variant:"transparent",size:"xs",icon:u(Rie,{className:"text-fg-subtler size-4"}),onClick:()=>c.current?.zoomIn(ZNe)}),u(Yt,{className:"text-fg-subtle p-0.5",variant:"transparent",size:"xs",icon:u(Mie,{className:"text-fg-subtler size-4"}),onClick:()=>c.current?.zoomOut(ZNe)})]}),u(oue,{ref:c,minScale:.7,maxScale:2,onUserInteractScroll:A,children:!!t&&u(S6e,{robotModel:t.robotModel,programId:t.programId,taskId:t.taskId,isEditMode:o,onChangeEditMode:a})}),!!v&&u(fSn,{mainTaskId:t.taskId,subTaskId:v,subTaskType:w})]})]})})},bSn=i=>{const{data:e,loading:t}=ls("common/program/change",{selector:i});return{...e,loading:t}},{useEffect:eIe,useState:vSn}=await F("react"),Z6e=({className:i})=>{const{t:e}=q(),t=ie(m=>m.programInfo?.programId),{prevProgramId:n,programId:s}=bSn(),{playState:o,programPlayStateData:r,refetchProgramPlayState:a,isDifferentProgram:l}=R2e(),{handleLoadProgram:c}=SRe(),[d,h]=vSn(!1),g=async()=>{const m=Object.keys(r?.states??{})?.[0];if(!m)return;if(!/^[0-9a-f]{24}$/i.test(m)){rt.openToast({content:e("program.dimOverlay.toast.invalidTask"),variant:"caution",type:"basic"});return}const{task:f}=await Y6e({taskId:m}),{program:p}=await Yk({programId:f?.programId||""});c({programId:p?.programId||"",programName:p?.name||""})};return eIe(()=>{o==="play"&&a()},[o,a]),eIe(()=>{o&&o!=="idle"?n===t&&!l?c({programId:s},!0):h(l):h(!1)},[o,l,n,t,c,s]),d&&x(U,{className:P("ProgramDimOverlay","bg-bg-dim pointer-events-none absolute top-0 left-0 z-10 size-full gap-4",i),alignItems:"center",justifyContent:"center",children:[x(U,{className:"text-fg-subtle typo-compact-md-semibold",alignItems:"center",children:[u("span",{children:e("program.dimOverlay.line1")}),u("span",{children:e("program.dimOverlay.line2")}),u("small",{className:"text-fg-subtler typo-body-xs2-normal",children:e("program.dimOverlay.notice")})]}),u(se,{variant:"brand",size:"sm",className:"pointer-events-auto w-32",onClick:g,children:e("program.dimOverlay.button.move")})]})},{useCallback:ySn,useEffect:tIe,useState:wSn}=await F("react"),CSn=({className:i})=>{const e=ie(f=>f.treeItems),t=ie(f=>f.setInitialInfo),n=ie(f=>f.setAllTreeItems),s=ie(f=>f.setAllSubTreeItems),[o]=xc(),r=o.get("editMode")||"add-command",{usePluginManifest:a}=Fu(),l=ir(),[c,d]=wSn(!0),{data:h}=a(),g=({isEditMode:f,editMode:p})=>{f?setTimeout(()=>{d(f)},5):d(f),l(`./?editMode=${p}&mainTaskId=${Yu.taskId}`,{replace:!0})},m=ySn(async()=>{(e?.[Yu.taskId]?.filter(_=>_.method!==Za.method)?.length>0&&e[Yu.taskId].some(_=>_.method==="PluginCommand"&&_.args?.plugin_id!==h?.id)||!e?.[Yu.taskId])&&t({programInfo:cEe,treeItems:{[Yu.taskId]:[]},subTreeItems:{[Yu.taskId]:[]},beginInfo:{[Yu.taskId]:Yu.begin}},!0)},[h?.id,t,e]);return tIe(()=>{m()},[m]),tIe(()=>{const f=b=>{b&&(b.treeItems&&n(b.treeItems),b.subTreeItems&&s(b.subTreeItems))},p=b=>{f(b.detail)};window.addEventListener("program-ai-prompt-plugin:applied",p);let _=null;try{_=new BroadcastChannel("program-ai-prompt-plugin"),_.onmessage=b=>{b.data?.type==="program-store-updated"&&f(b.data)}}catch{_=null}return()=>{window.removeEventListener("program-ai-prompt-plugin:applied",p),_?.close()}},[s,n]),x("div",{className:P("PreviewProgram",i),children:[u(Z6e,{}),u(G6e,{onChangeEditMode:g}),x(H,{className:P("relative overflow-x-auto [&_.no-data]:size-full",{"overflow-hidden":!0}),style:{height:"calc(var(--vh, 1vh) * 100 - 2.75rem - 1px - 3rem - 1px - 3rem - 1px)"},children:[u(Q6e,{index:0,mainTask:Yu,editTaskId:Yu.taskId,editMode:r,isEditMode:!0,onChangeEditMode:g}),u($6e,{showEditPannel:c,mainTask:Yu,editMode:r})]})]})},{useCallback:SSn,useEffect:P3,useMemo:xSn,useState:nIe}=await F("react"),NSn=({className:i})=>{const{connected:e}=Mg(),t=ir(),{t:n}=q(),{modal:s}=Vi(),{alertDialog:o}=jn(),[r]=xc(),a=ie(L=>L.programInfo),l=ie(L=>L.setShowItem),c=ie(L=>L.setInitialInfo),{playState:d}=nL(),{theme:h}=tt(),{data:g,isError:m}=As({retry:!0}),{data:f}=Sp({programId:a?.programId||g?.info?.programId},{refetchOnWindowFocus:!0,retry:!0}),p=r.get("editMode")||null,_=r.get("mainTaskId")||null,[b,v]=nIe({editMode:p,mainTaskId:_}),[w,y]=nIe(!!p),S=xSn(()=>f?.mainTasks?.map(L=>L.taskId)||[],[f?.mainTasks]),C=SSn(({isEditMode:L,editMode:D,mainTaskId:T})=>{L?setTimeout(()=>{y(L)},5):y(L),v({editMode:D||null,mainTaskId:T||null}),D&&T&&S.includes(T)?t(`./?editMode=${D}&mainTaskId=${T}`,{replace:!0}):t("./",{replace:!0}),l(null)},[t,l,S]),N=async()=>{await s({component:U6e})},k=async()=>{await s({component:i6})};return P3(()=>{d!=="idle"&&w&&C({isEditMode:!0,editMode:!b?.editMode||b?.editMode==="add-command"?"simulation":b?.editMode,mainTaskId:b?.mainTaskId||null})},[b?.editMode,b?.mainTaskId,C,d,w]),P3(()=>{Yl()||(f?.program===null||g?.info?.robotModel&&f?.program?.robotModel&&f?.program?.robotModel!==g?.info?.robotModel)&&(c({programInfo:null,beginInfo:null,treeItems:null,subTreeItems:null},!0),f?.program===null&&o({title:n("program.deleted.alert.title"),content:n("program.deleted.alert.content"),onConfirm:()=>{t("./",{replace:!0})}}))},[o,t,f,g?.info?.robotModel,c,n]),P3(()=>{Yl()||(f?.mainTasks?.length===1&&!p?C({isEditMode:!0,editMode:"simulation",mainTaskId:f?.mainTasks[0].taskId}):f?.mainTasks?.length!==1&&(m||!p&&!_||S.length>0&&_&&!S.includes(_))&&C({isEditMode:!1}))},[m,C,p,_,S,f?.mainTasks]),P3(()=>()=>{l(null)},[l]),Yl()?u(CSn,{}):e?x("div",{className:P("relative h-full",i),children:[u(Z6e,{}),u(G6e,{onChangeEditMode:C}),x(H,{className:P("relative overflow-x-auto [&_.no-data]:size-full",{"overflow-hidden":p}),style:{height:"calc(var(--vh, 1vh) * 100 - 2.75rem - 1px - 3rem - 1px - 3rem - 1px)"},children:[!!a&&x(rn,{children:[u(qr,{noDataMsg:n("program.desc.noRobotComponentsFound"),list:f?.mainTasks,children:({item:L,index:D})=>u(Q6e,{index:D,mainTask:L,editTaskId:b?.mainTaskId,editMode:b?.editMode,isEditMode:b?.mainTaskId===L.taskId,onChangeEditMode:C},`${L.taskId}-${D}`)}),!!b?.mainTaskId&&S.includes(b?.mainTaskId)&&u($6e,{showEditPannel:w,mainTask:f?.mainTasks?.find(L=>L.taskId===b?.mainTaskId),editMode:b?.editMode},b?.mainTaskId)]}),!a&&u("div",{className:"size-full",children:u(Pie,{nullText:x(U,{className:"gap-3",alignItems:"center",justifyContent:"center",children:[u("p",{className:"typo-compact-lg-semibold",children:n("program.desc.loadOrAddNew")}),x(H,{className:"gap-2",children:[u(se,{className:P("w-fit",h==="light"?"bg-fill-subtlest":"bg-fill-subtler"),variant:"soft",onClick:k,children:n("program.button.loadProgram")}),u(se,{className:"w-fit",variant:"brand",onClick:N,children:n("program.button.newProgram")})]})]})})})]})]}):u("div",{className:"text-fg-default flex size-full items-center justify-center",children:u(qm,{className:"text-fg-default size-8"})})},{useEffect:ISn}=await F("react"),kSn=({className:i})=>{const{pathname:e}=Uk(),t=ir(),n=ui(),{selectedRobotModel:s}=n,{selectedRobot:o}=Fi(s),r=o?.be_service;return ISn(()=>{if(!r||!["manipulate","amr","rby1"].includes(r)||e.split("/settings/")[1]?.split("/")[0]===r)return;const l=e.split("/settings")[0]+"/settings";t(l+"/"+r,{replace:!0})},[r,e,t]),u("div",{className:P("SettingsPage","flex size-full overflow-auto",i),children:u(jk,{context:n})})},{useQuery:LSn}=await F("@tanstack/react-query"),eHe="/plugin/list",DSn=i=>Ut.get(eHe,{params:i}),TSn=(i,e)=>LSn({queryKey:[eHe,i],queryFn:()=>DSn(i),...e}),ESn=({className:i,tab:e,tabList:t,onChangeTab:n})=>{const{theme:s}=tt();return u(bA,{className:P("PluginListTab",i),defaultValue:e,children:u("div",{children:u(vA,{className:P("h-8 rounded-md border-none",s==="light"?"bg-fill-navy-subtlest":"bg-fill-subtlest"),children:t.map((o,r)=>x(yA,{value:o.value,className:P("typo-compact-xs2-medium min-w-35 cursor-pointer items-center gap-2 rounded px-4",s==="light"?["text-fg-subtle","data-[state=active]:bg-fill-navy","data-[state=active]:text-white"]:["text-fg-subtle","data-[state=active]:bg-fill-subtler","data-[state=active]:text-fg-default"]),onClick:()=>{n(o.value)},children:[u("span",{children:o.label}),o.totalCount>=0&&u("span",{className:"typo-compact-2xs-medium bg-bg-overlay text-fg-default inline-flex size-4 items-center justify-center rounded-sm",children:Ti(o?.totalCount)})]},r))})})})},{useMutation:PSn,useQueryClient:RSn}=await F("@tanstack/react-query"),MSn="/plugin/{pluginId}/install",ASn=({pluginId:i,version:e})=>{const t=MSn.replace("{pluginId}",i);return Ut.post(t,{version:e})},tHe=()=>{const i=RSn();return PSn({mutationFn:ASn,onSuccess:()=>{i.invalidateQueries({queryKey:["/plugin/installed/list"]})}})},{useMemo:OSn,useState:iIe}=await F("react"),FSn=({className:i,pluginId:e,iconUrl:t,name:n,description:s,company:o,author:r,architectures:a,installCount:l,installed:c,enabled:d,enableUpdate:h,supported:g,refetchInstalledList:m,refetchRegistryList:f})=>{const p=ir(),{t:_}=q(),[b,v]=iIe(!!c),{data:w}=i2e(e,!b),{mutateAsync:y,isPending:S}=Ooe(),{mutateAsync:C,isPending:N}=tHe(),[k,L]=iIe(!!d),{mutateAsync:D,isPending:T}=Aoe(),E=async M=>{M.preventDefault(),M.stopPropagation(),await D({pluginId:e,enabled:!k}),L(O=>!O),m?.()},R=OSn(()=>b?S:N,[b,N,S]),A=async M=>{M.preventDefault(),M.stopPropagation(),b?await y({pluginId:e}):await C({pluginId:e}),m?.(),f?.(),v(O=>!O),L(!b),rt.openToast({variant:"success",title:_(b?"plugin.toast.title.uninstalled":"plugin.toast.title.installed"),content:u("p",{children:b?_("plugin.toast.content.uninstalled",{name:n}):_("plugin.toast.content.installed",{name:n})})})};return u(Aie,{color:"#dddddd6a",duration:500,children:x(H,{className:P("PluginListItem","bg-bg-card border-subtle w-full cursor-pointer gap-4 rounded-md border-1 px-3 py-3.5",i),justifyContent:"space-between",onClick:()=>{p(`/muscat/app/plugin/${e}`)},children:[x(H,{className:"min-w-0 flex-1 gap-3",children:[u("span",{className:"border-border-subtler size-14 rounded-lg border-1",children:u("img",{className:"size-full object-contain object-center",src:t||yt("nexus/no-image.png"),onError:M=>{M.currentTarget.onerror=null,M.currentTarget.src=yt("nexus/no-image.png")}})}),x(U,{className:"gap-2",children:[x("div",{children:[u("strong",{className:"typo-compact-sm-semibold text-fg-default",children:n}),u("p",{className:"typo-compact-xs2-medium text-fg-subtler line-clamp-1 text-ellipsis",children:s})]}),x(H,{className:"gap-3",alignItems:"center",children:[x(H,{className:"text-fg-subtlest gap-1",alignItems:"center",children:[!!o&&u(BDe,{className:P("size-3.5",{"text-fg-brand":MDe(o)})}),u("span",{className:"typo-compact-xs-medium text-fg-subtle",children:o||r})]}),!!a&&u(H,{className:"text-fg-subtlest gap-1",alignItems:"center",children:u("span",{className:"typo-compact-xs-medium text-fg-subtle",children:a.join("/")})}),b&&!!w&&x(H,{className:"text-fg-subtle gap-3",alignItems:"center",children:[x(H,{className:"gap-1",alignItems:"center",children:[u(nKe,{className:"size-3.5"}),x("span",{className:"typo-compact-xs-medium",children:[w.cpuPercent.toFixed(1),"%"]})]}),x(H,{className:"gap-1",alignItems:"center",children:[u(xJe,{className:"size-3.5"}),x("span",{className:"typo-compact-xs-medium",children:[(w.memoryBytes/1024/1024).toFixed(0)," MB"]})]})]}),l>10&&x(H,{className:"text-fg-subtle gap-1",alignItems:"center",children:[u(zDe,{className:"size-3.5"}),u("span",{className:"typo-compact-xs-medium",children:Ti(l||0)})]})]})]})]}),x(H,{className:"gap-2",children:[b&&u(se,{className:"px-3",variant:"outlined",size:"xs",loading:T,onClick:E,children:_(k?"plugin.button.disable":"plugin.button.enable")}),u(se,{className:"px-3",variant:b?"outlined":"solid",size:"xs",loading:R,disabled:!b&&g,onClick:A,children:_(b?h?"plugin.button.update":"plugin.button.uninstall":"plugin.button.install")})]})]})})},{useMutation:BSn}=await F("@tanstack/react-query"),VSn="/plugin/upload",zSn=({file:i})=>{const e=new FormData;return e.append("file",i),Ut.post(VSn,e,{headers:{"Content-Type":"multipart/form-data"}})},WSn=()=>BSn({mutationFn:zSn}),{useMemo:sIe,useRef:HSn,useState:oIe}=await F("react"),VT=[{labelKey:"plugin.tab.registryList",value:"registry-list"},{labelKey:"plugin.tab.installedList",value:"installed-list"}],$Sn=({className:i})=>{const e=HSn(null),t=ir(),[n]=xc(),{t:s,currentLanguage:o}=q(),{getAssetUrl:r}=Fu(),a=Number(n.get("installed"))===1,[l,c]=oIe(""),[d,h]=oIe(a?VT[1].value:VT[0].value),{data:g}=As(),{data:m,refetch:f}=TSn({robotModel:g?.info?.robotModel,q:l},{enabled:!a}),{data:p,refetch:_}=kA({q:l}),{mutateAsync:b,isPending:v}=WSn(),w=sIe(()=>VT.map(k=>k.value===VT[1].value?{...k,label:s(k.labelKey),totalCount:p?.totalCount}:{...k,label:s(k.labelKey)}),[p?.totalCount,s]),y=sIe(()=>{const k=a?p?.plugins:m?.plugins;return k?k.map(L=>({pluginId:L.pluginId,iconUrl:L.icons?r(L.pluginId,uA(L.icons,128)):L.iconUrl,name:L.name,description:gA(L.description,o),company:L.company,author:L.author,architectures:L.architectures,installCount:"installCount"in L?L.installCount:0,installed:L.installed,enabled:L.enabled,supported:L.supported,enableUpdate:RGe(L.latestVersion,L.version)===1})):null},[o,r,a,p?.plugins,m?.plugins]),S=k=>{const L=k===VT[0].value;h(k),t(`${window.location.pathname}?installed=${L?0:1}`),L?f():_()},C=()=>{e.current&&e.current.click()},N=async k=>{const{file:L}=await xRe(k);await b({file:L}),f(),_()};return x("div",{className:P("PluginPage","mx-auto h-full max-w-[1536px] overflow-auto p-6 pt-0",i),children:[x("div",{className:"bg-default before:from-bg-default/0 before:to-bg-default/100 sticky top-0 left-0 z-1 pt-6 before:pointer-events-none before:absolute before:-bottom-3 before:left-0 before:z-1 before:h-3 before:w-full before:bg-gradient-to-t before:content-['']",children:[x(H,{justifyContent:"space-between",alignItems:"center",children:[u(ESn,{tab:d,tabList:w,onChangeTab:S}),x(se,{size:"xs2",leadingIcon:u(qDe,{className:"size-3"}),loading:v,onClick:C,children:[u("input",{ref:e,className:"hidden",type:"file",accept:".zip,application/zip",onChange:N}),s("plugin.button.upload")]})]}),u("div",{className:"my-4",children:u(et,{className:"w-full",type:"search",value:l,hideBtnReset:!1,placeholder:s("plugin.search.placeholder"),handleEnter:c,handleReset:c})})]}),u(U,{className:"relative min-h-100 gap-2.5",children:u(qr,{list:y,loadingWrapperClassName:"min-h-[inherit] text-fg-default",noDataMsgClassName:"min-h-[inherit] [&_.no-data-text]:typo-compact-sm-medium",noDataMsg:s("plugin.desc.noDataMsg"),children:({item:k,index:L})=>u(FSn,{pluginId:k.pluginId,iconUrl:k.iconUrl,name:k.name,description:k.description,company:k.company,author:k.author,architectures:k.architectures,installCount:k.installCount,installed:k.installed,enabled:k.enabled,enableUpdate:k.enableUpdate,refetchInstalledList:_,refetchRegistryList:f},`${k.pluginId}-${L}`)})})]})},nHe=({className:i,...e})=>u(MGe,{className:P("Pagination","w-full gap-0 pt-4 pb-4","[&>li]:flex [&>li]:h-7 [&>li]:w-7 [&>li]:shrink-0 [&>li]:items-center [&>li]:justify-center","[&>li>button]:flex [&>li>button]:size-full [&>li>button]:items-center [&>li>button]:justify-center [&>li>button]:bg-transparent","[&>li>button]:text-fg-subtler [&>li>button:not(.pagination-page):not(:disabled)]:text-fg-default","[&>li]:typo-compact-xs2-semibold","[&>li>.selected]:outline-border-default [&>li>.selected]:text-fg-default [&>li>.selected]:outline-1","[&>li>.pagination-next]:m-0 [&>li>.pagination-next-double]:m-0 [&>li>.pagination-prev]:m-0 [&>li>.pagination-prev-double]:m-0",i),...e}),R3=({children:i,title:e,className:t,initialOpen:n=!0})=>u(g9,{initialOpen:n,className:P("w-full","[&_[data-slot='accord-header']_svg]:size-3.5 [&_[data-slot='accord-header']>i]:size-5",t),title:u("div",{className:"typo-compact-xs2-semibold",children:e}),children:u("div",{className:"pb-1.5",children:i})}),{useState:USn}=await F("react");function rIe({allLabel:i,title:e,sources:t,isNotCollapsible:n=!1}){const{watch:s,setValue:o}=hr(),[r,a]=USn(!1),l=s(e),c=t;return x("div",{className:"flex flex-col gap-1 pt-2",children:[u(ia,{checkValue:c,handleChange:()=>{o(e,l.length===c.length?[]:c,{shouldDirty:!0})},name:`rb-checkbox-demo-all-${String(e)}`,size:"sm",value:l,children:u("span",{className:P("typo-compact-xs2-normal",{"text-fg-subtle":!c.some(d=>l.includes(d)),"text-fg-default":c.some(d=>l.includes(d))}),children:i})}),c.map((d,h)=>h<5||r?u(ia,{checkValue:d,handleChange:()=>{o(e,l.includes(d)?l.filter(g=>g!==d):[...l,d],{shouldDirty:!0})},name:String(e),size:"sm",value:l,children:u("span",{className:P("typo-compact-xs2-normal",{"text-fg-subtle":!l.includes(d),"text-fg-default":l.includes(d)}),children:String(d).toLocaleUpperCase()})},h):null),c.length>4&&!n&&u(jSn,{isOpen:r,setIsOpen:a})]})}const jSn=({isOpen:i,setIsOpen:e})=>{const{t}=q(),{theme:n}=tt();return x(U,{className:"relative",children:[i||u("div",{className:"absolute -top-8 left-0 h-8 w-44",style:{background:n==="light"?"linear-gradient(180deg, rgba(255, 255, 255, 0.00) 0%, #ffffff 100%)":"linear-gradient(180deg, rgba(24, 24, 27, 0.00) 0%, #18181B 100%)"}}),x(se,{variant:"transparent",size:"3xs",onClick:()=>e(s=>!s),className:"z-1 mx-1.5 w-18 text-start",children:[i?u(v9,{className:"size-3"}):u(gB,{className:"size-3"}),u("label",{className:"typo-compact-2xs-semibold pl-0.5",children:t(i?"log.button.showLess":"log.button.showAll")})]})]})},{useCallback:aIe,useMemo:lIe,useState:GSn}=await F("react"),qSn={"last-24-hours":"log.datepicker.preset.last24Hours","last-3-days":"log.datepicker.preset.last3Days","last-week":"log.datepicker.preset.lastWeek","last-month":"log.datepicker.preset.lastMonth","last-3-month":"log.datepicker.preset.last3Months"},KSn=(i,e)=>!i||!e?!1:i.getFullYear()===e.getFullYear()&&i.getMonth()===e.getMonth()&&i.getDate()===e.getDate(),p_=(i,e,t=!1)=>{const n=new Date(i);return n.setHours(e?.getHours()??(t?23:0),e?.getMinutes()??(t?59:0),0,0),n},JSn=(i,e)=>{const t=new Date,n=!!(i?.from||i?.to);return{from:n?i?.from:p_(t,void 0),to:n?i?.to:p_(t,void 0,!0),timeEnabled:i?.setTime??e}},YSn=({className:i,open:e,value:t,includeTime:n=!1,onOpenChange:s,close:o,resolve:r})=>{const{currentLanguage:a,t:l}=q(),[c,d]=GSn(()=>JSn(t,n)),h=lIe(()=>rLe.map(b=>({...b,label:l(qSn[b.key])})),[l]),g=lIe(()=>{switch(a){case"ko":return RYe;case"en":return Bue;default:return Bue}},[a]),m=b=>{const{from:v,to:w}=kLe(b);d(y=>({...y,from:p_(v,y.from),to:p_(w,y.to,!0)}))},f=(b,v)=>{d(w=>{const y=w.from&&!w.to&&KSn(w.from,v)?v:b?.to;return{...w,from:b?.from?p_(b.from,w.from):void 0,to:b&&y?p_(y,w.to,!0):void 0}})},p=aIe(()=>{d({from:void 0,to:void 0,timeEnabled:!1})},[]),_=aIe(()=>{const b=c.from;if(!b){r?.({from:void 0,to:void 0,setTime:c.timeEnabled});return}const v=c.to??p_(b,void 0,!0);let w,y;c.timeEnabled?(w=new Date(b),w.setSeconds(0,0),y=new Date(v),y.setSeconds(59,0)):(w=new Date(new Date(b).setHours(0,0,0,0)),y=new Date(new Date(v).setHours(23,59,59,0))),r?.({from:w,to:y,setTime:c.timeEnabled})},[c,r]);return u(Uo,{className:P(i,"min-w-140","bg-overlay border-subtle overflow-hidden rounded-lg border border-solid! p-0 shadow-[0px_0px_2px_0px_rgba(9,9,11,0.20)]"),hideCloseButton:!0,open:e,onOpenChange:s,children:x(U,{children:[u("div",{className:"border-subtle inline-flex w-full flex-wrap items-start justify-center gap-1 border-b px-3 py-4",children:h.map(b=>u(bLe,{label:b.label,onClick:()=>m(b.key)},b.key))}),u(xLe,{mode:"range",numberOfMonths:2,selected:c,defaultMonth:c.from,onSelect:f,locale:g}),n&&u(_Le,{pickerType:"range",selectedDate:c,onChange:b=>{if(b.timeEnabled&&!b.from&&!b.to){const v=new Date;d({...b,from:p_(v,void 0),to:p_(v,void 0,!0)})}else d(b)},labels:{from:l("log.label.from"),to:l("log.label.to"),setTime:l("log.datepicker.setTime")}}),u(pLe,{onReset:p,onCancel:()=>o(),onConfirm:_,labels:{reset:l("settings.button.settingsReset"),cancel:l("settings.button.cancel"),confirm:l("log.button.confirm")}})]})})},{useState:XSn}=await F("react"),QSn=["Muscat"],ZSn=()=>{const{t:i}=q(),{theme:e}=tt(),{setValue:t,reset:n,watch:s}=hr(),{coreSwList:o}=Fi(),[r,a]=XSn(""),l=[...QSn,...o?.map(y=>y.sw_name)||[]],{modal:c}=Vi(),d=s("date"),h=s("searchText"),g=s("excludeTexts"),m=y=>y.trim().toLowerCase(),f=()=>{rt.openToast({title:i("log.toast.title.duplicateText"),content:i("log.toast.content.duplicateText"),type:"basic",variant:"warning"})},p=y=>{const S=y.trim(),C=m(S),N=g.some(k=>m(k)===C);if(C&&N){f();return}t("searchText",S,{shouldDirty:!0}),t("pageNum",1,{shouldDirty:!0})},_=y=>{const S=y.trim();if(S){if(m(S)===m(h)){f(),a("");return}g.includes(S)||(t("excludeTexts",[...g,S],{shouldDirty:!0}),t("pageNum",1,{shouldDirty:!0})),a("")}},b=y=>{t("excludeTexts",g.filter(S=>S!==y),{shouldDirty:!0}),t("pageNum",1,{shouldDirty:!0})},v=async()=>{const y=dB(d.startValue??""),S=dB(d.endValue??""),C=await c({component:YSn,props:{includeTime:!0,value:{from:y.isValid()?y.toDate():void 0,to:S.isValid()?S.toDate():void 0,setTime:d.setTime}}});t("date",{startValue:C.from?Cr(C.from.getTime(),"YYYY-MM-DD HH:mm"):void 0,endValue:C.to?Cr(C.to.getTime(),"YYYY-MM-DD HH:mm"):void 0,setTime:C.setTime??!1},{shouldDirty:!0}),t("pageNum",1,{shouldDirty:!0})},w=d.endValue&&d.startValue;return x(U,{className:P(e==="light"?"border-subtle border-r bg-white":"bg-alt-1","sticky top-0 left-0 h-full w-43 overflow-y-scroll pb-1.5"),children:[u("div",{className:"my-1.5 px-2",children:u(et,{size:"xs2",type:"search",value:h,handleEnter:p,handleReset:()=>{t("searchText","",{shouldDirty:!0}),t("pageNum",1,{shouldDirty:!0})},placeholder:i("log.placeholder.search"),className:"w-full"})}),u(R3,{title:i("log.title.dateRange"),className:"**:data-[slot='accord-content-inner']:pb-0",children:x(U,{className:"gap-1 px-2 pt-2",children:[w&&x("div",{className:P("bg-fill-subtlest rounded-md p-2","typo-compact-2xs-normal grid gap-y-1"),children:[x("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[u("label",{className:"text-fg-subtler",children:"From"}),u("div",{className:"text-fg-default justify-self-end text-right",children:d.startValue})]}),x("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[u("label",{className:"text-fg-subtler",children:"To"}),u("div",{className:"text-fg-default justify-self-end text-right",children:d.endValue})]})]}),x(se,{size:"xs",variant:"soft",className:P("typo-compact-xs-semibold h-7 w-full",e==="light"&&"bg-fill-navy-subtlest text-fg-navy hover:bg-fill-navy-subtlest!"),onClick:v,children:[u(AGe,{className:"mr-1 size-4"}),i(w?"move.button.change":"log.button.selectDate")]})]})}),u(R3,{title:i("dashboard.content.components"),className:"**:data-[slot='accord-content-inner']:pb-0",children:u(rIe,{allLabel:"All Components",title:"components",sources:l})}),u(R3,{title:i("log.title.level"),className:"**:data-[slot='accord-content-inner']:pb-0",children:u(rIe,{allLabel:"All Levels",title:"levels",sources:Zse,isNotCollapsible:!0})}),u(R3,{title:i("log.title.excludeText"),initialOpen:!1,className:"**:data-[slot='accord-content-inner']:pb-0",children:x(U,{className:"gap-1.5 pb-1.5",children:[u(et,{size:"xs2",type:"search",value:r,handleChange:y=>a(String(y)),handleEnter:_,handleReset:()=>a(""),placeholder:i("log.placeholder.search"),className:"w-full"}),g.length>0&&u("div",{className:"flex flex-wrap gap-1.5",children:g.map(y=>x("span",{className:"bg-fill-subtlest text-fg-default typo-compact-xs-medium inline-flex max-w-full items-center gap-1 rounded-sm py-0.5 pr-1 pl-1.5",children:[u("span",{className:"truncate",children:y}),u("button",{type:"button",className:"text-fg-subtle hover:text-fg-default shrink-0 rounded-sm","aria-label":`Remove ${y}`,onClick:()=>b(y),children:u(Nb,{className:"size-2.5"})})]},y))})]})}),u(se,{size:"xs",variant:"outlined",className:"typo-compact-xs-semibold mx-2 shrink-0",onClick:()=>{n(hxn),a("")},children:i("log.button.resetFilter")})]})},{useMutation:exn}=await F("@tanstack/react-query"),txn="/export/state_logs",nxn=async i=>{const{fromDate:e,toDate:t}=i;return $ie.post(txn,{...i,fromDate:e?hB(e):void 0,toDate:t?hB(t):void 0},{responseType:"blob",timeout:0})},ixn=()=>exn({mutationFn:nxn}),cIe=()=>{const{mutateAsync:i,isPending:e}=ixn(),t=async n=>{const{format:s}=n;try{const o=`rb_logs_${Cr(new Date().getTime(),"YYYYMMDDHHmmss")}.${s}`,r=await i(n),a=window.URL.createObjectURL(r),l=document.createElement("a");l.href=a,l.download=o,document.body.appendChild(l),l.click(),l.remove(),window.URL.revokeObjectURL(a)}catch(o){console.error(o),rt.openToast({title:"Failed to download log list",content:"Please try again",type:"basic",variant:"danger"})}};return{downloadLogListCSV:n=>t({...n,format:"csv"}),downloadLogListTXT:n=>t({...n,format:"txt"}),isDownloading:e}},{useQueryClient:sxn}=await F("@tanstack/react-query"),oxn=[{label:"30",value:30},{label:"50",value:50},{label:"100",value:100}],rxn=()=>{const{t:i}=q(),{register:e,getValues:t}=hr(),n=t(),s=sxn(),{downloadLogListCSV:o,isDownloading:r}=cIe(),{downloadLogListTXT:a,isDownloading:l}=cIe(),c=()=>{o(jP(n))},d=()=>{a(jP(n))},{data:h,isLoading:g,queryKey:m}=Xse(jP(n));return x(H,{alignContent:"space-between",alignItems:"center",children:[x(H,{alignItems:"center",children:[u(Yt,{icon:u(Fie,{className:"size-3"}),loading:g,onClick:()=>s.invalidateQueries({queryKey:m}),size:"2xs",type:"button",variant:"transparent",className:"size-6"}),x("div",{className:"typo-compact-xs-normal text-fg-subtle pr-1.5 pl-0.5",children:[i("log.title.total"),":",u("label",{className:"text-fg-default pl-1",children:h?Ti(h.totalCount??0):"-"})]}),u(_o,{className:"mx-1.5 h-4",spaceDirection:"both",thickness:"thick",type:"vertical",variant:"solid"}),x(se,{size:"2xs",type:"button",variant:"transparent",className:"typo-compact-xs-semibold h-6",onClick:c,loading:r,children:[u(Ey,{className:"size-3"}),u("label",{className:"pl-0.5",children:i("log.button.exportCSV")})]}),x(se,{size:"2xs",type:"button",variant:"transparent",className:"typo-compact-xs-semibold h-6",onClick:d,loading:l,children:[u(Ey,{className:"size-3"}),u("label",{className:"pl-0.5",children:i("log.button.exportTXT")})]})]}),x(H,{alignItems:"center",className:"gap-1.5",children:[u("span",{className:"typo-compact-xs-normal text-fg-subtle",children:i("log.title.rows")}),u(ae,{className:P("h-8 w-fit","[&_div]:!typo-compact-xs2-medium"),size:"sm",...e("limit"),children:oxn.map(f=>u(J,{value:f.value,children:f.label},f.value))})]})]})},{useMemo:axn}=await F("react"),sie={info:{icon:(i="")=>u(DE,{className:` ${i}`}),iconColor:"bg-fg-information",color:"text-fg-information"},warning:{icon:(i="")=>u(X0,{className:` ${i}`}),iconColor:"bg-fg-warning",color:"text-fg-warning"},error:{icon:(i="")=>u(sDe,{className:`${i}`}),iconColor:"bg-fg-danger",color:"text-fg-danger"},debug:{icon:(i="")=>u(KLe,{className:` ${i}`}),iconColor:"bg-fg-debug",color:"text-fg-debug"},user:{icon:(i="")=>u(OGe,{className:` ${i}`}),iconColor:"bg-fg-subtle/60",color:"text-fg-subtle/60"},general:{icon:(i="")=>u(nDe,{className:` ${i}`}),iconColor:"bg-fg-subtle/60",color:"text-fg-subtle/60"}};function lxn(i){if(typeof i=="string")return i in sie?i:"general";const e=eoe[i]??"general";return e in sie?e:"general"}const cxn=({className:i,level:e})=>{const t=axn(()=>lxn(e),[e]),n=sie[t];return x(H,{alignItems:"center",className:P("LogLevel",n.color,"gap-0.5",i),children:[n.icon("h-3"),u("label",{className:"typo-compact-2xs-semibold",children:t.toUpperCase()})]})},dIe=({logDataList:i,isHeader:e=!1})=>{const{t}=q(),{theme:n}=tt(),s=e?P("LogTableHeader","z-10 w-full rounded-t-md p-1",n==="light"?"bg-fill-navy-subtlest border-subtle border border-b-0":"bg-alt-1 border-border-subtle border-t","[ [&_th,td]:px-1 [&_th,td]:px-2 [&_th,td]:py-0","[&_th]:h-7 [&_th]:bg-transparent","[&_table]:overflow-hidden [&_tbody]:hidden","[&_th]:typo-compact-xs-semibold [&_th]:text-fg-default [&_th]:!border-none"):P("LogTableContent rounded-br-md rounded-bl-md p-1",n==="light"?"border-subtle border bg-white":"bg-alt-2","[&_tr]:typo-compact-xs-normal w-full [&_td]:px-2 [&_td]:pr-2","[&_td]:align-baseline","[&_td]:!border-none [&_td]:bg-transparent [&_td]:py-1","[&_td]:text-slate-200 [&_thead]:hidden","[&_.no-data-text]:typo-compact-sm-normal");return u(Q0,{className:s,list:i,children:({item:o})=>x(Z0,{children:[u(Ao,{className:"w-[10rem]",fieldId:"createdAt",label:t("log.title.createdAt"),children:i?.length>0&&u("span",{className:"text-fg-subtle",children:Cr(o.createdAt,"YYYY-MM-DD HH:mm:ss")})}),u(Ao,{className:"w-[8rem]",fieldId:"swName",label:t("log.title.swName"),children:u("span",{className:"text-fg-subtle",children:i?.length>0&&(o.swName||"-")})}),u(Ao,{className:"w-[5.5rem]",fieldId:"level",label:t("log.title.level"),children:u("span",{className:"text-fg-subtle",children:i?.length>0&&u(cxn,{level:o.level})})}),u(Ao,{fieldId:"message",label:t("log.title.contents"),className:"text-fg-default",children:u("span",{className:"text-fg-default",children:i?.length>0&&o.contents})})]},o._id)})},{useEffect:uIe,useRef:dxn,useState:uxn}=await F("react"),hxn={levels:[],components:[],date:{startValue:void 0,endValue:void 0,setTime:!1},searchText:"",excludeTexts:[],limit:30,pageNum:1};function jP(i){return{limit:i.limit,pageNum:i.pageNum,level:i.levels,swName:i.components,searchText:i.searchText,excludeTexts:i.excludeTexts,fromDate:i.date.startValue,toDate:i.date.endValue}}const Hq=(i,e)=>{const t=i.getAll(e).filter(Boolean);if(t.length>0)return t;const n=i.get(e);return n?n.includes(",")?n.split(",").map(s=>s.trim()).filter(Boolean):[n]:[]},gxn=i=>{const e=new URLSearchParams;return i.limit!==void 0&&i.limit!==null&&e.set("limit",String(i.limit)),i.pageNum!==void 0&&i.pageNum!==null&&e.set("pageNum",String(i.pageNum)),i.searchText&&e.set("searchText",i.searchText),(Array.isArray(i.excludeTexts)?i.excludeTexts:i.excludeTexts?[i.excludeTexts]:[]).forEach(o=>{o&&e.append("excludeTexts",o)}),i.fromDate&&e.set("fromDate",i.fromDate),i.toDate&&e.set("toDate",i.toDate),(Array.isArray(i.level)?i.level:i.level!==void 0&&i.level!==null&&i.level!==""?[i.level]:[]).forEach(o=>{o!=null&&o!==""&&e.append("level",String(o))}),(Array.isArray(i.swName)?i.swName:i.swName?[i.swName]:[]).forEach(o=>{o&&e.append("swName",o)}),e.toString()},mxn=({className:i})=>{const[e,t]=xc(),{theme:n}=tt(),s=Hq(e,"level"),o=Hq(e,"swName"),r=Hq(e,"excludeTexts"),a=he({defaultValues:{limit:Number(e.get("limit"))||30,pageNum:Number(e.get("pageNum"))||1,levels:s,components:o,searchText:e.get("searchText")||"",excludeTexts:r,date:{startValue:e.get("fromDate")||"",endValue:e.get("toDate")||"",setTime:e.get("setTime")==="true"}},mode:"onChange"}),l=a.watch(),c=JSON.stringify(l);uIe(()=>{const f=new URLSearchParams(gxn(jP(l)));l.date.setTime&&f.set("setTime","true");const p=f.toString();p!==e.toString()&&t(p,{replace:!0})},[e,t,c,l]);const{data:d}=Xse(jP(l)),h=dxn(null),[g,m]=uxn(!1);return uIe(()=>{const f=h.current;f&&m(f.scrollHeight>f.clientHeight)},[d]),u(xn,{...a,children:x(H,{className:P("size-full max-h-full overflow-y-scroll pb-0",n==="light"&&"bg-overlay",i),ref:h,children:[u(ZSn,{}),x(U,{className:"m-auto flex h-full max-w-[1000px] flex-1 p-4",children:[u(rxn,{}),u("div",{className:P("bg-bg-default sticky top-0 left-0 z-1 pt-1.5"),children:u(dIe,{isHeader:!0,logDataList:[]})}),u(dIe,{logDataList:d?.items}),u(nHe,{currPage:a.watch("pageNum"),listSize:a.watch("limit"),pageSize:8,totalCount:d?.totalCount??0,handlePageChange:a.setValue.bind(null,"pageNum")}),g&&u("div",{className:"fixed right-5 bottom-18 z-10",children:u(Yt,{size:"sm",variant:"soft",className:P(n==="light"&&"bg-fill-subtlest hover:bg-fill-subtlest-hovered"),onClick:()=>{h.current?.scrollTo({top:0,behavior:"smooth"})},icon:u(v9,{className:"size-4"})})})]})]})})},fxn=({className:i,open:e,onOpenChange:t,onConfirm:n})=>{const{t:s}=q();return u(td,{className:P(i,"!max-h-70 w-100 max-w-full border-none p-0"),enableDimClose:!1,hideCloseButton:!0,open:e,onOpenChange:t,header:{title:x(H,{className:"gap-2",alignItems:"center",children:[u(mA,{className:"text-fg-danger"}),s("login.modal.title.denied")]})},footer:u("div",{className:"flex w-full justify-end",children:u(se,{size:"sm",className:"h-8 w-20",onClick:()=>{n(),t(!1)},children:s("log.button.confirm")})}),children:u("div",{className:"px-4 pt-3 pb-0",children:u("span",{className:"text-fg-default typo-compact-sm-normal",children:s("login.msg.denied")})})})},pxn=({className:i,open:e,onOpenChange:t,onConfirm:n})=>{const{t:s}=q();return u(td,{className:P(i,"!max-h-70 w-100 max-w-full border-none p-0"),enableDimClose:!1,hideCloseButton:!0,open:e,onOpenChange:t,header:{title:x(H,{className:"gap-2",alignItems:"center",children:[u(mA,{className:"text-fg-danger"}),s("login.modal.title.timeout")]})},footer:u("div",{className:"flex w-full justify-end",children:u(se,{size:"sm",className:"h-8 w-20",onClick:()=>{n(),t(!1)},children:s("log.button.confirm")})}),children:u("div",{className:"px-4 pt-3 pb-0",children:u("span",{className:"text-fg-default typo-compact-sm-normal",children:s("login.msg.timeout")})})})},{useMutation:_xn}=await F("@tanstack/react-query"),{useCallback:bxn,useRef:vxn,useState:yxn}=await F("react"),wxn="/login",Cxn=()=>{const[i,e]=yxn({status:"idle"}),t=vxn(!1),{socketEventEmit:n}=Mg(),{setLoggedIn:s}=Ib(),o=bxn(()=>{e({status:"idle"})},[]);return lA({topic:`login_result/${i.status==="pending"?i.request_id:""}`,callback:a=>{if(a){if(a.approved===!0){jue(a.access_token,a.refresh_token,t.current),Gue(),n("auth",{token:a.access_token,autoLogin:t.current?"true":"false"}),s(!0),e({status:"success",...a});return}e({status:a.reason})}}}),{..._xn({mutationFn:async a=>(t.current=a.is_auto_login??!1,Ut.post(wxn,a)),onSuccess:a=>{if(a.pending===!0){e({status:"pending",request_id:a.request_id,timeout:a.timeout,username:a.username});return}jue(a.access_token,a.refresh_token,t.current),Gue(),n("auth",{token:a.access_token,autoLogin:t.current?"true":"false"}),s(!0),e({status:"success",access_token:a.access_token,refresh_token:a.refresh_token})}}),loginState:i,resetLoginState:o}},{useEffect:oie,useMemo:Sxn,useRef:hIe,useState:GP}=await F("react"),xxn={denied:fxn,timeout:pxn};function Nxn({timeout:i,username:e}){const{t}=q(),{theme:n}=tt(),[s,o]=t("login_peding.modal.desc").split("{{username}}"),[r,a]=GP(100),[l,c]=GP(i),d=hIe(null),h=hIe(null);return oie(()=>{a(100),c(i),d.current=performance.now();const g=m=>{const f=m-(d.current??m),p=Math.max(0,1-f/(i*1e3));a(p*100),c(Math.ceil(p*i)),p>0&&(h.current=requestAnimationFrame(g))};return h.current=requestAnimationFrame(g),()=>{h.current!==null&&cancelAnimationFrame(h.current)}},[i]),x("div",{className:"flex w-72 flex-col items-center gap-4",children:[x("p",{className:"text-fg-subtle typo-compact-sm-normal",children:[s,x("b",{className:P(n==="light"?"text-orange-500":"text-fg-caution"),children:["'",e,"'"]}),o]}),x(H,{className:"w-full items-center justify-center gap-2",children:[u("div",{className:"flex-1 px-4",children:u("div",{className:P(n==="light"?"bg-fill-navy-subtlest":"bg-fg-static-white-subtle","h-1 w-full overflow-hidden rounded-full"),children:u("div",{className:P(n==="light"?"bg-fill-navy-subtle":"bg-fg-subtle","h-full rounded-full transition-none"),style:{width:`${r}%`}})})}),x("p",{className:"text-fg-subtle typo-compact-xs-normal tr text-right",children:[l,t("common.unit.seconds")]})]})]})}const Ixn=({className:i})=>{const{t:e}=q(),t=ir(),{modal:n,checkModal:s}=Vi(),{getSocketId:o}=Mg(),[r,a]=GP(ADe()),{mutateAsync:l,isPending:c,loginState:d,resetLoginState:h}=Cxn(),[g,m]=GP(!1),[f,p]=GP(!1),{register:_,watch:b,handleSubmit:v,formState:{errors:w}}=he({defaultValues:{inputId:"",inputPW:""},reValidateMode:"onSubmit"}),S=!!b("inputPW"),C=Sxn(()=>S&&f,[S,f]);oie(()=>{d.status==="success"&&t("/muscat/app/dashboard")},[d,t]),oie(()=>{if(d.status!=="denied"&&d.status!=="timeout")return;const k=xxn[d.status];n({component:k,props:{onConfirm:h,onClose:h},options:{componentName:`login-${d.status}`}})},[d.status,n,s,h]);const N=async k=>{try{await l({user_id:k.inputId,password:k.inputPW,socket_id:o()??"",is_auto_login:r,interactive:!0})}catch(L){if(typeof L=="object"&&L!==null&&"response"in L&&L.response?.data?.message){const D=L.response?.data?.code;let T=e("login.msg.error.unknown");D===403?T=e("login.msg.error.idOrPassword"):D===409?T=e("login.msg.error.alreadyLogged"):T=e("login.msg.error.unknown"),rt.openToast({title:e("login.title.failed"),content:T,variant:"warning",type:"basic"})}}};return d.status==="pending"?u(Nxn,{timeout:d.timeout,username:d.username}):u("form",{className:P("LoginForm",i),onSubmit:v(N),children:x(U,{className:"gap-8",alignItems:"center",children:[u("strong",{className:"text-fg-default text-2xl",children:e("login.title.welcome")}),x(U,{className:"w-84 gap-3",children:[u(me,{label:e("login.textfield.label.id"),children:x(U,{className:"gap-1.5",children:[u(et,{className:"w-full",size:"lg",type:"text",placeholder:e("login.placeholder.loginInfo",{info:e("login.textfield.label.id")}),..._("inputId",{required:!0}),handleEnter:()=>v(N)()}),w?.inputId&&x("span",{className:"text-fg-danger typo-compact-xs-semibold",children:["* ",e("login.msg.error.id")]})]})}),u(me,{label:e("login.textfield.label.password"),children:x(U,{className:"gap-1.5",children:[x("div",{className:"relative",children:[u(et,{className:"w-full",size:"lg",type:g?"text":"password",placeholder:e("login.placeholder.loginInfo",{info:e("login.textfield.label.password")}),..._("inputPW",{required:!0}),onFocus:()=>p(!0),onBlur:()=>{setTimeout(()=>p(!1),150)},handleEnter:()=>v(N)()}),u("div",{className:P("absolute inset-y-0 right-1.5 flex items-center transition-all duration-200",{"right-10":C}),children:u(Yt,{type:"button",tabIndex:-1,variant:"transparent",onClick:()=>m(k=>!k),icon:g?u(HDe,{className:"size-5"}):u(sJe,{className:"size-5"}),className:"text-fg-default hover:text-fg-default-hovered"})})]}),w?.inputPW&&x("span",{className:"text-fg-danger typo-compact-xs-semibold",children:["* ",e("login.msg.error.password")]})]})}),u(ia,{size:"md",tabIndex:-1,value:r,handleChange:k=>{a(k),uKe(k)},children:u("span",{className:"text-fg-default typo-compact-sm2-normal",children:e("login.label.rememberMe")})})]}),u(se,{variant:"brand",size:"md",type:"submit",className:"typo-compact-sm2-semibold w-84 px-4",loading:c,children:e("login.button.label.login")})]})})},kxn=({className:i})=>{const{isLoggedIn:e}=Ib();return e?u(l_,{to:"/muscat/app/dashboard",replace:!0}):u("div",{className:P("LoginPage","flex size-full items-center justify-center text-white",i),children:u(Ixn,{})})},{useState:Lxn}=await F("react"),E7=({className:i,routes:e,pathPrefix:t})=>{const{t:n}=q(),{theme:s}=tt(),{pathname:o,search:r}=Uk(),a=ir(),{user:l}=Ib(),c=p=>p===void 0||!hA()&&l.role<=p,d=p=>{const[_,b]=p.split("?"),v=o.endsWith("/"+_);return b?v&&r.includes(b):v},[h,g]=Lxn(()=>new Set(e?.map(p=>p.path)??[])),m=p=>{document.querySelector(".Scrolled-Box")?.scrollTo({top:0,behavior:"smooth"});const _=t?`${t}/${p}`:p;a(_,{replace:!0})},f=p=>{g(_=>{const b=new Set(_);return b.has(p)?b.delete(p):b.add(p),b})};return u("nav",{className:P("SettingsMenuBar",s==="light"?"bg-white":"bg-alt-1","border-subtle h-full border-r p-1","overflow-y-auto",i),children:e.filter(p=>c(p.meta?.requiresAuth)).map(p=>p.children?.length>0?u(g9,{className:P("[&_[data-slot='accord-content-inner']]:border-none [&_[data-slot='accord-content-inner']]:pb-0","[&_[data-slot='accord-header']_svg]:size-3.5 [&_[data-slot='accord-header']>i]:size-5"),handleOpenChange:()=>f(p.path),open:h.has(p.path),title:u("div",{className:"typo-compact-xs2-semibold py-2",children:n(`${p.meta?.label}`)}),children:u(U,{className:"px-2",children:p.children.filter(_=>c(_.meta?.requiresAuth)).map(_=>u("button",{className:"block",onClick:()=>m(`${p.path}/${_.path}`),children:u(U,{alignItems:"start",justifyContent:"center",className:P("h-8 p-2.5",d(_.path)?s==="light"?"bg-fill-navy-subtlest text-fg-navy typo-compact-xs-semibold rounded-md":"bg-fill-subtler text-fg-default typo-compact-xs-semibold rounded-md":"text-fg-subtler typo-compact-xs-medium"),children:n(`${_.meta?.label}`)})},_.path))})},p.path):u("button",{onClick:()=>m(p.path),className:"block w-full",children:u("div",{className:P("typo-compact-xs2-semibold inline-flex h-9 w-full items-center px-2 py-2.5","hover:text-fg-default-hovered",d(p.path)?s==="light"?"bg-fill-navy-subtlest text-fg-navy rounded-md":"bg-fill-subtler text-fg-default rounded-md":"text-fg-default"),children:n(p.meta?.label)})},p.path))})},Dxn=({className:i,robotModel:e,currentVersion:t,updateInfo:n})=>{const{selectedRobot:s}=Fi(e),{t:o}=q();return x("div",{className:P("DetailUpdateSWItem","border-border-subtle w-full rounded-md border-1 px-3 py-2",{"border-fg-caution-subtle":n&&n.status!=="available","border-fg-success-subtle":n&&n.status==="available"},i),children:[x(H,{justifyContent:"space-between",alignItems:"center",children:[x("div",{className:"typo-compact-xs2-medium text-fg-default",children:[s?.alias||e,!!s?.alias&&e!==s?.alias&&x("span",{className:"typo-compact-xs-normal text-fg-subtle ml-1",children:["(",s?.model,")"]})]}),u(CA,{status:s?.connected,variant:"only-text",size:"xs"})]}),x("div",{className:"typo-compact-2xs-medium mt-2",children:[u("span",{className:"text-fg-subtle",children:t||"-"}),!!n?.version&&n?.status==="available"&&x("span",{className:"text-fg-success ml-1",children:["→ ",n.version]}),!!n&&u("span",{className:P("border-border-default bg-bg-card typo-compact-2xs-normal ml-2 rounded-full border-1 px-1.5 py-0.5",{"border-fg-caution text-fg-caution":n.status!=="available","border-fg-success text-fg-success":n.status==="available"}),children:n?.status==="available"?o("maintenance.update.label.available"):o("maintenance.update.label.unavailable")})]}),!!n?.message&&u("p",{className:"text-fg-caution typo-compact-xs-semibold mt-1",children:n?.message})]})},{useMutation:Txn}=await F("@tanstack/react-query"),Exn="/deploy/upload/stream",Pxn=({fileData:i,onUploadProgress:e,signal:t,...n})=>Ut.post(Exn,i,{params:n,headers:{"Content-Type":"application/octet-stream"},timeout:0,signal:t,onUploadProgress:s=>{s.total&&e?.(Math.round(s.loaded/s.total*100))}}),Rxn=()=>Txn({mutationFn:Pxn}),{useMutation:Mxn}=await F("@tanstack/react-query"),Axn="/deploy/update-check/bulk",Oxn=i=>Ut.post(Axn,i),Fxn=()=>Mxn({mutationFn:Oxn}),{useMutation:Bxn}=await F("@tanstack/react-query"),Vxn="/deploy/update",zxn=i=>Ut.post(Vxn,i),Wxn=()=>Bxn({mutationFn:zxn}),{useQuery:Hxn}=await F("@tanstack/react-query"),iHe="/deploy/update-info",$xn=i=>Ut.get(iHe,{params:i}),Uxn=(i,e)=>Hxn({queryKey:[iHe,i],queryFn:()=>$xn(i),...e}),{useMutation:jxn}=await F("@tanstack/react-query"),Gxn="/deploy/update-info",qxn=i=>Ut.patch(Gxn,i),Kxn=()=>jxn({mutationFn:qxn}),{useEffect:gIe,useMemo:Jxn,useRef:mIe,useState:M3}=await F("react"),Yxn=({className:i,category:e,robotModels:t})=>{const n=mIe(null),s=mIe(null),{theme:o}=tt(),{t:r}=q(),{promptDialog:a,alertDialog:l}=jn(),[c,d]=M3(!1),[h,g]=M3(""),[m,f]=M3(null),[p,_]=M3(0),b=Imt(t.map(B=>({namespace:B}))),{data:v,refetch:w}=Uxn({category:e}),{mutateAsync:y,isPending:S}=Rxn(),{mutateAsync:C,isPending:N}=Fxn(),{mutateAsync:k,isPending:L}=Wxn(),{mutateAsync:D}=Kxn(),T=Jxn(()=>b.map(({data:B})=>B),[b]),E=()=>{n?.current?.click()},R=async B=>{d(!0);const{file:z}=await xRe(B);if(!z){d(!1);return}d(!1);let Y=z.name.replace(/\.[^.]+$/,"").replace(/\.(?:amd64|arm64)$/,"");if(Y=await a({title:r("maintenance.update.modal.title.confirmVersion"),content:x("span",{className:"!leading-[1.5]",children:[r("maintenance.update.modal.content.confirmVersion",{category:e.toUpperCase()}),u("br",{}),r("maintenance.update.modal.content.confirmVersionSub")]}),value:Y}),!Y)return;const{items:$}=await C({items:t.map(V=>({category:e,sw_name:V,version:Y}))});if(!$?.some(V=>V.status==="available")){rt.openToast({variant:"danger",title:r("maintenance.update.toast.title.unavailable"),content:$?.find(V=>V.status!=="available"&&!!V.message)?.message});return}f($?.reduce((V,fe)=>(V[fe.sw_name]=fe,V),{})),_(0);const K=new AbortController;s.current=K;try{await y({fileData:z,category:e,version:Y,onUploadProgress:_,signal:K.signal})}catch(V){if(K.signal.aborted)return;throw V}g(Y||"")},A=async()=>{const B=t.filter(Z=>m?.[Z]?.status==="available"),z=await Promise.allSettled(B.map(Z=>k({category:e,sw_name:Z,version:h}))),Y=B.filter((Z,K)=>z[K].status==="fulfilled"&&z[K].value.status!=="failed"),$=B.filter(Z=>!Y.includes(Z));$.length===0?rt.openToast({variant:"success",title:r("maintenance.update.toast.title.complete"),content:r("maintenance.update.toast.content.updateSuccess",{names:Y.join(", ")})}):await l({title:r("maintenance.update.dialog.title.result"),content:x(U,{className:"gap-1",children:[u("span",{children:r("maintenance.update.dialog.label.succeeded",{names:Y.length>0?Y.join(", "):"-"})}),u("span",{children:r("maintenance.update.dialog.label.failed",{names:$.join(", ")})})]})}),g(""),f(null)},M=async B=>{await D({autoUpdate:B,category:e,available:v?.available}),w(),b.forEach(({refetch:z})=>{z()})},O=()=>{g(""),f(null)};return gIe(()=>()=>{s.current?.abort()},[]),gIe(()=>{!m&&t?.length>0&&f(t.reduce((B,z)=>(B[z]=null,B),{}))},[t,m]),x(U,{className:P("SWVersionItem","relative rounded-lg border-1 px-5 py-3",o==="light"?"border-fill-navy-subtle":"border-border-subtle bg-bg-alt-1",i),children:[u("div",{className:"absolute size-full"}),x(H,{justifyContent:"space-between",alignItems:"center",children:[x(U,{className:"gap-1.5",children:[x(H,{className:"gap-2",alignItems:"center",children:[u("strong",{className:"typo-title-01-bold text-fg-default uppercase",children:e}),t.length>1&&u("span",{className:"border-border-default bg-card typo-compact-2xs-normal text-fg-subtle rounded-full border-1 px-1.5 py-0.5",children:r("maintenance.update.label.unitCount",{count:t.length})}),t.length===1&&e!==t?.[0]&&x("span",{className:"typo-title-01-normal text-fg-subtle -ml-1",children:["(",T?.[0]?.alias||t?.[0],")"]}),["web-ui","muscat"].includes(e)&&u("div",{children:u(ia,{size:"xs",value:v?.autoUpdate,checkValue:1,unCheckValue:0,handleChange:M,children:r("maintenance.update.label.autoUpdate")})})]}),x(H,{className:"gap-3",children:[u("span",{className:"typo-compact-xs-medium text-fg-subtler",children:r(`maintenance.update.${e}.description`)}),T.length===1&&!!T?.[0]?.branch&&T[0].branch!=="main"&&x(H,{className:"typo-compact-xs-medium text-fg-subtle gap-1",children:[u("span",{children:"Branch:"}),u("span",{children:T[0].branch})]}),T.length===1&&!!T?.[0]?.version&&x(H,{className:"typo-compact-xs-medium text-fg-subtle gap-1",children:[u("span",{children:"Version:"}),u("span",{children:T[0].version})]})]})]}),u(H,{className:"gap-2",children:h?x(rn,{children:[u(se,{size:"xs2",variant:"outlined",onClick:O,children:r("common.button.cancel")}),u(se,{size:"xs2",variant:"brand",loading:L,onClick:A,children:r("maintenance.update.button.execute")})]}):x(se,{variant:"soft",className:o==="light"&&"bg-fill-navy-subtlest",size:"xs2",leadingIcon:u(qDe,{className:"size-3.5"}),loading:c,disabled:T?.every(B=>!B?.version)||S,onClick:E,children:[u("input",{ref:n,type:"file",className:"hidden",accept:".zip",onChange:R}),S?r("maintenance.update.button.uploading",{progress:p}):r("maintenance.update.button.uploadBuildFile")]})})]}),t.length>1&&u(H,{className:"mt-3 gap-2",children:t.map(B=>u(Dxn,{robotModel:B,currentVersion:T?.find(z=>z?.model===B)?.version,updateInfo:m?.[B]},B))})]})},{useEffect:Xxn,useMemo:Qxn,useState:Zxn}=await F("react"),eNn=({className:i})=>{const{t:e}=q(),{realConnected:t}=Mg(),{coreSwList:n}=Fi(),[s,o]=Zxn(t),r=Qxn(()=>({...(n??[]).reduce((l,c)=>(l[c.be_service]||(l[c.be_service]=[]),l[c.be_service].push(c.sw_name),l),{}),muscat:["muscat"],"web-ui":["web-ui"]}),[n]);return Xxn(()=>{setTimeout(()=>{o(t)},t?2e3:0)},[t]),u("div",{className:P("MaintenenceUpdatePage","flex flex-1 flex-col gap-1.5 p-1.5",i),children:u(cs,{className:P("MuscatUpdate","flex flex-1 flex-col gap-1.5 overflow-y-auto","[&_.NxCardTitle]:typo-title-01-bold!"),title:e("maintenance.title.update"),description:e("maintenance.sub-title.update"),children:s?u(U,{className:"gap-3",children:Object.entries(r).map(([a,l])=>u(Yxn,{category:a,robotModels:l},a))}):u(U,{className:"h-[35vh]",justifyContent:"center",alignItems:"center",children:u(qm,{className:"text-fg-default size-7"})})})})},{useQuery:tNn}=await F("@tanstack/react-query"),sHe="/auth/policy",nNn=()=>Ut.get(sHe,{}),iNn=()=>tNn({queryKey:[sHe],queryFn:()=>nNn()}),{useMutation:sNn}=await F("@tanstack/react-query"),oNn="/auth/policy/upsert",rNn=async i=>await Ut.post(oNn,i),aNn=()=>sNn({mutationFn:rNn}),lNn=({className:i,isPending:e=!1,willForceRelogin:t,open:n,onOpenChange:s,onSave:o})=>{const{t:r}=q(),a=r(t?"maintenance.modal.saveAuto.desc.relogin":"maintenance.modal.saveAuto.desc.noRelogin"),l=async()=>{try{await o(),t&&hKe(),rt.openToast({title:"Success",content:r("settings.toast.saveSuccess.content"),variant:"success",type:"basic"})}catch(c){rt.openToast({title:"Error",content:"Save Failed. "+c,variant:"caution",type:"basic"})}finally{s(!1)}};return u(td,{className:P(i,"block w-100 border-none p-0"),header:{title:x(H,{className:"gap-2",alignItems:"center",children:[u(Gk,{className:"text-fg-information"}),u("span",{children:"Information"})]})},open:n,onOpenChange:s,footer:x(H,{className:"gap-1",alignItems:"center",justifyContent:"end",children:[u(se,{variant:"outlined",size:"sm",onClick:()=>s(!1),children:r("common.button.cancel")}),u(se,{variant:"brand",loading:e,onClick:l,children:r("log.button.confirm")})]}),children:u(U,{className:"px-4 pt-3 pb-4",children:a.split("\\n").map((c,d)=>u("span",{className:"typo-compact-sm-normal text-fg-default",children:c},d))})})},{useMemo:cNn}=await F("react"),dNn=["isLoginEnabled","requiredTransportList"],uNn={allowDuplicateLogin:!1,maxConnUsers:1,isLoginEnabled:!1,requiredTransportList:{api:!1,socket:!1,tcp:!1,mqtt:!1,webrtc:!1},jwtConfiguration:{expMins:5,refreshDays:3,servicePrefix:"$RB_SERVICE_",sdkPrefix:"rbst_"}},hNn=({className:i,robotModel:e})=>{const{t}=q(),{modal:n}=Vi(),{data:s,refetch:o}=iNn(),{mutateAsync:r,isPending:a}=aNn(),l=cNn(()=>s?{allowDuplicateLogin:s.allow_duplicate_login??!1,maxConnUsers:s.max_concurrent_users??1,isLoginEnabled:s.is_enabled??!1,requiredTransportList:{api:s.auth_required_transports.includes("api"),socket:s.auth_required_transports.includes("socket"),tcp:s.auth_required_transports.includes("tcp"),mqtt:s.auth_required_transports.includes("mqtt"),webrtc:s.auth_required_transports.includes("webrtc")},jwtConfiguration:{expMins:s.jwt_runtime_config.exp_mins??5,refreshDays:s.jwt_runtime_config.refresh_exp_days??3,servicePrefix:s.jwt_runtime_config.service_prefix??"$RB_SERVICE_",sdkPrefix:s.jwt_runtime_config.sdk_prefix??"rbst_"}}:uNn,[s]),{control:c,register:d,reset:h,handleSubmit:g,formState:{isDirty:m,dirtyFields:f}}=he({values:l}),p=g(_=>{const b=Object.entries(_.requiredTransportList).filter(([y,S])=>S).map(([y])=>y),w=Object.keys(f).some(y=>!dNn.includes(y));n({component:lNn,props:{isPending:a,willForceRelogin:w,onSave:async()=>{await r({allow_duplicate_login:_.allowDuplicateLogin,max_concurrent_users:_.maxConnUsers,is_enabled:_.isLoginEnabled,auth_required_transports:b,jwt_runtime_config:{exp_mins:_.jwtConfiguration.expMins,refresh_exp_days:_.jwtConfiguration.refreshDays,service_prefix:_.jwtConfiguration.servicePrefix,sdk_prefix:_.jwtConfiguration.sdkPrefix}}),await o()}}})});return u("div",{className:P("AuthPolicyManagementPagePage","flex flex-1 flex-col gap-1.5 p-1.5",i),children:u(cs,{className:P("AuthPolicyManagementPage","flex flex-1 flex-col gap-1.5 overflow-y-auto","[&_.NxCardTitle]:typo-title-01-bold!"),title:t("maintenance.menu.authPolicy"),description:t("maintenance.authPolicy.desc"),titleElement:u(la,{confirm:{onClick:p,loading:a,disabled:!m},reset:{onClick:()=>h(l),loading:a,disabled:!m}}),children:x(U,{className:"gap-3",children:[x(H,{className:"gap-5",children:[u(me,{label:t("maintenance.label.loginEnabled"),children:u(oe,{control:c,name:"isLoginEnabled",render:({field:_})=>u(tr,{checked:_.value,onCheckedChange:b=>{_.onChange(b)},className:"p-0",size:"default"})})}),u(me,{label:t("maintenance.label.transportProtocols"),children:x(H,{className:"grid grid-cols-5 gap-3",children:[x(H,{alignItems:"center",children:[u("span",{className:"typo-compact-xs-normal text-fg-default",children:"API"}),u(oe,{control:c,name:"requiredTransportList.api",render:({field:_})=>u(ia,{..._,value:_.value,handleChange:b=>{_.onChange(!!b)}})})]}),x(H,{alignItems:"center",children:[u("span",{className:"typo-compact-xs-normal text-fg-default",children:"TCP"}),u(oe,{control:c,name:"requiredTransportList.tcp",render:({field:_})=>u(ia,{..._,value:_.value,handleChange:b=>{_.onChange(!!b)}})})]}),x(H,{alignItems:"center",children:[u("span",{className:"typo-compact-xs-normal text-fg-default",children:"Socket"}),u(oe,{control:c,name:"requiredTransportList.socket",render:({field:_})=>u(ia,{..._,value:_.value,handleChange:b=>{_.onChange(!!b)}})})]}),x(H,{alignItems:"center",children:[u("span",{className:"typo-compact-xs-normal text-fg-default",children:"MQTT"}),u(oe,{control:c,name:"requiredTransportList.mqtt",render:({field:_})=>u(ia,{..._,value:_.value,handleChange:b=>{_.onChange(!!b)}})})]}),x(H,{alignItems:"center",children:[u("span",{className:"typo-compact-xs-normal text-fg-default",children:"WebRTC"}),u(oe,{control:c,name:"requiredTransportList.webrtc",render:({field:_})=>u(ia,{..._,value:_.value,handleChange:b=>{_.onChange(!!b)}})})]})]})})]}),x("div",{children:[u("span",{className:"typo-compact-xs-normal text-fg-danger",children:t("maintenance.helpText.reloginNotice")}),u(_o,{spaceDirection:"both",thickness:"thin",type:"horizontal",variant:"solid"})]}),x(H,{className:"gap-5",children:[u(me,{label:t("maintenance.label.allowDuplLogin"),children:u(oe,{control:c,name:"allowDuplicateLogin",render:({field:_})=>u(tr,{checked:_.value,onCheckedChange:b=>{_.onChange(b)},className:"p-0",size:"default"})})}),u(me,{label:t("maintenance.label.maxConcurrUsers"),helperText:t("maintenance.helpText.maxConcurrUsers"),children:u(ot,{size:"sm",name:"maxConnUsers",register:d,allowNegative:!1,decimalPlaces:0})})]}),u(Qi,{className:"mt-2",label:t("maintenance.label.jwtRuntimeConfig"),children:x(U,{className:"gap-3",children:[x(H,{className:"w-full gap-5",children:[u(me,{label:t("maintenance.label.tokenExp"),children:u(ot,{name:"jwtConfiguration.expMins",register:d,allowNegative:!1,decimalPlaces:0})}),u(me,{label:t("maintenance.label.refreshTokenExp"),children:u(ot,{name:"jwtConfiguration.refreshDays",register:d,allowNegative:!1,decimalPlaces:0})})]}),x(H,{className:"w-full gap-5",children:[u(me,{label:t("maintenance.label.servicePrefix"),children:u(et,{size:"sm",className:"w-full",...d("jwtConfiguration.servicePrefix")})}),u(me,{label:t("maintenance.label.sdkPrefix"),children:u(et,{size:"sm",className:"w-full",...d("jwtConfiguration.sdkPrefix")})})]})]})})]})})})},{useQuery:gNn}=await F("@tanstack/react-query"),oHe="/zenoh/peer/list",mNn=()=>Ut.get(oHe),fNn=()=>gNn({queryKey:[oHe],queryFn:()=>mNn()}),{useMutation:pNn}=await F("@tanstack/react-query"),_Nn="/zenoh/peer/{peer_id}",bNn=async i=>{const{peer_id:e}=i,t=_Nn.replace("{peer_id}",e);return await Ut.delete(t)},vNn=()=>pNn({mutationFn:bNn}),{useMutation:yNn}=await F("@tanstack/react-query"),wNn="/zenoh/peer",CNn=async i=>await Ut.post(wNn,i),SNn=()=>yNn({mutationFn:CNn}),{useMutation:xNn}=await F("@tanstack/react-query"),NNn="/zenoh/peer/{peer_id}/heartbeat",INn=async i=>{const{peer_id:e,...t}=i,n=NNn.replace("{peer_id}",e);return await Ut.post(n,t)},kNn=()=>xNn({mutationFn:INn}),fIe=({className:i,open:e,onOpenChange:t,isEditMode:n,editPeerData:s,refetchPeerList:o})=>{const{t:r}=q(),{mutateAsync:a,isPending:l}=SNn(),{mutateAsync:c,isPending:d}=kNn(),{register:h,handleSubmit:g,setValue:m,formState:{errors:f}}=he({defaultValues:{peerIp:s?.ip??"0.0.0.0",port:s?.port??0,ttl:s?.ttl??30}}),p=(b,v)=>{m(b,v)},_=async b=>{try{n?await c({peer_id:s.peer_id,ttl:Number(b.ttl)}):await a({ip:b.peerIp,port:Number(b.port),ttl:Number(b.ttl)}),o(),rt.openToast({title:"Success",content:n?r("maintenance.toast.content.editSuccess",{msg:r("maintenance.menu.externalPeer")}):r("maintenance.toast.content.registerSuccess"),variant:"success",type:"basic"})}catch(v){rt.openToast({title:"Error",content:`${n?r("maintenance.toast.content.editFail",{msg:r("maintenance.menu.externalPeer")}):r("maintenance.toast.content.registerFail")} : ${v}`,variant:"caution",type:"basic"})}finally{t(!1)}};return u(td,{className:P(i,"block border-none p-0"),header:{title:r(n?"maintenance.label.editPeer":"maintenance.label.registerPeer")},open:e,onOpenChange:t,disableAutoFocus:!0,footer:x(H,{className:"gap-1",alignItems:"center",justifyContent:"end",children:[u(se,{variant:"outlined",size:"sm",onClick:()=>t(!1),children:r("program.modal.button.cancel")}),u(se,{variant:"brand",loading:l||d,onClick:g(_),children:r("dashboard.modal.button.submit")})]}),children:x(U,{className:"gap-4 px-4 pt-3 pb-4",children:[x(H,{className:"grid grid-cols-2 gap-2",children:[x(U,{className:"w-full gap-1.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:"IP"}),u(et,{className:"w-full",size:"sm",disabled:n,...h("peerIp",{onChange:b=>p("peerIp",b.target.value)})}),f?.peerIp&&x("span",{className:"typo-compact-xs-semibold text-red-500",children:["* ",f.peerIp.message]})]}),x(U,{className:"w-full gap-1.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:r("program.options.port.port")}),u(et,{className:"w-full",size:"sm",disabled:n,...h("port",{onChange:b=>p("port",b.target.value),valueAsNumber:!0})}),f?.port&&x("span",{className:"typo-compact-xs-semibold text-red-500",children:["* ",f.port.message]})]})]}),u(H,{className:"gap-2",children:x(U,{className:"w-full gap-1.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:r("Heartbeat TTL")}),u(et,{className:"w-full",size:"sm",...h("ttl",{onChange:b=>p("ttl",b.target.value),valueAsNumber:!0})}),f?.ttl&&x("span",{className:"typo-compact-xs-semibold text-red-500",children:["* ",f.ttl.message]})]})})]})})},rue=({className:i,title:e,description:t,isPending:n=!1,open:s,onOpenChange:o,onDelete:r})=>{const{t:a}=q(),l=async()=>{try{await r(),rt.openToast({title:"Success",content:a("maintenance.toast.content.delete"),variant:"success",type:"basic"})}catch(d){rt.openToast({title:"Error",content:"Delete Failed. "+d,variant:"caution",type:"basic"})}finally{o(!1)}},c=t.split("\\n");return u(td,{className:P(i,"block w-100 border-none p-0"),header:{title:x(H,{className:"gap-2",alignItems:"center",children:[u(mA,{className:"text-fg-danger"}),u("span",{children:e})]})},open:s,onOpenChange:o,footer:x(H,{className:"gap-1",alignItems:"center",justifyContent:"end",children:[u(se,{variant:"outlined",size:"sm",onClick:()=>o(!1),children:a("program.modal.button.cancel")}),u(se,{variant:"danger",loading:n,onClick:l,children:a("program.modal.button.delete")})]}),children:x(U,{className:"px-4 pt-3 pb-4",children:[u("span",{className:"text-fg-default typo-compact-sm-normal whitespace-pre-line",children:c[0]}),c[1]&&x("span",{className:"text-fg-subtle typo-compact-xs-normal mt-2",children:["* ",c[1]]})]})})},{Fragment:LNn,useMemo:DNn,useState:TNn}=await F("react"),$q=10,rw=({className:i,isHeader:e=!1,tableName:t,dataList:n,columns:s,actions:o,getRowKey:r,noDataMsg:a})=>{const{theme:l}=tt(),[c,d]=TNn(1),h=DNn(()=>{if(!n)return;const m=(c-1)*$q;return n.slice(m,m+$q)},[n,c]),g=e?P(`${t}Header`,"w-full rounded-t-md p-1",l==="light"?"bg-fill-navy-subtlest border-subtle border border-b-0":"bg-alt-1 border-border-subtle border-x border-t","[&_th,td]:px-2 [&_th,td]:py-0","[&_th]:h-7 [&_th]:bg-transparent","[&_table]:overflow-hidden [&_tbody]:hidden","[&_th]:typo-compact-xs-semibold [&_th]:text-fg-default [&_th]:!border-none","[&_th.additional]:invisible",i):P(`${t}Content`,"min-h-7 rounded-br-md rounded-bl-md p-1",l==="light"?"border-subtle border bg-white":"border-border-subtle bg-alt-2 border-x border-b","[&_tr]:typo-compact-xs-normal w-full [&_td]:px-2","[&_td]:align-baseline","[&_td]:!border-none [&_td]:bg-transparent [&_td]:py-1","[&_td]:text-slate-200 [&_thead]:hidden","[&_.no-data-text]:typo-compact-sm-normal",i);return x(rn,{children:[u(Q0,{className:g,list:h,noDataMsg:a,children:({item:m,index:f})=>{const p=s.map(v=>u(Ao,{className:P("align-middle!",v.className),fieldId:v.fieldId,label:v.label,children:v.render?.(m,f,h)},v.fieldId)),_=o&&o.length>0?u(Ao,{className:"w-3.5",fieldId:"additional",label:"ED",children:x(iA,{children:[u(oA,{asChild:!0,children:u("button",{className:"w-full rounded-sm",children:u(nJe,{className:"text-fg-default size-4"})})}),u(sA,{className:"w-25",side:"left",align:"start",children:o.map(v=>x(LNn,{children:[v.separatorBefore&&u(f9,{}),u(hu,{onClick:()=>v.onClick(m),disabled:v.disabled,children:x(H,{className:P({"text-fg-danger":v.danger}),alignItems:"center",children:[v.icon,u(vLe,{className:P({"text-fg-danger":v.danger}),children:v.label})]})})]},v.key))})]})},"additional"):null,b=_?[...p,_]:p;return u(Z0,{children:b},r?r(m,f):f)}}),n?.length>0&&u(nHe,{currPage:c,listSize:$q,totalCount:n?.length??0,handlePageChange:d})]})},{useMemo:ENn}=await F("react"),PNn=({className:i,robotModel:e})=>{const{t}=q(),{modal:n}=Vi(),{data:s,refetch:o}=fNn(),{mutateAsync:r,isPending:a}=vNn(),l=ENn(()=>s?{totalCount:s.peers.length}:{},[s]),c=()=>{n({component:fIe,props:{refetchPeerList:o}})},d=m=>{n({component:fIe,props:{isEditMode:!0,editPeerData:m,refetchPeerList:o}})},h=m=>{n({component:rue,props:{title:t("maintenance.modal.title.delete",{msg:"Peer"}),description:t("maintenance.modal.content.confirmDeleteUser",{id:m}),isPending:a,onDelete:async()=>{await r({peer_id:m}),await o()}}})},g=m=>Cr(m,"YYYY-MM-DD","ko");return u("div",{className:P("PeerManagementPage","flex flex-1 flex-col gap-1.5 p-1.5",i),children:x(cs,{className:P("PeerManagement","flex flex-1 flex-col gap-1.5 overflow-y-auto","[&_.NxCardTitle]:typo-title-01-bold!"),title:`${t("maintenance.menu.externalPeer")} ${t("maintenance.menu.management")}`,description:t("maintenance.peerManagement.desc"),titleElement:u(se,{className:"w-35",size:"xs",variant:"soft",onClick:c,leadingIcon:u(qk,{className:"size-4"}),children:t("maintenance.label.registerPeer")}),children:[u(H,{className:"grid grid-cols-2 gap-4",children:u(Qi,{className:"mb-4 w-full",label:t("maintenance.label.totalPeers"),children:u("span",{className:"text-fg-default typo-compact-xs-semibold",children:l.totalCount??"-"})})}),u(rw,{tableName:"PeerTable",isHeader:!0,dataList:[],columns:[{fieldId:"peerId",label:"Peer ID",className:"w-[40%]"},{fieldId:"ip",label:"IP",className:"w-[15%]"},{fieldId:"port",label:t("program.options.port.port"),className:"w-[15%]"},{fieldId:"issuedDate",label:t("maintenance.table.label.issuedDate"),className:"w-[15%]"},{fieldId:"issuedBy",label:t("maintenance.table.label.issuedBy"),className:"w-[15%]"},{fieldId:"additional",label:"ED",className:"w-3.5"}]}),u(rw,{tableName:"PeerTable",isHeader:!1,dataList:s?.peers,noDataMsg:t("maintenance.table.msg.noManagementDatas",{msg:"Peer"}),getRowKey:(m,f)=>`${m.peer_id}-${f}`,columns:[{fieldId:"peerId",className:"w-[40%]",render:m=>u("span",{className:"text-fg-subtle",children:m.peer_id||"-"})},{fieldId:"ip",className:"w-[15%]",render:m=>u("span",{className:"text-fg-subtle",children:m.ip||"-"})},{fieldId:"port",className:"w-[15%]",render:m=>u("span",{className:"text-fg-subtle",children:m.port??"-"})},{fieldId:"issuedDate",className:"w-[15%]",render:m=>u("span",{className:"text-fg-subtle",children:g(m.issued_at)||"-"})},{fieldId:"issuedBy",className:"w-[15%]",render:m=>u("span",{className:"text-fg-subtle",children:m.issued_by||"-"})}],actions:[{key:"edit",label:t("settings.button.edit"),icon:u(Gie,{className:"text-fg-subtle size-3.5"}),onClick:m=>d(m)},{key:"delete",label:t("program.modal.button.delete"),icon:u(VI,{className:"size-3.5"}),danger:!0,separatorBefore:!0,onClick:m=>h(m.peer_id)}]})]})})},{useQuery:RNn}=await F("@tanstack/react-query"),rHe="/sdk/token/list/all",MNn=()=>Ut.get(rHe),ANn=()=>RNn({queryKey:[rHe],queryFn:()=>MNn()}),{useMutation:ONn}=await F("@tanstack/react-query"),FNn="/sdk/token/{token_id}",BNn=async i=>{const{token_id:e}=i,t=FNn.replace("{token_id}",e);return await Ut.delete(t)},VNn=()=>ONn({mutationFn:BNn}),{useMutation:zNn}=await F("@tanstack/react-query"),WNn="/sdk/token",HNn=async i=>await Ut.post(WNn,i),$Nn=()=>zNn({mutationFn:HNn}),{useMutation:UNn}=await F("@tanstack/react-query"),jNn="/sdk/token/{token_id}",GNn=async i=>{const{token_id:e,...t}=i,n=jNn.replace("{token_id}",e);return await Ut.put(n,t)},qNn=()=>UNn({mutationFn:GNn}),pIe=({className:i,open:e,onOpenChange:t,isEditMode:n,editSdkData:s,refetchSdkList:o})=>{const{t:r}=q(),{mutateAsync:a,isPending:l}=$Nn(),{mutateAsync:c,isPending:d}=qNn(),h=w=>dB(Number(w)?Number(w):w).startOf("day").valueOf(),{register:g,handleSubmit:m,setValue:f,control:p,formState:{errors:_}}=he({defaultValues:{name:s?.name||"",expires_at:n?h(s?.expires_at):Number(Vue())}}),b=(w,y)=>{f(w,y)},v=async w=>{try{n?await c({token_id:s?.token,expires_at:w.expires_at,name:w.name}):await a({expires_at:w.expires_at,name:w.name}),o(),rt.openToast({title:"Success",content:n?r("maintenance.toast.content.editSuccess",{msg:"SDK"}):r("maintenance.toast.content.createSuccess",{msg:"SDK"}),variant:"success",type:"basic"})}catch(y){rt.openToast({title:"Error",content:`${n?r("maintenance.toast.content.editFail",{msg:"SDK"}):r("maintenance.toast.content.createFail",{msg:"SDK"})} : ${y}`,variant:"caution",type:"basic"})}finally{t(!1)}};return u(td,{className:P(i,"block border-none p-0"),header:{title:r(n?"maintenance.label.editToken":"maintenance.label.createToken")},open:e,onOpenChange:t,disableAutoFocus:!0,footer:x(H,{className:"gap-1",alignItems:"center",justifyContent:"end",children:[u(se,{variant:"outlined",size:"sm",onClick:()=>t(!1),children:r("program.modal.button.cancel")}),u(se,{variant:"brand",loading:l||d,onClick:m(v),children:r("dashboard.modal.button.submit")})]}),children:u(U,{className:"gap-4 px-4 pt-3 pb-4",children:x(H,{className:"grid grid-cols-2 gap-2",children:[x(U,{className:"w-full gap-1.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:r("settings.tool.title.name")}),u(et,{className:"w-full",size:"sm",disabled:n,...g("name",{required:"Name is required",onChange:w=>b("name",w.target.value)})}),_?.name&&x("span",{className:"typo-compact-xs-semibold text-red-500",children:["* ",_.name.message]})]}),x(U,{className:"w-full gap-1.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:r("maintenance.table.label.expiredDate")}),u(oe,{name:"expires_at",control:p,rules:{required:"Check selected date",validate:w=>{const y=Number(w),S=Number(Vue());return y<=S?"Expiration date must be a future date.":!0}},render:({field:w})=>u(xie,{...w,value:w.value!=null?new Date(w.value):void 0,className:"w-full min-w-0",size:"sm",showType:"modal",showFooter:!1,showPresets:!1,handleChange:y=>{w.onChange(y?.getTime())}})}),_?.expires_at&&x("span",{className:"typo-compact-xs-semibold text-red-500",children:["* ",_.expires_at.message]})]})]})})})},{useMemo:KNn}=await F("react"),JNn=({className:i,robotModel:e})=>{const{t}=q(),{modal:n}=Vi(),{data:s,refetch:o}=ANn(),{mutateAsync:r,isPending:a}=VNn(),l=KNn(()=>s?{totalCount:s.tokens.length}:{},[s]),c=()=>{n({component:pIe,props:{refetchSdkList:o}})},d=p=>{n({component:pIe,props:{refetchSdkList:o,isEditMode:!0,editSdkData:p}})},h=p=>{n({component:rue,props:{title:t("maintenance.modal.title.delete",{msg:`SDK ${t("maintenance.table.label.token")}`}),description:t("maintenance.modal.content.confirmDeleteUser",{id:p}),isPending:a,onDelete:async()=>{await r({token_id:p}),await o()}}})},g=p=>{try{aDe({text:p}),rt.openToast({title:"Information",type:"basic",variant:"success",content:"Copied to clipboard!"})}catch(_){rt.openToast({title:"Error",type:"basic",variant:"caution",content:"Copy failed: "+_})}},m=p=>Cr(p,"YYYY-MM-DD","ko"),f=p=>{const _=new Date;return new Date(p)<_};return u("div",{className:P("SdkManagementPage","flex flex-1 flex-col gap-1.5 p-1.5",i),children:x(cs,{className:P("SdkManagement","flex flex-1 flex-col gap-1.5 overflow-y-auto","[&_.NxCardTitle]:typo-title-01-bold!"),title:`SDK ${t("maintenance.menu.management")}`,description:t("maintenance.sdkManagement.desc"),titleElement:u(se,{className:"w-40",size:"xs",variant:"soft",onClick:c,leadingIcon:u(qk,{className:"size-4"}),children:t("maintenance.label.createToken")}),children:[u(H,{className:"grid grid-cols-2 gap-4",children:u(Qi,{className:"mb-4 w-full",label:t("maintenance.label.totalTokens"),children:u("span",{className:"text-fg-default typo-compact-xs-semibold",children:l.totalCount??"-"})})}),u(rw,{tableName:"SdkTable",isHeader:!0,dataList:[],columns:[{fieldId:"name",label:t("settings.tool.title.name"),className:"w-[20%]"},{fieldId:"token",label:x(H,{className:"gap-1.5",alignItems:"center",children:[u("span",{children:t("maintenance.table.label.token")}),u(Gk,{id:"token-tooltip",className:"size-3"}),u(J0,{anchorId:"token-tooltip",events:["hover"],place:"top",width:"fit-content",children:t("maintenance.table.tooltip.token")})]}),className:"w-[35%] max-w-0"},{fieldId:"issuedDate",label:t("maintenance.table.label.issuedDate"),className:"w-[15%]"},{fieldId:"expiredDate",label:t("maintenance.table.label.expiredDate"),className:"w-[15%]"},{fieldId:"issuedBy",label:t("maintenance.table.label.issuedBy"),className:"w-[15%]"},{fieldId:"additional",label:"ED",className:"w-3.5"}]}),u(rw,{tableName:"SdkTable",isHeader:!1,dataList:s?.tokens,noDataMsg:t("maintenance.table.msg.noSdkTokens"),getRowKey:(p,_)=>`${p.token}-${_}`,columns:[{fieldId:"name",className:"w-[20%]",render:p=>u("span",{className:"text-fg-subtle",children:p.name||"-"})},{fieldId:"token",className:"w-[35%] max-w-0",render:(p,_)=>x(rn,{children:[u("span",{id:`token-${_}`,className:P("text-fg-subtle block w-full cursor-pointer truncate",{"line-through":f(p.expires_at)}),children:p.token||"-"}),u(J0,{anchorId:`token-${_}`,events:["click"],place:"top",width:"fit-content",children:x(H,{className:"gap-0.5",alignItems:"center",children:[u("span",{className:"min-w-0 break-all",children:p.token}),u(Yt,{variant:"transparent",className:"h-6 w-6",onClick:()=>g(p.token),"aria-label":"Copy to clipboard",icon:u(YKe,{className:"size-full"})})]})})]})},{fieldId:"issuedDate",className:"w-[15%]",render:p=>u("span",{className:"text-fg-subtle",children:m(p.issued_at)||"-"})},{fieldId:"expiredDate",className:"w-[15%]",render:p=>u("span",{className:P("text-fg-subtle",{"text-fg-danger":f(p.expires_at)}),children:m(p.expires_at)||"-"})},{fieldId:"issuedBy",className:"w-[15%]",render:p=>u("span",{className:"text-fg-subtle",children:p.issued_by||"-"})}],actions:[{key:"edit",label:t("settings.button.edit"),icon:u(Gie,{className:"text-fg-subtle size-3.5"}),onClick:p=>d(p)},{key:"delete",label:t("program.modal.button.delete"),icon:u(VI,{className:"size-3.5"}),danger:!0,separatorBefore:!0,onClick:p=>h(p.token)}]})]})})},{useMutation:YNn}=await F("@tanstack/react-query"),XNn="/user/remove/{user_id}",QNn=async i=>{const{user_id:e}=i,t=XNn.replace("{user_id}",e);return await Ut.delete(t)},ZNn=()=>YNn({mutationFn:QNn}),{useQuery:UHn,useQueryClient:eIn}=await F("@tanstack/react-query"),aHe="/user/get/{user_id}",tIn=i=>{const{user_id:e}=i,t=aHe.replace("{user_id}",e);return Ut.get(t,{})},nIn=()=>{const i=eIn();return e=>i.fetchQuery({queryKey:[aHe,e],queryFn:()=>tIn(e)})},{useQuery:iIn}=await F("@tanstack/react-query"),lHe="/users",sIn=i=>Ut.get(lHe,{params:i}),oIn=i=>iIn({queryKey:[lHe,i],queryFn:()=>sIn(i)}),{useMutation:rIn}=await F("@tanstack/react-query"),aIn="/user/signup",lIn=async i=>await Ut.post(aIn,i),cIn=()=>rIn({mutationFn:lIn}),{useMutation:dIn}=await F("@tanstack/react-query"),uIn="/user/update/{user_id}",hIn=async i=>{const{user_id:e,...t}=i,n=uIn.replace("{user_id}",e);return await Ut.put(n,t)},gIn=()=>dIn({mutationFn:hIn}),mIn=Object.keys(gKe).filter(i=>i!=="GUEST").map(i=>({label:i.charAt(0)+i.slice(1).toLowerCase(),value:i})),_Ie=({className:i,open:e,onOpenChange:t,isEditMode:n,editUserData:s,refetchUsers:o})=>{const{t:r}=q(),{mutateAsync:a,isPending:l}=cIn(),{mutateAsync:c,isPending:d}=gIn(),{register:h,handleSubmit:g,setValue:m,control:f,formState:{errors:p}}=he({defaultValues:{userId:s?.user_id??"",password:"",username:s?.username??"",role:s?.role??"OPERATOR"}}),_=(v,w)=>{m(v,w)},b=async v=>{try{if(n){const w=v.password.length>0;await c({user_id:v.userId,role:v.role,username:v.username,...w&&{password:v.password}})}else await a({user_id:v.userId,password:v.password,role:v.role,username:v.username});o(),rt.openToast({title:"Success",content:n?r("maintenance.toast.content.editSuccess",{msg:r("maintenance.menu.user")}):r("maintenance.toast.content.createSuccess",{msg:r("maintenance.menu.user")}),variant:"success",type:"basic"})}catch(w){rt.openToast({title:"Error",content:`${n?r("maintenance.toast.content.editFail",{msg:r("maintenance.menu.user")}):r("maintenance.toast.content.createFail",{msg:r("maintenance.menu.user")})} : ${w}`,variant:"caution",type:"basic"})}finally{t(!1)}};return u(td,{className:P(i,"block border-none p-0"),header:{title:r(n?"maintenance.modal.title.editUser":"maintenance.modal.title.createUser")},open:e,onOpenChange:t,disableAutoFocus:!0,footer:x(H,{className:"gap-1",alignItems:"center",justifyContent:"end",children:[u(se,{variant:"outlined",size:"sm",onClick:()=>t(!1),children:r("program.modal.button.cancel")}),u(se,{variant:"brand",loading:l||d,onClick:g(b),children:r("dashboard.modal.button.submit")})]}),children:x(U,{className:"gap-4 px-4 pt-3 pb-4",children:[x(H,{className:"grid grid-cols-2 gap-2",children:[x(U,{className:"w-full gap-1.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:r("maintenance.userManagement.label.userId")}),u(et,{className:"w-full",size:"sm",hideBtnReset:!0,disabled:n,...h("userId",{required:"ID is required",minLength:{value:4,message:"ID is too short."},pattern:{value:/^[a-z0-9_]+$/,message:"Only lowercase letters, numbers, and underscores are allowed."},onChange:v=>_("userId",v.target.value)}),handleEnter:()=>g(b)()}),p?.userId&&x("span",{className:"typo-compact-xs-semibold text-red-500",children:["* ",p.userId.message]})]}),x(U,{className:"w-full gap-1.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:r("maintenance.userManagement.label.userPw")}),u(et,{className:"w-full",type:"password",size:"sm",hideBtnReset:!0,...h("password",{required:{value:!n,message:"Password is required"},minLength:{value:4,message:"Password is too short."},onChange:v=>_("password",v.target.value)}),handleEnter:()=>g(b)()}),p?.password&&x("span",{className:"typo-compact-xs-semibold text-red-500",children:["* ",p.password.message]})]})]}),x(H,{className:"grid grid-cols-2 gap-2",children:[x(U,{className:"w-full gap-1.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:r("maintenance.userManagement.label.userName")}),u(et,{className:"w-full",size:"sm",hideBtnReset:!0,...h("username",{required:"User Name is required",onChange:v=>_("username",v.target.value)}),handleEnter:()=>g(b)()}),p?.username&&x("span",{className:"typo-compact-xs-semibold text-red-500",children:["* ",p.username.message]})]}),x(U,{className:"w-full gap-1.5",children:[u("span",{className:"typo-compact-xs-semibold text-fg-default",children:r("maintenance.userManagement.label.role")}),u(oe,{name:"role",control:f,render:({field:v})=>u(ae,{...v,size:"sm",onChange:w=>{v.onChange(w.target.value)},children:mIn.map(w=>u(J,{value:w.value,children:w.label},w.value))})})]})]})]})})};function A3({label:i,children:e}){return x("div",{className:"grid grid-cols-2 gap-4 py-2",children:[u("dt",{className:"typo-compact-sm-semibold text-fg-default",children:i}),u("dd",{className:"typo-compact-sm-medium text-fg-subtle wrap-break-word",children:e})]})}const fIn=({className:i,data:e,open:t,onOpenChange:n})=>{const{t:s}=q();return u(td,{className:P(i,"block w-100 border-none p-0"),header:{title:s("maintenance.modal.title.userInfo")},open:t,onOpenChange:n,disableAutoFocus:!0,children:u(U,{className:"gap-4 px-4 pt-3 pb-4",children:e&&x(U,{className:"",children:[u(A3,{label:s("maintenance.userManagement.label.userId"),children:e.user_id}),u(A3,{label:s("maintenance.userManagement.label.userName"),children:e.username}),u(A3,{label:s("maintenance.userManagement.label.role"),children:e.role}),u(A3,{label:s("maintenance.modal.label.activeSessionCnt"),children:e.active_session_count})]})})})},{useMemo:pIn}=await F("react"),rie={SUPERVISOR:{icon:(i="")=>u(gJe,{className:`${i}`}),iconColor:"bg-purple-100",color:"text-purple-500"},ADMIN:{icon:(i="")=>u(JJe,{className:`${i}`}),iconColor:"bg-indigo-100",color:"text-indigo-500"},MANAGER:{icon:(i="")=>u(Zue,{className:`${i}`}),iconColor:"bg-sky-100",color:"text-sky-400"},OPERATOR:{icon:(i="")=>u(Xue,{className:`${i}`}),iconColor:"bg-gray-200",color:"text-gray-500"},USER:{icon:(i="")=>u(Xue,{className:`${i}`}),iconColor:"bg-gray-300",color:"text-gray-600"},GUEST:{icon:(i="")=>u(Zue,{className:`${i}`}),iconColor:"bg-alt-1",color:"text-fg-disabled"}};function _In(i){if(typeof i=="string")return i in rie?i:"GUEST";const e=ng[i];return e&&e in rie?e:"GUEST"}const bIn=({className:i,level:e})=>{const t=pIn(()=>_In(e),[e]),n=rie[t];return x(H,{alignItems:"center",className:P("UserLevel",n.color,"gap-1.5",i),children:[n.icon("h-3.5 w-3.5"),u("label",{className:"typo-compact-2xs-semibold",children:t.toUpperCase()})]})},{useMemo:vIn,useState:yIn}=await F("react"),wIn=({className:i})=>{const{t:e}=q(),{modal:t}=Vi(),[n,s]=yIn(!1),{setValue:o,control:r}=he({defaultValues:{pageNum:1}}),{data:a,refetch:l}=oIn({skip:0,limit:50}),c=nIn(),{mutateAsync:d,isPending:h}=ZNn(),g=vIn(()=>{if(!a)return{};const b=a.items?.filter(v=>v.role==="ADMIN"||v.role==="SUPERVISOR").length;return{totalCount:a.total,adminCount:b}},[a]),m=()=>{t({component:_Ie,props:{refetchUsers:l}})},f=b=>{t({component:_Ie,props:{isEditMode:!0,editUserData:b,refetchUsers:l}})},p=b=>{t({component:rue,props:{title:e("maintenance.modal.title.delete",{msg:e("maintenance.menu.user")}),description:e("maintenance.modal.content.confirmDeleteUser",{id:b}),isPending:h,onDelete:async()=>{await d({user_id:b}),await l()}}})},_=async b=>{s(!0);try{const v=await c({user_id:b});t({component:fIn,props:{data:v}})}catch(v){console.error("User Detail modal open failed.",v)}finally{s(!1)}};return u("div",{className:P("UserManagement","flex",i),children:x(cs,{className:P("w-full gap-1.5","[&_.NxCardTitle]:typo-title-01-bold!"),title:`${e("maintenance.menu.user")} ${e("maintenance.menu.management")}`,description:e("maintenance.userManagement.desc"),titleElement:u(se,{className:"w-25",size:"xs",variant:"soft",onClick:m,leadingIcon:u(qk,{className:"size-4"}),children:e("maintenance.userManagement.button.addUser")}),children:[x(H,{className:"gap-4",children:[u(Qi,{className:"mb-4 w-full",label:e("maintenance.userManagement.button.totalUser"),children:u("span",{className:"text-fg-default typo-compact-xs-semibold",children:g.totalCount??"-"})}),u(Qi,{className:"mb-4 w-full",label:e("maintenance.userManagement.button.adminUser"),children:u("span",{className:"text-fg-default typo-compact-xs-semibold",children:g.adminCount??"-"})})]}),u(rw,{tableName:"UserTable",isHeader:!0,dataList:[],columns:[{fieldId:"userId",label:e("maintenance.userManagement.label.userId"),className:"w-[33%]"},{fieldId:"userName",label:e("maintenance.userManagement.label.userName"),className:"w-[33%]"},{fieldId:"role",label:e("maintenance.userManagement.label.role"),className:"w-[33%]"},{fieldId:"additional",label:"ED",className:"w-3.5"}]}),u(rw,{tableName:"UserTable",isHeader:!1,dataList:a?.items,noDataMsg:e("maintenance.table.msg.noManagementDatas",{msg:e("maintenance.menu.user")}),getRowKey:(b,v)=>`${b.user_id}-${v}`,columns:[{fieldId:"userId",className:"w-[33%]",render:b=>u("span",{className:"text-fg-subtle",children:b.user_id||"-"})},{fieldId:"userName",className:"w-[33%]",render:b=>u("span",{className:"text-fg-subtle",children:b.username||"-"})},{fieldId:"role",className:"w-[33%]",render:b=>u(bIn,{level:b.role})}],actions:[{key:"detail",label:e("dashboard.button.detail"),disabled:n,icon:u(HDe,{className:"text-fg-subtle size-3.5"}),onClick:b=>_(b.user_id)},{key:"edit",label:e("settings.button.edit"),icon:u(Gie,{className:"text-fg-subtle size-3.5"}),onClick:b=>f(b)},{key:"delete",label:e("program.modal.button.delete"),icon:u(VI,{className:"size-3.5"}),danger:!0,separatorBefore:!0,onClick:b=>p(b.user_id)}]})]})})},{useQuery:CIn}=await F("@tanstack/react-query"),cHe="/auth/sessions",aue=[cHe],SIn=()=>Ut.get(cHe,{}),xIn=()=>CIn({queryKey:aue,queryFn:SIn}),{useMutation:NIn,useQueryClient:IIn}=await F("@tanstack/react-query"),kIn=()=>{const i=IIn();return NIn({mutationFn:e=>mKe(e),onSuccess:()=>{i.invalidateQueries({queryKey:aue})}})},{useMutation:LIn,useQueryClient:DIn}=await F("@tanstack/react-query"),TIn="/logout/all",EIn=()=>Ut.post(TIn,{}),PIn=()=>{const i=DIn();return LIn({mutationFn:EIn,onSuccess:()=>{i.invalidateQueries({queryKey:aue})}})},{useMemo:bIe}=await F("react"),RIn={api:"blue",socket:"green",tcp:"purple",mqtt:"orange",webrtc:"red"},MIn=600,AIn=i=>{const e=Math.floor(Date.now()/1e3);return Object.entries(i).filter(([,t])=>e-t<=MIn).map(([t])=>t)},OIn=({className:i,robotModel:e})=>{const{t}=q(),{user:n}=Ib(),{data:s,isFetching:o,refetch:r}=xIn(),{mutate:a}=kIn(),{mutate:l}=PIn(),c=bIe(()=>s?.sessions??[],[s]),d=bIe(()=>{const m=new Map;return c.forEach(f=>{m.set(f.user_id,(m.get(f.user_id)??0)+1)}),[...m.values()].filter(f=>f>1).length},[c]),h=m=>{a(m.sid)},g=()=>{l()};return u("div",{className:P("LoginManagement","flex",i),children:x(cs,{className:P("w-full gap-1.5","[&_.NxCardTitle]:typo-title-01-bold!"),title:`${t("maintenance.title.login")} ${t("maintenance.menu.management")}`,description:t("maintenance.loginManagement.desc"),titleElement:x(H,{className:"gap-2",children:[u(se,{size:"xs",variant:"soft",onClick:()=>r(),loading:o,leadingIcon:u(OJe,{className:"size-4"}),children:t("maintenance.loginManagement.button.refresh")}),u(se,{className:"w-32",size:"xs",variant:"dangerSoft",onClick:g,leadingIcon:u(Que,{className:"size-4"}),children:t("maintenance.loginManagement.button.forceAll")})]}),children:[x(H,{className:"gap-5",children:[u(Qi,{className:"mb-4 w-full",label:t("maintenance.modal.label.activeSessionCnt"),children:u("span",{className:"text-fg-default typo-compact-xs-semibold",children:c.length})}),u(Qi,{className:"mb-4 w-full",label:t("maintenance.loginManagement.label.duplicateAccounts"),children:u("span",{className:"text-fg-danger typo-compact-xs-semibold",children:d})})]}),u(rw,{tableName:"UserLoginTable",isHeader:!0,dataList:[],columns:[{fieldId:"user",label:t("maintenance.loginManagement.label.username"),className:"w-[25%]"},{fieldId:"transport",label:t("maintenance.loginManagement.label.transport"),className:"w-[25%]"},{fieldId:"loginTime",label:t("maintenance.loginManagement.label.loginTime"),className:"w-[25%]"},{fieldId:"additional",label:"Action",className:"w-[25%]"}]}),u(rw,{tableName:"UserTable",isHeader:!1,dataList:c,noDataMsg:t("maintenance.table.msg.noManagementDatas",{msg:t("duplicated login")}),getRowKey:(m,f)=>`${m.sid}-${f}`,columns:[{fieldId:"user",className:"w-[25%]",render:m=>u("div",{className:"flex flex-col gap-1",children:x(H,{className:"gap-1_5 items-center",children:[x("span",{className:"text-fg-default typo-compact-xs-semibold",children:[m.username||"-"," (",u("span",{className:"text-fg-subtle typo-compact-2xs-regular",children:m.user_id}),")"]}),m.sid===n.sid&&u(lh,{type:"soft",color:"green",children:t("maintenance.loginManagement.label.currentSession")})]})})},{fieldId:"transport",className:"w-[25%]",render:m=>{const f=AIn(m.transports??{});return f.length===0?u("span",{className:"text-fg-subtle",children:"-"}):u(H,{className:"flex-wrap gap-1",children:f.map(p=>u(lh,{type:"soft",color:RIn[p]??"gray",children:p},p))})}},{fieldId:"loginTime",className:"w-[25%]",render:m=>u("span",{className:"text-fg-subtle",children:Cr(m.issued_at,"YYYY-MM-DD HH:mm:ss")})},{fieldId:"additional",className:"w-[25%]",render:m=>u(se,{className:"w-25",size:"xs",variant:"outlined",onClick:()=>h(m),leadingIcon:u(Que,{className:"size-4"}),children:t("maintenance.loginManagement.button.force")})}]})]})})},FIn=({className:i,robotModel:e})=>x("div",{className:P("UserManagementPage","flex flex-1 flex-col gap-1.5 p-1.5",i),children:[u(wIn,{className:"h-full flex-1"}),u(OIn,{className:"h-full flex-1"})]}),BIn=({className:i,item:e,isPending:t,onResetClick:n})=>{const{theme:s}=tt(),{t:o}=q(),r=(e.warningDesc?.length??0)>0,a=()=>{n?.()};return u(U,{className:P("DatabaseItem","relative rounded-lg border px-5 py-3",s==="light"?"border-fill-navy-subtle":"border-border-subtle bg-bg-alt-1",i),children:x(H,{justifyContent:"space-between",alignItems:"center",children:[x(U,{className:"gap-1.5",children:[u("strong",{className:"typo-title-01-bold text-fg-default",children:o(e.title)}),x(U,{className:"gap-2",children:[u("span",{className:"typo-compact-xs-medium text-fg-subtler",children:o(e.description)}),r&&u(H,{className:"typo-compact-xs-medium text-fg-caution pr-5 break-all",children:u("span",{children:o(e.warningDesc)})})]})]}),u(H,{children:u(se,{variant:"dangerSoft",className:P("w-32",{"bg-fill-danger-subtlest":s==="light"}),size:"xs2",disabled:t,onClick:a,children:o(e.resetLabel)})})]})})},vIe=[{title:"maintenance.db.title.programReset",description:"maintenance.db.desc.programReset",resetLabel:"maintenance.db.button.programReset",target:"program"},{title:"maintenance.db.title.logReset",description:"maintenance.db.desc.logReset",resetLabel:"maintenance.db.button.logReset",target:"log"},{title:"maintenance.db.title.pluginReset",description:"maintenance.db.desc.pluginReset",resetLabel:"maintenance.db.button.pluginReset",target:"plugin"},{title:"maintenance.db.title.fileReset",description:"maintenance.db.desc.fileReset",resetLabel:"maintenance.db.button.fileReset",target:"file"},{title:"maintenance.db.title.amrReset",description:"maintenance.db.desc.amrReset",resetLabel:"maintenance.db.button.amrReset",warningDesc:"maintenance.db.warning.amrReset",service:"amr",target:"amr"},{title:"maintenance.db.title.userReset",description:"maintenance.db.desc.userReset",resetLabel:"maintenance.db.button.userReset",target:"user"},{title:"maintenance.db.title.factoryReset",description:"maintenance.db.desc.factoryReset",resetLabel:"maintenance.db.button.factoryReset",warningDesc:"maintenance.db.warning.factoryReset",target:"all"}],{useMutation:VIn}=await F("@tanstack/react-query"),zIn="reset-db",WIn=async i=>Ut.post(zIn,i),HIn=()=>VIn({mutationFn:async i=>WIn(i)}),{useEffect:$In,useMemo:UIn,useState:jIn}=await F("react"),GIn=({className:i})=>{const{t:e}=q(),{realConnected:t}=Mg(),{coreSwList:n}=Fi();Vi();const{confirmDialog:s}=jn(),o=ie(m=>m.setInitialInfo),{removeQuery:r}=Sp({programId:""},{enabled:!1}),{mutateAsync:a,isPending:l}=HIn(),[c,d]=jIn(t),h=UIn(()=>n?.some(p=>p.be_service==="amr")?vIe:vIe.filter(p=>p.service!=="amr"),[n]),g=(m,f)=>{const p=e("maintenance.modal.content.confirmResetDB").split("\\n");s({title:x(H,{className:"gap-2",alignItems:"center",children:[u(mA,{className:"text-fg-danger"}),u("span",{children:e(f)})]}),content:x(U,{className:"px-4",children:[u("span",{className:"text-fg-default typo-compact-sm-normal whitespace-pre-line",children:p[0]}),p[1]&&x("span",{className:"text-fg-subtle typo-compact-xs-normal mt-2",children:["* ",p[1]]})]}),buttonText:{yes:e("settings.button.settingsReset"),no:e("program.modal.button.cancel")},onConfirm:async()=>{await a({targets:[m]},{onSuccess:()=>{(m==="program"||m==="all")&&(r(),o({beginInfo:null,programInfo:null,subTreeItems:null,treeItems:null},!0)),rt.openToast({title:"Success",content:"Reset successful.",type:"basic",variant:"success"})}})}})};return $In(()=>{setTimeout(()=>{d(t)},t?2e3:0)},[t]),u("div",{className:P("MaintenenceDatabasePage","flex flex-1 flex-col gap-1.5 p-1.5",i),children:u(cs,{className:P("DatabaseCard","flex flex-1 flex-col gap-1.5 overflow-y-auto","[&_.NxCardTitle]:typo-title-01-bold!"),title:e("maintenance.menu.database"),description:e("maintenance.database.desc"),children:c?u(U,{className:"gap-3",children:h.map(m=>u(BIn,{item:m,isPending:l,onResetClick:()=>g(m.target,m.title)},m.title))}):u(U,{className:"h-[35vh]",justifyContent:"center",alignItems:"center",children:u(qm,{className:"text-fg-default size-7"})})})})},{useQuery:qIn}=await F("@tanstack/react-query"),P7="/container/resources",KIn=()=>ODe.get(P7),JIn=()=>qIn({queryKey:[P7],queryFn:KIn}),{useMutation:YIn,useQueryClient:XIn}=await F("@tanstack/react-query"),QIn=i=>ODe.post(P7,i),ZIn=()=>{const i=XIn();return YIn({mutationFn:QIn,onSuccess:e=>{i.setQueryData([P7],e)}})},{useEffect:ekn,useState:tkn}=await F("react"),_v=1073741824,aie=.5,yIe=({label:i,helperText:e,value:t,min:n,max:s,unlimited:o,format:r,onValueChange:a,onUnlimitedChange:l})=>{const{t:c}=q();return u(me,{label:i,helperText:e,children:x(H,{className:"h-9 w-full gap-4",alignItems:"center",children:[u(Ms,{className:"p-0",disabled:o,min:n,max:s,step:aie,value:[o?s:t],onValueChange:d=>a(d[0]??n)}),u("span",{className:P("text-fg-default typo-compact-sm-medium w-36 shrink-0 text-right whitespace-nowrap",o&&"text-fg-subtle"),children:o?c("maintenance.resources.unlimited"):r(t)}),x(H,{className:"shrink-0 gap-2",alignItems:"center",children:[u(tr,{checked:o,onCheckedChange:l}),u("span",{className:"text-fg-default typo-compact-xs-normal",children:c("maintenance.resources.unlimited")})]})]})})},nkn=()=>{const{t:i}=q(),{confirmDialog:e}=jn(),{data:t,isError:n}=JIn(),{mutateAsync:s,isPending:o}=ZIn(),[r,a]=tkn(null),l=t?Math.min(Math.ceil(Math.max(t.minMemoryBytes,(t.memoryUsageBytes??0)+1)/_v*(1/aie))*aie,t.maxMemoryBytes/_v):0,c=t?{cpus:t.cpus??t.maxCpus,cpuUnlimited:t.cpus===null,memoryGiB:t.memoryBytes===null?t.maxMemoryBytes/_v:t.memoryBytes/_v,memoryUnlimited:t.memoryBytes===null}:null;if(ekn(()=>{a(c)},[t]),n)return u(U,{className:"h-[35vh]",justifyContent:"center",alignItems:"center",children:u("span",{className:"text-fg-subtle typo-compact-sm-normal",children:i("common.toast.apiError.content")})});if(!t||!r||!c)return u(U,{className:"h-[35vh]",justifyContent:"center",alignItems:"center",children:u(qm,{className:"text-fg-default size-7"})});const d=JSON.stringify(r)!==JSON.stringify(c),h=()=>{const g=i("maintenance.modal.content.confirmResources").split("\\n");e({title:x(H,{className:"gap-2",alignItems:"center",children:[u(qie,{className:"text-fg-warning"}),u("span",{children:i("maintenance.menu.resources")})]}),content:u(U,{className:"gap-1 px-4",children:g.map(m=>u("span",{className:"text-fg-default typo-compact-sm-normal",children:m},m))}),buttonText:{yes:i("settings.button.save"),no:i("program.modal.button.cancel")},onConfirm:async()=>{await s({cpus:r.cpuUnlimited?null:r.cpus,memoryBytes:r.memoryUnlimited?null:Math.round(r.memoryGiB*_v)})}})};return u("div",{className:P("MaintenanceResourcesPage","flex flex-1 flex-col gap-1.5 p-1.5"),children:u(cs,{className:"[&_.NxCardTitle]:typo-title-01-bold!",title:i("maintenance.menu.resources"),description:i("maintenance.resources.desc"),titleElement:u(la,{size:"xs",confirm:{onClick:h,loading:o,disabled:!d},reset:{onClick:()=>a(c),loading:o,disabled:!d}}),children:x(U,{className:"gap-6",children:[u(yIe,{label:i("maintenance.resources.cpu"),helperText:`${i("maintenance.resources.host")}: ${t.hostCpus} ${i("maintenance.resources.cores")}`,value:r.cpus,min:t.minCpus,max:t.maxCpus,unlimited:r.cpuUnlimited,format:g=>`${g} ${i("maintenance.resources.cores")} (${Math.round(g*100)}%)`,onValueChange:g=>a({...r,cpus:g}),onUnlimitedChange:g=>a({...r,cpuUnlimited:g})}),u(yIe,{label:i("maintenance.resources.memory"),helperText:[t.memoryUsageBytes!==null&&`${i("maintenance.resources.usage")}: ${(t.memoryUsageBytes/_v).toFixed(2)} GiB`,`${i("maintenance.resources.host")}: ${(t.hostMemoryBytes/_v).toFixed(1)} GiB`].filter(Boolean).join(" / "),value:r.memoryGiB,min:l,max:t.maxMemoryBytes/_v,unlimited:r.memoryUnlimited,format:g=>`${g.toFixed(1)} GiB`,onValueChange:g=>a({...r,memoryGiB:g}),onUnlimitedChange:g=>a({...r,memoryUnlimited:g})})]})})})},{useQuery:ikn}=await F("@tanstack/react-query"),lue="/get-log-retention",skn=()=>Ut.get(lue),okn=()=>ikn({queryKey:[lue],queryFn:skn}),{useMutation:rkn,useQueryClient:akn}=await F("@tanstack/react-query"),lkn="/change-log-retention",ckn=i=>Ut.post(lkn,i),dkn=()=>{const i=akn();return rkn({mutationFn:ckn,onSuccess:e=>{i.setQueryData([lue],e)}})},{useEffect:ukn,useState:hkn}=await F("react"),wIe=1,gkn=30,mkn=()=>{const{t:i}=q(),{data:e,isError:t}=okn(),{mutate:n,isPending:s}=dkn(),{confirmDialog:o}=jn(),[r,a]=hkn(null);if(ukn(()=>{e&&a(e.days)},[e]),t)return u(U,{className:"h-[35vh]",justifyContent:"center",alignItems:"center",children:u("span",{className:"text-fg-subtle typo-compact-sm-normal",children:i("common.toast.apiError.content")})});if(!e||r===null)return u(U,{className:"h-[35vh]",justifyContent:"center",alignItems:"center",children:u(qm,{className:"text-fg-default size-7"})});const l=r!==e.days,c=()=>{n({days:r},{onSuccess:h=>{rt.openToast({title:i("maintenance.logRetention.toast.savedTitle"),content:i("maintenance.logRetention.toast.savedContent",{days:h.days}),type:"basic",variant:"success"})}})},d=()=>{if(r>=e.days){c();return}o({title:x(H,{className:"gap-2",alignItems:"center",children:[u(mA,{className:"text-fg-danger"}),u("span",{children:i("maintenance.logRetention.confirm.title")})]}),content:u(U,{className:"px-4",children:u("span",{className:"text-fg-default typo-compact-sm-normal whitespace-pre-line",children:i("maintenance.logRetention.confirm.content",{from:e.days,to:r})})}),buttonText:{yes:i("common.button.confirm"),no:i("program.modal.button.cancel")},onConfirm:c})};return u("div",{className:P("MaintenanceLogPage","flex flex-1 flex-col gap-1.5 p-1.5"),children:u(cs,{className:"[&_.NxCardTitle]:typo-title-01-bold!",title:i("maintenance.menu.logRetention"),description:i("maintenance.logRetention.desc"),titleElement:u(la,{size:"xs",confirm:{onClick:d,loading:s,disabled:!l},reset:{onClick:()=>a(e.days),loading:s,disabled:!l}}),children:u(me,{label:i("maintenance.logRetention.retentionDays"),helperText:i("maintenance.logRetention.retentionRange"),children:x(H,{className:"h-9 w-full gap-4",alignItems:"center",children:[u(Ms,{className:"p-0",min:wIe,max:gkn,step:1,value:[r],onValueChange:h=>a(h[0]??wIe)}),u("span",{className:"text-fg-default typo-compact-sm-medium w-20 shrink-0 text-right whitespace-nowrap",children:i("maintenance.logRetention.days",{days:r})})]})})})})},{useCallback:fkn,useEffect:pkn,useMemo:_kn}=await F("react"),bkn=()=>{const{t:i}=q(),{modal:e}=Vi(),t=ie(k=>k.setInitialInfo),{data:n}=As(),{refetch:s,isFetching:o}=As({enabled:!1}),{data:r}=L2e(),a=_kn(()=>({selectedCategory:n?.modelInfo?.be_service??"",selectedRobotModel:n?.info?.robotModel??"",serialNumber:n?.info?.serialNumber??"",robotName:n?.info?.robotName??""}),[n]),{register:l,handleSubmit:c,setValue:d,watch:h,reset:g,control:m,formState:{errors:f,isDirty:p}}=he({values:a}),_=h("selectedCategory"),b=h("selectedRobotModel"),{data:v}=T2e({beService:_,hiddenPart:!0},{enabled:_!==""}),{mutateAsync:w,isPending:y}=$oe(),S=fkn(async()=>{await e({component:E2e})},[e]),C=(k,L)=>{k==="selectedCategory"&&d("selectedRobotModel",""),d(k,L)},N=async k=>{try{const L=await w({serialNumber:k.serialNumber,robotModel:k.selectedRobotModel,robotName:k.robotName??""});await s();const{program:D,mainSteps:T,subSteps:E,mainTasks:R}=L.programId?await Yk({programId:L.programId}):{program:null,mainSteps:null,subSteps:null,mainTasks:null};D?.programId?t({programInfo:D,treeItems:T,subTreeItems:E,beginInfo:R.reduce((A,M)=>(A[M.taskId]=M.begin,A),{})},!0):t({programInfo:null,treeItems:null,subTreeItems:null,beginInfo:null},!0),rt.openToast({title:"Success",content:"Robot information updated successfully.",variant:"success",type:"basic"})}catch(L){rt.openToast({title:"Error",content:`Failed to update robot information. - ${L}`,variant:"caution",type:"basic"})}};return pkn(()=>{v&&v.length>0&&!b&&d("selectedRobotModel",v[0])},[v,b,d]),u("div",{className:P("MaintenanceRobotInformationPage","flex flex-1 flex-col gap-1.5 p-1.5"),children:u(cs,{className:"[&_.NxCardTitle]:typo-title-01-bold!",title:i("maintenance.title.editRobotInfo"),description:i("maintenance.desc.editRobotInfo"),titleElement:u(la,{size:"xs",confirm:{onClick:c(N),loading:y||o},reset:{onClick:()=>g(a),loading:y||o,disabled:!p}}),children:x(U,{className:"gap-4",children:[x(H,{className:"gap-2",children:[x(U,{className:"w-full gap-1.5",children:[u("h6",{className:"typo-compact-xs-semibold text-fg-default",children:i("dashboard.modal.label.category")}),u(oe,{control:m,name:"selectedCategory",render:({field:k})=>u(ae,{className:"h-10 w-full",value:k.value,handleChange:L=>{k.onChange(L),C("selectedCategory",L)},children:r?.map(L=>u(J,{value:L,children:L.toUpperCase()},L))})})]}),x(U,{className:"w-full gap-1.5",children:[u("h6",{className:"typo-compact-xs-semibold text-fg-default",children:i("dashboard.modal.label.robotModel")}),u(oe,{control:m,name:"selectedRobotModel",render:({field:k})=>u(ae,{className:"h-10 w-full",value:k.value,handleChange:L=>{k.onChange(L)},children:v?.map(L=>u(J,{value:L,children:L.toUpperCase()},L))})})]})]}),r&&_==="amr"&&x(U,{className:"gap-1.5",children:[x("span",{className:"typo-compact-xs-semibold text-fg-default",children:[i("dashboard.modal.label.serialNumber"),f?.serialNumber&&x("span",{className:"text-fg-danger",children:[" ","* ",i("dashboard.modal.msg.serialNumber")]})]}),x(H,{className:"gap-2",children:[u(et,{className:"h-10 w-full",...l("serialNumber",{required:!0,onChange:k=>C("serialNumber",k.target.value)})}),u(se,{className:"h-10 w-20",variant:"outlined","data-pad-focus":"true",onClick:S,children:i("dashboard.modal.button.qrCode")})]})]}),x(U,{className:"gap-1.5",children:[x("span",{className:"typo-compact-xs-semibold text-fg-default",children:[i("dashboard.modal.label.robotName")," (",i("dashboard.modal.label.optional"),")"]}),u(et,{className:"h-10 w-full",...l("robotName",{onChange:k=>C("robotName",k.target.value)})})]})]})})})},dHe=[{meta:{label:"maintenance.menu.robotInfo"},path:"robot-info",element:u(bkn,{})},{meta:{label:"maintenance.menu.authentication"},path:"management",children:[{meta:{label:"maintenance.menu.user"},path:"user",element:u(FIn,{})},{meta:{label:"SDK"},path:"sdk-token",element:u(JNn,{})},{meta:{label:"maintenance.menu.externalPeer"},path:"external-peer",element:u(PNn,{})},{meta:{label:"maintenance.menu.authPolicy"},path:"auth-policy",element:u(hNn,{})}]},{meta:{label:"maintenance.menu.resources"},path:"resources",element:u(nkn,{})},{meta:{label:"maintenance.menu.logRetention"},path:"log",element:u(mkn,{})},{meta:{label:"maintenance.menu.database"},path:"database",element:u(GIn,{})},{meta:{label:"maintenance.menu.update"},path:"update",element:u(eNn,{})}],vkn=({className:i})=>{const{theme:e}=tt();return x(H,{className:P("MaintenancePage","flex size-full overflow-auto",i),children:[u("aside",{className:"h-full w-48 shrink-0",children:u(E7,{routes:dHe})}),u("section",{className:P(e==="light"?"bg-overlay":"bg-alt-1","flex h-full flex-1 flex-col overflow-auto",i),children:u(jk,{})})]})},{useQuery:ykn}=await F("@tanstack/react-query"),uHe="/plugin/{pluginId}/install-count",wkn=({pluginId:i})=>{const e=uHe.replace("{pluginId}",i);return Ut.get(e)},hHe=(i,e)=>ykn({queryKey:[uHe,i],queryFn:()=>wkn(i),...e}),{useMemo:CIe}=await F("react"),Ckn=({className:i,pluginId:e})=>{const{t,currentLanguage:n}=q(),s=ir(),{getAssetUrl:o}=Fu(),{data:r}=As(),{data:a,refetch:l}=cL({pluginId:e}),{data:c}=hHe({pluginId:e}),{refetchPluginInstalledList:d}=Lb({robotModel:r?.info?.robotModel,ui:"toolbar"}),h=CIe(()=>a?{...a,iconUrl:a.icons?o(a.pluginId,uA(a.icons,128)):a.iconUrl}:null,[o,a]),{mutateAsync:g,isPending:m}=Ooe(),{mutateAsync:f,isPending:p}=tHe(),{mutateAsync:_,isPending:b}=Aoe(),v=async()=>{await _({pluginId:e,enabled:!h?.enabled}),d(),l()},w=CIe(()=>h?.installed?m:p,[h?.installed,p,m]),y=async()=>{h?.installed?await g({pluginId:e}):await f({pluginId:e}),d();const{data:S}=await l();S?.description?.en?rt.openToast({variant:"success",title:h?.installed?t("plugin.toast.title.uninstalled"):t("plugin.toast.title.installed"),content:u("p",{children:h?.installed?t("plugin.toast.content.uninstalled",{name:h?.name}):t("plugin.toast.content.installed",{name:h?.name})})}):s(-1)};return x(H,{className:P("PluginDetailHeadInfo",i),justifyContent:"space-between",alignItems:"center",children:[x(H,{className:"gap-3",children:[u("span",{className:"border-border-subtler size-20 rounded-lg border-1",children:u("img",{className:"size-full object-contain object-center",src:h?.iconUrl||yt("nexus/no-image.png"),onError:S=>{S.currentTarget.onerror=null,S.currentTarget.src=yt("nexus/no-image.png")}})}),x(U,{children:[u("h5",{className:"typo-title-03-bold text-fg-default",children:h?.name}),x(H,{className:"gap-3",alignItems:"center",children:[x(H,{className:"text-fg-subtlest gap-1",alignItems:"center",children:[!!h?.company&&u(BDe,{className:P("size-3.5",{"text-fg-brand":MDe(h?.company)})}),u("span",{className:"typo-compact-sm-medium text-fg-subtle",children:h?.company||h?.author})]}),!!h?.architectures&&u(H,{className:"text-fg-subtlest gap-1",alignItems:"center",children:u("span",{className:"typo-compact-xs2-medium text-fg-subtle",children:h?.architectures.join("/")})}),c?.installCount>10&&x(H,{className:"text-fg-subtle gap-1",alignItems:"center",children:[u(zDe,{className:"size-3.5"}),u("span",{className:"typo-compact-xs2-medium",children:Ti(c?.installCount||0)})]})]}),u("p",{className:"text-fg-default-hovered typo-compact-md-semibold mt-1",children:gA(h?.description,n)})]})]}),x(H,{className:"gap-2",children:[h?.installed&&u(se,{size:"sm",variant:"outlined",loading:b,onClick:v,children:h.enabled?t("plugin.button.disable"):t("plugin.button.enable")}),u(se,{size:"sm",variant:h?.installed?"dangerSoft":"solid",loading:w,onClick:y,children:h?.installed?t("plugin.button.uninstall"):t("plugin.button.install")})]})]})},{useQuery:Skn}=await F("@tanstack/react-query"),gHe="/plugin/{pluginId}/logs",xkn=({pluginId:i,...e})=>{const t=gHe.replace("{pluginId}",i);return Ut.get(t,{params:e,skipErrorToast:!0})},Nkn=(i,e)=>Skn({queryKey:[gHe,i],queryFn:()=>xkn(i),enabled:!!i.pluginId,retry:!1,refetchOnWindowFocus:!1,...e}),Ikn=i=>i?Array.isArray(i)?i:[i]:[],kkn=(i,e)=>ls(`common/muscat/plugin/logs/${i}`,{selector:Ikn,disabled:e,disableDuplicateCheck:!0}),Lkn=1e4,Dkn=500,Tkn=2e3,Ekn=1e3,Pkn=/\u001b\[[0-9;?]*[ -/]*[@-~]/g,Rkn=i=>i.replace(Pkn,""),SIe=i=>({...i,line:Rkn(i.line??"")}),xIe=(i,e,t=Lkn,n=Ekn)=>{if(!e.length)return i;const s=i.concat(e);if(s.length<=t)return s;const o=Math.ceil((s.length-t)/n)*n;return s.slice(o)},Mkn=(i,e)=>{if(!i)return null;let t=e.regex?i:i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e.wholeWord&&(t=`\\b(?:${t})\\b`);try{return new RegExp(t,e.matchCase?"g":"gi")}catch{return null}},Akn=(i,e)=>{if(!e)return[];const t=[];return i.forEach((n,s)=>{e.lastIndex=0,e.test(n.line)&&t.push(s)}),t},mHe="????-??-?? ??:??:??.???",Okn=i=>i.map(e=>`${e.ts??mHe} [${e.stream}] ${e.line}`).join(`
1316
- `),{useCallback:hC,useEffect:Uq,useMemo:NIe,useRef:jq,useState:gC}=await F("react"),Fkn={matchCase:!1,wholeWord:!1,regex:!1},Bkn=i=>{const[e,t]=gC([]),[n,s]=gC([]),[o,r]=gC(!1),[a,l]=gC({}),[c,d]=gC(""),[h,g]=gC(Fkn),[m,f]=gC(-1),p=!!(a.from||a.to),_=jq(o);_.current=o;const b=jq(!1),v=Nkn({pluginId:i,limit:p?Tkn:Dkn,fromDate:a.from?.toISOString(),toDate:a.to?.toISOString()});Uq(()=>{v.data&&(t(v.data.items.map(SIe)),s([]),b.current=!0)},[v.data]);const{data:w}=kkn(i,p);Uq(()=>{if(!b.current||!w?.length)return;const O=w.map(SIe);_.current?s(B=>B.concat(O)):t(B=>xIe(B,O))},[w]);const y=hC(()=>r(!0),[]),S=hC(()=>{t(O=>xIe(O,n)),s([]),r(!1)},[n]),C=hC(()=>l({}),[]),N=NIe(()=>Mkn(c,h),[c,h]),k=!!c&&!N,L=NIe(()=>Akn(e,N),[e,N]),D=jq("");Uq(()=>{const O=`${c}|${JSON.stringify(h)}`;D.current!==O?(D.current=O,f(L.length-1)):m>=L.length&&f(L.length-1)},[L,c,h,m]);const T=hC(O=>g(B=>({...B,[O]:!B[O]})),[]),E=hC(()=>{L.length&&f(O=>(O+1)%L.length)},[L.length]),R=hC(()=>{L.length&&f(O=>(O-1+L.length)%L.length)},[L.length]),A=hC(()=>{const O=new Blob([Okn(e)],{type:"text/plain"}),B=URL.createObjectURL(O),z=document.createElement("a");z.href=B,z.download=`${i}-${Cr(Date.now(),"YYYYMMDD-HHmmss")}.txt`,z.click(),URL.revokeObjectURL(B)},[i,e]),M=[...n,...e].reverse().find(O=>O.ts)?.ts;return{lines:e,lastReceivedAt:M,pendingCount:n.length,paused:o,isRange:p,range:a,isLoading:v.isLoading,isError:v.isError,refetch:v.refetch,setRange:l,clearRange:C,pause:y,resume:S,download:A,find:{text:c,options:h,regex:N,error:k,matches:L,active:m,activeLine:L[m]??-1,setText:d,toggleOption:T,next:E,prev:R}}},{useCallback:IIe,useEffect:zT,useRef:Gq,useState:Vkn}=await F("react"),zkn=[{key:"matchCase",label:"Aa",titleKey:"plugin.log.find.matchCase"},{key:"wholeWord",label:u("span",{className:"underline underline-offset-2",children:"ab"}),titleKey:"plugin.log.find.wholeWord"},{key:"regex",label:".*",titleKey:"plugin.log.find.regex"}],kIe=()=>1.5*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16),Wkn=8,Hkn=(i,e,t)=>{if(!e)return i;const n=[];let s=0;for(const o of i.matchAll(e))o[0]&&(n.push(i.slice(s,o.index)),n.push(u("mark",{className:P("text-fg-default rounded-xs",t?"bg-fill-warning":"bg-fill-warning-subtle"),children:o[0]},o.index)),s=o.index+o[0].length);return n.push(i.slice(s)),n},$kn=({className:i,pluginId:e})=>{const{t}=q(),n=Bkn(e),{find:s}=n,o=Gq(null),r=Gq(!0),a=Gq(0),[l,c]=Vkn(0),d=IIe(()=>{const v=o.current;v&&(r.current=!0,v.scrollTop=v.scrollHeight,c(0))},[]),h=()=>{const v=o.current;if(!v)return;const w=v.scrollHeight-v.scrollTop-v.clientHeight<Wkn;r.current=w,w&&c(0)};zT(()=>{const v=o.current,w=v?.firstElementChild;if(!v||!w)return;const y=new ResizeObserver(()=>{r.current&&d()});return y.observe(w),y.observe(v),()=>y.disconnect()},[d,n.isLoading,n.isError]),zT(()=>{if(!r.current)return;const v=requestAnimationFrame(d);return()=>cancelAnimationFrame(v)},[n.lines.length,d]),zT(()=>{n.isRange?(r.current=!1,c(0),o.current&&(o.current.scrollTop=0)):d()},[n.isRange,d]),zT(()=>{const v=n.lines.length-a.current;a.current=n.lines.length,v>0&&!r.current&&c(w=>w+v)},[n.lines.length]),zT(()=>{const v=o.current;if(!v||s.activeLine<0)return;r.current=!1;const w=kIe();v.scrollTop=Math.max(0,s.activeLine*w-v.clientHeight/2+w/2)},[s.activeLine]);const g=()=>{n.resume(),requestAnimationFrame(d)},m=v=>{v.key==="Enter"?(v.preventDefault(),v.shiftKey?s.prev():s.next()):v.key==="Escape"&&s.setText("")},{regex:f,activeLine:p}=s,_=IIe(({item:v,index:w})=>{const y=w===p;return x("div",{className:P("h-6 px-5 leading-6 whitespace-pre",v.stream==="stderr"?"text-fg-danger":"text-fg-default",y&&"bg-fill-brand-subtlest"),children:[u("span",{className:"text-fg-subtle mr-3 select-none",children:v.ts?Cr(v.ts,"YYYY-MM-DD HH:mm:ss.SSS"):mHe}),Hkn(v.line,f,y)]})},[f,p]),b=s.text?s.error?t("plugin.log.find.invalidRegex"):s.matches.length?`${s.active+1} / ${s.matches.length}`:t("plugin.log.find.noResults"):null;return x("div",{className:P("PluginDetailLogContent","border-border-subtle relative mt-4 rounded-xl border",i),children:[x(H,{className:"bg-bg-alt-1 border-border-subtle flex-nowrap gap-3 rounded-t-xl border-b p-4",alignItems:"center",children:[x(H,{className:"border-border-subtle bg-bg-default focus-within:ring-fill-brand h-10 min-w-0 flex-1 basis-0 gap-1 rounded-lg border px-3 focus-within:ring-1",alignItems:"center",children:[u(Vie,{className:"text-fg-subtle size-4 shrink-0"}),u("input",{className:"typo-compact-sm-normal text-fg-default placeholder:text-fg-subtle min-w-0 flex-1 bg-transparent px-1 outline-none",value:s.text,placeholder:t("plugin.log.find.placeholder"),spellCheck:!1,onChange:v=>s.setText(v.target.value),onKeyDown:m}),u("span",{className:P("typo-compact-xs-normal shrink-0 px-1 tabular-nums",s.error||s.text&&!s.matches.length?"text-fg-danger":"text-fg-subtle"),children:b}),zkn.map(v=>u("button",{type:"button",title:t(v.titleKey),className:P("typo-code-xs-semibold h-6 shrink-0 rounded-sm px-1.5 transition-colors",s.options[v.key]?"bg-fill-brand-subtle text-fg-default":"text-fg-subtle hover:bg-fill-subtlest"),onClick:()=>s.toggleOption(v.key),children:v.label},v.key)),x(H,{className:"gap-0.5",children:[u(Yt,{size:"2xs",variant:"transparent",title:t("plugin.log.find.prev"),disabled:!s.matches.length,icon:u(v9,{className:"size-3.5"}),onClick:s.prev}),u(Yt,{size:"2xs",variant:"transparent",title:t("plugin.log.find.next"),disabled:!s.matches.length,icon:u(gB,{className:"size-3.5"}),onClick:s.next}),u(Yt,{size:"2xs",variant:"transparent",disabled:!s.text,icon:u(Nb,{className:"size-3.5"}),onClick:()=>s.setText("")})]})]}),u(CLe,{className:"w-96 shrink-0",size:"md",showFooter:!0,placeholder:t("plugin.log.placeholder.range"),presets:["last-24-hours","last-3-days","last-week"],value:[n.range.from,n.range.to],handleChange:(v,w)=>n.setRange({from:v,to:w})})]}),x(H,{className:"bg-bg-alt-1 border-border-subtle typo-compact-xs-normal text-fg-subtle h-9 gap-2 border-b px-4",alignItems:"center",children:[n.isRange?u("span",{className:"text-fg-default",children:t("plugin.log.status.range")}):x(rn,{children:[u("span",{className:P("size-2.5 rounded-full",n.paused?"bg-fill-subtle":"bg-fill-success")}),u("span",{className:"typo-compact-xs-semibold text-fg-default",children:n.paused?t("plugin.log.status.paused"):t("plugin.log.status.live")}),n.paused&&n.pendingCount>0&&x("span",{children:["· ",t("plugin.log.newLines",{count:n.pendingCount})]})]}),n.lastReceivedAt&&x("span",{children:["·"," ",t("plugin.log.status.lastReceived",{time:Cr(n.lastReceivedAt,"HH:mm:ss")})]}),x(H,{className:"ml-auto gap-1",alignItems:"center",children:[n.isRange?u(se,{size:"2xs",variant:"transparent",leadingIcon:u(FI,{}),onClick:n.clearRange,children:t("plugin.log.button.backToLive")}):u(se,{className:"min-w-20",size:"2xs",variant:"transparent",leadingIcon:n.paused?u(FI,{}):u(aA,{}),onClick:n.paused?g:n.pause,children:n.paused?t("plugin.log.button.resume"):t("plugin.log.button.pause")}),u(se,{size:"2xs",variant:"transparent",disabled:!n.lines.length,leadingIcon:u(Ey,{}),onClick:n.download,children:t("plugin.log.button.download")}),u("span",{className:"ml-2 tabular-nums",children:t("plugin.log.status.lines",{count:n.lines.length})})]})]}),u("div",{ref:o,className:"typo-code-sm-normal bg-bg-default h-[60vh] overflow-auto rounded-b-xl py-3 [overflow-anchor:none]",onScroll:h,children:n.isError?x(U,{className:"text-fg-subtle size-full gap-2",alignItems:"center",justifyContent:"center",children:[u("span",{children:t("plugin.log.error")}),u(se,{size:"xs",variant:"outlined",onClick:()=>n.refetch(),children:t("plugin.log.button.retry")})]}):n.isLoading?u(U,{className:"text-fg-subtle size-full",alignItems:"center",justifyContent:"center",children:u(qm,{className:"size-6"})}):x(rn,{children:[u(FGe,{scrollTarget:o,list:n.lines,itemHeight:kIe,preloadCnt:20,noDataMsg:t("plugin.log.noData"),element:_}),!n.isRange&&u("span",{className:P("bg-fg-default mx-5 inline-block h-4 w-2 align-middle",!n.paused&&"animate-pulse")})]})}),l>0&&u(se,{className:"shadow-down-md absolute right-5 bottom-5",size:"xs",variant:"solid",trailingIcon:u(gB,{}),onClick:d,children:t("plugin.log.newLines",{count:l})})]})},{useQuery:Ukn}=await F("@tanstack/react-query"),fHe="README.md",LIe={responseType:"text",skipErrorToast:!0},jkn=i=>{const[e,t=""]=i.split("#",2),[n,s=""]=e.split("?",2),o=n.split("/");return o[o.length-1]=fHe,`${o.join("/")}${s?`?${s}`:""}${t?`#${t}`:""}`},Gkn=async({url:i})=>{try{return await Ut.get(i,LIe)}catch{return i.split(/[?#]/)[0].endsWith(`/${fHe}`)?void 0:Ut.get(jkn(i),LIe)}},qkn=(i,e)=>Ukn({queryKey:["plugin-readme",i],queryFn:()=>Gkn(i),...e});function Kkn(i,e){const t={};return(i[i.length-1]===""?[...i,""]:i).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const Jkn=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ykn=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xkn={};function DIe(i,e){return(Xkn.jsx?Ykn:Jkn).test(i)}const Qkn=/[ \t\n\f\r]/g;function Zkn(i){return typeof i=="object"?i.type==="text"?TIe(i.value):!1:TIe(i)}function TIe(i){return i.replace(Qkn,"")===""}class T2{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}T2.prototype.normal={};T2.prototype.property={};T2.prototype.space=void 0;function pHe(i,e){const t={},n={};for(const s of i)Object.assign(t,s.property),Object.assign(n,s.normal);return new T2(t,n,e)}function lie(i){return i.toLowerCase()}class Hu{constructor(e,t){this.attribute=t,this.property=e}}Hu.prototype.attribute="";Hu.prototype.booleanish=!1;Hu.prototype.boolean=!1;Hu.prototype.commaOrSpaceSeparated=!1;Hu.prototype.commaSeparated=!1;Hu.prototype.defined=!1;Hu.prototype.mustUseProperty=!1;Hu.prototype.number=!1;Hu.prototype.overloadedBoolean=!1;Hu.prototype.property="";Hu.prototype.spaceSeparated=!1;Hu.prototype.space=void 0;let eLn=0;const ki=fS(),qa=fS(),cie=fS(),Ot=fS(),Xo=fS(),AI=fS(),Ju=fS();function fS(){return 2**++eLn}const die=Object.freeze(Object.defineProperty({__proto__:null,boolean:ki,booleanish:qa,commaOrSpaceSeparated:Ju,commaSeparated:AI,number:Ot,overloadedBoolean:cie,spaceSeparated:Xo},Symbol.toStringTag,{value:"Module"})),qq=Object.keys(die);class cue extends Hu{constructor(e,t,n,s){let o=-1;if(super(e,t),EIe(this,"space",s),typeof n=="number")for(;++o<qq.length;){const r=qq[o];EIe(this,qq[o],(n&die[r])===die[r])}}}cue.prototype.defined=!0;function EIe(i,e,t){t&&(i[e]=t)}function VL(i){const e={},t={};for(const[n,s]of Object.entries(i.properties)){const o=new cue(n,i.transform(i.attributes||{},n),s,i.space);i.mustUseProperty&&i.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),e[n]=o,t[lie(n)]=n,t[lie(o.attribute)]=n}return new T2(e,t,i.space)}const _He=VL({properties:{ariaActiveDescendant:null,ariaAtomic:qa,ariaAutoComplete:null,ariaBusy:qa,ariaChecked:qa,ariaColCount:Ot,ariaColIndex:Ot,ariaColSpan:Ot,ariaControls:Xo,ariaCurrent:null,ariaDescribedBy:Xo,ariaDetails:null,ariaDisabled:qa,ariaDropEffect:Xo,ariaErrorMessage:null,ariaExpanded:qa,ariaFlowTo:Xo,ariaGrabbed:qa,ariaHasPopup:null,ariaHidden:qa,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Xo,ariaLevel:Ot,ariaLive:null,ariaModal:qa,ariaMultiLine:qa,ariaMultiSelectable:qa,ariaOrientation:null,ariaOwns:Xo,ariaPlaceholder:null,ariaPosInSet:Ot,ariaPressed:qa,ariaReadOnly:qa,ariaRelevant:null,ariaRequired:qa,ariaRoleDescription:Xo,ariaRowCount:Ot,ariaRowIndex:Ot,ariaRowSpan:Ot,ariaSelected:qa,ariaSetSize:Ot,ariaSort:null,ariaValueMax:Ot,ariaValueMin:Ot,ariaValueNow:Ot,ariaValueText:null,role:null},transform(i,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function bHe(i,e){return e in i?i[e]:e}function vHe(i,e){return bHe(i,e.toLowerCase())}const tLn=VL({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:AI,acceptCharset:Xo,accessKey:Xo,action:null,allow:null,allowFullScreen:ki,allowPaymentRequest:ki,allowUserMedia:ki,alt:null,as:null,async:ki,autoCapitalize:null,autoComplete:Xo,autoFocus:ki,autoPlay:ki,blocking:Xo,capture:null,charSet:null,checked:ki,cite:null,className:Xo,cols:Ot,colSpan:null,content:null,contentEditable:qa,controls:ki,controlsList:Xo,coords:Ot|AI,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ki,defer:ki,dir:null,dirName:null,disabled:ki,download:cie,draggable:qa,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ki,formTarget:null,headers:Xo,height:Ot,hidden:cie,high:Ot,href:null,hrefLang:null,htmlFor:Xo,httpEquiv:Xo,id:null,imageSizes:null,imageSrcSet:null,inert:ki,inputMode:null,integrity:null,is:null,isMap:ki,itemId:null,itemProp:Xo,itemRef:Xo,itemScope:ki,itemType:Xo,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ki,low:Ot,manifest:null,max:null,maxLength:Ot,media:null,method:null,min:null,minLength:Ot,multiple:ki,muted:ki,name:null,nonce:null,noModule:ki,noValidate:ki,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ki,optimum:Ot,pattern:null,ping:Xo,placeholder:null,playsInline:ki,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ki,referrerPolicy:null,rel:Xo,required:ki,reversed:ki,rows:Ot,rowSpan:Ot,sandbox:Xo,scope:null,scoped:ki,seamless:ki,selected:ki,shadowRootClonable:ki,shadowRootDelegatesFocus:ki,shadowRootMode:null,shape:null,size:Ot,sizes:null,slot:null,span:Ot,spellCheck:qa,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ot,step:null,style:null,tabIndex:Ot,target:null,title:null,translate:null,type:null,typeMustMatch:ki,useMap:null,value:qa,width:Ot,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Xo,axis:null,background:null,bgColor:null,border:Ot,borderColor:null,bottomMargin:Ot,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ki,declare:ki,event:null,face:null,frame:null,frameBorder:null,hSpace:Ot,leftMargin:Ot,link:null,longDesc:null,lowSrc:null,marginHeight:Ot,marginWidth:Ot,noResize:ki,noHref:ki,noShade:ki,noWrap:ki,object:null,profile:null,prompt:null,rev:null,rightMargin:Ot,rules:null,scheme:null,scrolling:qa,standby:null,summary:null,text:null,topMargin:Ot,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ot,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ki,disableRemotePlayback:ki,prefix:null,property:null,results:Ot,security:null,unselectable:null},space:"html",transform:vHe}),nLn=VL({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ju,accentHeight:Ot,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ot,amplitude:Ot,arabicForm:null,ascent:Ot,attributeName:null,attributeType:null,azimuth:Ot,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ot,by:null,calcMode:null,capHeight:Ot,className:Xo,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ot,diffuseConstant:Ot,direction:null,display:null,dur:null,divisor:Ot,dominantBaseline:null,download:ki,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ot,enableBackground:null,end:null,event:null,exponent:Ot,externalResourcesRequired:null,fill:null,fillOpacity:Ot,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:AI,g2:AI,glyphName:AI,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ot,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ot,horizOriginX:Ot,horizOriginY:Ot,id:null,ideographic:Ot,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ot,k:Ot,k1:Ot,k2:Ot,k3:Ot,k4:Ot,kernelMatrix:Ju,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ot,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ot,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ot,overlineThickness:Ot,paintOrder:null,panose1:null,path:null,pathLength:Ot,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Xo,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ot,pointsAtY:Ot,pointsAtZ:Ot,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ju,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ju,rev:Ju,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ju,requiredFeatures:Ju,requiredFonts:Ju,requiredFormats:Ju,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ot,specularExponent:Ot,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ot,strikethroughThickness:Ot,string:null,stroke:null,strokeDashArray:Ju,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ot,strokeOpacity:Ot,strokeWidth:null,style:null,surfaceScale:Ot,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ju,tabIndex:Ot,tableValues:null,target:null,targetX:Ot,targetY:Ot,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ju,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ot,underlineThickness:Ot,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ot,values:null,vAlphabetic:Ot,vMathematical:Ot,vectorEffect:null,vHanging:Ot,vIdeographic:Ot,version:null,vertAdvY:Ot,vertOriginX:Ot,vertOriginY:Ot,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ot,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:bHe}),yHe=VL({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(i,e){return"xlink:"+e.slice(5).toLowerCase()}}),wHe=VL({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vHe}),CHe=VL({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(i,e){return"xml:"+e.slice(3).toLowerCase()}}),iLn={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},sLn=/[A-Z]/g,PIe=/-[a-z]/g,oLn=/^data[-\w.:]+$/i;function rLn(i,e){const t=lie(e);let n=e,s=Hu;if(t in i.normal)return i.property[i.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&oLn.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(PIe,lLn);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!PIe.test(o)){let r=o.replace(sLn,aLn);r.charAt(0)!=="-"&&(r="-"+r),e="data"+r}}s=cue}return new s(n,e)}function aLn(i){return"-"+i.toLowerCase()}function lLn(i){return i.charAt(1).toUpperCase()}const cLn=pHe([_He,tLn,yHe,wHe,CHe],"html"),due=pHe([_He,nLn,yHe,wHe,CHe],"svg");function dLn(i){return i.join(" ").trim()}var Ox={},Kq,RIe;function uLn(){if(RIe)return Kq;RIe=1;var i=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,t=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,r=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
1316
+ `),{useCallback:hC,useEffect:Uq,useMemo:NIe,useRef:jq,useState:gC}=await F("react"),Fkn={matchCase:!1,wholeWord:!1,regex:!1},Bkn=i=>{const[e,t]=gC([]),[n,s]=gC([]),[o,r]=gC(!1),[a,l]=gC({}),[c,d]=gC(""),[h,g]=gC(Fkn),[m,f]=gC(-1),p=!!(a.from||a.to),_=jq(o);_.current=o;const b=jq(!1),v=Nkn({pluginId:i,limit:p?Tkn:Dkn,fromDate:a.from?.toISOString(),toDate:a.to?.toISOString()});Uq(()=>{v.data&&(t(v.data.items.map(SIe)),s([]),b.current=!0)},[v.data]);const{data:w}=kkn(i,p);Uq(()=>{if(!b.current||!w?.length)return;const O=w.map(SIe);_.current?s(B=>B.concat(O)):t(B=>xIe(B,O))},[w]);const y=hC(()=>r(!0),[]),S=hC(()=>{t(O=>xIe(O,n)),s([]),r(!1)},[n]),C=hC(()=>l({}),[]),N=NIe(()=>Mkn(c,h),[c,h]),k=!!c&&!N,L=NIe(()=>Akn(e,N),[e,N]),D=jq("");Uq(()=>{const O=`${c}|${JSON.stringify(h)}`;D.current!==O?(D.current=O,f(L.length-1)):m>=L.length&&f(L.length-1)},[L,c,h,m]);const T=hC(O=>g(B=>({...B,[O]:!B[O]})),[]),E=hC(()=>{L.length&&f(O=>(O+1)%L.length)},[L.length]),R=hC(()=>{L.length&&f(O=>(O-1+L.length)%L.length)},[L.length]),A=hC(()=>{const O=new Blob([Okn(e)],{type:"text/plain"}),B=URL.createObjectURL(O),z=document.createElement("a");z.href=B,z.download=`${i}-${Cr(Date.now(),"YYYYMMDD-HHmmss")}.txt`,z.click(),URL.revokeObjectURL(B)},[i,e]),M=[...n,...e].reverse().find(O=>O.ts)?.ts;return{lines:e,lastReceivedAt:M,pendingCount:n.length,paused:o,isRange:p,range:a,isLoading:v.isLoading,isError:v.isError,refetch:v.refetch,setRange:l,clearRange:C,pause:y,resume:S,download:A,find:{text:c,options:h,regex:N,error:k,matches:L,active:m,activeLine:L[m]??-1,setText:d,toggleOption:T,next:E,prev:R}}},{useCallback:IIe,useEffect:zT,useRef:Gq,useState:Vkn}=await F("react"),zkn=[{key:"matchCase",label:"Aa",titleKey:"plugin.log.find.matchCase"},{key:"wholeWord",label:u("span",{className:"underline underline-offset-2",children:"ab"}),titleKey:"plugin.log.find.wholeWord"},{key:"regex",label:".*",titleKey:"plugin.log.find.regex"}],kIe=()=>1.5*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16),Wkn=8,Hkn=(i,e,t)=>{if(!e)return i;const n=[];let s=0;for(const o of i.matchAll(e))o[0]&&(n.push(i.slice(s,o.index)),n.push(u("mark",{className:P("text-fg-default rounded-xs",t?"bg-fill-warning":"bg-fill-warning-subtle"),children:o[0]},o.index)),s=o.index+o[0].length);return n.push(i.slice(s)),n},$kn=({className:i,pluginId:e})=>{const{t}=q(),n=Bkn(e),{find:s}=n,o=Gq(null),r=Gq(!0),a=Gq(0),[l,c]=Vkn(0),d=IIe(()=>{const v=o.current;v&&(r.current=!0,v.scrollTop=v.scrollHeight,c(0))},[]),h=()=>{const v=o.current;if(!v)return;const w=v.scrollHeight-v.scrollTop-v.clientHeight<Wkn;r.current=w,w&&c(0)};zT(()=>{const v=o.current,w=v?.firstElementChild;if(!v||!w)return;const y=new ResizeObserver(()=>{r.current&&d()});return y.observe(w),y.observe(v),()=>y.disconnect()},[d,n.isLoading,n.isError]),zT(()=>{if(!r.current)return;const v=requestAnimationFrame(d);return()=>cancelAnimationFrame(v)},[n.lines.length,d]),zT(()=>{n.isRange?(r.current=!1,c(0),o.current&&(o.current.scrollTop=0)):d()},[n.isRange,d]),zT(()=>{const v=n.lines.length-a.current;a.current=n.lines.length,v>0&&!r.current&&c(w=>w+v)},[n.lines.length]),zT(()=>{const v=o.current;if(!v||s.activeLine<0)return;r.current=!1;const w=kIe();v.scrollTop=Math.max(0,s.activeLine*w-v.clientHeight/2+w/2)},[s.activeLine]);const g=()=>{n.resume(),requestAnimationFrame(d)},m=v=>{v.key==="Enter"?(v.preventDefault(),v.shiftKey?s.prev():s.next()):v.key==="Escape"&&s.setText("")},{regex:f,activeLine:p}=s,_=IIe(({item:v,index:w})=>{const y=w===p;return x("div",{className:P("h-6 px-5 leading-6 whitespace-pre select-text! [&_*]:select-text!",v.stream==="stderr"?"text-fg-danger":"text-fg-default",y&&"bg-fill-brand-subtlest"),children:[u("span",{className:"text-fg-subtle mr-3",children:v.ts?Cr(v.ts,"YYYY-MM-DD HH:mm:ss.SSS"):mHe}),Hkn(v.line,f,y)]})},[f,p]),b=s.text?s.error?t("plugin.log.find.invalidRegex"):s.matches.length?`${s.active+1} / ${s.matches.length}`:t("plugin.log.find.noResults"):null;return x("div",{className:P("PluginDetailLogContent","border-border-subtle relative mt-4 rounded-xl border",i),children:[x(H,{className:"bg-bg-alt-1 border-border-subtle flex-nowrap gap-3 rounded-t-xl border-b p-4",alignItems:"center",children:[x(H,{className:"border-border-subtle bg-bg-default focus-within:ring-fill-brand h-10 min-w-0 flex-1 basis-0 gap-1 rounded-lg border px-3 focus-within:ring-1",alignItems:"center",children:[u(Vie,{className:"text-fg-subtle size-4 shrink-0"}),u("input",{className:"typo-compact-sm-normal text-fg-default placeholder:text-fg-subtle min-w-0 flex-1 bg-transparent px-1 outline-none",value:s.text,placeholder:t("plugin.log.find.placeholder"),spellCheck:!1,onChange:v=>s.setText(v.target.value),onKeyDown:m}),u("span",{className:P("typo-compact-xs-normal shrink-0 px-1 tabular-nums",s.error||s.text&&!s.matches.length?"text-fg-danger":"text-fg-subtle"),children:b}),zkn.map(v=>u("button",{type:"button",title:t(v.titleKey),className:P("typo-code-xs-semibold h-6 shrink-0 rounded-sm px-1.5 transition-colors",s.options[v.key]?"bg-fill-brand-subtle text-fg-default":"text-fg-subtle hover:bg-fill-subtlest"),onClick:()=>s.toggleOption(v.key),children:v.label},v.key)),x(H,{className:"gap-0.5",children:[u(Yt,{size:"2xs",variant:"transparent",title:t("plugin.log.find.prev"),disabled:!s.matches.length,icon:u(v9,{className:"size-3.5"}),onClick:s.prev}),u(Yt,{size:"2xs",variant:"transparent",title:t("plugin.log.find.next"),disabled:!s.matches.length,icon:u(gB,{className:"size-3.5"}),onClick:s.next}),u(Yt,{size:"2xs",variant:"transparent",disabled:!s.text,icon:u(Nb,{className:"size-3.5"}),onClick:()=>s.setText("")})]})]}),u(CLe,{className:"w-96 shrink-0",size:"md",showFooter:!0,placeholder:t("plugin.log.placeholder.range"),presets:["last-24-hours","last-3-days","last-week"],value:[n.range.from,n.range.to],handleChange:(v,w)=>n.setRange({from:v,to:w})})]}),x(H,{className:"bg-bg-alt-1 border-border-subtle typo-compact-xs-normal text-fg-subtle h-9 gap-2 border-b px-4",alignItems:"center",children:[n.isRange?u("span",{className:"text-fg-default",children:t("plugin.log.status.range")}):x(rn,{children:[u("span",{className:P("size-2.5 rounded-full",n.paused?"bg-fill-subtle":"bg-fill-success")}),u("span",{className:"typo-compact-xs-semibold text-fg-default",children:n.paused?t("plugin.log.status.paused"):t("plugin.log.status.live")}),n.paused&&n.pendingCount>0&&x("span",{children:["· ",t("plugin.log.newLines",{count:n.pendingCount})]})]}),n.lastReceivedAt&&x("span",{children:["·"," ",t("plugin.log.status.lastReceived",{time:Cr(n.lastReceivedAt,"HH:mm:ss")})]}),x(H,{className:"ml-auto gap-1",alignItems:"center",children:[n.isRange?u(se,{size:"2xs",variant:"transparent",leadingIcon:u(FI,{}),onClick:n.clearRange,children:t("plugin.log.button.backToLive")}):u(se,{className:"min-w-20",size:"2xs",variant:"transparent",leadingIcon:n.paused?u(FI,{}):u(aA,{}),onClick:n.paused?g:n.pause,children:n.paused?t("plugin.log.button.resume"):t("plugin.log.button.pause")}),u(se,{size:"2xs",variant:"transparent",disabled:!n.lines.length,leadingIcon:u(Ey,{}),onClick:n.download,children:t("plugin.log.button.download")}),u("span",{className:"ml-2 tabular-nums",children:t("plugin.log.status.lines",{count:n.lines.length})})]})]}),u("div",{ref:o,className:"typo-code-sm-normal bg-bg-default selection:bg-fill-brand-subtler h-[60vh] overflow-auto rounded-b-xl py-3 [overflow-anchor:none]",onScroll:h,children:n.isError?x(U,{className:"text-fg-subtle size-full gap-2",alignItems:"center",justifyContent:"center",children:[u("span",{children:t("plugin.log.error")}),u(se,{size:"xs",variant:"outlined",onClick:()=>n.refetch(),children:t("plugin.log.button.retry")})]}):n.isLoading?u(U,{className:"text-fg-subtle size-full",alignItems:"center",justifyContent:"center",children:u(qm,{className:"size-6"})}):x(rn,{children:[u(FGe,{scrollTarget:o,list:n.lines,itemHeight:kIe,preloadCnt:20,noDataMsg:t("plugin.log.noData"),element:_}),!n.isRange&&u("span",{className:P("bg-fg-default mx-5 inline-block h-4 w-2 align-middle",!n.paused&&"animate-pulse")})]})}),l>0&&u(se,{className:"shadow-down-md absolute right-5 bottom-5",size:"xs",variant:"solid",trailingIcon:u(gB,{}),onClick:d,children:t("plugin.log.newLines",{count:l})})]})},{useQuery:Ukn}=await F("@tanstack/react-query"),fHe="README.md",LIe={responseType:"text",skipErrorToast:!0},jkn=i=>{const[e,t=""]=i.split("#",2),[n,s=""]=e.split("?",2),o=n.split("/");return o[o.length-1]=fHe,`${o.join("/")}${s?`?${s}`:""}${t?`#${t}`:""}`},Gkn=async({url:i})=>{try{return await Ut.get(i,LIe)}catch{return i.split(/[?#]/)[0].endsWith(`/${fHe}`)?void 0:Ut.get(jkn(i),LIe)}},qkn=(i,e)=>Ukn({queryKey:["plugin-readme",i],queryFn:()=>Gkn(i),...e});function Kkn(i,e){const t={};return(i[i.length-1]===""?[...i,""]:i).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const Jkn=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ykn=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xkn={};function DIe(i,e){return(Xkn.jsx?Ykn:Jkn).test(i)}const Qkn=/[ \t\n\f\r]/g;function Zkn(i){return typeof i=="object"?i.type==="text"?TIe(i.value):!1:TIe(i)}function TIe(i){return i.replace(Qkn,"")===""}class T2{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}T2.prototype.normal={};T2.prototype.property={};T2.prototype.space=void 0;function pHe(i,e){const t={},n={};for(const s of i)Object.assign(t,s.property),Object.assign(n,s.normal);return new T2(t,n,e)}function lie(i){return i.toLowerCase()}class Hu{constructor(e,t){this.attribute=t,this.property=e}}Hu.prototype.attribute="";Hu.prototype.booleanish=!1;Hu.prototype.boolean=!1;Hu.prototype.commaOrSpaceSeparated=!1;Hu.prototype.commaSeparated=!1;Hu.prototype.defined=!1;Hu.prototype.mustUseProperty=!1;Hu.prototype.number=!1;Hu.prototype.overloadedBoolean=!1;Hu.prototype.property="";Hu.prototype.spaceSeparated=!1;Hu.prototype.space=void 0;let eLn=0;const ki=fS(),qa=fS(),cie=fS(),Ot=fS(),Xo=fS(),AI=fS(),Ju=fS();function fS(){return 2**++eLn}const die=Object.freeze(Object.defineProperty({__proto__:null,boolean:ki,booleanish:qa,commaOrSpaceSeparated:Ju,commaSeparated:AI,number:Ot,overloadedBoolean:cie,spaceSeparated:Xo},Symbol.toStringTag,{value:"Module"})),qq=Object.keys(die);class cue extends Hu{constructor(e,t,n,s){let o=-1;if(super(e,t),EIe(this,"space",s),typeof n=="number")for(;++o<qq.length;){const r=qq[o];EIe(this,qq[o],(n&die[r])===die[r])}}}cue.prototype.defined=!0;function EIe(i,e,t){t&&(i[e]=t)}function VL(i){const e={},t={};for(const[n,s]of Object.entries(i.properties)){const o=new cue(n,i.transform(i.attributes||{},n),s,i.space);i.mustUseProperty&&i.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),e[n]=o,t[lie(n)]=n,t[lie(o.attribute)]=n}return new T2(e,t,i.space)}const _He=VL({properties:{ariaActiveDescendant:null,ariaAtomic:qa,ariaAutoComplete:null,ariaBusy:qa,ariaChecked:qa,ariaColCount:Ot,ariaColIndex:Ot,ariaColSpan:Ot,ariaControls:Xo,ariaCurrent:null,ariaDescribedBy:Xo,ariaDetails:null,ariaDisabled:qa,ariaDropEffect:Xo,ariaErrorMessage:null,ariaExpanded:qa,ariaFlowTo:Xo,ariaGrabbed:qa,ariaHasPopup:null,ariaHidden:qa,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Xo,ariaLevel:Ot,ariaLive:null,ariaModal:qa,ariaMultiLine:qa,ariaMultiSelectable:qa,ariaOrientation:null,ariaOwns:Xo,ariaPlaceholder:null,ariaPosInSet:Ot,ariaPressed:qa,ariaReadOnly:qa,ariaRelevant:null,ariaRequired:qa,ariaRoleDescription:Xo,ariaRowCount:Ot,ariaRowIndex:Ot,ariaRowSpan:Ot,ariaSelected:qa,ariaSetSize:Ot,ariaSort:null,ariaValueMax:Ot,ariaValueMin:Ot,ariaValueNow:Ot,ariaValueText:null,role:null},transform(i,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function bHe(i,e){return e in i?i[e]:e}function vHe(i,e){return bHe(i,e.toLowerCase())}const tLn=VL({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:AI,acceptCharset:Xo,accessKey:Xo,action:null,allow:null,allowFullScreen:ki,allowPaymentRequest:ki,allowUserMedia:ki,alt:null,as:null,async:ki,autoCapitalize:null,autoComplete:Xo,autoFocus:ki,autoPlay:ki,blocking:Xo,capture:null,charSet:null,checked:ki,cite:null,className:Xo,cols:Ot,colSpan:null,content:null,contentEditable:qa,controls:ki,controlsList:Xo,coords:Ot|AI,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ki,defer:ki,dir:null,dirName:null,disabled:ki,download:cie,draggable:qa,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ki,formTarget:null,headers:Xo,height:Ot,hidden:cie,high:Ot,href:null,hrefLang:null,htmlFor:Xo,httpEquiv:Xo,id:null,imageSizes:null,imageSrcSet:null,inert:ki,inputMode:null,integrity:null,is:null,isMap:ki,itemId:null,itemProp:Xo,itemRef:Xo,itemScope:ki,itemType:Xo,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ki,low:Ot,manifest:null,max:null,maxLength:Ot,media:null,method:null,min:null,minLength:Ot,multiple:ki,muted:ki,name:null,nonce:null,noModule:ki,noValidate:ki,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ki,optimum:Ot,pattern:null,ping:Xo,placeholder:null,playsInline:ki,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ki,referrerPolicy:null,rel:Xo,required:ki,reversed:ki,rows:Ot,rowSpan:Ot,sandbox:Xo,scope:null,scoped:ki,seamless:ki,selected:ki,shadowRootClonable:ki,shadowRootDelegatesFocus:ki,shadowRootMode:null,shape:null,size:Ot,sizes:null,slot:null,span:Ot,spellCheck:qa,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ot,step:null,style:null,tabIndex:Ot,target:null,title:null,translate:null,type:null,typeMustMatch:ki,useMap:null,value:qa,width:Ot,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Xo,axis:null,background:null,bgColor:null,border:Ot,borderColor:null,bottomMargin:Ot,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ki,declare:ki,event:null,face:null,frame:null,frameBorder:null,hSpace:Ot,leftMargin:Ot,link:null,longDesc:null,lowSrc:null,marginHeight:Ot,marginWidth:Ot,noResize:ki,noHref:ki,noShade:ki,noWrap:ki,object:null,profile:null,prompt:null,rev:null,rightMargin:Ot,rules:null,scheme:null,scrolling:qa,standby:null,summary:null,text:null,topMargin:Ot,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ot,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ki,disableRemotePlayback:ki,prefix:null,property:null,results:Ot,security:null,unselectable:null},space:"html",transform:vHe}),nLn=VL({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ju,accentHeight:Ot,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ot,amplitude:Ot,arabicForm:null,ascent:Ot,attributeName:null,attributeType:null,azimuth:Ot,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ot,by:null,calcMode:null,capHeight:Ot,className:Xo,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ot,diffuseConstant:Ot,direction:null,display:null,dur:null,divisor:Ot,dominantBaseline:null,download:ki,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ot,enableBackground:null,end:null,event:null,exponent:Ot,externalResourcesRequired:null,fill:null,fillOpacity:Ot,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:AI,g2:AI,glyphName:AI,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ot,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ot,horizOriginX:Ot,horizOriginY:Ot,id:null,ideographic:Ot,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ot,k:Ot,k1:Ot,k2:Ot,k3:Ot,k4:Ot,kernelMatrix:Ju,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ot,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ot,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ot,overlineThickness:Ot,paintOrder:null,panose1:null,path:null,pathLength:Ot,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Xo,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ot,pointsAtY:Ot,pointsAtZ:Ot,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ju,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ju,rev:Ju,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ju,requiredFeatures:Ju,requiredFonts:Ju,requiredFormats:Ju,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ot,specularExponent:Ot,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ot,strikethroughThickness:Ot,string:null,stroke:null,strokeDashArray:Ju,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ot,strokeOpacity:Ot,strokeWidth:null,style:null,surfaceScale:Ot,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ju,tabIndex:Ot,tableValues:null,target:null,targetX:Ot,targetY:Ot,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ju,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ot,underlineThickness:Ot,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ot,values:null,vAlphabetic:Ot,vMathematical:Ot,vectorEffect:null,vHanging:Ot,vIdeographic:Ot,version:null,vertAdvY:Ot,vertOriginX:Ot,vertOriginY:Ot,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ot,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:bHe}),yHe=VL({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(i,e){return"xlink:"+e.slice(5).toLowerCase()}}),wHe=VL({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vHe}),CHe=VL({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(i,e){return"xml:"+e.slice(3).toLowerCase()}}),iLn={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},sLn=/[A-Z]/g,PIe=/-[a-z]/g,oLn=/^data[-\w.:]+$/i;function rLn(i,e){const t=lie(e);let n=e,s=Hu;if(t in i.normal)return i.property[i.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&oLn.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(PIe,lLn);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!PIe.test(o)){let r=o.replace(sLn,aLn);r.charAt(0)!=="-"&&(r="-"+r),e="data"+r}}s=cue}return new s(n,e)}function aLn(i){return"-"+i.toLowerCase()}function lLn(i){return i.charAt(1).toUpperCase()}const cLn=pHe([_He,tLn,yHe,wHe,CHe],"html"),due=pHe([_He,nLn,yHe,wHe,CHe],"svg");function dLn(i){return i.join(" ").trim()}var Ox={},Kq,RIe;function uLn(){if(RIe)return Kq;RIe=1;var i=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,t=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,r=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
1317
1317
  `,c="/",d="*",h="",g="comment",m="declaration";function f(_,b){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];b=b||{};var v=1,w=1;function y(A){var M=A.match(e);M&&(v+=M.length);var O=A.lastIndexOf(l);w=~O?A.length-O:w+A.length}function S(){var A={line:v,column:w};return function(M){return M.position=new C(A),L(),M}}function C(A){this.start=A,this.end={line:v,column:w},this.source=b.source}C.prototype.content=_;function N(A){var M=new Error(b.source+":"+v+":"+w+": "+A);if(M.reason=A,M.filename=b.source,M.line=v,M.column=w,M.source=_,!b.silent)throw M}function k(A){var M=A.exec(_);if(M){var O=M[0];return y(O),_=_.slice(O.length),M}}function L(){k(t)}function D(A){var M;for(A=A||[];M=T();)M!==!1&&A.push(M);return A}function T(){var A=S();if(!(c!=_.charAt(0)||d!=_.charAt(1))){for(var M=2;h!=_.charAt(M)&&(d!=_.charAt(M)||c!=_.charAt(M+1));)++M;if(M+=2,h===_.charAt(M-1))return N("End of comment missing");var O=_.slice(2,M-2);return w+=2,y(O),_=_.slice(M),w+=2,A({type:g,comment:O})}}function E(){var A=S(),M=k(n);if(M){if(T(),!k(s))return N("property missing ':'");var O=k(o),B=A({type:m,property:p(M[0].replace(i,h)),value:O?p(O[0].replace(i,h)):h});return k(r),B}}function R(){var A=[];D(A);for(var M;M=E();)M!==!1&&(A.push(M),D(A));return A}return L(),R()}function p(_){return _?_.replace(a,h):h}return Kq=f,Kq}var MIe;function hLn(){if(MIe)return Ox;MIe=1;var i=Ox&&Ox.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ox,"__esModule",{value:!0}),Ox.default=t;const e=i(uLn());function t(n,s){let o=null;if(!n||typeof n!="string")return o;const r=(0,e.default)(n),a=typeof s=="function";return r.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:d}=l;a?s(c,d,l):d&&(o=o||{},o[c]=d)}),o}return Ox}var WT={},AIe;function gLn(){if(AIe)return WT;AIe=1,Object.defineProperty(WT,"__esModule",{value:!0}),WT.camelCase=void 0;var i=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,t=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(c){return!c||t.test(c)||i.test(c)},r=function(c,d){return d.toUpperCase()},a=function(c,d){return"".concat(d,"-")},l=function(c,d){return d===void 0&&(d={}),o(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(s,a):c=c.replace(n,a),c.replace(e,r))};return WT.camelCase=l,WT}var HT,OIe;function mLn(){if(OIe)return HT;OIe=1;var i=HT&&HT.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=i(hLn()),t=gLn();function n(s,o){var r={};return!s||typeof s!="string"||(0,e.default)(s,function(a,l){a&&l&&(r[(0,t.camelCase)(a,o)]=l)}),r}return n.default=n,HT=n,HT}var fLn=mLn();const pLn=cA(fLn),SHe=xHe("end"),uue=xHe("start");function xHe(i){return e;function e(t){const n=t&&t.position&&t.position[i]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function _Ln(i){const e=uue(i),t=SHe(i);if(e&&t)return{start:e,end:t}}function qP(i){return!i||typeof i!="object"?"":"position"in i||"type"in i?FIe(i.position):"start"in i||"end"in i?FIe(i):"line"in i||"column"in i?uie(i):""}function uie(i){return BIe(i&&i.line)+":"+BIe(i&&i.column)}function FIe(i){return uie(i&&i.start)+"-"+uie(i&&i.end)}function BIe(i){return i&&typeof i=="number"?i:1}class rd extends Error{constructor(e,t,n){super(),typeof t=="string"&&(n=t,t=void 0);let s="",o={},r=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof e=="string"?s=e:!o.cause&&e&&(r=!0,s=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?o.ruleId=n:(o.source=n.slice(0,l),o.ruleId=n.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=a?a.line:void 0,this.name=qP(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=r&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}rd.prototype.file="";rd.prototype.name="";rd.prototype.reason="";rd.prototype.message="";rd.prototype.stack="";rd.prototype.column=void 0;rd.prototype.line=void 0;rd.prototype.ancestors=void 0;rd.prototype.cause=void 0;rd.prototype.fatal=void 0;rd.prototype.place=void 0;rd.prototype.ruleId=void 0;rd.prototype.source=void 0;const hue={}.hasOwnProperty,bLn=new Map,vLn=/[A-Z]/g,yLn=new Set(["table","tbody","thead","tfoot","tr"]),wLn=new Set(["td","th"]),NHe="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function CLn(i,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=e.filePath||void 0;let n;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=TLn(t,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=DLn(t,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:n,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?due:cLn,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},o=IHe(s,i,void 0);return o&&typeof o!="string"?o:s.create(i,s.Fragment,{children:o||void 0},void 0)}function IHe(i,e,t){if(e.type==="element")return SLn(i,e,t);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return xLn(i,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return ILn(i,e,t);if(e.type==="mdxjsEsm")return NLn(i,e);if(e.type==="root")return kLn(i,e,t);if(e.type==="text")return LLn(i,e)}function SLn(i,e,t){const n=i.schema;let s=n;e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(s=due,i.schema=s),i.ancestors.push(e);const o=LHe(i,e.tagName,!1),r=ELn(i,e);let a=mue(i,e);return yLn.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Zkn(l):!0})),kHe(i,r,o,e),gue(r,a),i.ancestors.pop(),i.schema=n,i.create(e,o,r,t)}function xLn(i,e){if(e.data&&e.data.estree&&i.evaluater){const n=e.data.estree.body[0];return n.type,i.evaluater.evaluateExpression(n.expression)}tA(i,e.position)}function NLn(i,e){if(e.data&&e.data.estree&&i.evaluater)return i.evaluater.evaluateProgram(e.data.estree);tA(i,e.position)}function ILn(i,e,t){const n=i.schema;let s=n;e.name==="svg"&&n.space==="html"&&(s=due,i.schema=s),i.ancestors.push(e);const o=e.name===null?i.Fragment:LHe(i,e.name,!0),r=PLn(i,e),a=mue(i,e);return kHe(i,r,o,e),gue(r,a),i.ancestors.pop(),i.schema=n,i.create(e,o,r,t)}function kLn(i,e,t){const n={};return gue(n,mue(i,e)),i.create(e,i.Fragment,n,t)}function LLn(i,e){return e.value}function kHe(i,e,t,n){typeof t!="string"&&t!==i.Fragment&&i.passNode&&(e.node=n)}function gue(i,e){if(e.length>0){const t=e.length>1?e:e[0];t&&(i.children=t)}}function DLn(i,e,t){return n;function n(s,o,r,a){const c=Array.isArray(r.children)?t:e;return a?c(o,r,a):c(o,r)}}function TLn(i,e){return t;function t(n,s,o,r){const a=Array.isArray(o.children),l=uue(n);return e(s,o,r,a,{columnNumber:l?l.column-1:void 0,fileName:i,lineNumber:l?l.line:void 0},void 0)}}function ELn(i,e){const t={};let n,s;for(s in e.properties)if(s!=="children"&&hue.call(e.properties,s)){const o=RLn(i,s,e.properties[s]);if(o){const[r,a]=o;i.tableCellAlignToStyle&&r==="align"&&typeof a=="string"&&wLn.has(e.tagName)?n=a:t[r]=a}}if(n){const o=t.style||(t.style={});o[i.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return t}function PLn(i,e){const t={};for(const n of e.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&i.evaluater){const o=n.data.estree.body[0];o.type;const r=o.expression;r.type;const a=r.properties[0];a.type,Object.assign(t,i.evaluater.evaluateExpression(a.argument))}else tA(i,e.position);else{const s=n.name;let o;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&i.evaluater){const a=n.value.data.estree.body[0];a.type,o=i.evaluater.evaluateExpression(a.expression)}else tA(i,e.position);else o=n.value===null?!0:n.value;t[s]=o}return t}function mue(i,e){const t=[];let n=-1;const s=i.passKeys?new Map:bLn;for(;++n<e.children.length;){const o=e.children[n];let r;if(i.passKeys){const l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){const c=s.get(l)||0;r=l+"-"+c,s.set(l,c+1)}}const a=IHe(i,o,r);a!==void 0&&t.push(a)}return t}function RLn(i,e,t){const n=rLn(i.schema,e);if(!(t==null||typeof t=="number"&&Number.isNaN(t))){if(Array.isArray(t)&&(t=n.commaSeparated?Kkn(t):dLn(t)),n.property==="style"){let s=typeof t=="object"?t:MLn(i,String(t));return i.stylePropertyNameCase==="css"&&(s=ALn(s)),["style",s]}return[i.elementAttributeNameCase==="react"&&n.space?iLn[n.property]||n.property:n.attribute,t]}}function MLn(i,e){try{return pLn(e,{reactCompat:!0})}catch(t){if(i.ignoreInvalidStyle)return{};const n=t,s=new rd("Cannot parse `style` attribute",{ancestors:i.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=i.filePath||void 0,s.url=NHe+"#cannot-parse-style-attribute",s}}function LHe(i,e,t){let n;if(!t)n={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let o=-1,r;for(;++o<s.length;){const a=DIe(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};r=r?{type:"MemberExpression",object:r,property:a,computed:!!(o&&a.type==="Literal"),optional:!1}:a}n=r}else n=DIe(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(n.type==="Literal"){const s=n.value;return hue.call(i.components,s)?i.components[s]:s}if(i.evaluater)return i.evaluater.evaluateExpression(n);tA(i)}function tA(i,e){const t=new rd("Cannot handle MDX estrees without `createEvaluater`",{ancestors:i.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw t.file=i.filePath||void 0,t.url=NHe+"#cannot-handle-mdx-estrees-without-createevaluater",t}function ALn(i){const e={};let t;for(t in i)hue.call(i,t)&&(e[OLn(t)]=i[t]);return e}function OLn(i){let e=i.replace(vLn,FLn);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function FLn(i){return"-"+i.toLowerCase()}const Jq={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},BLn={};function fue(i,e){const t=BLn,n=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,s=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return DHe(i,n,s)}function DHe(i,e,t){if(VLn(i)){if("value"in i)return i.type==="html"&&!t?"":i.value;if(e&&"alt"in i&&i.alt)return i.alt;if("children"in i)return VIe(i.children,e,t)}return Array.isArray(i)?VIe(i,e,t):""}function VIe(i,e,t){const n=[];let s=-1;for(;++s<i.length;)n[s]=DHe(i[s],e,t);return n.join("")}function VLn(i){return!!(i&&typeof i=="object")}const zIe=document.createElement("i");function pue(i){const e="&"+i+";";zIe.innerHTML=e;const t=zIe.textContent;return t.charCodeAt(t.length-1)===59&&i!=="semi"||t===e?!1:t}function Sh(i,e,t,n){const s=i.length;let o=0,r;if(e<0?e=-e>s?0:s+e:e=e>s?s:e,t=t>0?t:0,n.length<1e4)r=Array.from(n),r.unshift(e,t),i.splice(...r);else for(t&&i.splice(e,t);o<n.length;)r=n.slice(o,o+1e4),r.unshift(e,0),i.splice(...r),o+=1e4,e+=1e4}function pg(i,e){return i.length>0?(Sh(i,i.length,0,e),i):e}const WIe={}.hasOwnProperty;function THe(i){const e={};let t=-1;for(;++t<i.length;)zLn(e,i[t]);return e}function zLn(i,e){let t;for(t in e){const s=(WIe.call(i,t)?i[t]:void 0)||(i[t]={}),o=e[t];let r;if(o)for(r in o){WIe.call(s,r)||(s[r]=[]);const a=o[r];WLn(s[r],Array.isArray(a)?a:a?[a]:[])}}}function WLn(i,e){let t=-1;const n=[];for(;++t<e.length;)(e[t].add==="after"?i:n).push(e[t]);Sh(i,0,0,n)}function EHe(i,e){const t=Number.parseInt(i,e);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function Rm(i){return i.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Cd=Sw(/[A-Za-z]/),Gc=Sw(/[\dA-Za-z]/),HLn=Sw(/[#-'*+\--9=?A-Z^-~]/);function r9(i){return i!==null&&(i<32||i===127)}const hie=Sw(/\d/),$Ln=Sw(/[\dA-Fa-f]/),ULn=Sw(/[!-/:-@[-`{-~]/);function Un(i){return i!==null&&i<-2}function Wo(i){return i!==null&&(i<0||i===32)}function ji(i){return i===-2||i===-1||i===32}const R7=Sw(/\p{P}|\p{S}/u),V1=Sw(/\s/);function Sw(i){return e;function e(t){return t!==null&&t>-1&&i.test(String.fromCharCode(t))}}function zL(i){const e=[];let t=-1,n=0,s=0;for(;++t<i.length;){const o=i.charCodeAt(t);let r="";if(o===37&&Gc(i.charCodeAt(t+1))&&Gc(i.charCodeAt(t+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(r=String.fromCharCode(o));else if(o>55295&&o<57344){const a=i.charCodeAt(t+1);o<56320&&a>56319&&a<57344?(r=String.fromCharCode(o,a),s=1):r="�"}else r=String.fromCharCode(o);r&&(e.push(i.slice(n,t),encodeURIComponent(r)),n=t+s+1,r=""),s&&(t+=s,s=0)}return e.join("")+i.slice(n)}function ps(i,e,t,n){const s=n?n-1:Number.POSITIVE_INFINITY;let o=0;return r;function r(l){return ji(l)?(i.enter(t),a(l)):e(l)}function a(l){return ji(l)&&o++<s?(i.consume(l),a):(i.exit(t),e(l))}}const jLn={tokenize:GLn};function GLn(i){const e=i.attempt(this.parser.constructs.contentInitial,n,s);let t;return e;function n(a){if(a===null){i.consume(a);return}return i.enter("lineEnding"),i.consume(a),i.exit("lineEnding"),ps(i,e,"linePrefix")}function s(a){return i.enter("paragraph"),o(a)}function o(a){const l=i.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=l),t=l,r(a)}function r(a){if(a===null){i.exit("chunkText"),i.exit("paragraph"),i.consume(a);return}return Un(a)?(i.consume(a),i.exit("chunkText"),o):(i.consume(a),r)}}const qLn={tokenize:KLn},HIe={tokenize:JLn};function KLn(i){const e=this,t=[];let n=0,s,o,r;return a;function a(w){if(n<t.length){const y=t[n];return e.containerState=y[1],i.attempt(y[0].continuation,l,c)(w)}return c(w)}function l(w){if(n++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&v();const y=e.events.length;let S=y,C;for(;S--;)if(e.events[S][0]==="exit"&&e.events[S][1].type==="chunkFlow"){C=e.events[S][1].end;break}b(n);let N=y;for(;N<e.events.length;)e.events[N][1].end={...C},N++;return Sh(e.events,S+1,0,e.events.slice(y)),e.events.length=N,c(w)}return a(w)}function c(w){if(n===t.length){if(!s)return g(w);if(s.currentConstruct&&s.currentConstruct.concrete)return f(w);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},i.check(HIe,d,h)(w)}function d(w){return s&&v(),b(n),g(w)}function h(w){return e.parser.lazy[e.now().line]=n!==t.length,r=e.now().offset,f(w)}function g(w){return e.containerState={},i.attempt(HIe,m,f)(w)}function m(w){return n++,t.push([e.currentConstruct,e.containerState]),g(w)}function f(w){if(w===null){s&&v(),b(0),i.consume(w);return}return s=s||e.parser.flow(e.now()),i.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),p(w)}function p(w){if(w===null){_(i.exit("chunkFlow"),!0),b(0),i.consume(w);return}return Un(w)?(i.consume(w),_(i.exit("chunkFlow")),n=0,e.interrupt=void 0,a):(i.consume(w),p)}function _(w,y){const S=e.sliceStream(w);if(y&&S.push(null),w.previous=o,o&&(o.next=w),o=w,s.defineSkip(w.start),s.write(S),e.parser.lazy[w.start.line]){let C=s.events.length;for(;C--;)if(s.events[C][1].start.offset<r&&(!s.events[C][1].end||s.events[C][1].end.offset>r))return;const N=e.events.length;let k=N,L,D;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){if(L){D=e.events[k][1].end;break}L=!0}for(b(n),C=N;C<e.events.length;)e.events[C][1].end={...D},C++;Sh(e.events,k+1,0,e.events.slice(N)),e.events.length=C}}function b(w){let y=t.length;for(;y-- >w;){const S=t[y];e.containerState=S[1],S[0].exit.call(e,i)}t.length=w}function v(){s.write([null]),o=void 0,s=void 0,e.containerState._closeFlow=void 0}}function JLn(i,e,t){return ps(i,i.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function zk(i){if(i===null||Wo(i)||V1(i))return 1;if(R7(i))return 2}function M7(i,e,t){const n=[];let s=-1;for(;++s<i.length;){const o=i[s].resolveAll;o&&!n.includes(o)&&(e=o(e,t),n.push(o))}return e}const gie={name:"attention",resolveAll:YLn,tokenize:XLn};function YLn(i,e){let t=-1,n,s,o,r,a,l,c,d;for(;++t<i.length;)if(i[t][0]==="enter"&&i[t][1].type==="attentionSequence"&&i[t][1]._close){for(n=t;n--;)if(i[n][0]==="exit"&&i[n][1].type==="attentionSequence"&&i[n][1]._open&&e.sliceSerialize(i[n][1]).charCodeAt(0)===e.sliceSerialize(i[t][1]).charCodeAt(0)){if((i[n][1]._close||i[t][1]._open)&&(i[t][1].end.offset-i[t][1].start.offset)%3&&!((i[n][1].end.offset-i[n][1].start.offset+i[t][1].end.offset-i[t][1].start.offset)%3))continue;l=i[n][1].end.offset-i[n][1].start.offset>1&&i[t][1].end.offset-i[t][1].start.offset>1?2:1;const h={...i[n][1].end},g={...i[t][1].start};$Ie(h,-l),$Ie(g,l),r={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...i[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...i[t][1].start},end:g},o={type:l>1?"strongText":"emphasisText",start:{...i[n][1].end},end:{...i[t][1].start}},s={type:l>1?"strong":"emphasis",start:{...r.start},end:{...a.end}},i[n][1].end={...r.start},i[t][1].start={...a.end},c=[],i[n][1].end.offset-i[n][1].start.offset&&(c=pg(c,[["enter",i[n][1],e],["exit",i[n][1],e]])),c=pg(c,[["enter",s,e],["enter",r,e],["exit",r,e],["enter",o,e]]),c=pg(c,M7(e.parser.constructs.insideSpan.null,i.slice(n+1,t),e)),c=pg(c,[["exit",o,e],["enter",a,e],["exit",a,e],["exit",s,e]]),i[t][1].end.offset-i[t][1].start.offset?(d=2,c=pg(c,[["enter",i[t][1],e],["exit",i[t][1],e]])):d=0,Sh(i,n-1,t-n+3,c),t=n+c.length-d-2;break}}for(t=-1;++t<i.length;)i[t][1].type==="attentionSequence"&&(i[t][1].type="data");return i}function XLn(i,e){const t=this.parser.constructs.attentionMarkers.null,n=this.previous,s=zk(n);let o;return r;function r(l){return o=l,i.enter("attentionSequence"),a(l)}function a(l){if(l===o)return i.consume(l),a;const c=i.exit("attentionSequence"),d=zk(l),h=!d||d===2&&s||t.includes(l),g=!s||s===2&&d||t.includes(n);return c._open=!!(o===42?h:h&&(s||!g)),c._close=!!(o===42?g:g&&(d||!h)),e(l)}}function $Ie(i,e){i.column+=e,i.offset+=e,i._bufferIndex+=e}const QLn={name:"autolink",tokenize:ZLn};function ZLn(i,e,t){let n=0;return s;function s(m){return i.enter("autolink"),i.enter("autolinkMarker"),i.consume(m),i.exit("autolinkMarker"),i.enter("autolinkProtocol"),o}function o(m){return Cd(m)?(i.consume(m),r):m===64?t(m):c(m)}function r(m){return m===43||m===45||m===46||Gc(m)?(n=1,a(m)):c(m)}function a(m){return m===58?(i.consume(m),n=0,l):(m===43||m===45||m===46||Gc(m))&&n++<32?(i.consume(m),a):(n=0,c(m))}function l(m){return m===62?(i.exit("autolinkProtocol"),i.enter("autolinkMarker"),i.consume(m),i.exit("autolinkMarker"),i.exit("autolink"),e):m===null||m===32||m===60||r9(m)?t(m):(i.consume(m),l)}function c(m){return m===64?(i.consume(m),d):HLn(m)?(i.consume(m),c):t(m)}function d(m){return Gc(m)?h(m):t(m)}function h(m){return m===46?(i.consume(m),n=0,d):m===62?(i.exit("autolinkProtocol").type="autolinkEmail",i.enter("autolinkMarker"),i.consume(m),i.exit("autolinkMarker"),i.exit("autolink"),e):g(m)}function g(m){if((m===45||Gc(m))&&n++<63){const f=m===45?g:h;return i.consume(m),f}return t(m)}}const E2={partial:!0,tokenize:eDn};function eDn(i,e,t){return n;function n(o){return ji(o)?ps(i,s,"linePrefix")(o):s(o)}function s(o){return o===null||Un(o)?e(o):t(o)}}const PHe={continuation:{tokenize:nDn},exit:iDn,name:"blockQuote",tokenize:tDn};function tDn(i,e,t){const n=this;return s;function s(r){if(r===62){const a=n.containerState;return a.open||(i.enter("blockQuote",{_container:!0}),a.open=!0),i.enter("blockQuotePrefix"),i.enter("blockQuoteMarker"),i.consume(r),i.exit("blockQuoteMarker"),o}return t(r)}function o(r){return ji(r)?(i.enter("blockQuotePrefixWhitespace"),i.consume(r),i.exit("blockQuotePrefixWhitespace"),i.exit("blockQuotePrefix"),e):(i.exit("blockQuotePrefix"),e(r))}}function nDn(i,e,t){const n=this;return s;function s(r){return ji(r)?ps(i,o,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(r):o(r)}function o(r){return i.attempt(PHe,e,t)(r)}}function iDn(i){i.exit("blockQuote")}const RHe={name:"characterEscape",tokenize:sDn};function sDn(i,e,t){return n;function n(o){return i.enter("characterEscape"),i.enter("escapeMarker"),i.consume(o),i.exit("escapeMarker"),s}function s(o){return ULn(o)?(i.enter("characterEscapeValue"),i.consume(o),i.exit("characterEscapeValue"),i.exit("characterEscape"),e):t(o)}}const MHe={name:"characterReference",tokenize:oDn};function oDn(i,e,t){const n=this;let s=0,o,r;return a;function a(h){return i.enter("characterReference"),i.enter("characterReferenceMarker"),i.consume(h),i.exit("characterReferenceMarker"),l}function l(h){return h===35?(i.enter("characterReferenceMarkerNumeric"),i.consume(h),i.exit("characterReferenceMarkerNumeric"),c):(i.enter("characterReferenceValue"),o=31,r=Gc,d(h))}function c(h){return h===88||h===120?(i.enter("characterReferenceMarkerHexadecimal"),i.consume(h),i.exit("characterReferenceMarkerHexadecimal"),i.enter("characterReferenceValue"),o=6,r=$Ln,d):(i.enter("characterReferenceValue"),o=7,r=hie,d(h))}function d(h){if(h===59&&s){const g=i.exit("characterReferenceValue");return r===Gc&&!pue(n.sliceSerialize(g))?t(h):(i.enter("characterReferenceMarker"),i.consume(h),i.exit("characterReferenceMarker"),i.exit("characterReference"),e)}return r(h)&&s++<o?(i.consume(h),d):t(h)}}const UIe={partial:!0,tokenize:aDn},jIe={concrete:!0,name:"codeFenced",tokenize:rDn};function rDn(i,e,t){const n=this,s={partial:!0,tokenize:S};let o=0,r=0,a;return l;function l(C){return c(C)}function c(C){const N=n.events[n.events.length-1];return o=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=C,i.enter("codeFenced"),i.enter("codeFencedFence"),i.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===a?(r++,i.consume(C),d):r<3?t(C):(i.exit("codeFencedFenceSequence"),ji(C)?ps(i,h,"whitespace")(C):h(C))}function h(C){return C===null||Un(C)?(i.exit("codeFencedFence"),n.interrupt?e(C):i.check(UIe,p,y)(C)):(i.enter("codeFencedFenceInfo"),i.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||Un(C)?(i.exit("chunkString"),i.exit("codeFencedFenceInfo"),h(C)):ji(C)?(i.exit("chunkString"),i.exit("codeFencedFenceInfo"),ps(i,m,"whitespace")(C)):C===96&&C===a?t(C):(i.consume(C),g)}function m(C){return C===null||Un(C)?h(C):(i.enter("codeFencedFenceMeta"),i.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||Un(C)?(i.exit("chunkString"),i.exit("codeFencedFenceMeta"),h(C)):C===96&&C===a?t(C):(i.consume(C),f)}function p(C){return i.attempt(s,y,_)(C)}function _(C){return i.enter("lineEnding"),i.consume(C),i.exit("lineEnding"),b}function b(C){return o>0&&ji(C)?ps(i,v,"linePrefix",o+1)(C):v(C)}function v(C){return C===null||Un(C)?i.check(UIe,p,y)(C):(i.enter("codeFlowValue"),w(C))}function w(C){return C===null||Un(C)?(i.exit("codeFlowValue"),v(C)):(i.consume(C),w)}function y(C){return i.exit("codeFenced"),e(C)}function S(C,N,k){let L=0;return D;function D(M){return C.enter("lineEnding"),C.consume(M),C.exit("lineEnding"),T}function T(M){return C.enter("codeFencedFence"),ji(M)?ps(C,E,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):E(M)}function E(M){return M===a?(C.enter("codeFencedFenceSequence"),R(M)):k(M)}function R(M){return M===a?(L++,C.consume(M),R):L>=r?(C.exit("codeFencedFenceSequence"),ji(M)?ps(C,A,"whitespace")(M):A(M)):k(M)}function A(M){return M===null||Un(M)?(C.exit("codeFencedFence"),N(M)):k(M)}}}function aDn(i,e,t){const n=this;return s;function s(r){return r===null?t(r):(i.enter("lineEnding"),i.consume(r),i.exit("lineEnding"),o)}function o(r){return n.parser.lazy[n.now().line]?t(r):e(r)}}const Yq={name:"codeIndented",tokenize:cDn},lDn={partial:!0,tokenize:dDn};function cDn(i,e,t){const n=this;return s;function s(c){return i.enter("codeIndented"),ps(i,o,"linePrefix",5)(c)}function o(c){const d=n.events[n.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?r(c):t(c)}function r(c){return c===null?l(c):Un(c)?i.attempt(lDn,r,l)(c):(i.enter("codeFlowValue"),a(c))}function a(c){return c===null||Un(c)?(i.exit("codeFlowValue"),r(c)):(i.consume(c),a)}function l(c){return i.exit("codeIndented"),e(c)}}function dDn(i,e,t){const n=this;return s;function s(r){return n.parser.lazy[n.now().line]?t(r):Un(r)?(i.enter("lineEnding"),i.consume(r),i.exit("lineEnding"),s):ps(i,o,"linePrefix",5)(r)}function o(r){const a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(r):Un(r)?s(r):t(r)}}const uDn={name:"codeText",previous:gDn,resolve:hDn,tokenize:mDn};function hDn(i){let e=i.length-4,t=3,n,s;if((i[t][1].type==="lineEnding"||i[t][1].type==="space")&&(i[e][1].type==="lineEnding"||i[e][1].type==="space")){for(n=t;++n<e;)if(i[n][1].type==="codeTextData"){i[t][1].type="codeTextPadding",i[e][1].type="codeTextPadding",t+=2,e-=2;break}}for(n=t-1,e++;++n<=e;)s===void 0?n!==e&&i[n][1].type!=="lineEnding"&&(s=n):(n===e||i[n][1].type==="lineEnding")&&(i[s][1].type="codeTextData",n!==s+2&&(i[s][1].end=i[n-1][1].end,i.splice(s+2,n-s-2),e-=n-s-2,n=s+2),s=void 0);return i}function gDn(i){return i!==96||this.events[this.events.length-1][1].type==="characterEscape"}function mDn(i,e,t){let n=0,s,o;return r;function r(h){return i.enter("codeText"),i.enter("codeTextSequence"),a(h)}function a(h){return h===96?(i.consume(h),n++,a):(i.exit("codeTextSequence"),l(h))}function l(h){return h===null?t(h):h===32?(i.enter("space"),i.consume(h),i.exit("space"),l):h===96?(o=i.enter("codeTextSequence"),s=0,d(h)):Un(h)?(i.enter("lineEnding"),i.consume(h),i.exit("lineEnding"),l):(i.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||Un(h)?(i.exit("codeTextData"),l(h)):(i.consume(h),c)}function d(h){return h===96?(i.consume(h),s++,d):s===n?(i.exit("codeTextSequence"),i.exit("codeText"),e(h)):(o.type="codeTextData",c(h))}}class fDn{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const n=t??Number.POSITIVE_INFINITY;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const s=t||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return n&&$T(this.left,n),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),$T(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),$T(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);$T(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);$T(this.left,t.reverse())}}}function $T(i,e){let t=0;if(e.length<1e4)i.push(...e);else for(;t<e.length;)i.push(...e.slice(t,t+1e4)),t+=1e4}function AHe(i){const e={};let t=-1,n,s,o,r,a,l,c;const d=new fDn(i);for(;++t<d.length;){for(;t in e;)t=e[t];if(n=d.get(t),t&&n[1].type==="chunkFlow"&&d.get(t-1)[1].type==="listItemPrefix"&&(l=n[1]._tokenizer.events,o=0,o<l.length&&l[o][1].type==="lineEndingBlank"&&(o+=2),o<l.length&&l[o][1].type==="content"))for(;++o<l.length&&l[o][1].type!=="content";)l[o][1].type==="chunkText"&&(l[o][1]._isInFirstContentOfListItem=!0,o++);if(n[0]==="enter")n[1].contentType&&(Object.assign(e,pDn(d,t)),t=e[t],c=!0);else if(n[1]._container){for(o=t,s=void 0;o--;)if(r=d.get(o),r[1].type==="lineEnding"||r[1].type==="lineEndingBlank")r[0]==="enter"&&(s&&(d.get(s)[1].type="lineEndingBlank"),r[1].type="lineEnding",s=o);else if(!(r[1].type==="linePrefix"||r[1].type==="listItemIndent"))break;s&&(n[1].end={...d.get(s)[1].start},a=d.slice(s,t),a.unshift(n),d.splice(s,t-s+1,a))}}return Sh(i,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function pDn(i,e){const t=i.get(e)[1],n=i.get(e)[2];let s=e-1;const o=[];let r=t._tokenizer;r||(r=n.parser[t.contentType](t.start),t._contentTypeTextTrailing&&(r._contentTypeTextTrailing=!0));const a=r.events,l=[],c={};let d,h,g=-1,m=t,f=0,p=0;const _=[p];for(;m;){for(;i.get(++s)[1]!==m;);o.push(s),m._tokenizer||(d=n.sliceStream(m),m.next||d.push(null),h&&r.defineSkip(m.start),m._isInFirstContentOfListItem&&(r._gfmTasklistFirstContentOfListItem=!0),r.write(d),m._isInFirstContentOfListItem&&(r._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=t;++g<a.length;)a[g][0]==="exit"&&a[g-1][0]==="enter"&&a[g][1].type===a[g-1][1].type&&a[g][1].start.line!==a[g][1].end.line&&(p=g+1,_.push(p),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(r.events=[],m?(m._tokenizer=void 0,m.previous=void 0):_.pop(),g=_.length;g--;){const b=a.slice(_[g],_[g+1]),v=o.pop();l.push([v,v+b.length-1]),i.splice(v,2,b)}for(l.reverse(),g=-1;++g<l.length;)c[f+l[g][0]]=f+l[g][1],f+=l[g][1]-l[g][0]-1;return c}const _Dn={resolve:vDn,tokenize:yDn},bDn={partial:!0,tokenize:wDn};function vDn(i){return AHe(i),i}function yDn(i,e){let t;return n;function n(a){return i.enter("content"),t=i.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?o(a):Un(a)?i.check(bDn,r,o)(a):(i.consume(a),s)}function o(a){return i.exit("chunkContent"),i.exit("content"),e(a)}function r(a){return i.consume(a),i.exit("chunkContent"),t.next=i.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,s}}function wDn(i,e,t){const n=this;return s;function s(r){return i.exit("chunkContent"),i.enter("lineEnding"),i.consume(r),i.exit("lineEnding"),ps(i,o,"linePrefix")}function o(r){if(r===null||Un(r))return t(r);const a=n.events[n.events.length-1];return!n.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(r):i.interrupt(n.parser.constructs.flow,t,e)(r)}}function OHe(i,e,t,n,s,o,r,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(b){return b===60?(i.enter(n),i.enter(s),i.enter(o),i.consume(b),i.exit(o),g):b===null||b===32||b===41||r9(b)?t(b):(i.enter(n),i.enter(r),i.enter(a),i.enter("chunkString",{contentType:"string"}),p(b))}function g(b){return b===62?(i.enter(o),i.consume(b),i.exit(o),i.exit(s),i.exit(n),e):(i.enter(a),i.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===62?(i.exit("chunkString"),i.exit(a),g(b)):b===null||b===60||Un(b)?t(b):(i.consume(b),b===92?f:m)}function f(b){return b===60||b===62||b===92?(i.consume(b),m):m(b)}function p(b){return!d&&(b===null||b===41||Wo(b))?(i.exit("chunkString"),i.exit(a),i.exit(r),i.exit(n),e(b)):d<c&&b===40?(i.consume(b),d++,p):b===41?(i.consume(b),d--,p):b===null||b===32||b===40||r9(b)?t(b):(i.consume(b),b===92?_:p)}function _(b){return b===40||b===41||b===92?(i.consume(b),p):p(b)}}function FHe(i,e,t,n,s,o){const r=this;let a=0,l;return c;function c(m){return i.enter(n),i.enter(s),i.consume(m),i.exit(s),i.enter(o),d}function d(m){return a>999||m===null||m===91||m===93&&!l||m===94&&!a&&"_hiddenFootnoteSupport"in r.parser.constructs?t(m):m===93?(i.exit(o),i.enter(s),i.consume(m),i.exit(s),i.exit(n),e):Un(m)?(i.enter("lineEnding"),i.consume(m),i.exit("lineEnding"),d):(i.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||Un(m)||a++>999?(i.exit("chunkString"),d(m)):(i.consume(m),l||(l=!ji(m)),m===92?g:h)}function g(m){return m===91||m===92||m===93?(i.consume(m),a++,h):h(m)}}function BHe(i,e,t,n,s,o){let r;return a;function a(g){return g===34||g===39||g===40?(i.enter(n),i.enter(s),i.consume(g),i.exit(s),r=g===40?41:g,l):t(g)}function l(g){return g===r?(i.enter(s),i.consume(g),i.exit(s),i.exit(n),e):(i.enter(o),c(g))}function c(g){return g===r?(i.exit(o),l(r)):g===null?t(g):Un(g)?(i.enter("lineEnding"),i.consume(g),i.exit("lineEnding"),ps(i,c,"linePrefix")):(i.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===r||g===null||Un(g)?(i.exit("chunkString"),c(g)):(i.consume(g),g===92?h:d)}function h(g){return g===r||g===92?(i.consume(g),d):d(g)}}function KP(i,e){let t;return n;function n(s){return Un(s)?(i.enter("lineEnding"),i.consume(s),i.exit("lineEnding"),t=!0,n):ji(s)?ps(i,n,t?"linePrefix":"lineSuffix")(s):e(s)}}const CDn={name:"definition",tokenize:xDn},SDn={partial:!0,tokenize:NDn};function xDn(i,e,t){const n=this;let s;return o;function o(m){return i.enter("definition"),r(m)}function r(m){return FHe.call(n,i,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function a(m){return s=Rm(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),m===58?(i.enter("definitionMarker"),i.consume(m),i.exit("definitionMarker"),l):t(m)}function l(m){return Wo(m)?KP(i,c)(m):c(m)}function c(m){return OHe(i,d,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return i.attempt(SDn,h,h)(m)}function h(m){return ji(m)?ps(i,g,"whitespace")(m):g(m)}function g(m){return m===null||Un(m)?(i.exit("definition"),n.parser.defined.push(s),e(m)):t(m)}}function NDn(i,e,t){return n;function n(a){return Wo(a)?KP(i,s)(a):t(a)}function s(a){return BHe(i,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return ji(a)?ps(i,r,"whitespace")(a):r(a)}function r(a){return a===null||Un(a)?e(a):t(a)}}const IDn={name:"hardBreakEscape",tokenize:kDn};function kDn(i,e,t){return n;function n(o){return i.enter("hardBreakEscape"),i.consume(o),s}function s(o){return Un(o)?(i.exit("hardBreakEscape"),e(o)):t(o)}}const LDn={name:"headingAtx",resolve:DDn,tokenize:TDn};function DDn(i,e){let t=i.length-2,n=3,s,o;return i[n][1].type==="whitespace"&&(n+=2),t-2>n&&i[t][1].type==="whitespace"&&(t-=2),i[t][1].type==="atxHeadingSequence"&&(n===t-1||t-4>n&&i[t-2][1].type==="whitespace")&&(t-=n+1===t?2:4),t>n&&(s={type:"atxHeadingText",start:i[n][1].start,end:i[t][1].end},o={type:"chunkText",start:i[n][1].start,end:i[t][1].end,contentType:"text"},Sh(i,n,t-n+1,[["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e]])),i}function TDn(i,e,t){let n=0;return s;function s(d){return i.enter("atxHeading"),o(d)}function o(d){return i.enter("atxHeadingSequence"),r(d)}function r(d){return d===35&&n++<6?(i.consume(d),r):d===null||Wo(d)?(i.exit("atxHeadingSequence"),a(d)):t(d)}function a(d){return d===35?(i.enter("atxHeadingSequence"),l(d)):d===null||Un(d)?(i.exit("atxHeading"),e(d)):ji(d)?ps(i,a,"whitespace")(d):(i.enter("atxHeadingText"),c(d))}function l(d){return d===35?(i.consume(d),l):(i.exit("atxHeadingSequence"),a(d))}function c(d){return d===null||d===35||Wo(d)?(i.exit("atxHeadingText"),a(d)):(i.consume(d),c)}}const EDn=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],GIe=["pre","script","style","textarea"],PDn={concrete:!0,name:"htmlFlow",resolveTo:ADn,tokenize:ODn},RDn={partial:!0,tokenize:BDn},MDn={partial:!0,tokenize:FDn};function ADn(i){let e=i.length;for(;e--&&!(i[e][0]==="enter"&&i[e][1].type==="htmlFlow"););return e>1&&i[e-2][1].type==="linePrefix"&&(i[e][1].start=i[e-2][1].start,i[e+1][1].start=i[e-2][1].start,i.splice(e-2,2)),i}function ODn(i,e,t){const n=this;let s,o,r,a,l;return c;function c(V){return d(V)}function d(V){return i.enter("htmlFlow"),i.enter("htmlFlowData"),i.consume(V),h}function h(V){return V===33?(i.consume(V),g):V===47?(i.consume(V),o=!0,p):V===63?(i.consume(V),s=3,n.interrupt?e:$):Cd(V)?(i.consume(V),r=String.fromCharCode(V),_):t(V)}function g(V){return V===45?(i.consume(V),s=2,m):V===91?(i.consume(V),s=5,a=0,f):Cd(V)?(i.consume(V),s=4,n.interrupt?e:$):t(V)}function m(V){return V===45?(i.consume(V),n.interrupt?e:$):t(V)}function f(V){const fe="CDATA[";return V===fe.charCodeAt(a++)?(i.consume(V),a===fe.length?n.interrupt?e:E:f):t(V)}function p(V){return Cd(V)?(i.consume(V),r=String.fromCharCode(V),_):t(V)}function _(V){if(V===null||V===47||V===62||Wo(V)){const fe=V===47,Q=r.toLowerCase();return!fe&&!o&&GIe.includes(Q)?(s=1,n.interrupt?e(V):E(V)):EDn.includes(r.toLowerCase())?(s=6,fe?(i.consume(V),b):n.interrupt?e(V):E(V)):(s=7,n.interrupt&&!n.parser.lazy[n.now().line]?t(V):o?v(V):w(V))}return V===45||Gc(V)?(i.consume(V),r+=String.fromCharCode(V),_):t(V)}function b(V){return V===62?(i.consume(V),n.interrupt?e:E):t(V)}function v(V){return ji(V)?(i.consume(V),v):D(V)}function w(V){return V===47?(i.consume(V),D):V===58||V===95||Cd(V)?(i.consume(V),y):ji(V)?(i.consume(V),w):D(V)}function y(V){return V===45||V===46||V===58||V===95||Gc(V)?(i.consume(V),y):S(V)}function S(V){return V===61?(i.consume(V),C):ji(V)?(i.consume(V),S):w(V)}function C(V){return V===null||V===60||V===61||V===62||V===96?t(V):V===34||V===39?(i.consume(V),l=V,N):ji(V)?(i.consume(V),C):k(V)}function N(V){return V===l?(i.consume(V),l=null,L):V===null||Un(V)?t(V):(i.consume(V),N)}function k(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||Wo(V)?S(V):(i.consume(V),k)}function L(V){return V===47||V===62||ji(V)?w(V):t(V)}function D(V){return V===62?(i.consume(V),T):t(V)}function T(V){return V===null||Un(V)?E(V):ji(V)?(i.consume(V),T):t(V)}function E(V){return V===45&&s===2?(i.consume(V),O):V===60&&s===1?(i.consume(V),B):V===62&&s===4?(i.consume(V),Z):V===63&&s===3?(i.consume(V),$):V===93&&s===5?(i.consume(V),Y):Un(V)&&(s===6||s===7)?(i.exit("htmlFlowData"),i.check(RDn,K,R)(V)):V===null||Un(V)?(i.exit("htmlFlowData"),R(V)):(i.consume(V),E)}function R(V){return i.check(MDn,A,K)(V)}function A(V){return i.enter("lineEnding"),i.consume(V),i.exit("lineEnding"),M}function M(V){return V===null||Un(V)?R(V):(i.enter("htmlFlowData"),E(V))}function O(V){return V===45?(i.consume(V),$):E(V)}function B(V){return V===47?(i.consume(V),r="",z):E(V)}function z(V){if(V===62){const fe=r.toLowerCase();return GIe.includes(fe)?(i.consume(V),Z):E(V)}return Cd(V)&&r.length<8?(i.consume(V),r+=String.fromCharCode(V),z):E(V)}function Y(V){return V===93?(i.consume(V),$):E(V)}function $(V){return V===62?(i.consume(V),Z):V===45&&s===2?(i.consume(V),$):E(V)}function Z(V){return V===null||Un(V)?(i.exit("htmlFlowData"),K(V)):(i.consume(V),Z)}function K(V){return i.exit("htmlFlow"),e(V)}}function FDn(i,e,t){const n=this;return s;function s(r){return Un(r)?(i.enter("lineEnding"),i.consume(r),i.exit("lineEnding"),o):t(r)}function o(r){return n.parser.lazy[n.now().line]?t(r):e(r)}}function BDn(i,e,t){return n;function n(s){return i.enter("lineEnding"),i.consume(s),i.exit("lineEnding"),i.attempt(E2,e,t)}}const VDn={name:"htmlText",tokenize:zDn};function zDn(i,e,t){const n=this;let s,o,r;return a;function a($){return i.enter("htmlText"),i.enter("htmlTextData"),i.consume($),l}function l($){return $===33?(i.consume($),c):$===47?(i.consume($),S):$===63?(i.consume($),w):Cd($)?(i.consume($),k):t($)}function c($){return $===45?(i.consume($),d):$===91?(i.consume($),o=0,f):Cd($)?(i.consume($),v):t($)}function d($){return $===45?(i.consume($),m):t($)}function h($){return $===null?t($):$===45?(i.consume($),g):Un($)?(r=h,B($)):(i.consume($),h)}function g($){return $===45?(i.consume($),m):h($)}function m($){return $===62?O($):$===45?g($):h($)}function f($){const Z="CDATA[";return $===Z.charCodeAt(o++)?(i.consume($),o===Z.length?p:f):t($)}function p($){return $===null?t($):$===93?(i.consume($),_):Un($)?(r=p,B($)):(i.consume($),p)}function _($){return $===93?(i.consume($),b):p($)}function b($){return $===62?O($):$===93?(i.consume($),b):p($)}function v($){return $===null||$===62?O($):Un($)?(r=v,B($)):(i.consume($),v)}function w($){return $===null?t($):$===63?(i.consume($),y):Un($)?(r=w,B($)):(i.consume($),w)}function y($){return $===62?O($):w($)}function S($){return Cd($)?(i.consume($),C):t($)}function C($){return $===45||Gc($)?(i.consume($),C):N($)}function N($){return Un($)?(r=N,B($)):ji($)?(i.consume($),N):O($)}function k($){return $===45||Gc($)?(i.consume($),k):$===47||$===62||Wo($)?L($):t($)}function L($){return $===47?(i.consume($),O):$===58||$===95||Cd($)?(i.consume($),D):Un($)?(r=L,B($)):ji($)?(i.consume($),L):O($)}function D($){return $===45||$===46||$===58||$===95||Gc($)?(i.consume($),D):T($)}function T($){return $===61?(i.consume($),E):Un($)?(r=T,B($)):ji($)?(i.consume($),T):L($)}function E($){return $===null||$===60||$===61||$===62||$===96?t($):$===34||$===39?(i.consume($),s=$,R):Un($)?(r=E,B($)):ji($)?(i.consume($),E):(i.consume($),A)}function R($){return $===s?(i.consume($),s=void 0,M):$===null?t($):Un($)?(r=R,B($)):(i.consume($),R)}function A($){return $===null||$===34||$===39||$===60||$===61||$===96?t($):$===47||$===62||Wo($)?L($):(i.consume($),A)}function M($){return $===47||$===62||Wo($)?L($):t($)}function O($){return $===62?(i.consume($),i.exit("htmlTextData"),i.exit("htmlText"),e):t($)}function B($){return i.exit("htmlTextData"),i.enter("lineEnding"),i.consume($),i.exit("lineEnding"),z}function z($){return ji($)?ps(i,Y,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):Y($)}function Y($){return i.enter("htmlTextData"),r($)}}const _ue={name:"labelEnd",resolveAll:UDn,resolveTo:jDn,tokenize:GDn},WDn={tokenize:qDn},HDn={tokenize:KDn},$Dn={tokenize:JDn};function UDn(i){let e=-1;const t=[];for(;++e<i.length;){const n=i[e][1];if(t.push(i[e]),n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd"){const s=n.type==="labelImage"?4:2;n.type="data",e+=s}}return i.length!==t.length&&Sh(i,0,i.length,t),i}function jDn(i,e){let t=i.length,n=0,s,o,r,a;for(;t--;)if(s=i[t][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;i[t][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(r){if(i[t][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=t,s.type!=="labelLink")){n=2;break}}else s.type==="labelEnd"&&(r=t);const l={type:i[o][1].type==="labelLink"?"link":"image",start:{...i[o][1].start},end:{...i[i.length-1][1].end}},c={type:"label",start:{...i[o][1].start},end:{...i[r][1].end}},d={type:"labelText",start:{...i[o+n+2][1].end},end:{...i[r-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=pg(a,i.slice(o+1,o+n+3)),a=pg(a,[["enter",d,e]]),a=pg(a,M7(e.parser.constructs.insideSpan.null,i.slice(o+n+4,r-3),e)),a=pg(a,[["exit",d,e],i[r-2],i[r-1],["exit",c,e]]),a=pg(a,i.slice(r+1)),a=pg(a,[["exit",l,e]]),Sh(i,o,i.length,a),i}function GDn(i,e,t){const n=this;let s=n.events.length,o,r;for(;s--;)if((n.events[s][1].type==="labelImage"||n.events[s][1].type==="labelLink")&&!n.events[s][1]._balanced){o=n.events[s][1];break}return a;function a(g){return o?o._inactive?h(g):(r=n.parser.defined.includes(Rm(n.sliceSerialize({start:o.end,end:n.now()}))),i.enter("labelEnd"),i.enter("labelMarker"),i.consume(g),i.exit("labelMarker"),i.exit("labelEnd"),l):t(g)}function l(g){return g===40?i.attempt(WDn,d,r?d:h)(g):g===91?i.attempt(HDn,d,r?c:h)(g):r?d(g):h(g)}function c(g){return i.attempt($Dn,d,h)(g)}function d(g){return e(g)}function h(g){return o._balanced=!0,t(g)}}function qDn(i,e,t){return n;function n(h){return i.enter("resource"),i.enter("resourceMarker"),i.consume(h),i.exit("resourceMarker"),s}function s(h){return Wo(h)?KP(i,o)(h):o(h)}function o(h){return h===41?d(h):OHe(i,r,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function r(h){return Wo(h)?KP(i,l)(h):d(h)}function a(h){return t(h)}function l(h){return h===34||h===39||h===40?BHe(i,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return Wo(h)?KP(i,d)(h):d(h)}function d(h){return h===41?(i.enter("resourceMarker"),i.consume(h),i.exit("resourceMarker"),i.exit("resource"),e):t(h)}}function KDn(i,e,t){const n=this;return s;function s(a){return FHe.call(n,i,o,r,"reference","referenceMarker","referenceString")(a)}function o(a){return n.parser.defined.includes(Rm(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?e(a):t(a)}function r(a){return t(a)}}function JDn(i,e,t){return n;function n(o){return i.enter("reference"),i.enter("referenceMarker"),i.consume(o),i.exit("referenceMarker"),s}function s(o){return o===93?(i.enter("referenceMarker"),i.consume(o),i.exit("referenceMarker"),i.exit("reference"),e):t(o)}}const YDn={name:"labelStartImage",resolveAll:_ue.resolveAll,tokenize:XDn};function XDn(i,e,t){const n=this;return s;function s(a){return i.enter("labelImage"),i.enter("labelImageMarker"),i.consume(a),i.exit("labelImageMarker"),o}function o(a){return a===91?(i.enter("labelMarker"),i.consume(a),i.exit("labelMarker"),i.exit("labelImage"),r):t(a)}function r(a){return a===94&&"_hiddenFootnoteSupport"in n.parser.constructs?t(a):e(a)}}const QDn={name:"labelStartLink",resolveAll:_ue.resolveAll,tokenize:ZDn};function ZDn(i,e,t){const n=this;return s;function s(r){return i.enter("labelLink"),i.enter("labelMarker"),i.consume(r),i.exit("labelMarker"),i.exit("labelLink"),o}function o(r){return r===94&&"_hiddenFootnoteSupport"in n.parser.constructs?t(r):e(r)}}const Xq={name:"lineEnding",tokenize:eTn};function eTn(i,e){return t;function t(n){return i.enter("lineEnding"),i.consume(n),i.exit("lineEnding"),ps(i,e,"linePrefix")}}const aB={name:"thematicBreak",tokenize:tTn};function tTn(i,e,t){let n=0,s;return o;function o(c){return i.enter("thematicBreak"),r(c)}function r(c){return s=c,a(c)}function a(c){return c===s?(i.enter("thematicBreakSequence"),l(c)):n>=3&&(c===null||Un(c))?(i.exit("thematicBreak"),e(c)):t(c)}function l(c){return c===s?(i.consume(c),n++,l):(i.exit("thematicBreakSequence"),ji(c)?ps(i,a,"whitespace")(c):a(c))}}const nu={continuation:{tokenize:oTn},exit:aTn,name:"list",tokenize:sTn},nTn={partial:!0,tokenize:lTn},iTn={partial:!0,tokenize:rTn};function sTn(i,e,t){const n=this,s=n.events[n.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,r=0;return a;function a(m){const f=n.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(f==="listUnordered"?!n.containerState.marker||m===n.containerState.marker:hie(m)){if(n.containerState.type||(n.containerState.type=f,i.enter(f,{_container:!0})),f==="listUnordered")return i.enter("listItemPrefix"),m===42||m===45?i.check(aB,t,c)(m):c(m);if(!n.interrupt||m===49)return i.enter("listItemPrefix"),i.enter("listItemValue"),l(m)}return t(m)}function l(m){return hie(m)&&++r<10?(i.consume(m),l):(!n.interrupt||r<2)&&(n.containerState.marker?m===n.containerState.marker:m===41||m===46)?(i.exit("listItemValue"),c(m)):t(m)}function c(m){return i.enter("listItemMarker"),i.consume(m),i.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||m,i.check(E2,n.interrupt?t:d,i.attempt(nTn,g,h))}function d(m){return n.containerState.initialBlankLine=!0,o++,g(m)}function h(m){return ji(m)?(i.enter("listItemPrefixWhitespace"),i.consume(m),i.exit("listItemPrefixWhitespace"),g):t(m)}function g(m){return n.containerState.size=o+n.sliceSerialize(i.exit("listItemPrefix"),!0).length,e(m)}}function oTn(i,e,t){const n=this;return n.containerState._closeFlow=void 0,i.check(E2,s,o);function s(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,ps(i,e,"listItemIndent",n.containerState.size+1)(a)}function o(a){return n.containerState.furtherBlankLines||!ji(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,r(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,i.attempt(iTn,e,r)(a))}function r(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,ps(i,i.attempt(nu,e,t),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function rTn(i,e,t){const n=this;return ps(i,s,"listItemIndent",n.containerState.size+1);function s(o){const r=n.events[n.events.length-1];return r&&r[1].type==="listItemIndent"&&r[2].sliceSerialize(r[1],!0).length===n.containerState.size?e(o):t(o)}}function aTn(i){i.exit(this.containerState.type)}function lTn(i,e,t){const n=this;return ps(i,s,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const r=n.events[n.events.length-1];return!ji(o)&&r&&r[1].type==="listItemPrefixWhitespace"?e(o):t(o)}}const qIe={name:"setextUnderline",resolveTo:cTn,tokenize:dTn};function cTn(i,e){let t=i.length,n,s,o;for(;t--;)if(i[t][0]==="enter"){if(i[t][1].type==="content"){n=t;break}i[t][1].type==="paragraph"&&(s=t)}else i[t][1].type==="content"&&i.splice(t,1),!o&&i[t][1].type==="definition"&&(o=t);const r={type:"setextHeading",start:{...i[n][1].start},end:{...i[i.length-1][1].end}};return i[s][1].type="setextHeadingText",o?(i.splice(s,0,["enter",r,e]),i.splice(o+1,0,["exit",i[n][1],e]),i[n][1].end={...i[o][1].end}):i[n][1]=r,i.push(["exit",r,e]),i}function dTn(i,e,t){const n=this;let s;return o;function o(c){let d=n.events.length,h;for(;d--;)if(n.events[d][1].type!=="lineEnding"&&n.events[d][1].type!=="linePrefix"&&n.events[d][1].type!=="content"){h=n.events[d][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||h)?(i.enter("setextHeadingLine"),s=c,r(c)):t(c)}function r(c){return i.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(i.consume(c),a):(i.exit("setextHeadingLineSequence"),ji(c)?ps(i,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Un(c)?(i.exit("setextHeadingLine"),e(c)):t(c)}}const uTn={tokenize:hTn};function hTn(i){const e=this,t=i.attempt(E2,n,i.attempt(this.parser.constructs.flowInitial,s,ps(i,i.attempt(this.parser.constructs.flow,s,i.attempt(_Dn,s)),"linePrefix")));return t;function n(o){if(o===null){i.consume(o);return}return i.enter("lineEndingBlank"),i.consume(o),i.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function s(o){if(o===null){i.consume(o);return}return i.enter("lineEnding"),i.consume(o),i.exit("lineEnding"),e.currentConstruct=void 0,t}}const gTn={resolveAll:zHe()},mTn=VHe("string"),fTn=VHe("text");function VHe(i){return{resolveAll:zHe(i==="text"?pTn:void 0),tokenize:e};function e(t){const n=this,s=this.parser.constructs[i],o=t.attempt(s,r,a);return r;function r(d){return c(d)?o(d):a(d)}function a(d){if(d===null){t.consume(d);return}return t.enter("data"),t.consume(d),l}function l(d){return c(d)?(t.exit("data"),o(d)):(t.consume(d),l)}function c(d){if(d===null)return!0;const h=s[d];let g=-1;if(h)for(;++g<h.length;){const m=h[g];if(!m.previous||m.previous.call(n,n.previous))return!0}return!1}}}function zHe(i){return e;function e(t,n){let s=-1,o;for(;++s<=t.length;)o===void 0?t[s]&&t[s][1].type==="data"&&(o=s,s++):(!t[s]||t[s][1].type!=="data")&&(s!==o+2&&(t[o][1].end=t[s-1][1].end,t.splice(o+2,s-o-2),s=o+2),o=void 0);return i?i(t,n):t}}function pTn(i,e){let t=0;for(;++t<=i.length;)if((t===i.length||i[t][1].type==="lineEnding")&&i[t-1][1].type==="data"){const n=i[t-1][1],s=e.sliceStream(n);let o=s.length,r=-1,a=0,l;for(;o--;){const c=s[o];if(typeof c=="string"){for(r=c.length;c.charCodeAt(r-1)===32;)a++,r--;if(r)break;r=-1}else if(c===-2)l=!0,a++;else if(c!==-1){o++;break}}if(e._contentTypeTextTrailing&&t===i.length&&(a=0),a){const c={type:t===i.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?r:n.start._bufferIndex+r,_index:n.start._index+o,line:n.end.line,column:n.end.column-a,offset:n.end.offset-a},end:{...n.end}};n.end={...c.start},n.start.offset===n.end.offset?Object.assign(n,c):(i.splice(t,0,["enter",c,e],["exit",c,e]),t+=2)}t++}return i}const _Tn={42:nu,43:nu,45:nu,48:nu,49:nu,50:nu,51:nu,52:nu,53:nu,54:nu,55:nu,56:nu,57:nu,62:PHe},bTn={91:CDn},vTn={[-2]:Yq,[-1]:Yq,32:Yq},yTn={35:LDn,42:aB,45:[qIe,aB],60:PDn,61:qIe,95:aB,96:jIe,126:jIe},wTn={38:MHe,92:RHe},CTn={[-5]:Xq,[-4]:Xq,[-3]:Xq,33:YDn,38:MHe,42:gie,60:[QLn,VDn],91:QDn,92:[IDn,RHe],93:_ue,95:gie,96:uDn},STn={null:[gie,gTn]},xTn={null:[42,95]},NTn={null:[]},ITn=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:xTn,contentInitial:bTn,disable:NTn,document:_Tn,flow:yTn,flowInitial:vTn,insideSpan:STn,string:wTn,text:CTn},Symbol.toStringTag,{value:"Module"}));function kTn(i,e,t){let n={_bufferIndex:-1,_index:0,line:t&&t.line||1,column:t&&t.column||1,offset:t&&t.offset||0};const s={},o=[];let r=[],a=[];const l={attempt:N(S),check:N(C),consume:v,enter:w,exit:y,interrupt:N(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:p,events:[],now:f,parser:i,previous:null,sliceSerialize:g,sliceStream:m,write:h};let d=e.tokenize.call(c,l);return e.resolveAll&&o.push(e),c;function h(T){return r=pg(r,T),_(),r[r.length-1]!==null?[]:(k(e,0),c.events=M7(o,c.events,c),c.events)}function g(T,E){return DTn(m(T),E)}function m(T){return LTn(r,T)}function f(){const{_bufferIndex:T,_index:E,line:R,column:A,offset:M}=n;return{_bufferIndex:T,_index:E,line:R,column:A,offset:M}}function p(T){s[T.line]=T.column,D()}function _(){let T;for(;n._index<r.length;){const E=r[n._index];if(typeof E=="string")for(T=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===T&&n._bufferIndex<E.length;)b(E.charCodeAt(n._bufferIndex));else b(E)}}function b(T){d=d(T)}function v(T){Un(T)?(n.line++,n.column=1,n.offset+=T===-3?2:1,D()):T!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===r[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=T}function w(T,E){const R=E||{};return R.type=T,R.start=f(),c.events.push(["enter",R,c]),a.push(R),R}function y(T){const E=a.pop();return E.end=f(),c.events.push(["exit",E,c]),E}function S(T,E){k(T,E.from)}function C(T,E){E.restore()}function N(T,E){return R;function R(A,M,O){let B,z,Y,$;return Array.isArray(A)?K(A):"tokenize"in A?K([A]):Z(A);function Z(re){return ve;function ve(_e){const Le=_e!==null&&re[_e],Ie=_e!==null&&re.null,Te=[...Array.isArray(Le)?Le:Le?[Le]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return K(Te)(_e)}}function K(re){return B=re,z=0,re.length===0?O:V(re[z])}function V(re){return ve;function ve(_e){return $=L(),Y=re,re.partial||(c.currentConstruct=re),re.name&&c.parser.constructs.disable.null.includes(re.name)?Q():re.tokenize.call(E?Object.assign(Object.create(c),E):c,l,fe,Q)(_e)}}function fe(re){return T(Y,$),M}function Q(re){return $.restore(),++z<B.length?V(B[z]):O}}}function k(T,E){T.resolveAll&&!o.includes(T)&&o.push(T),T.resolve&&Sh(c.events,E,c.events.length-E,T.resolve(c.events.slice(E),c)),T.resolveTo&&(c.events=T.resolveTo(c.events,c))}function L(){const T=f(),E=c.previous,R=c.currentConstruct,A=c.events.length,M=Array.from(a);return{from:A,restore:O};function O(){n=T,c.previous=E,c.currentConstruct=R,c.events.length=A,a=M,D()}}function D(){n.line in s&&n.column<2&&(n.column=s[n.line],n.offset+=s[n.line]-1)}}function LTn(i,e){const t=e.start._index,n=e.start._bufferIndex,s=e.end._index,o=e.end._bufferIndex;let r;if(t===s)r=[i[t].slice(n,o)];else{if(r=i.slice(t,s),n>-1){const a=r[0];typeof a=="string"?r[0]=a.slice(n):r.shift()}o>0&&r.push(i[s].slice(0,o))}return r}function DTn(i,e){let t=-1;const n=[];let s;for(;++t<i.length;){const o=i[t];let r;if(typeof o=="string")r=o;else switch(o){case-5:{r="\r";break}case-4:{r=`
1318
1318
  `;break}case-3:{r=`\r
1319
1319
  `;break}case-2:{r=e?" ":" ";break}case-1:{if(!e&&s)continue;r=" ";break}default:r=String.fromCharCode(o)}s=o===-2,n.push(r)}return n.join("")}function TTn(i){const n={constructs:THe([ITn,...(i||{}).extensions||[]]),content:s(jLn),defined:[],document:s(qLn),flow:s(uTn),lazy:{},string:s(mTn),text:s(fTn)};return n;function s(o){return r;function r(a){return kTn(n,o,a)}}}function ETn(i){for(;!AHe(i););return i}const KIe=/[\0\t\n\r]/g;function PTn(){let i=1,e="",t=!0,n;return s;function s(o,r,a){const l=[];let c,d,h,g,m;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(r||void 0).decode(o)),h=0,e="",t&&(o.charCodeAt(0)===65279&&h++,t=void 0);h<o.length;){if(KIe.lastIndex=h,c=KIe.exec(o),g=c&&c.index!==void 0?c.index:o.length,m=o.charCodeAt(g),!c){e=o.slice(h);break}if(m===10&&h===g&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),h<g&&(l.push(o.slice(h,g)),i+=g-h),m){case 0:{l.push(65533),i++;break}case 9:{for(d=Math.ceil(i/4)*4,l.push(-2);i++<d;)l.push(-1);break}case 10:{l.push(-4),i=1;break}default:n=!0,i=1}h=g+1}return a&&(n&&l.push(-5),e&&l.push(e),l.push(null)),l}}const RTn=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function MTn(i){return i.replace(RTn,ATn)}function ATn(i,e,t){if(e)return e;if(t.charCodeAt(0)===35){const s=t.charCodeAt(1),o=s===120||s===88;return EHe(t.slice(o?2:1),o?16:10)}return pue(t)||i}const WHe={}.hasOwnProperty;function OTn(i,e,t){return e&&typeof e=="object"&&(t=e,e=void 0),FTn(t)(ETn(TTn(t).document().write(PTn()(i,e,!0))))}function FTn(i){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Mn),autolinkProtocol:L,autolinkEmail:L,atxHeading:o(ft),blockQuote:o(Ie),characterEscape:L,characterReference:L,codeFenced:o(Te),codeFencedFenceInfo:r,codeFencedFenceMeta:r,codeIndented:o(Te,r),codeText:o(lt,r),codeTextData:L,data:L,codeFlowValue:L,definition:o(it),definitionDestinationString:r,definitionLabelString:r,definitionTitleString:r,emphasis:o(Ct),hardBreakEscape:o(Xt),hardBreakTrailing:o(Xt),htmlFlow:o(Mt,r),htmlFlowData:L,htmlText:o(Mt,r),htmlTextData:L,image:o(Ht),label:r,link:o(Mn),listItem:o(or),listItemValue:g,listOrdered:o(Cs,h),listUnordered:o(Cs),paragraph:o(ge),reference:V,referenceString:r,resourceDestinationString:r,resourceTitleString:r,setextHeading:o(ft),strong:o(Ue),thematicBreak:o(Ne)},exit:{atxHeading:l(),atxHeadingSequence:S,autolink:l(),autolinkEmail:Le,autolinkProtocol:_e,blockQuote:l(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:Q,characterReferenceMarkerNumeric:Q,characterReferenceValue:re,characterReference:ve,codeFenced:l(_),codeFencedFence:p,codeFencedFenceInfo:m,codeFencedFenceMeta:f,codeFlowValue:D,codeIndented:l(b),codeText:l(M),codeTextData:D,data:D,definition:l(),definitionDestinationString:y,definitionLabelString:v,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(E),hardBreakTrailing:l(E),htmlFlow:l(R),htmlFlowData:D,htmlText:l(A),htmlTextData:D,image:l(B),label:Y,labelText:z,lineEnding:T,link:l(O),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:fe,resourceDestinationString:$,resourceTitleString:Z,resource:K,setextHeading:l(k),setextHeadingLineSequence:N,setextHeadingText:C,strong:l(),thematicBreak:l()}};HHe(e,(i||{}).mdastExtensions||[]);const t={};return n;function n(le){let Pe={type:"root",children:[]};const Re={stack:[Pe],tokenStack:[],config:e,enter:a,exit:c,buffer:r,resume:d,data:t},We=[];let ct=-1;for(;++ct<le.length;)if(le[ct][1].type==="listOrdered"||le[ct][1].type==="listUnordered")if(le[ct][0]==="enter")We.push(ct);else{const gn=We.pop();ct=s(le,gn,ct)}for(ct=-1;++ct<le.length;){const gn=e[le[ct][0]];WHe.call(gn,le[ct][1].type)&&gn[le[ct][1].type].call(Object.assign({sliceSerialize:le[ct][2].sliceSerialize},Re),le[ct][1])}if(Re.tokenStack.length>0){const gn=Re.tokenStack[Re.tokenStack.length-1];(gn[1]||JIe).call(Re,void 0,gn[0])}for(Pe.position={start:bv(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:bv(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},ct=-1;++ct<e.transforms.length;)Pe=e.transforms[ct](Pe)||Pe;return Pe}function s(le,Pe,Re){let We=Pe-1,ct=-1,gn=!1,$n,Ln,yi,oi;for(;++We<=Re;){const Xn=le[We];switch(Xn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xn[0]==="enter"?ct++:ct--,oi=void 0;break}case"lineEndingBlank":{Xn[0]==="enter"&&($n&&!oi&&!ct&&!yi&&(yi=We),oi=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:oi=void 0}if(!ct&&Xn[0]==="enter"&&Xn[1].type==="listItemPrefix"||ct===-1&&Xn[0]==="exit"&&(Xn[1].type==="listUnordered"||Xn[1].type==="listOrdered")){if($n){let go=We;for(Ln=void 0;go--;){const wo=le[go];if(wo[1].type==="lineEnding"||wo[1].type==="lineEndingBlank"){if(wo[0]==="exit")continue;Ln&&(le[Ln][1].type="lineEndingBlank",gn=!0),wo[1].type="lineEnding",Ln=go}else if(!(wo[1].type==="linePrefix"||wo[1].type==="blockQuotePrefix"||wo[1].type==="blockQuotePrefixWhitespace"||wo[1].type==="blockQuoteMarker"||wo[1].type==="listItemIndent"))break}yi&&(!Ln||yi<Ln)&&($n._spread=!0),$n.end=Object.assign({},Ln?le[Ln][1].start:Xn[1].end),le.splice(Ln||We,0,["exit",$n,Xn[2]]),We++,Re++}if(Xn[1].type==="listItemPrefix"){const go={type:"listItem",_spread:!1,start:Object.assign({},Xn[1].start),end:void 0};$n=go,le.splice(We,0,["enter",go,Xn[2]]),We++,Re++,yi=void 0,oi=!0}}}return le[Pe][1]._spread=gn,Re}function o(le,Pe){return Re;function Re(We){a.call(this,le(We),We),Pe&&Pe.call(this,We)}}function r(){this.stack.push({type:"fragment",children:[]})}function a(le,Pe,Re){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([Pe,Re||void 0]),le.position={start:bv(Pe.start),end:void 0}}function l(le){return Pe;function Pe(Re){le&&le.call(this,Re),c.call(this,Re)}}function c(le,Pe){const Re=this.stack.pop(),We=this.tokenStack.pop();if(We)We[0].type!==le.type&&(Pe?Pe.call(this,le,We[0]):(We[1]||JIe).call(this,le,We[0]));else throw new Error("Cannot close `"+le.type+"` ("+qP({start:le.start,end:le.end})+"): it’s not open");Re.position.end=bv(le.end)}function d(){return fue(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(le){if(this.data.expectingFirstListItemValue){const Pe=this.stack[this.stack.length-2];Pe.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function m(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.lang=le}function f(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.meta=le}function p(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.value=le.replace(/(\r?\n|\r)$/g,"")}function v(le){const Pe=this.resume(),Re=this.stack[this.stack.length-1];Re.label=Pe,Re.identifier=Rm(this.sliceSerialize(le)).toLowerCase()}function w(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.title=le}function y(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.url=le}function S(le){const Pe=this.stack[this.stack.length-1];if(!Pe.depth){const Re=this.sliceSerialize(le).length;Pe.depth=Re}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function N(le){const Pe=this.stack[this.stack.length-1];Pe.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function L(le){const Re=this.stack[this.stack.length-1].children;let We=Re[Re.length-1];(!We||We.type!=="text")&&(We=Ee(),We.position={start:bv(le.start),end:void 0},Re.push(We)),this.stack.push(We)}function D(le){const Pe=this.stack.pop();Pe.value+=this.sliceSerialize(le),Pe.position.end=bv(le.end)}function T(le){const Pe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=Pe.children[Pe.children.length-1];Re.position.end=bv(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Pe.type)&&(L.call(this,le),D.call(this,le))}function E(){this.data.atHardBreak=!0}function R(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.value=le}function A(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.value=le}function M(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.value=le}function O(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Pe=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Pe,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function B(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Pe=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Pe,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function z(le){const Pe=this.sliceSerialize(le),Re=this.stack[this.stack.length-2];Re.label=MTn(Pe),Re.identifier=Rm(Pe).toLowerCase()}function Y(){const le=this.stack[this.stack.length-1],Pe=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const We=le.children;Re.children=We}else Re.alt=Pe}function $(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.url=le}function Z(){const le=this.resume(),Pe=this.stack[this.stack.length-1];Pe.title=le}function K(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function fe(le){const Pe=this.resume(),Re=this.stack[this.stack.length-1];Re.label=Pe,Re.identifier=Rm(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function Q(le){this.data.characterReferenceType=le.type}function re(le){const Pe=this.sliceSerialize(le),Re=this.data.characterReferenceType;let We;Re?(We=EHe(Pe,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):We=pue(Pe);const ct=this.stack[this.stack.length-1];ct.value+=We}function ve(le){const Pe=this.stack.pop();Pe.position.end=bv(le.end)}function _e(le){D.call(this,le);const Pe=this.stack[this.stack.length-1];Pe.url=this.sliceSerialize(le)}function Le(le){D.call(this,le);const Pe=this.stack[this.stack.length-1];Pe.url="mailto:"+this.sliceSerialize(le)}function Ie(){return{type:"blockquote",children:[]}}function Te(){return{type:"code",lang:null,meta:null,value:""}}function lt(){return{type:"inlineCode",value:""}}function it(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ct(){return{type:"emphasis",children:[]}}function ft(){return{type:"heading",depth:0,children:[]}}function Xt(){return{type:"break"}}function Mt(){return{type:"html",value:""}}function Ht(){return{type:"image",title:null,url:"",alt:null}}function Mn(){return{type:"link",title:null,url:"",children:[]}}function Cs(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function or(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function ge(){return{type:"paragraph",children:[]}}function Ue(){return{type:"strong",children:[]}}function Ee(){return{type:"text",value:""}}function Ne(){return{type:"thematicBreak"}}}function bv(i){return{line:i.line,column:i.column,offset:i.offset}}function HHe(i,e){let t=-1;for(;++t<e.length;){const n=e[t];Array.isArray(n)?HHe(i,n):BTn(i,n)}}function BTn(i,e){let t;for(t in e)if(WHe.call(e,t))switch(t){case"canContainEols":{const n=e[t];n&&i[t].push(...n);break}case"transforms":{const n=e[t];n&&i[t].push(...n);break}case"enter":case"exit":{const n=e[t];n&&Object.assign(i[t],n);break}}}function JIe(i,e){throw i?new Error("Cannot close `"+i.type+"` ("+qP({start:i.start,end:i.end})+"): a different token (`"+e.type+"`, "+qP({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+qP({start:e.start,end:e.end})+") is still open")}function VTn(i){const e=this;e.parser=t;function t(n){return OTn(n,{...e.data("settings"),...i,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function zTn(i,e){const t={type:"element",tagName:"blockquote",properties:{},children:i.wrap(i.all(e),!0)};return i.patch(e,t),i.applyData(e,t)}function WTn(i,e){const t={type:"element",tagName:"br",properties:{},children:[]};return i.patch(e,t),[i.applyData(e,t),{type:"text",value:`