@agent-spaces/server 0.2.9 → 0.3.0

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 (129) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/web/404.html +1 -1
  3. package/dist/web/__next.__PAGE__.txt +4 -4
  4. package/dist/web/__next._full.txt +20 -20
  5. package/dist/web/__next._head.txt +4 -4
  6. package/dist/web/__next._index.txt +13 -13
  7. package/dist/web/__next._tree.txt +2 -2
  8. package/dist/web/_next/static/chunks/{0n0j7tw_y1qk2.js → 00fu7sjtftd3f.js} +1 -1
  9. package/dist/web/_next/static/chunks/00s_1ft2-qz0r.js +1 -0
  10. package/dist/web/_next/static/chunks/{0-vgd3j-zh3m8.js → 05iy4.c-1cfhd.js} +1 -1
  11. package/dist/web/_next/static/chunks/0b1w9_ne4c2ez.js +1 -0
  12. package/dist/web/_next/static/chunks/0bzechrx76-ix.js +1 -0
  13. package/dist/web/_next/static/chunks/0fxdvo63ywaa~.js +1 -0
  14. package/dist/web/_next/static/chunks/0k5bmi-es-2nj.js +1 -0
  15. package/dist/web/_next/static/chunks/0tqwdxb-8t_n1.js +1 -0
  16. package/dist/web/_next/static/chunks/0yc41k980zabo.js +1 -0
  17. package/dist/web/_next/static/chunks/0zhhkzv4.0koq.js +183 -0
  18. package/dist/web/_next/static/chunks/102lz3yanx8i~.css +1 -0
  19. package/dist/web/_next/static/chunks/13wm9.vry~.lh.js +5 -0
  20. package/dist/web/_not-found/__next._full.txt +19 -19
  21. package/dist/web/_not-found/__next._head.txt +4 -4
  22. package/dist/web/_not-found/__next._index.txt +13 -13
  23. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  24. package/dist/web/_not-found/__next._not-found.txt +3 -3
  25. package/dist/web/_not-found/__next._tree.txt +2 -2
  26. package/dist/web/_not-found.html +1 -1
  27. package/dist/web/_not-found.txt +19 -19
  28. package/dist/web/index.html +1 -1
  29. package/dist/web/index.txt +20 -20
  30. package/dist/web/login/__next._full.txt +21 -21
  31. package/dist/web/login/__next._head.txt +4 -4
  32. package/dist/web/login/__next._index.txt +13 -13
  33. package/dist/web/login/__next._tree.txt +2 -2
  34. package/dist/web/login/__next.login.__PAGE__.txt +4 -4
  35. package/dist/web/login/__next.login.txt +3 -3
  36. package/dist/web/login.html +1 -1
  37. package/dist/web/login.txt +21 -21
  38. package/dist/web/settings/__next._full.txt +23 -23
  39. package/dist/web/settings/__next._head.txt +4 -4
  40. package/dist/web/settings/__next._index.txt +13 -13
  41. package/dist/web/settings/__next._tree.txt +2 -2
  42. package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
  43. package/dist/web/settings/__next.settings.txt +5 -5
  44. package/dist/web/settings/agents/__next._full.txt +23 -23
  45. package/dist/web/settings/agents/__next._head.txt +4 -4
  46. package/dist/web/settings/agents/__next._index.txt +13 -13
  47. package/dist/web/settings/agents/__next._tree.txt +2 -2
  48. package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
  49. package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
  50. package/dist/web/settings/agents/__next.settings.txt +5 -5
  51. package/dist/web/settings/agents.html +1 -1
  52. package/dist/web/settings/agents.txt +23 -23
  53. package/dist/web/settings/mcps/__next._full.txt +23 -23
  54. package/dist/web/settings/mcps/__next._head.txt +4 -4
  55. package/dist/web/settings/mcps/__next._index.txt +13 -13
  56. package/dist/web/settings/mcps/__next._tree.txt +2 -2
  57. package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
  58. package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
  59. package/dist/web/settings/mcps/__next.settings.txt +5 -5
  60. package/dist/web/settings/mcps.html +1 -1
  61. package/dist/web/settings/mcps.txt +23 -23
  62. package/dist/web/settings/models/__next._full.txt +23 -23
  63. package/dist/web/settings/models/__next._head.txt +4 -4
  64. package/dist/web/settings/models/__next._index.txt +13 -13
  65. package/dist/web/settings/models/__next._tree.txt +2 -2
  66. package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
  67. package/dist/web/settings/models/__next.settings.models.txt +3 -3
  68. package/dist/web/settings/models/__next.settings.txt +5 -5
  69. package/dist/web/settings/models.html +1 -1
  70. package/dist/web/settings/models.txt +23 -23
  71. package/dist/web/settings/providers/__next._full.txt +23 -23
  72. package/dist/web/settings/providers/__next._head.txt +4 -4
  73. package/dist/web/settings/providers/__next._index.txt +13 -13
  74. package/dist/web/settings/providers/__next._tree.txt +2 -2
  75. package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
  76. package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
  77. package/dist/web/settings/providers/__next.settings.txt +5 -5
  78. package/dist/web/settings/providers.html +1 -1
  79. package/dist/web/settings/providers.txt +23 -23
  80. package/dist/web/settings/skills/__next._full.txt +23 -23
  81. package/dist/web/settings/skills/__next._head.txt +4 -4
  82. package/dist/web/settings/skills/__next._index.txt +13 -13
  83. package/dist/web/settings/skills/__next._tree.txt +2 -2
  84. package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
  85. package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
  86. package/dist/web/settings/skills/__next.settings.txt +5 -5
  87. package/dist/web/settings/skills.html +1 -1
  88. package/dist/web/settings/skills.txt +23 -23
  89. package/dist/web/settings.html +1 -1
  90. package/dist/web/settings.txt +23 -23
  91. package/dist/web/workflows/__next._full.txt +21 -21
  92. package/dist/web/workflows/__next._head.txt +4 -4
  93. package/dist/web/workflows/__next._index.txt +13 -13
  94. package/dist/web/workflows/__next._tree.txt +2 -2
  95. package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
  96. package/dist/web/workflows/__next.workflows.txt +3 -3
  97. package/dist/web/workflows.html +1 -1
  98. package/dist/web/workflows.txt +21 -21
  99. package/dist/web/workspace/_/__next._full.txt +22 -22
  100. package/dist/web/workspace/_/__next._head.txt +4 -4
  101. package/dist/web/workspace/_/__next._index.txt +13 -13
  102. package/dist/web/workspace/_/__next._tree.txt +2 -2
  103. package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
  104. package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
  105. package/dist/web/workspace/_/__next.workspace.txt +3 -3
  106. package/dist/web/workspace/_.html +1 -1
  107. package/dist/web/workspace/_.txt +22 -22
  108. package/dist/web/workspaces/__next._full.txt +21 -21
  109. package/dist/web/workspaces/__next._head.txt +4 -4
  110. package/dist/web/workspaces/__next._index.txt +13 -13
  111. package/dist/web/workspaces/__next._tree.txt +2 -2
  112. package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
  113. package/dist/web/workspaces/__next.workspaces.txt +3 -3
  114. package/dist/web/workspaces.html +1 -1
  115. package/dist/web/workspaces.txt +21 -21
  116. package/package.json +1 -1
  117. package/dist/web/_next/static/chunks/0.~n0s82y4zh_.css +0 -1
  118. package/dist/web/_next/static/chunks/02duknlg3rgjp.js +0 -1
  119. package/dist/web/_next/static/chunks/04zxh2e-4~-xs.js +0 -1
  120. package/dist/web/_next/static/chunks/082lp-xqv7r.-.js +0 -183
  121. package/dist/web/_next/static/chunks/0b2tump5duj9j.js +0 -1
  122. package/dist/web/_next/static/chunks/0tkii3.lkbu3u.js +0 -1
  123. package/dist/web/_next/static/chunks/0wz8~mvztv-vq.js +0 -1
  124. package/dist/web/_next/static/chunks/0zxtxecpqyoeh.js +0 -1
  125. package/dist/web/_next/static/chunks/12sucjx_z8ftc.js +0 -1
  126. package/dist/web/_next/static/chunks/15_n_khh8cuax.js +0 -5
  127. /package/dist/web/_next/static/{hGfVPALj5nbwettayL9DY → XzP71HbFE1fuE_bLT-x7i}/_buildManifest.js +0 -0
  128. /package/dist/web/_next/static/{hGfVPALj5nbwettayL9DY → XzP71HbFE1fuE_bLT-x7i}/_clientMiddlewareManifest.js +0 -0
  129. /package/dist/web/_next/static/{hGfVPALj5nbwettayL9DY → XzP71HbFE1fuE_bLT-x7i}/_ssgManifest.js +0 -0
@@ -0,0 +1,183 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,843982,(e,i,n)=>{"use strict";function r({widthInt:e,heightInt:i,blurWidth:n,blurHeight:s,blurDataURL:o,objectFit:a}){let l=n?40*n:e,c=s?40*s:i,d=l&&c?`viewBox='0 0 ${l} ${c}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${d}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${d?"none":"contain"===a?"xMidYMid":"cover"===a?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${o}'/%3E%3C/svg%3E`}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},500680,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={VALID_LOADERS:function(){return o},imageConfigDefault:function(){return a}};for(var s in r)Object.defineProperty(n,s,{enumerable:!0,get:r[s]});let o=["default","imgix","cloudinary","akamai","custom"],a={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumDiskCacheSize:void 0,maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1,customCacheHandler:!1}},622398,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"getImgProps",{enumerable:!0,get:function(){return d}}),e.r(837121);let r=e.r(745137),s=e.r(843982),o=e.r(500680),a=["-moz-initial","fill","none","scale-down",void 0];function l(e){return void 0!==e.default}function c(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function d({src:e,sizes:i,unoptimized:n=!1,priority:h=!1,preload:u=!1,loading:p,className:f,quality:m,width:g,height:v,fill:y=!1,style:_,overrideSrc:b,onLoad:w,onLoadingComplete:S,placeholder:k="empty",blurDataURL:C,fetchPriority:T,decoding:E="async",layout:D,objectFit:N,objectPosition:M,lazyBoundary:O,lazyRoot:R,...A},L){var j;let I,P,B,{imgConf:z,showAltText:F,blurComplete:H,defaultLoader:W}=L,$=z||o.imageConfigDefault;if("allSizes"in $)I=$;else{let e=[...$.deviceSizes,...$.imageSizes].sort((e,i)=>e-i),i=$.deviceSizes.sort((e,i)=>e-i),n=$.qualities?.sort((e,i)=>e-i);I={...$,allSizes:e,deviceSizes:i,qualities:n}}if(void 0===W)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let U=A.loader||W;delete A.loader,delete A.srcSet;let V="__next_img_default"in U;if(V){if("custom"===I.loader)throw Object.defineProperty(Error(`Image with src "${e}" is missing "loader" prop.
2
+ Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=U;U=i=>{let{config:n,...r}=i;return e(r)}}if(D){"fill"===D&&(y=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[D];e&&(_={..._,...e});let n={responsive:"100vw",fill:"100vw"}[D];n&&!i&&(i=n)}let q="",K=c(g),Y=c(v);if((j=e)&&"object"==typeof j&&(l(j)||void 0!==j.src)){let i=l(e)?e.default:e;if(!i.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(i)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!i.height||!i.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(i)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(P=i.blurWidth,B=i.blurHeight,C=C||i.blurDataURL,q=i.src,!y)if(K||Y){if(K&&!Y){let e=K/i.width;Y=Math.round(i.height*e)}else if(!K&&Y){let e=Y/i.height;K=Math.round(i.width*e)}}else K=i.width,Y=i.height}let X=!h&&!u&&("lazy"===p||void 0===p);(!(e="string"==typeof e?e:q)||e.startsWith("data:")||e.startsWith("blob:"))&&(n=!0,X=!1),I.unoptimized&&(n=!0),V&&!I.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(n=!0);let J=c(m),G=Object.assign(y?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:N,objectPosition:M}:{},F?{}:{color:"transparent"},_),Z=H||"empty"===k?null:"blur"===k?`url("data:image/svg+xml;charset=utf-8,${(0,s.getImageBlurSvg)({widthInt:K,heightInt:Y,blurWidth:P,blurHeight:B,blurDataURL:C||"",objectFit:G.objectFit})}")`:`url("${k}")`,Q=a.includes(G.objectFit)?"fill"===G.objectFit?"100% 100%":"cover":G.objectFit,ee=Z?{backgroundSize:Q,backgroundPosition:G.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:Z}:{},et=function({config:e,src:i,unoptimized:n,width:s,quality:o,sizes:a,loader:l}){if(n){if(i.startsWith("/")&&!i.startsWith("//")){let e=(0,r.getDeploymentId)();if(e){let n=i.indexOf("?");if(-1!==n){let r=new URLSearchParams(i.slice(n+1));r.get("dpl")||(r.append("dpl",e),i=i.slice(0,n)+"?"+r.toString())}else i+=`?dpl=${e}`}}return{src:i,srcSet:void 0,sizes:void 0}}let{widths:c,kind:d}=function({deviceSizes:e,allSizes:i},n,r){if(r){let n=/(^|\s)(1?\d?\d)vw/g,s=[];for(let e;e=n.exec(r);)s.push(parseInt(e[2]));if(s.length){let n=.01*Math.min(...s);return{widths:i.filter(i=>i>=e[0]*n),kind:"w"}}return{widths:i,kind:"w"}}return"number"!=typeof n?{widths:e,kind:"w"}:{widths:[...new Set([n,2*n].map(e=>i.find(i=>i>=e)||i[i.length-1]))],kind:"x"}}(e,s,a),h=c.length-1;return{sizes:a||"w"!==d?a:"100vw",srcSet:c.map((n,r)=>`${l({config:e,src:i,quality:o,width:n})} ${"w"===d?n:r+1}${d}`).join(", "),src:l({config:e,src:i,quality:o,width:c[h]})}}({config:I,src:e,unoptimized:n,width:K,quality:J,sizes:i,loader:U}),ei=X?"lazy":p;return{props:{...A,loading:ei,fetchPriority:T,width:K,height:Y,decoding:E,className:f,style:{...G,...ee},sizes:et.sizes,srcSet:et.srcSet,src:b||et.src},meta:{unoptimized:n,preload:u||h,placeholder:k,fill:y}}}},852824,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return l}});let r=e.r(764556),s="u"<typeof window,o=s?()=>{}:r.useLayoutEffect,a=s?()=>{}:r.useEffect;function l(e){let{headManager:i,reduceComponentsToState:n}=e;function l(){if(i&&i.mountedInstances){let e=r.Children.toArray(Array.from(i.mountedInstances).filter(Boolean));i.updateHead(n(e))}}return s&&(i?.mountedInstances?.add(e.children),l()),o(()=>(i?.mountedInstances?.add(e.children),()=>{i?.mountedInstances?.delete(e.children)})),o(()=>(i&&(i._pendingUpdate=l),()=>{i&&(i._pendingUpdate=l)})),a(()=>(i&&i._pendingUpdate&&(i._pendingUpdate(),i._pendingUpdate=null),()=>{i&&i._pendingUpdate&&(i._pendingUpdate(),i._pendingUpdate=null)})),null}},120333,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return g},defaultHead:function(){return u}};for(var s in r)Object.defineProperty(n,s,{enumerable:!0,get:r[s]});let o=e.r(481258),a=e.r(744066),l=e.r(344180),c=a._(e.r(764556)),d=o._(e.r(852824)),h=e.r(57426);function u(){return[(0,l.jsx)("meta",{charSet:"utf-8"},"charset"),(0,l.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function p(e,i){return"string"==typeof i||"number"==typeof i?e:i.type===c.default.Fragment?e.concat(c.default.Children.toArray(i.props.children).reduce((e,i)=>"string"==typeof i||"number"==typeof i?e:e.concat(i),[])):e.concat(i)}e.r(837121);let f=["name","httpEquiv","charSet","itemProp"];function m(e){let i,n,r,s;return e.reduce(p,[]).reverse().concat(u().reverse()).filter((i=new Set,n=new Set,r=new Set,s={},e=>{let o=!0,a=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){a=!0;let n=e.key.slice(e.key.indexOf("$")+1);i.has(n)?o=!1:i.add(n)}switch(e.type){case"title":case"base":n.has(e.type)?o=!1:n.add(e.type);break;case"meta":for(let i=0,n=f.length;i<n;i++){let n=f[i];if(e.props.hasOwnProperty(n))if("charSet"===n)r.has(n)?o=!1:r.add(n);else{let i=e.props[n],r=s[n]||new Set;("name"!==n||!a)&&r.has(i)?o=!1:(r.add(i),s[n]=r)}}}return o})).reverse().map((e,i)=>{let n=e.key||i;return c.default.cloneElement(e,{key:n})})}let g=function({children:e}){let i=(0,c.useContext)(h.HeadManagerContext);return(0,l.jsx)(d.default,{reduceComponentsToState:m,headManager:i,children:e})};("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),i.exports=n.default)},914272,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"ImageConfigContext",{enumerable:!0,get:function(){return o}});let r=e.r(481258)._(e.r(764556)),s=e.r(500680),o=r.default.createContext(s.imageConfigDefault)},338431,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"RouterContext",{enumerable:!0,get:function(){return r}});let r=e.r(481258)._(e.r(764556)).default.createContext(null)},741186,(e,i,n)=>{"use strict";function r(e,i){let n=e||75;return i?.qualities?.length?i.qualities.reduce((e,i)=>Math.abs(i-n)<Math.abs(e-n)?i:e,i.qualities[0]):n}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"findClosestQuality",{enumerable:!0,get:function(){return r}})},99552,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return a}});let r=e.r(741186),s=e.r(745137);function o({config:e,src:i,width:n,quality:a}){let l=(0,s.getDeploymentId)();if(i.startsWith("/")&&!i.startsWith("//")){let e=i.indexOf("?");if(-1!==e){let n=new URLSearchParams(i.slice(e+1)),r=n.get("dpl");if(r){l=r,n.delete("dpl");let s=n.toString();i=i.slice(0,e)+(s?"?"+s:"")}}}if(i.startsWith("/")&&i.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${i}" is using a query string which is not configured in images.localPatterns.
3
+ Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let c=(0,r.findClosestQuality)(a,e);return`${e.path}?url=${encodeURIComponent(i)}&w=${n}&q=${c}${i.startsWith("/")&&l?`&dpl=${l}`:""}`}o.__next_img_default=!0;let a=o},822862,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"useMergedRef",{enumerable:!0,get:function(){return s}});let r=e.r(764556);function s(e,i){let n=(0,r.useRef)(null),s=(0,r.useRef)(null);return(0,r.useCallback)(r=>{if(null===r){let e=n.current;e&&(n.current=null,e());let i=s.current;i&&(s.current=null,i())}else e&&(n.current=o(e,r)),i&&(s.current=o(i,r))},[e,i])}function o(e,i){if("function"!=typeof e)return e.current=i,()=>{e.current=null};{let n=e(i);return"function"==typeof n?n:()=>e(null)}}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),i.exports=n.default)},810034,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"Image",{enumerable:!0,get:function(){return w}});let r=e.r(481258),s=e.r(744066),o=e.r(344180),a=s._(e.r(764556)),l=r._(e.r(106206)),c=r._(e.r(120333)),d=e.r(622398),h=e.r(500680),u=e.r(914272);e.r(837121);let p=e.r(338431),f=r._(e.r(99552)),m=e.r(822862),g={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function v(e,i,n,r,s,o,a){let l=e?.src;e&&e["data-loaded-src"]!==l&&(e["data-loaded-src"]=l,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==i&&s(!0),n?.current){let i=new Event("load");Object.defineProperty(i,"target",{writable:!1,value:e});let r=!1,s=!1;n.current({...i,nativeEvent:i,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>s,persist:()=>{},preventDefault:()=>{r=!0,i.preventDefault()},stopPropagation:()=>{s=!0,i.stopPropagation()}})}r?.current&&r.current(e)}}))}function y(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}"u"<typeof window&&(globalThis.__NEXT_IMAGE_IMPORTED=!0);let _=(0,a.forwardRef)(({src:e,srcSet:i,sizes:n,height:r,width:s,decoding:l,className:c,style:d,fetchPriority:h,placeholder:u,loading:p,unoptimized:f,fill:g,onLoadRef:_,onLoadingCompleteRef:b,setBlurComplete:w,setShowAltText:S,sizesInput:k,onLoad:C,onError:T,...E},D)=>{let N=(0,a.useCallback)(e=>{e&&(T&&(e.src=e.src),e.complete&&v(e,u,_,b,w,f,k))},[e,u,_,b,w,T,f,k]),M=(0,m.useMergedRef)(D,N);return(0,o.jsx)("img",{...E,...y(h),loading:p,width:s,height:r,decoding:l,"data-nimg":g?"fill":"1",className:c,style:d,sizes:n,srcSet:i,src:e,ref:M,onLoad:e=>{v(e.currentTarget,u,_,b,w,f,k)},onError:e=>{S(!0),"empty"!==u&&w(!0),T&&T(e)}})});function b({isAppRouter:e,imgAttributes:i}){let n={as:"image",imageSrcSet:i.srcSet,imageSizes:i.sizes,crossOrigin:i.crossOrigin,referrerPolicy:i.referrerPolicy,...y(i.fetchPriority)};return e&&l.default.preload?(l.default.preload(i.src,n),null):(0,o.jsx)(c.default,{children:(0,o.jsx)("link",{rel:"preload",href:i.srcSet?void 0:i.src,...n},"__nimg-"+i.src+i.srcSet+i.sizes)})}let w=(0,a.forwardRef)((e,i)=>{let n=(0,a.useContext)(p.RouterContext),r=(0,a.useContext)(u.ImageConfigContext),s=(0,a.useMemo)(()=>{let e=g||r||h.imageConfigDefault,i=[...e.deviceSizes,...e.imageSizes].sort((e,i)=>e-i),n=e.deviceSizes.sort((e,i)=>e-i),s=e.qualities?.sort((e,i)=>e-i);return{...e,allSizes:i,deviceSizes:n,qualities:s,localPatterns:"u"<typeof window?r?.localPatterns:e.localPatterns}},[r]),{onLoad:l,onLoadingComplete:c}=e,m=(0,a.useRef)(l);(0,a.useEffect)(()=>{m.current=l},[l]);let v=(0,a.useRef)(c);(0,a.useEffect)(()=>{v.current=c},[c]);let[y,w]=(0,a.useState)(!1),[S,k]=(0,a.useState)(!1),{props:C,meta:T}=(0,d.getImgProps)(e,{defaultLoader:f.default,imgConf:s,blurComplete:y,showAltText:S});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(_,{...C,unoptimized:T.unoptimized,placeholder:T.placeholder,fill:T.fill,onLoadRef:m,onLoadingCompleteRef:v,setBlurComplete:w,setShowAltText:k,sizesInput:e.sizes,ref:i}),T.preload?(0,o.jsx)(b,{isAppRouter:!n,imgAttributes:C}):null]})});("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),i.exports=n.default)},776785,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return h},getImageProps:function(){return d}};for(var s in r)Object.defineProperty(n,s,{enumerable:!0,get:r[s]});let o=e.r(481258),a=e.r(622398),l=e.r(810034),c=o._(e.r(99552));function d(e){let{props:i}=(0,a.getImgProps)(e,{defaultLoader:c.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,n]of Object.entries(i))void 0===n&&delete i[e];return{props:i}}let h=l.Image},253937,(e,i,n)=>{i.exports=e.r(776785)},369090,(e,i,n)=>{"use strict";var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,s=/\n/g,o=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,h=/^\s+|\s+$/g;function u(e){return e?e.replace(h,""):""}i.exports=function(e,i){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];i=i||{};var n=1,h=1;function p(e){var i=e.match(s);i&&(n+=i.length);var r=e.lastIndexOf("\n");h=~r?e.length-r:h+e.length}function f(){var e={line:n,column:h};return function(i){return i.position=new m(e),v(o),i}}function m(e){this.start=e,this.end={line:n,column:h},this.source=i.source}function g(r){var s=Error(i.source+":"+n+":"+h+": "+r);if(s.reason=r,s.filename=i.source,s.line=n,s.column=h,s.source=e,i.silent);else throw s}function v(i){var n=i.exec(e);if(n){var r=n[0];return p(r),e=e.slice(r.length),n}}function y(e){var i;for(e=e||[];i=_();)!1!==i&&e.push(i);return e}function _(){var i=f();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return g("End of comment missing");var r=e.slice(2,n-2);return h+=2,p(r),e=e.slice(n),h+=2,i({type:"comment",comment:r})}}m.prototype.content=e,v(o);var b,w=[];for(y(w);b=function(){var e=f(),i=v(a);if(i){if(_(),!v(l))return g("property missing ':'");var n=v(c),s=e({type:"declaration",property:u(i[0].replace(r,"")),value:n?u(n[0].replace(r,"")):""});return v(d),s}}();)!1!==b&&(w.push(b),y(w));return w}},559596,(e,i,n)=>{"use strict";var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,i){let n=null;if(!e||"string"!=typeof e)return n;let r=(0,s.default)(e),o="function"==typeof i;return r.forEach(e=>{if("declaration"!==e.type)return;let{property:r,value:s}=e;o?i(r,s,e):s&&((n=n||{})[r]=s)}),n};let s=r(e.r(369090))},851521,(e,i,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.camelCase=void 0;var r=/^--[a-zA-Z0-9_-]+$/,s=/-([a-z])/g,o=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,c=function(e,i){return i.toUpperCase()},d=function(e,i){return"".concat(i,"-")};n.camelCase=function(e,i){var n;return(void 0===i&&(i={}),!(n=e)||o.test(n)||r.test(n))?e:(e=e.toLowerCase(),(e=i.reactCompat?e.replace(l,d):e.replace(a,d)).replace(s,c))}},763185,(e,i,n)=>{"use strict";var r=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(559596)),s=e.r(851521);function o(e,i){var n={};return e&&"string"==typeof e&&(0,r.default)(e,function(e,r){e&&r&&(n[(0,s.camelCase)(e,i)]=r)}),n}o.default=o,i.exports=o},975609,(e,i,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,s=Object.prototype.toString,o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===s.call(e)},c=function(e){if(!e||"[object Object]"!==s.call(e))return!1;var i,n=r.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!o)return!1;for(i in e);return void 0===i||r.call(e,i)},d=function(e,i){o&&"__proto__"===i.name?o(e,i.name,{enumerable:!0,configurable:!0,value:i.newValue,writable:!0}):e[i.name]=i.newValue},h=function(e,i){if("__proto__"===i){if(!r.call(e,i))return;else if(a)return a(e,i).value}return e[i]};i.exports=function e(){var i,n,r,s,o,a,u=arguments[0],p=1,f=arguments.length,m=!1;for("boolean"==typeof u&&(m=u,u=arguments[1]||{},p=2),(null==u||"object"!=typeof u&&"function"!=typeof u)&&(u={});p<f;++p)if(i=arguments[p],null!=i)for(n in i)r=h(u,n),u!==(s=h(i,n))&&(m&&s&&(c(s)||(o=l(s)))?(o?(o=!1,a=r&&l(r)?r:[]):a=r&&c(r)?r:{},d(u,{name:n,newValue:e(m,a,s)})):void 0!==s&&d(u,{name:n,newValue:s}));return u}},191871,e=>{"use strict";let i,n,r,s,o,a,l,c,d,h,u,p,f,m,g,v,y,_;var b,w,S,k,C,T,E,D,N,M,O,R,A,L,j,I,P,B,z,F,H,W,$,U,V,q,K,Y,X,J,G,Z,Q,ee,et,ei,en,er,es,eo,ea,el,ec,ed,eh,eu,ep,ef,em,eg,ev,ey,e_,ex,eb,ew,eS,ek,eC,eT,eE,eD,eN,eM,eO,eR,eA,eL,ej,eI,eP,eB,ez,eF,eH,eW,e$,eU,eV,eq,eK,eY,eX,eJ,eG,eZ,eQ,e0,e1,e2,e5,e3,e4,e6,e8,e9,e7,te,tt,ti,tn,tr,ts,to,ta,tl,tc,td,th,tu,tp,tf,tm,tg,tv,ty,t_,tx,tb,tw,tS,tk,tC,tT,tE,tD,tN,tM,tO,tR,tA,tL,tj,tI,tP,tB,tz,tF,tH,tW,t$,tU,tV,tq,tK,tY,tX,tJ,tG,tZ,tQ,t0,t1,t2,t5,t3,t4,t6,t8,t9,t7,ie,it,ii,ir,is,io,ia,il,ic,id,ih,iu,ip,im,ig,iv,iy,i_,ix,ib,iw,iS,ik,iC,iT,iE,iD,iN,iM=e.i(344180),iO=e.i(764556),iR=e.i(799543),iA=iO,iL=e.i(106206),ij=e.i(51190),iI=class e{static HORZ=new e("horz");static VERT=new e("vert");static flip(i){return i===e.HORZ?e.VERT:e.HORZ}_name;constructor(e){this._name=e}getName(){return this._name}toString(){return this._name}},iP=class e{static empty(){return new e(0,0,0,0)}static fromJson(i){return new e(i.x,i.y,i.width,i.height)}x;y;width;height;constructor(e,i,n,r){this.x=e,this.y=i,this.width=n,this.height=r}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}snap(e){this.x=Math.round(this.x/e)*e,this.y=Math.round(this.y/e)*e,this.width=Math.round(this.width/e)*e,this.height=Math.round(this.height/e)*e}static getBoundingClientRect(i){let{x:n,y:r,width:s,height:o}=i.getBoundingClientRect();return new e(n,r,s,o)}static getContentRect(i){let n=i.getBoundingClientRect(),r=window.getComputedStyle(i),s=parseFloat(r.paddingLeft),o=parseFloat(r.paddingRight),a=parseFloat(r.paddingTop),l=parseFloat(r.paddingBottom),c=parseFloat(r.borderLeftWidth),d=parseFloat(r.borderRightWidth),h=parseFloat(r.borderTopWidth),u=parseFloat(r.borderBottomWidth),p=n.width-c-s-o-d,f=n.height-h-a-l-u;return new e(n.left+c+s,n.top+h+a,p,f)}static fromDomRect(i){return new e(i.x,i.y,i.width,i.height)}relativeTo(i){return new e(this.x-i.x,this.y-i.y,this.width,this.height)}clone(){return new e(this.x,this.y,this.width,this.height)}equals(e){return this.x===e?.x&&this.y===e?.y&&this.width===e?.width&&this.height===e?.height}equalsWhenRounded(e){return!!e&&.5>Math.abs(this.x-e.x)&&.5>Math.abs(this.y-e.y)&&.5>Math.abs(this.width-e.width)&&.5>Math.abs(this.height-e.height)}equalSize(e){return this.width===e?.width&&this.height===e?.height}getBottom(){return this.y+this.height}getRight(){return this.x+this.width}get bottom(){return this.y+this.height}get right(){return this.x+this.width}getCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}positionElement(e,i){this.styleWithPosition(e.style,i)}styleWithPosition(e,i="absolute"){return e.left=this.x+"px",e.top=this.y+"px",e.width=Math.max(0,this.width)+"px",e.height=Math.max(0,this.height)+"px",e.position=i,e}contains(e,i){return!!(this.x<=e&&e<=this.getRight()&&this.y<=i&&i<=this.getBottom())}removeInsets(i){return new e(this.x+i.left,this.y+i.top,Math.max(0,this.width-i.left-i.right),Math.max(0,this.height-i.top-i.bottom))}centerInRect(e){this.x=(e.width-this.width)/2,this.y=(e.height-this.height)/2}clamp(e){this.width>e.width&&(this.width=e.width),this.height>e.height&&(this.height=e.height),this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.getRight()>e.getRight()&&(this.x=e.getRight()-this.width),this.getBottom()>e.getBottom()&&(this.y=e.getBottom()-this.height),this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y)}_getSize(e){let i=this.width;return e===iI.VERT&&(i=this.height),i}toString(){return"(Rect: x="+this.x+", y="+this.y+", width="+this.width+", height="+this.height+")"}},iB=class e{static values=new Map;static TOP=new e("top",iI.VERT,0);static BOTTOM=new e("bottom",iI.VERT,1);static LEFT=new e("left",iI.HORZ,0);static RIGHT=new e("right",iI.HORZ,1);static CENTER=new e("center",iI.VERT,0);static getByName(i){return e.values.get(i)}static getLocation(i,n,r){if(n=(n-i.x)/i.width,r=(r-i.y)/i.height,n>=.25&&n<.75&&r>=.25&&r<.75)return e.CENTER;let s=r>=n,o=r>=1-n;return s?o?e.BOTTOM:e.LEFT:o?e.RIGHT:e.TOP}name;orientation;indexPlus;constructor(i,n,r){this.name=i,this.orientation=n,this.indexPlus=r,e.values.set(this.name,this)}getName(){return this.name}getOrientation(){return this.orientation}getDockRect(i){return this===e.TOP?new iP(i.x,i.y,i.width,i.height/2):this===e.BOTTOM?new iP(i.x,i.getBottom()-i.height/2,i.width,i.height/2):this===e.LEFT?new iP(i.x,i.y,i.width/2,i.height):this===e.RIGHT?new iP(i.getRight()-i.width/2,i.y,i.width/2,i.height):i.clone()}split(i,n){return this===e.TOP?{start:new iP(i.x,i.y,i.width,n),end:new iP(i.x,i.y+n,i.width,i.height-n)}:this===e.LEFT?{start:new iP(i.x,i.y,n,i.height),end:new iP(i.x+n,i.y,i.width-n,i.height)}:this===e.RIGHT?{start:new iP(i.getRight()-n,i.y,n,i.height),end:new iP(i.x,i.y,i.width-n,i.height)}:{start:new iP(i.x,i.getBottom()-n,i.width,n),end:new iP(i.x,i.y,i.width,i.height-n)}}reflect(){return this===e.TOP?e.BOTTOM:this===e.LEFT?e.RIGHT:this===e.RIGHT?e.LEFT:e.TOP}toString(){return"(DockLocation: name="+this.name+", orientation="+this.orientation+")"}},iz=((cZ={}).FLEXLAYOUT__BORDER="flexlayout__border",cZ.FLEXLAYOUT__BORDER_="flexlayout__border_",cZ.FLEXLAYOUT__BORDER_TAB_CONTENTS="flexlayout__border_tab_contents",cZ.FLEXLAYOUT__BORDER_BUTTON="flexlayout__border_button",cZ.FLEXLAYOUT__BORDER_BUTTON_="flexlayout__border_button_",cZ.FLEXLAYOUT__BORDER_BUTTON_CONTENT="flexlayout__border_button_content",cZ.FLEXLAYOUT__BORDER_BUTTON_LEADING="flexlayout__border_button_leading",cZ.FLEXLAYOUT__BORDER_BUTTON_TRAILING="flexlayout__border_button_trailing",cZ.FLEXLAYOUT__BORDER_BUTTON__SELECTED="flexlayout__border_button--selected",cZ.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED="flexlayout__border_button--unselected",cZ.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW="flexlayout__border_toolbar_button_overflow",cZ.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_="flexlayout__border_toolbar_button_overflow_",cZ.FLEXLAYOUT__BORDER_INNER="flexlayout__border_inner",cZ.FLEXLAYOUT__BORDER_INNER_="flexlayout__border_inner_",cZ.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER="flexlayout__border_inner_tab_container",cZ.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_="flexlayout__border_inner_tab_container_",cZ.FLEXLAYOUT__BORDER_TAB_DIVIDER="flexlayout__border_tab_divider",cZ.FLEXLAYOUT__BORDER_LEADING="flexlayout__border_leading",cZ.FLEXLAYOUT__BORDER_SIZER="flexlayout__border_sizer",cZ.FLEXLAYOUT__BORDER_TOOLBAR="flexlayout__border_toolbar",cZ.FLEXLAYOUT__BORDER_TOOLBAR_="flexlayout__border_toolbar_",cZ.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON="flexlayout__border_toolbar_button",cZ.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT="flexlayout__border_toolbar_button-float",cZ.FLEXLAYOUT__DRAG_RECT="flexlayout__drag_rect",cZ.FLEXLAYOUT__EDGE_RECT="flexlayout__edge_rect",cZ.FLEXLAYOUT__EDGE_RECT_TOP="flexlayout__edge_rect_top",cZ.FLEXLAYOUT__EDGE_RECT_LEFT="flexlayout__edge_rect_left",cZ.FLEXLAYOUT__EDGE_RECT_BOTTOM="flexlayout__edge_rect_bottom",cZ.FLEXLAYOUT__EDGE_RECT_RIGHT="flexlayout__edge_rect_right",cZ.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER="flexlayout__error_boundary_container",cZ.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT="flexlayout__error_boundary_content",cZ.FLEXLAYOUT__FLOAT_WINDOW="flexlayout__float_window",cZ.FLEXLAYOUT__FLOAT_WINDOW_HEADER="flexlayout__float_window_header",cZ.FLEXLAYOUT__FLOAT_WINDOW_CONTENT="flexlayout__float_window_content",cZ.FLEXLAYOUT__FLOATING_WINDOW_CONTENT="flexlayout__floating_window_content",cZ.FLEXLAYOUT__LAYOUT="flexlayout__layout",cZ.FLEXLAYOUT__LAYOUT_MOVEABLES="flexlayout__layout_moveables",cZ.FLEXLAYOUT__LAYOUT_OVERLAY="flexlayout__layout_overlay",cZ.FLEXLAYOUT__LAYOUT_TAB_STAMPS="flexlayout__layout_tab_stamps",cZ.FLEXLAYOUT__LAYOUT_MAIN="flexlayout__layout_main",cZ.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER="flexlayout__layout_border_container",cZ.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER="flexlayout__layout_border_container_inner",cZ.FLEXLAYOUT__OUTLINE_RECT="flexlayout__outline_rect",cZ.FLEXLAYOUT__OUTLINE_RECT_EDGE="flexlayout__outline_rect_edge",cZ.FLEXLAYOUT__SPLITTER="flexlayout__splitter",cZ.FLEXLAYOUT__SPLITTER_EXTRA="flexlayout__splitter_extra",cZ.FLEXLAYOUT__SPLITTER_="flexlayout__splitter_",cZ.FLEXLAYOUT__SPLITTER_BORDER="flexlayout__splitter_border",cZ.FLEXLAYOUT__SPLITTER_DRAG="flexlayout__splitter_drag",cZ.FLEXLAYOUT__SPLITTER_HANDLE="flexlayout__splitter_handle",cZ.FLEXLAYOUT__SPLITTER_HANDLE_HORZ="flexlayout__splitter_handle_horz",cZ.FLEXLAYOUT__SPLITTER_HANDLE_VERT="flexlayout__splitter_handle_vert",cZ.FLEXLAYOUT__ROW="flexlayout__row",cZ.FLEXLAYOUT__TAB="flexlayout__tab",cZ.FLEXLAYOUT__TAB_POSITION="flexlayout__tab_position",cZ.FLEXLAYOUT__TAB_MOVEABLE="flexlayout__tab_moveable",cZ.FLEXLAYOUT__TAB_OVERLAY="flexlayout__tab_overlay",cZ.FLEXLAYOUT__TAB_LAYOUT_CONTAINER="flexlayout__tab_layout_container",cZ.FLEXLAYOUT__TAB_LAYOUT_CONTAINER_USER="flexlayout__tab_layout_container_user",cZ.FLEXLAYOUT__TABSET="flexlayout__tabset",cZ.FLEXLAYOUT__TABSET_CONTAINER="flexlayout__tabset_container",cZ.FLEXLAYOUT__TABSET_MAXIMIZED="flexlayout__tabset-maximized",cZ.FLEXLAYOUT__TABSET_SELECTED="flexlayout__tabset-selected",cZ.FLEXLAYOUT__TABSET_TAB_SPACER="flexlayout__tabset_tab_spacer",cZ.FLEXLAYOUT__TABSET_TAB_DIVIDER="flexlayout__tabset_tab_divider",cZ.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_BEFORE="flexlayout__tabset_tab_divider_selected_before",cZ.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER="flexlayout__tabset_tab_divider_selected_after",cZ.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER="flexlayout__tabset_tab_divider_inner",cZ.FLEXLAYOUT__TABSET_CONTENT="flexlayout__tabset_content",cZ.FLEXLAYOUT__TABSET_TABBAR_INNER="flexlayout__tabset_tabbar_inner",cZ.FLEXLAYOUT__TABSET_TABBAR_INNER_="flexlayout__tabset_tabbar_inner_",cZ.FLEXLAYOUT__TABSET_LEADING="flexlayout__tabset_leading",cZ.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER="flexlayout__tabset_tabbar_inner_tab_container",cZ.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_="flexlayout__tabset_tabbar_inner_tab_container_",cZ.FLEXLAYOUT__TABSET_TABBAR_OUTER="flexlayout__tabset_tabbar_outer",cZ.FLEXLAYOUT__TABSET_TABBAR_OUTER_="flexlayout__tabset_tabbar_outer_",cZ.FLEXLAYOUT__TAB_BORDER="flexlayout__tab_border",cZ.FLEXLAYOUT__TAB_BORDER_="flexlayout__tab_border_",cZ.FLEXLAYOUT__TAB_BUTTON="flexlayout__tab_button",cZ.FLEXLAYOUT__TAB_BUTTON_STRETCH="flexlayout__tab_button_stretch",cZ.FLEXLAYOUT__TAB_BUTTON_CONTENT="flexlayout__tab_button_content",cZ.FLEXLAYOUT__TAB_BUTTON_LEADING="flexlayout__tab_button_leading",cZ.FLEXLAYOUT__TAB_BUTTON_OVERFLOW="flexlayout__tab_button_overflow",cZ.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT="flexlayout__tab_button_overflow_count",cZ.FLEXLAYOUT__TAB_BUTTON_TEXTBOX="flexlayout__tab_button_textbox",cZ.FLEXLAYOUT__TAB_BUTTON_TRAILING="flexlayout__tab_button_trailing",cZ.FLEXLAYOUT__TAB_BUTTON_STAMP="flexlayout__tab_button_stamp",cZ.FLEXLAYOUT__TAB_TOOLBAR="flexlayout__tab_toolbar",cZ.FLEXLAYOUT__TAB_TOOLBAR_BUTTON="flexlayout__tab_toolbar_button",cZ.FLEXLAYOUT__TAB_TOOLBAR_ICON="flexlayout__tab_toolbar_icon",cZ.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_="flexlayout__tab_toolbar_button-",cZ.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT="flexlayout__tab_toolbar_button-float",cZ.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER="flexlayout__tab_toolbar_sticky_buttons_container",cZ.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE="flexlayout__tab_toolbar_button-close",cZ.FLEXLAYOUT__POPUP_MENU_CONTAINER="flexlayout__popup_menu_container",cZ.FLEXLAYOUT__POPUP_MENU_ITEM="flexlayout__popup_menu_item",cZ.FLEXLAYOUT__POPUP_MENU_ITEM__SELECTED="flexlayout__popup_menu_item--selected",cZ.FLEXLAYOUT__POPUP_MENU="flexlayout__popup_menu",cZ.FLEXLAYOUT__MINI_SCROLLBAR="flexlayout__mini_scrollbar",cZ.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER="flexlayout__mini_scrollbar_container",cZ),iF=class e{static ADD_TAB="FlexLayout_AddTab";static DELETE_TAB="FlexLayout_DeleteTab";static RENAME_TAB="FlexLayout_RenameTab";static SELECT_TAB="FlexLayout_SelectTab";static MOVE_NODE="FlexLayout_MoveNode";static DELETE_TABSET="FlexLayout_DeleteTabset";static SET_ACTIVE_TABSET="FlexLayout_SetActiveTabset";static ADJUST_WEIGHTS="FlexLayout_AdjustWeights";static ADJUST_BORDER_SPLIT="FlexLayout_AdjustBorderSplit";static MAXIMIZE_TOGGLE="FlexLayout_MaximizeToggle";static UPDATE_MODEL_ATTRIBUTES="FlexLayout_UpdateModelAttributes";static UPDATE_NODE_ATTRIBUTES="FlexLayout_UpdateNodeAttributes";static POPOUT_TAB="FlexLayout_PopoutTab";static POPOUT_TABSET="FlexLayout_PopoutTabset";static CLOSE_POPOUT="FlexLayout_ClosePopout";static MOVE_POPOUT_TO_FRONT="FlexLayout_MoveFloatToFront";static CREATE_SUBLAYOUT="FlexLayout_CreateSubLayout";static addTab(i,n,r,s,o){return new iH(e.ADD_TAB,{json:i,toNode:n,location:r.getName(),index:s,select:o})}static addNode(e,i,n,r,s){return this.addTab(e,i,n,r,s)}static moveNode(i,n,r,s,o){return new iH(e.MOVE_NODE,{fromNode:i,toNode:n,location:r.getName(),index:s,select:o})}static deleteTab(i){return new iH(e.DELETE_TAB,{node:i})}static deleteTabset(i){return new iH(e.DELETE_TABSET,{node:i})}static renameTab(i,n){return new iH(e.RENAME_TAB,{node:i,text:n})}static selectTab(i){return new iH(e.SELECT_TAB,{tabNode:i})}static setActiveTabset(i,n){return new iH(e.SET_ACTIVE_TABSET,{tabsetNode:i,layoutId:n})}static adjustWeights(i,n){return new iH(e.ADJUST_WEIGHTS,{nodeId:i,weights:n})}static adjustBorderSplit(i,n){return new iH(e.ADJUST_BORDER_SPLIT,{node:i,size:n})}static maximizeToggle(i,n){return new iH(e.MAXIMIZE_TOGGLE,{node:i,layoutId:n})}static updateModelAttributes(i){return new iH(e.UPDATE_MODEL_ATTRIBUTES,{json:i})}static updateNodeAttributes(i,n){return new iH(e.UPDATE_NODE_ATTRIBUTES,{node:i,json:n})}static popoutTab(i,n="window"){return new iH(e.POPOUT_TAB,{node:i,type:n})}static popoutTabset(i,n="window"){return new iH(e.POPOUT_TABSET,{node:i,type:n})}static closePopout(i){return new iH(e.CLOSE_POPOUT,{layoutId:i})}static movePopoutToFront(i){return new iH(e.MOVE_POPOUT_TO_FRONT,{layoutId:i})}static createPopout(e,i,n){return this.createSubLayout(e,i,n)}static createSubLayout(i,n,r){return new iH(e.CREATE_SUBLAYOUT,{layout:i,rect:n,type:r})}},iH=class{type;data;constructor(e,i){this.type=e,this.data=i}},iW=class{attributes;nameToAttribute;constructor(){this.attributes=[],this.nameToAttribute=new Map}addWithAll(e,i,n,r){let s=new i$(e,i,n,r);return this.attributes.push(s),this.nameToAttribute.set(e,s),s}addInherited(e,i){return this.addWithAll(e,i,void 0,!1)}add(e,i,n){return this.addWithAll(e,void 0,i,n)}getAttributes(){return this.attributes}getModelName(e){let i=this.nameToAttribute.get(e);if(void 0!==i)return i.modelName}toJson(e,i){for(let n of this.attributes){let r=i[n.name];(n.alwaysWriteJson||r!==n.defaultValue)&&(e[n.name]=r)}}fromJson(e,i){for(let n of this.attributes){let r=e[n.name];void 0===r&&n.alias&&(r=e[n.alias]),void 0===r?i[n.name]=n.defaultValue:i[n.name]=r}}update(e,i){for(let n of this.attributes)if(Object.prototype.hasOwnProperty.call(e,n.name)){let r=e[n.name];void 0===r?delete i[n.name]:i[n.name]=r}}setDefaults(e){for(let i of this.attributes)e[i.name]=i.defaultValue}pairAttributes(e,i){for(let n of i.attributes)if(n.modelName&&this.nameToAttribute.has(n.modelName)){let i=this.nameToAttribute.get(n.modelName);i.setpairedAttr(n),n.setpairedAttr(i),i.setPairedType(e)}}toTypescriptInterface(e,i){let n=[],r=this.attributes.sort((e,i)=>e.name.localeCompare(i.name));n.push("export interface I"+e+"Attributes {");for(let e=0;e<r.length;e++){let s,o,a=r[e],l=a.type,c=a;void 0!==c.defaultValue?s=c.defaultValue:void 0!==c.modelName&&void 0!==i&&void 0!==i.nameToAttribute.get(c.modelName)&&(o=c.modelName,s=(c=i.nameToAttribute.get(o)).defaultValue,l=c.type);let d=JSON.stringify(s),h=c.required?"":"?",u=" /**\n ";a.description?u+=a.description:a.pairedType&&a.pairedAttr?.description&&(u+=`Value for ${a.pairedType} attribute ${a.pairedAttr.name} if not overridden`,u+="\n\n ",u+=a.pairedAttr?.description),u+="\n\n ",a.fixed?u+=`Fixed value: ${d}`:o?u+=`Default: inherited from Global attribute ${a.modelName} (default ${d})`:u+=`Default: ${d}`,u+="\n */",n.push(u),n.push(" "+a.name+h+": "+l+";\n")}return n.push("}"),n.join("\n")}},i$=class{static NUMBER="number";static STRING="string";static BOOLEAN="boolean";name;alias;modelName;pairedAttr;pairedType;defaultValue;alwaysWriteJson;type;required;fixed;description;constructor(e,i,n,r){this.name=e,this.alias=void 0,this.modelName=i,this.defaultValue=n,this.alwaysWriteJson=r,this.required=!1,this.fixed=!1,this.type="any"}setType(e){return this.type=e,this}setAlias(e){return this.alias=e,this}setDescription(e){this.description=e}setRequired(){return this.required=!0,this}setFixed(){return this.fixed=!0,this}setpairedAttr(e){this.pairedAttr=e}setPairedType(e){this.pairedType=e}},iU=class{node;rect;location;index;className;constructor(e,i,n,r,s){this.node=e,this.rect=i,this.location=n,this.index=r,this.className=s}},iV=class{model;attributes;parent;children;rect;path;listeners;constructor(e){this.model=e,this.attributes={},this.children=[],this.rect=iP.empty(),this.listeners=new Map,this.path=""}getId(){let e=this.attributes.id;return void 0!==e||(e=this.model.nextUniqueId(),this.setId(e)),e}getModel(){return this.model}getType(){return this.attributes.type}getParent(){return this.parent}getChildren(){return this.children}getRect(){return this.rect}getPath(){return this.path}isCloseable(){for(let e=0;e<this.children.length;e++)if(!this.children[e].isCloseable())return!1;return!0}isAllowedInWindow(){for(let e=0;e<this.children.length;e++)if(!this.children[e].isAllowedInWindow())return!1;return!0}getOrientation(){return void 0===this.parent?this.model.isRootOrientationVertical()?iI.VERT:iI.HORZ:iI.flip(this.parent.getOrientation())}getLayoutId(){return this.getLayout().getLayoutId()}getLayout(){return this.parent?this.parent.getLayout():this.model.getMainLayout()}setEventListener(e,i){this.listeners.set(e,i)}removeEventListener(e){this.listeners.delete(e)}setId(e){this.attributes.id=e}fireEvent(e,i){this.listeners.has(e)&&this.listeners.get(e)(i)}getAttr(e){let i=this.attributes[e];if(void 0===i){let n=this.getAttributeDefinitions().getModelName(e);void 0!==n&&(i=this.model.getAttribute(n))}return i}forEachNode(e,i){for(let n of(e(this,i),i++,this.children))n.forEachNode(e,i)}setPaths(e){let i=0;for(let n of this.children){let r=e;"row"===n.getType()?r+="/r"+i:"tabset"===n.getType()?r+="/ts"+i:"tab"===n.getType()&&(r+="/t"+i),n.path=r,n.setPaths(r),i++}}setParent(e){this.parent=e}setRect(e){this.rect=e}setPath(e){this.path=e}setWeight(e){this.attributes.weight=e}setSelected(e){this.attributes.selected=e}findDropTargetNode(e,i,n,r){let s;if(this.rect.contains(n,r)){if(void 0!==this.model.getMaximizedTabset(e))s=this.model.getMaximizedTabset(e).canDrop(i,n,r);else if(void 0===(s=this.canDrop(i,n,r))&&0!==this.children.length){for(let o of this.children)if(void 0!==(s=o.findDropTargetNode(e,i,n,r)))break}}return s}canDrop(e,i,n){}canDockInto(e,i){if(null!=i){if(i.location===iB.CENTER&&!1===i.node.isEnableDrop()||i.location===iB.CENTER&&"tabset"===e.getType()&&!1===e.isEnableClose()||i.location!==iB.CENTER&&!1===i.node.isEnableDivide())return!1;if(this.model.getOnAllowDrop())return this.model.getOnAllowDrop()(e,i)}return!0}removeChild(e){let i=this.children.indexOf(e);return -1!==i&&this.children.splice(i,1),i}addChild(e,i){return null!=i?this.children.splice(i,0,e):(this.children.push(e),i=this.children.length-1),e.parent=this,i}removeAll(){this.children=[]}styleWithPosition(e){return null==e&&(e={}),this.rect.styleWithPosition(e)}isEnableDivide(){return!0}toAttributeString(){return JSON.stringify(this.attributes,void 0," ")}},iq=class e extends iV{static TYPE="tab";static fromJson(i,n,r=!0){return new e(n,i,r)}tabRect=iP.empty();moveableElement;renderedName;extra;visible;rendered;scrollTop;scrollLeft;tabStamp;constructor(i,n,r=!0){super(i),this.extra={},this.moveableElement=null,this.tabStamp=null,this.rendered=!1,this.visible=!1,e.attributeDefinitions.fromJson(n,this.attributes),!0===r&&i.addNode(this)}getName(){return this.getAttr("name")}getIcon(){return this.getAttr("icon")}getSubLayoutId(){return this.getAttr("subLayoutId")}getHelpText(){return this.getAttr("helpText")}getComponent(){return this.getAttr("component")}getWindowId(){let e=this.getLayout();if(e)return e.getWindowId()}getConfig(){return this.attributes.config}getExtraData(){return this.extra}isPoppedOut(){return this.getLayoutId()!==ne.MAIN_LAYOUT_ID}isSelected(){return this.getParent().getSelectedNode()===this}isCloseable(){let e=this.isEnableClose();return e&&this.getSubLayoutId()&&(e=this.model.getLayouts().get(this.getSubLayoutId()).getRootRow().isCloseable()),e}isAllowedInWindow(){let e=this.isEnablePopout();return e&&this.getSubLayoutId()&&(e=this.model.getLayouts().get(this.getSubLayoutId()).getRootRow().isAllowedInWindow()),e}isEnableClose(){return this.getAttr("enableClose")}getCloseType(){return this.getAttr("closeType")}isEnablePopout(){return this.getAttr("enablePopout")}isEnablePopoutIcon(){return this.getAttr("enablePopoutIcon")}isEnablePopoutFloatIcon(){return this.getAttr("enablePopoutFloatIcon")}isEnablePopoutOverlay(){return this.getAttr("enablePopoutOverlay")}isEnableDrag(){return this.getAttr("enableDrag")}isEnableRename(){return this.getAttr("enableRename")}isEnableWindowReMount(){return this.getAttr("enableWindowReMount")}getClassName(){return this.getAttr("className")}getContentClassName(){return this.getAttr("contentClassName")}getTabSetClassName(){return this.getAttr("tabsetClassName")}isEnableRenderOnDemand(){return this.getAttr("enableRenderOnDemand")}getMinWidth(){return this.getAttr("minWidth")}getMinHeight(){return this.getAttr("minHeight")}getMaxWidth(){return this.getAttr("maxWidth")}getMaxHeight(){return this.getAttr("maxHeight")}isVisible(){return this.visible}toJson(){let i={};return e.attributeDefinitions.toJson(i,this.attributes),i}saveScrollPosition(){this.moveableElement&&(this.scrollLeft=this.moveableElement.scrollLeft,this.scrollTop=this.moveableElement.scrollTop)}restoreScrollPosition(){this.scrollTop&&requestAnimationFrame(()=>{this.moveableElement&&this.scrollTop&&(this.moveableElement.scrollTop=this.scrollTop,this.moveableElement.scrollLeft=this.scrollLeft)})}setRect(e){e.equals(this.rect)||(this.fireEvent("resize",{rect:e}),this.rect=e)}setVisible(e){e!==this.visible&&(this.visible=e,this.fireEvent("visibility",{visible:e}))}getScrollTop(){return this.scrollTop}setScrollTop(e){this.scrollTop=e}getScrollLeft(){return this.scrollLeft}setScrollLeft(e){this.scrollLeft=e}isRendered(){return this.rendered}setRendered(e){this.rendered=e}getTabRect(){return this.tabRect}setTabRect(e){this.tabRect=e}getTabStamp(){return this.tabStamp}setTabStamp(e){this.tabStamp=e}getMoveableElement(){return this.moveableElement}setMoveableElement(e){this.moveableElement=e}setRenderedName(e){this.renderedName=e}getNameForOverflowMenu(){let e=this.getAttr("altName");return void 0!==e?e:this.renderedName}setName(e){this.attributes.name=e}delete(){this.parent.remove(this),this.getSubLayoutId()&&this.model.getLayouts().delete(this.getSubLayoutId()),this.fireEvent("close",{})}updateAttrs(i){e.attributeDefinitions.update(i,this.attributes)}getAttributeDefinitions(){return e.attributeDefinitions}setBorderWidth(e){this.attributes.borderWidth=e}setBorderHeight(e){this.attributes.borderHeight=e}static getAttributeDefinitions(){return e.attributeDefinitions}static attributeDefinitions=e.createAttributeDefinitions();static createAttributeDefinitions(){let i=new iW;return i.add("type",e.TYPE,!0).setType(i$.STRING).setFixed(),i.add("id",void 0).setType(i$.STRING).setDescription("the unique id of the tab, if left undefined a uuid will be assigned"),i.add("name","[Unnamed Tab]").setType(i$.STRING).setDescription("name of tab to be displayed in the tab button"),i.add("component",void 0).setType(i$.STRING).setDescription("string identifying which component to render in this tab (used in the layout factory function)"),i.add("subLayoutId",void 0).setType(i$.STRING).setDescription(`the Id of the sub layout to render in this tab, defined in the subLayouts section of the model json (if
4
+ component is also defined then use the <TabLayout> component in the factory to render the sublayout)`),i.add("altName",void 0).setType(i$.STRING).setDescription("if there is no name specifed then this value will be used in the overflow menu"),i.add("helpText",void 0).setType(i$.STRING).setDescription("help text for the tab to be displayed upon tab hover."),i.add("config",void 0).setType("any").setDescription("a place to hold json config for the hosted component"),i.add("tabsetClassName",void 0).setType(i$.STRING).setDescription("class applied to parent tabset when this is the only tab and it is stretched to fill the tabset"),i.add("enableWindowReMount",!1).setType(i$.BOOLEAN).setDescription("if enabled the tab will re-mount when popped out/in"),i.addInherited("enableClose","tabEnableClose").setType(i$.BOOLEAN).setDescription("allow user to close tab via close button"),i.addInherited("closeType","tabCloseType").setType("ICloseType").setDescription("see values in ICloseType"),i.addInherited("enableDrag","tabEnableDrag").setType(i$.BOOLEAN).setDescription("allow user to drag tab to new location"),i.addInherited("enableRename","tabEnableRename").setType(i$.BOOLEAN).setDescription("allow user to rename tabs by double clicking"),i.addInherited("className","tabClassName").setType(i$.STRING).setDescription("class applied to tab button"),i.addInherited("contentClassName","tabContentClassName").setType(i$.STRING).setDescription("class applied to tab content"),i.addInherited("icon","tabIcon").setType(i$.STRING).setDescription("the tab icon"),i.addInherited("enableRenderOnDemand","tabEnableRenderOnDemand").setType(i$.BOOLEAN).setDescription("whether to avoid rendering component until tab is visible"),i.addInherited("enablePopout","tabEnablePopout").setType(i$.BOOLEAN).setAlias("enableFloat").setDescription("enable popout (in popout capable browser)"),i.addInherited("enablePopoutIcon","tabEnablePopoutIcon").setType(i$.BOOLEAN).setDescription("whether to show the popout icon in the tabset header if this tab enables popouts"),i.addInherited("enablePopoutFloatIcon","tabEnablePopoutFloatIcon").setType(i$.BOOLEAN).setDescription("whether to show the popout float icon in the tabset header if this tab enables floating popouts"),i.addInherited("enablePopoutOverlay","tabEnablePopoutOverlay").setType(i$.BOOLEAN).setDescription(`if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)
5
+ then enabling this option will gray out this tab`),i.addInherited("borderWidth","tabBorderWidth").setType(i$.NUMBER).setDescription("width when added to border, -1 will use border size"),i.addInherited("borderHeight","tabBorderHeight").setType(i$.NUMBER).setDescription("height when added to border, -1 will use border size"),i.addInherited("minWidth","tabMinWidth").setType(i$.NUMBER).setDescription("the min width of this tab"),i.addInherited("minHeight","tabMinHeight").setType(i$.NUMBER).setDescription("the min height of this tab"),i.addInherited("maxWidth","tabMaxWidth").setType(i$.NUMBER).setDescription("the max width of this tab"),i.addInherited("maxHeight","tabMaxHeight").setType(i$.NUMBER).setDescription("the max height of this tab"),i}};function iK(){return window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches}function iY(e,i,n){let r,s=i.getName(),o=i.getName();void 0===n&&(n=0),void 0===r&&void 0!==i.getIcon()&&(r=0!==n?(0,iM.jsx)("img",{style:{width:"1em",height:"1em",transform:"rotate("+n+"deg)"},src:i.getIcon(),alt:"leadingContent"}):(0,iM.jsx)("img",{style:{width:"1em",height:"1em"},src:i.getIcon(),alt:"leadingContent"}));let a={leading:r,content:s,name:o,buttons:[]};return e.customizeTab(i,a),i.setRenderedName(a.name),a}function iX(e){let i=!1;return e.nativeEvent instanceof MouseEvent&&(0!==e.nativeEvent.button||e.ctrlKey||e.altKey||e.metaKey||e.shiftKey)&&(i=!0),i}function iJ(e,i){for(let n of[...iG("iframe",i),...iG("webview",i)])n.style.pointerEvents=e?"auto":"none"}function iG(e,i){return[...i.getElementsByTagName(e)]}var iZ=!1;function iQ(e,i,n,r,s){iZ=!0,i.preventDefault();let o=e=>{e.preventDefault(),n(e.clientX,e.clientY)},a=e=>{e.preventDefault(),iZ=!1,s()},l=()=>{e.removeEventListener("pointermove",o),e.removeEventListener("pointerup",l),e.removeEventListener("pointercancel",a),iZ=!1,r()};e.addEventListener("pointermove",o),e.addEventListener("pointerup",l),e.addEventListener("pointercancel",a)}function i0(e,i){let n=i.getType();if("window"===n)return e.isAllowedInWindow();if("float"===n)return!0;if("tab"===n){let n,r=(i.getController().getModel().visitNodes(e=>{e instanceof iq&&e.getSubLayoutId()===i.getLayoutId()&&(n=e.getLayout())}),n);if(r&&"window"===r.getType()&&!r.isMainLayout()&&!e.isAllowedInWindow())return!1;if(e instanceof iq){if(void 0!==e.getSubLayoutId())return!1}else if(e instanceof i5){for(let i of e.getChildren())if(void 0!==i.getSubLayoutId())return!1}return!0}return!1}function i1(e,i){let n=e.getAttribute("style");return n!==i.getAttribute("style")&&(n?i.setAttribute("style",n):i.removeAttribute("style"),!0)}var i2=class e extends iV{static TYPE="row";static fromJson(i,n,r){let s=new e(n,i);if(null!=i.children){for(let o of i.children)if(o.type===i5.TYPE){let e=i5.fromJson(o,n,r);s.addChild(e)}else if(o.type===e.TYPE){let i=e.fromJson(o,n,r);s.addChild(i)}}return s}static attributeDefinitions=e.createAttributeDefinitions();layout;minHeight;minWidth;maxHeight;maxWidth;constructor(i,n){super(i),this.minHeight=1,this.minWidth=1,this.maxHeight=i7,this.maxWidth=i7,e.attributeDefinitions.fromJson(n,this.attributes),this.normalizeWeights(),i.addNode(this)}getWeight(){return this.attributes.weight}toJson(){let i={};for(let n of(e.attributeDefinitions.toJson(i,this.attributes),i.children=[],this.children))i.children.push(n.toJson());return i}getLayout(){return this.layout?this.layout:super.getLayout()}setLayout(e){this.layout=e}setWeight(e){this.attributes.weight=e}getSplitterBounds(e){let i=this.getOrientation()===iI.HORZ,n=this.getChildren(),r=this.model.getSplitterSize(),s=n[0].getRect(),o=n[n.length-1].getRect(),a=i?[s.x,o.getRight()]:[s.y,o.getBottom()],l=i?[s.x,o.getRight()]:[s.y,o.getBottom()];for(let s=0;s<e;s++){let e=n[s];a[0]+=i?e.getMinWidth():e.getMinHeight(),l[0]+=i?e.getMaxWidth():e.getMaxHeight(),s>0&&(a[0]+=r,l[0]+=r)}for(let s=n.length-1;s>=e;s--){let e=n[s];a[1]-=(i?e.getMinWidth():e.getMinHeight())+r,l[1]-=(i?e.getMaxWidth():e.getMaxHeight())+r}return[Math.max(l[1],a[0]),Math.min(l[0],a[1])]}getSplitterInitials(e){let i=this.getOrientation()===iI.HORZ,n=this.getChildren(),r=this.model.getSplitterSize(),s=[],o=0;for(let e=0;e<n.length;e++){let r=n[e].getRect(),a=i?r.width:r.height;s.push(a),o+=a}let a=n[e].getRect();return{initialSizes:s,sum:o,startPosition:(i?a.x:a.y)-r}}calculateSplit(e,i,n,r,s){let o=this.getOrientation()===iI.HORZ,a=this.getChildren(),l=a[e],c=o?l.getMaxWidth():l.getMaxHeight(),d=[...n];if(i<s){let n=s-i,r=0;d[e]+n>c?(r=d[e]+n-c,d[e]=c):d[e]+=n;for(let i=e-1;i>=0;i--){let e=a[i],r=o?e.getMinWidth():e.getMinHeight();if(d[i]-n>r){d[i]-=n;break}n-=d[i]-r,d[i]=r}for(let i=e+1;i<a.length;i++){let e=a[i],n=o?e.getMaxWidth():e.getMaxHeight();if(d[i]+r<n){d[i]+=r;break}r-=n-d[i],d[i]=n}}else{let n=i-s,r=0;d[e-1]+n>c?(r=d[e-1]+n-c,d[e-1]=c):d[e-1]+=n;for(let i=e;i<a.length;i++){let e=a[i],r=o?e.getMinWidth():e.getMinHeight();if(d[i]-n>r){d[i]-=n;break}n-=d[i]-r,d[i]=r}for(let i=e-1;i>=0;i--){let e=a[i],n=o?e.getMaxWidth():e.getMaxHeight();if(d[i]+r<n){d[i]+=r;break}r-=n-d[i],d[i]=n}}return d.map(e=>100*Math.max(.1,e)/r)}getMinSize(e){return e===iI.HORZ?this.getMinWidth():this.getMinHeight()}getMinWidth(){return this.minWidth}getMinHeight(){return this.minHeight}getMaxSize(e){return e===iI.HORZ?this.getMaxWidth():this.getMaxHeight()}getMaxWidth(){return this.maxWidth}getMaxHeight(){return this.maxHeight}calcMinMaxSize(){this.minHeight=1,this.minWidth=1,this.maxHeight=i7,this.maxWidth=i7;let e=!0;for(let i of this.children)i.calcMinMaxSize(),this.getOrientation()===iI.VERT?(this.minHeight+=i.getMinHeight(),this.maxHeight+=i.getMaxHeight(),e||(this.minHeight+=this.model.getSplitterSize(),this.maxHeight+=this.model.getSplitterSize()),this.minWidth=Math.max(this.minWidth,i.getMinWidth()),this.maxWidth=Math.min(this.maxWidth,i.getMaxWidth())):(this.minWidth+=i.getMinWidth(),this.maxWidth+=i.getMaxWidth(),e||(this.minWidth+=this.model.getSplitterSize(),this.maxWidth+=this.model.getSplitterSize()),this.minHeight=Math.max(this.minHeight,i.getMinHeight()),this.maxHeight=Math.min(this.maxHeight,i.getMaxHeight())),e=!1}tidy(){let i=0;for(;i<this.children.length;){let n=this.children[i];if(n instanceof e){n.tidy();let r=n.getChildren();if(0===r.length)this.removeChild(n);else if(1===r.length){let s=r[0];if(this.removeChild(n),s instanceof e){let e=0,r=s.getChildren();for(let i of r)e+=i.getWeight();for(let s=0;s<r.length;s++){let o=r[s];o.setWeight(n.getWeight()*o.getWeight()/e),this.addChild(o,i+s)}}else s.setWeight(n.getWeight()),this.addChild(s,i)}else i++}else n instanceof i5&&0===n.getChildren().length&&n.isEnableDeleteWhenEmpty()&&n.isEnableClose()?(this.removeChild(n),n===this.model.getMaximizedTabset(this.getLayoutId())&&this.model.setMaximizedTabset(void 0,this.getLayoutId())):i++}if(this===this.model.getRootRow(this.getLayoutId())&&0===this.children.length)if(this.getLayout()?.getType()!=="tab"&&this.getLayoutId()!==ne.MAIN_LAYOUT_ID)this.model.getLayouts().delete(this.getLayoutId());else{let e=this.model.getOnCreateTabSet(),i=e?e():{};i={...i,selected:-1};let n=new i5(this.model,i);this.model.setActiveTabset(n,this.getLayoutId()),this.addChild(n)}}canDrop(e,i,n){let r,s=n-this.rect.y,o=i-this.rect.x,a=this.rect.width,l=this.rect.height,c=this.model.isEnableEdgeDockIndicators()?50:9999,d=this.getLayout();if(this.getLayoutId()===ne.MAIN_LAYOUT_ID||i0(e,d)){if(this.model.isEnableEdgeDock()&&void 0===this.parent){if(i<this.rect.x+10&&s>l/2-c&&s<l/2+c){let e=iB.LEFT,i=e.getDockRect(this.rect);i.width=i.width/2,r=new iU(this,i,e,-1,iz.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i>this.rect.getRight()-10&&s>l/2-c&&s<l/2+c){let e=iB.RIGHT,i=e.getDockRect(this.rect);i.width=i.width/2,i.x+=i.width,r=new iU(this,i,e,-1,iz.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(n<this.rect.y+10&&o>a/2-c&&o<a/2+c){let e=iB.TOP,i=e.getDockRect(this.rect);i.height=i.height/2,r=new iU(this,i,e,-1,iz.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(n>this.rect.getBottom()-10&&o>a/2-c&&o<a/2+c){let e=iB.BOTTOM,i=e.getDockRect(this.rect);i.height=i.height/2,i.y+=i.height,r=new iU(this,i,e,-1,iz.FLEXLAYOUT__OUTLINE_RECT_EDGE)}if(void 0!==r&&!e.canDockInto(e,r))return}return r}}drop(i,n,r){let s,o=i.getParent();if(o&&o.removeChild(i),void 0!==o&&o instanceof i5&&o.setSelected(0),void 0!==o&&o instanceof i6&&o.setSelected(-1),i instanceof i5||i instanceof e)(s=i)instanceof e&&s.getOrientation()===this.getOrientation()&&(n.getOrientation()===this.getOrientation()||n===iB.CENTER)&&(s=new e(this.model,{})).addChild(i);else{let e=this.model.getOnCreateTabSet(),n=e?e(i):{};(s=new i5(this.model,n)).addChild(i)}let a=this.children.reduce((e,i)=>e+i.getWeight(),0);0===a&&(a=100),s.setWeight(a/3);let l=!this.model.isRootOrientationVertical();if(n===iB.CENTER)-1===r?this.addChild(s,this.children.length):this.addChild(s,r);else if(l&&n===iB.LEFT||!l&&n===iB.TOP)this.addChild(s,0);else if(l&&n===iB.RIGHT||!l&&n===iB.BOTTOM)this.addChild(s);else if(l&&n===iB.TOP||!l&&n===iB.LEFT){let i=new e(this.model,{}),n=new e(this.model,{});for(let e of(n.setWeight(75),s.setWeight(25),this.children))n.addChild(e);this.removeAll(),i.addChild(s),i.addChild(n),this.addChild(i)}else if(l&&n===iB.BOTTOM||!l&&n===iB.RIGHT){let i=new e(this.model,{}),n=new e(this.model,{});for(let e of(n.setWeight(75),s.setWeight(25),this.children))n.addChild(e);this.removeAll(),i.addChild(n),i.addChild(s),this.addChild(i)}s instanceof i5&&this.model.setActiveTabset(s,this.getLayoutId()),this.model.tidy()}isEnableDrop(){return!0}getAttributeDefinitions(){return e.attributeDefinitions}updateAttrs(i){e.attributeDefinitions.update(i,this.attributes)}static getAttributeDefinitions(){return e.attributeDefinitions}normalizeWeights(){let e=0;for(let i of this.children)e+=i.getWeight();for(let i of(0===e&&(e=1),this.children))i.setWeight(Math.max(.001,100*i.getWeight()/e))}static createAttributeDefinitions(){let i=new iW;return i.add("type",e.TYPE,!0).setType(i$.STRING).setFixed(),i.add("id",void 0).setType(i$.STRING).setDescription("the unique id of the row, if left undefined a uuid will be assigned"),i.add("weight",100).setType(i$.NUMBER).setDescription("relative weight for sizing of this row in parent row"),i}},i5=class e extends iV{static TYPE="tabset";static fromJson(i,n,r){let s=new e(n,i);if(null!=i.children)for(let e of i.children){let i=iq.fromJson(e,n);s.addChild(i)}return 0===s.children.length&&s.setSelected(-1),i.maximized&&!0===i.maximized&&r.setMaximizedTabSet(s),i.active&&!0===i.active&&r.setActiveTabSet(s),s}static attributeDefinitions=e.createAttributeDefinitions();tabStripRect=iP.empty();contentRect=iP.empty();calculatedMinHeight;calculatedMinWidth;calculatedMaxHeight;calculatedMaxWidth;constructor(i,n){super(i),this.calculatedMinHeight=0,this.calculatedMinWidth=0,this.calculatedMaxHeight=0,this.calculatedMaxWidth=0,e.attributeDefinitions.fromJson(n,this.attributes),i.addNode(this)}getName(){return this.getAttr("name")}isEnableActiveIcon(){return this.getAttr("enableActiveIcon")}getSelected(){let e=this.attributes.selected;return void 0!==e?e:-1}getSelectedNode(){let e=this.getSelected();if(-1!==e)return this.children[e]}getWeight(){return this.getAttr("weight")}getAttrMinWidth(){return this.getAttr("minWidth")}getAttrMinHeight(){return this.getAttr("minHeight")}getMinWidth(){return this.calculatedMinWidth}getMinHeight(){return this.calculatedMinHeight}getMinSize(e){return e===iI.HORZ?this.getMinWidth():this.getMinHeight()}getAttrMaxWidth(){return this.getAttr("maxWidth")}getAttrMaxHeight(){return this.getAttr("maxHeight")}getMaxWidth(){return this.calculatedMaxWidth}getMaxHeight(){return this.calculatedMaxHeight}getMaxSize(e){return e===iI.HORZ?this.getMaxWidth():this.getMaxHeight()}isCloseable(){let e=this.isEnableClose();return e&&(e=super.isCloseable()),e}getConfig(){return this.attributes.config}isMaximized(){return this.model.getMaximizedTabset(this.getLayoutId())===this}isActive(){return this.model.getActiveTabset(this.getLayoutId())===this}isEnableDeleteWhenEmpty(){return this.getAttr("enableDeleteWhenEmpty")}isEnableDrop(){return this.getAttr("enableDrop")}isEnableTabStrip(){return this.getAttr("enableTabStrip")}isEnableTabWrap(){return this.getAttr("enableTabWrap")}isEnableDrag(){return this.getAttr("enableDrag")}isEnableDivide(){return this.getAttr("enableDivide")}isEnableMaximize(){return this.getAttr("enableMaximize")}isEnableClose(){return this.getAttr("enableClose")}isEnableCloseButton(){return this.getAttr("enableCloseButton")}isEnableSingleTabStretch(){return this.getAttr("enableSingleTabStretch")}isAutoSelectTab(){return this.getAttr("autoSelectTab")}isEnableTabScrollbar(){return this.getAttr("enableTabScrollbar")}getClassNameTabStrip(){return this.getAttr("classNameTabStrip")}getTabLocation(){return this.getAttr("tabLocation")}toJson(){let i={};return e.attributeDefinitions.toJson(i,this.attributes),i.children=this.children.map(e=>e.toJson()),this.isActive()&&(i.active=!0),this.isMaximized()&&(i.maximized=!0),i}calcMinMaxSize(){for(let e of(this.calculatedMinHeight=this.getAttrMinHeight(),this.calculatedMinWidth=this.getAttrMinWidth(),this.calculatedMaxHeight=this.getAttrMaxHeight(),this.calculatedMaxWidth=this.getAttrMaxWidth(),this.children))this.calculatedMinWidth=Math.max(this.calculatedMinWidth,e.getMinWidth()),this.calculatedMinHeight=Math.max(this.calculatedMinHeight,e.getMinHeight()),this.calculatedMaxWidth=Math.min(this.calculatedMaxWidth,e.getMaxWidth()),this.calculatedMaxHeight=Math.min(this.calculatedMaxHeight,e.getMaxHeight());this.calculatedMinHeight+=this.tabStripRect.height,this.calculatedMaxHeight+=this.tabStripRect.height}canMaximize(){return!!this.isEnableMaximize()&&(this.getModel().getMaximizedTabset(this.getLayoutId())===this||this.getParent()!==this.getModel().getRootRow(this.getLayoutId())||1!==this.getModel().getRootRow(this.getLayoutId()).getChildren().length)}setContentRect(e){this.contentRect=e}getContentRect(){return this.contentRect}setTabStripRect(e){this.tabStripRect=e}setWeight(e){this.attributes.weight=e}setSelected(e){this.attributes.selected=e}canDrop(e,i,n){let r,s=this.getLayout();if(e===this){let e=iB.CENTER;r=new iU(this,this.tabStripRect,e,-1,iz.FLEXLAYOUT__OUTLINE_RECT)}else if(this.getLayoutId()!==ne.MAIN_LAYOUT_ID&&!i0(e,s))return;else if(this.contentRect.contains(i,n)){let e=iB.CENTER;void 0===this.model.getMaximizedTabset(this.getLayoutId())&&(e=iB.getLocation(this.contentRect,i,n)),r=new iU(this,e.getDockRect(this.rect),e,-1,iz.FLEXLAYOUT__OUTLINE_RECT)}else if(null!=this.tabStripRect&&this.tabStripRect.contains(i,n)){let e,s,o;if(0===this.children.length)s=(e=this.tabStripRect.clone()).y+3,o=e.height-4,e.width=2;else{let a=this.children[0];s=(e=a.getTabRect()).y,o=e.height;let l=this.tabStripRect.x;for(let o=0;o<this.children.length;o++){(e=(a=this.children[o]).getTabRect()).y!==s&&(s=e.y,l=this.tabStripRect.x);let c=e.x+e.width/2;if(l<=i&&i<c&&e.y<n&&n<e.getBottom()){let i=iB.CENTER,n=new iP(e.x-2,e.y,3,e.height);if(!(this.rect.x<e.x&&e.x<this.rect.getRight()))return;r=new iU(this,n,i,o,iz.FLEXLAYOUT__OUTLINE_RECT);break}l=c}}if(null==r&&e.getRight()<this.rect.getRight()){let i=iB.CENTER;r=new iU(this,new iP(e.getRight()-2,s,3,o),i,this.children.length,iz.FLEXLAYOUT__OUTLINE_RECT)}}if(e.canDockInto(e,r))return r}delete(){this.parent.removeChild(this)}remove(e){let i=this.removeChild(e);this.model.tidy(),i3(this,i)}drop(i,n,r,s){if(this===i)return;let o=i.getParent(),a=0;if(void 0!==o&&(a=o.removeChild(i),o instanceof i6&&o.getSelected()===a?o.setSelected(-1):i3(o,a)),i instanceof iq&&o===this&&a<r&&r>0&&r--,n===iB.CENTER){let e=r;if(-1===e&&(e=this.children.length),i instanceof iq)this.addChild(i,e),(s||!1!==s&&this.isAutoSelectTab())&&this.setSelected(e);else if(i instanceof i2)i.forEachNode((i,n)=>{i instanceof iq&&(this.addChild(i,e),e++)},0);else{for(let n=0;n<i.getChildren().length;n++){let r=i.getChildren()[n];this.addChild(r,e),e++}-1===this.getSelected()&&this.children.length>0&&this.setSelected(0)}this.model.setActiveTabset(this,this.parent.getLayoutId())}else{let r=i;if(i instanceof iq){let n=this.model.getOnCreateTabSet();(r=new e(this.model,n?n(i):{})).addChild(i)}else if(i instanceof i2){let e=this.getParent();if(i.getOrientation()===e.getOrientation()&&(n.getOrientation()===e.getOrientation()||n===iB.CENTER)){let e=new i2(this.model,{});e.addChild(i),r=e}}else r=i;let s=this.parent,o=s.getChildren().indexOf(this);if(s.getOrientation()===n.orientation)r.setWeight(this.getWeight()/2),this.setWeight(this.getWeight()/2),s.addChild(r,o+n.indexPlus);else{let e=new i2(this.model,{});e.setWeight(this.getWeight()),e.addChild(this),this.setWeight(50),r.setWeight(50),e.addChild(r,n.indexPlus),s.removeChild(this),s.addChild(e,o)}r instanceof e&&this.model.setActiveTabset(r,this.getLayoutId())}this.model.tidy()}updateAttrs(i){e.attributeDefinitions.update(i,this.attributes)}getAttributeDefinitions(){return e.attributeDefinitions}static getAttributeDefinitions(){return e.attributeDefinitions}static createAttributeDefinitions(){let i=new iW;return i.add("type",e.TYPE,!0).setType(i$.STRING).setFixed(),i.add("id",void 0).setType(i$.STRING).setDescription("the unique id of the tab set, if left undefined a uuid will be assigned"),i.add("weight",100).setType(i$.NUMBER).setDescription("relative weight for sizing of this tabset in parent row"),i.add("selected",0).setType(i$.NUMBER).setDescription("index of selected/visible tab in tabset"),i.add("name",void 0).setType(i$.STRING),i.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),i.addInherited("enableDeleteWhenEmpty","tabSetEnableDeleteWhenEmpty").setDescription("whether to delete this tabset when is has no tabs"),i.addInherited("enableDrop","tabSetEnableDrop").setDescription("allow user to drag tabs into this tabset"),i.addInherited("enableDrag","tabSetEnableDrag").setDescription("allow user to drag tabs out this tabset"),i.addInherited("enableDivide","tabSetEnableDivide").setDescription("allow user to drag tabs to region of this tabset, splitting into new tabset"),i.addInherited("enableMaximize","tabSetEnableMaximize").setDescription("allow user to maximize tabset to fill view via maximize button"),i.addInherited("enableClose","tabSetEnableClose").setDescription("can this tabset be closed"),i.addInherited("enableCloseButton","tabSetEnableCloseButton").setDescription("if the tabset can be closed then show a close button"),i.addInherited("enableSingleTabStretch","tabSetEnableSingleTabStretch").setDescription("if the tabset has only a single tab then stretch the single tab to fill area and display in a header style"),i.addInherited("classNameTabStrip","tabSetClassNameTabStrip").setDescription("a class name to apply to the tab strip"),i.addInherited("enableTabStrip","tabSetEnableTabStrip").setDescription("enable tab strip and allow multiple tabs in this tabset"),i.addInherited("minWidth","tabSetMinWidth").setDescription("minimum width (in px) for this tabset"),i.addInherited("minHeight","tabSetMinHeight").setDescription("minimum height (in px) for this tabset"),i.addInherited("maxWidth","tabSetMaxWidth").setDescription("maximum width (in px) for this tabset"),i.addInherited("maxHeight","tabSetMaxHeight").setDescription("maximum height (in px) for this tabset"),i.addInherited("enableTabWrap","tabSetEnableTabWrap").setDescription("wrap tabs onto multiple lines"),i.addInherited("tabLocation","tabSetTabLocation").setDescription("the location of the tabs either top or bottom"),i.addInherited("autoSelectTab","tabSetAutoSelectTab").setType(i$.BOOLEAN).setDescription("whether to select new/moved tabs in tabset"),i.addInherited("enableActiveIcon","tabSetEnableActiveIcon").setType(i$.BOOLEAN).setDescription("whether the active icon (*) should be displayed when the tabset is active"),i.addInherited("enableTabScrollbar","tabSetEnableTabScrollbar").setType(i$.BOOLEAN).setDescription("whether to show a mini scrollbar for the tabs"),i}};function i3(e,i){if(void 0!==e&&(e instanceof i5||e instanceof i6)){let n=e.getSelected();-1!==n&&(i===n&&e.getChildren().length>0?i>=e.getChildren().length&&e.setSelected(e.getChildren().length-1):i<n?e.setSelected(n-1):i>n||e.setSelected(-1))}}function i4(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}var i6=class e extends iV{static TYPE="border";static fromJson(i,n){let r=new e(iB.getByName(i.location),i,n);return i.children&&(r.children=i.children.map(e=>{let i=iq.fromJson(e,n);return i.setParent(r),i})),r}static attributeDefinitions=e.createAttributeDefinitions();contentRect=iP.empty();tabHeaderRect=iP.empty();location;constructor(i,n,r){super(r),this.location=i,this.attributes.id=`border_${i.getName()}`,e.attributeDefinitions.fromJson(n,this.attributes),r.addNode(this)}getLocation(){return this.location}getClassName(){return this.getAttr("className")}isHorizontal(){return this.location.orientation===iI.HORZ}getSize(){let e=this.getAttr("size"),i=this.getSelected();if(-1===i)return e;{let n=this.children[i],r=this.isHorizontal()?n.getAttr("borderWidth"):n.getAttr("borderHeight");return -1===r?e:r}}getMinSize(){let e=this.getSelectedNode(),i=this.getAttr("minSize");return e&&(i=Math.max(i,this.isHorizontal()?e.getMinWidth():e.getMinHeight())),i}getMaxSize(){let e=this.getSelectedNode(),i=this.getAttr("maxSize");return e&&(i=Math.min(i,this.isHorizontal()?e.getMaxWidth():e.getMaxHeight())),i}getSelected(){return this.attributes.selected}isAutoHide(){return this.getAttr("enableAutoHide")}getSelectedNode(){if(-1!==this.getSelected())return this.children[this.getSelected()]}getOrientation(){return this.location.getOrientation()}getConfig(){return this.attributes.config}isMaximized(){return!1}isShowing(){return this.attributes.show}toJson(){let i={location:"bottom"};return e.attributeDefinitions.toJson(i,this.attributes),i.location=this.location.getName(),i.children=this.children.map(e=>e.toJson()),i}isAutoSelectTab(e){return(null==e&&(e=-1!==this.getSelected()),e)?this.getAttr("autoSelectTabWhenOpen"):this.getAttr("autoSelectTabWhenClosed")}isEnableTabScrollbar(){return this.getAttr("enableTabScrollbar")}setSelected(e){this.attributes.selected=e}getTabHeaderRect(){return this.tabHeaderRect}setTabHeaderRect(e){this.tabHeaderRect=e}getRect(){return this.tabHeaderRect}getContentRect(){return this.contentRect}setContentRect(e){this.contentRect=e}isEnableDrop(){return this.getAttr("enableDrop")}setSize(e){let i=this.getSelected();if(-1===i)this.attributes.size=e;else{let n=this.children[i];(this.isHorizontal()?n.getAttr("borderWidth"):n.getAttr("borderHeight"))===-1?this.attributes.size=e:this.isHorizontal()?n.setBorderWidth(e):n.setBorderHeight(e)}}updateAttrs(i){e.attributeDefinitions.update(i,this.attributes)}remove(e){let i=this.removeChild(e);-1!==this.getSelected()&&i3(this,i)}canDrop(e,i,n){let r;if(!(e instanceof iq))return;let s=iB.CENTER;if(this.tabHeaderRect.contains(i,n)){if(this.location.orientation===iI.VERT)if(this.children.length>0){let e=this.children[0],n=e.getTabRect(),o=n.y,a=n.height,l=this.tabHeaderRect.x;for(let c=0;c<this.children.length;c++){let d=(n=(e=this.children[c]).getTabRect()).x+n.width/2;if(i>=l&&i<d){r=new iU(this,new iP(n.x-2,o,3,a),s,c,iz.FLEXLAYOUT__OUTLINE_RECT);break}l=d}null==r&&(r=new iU(this,new iP(n.getRight()-2,o,3,a),s,this.children.length,iz.FLEXLAYOUT__OUTLINE_RECT))}else r=new iU(this,new iP(this.tabHeaderRect.x+1,this.tabHeaderRect.y+2,3,18),s,0,iz.FLEXLAYOUT__OUTLINE_RECT);else if(this.children.length>0){let e=this.children[0],i=e.getTabRect(),o=i.x,a=i.width,l=this.tabHeaderRect.y;for(let c=0;c<this.children.length;c++){let d=(i=(e=this.children[c]).getTabRect()).y+i.height/2;if(n>=l&&n<d){r=new iU(this,new iP(o,i.y-2,a,3),s,c,iz.FLEXLAYOUT__OUTLINE_RECT);break}l=d}null==r&&(r=new iU(this,new iP(o,i.getBottom()-2,a,3),s,this.children.length,iz.FLEXLAYOUT__OUTLINE_RECT))}else r=new iU(this,new iP(this.tabHeaderRect.x+2,this.tabHeaderRect.y+1,18,3),s,0,iz.FLEXLAYOUT__OUTLINE_RECT);if(!e.canDockInto(e,r))return}else if(-1!==this.getSelected()&&this.contentRect.contains(i,n)&&(r=new iU(this,this.contentRect,s,-1,iz.FLEXLAYOUT__OUTLINE_RECT),!e.canDockInto(e,r)))return;return r}drop(i,n,r,s){let o=0,a=i.getParent();void 0!==a&&(o=a.removeChild(i),a!==this&&a instanceof e&&a.getSelected()===o?a.setSelected(-1):i3(a,o)),i instanceof iq&&a===this&&o<r&&r>0&&r--;let l=r;-1===l&&(l=this.children.length),i instanceof iq&&this.addChild(i,l),(s||!1!==s&&this.isAutoSelectTab())&&this.setSelected(l),this.model.tidy()}getSplitterBounds(e,i=!1){let n=[0,0],r=i?this.getMinSize():0,s=i?this.getMaxSize():99999,o=this.model.getRootRow(ne.MAIN_LAYOUT_ID),a=o.getRect(),l=this.model.getSplitterSize();if(this.location===iB.TOP){n[0]=this.tabHeaderRect.getBottom()+r;let e=this.tabHeaderRect.getBottom()+s;n[1]=Math.max(n[0],a.getBottom()-o.getMinHeight()-l),n[1]=Math.min(n[1],e)}else if(this.location===iB.LEFT){n[0]=this.tabHeaderRect.getRight()+r;let e=this.tabHeaderRect.getRight()+s;n[1]=Math.max(n[0],a.getRight()-o.getMinWidth()-l),n[1]=Math.min(n[1],e)}else if(this.location===iB.BOTTOM){n[1]=this.tabHeaderRect.y-r-l;let e=this.tabHeaderRect.y-s-l;n[0]=Math.min(n[1],a.y+o.getMinHeight()),n[0]=Math.max(n[0],e)}else if(this.location===iB.RIGHT){n[1]=this.tabHeaderRect.x-r-l;let e=this.tabHeaderRect.x-s-l;n[0]=Math.min(n[1],a.x+o.getMinWidth()),n[0]=Math.max(n[0],e)}return n}calculateSplit(e,i){let n=this.getSplitterBounds(i);return this.location===iB.BOTTOM||this.location===iB.RIGHT?Math.max(0,n[1]-i):Math.max(0,i-n[0])}getAttributeDefinitions(){return e.attributeDefinitions}static getAttributeDefinitions(){return e.attributeDefinitions}static createAttributeDefinitions(){let i=new iW;return i.add("type",e.TYPE,!0).setType(i$.STRING).setFixed(),i.add("selected",-1).setType(i$.NUMBER).setDescription("index of selected/visible tab in border; -1 means no tab selected"),i.add("show",!0).setType(i$.BOOLEAN).setDescription("show/hide this border"),i.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),i.addInherited("enableDrop","borderEnableDrop").setType(i$.BOOLEAN).setDescription("whether tabs can be dropped into this border"),i.addInherited("className","borderClassName").setType(i$.STRING).setDescription("class applied to tab button"),i.addInherited("autoSelectTabWhenOpen","borderAutoSelectTabWhenOpen").setType(i$.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is already open"),i.addInherited("autoSelectTabWhenClosed","borderAutoSelectTabWhenClosed").setType(i$.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is currently closed"),i.addInherited("size","borderSize").setType(i$.NUMBER).setDescription("size of the tab area when selected"),i.addInherited("minSize","borderMinSize").setType(i$.NUMBER).setDescription("the minimum size of the tab area"),i.addInherited("maxSize","borderMaxSize").setType(i$.NUMBER).setDescription("the maximum size of the tab area"),i.addInherited("enableAutoHide","borderEnableAutoHide").setType(i$.BOOLEAN).setDescription("hide border if it has zero tabs"),i.addInherited("enableTabScrollbar","borderEnableTabScrollbar").setType(i$.BOOLEAN).setDescription("whether to show a mini scrollbar for the tabs"),i}},i8=class e{static fromJson(i,n){let r=new e(n);for(let e of(r.borders=i.map(e=>i6.fromJson(e,n)),r.borders))r.borderMap.set(e.getLocation(),e);return r}borders;borderMap;layoutHorizontal;constructor(e){this.borders=[],this.borderMap=new Map,this.layoutHorizontal=!0}toJson(){return this.borders.map(e=>e.toJson())}getLayoutHorizontal(){return this.layoutHorizontal}getBorders(){return this.borders}getBorderMap(){return this.borderMap}forEachNode(e){for(let i of this.borders)for(let n of(e(i,0),i.getChildren()))n.forEachNode(e,1)}setPaths(){for(let e of this.borders){let i="/border/"+e.getLocation().getName();e.setPath(i);let n=0;for(let r of e.getChildren())r.setPath(i+"/t"+n),n++}}findDropTargetNode(e,i,n){for(let r of this.borders)if(r.isShowing()){let s=r.canDrop(e,i,n);if(void 0!==s)return s}}},i9=class e{_layoutId;_type;_rect;_controller;_rootRow;_maximizedTabSet;_activeTabSet;_toExportRectFunction;constructor(e,i,n){this._layoutId=e,this._type=i,this._rect=n,this._toExportRectFunction=(e,i)=>e}visitNodes(e){this.getRootRow()?.forEachNode(e,0)}isMainLayout(){return this._layoutId===ne.MAIN_LAYOUT_ID}getLayoutId(){return this._layoutId}getType(){return this._type}setType(e){this._type=e}getRect(){return this._rect}getController(){return this._controller}getWindow(){return this._controller?.getCurrentWindow()}getRootRow(){return this._rootRow}getMaximizedTabSet(){return this._maximizedTabSet}getActiveTabSet(){return this._activeTabSet}setRect(e){this._rect=e}setController(e){this._controller=e}getWindowId(){return this._controller?.getWindowId()}setRootRow(e){e?.setLayout(this),this._rootRow=e}setMaximizedTabSet(e){this._maximizedTabSet=e}setActiveTabSet(e){this._activeTabSet=e}getToExportRectFunction(){return this._toExportRectFunction}setToExportRectFunction(e){this._toExportRectFunction=e}toJson(){return"window"===this.getType()&&this.getWindow()&&this.getWindow().screenTop>-1e4&&this.setRect(new iP(this.getWindow().screenLeft,this.getWindow().screenTop,this.getWindow().outerWidth,this.getWindow().outerHeight)),{type:this.getType(),layout:this.getRootRow().toJson(),rect:"tab"===this.getType()?void 0:this.getRect().toJson()}}static fromJson(i,n,r){let s=n.getLayouts().size,o=i.rect?iP.fromJson(i.rect):new iP(50+50*s,50+50*s,600,400);o.snap(10);let a=new e(r,i.type||"window",o);return a.setRootRow(i2.fromJson(i.layout,n,a)),a}},i7=99999,ne=class e{static MAIN_LAYOUT_ID="__main_layout_id__";static attributeDefinitions=e.createAttributeDefinitions();attributes;layouts;borders;changeListeners;idMap;mainLayout;splitterSize;onAllowDrop;onCreateTabSet;constructor(){this.attributes={},this.layouts=new Map,this.borders=new i8(this),this.idMap=new Map,this.changeListeners=[],this.mainLayout=new i9(e.MAIN_LAYOUT_ID,"window",iP.empty()),this.layouts.set(e.MAIN_LAYOUT_ID,this.mainLayout),this.splitterSize=8}doAction(i){let n;switch(i.type){case iF.ADD_TAB:{let e=new iq(this,i.data.json,!0),r=this.idMap.get(i.data.toNode);(r instanceof i5||r instanceof i6||r instanceof i2)&&(r.drop(e,iB.getByName(i.data.location),i.data.index,i.data.select),n=e);break}case iF.MOVE_NODE:{let e=this.idMap.get(i.data.fromNode);if(e instanceof iq||e instanceof i5||e instanceof i2){e===this.getMaximizedTabset(e.getLayoutId())&&this.layouts.get(e.getLayoutId()).setMaximizedTabSet(void 0);let n=this.idMap.get(i.data.toNode);(n instanceof i5||n instanceof i6||n instanceof i2)&&n.drop(e,iB.getByName(i.data.location),i.data.index,i.data.select)}break}case iF.DELETE_TAB:{let e=this.idMap.get(i.data.node);e instanceof iq&&e.delete();break}case iF.DELETE_TABSET:{let e=this.idMap.get(i.data.node);if(e instanceof i5){let i=[...e.getChildren()];for(let e=0;e<i.length;e++){let n=i[e];n.isEnableClose()&&n.delete()}0===e.getChildren().length&&e.delete(),this.tidy()}break}case iF.POPOUT_TABSET:{let e=this.idMap.get(i.data.node);if(e instanceof i5){let n=e.isMaximized(),r=e.getLayout(),s=i4(),o=i.data.type||"window",a=new i9(s,o,r.getToExportRectFunction()(e.getRect(),o)),l=i2.fromJson({type:"row"},this,a);a.setRootRow(l),this.layouts.set(s,a),l.drop(e,iB.CENTER,0),n&&this.mainLayout.setMaximizedTabSet(void 0)}break}case iF.POPOUT_TAB:{let e=this.idMap.get(i.data.node);if(e instanceof iq){let n=i4(),r=e.getParent().getContentRect(),s=e.getLayout(),o=i.data.type||"window",a=new i9(n,o,s.getToExportRectFunction()(r,o)),l=i4(),c=i2.fromJson({type:"row",children:[{type:"tabset",id:l}]},this,a);a.setRootRow(c),this.layouts.set(n,a),this.idMap.get(l).drop(e,iB.CENTER,0,!0)}break}case iF.SELECT_TAB:{let e=this.idMap.get(i.data.tabNode);if(e instanceof iq){let i=e.getParent(),n=i.getChildren().indexOf(e);i instanceof i6?i.getSelected()===n?i.setSelected(-1):i.setSelected(n):i instanceof i5&&(i.getSelected()!==n&&i.setSelected(n),e.getLayout().setActiveTabSet(i))}break}case iF.SET_ACTIVE_TABSET:{let n=i.data.layoutId?i.data.layoutId:e.MAIN_LAYOUT_ID,r=this.layouts.get(n);if(void 0===i.data.tabsetNode)r.setActiveTabSet(void 0);else{let e=this.idMap.get(i.data.tabsetNode);e instanceof i5&&r.setActiveTabSet(e)}break}case iF.ADJUST_WEIGHTS:{let e=this.idMap.get(i.data.nodeId).getChildren();for(let n=0;n<e.length;n++)e[n].setWeight(i.data.weights[n]);break}case iF.ADJUST_BORDER_SPLIT:{let e=this.idMap.get(i.data.node);e instanceof i6&&e.setSize(i.data.size);break}case iF.MAXIMIZE_TOGGLE:{let n=i.data.layoutId?i.data.layoutId:e.MAIN_LAYOUT_ID,r=this.layouts.get(n),s=this.idMap.get(i.data.node);s instanceof i5&&(s===r.getMaximizedTabSet()?r.setMaximizedTabSet(void 0):(r.setMaximizedTabSet(s),r.setActiveTabSet(s)));break}case iF.UPDATE_MODEL_ATTRIBUTES:this.updateAttrs(i.data.json);break;case iF.UPDATE_NODE_ATTRIBUTES:this.idMap.get(i.data.node).updateAttrs(i.data.json);break;case iF.RENAME_TAB:{let e=this.idMap.get(i.data.node);e instanceof iq&&e.setName(i.data.text);break}case iF.CREATE_SUBLAYOUT:{let e=i4(),r=new i9(e,i.data.type||"window",iP.fromJson(i.data.rect)),s=i2.fromJson(i.data.layout,this,r);r.setRootRow(s),this.layouts.set(e,r),n=e;break}case iF.CLOSE_POPOUT:{let e=this.layouts.get(i.data.layoutId);if(e){e.setType("float");let i=this.mainLayout.getController().getDomRect();e.setRect(new iP(i.width/4,i.height/4,i.width/2,i.height/2))}break}case iF.MOVE_POPOUT_TO_FRONT:{let e=i.data.layoutId,n=this.layouts.get(e);n&&(this.layouts.delete(e),this.layouts.set(e,n))}}for(let e of(this.updateIdMap(),this.changeListeners))e(i);return n}getActiveTabset(i=e.MAIN_LAYOUT_ID){let n=this.layouts.get(i);return n&&n.getActiveTabSet()&&this.getNodeById(n.getActiveTabSet().getId())?n.getActiveTabSet():void 0}getMaximizedTabset(i=e.MAIN_LAYOUT_ID){return this.layouts.get(i).getMaximizedTabSet()}getRootRow(i=e.MAIN_LAYOUT_ID){return this.layouts.get(i).getRootRow()}isRootOrientationVertical(){return this.attributes.rootOrientationVertical}isEnableRotateBorderIcons(){return this.attributes.enableRotateBorderIcons}getBorderSet(){return this.borders}visitNodes(e){for(let[i,n]of(this.borders.forEachNode(e),this.layouts))n.getRootRow().forEachNode(e,0)}visitLayoutNodes(i,n){this.layouts.has(i)&&(i===e.MAIN_LAYOUT_ID&&this.borders.forEachNode(n),this.layouts.get(i).visitNodes(n))}getNodeById(e){return this.idMap.get(e)}getFirstTabSet(i=this.layouts.get(e.MAIN_LAYOUT_ID).getRootRow()){let n=i.getChildren()[0];return n instanceof i5?n:this.getFirstTabSet(n)}static fromJson(i){let n=new e;e.attributeDefinitions.fromJson(i.global,n.attributes),i.borders&&(n.borders=i8.fromJson(i.borders,n));let r=i.subLayouts||i.popouts;if(r)for(let e in r){let i=r[e],s=i9.fromJson(i,n,e);n.layouts.set(e,s)}return n.mainLayout.setRootRow(i2.fromJson(i.layout,n,n.mainLayout)),n.tidy(),n}toJson(){let i={};e.attributeDefinitions.toJson(i,this.attributes),this.visitNodes(e=>{e.fireEvent("save",{})});let n={};for(let[i,r]of this.layouts)i!==e.MAIN_LAYOUT_ID&&(n[i]=r.toJson());return{global:i,borders:this.borders.toJson(),layout:this.mainLayout.getRootRow().toJson(),subLayouts:n}}getSplitterSize(){return this.splitterSize}setSplitterSize(e){this.splitterSize=e}isEnableEdgeDock(){return this.attributes.enableEdgeDock}isEnableEdgeDockIndicators(){return this.attributes.enableEdgeDockIndicators}setOnAllowDrop(e){this.onAllowDrop=e}setOnCreateTabSet(e){this.onCreateTabSet=e}addChangeListener(e){this.changeListeners.push(e)}removeChangeListener(e){let i=this.changeListeners.findIndex(i=>i===e);-1!==i&&this.changeListeners.splice(i,1)}toString(){return JSON.stringify(this.toJson())}getMainLayout(){return this.mainLayout}getLayouts(){return this.layouts}sortLayouts(){let e={window:1,tab:2,float:3},i=Array.from(this.getLayouts().values()).sort((i,n)=>e[i.getType()]-e[n.getType()]);this.layouts.clear(),i.forEach(e=>this.layouts.set(e.getLayoutId(),e))}setActiveTabset(e,i){let n=this.layouts.get(i);n&&(e?n.setActiveTabSet(e):n.setActiveTabSet(void 0))}setMaximizedTabset(e,i){let n=this.layouts.get(i);n&&(e?n.setMaximizedTabSet(e):n.setMaximizedTabSet(void 0))}updateIdMap(){this.idMap.clear(),this.visitNodes(e=>{this.idMap.set(e.getId(),e)})}addNode(e){let i=e.getId();if(this.idMap.has(i))throw Error(`Error: each node must have a unique id, duplicate id:${e.getId()}`);this.idMap.set(i,e)}findDropTargetNode(i,n,r,s){let o=this.layouts.get(i).getRootRow().findDropTargetNode(i,n,r,s);return void 0===o&&i===e.MAIN_LAYOUT_ID&&(o=this.borders.findDropTargetNode(n,r,s)),o}tidy(){for(let[e,i]of this.layouts)i.getRootRow().tidy()}updateAttrs(i){e.attributeDefinitions.update(i,this.attributes)}nextUniqueId(){return"#"+i4()}getAttribute(e){return this.attributes[e]}getOnAllowDrop(){return this.onAllowDrop}getOnCreateTabSet(){return this.onCreateTabSet}static toTypescriptInterfaces(){e.attributeDefinitions.pairAttributes("RowNode",i2.getAttributeDefinitions()),e.attributeDefinitions.pairAttributes("TabSetNode",i5.getAttributeDefinitions()),e.attributeDefinitions.pairAttributes("TabNode",iq.getAttributeDefinitions()),e.attributeDefinitions.pairAttributes("BorderNode",i6.getAttributeDefinitions());let i=[];i.push(e.attributeDefinitions.toTypescriptInterface("Global",void 0)),i.push(i2.getAttributeDefinitions().toTypescriptInterface("Row",e.attributeDefinitions)),i.push(i5.getAttributeDefinitions().toTypescriptInterface("TabSet",e.attributeDefinitions)),i.push(iq.getAttributeDefinitions().toTypescriptInterface("Tab",e.attributeDefinitions)),i.push(i6.getAttributeDefinitions().toTypescriptInterface("Border",e.attributeDefinitions)),console.log(i.join("\n"))}static createAttributeDefinitions(){let e=new iW;return e.add("enableEdgeDock",!0).setType(i$.BOOLEAN).setDescription("enable docking to the edges of the layout"),e.add("enableEdgeDockIndicators",!0).setType(i$.BOOLEAN).setDescription("show the edge indicators when dragging"),e.add("rootOrientationVertical",!1).setType(i$.BOOLEAN).setDescription("the top level 'row' will layout horizontally by default, set this option true to make it layout vertically"),e.add("enableRotateBorderIcons",!0).setType(i$.BOOLEAN).setDescription("boolean indicating if tab icons should rotate with the text in the left and right borders"),e.add("tabEnableClose",!0).setType(i$.BOOLEAN),e.add("tabCloseType",1).setType("ICloseType"),e.add("tabEnablePopout",!1).setType(i$.BOOLEAN).setAlias("tabEnableFloat"),e.add("tabEnablePopoutIcon",!0).setType(i$.BOOLEAN),e.add("tabEnablePopoutFloatIcon",!1).setType(i$.BOOLEAN),e.add("tabEnablePopoutOverlay",!1).setType(i$.BOOLEAN),e.add("tabEnableDrag",!0).setType(i$.BOOLEAN),e.add("tabEnableRename",!0).setType(i$.BOOLEAN),e.add("tabContentClassName",void 0).setType(i$.STRING),e.add("tabClassName",void 0).setType(i$.STRING),e.add("tabIcon",void 0).setType(i$.STRING),e.add("tabEnableRenderOnDemand",!0).setType(i$.BOOLEAN),e.add("tabBorderWidth",-1).setType(i$.NUMBER),e.add("tabBorderHeight",-1).setType(i$.NUMBER),e.add("tabSetEnableDeleteWhenEmpty",!0).setType(i$.BOOLEAN),e.add("tabSetEnableDrop",!0).setType(i$.BOOLEAN),e.add("tabSetEnableDrag",!0).setType(i$.BOOLEAN),e.add("tabSetEnableDivide",!0).setType(i$.BOOLEAN),e.add("tabSetEnableMaximize",!0).setType(i$.BOOLEAN),e.add("tabSetEnableClose",!0).setType(i$.BOOLEAN),e.add("tabSetEnableCloseButton",!1).setType(i$.BOOLEAN),e.add("tabSetEnableSingleTabStretch",!1).setType(i$.BOOLEAN),e.add("tabSetAutoSelectTab",!0).setType(i$.BOOLEAN),e.add("tabSetEnableActiveIcon",!1).setType(i$.BOOLEAN),e.add("tabSetClassNameTabStrip",void 0).setType(i$.STRING),e.add("tabSetEnableTabStrip",!0).setType(i$.BOOLEAN),e.add("tabSetEnableTabWrap",!1).setType(i$.BOOLEAN),e.add("tabSetTabLocation","top").setType("ITabLocation"),e.add("tabMinWidth",1).setType(i$.NUMBER),e.add("tabMinHeight",1).setType(i$.NUMBER),e.add("tabSetMinWidth",1).setType(i$.NUMBER),e.add("tabSetMinHeight",1).setType(i$.NUMBER),e.add("tabMaxWidth",i7).setType(i$.NUMBER),e.add("tabMaxHeight",i7).setType(i$.NUMBER),e.add("tabSetMaxWidth",i7).setType(i$.NUMBER),e.add("tabSetMaxHeight",i7).setType(i$.NUMBER),e.add("tabSetEnableTabScrollbar",!1).setType(i$.BOOLEAN),e.add("borderSize",200).setType(i$.NUMBER),e.add("borderMinSize",1).setType(i$.NUMBER),e.add("borderMaxSize",i7).setType(i$.NUMBER),e.add("borderEnableDrop",!0).setType(i$.BOOLEAN),e.add("borderAutoSelectTabWhenOpen",!0).setType(i$.BOOLEAN),e.add("borderAutoSelectTabWhenClosed",!1).setType(i$.BOOLEAN),e.add("borderClassName",void 0).setType(i$.STRING),e.add("borderEnableAutoHide",!1).setType(i$.BOOLEAN),e.add("borderEnableTabScrollbar",!1).setType(i$.BOOLEAN),e}},nt={width:"1em",height:"1em",display:"flex",alignItems:"center"},ni=()=>(0,iM.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:nt,viewBox:"0 0 24 24",children:[(0,iM.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,iM.jsx)("path",{stroke:"var(--color-icon)",fill:"var(--color-icon)",d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})]}),nn=e=>{let{controller:i,show:n}=e;return(0,iM.jsx)("div",{className:i.getClassName(iz.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:n?"flex":"none"}})},nr=((cQ={}).Close_Tab="Close",cQ.Close_Tabset="Close tab set",cQ.Active_Tabset="Active tab set",cQ.Move_Tabset="Move tab set",cQ.Move_Tabs="Move tabs(?)",cQ.Maximize="Maximize tab set",cQ.Restore="Restore tab set",cQ.Popout_Tab="Popout selected tab",cQ.Popout_Tab_Float="Float selected tab",cQ.Overflow_Menu_Tooltip="Hidden tabs",cQ.Error_rendering_component="Error rendering component",cQ.Error_rendering_component_retry="Retry",cQ),ns=e=>{let{controller:i,tabNode:n}=e,r=i.getClassName,s=r(iz.FLEXLAYOUT__TAB_BUTTON_STAMP),o=iY(i,n),a=o.content?(0,iM.jsx)("div",{className:r(iz.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:o.content}):n.getNameForOverflowMenu(),l=o.leading?(0,iM.jsx)("div",{className:r(iz.FLEXLAYOUT__TAB_BUTTON_LEADING),children:o.leading}):null;return(0,iM.jsxs)("div",{className:s,title:n.getHelpText(),children:[l,a]})};function no(e,i,n,r,s){let o=s.getRootDiv(),a=s.getClassName,l=e.ownerDocument,c=e.getBoundingClientRect(),d=o?.getBoundingClientRect()??new DOMRect(0,0,100,100),h=l.createElement("div");h.className=a(iz.FLEXLAYOUT__POPUP_MENU_CONTAINER),c.left<d.left+d.width/2?h.style.left=c.left-d.left+"px":h.style.right=d.right-c.right+"px",c.top<d.top+d.height/2?h.style.top=c.top-d.top+"px":h.style.bottom=d.bottom-c.bottom+"px",s.showOverlayOnAllWindows(!0),o&&o.appendChild(h);let u=()=>{s.hideControlInPortal(),s.showOverlayOnAllWindows(!1),o&&o.removeChild(h),h.removeEventListener("pointerdown",p),l.removeEventListener("pointerdown",f)},p=e=>{e.stopPropagation()},f=e=>{u()};h.addEventListener("pointerdown",p),l.addEventListener("pointerdown",f),s.showControlInPortal((0,iM.jsx)(na,{currentDocument:l,parentNode:i,onSelect:r,onHide:u,items:n,classNameMapper:a,controller:s}),h)}var na=e=>{let{parentNode:i,items:n,onHide:r,onSelect:s,classNameMapper:o,controller:a}=e,l=(0,iA.useRef)(null);(0,iA.useEffect)(()=>{l.current&&l.current.focus()},[]);let c=e=>{a.getDragDropManager().clearDragMain()},d=n.map((e,n)=>{let l=o(iz.FLEXLAYOUT__POPUP_MENU_ITEM);return i.getSelected()===e.index&&(l+=" "+o(iz.FLEXLAYOUT__POPUP_MENU_ITEM__SELECTED)),(0,iM.jsx)("div",{className:l,"data-layout-path":"/popup-menu/tb"+n,onClick:i=>{s(e),r(),i.stopPropagation()},draggable:!0,onDragStart:i=>{var n;return n=e.node,void(i.stopPropagation(),a.getDragDropManager().setDragNode(i.nativeEvent,n),setTimeout(()=>{r()},0))},onDragEnd:c,title:e.node.getHelpText(),children:(0,iM.jsx)(ns,{tabNode:e.node,controller:a})},e.index)});return(0,iM.jsx)("div",{className:o(iz.FLEXLAYOUT__POPUP_MENU),ref:l,tabIndex:0,onKeyDown:e=>{"Escape"===e.key&&r()},"data-layout-path":"/popup-menu",children:d})},nl=((c0={})[c0.Visible=1]="Visible",c0[c0.Always=2]="Always",c0[c0.Selected=3]="Selected",c0),nc=e=>{let{controller:i,tabNode:n,selected:r,path:s}=e,o=iA.useRef(null),a=iA.useRef(null),l=i.getIcons();iA.useLayoutEffect(()=>{n.setTabRect(i.getBoundingClientRect(o.current)),i.getEditingTab()===n&&a.current.select()});let c=e=>{e.target!==a.current&&(i.getCurrentDocument().body.removeEventListener("pointerdown",c),i.setEditingTab(void 0))},d=i.getClassName,h=n.getParent(),u=h.isEnableSingleTabStretch()&&1===h.getChildren().length,p=u?iz.FLEXLAYOUT__TAB_BUTTON_STRETCH:iz.FLEXLAYOUT__TAB_BUTTON,f=d(p);f+=" "+d(p+"_"+h.getTabLocation()),u||(r?f+=" "+d(p+"--selected"):f+=" "+d(p+"--unselected")),void 0!==n.getClassName()&&(f+=" "+n.getClassName());let m=iY(i,n),g=m.content?(0,iM.jsx)("div",{className:d(iz.FLEXLAYOUT__TAB_BUTTON_CONTENT),children:m.content}):null,v=m.leading?(0,iM.jsx)("div",{className:d(iz.FLEXLAYOUT__TAB_BUTTON_LEADING),children:m.leading}):null;if(i.getEditingTab()===n&&(g=(0,iM.jsx)("input",{ref:a,className:d(iz.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":s+"/textbox",type:"text",autoFocus:!0,defaultValue:n.getName(),onKeyDown:e=>{"Escape"===e.code?i.setEditingTab(void 0):("Enter"===e.code||"NumpadEnter"===e.code)&&(i.setEditingTab(void 0),i.doAction(iF.renameTab(n.getId(),e.target.value)))},onPointerDown:e=>{e.stopPropagation()}})),n.isCloseable()&&!u){let e=i.i18nName(nr.Close_Tab);m.buttons.push((0,iM.jsx)("div",{"data-layout-path":s+"/button/close",title:e,className:d(iz.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:e=>{e.stopPropagation()},onClick:e=>{let s;s=n.getCloseType(),(r||s===nl.Always||s===nl.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches||0)&&(i.doAction(iF.deleteTab(n.getId())),e.stopPropagation())},children:"function"==typeof l.close?l.close(n):l.close},"close"))}return(0,iM.jsxs)("div",{ref:o,"data-layout-path":s,className:f,onClick:()=>{i.doAction(iF.selectTab(n.getId()))},onAuxClick:e=>{iX(e)&&i.auxMouseClick(n,e)},onContextMenu:e=>{i.showContextMenu(n,e)},title:n.getHelpText(),draggable:!0,onDragStart:e=>{n.isEnableDrag()?(e.stopPropagation(),i.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},onDragEnd:e=>{i.getDragDropManager().clearDragMain()},onDoubleClick:e=>{n.isEnableRename()&&(i.setEditingTab(n),i.getCurrentDocument().body.addEventListener("pointerdown",c),e.stopPropagation())},children:[v,g,m.buttons]})},nd=(e,i,n,r,s,o)=>{let[a,l]=iA.useState([]),[c,d]=iA.useState(!1),[h,u]=iA.useState(!1),p=iA.useRef(null),f=iA.useRef(!1),m=iA.useRef(void 0),g=iA.useRef([]),v=iA.useRef(0),y=iA.useRef(!1);g.current=a,iA.useLayoutEffect(()=>{r.current&&A(0)},[i.getId()]),iA.useLayoutEffect(()=>{f.current=!1},[i.getSelectedNode(),i.getRect().width,i.getRect().height]),iA.useLayoutEffect(()=>{T(),!1===f.current&&function(){let n=i.getSelectedNode();if(n&&r.current){let i=e.getBoundingClientRect(r.current),s=n.getTabRect(),o=D(i)-D(s);o>0||O(s)>O(i)?(A(L(r.current)-o),y.current=!0):(o=N(s)-N(i))>0&&(A(L(r.current)+o),y.current=!0)}}(),b(),w()}),iA.useEffect(()=>(p.current?.addEventListener("wheel",_,{passive:!1}),()=>{p.current?.removeEventListener("wheel",_)}),[p.current]);let _=e=>{e.preventDefault()},b=()=>{if(r.current&&s.current){let e=r.current,i=s.current,o=M(e),a=R(e),l=L(e);if(a>o&&a>0){let e=o*o/a,r=0;e<20&&(r=20-e,e=20);let s=l*(o-r)/a;n===iI.HORZ?(i.style.width=e+"px",i.style.left=s+"px"):(i.style.height=e+"px",i.style.top=s+"px"),i.style.display="block"}else i.style.display="none";n===iI.HORZ?i.style.bottom="0px":i.style.right="0px"}},w=()=>{let e=E().length>0;e!==c&&d(e),void 0===m.current&&(m.current=setTimeout(()=>{var e,i;let n=E();e=n,i=g.current,e.length===i.length&&e.every((e,n)=>e===i[n])||l(n),m.current=void 0},100))},S=(e,i)=>{if(r.current&&s.current){let o,a=r.current,l=s.current,c=M(a),d=R(a),h=M(l),u=a.getBoundingClientRect();o=Math.max(0,Math.min(d-h,o=n===iI.HORZ?e-u.x-v.current:i-u.y-v.current)),c>0&&A(o*d/c)}},k=()=>{},C=()=>{},T=()=>{if(r.current){let e=M(r.current.firstElementChild)+10*!!h>M(r.current);e!==h&&u(e)}},E=()=>{let e=[];if(r.current){let i=r.current,n=i.getBoundingClientRect(),s=D(n)-1,a=N(n)+1,l=i.firstElementChild,c=0;Array.from(l.children).forEach(i=>{let n=i.getBoundingClientRect();i.classList.contains(o)&&((D(n)<s||N(n)>a)&&e.push(c),c++)})}return e},D=e=>n===iI.HORZ?e.x:e.y,N=e=>n===iI.HORZ?e.right:e.bottom,M=e=>n===iI.HORZ?e.clientWidth:e.clientHeight,O=e=>n===iI.HORZ?e.width:e.height,R=e=>n===iI.HORZ?e.scrollWidth:e.scrollHeight,A=e=>{n===iI.HORZ?r.current.scrollLeft=e:r.current.scrollTop=e},L=e=>n===iI.HORZ?e.scrollLeft:e.scrollTop;return{selfRef:p,userControlledPositionRef:f,onScroll:()=>{y.current||(f.current=!0),y.current=!1,b(),w()},onScrollPointerDown:e=>{e.stopPropagation(),s.current.setPointerCapture(e.pointerId);let i=s.current.getBoundingClientRect();n===iI.HORZ?v.current=e.clientX-i.x:v.current=e.clientY-i.y,iQ(e.currentTarget.ownerDocument,e,S,k,C)},hiddenTabs:a,onMouseWheel:e=>{if(r.current){let n;if(0!==i.getChildren().length&&Math.abs(e.deltaY)>0){n=-e.deltaY,1===e.deltaMode&&(n*=40);let i=L(r.current)-n;A(Math.max(0,Math.min(R(r.current)-M(r.current),i))),e.stopPropagation()}}},isDockStickyButtons:h,isShowHiddenTabs:c}},nh=e=>{let{tabsetNode:i,controller:n}=e,r=iA.useRef(null),s=iA.useRef(null),o=iA.useRef(null),a=iA.useRef(null),l=iA.useRef(null),c=iA.useRef(null),d=iA.useRef(null),h=n.getIcons();iA.useLayoutEffect(()=>{i.setRect(n.getBoundingClientRect(u.current)),r.current&&i.setTabStripRect(n.getBoundingClientRect(r.current));let e=n.getBoundingClientRect(a.current);i.getContentRect().equalsWhenRounded(e)||isNaN(e.x)||(i.setContentRect(e),n.setReLayout(!0))});let{selfRef:u,userControlledPositionRef:p,onScroll:f,onScrollPointerDown:m,hiddenTabs:g,onMouseWheel:v,isDockStickyButtons:y,isShowHiddenTabs:_}=nd(n,i,iI.HORZ,o,s,n.getClassName(iz.FLEXLAYOUT__TAB_BUTTON)),b=e=>{let r=n.getShowOverflowMenu(),s=g.map(e=>({index:e,node:i.getChildren()[e]}));void 0!==r?r(i,e,s,w):no(c.current,i,s,w,n),e.stopPropagation()},w=e=>{n.doAction(iF.selectTab(e.node.getId())),p.current=!1},S=e=>{n.getEditingTab()?e.preventDefault():i.isEnableDrag()?(e.stopPropagation(),n.getDragDropManager().setDragNode(e.nativeEvent,i)):e.preventDefault()},k=e=>{iX(e)||n.doAction(iF.setActiveTabset(i.getId(),n.getLayoutId()))},C=e=>{iX(e)&&n.auxMouseClick(i,e)},T=e=>{n.showContextMenu(i,e)},E=e=>{e.stopPropagation()},D=e=>{i.canMaximize()&&n.maximize(i),e.stopPropagation()},N=e=>{n.doAction(iF.deleteTabset(i.getId())),e.stopPropagation()},M=e=>{n.doAction(iF.deleteTab(i.getChildren()[0].getId())),e.stopPropagation()},O=e=>{void 0!==j&&n.doAction(iF.popoutTab(j.getId(),"window")),e.stopPropagation()},R=e=>{void 0!==j&&n.doAction(iF.popoutTab(j.getId(),"float")),e.stopPropagation()},A=e=>{i.canMaximize()&&n.maximize(i)},L=n.getClassName,j=i.getSelectedNode(),I=i.getPath(),P=(()=>{let e=[],r=!1;if(i.isEnableTabStrip()){let s=i.isEnableSingleTabStretch()&&1===i.getChildren().length;for(let o=0;o<i.getChildren().length;o++){let a=i.getChildren()[o],l=i.getSelected()===o,c=L(iz.FLEXLAYOUT__TABSET_TAB_SPACER);0!==o&&(c+=" "+L(iz.FLEXLAYOUT__TABSET_TAB_DIVIDER)),i.isEnableTabWrap()||s||(l?c+=" "+L(iz.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_BEFORE):r&&(c+=" "+L(iz.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER))),e.push((0,iM.jsx)("div",{className:c,children:(0,iM.jsx)("div",{className:L(iz.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},"divider"+o)),e.push((0,iM.jsx)(nc,{controller:n,tabNode:a,path:I+"/tb"+o,selected:l},a.getId())),o===i.getChildren().length-1&&(c=L(iz.FLEXLAYOUT__TABSET_TAB_SPACER),i.isEnableTabWrap()||s||!l||(c+=" "+L(iz.FLEXLAYOUT__TABSET_TAB_DIVIDER_SELECTED_AFTER)),e.push((0,iM.jsx)("div",{className:c,children:(0,iM.jsx)("div",{className:L(iz.FLEXLAYOUT__TABSET_TAB_DIVIDER_INNER)})},"divider"+(o+1)))),r=l}}return e})(),{leading:B,buttonbar:z}=(e=>{let r,s=[],o=[],a={leading:r,stickyButtons:s,buttons:o,overflowPosition:void 0};n.customizeTabSet(i,a),r=a.leading,s=a.stickyButtons,o=a.buttons;let u=i.isEnableSingleTabStretch()&&1===i.getChildren().length,p=u&&i.getChildren()[0].isCloseable()||i.isCloseable();if(p=p&&i.isEnableCloseButton(),void 0===a.overflowPosition&&(a.overflowPosition=s.length),s.length>0&&(!i.isEnableTabWrap()&&(y||u)?o=[...s,...o]:e.push((0,iM.jsx)("div",{ref:d,onPointerDown:E,onDragStart:e=>{e.preventDefault()},className:L(iz.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:s},"sticky_buttons_container"))),!i.isEnableTabWrap()&&_){let e,r=n.i18nName(nr.Overflow_Menu_Tooltip);if("function"==typeof h.more){let n=g.map(e=>({index:e,node:i.getChildren()[e]}));e=h.more(i,n)}else e=(0,iM.jsxs)(iM.Fragment,{children:[h.more,(0,iM.jsx)("div",{className:L(iz.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:g.length>0?g.length:""})]});o.splice(Math.min(a.overflowPosition,o.length),0,(0,iM.jsx)("button",{"data-layout-path":I+"/button/overflow",ref:c,className:L(iz.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+L(iz.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:r,onClick:b,onPointerDown:E,children:e},"overflowbutton"))}if(void 0!==j){if(j.isEnablePopoutFloatIcon()){let e=n.i18nName(nr.Popout_Tab_Float);o.push((0,iM.jsx)("button",{"data-layout-path":I+"/button/popout-float",title:e,className:L(iz.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+L(iz.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:R,onPointerDown:E,children:"function"==typeof h.popoutFloat?h.popoutFloat(j):h.popoutFloat},"popout-float"))}if(n.isSupportsPopout()&&j.isAllowedInWindow()&&j.isEnablePopout()){let e=n.i18nName(nr.Popout_Tab);o.push((0,iM.jsx)("button",{"data-layout-path":I+"/button/popout",title:e,className:L(iz.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+L(iz.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:O,onPointerDown:E,children:"function"==typeof h.popout?h.popout(j):h.popout},"popout"))}}if(i.canMaximize()){let e=n.i18nName(nr.Restore),r=n.i18nName(nr.Maximize);o.push((0,iM.jsx)("button",{"data-layout-path":I+"/button/max",title:i.isMaximized()?e:r,className:L(iz.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+L(iz.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(i.isMaximized()?"max":"min")),onClick:D,onPointerDown:E,children:i.isMaximized()?"function"==typeof h.restore?h.restore(i):h.restore:"function"==typeof h.maximize?h.maximize(i):h.maximize},"max"))}if(!i.isMaximized()&&p){let e=u?n.i18nName(nr.Close_Tab):n.i18nName(nr.Close_Tabset);o.push((0,iM.jsx)("button",{"data-layout-path":I+"/button/close",title:e,className:L(iz.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+L(iz.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:u?M:N,onPointerDown:E,children:"function"==typeof h.closeTabset?h.closeTabset(i):h.closeTabset},"close"))}if(i.isActive()&&i.isEnableActiveIcon()){let e=n.i18nName(nr.Active_Tabset);o.push((0,iM.jsx)("div",{"data-layout-path":I+"/button/active",title:e,className:L(iz.FLEXLAYOUT__TAB_TOOLBAR_ICON),children:"function"==typeof h.activeTabset?h.activeTabset(i):h.activeTabset},"active"))}return{leading:r,buttonbar:(0,iM.jsx)("div",{ref:l,className:L(iz.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:E,onDragStart:e=>{e.preventDefault()},children:o},"buttonbar")}})(P),F=(e=>{let r;if(0===i.getChildren().length){let e=n.getTabSetPlaceHolderCallback();e&&(r=e(i))}let s=(0,iM.jsx)("div",{ref:a,className:L(iz.FLEXLAYOUT__TABSET_CONTENT),children:r});return"top"===i.getTabLocation()?(0,iM.jsxs)(iM.Fragment,{children:[e,s]}):(0,iM.jsxs)(iM.Fragment,{children:[s,e]})})(((e,n,a)=>{let l,c,d=L(iz.FLEXLAYOUT__TABSET_TABBAR_OUTER);void 0!==i.getClassNameTabStrip()&&(d+=" "+i.getClassNameTabStrip()),d+=" "+iz.FLEXLAYOUT__TABSET_TABBAR_OUTER_+i.getTabLocation(),i.isActive()&&(d+=" "+L(iz.FLEXLAYOUT__TABSET_SELECTED)),i.isMaximized()&&(d+=" "+L(iz.FLEXLAYOUT__TABSET_MAXIMIZED));let h=i.isEnableSingleTabStretch()&&1===i.getChildren().length;if(h){let e=i.getChildren()[0];void 0!==e.getTabSetClassName()&&(d+=" "+e.getTabSetClassName())}if(n&&(l=(0,iM.jsx)("div",{className:L(iz.FLEXLAYOUT__TABSET_LEADING),children:n})),i.isEnableTabWrap())i.isEnableTabStrip()&&(c=(0,iM.jsxs)("div",{className:d,style:{flexWrap:"wrap",gap:"1px",marginTop:"2px"},ref:r,"data-layout-path":I+"/tabstrip",onPointerDown:k,onDoubleClick:A,onContextMenu:T,onClick:C,onAuxClick:C,draggable:!0,onDragStart:S,children:[l,e,(0,iM.jsx)("div",{style:{flexGrow:1}}),a]}));else if(i.isEnableTabStrip()){let n;i.isEnableTabScrollbar()&&(n=(0,iM.jsx)("div",{ref:s,className:L(iz.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:m})),c=(0,iM.jsxs)("div",{className:d,ref:r,"data-layout-path":I+"/tabstrip",onPointerDown:k,onDoubleClick:A,onContextMenu:T,onClick:C,onAuxClick:C,draggable:!0,onWheel:v,onDragStart:S,children:[l,(0,iM.jsxs)("div",{className:L(iz.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,iM.jsx)("div",{ref:o,className:L(iz.FLEXLAYOUT__TABSET_TABBAR_INNER)+" "+L(iz.FLEXLAYOUT__TABSET_TABBAR_INNER_+i.getTabLocation()),style:{overflowX:"auto",overflowY:"hidden"},onScroll:f,children:(0,iM.jsx)("div",{style:{width:h?"100%":"none"},className:L(iz.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+" "+L(iz.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+i.getTabLocation()),children:e})}),n]}),a]})}return c})(P,B,z)),H={flexGrow:Math.max(1,1e3*i.getWeight()),minWidth:i.getMinWidth(),minHeight:i.getMinHeight(),maxWidth:i.getMaxWidth(),maxHeight:i.getMaxHeight()};void 0===i.getModel().getMaximizedTabset(n.getLayoutId())||i.isMaximized()||(H.display="none");let W=(0,iM.jsx)("div",{ref:u,className:L(iz.FLEXLAYOUT__TABSET_CONTAINER),style:H,children:(0,iM.jsx)("div",{className:L(iz.FLEXLAYOUT__TABSET),"data-layout-path":I,children:F})});return i.isMaximized()&&n.getMainElement()?(0,iL.createPortal)((0,iM.jsx)("div",{style:{position:"absolute",display:"flex",top:0,left:0,bottom:0,right:0},children:W}),n.getMainElement()):W},nu=e=>{let{controller:i,node:n,index:r,horizontal:s}=e,o=iA.useRef(null),a=iA.useRef(null),l=iA.useRef([]),c=iA.useRef(void 0),d=iA.useRef(void 0),h=iA.useRef(0),u=iA.useRef(0),p=iA.useRef({initialSizes:[],sum:0,startPosition:0});iA.useEffect(()=>(o.current?.addEventListener("touchstart",f,{passive:!1}),a.current?.addEventListener("touchstart",f,{passive:!1}),()=>{o.current?.removeEventListener("touchstart",f),a.current?.removeEventListener("touchstart",f)}),[]);let f=e=>{e.preventDefault(),e.stopImmediatePropagation()},m=()=>{let e=i.getRootDiv();e&&c.current&&e.removeChild(c.current),c.current=void 0},g=(e,r)=>{if(c.current){let s=i.getDomRect();s&&(n.getOrientation()===iI.VERT?c.current.style.top=_(r-s.y-u.current)+"px":c.current.style.left=_(e-s.x-h.current)+"px",i.isRealtimeResize()&&y(!0))}},v=()=>{if(c.current){y(!1);let e=i.getRootDiv();e&&c.current&&e.removeChild(c.current),c.current=void 0}iJ(!0,i.getCurrentDocument())},y=e=>{if(c.current){let e;if(e=n.getOrientation()===iI.VERT?c.current.offsetTop:c.current.offsetLeft,n instanceof i6){let r=n.calculateSplit(n,e);i.doAction(iF.adjustBorderSplit(n.getId(),r))}else{let s=p.current,o=n.calculateSplit(r,e,s.initialSizes,s.sum,s.startPosition);i.doAction(iF.adjustWeights(n.getId(),o))}}},_=e=>{let i=l.current,n=e;return e<i[0]&&(n=i[0]),e>i[1]&&(n=i[1]),n},b=i.getClassName,w={cursor:s?"ew-resize":"ns-resize",flexDirection:s?"column":"row"},S=b(iz.FLEXLAYOUT__SPLITTER)+" "+b(iz.FLEXLAYOUT__SPLITTER_+n.getOrientation().getName());return n instanceof i6?S+=" "+b(iz.FLEXLAYOUT__SPLITTER_BORDER):void 0!==n.getModel().getMaximizedTabset(i.getLayoutId())&&(w.display="none"),iK()||(w["--splitter-active-size"]="30px"),(0,iM.jsx)("div",{className:S,style:w,ref:o,"data-layout-path":n.getPath()+"/s"+(r-1),onPointerDown:e=>{e.stopPropagation(),n instanceof i2&&(p.current=n.getSplitterInitials(r)),iJ(!1,i.getCurrentDocument()),iQ(e.currentTarget.ownerDocument,e,g,v,m),l.current=n.getSplitterBounds(r,!0);let a=i.getRootDiv();c.current=i.getCurrentDocument().createElement("div"),c.current.style.flexDirection=s?"row":"column",c.current.className=i.getClassName(iz.FLEXLAYOUT__SPLITTER_DRAG)+(n instanceof i6?" "+i.getClassName(iz.FLEXLAYOUT__SPLITTER_BORDER):""),c.current.style.cursor=n.getOrientation()===iI.VERT?"ns-resize":"ew-resize",d.current=i.getCurrentDocument().createElement("div"),d.current.className=b(iz.FLEXLAYOUT__SPLITTER_HANDLE)+" "+(s?b(iz.FLEXLAYOUT__SPLITTER_HANDLE_HORZ):b(iz.FLEXLAYOUT__SPLITTER_HANDLE_VERT)),c.current.appendChild(d.current);let f=o.current.getBoundingClientRect(),y=new iP(f.x-i.getDomRect().x,f.y-i.getDomRect().y,f.width,f.height);h.current=e.clientX-f.x,u.current=e.clientY-f.y,y.positionElement(c.current),a&&a.appendChild(c.current)},children:(0,iM.jsx)("div",{className:b(iz.FLEXLAYOUT__SPLITTER_HANDLE)+" "+(s?b(iz.FLEXLAYOUT__SPLITTER_HANDLE_HORZ):b(iz.FLEXLAYOUT__SPLITTER_HANDLE_VERT))})})},np=e=>{let{controller:i,rowNode:n}=e,r=iA.useRef(null),s=n.getOrientation()===iI.HORZ;iA.useLayoutEffect(()=>{n.setRect(i.getBoundingClientRect(r.current))});let o=[],a=0;for(let e of n.getChildren())a>0&&o.push((0,iM.jsx)(nu,{controller:i,node:n,index:a,horizontal:s},"splitter"+a)),e instanceof i2?o.push((0,iM.jsx)(np,{controller:i,rowNode:e},e.getId())):e instanceof i5&&o.push((0,iM.jsx)(nh,{controller:i,tabsetNode:e},e.getId())),a++;let l={flexGrow:Math.max(1,1e3*n.getWeight()),minWidth:n.getMinWidth(),minHeight:n.getMinHeight(),maxWidth:n.getMaxWidth(),maxHeight:n.getMaxHeight()};return s?l.flexDirection="row":l.flexDirection="column",(0,iM.jsx)("div",{ref:r,className:i.getClassName(iz.FLEXLAYOUT__ROW),style:l,children:o})},nf=e=>{let{controller:i,selected:n,tabNode:r}=e,s=iA.useRef(null),o=iA.useRef(!0),a=r.getParent(),l=a.getContentRect();iA.useLayoutEffect(()=>{let e=()=>{r.saveScrollPosition()},n=r.getMoveableElement();return n&&(s.current.appendChild(n),n.addEventListener("scroll",e)),s.current.addEventListener("pointerdown",c),()=>{s.current&&s.current.removeEventListener("pointerdown",c),n&&(r.isEnableWindowReMount()||i.getMainController()?.getMoveablesDiv()?.appendChild(n),n.removeEventListener("scroll",e)),r.setVisible(!1)}},[r.getMoveableElement()]),iA.useEffect(()=>{r.isSelected()&&o.current&&(r.restoreScrollPosition(),o.current=!1)});let c=()=>{let e=r.getParent();e instanceof i5&&!e.isActive()&&i.doAction(iF.setActiveTabset(e.getId(),i.getLayoutId()))};r.setRect(l);let d=i.getClassName,h={};l.styleWithPosition(h);let u=null;if(n){if(r.setVisible(!0),document.hidden&&r.isEnablePopoutOverlay()){let e={};l.styleWithPosition(e),u=(0,iM.jsx)("div",{style:e,className:d(iz.FLEXLAYOUT__TAB_OVERLAY)})}}else h.display="none",r.setVisible(!1);a instanceof i5&&void 0!==r.getModel().getMaximizedTabset(i.getLayoutId())&&!a.isMaximized()&&(h.display="none"),a instanceof i6&&!a.isShowing()&&(h.display="none");let p=d(iz.FLEXLAYOUT__TAB);return a instanceof i6&&(p+=" "+d(iz.FLEXLAYOUT__TAB_BORDER),p+=" "+d(iz.FLEXLAYOUT__TAB_BORDER_+a.getLocation().getName())),void 0!==r.getContentClassName()&&(p+=" "+r.getContentClassName()),(0,iM.jsxs)(iM.Fragment,{children:[u,(0,iM.jsx)("div",{ref:s,style:h,className:p,"data-layout-path":r.getPath()})]})},nm=class extends iA.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,i){console.debug(e),console.debug(i)}retry=()=>{this.setState({hasError:!1})};render(){return this.state.hasError?(0,iM.jsx)("div",{className:iz.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER,children:(0,iM.jsx)("div",{className:iz.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT,children:(0,iM.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[this.props.message,(0,iM.jsx)("p",{children:(0,iM.jsx)("button",{onClick:this.retry,children:this.props.retryText})})]})})}):this.props.children}},ng=iA.memo(({controller:e,tabNode:i})=>{let n;return ng.displayName="TabContentRenderer",i.getComponent()?n=e.getFactory()(i):i.getSubLayoutId()&&(n=(0,iM.jsxs)("div",{className:e.getClassName(iz.FLEXLAYOUT__TAB_LAYOUT_CONTAINER),children:[(0,iM.jsx)(nO,{...e.getProps(),layoutId:i.getSubLayoutId(),mainLayoutController:e.getMainController()}),";"]})),(0,iM.jsx)(nm,{message:e.i18nName(nr.Error_rendering_component),retryText:e.i18nName(nr.Error_rendering_component_retry),children:n})},function(e,i){return!(i.visible&&(e.windowId!==i.windowId||e.fullRedrawRevision!==i.fullRedrawRevision||e.parentRedrawRevision!==i.parentRedrawRevision||void 0!==i.tabNode.getSubLayoutId()))}),nv=class e{static dragState=void 0;_controller;_dragEnterCount=0;_dragging=!1;_active=!1;_dropInfo;_outlineDiv;_mainController;constructor(e){this._controller=e,this._mainController=e.getMainController()}addTabWithDragAndDrop(i,n,r){let s=iq.fromJson(n,this._controller.getModel(),!1);e.dragState=new n_(this._controller.getMainController(),ny.Add,s,n,r)}moveTabWithDragAndDrop(e,i){this.setDragNode(e,i)}setDragNode=(i,n)=>{if(e.dragState=new n_(this._controller.getMainController(),ny.Internal,n,void 0,void 0),i.dataTransfer.setData("text/plain","--flexlayout--"),i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.dropEffect="move",this._dragEnterCount=0,n instanceof i5){let e=!1,r=this._controller.i18nName(nr.Move_Tabset);if(n.getChildren().length>0&&(r=this._controller.i18nName(nr.Move_Tabs).replace("?",String(n.getChildren().length))),this._controller.getProps().onRenderDragRect){let s=this._controller.getProps().onRenderDragRect(r,n,void 0);s&&(this.setDragComponent(i,s,10,10),e=!0)}e||this.setDragComponent(i,r,10,10)}else{let e=i.target;if(e&&"function"==typeof e.getBoundingClientRect){let r=e.getBoundingClientRect(),s=i.clientX-r.left,o=i.clientY-r.top,a=n?.getParent(),l=a instanceof i6&&a.getOrientation()===iI.HORZ,c=l?10:s,d=l?10:o,h=!1;if(this._controller.getProps().onRenderDragRect){let e=(0,iM.jsx)(ns,{controller:this._controller,tabNode:n},n.getId()),r=this._controller.getProps().onRenderDragRect(e,n,void 0);r&&(this.setDragComponent(i,r,c,d),h=!0)}if(!h){let e;!(e=navigator.userAgent).includes("Safari")||e.includes("Chrome")||e.includes("Chromium")?i.dataTransfer.setDragImage(n.getTabStamp(),c,d):this.setDragComponent(i,(0,iM.jsx)(ns,{tabNode:n,controller:this._controller}),c,d)}}}};setDragComponent(e,i,n,r){let s=(0,iM.jsx)("div",{style:{position:"unset"},className:this._controller.getClassName(iz.FLEXLAYOUT__LAYOUT)+" "+this._controller.getClassName(iz.FLEXLAYOUT__DRAG_RECT),children:i});this._controller.getModel().sortLayouts();let o=this._controller.getCurrentDocument(),a=o.createElement("div");a.setAttribute("data-layout-path","/drag-rectangle"),a.style.position="absolute",a.style.left="-10000px",a.style.top="-10000px",o.body.appendChild(a),(0,ij.createRoot)(a).render(s),e.dataTransfer.setDragImage(a,n,r),setTimeout(()=>{o.body.removeChild(a)},0)}updateActive(e){let i=Array.from(this._controller.getModel().getLayouts().values()),n=!1;for(let r=i.length-1;r>=0;r--){let s=i[r].getController()?.getDragDropManager();if(s){let i=!n&&s.getDragEnterCount()>0;i&&(n=!0),s.setActive(i,e)}}}setActive(e,i){this._active!==e&&(this._active=e,this._active?this.onDragEnter(i):this.onDragLeave(i))}onDragEnterRaw=e=>{this._dragEnterCount++,this.updateActive(e)};onDragLeaveRaw=e=>{this._dragEnterCount--,this.updateActive(e)};clearDragMain(){for(let[,e]of(this._controller.showOverlayOnAllWindows(!1),this._controller.getModel().getLayouts()))e.getController()&&e.getController().getDragDropManager().clearDragLocal()}clearDragLocal(){this._dragEnterCount=0,this._active=!1,this.clearDragLocalVisuals()}clearDragLocalVisuals(){this._controller.setState({showEdges:!1}),this._dragging=!1,this._outlineDiv&&(this._controller.getRootDiv().removeChild(this._outlineDiv),this._outlineDiv=void 0)}onDragEnter=i=>{if(!e.dragState&&this._controller.getProps().onExternalDrag){let n=this._controller.getProps().onExternalDrag(i);if(n){let i=iq.fromJson(n.json,this._controller.getModel(),!1);e.dragState=new n_(this._controller.getMainController(),ny.External,i,n.json,n.onDrop)}}if(this._mainController===e.dragState?.mainLayoutController&&e.dragState){i.preventDefault(),this._dropInfo=void 0;let e=this._controller.getRootDiv();this._outlineDiv=this._controller.getCurrentDocument().createElement("div"),this._outlineDiv.className=this._controller.getClassName(iz.FLEXLAYOUT__OUTLINE_RECT),this._outlineDiv.style.visibility="hidden";let n=this._controller.getTabDragSpeed();this._outlineDiv.style.transition=`top ${n}s, left ${n}s, width ${n}s, height ${n}s`,e.appendChild(this._outlineDiv),this._dragging=!0,this._controller.showOverlayOnAllWindows(!0),void 0===this._controller.getModel().getMaximizedTabset(this._controller.getLayoutId())&&this._controller.setState({showEdges:this._controller.getModel().isEnableEdgeDock()});let r=this._controller.getRootDiv().getBoundingClientRect();new iP(i.clientX-r.left,i.clientY-r.top,1,1).positionElement(this._outlineDiv)}};onDragOver=i=>{if(this._mainController===e.dragState?.mainLayoutController&&this._active){let n=this._controller.getRootDiv()?.getBoundingClientRect(),r={x:i.clientX-(n?.left??0),y:i.clientY-(n?.top??0)};this._controller.checkForBorderToShow(r.x,r.y);let s=this._controller.getModel().findDropTargetNode(this._controller.getLayoutId(),e.dragState.dragNode,r.x,r.y);s&&(i.preventDefault(),this._dropInfo=s,this._outlineDiv&&(this._outlineDiv.className=this._controller.getClassName(s.className),s.rect.positionElement(this._outlineDiv),this._outlineDiv.style.visibility="visible"))}};onDragLeave=i=>{if(this._mainController===e.dragState?.mainLayoutController&&(this.clearDragLocalVisuals(),this._controller.isMainLayout())){let e=!1;for(let[,i]of this._controller.getModel().getLayouts())if(i.getController()&&i.getController().getDragDropManager().isDragging()){e=!0;break}!1===e&&this.clearDragMain()}};onDrop=i=>{if(this._mainController===e.dragState?.mainLayoutController){if(this._active){i.preventDefault();let n=e.dragState;if(this._dropInfo)if(void 0!==n.dragJson){let e=this._controller.doAction(iF.addNode(n.dragJson,this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));void 0!==n.fnNewNodeDropped&&n.fnNewNodeDropped(e,i)}else void 0!==n.dragNode&&this._controller.doAction(iF.moveNode(n.dragNode.getId(),this._dropInfo.node.getId(),this._dropInfo.location,this._dropInfo.index));this.clearDragMain(),e.dragState=void 0}this._dragEnterCount=0}};getDragEnterCount(){return this._dragEnterCount}isDragging(){return this._dragging}},ny=((c1={}).Internal="internal",c1.External="external",c1.Add="add",c1),n_=class{mainLayoutController;dragSource;dragNode;dragJson;fnNewNodeDropped;constructor(e,i,n,r,s){this.mainLayoutController=e,this.dragSource=i,this.dragNode=n,this.dragJson=r,this.fnNewNodeDropped=s}},nx=({controller:e})=>{let i=[],n=e.getIcons().edgeArrow;if(e.getState().showEdges&&e.getModel().isEnableEdgeDockIndicators()){let r=e.getModel().getRootRow(e.getLayoutId()).getRect(),s=e.getClassName(iz.FLEXLAYOUT__EDGE_RECT);i.push((0,iM.jsx)("div",{style:{top:0,left:r.width/2-50,width:100,height:10,borderBottomLeftRadius:50,borderBottomRightRadius:50},className:s+" "+e.getClassName(iz.FLEXLAYOUT__EDGE_RECT_TOP),children:(0,iM.jsx)("div",{style:{transform:"rotate(180deg)"},children:n})},"North")),i.push((0,iM.jsx)("div",{style:{top:r.height/2-50,left:0,width:10,height:100,borderTopRightRadius:50,borderBottomRightRadius:50},className:s+" "+e.getClassName(iz.FLEXLAYOUT__EDGE_RECT_LEFT),children:(0,iM.jsx)("div",{style:{transform:"rotate(90deg)"},children:n})},"West")),i.push((0,iM.jsx)("div",{style:{top:r.height-10,left:r.width/2-50,width:100,height:10,borderTopLeftRadius:50,borderTopRightRadius:50},className:s+" "+e.getClassName(iz.FLEXLAYOUT__EDGE_RECT_BOTTOM),children:(0,iM.jsx)("div",{children:n})},"South")),i.push((0,iM.jsx)("div",{style:{top:r.height/2-50,left:r.width-10,width:10,height:100,borderTopLeftRadius:50,borderBottomLeftRadius:50},className:s+" "+e.getClassName(iz.FLEXLAYOUT__EDGE_RECT_RIGHT),children:(0,iM.jsx)("div",{style:{transform:"rotate(-90deg)"},children:n})},"East"))}return(0,iM.jsx)(iM.Fragment,{children:i})},nb=e=>{let{title:i,controller:n,layout:r,url:s,onCloseLayout:o,onSetWindow:a,children:l}=e,c=iA.useRef(null),[d,h]=iA.useState(void 0),[u,p]=iA.useState(!0),f=new Map;return(iA.useLayoutEffect(()=>{if(!c.current){let e=r.getLayoutId(),n=r.getRect();c.current=window.open(s,e,`left=${n.x},top=${n.y},width=${n.width},height=${n.height}`),c.current?(a(r,c.current),window.addEventListener("beforeunload",()=>{if(c.current){let e=c.current;c.current=null,e.close()}}),c.current.addEventListener("load",()=>{if(c.current){c.current.focus(),c.current.resizeTo(n.width,n.height),c.current.moveTo(n.x,n.y);let e=c.current.document;e.title=i;let s=e.createElement("div");s.className=iz.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,e.body.appendChild(s),(function(e,i){let n=[];for(let r of document.querySelectorAll('style, link[rel="stylesheet"]'))nw(e,r,i,n);return Promise.all(n)})(e,f).then(()=>{h(s)});let a=new MutationObserver(i=>(function(e,i,n){for(let r of e)if("childList"===r.type){for(let e of r.addedNodes)(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement)&&nw(i,e,n);for(let e of r.removedNodes)if(e instanceof HTMLLinkElement||e instanceof HTMLStyleElement){let r=n.get(e);r&&i.head.removeChild(r)}}})(i,e,f));a.observe(document.head,{childList:!0}),c.current.addEventListener("beforeunload",()=>{c.current&&(o(r),c.current=null,a.disconnect())})}})):(console.warn(`Unable to open window ${s}`),o(r))}return()=>{n.getModel().getLayouts().has(r.getLayoutId())||(c.current?.close(),c.current=null)}},[]),iA.useEffect(()=>{void 0!==d&&u&&(n.redrawLayout(),p(!1))},[d,u,n]),void 0!==d)?(0,iL.createPortal)(l,d):null};function nw(e,i,n,r){if(i instanceof HTMLLinkElement){let s=i.cloneNode(!0);e.head.appendChild(s),n.set(i,s),r&&r.push(new Promise(e=>{s.onload=()=>e(!0)}))}else if(i instanceof HTMLStyleElement)try{let r=i.cloneNode(!0);e.head.appendChild(r),n.set(i,r)}catch(e){}}var nS=((c2=nS||{}).North="n",c2.South="s",c2.East="e",c2.West="w",c2.NorthWest="nw",c2.NorthEast="ne",c2.SouthWest="sw",c2.SouthEast="se",c2),nk=e=>{let{controller:i,layout:n,children:r}=e,[s,o]=iA.useState(n.getRect()),a=i.getClassName,l=iA.useRef(null),c=iA.useRef(null),d=iA.useRef(null),h=iA.useRef(null),u=iA.useRef(null),p=iA.useRef(null),f=iA.useRef(null),m=iA.useRef(null),g=iA.useRef(null),v=iA.useRef(null),y=iA.useRef(!1);iA.useEffect(()=>(c.current?.addEventListener("touchstart",_,{passive:!1}),d.current?.addEventListener("touchstart",_,{passive:!1}),h.current?.addEventListener("touchstart",_,{passive:!1}),u.current?.addEventListener("touchstart",_,{passive:!1}),p.current?.addEventListener("touchstart",_,{passive:!1}),f.current?.addEventListener("touchstart",_,{passive:!1}),m.current?.addEventListener("touchstart",_,{passive:!1}),g.current?.addEventListener("touchstart",_,{passive:!1}),v.current?.addEventListener("touchstart",_,{passive:!1}),()=>{c.current?.removeEventListener("touchstart",_),d.current?.removeEventListener("touchstart",_),h.current?.removeEventListener("touchstart",_),u.current?.removeEventListener("touchstart",_),p.current?.removeEventListener("touchstart",_),f.current?.removeEventListener("touchstart",_),m.current?.removeEventListener("touchstart",_),g.current?.removeEventListener("touchstart",_),v.current?.removeEventListener("touchstart",_)}),[]);let _=e=>{e.preventDefault(),e.stopImmediatePropagation()};iA.useEffect(()=>{let e=()=>{let e=[...i.getModel().getLayouts()];n!==e[e.length-1][1]&&(y.current=!0)},r=()=>{y.current&&(setTimeout(()=>{i.moveWindowToFront(n.getLayoutId())},10),y.current=!1)},s=l.current;return s&&(s.addEventListener("pointerdown",e,{capture:!0}),s.addEventListener("pointerup",r)),()=>{s&&(s.removeEventListener("pointerdown",e,{capture:!0}),s.removeEventListener("pointerup",r))}},[i,n.getLayoutId()]);let b=(e,r)=>{let a={x:e.clientX,y:e.clientY},l=i.getRootDiv(),c=l?l.getBoundingClientRect():{width:window.innerWidth,height:window.innerHeight};iQ(document,e,(e,l)=>{i.showOverlayOnAllWindows(!0);let d=e-a.x,h=l-a.y,u=s.x,p=s.y,f=s.width,m=s.height;r.includes("n")&&(p+=h,m-=h),r.includes("s")&&(m+=h),r.includes("w")&&(u+=d,f-=d),r.includes("e")&&(f+=d),f<150&&(r.includes("w")&&(u=s.x+s.width-150),f=150),m<25&&(r.includes("n")&&(p=s.y+s.height-25),m=25),u<0&&(f+=u,u=0),p<0&&(m+=p,p=0),u+f>c.width&&(f=c.width-u),p+m>c.height&&(m=c.height-p),f<150&&(f=150),m<25&&(m=25);let g=new iP(u,p,f,m);o(g),n.setRect(g)},()=>{i.redrawLayout(),i.showOverlayOnAllWindows(!1)},()=>{}),e.stopPropagation()},w=i.getRootDiv(),S=w?w.getBoundingClientRect():{width:window.innerWidth,height:window.innerHeight};return s.clamp(new iP(0,0,S.width,S.height)),(0,iM.jsxs)("div",{ref:l,className:a(iz.FLEXLAYOUT__FLOAT_WINDOW),style:{left:s.x,top:s.y,width:s.width,height:s.height,position:"absolute"},children:[(0,iM.jsx)("div",{ref:c,className:a(iz.FLEXLAYOUT__FLOAT_WINDOW_HEADER),onPointerDown:e=>{e.stopPropagation();let r={x:e.clientX-s.x,y:e.clientY-s.y},a=i.getRootDiv(),l=a?a.getBoundingClientRect():{width:window.innerWidth,height:window.innerHeight};iQ(document,e,(e,a)=>{i.showOverlayOnAllWindows(!0),y.current&&(i.moveWindowToFront(n.getLayoutId()),y.current=!1);let c=new iP(e-r.x,a-r.y,s.width,s.height);c.clamp(new iP(0,0,l.width,l.height)),o(c),n.setRect(c)},()=>{i.redrawLayout(),i.showOverlayOnAllWindows(!1)},()=>{})},children:(0,iM.jsx)("div",{style:{flexGrow:1,display:"flex",justifyContent:"center"},children:(0,iM.jsx)("div",{style:{width:50,height:8,display:"flex",flexDirection:"column",justifyContent:"space-around",opacity:.5},children:(0,iM.jsx)("div",{style:{height:2,backgroundColor:"gray",borderRadius:1}})})})}),(0,iM.jsx)("div",{className:a(iz.FLEXLAYOUT__FLOAT_WINDOW_CONTENT),children:r}),(0,iM.jsx)("div",{ref:d,style:{position:"absolute",zIndex:10,top:-4,left:8,right:8,height:8,cursor:"ns-resize"},onPointerDown:e=>b(e,nS.North)}),(0,iM.jsx)("div",{ref:f,style:{position:"absolute",zIndex:10,bottom:-4,left:8,right:8,height:8,cursor:"ns-resize"},onPointerDown:e=>b(e,nS.South)}),(0,iM.jsx)("div",{ref:u,style:{position:"absolute",zIndex:10,top:8,bottom:8,right:-4,width:8,cursor:"ew-resize"},onPointerDown:e=>b(e,nS.East)}),(0,iM.jsx)("div",{ref:g,style:{position:"absolute",zIndex:10,top:8,bottom:8,left:-4,width:8,cursor:"ew-resize"},onPointerDown:e=>b(e,nS.West)}),(0,iM.jsx)("div",{ref:v,style:{position:"absolute",zIndex:10,top:-4,left:-4,width:12,height:12,cursor:"nwse-resize"},onPointerDown:e=>b(e,nS.NorthWest)}),(0,iM.jsx)("div",{ref:h,style:{position:"absolute",zIndex:10,top:-4,right:-4,width:12,height:12,cursor:"nesw-resize"},onPointerDown:e=>b(e,nS.NorthEast)}),(0,iM.jsx)("div",{ref:m,style:{position:"absolute",zIndex:10,bottom:-4,left:-4,width:12,height:12,cursor:"nesw-resize"},onPointerDown:e=>b(e,nS.SouthWest)}),(0,iM.jsx)("div",{ref:p,style:{position:"absolute",zIndex:10,bottom:0,right:0,width:12,height:12,cursor:"nwse-resize"},onPointerDown:e=>b(e,nS.SouthEast)})]})},nC=({controller:e})=>{let i=[],n=e.getModel().getLayouts(),r=0;for(let[s,o]of n)!o.isMainLayout()&&("window"===o.getType()&&e.isSupportsPopout()?(i.push((0,iM.jsx)(nb,{controller:e,layout:o,title:e.getPopoutWindowName()+" "+r,url:e.getPopoutURL()+"?id="+s,onSetWindow:e.onSetWindow,onCloseLayout:e.onCloseLayout,children:(0,iM.jsx)("div",{className:e.getProps().popoutClassName,children:(0,iM.jsx)(nO,{...e.getProps(),layoutId:s,mainLayoutController:e})})},s)),r++):"float"===o.getType()&&i.push((0,iM.jsx)(nk,{controller:e,layout:o,onCloseLayout:e.onCloseLayout,children:(0,iM.jsx)(nO,{...e.getProps(),layoutId:s,mainLayoutController:e})},s+"float")));return(0,iM.jsx)(iM.Fragment,{children:i})},nT=e=>{let{controller:i,tabNode:n,selected:r,border:s,icons:o,path:a}=e,l=iA.useRef(null),c=iA.useRef(null);iA.useLayoutEffect(()=>{n.setTabRect(i.getBoundingClientRect(l.current)),i.getEditingTab()===n&&c.current.select()});let d=i.getClassName,h=d(iz.FLEXLAYOUT__BORDER_BUTTON)+" "+d(iz.FLEXLAYOUT__BORDER_BUTTON_+s);r?h+=" "+d(iz.FLEXLAYOUT__BORDER_BUTTON__SELECTED):h+=" "+d(iz.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED),void 0!==n.getClassName()&&(h+=" "+n.getClassName());let u=0;!1===n.getModel().isEnableRotateBorderIcons()&&("left"===s?u=90:"right"===s&&(u=-90));let p=iY(i,n,u),f=p.content?(0,iM.jsx)("div",{className:d(iz.FLEXLAYOUT__BORDER_BUTTON_CONTENT),children:p.content}):null,m=p.leading?(0,iM.jsx)("div",{className:d(iz.FLEXLAYOUT__BORDER_BUTTON_LEADING),children:p.leading}):null;if(i.getEditingTab()===n&&(f=(0,iM.jsx)("input",{ref:c,className:d(iz.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":a+"/textbox",type:"text",autoFocus:!0,defaultValue:n.getName(),onKeyDown:e=>{"Escape"===e.code?i.setEditingTab(void 0):("Enter"===e.code||"NumpadEnter"===e.code)&&(i.setEditingTab(void 0),i.doAction(iF.renameTab(n.getId(),e.target.value)))},onPointerDown:e=>{e.stopPropagation()}})),n.isCloseable()){let e=i.i18nName(nr.Close_Tab);p.buttons.push((0,iM.jsx)("div",{"data-layout-path":a+"/button/close",title:e,className:d(iz.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:e=>{e.stopPropagation()},onClick:e=>{let s;s=n.getCloseType(),(r||s===nl.Always||s===nl.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches||0)&&(i.doAction(iF.deleteTab(n.getId())),e.stopPropagation())},children:"function"==typeof o.close?o.close(n):o.close},"close"))}return(0,iM.jsxs)("div",{ref:l,"data-layout-path":a,className:h,onClick:()=>{i.doAction(iF.selectTab(n.getId()))},onAuxClick:e=>{iX(e)&&i.auxMouseClick(n,e)},onContextMenu:e=>{i.showContextMenu(n,e)},title:n.getHelpText(),draggable:!0,onDragStart:e=>{n.isEnableDrag()?(e.stopPropagation(),i.getDragDropManager().setDragNode(e.nativeEvent,n)):e.preventDefault()},onDragEnd:e=>{e.stopPropagation(),i.getDragDropManager().clearDragMain()},children:[m,f,p.buttons]})},nE=e=>{let i,n,r,s,{borderNode:o,controller:a,size:l}=e,c=iA.useRef(null),d=iA.useRef(null),h=iA.useRef(null),u=iA.useRef(null),p=iA.useRef(null),f=a.getIcons();iA.useLayoutEffect(()=>{o.setTabHeaderRect(a.getBoundingClientRect(m.current))});let{selfRef:m,userControlledPositionRef:g,onScroll:v,onScrollPointerDown:y,hiddenTabs:_,onMouseWheel:b,isDockStickyButtons:w,isShowHiddenTabs:S}=nd(a,o,iI.flip(o.getOrientation()),p,d,a.getClassName(iz.FLEXLAYOUT__BORDER_BUTTON)),k=e=>{iX(e)&&a.auxMouseClick(o,e)},C=e=>{e.stopPropagation()},T=e=>{let i=a.getShowOverflowMenu(),n=_.map(e=>({index:e,node:o.getChildren()[e]}));void 0!==i?i(o,e,n,E):no(h.current,o,n,E,a),e.stopPropagation()},E=e=>{a.doAction(iF.selectTab(e.node.getId())),g.current=!1},D=e=>{let i=o.getChildren()[o.getSelected()];void 0!==i&&a.doAction(iF.popoutTab(i.getId(),"window")),e.stopPropagation()},N=e=>{let i=o.getChildren()[o.getSelected()];void 0!==i&&a.doAction(iF.popoutTab(i.getId(),"float")),e.stopPropagation()},M=a.getClassName,O=(()=>{let e=[];for(let i=0;i<o.getChildren().length;i++){let n=o.getSelected()===i,r=o.getChildren()[i];e.push((0,iM.jsx)(nT,{controller:a,border:o.getLocation().getName(),tabNode:r,path:o.getPath()+"/tb"+i,selected:n,icons:f},r.getId())),i<o.getChildren().length-1&&e.push((0,iM.jsx)("div",{className:M(iz.FLEXLAYOUT__BORDER_TAB_DIVIDER)},"divider"+i))}return e})(),{leading:R,toolbar:A}=(e=>{let i,n=[],r=[],s={leading:i,buttons:n,stickyButtons:r,overflowPosition:void 0};if(a.customizeTabSet(o,s),i=s.leading,r=s.stickyButtons,n=s.buttons,void 0===s.overflowPosition&&(s.overflowPosition=r.length),r.length>0&&(w?n=[...r,...n]:e.push((0,iM.jsx)("div",{ref:u,onPointerDown:C,onDragStart:e=>{e.preventDefault()},className:M(iz.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER),children:r},"sticky_buttons_container"))),S){let e,i=a.i18nName(nr.Overflow_Menu_Tooltip);if("function"==typeof f.more){let i=_.map(e=>({index:e,node:o.getChildren()[e]}));e=f.more(o,i)}else e=(0,iM.jsxs)(iM.Fragment,{children:[f.more,(0,iM.jsx)("div",{className:M(iz.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT),children:_.length>0?_.length:""})]});n.splice(Math.min(s.overflowPosition,n.length),0,(0,iM.jsx)("button",{ref:h,className:M(iz.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+M(iz.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+" "+M(iz.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+o.getLocation().getName()),title:i,onClick:T,onPointerDown:C,children:e},"overflowbutton"))}let l=o.getSelected();if(-1!==l){let e=o.getChildren()[l];if(void 0!==e&&a.isMainLayout()){if(e.isEnablePopoutFloatIcon()){let i=a.i18nName(nr.Popout_Tab_Float);n.push((0,iM.jsx)("button",{title:i,className:M(iz.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+M(iz.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:N,onPointerDown:C,children:"function"==typeof f.popoutFloat?f.popoutFloat(e):f.popoutFloat},"popout-float"))}if(a.isSupportsPopout()&&e.isEnablePopoutIcon()&&e.isAllowedInWindow()){let i=a.i18nName(nr.Popout_Tab);n.push((0,iM.jsx)("button",{title:i,className:M(iz.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+M(iz.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:D,onPointerDown:C,children:"function"==typeof f.popout?f.popout(e):f.popout},"popout"))}}}return{leading:i,toolbar:(0,iM.jsx)("div",{ref:c,className:M(iz.FLEXLAYOUT__BORDER_TOOLBAR)+" "+M(iz.FLEXLAYOUT__BORDER_TOOLBAR_+o.getLocation().getName()),children:n},"toolbar")}})(O),L=M(iz.FLEXLAYOUT__BORDER)+" "+M(iz.FLEXLAYOUT__BORDER_+o.getLocation().getName());void 0!==o.getClassName()&&(L+=" "+o.getClassName());let j=l-1;return o.getLocation()===iB.LEFT?(i={right:"100%",top:0},n={width:j,overflowY:"auto"}):o.getLocation()===iB.RIGHT?(i={left:"100%",top:0},n={width:j,overflowY:"auto"}):(i={left:0},n={height:j,overflowX:"auto"}),o.isEnableTabScrollbar()&&(r=(0,iM.jsx)("div",{ref:d,className:M(iz.FLEXLAYOUT__MINI_SCROLLBAR),onPointerDown:y})),R&&(s=(0,iM.jsx)("div",{className:M(iz.FLEXLAYOUT__BORDER_LEADING),children:R})),(0,iM.jsxs)("div",{ref:m,style:{display:"flex",flexDirection:o.getOrientation()===iI.VERT?"row":"column"},className:L,"data-layout-path":o.getPath(),onClick:k,onAuxClick:k,onContextMenu:e=>{a.showContextMenu(o,e)},onWheel:b,children:[s,(0,iM.jsxs)("div",{className:M(iz.FLEXLAYOUT__MINI_SCROLLBAR_CONTAINER),children:[(0,iM.jsx)("div",{ref:p,className:M(iz.FLEXLAYOUT__BORDER_INNER)+" "+M(iz.FLEXLAYOUT__BORDER_INNER_+o.getLocation().getName()),style:n,onScroll:v,children:(0,iM.jsx)("div",{style:i,className:M(iz.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+" "+M(iz.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+o.getLocation().getName()),children:O})}),r]}),A]})};function nD(e){let{controller:i,borderNode:n,show:r}=e,s=iA.useRef(null);iA.useLayoutEffect(()=>{let e=i.getBoundingClientRect(s.current);isNaN(e.x)||!(e.width>0)||n.getContentRect().equalsWhenRounded(e)||(n.setContentRect(e),i.setReLayout(!0))});let o=!0,a={};n.getOrientation()===iI.HORZ?(a.width=n.getSize(),a.minWidth=n.getMinSize(),a.maxWidth=n.getMaxSize()):(a.height=n.getSize(),a.minHeight=n.getMinSize(),a.maxHeight=n.getMaxSize(),o=!1),a.display=r?"flex":"none";let l=i.getClassName(iz.FLEXLAYOUT__BORDER_TAB_CONTENTS);return n.getLocation()===iB.LEFT||n.getLocation()===iB.TOP?(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsx)("div",{ref:s,style:a,className:l}),r&&(0,iM.jsx)(nu,{controller:i,node:n,index:0,horizontal:o})]}):(0,iM.jsxs)(iM.Fragment,{children:[r&&(0,iM.jsx)(nu,{controller:i,node:n,index:0,horizontal:o}),(0,iM.jsx)("div",{ref:s,style:a,className:l})]})}var nN=({controller:e,inner:i})=>{let n=e.getClassName(iz.FLEXLAYOUT__LAYOUT_MAIN),r=e.getModel().getBorderSet().getBorderMap();if(!e.isMainLayout()||!(r.size>0))return(0,iM.jsx)("div",{className:n,ref:e.getMainRef(),style:{position:"absolute",top:0,left:0,bottom:0,right:0,display:"flex"},children:i});{let s=(0,iM.jsx)("div",{className:n,ref:e.getMainRef(),children:i}),o=new Map,a=new Map;for(let[i,n]of iB.values){let i=r.get(n);i&&i.isShowing()&&(!i.isAutoHide()||i.isAutoHide()&&(i.getChildren().length>0||e.getState().showHiddenBorder===n))&&(o.set(n,(0,iM.jsx)(nE,{controller:e,borderNode:i,size:e.getState().calculatedBorderBarSize})),a.set(n,(0,iM.jsx)(nD,{controller:e,borderNode:i,show:-1!==i.getSelected()})))}let l=e.getClassName(iz.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),c=e.getClassName(iz.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER);if(e.getModel().getBorderSet().getLayoutHorizontal()){let e=(0,iM.jsxs)("div",{className:c,style:{flexDirection:"column"},children:[a.get(iB.TOP),(0,iM.jsxs)("div",{className:c,style:{flexDirection:"row"},children:[a.get(iB.LEFT),s,a.get(iB.RIGHT)]}),a.get(iB.BOTTOM)]});return(0,iM.jsxs)("div",{className:l,style:{flexDirection:"column"},children:[o.get(iB.TOP),(0,iM.jsxs)("div",{className:c,style:{flexDirection:"row"},children:[o.get(iB.LEFT),e,o.get(iB.RIGHT)]}),o.get(iB.BOTTOM)]})}{let e=(0,iM.jsxs)("div",{className:c,style:{flexDirection:"row"},children:[a.get(iB.LEFT),(0,iM.jsxs)("div",{className:c,style:{flexDirection:"column"},children:[a.get(iB.TOP),s,a.get(iB.BOTTOM)]}),a.get(iB.RIGHT)]});return(0,iM.jsxs)("div",{className:l,style:{flexDirection:"row"},children:[o.get(iB.LEFT),(0,iM.jsxs)("div",{className:c,style:{flexDirection:"column"},children:[o.get(iB.TOP),e,o.get(iB.BOTTOM)]}),o.get(iB.RIGHT)]})}}},nM=iA.memo(e=>{nM.displayName="DragContainer";let{controller:i,tabNode:n}=e,r=iA.useRef(null);iA.useEffect(()=>{n.setTabStamp(r.current)},[n,r.current]);let s=i.getClassName;return(0,iM.jsx)("div",{ref:r,className:s(iz.FLEXLAYOUT__DRAG_RECT),children:(0,iM.jsx)(ns,{controller:i,tabNode:n},n.getId())})},function(e,i){return i.dragging}),nO=iA.forwardRef((e,i)=>{nO.displayName="LayoutInternal";let[n,r]=iA.useState({rect:iP.empty(),editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRedrawRevision:0,fullRedrawRevision:0,showHiddenBorder:iB.CENTER,splitterSize:8}),s=iA.useCallback(i=>{r(n=>({...n,..."function"==typeof i?i(n,e):i}))},[e]),o=iA.useRef(null),a=iA.useRef(null),l=iA.useRef(null),c=iA.useRef(null),d=iA.useMemo(()=>new nR(e,n,s),[]);if(d.setProps(e),d.setStateRaw(n),d.setSetState(s),d.setLayoutRef(o),d.setMoveablesRef(a),d.setFindBorderBarSizeRef(l),d.setMainRef(c),iA.useImperativeHandle(i,()=>d,[d]),iA.useLayoutEffect(()=>{d.isMainLayout()&&d.updateLayoutMetrics(),d.isReLayout()&&(d.redrawLayout(),d.setReLayout(!1))}),iA.useEffect(()=>{let e=o.current.ownerDocument,i=e.defaultView;d.setCurrentDocument(e),d.setCurrentWindow(i);let n=new i.ResizeObserver(()=>{i.requestAnimationFrame(()=>{d.updateRect()})});n.observe(o.current);let r=()=>{d.updateRect()};i.addEventListener("resize",r);let s=()=>{for(let[e,i]of d.getProps().model.getLayouts())i.getController()&&d.redrawLayout()};return document.addEventListener("visibilitychange",s),()=>{n.disconnect(),i.removeEventListener("resize",r),document.removeEventListener("visibilitychange",s)}},[d,o.current?.ownerDocument]),iA.useEffect(()=>{let e;if(!d.isMainLayout()&&"window"===d.getLayout().getType()){let i=d.getProps().mainLayoutController?.getRootDiv();if(i){let n=o.current;i1(i,n),(e=new MutationObserver(()=>{i1(i,n)&&d.redrawLayout()})).observe(i,{attributeFilter:["style"]})}}return()=>{e&&e.disconnect()}},[d]),iA.useEffect(()=>{let i=e.model,r=i.getLayouts().get(d.getLayoutId());if(r.setController(d),r.setToExportRectFunction((e,i)=>"window"===i?d.getScreenRect(e):d.getRelativeRect(e)),d.setLayout(r),d.isMainLayout()){i.addChangeListener(d.onModelChange);let r=()=>{let i=parseInt(getComputedStyle(o.current).getPropertyValue("--splitter-size"));Number.isFinite(i)&&(e.model.setSplitterSize(i),n.splitterSize!==i&&s({splitterSize:i}))};r();let a=setInterval(r,1e3);return()=>{i.removeChangeListener(d.onModelChange),clearInterval(a),d.tidyMoveablesMap()}}},[e.model,d]),!o.current)return(0,iM.jsxs)("div",{ref:o,className:d.getClassName(iz.FLEXLAYOUT__LAYOUT),children:[(0,iM.jsx)("div",{ref:a,className:d.getClassName(iz.FLEXLAYOUT__LAYOUT_MOVEABLES)},"__moveables__"),(0,iM.jsx)("div",{ref:l,className:d.getClassName(iz.FLEXLAYOUT__BORDER_SIZER),children:"FindBorderBarSize"},"findBorderBarSize")]});let h=e.model,u=d.getLayoutId();h.getRootRow(u).calcMinMaxSize(),h.getRootRow(u).setPaths(""),d.isMainLayout()&&(h.getBorderSet().setPaths(),d.createMoveableDivs());let p=(0,iM.jsx)(nN,{controller:d,inner:d.renderLayout()}),f=d.renderTabContainers(),m=d.reorderComponents(f,d.getOrderedTabIds()),g=null,v=null,y=null,_=null;if(d.isMainLayout()){g=d.renderMetricsElements(),v=(0,iM.jsx)(nC,{controller:d});let e=d.renderTabContents();y=d.reorderComponents(e,d.getOrderedTabMoveableIds()),_=(0,iM.jsx)("div",{className:d.getClassName(iz.FLEXLAYOUT__LAYOUT_TAB_STAMPS),children:d.renderTabStamps()},"__tabStamps__")}return(0,iM.jsxs)("div",{ref:o,className:d.getClassName(iz.FLEXLAYOUT__LAYOUT),onDragEnter:d.getDragDropManager().onDragEnterRaw,onDragLeave:d.getDragDropManager().onDragLeaveRaw,onDragOver:d.getDragDropManager().onDragOver,onDrop:d.getDragDropManager().onDrop,children:[(0,iM.jsx)("div",{ref:a,className:d.getClassName(iz.FLEXLAYOUT__LAYOUT_MOVEABLES)},"__moveables__"),g,(0,iM.jsx)(nn,{controller:d,show:n.showOverlay},"__overlay__"),p,m,y,n.portal,v,_]})}),nR=class e{static Windows=new Map;_props;_state;_setState;_layoutRef;_moveablesRef;_findBorderBarSizeRef;_mainRef;_orderedTabIds;_orderedTabMoveableIds;_moveableElementMap=new Map;_currentDocument;_currentWindow;_supportsPopout;_popoutURL;_icons;_dragDropManager;_layoutId;_layout;_mainController;_popoutWindowName;_cachedLayoutDOMRect;_reLayout;constructor(e,i,n){this._props=e,this._state=i,this._setState=n,this._orderedTabIds=[],this._orderedTabMoveableIds=[],this._supportsPopout=void 0!==e.supportsPopout?e.supportsPopout:nL,this._popoutURL=e.popoutURL?e.popoutURL:"popout.html",this._icons={...nA,...e.icons},this._layoutId=e.layoutId?e.layoutId:ne.MAIN_LAYOUT_ID,this._mainController=e.mainLayoutController?e.mainLayoutController:this,this._dragDropManager=new nv(this),this._layout=e.model.getLayouts().get(this._layoutId),this._layout.setController(this),this._popoutWindowName=e.popoutWindowName||"Popout Window",this._reLayout=!1}renderLayout(){return this._cachedLayoutDOMRect=void 0,(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsx)(np,{controller:this,rowNode:this._props.model.getRootRow(this._layoutId)},"__row__"),(0,iM.jsx)(nx,{controller:this})]})}renderTabContainers(){let e=new Map;return this._props.model.visitLayoutNodes(this._layoutId,i=>{if(i instanceof iq){let n=i.isSelected(),r=i.isRendered(),s=i.isEnableRenderOnDemand();(r||n||!s)&&e.set(i.getId(),(0,iM.jsx)(nf,{controller:this,tabNode:i,selected:n},i.getId()))}}),e}renderTabContents(){let e=new Map;for(let[i,n]of this._props.model.getLayouts())this._props.model.visitLayoutNodes(i,i=>{if(i instanceof iq){let r=i.isSelected(),s=i.isRendered(),o=i.isEnableRenderOnDemand(),a=i.getParent().getContentRect(),l=r||!o;if(s||l&&a.width>0&&a.height>0){let r=i.getMoveableElement(),s=n.getWindowId()||"",o=i.getId()+(i.isEnableWindowReMount()?s:"");e.set(i.getId(),(0,iL.createPortal)((0,iM.jsx)(ng,{controller:this,tabNode:i,rect:a,windowId:s,visible:l,fullRedrawRevision:this._state.fullRedrawRevision,parentRedrawRevision:this._props.parentRedrawRevision},o),r,o)),i.setRendered(!0)}}});return e}renderMetricsElements(){return(0,iM.jsx)("div",{ref:this._findBorderBarSizeRef,className:this.getClassName(iz.FLEXLAYOUT__BORDER_SIZER),children:"FindBorderBarSize"},"findBorderBarSize")}renderTabStamps(){let e=[];return this._props.model.visitNodes(i=>{i instanceof iq&&e.push((0,iM.jsx)(nM,{controller:this,tabNode:i,dragging:iZ},i.getId()))}),e}createMoveableDivs(){this._props.model.visitNodes(e=>{if(e instanceof iq){let i=this.getMoveableElement(e.getId());e.setMoveableElement(i)}})}getMoveablesDiv(){return this._moveablesRef.current}getMoveableElement(e){let i=this._moveableElementMap.get(e);return void 0===i&&(i=document.createElement("div"),this._moveablesRef.current.appendChild(i),i.className=iz.FLEXLAYOUT__TAB_MOVEABLE,this._moveableElementMap.set(e,i)),i}tidyMoveablesMap(){let e=new Map;for(let[i,n]of(this._props.model.visitNodes((i,n)=>{i instanceof iq&&e.set(i.getId(),i)}),this._moveableElementMap))e.has(i)||(n.remove(),this._moveableElementMap.delete(i))}redrawLayout(){this._mainController?.setState(e=>({layoutRedrawRevision:e.layoutRedrawRevision+1}))}redrawLayoutAndTabContent(e=!0){this._mainController?.setState(e=>({fullRedrawRevision:e.fullRedrawRevision+1}))}doAction(e){if(void 0===this._props.onAction)return this._props.model.doAction(e);{let i=this._props.onAction(e);return void 0!==i?this._props.model.doAction(i):void 0}}updateRect=()=>{if(this._layoutRef.current){let e=this._layoutRef.current;if(!this._layout.isMainLayout()&&"float"===this._layout.getType()){let i=e.closest("."+this.getClassName(iz.FLEXLAYOUT__FLOAT_WINDOW));i instanceof HTMLDivElement&&(e=i)}let i=iP.fromDomRect(e.getBoundingClientRect());if(!this._layout.isMainLayout()&&"float"===this._layout.getType()){let e=this._mainController.getDomRect();i=i.relativeTo(e)}!i.equalsWhenRounded(this._state.rect)&&0!==i.width&&0!==i.height&&(this.setState({rect:i}),this._layout.setRect(i),this._layout.isMainLayout()||this.redrawLayout())}};onModelChange=e=>{e.type==iF.DELETE_TAB&&this._state.showHiddenBorder!==iB.CENTER&&0===this._props.model.getBorderSet().getBorderMap().get(this._state.showHiddenBorder).getChildren().length&&this._setState({showHiddenBorder:iB.CENTER}),this.redrawLayout(),this._props.onModelChange&&this._props.onModelChange(this._props.model,e)};reorderComponents(e,i){let n=i.filter(i=>e.has(i)),r=new Set(n);for(let i of e.keys())r.has(i)||n.push(i);return i.splice(0,i.length,...n),i.map(i=>e.get(i))}checkForBorderToShow(e,i){let n=this.getBoundingClientRect(this._mainRef.current),r=n.getCenter(),s=!1;this._props.model.isEnableEdgeDock()&&this._state.showHiddenBorder===iB.CENTER&&(i>r.y-50&&i<r.y+50||e>r.x-50&&e<r.x+50)&&(s=!0);let o=iB.CENTER;!s&&(e<=n.x+10?o=iB.LEFT:e>=n.getRight()-10?o=iB.RIGHT:i<=n.y+10?o=iB.TOP:i>=n.getBottom()-10&&(o=iB.BOTTOM)),o!==this._state.showHiddenBorder&&this.setState({showHiddenBorder:o})}updateLayoutMetrics=()=>{if(this._findBorderBarSizeRef.current){let e=this._findBorderBarSizeRef.current.getBoundingClientRect().height;e!==this._state.calculatedBorderBarSize&&this.setState({calculatedBorderBarSize:e})}};addTabWithDragAndDrop(e,i,n){this._dragDropManager.addTabWithDragAndDrop(e,i,n)}moveTabWithDragAndDrop(e,i){this._dragDropManager.moveTabWithDragAndDrop(e,i)}setDragComponent(e,i,n,r){this._dragDropManager.setDragComponent(e,i,n,r)}getProps(){return this._props}setProps(e){this._props=e}getState(){return this._state}setStateRaw(e){this._state=e}setState(e){this._setState(e)}setSetState(e){this._setState=e}getLayoutRef(){return this._layoutRef}setLayoutRef(e){this._layoutRef=e}getMoveablesRef(){return this._moveablesRef}setMoveablesRef(e){this._moveablesRef=e}getFindBorderBarSizeRef(){return this._findBorderBarSizeRef}setFindBorderBarSizeRef(e){this._findBorderBarSizeRef=e}getMainRef(){return this._mainRef}setMainRef(e){this._mainRef=e}getOrderedTabIds(){return this._orderedTabIds}getOrderedTabMoveableIds(){return this._orderedTabMoveableIds}getCurrentDocument(){return this._currentDocument}setCurrentDocument(e){this._currentDocument=e}getCurrentWindow(){return this._currentWindow}setCurrentWindow(i){this._currentWindow=i,i&&!e.Windows.has(i)&&e.Windows.set(i,i4())}getWindowId(){if(this.getCurrentWindow())return e.Windows.get(this.getCurrentWindow())}isSupportsPopout(){return this._supportsPopout}getPopoutURL(){return this._popoutURL}getIcons(){return this._icons}getDragDropManager(){return this._dragDropManager}getLayoutId(){return this._layoutId}getLayout(){return this._layout}setLayout(e){this._layout=e}getMainController(){return this._mainController}isMainLayout(){return this._layout.isMainLayout()}getPopoutWindowName(){return this._popoutWindowName}isReLayout(){return this._reLayout}setReLayout(e){this._reLayout=e}getBoundingClientRect(e){let i=this.getDomRect();return i?iP.getBoundingClientRect(e).relativeTo(i):iP.empty()}getMoveableContainer(){return this._moveablesRef.current}getClassName=e=>void 0===this._props.classNameMapper?e:this._props.classNameMapper(e);getDomRect(){return void 0!==this._cachedLayoutDOMRect?this._cachedLayoutDOMRect:this._layoutRef.current?(this._cachedLayoutDOMRect=iP.fromDomRect(this._layoutRef.current.getBoundingClientRect()),this._cachedLayoutDOMRect):iP.empty()}getRootDiv(){return this._layoutRef.current}getMainElement(){return this._mainRef.current}getFactory(){return this._props.factory}isRealtimeResize(){return this._props.realtimeResize??!1}setEditingTab(e){this.setState({editingTab:e})}getEditingTab(){return this._state.editingTab}getModel(){return this._props.model}getTabDragSpeed(){return this._props.tabDragSpeed?this._props.tabDragSpeed:.3}onCloseLayout=e=>{this.doAction(iF.closePopout(e.getLayoutId()))};onSetWindow=(e,i)=>{};getScreenRect(e){let i=e.clone(),n=this.getDomRect();return i.x=this._currentWindow.screenX+this._currentWindow.scrollX+1+n.x+i.x,i.y=this._currentWindow.screenY+this._currentWindow.scrollY+59+n.y+i.y,i.height+=60,i.width+=2,i}getRelativeRect(e){let i=e.clone();if(!this._layout.isMainLayout()){let e=this._layout.getRect();i.x+=e.x,i.y+=e.y}return i}moveWindowToFront(e){this.doAction(iF.movePopoutToFront(e))}addTabToTabSet(e,i){if(void 0!==this._props.model.getNodeById(e))return this.doAction(iF.addNode(i,e,iB.CENTER,-1))}addTabToActiveTabSet(e){let i=this._props.model.getActiveTabset(this._layoutId);if(void 0!==i)return this.doAction(iF.addNode(e,i.getId(),iB.CENTER,-1))}showControlInPortal=(e,i)=>{let n=(0,iL.createPortal)(e,i);this.setState({portal:n})};hideControlInPortal=()=>{this.setState({portal:void 0})};maximize(e){this.doAction(iF.maximizeToggle(e.getId(),this.getLayoutId()))}customizeTab(e,i){this._props.onRenderTab&&this._props.onRenderTab(e,i)}customizeTabSet(e,i){this._props.onRenderTabSet&&this._props.onRenderTabSet(e,i)}i18nName(e,i){let n;return this._props.i18nMapper&&(n=this._props.i18nMapper(e,i)),void 0===n&&(n=e+(void 0===i?"":i)),n}getShowOverflowMenu(){return this._props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this._props.onTabSetPlaceHolder}showContextMenu(e,i){this._props.onContextMenu&&this._props.onContextMenu(e,i)}auxMouseClick(e,i){this._props.onAuxMouseClick&&this._props.onAuxMouseClick(e,i)}showOverlay(e){this.setState({showOverlay:e}),iJ(!e,this._currentDocument)}showOverlayOnAllWindows(e){for(let[,i]of this._props.model.getLayouts())i.getController()&&i.getController().showOverlay(e)}},nA={close:(0,iM.jsx)(ni,{}),closeTabset:(0,iM.jsx)(ni,{}),closeFloatPopout:(0,iM.jsx)(ni,{}),popout:(0,iM.jsx)(()=>(0,iM.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:nt,viewBox:"0 0 20 20",fill:"var(--color-icon)",children:[(0,iM.jsx)("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),(0,iM.jsx)("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]}),{}),popoutFloat:(0,iM.jsx)(()=>(0,iM.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:nt,viewBox:"0 0 20 20",fill:"var(--color-icon)",children:[(0,iM.jsx)("rect",{x:"3",y:"10",width:"7",height:"7",rx:"1",fill:"none",stroke:"var(--color-icon)",strokeWidth:"1.5"}),(0,iM.jsx)("rect",{x:"10",y:"3",width:"7",height:"7",rx:"1",fill:"none",stroke:"var(--color-icon)",strokeWidth:"1.5"}),(0,iM.jsx)("path",{d:"M6 14 L14 6",stroke:"var(--color-icon)",strokeWidth:"1.5",strokeLinecap:"round"}),(0,iM.jsx)("path",{d:"M10 6 h4 v4",fill:"none",stroke:"var(--color-icon)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),{}),maximize:(0,iM.jsx)(()=>(0,iM.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:nt,viewBox:"0 0 24 24",fill:"var(--color-icon)",children:[(0,iM.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,iM.jsx)("path",{stroke:"var(--color-icon)",d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})]}),{}),restore:(0,iM.jsx)(()=>(0,iM.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:nt,viewBox:"0 0 24 24",fill:"var(--color-icon)",children:[(0,iM.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,iM.jsx)("path",{stroke:"var(--color-icon)",d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"})]}),{}),more:(0,iM.jsx)(()=>(0,iM.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",style:nt,viewBox:"0 0 24 24",fill:"var(--color-icon)",children:[(0,iM.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,iM.jsx)("path",{stroke:"var(--color-icon)",d:"M7 10l5 5 5-5z"})]}),{}),edgeArrow:(0,iM.jsx)(()=>(0,iM.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"block",width:10,height:10},preserveAspectRatio:"none",viewBox:"0 0 100 100",children:(0,iM.jsx)("path",{fill:"var(--color-edge-icon)",stroke:"var(--color-edge-icon)",d:"M10 30 L90 30 l-40 40 Z"})}),{}),activeTabset:(0,iM.jsx)(()=>(0,iM.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",style:nt,height:"24px",viewBox:"0 -960 960 960",width:"24px",children:(0,iM.jsx)("path",{fill:"var(--color-icon)",stroke:"var(--color-icon)",d:"M440-120v-264L254-197l-57-57 187-186H120v-80h264L197-706l57-57 186 187v-264h80v264l186-187 57 57-187 186h264v80H576l187 186-57 57-186-187v264h-80Z"})}),{})},nL=iK(),nj=iA.forwardRef((e,i)=>{let n=(0,iA.useRef)(null),r=(0,iA.useRef)(0);return nj.displayName="Layout",(0,iA.useImperativeHandle)(i,()=>({redraw:()=>{n.current?.redrawLayoutAndTabContent()},addTabToTabSet:(e,i)=>n.current?.addTabToTabSet(e,i),addTabWithDragAndDrop:(e,i,r)=>{n.current?.addTabWithDragAndDrop(e,i,r)},moveTabWithDragAndDrop:(e,i)=>{n.current?.moveTabWithDragAndDrop(e,i)},addTabToActiveTabSet:e=>n.current?.addTabToActiveTabSet(e),setDragComponent:(e,i,r,s)=>{n.current?.setDragComponent(e,i,r,s)},getRootDiv:()=>n.current.getRootDiv()})),(0,iM.jsx)(nO,{ref:n,...e,parentRedrawRevision:r.current++})}),nI=e.i(227634),nP=e.i(433721);let nB=(0,nP.default)("list-checks",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]);var nz=e.i(451534);let nF=(0,nP.default)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);var nH=e.i(426022),nW=e.i(989484);let n$=(0,nP.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),nU=(0,nP.default)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]),nV=(0,nP.default)("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]),nq=(0,nP.default)("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);var nK=e.i(210),nY=e.i(932031),nX=e.i(984178),nJ=e.i(220336),nJ=nJ,nG=e.i(680422),nG=nG,nZ=e.i(137340),nQ=e.i(307858),n0=e.i(256186),n1=e.i(465458),n2=e.i(244073);let n5=(0,iO.createContext)({expandedPaths:new Set,togglePath:()=>void 0}),n3=({expanded:e,defaultExpanded:i=new Set,selectedPath:n,onFileSelect:r,onExpandedChange:s,workspaceId:o,onDelete:a,className:l,children:c,...d})=>{let[h,u]=(0,iO.useState)(i),p=e??h;return(0,iM.jsx)(n5.Provider,{value:{expandedPaths:p,togglePath:e=>{let i=new Set(p);i.has(e)?i.delete(e):i.add(e),u(i),s?.(i)},selectedPath:n,onFileSelect:r,workspaceId:o,onDelete:a},children:(0,iM.jsx)("div",{className:(0,n1.cn)("flex flex-col bg-background font-mono text-sm h-full",l),role:"tree",...d,children:(0,iM.jsx)("div",{className:"p-2 flex-1 min-h-0 overflow-y-auto",children:c})})})},n4=(0,iO.createContext)({path:"",name:"",isExpanded:!1}),n6=({path:e,name:i,folderIcon:n,className:r,children:s,...o})=>{let{expandedPaths:a,togglePath:l,selectedPath:c,onFileSelect:d,workspaceId:h,onDelete:u}=(0,iO.useContext)(n5),p=a.has(e),f=c===e,m=(0,n2.useTranslations)("editor"),g=(0,n2.useTranslations)("common");return(0,iM.jsx)(n4.Provider,{value:{path:e,name:i,isExpanded:p},children:(0,iM.jsx)(n0.Collapsible,{onOpenChange:()=>l(e),open:p,children:(0,iM.jsxs)("div",{className:r,role:"treeitem",tabIndex:0,...o,children:[(0,iM.jsxs)("div",{className:"group/folder relative",children:[(0,iM.jsxs)(n0.CollapsibleTrigger,{className:(0,n1.cn)("flex w-full items-center gap-1 rounded px-2 py-1 pr-16 text-left transition-colors hover:bg-muted/50",f&&"bg-muted"),children:[(0,iM.jsx)(nY.ChevronRightIcon,{className:(0,n1.cn)("size-4 shrink-0 text-muted-foreground transition-transform",p&&"rotate-90")}),(0,iM.jsx)(n7,{children:n?n(p):p?(0,iM.jsx)(nG.default,{className:"size-4 text-blue-500"}):(0,iM.jsx)(nJ.default,{className:"size-4 text-blue-500"})}),(0,iM.jsx)(re,{children:i})]}),(0,iM.jsxs)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-1 invisible group-hover/folder:visible",onClick:e=>e.stopPropagation(),children:[(0,iM.jsx)("button",{onClick:()=>{fetch(`/api/workspaces/${h}/files/reveal?path=${encodeURIComponent(e)}`,{method:"POST"})},className:"p-0.5 rounded hover:bg-accent",title:m("revealInFinder"),children:(0,iM.jsx)(nQ.ExternalLink,{className:"size-3 text-muted-foreground"})}),(0,iM.jsx)("button",{onClick:()=>u?.(e),className:"p-0.5 rounded hover:bg-accent",title:g("delete"),children:(0,iM.jsx)(nZ.Trash2,{className:"size-3 text-muted-foreground hover:text-destructive"})})]})]}),(0,iM.jsx)(n0.CollapsibleContent,{children:(0,iM.jsx)("div",{className:"ml-4 border-l pl-2",children:s})})]})})})},n8=(0,iO.createContext)({path:"",name:""}),n9=({path:e,name:i,icon:n,className:r,children:s,...o})=>{let{selectedPath:a,onFileSelect:l,workspaceId:c,onDelete:d}=(0,iO.useContext)(n5),h=(0,n2.useTranslations)("editor"),u=(0,n2.useTranslations)("common");return(0,iM.jsx)(n8.Provider,{value:{path:e,name:i},children:(0,iM.jsx)("div",{className:(0,n1.cn)("group/file flex cursor-pointer items-center gap-1 rounded px-2 py-1 transition-colors hover:bg-muted/50",a===e&&"bg-muted",r),onClick:()=>l?.(e),onKeyDown:i=>{("Enter"===i.key||" "===i.key)&&l?.(e)},role:"treeitem",tabIndex:0,...o,children:s??(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsx)("span",{className:"size-4"}),(0,iM.jsx)(n7,{children:n??(0,iM.jsx)(nX.FileIcon,{className:"size-4 text-muted-foreground"})}),(0,iM.jsx)(re,{children:i}),(0,iM.jsxs)(rt,{children:[(0,iM.jsx)("button",{onClick:()=>{fetch(`/api/workspaces/${c}/files/reveal?path=${encodeURIComponent(e)}`,{method:"POST"})},className:"p-0.5 rounded hover:bg-accent",title:h("revealInFinder"),children:(0,iM.jsx)(nQ.ExternalLink,{className:"size-3 text-muted-foreground"})}),(0,iM.jsx)("button",{onClick:()=>d?.(e),className:"p-0.5 rounded hover:bg-accent",title:u("delete"),children:(0,iM.jsx)(nZ.Trash2,{className:"size-3 text-muted-foreground hover:text-destructive"})})]})]})})})},n7=({className:e,children:i,...n})=>(0,iM.jsx)("span",{className:(0,n1.cn)("shrink-0",e),...n,children:i}),re=({className:e,children:i,...n})=>(0,iM.jsx)("span",{className:(0,n1.cn)("truncate flex-1 min-w-0",e),...n,children:i}),rt=({className:e,children:i,...n})=>(0,iM.jsx)("div",{className:(0,n1.cn)("ml-auto flex items-center gap-1 shrink-0 invisible group-hover/file:visible",e),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:"group",...n,children:i});var ri=e.i(887354);let rn=(0,nP.default)("case-sensitive",[["path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16",key:"d5nyq2"}],["path",{d:"M22 9v7",key:"pvm9v3"}],["path",{d:"M3.304 13h6.392",key:"1q3zxz"}],["circle",{cx:"18.5",cy:"12.5",r:"3.5",key:"z97x68"}]]),rr=(0,nP.default)("regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]);var rs=e.i(244644),ro=e.i(992764),ra=e.i(650654),rl=e.i(550080),rc=e.i(62669),rd=e.i(691223);function rh({workspaceId:e}){let i=(0,n2.useTranslations)("editor"),{jumpToPosition:n}=(0,rd.useEditorStore)(),[r,s]=(0,iO.useState)(""),[o,a]=(0,iO.useState)(!1),[l,c]=(0,iO.useState)(!1),[d,h]=(0,iO.useState)(!1),[u,p]=(0,iO.useState)(!1),[f,m]=(0,iO.useState)({}),[g,v]=(0,iO.useState)(0),[y,_]=(0,iO.useState)([]),[b,w]=(0,iO.useState)(new Set),S=(0,iO.useRef)(void 0),k=(0,iO.useCallback)(async i=>{if(!i.trim()){m({}),v(0),_([]);return}p(!0);try{if(d){let n=await fetch(`/api/workspaces/${e}/search/files?q=${encodeURIComponent(i)}`),r=await n.json();_(r.results||[]),m({}),v(0)}else{let n=new URLSearchParams({q:i,regex:String(o),caseSensitive:String(l)}),r=await fetch(`/api/workspaces/${e}/search/code?${n}`),s=(await r.json()).results||[],a={};for(let e of s)a[e.file]||(a[e.file]=[]),a[e.file].push(e);m(a),v(s.length),_([]),w(new Set(Object.keys(a)))}}catch{m({}),v(0),_([])}finally{p(!1)}},[e,o,l,d]),C=(0,iO.useCallback)(e=>{s(e),clearTimeout(S.current),S.current=setTimeout(()=>k(e),300)},[k]);(0,iO.useEffect)(()=>{r.trim()&&k(r)},[o,l,d]);let T=Object.keys(f).length;return(0,iM.jsxs)("div",{className:"flex flex-col h-full",children:[(0,iM.jsxs)("div",{className:"px-2 py-1.5 border-b space-y-1",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-1",children:[(0,iM.jsx)(ri.Search,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,iM.jsx)("input",{type:"text",value:r,onChange:e=>C(e.target.value),placeholder:d?i("searchFiles")+"...":i("searchPlaceholder"),className:"flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground",spellCheck:!1}),u&&(0,iM.jsx)(rc.Loader2,{className:"size-3 animate-spin text-muted-foreground"})]}),(0,iM.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,iM.jsx)("button",{onClick:()=>c(!l),className:(0,n1.cn)("p-1 rounded text-xs",l?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),title:i("caseSensitive"),children:(0,iM.jsx)(rn,{className:"size-3"})}),(0,iM.jsx)("button",{onClick:()=>a(!o),className:(0,n1.cn)("p-1 rounded text-xs",o?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),title:i("useRegex"),children:(0,iM.jsx)(rr,{className:"size-3"})}),(0,iM.jsx)("button",{onClick:()=>h(!d),className:(0,n1.cn)("p-1 rounded text-xs",d?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),title:i("searchFiles"),children:(0,iM.jsx)(rs.FolderSearch,{className:"size-3"})})]})]}),!u&&r.trim()&&(g>0||y.length>0)&&(0,iM.jsx)("div",{className:"px-2 py-1 text-[10px] text-muted-foreground border-b",children:d?`${y.length} 个文件`:i("searchResults",{count:g,files:T})}),(0,iM.jsxs)("div",{className:"flex-1 overflow-auto",children:[d?(0,iM.jsx)("div",{className:"py-1",children:y.map(i=>(0,iM.jsxs)("button",{onClick:()=>{n(e,i.path,1)},className:"w-full flex items-center gap-1.5 px-2 py-0.5 text-xs hover:bg-accent/50 text-left",children:[(0,iM.jsx)(rl.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,iM.jsx)("span",{className:"truncate",children:i.path})]},i.path))}):(0,iM.jsx)("div",{className:"py-1",children:Object.entries(f).map(([i,r])=>(0,iM.jsxs)("div",{children:[(0,iM.jsxs)("button",{onClick:()=>{w(e=>{let n=new Set(e);return n.has(i)?n.delete(i):n.add(i),n})},className:"w-full flex items-center gap-1 px-2 py-0.5 text-xs font-medium hover:bg-accent/50",children:[b.has(i)?(0,iM.jsx)(ra.ChevronDown,{className:"size-3 text-muted-foreground shrink-0"}):(0,iM.jsx)(ro.ChevronRight,{className:"size-3 text-muted-foreground shrink-0"}),(0,iM.jsx)(rl.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,iM.jsx)("span",{className:"truncate",children:i}),(0,iM.jsxs)("span",{className:"text-muted-foreground ml-auto shrink-0",children:["(",r.length,")"]})]}),b.has(i)&&r.map((i,r)=>(0,iM.jsxs)("button",{onClick:()=>{var r;return r=i.file,void n(e,r,i.line,i.column)},className:"w-full flex items-start gap-2 pl-6 pr-2 py-0.5 text-xs hover:bg-accent/50 text-left font-mono",children:[(0,iM.jsx)("span",{className:"text-muted-foreground w-8 text-right shrink-0",children:i.line}),(0,iM.jsx)("span",{className:"truncate",children:(0,iM.jsx)(ru,{text:i.text,start:i.matchStart,length:i.matchLength})})]},r))]},i))}),!u&&r.trim()&&0===g&&0===y.length&&(0,iM.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:i("noResults")}),!u&&g>=200&&(0,iM.jsx)("div",{className:"px-2 py-2 text-xs text-muted-foreground text-center",children:i("tooManyResults")})]})]})}function ru({text:e,start:i,length:n}){if(i<0||n<=0||i>=e.length)return(0,iM.jsx)("span",{children:e});let r=e.slice(0,i),s=e.slice(i,i+n),o=e.slice(i+n);return(0,iM.jsxs)("span",{children:[r,(0,iM.jsx)("span",{className:"bg-yellow-200/60 dark:bg-yellow-800/40 rounded-sm px-px",children:s}),o]})}var rp=e.i(601039),rf=e.i(253937);let rm={".ts":"file_type_typescript",".tsx":"file_type_reactts",".js":"file_type_js",".jsx":"file_type_reactjs",".mjs":"file_type_js",".cjs":"file_type_js",".json":"file_type_json",".json5":"file_type_json5",".jsonc":"file_type_json",".md":"file_type_markdown",".mdx":"file_type_mdx",".css":"file_type_css",".scss":"file_type_scss",".less":"file_type_less",".html":"file_type_html",".svg":"file_type_svg",".png":"file_type_image",".jpg":"file_type_image",".jpeg":"file_type_image",".gif":"file_type_image",".webp":"file_type_webp",".ico":"file_type_favicon",".yaml":"file_type_yaml",".yml":"file_type_yaml",".toml":"file_type_toml",".xml":"file_type_xml",".graphql":"file_type_graphql",".gql":"file_type_graphql",".prisma":"file_type_prisma",".sql":"file_type_sql",".sh":"file_type_shell",".bash":"file_type_shell",".zsh":"file_type_shell",".py":"file_type_python",".rb":"file_type_ruby",".go":"file_type_go",".rs":"file_type_rust",".java":"file_type_java",".kt":"file_type_kotlin",".swift":"file_type_swift",".c":"file_type_c",".cpp":"file_type_cpp",".h":"file_type_cheader",".hpp":"file_type_cppheader",".cs":"file_type_csharp",".php":"file_type_php",".vue":"file_type_vue",".svelte":"file_type_svelte",".dart":"file_type_dartlang",".lua":"file_type_lua",".r":"file_type_r",".ex":"file_type_elixir",".exs":"file_type_elixir",".erl":"file_type_erlang",".hs":"file_type_haskell",".scala":"file_type_scala",".clj":"file_type_clojure",".cljs":"file_type_clojurescript",".coffee":"file_type_coffeescript",".dockerfile":"file_type_docker",".makefile":"file_type_makefile",".txt":"file_type_text",".log":"file_type_log",".env":"file_type_config",".gitignore":"file_type_git",".editorconfig":"file_type_editorconfig",".prettierrc":"file_type_prettier",".eslintrc":"file_type_eslint",".lock":"file_type_lock",".wasm":"file_type_wasm",".pdf":"file_type_pdf",".zip":"file_type_zip",".tar":"file_type_zip",".gz":"file_type_zip"},rg={"tsconfig.json":"file_type_tsconfig","tsconfig.build.json":"file_type_tsconfig","jsconfig.json":"file_type_jsconfig","package.json":"file_type_npm","package-lock.json":"file_type_npm","pnpm-lock.yaml":"file_type_pnpm","pnpm-workspace.yaml":"file_type_pnpm",".pnpmfile.cjs":"file_type_pnpm","yarn.lock":"file_type_yarn",".yarnrc":"file_type_yarn","next.config.ts":"file_type_next","next.config.js":"file_type_next","next.config.mjs":"file_type_next","vite.config.ts":"file_type_vite","vite.config.js":"file_type_vite","tailwind.config.ts":"file_type_tailwind","tailwind.config.js":"file_type_tailwind","postcss.config.mjs":"file_type_postcss","postcss.config.js":"file_type_postcss",".eslintrc":"file_type_eslint",".eslintrc.js":"file_type_eslint",".eslintrc.json":"file_type_eslint",".eslintrc.cjs":"file_type_eslint",".prettierrc":"file_type_prettier",".prettierrc.js":"file_type_prettier",".prettierrc.json":"file_type_prettier",".gitignore":"file_type_git",".gitattributes":"file_type_git",".editorconfig":"file_type_editorconfig",dockerfile:"file_type_docker","docker-compose.yml":"file_type_docker","docker-compose.yaml":"file_type_docker",makefile:"file_type_makefile","readme.md":"file_type_markdown",license:"file_type_license","license.md":"file_type_license",".env":"file_type_config",".env.local":"file_type_config",".env.development":"file_type_config",".env.production":"file_type_config",".env.test":"file_type_config",".npmrc":"file_type_npm",".babelrc":"file_type_babel","babel.config.js":"file_type_babel","babel.config.json":"file_type_babel",".babelrc.js":"file_type_babel",".babelrc.json":"file_type_babel","jest.config.ts":"file_type_jest","jest.config.js":"file_type_jest","vitest.config.ts":"file_type_vite","vitest.config.js":"file_type_vite","webpack.config.js":"file_type_webpack","webpack.config.ts":"file_type_webpack","rollup.config.js":"file_type_rollup","rollup.config.ts":"file_type_rollup","renovate.json":"file_type_renovate",".prettierignore":"file_type_prettier",".eslintignore":"file_type_eslint",".dockerignore":"file_type_docker",prisma:"file_type_prisma"},rv={src:"folder_type_src",lib:"folder_type_library",dist:"folder_type_dist",build:"folder_type_dist",out:"folder_type_dist",public:"folder_type_public",assets:"folder_type_asset",static:"folder_type_asset",components:"folder_type_component",pages:"folder_type_view",views:"folder_type_view",routes:"folder_type_route",api:"folder_type_api",server:"folder_type_server",client:"folder_type_client",test:"folder_type_test",tests:"folder_type_test",__tests__:"folder_type_test",spec:"folder_type_test",specs:"folder_type_test",e2e:"folder_type_e2e",docs:"folder_type_docs",config:"folder_type_config",configs:"folder_type_config",scripts:"folder_type_script",styles:"folder_type_style",css:"folder_type_css",images:"folder_type_images",img:"folder_type_images",icons:"folder_type_images",fonts:"folder_type_fonts",types:"folder_type_typescript",typings:"folder_type_typings",hooks:"folder_type_hook",utils:"folder_type_helper",helpers:"folder_type_helper",tools:"folder_type_tools",services:"folder_type_services",middleware:"folder_type_middleware",models:"folder_type_model",store:"folder_type_redux",stores:"folder_type_redux",state:"folder_type_redux",node_modules:"folder_type_node",".git":"folder_type_git",".github":"folder_type_github",".vscode":"folder_type_vscode",".idea":"folder_type_idea",docker:"folder_type_docker",".docker":"folder_type_docker",kubernetes:"folder_type_kubernetes",k8s:"folder_type_kubernetes",".husky":"folder_type_husky",coverage:"folder_type_coverage",".next":"folder_type_next",".nuxt":"folder_type_nuxt",ios:"folder_type_ios",android:"folder_type_android",app:"folder_type_app",packages:"folder_type_package",modules:"folder_type_module",plugins:"folder_type_plugin",templates:"folder_type_template",i18n:"folder_type_locale",locales:"folder_type_locale",lang:"folder_type_locale",translations:"folder_type_locale",prisma:"folder_type_db",db:"folder_type_db",database:"folder_type_db",migrations:"folder_type_db",seeds:"folder_type_db",storybook:"folder_type_story",stories:"folder_type_story",".storybook":"folder_type_story",".cache":"folder_type_temp",temp:"folder_type_temp",tmp:"folder_type_temp"};function ry({name:e}){return(0,iM.jsx)(rf.default,{src:function(e){let i,n=e.toLowerCase();if(rg[n])return`/icons/${rg[n]}.svg`;let r=(i=e.lastIndexOf("."))>=0?e.slice(i).toLowerCase():"";return r&&rm[r]?`/icons/${rm[r]}.svg`:"/icons/default_file.svg"}(e),alt:e,width:16,height:16,className:"size-4 shrink-0",unoptimized:!0})}function r_({name:e,isOpen:i}){let n;return(0,iM.jsx)(rf.default,{src:(n=rv[e.toLowerCase()])?`/icons/${n}${i?"_opened":""}.svg`:i?"/icons/default_folder_opened.svg":"/icons/default_folder.svg",alt:e,width:16,height:16,className:"size-4 shrink-0",unoptimized:!0})}e.s([],236634),e.i(236634);var rx=e.i(8890),rb=e.i(535270),rw=e.i(277642),rS=e.i(29905),rk=e.i(969490),rC=e.i(756432),rT=e.i(267805);let rE=iO.createContext(void 0);function rD(){let e=iO.useContext(rE);if(void 0===e)throw Error((0,rT.default)(64));return e}let rN=((c5={}).activationDirection="data-activation-direction",c5.orientation="data-orientation",c5),rM={tabActivationDirection:e=>({[rN.activationDirection]:e})},rO=iO.forwardRef(function(e,i){let{className:n,defaultValue:r=0,onValueChange:s,orientation:o="horizontal",render:a,value:l,style:c,...d}=e,h=Object.hasOwn(e,"defaultValue"),u=iO.useRef([]),[p,f]=iO.useState(()=>new Map),[m,g]=(0,rb.useControlled)({controlled:l,default:r,name:"Tabs",state:"value"}),v=void 0!==l,[y,_]=iO.useState(()=>new Map),b=iO.useCallback(e=>{if(void 0===e)return null;for(let[i,n]of y.entries())if(null!=n&&e===(n.value??n.index))return i;return null},[y]),[w,S]=iO.useState(()=>({previousValue:m,tabActivationDirection:"none"})),{previousValue:k,tabActivationDirection:C}=w,T=C,E=!1;k!==m&&(T=rR(k,m,o,y),E=null!=k&&null!=m&&null==b(m));let D=E?k:m,N=k!==D||C!==T;(0,rw.useIsoLayoutEffect)(()=>{N&&S({previousValue:D,tabActivationDirection:T})},[D,N,T]);let M=(0,rS.useStableCallback)((e,i)=>{i.activationDirection=rR(m,e,o,y),s?.(e,i),i.isCanceled||g(e)}),O=(0,rS.useStableCallback)((e,i)=>{f(n=>{if(n.get(e)===i)return n;let r=new Map(n);return r.set(e,i),r})}),R=(0,rS.useStableCallback)((e,i)=>{f(n=>{if(!n.has(e)||n.get(e)!==i)return n;let r=new Map(n);return r.delete(e),r})}),A=iO.useCallback(e=>p.get(e),[p]),L=iO.useCallback(e=>{for(let i of y.values())if(e===i?.value)return i?.id},[y]),j=iO.useMemo(()=>({getTabElementBySelectedValue:b,getTabIdByPanelValue:L,getTabPanelIdByValue:A,onValueChange:M,orientation:o,registerMountedTabPanel:O,setTabMap:_,unregisterMountedTabPanel:R,tabActivationDirection:T,value:m}),[b,L,A,M,o,O,_,R,T,m]),I=iO.useMemo(()=>{for(let e of y.values())if(null!=e&&e.value===m)return e},[y,m]),P=iO.useMemo(()=>{for(let e of y.values())if(null!=e&&!e.disabled)return e.value},[y]);(0,rw.useIsoLayoutEffect)(()=>{if(v||0===y.size)return;let e=I?.disabled,i=null==I&&null!==m;if(h&&e&&m===r||!e&&!i)return;let n=P??null;m!==n&&(g(n),S(e=>"none"===e.tabActivationDirection?e:{...e,tabActivationDirection:"none"}))},[r,P,h,v,I,g,y,m]);let B={orientation:o,tabActivationDirection:T},z=(0,rk.useRenderElement)("div",e,{state:B,ref:i,props:d,stateAttributesMapping:rM});return(0,iM.jsx)(rE.Provider,{value:j,children:(0,iM.jsx)(rC.CompositeList,{elementsRef:u,children:z})})});function rR(e,i,n,r){if(null==e||null==i)return"none";let s=null,o=null;for(let[n,a]of r.entries()){if(null==a)continue;let r=a.value??a.index;if(e===r&&(s=n),i===r&&(o=n),null!=s&&null!=o)break}if(null==s||null==o)return s!==o&&("number"==typeof e||"string"==typeof e)&&typeof e==typeof i?"horizontal"===n?i>e?"right":"left":i>e?"down":"up":"none";let a=s.getBoundingClientRect(),l=o.getBoundingClientRect();if("horizontal"===n){if(l.left<a.left)return"left";if(l.left>a.left)return"right"}else{if(l.top<a.top)return"up";if(l.top>a.top)return"down"}return"none"}var rA=e.i(526850),rL=e.i(139236),rj=e.i(931709);let rI="data-composite-item-active";var rP=e.i(530909);let rB=iO.createContext(void 0);function rz(){let e=iO.useContext(rB);if(void 0===e)throw Error((0,rT.default)(65));return e}var rF=e.i(602453),rH=e.i(742665),rW=e.i(410421);let r$=iO.forwardRef(function(e,i){let{className:n,disabled:r=!1,render:s,value:o,id:a,nativeButton:l=!0,style:c,...d}=e,{value:h,getTabPanelIdByValue:u,orientation:p}=rD(),{activateOnFocus:f,highlightedTabIndex:m,onTabActivation:g,registerTabResizeObserverElement:v,setHighlightedTabIndex:y,tabsListElement:_}=rz(),b=(0,rL.useBaseUiId)(a),w=iO.useMemo(()=>({disabled:r,id:b,value:o}),[r,b,o]),{compositeProps:S,compositeRef:k,index:C}=(0,rP.useCompositeItem)({metadata:w}),T=o===h,E=iO.useRef(!1),D=iO.useRef(null);iO.useEffect(()=>{let e=D.current;if(e)return v(e)},[v]),(0,rw.useIsoLayoutEffect)(()=>{if(E.current){E.current=!1;return}if(T&&C>-1&&m!==C){if(null!=_){let e=(0,rW.activeElement)((0,rA.ownerDocument)(_));if(e&&(0,rW.contains)(_,e))return}r||y(C)}},[T,C,m,y,r,_]);let{getButtonProps:N,buttonRef:M}=(0,rj.useButton)({disabled:r,native:l,focusableWhenDisabled:!0}),O=u(o),R=iO.useRef(!1),A=iO.useRef(!1);return(0,rk.useRenderElement)("button",e,{state:{disabled:r,active:T,orientation:p},ref:[i,M,k,D],props:[S,{role:"tab","aria-controls":O,"aria-selected":T,id:b,onClick:function(e){T||r||g(o,(0,rF.createChangeEventDetails)(rH.REASONS.none,e.nativeEvent,void 0,{activationDirection:"none"}))},onFocus:function(e){T||(C>-1&&!r&&y(C),!r&&f&&(!R.current||R.current&&A.current)&&g(o,(0,rF.createChangeEventDetails)(rH.REASONS.none,e.nativeEvent,void 0,{activationDirection:"none"})))},onPointerDown:function(e){T||r||(R.current=!0,e.button&&0!==e.button||(A.current=!0,(0,rA.ownerDocument)(e.currentTarget).addEventListener("pointerup",function(){R.current=!1,A.current=!1},{once:!0})))},[rI]:T?"":void 0,onKeyDownCapture(){E.current=!0}},d,N]})});var rU=e.i(730774),rV=e.i(517432);let rq=((c3={}).activeTabLeft="--active-tab-left",c3.activeTabRight="--active-tab-right",c3.activeTabTop="--active-tab-top",c3.activeTabBottom="--active-tab-bottom",c3.activeTabWidth="--active-tab-width",c3.activeTabHeight="--active-tab-height",c3);var rK=e.i(394394);let rY={...rM,activeTabPosition:()=>null,activeTabSize:()=>null},rX=iO.forwardRef(function(e,i){let{className:n,render:r,renderBeforeHydration:s=!1,style:o,...a}=e,{nonce:l}=(0,rK.useCSPContext)(),{getTabElementBySelectedValue:c,orientation:d,tabActivationDirection:h,value:u}=rD(),{tabsListElement:p,registerIndicatorUpdateListener:f}=rz(),m=(0,rV.useIsHydrating)(),g=function(){let[,e]=iO.useState({});return iO.useCallback(()=>{e({})},[])}();iO.useEffect(()=>f(g),[f,g]);let v=0,y=0,_=0,b=0,w=0,S=0,k=!1;if(null!=u&&null!=p){let e=c(u);if(k=!0,null!=e){let{width:i,height:n}=(0,rU.getCssDimensions)(e),{width:r,height:s}=(0,rU.getCssDimensions)(p),o=e.getBoundingClientRect(),a=p.getBoundingClientRect(),l=r>0?a.width/r:1,c=s>0?a.height/s:1;if(Math.abs(l)>Number.EPSILON&&Math.abs(c)>Number.EPSILON){let e=o.left-a.left,i=o.top-a.top;v=e/l+p.scrollLeft-p.clientLeft,_=i/c+p.scrollTop-p.clientTop}else v=e.offsetLeft,_=e.offsetTop;w=i,S=n,y=p.scrollWidth-v-w,b=p.scrollHeight-_-S}}let C=iO.useMemo(()=>k?{left:v,right:y,top:_,bottom:b}:null,[v,y,_,b,k]),T=iO.useMemo(()=>k?{width:w,height:S}:null,[w,S,k]),E=iO.useMemo(()=>{if(k)return{[rq.activeTabLeft]:`${v}px`,[rq.activeTabRight]:`${y}px`,[rq.activeTabTop]:`${_}px`,[rq.activeTabBottom]:`${b}px`,[rq.activeTabWidth]:`${w}px`,[rq.activeTabHeight]:`${S}px`}},[v,y,_,b,w,S,k]),D=k&&w>0&&S>0,N=(0,rk.useRenderElement)("span",e,{state:{orientation:d,activeTabPosition:C,activeTabSize:T,tabActivationDirection:h},ref:i,props:[{role:"presentation",style:E,hidden:!D},a,{suppressHydrationWarning:!0}],stateAttributesMapping:rY});return null==u?null:(0,iM.jsxs)(iO.Fragment,{children:[N,m&&s&&(0,iM.jsx)("script",{nonce:l,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'},suppressHydrationWarning:!0})]})});var rJ=e.i(677822),rG=e.i(282458),rZ=e.i(273598),rQ=e.i(254891),r0=e.i(296615);let r1=((c4={}).index="data-index",c4.activationDirection="data-activation-direction",c4.orientation="data-orientation",c4.hidden="data-hidden",c4[c4.startingStyle=rG.TransitionStatusDataAttributes.startingStyle]="startingStyle",c4[c4.endingStyle=rG.TransitionStatusDataAttributes.endingStyle]="endingStyle",c4),r2={...rM,...rG.transitionStatusMapping},r5=iO.forwardRef(function(e,i){let{className:n,value:r,render:s,keepMounted:o=!1,style:a,...l}=e,{value:c,getTabIdByPanelValue:d,orientation:h,tabActivationDirection:u,registerMountedTabPanel:p,unregisterMountedTabPanel:f}=rD(),m=(0,rL.useBaseUiId)(),g=iO.useMemo(()=>({id:m,value:r}),[m,r]),{ref:v,index:y}=(0,r0.useCompositeListItem)({metadata:g}),_=r===c,{mounted:b,transitionStatus:w,setMounted:S}=(0,rQ.useTransitionStatus)(_),k=!b,C=d(r),T=iO.useRef(null),E=(0,rk.useRenderElement)("div",e,{state:{hidden:k,orientation:h,tabActivationDirection:u,transitionStatus:w},ref:[i,v,T],props:[{"aria-labelledby":C,hidden:k,id:m,role:"tabpanel",tabIndex:_?0:-1,inert:(0,rJ.inertValue)(!_),[r1.index]:y},l],stateAttributesMapping:r2});return((0,rZ.useOpenChangeComplete)({open:_,ref:T,onComplete(){_||S(!1)}}),(0,rw.useIsoLayoutEffect)(()=>{if((!k||o)&&null!=m)return p(r,m),()=>{f(r,m)}},[k,o,r,m,p,f]),o||b)?E:null});var r3=e.i(863728);function r4(e){return null==e||e.hasAttribute("disabled")||"true"===e.getAttribute("aria-disabled")}var r6=e.i(204133),r8=e.i(100229),r9=e.i(877580);let r7=[];var se=e.i(352360),st=e.i(189131);function si(e){let{render:i,className:n,style:r,refs:s=r3.EMPTY_ARRAY,props:o=r3.EMPTY_ARRAY,state:a=r3.EMPTY_OBJECT,stateAttributesMapping:l,highlightedIndex:c,onHighlightedIndexChange:d,orientation:h,dense:u,itemSizes:p,loopFocus:f,onLoop:m,cols:g,enableHomeAndEndKeys:v,onMapChange:y,stopEventPropagation:_=!0,rootRef:b,disabledIndices:w,modifierKeys:S,highlightItemOnHover:k=!1,tag:C="div",...T}=e,{props:E,highlightedIndex:D,onHighlightedIndexChange:N,elementsRef:M,onMapChange:O,relayKeyboardEvent:R}=function(e){let{itemSizes:i,cols:n=1,loopFocus:r=!0,onLoop:s,dense:o=!1,orientation:a="both",direction:l,highlightedIndex:c,onHighlightedIndexChange:d,rootRef:h,enableHomeAndEndKeys:u=!1,stopEventPropagation:p=!1,disabledIndices:f,modifierKeys:m=r7}=e,[g,v]=iO.useState(0),y=n>1,_=iO.useRef(null),b=(0,r6.useMergedRefs)(_,h),w=iO.useRef([]),S=iO.useRef(!1),k=c??g,C=(0,rS.useStableCallback)((e,i=!1)=>{if((d??v)(e),i){let i=w.current[e];(0,r8.scrollIntoViewIfNeeded)(_.current,i,l,a)}}),T=(0,rS.useStableCallback)(e=>{if(0===e.size||S.current)return;S.current=!0;let i=Array.from(e.keys()),n=i.find(e=>e?.hasAttribute(rI))??null,r=n?i.indexOf(n):-1;-1!==r&&C(r),(0,r8.scrollIntoViewIfNeeded)(_.current,n,l,a)}),E=(0,rS.useStableCallback)((e,i,n)=>s?s?.(e,i,n,w):n),D=iO.useMemo(()=>({"aria-orientation":"both"===a?void 0:a,ref:b,onFocus(e){let i=_.current,n=(0,rW.getTarget)(e.nativeEvent);i&&null!=n&&(0,r8.isNativeInput)(n)&&n.setSelectionRange(0,n.value.length??0)},onKeyDown(e){let c=u?r8.ALL_KEYS:r8.ARROW_KEYS;if(!c.has(e.key)||function(e,i){for(let n of r8.MODIFIER_KEYS.values())if(!i.includes(n)&&e.getModifierState(n))return!0;return!1}(e,m)||!_.current)return;let d="rtl"===l,h=d?r8.ARROW_LEFT:r8.ARROW_RIGHT,g={horizontal:h,vertical:r8.ARROW_DOWN,both:h}[a],v=d?r8.ARROW_RIGHT:r8.ARROW_LEFT,b={horizontal:v,vertical:r8.ARROW_UP,both:v}[a],S=(0,rW.getTarget)(e.nativeEvent);if(null!=S&&(0,r8.isNativeInput)(S)&&!r4(S)){let i=S.selectionStart,n=S.selectionEnd,r=S.value??"";if(null==i||e.shiftKey||i!==n||e.key!==b&&i<r.length||e.key!==g&&i>0)return}let T=k,D=(0,r9.getMinListIndex)(w,f),N=(0,r9.getMaxListIndex)(w,f);if(y){let s=i||Array.from({length:w.current.length},()=>({width:1,height:1})),l=(0,r9.createGridCellMap)(s,n,o),c=l.findIndex(e=>null!=e&&!(0,r9.isListIndexDisabled)(w.current,e,f)),h=l.reduce((e,i,n)=>null==i||(0,r9.isListIndexDisabled)(w.current,i,f)?e:n,-1);T=l[(0,r9.getGridNavigatedIndex)(l.map(e=>null!=e?w.current[e]:null),{event:e,orientation:a,loopFocus:r,onLoop:E,cols:n,disabledIndices:(0,r9.getGridCellIndices)([...f||w.current.map((e,i)=>(0,r9.isListIndexDisabled)(w.current,i)?i:void 0),void 0],l),minIndex:c,maxIndex:h,prevIndex:(0,r9.getGridCellIndexOfCorner)(k>N?D:k,s,l,n,e.key===r8.ARROW_DOWN?"bl":e.key===r8.ARROW_RIGHT?"tr":"tl"),rtl:d})]}let M={horizontal:[h],vertical:[r8.ARROW_DOWN],both:[h,r8.ARROW_DOWN]}[a],O={horizontal:[v],vertical:[r8.ARROW_UP],both:[v,r8.ARROW_UP]}[a],R=y?c:({horizontal:u?r8.HORIZONTAL_KEYS_WITH_EXTRA_KEYS:r8.HORIZONTAL_KEYS,vertical:u?r8.VERTICAL_KEYS_WITH_EXTRA_KEYS:r8.VERTICAL_KEYS,both:c})[a];u&&(e.key===r8.HOME?T=D:e.key===r8.END&&(T=N)),T===k&&(M.includes(e.key)||O.includes(e.key))&&(r&&T===N&&M.includes(e.key)?(T=D,s&&(T=s(e,k,T,w))):r&&T===D&&O.includes(e.key)?(T=N,s&&(T=s(e,k,T,w))):T=(0,r9.findNonDisabledListIndex)(w.current,{startingIndex:T,decrement:O.includes(e.key),disabledIndices:f})),T===k||(0,r9.isIndexOutOfListBounds)(w.current,T)||(p&&e.stopPropagation(),R.has(e.key)&&e.preventDefault(),C(T,!0),queueMicrotask(()=>{w.current[T]?.focus()}))}}),[n,o,l,f,w,u,k,y,i,r,s,E,b,m,C,a,p]);return iO.useMemo(()=>({props:D,highlightedIndex:k,onHighlightedIndexChange:C,elementsRef:w,disabledIndices:f,onMapChange:T,relayKeyboardEvent:D.onKeyDown}),[D,k,C,w,f,T])}({itemSizes:p,cols:g,loopFocus:f,onLoop:m,dense:u,orientation:h,highlightedIndex:c,onHighlightedIndexChange:d,rootRef:b,stopEventPropagation:_,enableHomeAndEndKeys:v,direction:(0,st.useDirection)(),disabledIndices:w,modifierKeys:S}),A=(0,rk.useRenderElement)(C,e,{state:a,ref:s,props:[E,...o,T],stateAttributesMapping:l}),L=iO.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:N,highlightItemOnHover:k,relayKeyboardEvent:R}),[D,N,k,R]);return(0,iM.jsx)(se.CompositeRootContext.Provider,{value:L,children:(0,iM.jsx)(rC.CompositeList,{elementsRef:M,onMapChange:e=>{y?.(e),O(e)},children:A})})}let sn=iO.forwardRef(function(e,i){let{activateOnFocus:n=!1,className:r,loopFocus:s=!0,render:o,style:a,...l}=e,{onValueChange:c,orientation:d,value:h,setTabMap:u,tabActivationDirection:p}=rD(),[f,m]=iO.useState(0),[g,v]=iO.useState(null),y=iO.useRef(new Set),_=iO.useRef(new Set),b=iO.useRef(null),w=(0,rS.useStableCallback)(()=>{y.current.forEach(e=>{e()})});iO.useEffect(()=>{if("u"<typeof ResizeObserver)return;let e=new ResizeObserver(()=>{y.current.size&&w()});return b.current=e,g&&e.observe(g),_.current.forEach(i=>{e.observe(i)}),()=>{e.disconnect(),b.current=null}},[g,w]);let S=(0,rS.useStableCallback)(e=>(y.current.add(e),()=>{y.current.delete(e)})),k=(0,rS.useStableCallback)(e=>(_.current.add(e),b.current?.observe(e),()=>{_.current.delete(e),b.current?.unobserve(e)})),C=(0,rS.useStableCallback)((e,i)=>{e!==h&&c(e,i)}),T=iO.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:f,registerIndicatorUpdateListener:S,registerTabResizeObserverElement:k,onTabActivation:C,setHighlightedTabIndex:m,tabsListElement:g}),[n,f,S,k,C,m,g]);return(0,iM.jsx)(rB.Provider,{value:T,children:(0,iM.jsx)(si,{render:o,className:r,style:a,state:{orientation:d,tabActivationDirection:p},refs:[i,v],props:[{"aria-orientation":"vertical"===d?"vertical":void 0,role:"tablist"},l],stateAttributesMapping:rM,highlightedIndex:f,enableHomeAndEndKeys:!0,loopFocus:s,orientation:d,onHighlightedIndexChange:m,onMapChange:u,disabledIndices:r3.EMPTY_ARRAY})})});e.s(["Indicator",0,rX,"List",0,sn,"Panel",0,r5,"Root",0,rO,"Tab",0,r$],227146);var sr=e.i(227146),sr=sr;function ss({className:e,orientation:i="horizontal",...n}){return(0,iM.jsx)(sr.Root,{"data-slot":"tabs","data-orientation":i,className:(0,n1.cn)("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}let so=(0,e.i(294237).cva)("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function sa({className:e,variant:i="default",...n}){return(0,iM.jsx)(sr.List,{"data-slot":"tabs-list","data-variant":i,className:(0,n1.cn)(so({variant:i}),e),...n})}function sl({className:e,...i}){return(0,iM.jsx)(sr.Tab,{"data-slot":"tabs-trigger",className:(0,n1.cn)("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...i})}function sc({className:e,...i}){return(0,iM.jsx)(sr.Panel,{"data-slot":"tabs-content",className:(0,n1.cn)("flex-1 text-sm outline-none",e),...i})}function sd({nodes:e}){return e.map(e=>"directory"===e.type?(0,iM.jsx)(n6,{path:e.path,name:e.name,folderIcon:i=>(0,iM.jsx)(r_,{name:e.name,isOpen:i}),children:e.children&&(0,iM.jsx)(sd,{nodes:e.children})},e.path):(0,iM.jsx)(n9,{path:e.path,name:e.name,icon:(0,iM.jsx)(ry,{name:e.name})},e.path))}let sh="agent-spaces:file-tree-expanded:";function su(e){try{let i=localStorage.getItem(sh+e);if(i)return new Set(JSON.parse(i))}catch{}return new Set}function sp(e,i){try{localStorage.setItem(sh+e,JSON.stringify([...i]))}catch{}}function sf({workspaceId:e}){let{tree:i,treeLoading:n,loadTree:r,openFile:s,revealPath:o,clearRevealPath:a}=(0,rd.useEditorStore)(),l=(0,n2.useTranslations)("editor"),[c,d]=(0,iO.useState)(),[h,u]=(0,iO.useState)(()=>su(e));(0,iO.useEffect)(()=>{r(e),u(su(e))},[e,r]);let p=(0,iO.useCallback)(i=>{u(i),sp(e,i)},[e]),f=async i=>{await fetch(`/api/workspaces/${e}/files?path=${encodeURIComponent(i)}`,{method:"DELETE"}),r(e)};return(0,iO.useEffect)(()=>{if(!o)return;let i=o.split("/").filter(Boolean),n=[],r="";for(let e=0;e<i.length-1;e++)r=r?`${r}/${i[e]}`:i[e],n.push(r);u(i=>{let r=new Set(i);for(let e of n)r.add(e);return sp(e,r),r}),d(o),a()},[o,e,a]),(0,iM.jsx)("div",{className:"flex flex-col h-full",children:(0,iM.jsxs)(ss,{defaultValue:"files",className:"flex flex-col h-full",children:[(0,iM.jsxs)(sa,{className:"w-full h-8 shrink-0 rounded-none border-b bg-transparent p-0",children:[(0,iM.jsx)(sl,{value:"files",className:"flex-1 gap-1 rounded-none border border-b-2 border-transparent text-xs text-muted-foreground data-[active]:border-b-primary data-[active]:bg-transparent data-[active]:text-foreground data-[active]:shadow-none",children:l("explorer")}),(0,iM.jsx)(sl,{value:"search",className:"flex-1 gap-1 rounded-none border border-b-2 border-transparent text-xs text-muted-foreground data-[active]:border-b-primary data-[active]:bg-transparent data-[active]:text-foreground data-[active]:shadow-none",children:l("search")})]}),(0,iM.jsxs)(sc,{value:"files",className:"flex-1 min-h-0 mt-0",children:[(0,iM.jsx)("div",{className:"flex items-center justify-end px-2 py-1 border-b",children:(0,iM.jsx)("button",{onClick:()=>r(e),className:"p-0.5 hover:bg-accent rounded",disabled:n,children:(0,iM.jsx)(rp.RefreshCw,{className:`size-3 ${n?"animate-spin":""}`})})}),(0,iM.jsxs)("div",{className:"overflow-auto py-1",style:{height:"calc(100% - 28px)"},children:[0===i.length&&!n&&(0,iM.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:l("noFiles")}),i.length>0&&(0,iM.jsx)(n3,{expanded:h,onExpandedChange:p,selectedPath:c,onFileSelect:i=>{d(i),s(e,i)},workspaceId:e,onDelete:f,children:(0,iM.jsx)(sd,{nodes:i})})]})]}),(0,iM.jsx)(sc,{value:"search",className:"flex-1 min-h-0 mt-0",children:(0,iM.jsx)(rh,{workspaceId:e})})]})})}var sm=e.i(887836);e.i(462506);var sg=e.i(972846),sv=e.i(361031);e.s([],2365),e.i(2365);var sy=e.i(394822),s_=e.i(174465),sx=e.i(648224),sb=e.i(35359),sw=e.i(422561),sS=e.i(232449),sk=e.i(150129),sC=e.i(817955),sT=e.i(87709);let sE=iO.forwardRef(function(e,i){let{render:n,className:r,style:s,...o}=e,{setAnchor:a,actionsRef:l,internalBackdropRef:c,backdropRef:d,positionerRef:h,allowMouseUpTriggerRef:u,initialCursorPointRef:p,rootId:f}=(0,s_.useContextMenuRootContext)(!1),{store:m}=(0,sb.useMenuRootContext)(!1),g=m.useState("open"),v=m.useState("disabled"),y=iO.useRef(null),_=iO.useRef(null),b=(0,sS.useTimeout)(),w=(0,sS.useTimeout)(),S=iO.useRef(!1);function k(e,i,n){let r=n.type.startsWith("touch");p.current={x:e,y:i},a({getBoundingClientRect:()=>DOMRect.fromRect({width:10*!!r,height:10*!!r,x:e,y:i})}),S.current=!1,l.current?.setOpen(!0,(0,rF.createChangeEventDetails)(rH.REASONS.triggerPress,n)),w.start(500,()=>{S.current=!0})}function C(){b.clear(),_.current=null}return iO.useEffect(()=>{let e=(0,rA.ownerDocument)(y.current);return(0,sw.addEventListener)(e,"contextmenu",function(e){if(v)return;let i=(0,rW.getTarget)(e);((0,rW.contains)(y.current,i)||(0,rW.contains)(c.current,i)||(0,rW.contains)(d.current,i))&&e.preventDefault()})},[d,v,c]),(0,rk.useRenderElement)("div",e,{state:{open:g},ref:[y,i],props:[{onContextMenu:function(e){if(v)return;u.current=!0,(0,sk.stopEvent)(e),k(e.clientX,e.clientY,e.nativeEvent);let i=(0,rA.ownerDocument)(y.current);(0,sw.addEventListener)(i,"mouseup",e=>{if(u.current=!1,!S.current)return;w.clear(),S.current=!1;let i=(0,rW.getTarget)(e);(0,rW.contains)(h.current,i)||f&&i&&(0,sT.findRootOwnerId)(i)===f||l.current?.setOpen(!1,(0,rF.createChangeEventDetails)(rH.REASONS.cancelOpen,e))},{once:!0})},onTouchStart:function(e){if(!v&&(u.current=!1,1===e.touches.length)){e.stopPropagation();let i=e.touches[0];_.current={x:i.clientX,y:i.clientY},b.start(500,()=>{_.current&&k(_.current.x,_.current.y,e.nativeEvent)})}},onTouchMove:function(e){if(b.isStarted()&&_.current&&1===e.touches.length){let i=e.touches[0],n=Math.abs(i.clientX-_.current.x),r=Math.abs(i.clientY-_.current.y);(n>10||r>10)&&b.clear()}},onTouchEnd:C,onTouchCancel:C,style:{WebkitTouchCallout:"none"}},o],stateAttributesMapping:sC.pressableTriggerOpenStateMapping})});var sD=e.i(487455),sN=e.i(293209),sM=e.i(503662),sO=e.i(33427),sR=e.i(324573),sA=e.i(582883),sL=e.i(277658),sj=e.i(349204),sI=e.i(28051),sP=e.i(597375),sB=e.i(81752),sz=e.i(59354),sF=e.i(300637),sH=e.i(281478),sW=e.i(65255),s$=e.i(327794),sU=e.i(362962);e.s(["Arrow",()=>sR.MenuArrow,"Backdrop",()=>sD.MenuBackdrop,"CheckboxItem",()=>sI.MenuCheckboxItem,"CheckboxItemIndicator",()=>sP.MenuCheckboxItemIndicator,"Group",()=>sA.MenuGroup,"GroupLabel",()=>sL.MenuGroupLabel,"Item",()=>sj.MenuItem,"LinkItem",()=>sB.MenuLinkItem,"Popup",()=>sO.MenuPopup,"Portal",()=>sN.MenuPortal,"Positioner",()=>sM.MenuPositioner,"RadioGroup",()=>sz.MenuRadioGroup,"RadioItem",()=>sF.MenuRadioItem,"RadioItemIndicator",()=>sH.MenuRadioItemIndicator,"Root",0,function(e){let[i,n]=iO.useState({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,x:0,y:0})}),r=iO.useRef(null),s=iO.useRef(null),o=iO.useRef(null),a=iO.useRef(null),l=iO.useRef(!0),c=iO.useRef(null),d=(0,sy.useId)(),h=iO.useMemo(()=>({anchor:i,setAnchor:n,actionsRef:o,backdropRef:r,internalBackdropRef:s,positionerRef:a,allowMouseUpTriggerRef:l,initialCursorPointRef:c,rootId:d}),[i,d]);return(0,iM.jsx)(s_.ContextMenuRootContext.Provider,{value:h,children:(0,iM.jsx)(sb.MenuRootContext.Provider,{value:void 0,children:(0,iM.jsx)(sx.Menu.Root,{...e})})})},"Separator",()=>sU.Separator,"SubmenuRoot",()=>sW.MenuSubmenuRoot,"SubmenuTrigger",()=>s$.MenuSubmenuTrigger,"Trigger",0,sE],912001);var sV=e.i(912001),sV=sV,sq=e.i(299648);function sK({...e}){return(0,iM.jsx)(sV.Root,{"data-slot":"context-menu",...e})}function sY({className:e,...i}){return(0,iM.jsx)(sV.Trigger,{"data-slot":"context-menu-trigger",className:(0,n1.cn)("select-none",e),...i})}function sX({className:e,align:i="start",alignOffset:n=4,side:r="right",sideOffset:s=0,...o}){return(0,iM.jsx)(sV.Portal,{children:(0,iM.jsx)(sV.Positioner,{className:"isolate z-50 outline-none",align:i,alignOffset:n,side:r,sideOffset:s,children:(0,iM.jsx)(sV.Popup,{"data-slot":"context-menu-content",className:(0,n1.cn)("z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o})})})}function sJ({className:e,inset:i,variant:n="default",...r}){return(0,iM.jsx)(sV.Item,{"data-slot":"context-menu-item","data-inset":i,"data-variant":n,className:(0,n1.cn)("group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function sG({className:e,...i}){return(0,iM.jsx)(sV.Separator,{"data-slot":"context-menu-separator",className:(0,n1.cn)("-mx-1 my-1 h-px bg-border",e),...i})}var sZ=e.i(360112);function sQ({workspaceId:e}){let{openFiles:i,activeFilePath:n,setActiveFile:r,closeFile:s,saveFile:o,setRevealPath:a}=(0,rd.useEditorStore)(),l=(0,sv.useWorkspaceStore)(e=>e.workspaces).find(i=>i.id===e),c=l?.boundDirs??[],d=(0,n2.useTranslations)("editor");if(0===i.length)return null;let h=async e=>{await navigator.clipboard.writeText(e),sZ.toast.success(d("copied"))};return(0,iM.jsx)("div",{className:"flex items-center border-b bg-muted/30 overflow-x-auto",children:i.map(i=>(0,iM.jsxs)(sK,{children:[(0,iM.jsx)(sY,{children:(0,iM.jsxs)("div",{className:`flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-pointer shrink-0 ${i.path===n?"bg-background text-foreground":"text-muted-foreground hover:bg-accent"}`,onClick:()=>r(e,i.path),children:[i.modified&&(0,iM.jsx)("span",{className:"size-1.5 rounded-full bg-orange-400 shrink-0"}),(0,iM.jsx)("span",{className:"truncate max-w-32",children:i.name}),(0,iM.jsx)("button",{className:"ml-1 hover:bg-accent rounded p-0.5",onClick:n=>{n.stopPropagation(),i.modified&&o(e,i.path),s(e,i.path)},children:(0,iM.jsx)(sg.X,{className:"size-3"})})]})}),(0,iM.jsxs)(sX,{children:[(0,iM.jsx)(sJ,{onClick:()=>a(i.path),children:d("revealInTree")}),(0,iM.jsx)(sJ,{onClick:()=>{var n;return n=i.path,void fetch(`/api/workspaces/${e}/files/reveal?path=${encodeURIComponent(n)}`,{method:"POST"})},children:d("revealInFinder")}),(0,iM.jsx)(sG,{}),(0,iM.jsx)(sJ,{onClick:()=>{var e;return h((e=i.path,0===c.length?e:c[0].replace(/\/+$/,"")+"/"+e))},children:d("copyFilePath")}),(0,iM.jsx)(sJ,{onClick:()=>h(i.path),children:d("copyRelativePath")})]})]},i.path))})}var s0=e.i(950396);e.i(836406),e.i(859073),e.i(664195),e.i(347410),e.i(768224),e.i(93151),e.i(158555),e.i(517965),e.i(742150),e.i(500127),e.i(874243),e.i(686882),e.i(127819),e.i(640883),e.i(604257),e.i(869416),e.i(116427),e.i(836354),e.i(473864),e.i(318209),e.i(172781),e.i(250182),e.i(131624),e.i(238015),e.i(534662),e.i(433140),e.i(663159),e.i(119260),e.i(877059),e.i(808e3),e.i(645831),e.i(764894),e.i(551501),e.i(337525),e.i(335283),e.i(615239),e.i(324240),e.i(33999),e.i(745026),e.i(637114),e.i(705067),e.i(948539),e.i(768797),e.i(633666),e.i(405261),e.i(231009),e.i(72895),e.i(862215),e.i(273544),e.i(844168),e.i(843210),e.i(767312),e.i(116013),e.i(735564),e.i(44118),e.i(486172),e.i(321915),e.i(171733),e.i(6838),e.i(45048),e.i(526568),e.i(646675),e.i(426208),e.i(772315),e.i(137475),e.i(504183),e.i(656092),e.i(126391),e.i(925665),e.i(756500);var s1=e.i(680590);class s2{constructor(e,i,n){this._onDidChange=new s1.Emitter,this._languageId=e,this.setOptions(i),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)}}let s5={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}},s3={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},s4=new s2("css",s5,s3),s6=new s2("scss",s5,s3),s8=new s2("less",s5,s3);function s9(){return e.A(771485)}s1.languages.onLanguage("less",()=>{s9().then(e=>e.setupMode(s8))}),s1.languages.onLanguage("scss",()=>{s9().then(e=>e.setupMode(s6))}),s1.languages.onLanguage("css",()=>{s9().then(e=>e.setupMode(s4))}),e.s(["cssDefaults",0,s4,"lessDefaults",0,s8,"scssDefaults",0,s6],312705);var s7=e.i(312705);class oe{constructor(e,i,n){this._onDidChange=new s1.Emitter,this._languageId=e,this.setOptions(i),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)}}let ot={format:{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"},suggest:{},data:{useDefaultDataProvider:!0}};function oi(e){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:e===on,documentFormattingEdits:e===on,documentRangeFormattingEdits:e===on}}let on="html",or="handlebars",oo="razor",oa=op(on,ot,oi(on)),ol=oa.defaults,oc=op(or,ot,oi(or)),od=oc.defaults,oh=op(oo,ot,oi(oo)),ou=oh.defaults;function op(i,n=ot,r=oi(i)){let s,o=new oe(i,n,r),a=s1.languages.onLanguage(i,async()=>{s=(await e.A(918487)).setupMode(o)});return{defaults:o,dispose(){a.dispose(),s?.dispose(),s=void 0}}}e.s(["handlebarDefaults",0,od,"handlebarLanguageService",0,oc,"htmlDefaults",0,ol,"htmlLanguageService",0,oa,"razorDefaults",0,ou,"razorLanguageService",0,oh,"registerHTMLLanguageService",0,op],994073);var of=e.i(994073);let om=new class{constructor(e,i,n){this._onDidChange=new s1.Emitter,this._languageId=e,this.setDiagnosticsOptions(i),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)}}("json",{validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},{documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0});function og(){return e.A(134924)}s1.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),s1.languages.onLanguage("json",()=>{og().then(e=>e.setupMode(om))}),e.s(["getWorker",0,()=>og().then(e=>e.getWorker()),"jsonDefaults",0,om],632514);var ov=e.i(632514),oy=e.i(551959);let o_={},ox={};class ob{static getOrCreate(e){return ox[e]||(ox[e]=new ob(e)),ox[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((e,i)=>{this._lazyLoadPromiseResolve=e,this._lazyLoadPromiseReject=i})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,o_[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}}function ow(e){let i=e.id;o_[i]=e,s1.languages.register(e);let n=ob.getOrCreate(i);s1.languages.registerTokensProviderFactory(i,{create:async()=>(await n.load()).language}),s1.languages.onLanguageEncountered(i,async()=>{let e=await n.load();s1.languages.setLanguageConfiguration(i,e.conf)})}ow({id:"abap",extensions:[".abap"],aliases:["abap","ABAP"],loader:()=>e.A(635811)}),ow({id:"apex",extensions:[".cls"],aliases:["Apex","apex"],mimetypes:["text/x-apex-source","text/x-apex"],loader:()=>e.A(264749)}),ow({id:"azcli",extensions:[".azcli"],aliases:["Azure CLI","azcli"],loader:()=>e.A(317605)}),ow({id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],loader:()=>e.A(704590)}),ow({id:"bicep",extensions:[".bicep"],aliases:["Bicep"],loader:()=>e.A(153742)}),ow({id:"cameligo",extensions:[".mligo"],aliases:["Cameligo"],loader:()=>e.A(629448)}),ow({id:"clojure",extensions:[".clj",".cljs",".cljc",".edn"],aliases:["clojure","Clojure"],loader:()=>e.A(124011)}),ow({id:"coffeescript",extensions:[".coffee"],aliases:["CoffeeScript","coffeescript","coffee"],mimetypes:["text/x-coffeescript","text/coffeescript"],loader:()=>e.A(331538)}),ow({id:"c",extensions:[".c",".h"],aliases:["C","c"],loader:()=>e.A(940085)}),ow({id:"cpp",extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],aliases:["C++","Cpp","cpp"],loader:()=>e.A(940085)}),ow({id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],loader:()=>e.A(158993)}),ow({id:"csp",extensions:[".csp"],aliases:["CSP","csp"],loader:()=>e.A(189140)}),ow({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>e.A(12065)}),ow({id:"cypher",extensions:[".cypher",".cyp"],aliases:["Cypher","OpenCypher"],loader:()=>e.A(546118)}),ow({id:"dart",extensions:[".dart"],aliases:["Dart","dart"],mimetypes:["text/x-dart-source","text/x-dart"],loader:()=>e.A(468355)}),ow({id:"dockerfile",extensions:[".dockerfile"],filenames:["Dockerfile"],aliases:["Dockerfile"],loader:()=>e.A(292453)}),ow({id:"ecl",extensions:[".ecl"],aliases:["ECL","Ecl","ecl"],loader:()=>e.A(699591)}),ow({id:"elixir",extensions:[".ex",".exs"],aliases:["Elixir","elixir","ex"],loader:()=>e.A(357037)}),ow({id:"flow9",extensions:[".flow"],aliases:["Flow9","Flow","flow9","flow"],loader:()=>e.A(766246)}),ow({id:"fsharp",extensions:[".fs",".fsi",".ml",".mli",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],loader:()=>e.A(301403)}),ow({id:"freemarker2",extensions:[".ftl",".ftlh",".ftlx"],aliases:["FreeMarker2","Apache FreeMarker2"],loader:()=>e.A(806910).then(e=>e.TagAutoInterpolationDollar)}),ow({id:"freemarker2.tag-angle.interpolation-dollar",aliases:["FreeMarker2 (Angle/Dollar)","Apache FreeMarker2 (Angle/Dollar)"],loader:()=>e.A(806910).then(e=>e.TagAngleInterpolationDollar)}),ow({id:"freemarker2.tag-bracket.interpolation-dollar",aliases:["FreeMarker2 (Bracket/Dollar)","Apache FreeMarker2 (Bracket/Dollar)"],loader:()=>e.A(806910).then(e=>e.TagBracketInterpolationDollar)}),ow({id:"freemarker2.tag-angle.interpolation-bracket",aliases:["FreeMarker2 (Angle/Bracket)","Apache FreeMarker2 (Angle/Bracket)"],loader:()=>e.A(806910).then(e=>e.TagAngleInterpolationBracket)}),ow({id:"freemarker2.tag-bracket.interpolation-bracket",aliases:["FreeMarker2 (Bracket/Bracket)","Apache FreeMarker2 (Bracket/Bracket)"],loader:()=>e.A(806910).then(e=>e.TagBracketInterpolationBracket)}),ow({id:"freemarker2.tag-auto.interpolation-dollar",aliases:["FreeMarker2 (Auto/Dollar)","Apache FreeMarker2 (Auto/Dollar)"],loader:()=>e.A(806910).then(e=>e.TagAutoInterpolationDollar)}),ow({id:"freemarker2.tag-auto.interpolation-bracket",aliases:["FreeMarker2 (Auto/Bracket)","Apache FreeMarker2 (Auto/Bracket)"],loader:()=>e.A(806910).then(e=>e.TagAutoInterpolationBracket)}),ow({id:"go",extensions:[".go"],aliases:["Go"],loader:()=>e.A(961253)}),ow({id:"graphql",extensions:[".graphql",".gql"],aliases:["GraphQL","graphql","gql"],mimetypes:["application/graphql"],loader:()=>e.A(264559)}),ow({id:"handlebars",extensions:[".handlebars",".hbs"],aliases:["Handlebars","handlebars","hbs"],mimetypes:["text/x-handlebars-template"],loader:()=>e.A(30518)}),ow({id:"hcl",extensions:[".tf",".tfvars",".hcl"],aliases:["Terraform","tf","HCL","hcl"],loader:()=>e.A(768474)}),ow({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:()=>e.A(504826)}),ow({id:"ini",extensions:[".ini",".properties",".gitconfig"],filenames:["config",".gitattributes",".gitconfig",".editorconfig"],aliases:["Ini","ini"],loader:()=>e.A(524721)}),ow({id:"java",extensions:[".java",".jav"],aliases:["Java","java"],mimetypes:["text/x-java-source","text/x-java"],loader:()=>e.A(365570)}),ow({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>e.A(787804)}),ow({id:"julia",extensions:[".jl"],aliases:["julia","Julia"],loader:()=>e.A(979480)}),ow({id:"kotlin",extensions:[".kt",".kts"],aliases:["Kotlin","kotlin"],mimetypes:["text/x-kotlin-source","text/x-kotlin"],loader:()=>e.A(850064)}),ow({id:"less",extensions:[".less"],aliases:["Less","less"],mimetypes:["text/x-less","text/less"],loader:()=>e.A(236120)}),ow({id:"lexon",extensions:[".lex"],aliases:["Lexon"],loader:()=>e.A(769302)}),ow({id:"lua",extensions:[".lua"],aliases:["Lua","lua"],loader:()=>e.A(511259)}),ow({id:"liquid",extensions:[".liquid",".html.liquid"],aliases:["Liquid","liquid"],mimetypes:["application/liquid"],loader:()=>e.A(778189)}),ow({id:"m3",extensions:[".m3",".i3",".mg",".ig"],aliases:["Modula-3","Modula3","modula3","m3"],loader:()=>e.A(391583)}),ow({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>e.A(4206)}),ow({id:"mdx",extensions:[".mdx"],aliases:["MDX","mdx"],loader:()=>e.A(816552)}),ow({id:"mips",extensions:[".s"],aliases:["MIPS","MIPS-V"],mimetypes:["text/x-mips","text/mips","text/plaintext"],loader:()=>e.A(718384)}),ow({id:"msdax",extensions:[".dax",".msdax"],aliases:["DAX","MSDAX"],loader:()=>e.A(284913)}),ow({id:"mysql",extensions:[],aliases:["MySQL","mysql"],loader:()=>e.A(581714)}),ow({id:"objective-c",extensions:[".m"],aliases:["Objective-C"],loader:()=>e.A(261034)}),ow({id:"pascal",extensions:[".pas",".p",".pp"],aliases:["Pascal","pas"],mimetypes:["text/x-pascal-source","text/x-pascal"],loader:()=>e.A(93611)}),ow({id:"pascaligo",extensions:[".ligo"],aliases:["Pascaligo","ligo"],loader:()=>e.A(862727)}),ow({id:"perl",extensions:[".pl",".pm"],aliases:["Perl","pl"],loader:()=>e.A(697377)}),ow({id:"pgsql",extensions:[],aliases:["PostgreSQL","postgres","pg","postgre"],loader:()=>e.A(347750)}),ow({id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],mimetypes:["application/x-php"],loader:()=>e.A(461792)}),ow({id:"pla",extensions:[".pla"],loader:()=>e.A(84791)}),ow({id:"postiats",extensions:[".dats",".sats",".hats"],aliases:["ATS","ATS/Postiats"],loader:()=>e.A(590375)}),ow({id:"powerquery",extensions:[".pq",".pqm"],aliases:["PQ","M","Power Query","Power Query M"],loader:()=>e.A(146984)}),ow({id:"powershell",extensions:[".ps1",".psm1",".psd1"],aliases:["PowerShell","powershell","ps","ps1"],loader:()=>e.A(64443)}),ow({id:"proto",extensions:[".proto"],aliases:["protobuf","Protocol Buffers"],loader:()=>e.A(402493)}),ow({id:"pug",extensions:[".jade",".pug"],aliases:["Pug","Jade","jade"],loader:()=>e.A(294884)}),ow({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>e.A(445468)}),ow({id:"qsharp",extensions:[".qs"],aliases:["Q#","qsharp"],loader:()=>e.A(250392)}),ow({id:"r",extensions:[".r",".rhistory",".rmd",".rprofile",".rt"],aliases:["R","r"],loader:()=>e.A(35431)}),ow({id:"razor",extensions:[".cshtml"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],loader:()=>e.A(185498)}),ow({id:"redis",extensions:[".redis"],aliases:["redis"],loader:()=>e.A(288688)}),ow({id:"redshift",extensions:[],aliases:["Redshift","redshift"],loader:()=>e.A(257081)}),ow({id:"restructuredtext",extensions:[".rst"],aliases:["reStructuredText","restructuredtext"],loader:()=>e.A(434615)}),ow({id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".pp"],filenames:["rakefile","Gemfile"],aliases:["Ruby","rb"],loader:()=>e.A(611325)}),ow({id:"rust",extensions:[".rs",".rlib"],aliases:["Rust","rust"],loader:()=>e.A(199304)}),ow({id:"sb",extensions:[".sb"],aliases:["Small Basic","sb"],loader:()=>e.A(424725)}),ow({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:()=>e.A(575894)}),ow({id:"scheme",extensions:[".scm",".ss",".sch",".rkt"],aliases:["scheme","Scheme"],loader:()=>e.A(440673)}),ow({id:"scss",extensions:[".scss"],aliases:["Sass","sass","scss"],mimetypes:["text/x-scss","text/scss"],loader:()=>e.A(647192)}),ow({id:"shell",extensions:[".sh",".bash"],aliases:["Shell","sh"],loader:()=>e.A(30427)}),ow({id:"sol",extensions:[".sol"],aliases:["sol","solidity","Solidity"],loader:()=>e.A(509854)}),ow({id:"aes",extensions:[".aes"],aliases:["aes","sophia","Sophia"],loader:()=>e.A(641974)}),ow({id:"sparql",extensions:[".rq"],aliases:["sparql","SPARQL"],loader:()=>e.A(66225)}),ow({id:"sql",extensions:[".sql"],aliases:["SQL"],loader:()=>e.A(252541)}),ow({id:"st",extensions:[".st",".iecst",".iecplc",".lc3lib",".TcPOU",".TcDUT",".TcGVL",".TcIO"],aliases:["StructuredText","scl","stl"],loader:()=>e.A(769837)}),ow({id:"swift",aliases:["Swift","swift"],extensions:[".swift"],mimetypes:["text/swift"],loader:()=>e.A(215611)}),ow({id:"systemverilog",extensions:[".sv",".svh"],aliases:["SV","sv","SystemVerilog","systemverilog"],loader:()=>e.A(316227)}),ow({id:"verilog",extensions:[".v",".vh"],aliases:["V","v","Verilog","verilog"],loader:()=>e.A(316227)}),ow({id:"tcl",extensions:[".tcl"],aliases:["tcl","Tcl","tcltk","TclTk","tcl/tk","Tcl/Tk"],loader:()=>e.A(240972)}),ow({id:"twig",extensions:[".twig"],aliases:["Twig","twig"],mimetypes:["text/x-twig"],loader:()=>e.A(216930)}),ow({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>e.A(755019)}),ow({id:"typespec",extensions:[".tsp"],aliases:["TypeSpec"],loader:()=>e.A(717277)}),ow({id:"vb",extensions:[".vb"],aliases:["Visual Basic","vb"],loader:()=>e.A(308554)}),ow({id:"wgsl",extensions:[".wgsl"],aliases:["WebGPU Shading Language","WGSL","wgsl"],loader:()=>e.A(943272)}),ow({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:()=>e.A(867512)}),ow({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>e.A(611958)});var oS=Object.defineProperty,ok=(e,i,n)=>{let r;return(r="symbol"!=typeof i?i+"":i)in e?oS(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n};(db||(db={})).create=function(e){return e};var oC=dw||(dw={});function oT(e){return -32099<=e&&e<=-32e3}oC.parseError=-32700,oC.invalidRequest=-32600,oC.methodNotFound=-32601,oC.invalidParams=-32602,oC.internalError=-32603,oC.isServerError=oT,oC.serverError=function(e){if(!oT(e))throw Error("Invalid range for a server error.");return e},oC.unexpectedServerError=-32e3,oC.isApplicationError=function(e){return!0},oC.applicationError=function(e){return e},oC.genericApplicationError=-320100;var oE=class{constructor(){ok(this,"listeners",new Set),ok(this,"event",e=>(this.listeners.add(e),{dispose:()=>{this.listeners.delete(e)}}))}fire(e){this.listeners.forEach(i=>i(e))}},oD=class{constructor(e){ok(this,"_value"),ok(this,"eventEmitter"),this._value=e,this.eventEmitter=new oE}get value(){return this._value}set value(e){this._value!==e&&(this._value=e,this.eventEmitter.fire(e))}get onChange(){return this.eventEmitter.event}};function oN(e,i,n){return e instanceof Set?e.add(i):e.set(i,n),{dispose:()=>e.delete(i)}}var oM=class{constructor(){ok(this,"_state","none"),ok(this,"promise"),ok(this,"resolve",()=>{}),ok(this,"reject",()=>{}),this.promise=new Promise((e,i)=>{this.resolve=e,this.reject=i})}get state(){return this._state}},oO=(dv=class{constructor(){ok(this,"_unprocessedMessages",[]),ok(this,"_messageListener"),ok(this,"id",dv.id++),ok(this,"_state",new oD({state:"open"})),ok(this,"state",this._state)}setListener(e){if(this._messageListener=e,e)for(;this._unprocessedMessages.length>0&&void 0!==this._messageListener;){let e=this._unprocessedMessages.shift();this._messageListener(e)}}send(e){return this._sendImpl(e)}_dispatchReceivedMessage(e){0===this._unprocessedMessages.length&&this._messageListener?this._messageListener(e):this._unprocessedMessages.push(e)}_onConnectionClosed(){this._state.value={state:"closed",error:void 0}}log(e){return new oR(this,e??new oA)}},ok(dv,"id",0),dv),oR=class{constructor(e,i){ok(this,"baseStream"),ok(this,"logger"),this.baseStream=e,this.logger=i}get state(){return this.baseStream.state}setListener(e){void 0===e?this.baseStream.setListener(void 0):this.baseStream.setListener(i=>{this.logger.log(this.baseStream,"incoming",i),e(i)})}send(e){return this.logger.log(this.baseStream,"outgoing",e),this.baseStream.send(e)}toString(){return`StreamLogger/${this.baseStream.toString()}`}},oA=class{log(e,i,n){console.log(`${"incoming"===i?"<-":"->"} [${e.toString()}] ${JSON.stringify(n)}`)}},oL=class e{constructor(e){ok(this,"connect"),this.connect=e}mapContext(i){return new e(e=>{var n,r;return this.connect(e?(n=e,r=i,{handleNotification:(e,i)=>n.handleNotification(e,r(i)),handleRequest:(e,i,s)=>n.handleRequest(e,i,r(s))}):void 0)})}},oj=class e{constructor(e,i,n){ok(this,"_stream"),ok(this,"_listener"),ok(this,"_logger"),ok(this,"_unprocessedResponses",new Map),ok(this,"_lastUsedRequestId",0),this._stream=e,this._listener=i,this._logger=n,this._stream.setListener(e=>{void 0!==e.method?void 0===e.id?this._processNotification(e):this._processRequest(e):this._processResponse(e)})}static createChannel(i,n){let r=!1;return new oL(s=>{if(r)throw Error(`A channel to the stream ${i} was already constructed!`);return r=!0,new e(i,s,n)})}get state(){return this._stream.state}async _processNotification(e){if(void 0!==e.id)throw 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(i){this._logger&&this._logger.warn({text:`Exception was thrown while handling notification: ${i}`,exception:i,message:e})}}async _processRequest(e){let i,n;if(void 0===e.id)throw Error();if(this._listener)try{i=await this._listener.handleRequest({method:e.method,params:e.params||null},e.id)}catch(n){this._logger&&this._logger.warn({text:`Exception was thrown while handling request: ${n}`,message:e,exception:n}),i={error:{code:dw.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}),i={error:{code:dw.methodNotFound,message:"This endpoint does not listen for requests or notifications.",data:void 0}};n="result"in i?{jsonrpc:"2.0",id:e.id,result:i.result}:{jsonrpc:"2.0",id:e.id,error:i.error},await this._stream.send(n)}_processResponse(e){let i=""+e.id,n=this._unprocessedResponses.get(i);if(!n){this._logger&&this._logger.debug({text:"Got an unexpected response message",message:e});return}this._unprocessedResponses.delete(i),n(e)}_newRequestId(){return this._lastUsedRequestId++}sendRequest(e,i,n){let r={jsonrpc:"2.0",id:this._newRequestId(),method:e.method,params:e.params||void 0};return n&&n(r.id),new Promise((e,i)=>{let n=""+r.id;this._unprocessedResponses.set(n,n=>{"result"in n?e({result:n.result}):(n.error||i(Error("Response had neither 'result' nor 'error' field set.")),e({error:n.error}))}),this._stream.send(r).then(void 0,e=>{this._unprocessedResponses.delete(n),i(e)})})}sendNotification(e,i){let 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()}};(c6=dS||(dS={})).sAny=function(){return{deserializeFromJson:e=>({hasErrors:!1,value:e}),serializeToJson:e=>e}},c6.sEmptyObject=function(){return{deserializeFromJson:e=>({hasErrors:!1,value:{}}),serializeToJson:e=>({})}},c6.sVoidFromNull=function(){return{deserializeFromJson:e=>({hasErrors:!1,value:void 0}),serializeToJson:e=>null}};let oI=Symbol("OptionalMethodNotFound");var oP=class{contextualize(e){return new oB(this,e)}},oB=class extends oP{constructor(e,i){super(),ok(this,"underylingTypedChannel"),ok(this,"converters"),this.underylingTypedChannel=e,this.converters=i}async request(e,i,n){let r=await this.converters.getSendContext(n);return this.underylingTypedChannel.request(e,i,r)}async notify(e,i,n){let r=await this.converters.getSendContext(n);return this.underylingTypedChannel.notify(e,i,r)}registerNotificationHandler(e,i){return this.underylingTypedChannel.registerNotificationHandler(e,async(e,n)=>await i(e,await this.converters.getNewContext(n)))}registerRequestHandler(e,i){return this.underylingTypedChannel.registerRequestHandler(e,async(e,n,r)=>await i(e,n,await this.converters.getNewContext(r)))}},oz=class e extends oP{constructor(e,i={}){super(),ok(this,"channelCtor"),ok(this,"_requestSender"),ok(this,"_handler",new Map),ok(this,"_unknownNotificationHandler",new Set),ok(this,"_timeout"),ok(this,"sendExceptionDetails",!1),ok(this,"_logger"),ok(this,"listeningDeferred",new oM),ok(this,"onListening",this.listeningDeferred.promise),ok(this,"_requestDidErrorEventEmitter",new oE),ok(this,"onRequestDidError",this._requestDidErrorEventEmitter.event),this.channelCtor=e,this._logger=i.logger,this.sendExceptionDetails=!!i.sendExceptionDetails,this._timeout=function(e){let i=setTimeout(e,1e3);return{dispose:()=>clearTimeout(i)}}(()=>{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(i,n={}){return new e(oj.createChannel(i,n.logger),n)}startListen(){if(this._requestSender)throw 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,i,n)=>this.handleRequest(e,i,n),handleNotification:(e,i)=>this.handleNotification(e,i)}),this.listeningDeferred.resolve()}checkChannel(e){if(!e)throw Error(`"${this.startListen.name}" must be called before any messages can be sent or received.`);return!0}async handleRequest(e,i,n){let r=this._handler.get(e.method);if(!r)return this._logger&&this._logger.debug({text:`No request handler for "${e.method}".`,data:{requestObject:e}}),{error:{code:dw.methodNotFound,message:`No request handler for "${e.method}".`,data:{method:e.method}}};if("request"!=r.kind){let i=`"${e.method}" is registered as notification, but was sent as request.`;return this._logger&&this._logger.debug({text:i,data:{requestObject:e}}),{error:{code:dw.invalidRequest,message:i,data:{method:e.method}}}}let s=r.requestType.paramsSerializer.deserializeFromJson(e.params);if(s.hasErrors){let i=`Got invalid params: ${s.errorMessage}`;return this._logger&&this._logger.debug({text:i,data:{requestObject:e,errorMessage:s.errorMessage}}),{error:{code:dw.invalidParams,message:i,data:{errors:s.errorMessage}}}}{let o,a=s.value;try{let e=await r.handler(a,i,n);if("error"in e||"errorMessage"in e){let i=e.error?r.requestType.errorSerializer.serializeToJson(e.error):void 0;o={error:{code:e.errorCode||dw.genericApplicationError,message:e.errorMessage||"An error was returned",data:i}}}else o={result:r.requestType.resultSerializer.serializeToJson(e.ok)}}catch(i){i instanceof oH?o={error:{code:i.code,message:i.message}}:(this._logger&&this._logger.warn({text:`An exception was thrown while handling a request: ${i}.`,exception:i,data:{requestObject:e}}),o={error:{code:dw.unexpectedServerError,message:this.sendExceptionDetails?`An exception was thrown while handling a request: ${i}.`:"Server has thrown an unexpected exception"}})}return o}}async handleNotification(e,i){let n=this._handler.get(e.method);if(!n){for(let i of this._unknownNotificationHandler)i(e);0===this._unknownNotificationHandler.size&&this._logger&&this._logger.debug({text:`Unhandled notification "${e.method}"`,data:{requestObject:e}});return}if("notification"!=n.kind){this._logger&&this._logger.debug({text:`"${e.method}" is registered as request, but was sent as notification.`,data:{requestObject:e}});return}let r=n.notificationType.paramsSerializer.deserializeFromJson(e.params);if(r.hasErrors){this._logger&&this._logger.debug({text:`Got invalid params: ${r}`,data:{requestObject:e,errorMessage:r.errorMessage}});return}let s=r.value;for(let r of n.handlers)try{r(s,i)}catch(i){this._logger&&this._logger.warn({text:`An exception was thrown while handling a notification: ${i}.`,exception:i,data:{requestObject:e}})}}registerUnknownNotificationHandler(e){return oN(this._unknownNotificationHandler,e)}registerRequestHandler(e,i){if(this._handler.get(e.method))throw Error(`Handler with method "${e.method}" already registered.`);return oN(this._handler,e.method,{kind:"request",requestType:e,handler:i})}registerNotificationHandler(e,i){let n=this._handler.get(e.method);if(n){if("notification"!==n.kind)throw Error(`Method "${e.method}" was already registered as request handler.`);if(n.notificationType!==e)throw Error(`Method "${e.method}" was registered for a different type.`)}else n={kind:"notification",notificationType:e,handlers:new Set},this._handler.set(e.method,n);return oN(n.handlers,i)}getRegisteredTypes(){let e=[];for(let i of this._handler.values())"notification"===i.kind?e.push(i.notificationType):"request"===i.kind&&e.push(i.requestType);return e}async request(e,i,n){if(!this.checkChannel(this._requestSender))throw Error("Impossible");let r=e.paramsSerializer.serializeToJson(i);oF(r);let s=await this._requestSender.sendRequest({method:e.method,params:r},n);if("error"in s){let i;if(e.isOptional&&s.error.code===dw.methodNotFound)return oI;if(void 0!==s.error.data){let n=e.errorSerializer.deserializeFromJson(s.error.data);if(n.hasErrors)throw Error(n.errorMessage);i=n.value}else i=void 0;let n=new oH(s.error.message,i,s.error.code);throw this._requestDidErrorEventEmitter.fire({error:n}),n}{let i=e.resultSerializer.deserializeFromJson(s.result);if(!i.hasErrors)return i.value;throw Error("Could not deserialize response: "+i.errorMessage+`
6
+
7
+ ${JSON.stringify(s,null,2)}`)}}async notify(e,i,n){if(!this.checkChannel(this._requestSender))throw Error();let r=e.paramsSerializer.serializeToJson(i);oF(r),this._requestSender.sendNotification({method:e.method,params:r},n)}};function oF(e){if(null!==e&&Array.isArray(e)&&"object"!=typeof e)throw Error("Invalid value! Only null, array and object is allowed.")}var oH=class e extends Error{constructor(i,n,r=dw.genericApplicationError){super(i),ok(this,"data"),ok(this,"code"),this.data=n,this.code=r,Object.setPrototypeOf(this,e.prototype)}},oW=class e{constructor(e,i,n,r,s=!1){ok(this,"method"),ok(this,"paramsSerializer"),ok(this,"resultSerializer"),ok(this,"errorSerializer"),ok(this,"isOptional"),ok(this,"kind","request"),this.method=e,this.paramsSerializer=i,this.resultSerializer=n,this.errorSerializer=r,this.isOptional=s}withMethod(i){return new e(i,this.paramsSerializer,this.resultSerializer,this.errorSerializer)}optional(){return new e(this.method,this.paramsSerializer,this.resultSerializer,this.errorSerializer,!0)}},o$=class e{constructor(e,i){ok(this,"method"),ok(this,"paramsSerializer"),ok(this,"kind","notification"),this.method=e,this.paramsSerializer=i}withMethod(i){return new e(i,this.paramsSerializer)}};function oU(e){return new oW((e||{}).method,dS.sAny(),dS.sAny(),dS.sAny())}function oV(e){return new o$((e||{}).method,dS.sAny())}let oq=Symbol();var oK=(dy=class{constructor(e){ok(this,"error"),ok(this,oq),this.error=e}},ok(dy,"factory",e=>new dy(e)),dy);function oY(e){let i={};for(let[n,r]of Object.entries(e)){let e=r.method?r.method:n;i[n]=r.withMethod(e)}return i}var oX=class e{constructor(e=[],i,n){ok(this,"tags"),ok(this,"server"),ok(this,"client"),this.tags=e,this.server=i,this.client=n}_onlyDesignTime(){return 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,i,n,r){let s=this.buildCounterpart(e,n),o=this.registerHandlers(e,i,r,s);return{counterpart:s,dispose:()=>o.dispose()}}buildCounterpart(e,i){let n={};for(let[r,s]of Object.entries(i)){let i;i="request"===s.kind?s.isOptional?async(i,n)=>{void 0===i&&(i={});try{return await e.request(s,i,n)}catch(e){if(e&&e.code===dw.methodNotFound)return oI;throw e}}:(i,n)=>(void 0===i&&(i={}),e.request(s,i,n)):(i,n)=>(void 0===i&&(i={}),e.notify(s,i,n)),n[r]=i}return n}registerHandlers(e,i,n,r){let s=[];for(let[o,a]of Object.entries(i))if("request"===a.kind){let i=n[o];if(!i)continue;let l=this.createRequestHandler(r,i);s.push(e.registerRequestHandler(a,l))}else{let i=n[o];i&&s.push(e.registerNotificationHandler(a,(e,n)=>{i(e,{context:n,counterpart:r})}))}return{dispose:()=>s.forEach(e=>e.dispose())}}createRequestHandler(e,i){return async(n,r,s)=>{let o=await i(n,{context:s,counterpart:e,newErr:oK.factory,requestId:r});return o instanceof oK?o.error:{ok:o}}}static getServerFromStream(e,i,n,r){let s=oz.fromTransport(i,n),{server:o}=e.getServer(s,r);return s.startListen(),{channel:s,server:o}}static registerServerToStream(e,i,n,r){let s=oz.fromTransport(i,n),{client:o}=e.registerServer(s,r);return s.startListen(),{channel:s,client:o}}getServer(e,i){let{counterpart:n,dispose:r}=this.getInterface(e,this.client,this.server,i);return{server:n,dispose:r}}registerServer(e,i){let{counterpart:n,dispose:r}=this.getInterface(e,this.server,this.client,i);return{client:n,dispose:r}}withContext(){return new e(this.tags,this.server,this.client)}};let oJ=((c8={}).Comment="comment",c8.Imports="imports",c8.Region="region",c8),oG=((c9={})[c9.File=1]="File",c9[c9.Module=2]="Module",c9[c9.Namespace=3]="Namespace",c9[c9.Package=4]="Package",c9[c9.Class=5]="Class",c9[c9.Method=6]="Method",c9[c9.Property=7]="Property",c9[c9.Field=8]="Field",c9[c9.Constructor=9]="Constructor",c9[c9.Enum=10]="Enum",c9[c9.Interface=11]="Interface",c9[c9.Function=12]="Function",c9[c9.Variable=13]="Variable",c9[c9.Constant=14]="Constant",c9[c9.String=15]="String",c9[c9.Number=16]="Number",c9[c9.Boolean=17]="Boolean",c9[c9.Array=18]="Array",c9[c9.Object=19]="Object",c9[c9.Key=20]="Key",c9[c9.Null=21]="Null",c9[c9.EnumMember=22]="EnumMember",c9[c9.Struct=23]="Struct",c9[c9.Event=24]="Event",c9[c9.Operator=25]="Operator",c9[c9.TypeParameter=26]="TypeParameter",c9),oZ=((c7={})[c7.Deprecated=1]="Deprecated",c7),oQ=((de={})[de.Type=1]="Type",de[de.Parameter=2]="Parameter",de),o0=((dt={})[dt.None=0]="None",dt[dt.Full=1]="Full",dt[dt.Incremental=2]="Incremental",dt),o1=((di={})[di.Text=1]="Text",di[di.Method=2]="Method",di[di.Function=3]="Function",di[di.Constructor=4]="Constructor",di[di.Field=5]="Field",di[di.Variable=6]="Variable",di[di.Class=7]="Class",di[di.Interface=8]="Interface",di[di.Module=9]="Module",di[di.Property=10]="Property",di[di.Unit=11]="Unit",di[di.Value=12]="Value",di[di.Enum=13]="Enum",di[di.Keyword=14]="Keyword",di[di.Snippet=15]="Snippet",di[di.Color=16]="Color",di[di.File=17]="File",di[di.Reference=18]="Reference",di[di.Folder=19]="Folder",di[di.EnumMember=20]="EnumMember",di[di.Constant=21]="Constant",di[di.Struct=22]="Struct",di[di.Event=23]="Event",di[di.Operator=24]="Operator",di[di.TypeParameter=25]="TypeParameter",di),o2=((dn={})[dn.Deprecated=1]="Deprecated",dn),o5=((dr={})[dr.PlainText=1]="PlainText",dr[dr.Snippet=2]="Snippet",dr),o3=((ds={})[ds.Text=1]="Text",ds[ds.Read=2]="Read",ds[ds.Write=3]="Write",ds),o4=((da={}).Empty="",da.QuickFix="quickfix",da.Refactor="refactor",da.RefactorExtract="refactor.extract",da.RefactorInline="refactor.inline",da.RefactorRewrite="refactor.rewrite",da.Source="source",da.SourceOrganizeImports="source.organizeImports",da.SourceFixAll="source.fixAll",da),o6=((dl={}).PlainText="plaintext",dl.Markdown="markdown",dl),o8=((dc={})[dc.Error=1]="Error",dc[dc.Warning=2]="Warning",dc[dc.Information=3]="Information",dc[dc.Hint=4]="Hint",dc),o9=((dd={})[dd.Unnecessary=1]="Unnecessary",dd[dd.Deprecated=2]="Deprecated",dd),o7=((dh={})[dh.Invoked=1]="Invoked",dh[dh.TriggerCharacter=2]="TriggerCharacter",dh[dh.TriggerForIncompleteCompletions=3]="TriggerForIncompleteCompletions",dh),ae=((du={})[du.Invoked=1]="Invoked",du[du.TriggerCharacter=2]="TriggerCharacter",du[du.ContentChange=3]="ContentChange",du),at=((dp={})[dp.Invoked=1]="Invoked",dp[dp.Automatic=2]="Automatic",dp),ai=((df={}).Relative="relative",df);var an=class{constructor(e){this.method=e}};let ar={textDocumentImplementation:new an("textDocument/implementation"),textDocumentTypeDefinition:new an("textDocument/typeDefinition"),textDocumentDocumentColor:new an("textDocument/documentColor"),textDocumentColorPresentation:new an("textDocument/colorPresentation"),textDocumentFoldingRange:new an("textDocument/foldingRange"),textDocumentDeclaration:new an("textDocument/declaration"),textDocumentSelectionRange:new an("textDocument/selectionRange"),textDocumentPrepareCallHierarchy:new an("textDocument/prepareCallHierarchy"),textDocumentSemanticTokensFull:new an("textDocument/semanticTokens/full"),textDocumentSemanticTokensFullDelta:new an("textDocument/semanticTokens/full/delta"),textDocumentLinkedEditingRange:new an("textDocument/linkedEditingRange"),workspaceWillCreateFiles:new an("workspace/willCreateFiles"),workspaceWillRenameFiles:new an("workspace/willRenameFiles"),workspaceWillDeleteFiles:new an("workspace/willDeleteFiles"),textDocumentMoniker:new an("textDocument/moniker"),textDocumentPrepareTypeHierarchy:new an("textDocument/prepareTypeHierarchy"),textDocumentInlineValue:new an("textDocument/inlineValue"),textDocumentInlayHint:new an("textDocument/inlayHint"),textDocumentDiagnostic:new an("textDocument/diagnostic"),textDocumentInlineCompletion:new an("textDocument/inlineCompletion"),textDocumentWillSaveWaitUntil:new an("textDocument/willSaveWaitUntil"),textDocumentCompletion:new an("textDocument/completion"),textDocumentHover:new an("textDocument/hover"),textDocumentSignatureHelp:new an("textDocument/signatureHelp"),textDocumentDefinition:new an("textDocument/definition"),textDocumentReferences:new an("textDocument/references"),textDocumentDocumentHighlight:new an("textDocument/documentHighlight"),textDocumentDocumentSymbol:new an("textDocument/documentSymbol"),textDocumentCodeAction:new an("textDocument/codeAction"),workspaceSymbol:new an("workspace/symbol"),textDocumentCodeLens:new an("textDocument/codeLens"),textDocumentDocumentLink:new an("textDocument/documentLink"),textDocumentFormatting:new an("textDocument/formatting"),textDocumentRangeFormatting:new an("textDocument/rangeFormatting"),textDocumentRangesFormatting:new an("textDocument/rangesFormatting"),textDocumentOnTypeFormatting:new an("textDocument/onTypeFormatting"),textDocumentRename:new an("textDocument/rename"),workspaceExecuteCommand:new an("workspace/executeCommand"),workspaceDidCreateFiles:new an("workspace/didCreateFiles"),workspaceDidRenameFiles:new an("workspace/didRenameFiles"),workspaceDidDeleteFiles:new an("workspace/didDeleteFiles"),workspaceDidChangeConfiguration:new an("workspace/didChangeConfiguration"),textDocumentDidOpen:new an("textDocument/didOpen"),textDocumentDidChange:new an("textDocument/didChange"),textDocumentDidClose:new an("textDocument/didClose"),textDocumentDidSave:new an("textDocument/didSave"),textDocumentWillSave:new an("textDocument/willSave"),workspaceDidChangeWatchedFiles:new an("workspace/didChangeWatchedFiles")},as=(i=oY((dm={server:{textDocumentImplementation:oU({method:"textDocument/implementation"}),textDocumentTypeDefinition:oU({method:"textDocument/typeDefinition"}),textDocumentDocumentColor:oU({method:"textDocument/documentColor"}),textDocumentColorPresentation:oU({method:"textDocument/colorPresentation"}),textDocumentFoldingRange:oU({method:"textDocument/foldingRange"}),textDocumentDeclaration:oU({method:"textDocument/declaration"}),textDocumentSelectionRange:oU({method:"textDocument/selectionRange"}),textDocumentPrepareCallHierarchy:oU({method:"textDocument/prepareCallHierarchy"}),callHierarchyIncomingCalls:oU({method:"callHierarchy/incomingCalls"}),callHierarchyOutgoingCalls:oU({method:"callHierarchy/outgoingCalls"}),textDocumentSemanticTokensFull:oU({method:"textDocument/semanticTokens/full"}),textDocumentSemanticTokensFullDelta:oU({method:"textDocument/semanticTokens/full/delta"}),textDocumentSemanticTokensRange:oU({method:"textDocument/semanticTokens/range"}),textDocumentLinkedEditingRange:oU({method:"textDocument/linkedEditingRange"}),workspaceWillCreateFiles:oU({method:"workspace/willCreateFiles"}),workspaceWillRenameFiles:oU({method:"workspace/willRenameFiles"}),workspaceWillDeleteFiles:oU({method:"workspace/willDeleteFiles"}),textDocumentMoniker:oU({method:"textDocument/moniker"}),textDocumentPrepareTypeHierarchy:oU({method:"textDocument/prepareTypeHierarchy"}),typeHierarchySupertypes:oU({method:"typeHierarchy/supertypes"}),typeHierarchySubtypes:oU({method:"typeHierarchy/subtypes"}),textDocumentInlineValue:oU({method:"textDocument/inlineValue"}),textDocumentInlayHint:oU({method:"textDocument/inlayHint"}),inlayHintResolve:oU({method:"inlayHint/resolve"}),textDocumentDiagnostic:oU({method:"textDocument/diagnostic"}),workspaceDiagnostic:oU({method:"workspace/diagnostic"}),textDocumentInlineCompletion:oU({method:"textDocument/inlineCompletion"}),initialize:oU({method:"initialize"}),shutdown:oU({method:"shutdown"}),textDocumentWillSaveWaitUntil:oU({method:"textDocument/willSaveWaitUntil"}),textDocumentCompletion:oU({method:"textDocument/completion"}),completionItemResolve:oU({method:"completionItem/resolve"}),textDocumentHover:oU({method:"textDocument/hover"}),textDocumentSignatureHelp:oU({method:"textDocument/signatureHelp"}),textDocumentDefinition:oU({method:"textDocument/definition"}),textDocumentReferences:oU({method:"textDocument/references"}),textDocumentDocumentHighlight:oU({method:"textDocument/documentHighlight"}),textDocumentDocumentSymbol:oU({method:"textDocument/documentSymbol"}),textDocumentCodeAction:oU({method:"textDocument/codeAction"}),codeActionResolve:oU({method:"codeAction/resolve"}),workspaceSymbol:oU({method:"workspace/symbol"}),workspaceSymbolResolve:oU({method:"workspaceSymbol/resolve"}),textDocumentCodeLens:oU({method:"textDocument/codeLens"}),codeLensResolve:oU({method:"codeLens/resolve"}),textDocumentDocumentLink:oU({method:"textDocument/documentLink"}),documentLinkResolve:oU({method:"documentLink/resolve"}),textDocumentFormatting:oU({method:"textDocument/formatting"}),textDocumentRangeFormatting:oU({method:"textDocument/rangeFormatting"}),textDocumentRangesFormatting:oU({method:"textDocument/rangesFormatting"}),textDocumentOnTypeFormatting:oU({method:"textDocument/onTypeFormatting"}),textDocumentRename:oU({method:"textDocument/rename"}),textDocumentPrepareRename:oU({method:"textDocument/prepareRename"}),workspaceExecuteCommand:oU({method:"workspace/executeCommand"}),workspaceDidChangeWorkspaceFolders:oV({method:"workspace/didChangeWorkspaceFolders"}),windowWorkDoneProgressCancel:oV({method:"window/workDoneProgress/cancel"}),workspaceDidCreateFiles:oV({method:"workspace/didCreateFiles"}),workspaceDidRenameFiles:oV({method:"workspace/didRenameFiles"}),workspaceDidDeleteFiles:oV({method:"workspace/didDeleteFiles"}),notebookDocumentDidOpen:oV({method:"notebookDocument/didOpen"}),notebookDocumentDidChange:oV({method:"notebookDocument/didChange"}),notebookDocumentDidSave:oV({method:"notebookDocument/didSave"}),notebookDocumentDidClose:oV({method:"notebookDocument/didClose"}),initialized:oV({method:"initialized"}),exit:oV({method:"exit"}),workspaceDidChangeConfiguration:oV({method:"workspace/didChangeConfiguration"}),textDocumentDidOpen:oV({method:"textDocument/didOpen"}),textDocumentDidChange:oV({method:"textDocument/didChange"}),textDocumentDidClose:oV({method:"textDocument/didClose"}),textDocumentDidSave:oV({method:"textDocument/didSave"}),textDocumentWillSave:oV({method:"textDocument/willSave"}),workspaceDidChangeWatchedFiles:oV({method:"workspace/didChangeWatchedFiles"}),setTrace:oV({method:"$/setTrace"}),cancelRequest:oV({method:"$/cancelRequest"}),progress:oV({method:"$/progress"})},client:{workspaceWorkspaceFolders:oU({method:"workspace/workspaceFolders"}).optional(),workspaceConfiguration:oU({method:"workspace/configuration"}).optional(),workspaceFoldingRangeRefresh:oU({method:"workspace/foldingRange/refresh"}).optional(),windowWorkDoneProgressCreate:oU({method:"window/workDoneProgress/create"}).optional(),workspaceSemanticTokensRefresh:oU({method:"workspace/semanticTokens/refresh"}).optional(),windowShowDocument:oU({method:"window/showDocument"}).optional(),workspaceInlineValueRefresh:oU({method:"workspace/inlineValue/refresh"}).optional(),workspaceInlayHintRefresh:oU({method:"workspace/inlayHint/refresh"}).optional(),workspaceDiagnosticRefresh:oU({method:"workspace/diagnostic/refresh"}).optional(),clientRegisterCapability:oU({method:"client/registerCapability"}).optional(),clientUnregisterCapability:oU({method:"client/unregisterCapability"}).optional(),windowShowMessageRequest:oU({method:"window/showMessageRequest"}).optional(),workspaceCodeLensRefresh:oU({method:"workspace/codeLens/refresh"}).optional(),workspaceApplyEdit:oU({method:"workspace/applyEdit"}).optional(),windowShowMessage:oV({method:"window/showMessage"}),windowLogMessage:oV({method:"window/logMessage"}),telemetryEvent:oV({method:"telemetry/event"}),textDocumentPublishDiagnostics:oV({method:"textDocument/publishDiagnostics"}),logTrace:oV({method:"$/logTrace"}),cancelRequest:oV({method:"$/cancelRequest"}),progress:oV({method:"$/progress"})}}).server),n=oY(dm.client),new oX(dm.tags||[],i,n));function ao(e,i){if(e.textModel!==i)throw Error(`Expected text model to be ${i}, but got ${e.textModel}`);return e}var aa=(d_=class{constructor(){ok(this,"_store",new al)}dispose(){this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}},ok(d_,"None",Object.freeze({dispose(){}})),d_),al=(dx=class{constructor(){ok(this,"_toDispose",new Set),ok(this,"_isDisposed",!1)}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}clear(){if(0!==this._toDispose.size)try{for(let e of this._toDispose)e.dispose()}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw Error("Cannot register a disposable on itself!");return this._isDisposed?dx.DISABLE_DISPOSED_WARNING||console.warn(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(e),e}},ok(dx,"DISABLE_DISPOSED_WARNING",!1),dx);let ac=new Map([[o4.Empty,""],[o4.QuickFix,"quickfix"],[o4.Refactor,"refactor"],[o4.RefactorExtract,"refactor.extract"],[o4.RefactorInline,"refactor.inline"],[o4.RefactorRewrite,"refactor.rewrite"],[o4.Source,"source"],[o4.SourceOrganizeImports,"source.organizeImports"],[o4.SourceFixAll,"source.fixAll"]]),ad=new Map([[s1.languages.CodeActionTriggerType.Invoke,at.Invoked],[s1.languages.CodeActionTriggerType.Auto,at.Automatic]]),ah=new Map([[o1.Text,s1.languages.CompletionItemKind.Text],[o1.Method,s1.languages.CompletionItemKind.Method],[o1.Function,s1.languages.CompletionItemKind.Function],[o1.Constructor,s1.languages.CompletionItemKind.Constructor],[o1.Field,s1.languages.CompletionItemKind.Field],[o1.Variable,s1.languages.CompletionItemKind.Variable],[o1.Class,s1.languages.CompletionItemKind.Class],[o1.Interface,s1.languages.CompletionItemKind.Interface],[o1.Module,s1.languages.CompletionItemKind.Module],[o1.Property,s1.languages.CompletionItemKind.Property],[o1.Unit,s1.languages.CompletionItemKind.Unit],[o1.Value,s1.languages.CompletionItemKind.Value],[o1.Enum,s1.languages.CompletionItemKind.Enum],[o1.Keyword,s1.languages.CompletionItemKind.Keyword],[o1.Snippet,s1.languages.CompletionItemKind.Snippet],[o1.Color,s1.languages.CompletionItemKind.Color],[o1.File,s1.languages.CompletionItemKind.File],[o1.Reference,s1.languages.CompletionItemKind.Reference],[o1.Folder,s1.languages.CompletionItemKind.Folder],[o1.EnumMember,s1.languages.CompletionItemKind.EnumMember],[o1.Constant,s1.languages.CompletionItemKind.Constant],[o1.Struct,s1.languages.CompletionItemKind.Struct],[o1.Event,s1.languages.CompletionItemKind.Event],[o1.Operator,s1.languages.CompletionItemKind.Operator],[o1.TypeParameter,s1.languages.CompletionItemKind.TypeParameter]]),au=new Map([[o2.Deprecated,s1.languages.CompletionItemTag.Deprecated]]);function ap(e){return au.get(e)}let af=new Map([[s1.languages.CompletionTriggerKind.Invoke,o7.Invoked],[s1.languages.CompletionTriggerKind.TriggerCharacter,o7.TriggerCharacter],[s1.languages.CompletionTriggerKind.TriggerForIncompleteCompletions,o7.TriggerForIncompleteCompletions]]),am=new Map([[o5.Snippet,s1.languages.CompletionItemInsertTextRule.InsertAsSnippet]]),ag=new Map([[oG.File,s1.languages.SymbolKind.File],[oG.Module,s1.languages.SymbolKind.Module],[oG.Namespace,s1.languages.SymbolKind.Namespace],[oG.Package,s1.languages.SymbolKind.Package],[oG.Class,s1.languages.SymbolKind.Class],[oG.Method,s1.languages.SymbolKind.Method],[oG.Property,s1.languages.SymbolKind.Property],[oG.Field,s1.languages.SymbolKind.Field],[oG.Constructor,s1.languages.SymbolKind.Constructor],[oG.Enum,s1.languages.SymbolKind.Enum],[oG.Interface,s1.languages.SymbolKind.Interface],[oG.Function,s1.languages.SymbolKind.Function],[oG.Variable,s1.languages.SymbolKind.Variable],[oG.Constant,s1.languages.SymbolKind.Constant],[oG.String,s1.languages.SymbolKind.String],[oG.Number,s1.languages.SymbolKind.Number],[oG.Boolean,s1.languages.SymbolKind.Boolean],[oG.Array,s1.languages.SymbolKind.Array],[oG.Object,s1.languages.SymbolKind.Object],[oG.Key,s1.languages.SymbolKind.Key],[oG.Null,s1.languages.SymbolKind.Null],[oG.EnumMember,s1.languages.SymbolKind.EnumMember],[oG.Struct,s1.languages.SymbolKind.Struct],[oG.Event,s1.languages.SymbolKind.Event],[oG.Operator,s1.languages.SymbolKind.Operator],[oG.TypeParameter,s1.languages.SymbolKind.TypeParameter]]);function av(e){return ag.get(e)??s1.languages.SymbolKind.File}let ay=new Map([[oZ.Deprecated,s1.languages.SymbolTag.Deprecated]]),a_=new Map([[o3.Text,s1.languages.DocumentHighlightKind.Text],[o3.Read,s1.languages.DocumentHighlightKind.Read],[o3.Write,s1.languages.DocumentHighlightKind.Write]]),ax=new Map([[oJ.Comment,s1.languages.FoldingRangeKind.Comment],[oJ.Imports,s1.languages.FoldingRangeKind.Imports],[oJ.Region,s1.languages.FoldingRangeKind.Region]]),ab=new Map([[s1.MarkerSeverity.Error,o8.Error],[s1.MarkerSeverity.Warning,o8.Warning],[s1.MarkerSeverity.Info,o8.Information],[s1.MarkerSeverity.Hint,o8.Hint]]),aw=new Map([[o8.Error,s1.MarkerSeverity.Error],[o8.Warning,s1.MarkerSeverity.Warning],[o8.Information,s1.MarkerSeverity.Info],[o8.Hint,s1.MarkerSeverity.Hint]]),aS=new Map([[o9.Unnecessary,s1.MarkerTag.Unnecessary],[o9.Deprecated,s1.MarkerTag.Deprecated]]),ak=new Map([[s1.languages.SignatureHelpTriggerKind.Invoke,ae.Invoked],[s1.languages.SignatureHelpTriggerKind.TriggerCharacter,ae.TriggerCharacter],[s1.languages.SignatureHelpTriggerKind.ContentChange,ae.ContentChange]]);function aC(e){if(e)return{id:e.command,title:e.title,arguments:e.arguments}}let aT=new Map([[oQ.Type,s1.languages.InlayHintKind.Type],[oQ.Parameter,s1.languages.InlayHintKind.Parameter]]);function aE(e,i){if("targetUri"in e){let n=i.bridge.translateBackRange({uri:e.targetUri},e.targetRange);return{uri:n.textModel.uri,range:n.range,originSelectionRange:e.originSelectionRange?i.bridge.translateBackRange({uri:e.targetUri},e.originSelectionRange).range:void 0,targetSelectionRange:e.targetSelectionRange?i.bridge.translateBackRange({uri:e.targetUri},e.targetSelectionRange).range:void 0}}{let n=i.bridge.translateBackRange({uri:e.uri},e.range);return{uri:n.textModel.uri,range:n.range}}}function aD(e){return e&&0!==e.length?e.map(e=>"notebook"in e?"string"==typeof e.notebook?{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}):{language:"*"}}function aN(e){var i;let n={severity:(i=e.severity)?aw.get(i)??s1.MarkerSeverity.Error:s1.MarkerSeverity.Error,startLineNumber:e.range.start.line+1,startColumn:e.range.start.character+1,endLineNumber:e.range.end.line+1,endColumn:e.range.end.character+1,message:e.message,source:e.source,code:"string"==typeof e.code?e.code:e.code?.toString()};return e.tags&&(n.tags=e.tags.map(e=>aS.get(e)).filter(e=>void 0!==e)),e.relatedInformation&&(n.relatedInformation=e.relatedInformation.map(e=>({resource:s1.Uri.parse(e.location.uri),startLineNumber:e.location.range.start.line+1,startColumn:e.location.range.start.character+1,endLineNumber:e.location.range.end.line+1,endColumn:e.location.range.end.character+1,message:e.message}))),n}var aM=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{completion:{dynamicRegistration:!0,contextSupport:!0,completionItemKind:{valueSet:Array.from(ah.keys())},completionItem:{tagSupport:{valueSet:Array.from(au.keys())},commitCharactersSupport:!0,deprecatedSupport:!0,preselectSupport:!0}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentCompletion,!0,e=>s1.languages.registerCompletionItemProvider(aD(e.documentSelector),new aO(this._connection,e))))}},aO=class{constructor(e,i){ok(this,"resolveCompletionItem"),this._client=e,this._capabilities=i,i.resolveProvider&&(this.resolveCompletionItem=async(e,i)=>(aR(e,await this._client.server.completionItemResolve(e._lspItem),this._client.bridge,e._translated,e._model),e))}get triggerCharacters(){return this._capabilities.triggerCharacters}async provideCompletionItems(e,i,n,r){var s;let o=this._client.bridge.translate(e,i),a=await this._client.server.textDocumentCompletion({textDocument:o.textDocument,position:o.position,context:n.triggerCharacter?{triggerKind:(s=n.triggerKind,af.get(s)??o7.Invoked),triggerCharacter:n.triggerCharacter}:void 0});return a?{suggestions:(Array.isArray(a)?a:a.items).map(n=>{var r,s,a,l,c,d;let h,u,p;return{...(r=n,s=this._client.bridge,a=o,l=e,c=i,u=r.insertText||r.label,r.textEdit&&("range"in r.textEdit?(u=r.textEdit.newText,h=ao(s.translateBackRange(a.textDocument,r.textEdit.range),l).range):(u=r.textEdit.newText,h={insert:ao(s.translateBackRange(a.textDocument,r.textEdit.insert),l).range,replace:ao(s.translateBackRange(a.textDocument,r.textEdit.replace),l).range})),h||(h=s1.Range.fromPositions(c,c)),aR(p={label:r.label,kind:(d=r.kind)?ah.get(d)??s1.languages.CompletionItemKind.Text:s1.languages.CompletionItemKind.Text,insertText:u,sortText:r.sortText,filterText:r.filterText,preselect:r.preselect,commitCharacters:r.commitCharacters,range:h},r,s,a,l),p),_lspItem:n,_translated:o,_model:e}})}:{suggestions:[]}}};function aR(e,i,n,r,s){void 0!==i.detail&&(e.detail=i.detail),void 0!==i.documentation&&(e.documentation=function(e){if(e)return"string"==typeof e?e:{value:e.value,isTrusted:!0}}(i.documentation)),void 0!==i.insertTextFormat&&(e.insertTextRules=function(e){if(e)return am.get(e)}(i.insertTextFormat)),i.tags&&i.tags.length>0&&(e.tags=i.tags.map(ap).filter(e=>void 0!==e)),i.additionalTextEdits&&i.additionalTextEdits.length>0&&(e.additionalTextEdits=i.additionalTextEdits.map(e=>({range:ao(n.translateBackRange(r.textDocument,e.range),s).range,text:e.newText}))),i.command&&(e.command=aC(i.command))}var aA=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{hover:{dynamicRegistration:!0,contentFormat:[o6.Markdown,o6.PlainText]}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentHover,!0,e=>s1.languages.registerHoverProvider(aD(e.documentSelector),new aL(this._connection,e))))}},aL=class{constructor(e,i){this._client=e,this._capabilities=i}async provideHover(e,i,n){var r;let s=this._client.bridge.translate(e,i),o=await this._client.server.textDocumentHover({textDocument:s.textDocument,position:s.position});return o&&o.contents?{contents:Array.isArray(r=o.contents)?r.map(e=>aj(e)):[aj(r)],range:o.range?this._client.bridge.translateBackRange(s.textDocument,o.range).range:void 0}:null}};function aj(e){return"string"==typeof e?{value:e,isTrusted:!0}:"kind"in e?{value:e.value,isTrusted:!0}:{value:`\`\`\`${e.language}
8
+ ${e.value}
9
+ \`\`\``,isTrusted:!0}}var aI=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{signatureHelp:{dynamicRegistration:!0,contextSupport:!0,signatureInformation:{documentationFormat:[o6.Markdown,o6.PlainText],parameterInformation:{labelOffsetSupport:!0},activeParameterSupport:!0}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentSignatureHelp,!0,e=>s1.languages.registerSignatureHelpProvider(aD(e.documentSelector),new aP(this._connection,e))))}},aP=class{constructor(e,i){ok(this,"signatureHelpTriggerCharacters"),ok(this,"signatureHelpRetriggerCharacters"),this._client=e,this._capabilities=i,this.signatureHelpTriggerCharacters=i.triggerCharacters,this.signatureHelpRetriggerCharacters=i.retriggerCharacters}async provideSignatureHelp(e,i,n,r){var s;let o=this._client.bridge.translate(e,i),a=await this._client.server.textDocumentSignatureHelp({textDocument:o.textDocument,position:o.position,context:{triggerKind:(s=r.triggerKind,ak.get(s)??ae.Invoked),triggerCharacter:r.triggerCharacter,isRetrigger:r.isRetrigger}});return a?{value:{signatures:a.signatures.map(e=>({label:e.label,documentation:aB(e.documentation),parameters:e.parameters?.map(e=>({label:e.label,documentation:aB(e.documentation)}))||[],activeParameter:e.activeParameter})),activeSignature:a.activeSignature||0,activeParameter:a.activeParameter||0},dispose:()=>{}}:null}};function aB(e){if(e)return"string"==typeof e?e:{value:e.value,isTrusted:!0}}var az=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{definition:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentDefinition,!0,e=>s1.languages.registerDefinitionProvider(aD(e.documentSelector),new aF(this._connection,e))))}},aF=class{constructor(e,i){this._client=e,this._capabilities=i}async provideDefinition(e,i,n){let r=this._client.bridge.translate(e,i),s=await this._client.server.textDocumentDefinition({textDocument:r.textDocument,position:r.position});return s?Array.isArray(s)?s.map(e=>aE(e,this._client)):aE(s,this._client):null}},aH=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{declaration:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentDeclaration,!0,e=>s1.languages.registerDeclarationProvider(aD(e.documentSelector),new aW(this._connection,e))))}},aW=class{constructor(e,i){this._client=e,this._capabilities=i}async provideDeclaration(e,i,n){let r=this._client.bridge.translate(e,i),s=await this._client.server.textDocumentDeclaration({textDocument:r.textDocument,position:r.position});return s?Array.isArray(s)?s.map(e=>aE(e,this._client)):aE(s,this._client):null}},a$=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{typeDefinition:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentTypeDefinition,!0,e=>s1.languages.registerTypeDefinitionProvider(aD(e.documentSelector),new aU(this._connection,e))))}},aU=class{constructor(e,i){this._client=e,this._capabilities=i}async provideTypeDefinition(e,i,n){let r=this._client.bridge.translate(e,i),s=await this._client.server.textDocumentTypeDefinition({textDocument:r.textDocument,position:r.position});return s?Array.isArray(s)?s.map(e=>aE(e,this._client)):aE(s,this._client):null}},aV=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{implementation:{dynamicRegistration:!0,linkSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentImplementation,!0,e=>s1.languages.registerImplementationProvider(aD(e.documentSelector),new aq(this._connection,e))))}},aq=class{constructor(e,i){this._client=e,this._capabilities=i}async provideImplementation(e,i,n){let r=this._client.bridge.translate(e,i),s=await this._client.server.textDocumentImplementation({textDocument:r.textDocument,position:r.position});return s?Array.isArray(s)?s.map(e=>aE(e,this._client)):aE(s,this._client):null}},aK=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{references:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentReferences,!0,e=>s1.languages.registerReferenceProvider(aD(e.documentSelector),new aY(this._connection,e))))}},aY=class{constructor(e,i){this._client=e,this._capabilities=i}async provideReferences(e,i,n,r){let s=this._client.bridge.translate(e,i),o=await this._client.server.textDocumentReferences({textDocument:s.textDocument,position:s.position,context:{includeDeclaration:n.includeDeclaration}});return o?o.map(e=>{let i=this._client.bridge.translateBackRange({uri:e.uri},e.range);return{uri:i.textModel.uri,range:i.range}}):null}},aX=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{documentHighlight:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentDocumentHighlight,!0,e=>s1.languages.registerDocumentHighlightProvider(aD(e.documentSelector),new aJ(this._connection,e))))}},aJ=class{constructor(e,i){this._client=e,this._capabilities=i}async provideDocumentHighlights(e,i,n){let r=this._client.bridge.translate(e,i),s=await this._client.server.textDocumentDocumentHighlight({textDocument:r.textDocument,position:r.position});return s?s.map(e=>{var i;return{range:this._client.bridge.translateBackRange(r.textDocument,e.range).range,kind:(i=e.kind)?a_.get(i)??s1.languages.DocumentHighlightKind.Text:s1.languages.DocumentHighlightKind.Text}}):null}},aG=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{documentSymbol:{dynamicRegistration:!0,hierarchicalDocumentSymbolSupport:!0,symbolKind:{valueSet:Array.from(ag.keys())},tagSupport:{valueSet:[oZ.Deprecated]}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentDocumentSymbol,!0,e=>s1.languages.registerDocumentSymbolProvider(aD(e.documentSelector),new aZ(this._connection,e))))}},aZ=class{constructor(e,i){this._client=e,this._capabilities=i}async provideDocumentSymbols(e,i){let n=this._client.bridge.translate(e,new s1.Position(1,1)),r=await this._client.server.textDocumentDocumentSymbol({textDocument:n.textDocument});if(!r)return null;if(Array.isArray(r)&&r.length>0)if("location"in r[0])return r.map(e=>{var i,n;return i=e,n=this._client,{name:i.name,detail:"",kind:av(i.kind),tags:i.tags?.map(e=>ay.get(e)).filter(e=>void 0!==e)||[],range:n.bridge.translateBackRange({uri:i.location.uri},i.location.range).range,selectionRange:n.bridge.translateBackRange({uri:i.location.uri},i.location.range).range,children:[]}});else return r.map(e=>(function e(i,n,r){return{name:i.name,detail:i.detail||"",kind:av(i.kind),tags:i.tags?.map(e=>ay.get(e)).filter(e=>void 0!==e)||[],range:n.bridge.translateBackRange(r,i.range).range,selectionRange:n.bridge.translateBackRange(r,i.selectionRange).range,children:i.children?.map(i=>e(i,n,r))||[]}})(e,this._client,n.textDocument));return[]}},aQ=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{rename:{dynamicRegistration:!0,prepareSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentRename,!0,e=>s1.languages.registerRenameProvider(aD(e.documentSelector),new a0(this._connection,e))))}},a0=class{constructor(e,i){this._client=e,this._capabilities=i}async provideRenameEdits(e,i,n,r){let s=this._client.bridge.translate(e,i),o=await this._client.server.textDocumentRename({textDocument:s.textDocument,position:s.position,newName:n});return o?function(e,i){let n=[];if(e.changes)for(let r in e.changes)for(let s of e.changes[r]){let e=i.bridge.translateBackRange({uri:r},s.range);n.push({resource:e.textModel.uri,versionId:void 0,textEdit:{range:e.range,text:s.newText}})}if(e.documentChanges){for(let r of e.documentChanges)if("textDocument"in r){let e=r.textDocument.uri;for(let s of r.edits){let o=i.bridge.translateBackRange({uri:e},s.range);n.push({resource:o.textModel.uri,versionId:r.textDocument.version,textEdit:{range:o.range,text:s.newText}})}}}return{edits:n}}(o,this._client):null}async resolveRenameLocation(e,i,n){if(!this._capabilities.prepareProvider)return null;let r=this._client.bridge.translate(e,i),s=await this._client.server.textDocumentPrepareRename({textDocument:r.textDocument,position:r.position});if(!s)return null;if("range"in s&&"placeholder"in s)return{range:this._client.bridge.translateBackRange(r.textDocument,s.range).range,text:s.placeholder};if("defaultBehavior"in s);else if("start"in s&&"end"in s){let i=this._client.bridge.translateBackRange(r.textDocument,s).range;return{range:i,text:e.getValueInRange(i)}}return null}},a1=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{codeAction:{dynamicRegistration:!0,codeActionLiteralSupport:{codeActionKind:{valueSet:Array.from(ac.keys())}},isPreferredSupport:!0,disabledSupport:!0,dataSupport:!0,resolveSupport:{properties:["edit"]}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentCodeAction,!0,e=>s1.languages.registerCodeActionProvider(aD(e.documentSelector),new a2(this._connection,e))))}},a2=class{constructor(e,i){ok(this,"resolveCodeAction"),this._client=e,this._capabilities=i,i.resolveProvider&&(this.resolveCodeAction=async(e,i)=>{if(e._lspAction){let i=await this._client.server.codeActionResolve(e._lspAction);i.edit&&(e.edit=a5(i.edit,this._client)),i.command&&(e.command=aC(i.command))}return e})}async provideCodeActions(e,i,n,r){var s;let o=this._client.bridge.translate(e,i.getStartPosition()),a=await this._client.server.textDocumentCodeAction({textDocument:o.textDocument,range:this._client.bridge.translateRange(e,i),context:{diagnostics:n.markers.map(i=>{var n;return{range:this._client.bridge.translateRange(e,s1.Range.lift(i)),message:i.message,severity:(n=i.severity,ab.get(n)??o8.Error)}}),triggerKind:(s=n.trigger,ad.get(s)??at.Invoked)}});return a?{actions:(Array.isArray(a)?a:[a]).map(e=>"title"in e&&!("kind"in e)?{title:e.title,command:aC(e)}:{title:e.title,kind:function(e){if(e)return ac.get(e)??e}(e.kind),isPreferred:e.isPreferred,disabled:e.disabled?.reason,edit:e.edit?a5(e.edit,this._client):void 0,command:aC(e.command),_lspAction:e}),dispose:()=>{}}:null}};function a5(e,i){let n=[];if(e.changes)for(let r in e.changes)for(let s of e.changes[r]){let e=i.bridge.translateBackRange({uri:r},s.range);n.push({resource:e.textModel.uri,versionId:void 0,textEdit:{range:e.range,text:s.newText}})}if(e.documentChanges){for(let r of e.documentChanges)if("textDocument"in r){let e=r.textDocument.uri;for(let s of r.edits){let o=i.bridge.translateBackRange({uri:e},s.range);n.push({resource:o.textModel.uri,versionId:r.textDocument.version??void 0,textEdit:{range:o.range,text:s.newText}})}}}return{edits:n}}var a3=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{codeLens:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentCodeLens,!0,e=>s1.languages.registerCodeLensProvider(aD(e.documentSelector),new a4(this._connection,e))))}},a4=class{constructor(e,i){this._client=e,this._capabilities=i}async provideCodeLenses(e,i){let n=this._client.bridge.translate(e,new s1.Position(1,1)),r=await this._client.server.textDocumentCodeLens({textDocument:n.textDocument});return r?{lenses:r.map(i=>({range:ao(this._client.bridge.translateBackRange(n.textDocument,i.range),e).range,command:aC(i.command),_lspCodeLens:i})),dispose:()=>{}}:null}async resolveCodeLens(e,i,n){if(!this._capabilities.resolveProvider||!i._lspCodeLens)return i;let r=await this._client.server.codeLensResolve(i._lspCodeLens);return r.command&&(i.command={id:r.command.command,title:r.command.title,arguments:r.command.arguments}),i}},a6=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{documentLink:{dynamicRegistration:!0,tooltipSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentDocumentLink,!0,e=>s1.languages.registerLinkProvider(aD(e.documentSelector),new a8(this._connection,e))))}},a8=class{constructor(e,i){this._client=e,this._capabilities=i}async provideLinks(e,i){let n=this._client.bridge.translate(e,new s1.Position(1,1)),r=await this._client.server.textDocumentDocumentLink({textDocument:n.textDocument});return r?{links:r.map(e=>({range:this._client.bridge.translateBackRange(n.textDocument,e.range).range,url:e.target,tooltip:e.tooltip}))}:null}async resolveLink(e,i){return!this._capabilities.resolveProvider,e}},a9=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{formatting:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentFormatting,!0,e=>s1.languages.registerDocumentFormattingEditProvider(aD(e.documentSelector),new a7(this._connection,e))))}},a7=class{constructor(e,i){this._client=e,this._capabilities=i}async provideDocumentFormattingEdits(e,i,n){let r=this._client.bridge.translate(e,new s1.Position(1,1)),s=await this._client.server.textDocumentFormatting({textDocument:r.textDocument,options:{tabSize:i.tabSize,insertSpaces:i.insertSpaces}});return s?s.map(e=>({range:this._client.bridge.translateBackRange(r.textDocument,e.range).range,text:e.newText})):null}},le=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{rangeFormatting:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentRangeFormatting,!0,e=>s1.languages.registerDocumentRangeFormattingEditProvider(aD(e.documentSelector),new lt(this._connection,e))))}},lt=class{constructor(e,i){this._client=e,this._capabilities=i}async provideDocumentRangeFormattingEdits(e,i,n,r){let s=this._client.bridge.translate(e,i.getStartPosition()),o=await this._client.server.textDocumentRangeFormatting({textDocument:s.textDocument,range:this._client.bridge.translateRange(e,i),options:{tabSize:n.tabSize,insertSpaces:n.insertSpaces}});return o?o.map(e=>({range:this._client.bridge.translateBackRange(s.textDocument,e.range).range,text:e.newText})):null}},li=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{onTypeFormatting:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentOnTypeFormatting,!0,e=>s1.languages.registerOnTypeFormattingEditProvider(aD(e.documentSelector),new ln(this._connection,e))))}},ln=class{constructor(e,i){ok(this,"autoFormatTriggerCharacters"),this._client=e,this._capabilities=i,this.autoFormatTriggerCharacters=[i.firstTriggerCharacter,...i.moreTriggerCharacter||[]]}async provideOnTypeFormattingEdits(e,i,n,r,s){let o=this._client.bridge.translate(e,i),a=await this._client.server.textDocumentOnTypeFormatting({textDocument:o.textDocument,position:o.position,ch:n,options:{tabSize:r.tabSize,insertSpaces:r.insertSpaces}});return a?a.map(e=>({range:this._client.bridge.translateBackRange(o.textDocument,e.range).range,text:e.newText})):null}},lr=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{foldingRange:{dynamicRegistration:!0,rangeLimit:5e3,lineFoldingOnly:!1,foldingRangeKind:{valueSet:[oJ.Comment,oJ.Imports,oJ.Region]}}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentFoldingRange,!0,e=>s1.languages.registerFoldingRangeProvider(aD(e.documentSelector),new ls(this._connection,e))))}},ls=class{constructor(e,i){this._client=e,this._capabilities=i}async provideFoldingRanges(e,i,n){let r=this._client.bridge.translate(e,new s1.Position(1,1)),s=await this._client.server.textDocumentFoldingRange({textDocument:r.textDocument});return s?s.map(e=>({start:e.startLine+1,end:e.endLine+1,kind:function(e){if(e)return ax.get(e)}(e.kind)})):null}},lo=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{selectionRange:{dynamicRegistration:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentSelectionRange,!0,e=>s1.languages.registerSelectionRangeProvider(aD(e.documentSelector),new la(this._connection,e))))}},la=class{constructor(e,i){this._client=e,this._capabilities=i}async provideSelectionRanges(e,i,n){let r=this._client.bridge.translate(e,i[0]),s=await this._client.server.textDocumentSelectionRange({textDocument:r.textDocument,positions:i.map(i=>this._client.bridge.translate(e,i).position)});return s?s.map(e=>this.convertSelectionRange(e,r.textDocument)):null}convertSelectionRange(e,i){let n=[],r=e;for(;r;)n.push({range:this._client.bridge.translateBackRange(i,r.range).range}),r=r.parent;return n}},ll=class extends aa{constructor(e){super(),ok(this,"_providers",new Set),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{inlayHint:{dynamicRegistration:!0,resolveSupport:{properties:["tooltip","textEdits","label.tooltip","label.location","label.command"]}}},workspace:{inlayHint:{refreshSupport:!0}}})),this._register(this._connection.connection.registerRequestHandler(as.client.workspaceInlayHintRefresh,async()=>{for(let e of this._providers)e.refresh();return{ok:null}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentInlayHint,!0,e=>{let i=new lc(this._connection,e);this._providers.add(i);let n=s1.languages.registerInlayHintsProvider(aD(e.documentSelector),i);return{dispose:()=>{this._providers.delete(i),n.dispose()}}}))}},lc=class{constructor(e,i){ok(this,"_onDidChangeInlayHints",new s1.Emitter),ok(this,"onDidChangeInlayHints",this._onDidChangeInlayHints.event),ok(this,"resolveInlayHint"),this._client=e,this._capabilities=i,i.resolveProvider&&(this.resolveInlayHint=async(e,i)=>{let n=await this._client.server.inlayHintResolve(e._lspInlayHint);return n.tooltip&&(e.tooltip=lu(n.tooltip)),n.label!==e._lspInlayHint.label&&(e.label=lh(n.label)),n.textEdits&&(e.textEdits=n.textEdits.map(i=>({range:this._client.bridge.translateBackRange({uri:e._targetUri},i.range).range,text:i.newText}))),e})}refresh(){this._onDidChangeInlayHints.fire()}async provideInlayHints(e,i,n){let r=this._client.bridge.translate(e,i.getStartPosition()),s=await ld(async()=>await this._client.server.textDocumentInlayHint({textDocument:r.textDocument,range:this._client.bridge.translateRange(e,i)}));return s?{hints:s.map(i=>{var n;return{label:lh(i.label),position:ao(this._client.bridge.translateBack(r.textDocument,i.position),e).position,kind:(n=i.kind)?aT.get(n)??s1.languages.InlayHintKind.Type:s1.languages.InlayHintKind.Type,tooltip:lu(i.tooltip),paddingLeft:i.paddingLeft,paddingRight:i.paddingRight,textEdits:i.textEdits?.map(i=>({range:ao(this._client.bridge.translateBackRange(r.textDocument,i.range),e).range,text:i.newText})),_lspInlayHint:i,_targetUri:r.textDocument.uri}}),dispose:()=>{}}:null}};async function ld(e){for(let i=3;;i--)try{return await e()}catch(e){if("content modified"===e.message&&i>0)continue;throw e}}function lh(e){return"string"==typeof e?e:e.map(e=>{let i={label:e.value,tooltip:lu(e.tooltip),command:aC(e.command)};return e.location&&(i.location={uri:s1.Uri.parse(e.location.uri),range:new s1.Range(e.location.range.start.line+1,e.location.range.start.character+1,e.location.range.end.line+1,e.location.range.end.character+1)}),i})}function lu(e){if(e)return"string"==typeof e?e:{value:e.value,isTrusted:!0}}var lp=class extends aa{constructor(e){super(),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{semanticTokens:{dynamicRegistration:!0,requests:{range:!0,full:{delta:!0}},tokenTypes:["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],tokenModifiers:["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],formats:[ai.Relative],overlappingTokenSupport:!1,multilineTokenSupport:!0}}})),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentSemanticTokensFull,!0,e=>s1.languages.registerDocumentSemanticTokensProvider(aD(e.documentSelector),new lf(this._connection,e))))}},lf=class{constructor(e,i){this._client=e,this._capabilities=i}getLegend(){return{tokenTypes:this._capabilities.legend.tokenTypes,tokenModifiers:this._capabilities.legend.tokenModifiers}}releaseDocumentSemanticTokens(e){}async provideDocumentSemanticTokens(e,i,n){let r=this._client.bridge.translate(e,e.getPositionAt(0)),s=this._capabilities.full;if(i&&s&&"object"==typeof s&&s.delta){let e=await this._client.server.textDocumentSemanticTokensFullDelta({textDocument:r.textDocument,previousResultId:i});return e?"edits"in e?{resultId:e.resultId,edits:e.edits.map(e=>({start:e.start,deleteCount:e.deleteCount,data:e.data?new Uint32Array(e.data):void 0}))}:{resultId:e.resultId,data:new Uint32Array(e.data)}:null}let o=await this._client.server.textDocumentSemanticTokensFull({textDocument:r.textDocument});return o?{resultId:o.resultId,data:new Uint32Array(o.data)}:null}async provideDocumentSemanticTokensEdits(e,i,n){return this.provideDocumentSemanticTokens(e,i,n)}},lm=class extends aa{constructor(e){super(),ok(this,"_diagnosticsMarkerOwner","lsp"),ok(this,"_pullDiagnosticProviders",new Map),this._connection=e,this._register(this._connection.capabilities.addStaticClientCapabilities({textDocument:{publishDiagnostics:{relatedInformation:!0,tagSupport:{valueSet:[...aS.keys()]},versionSupport:!0,codeDescriptionSupport:!0,dataSupport:!0},diagnostic:{dynamicRegistration:!0,relatedDocumentSupport:!0}}})),this._register(this._connection.connection.registerNotificationHandler(as.client.textDocumentPublishDiagnostics,e=>this._handlePublishDiagnostics(e))),this._register(this._connection.capabilities.registerCapabilityHandler(ar.textDocumentDiagnostic,!0,e=>{let i=new al;for(let n of s1.editor.getModels())this._addPullDiagnosticProvider(n,e,i);return i.add(s1.editor.onDidCreateModel(n=>{this._addPullDiagnosticProvider(n,e,i)})),i}))}_addPullDiagnosticProvider(e,i,n){if(e.getLanguageId(),!function(e,i){if(!i)return!0;let n=e.getLanguageId();if(e.uri.toString(!0),!i||0===i.length)return!0;for(let e of i)if(!e.language||"*"===e.language||e.language===n)return!0;return!1}(e,i.documentSelector))return;let r=new lg(e,this._connection,this._diagnosticsMarkerOwner,i);this._pullDiagnosticProviders.set(e,r),n.add(r),n.add(e.onWillDispose(()=>{this._pullDiagnosticProviders.delete(e)}))}_handlePublishDiagnostics(e){let i=e.uri;try{let n=this._connection.bridge.translateBack({uri:i},{line:0,character:0}).textModel;if(!n||n.isDisposed())return;let r=e.diagnostics.map(e=>aN(e));s1.editor.setModelMarkers(n,this._diagnosticsMarkerOwner,r)}catch(e){console.debug(`Could not set diagnostics for ${i}:`,e)}}},lg=class extends aa{constructor(e,i,n,r){super(),ok(this,"_updateHandle"),ok(this,"_previousResultId"),this._model=e,this._connection=i,this._markerOwner=n,this._capability=r,this._register(this._model.onDidChangeContent(()=>{this._scheduleDiagnosticUpdate()})),this._scheduleDiagnosticUpdate()}_scheduleDiagnosticUpdate(){void 0!==this._updateHandle&&clearTimeout(this._updateHandle),this._updateHandle=window.setTimeout(()=>{this._updateHandle=void 0,this._requestDiagnostics()},500)}async _requestDiagnostics(){if(!this._model.isDisposed())try{let e=this._connection.bridge.translate(this._model,new s1.Position(1,1)),i=await this._connection.server.textDocumentDiagnostic({textDocument:e.textDocument,identifier:this._capability.identifier,previousResultId:this._previousResultId});if(this._model.isDisposed())return;this._handleDiagnosticReport(i)}catch(e){console.error("Error requesting diagnostics:",e)}}_handleDiagnosticReport(e){if("full"===e.kind){this._previousResultId=e.resultId;let i=e.items.map(e=>aN(e));s1.editor.setModelMarkers(this._model,this._markerOwner,i),"relatedDocuments"in e&&e.relatedDocuments&&this._handleRelatedDocuments(e.relatedDocuments)}else"unchanged"===e.kind&&(this._previousResultId=e.resultId)}_handleRelatedDocuments(e){for(let[i,n]of Object.entries(e))try{let e=this._connection.bridge.translateBack({uri:i},{line:0,character:0}).textModel;if(!e||e.isDisposed())continue;if("full"===n.kind){let i=n.items.map(e=>aN(e));s1.editor.setModelMarkers(e,this._markerOwner,i)}}catch(e){console.debug(`Could not set related diagnostics for ${i}:`,e)}}dispose(){void 0!==this._updateHandle&&(clearTimeout(this._updateHandle),this._updateHandle=void 0),super.dispose()}},lv=class{constructor(e,i,n,r){this.server=e,this.bridge=i,this.capabilities=n,this.connection=r}},ly=class extends aa{constructor(e){super(),ok(this,"_staticCapabilities",new Set),ok(this,"_dynamicFromStatic",lk.create()),ok(this,"_registrations",new Map),ok(this,"_serverCapabilities"),this._connection=e,this._register(this._connection.registerRequestHandler(as.client.clientRegisterCapability,async e=>{for(let i of e.registrations){let e=lw(i.method),n=new lx(i.id,e,i.registerOptions,!1);this._registerCapabilityOptions(n)}return{ok:null}})),this._register(this._connection.registerRequestHandler(as.client.clientUnregisterCapability,async e=>{for(let i of e.unregisterations){let e=lw(i.method),n=this._registrations.get(e),r=n?.registrations.get(i.id);if(!r)throw Error(`No registration for method ${i.method} with id ${i.id}`);r?.handlerDisposables.forEach(e=>e.dispose()),n?.registrations.delete(i.id)}return{ok:null}}))}_registerCapabilityOptions(e){let i=this._registrations.get(e.capability);if(i||(i=new lS,this._registrations.set(e.capability,i)),i.registrations.has(e.id))throw Error(`Handler for method ${e.capability.method} with id ${e.id} already registered`);for(let n of(i.registrations.set(e.id,e),i.handlers))(n.handleStaticCapability||!e.isFromStatic)&&e.handlerDisposables.set(n,n.handler(e.options))}setServerCapabilities(e){if(this._serverCapabilities)throw Error("Server capabilities already set");for(let i of(this._serverCapabilities=e,Object.values(ar))){let n=this._dynamicFromStatic.getOptions(i,e);n&&this._registerCapabilityOptions(new lx(i.method,i,n,!0))}}getClientCapabilities(){let e={};for(let i of this._staticCapabilities)!function e(i,n){for(let r of Object.keys(n)){let s=n[r];if(void 0===s)continue;let o=i[r];if(void 0===o||"object"!=typeof s||null===s||"object"!=typeof o||null===o){i[r]=s;continue}e(o,s)}}(e,i.cap);return e}addStaticClientCapabilities(e){let i={cap:e};return this._staticCapabilities.add(i),{dispose:()=>{this._staticCapabilities.delete(i)}}}registerCapabilityHandler(e,i,n){let r=this._registrations.get(e);r||(r=new lS,this._registrations.set(e,r));let s=new l_(e,i,n);for(let e of(r.handlers.add(s),r.registrations.values()))(s.handleStaticCapability||!e.isFromStatic)&&e.handlerDisposables.set(s,n(e.options));return{dispose:()=>{for(let e of(r.handlers.delete(s),r.registrations.values())){let i=e.handlerDisposables.get(s);i&&(i.dispose(),e.handlerDisposables.delete(s))}}}}},l_=class{constructor(e,i,n){this.capability=e,this.handleStaticCapability=i,this.handler=n}},lx=class{constructor(e,i,n,r){ok(this,"handlerDisposables",new Map),this.id=e,this.capability=i,this.options=n,this.isFromStatic=r}};let lb=new Map([...Object.values(ar)].map(e=>[e.method,e]));function lw(e){let i=lb.get(e);if(!i)throw Error(`No capability found for method ${e}`);return i}var lS=class{constructor(){ok(this,"handlers",new Set),ok(this,"registrations",new Map)}},lk=class e{constructor(){ok(this,"_mappings",new Map)}static create(){let i=new e;return i.set(ar.textDocumentDidChange,e=>{if(void 0!==e.textDocumentSync)if("object"==typeof e.textDocumentSync)return{syncKind:e.textDocumentSync.change??o0.None,documentSelector:null};else return{syncKind:e.textDocumentSync,documentSelector:null}}),i.set(ar.textDocumentCompletion,e=>e.completionProvider),i.set(ar.textDocumentHover,e=>e.hoverProvider),i.set(ar.textDocumentSignatureHelp,e=>e.signatureHelpProvider),i.set(ar.textDocumentDefinition,e=>e.definitionProvider),i.set(ar.textDocumentReferences,e=>e.referencesProvider),i.set(ar.textDocumentDocumentHighlight,e=>e.documentHighlightProvider),i.set(ar.textDocumentDocumentSymbol,e=>e.documentSymbolProvider),i.set(ar.textDocumentCodeAction,e=>e.codeActionProvider),i.set(ar.textDocumentCodeLens,e=>e.codeLensProvider),i.set(ar.textDocumentDocumentLink,e=>e.documentLinkProvider),i.set(ar.textDocumentFormatting,e=>e.documentFormattingProvider),i.set(ar.textDocumentRangeFormatting,e=>e.documentRangeFormattingProvider),i.set(ar.textDocumentOnTypeFormatting,e=>e.documentOnTypeFormattingProvider),i.set(ar.textDocumentRename,e=>e.renameProvider),i.set(ar.textDocumentFoldingRange,e=>e.foldingRangeProvider),i.set(ar.textDocumentDeclaration,e=>e.declarationProvider),i.set(ar.textDocumentTypeDefinition,e=>e.typeDefinitionProvider),i.set(ar.textDocumentImplementation,e=>e.implementationProvider),i.set(ar.textDocumentDocumentColor,e=>e.colorProvider),i.set(ar.textDocumentSelectionRange,e=>e.selectionRangeProvider),i.set(ar.textDocumentLinkedEditingRange,e=>e.linkedEditingRangeProvider),i.set(ar.textDocumentPrepareCallHierarchy,e=>e.callHierarchyProvider),i.set(ar.textDocumentSemanticTokensFull,e=>e.semanticTokensProvider),i.set(ar.textDocumentInlayHint,e=>e.inlayHintProvider),i.set(ar.textDocumentInlineValue,e=>e.inlineValueProvider),i.set(ar.textDocumentDiagnostic,e=>e.diagnosticProvider),i.set(ar.textDocumentMoniker,e=>e.monikerProvider),i.set(ar.textDocumentPrepareTypeHierarchy,e=>e.typeHierarchyProvider),i.set(ar.workspaceSymbol,e=>e.workspaceSymbolProvider),i.set(ar.workspaceExecuteCommand,e=>e.executeCommandProvider),i}set(e,i){if(this._mappings.has(e.method))throw Error(`Capability for method ${e.method} already registered`);this._mappings.set(e.method,i)}getOptions(e,i){let n=this._mappings.get(e.method);if(n)return n(i)}},lC=class extends aa{constructor(e,i){super(),ok(this,"_managedModels",new Map),ok(this,"_managedModelsReverse",new Map),ok(this,"_started",!1),this._server=e,this._capabilities=i,this._register(this._capabilities.addStaticClientCapabilities({textDocument:{synchronization:{dynamicRegistration:!0,willSave:!1,willSaveWaitUntil:!1,didSave:!1}}})),this._register(i.registerCapabilityHandler(ar.textDocumentDidChange,!0,e=>{if(this._started)return{dispose:()=>{}};for(let e of(this._started=!0,this._register(s1.editor.onDidCreateModel(e=>{this._getOrCreateManagedModel(e)})),s1.editor.getModels()))this._getOrCreateManagedModel(e);return{dispose:()=>{}}}))}_getOrCreateManagedModel(e){if(!this._started)throw Error("Not started");let i=e.uri.toString(!0).toLowerCase(),n=this._managedModels.get(e);return n||(n=new lT(e,this._server),this._managedModels.set(e,n),this._managedModelsReverse.set(i,e)),e.onWillDispose(()=>{n.dispose(),this._managedModels.delete(e),this._managedModelsReverse.delete(i)}),n}translateBack(e,i){let n=e.uri.toLowerCase(),r=this._managedModelsReverse.get(n);if(!r)throw Error(`No text model for uri ${n}`);return{textModel:r,position:new s1.Position(i.line+1,i.character+1)}}translateBackRange(e,i){let n=e.uri.toLowerCase(),r=this._managedModelsReverse.get(n);if(!r)throw Error(`No text model for uri ${n}`);return{textModel:r,range:new s1.Range(i.start.line+1,i.start.character+1,i.end.line+1,i.end.character+1)}}translate(e,i){return{textDocument:{uri:e.uri.toString(!0)},position:{line:i.lineNumber-1,character:i.column-1}}}translateRange(e,i){return{start:{line:i.startLineNumber-1,character:i.startColumn-1},end:{line:i.endLineNumber-1,character:i.endColumn-1}}}},lT=class extends aa{constructor(e,i){super(),this._textModel=e,this._api=i;const n=e.uri.toString(!0).toLowerCase();this._api.textDocumentDidOpen({textDocument:{languageId:e.getLanguageId(),uri:n,version:e.getVersionId(),text:e.getValue()}}),this._register(e.onDidChangeContent(i=>{let r=i.changes.map(e=>{var i,n;return{range:{start:{line:(n=(i=e).range).startLineNumber-1,character:n.startColumn-1},end:{line:n.endLineNumber-1,character:n.endColumn-1}},rangeLength:i.rangeLength,text:i.text}});this._api.textDocumentDidChange({textDocument:{uri:n,version:e.getVersionId()},contentChanges:r})})),this._register({dispose:()=>{this._api.textDocumentDidClose({textDocument:{uri:n}})}})}},lE=class{constructor(e){ok(this,"_connection"),ok(this,"_capabilitiesRegistry"),ok(this,"_bridge"),ok(this,"_initPromise");const i=oz.fromTransport(e),n=as.getServer(i,{});i.startListen(),this._capabilitiesRegistry=new ly(i),this._bridge=new lC(n.server,this._capabilitiesRegistry),this._connection=new lv(n.server,this._bridge,this._capabilitiesRegistry,i),this.createFeatures(),this._initPromise=this._init()}async _init(){let e=await this._connection.server.initialize({processId:null,capabilities:this._capabilitiesRegistry.getClientCapabilities(),rootUri:null});this._connection.server.initialized({}),this._capabilitiesRegistry.setServerCapabilities(e.capabilities)}createFeatures(){let e=new al;return e.add(new aM(this._connection)),e.add(new aA(this._connection)),e.add(new aI(this._connection)),e.add(new az(this._connection)),e.add(new aH(this._connection)),e.add(new a$(this._connection)),e.add(new aV(this._connection)),e.add(new aK(this._connection)),e.add(new aX(this._connection)),e.add(new aG(this._connection)),e.add(new aQ(this._connection)),e.add(new a1(this._connection)),e.add(new a3(this._connection)),e.add(new a6(this._connection)),e.add(new a9(this._connection)),e.add(new le(this._connection)),e.add(new li(this._connection)),e.add(new lr(this._connection)),e.add(new lo(this._connection)),e.add(new ll(this._connection)),e.add(new lp(this._connection)),e.add(new lm(this._connection)),e}},lD=null,lN=lD="u">typeof WebSocket?WebSocket:"u">typeof MozWebSocket?MozWebSocket:e.g.WebSocket||e.g.MozWebSocket,lM=class e extends oO{constructor(e){super(),ok(this,"socket"),ok(this,"errorEmitter",new oE),ok(this,"onError",this.errorEmitter),this.socket=e,e.onmessage=e=>{try{let i=e.data;if("string"==typeof i){let e=JSON.parse(i);this._dispatchReceivedMessage(e)}else throw Error("Not supported")}catch(e){this.errorEmitter.fire({error:e})}},e.onclose=e=>{this._onConnectionClosed()}}static connectTo(i){let n=new lN(("host"in i?{address:`${i.forceTls?"wss":"ws"}://${i.host}:${i.port}`}:i).address);return new Promise((i,r)=>{n.onerror=e=>{r(e)},n.onopen=()=>{i(new e(n))}})}static fromWebSocket(i){return new e(i)}close(){this.socket.close()}dispose(){this.close()}_sendImpl(e){let i=JSON.stringify(e);return new Promise((e,n)=>{this.socket.send(i,i=>{i?n(i):e()})})}toString(){return`${this.id}@${this.socket.url}`}},lO=class extends oO{constructor(e,i,n){super(),ok(this,"_windowLike"),ok(this,"_source"),ok(this,"_loadingState"),ok(this,"_disposed",!1),ok(this,"_messageHandler",({data:e,source:i})=>{(!this._source||i===this._source)&&"object"==typeof e&&e&&this._dispatchReceivedMessage(e)}),this._windowLike=e,this._source=i,this._loadingState=n,this._windowLike.addEventListener("message",this._messageHandler)}async _sendImpl(e){if(this._disposed)throw Error("Transport is disposed");this._loadingState&&!this._loadingState.loaded&&await this._loadingState.onLoaded,this._windowLike.postMessage(e)}toString(){return`${this.id}@${this._windowLike}`}dispose(){this._disposed||(this._disposed=!0,this._windowLike.removeEventListener("message",this._messageHandler))}};e.s(["MonacoLspClient",0,lE,"WebSocketTransport",0,lM,"createTransportToIFrame",0,function(e){if("u"<typeof window)throw Error("call this function from the main browser thread");return new lO(e.contentWindow,e.contentWindow,{loaded:"complete"===window.document.readyState,onLoaded:new Promise(e=>{window.addEventListener("load",()=>e())})})},"createTransportToWorker",0,function(e){if("u"<typeof window)throw Error("call this function from the main browser thread");return new lO(e)}],733757),e.i(733757),e.i(120276);let lR=globalThis.MonacoEnvironment;lR?.globalAPI&&(globalThis.monaco=s1),s1.languages.css=s7,s1.languages.html=of,s1.languages.typescript=oy,s1.languages.json=ov;let lA=[".ts",".tsx",".js",".jsx"],lL=new Map,lj=new Set;function lI(e,i){return s1.Uri.parse(`file:///workspace/${e}/${i}`)}function lP(e,i,n){let r=n??"",s=lI(e,i),o=s1.editor.getModel(s);if(o)o.getValue()!==r&&o.setValue(r);else o=s1.editor.createModel(r,{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",md:"markdown",css:"css",html:"html",yaml:"yaml",yml:"yaml",py:"python",rs:"rust",go:"go",sql:"sql",sh:"shell",bash:"shell"}[i.split(".").pop()?.toLowerCase()||""]||"plaintext",s);return lL.set(i,o),o}async function lB(e,i){let n=i.split("/").slice(0,-1).join("/"),r=`${e}:${n}`;if(lj.has(r))return void console.log("[monaco-models] skip preloaded dir:",n);lj.add(r);try{let i=new URLSearchParams({path:n}),r=await fetch(`/api/workspaces/${e}/files/tree?${i}`),s=await r.json();console.log("[monaco-models] preload dir:",n,"nodes:",s.length);let o=0,a=[];for(let i of s){if(o>=20){a.push("maxFiles limit");break}if("file"!==i.type)continue;let n="."+(i.name.split(".").pop()?.toLowerCase()||"");if(!lA.includes(n))continue;if(i.size&&i.size>512e3){a.push(`${i.name} (${(i.size/1024).toFixed(0)}KB)`);continue}let r=lI(e,i.path);if(s1.editor.getModel(r)){a.push(`${i.name} (exists)`);continue}try{let n=await fetch(`/api/workspaces/${e}/files/content?path=${encodeURIComponent(i.path)}`),r=await n.json();void 0!==r.content&&(lP(e,i.path,r.content),o++)}catch(e){a.push(`${i.name} (fetch error)`)}}console.log("[monaco-models] preloaded:",o,"skipped:",a.length?a:"none")}catch(e){console.warn("[monaco-models] preload failed for dir:",n,e)}}var lz=e.i(917955);function lF(){let e=(0,n2.useTranslations)("editor");return(0,iM.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:e("loadingEditor")})}navigator.clipboard?.write||Object.defineProperty(navigator,"clipboard",{value:{...navigator.clipboard,writeText:navigator.clipboard?.writeText??(e=>Promise.resolve()),write:e=>{let i=e[0]?.getType("text/plain");return i?i.then(e=>e.text()).then(e=>navigator.clipboard.writeText(e)):Promise.resolve()}},writable:!0,configurable:!0});let lH=(0,sm.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,iM.jsx)(lF,{})});function lW({editorRef:e,workspaceId:i,isReadOnly:n,onToggleReadOnly:r,isFullscreen:s,onToggleFullscreen:o}){let{saveFile:a,activeFilePath:l}=(0,rd.useEditorStore)(),c=(0,n2.useTranslations)("editor"),d=i=>{e.current?.trigger("menu",i,null)};return(0,iM.jsxs)("div",{className:"flex items-center h-7 border-b bg-background shrink-0",children:[(0,iM.jsxs)(lz.DropdownMenu,{children:[(0,iM.jsx)(lz.DropdownMenuTrigger,{className:"px-3 h-full text-xs hover:bg-accent outline-none cursor-default",children:c("menuFile")}),(0,iM.jsx)(lz.DropdownMenuContent,{align:"start",sideOffset:0,children:(0,iM.jsxs)(lz.DropdownMenuItem,{onClick:()=>l&&a(i,l),children:[c("menuSave"),(0,iM.jsx)(lz.DropdownMenuShortcut,{children:"⌘S"})]})})]}),(0,iM.jsxs)(lz.DropdownMenu,{children:[(0,iM.jsx)(lz.DropdownMenuTrigger,{className:"px-3 h-full text-xs hover:bg-accent outline-none cursor-default",children:c("menuEdit")}),(0,iM.jsxs)(lz.DropdownMenuContent,{align:"start",sideOffset:0,children:[(0,iM.jsxs)(lz.DropdownMenuItem,{onClick:()=>d("undo"),children:[c("menuUndo"),(0,iM.jsx)(lz.DropdownMenuShortcut,{children:"⌘Z"})]}),(0,iM.jsxs)(lz.DropdownMenuItem,{onClick:()=>d("redo"),children:[c("menuRedo"),(0,iM.jsx)(lz.DropdownMenuShortcut,{children:"⇧⌘Z"})]}),(0,iM.jsx)(lz.DropdownMenuSeparator,{}),(0,iM.jsxs)(lz.DropdownMenuItem,{onClick:()=>d("editor.action.clipboardCutAction"),children:[c("menuCut"),(0,iM.jsx)(lz.DropdownMenuShortcut,{children:"⌘X"})]}),(0,iM.jsxs)(lz.DropdownMenuItem,{onClick:()=>d("editor.action.clipboardCopyAction"),children:[c("menuCopy"),(0,iM.jsx)(lz.DropdownMenuShortcut,{children:"⌘C"})]}),(0,iM.jsxs)(lz.DropdownMenuItem,{onClick:()=>d("editor.action.clipboardPasteAction"),children:[c("menuPaste"),(0,iM.jsx)(lz.DropdownMenuShortcut,{children:"⌘V"})]}),(0,iM.jsx)(lz.DropdownMenuSeparator,{}),(0,iM.jsxs)(lz.DropdownMenuItem,{onClick:()=>d("actions.find"),children:[c("menuFind"),(0,iM.jsx)(lz.DropdownMenuShortcut,{children:"⌘F"})]}),(0,iM.jsxs)(lz.DropdownMenuItem,{onClick:()=>d("editor.action.startFindReplaceAction"),children:[c("menuReplace"),(0,iM.jsx)(lz.DropdownMenuShortcut,{children:"⌥⌘F"})]})]})]}),(0,iM.jsxs)(lz.DropdownMenu,{children:[(0,iM.jsx)(lz.DropdownMenuTrigger,{className:"px-3 h-full text-xs hover:bg-accent outline-none cursor-default",children:c("menuView")}),(0,iM.jsx)(lz.DropdownMenuContent,{align:"start",sideOffset:0,children:(0,iM.jsxs)(lz.DropdownMenuItem,{onClick:o,children:[c(s?"exitFullscreen":"menuFullscreen"),(0,iM.jsx)(lz.DropdownMenuShortcut,{children:"⌃⌘F"})]})})]}),(0,iM.jsx)("div",{className:"flex-1"}),(0,iM.jsx)("button",{onClick:r,className:"flex items-center gap-1 px-2 h-full text-xs text-muted-foreground hover:text-foreground hover:bg-accent outline-none cursor-default",title:c(n?"enableEdit":"disableEdit"),children:n?"🔒":"✏️"})]})}function l$({workspaceId:e}){var i;let{openFiles:n,activeFilePath:r,updateContent:s,saveFile:o,pendingJump:a,clearPendingJump:l}=(0,rd.useEditorStore)(),{resolvedTheme:c}=(0,s0.useTheme)(),d=(0,n2.useTranslations)("editor"),h=(0,iO.useRef)(null),[u,p]=(0,iO.useState)(!0),[f,m]=(0,iO.useState)(!1),g=n.find(e=>e.path===r),v=(0,iO.useCallback)(()=>{r&&o(e,r)},[r,o,e]),y=(0,iO.useCallback)((e,i)=>{let n;h.current=e,(n=s1.languages.typescript)&&(n.typescriptDefaults?.setEagerModelSync(!0),n.javascriptDefaults?.setEagerModelSync(!0),n.typescriptDefaults?.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1,noSuggestionDiagnostics:!0}),n.javascriptDefaults?.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1,noSuggestionDiagnostics:!0})),e.addCommand(2097,()=>v())},[v]);(0,iO.useEffect)(()=>{h.current?.updateOptions({readOnly:u})},[u]),(0,iO.useEffect)(()=>{g&&r&&(lP(e,r,g.content),lB(e,r))},[r,e,g]),(0,iO.useEffect)(()=>{if(!a||!h.current)return;let{line:e,column:i}=a,n=h.current;n.revealLineInCenter(e),n.setPosition({lineNumber:e,column:i||1}),n.focus(),l()},[a,l]);let _=r?`/${e}/${r}`:void 0;return(0,iM.jsxs)("div",{className:`flex flex-col h-full ${f?"fixed inset-0 z-50 bg-background":""}`,children:[(0,iM.jsx)(sQ,{workspaceId:e}),(0,iM.jsx)(lW,{editorRef:h,workspaceId:e,isReadOnly:u,onToggleReadOnly:()=>p(e=>!e),isFullscreen:f,onToggleFullscreen:()=>m(e=>!e)}),(0,iM.jsx)("div",{className:"flex-1 min-h-0",children:g?(0,iM.jsx)(lH,{height:"100%",language:(i=g.path,({ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",md:"markdown",css:"css",html:"html",yaml:"yaml",yml:"yaml",py:"python",rs:"rust",go:"go",sql:"sql",sh:"shell",bash:"shell"})[i.split(".").pop()?.toLowerCase()||""]||"plaintext"),value:g.content,path:_,onChange:e=>s(g.path,e||""),onMount:y,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",readOnly:u},theme:"dark"===c?"vs-dark":"vs"}):(0,iM.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:d("openFileToEdit")})})]})}var lU=e.i(953700),lV=e.i(683640),lq=e.i(209988),lK=e.i(996652),lY=e.i(816709);let lX=new Map,lJ=(0,lY.create)((e,i)=>({sessions:[],activeId:null,ws:null,_initialized:!1,_restored:!1,init:(n,r)=>{let s=i();s._initialized&&s.ws===n||(e({ws:n,_initialized:!0,_restored:!1}),n.on("terminal.created",i=>{let{sessionId:n,cwd:r,shell:s}=i;e(e=>e.sessions.some(e=>e.id===n)?e:{sessions:[...e.sessions,{id:n,cwd:r,shell:s}],activeId:n})}),n.on("terminal.closed",i=>{let{sessionId:n}=i;e(e=>{let i=e.sessions.filter(e=>e.id!==n),r=e.activeId===n?i[0]?.id??null:e.activeId;return{sessions:i,activeId:r}})}),n.on("terminal.sessions",i=>{let{sessions:n}=i;e(e=>{let i=new Set(e.sessions.map(e=>e.id)),r=[...e.sessions];for(let e of n)!i.has(e.sessionId)&&(r.push({id:e.sessionId,cwd:e.cwd}),e.buffer&&lX.set(e.sessionId,e.buffer));return{sessions:r,activeId:e.activeId??r[0]?.id??null,_restored:!0}}),r?.()}))},createSession:(e,n)=>{let{ws:r}=i();r?.send("terminal.create",{sessionId:crypto.randomUUID?.()??crypto.getRandomValues(new Uint8Array(16)).reduce((e,i)=>e+i.toString(16).padStart(2,"0"),""),shell:e,cwd:n})},setActive:i=>e({activeId:i}),setSessionName:(i,n)=>e(e=>({sessions:e.sessions.map(e=>e.id===i?{...e,name:n}:e)})),removeSession:n=>{let{ws:r,sessions:s,activeId:o}=i();r?.send("terminal.close",{sessionId:n});let a=s.filter(e=>e.id!==n),l=o===n?a[0]?.id??null:o;e({sessions:a,activeId:l})},sendInput:(e,n)=>{i().ws?.send("terminal.input",{sessionId:e,data:n})},resize:(e,n,r)=>{i().ws?.send("terminal.resize",{sessionId:e,cols:n,rows:r})}}));var lG=e.i(437122),lZ=e.i(157408);let lQ=(0,lY.create)((e,i)=>({commands:[],runningMap:{},loaded:!1,wsAttached:!1,load:async n=>{let[r,s]=await Promise.all([(0,lG.fetchWithAuth)(`/api/workspaces/${n}/commands`),(0,lG.fetchWithAuth)(`/api/workspaces/${n}/commands/processes`)]),o=await r.json(),a=await s.json(),l={};for(let e of a)l[e.commandId]={sessionId:e.sessionId,status:e.status};e({commands:o,runningMap:l,loaded:!0}),i().attachWS(n)},create:async(i,n)=>{let r=await (0,lG.fetchWithAuth)(`/api/workspaces/${i}/commands`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),s=await r.json();e(e=>({commands:[...e.commands,s]}))},update:async(i,n,r)=>{let s=await (0,lG.fetchWithAuth)(`/api/workspaces/${i}/commands/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),o=await s.json();e(e=>({commands:e.commands.map(e=>e.id===n?o:e)}))},remove:async(i,n)=>{await (0,lG.fetchWithAuth)(`/api/workspaces/${i}/commands/${n}`,{method:"DELETE"}),e(e=>({commands:e.commands.filter(e=>e.id!==n),runningMap:Object.fromEntries(Object.entries(e.runningMap).filter(([e])=>e!==n))}))},run:async(e,i)=>{try{let n=await (0,lG.fetchWithAuth)(`/api/workspaces/${e}/commands/${i}/run`,{method:"POST"});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||"Failed to run command")}}catch(e){throw sZ.toast.error(e.message||"Failed to run command"),e}},stop:async(e,i)=>{try{let n=await (0,lG.fetchWithAuth)(`/api/workspaces/${e}/commands/${i}/stop`,{method:"POST"});if(!n.ok){let e=await n.json().catch(()=>({error:n.statusText}));throw Error(e.error||"Failed to stop command")}}catch(e){throw sZ.toast.error(e.message||"Failed to stop command"),e}},attachWS:n=>{if(i().wsAttached)return;let r=(0,lZ.getWS)(n);r.on("command.started",n=>{let{commandId:r,sessionId:s}=n,o=i().commands.find(e=>e.id===r);o&&lJ.getState().setSessionName(s,o.name),e(e=>({runningMap:{...e.runningMap,[r]:{sessionId:s,status:"running"}}}))}),r.on("command.stopped",i=>{let{commandId:n}=i;e(e=>{let{[n]:i,...r}=e.runningMap;return{runningMap:r}})}),r.on("command.restarted",i=>{let{commandId:n,sessionId:r}=i;e(e=>({runningMap:{...e.runningMap,[n]:{sessionId:r,status:"running"}}}))}),r.on("terminal.closed",i=>{let{sessionId:n}=i;e(e=>{let i=Object.fromEntries(Object.entries(e.runningMap).filter(([e,i])=>i.sessionId!==n));return Object.keys(i).length===Object.keys(e.runningMap).length?e:{runningMap:i}})}),e({wsAttached:!0})},isRunning:e=>!!i().runningMap[e]}));var l0=Object.defineProperty,l1=Object.getOwnPropertyDescriptor,l2=(e,i,n,r)=>{for(var s,o=r>1?void 0:r?l1(i,n):i,a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r?s(i,n,o):s(o))||o);return r&&o&&l0(i,n,o),o},l5=(e,i)=>(n,r)=>i(n,r,e),l3="Terminal input",l4="Too much output to announce, navigate to rows manually to read";function l6(e,i,n,r){var s;s=e=e.replace(/\r?\n/g,"\r"),e=n.decPrivateModes.bracketedPasteMode&&!0!==r.rawOptions.ignoreBracketedPasteMode?"\x1b[200~"+s+"\x1b[201~":s,n.triggerDataEvent(e,!0),i.value=""}function l8(e,i,n){let r=n.getBoundingClientRect(),s=e.clientX-r.left-10,o=e.clientY-r.top-10;i.style.width="20px",i.style.height="20px",i.style.left=`${s}px`,i.style.top=`${o}px`,i.style.zIndex="1000",i.focus()}function l9(e,i,n,r,s){l8(e,i,n),s&&r.rightClickSelect(e),i.value=r.selectionText,i.select()}function l7(e){return e>65535?String.fromCharCode(((e-=65536)>>10)+55296)+String.fromCharCode(e%1024+56320):String.fromCharCode(e)}function ce(e,i=0,n=e.length){let r="";for(let s=i;s<n;++s){let i=e[s];i>65535?(i-=65536,r+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):r+=String.fromCharCode(i)}return r}var ct=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let n=e.length;if(!n)return 0;let r=0,s=0;if(this._interim){let n=e.charCodeAt(s++);56320<=n&&n<=57343?i[r++]=(this._interim-55296)*1024+n-56320+65536:(i[r++]=this._interim,i[r++]=n),this._interim=0}for(let o=s;o<n;++o){let s=e.charCodeAt(o);if(55296<=s&&s<=56319){if(++o>=n)return this._interim=s,r;let a=e.charCodeAt(o);56320<=a&&a<=57343?i[r++]=(s-55296)*1024+a-56320+65536:(i[r++]=s,i[r++]=a);continue}65279!==s&&(i[r++]=s)}return r}},ci=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let n=e.length;if(!n)return 0;let r=0,s,o,a,l,c=0,d=0;if(this.interim[0]){let s=!1,o=this.interim[0];o&=(224&o)==192?31:(240&o)==224?15:7;let a=0,l;for(;(l=63&this.interim[++a])&&a<4;)o<<=6,o|=l;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,h=c-a;for(;d<h;){if(d>=n)return 0;if((192&(l=e[d++]))!=128){d--,s=!0;break}this.interim[a++]=l,o<<=6,o|=63&l}s||(2===c?o<128?d--:i[r++]=o:3===c?o<2048||o>=55296&&o<=57343||65279===o||(i[r++]=o):o<65536||o>1114111||(i[r++]=o)),this.interim.fill(0)}let h=n-4,u=d;for(;u<n;){for(;u<h&&!(128&(s=e[u]))&&!(128&(o=e[u+1]))&&!(128&(a=e[u+2]))&&!(128&(l=e[u+3]));)i[r++]=s,i[r++]=o,i[r++]=a,i[r++]=l,u+=4;if((s=e[u++])<128)i[r++]=s;else if((224&s)==192){if(u>=n)return this.interim[0]=s,r;if((192&(o=e[u++]))!=128||(c=(31&s)<<6|63&o)<128){u--;continue}i[r++]=c}else if((240&s)==224){if(u>=n)return this.interim[0]=s,r;if((192&(o=e[u++]))!=128){u--;continue}if(u>=n)return this.interim[0]=s,this.interim[1]=o,r;if((192&(a=e[u++]))!=128){u--;continue}if((c=(15&s)<<12|(63&o)<<6|63&a)<2048||c>=55296&&c<=57343||65279===c)continue;i[r++]=c}else if((248&s)==240){if(u>=n)return this.interim[0]=s,r;if((192&(o=e[u++]))!=128){u--;continue}if(u>=n)return this.interim[0]=s,this.interim[1]=o,r;if((192&(a=e[u++]))!=128){u--;continue}if(u>=n)return this.interim[0]=s,this.interim[1]=o,this.interim[2]=a,r;if((192&(l=e[u++]))!=128){u--;continue}if((c=(7&s)<<18|(63&o)<<12|(63&a)<<6|63&l)<65536||c>1114111)continue;i[r++]=c}}return r}},cn=class e{constructor(){this.fg=0,this.bg=0,this.extended=new cr}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let i=new e;return i.fg=this.fg,i.bg=this.bg,i.extended=this.extended.clone(),i}isInverse(){return 0x4000000&this.fg}isBold(){return 0x8000000&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:0x10000000&this.fg}isBlink(){return 0x20000000&this.fg}isInvisible(){return 0x40000000&this.fg}isItalic(){return 0x4000000&this.bg}isDim(){return 0x8000000&this.bg}isStrikethrough(){return 0x80000000&this.fg}isProtected(){return 0x20000000&this.bg}isOverline(){return 0x40000000&this.bg}getFgColorMode(){return 0x3000000&this.fg}getBgColorMode(){return 0x3000000&this.bg}isFgRGB(){return(0x3000000&this.fg)==0x3000000}isBgRGB(){return(0x3000000&this.bg)==0x3000000}isFgPalette(){return(0x3000000&this.fg)==0x1000000||(0x3000000&this.fg)==0x2000000}isBgPalette(){return(0x3000000&this.bg)==0x1000000||(0x3000000&this.bg)==0x2000000}isFgDefault(){return(0x3000000&this.fg)==0}isBgDefault(){return(0x3000000&this.bg)==0}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(0x3000000&this.fg){case 0x1000000:case 0x2000000:return 255&this.fg;case 0x3000000:return 0xffffff&this.fg;default:return -1}}getBgColor(){switch(0x3000000&this.bg){case 0x1000000:case 0x2000000:return 255&this.bg;case 0x3000000:return 0xffffff&this.bg;default:return -1}}hasExtendedAttrs(){return 0x10000000&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-0x10000001:this.bg|=0x10000000}getUnderlineColor(){if(0x10000000&this.bg&&~this.extended.underlineColor)switch(0x3000000&this.extended.underlineColor){case 0x1000000:case 0x2000000:return 255&this.extended.underlineColor;case 0x3000000:return 0xffffff&this.extended.underlineColor}return this.getFgColor()}getUnderlineColorMode(){return 0x10000000&this.bg&&~this.extended.underlineColor?0x3000000&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x3000000:this.isFgRGB()}isUnderlineColorPalette(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x1000000||(0x3000000&this.extended.underlineColor)==0x2000000:this.isFgPalette()}isUnderlineColorDefault(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 0x10000000&this.fg?0x10000000&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},cr=class e{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?-0x1c000001&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(0x1c000000&this._ext)>>26}set underlineStyle(e){this._ext&=-0x1c000001,this._ext|=e<<26&0x1c000000}get underlineColor(){return 0x3ffffff&this._ext}set underlineColor(e){this._ext&=-0x4000000,this._ext|=0x3ffffff&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(0xe0000000&this._ext)>>29;return e<0?0xfffffff8^e:e}set underlineVariantOffset(e){this._ext&=0x1fffffff,this._ext|=e<<29&0xe0000000}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},cs=class e extends cn{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new cr,this.combinedData=""}static fromCharData(i){let n=new e;return n.setFromCharData(i),n}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?l7(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(2===e[1].length){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},co="di$target",ca="di$dependencies",cl=new Map;function cc(e){if(cl.has(e))return cl.get(e);let i=function(e,n,r){var s,o,a;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");s=i,o=e,a=r,o[co]===o?o[ca].push({id:s,index:a}):(o[ca]=[{id:s,index:a}],o[co]=o)};return i._id=e,cl.set(e,i),i}var cd=cc("BufferService"),ch=cc("CoreMouseService"),cu=cc("CoreService"),cp=cc("CharsetService"),cf=cc("InstantiationService"),cm=cc("LogService"),cg=cc("OptionsService"),cv=cc("OscLinkService"),cy=cc("UnicodeService"),c_=cc("DecorationService"),cx=class{constructor(e,i,n){this._bufferService=e,this._optionsService=i,this._oscLinkService=n}provideLinks(e,i){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void i(void 0);let r=[],s=this._optionsService.rawOptions.linkHandler,o=new cs,a=n.getTrimmedLength(),l=-1,c=-1,d=!1;for(let i=0;i<a;i++)if(!(-1===c&&!n.hasContent(i))){if(n.loadCell(i,o),o.hasExtendedAttrs()&&o.extended.urlId)if(-1===c){c=i,l=o.extended.urlId;continue}else d=o.extended.urlId!==l;else -1!==c&&(d=!0);if(d||-1!==c&&i===a-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let o={start:{x:c+1,y:e},end:{x:i+ +(!d&&i===a-1),y:e}},l=!1;if(!s?.allowNonHttpProtocols)try{let e=new URL(n);["http:","https:"].includes(e.protocol)||(l=!0)}catch{l=!0}l||r.push({text:n,range:o,activate:(e,i)=>s?s.activate(e,i,o):function(e){if(confirm(`Do you want to navigate to ${e}?
10
+
11
+ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}(i),hover:(e,i)=>s?.hover?.(e,i,o),leave:(e,i)=>s?.leave?.(e,i,o)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(c=i,l=o.extended.urlId):(c=-1,l=-1)}}i(r)}};cx=l2([l5(0,cd),l5(1,cg),l5(2,cv)],cx);var cb=cc("CharSizeService"),cw=cc("CoreBrowserService"),cS=cc("MouseService"),ck=cc("RenderService"),cC=cc("SelectionService"),cT=cc("CharacterJoinerService"),cE=cc("ThemeService"),cD=cc("LinkProviderService"),cN=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?cA.isErrorNoTelemetry(e)?new cA(e.message+`
12
+
13
+ `+e.stack):Error(e.message+`
14
+
15
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function cM(e){var i;(i=e)instanceof cR||i instanceof Error&&i.name===cO&&i.message===cO||cN.onUnexpectedError(e)}var cO="Canceled",cR=class extends Error{constructor(){super(cO),this.name=this.message}},cA=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(i){if(i instanceof e)return i;let n=new e;return n.message=i.message,n.stack=i.stack,n}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}},cL=class e extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,e.prototype)}};function cj(e,i=0){return e[e.length-(1+i)]}(dg=dk||={}).isLessThan=function(e){return e<0},dg.isLessThanOrEqual=function(e){return e<=0},dg.isGreaterThan=function(e){return e>0},dg.isNeitherLessOrGreaterThan=function(e){return 0===e},dg.greaterThan=1,dg.lessThan=-1,dg.neitherLessOrGreaterThan=0;var cI=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(i=>(e(i),!0))}toArray(){let e=[];return this.iterate(i=>(e.push(i),!0)),e}filter(i){return new e(e=>this.iterate(n=>!i(n)||e(n)))}map(i){return new e(e=>this.iterate(n=>e(i(n))))}some(e){let i=!1;return this.iterate(n=>!(i=e(n))),i}findFirst(e){let i;return this.iterate(n=>!e(n)||(i=n,!1)),i}findLast(e){let i;return this.iterate(n=>(e(n)&&(i=n),!0)),i}findLastMaxBy(e){let i,n=!0;return this.iterate(r=>((n||dk.isGreaterThan(e(r,i)))&&(n=!1,i=r),!0)),i}};cI.empty=new cI(e=>{});function cP(e){}function cB(e,i){}function cz(e){if(dC.is(e)){let i=[];for(let n of e)if(n)try{n.dispose()}catch(e){i.push(e)}if(1===i.length)throw i[0];if(i.length>1)throw AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function cF(e){let i={dispose:function(e,i){let n=this,r=!1,s;return function(){if(r)return s;if(r=!0,i)try{s=e.apply(n,arguments)}finally{i()}else s=e.apply(n,arguments);return s}}(()=>{cP(i),e()})};return i}(e=>{function i(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=i;let n=Object.freeze([]);function*r(e){yield e}e.empty=function(){return n},e.single=r,e.wrap=function(e){return i(e)?e:r(e)},e.from=function(e){return e||n},e.reverse=function*(e){for(let i=e.length-1;i>=0;i--)yield e[i]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,i){let n=0;for(let r of e)if(i(r,n++))return!0;return!1},e.find=function(e,i){for(let n of e)if(i(n))return n},e.filter=function*(e,i){for(let n of e)i(n)&&(yield n)},e.map=function*(e,i){let n=0;for(let r of e)yield i(r,n++)},e.flatMap=function*(e,i){let n=0;for(let r of e)yield*i(r,n++)},e.concat=function*(...e){for(let i of e)yield*i},e.reduce=function(e,i,n){let r=n;for(let n of e)r=i(r,n);return r},e.slice=function*(e,i,n=e.length){for(i<0&&(i+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);i<n;i++)yield e[i]},e.consume=function(i,n=1/0){let r=[];if(0===n)return[r,i];let s=i[Symbol.iterator]();for(let i=0;i<n;i++){let i=s.next();if(i.done)return[r,e.empty()];r.push(i.value)}return[r,{[Symbol.iterator]:()=>s}]},e.asyncToArray=async function(e){let i=[];for await(let n of e)i.push(n);return Promise.resolve(i)}})(dC||={});var cH=class e{constructor(){var e;this._toDispose=new Set,this._isDisposed=!1,e=this}dispose(){this._isDisposed||(cP(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{cz(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw Error("Cannot register a disposable on itself!");return cB(i,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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}delete(e){if(e){if(e===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),cB(e,null))}};cH.DISABLE_DISPOSED_WARNING=!1;var cW=cH,c$=class{constructor(){var e;this._store=new cW,e=this,cB(this._store,this)}dispose(){cP(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};c$.None=Object.freeze({dispose(){}});var cU=class{constructor(){var e;this._isDisposed=!1,e=this}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&cB(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,cP(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&cB(e,null),e}},cV="object"==typeof window?window:globalThis,cq=class e{constructor(i){this.element=i,this.next=e.Undefined,this.prev=e.Undefined}};cq.Undefined=new cq(void 0);var cK=class{constructor(){this._first=cq.Undefined,this._last=cq.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===cq.Undefined}clear(){let e=this._first;for(;e!==cq.Undefined;){let i=e.next;e.prev=cq.Undefined,e.next=cq.Undefined,e=i}this._first=cq.Undefined,this._last=cq.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let n=new cq(e);if(this._first===cq.Undefined)this._first=n,this._last=n;else if(i){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==cq.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==cq.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==cq.Undefined&&e.next!==cq.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===cq.Undefined&&e.next===cq.Undefined?(this._first=cq.Undefined,this._last=cq.Undefined):e.next===cq.Undefined?(this._last=this._last.prev,this._last.next=cq.Undefined):e.prev===cq.Undefined&&(this._first=this._first.next,this._first.prev=cq.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==cq.Undefined;)yield e.element,e=e.next}},cY=globalThis.performance&&"function"==typeof globalThis.performance.now,cX=class e{static create(i){return new e(i)}constructor(e){this._now=cY&&!1===e?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return -1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function i(e){}function n(e){return(i,n=null,r)=>{let s=!1,o;return o=e(e=>{if(!s)return o?o.dispose():s=!0,i.call(n,e)},null,r),s&&o.dispose(),o}}function r(e,i,n){return o((n,r=null,s)=>e(e=>n.call(r,i(e)),null,s),n)}function s(e,i,n){return o((n,r=null,s)=>e(e=>i(e)&&n.call(r,e),null,s),n)}function o(e,n){let r,s={onWillAddFirstListener(){r=e(o.fire,o)},onDidRemoveLastListener(){r?.dispose()}};n||i(s);let o=new dA(s);return n?.add(o),o.event}function a(e,n,r=100,s=!1,o=!1,l,c){let d,h,u,p=0,f,m={leakWarningThreshold:l,onWillAddFirstListener(){d=e(e=>{p++,h=n(h,e),s&&!u&&(g.fire(h),h=void 0),f=()=>{let e=h;h=void 0,u=void 0,(!s||p>1)&&g.fire(e),p=0},"number"==typeof r?(clearTimeout(u),u=setTimeout(f,r)):void 0===u&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){o&&p>0&&f?.()},onDidRemoveLastListener(){f=void 0,d.dispose()}};c||i(m);let g=new dA(m);return c?.add(g),g.event}e.None=()=>c$.None,e.defer=function(e,i){return a(e,()=>{},0,void 0,!0,void 0,i)},e.once=n,e.map=r,e.forEach=function(e,i,n){return o((n,r=null,s)=>e(e=>{i(e),n.call(r,e)},null,s),n)},e.filter=s,e.signal=function(e){return e},e.any=function(...e){return(i,n=null,r)=>{var s,o;return s=function(...e){let i=cF(()=>cz(e));return i}(...e.map(e=>e(e=>i.call(n,e)))),(o=r)instanceof Array?o.push(s):o&&o.add(s),s}},e.reduce=function(e,i,n,s){let o=n;return r(e,e=>o=i(o,e),s)},e.debounce=a,e.accumulate=function(i,n=0,r){return e.debounce(i,(e,i)=>e?(e.push(i),e):[i],n,void 0,!0,void 0,r)},e.latch=function(e,i=(e,i)=>e===i,n){let r=!0,o;return s(e,e=>{let n=r||!i(e,o);return r=!1,o=e,n},n)},e.split=function(i,n,r){return[e.filter(i,n,r),e.filter(i,e=>!n(e),r)]},e.buffer=function(e,i=!1,n=[],r){let s=n.slice(),o=e(e=>{s?s.push(e):l.fire(e)});r&&r.add(o);let a=()=>{s?.forEach(e=>l.fire(e)),s=null},l=new dA({onWillAddFirstListener(){o||(o=e(e=>l.fire(e)),r&&r.add(o))},onDidAddFirstListener(){s&&(i?setTimeout(a):a())},onDidRemoveLastListener(){o&&o.dispose(),o=null}});return r&&r.add(l),l.event},e.chain=function(e,i){return(n,r,s)=>{let o=i(new c);return e(function(e){let i=o.evaluate(e);i!==l&&n.call(r,i)},void 0,s)}};let l=Symbol("HaltChainable");class c{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(i=>(e(i),i)),this}filter(e){return this.steps.push(i=>e(i)?i:l),this}reduce(e,i){let n=i;return this.steps.push(i=>n=e(n,i)),this}latch(e=(e,i)=>e===i){let i=!0,n;return this.steps.push(r=>{let s=i||!e(r,n);return i=!1,n=r,s?r:l}),this}evaluate(e){for(let i of this.steps)if((e=i(e))===l)break;return e}}e.fromNodeEventEmitter=function(e,i,n=e=>e){let r=(...e)=>s.fire(n(...e)),s=new dA({onWillAddFirstListener:()=>e.on(i,r),onDidRemoveLastListener:()=>e.removeListener(i,r)});return s.event},e.fromDOMEventEmitter=function(e,i,n=e=>e){let r=(...e)=>s.fire(n(...e)),s=new dA({onWillAddFirstListener:()=>e.addEventListener(i,r),onDidRemoveLastListener:()=>e.removeEventListener(i,r)});return s.event},e.toPromise=function(e){return new Promise(i=>n(e)(i))},e.fromPromise=function(e){let i=new dA;return e.then(e=>{i.fire(e)},()=>{i.fire(void 0)}).finally(()=>{i.dispose()}),i.event},e.forward=function(e,i){return e(e=>i.fire(e))},e.runAndSubscribe=function(e,i,n){return i(n),e(e=>i(e))};class d{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||i(r),this.emitter=new dA(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,i){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,i){return new d(e,i).emitter.event},e.fromObservableLight=function(e){return(i,n,r)=>{let s=0,o=!1,a={beginUpdate(){s++},endUpdate(){0==--s&&(e.reportChanges(),o&&(o=!1,i.call(n)))},handlePossibleChange(){},handleChange(){o=!0}};e.addObserver(a),e.reportChanges();let l={dispose(){e.removeObserver(a)}};return r instanceof cW?r.add(l):Array.isArray(r)&&r.push(l),l}}})(dT||={});var cJ=class e{constructor(i){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${i}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new cX,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};cJ.all=new Set,cJ._idPool=0;var cG=class e{constructor(i,n,r=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let n=this.threshold;if(n<=0||i<n)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*n;let[e,r]=this.getMostFrequentStack(),s=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${r}):`;console.warn(s),console.warn(e);let o=new dN(s,e);this._errorHandler(o)}return()=>{let i=this._stacks.get(e.value)||0;this._stacks.set(e.value,i-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[n,r]of this._stacks)(!e||i<r)&&(e=[n,r],i=r);return e}};cG._idPool=1;var cZ,cQ,c0,c1,c2,c5,c3,c4,c6,c8,c9,c7,de,dt,di,dn,dr,ds,da,dl,dc,dd,dh,du,dp,df,dm,dg,dv,dy,d_,dx,db,dw,dS,dk,dC,dT,dE,dD=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??"")}print(){console.warn(this.value.split(`
16
+ `).slice(2).join(`
17
+ `))}},dN=class extends Error{constructor(e,i){super(e),this.name="ListenerLeakError",this.stack=i}},dM=class extends Error{constructor(e,i){super(e),this.name="ListenerRefusalError",this.stack=i}},dO=0,dR=class{constructor(e){this.value=e,this.id=dO++}},dA=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new cG(e?.onListenerError??cM,this._options?.leakWarningThreshold??-1):void 0,this._perfMon=this._options?._profName?new cJ(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,i,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let i=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],n=new dM(`${e}. HINT: Stack shows most frequent listener (${i[1]}-times)`,i[0]);return(this._options?.onListenerError||cM)(n),c$.None}if(this._disposed)return c$.None;i&&(e=e.bind(i));let r=new dR(e),s;this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(r.stack=dD.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof dR?(this._deliveryQueue??=new dL,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=cF(()=>{dE?.unregister(o),s?.(),this._removeListener(r)});if(n instanceof cW?n.add(o):Array.isArray(n)&&n.push(o),dE){let e=Error().stack.split(`
18
+ `).slice(2,3).join(`
19
+ `).trim(),i=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);dE.register(o,i?.[2]??e,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,n=i.indexOf(e);if(-1===n)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,i[n]=void 0;let r=this._deliveryQueue.current===this;if(2*this._size<=i.length){let e=0;for(let n=0;n<i.length;n++)i[n]?i[e++]=i[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=e}}_deliver(e,i){if(!e)return;let n=this._options?.onListenerError||cM;try{e.value(i)}catch(e){n(e)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof dR)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},dL=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,n){this.i=0,this.end=n,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},dj=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new dA,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new dA,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};dj.INSTANCE=new dj,dj.INSTANCE.onDidChangeZoomLevel,dj.INSTANCE.onDidChangeFullscreen;var dI="object"==typeof navigator?navigator.userAgent:"",dP=dI.indexOf("Firefox")>=0,dB=dI.indexOf("AppleWebKit")>=0,dz=dI.indexOf("Chrome")>=0,dF=!dz&&dI.indexOf("Safari")>=0;dI.indexOf("Electron/"),dI.indexOf("Android");var dH=!1;if("function"==typeof cV.matchMedia){let e=cV.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=cV.matchMedia("(display-mode: fullscreen)");dH=e.matches,dW=e,"string"==typeof dW&&(dW=cV.matchMedia(dW)),dW.addEventListener("change",({matches:e})=>{dH&&i.matches||(dH=e)})}var dW,d$,dU,dV=!1,dq=!1,dK=!1,dY=!1,dX=!1,dJ="en",dG=globalThis;"u">typeof dG.vscode&&"u">typeof dG.vscode.process?dU=dG.vscode.process:"u">typeof rx.default&&"string"==typeof rx.default?.versions?.node&&(dU=rx.default);var dZ="string"==typeof dU?.versions?.electron&&dU?.type==="renderer";if("object"==typeof dU){dV="win32"===dU.platform,dq="darwin"===dU.platform,(dK="linux"===dU.platform)&&dU.env.SNAP&&dU.env.SNAP_REVISION,dU.env.CI||dU.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dJ="en";let e=dU.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);i.userLocale,i.osLocale,dJ=i.resolvedLanguage||"en",i.languagePack?.translationsConfigFile}catch{}dY=!0}else"object"!=typeof navigator||dZ?console.error("Unable to resolve platform."):(dV=(d$=navigator.userAgent).indexOf("Windows")>=0,dq=d$.indexOf("Macintosh")>=0,(d$.indexOf("Macintosh")>=0||d$.indexOf("iPad")>=0||d$.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,dK=d$.indexOf("Linux")>=0,d$?.indexOf("Mobi"),dX=!0,dJ=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());var dQ=dV,d0=dq,d1=dK,d2=dY;dX&&"function"==typeof dG.importScripts&&dG.origin;var d5,d3=d$,d4=dJ;(hs=d5||={}).value=function(){return d4},hs.isDefaultVariant=function(){return 2===d4.length?"en"===d4:d4.length>=3&&"e"===d4[0]&&"n"===d4[1]&&"-"===d4[2]},hs.isDefault=function(){return"en"===d4};var d6="function"==typeof dG.postMessage&&!dG.importScripts,d8=(()=>{if(d6){let e=[];dG.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let i=0;return n=>{let r=++i;e.push({id:r,callback:n}),dG.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})(),d9=!!(d3&&d3.indexOf("Chrome")>=0);d3&&d3.indexOf("Firefox"),!d9&&d3&&d3.indexOf("Safari"),d3&&d3.indexOf("Edg/"),d3&&d3.indexOf("Android");var d7="object"==typeof navigator?navigator:{};d2||document.queryCommandSupported&&document.queryCommandSupported("copy")||d7&&d7.clipboard&&d7.clipboard.writeText,d2||d7&&d7.clipboard&&d7.clipboard.readText,d2||dH||d7.keyboard,"ontouchstart"in cV||d7.maxTouchPoints,cV.PointerEvent&&("ontouchstart"in cV||navigator.maxTouchPoints);var he=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ht=new he,hi=new he,hn=new he,hr=Array(230);(ho=ha||={}).toString=function(e){return ht.keyCodeToStr(e)},ho.fromString=function(e){return ht.strToKeyCode(e)},ho.toUserSettingsUS=function(e){return hi.keyCodeToStr(e)},ho.toUserSettingsGeneral=function(e){return hn.keyCodeToStr(e)},ho.fromUserSettings=function(e){return hi.strToKeyCode(e)||hn.strToKeyCode(e)},ho.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ht.keyCodeToStr(e)};var hs,ho,ha,hl,hc=class e{constructor(e,i,n,r,s){this.ctrlKey=e,this.shiftKey=i,this.altKey=n,this.metaKey=r,this.keyCode=s}equals(i){return i instanceof e&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",n=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${e}${i}${n}${r}${this.keyCode}`}isModifierKey(){return 0===this.keyCode||5===this.keyCode||57===this.keyCode||6===this.keyCode||4===this.keyCode}toKeybinding(){return new hd([this])}isDuplicateModifierCase(){return this.ctrlKey&&5===this.keyCode||this.shiftKey&&4===this.keyCode||this.altKey&&6===this.keyCode||this.metaKey&&57===this.keyCode}},hd=class{constructor(e){if(0===e.length)throw function(e){return e?Error(`Illegal argument: ${e}`):Error("Illegal argument")}("chords");this.chords=e}getHashCode(){let e="";for(let i=0,n=this.chords.length;i<n;i++)0!==i&&(e+=";"),e+=this.chords[i].getHashCode();return e}equals(e){if(null===e||this.chords.length!==e.chords.length)return!1;for(let i=0;i<this.chords.length;i++)if(!this.chords[i].equals(e.chords[i]))return!1;return!0}},hh=d0?256:2048,hu=d0?2048:256,hp=class{constructor(e){this._standardKeyboardEventBrand=!0,this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=e.getModifierState?.("AltGraph"),this.keyCode=function(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return ha.fromString(i)}let i=e.keyCode;if(3===i)return 7;if(dP)switch(i){case 59:return 85;case 60:if(d1)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(d0)return 57}else if(dB&&(d0&&93===i||!d0&&92===i))return 57;return hr[i]||0}(e),this.code=e.code,this.ctrlKey=this.ctrlKey||5===this.keyCode,this.altKey=this.altKey||6===this.keyCode,this.shiftKey=this.shiftKey||4===this.keyCode,this.metaKey=this.metaKey||57===this.keyCode,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode);let i=0;return this.ctrlKey&&(i|=hh),this.altKey&&(i|=512),this.shiftKey&&(i|=1024),this.metaKey&&(i|=hu),i|=e}_computeKeyCodeChord(){let e=0;return 5!==this.keyCode&&4!==this.keyCode&&6!==this.keyCode&&57!==this.keyCode&&(e=this.keyCode),new hc(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},hf=new WeakMap,hm=class{static getSameOriginWindowChain(e){let i=hf.get(e);if(!i){i=[],hf.set(e,i);let n=e,r;do(r=function(e){if(!e.parent||e.parent===e)return null;try{let i=e.location,n=e.parent.location;if("null"!==i.origin&&"null"!==n.origin&&i.origin!==n.origin)return null}catch{return null}return e.parent}(n))?i.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):i.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return i.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,i){if(!i||e===i)return{top:0,left:0};let n=0,r=0;for(let s of this.getSameOriginWindowChain(e)){let e=s.window.deref();if(n+=e?.scrollY??0,r+=e?.scrollX??0,e===i||!s.iframeElement)break;let o=s.iframeElement.getBoundingClientRect();n+=o.top,r+=o.left}return{top:n,left:r}}},hg=class{constructor(e,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=0===i.button,this.middleButton=1===i.button,this.rightButton=2===i.button,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,"dblclick"===i.type&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,"number"==typeof i.pageX?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=hm.getPositionOfChildWindowRelativeToAncestorWindow(e,i.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},hv=class{constructor(e,i=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=i;let r=!1;if(dz){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let i=e.view?.devicePixelRatio||1;"u">typeof e.wheelDeltaY?r?this.deltaY=e.wheelDeltaY/(120*i):this.deltaY=e.wheelDeltaY/120:"u">typeof e.VERTICAL_AXIS&&e.axis===e.VERTICAL_AXIS?this.deltaY=-e.detail/3:"wheel"===e.type&&(e.deltaMode===e.DOM_DELTA_LINE?dP&&!d0?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40),"u">typeof e.wheelDeltaX?dF&&dQ?this.deltaX=-(e.wheelDeltaX/120):r?this.deltaX=e.wheelDeltaX/(120*i):this.deltaX=e.wheelDeltaX/120:"u">typeof e.HORIZONTAL_AXIS&&e.axis===e.HORIZONTAL_AXIS?this.deltaX=-e.detail/3:"wheel"===e.type&&(e.deltaMode===e.DOM_DELTA_LINE?dP&&!d0?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40),0===this.deltaY&&0===this.deltaX&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},hy=Object.freeze(function(e,i){let n=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(n)}}});(ul=hl||={}).isCancellationToken=function(e){return e===ul.None||e===ul.Cancelled||e instanceof h_||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},ul.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:dT.None}),ul.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:hy});var h_=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?hy:(this._emitter||(this._emitter=new dA),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};Symbol("MicrotaskDelay");var hx=class{constructor(e,i){this._isDisposed=!1,this._token=-1,"function"==typeof e&&"number"==typeof i&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){-1!==this._token&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new cL("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new cL("Calling 'setIfNotSet' on a disposed TimeoutTimer");-1===this._token&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},hb=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,i,n=globalThis){if(this.isDisposed)throw new cL("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},i);this.disposable=cF(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(uc=ud||={}).settled=async function(e){let i,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{i||(i=e)})));if("u">typeof i)throw i;return n},uc.withAsyncBody=function(e){return new Promise(async(i,n)=>{try{await e(i,n)}catch(e){n(e)}})};var hw=class e{static fromArray(i){return new e(e=>{e.emitMany(i)})}static fromPromise(i){return new e(async e=>{e.emitMany(await i)})}static fromPromises(i){return new e(async e=>{await Promise.all(i.map(async i=>e.emitOne(await i)))})}static merge(i){return new e(async e=>{await Promise.all(i.map(async i=>{for await(let n of i)e.emitOne(n)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new dA,queueMicrotask(async()=>{let i={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(i)),this.resolve()}catch(e){this.reject(e)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await dT.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,n){return new e(async e=>{for await(let r of i)e.emitOne(n(r))})}map(i){return e.map(this,i)}static filter(i,n){return new e(async e=>{for await(let r of i)n(r)&&e.emitOne(r)})}filter(i){return e.filter(this,i)}static coalesce(i){return e.filter(i,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let i=[];for await(let n of e)i.push(n);return i}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};hw.EMPTY=hw.fromArray([]);function hS(e,i){return(i<<5)-i+e|0}function hk(e,i){i=hS(149417,i);for(let n=0,r=e.length;n<r;n++)i=hS(e.charCodeAt(n),i);return i}new DataView(new ArrayBuffer(320));var{registerWindow:hC,getWindow:hT,getDocument:hE,getWindows:hD,getWindowsCount:hN,getWindowId:hM,getWindowById:hO,hasWindow:hR,onDidRegisterWindow:hA,onWillUnregisterWindow:hL,onDidUnregisterWindow:hj}=(r=new Map,s={window:cV,disposables:new cW},r.set(cV.vscodeWindowId,s),o=new dA,a=new dA,l=new dA,{onDidRegisterWindow:o.event,onWillUnregisterWindow:l.event,onDidUnregisterWindow:a.event,registerWindow(e){if(r.has(e.vscodeWindowId))return c$.None;let i=new cW,n={window:e,disposables:i.add(new cW)};return r.set(e.vscodeWindowId,n),i.add(cF(()=>{r.delete(e.vscodeWindowId),a.fire(e)})),i.add(hP(e,hW.BEFORE_UNLOAD,()=>{l.fire(e)})),o.fire(n),i},getWindows:()=>r.values(),getWindowsCount:()=>r.size,getWindowId:e=>e.vscodeWindowId,hasWindow:e=>r.has(e),getWindowById:function(e,i){return("number"==typeof e?r.get(e):void 0)??(i?s:void 0)},getWindow:e=>e?.ownerDocument?.defaultView?e.ownerDocument.defaultView.window:e?.view?e.view.window:cV,getDocument:e=>hT(e).document}),hI=class{constructor(e,i,n,r){this._node=e,this._type=i,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function hP(e,i,n,r){return new hI(e,i,n,r)}var hB=function(e,i,n,r){var s;let o=n;return"click"===i||"mousedown"===i||"contextmenu"===i?(s=hT(e),o=function(e){return n(new hg(s,e))}):("keydown"===i||"keypress"===i||"keyup"===i)&&(o=function(e){return n(new hp(e))}),hP(e,i,o,r)},hz=class extends hb{constructor(e){super(),this.defaultTarget=e&&hT(e)}cancelAndSet(e,i,n){return super.cancelAndSet(e,i,n??this.defaultTarget)}},hF=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){cM(e)}}static sort(e,i){return i.priority-e.priority}};c=new Map,d=new Map,h=new Map,u=new Map,uh=(e,i,n=0)=>{let r=hM(e),s=new hF(i,n),o=c.get(r);return o||(o=[],c.set(r,o)),o.push(s),h.get(r)||(h.set(r,!0),e.requestAnimationFrame(()=>(e=>{h.set(e,!1);let i=c.get(e)??[];for(d.set(e,i),c.set(e,[]),u.set(e,!0);i.length>0;)i.sort(hF.sort),i.shift().execute();u.set(e,!1)})(r))),s};var hH=class e{constructor(e,i){this.width=e,this.height=i}with(i=this.width,n=this.height){return i!==this.width||n!==this.height?new e(i,n):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(i){return i instanceof e?i:new e(i.width,i.height)}static equals(e,i){return e===i||!!e&&!!i&&e.width===i.width&&e.height===i.height}};hH.None=new hH(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,i,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let s=function e(i,n){switch(typeof i){case"object":var r,s,o,a;return null===i?hS(349,n):Array.isArray(i)?(r=i,s=hS(104579,s=n),r.reduce((i,n)=>e(n,i),s)):(o=i,a=hS(181387,a=n),Object.keys(o).sort().reduce((i,n)=>(i=hk(n,i),e(o[n],i)),a));case"string":return hk(i,n);case"boolean":return hS(i?433:863,n);case"number":return hS(i,n);case"undefined":return hS(937,n);default:return hS(617,n)}}(n,0),o=r.get(s);if(o)o.users+=1;else{let a=new dA,l=new MutationObserver(e=>a.fire(e));l.observe(e,n);let c=o={users:1,observer:l,onDidMutate:a.event};i.add(cF(()=>{c.users-=1,0===c.users&&(a.dispose(),l.disconnect(),r?.delete(s),r?.size===0&&this.mutationObservers.delete(e))})),r.set(s,o)}return o.onDidMutate}};var hW={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},h$=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let i=hU(e);this._maxWidth!==i&&(this._maxWidth=i,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let i=hU(e);this._width!==i&&(this._width=i,this.domNode.style.width=this._width)}setHeight(e){let i=hU(e);this._height!==i&&(this._height=i,this.domNode.style.height=this._height)}setTop(e){let i=hU(e);this._top!==i&&(this._top=i,this.domNode.style.top=this._top)}setLeft(e){let i=hU(e);this._left!==i&&(this._left=i,this.domNode.style.left=this._left)}setBottom(e){let i=hU(e);this._bottom!==i&&(this._bottom=i,this.domNode.style.bottom=this._bottom)}setRight(e){let i=hU(e);this._right!==i&&(this._right=i,this.domNode.style.right=this._right)}setPaddingTop(e){let i=hU(e);this._paddingTop!==i&&(this._paddingTop=i,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let i=hU(e);this._paddingLeft!==i&&(this._paddingLeft=i,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let i=hU(e);this._paddingBottom!==i&&(this._paddingBottom=i,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let i=hU(e);this._paddingRight!==i&&(this._paddingRight=i,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let i=hU(e);this._fontSize!==i&&(this._fontSize=i,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let i=hU(e);this._lineHeight!==i&&(this._lineHeight=i,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let i=hU(e);this._letterSpacing!==i&&(this._letterSpacing=i,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,i){this.domNode.classList.toggle(e,i),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,i){this.domNode.setAttribute(e,i)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function hU(e){return"number"==typeof e?`${e}px`:e}function hV(e){return new h$(e)}var hq=class{constructor(){this._hooks=new cW,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,n,r,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=s;let o=e;try{e.setPointerCapture(i),this._hooks.add(cF(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{o=hT(e)}this._hooks.add(hP(o,hW.POINTER_MOVE,e=>{e.buttons!==n?this.stopMonitoring(!0):(e.preventDefault(),this._pointerMoveCallback(e))})),this._hooks.add(hP(o,hW.POINTER_UP,e=>this.stopMonitoring(!0)))}};(p=uu||={}).Tap="-xterm-gesturetap",p.Change="-xterm-gesturechange",p.Start="-xterm-gesturestart",p.End="-xterm-gesturesend",p.Contextmenu="-xterm-gesturecontextmenu";var hK=class e extends c${constructor(){super(),this.dispatched=!1,this.targets=new cK,this.ignoreTargets=new cK,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(dT.runAndSubscribe(hA,({window:e,disposables:i})=>{i.add(hP(e.document,"touchstart",e=>this.onTouchStart(e),{passive:!1})),i.add(hP(e.document,"touchend",i=>this.onTouchEnd(e,i))),i.add(hP(e.document,"touchmove",e=>this.onTouchMove(e),{passive:!1}))},{window:cV,disposables:this._store}))}static addTarget(i){return e.isTouchDevice()?(e.INSTANCE||(e.INSTANCE=new e),cF(e.INSTANCE.targets.push(i))):c$.None}static ignoreTarget(i){return e.isTouchDevice()?(e.INSTANCE||(e.INSTANCE=new e),cF(e.INSTANCE.ignoreTargets.push(i))):c$.None}static isTouchDevice(){return"ontouchstart"in cV||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:i,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[i],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let s=this.newGestureEvent(uu.Start,r.target);s.pageX=r.pageX,s.pageY=r.pageY,this.dispatchEvent(s)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(i,n){let r=Date.now(),s=Object.keys(this.activeTouches).length;for(let o=0,a=n.changedTouches.length;o<a;o++){let a=n.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],c=Date.now()-l.initialTimeStamp;if(c<e.HOLD_DELAY&&30>Math.abs(l.initialPageX-cj(l.rollingPageX))&&30>Math.abs(l.initialPageY-cj(l.rollingPageY))){let e=this.newGestureEvent(uu.Tap,l.initialTarget);e.pageX=cj(l.rollingPageX),e.pageY=cj(l.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&30>Math.abs(l.initialPageX-cj(l.rollingPageX))&&30>Math.abs(l.initialPageY-cj(l.rollingPageY))){let e=this.newGestureEvent(uu.Contextmenu,l.initialTarget);e.pageX=cj(l.rollingPageX),e.pageY=cj(l.rollingPageY),this.dispatchEvent(e)}else if(1===s){let e=cj(l.rollingPageX),n=cj(l.rollingPageY),s=cj(l.rollingTimestamps)-l.rollingTimestamps[0],o=e-l.rollingPageX[0],a=n-l.rollingPageY[0],c=[...this.targets].filter(e=>l.initialTarget instanceof Node&&e.contains(l.initialTarget));this.inertia(i,c,r,Math.abs(o)/s,o>0?1:-1,e,Math.abs(a)/s,a>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(uu.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let n=document.createEvent("CustomEvent");return n.initEvent(e,!1,!0),n.initialTarget=i,n.tapCount=0,n}dispatchEvent(i){if(i.type===uu.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,i.tapCount=r}else(i.type===uu.Change||i.type===uu.Contextmenu)&&(this._lastSetTapCountTime=0);if(i.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(i.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(i.initialTarget)){let r=0,s=i.initialTarget;for(;s&&s!==n;)r++,s=s.parentElement;e.push([r,n])}for(let[n,r]of(e.sort((e,i)=>e[0]-i[0]),e))r.dispatchEvent(i),this.dispatched=!0}}inertia(i,n,r,s,o,a,l,c,d){this.handle=uh(i,()=>{let h=Date.now(),u=h-r,p=0,f=0,m=!0;s+=e.SCROLL_FRICTION*u,l+=e.SCROLL_FRICTION*u,s>0&&(m=!1,p=o*s*u),l>0&&(m=!1,f=c*l*u);let g=this.newGestureEvent(uu.Change);g.translationX=p,g.translationY=f,n.forEach(e=>e.dispatchEvent(g)),m||this.inertia(i,n,h,s,o,a+p,l,c,d+f)})}onTouchMove(e){let i=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn("end of an UNKNOWN touch",r);continue}let s=this.activeTouches[r.identifier],o=this.newGestureEvent(uu.Change,s.initialTarget);o.translationX=r.pageX-cj(s.rollingPageX),o.translationY=r.pageY-cj(s.rollingPageY),o.pageX=r.pageX,o.pageY=r.pageY,this.dispatchEvent(o),s.rollingPageX.length>3&&(s.rollingPageX.shift(),s.rollingPageY.shift(),s.rollingTimestamps.shift()),s.rollingPageX.push(r.pageX),s.rollingPageY.push(r.pageY),s.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};hK.SCROLL_FRICTION=-.005,hK.HOLD_DELAY=700,hK.CLEAR_TAP_COUNT_TIME=400,l2([function(e,i,n){let r=null,s=null;if("function"==typeof n.value?(r="value",0!==(s=n.value).length&&console.warn("Memoize should only be used in functions with zero parameters")):"function"==typeof n.get&&(r="get",s=n.get),!s)throw Error("not supported");let o=`$memoize$${i}`;n[r]=function(...e){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,e)}),this[o]}}],hK,"isTouchDevice",1);var hY=class extends c${onclick(e,i){this._register(hP(e,hW.CLICK,n=>i(new hg(hT(e),n))))}onmousedown(e,i){this._register(hP(e,hW.MOUSE_DOWN,n=>i(new hg(hT(e),n))))}onmouseover(e,i){this._register(hP(e,hW.MOUSE_OVER,n=>i(new hg(hT(e),n))))}onmouseleave(e,i){this._register(hP(e,hW.MOUSE_LEAVE,n=>i(new hg(hT(e),n))))}onkeydown(e,i){this._register(hP(e,hW.KEY_DOWN,e=>i(new hp(e))))}onkeyup(e,i){this._register(hP(e,hW.KEY_UP,e=>i(new hp(e))))}oninput(e,i){this._register(hP(e,hW.INPUT,i))}onblur(e,i){this._register(hP(e,hW.BLUR,i))}onfocus(e,i){this._register(hP(e,hW.FOCUS,i))}onchange(e,i){this._register(hP(e,hW.CHANGE,i))}ignoreGesture(e){return hK.ignoreTarget(e)}},hX=class extends hY{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px","u">typeof e.top&&(this.bgDomNode.style.top="0px"),"u">typeof e.left&&(this.bgDomNode.style.left="0px"),"u">typeof e.bottom&&(this.bgDomNode.style.bottom="0px"),"u">typeof e.right&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width="11px",this.domNode.style.height="11px","u">typeof e.top&&(this.domNode.style.top=e.top+"px"),"u">typeof e.left&&(this.domNode.style.left=e.left+"px"),"u">typeof e.bottom&&(this.domNode.style.bottom=e.bottom+"px"),"u">typeof e.right&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new hq),this._register(hB(this.bgDomNode,hW.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(hB(this.domNode,hW.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new hz),this._pointerdownScheduleRepeatTimer=this._register(new hx)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,hT(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(i,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},hJ=class e{constructor(e,i,n,r,s,o,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i|=0,n|=0,r|=0,s|=0,o|=0,a|=0),this.rawScrollLeft=r,this.rawScrollTop=a,i<0&&(i=0),r+i>n&&(r=n-i),r<0&&(r=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=i,this.scrollWidth=n,this.scrollLeft=r,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(i,n){return new e(this._forceIntegerValues,"u">typeof i.width?i.width:this.width,"u">typeof i.scrollWidth?i.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,"u">typeof i.height?i.height:this.height,"u">typeof i.scrollHeight?i.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new e(this._forceIntegerValues,this.width,this.scrollWidth,"u">typeof i.scrollLeft?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,"u">typeof i.scrollTop?i.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},hG=class extends c${constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new dA),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new hJ(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,i){let n=this._state.withScrollDimensions(e,i);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(e);if(this._smoothScrolling){let n;e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;n=i?new h0(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=h0.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),i=this._state.withScrollPosition(e);if(this._setState(i,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,i){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,i)))}},hZ=class{constructor(e,i,n){this.scrollLeft=e,this.scrollTop=i,this.isDone=n}};function hQ(e,i){let n=i-e;return function(i){return e+n*(1-Math.pow(1-i,3))}}var h0=class e{constructor(e,i,n,r){this.from=e,this.to=i,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,i,n){if(Math.abs(e-i)>2.5*n){var r,s;let o,a;return e<i?(o=e+.75*n,a=i-.75*n):(o=e-.75*n,a=i+.75*n),r=hQ(e,o),s=hQ(a,i),function(e){return e<.33?r(e/.33):s((e-.33)/(1-.33))}}return hQ(e,i)}dispose(){null!==this.animationFrameDisposable&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;return i<1?new hZ(this.scrollLeft(i),this.scrollTop(i),!1):new hZ(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,n,r){return e.start(i,n,r)}static start(i,n,r){return r+=10,new e(i,n,Date.now()-10,r)}},h1=class extends c${constructor(e,i,n){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new hx)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||this._rawShouldBeVisible)}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},h2=class extends hY{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new h1(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new hq),this._shouldRender=!0,this.domNode=hV(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(hP(this.domNode.domNode,hW.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let i=this._register(new hX(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,n,r){this.slider=hV(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),"number"==typeof n&&this.slider.setWidth(n),"number"==typeof r&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(hP(this.slider.domNode,hW.POINTER_DOWN,e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let i=this.domNode.domNode.getClientRects()[0].top,n=i+this._scrollbarState.getSliderPosition(),r=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);n<=s&&s<=r?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,n;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)i=e.offsetX,n=e.offsetY;else{var r;let s,o,a=(s=(r=this.domNode.domNode).getBoundingClientRect(),o=hT(r),{left:s.left+o.scrollX,top:s.top+o.scrollY,width:s.width,height:s.height});i=e.pageX-a.left,n=e.pageY-a.top}let s=this._pointerDownRelativePosition(i,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let s=Math.abs(this._sliderOrthogonalPointerPosition(e)-n);if(dQ&&s>140)return void this._setDesiredScrollPositionNow(r.getScrollPosition());let o=this._sliderPointerPosition(e)-i;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},h5=class e{constructor(e,i,n,r,s,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i&&(this._visibleSize=i,this._refreshComputedValues(),!0)}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i&&(this._scrollSize=i,this._refreshComputedValues(),!0)}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i&&(this._scrollPosition=i,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,n,r,s){let o=Math.max(0,n-e),a=Math.max(0,o-2*i),l=r>0&&r>n;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*a/r))),d=(a-c)/(r-n);return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:d,computedSliderPosition:Math.round(s*d)}}_refreshComputedValues(){let i=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){return this._computedIsNeeded?Math.round((e-this._arrowSize-this._computedSliderSize/2)/this._computedSliderRatio):0}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,n=this._scrollPosition;return i<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){return this._computedIsNeeded?Math.round((this._computedSliderPosition+e)/this._computedSliderRatio):0}},h3=class extends h2{constructor(e,i,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:n,scrollbarState:new h5(i.horizontalHasArrows?i.arrowSize:0,2===i.horizontal?0:i.horizontalScrollbarSize,2===i.vertical?0:i.verticalScrollbarSize,r.width,r.scrollWidth,s.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}updateOptions(e){this.updateScrollbarSize(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},h4=class extends h2{constructor(e,i,n){let r=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:n,scrollbarState:new h5(i.verticalHasArrows?i.arrowSize:0,2===i.vertical?0:i.verticalScrollbarSize,0,r.height,r.scrollHeight,s.scrollTop),visibility:i.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:i.scrollByPage}),i.verticalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((i.verticalScrollbarSize-i.verticalSliderSize)/2),i.verticalSliderSize,void 0)}_updateSlider(e,i){this.slider.setHeight(e),this.slider.setTop(i)}_renderDomNode(e,i){this.domNode.setWidth(i),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return i}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,i){e.scrollTop=i}updateOptions(e){this.updateScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},h6=class{constructor(e,i,n){this.timestamp=e,this.deltaX=i,this.deltaY=n,this.score=0}},h8=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(-1===this._front&&-1===this._rear)return!1;let e=1,i=0,n=1,r=this._rear;for(;;){let s=r===this._front?e:Math.pow(2,-n);if(e-=s,i+=this._memory[r].score*s,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}return i<=.5}acceptStandardWheelEvent(e){if(dz){var i;let n=(i=hT(e.browserEvent),dj.INSTANCE.getZoomFactor(i));this.accept(Date.now(),e.deltaX*n,e.deltaY*n)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,n){let r=null,s=new h6(e,i,n);-1===this._front&&-1===this._rear?(this._memory[0]=s,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,r)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if(this._isAlmostInt(e.deltaX)&&this._isAlmostInt(e.deltaY)||(n+=.25),i){let r=Math.abs(e.deltaX),s=Math.abs(e.deltaY),o=Math.abs(i.deltaX),a=Math.abs(i.deltaY),l=Math.max(Math.min(r,o),1),c=Math.max(Math.min(s,a),1),d=Math.max(s,a);Math.max(r,o)%l==0&&d%c==0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return .01>Math.abs(Math.round(e)-e)}};h8.INSTANCE=new h8;var h9=class extends hY{constructor(e,i,n){super(),this._onScroll=this._register(new dA),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new dA),this.onWillScroll=this._onWillScroll.event,this._options=function(e){let i={lazyRender:"u">typeof e.lazyRender&&e.lazyRender,className:"u">typeof e.className?e.className:"",useShadows:!("u">typeof e.useShadows)||e.useShadows,handleMouseWheel:!("u">typeof e.handleMouseWheel)||e.handleMouseWheel,flipAxes:"u">typeof e.flipAxes&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:"u">typeof e.consumeMouseWheelIfScrollbarIsNeeded&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:"u">typeof e.alwaysConsumeMouseWheel&&e.alwaysConsumeMouseWheel,scrollYToX:"u">typeof e.scrollYToX&&e.scrollYToX,mouseWheelScrollSensitivity:"u">typeof e.mouseWheelScrollSensitivity?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:"u">typeof e.fastScrollSensitivity?e.fastScrollSensitivity:5,scrollPredominantAxis:!("u">typeof e.scrollPredominantAxis)||e.scrollPredominantAxis,mouseWheelSmoothScroll:!("u">typeof e.mouseWheelSmoothScroll)||e.mouseWheelSmoothScroll,arrowSize:"u">typeof e.arrowSize?e.arrowSize:11,listenOnDomNode:"u">typeof e.listenOnDomNode?e.listenOnDomNode:null,horizontal:"u">typeof e.horizontal?e.horizontal:1,horizontalScrollbarSize:"u">typeof e.horizontalScrollbarSize?e.horizontalScrollbarSize:10,horizontalSliderSize:"u">typeof e.horizontalSliderSize?e.horizontalSliderSize:0,horizontalHasArrows:"u">typeof e.horizontalHasArrows&&e.horizontalHasArrows,vertical:"u">typeof e.vertical?e.vertical:1,verticalScrollbarSize:"u">typeof e.verticalScrollbarSize?e.verticalScrollbarSize:10,verticalHasArrows:"u">typeof e.verticalHasArrows&&e.verticalHasArrows,verticalSliderSize:"u">typeof e.verticalSliderSize?e.verticalSliderSize:0,scrollByPage:"u">typeof e.scrollByPage&&e.scrollByPage};return i.horizontalSliderSize="u">typeof e.horizontalSliderSize?e.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize="u">typeof e.verticalSliderSize?e.verticalSliderSize:i.verticalScrollbarSize,d0&&(i.className+=" mac"),i}(i),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new h4(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new h3(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=hV(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=hV(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=hV(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new hx),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=cz(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,d0&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){"u">typeof e.handleMouseWheel&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),"u">typeof e.mouseWheelScrollSensitivity&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),"u">typeof e.fastScrollSensitivity&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),"u">typeof e.scrollPredominantAxis&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),"u">typeof e.horizontal&&(this._options.horizontal=e.horizontal),"u">typeof e.vertical&&(this._options.vertical=e.vertical),"u">typeof e.horizontalScrollbarSize&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),"u">typeof e.verticalScrollbarSize&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),"u">typeof e.scrollByPage&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new hv(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=cz(this._mouseWheelToDispose),e)){let e=e=>{this._onMouseWheel(new hv(e))};this._mouseWheelToDispose.push(hP(this._listenOnDomNode,hW.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=h8.INSTANCE;i.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+r===0?s=r=0:Math.abs(r)>=Math.abs(s)?s=0:r=0),this._options.flipAxes&&([r,s]=[s,r]);let o=!d0&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!s&&(s=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(s*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),l={};if(r){let e=50*r,i=a.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(l,i)}if(s){let e=50*s,i=a.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(l,i)}l=this._scrollable.validateScrollPosition(l),(a.scrollLeft!==l.scrollLeft||a.scrollTop!==l.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(l):this._scrollable.setScrollPositionNow(l),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),i=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",s=i?" top":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${n||i?" top-left-corner":""}${s}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){this._mouseIsOver||this._isDragging||(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){this._mouseIsOver||this._isDragging||this._hideTimeout.cancelAndSet(()=>this._hide(),500)}},h7=class extends h9{constructor(e,i,n){super(e,i,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},ue=class extends c${constructor(e,i,n,r,s,o,a,l){super(),this._bufferService=n,this._optionsService=a,this._renderService=l,this._onRequestScrollLines=this._register(new dA),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new hG({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>uh(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new h7(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(16&e)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(dT.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(cF(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(cF(()=>this._styleElement.remove())),this._register(dT.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
20
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){void 0!==e&&(this._latestYDisp=e),void 0===this._queuedAnimationFrame&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=i-this._bufferService.buffer.ydisp;0!==n&&(this._latestYDisp=i,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};ue=l2([l5(2,cd),l5(3,cw),l5(4,ch),l5(5,cE),l5(6,cg),l5(7,ck)],ue);var ut=class extends c${constructor(e,i,n,r,s){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=n,this._decorationService=r,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(cF(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,i=e.element){if(!i)return;let n=e.options.x??0;"right"===(e.options.anchor||"left")?i.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};ut=l2([l5(1,cd),l5(2,cw),l5(3,c_),l5(4,ck)],ut);var ui=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(i,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,n){return i>=e.startBufferLine-this._linePadding[n||"full"]&&i<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},un={full:0,left:0,center:0,right:0},ur={full:0,left:0,center:0,right:0},us={full:0,left:0,center:0,right:0},uo=class extends c${constructor(e,i,n,r,s,o,a,l){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=n,this._decorationService=r,this._renderService=s,this._optionsService=o,this._themeService=a,this._coreBrowserService=l,this._colorZoneStore=new ui,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(cF(()=>this._canvas?.remove()));let c=this._canvas.getContext("2d");if(c)this._ctx=c;else throw Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);ur.full=this._canvas.width,ur.left=e,ur.center=i,ur.right=e,this._refreshDrawHeightConstants(),us.full=1,us.left=1,us.center=1+ur.left,us.right=1+ur.left+ur.center}_refreshDrawHeightConstants(){un.full=Math.round(2*this._coreBrowserService.dpr);let e=Math.round(Math.max(Math.min(this._canvas.height/this._bufferService.buffer.lines.length,12),6)*this._coreBrowserService.dpr);un.left=e,un.center=e,un.right=e}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*un.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*un.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*un.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*un.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){for(let e of(this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear(),this._decorationService.decorations))this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)"full"!==i.position&&this._renderColorZone(i);for(let i of e)"full"===i.position&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(us[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-un[e.position||"full"]/2),ur[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+un[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};uo=l2([l5(2,cd),l5(3,c_),l5(4,ck),l5(5,cg),l5(6,cE),l5(7,cw)],uo),(f=up||={}).NUL="\0",f.SOH="\x01",f.STX="\x02",f.ETX="\x03",f.EOT="\x04",f.ENQ="\x05",f.ACK="\x06",f.BEL="\x07",f.BS="\b",f.HT=" ",f.LF=`
21
+ `,f.VT="\v",f.FF="\f",f.CR="\r",f.SO="\x0e",f.SI="\x0f",f.DLE="\x10",f.DC1="\x11",f.DC2="\x12",f.DC3="\x13",f.DC4="\x14",f.NAK="\x15",f.SYN="\x16",f.ETB="\x17",f.CAN="\x18",f.EM="\x19",f.SUB="\x1a",f.ESC="\x1b",f.FS="\x1c",f.GS="\x1d",f.RS="\x1e",f.US="\x1f",f.SP=" ",f.DEL="",(m=uf||={}).PAD="€",m.HOP="",m.BPH="‚",m.NBH="ƒ",m.IND="„",m.NEL="…",m.SSA="†",m.ESA="‡",m.HTS="ˆ",m.HTJ="‰",m.VTS="Š",m.PLD="‹",m.PLU="Œ",m.RI="",m.SS2="Ž",m.SS3="",m.DCS="",m.PU1="‘",m.PU2="’",m.STS="“",m.CCH="”",m.MW="•",m.SPA="–",m.EPA="—",m.SOS="˜",m.SGCI="™",m.SCI="š",m.CSI="›",m.ST="œ",m.OSC="",m.PM="ž",m.APC="Ÿ",(um||={}).ST=`${up.ESC}\\`;var ua=class{constructor(e,i,n,r,s,o){this._textarea=e,this._compositionView=i,this._bufferService=n,this._optionsService=r,this._coreService=s,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(20===e.keyCode||229===e.keyCode||16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let i;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,(i=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start)).length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,n=i.replace(e,"");this._dataAlreadySent=n,i.length>e.length?this._coreService.triggerDataEvent(n,!0):i.length<e.length?this._coreService.triggerDataEvent(`${up.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};ua=l2([l5(2,cd),l5(3,cg),l5(4,cu),l5(5,ck)],ua);var ul,uc,ud,uh,uu,up,uf,um,ug,uv=0,uy=0,u_=0,ux=0,ub={css:"#00000000",rgba:0};(p6=ug||={}).toCss=function(e,i,n,r){return void 0!==r?`#${uN(e)}${uN(i)}${uN(n)}${uN(r)}`:`#${uN(e)}${uN(i)}${uN(n)}`},p6.toRgba=function(e,i,n,r=255){return(e<<24|i<<16|n<<8|r)>>>0},p6.toColor=function(e,i,n,r){return{css:p6.toCss(e,i,n,r),rgba:p6.toRgba(e,i,n,r)}};var uw=p8||={};function uS(e,i){return ux=Math.round(255*i),[uv,uy,u_]=fe.toChannels(e.rgba),{css:ug.toCss(uv,uy,u_,ux),rgba:ug.toRgba(uv,uy,u_,ux)}}uw.blend=function(e,i){if(1==(ux=(255&i.rgba)/255))return{css:i.css,rgba:i.rgba};let n=i.rgba>>24&255,r=i.rgba>>16&255,s=i.rgba>>8&255,o=e.rgba>>24&255,a=e.rgba>>16&255,l=e.rgba>>8&255;return uv=o+Math.round((n-o)*ux),uy=a+Math.round((r-a)*ux),u_=l+Math.round((s-l)*ux),{css:ug.toCss(uv,uy,u_),rgba:ug.toRgba(uv,uy,u_)}},uw.isOpaque=function(e){return(255&e.rgba)==255},uw.ensureContrastRatio=function(e,i,n){let r=fe.ensureContrastRatio(e.rgba,i.rgba,n);if(r)return ug.toColor(r>>24&255,r>>16&255,r>>8&255)},uw.opaque=function(e){let i=(255|e.rgba)>>>0;return[uv,uy,u_]=fe.toChannels(i),{css:ug.toCss(uv,uy,u_),rgba:i}},uw.opacity=uS,uw.multiplyOpacity=function(e,i){return ux=255&e.rgba,uS(e,ux*i/255)},uw.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]},(e=>{let i,n;try{let e=document.createElement("canvas");e.width=1,e.height=1;let r=e.getContext("2d",{willReadFrequently:!0});r&&((i=r).globalCompositeOperation="copy",n=i.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return uv=parseInt(e.slice(1,2).repeat(2),16),uy=parseInt(e.slice(2,3).repeat(2),16),u_=parseInt(e.slice(3,4).repeat(2),16),ug.toColor(uv,uy,u_);case 5:return uv=parseInt(e.slice(1,2).repeat(2),16),uy=parseInt(e.slice(2,3).repeat(2),16),u_=parseInt(e.slice(3,4).repeat(2),16),ux=parseInt(e.slice(4,5).repeat(2),16),ug.toColor(uv,uy,u_,ux);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return uv=parseInt(r[1]),uy=parseInt(r[2]),u_=parseInt(r[3]),ux=Math.round((void 0===r[5]?1:parseFloat(r[5]))*255),ug.toColor(uv,uy,u_,ux);if(!i||!n||(i.fillStyle=n,i.fillStyle=e,"string"!=typeof i.fillStyle)||(i.fillRect(0,0,1,1),[uv,uy,u_,ux]=i.getImageData(0,0,1,1).data,255!==ux))throw Error("css.toColor: Unsupported css format");return{rgba:ug.toRgba(uv,uy,u_,ux),css:e}}})(p9||={});var uk=p7||={};function uC(e,i,n){let r=e/255,s=i/255,o=n/255;return .2126*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}uk.relativeLuminance=function(e){return uC(e>>16&255,e>>8&255,255&e)},uk.relativeLuminance2=uC;var uT=fe||={};function uE(e,i,n){let r=e>>24&255,s=e>>16&255,o=e>>8&255,a=i>>24&255,l=i>>16&255,c=i>>8&255,d=uM(p7.relativeLuminance2(a,l,c),p7.relativeLuminance2(r,s,o));for(;d<n&&(a>0||l>0||c>0);)a-=Math.max(0,Math.ceil(.1*a)),l-=Math.max(0,Math.ceil(.1*l)),c-=Math.max(0,Math.ceil(.1*c)),d=uM(p7.relativeLuminance2(a,l,c),p7.relativeLuminance2(r,s,o));return(a<<24|l<<16|c<<8|255)>>>0}function uD(e,i,n){let r=e>>24&255,s=e>>16&255,o=e>>8&255,a=i>>24&255,l=i>>16&255,c=i>>8&255,d=uM(p7.relativeLuminance2(a,l,c),p7.relativeLuminance2(r,s,o));for(;d<n&&(a<255||l<255||c<255);)a=Math.min(255,a+Math.ceil((255-a)*.1)),l=Math.min(255,l+Math.ceil((255-l)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),d=uM(p7.relativeLuminance2(a,l,c),p7.relativeLuminance2(r,s,o));return(a<<24|l<<16|c<<8|255)>>>0}function uN(e){let i=e.toString(16);return i.length<2?"0"+i:i}function uM(e,i){return e<i?(i+.05)/(e+.05):(e+.05)/(i+.05)}uT.blend=function(e,i){if(1==(ux=(255&i)/255))return i;let n=e>>24&255,r=e>>16&255,s=e>>8&255;return uv=n+Math.round(((i>>24&255)-n)*ux),uy=r+Math.round(((i>>16&255)-r)*ux),u_=s+Math.round(((i>>8&255)-s)*ux),ug.toRgba(uv,uy,u_)},uT.ensureContrastRatio=function(e,i,n){let r=p7.relativeLuminance(e>>8),s=p7.relativeLuminance(i>>8);if(uM(r,s)<n){if(s<r){let s=uE(e,i,n),o=uM(r,p7.relativeLuminance(s>>8));if(o<n){let a=uD(e,i,n);return o>uM(r,p7.relativeLuminance(a>>8))?s:a}return s}let o=uD(e,i,n),a=uM(r,p7.relativeLuminance(o>>8));if(a<n){let s=uE(e,i,n);return a>uM(r,p7.relativeLuminance(s>>8))?o:s}return o}},uT.reduceLuminance=uE,uT.increaseLuminance=uD,uT.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]};var uO=class extends cn{constructor(e,i,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},uR=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new cs}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(0===this._characterJoiners.length)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||0===i.length)return[];let n=[],r=i.translateToString(!0),s=0,o=0,a=0,l=i.getFg(0),c=i.getBg(0);for(let e=0;e<i.getTrimmedLength();e++)if(i.loadCell(e,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(e-s>1){let e=this._getJoinedRanges(r,a,o,i,s);for(let i=0;i<e.length;i++)n.push(e[i])}s=e,a=o,l=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||1}if(this._bufferService.cols-s>1){let e=this._getJoinedRanges(r,a,o,i,s);for(let i=0;i<e.length;i++)n.push(e[i])}return n}_getJoinedRanges(e,i,n,r,s){let o=e.substring(i,n),a=[];try{a=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let i=this._characterJoiners[e].handler(o);for(let e=0;e<i.length;e++)uR._mergeRanges(a,i[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(a,r,s),a}_stringRangesToCellRanges(e,i,n){let r=0,s=!1,o=0,a=e[0];if(a){for(let l=n;l<this._bufferService.cols;l++){let n=i.getWidth(l),c=i.getString(l).length||1;if(0!==n){if(!s&&a[0]<=o&&(a[0]=l,s=!0),a[1]<=o){if(a[1]=l,!(a=e[++r]))break;a[0]<=o?(a[0]=l,s=!0):s=!1}o+=c}}a&&(a[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(n){if(i[1]<=s[0])return e[r-1][1]=i[1],e;if(i[1]<=s[1])return e[r-1][1]=Math.max(i[1],s[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(i[1]<=s[0])return e.splice(r,0,i),e;if(i[1]<=s[1])return s[0]=Math.min(i[0],s[0]),e;i[0]<s[1]&&(s[0]=Math.min(i[0],s[0]),n=!0);continue}}return n?e[e.length-1][1]=i[1]:e.push(i),e}};function uA(){return{width:0,height:0}}uR=l2([l5(0,cd)],uR);var uL=class{constructor(e,i,n,r,s,o,a){this._document=e,this._characterJoinerService=i,this._optionsService=n,this._coreBrowserService=r,this._coreService=s,this._decorationService=o,this._themeService=a,this._workCell=new cs,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,n){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=n}createRow(e,i,n,r,s,o,a,l,c,d,h){let u=[],p=this._characterJoinerService.getJoinedCharacters(i),f=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<o+1&&(m=o+1);let g,v=0,y="",_=0,b=0,w=0,S=0,k=!1,C=0,T=!1,E=0,D=0,N=[],M=-1!==d&&-1!==h;for(let O=0;O<m;O++){let m;e.loadCell(O,this._workCell);let R=this._workCell.getWidth();if(0===R)continue;let A=!1,L=O>=D,j=O,I=this._workCell;if(p.length>0&&O===p[0][0]&&L){let r=p.shift(),s=this._isCellInSelection(r[0],i);for(_=r[0]+1;_<r[1];_++)L&&=s===this._isCellInSelection(_,i);(L&&=!n||o<r[0]||o>=r[1])?(A=!0,I=new uO(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),j=r[1]-1,R=I.getWidth()):D=r[1]}let P=this._isCellInSelection(O,i),B=n&&O===o,z=M&&O>=d&&O<=h,F=!1;this._decorationService.forEachDecorationAtCell(O,i,void 0,e=>{F=!0});let H=I.getChars()||" ";if(" "===H&&(I.isUnderline()||I.isOverline())&&(H=" "),E=R*l-c.get(H,I.isBold(),I.isItalic()),g)if(v&&(P&&T||!P&&!T&&I.bg===b)&&(P&&T&&f.selectionForeground||I.fg===w)&&I.extended.ext===S&&z===k&&E===C&&!B&&!A&&!F&&L){I.isInvisible()?y+=" ":y+=H,v++;continue}else v&&(g.textContent=y),g=this._document.createElement("span"),v=0,y="";else g=this._document.createElement("span");if(b=I.bg,w=I.fg,S=I.extended.ext,k=z,C=E,T=P,A&&o>=O&&o<=j&&(o=O),!this._coreService.isCursorHidden&&B&&this._coreService.isCursorInitialized){if(N.push("xterm-cursor"),this._coreBrowserService.isFocused)a&&N.push("xterm-cursor-blink"),N.push("bar"===r?"xterm-cursor-bar":"underline"===r?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":N.push("xterm-cursor-outline");break;case"block":N.push("xterm-cursor-block");break;case"bar":N.push("xterm-cursor-bar");break;case"underline":N.push("xterm-cursor-underline")}}if(I.isBold()&&N.push("xterm-bold"),I.isItalic()&&N.push("xterm-italic"),I.isDim()&&N.push("xterm-dim"),y=I.isInvisible()?" ":I.getChars()||" ",I.isUnderline()&&(N.push(`xterm-underline-${I.extended.underlineStyle}`)," "===y&&(y=" "),!I.isUnderlineColorDefault()))if(I.isUnderlineColorRGB())g.style.textDecorationColor=`rgb(${cn.toColorRGB(I.getUnderlineColor()).join(",")})`;else{let e=I.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&I.isBold()&&e<8&&(e+=8),g.style.textDecorationColor=f.ansi[e].css}I.isOverline()&&(N.push("xterm-overline")," "===y&&(y=" ")),I.isStrikethrough()&&N.push("xterm-strikethrough"),z&&(g.style.textDecoration="underline");let W=I.getFgColor(),$=I.getFgColorMode(),U=I.getBgColor(),V=I.getBgColorMode(),q=!!I.isInverse();if(q){let e=W;W=U,U=e;let i=$;$=V,V=i}let K,Y,X=!1;switch(this._decorationService.forEachDecorationAtCell(O,i,void 0,e=>{"top"!==e.options.layer&&X||(e.backgroundColorRGB&&(V=0x3000000,U=e.backgroundColorRGB.rgba>>8&0xffffff,K=e.backgroundColorRGB),e.foregroundColorRGB&&($=0x3000000,W=e.foregroundColorRGB.rgba>>8&0xffffff,Y=e.foregroundColorRGB),X="top"===e.options.layer)}),!X&&P&&(U=(K=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque).rgba>>8&0xffffff,V=0x3000000,X=!0,f.selectionForeground&&($=0x3000000,W=f.selectionForeground.rgba>>8&0xffffff,Y=f.selectionForeground)),X&&N.push("xterm-decoration-top"),V){case 0x1000000:case 0x2000000:m=f.ansi[U],N.push(`xterm-bg-${U}`);break;case 0x3000000:m=ug.toColor(U>>16,U>>8&255,255&U),this._addStyle(g,`background-color:#${uj((U>>>0).toString(16),"0",6)}`);break;default:q?(m=f.foreground,N.push("xterm-bg-257")):m=f.background}switch(K||I.isDim()&&(K=p8.multiplyOpacity(m,.5)),$){case 0x1000000:case 0x2000000:I.isBold()&&W<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(W+=8),this._applyMinimumContrast(g,m,f.ansi[W],I,K,void 0)||N.push(`xterm-fg-${W}`);break;case 0x3000000:let J=ug.toColor(W>>16&255,W>>8&255,255&W);this._applyMinimumContrast(g,m,J,I,K,Y)||this._addStyle(g,`color:#${uj(W.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(g,m,f.foreground,I,K,Y)||q&&N.push("xterm-fg-257")}N.length&&(g.className=N.join(" "),N.length=0),B||A||F||!L?g.textContent=y:v++,E!==this.defaultSpacing&&(g.style.letterSpacing=`${E}px`),u.push(g),O=j}return g&&v&&(g.textContent=y),u}_applyMinimumContrast(e,i,n,r,s,o){var a,l,c;if(1===this._optionsService.rawOptions.minimumContrastRatio||57508<=(l=a=r.getCode())&&l<=57558||9472<=(c=a)&&c<=9631)return!1;let d=this._getContrastCache(r),h;if(s||o||(h=d.getColor(i.rgba,n.rgba)),void 0===h){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);h=p8.ensureContrastRatio(s||i,o||n,e),d.setColor((s||i).rgba,(o||n).rgba,h??null)}return!!h&&(this._addStyle(e,`color:${h.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let n=this._selectionStart,r=this._selectionEnd;return!!n&&!!r&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&i>=n[1]&&e<r[0]&&i<=r[1]:e<n[0]&&i>=n[1]&&e>=r[0]&&i<=r[1]:i>n[1]&&i<r[1]||n[1]===r[1]&&i===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&i===r[1]&&e<r[0]||n[1]<r[1]&&i===n[1]&&e>=n[0])}};function uj(e,i,n){for(;e.length<n;)e=i+e;return e}uL=l2([l5(1,cT),l5(2,cg),l5(3,cw),l5(4,cu),l5(5,c_),l5(6,cE)],uL);var uI=class{constructor(e,i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[n,r,s,o],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(s),this._container.appendChild(o),i.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,i,n,r){e===this._font&&i===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=i,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,i,n){let r=0;if(!i&&!n&&1===e.length&&(r=e.charCodeAt(0))<256){if(-9999!==this._flat[r])return this._flat[r];let i=this._measure(e,0);return i>0&&(this._flat[r]=i),i}let s=e;i&&(s+="B"),n&&(s+="I");let o=this._holey.get(s);if(void 0===o){let r=0;i&&(r|=1),n&&(r|=2),(o=this._measure(e,r))>0&&this._holey.set(s,o)}return o}_measure(e,i){let n=this._measureElements[i];return n.textContent=e.repeat(32),n.offsetWidth/32}},uP=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,i,n,r=!1){if(this.selectionStart=i,this.selectionEnd=n,!i||!n||i[0]===n[0]&&i[1]===n[1])return void this.clear();let s=e.buffers.active.ydisp,o=i[1]-s,a=n[1]-s,l=Math.max(o,0),c=Math.min(a,e.rows-1);l>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=a,this.viewportCappedStartRow=l,this.viewportCappedEndRow=c,this.startCol=i[0],this.endCol=n[0])}isCellSelected(e,i,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&n>=this.viewportCappedStartRow&&i<this.endCol&&n<=this.viewportCappedEndRow:i<this.startCol&&n>=this.viewportCappedStartRow&&i>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol)}},uB="xterm-dom-renderer-owner-",uz="xterm-rows",uF="xterm-fg-",uH="xterm-bg-",uW="xterm-focus",u$="xterm-selection",uU=1,uV=class extends c${constructor(e,i,n,r,s,o,a,l,c,d,h,u,p,f){super(),this._terminal=e,this._document=i,this._element=n,this._screenElement=r,this._viewportElement=s,this._helperContainer=o,this._linkifier2=a,this._charSizeService=c,this._optionsService=d,this._bufferService=h,this._coreService=u,this._coreBrowserService=p,this._themeService=f,this._terminalClass=uU++,this._rowElements=[],this._selectionRenderModel=new uP,this.onRequestRedraw=this._register(new dA).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(uz),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(u$),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions={css:{canvas:uA(),cell:uA()},device:{canvas:uA(),cell:uA(),char:{width:0,height:0,left:0,top:0}}},this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(uL,document),this._element.classList.add(uB+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(cF(()=>{this._element.classList.remove(uB+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new uI(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;for(let i of(this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows,this._rowElements))i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${uz} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${uz} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${uz} .xterm-dim { color: ${p8.multiplyOpacity(e.foreground,.5).css};}${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;for(let[o,a]of(i+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}@keyframes ${r} { 50% { box-shadow: none; }}@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}${this._terminalSelector} .${uz}.${uW} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${uz}.${uW} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${uz}.${uW} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${uz} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${uz} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${uz} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${uz} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${uz} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}${this._terminalSelector} .${u$} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${u$} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${u$} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`,e.ansi.entries()))i+=`${this._terminalSelector} .${uF}${o} { color: ${a.css}; }${this._terminalSelector} .${uF}${o}.xterm-dim { color: ${p8.multiplyOpacity(a,.5).css}; }${this._terminalSelector} .${uH}${o} { background-color: ${a.css}; }`;i+=`${this._terminalSelector} .${uF}257 { color: ${p8.opaque(e.background).css}; }${this._terminalSelector} .${uF}257.xterm-dim { color: ${p8.multiplyOpacity(p8.opaque(e.background),.5).css}; }${this._terminalSelector} .${uH}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let e=this._rowElements.length;e<=i;e++){let e=this._document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(uW),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(uW),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,n),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,a=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(n){let n=e[0]>i[0];l.appendChild(this._createSelectionElement(o,n?i[0]:e[0],n?e[0]:i[0],a-o+1))}else{let n=r===o?e[0]:0,c=o===s?i[0]:this._bufferService.cols;if(l.appendChild(this._createSelectionElement(o,n,c)),l.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,a-o-1)),o!==a){let e=s===a?i[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(a,0,e))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,i,n,r=1){let s=this._document.createElement("div"),o=i*this.dimensions.css.cell.width,a=this.dimensions.css.cell.width*(n-i);return o+a>this.dimensions.css.canvas.width&&(a=this.dimensions.css.canvas.width-o),s.style.height=`${r*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${o}px`,s.style.width=`${a}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let n=this._bufferService.buffer,r=n.ybase+n.y,s=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,a=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=i;c++){let e=c+n.ydisp,i=this._rowElements[c],d=n.lines.get(e);if(!i||!d)break;i.replaceChildren(...this._rowFactory.createRow(d,e,e===r,a,l,s,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${uB}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,n,r,s,o){n<0&&(e=0),r<0&&(i=0);let a=this._bufferService.rows-1;n=Math.max(Math.min(n,a),0),r=Math.max(Math.min(r,a),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,c=l.ybase+l.y,d=Math.min(l.x,s-1),h=this._optionsService.rawOptions.cursorBlink,u=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let a=n;a<=r;++a){let f=a+l.ydisp,m=this._rowElements[a],g=l.lines.get(f);if(!m||!g)break;m.replaceChildren(...this._rowFactory.createRow(g,f,f===c,u,p,d,h,this.dimensions.css.cell.width,this._widthCache,o?a===n?e:0:-1,o?(a===r?i:s)-1:-1))}}};uV=l2([l5(7,cf),l5(8,cb),l5(9,cg),l5(10,cd),l5(11,cu),l5(12,cw),l5(13,cE)],uV);var uq=class extends c${constructor(e,i,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new dA),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new uX(this._optionsService))}catch{this._measureStrategy=this._register(new uY(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};uq=l2([l5(2,cg)],uq);var uK=class extends c${constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,i){void 0!==e&&e>0&&void 0!==i&&i>0&&(this._result.width=e,this._result.height=i)}},uY=class extends uK{constructor(e,i,n){super(),this._document=e,this._parentElement=i,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},uX=class extends uK{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},uJ=class extends c${constructor(e,i,n){super(),this._textarea=e,this._window=i,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new uG(this._window)),this._onDprChange=this._register(new dA),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new dA),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(dT.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(hP(this._textarea,"focus",()=>this._isFocused=!0)),this._register(hP(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},uG=class extends c${constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new cU),this._onDprChange=this._register(new dA),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(cF(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=hP(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},uZ=class extends c${constructor(){super(),this.linkProviders=[],this._register(cF(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);-1!==i&&this.linkProviders.splice(i,1)}}}};function uQ(e,i,n){let r=n.getBoundingClientRect(),s=e.getComputedStyle(n),o=parseInt(s.getPropertyValue("padding-left")),a=parseInt(s.getPropertyValue("padding-top"));return[i.clientX-r.left-o,i.clientY-r.top-a]}var u0=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,n,r,s){return function(e,i,n,r,s,o,a,l,c){if(!o)return;let d=uQ(e,i,n);return d[0]=Math.ceil((d[0]+(c?a/2:0))/a),d[1]=Math.ceil(d[1]/l),d[0]=Math.min(Math.max(d[0],1),r+ +!!c),d[1]=Math.min(Math.max(d[1],1),s),d}(window,e,i,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,i){let n=uQ(window,e,i);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};u0=l2([l5(0,ck),l5(1,cb)],u0);var u1=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,n){this._rowCount=n,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},u2={},u5={getSafariVersion:()=>pt,isChromeOS:()=>pa,isFirefox:()=>u9,isIpad:()=>pn,isIphone:()=>pr,isLegacyEdge:()=>u7,isLinux:()=>po,isMac:()=>pi,isNode:()=>u4,isSafari:()=>pe,isWindows:()=>ps};for(var u3 in u5)l0(u2,u3,{get:u5[u3],enumerable:!0});var u4="u">typeof rx.default&&"title"in rx.default,u6=u4?"node":navigator.userAgent,u8=u4?"node":navigator.platform,u9=u6.includes("Firefox"),u7=u6.includes("Edge"),pe=/^((?!chrome|android).)*safari/i.test(u6);function pt(){if(!pe)return 0;let e=u6.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}var pi=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u8),pn="iPad"===u8,pr="iPhone"===u8,ps=["Windows","Win16","Win32","WinCE"].includes(u8),po=u8.indexOf("Linux")>=0,pa=/\bCrOS\b/.test(u6),pl=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let i=0,n=0,r=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(i=performance.now(),this._tasks[this._i]()||this._i++,1.5*(n=Math.max(i=Math.max(1,performance.now()-i),n))>(s=e.timeRemaining())){r-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-i))}ms`),this._start();return}r=s}this.clear()}},pc=class extends pl{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},pd=class extends pl{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ph=!u4&&"requestIdleCallback"in window?pd:pc,pu=class{constructor(){this._queue=new ph}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},pp=class extends c${constructor(e,i,n,r,s,o,a,l,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new cU),this._pausedResizeTask=new pu,this._observerDisposable=this._register(new cU),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new dA),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new dA),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new dA),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new dA),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new u1((e,i)=>this._renderRows(e,i),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new pf(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(cF(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(a.onResize(()=>this._fullRefresh())),this._register(a.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(a.cols,a.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(a.buffer.y,a.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(i),this._observerDisposable.value=cF(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,i);let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),i=Math.max(i,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput)return void this._syncOutputHandler.bufferRows(e,i);e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,n){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,i,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};pp=l2([l5(2,cg),l5(3,cb),l5(4,cu),l5(5,c_),l5(6,cd),l5(7,cw),l5(8,cE)],pp);var pf=class{constructor(e,i,n){this._coreBrowserService=e,this._coreService=i,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,i){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,i)):(this._start=e,this._end=i,this._isBuffering=!0),void 0===this._timeout&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){void 0!==this._timeout&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function pm(e,i,n,r){return p_(Math.abs(e-pg(e,n)-(i-pg(i,n)))-function(e,i,n){let r=0,s=e-pg(e,n),o=i-pg(i,n);for(let a=0;a<Math.abs(s-o);a++){let o="A"===function(e,i){return e>i?"A":"B"}(e,i)?-1:1;n.buffer.lines.get(s+o*a)?.isWrapped&&r++}return r}(e,i,n),py(e>i?"A":"B",r))}function pg(e,i){let n=0,r=i.buffer.lines.get(e),s=r?.isWrapped;for(;s&&e>=0&&e<i.rows;)n++,r=i.buffer.lines.get(--e),s=r?.isWrapped;return n}function pv(e,i,n,r,s,o){let a=e,l=i,c="";for(;(a!==n||l!==r)&&l>=0&&l<o.buffer.lines.length;)a+=s?1:-1,s&&a>o.cols-1?(c+=o.buffer.translateBufferLineToString(l,!1,e,a),a=0,e=0,l++):!s&&a<0&&(c+=o.buffer.translateBufferLineToString(l,!1,0,e+1),e=a=o.cols-1,l--);return c+o.buffer.translateBufferLineToString(l,!1,e,a)}function py(e,i){return up.ESC+(i?"O":"[")+e}function p_(e,i){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=i;return n}var px=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,i=this.selectionEnd;return!!e&&!!i&&(e[1]>i[1]||e[1]===i[1]&&e[0]>i[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function pb(e,i){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return i*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var pw=RegExp(" ","g"),pS=class extends c${constructor(e,i,n,r,s,o,a,l,c){super(),this._element=e,this._screenElement=i,this._linkifier=n,this._bufferService=r,this._coreService=s,this._mouseService=o,this._optionsService=a,this._renderService=l,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new cs,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new dA),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new dA),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new dA),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new dA),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new px(this._bufferService),this._activeSelectionMode=0,this._register(cF(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1])}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let n=this._bufferService.buffer,r=[];if(3===this._activeSelectionMode){if(e[0]===i[0])return"";let s=e[0]<i[0]?e[0]:i[0],o=e[0]<i[0]?i[0]:e[0];for(let a=e[1];a<=i[1];a++){let e=n.translateBufferLineToString(a,!0,s,o);r.push(e)}}else{let s=e[1]===i[1]?i[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],s));for(let s=e[1]+1;s<=i[1]-1;s++){let e=n.lines.get(s),i=n.translateBufferLineToString(s,!0);e?.isWrapped?r[r.length-1]+=i:r.push(i)}if(e[1]!==i[1]){let e=n.lines.get(i[1]),s=n.translateBufferLineToString(i[1],!0,0,i[0]);e&&e.isWrapped?r[r.length-1]+=s:r.push(s)}}return r.map(e=>e.replace(pw," ")).join(ps?`\r
22
+ `:`
23
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),po&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!n&&!!r&&!!i&&this._areCoordsInSelection(i,n,r)}isCellInSelection(e,i){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!n&&!!r&&this._areCoordsInSelection([e,i],n,r)}_areCoordsInSelection(e,i,n){return e[1]>i[1]&&e[1]<n[1]||i[1]===n[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<n[0]||i[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||i[1]<n[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=pb(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return!!r&&(this._selectWordAt(r,i),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=uQ(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=n?0:(i>n&&(i-=n),(i=Math.min(Math.max(i,-50),50)/50)/Math.abs(i)+Math.round(14*i))}shouldForceSelection(e){return pi?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(2===e.button&&this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=3*!!this.shouldColumnSelect(e),this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&0===i.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(pi&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}i&&i[0]===this._model.selectionEnd[0]&&i[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&void 0!==i[0]&&void 0!==i[1]){let e=function(e,i,n,r){var s,o,a,l,c,d,h,u,p,f,m,g,v,y,_,b;let w,S=n.buffer.x,k=n.buffer.y;if(!n.buffer.hasScrollback){let b,w,C;return s=S,(0===pm(o=k,i,a=n,l=r).length?"":p_(pv(s,o,s,o-pg(o,a),!1,a).length,py("D",l)))+pm(k,i,n,r)+(c=S,d=k,h=e,b=pm(d,u=i,p=n,f=r).length>0?u-pg(u,p):d,C=(m=c,g=d,w=pm(v=h,y=u,_=p,f).length>0?y-pg(y,_):g,m<v&&w<=y||m>=v&&w<y?"C":"D"),p_(pv(c,b,h,u,"C"===C,p).length,py(C,f)))}if(k===i)return w=S>e?"D":"C",p_(Math.abs(S-e),py(w,r));w=k>i?"D":"C";let C=Math.abs(k-i);return p_((b=k>i?e:S,n.cols-b+(C-1)*n.cols+1+((k>i?S:e)-1)),py(w,r))}(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,n=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,i,n);return}!e||!i||this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&i[0]===this._oldSelectionEnd[0]&&i[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,i,n)}_fireOnSelectionChange(e,i,n){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,i){let n=i;for(let r=0;i>=r;r++){let s=e.loadCell(r,this._workCell).getChars().length;0===this._workCell.getWidth()?n--:s>1&&i!==r&&(n+=s-1)}return n}setSelection(e,i,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,o=s.lines.get(e[1]);if(!o)return;let a=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(o,e[0]),c=l,d=e[0]-l,h=0,u=0,p=0,f=0;if(" "===a.charAt(l)){for(;l>0&&" "===a.charAt(l-1);)l--;for(;c<a.length&&" "===a.charAt(c+1);)c++}else{let i=e[0],n=e[0];0===o.getWidth(i)&&(h++,i--),2===o.getWidth(n)&&(u++,n++);let r=o.getString(n).length;for(r>1&&(f+=r-1,c+=r-1);i>0&&l>0&&!this._isCharWordSeparator(o.loadCell(i-1,this._workCell));){o.loadCell(i-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(h++,i--):e>1&&(p+=e-1,l-=e-1),l--,i--}for(;n<o.length&&c+1<a.length&&!this._isCharWordSeparator(o.loadCell(n+1,this._workCell));){o.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(u++,n++):e>1&&(f+=e-1,c+=e-1),c++,n++}}c++;let m=l+d-h+p,g=Math.min(this._bufferService.cols,c-l+h+u-p-f);if(!(!i&&""===a.slice(l,c).trim())){if(n&&0===m&&32!==o.getCodePoint(0)){let i=s.lines.get(e[1]-1);if(i&&o.isWrapped&&32!==i.getCodePoint(this._bufferService.cols-1)){let i=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(i){let e=this._bufferService.cols-i.start;m-=e,g+=e}}}if(r&&m+g===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){let i=s.lines.get(e[1]+1);if(i?.isWrapped&&32!==i.getCodePoint(0)){let i=this._getWordAt([0,e[1]+1],!1,!1,!0);i&&(g+=i.length)}}return{start:m,length:g}}}_selectWordAt(e,i){let n=this._getWordAt(e,i);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let n=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,n]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=pb(n,this._bufferService.cols)}};pS=l2([l5(3,cd),l5(4,cu),l5(5,cS),l5(6,cg),l5(7,ck),l5(8,cw)],pS);var pk=class{constructor(){this._data={}}set(e,i,n){this._data[e]||(this._data[e]={}),this._data[e][i]=n}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},pC=class{constructor(){this._color=new pk,this._css=new pk}setCss(e,i,n){this._css.set(e,i,n)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,n){this._color.set(e,i,n)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},pT=Object.freeze((()=>{let e=[p9.toColor("#2e3436"),p9.toColor("#cc0000"),p9.toColor("#4e9a06"),p9.toColor("#c4a000"),p9.toColor("#3465a4"),p9.toColor("#75507b"),p9.toColor("#06989a"),p9.toColor("#d3d7cf"),p9.toColor("#555753"),p9.toColor("#ef2929"),p9.toColor("#8ae234"),p9.toColor("#fce94f"),p9.toColor("#729fcf"),p9.toColor("#ad7fa8"),p9.toColor("#34e2e2"),p9.toColor("#eeeeec")],i=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=i[n/36%6|0],s=i[n/6%6|0],o=i[n%6];e.push({css:ug.toCss(r,s,o),rgba:ug.toRgba(r,s,o)})}for(let i=0;i<24;i++){let n=8+10*i;e.push({css:ug.toCss(n,n,n),rgba:ug.toRgba(n,n,n)})}return e})()),pE=p9.toColor("#ffffff"),pD=p9.toColor("#000000"),pN=p9.toColor("#ffffff"),pM={css:"rgba(255, 255, 255, 0.3)",rgba:0xffffff4d},pO=class extends c${constructor(e){super(),this._optionsService=e,this._contrastCache=new pC,this._halfContrastCache=new pC,this._onChangeColors=this._register(new dA),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:pE,background:pD,cursor:pN,cursorAccent:pD,selectionForeground:void 0,selectionBackgroundTransparent:pM,selectionBackgroundOpaque:p8.blend(pD,pM),selectionInactiveBackgroundTransparent:pM,selectionInactiveBackgroundOpaque:p8.blend(pD,pM),scrollbarSliderBackground:p8.opacity(pE,.2),scrollbarSliderHoverBackground:p8.opacity(pE,.4),scrollbarSliderActiveBackground:p8.opacity(pE,.5),overviewRulerBorder:pE,ansi:pT.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=pR(e.foreground,pE),i.background=pR(e.background,pD),i.cursor=p8.blend(i.background,pR(e.cursor,pN)),i.cursorAccent=p8.blend(i.background,pR(e.cursorAccent,pD)),i.selectionBackgroundTransparent=pR(e.selectionBackground,pM),i.selectionBackgroundOpaque=p8.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=pR(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=p8.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?pR(e.selectionForeground,ub):void 0,i.selectionForeground===ub&&(i.selectionForeground=void 0),p8.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=p8.opacity(i.selectionBackgroundTransparent,.3)),p8.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=p8.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=pR(e.scrollbarSliderBackground,p8.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=pR(e.scrollbarSliderHoverBackground,p8.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=pR(e.scrollbarSliderActiveBackground,p8.opacity(i.foreground,.5)),i.overviewRulerBorder=pR(e.overviewRulerBorder,pE),i.ansi=pT.slice(),i.ansi[0]=pR(e.black,pT[0]),i.ansi[1]=pR(e.red,pT[1]),i.ansi[2]=pR(e.green,pT[2]),i.ansi[3]=pR(e.yellow,pT[3]),i.ansi[4]=pR(e.blue,pT[4]),i.ansi[5]=pR(e.magenta,pT[5]),i.ansi[6]=pR(e.cyan,pT[6]),i.ansi[7]=pR(e.white,pT[7]),i.ansi[8]=pR(e.brightBlack,pT[8]),i.ansi[9]=pR(e.brightRed,pT[9]),i.ansi[10]=pR(e.brightGreen,pT[10]),i.ansi[11]=pR(e.brightYellow,pT[11]),i.ansi[12]=pR(e.brightBlue,pT[12]),i.ansi[13]=pR(e.brightMagenta,pT[13]),i.ansi[14]=pR(e.brightCyan,pT[14]),i.ansi[15]=pR(e.brightWhite,pT[15]),e.extendedAnsi){let n=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)i.ansi[r+16]=pR(e.extendedAnsi[r],pT[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0===e){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function pR(e,i){if(void 0!==e)try{return p9.toColor(e)}catch{}return i}pO=l2([l5(0,cg)],pO);var pA=class{constructor(...e){for(let[i,n]of(this._entries=new Map,e))this.set(i,n)}set(e,i){let n=this._entries.get(e);return this._entries.set(e,i),n}forEach(e){for(let[i,n]of this._entries.entries())e(i,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},pL=class{constructor(){this._services=new pA,this._services.set(cf,this)}setService(e,i){this._services.set(e,i)}getService(e){return this._services.get(e)}createInstance(e,...i){let n=(e[ca]||[]).sort((e,i)=>e.index-i.index),r=[];for(let i of n){let n=this._services.get(i.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id._id}.`);r.push(n)}let s=n.length>0?n[0].index:i.length;if(i.length!==s)throw Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${i.length} static arguments`);return new e(...i,...r)}},pj={trace:0,debug:1,info:2,warn:3,error:4,off:5},pI=class extends c${constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=pj[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)"function"==typeof e[i]&&(e[i]=e[i]())}_log(e,i,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...n)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};pI=l2([l5(0,cg)],pI);var pP=class extends c${constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new dA),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new dA),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new dA),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let i=Array(e);for(let n=0;n<Math.min(e,this.length);n++)i[n]=this._array[this._getCyclicIndex(n)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,i,...n){if(i){for(let n=e;n<this._length-i;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+n.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<n.length;i++)this._array[this._getCyclicIndex(e+i)]=n[i];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,n){if(!(i<=0)){if(e<0||e>=this._length)throw Error("start argument out of range");if(e+n<0)throw Error("Cannot shift elements in list beyond index 0");if(n>0){for(let r=i-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+i+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<i;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},pB=Object.freeze(new cn),pz=0,pF=class e{constructor(e,i,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=i||cs.fromCharData([0,"",1,0]);for(let i=0;i<e;++i)this.setCell(i,r);this.length=e}get(e){let i=this._data[3*e+0],n=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:n?l7(n):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,i){this._data[3*e+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[2]<<22):this._data[3*e+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 0xc00000&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?l7(2097151&i):""}isProtected(e){return 0x20000000&this._data[3*e+2]}loadCell(e,i){return pz=3*e,i.content=this._data[pz+0],i.fg=this._data[pz+1],i.bg=this._data[pz+2],2097152&i.content&&(i.combinedData=this._combined[e]),0x10000000&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),0x10000000&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodepoint(e,i,n,r){0x10000000&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=i|n<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,i,n){let r=this._data[3*e+0];2097152&r?this._combined[e]+=l7(i):2097151&r?(this._combined[e]=l7(2097151&r)+l7(i),r&=-2097152,r|=2097152):r=4194304|i,n&&(r&=-0xc00001,r|=n<<22),this._data[3*e+0]=r}insertCells(e,i,n){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length-e){let r=new cs;for(let n=this.length-e-i-1;n>=0;--n)this.setCell(e+i+n,this.loadCell(e+n,r));for(let r=0;r<i;++r)this.setCell(e+r,n)}else for(let i=e;i<this.length;++i)this.setCell(i,n);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,i,n){if(e%=this.length,i<this.length-e){let r=new cs;for(let n=0;n<this.length-e-i;++n)this.setCell(e+n,this.loadCell(e+i+n,r));for(let e=this.length-i;e<this.length;++e)this.setCell(e,n)}else for(let i=e;i<this.length;++i)this.setCell(i,n);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,i,n,r=!1){if(r){for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length&&2===this.getWidth(i-1)&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,n);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length&&2===this.getWidth(i-1)&&this.setCellFromCodepoint(i,0,1,n);e<i&&e<this.length;)this.setCell(e++,n)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let n=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*n)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,i)}else{this._data=this._data.subarray(0,n);let i=Object.keys(this._combined);for(let n=0;n<i.length;n++){let r=parseInt(i[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let i=0;i<r.length;i++){let n=parseInt(r[i],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,4*n*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}copyFrom(e){for(let i in this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={},e._combined)this._combined[i]=e._combined[i];for(let i in this._extendedAttrs={},e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let i=new e(0);for(let e in i._data=new Uint32Array(this._data),i.length=this.length,this._combined)i._combined[e]=this._combined[e];for(let e in this._extendedAttrs)i._extendedAttrs[e]=this._extendedAttrs[e];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||0x3000000&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,i,n,r,s){let o=e._data;if(s)for(let s=r-1;s>=0;s--){for(let e=0;e<3;e++)this._data[(n+s)*3+e]=o[(i+s)*3+e];0x10000000&o[(i+s)*3+2]&&(this._extendedAttrs[n+s]=e._extendedAttrs[i+s])}else for(let s=0;s<r;s++){for(let e=0;e<3;e++)this._data[(n+s)*3+e]=o[(i+s)*3+e];0x10000000&o[(i+s)*3+2]&&(this._extendedAttrs[n+s]=e._extendedAttrs[i+s])}let a=Object.keys(e._combined);for(let r=0;r<a.length;r++){let s=parseInt(a[r],10);s>=i&&(this._combined[s-i+n]=e._combined[s])}}translateToString(e,i,n,r){i=i??0,n=n??this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let s="";for(;i<n;){let e=this._data[3*i+0],n=2097151&e,o=2097152&e?this._combined[i]:n?l7(n):" ";if(s+=o,r)for(let e=0;e<o.length;++e)r.push(i);i+=e>>22||1}return r&&r.push(i),s}};function pH(e,i,n){if(i===e.length-1)return e[i].getTrimmedLength();let r=!e[i].hasContent(n-1)&&1===e[i].getWidth(n-1),s=2===e[i+1].getWidth(0);return r&&s?n-1:n}var pW=class e{constructor(i){this.line=i,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new dA),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),cz(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};pW._nextId=1;var p$={},pU=p$.B;p$[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},p$.A={"#":"£"},p$.B=void 0,p$[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},p$.C=p$[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},p$.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},p$.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},p$.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},p$.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},p$.E=p$[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},p$.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},p$.H=p$[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},p$["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var pV=class{constructor(e,i,n){this._hasScrollback=e,this._optionsService=i,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=pB.clone(),this.savedCharset=pU,this.markers=[],this._nullCell=cs.fromCharData([0,"",1,0]),this._whitespaceCell=cs.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ph,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new pP(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new cr),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new cr),this._whitespaceCell}getBlankLine(e,i){return new pF(this._bufferService.cols,this.getNullCell(e),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let i=e+this._optionsService.rawOptions.scrollback;return i>0xffffffff?0xffffffff:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=pB);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new pP(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,i){let n=this.getNullCell(pB),r=0,s=this._getCorrectBufferLength(i);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let i=0;i<this.lines.length;i++)r+=+this.lines.get(i).resize(e,n);let o=0;if(this._rows<i)for(let r=this._rows;r<i;r++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new pF(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new pF(e,n)));else for(let e=this._rows;e>i;e--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let e=this.lines.length-s;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let i=0;i<this.lines.length;i++)r+=+this.lines.get(i).resize(e,n);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let i=0;for(;this._memoryCleanupPosition<this.lines.length;)if((i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory())>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let n=this._optionsService.rawOptions.reflowCursorLine,r=function(e,i,n,r,s,o){let a=[];for(let l=0;l<e.length-1;l++){let c=l,d=e.get(++c);if(!d.isWrapped)continue;let h=[e.get(l)];for(;c<e.length&&d.isWrapped;)h.push(d),d=e.get(++c);if(!o&&r>=l&&r<c){l+=h.length-1;continue}let u=0,p=pH(h,0,i),f=1,m=0;for(;f<h.length;){let e=pH(h,f,i),r=Math.min(e-m,n-p);h[u].copyCellsFrom(h[f],m,p,r,!1),(p+=r)===n&&(u++,p=0),(m+=r)===e&&(f++,m=0),0===p&&0!==u&&2===h[u-1].getWidth(n-1)&&(h[u].copyCellsFrom(h[u-1],n-1,p++,1,!1),h[u-1].setCell(n-1,s))}h[u].replaceCells(p,n,s);let g=0;for(let e=h.length-1;e>0&&(e>u||0===h[e].getTrimmedLength());e--)g++;g>0&&(a.push(l+h.length-g),a.push(g)),l+=h.length-1}return a}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(pB),n);if(r.length>0){let n=function(e,i){let n=[],r=0,s=i[0],o=0;for(let a=0;a<e.length;a++)if(s===a){let n=i[++r];e.onDeleteEmitter.fire({index:a-o,amount:n}),a+=n-1,o+=n,s=i[++r]}else n.push(a);return{layout:n,countRemoved:o}}(this.lines,r);(function(e,i){let n=[];for(let r=0;r<i.length;r++)n.push(e.get(i[r]));for(let i=0;i<n.length;i++)e.set(i,n[i]);e.length=i.length})(this.lines,n.layout),this._reflowLargerAdjustViewport(e,i,n.countRemoved)}}_reflowLargerAdjustViewport(e,i,n){let r=this.getNullCell(pB),s=n;for(;s-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new pF(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,i){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(pB),s=[],o=0;for(let a=this.lines.length-1;a>=0;a--){let l=this.lines.get(a);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let c=[l];for(;l.isWrapped&&a>0;)l=this.lines.get(--a),c.unshift(l);if(!n){let e=this.ybase+this.y;if(e>=a&&e<a+c.length)continue}let d=c[c.length-1].getTrimmedLength(),h=function(e,i,n){let r=[],s=e.map((n,r)=>pH(e,r,i)).reduce((e,i)=>e+i),o=0,a=0,l=0;for(;l<s;){if(s-l<n){r.push(s-l);break}o+=n;let c=pH(e,a,i);o>c&&(o-=c,a++);let d=2===e[a].getWidth(o-1);d&&o--;let h=d?n-1:n;r.push(h),l+=h}return r}(c,this._cols,e),u=h.length-c.length,p;p=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+u):Math.max(0,this.lines.length-this.lines.maxLength+u);let f=[];for(let e=0;e<u;e++){let e=this.getBlankLine(pB,!0);f.push(e)}f.length>0&&(s.push({start:a+c.length+o,newLines:f}),o+=f.length),c.push(...f);let m=h.length-1,g=h[m];0===g&&(g=h[--m]);let v=c.length-u-1,y=d;for(;v>=0;){let e=Math.min(y,g);if(void 0===c[m])break;c[m].copyCellsFrom(c[v],y-e,g-e,e,!0),0==(g-=e)&&(g=h[--m]),0==(y-=e)&&(y=pH(c,Math.max(--v,0),this._cols))}for(let i=0;i<c.length;i++)h[i]<e&&c[i].setCell(h[i],r);let _=u-p;for(;_-- >0;)0===this.ybase?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+u,this.ybase+i-1)}if(s.length>0){let e=[],i=[];for(let e=0;e<this.lines.length;e++)i.push(this.lines.get(e));let n=this.lines.length,r=n-1,a=0,l=s[0];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let c=0;for(let d=Math.min(this.lines.maxLength-1,n+o-1);d>=0;d--)if(l&&l.start>r+c){for(let e=l.newLines.length-1;e>=0;e--)this.lines.set(d--,l.newLines[e]);d++,e.push({index:r+1,amount:l.newLines.length}),c+=l.newLines.length,l=s[++a]}else this.lines.set(d,i[r--]);let d=0;for(let i=e.length-1;i>=0;i--)e[i].index+=d,this.lines.onInsertEmitter.fire(e[i]),d+=e[i].amount;let h=Math.max(0,n+o-this.lines.maxLength);h>0&&this.lines.onTrimEmitter.fire(h)}}translateBufferLineToString(e,i,n=0,r){let s=this.lines.get(e);return s?s.translateToString(i,n,r):""}getWrappedRangeForLine(e){let i=e,n=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:i,last:n}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let i=new pW(e);return this.markers.push(i),i.register(this.lines.onTrim(e=>{i.line-=e,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(e=>{i.line>=e.index&&(i.line+=e.amount)})),i.register(this.lines.onDelete(e=>{i.line>=e.index&&i.line<e.index+e.amount&&i.dispose(),i.line>e.index&&(i.line-=e.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},pq=class extends c${constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new dA),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new pV(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new pV(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},pK=class extends c${constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new dA),this.onResize=this._onResize.event,this._onScroll=this._register(new dA),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new pq(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let n=this.cols!==e,r=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let n=this.buffer,r;(r=this._cachedBlankLine)&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,i),this._cachedBlankLine=r),r.isWrapped=i;let s=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(0===n.scrollTop){let e=n.lines.isFull;o===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(o+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=o-s+1;n.lines.shiftElements(s+1,e-1,-1),n.lines.set(o,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,i){let n=this.buffer;if(e<0){if(0===n.ydisp)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(i||this._onScroll.fire(n.ydisp))}};pK=l2([l5(0,cg)],pK);var pY={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:pi,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},pX=["normal","bold","100","200","300","400","500","600","700","800","900"],pJ=class extends c${constructor(e){super(),this._onOptionChange=this._register(new dA),this.onOptionChange=this._onOptionChange.event;let i={...pY};for(let n in e)if(n in i)try{let r=e[n];i[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(cF(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(n=>{n===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(n=>{-1!==e.indexOf(n)&&i()})}_setupOptions(){let e=e=>{if(!(e in pY))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in pY))throw Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":var n;if(i||(i=pY[e]),"block"!==(n=i)&&"underline"!==n&&"bar"!==n)throw Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=pY[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=pX.includes(i)?i:pY[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,0xffffffff))<0)throw Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&0!==i)throw Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}};function pG(e,i=5){if("object"!=typeof e)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=i<=1?e[r]:e[r]&&pG(e[r],i-1);return n}var pZ=Object.freeze({insertMode:!1}),pQ=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),p0=class extends c${constructor(e,i,n){super(),this._bufferService=e,this._logService=i,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new dA),this.onData=this._onData.event,this._onUserInput=this._register(new dA),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new dA),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new dA),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=pG(pZ),this.decPrivateModes=pG(pQ)}reset(){this.modes=pG(pZ),this.decPrivateModes=pG(pQ)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};p0=l2([l5(0,cd),l5(1,cm),l5(2,cg)],p0);var p1={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function p2(e,i){let n=16*!!e.ctrl|4*!!e.shift|8*!!e.alt;return 4===e.button?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),32===e.action?n|=32:0!==e.action||i||(n|=3)),n}var p5=String.fromCharCode,p3={DEFAULT:e=>{let i=[p2(e,!1)+32,e.col+32,e.row+32];return i[0]>255||i[1]>255||i[2]>255?"":`\x1b[M${p5(i[0])}${p5(i[1])}${p5(i[2])}`},SGR:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${p2(e,!0)};${e.col};${e.row}${i}`},SGR_PIXELS:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${p2(e,!0)};${e.x};${e.y}${i}`}},p4=class extends c${constructor(e,i,n){for(let r of(super(),this._bufferService=e,this._coreService=i,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new dA),this.onProtocolChange=this._onProtocolChange.event,Object.keys(p1)))this.addProtocol(r,p1[r]);for(let e of Object.keys(p3))this.addEncoding(e,p3[e]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,i,n){if(0===e.deltaY||e.shiftKey||void 0===i||void 0===n)return 0;let r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=i/n+0,50>Math.abs(e.deltaY)&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,i,n){if(n){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return e.button===i.button&&e.action===i.action&&e.ctrl===i.ctrl&&e.alt===i.alt&&e.shift===i.shift}};p4=l2([l5(0,cd),l5(1,cu),l5(2,cg)],p4);var p6,p8,p9,p7,fe,ft,fi=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],fn=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],fr=class{constructor(){if(this.version="6",!ft){(ft=new Uint8Array(65536)).fill(1),ft[0]=0,ft.fill(0,1,32),ft.fill(0,127,160),ft.fill(2,4352,4448),ft[9001]=2,ft[9002]=2,ft.fill(2,11904,42192),ft[12351]=1,ft.fill(2,44032,55204),ft.fill(2,63744,64256),ft.fill(2,65040,65050),ft.fill(2,65072,65136),ft.fill(2,65280,65377),ft.fill(2,65504,65511);for(let e=0;e<fi.length;++e)ft.fill(0,fi[e][0],fi[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ft[e]:!function(e,i){let n=0,r=i.length-1,s;if(e<i[0][0]||e>i[r][1])return!1;for(;r>=n;)if(e>i[s=n+r>>1][1])n=s+1;else{if(!(e<i[s][0]))return!0;r=s-1}return!1}(e,fn)?e>=131072&&e<=196605||e>=196608&&e<=262141?2:1:0}charProperties(e,i){let n=this.wcwidth(e),r=0===n&&0!==i;if(r){let e=fs.extractWidth(i);0===e?r=!1:e>n&&(n=e)}return fs.createPropertyValue(0,n,r)}},fs=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new dA,this.onChange=this._onChange.event;let e=new fr;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,n=!1){return(0xffffff&e)<<3|(3&i)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(i){let n=0,r=0,s=i.length;for(let o=0;o<s;++o){let a=i.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=s)return n+this.wcwidth(a);let e=i.charCodeAt(o);56320<=e&&e<=57343?a=(a-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let l=this.charProperties(a,r),c=e.extractWidth(l);e.extractShouldJoin(l)&&(c-=e.extractWidth(r)),n+=c,r=l}return n}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},fo=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function fa(e){let i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&i&&(n.isWrapped=0!==i[3]&&32!==i[3])}var fl=class e{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>256)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(i){let n=new e;if(!i.length)return n;for(let e=+!!Array.isArray(i[0]);e<i.length;++e){let r=i[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let i=new e(this.maxLength,this.maxSubParamsLength);return i.params.set(this.params),i.length=this.length,i._subParams.set(this._subParams),i._subParamsLength=this._subParamsLength,i._subParamsIdx.set(this._subParamsIdx),i._rejectDigits=this._rejectDigits,i._rejectSubDigits=this._rejectSubDigits,i._digitIsSub=this._digitIsSub,i}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let n=this._subParamsIdx[i]>>8,r=255&this._subParamsIdx[i];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>0x7fffffff?0x7fffffff:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>0x7fffffff?0x7fffffff:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-i>0?this._subParams.subarray(i,n):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let n=this._subParamsIdx[i]>>8,r=255&this._subParamsIdx[i];r-n>0&&(e[i]=this._subParams.slice(n,r))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[i-1];n[i-1]=~r?Math.min(10*r+e,0x7fffffff):e}},fc=[],fd=class{constructor(){this._state=0,this._active=fc,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(i),{dispose:()=>{let e=n.indexOf(i);-1!==e&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=fc}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=fc,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||fc,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,i,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,n);else this._handlerFb(this._id,"PUT",ce(e,i,n))}start(){this.reset(),this._state=1}put(e,i,n){if(3!==this._state){if(1===this._state)for(;i<n;){let n=e[i++];if(59===n){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}-1===this._id&&(this._id=0),this._id=10*this._id+n-48}2===this._state&&n-i>0&&this._put(e,i,n)}}end(e,i=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=i,s=this._stack.fallThrough,this._stack.paused=!1),!s&&!1===n){for(;r>=0&&!0!==(n=this._active[r].end(e));r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if((n=this._active[r].end(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._id,"END",e);this._active=fc,this._id=-1,this._state=0}}},fh=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,n){this._hitLimit||(this._data+=ce(e,i,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data))instanceof Promise)return i.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,i}},fu=[],fp=class{constructor(){this._handlers=Object.create(null),this._active=fu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=fu}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(i),{dispose:()=>{let e=n.indexOf(i);-1!==e&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=fu,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||fu,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(i);else this._handlerFb(this._ident,"HOOK",i)}put(e,i,n){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,n);else this._handlerFb(this._ident,"PUT",ce(e,i,n))}unhook(e,i=!0){if(this._active.length){let n=!1,r=this._active.length-1,s=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=i,s=this._stack.fallThrough,this._stack.paused=!1),!s&&!1===n){for(;r>=0&&!0!==(n=this._active[r].unhook(e));r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if((n=this._active[r].unhook(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}else this._handlerFb(this._ident,"UNHOOK",e);this._active=fu,this._ident=0}},ff=new fl;ff.addParam(0);var fm=class{constructor(e){this._handler=e,this._data="",this._params=ff,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ff,this._data="",this._hitLimit=!1}put(e,i,n){this._hitLimit||(this._data+=ce(e,i,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data,this._params))instanceof Promise)return i.then(e=>(this._params=ff,this._data="",this._hitLimit=!1,e));return this._params=ff,this._data="",this._hitLimit=!1,i}},fg=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,n,r){this.table[i<<8|e]=n<<4|r}addMany(e,i,n,r){for(let s=0;s<e.length;s++)this.table[i<<8|e[s]]=n<<4|r}},fv=function(){let e=new fg(4095),i=Array.apply(null,Array(256)).map((e,i)=>i),n=(e,n)=>i.slice(e,n),r=n(32,127),s=n(0,24);s.push(25),s.push.apply(s,n(28,32));let o=n(0,14),a;for(a in e.setDefault(1,0),e.addMany(r,0,2,0),o)e.addMany([24,26,153,154],a,3,0),e.addMany(n(128,144),a,3,0),e.addMany(n(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}(),fy=class extends c${constructor(e=fv){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new fl,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(cF(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new fd),this._dcsParser=this._register(new fp),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error("only one byte as prefix supported");if((n=e.prefix.charCodeAt(0))&&60>n||n>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let r=e.intermediates.charCodeAt(i);if(32>r||r>47)throw Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=r}}if(1!==e.final.length)throw Error("final must be a single byte");let r=e.final.charCodeAt(0);if(i[0]>r||r>i[1])throw Error(`final must be in range ${i[0]} .. ${i[1]}`);return n<<=8,n|=r}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(255&e)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let n=this._identifier(e,[48,126]);void 0===this._escHandlers[n]&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let n=this._identifier(e);void 0===this._csiHandlers[n]&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,n,r,s){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=s}parse(e,i,n){let r=0,s=0,o=0,a;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===n||1===this._parseStack.state)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let i=this._parseStack.handlers,s=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===n&&s>-1){for(;s>=0&&!0!==(a=i[s](this._params));s--)if(a instanceof Promise)return this._parseStack.handlerPos=s,a}this._parseStack.handlers=[];break;case 4:if(!1===n&&s>-1){for(;s>=0&&!0!==(a=i[s]());s--)if(a instanceof Promise)return this._parseStack.handlerPos=s,a}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],a=this._dcsParser.unhook(24!==r&&26!==r,n))return a;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],a=this._oscParser.end(24!==r&&26!==r,n))return a;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let n=o;n<i;++n){switch(r=e[n],(s=this._transitions.table[this.currentState<<8|(r<160?r:160)])>>4){case 2:for(let s=n+1;;++s)if(s>=i||(r=e[s])<32||r>126&&r<160||++s>=i||(r=e[s])<32||r>126&&r<160||++s>=i||(r=e[s])<32||r>126&&r<160||++s>=i||(r=e[s])<32||r>126&&r<160){this._printHandler(e,n,s),n=s-1;break}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|r],l=o?o.length-1:-1;for(;l>=0&&!0!==(a=o[l](this._params));l--)if(a instanceof Promise)return this._preserveStack(3,o,l,s,n),a;l<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<i&&(r=e[n])>47&&r<60)n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],d=c?c.length-1:-1;for(;d>=0&&!0!==(a=c[d]());d--)if(a instanceof Promise)return this._preserveStack(4,c,d,s,n),a;d<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let s=n+1;;++s)if(s>=i||24===(r=e[s])||26===r||27===r||r>127&&r<160){this._dcsParser.put(e,n,s),n=s-1;break}break;case 14:if(a=this._dcsParser.unhook(24!==r&&26!==r))return this._preserveStack(6,[],0,s,n),a;27===r&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let s=n+1;;s++)if(s>=i||(r=e[s])<32||r>127&&r<160){this._oscParser.put(e,n,s),n=s-1;break}break;case 6:if(a=this._oscParser.end(24!==r&&26!==r))return this._preserveStack(5,[],0,s,n),a;27===r&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&s}}},f_=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,fx=/^[\da-f]+$/;function fb(e){if(!e)return;let i=e.toLowerCase();if(0===i.indexOf("rgb:")){i=i.slice(4);let e=f_.exec(i);if(e){let i=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/i*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/i*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/i*255)]}}else if(0===i.indexOf("#")&&(i=i.slice(1),fx.exec(i)&&[3,6,9,12].includes(i.length))){let e=i.length/3,n=[0,0,0];for(let r=0;r<3;++r){let s=parseInt(i.slice(e*r,e*r+e),16);n[r]=1===e?s<<4:2===e?s:3===e?s>>4:s>>8}return n}}function fw(e,i){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(i){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}var fS={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function fk(e,i){if(e>24)return i.setWinLines||!1;switch(e){case 1:return!!i.restoreWin;case 2:return!!i.minimizeWin;case 3:return!!i.setWinPosition;case 4:return!!i.setWinSizePixels;case 5:return!!i.raiseWin;case 6:return!!i.lowerWin;case 7:return!!i.refreshWin;case 8:return!!i.setWinSizeChars;case 9:return!!i.maximizeWin;case 10:return!!i.fullscreenWin;case 11:return!!i.getWinState;case 13:return!!i.getWinPosition;case 14:return!!i.getWinSizePixels;case 15:return!!i.getScreenSizePixels;case 16:return!!i.getCellSizePixels;case 18:return!!i.getWinSizeChars;case 19:return!!i.getScreenSizeChars;case 20:return!!i.getIconTitle;case 21:return!!i.getWinTitle;case 22:return!!i.pushTitle;case 23:return!!i.popTitle;case 24:return!!i.setWinLines}return!1}var fC=0,fT=class extends c${constructor(e,i,n,r,s,o,a,l,c=new fy){for(let d in super(),this._bufferService=e,this._charsetService=i,this._coreService=n,this._logService=r,this._optionsService=s,this._oscLinkService=o,this._coreMouseService=a,this._unicodeService=l,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new ct,this._utf8Decoder=new ci,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=pB.clone(),this._eraseAttrDataInternal=pB.clone(),this._onRequestBell=this._register(new dA),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new dA),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new dA),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new dA),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new dA),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new dA),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new dA),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new dA),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new dA),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new dA),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new dA),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new dA),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new dA),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new fE(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,i)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:i.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,i,n)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:i,data:n})}),this._parser.setDcsHandlerFallback((e,i,n)=>{"HOOK"===i&&(n=n.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:i,payload:n})}),this._parser.setPrintHandler((e,i,n)=>this.print(e,i,n)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(up.BEL,()=>this.bell()),this._parser.setExecuteHandler(up.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(up.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(up.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(up.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(up.BS,()=>this.backspace()),this._parser.setExecuteHandler(up.HT,()=>this.tab()),this._parser.setExecuteHandler(up.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(up.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(uf.IND,()=>this.index()),this._parser.setExecuteHandler(uf.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(uf.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new fh(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new fh(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new fh(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new fh(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new fh(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new fh(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new fh(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new fh(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new fh(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new fh(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new fh(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new fh(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset()),p$)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new fm((e,i)=>this.requestStatusString(e,i)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let n,r=this._activeBuffer.x,s=this._activeBuffer.y,o=0,a=this._parseStack.paused;if(a){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(o=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${"string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`}`),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),a||this._dirtyRowTracker.clearRange(),e.length>131072)for(let i=o;i<e.length;i+=131072){let o=i+131072<e.length?i+131072:e.length,a="string"==typeof e?this._stringDecoder.decode(e.substring(i,o),this._parseBuffer):this._utf8Decoder.decode(e.subarray(i,o),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,a))return this._preserveStack(r,s,a,i),this._logSlowResolvingAsync(n),n}else if(!a){let i="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,i))return this._preserveStack(r,s,i,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,i,n){let r,s,o=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,h=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-i>0&&2===u.getWidth(this._activeBuffer.x-1)&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,h);let p=this._parser.precedingJoinState;for(let f=i;f<n;++f){if((r=e[f])<127&&o){let e=o[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let i=this._unicodeService.charProperties(r,p);s=fs.extractWidth(i);let n=fs.extractShouldJoin(i),m=n?fs.extractWidth(p):0;if(p=i,a&&this._onA11yChar.fire(l7(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-m>l){if(c){let e=u,i=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&u instanceof pF&&u.copyCellsFrom(e,i,0,m,!1);i<l;)e.setCellFromCodepoint(i++,0,1,h)}else if(this._activeBuffer.x=l-1,2===s)continue}if(n&&this._activeBuffer.x){let e=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-e,r,s);for(let e=s-m;--e>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h);continue}if(d&&(u.insertCells(this._activeBuffer.x,s-m,this._activeBuffer.getNullCell(h)),2===u.getWidth(l-1)&&u.setCellFromCodepoint(l-1,0,1,h)),u.setCellFromCodepoint(this._activeBuffer.x++,r,s,h),s>0)for(;--s;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,h)}this._parser.precedingJoinState=p,this._activeBuffer.x<l&&n-i>0&&0===u.getWidth(this._activeBuffer.x)&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,h),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,i):this._parser.registerCsiHandler(e,e=>!fk(e.params[0],this._optionsService.rawOptions.windowOptions)||i(e))}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new fm(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new fh(i))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let i=e.params[0];return 0===i?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===i&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return 1===i&&(this._curAttrData.bg|=0x20000000),(2===i||0===i)&&(this._curAttrData.bg&=-0x20000001),!0}_eraseInBufferLine(e,i,n,r=!1,s=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(i,n,this._activeBuffer.getNullCell(this._eraseAttrData()),s),r&&(o.isWrapped=!1)}_resetBufferLine(e,i=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,i=!1){let n;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);n<this._bufferService.rows;n++)this._resetBufferLine(n,i);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,i),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0))}return!0}eraseInLine(e,i=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;i--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;i--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let i=e.params[0]||1;for(;i--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let i=e.params[0]||1;for(;i--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(pB));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let i=this._parser.precedingJoinState;if(!i)return!0;let n=e.params[0]||1,r=fs.extractWidth(i),s=this._activeBuffer.x-r,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),a=new Uint32Array(o.length*n),l=0;for(let e=0;e<o.length;){let i=o.codePointAt(e)||0;a[l++]=i,e+=i>65535?2:1}let c=l;for(let e=1;e<n;++e)a.copyWithin(c,0,l),c+=l;return this.print(a,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(up.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(up.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(up.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(up.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(up.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,pU),this._charsetService.setgCharset(1,pU),this._charsetService.setgCharset(2,pU),this._charsetService.setgCharset(3,pU);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),1049===e.params[i]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,i){let n,r,s,o;(r=n||={})[r.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",r[r.SET=1]="SET",r[r.RESET=2]="RESET",r[r.PERMANENTLY_SET=3]="PERMANENTLY_SET",r[r.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let a=this._coreService.decPrivateModes,{activeProtocol:l,activeEncoding:c}=this._coreMouseService,d=this._coreService,{buffers:h,cols:u}=this._bufferService,{active:p,alt:f}=h,m=this._optionsService.rawOptions,g=e=>e?1:2,v=e.params[0];return s=v,o=i?2===v?4:4===v?g(d.modes.insertMode):12===v?3:20===v?g(m.convertEol):0:1===v?g(a.applicationCursorKeys):3===v?m.windowOptions.setWinLines?80===u?2:+(132===u):0:6===v?g(a.origin):7===v?g(a.wraparound):8===v?3:9===v?g("X10"===l):12===v?g(m.cursorBlink):25===v?g(!d.isCursorHidden):45===v?g(a.reverseWraparound):66===v?g(a.applicationKeypad):67===v?4:1e3===v?g("VT200"===l):1002===v?g("DRAG"===l):1003===v?g("ANY"===l):1004===v?g(a.sendFocus):1005===v?4:1006===v?g("SGR"===c):1015===v?4:1016===v?g("SGR_PIXELS"===c):1048===v?1:47===v||1047===v||1049===v?g(p===f):2004===v?g(a.bracketedPasteMode):2026===v?g(a.synchronizedOutput):0,d.triggerDataEvent(`${up.ESC}[${i?"":"?"}${s};${o}$y`),!0}_updateAttrColor(e,i,n,r,s){return 2===i?(e|=0x3000000,e&=-0x1000000,e|=cn.fromColorRGB([n,r,s])):5===i&&(e&=-0x3000100,e|=0x2000000|255&n),e}_extractColor(e,i,n){let r=[0,0,-1,0,0,0],s=0,o=0;do{if(r[o+s]=e.params[i+o],e.hasSubParams(i+o)){let n=e.getSubParams(i+o),a=0;do 5===r[1]&&(s=1),r[o+a+1+s]=n[a];while(++a<n.length&&a+o+1+s<r.length)break}if(5===r[1]&&o+s>=2||2===r[1]&&o+s>=5)break;r[1]&&(s=1)}while(++o+i<e.length&&o+s<r.length)for(let e=2;e<r.length;++e)-1===r[e]&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return o}_processUnderline(e,i){i.extended=i.extended.clone(),(!~e||e>5)&&(e=1),i.extended.underlineStyle=e,i.fg|=0x10000000,0===e&&(i.fg&=-0x10000001),i.updateExtended()}_processSGR0(e){e.fg=pB.fg,e.bg=pB.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-0x4000000,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let i=e.length,n,r=this._curAttrData;for(let s=0;s<i;s++)(n=e.params[s])>=30&&n<=37?(r.fg&=-0x3000100,r.fg|=0x1000000|n-30):n>=40&&n<=47?(r.bg&=-0x3000100,r.bg|=0x1000000|n-40):n>=90&&n<=97?(r.fg&=-0x3000100,r.fg|=0x1000000|n-90|8):n>=100&&n<=107?(r.bg&=-0x3000100,r.bg|=0x1000000|n-100|8):0===n?this._processSGR0(r):1===n?r.fg|=0x8000000:3===n?r.bg|=0x4000000:4===n?(r.fg|=0x10000000,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,r)):5===n?r.fg|=0x20000000:7===n?r.fg|=0x4000000:8===n?r.fg|=0x40000000:9===n?r.fg|=0x80000000:2===n?r.bg|=0x8000000:21===n?this._processUnderline(2,r):22===n?(r.fg&=-0x8000001,r.bg&=-0x8000001):23===n?r.bg&=-0x4000001:24===n?(r.fg&=-0x10000001,this._processUnderline(0,r)):25===n?r.fg&=-0x20000001:27===n?r.fg&=-0x4000001:28===n?r.fg&=-0x40000001:29===n?r.fg&=0x7fffffff:39===n?(r.fg&=-0x4000000,r.fg|=0xffffff&pB.fg):49===n?(r.bg&=-0x4000000,r.bg|=0xffffff&pB.bg):38===n||48===n||58===n?s+=this._extractColor(e,s,r):53===n?r.bg|=0x40000000:55===n?r.bg&=-0x40000001:59===n?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):100===n?(r.fg&=-0x4000000,r.fg|=0xffffff&pB.fg,r.bg&=-0x4000000,r.bg|=0xffffff&pB.bg):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${up.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${up.ESC}[${i};${n}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${up.ESC}[?${e};${i}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=pB.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let i=0===e.length?1:e.params[0];if(0===i)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}this._coreService.decPrivateModes.cursorBlink=i%2==1}return!0}setScrollRegion(e){let i=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||0===n)&&(n=this._bufferService.rows),n>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!fk(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==i&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${up.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===i||2===i)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===i||1===i)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===i||2===i)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===i||1===i)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let i=[],n=e.split(";");for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(fD(n))if("?"===r)i.push({type:0,index:n});else{let e=fb(r);e&&i.push({type:1,index:n,color:e})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(-1===i)return!0;let n=e.slice(0,i).trim(),r=e.slice(i+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,s=n.findIndex(e=>e.startsWith("id="));return -1!==s&&(r=n[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let n=e.split(";");for(let e=0;e<n.length&&!(i>=this._specialColors.length);++e,++i)if("?"===n[e])this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let r=fb(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[i],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let i=[],n=e.split(";");for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);fD(r)&&i.push({type:2,index:r})}return i.length&&this._onColor.fire(i),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,pU),!0}selectCharset(e){return 2!==e.length?this.selectDefaultCharset():"/"===e[0]||this._charsetService.setgCharset(fS[e[0]],p$[e[1]]||pU),!0}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=pB.clone(),this._eraseAttrDataInternal=pB.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-0x4000000,this._eraseAttrDataInternal.bg|=0x3ffffff&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new cs;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i<this._bufferService.rows;++i){let n=this._activeBuffer.ybase+this._activeBuffer.y+i,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,i){let n=e=>(this._coreService.triggerDataEvent(`${up.ESC}${e}${up.ESC}\\`),!0),r=this._bufferService.buffer,s=this._optionsService.rawOptions;return n('"q'===e?`P1$r${+!!this._curAttrData.isProtected()}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${({block:2,underline:4,bar:6})[s.cursorStyle]-!!s.cursorBlink} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},fE=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,i){e>i&&(fC=e,e=i,i=fC),e<this.start&&(this.start=e),i>this.end&&(this.end=i)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function fD(e){return 0<=e&&e<256}fE=l2([l5(0,cd)],fE);var fN=class extends c${constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new dA),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){let n;if(void 0!==i&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,!this._isSyncWriting){for(this._isSyncWriting=!0;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=0x7fffffff,this._isSyncWriting=!1,this._syncCalls=0}}write(e,i){if(this._pendingData>5e7)throw Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,i);if(r){let e=e=>performance.now()-n>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e);r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e);return}let s=this._callbacks[this._bufferOffset];if(s&&s(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},fM=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(void 0===e.id){let n=i.addMarker(i.ybase+i.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=this._getEntryIdKey(e),r=this._entriesWithId.get(n);if(r)return this.addLineToLink(r.id,i.ybase+i.y),r.id;let s=i.addMarker(i.ybase+i.y),o={id:this._nextId++,key:this._getEntryIdKey(e),data:e,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,i){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==i)){let e=this._bufferService.buffer.addMarker(i);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let n=e.lines.indexOf(i);-1!==n&&(e.lines.splice(n,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};fM=l2([l5(0,cd)],fM);var fO=!1,fR=class extends c${constructor(e){super(),this._windowsWrappingHeuristics=this._register(new cU),this._onBinary=this._register(new dA),this.onBinary=this._onBinary.event,this._onData=this._register(new dA),this.onData=this._onData.event,this._onLineFeed=this._register(new dA),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new dA),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new dA),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new dA),this._instantiationService=new pL,this.optionsService=this._register(new pJ(e)),this._instantiationService.setService(cg,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(pK)),this._instantiationService.setService(cd,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(pI)),this._instantiationService.setService(cm,this._logService),this.coreService=this._register(this._instantiationService.createInstance(p0)),this._instantiationService.setService(cu,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(p4)),this._instantiationService.setService(ch,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(fs)),this._instantiationService.setService(cy,this.unicodeService),this._charsetService=this._instantiationService.createInstance(fo),this._instantiationService.setService(cp,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(fM),this._instantiationService.setService(cv,this._oscLinkService),this._inputHandler=this._register(new fT(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(dT.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(dT.forward(this._bufferService.onResize,this._onResize)),this._register(dT.forward(this.coreService.onData,this._onData)),this._register(dT.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new fN((e,i)=>this._inputHandler.parse(e,i))),this._register(dT.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new dA),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!fO&&(this._logService.warn("writeSync is unreliable and will be removed soon."),fO=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,2),i=Math.max(i,1),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&void 0!==i.buildNumber&&void 0!==i.buildNumber?e="conpty"===i.backend&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(fa.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(fa(this._bufferService),!1))),this._windowsWrappingHeuristics.value=cF(()=>{for(let i of e)i.dispose()})}}},fA={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']},fL=0,fj=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ph,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ph,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,i)=>this._getKey(e)-this._getKey(i)),i=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let s=0;s<r.length;s++)n>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[n])?(r[s]=e[i],i++):r[s]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;let i=this._getKey(e);if(void 0===i||-1===(fL=this._search(i))||this._getKey(this._array[fL])!==i)return!1;do if(this._array[fL]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(fL),!0;while(++fL<this._array.length&&this._getKey(this._array[fL])===i)return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,i)=>e-i),i=0,n=Array(this._array.length-e.length),r=0;for(let s=0;s<this._array.length;s++)e[i]===s?i++:n[r++]=this._array[s];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((fL=this._search(e))<0||fL>=this._array.length)&&this._getKey(this._array[fL])===e)do yield this._array[fL];while(++fL<this._array.length&&this._getKey(this._array[fL])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((fL=this._search(e))<0||fL>=this._array.length)&&this._getKey(this._array[fL])===e)do i(this._array[fL]);while(++fL<this._array.length&&this._getKey(this._array[fL])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,n=this._array.length-1;for(;n>=i;){let r=i+n>>1,s=this._getKey(this._array[r]);if(s>e)n=r-1;else if(s<e)i=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return i}},fI=0,fP=0,fB=class extends c${constructor(){super(),this._decorations=new fj(e=>e?.marker.line),this._onDecorationRegistered=this._register(new dA),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new dA),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(cF(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new fz(e);if(i){let e=i.marker.onDispose(()=>i.dispose()),n=i.onDispose(()=>{n.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),e.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,n){let r=0,s=0;for(let o of this._decorations.getKeyIterator(i))s=(r=o.options.x??0)+(o.options.width??1),e>=r&&e<s&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,i,n,r){this._decorations.forEachByKey(i,i=>{fP=(fI=i.options.x??0)+(i.options.width??1),e>=fI&&e<fP&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},fz=class extends cW{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new dA),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new dA),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=p9.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=p9.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},fF=class{constructor(e,i=1e3){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,n){this._rowCount=n,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,i=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},i)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},fH=class extends c${constructor(e,i,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new fF(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
24
+ `))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(hP(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(cF(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let i=0;i<e;i++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
25
+ `&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=l4)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let n=this._terminal.buffer,r=n.lines.length.toString();for(let s=e;s<=i;s++){let e=n.lines.get(n.ydisp+s),i=[],o=e?.translateToString(!0,void 0,void 0,i)||"",a=(n.ydisp+s+1).toString(),l=this._rowElements[s];l&&(0===o.length?(l.textContent=" ",this._rowColumns.set(l,[0,1])):(l.textContent=o,this._rowColumns.set(l,i)),l.setAttribute("aria-posinset",a),l.setAttribute("aria-setsize",r),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let n,r,s=e.target,o=this._rowElements[0===i?1:this._rowElements.length-2];if(s.getAttribute("aria-posinset")!==(0===i?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===o){if(0===i?(n=s,r=this._rowElements.pop(),this._rowContainer.removeChild(r)):(n=this._rowElements.shift(),r=s,this._rowContainer.removeChild(n)),n.removeEventListener("focus",this._topBoundaryFocusListener),r.removeEventListener("focus",this._bottomBoundaryFocusListener),0===i){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===i?-1:1),this._rowElements[0===i?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){if(0===this._rowElements.length)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===n.node&&i.offset>n.offset)&&([i,n]=[n,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let s=({node:e,offset:i})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute("aria-posinset"),10)-1;if(isNaN(r))return console.warn("row is invalid. Race condition?"),null;let s=this._rowColumns.get(n);if(!s)return console.warn("columns is null. Race condition?"),null;let o=i<s.length?s[i]:s.slice(-1)[0]+1;return o>=this._terminal.cols&&(++r,o=0),{row:r,column:o}},o=s(i),a=s(n);if(!(!o||!a)){if(o.row>a.row||o.row===a.row&&o.column>=a.column)throw Error("invalid range");this._terminal.select(o.column,o.row,(a.row-o.row)*this._terminal.cols-o.column+a.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let i=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/i})`}};fH=l2([l5(1,cf),l5(2,cw),l5(3,ck)],fH);var fW=class extends c${constructor(e,i,n,r,s){super(),this._element=e,this._mouseService=i,this._renderService=n,this._bufferService=r,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new dA),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new dA),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(cF(()=>{cz(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(hP(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(hP(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(hP(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(hP(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let i=n[e];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,i){this._activeProviderReplies&&i||(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,s]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):s.provideLinks(e.y,i=>{if(this._isMouseOut)return;let s=i?.map(e=>({link:e}));this._activeProviderReplies?.set(r,s),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let n=new Set;for(let r=0;r<i.size;r++){let s=i.get(r);if(s)for(let i=0;i<s.length;i++){let r=s[i],o=r.link.range.start.y<e?0:r.link.range.start.x,a=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=o;e<=a;e++){if(n.has(e)){s.splice(i--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,i,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),s=!1;for(let i=0;i<e;i++)(!this._activeProviderReplies.has(i)||this._activeProviderReplies.get(i))&&(s=!0);if(!s&&r){let e=r.find(e=>this._linkAtPosition(e.link,i));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,i));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){var i,n;if(!this._currentLink)return;let r=this._positionFromMouseEvent(e,this._element,this._mouseService);r&&this._mouseDownLink&&(i=this._mouseDownLink.link,n=this._currentLink.link,i.text===n.text&&i.range.start.x===n.range.start.x&&i.range.start.y===n.range.start.y&&i.range.end.x===n.range.end.x&&i.range.end.y===n.range.end.y)&&this._linkAtPosition(this._currentLink.link,r)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){this._currentLink&&this._lastMouseEvent&&(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,cz(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let i=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(i,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,i,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(n,i.text)}_fireUnderlineEvent(e,i){let n=e.range,r=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,i,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(n,i.text)}_linkAtPosition(e,i){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,s=i.y*this._bufferService.cols+i.x;return n<=s&&s<=r}_positionFromMouseEvent(e,i,n){let r=n.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,n,r,s){return{x1:e,y1:i,x2:n,y2:r,cols:this._bufferService.cols,fg:s}}};fW=l2([l5(1,cS),l5(2,ck),l5(3,cd),l5(4,cD)],fW);var f$=class extends fR{constructor(e={}){super(e),this._linkifier=this._register(new cU),this.browser=u2,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new cU),this._onCursorMove=this._register(new dA),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new dA),this.onKey=this._onKey.event,this._onRender=this._register(new dA),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new dA),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new dA),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new dA),this.onBell=this._onBell.event,this._onFocus=this._register(new dA),this._onBlur=this._register(new dA),this._onA11yCharEmitter=this._register(new dA),this._onA11yTabEmitter=this._register(new dA),this._onWillOpen=this._register(new dA),this._setup(),this._decorationService=this._instantiationService.createInstance(fB),this._instantiationService.setService(c_,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(uZ),this._instantiationService.setService(cD,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(cx)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(dT.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(dT.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(dT.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(dT.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(cF(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let e,n="";switch(i.index){case 256:e="foreground",n="10";break;case 257:e="background",n="11";break;case 258:e="cursor",n="12";break;default:e="ansi",n="4;"+i.index}switch(i.type){case 0:let r=p8.toColorRGB("ansi"===e?this._themeService.colors.ansi[i.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${up.ESC}]${n};${function(e,i=16){let[n,r,s]=e;return`rgb:${fw(n,i)}/${fw(r,i)}/${fw(s,i)}`}(r)}${um.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[i.index]=ug.toColor(...i.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=ug.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(fH,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(up.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(up.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,s=i.getWidth(n),o=this._renderService.dimensions.css.cell.width*s,a=this.buffer.y*this._renderService.dimensions.css.cell.height,l=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=a+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(hP(this.element,"copy",e=>{var i;this.hasSelection()&&(i=this._selectionService,e.clipboardData&&e.clipboardData.setData("text/plain",i.selectionText),e.preventDefault())}));let e=e=>{var i,n,r;return i=this.textarea,n=this.coreService,r=this.optionsService,void(e.stopPropagation(),e.clipboardData&&l6(e.clipboardData.getData("text/plain"),i,n,r))};this._register(hP(this.textarea,"paste",e)),this._register(hP(this.element,"paste",e)),u9?this._register(hP(this.element,"mousedown",e=>{2===e.button&&l9(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(hP(this.element,"contextmenu",e=>{l9(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),po&&this._register(hP(this.element,"auxclick",e=>{1===e.button&&l8(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(hP(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(hP(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(hP(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(hP(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(hP(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(hP(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(hP(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(hP(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",l3),pa||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(uJ,this.textarea,e.ownerDocument.defaultView??window,this._document??"u">typeof window?window.document:null)),this._instantiationService.setService(cw,this._coreBrowserService),this._register(hP(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(hP(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(uq,this._document,this._helperContainer),this._instantiationService.setService(cb,this._charSizeService),this._themeService=this._instantiationService.createInstance(pO),this._instantiationService.setService(cE,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(uR),this._instantiationService.setService(cT,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(pp,this.rows,this.screenElement)),this._instantiationService.setService(ck,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ua,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(u0),this._instantiationService.setService(cS,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(fW,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(ue,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(pS,this.element,this.screenElement,r)),this._instantiationService.setService(cC,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(dT.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(ut,this.screenElement)),this._register(hP(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(fH,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uo,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(uo,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(uV,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function n(i){let n,r,s=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!s)return!1;switch(i.overrideType||i.type){case"mousemove":r=32,void 0===i.buttons?(n=3,void 0!==i.button&&(n=i.button<3?i.button:3)):n=1&i.buttons?0:4&i.buttons?1:2&i.buttons?2:3;break;case"mouseup":r=0,n=i.button<3?i.button:3;break;case"mousedown":r=1,n=i.button<3?i.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(i))return!1;let o=i.deltaY;if(0===o||0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return!1;r=o<0?0:1,n=4;break;default:return!1}return void 0!==r&&void 0!==n&&!(n>4)&&e.coreMouseService.triggerMouseEvent({col:s.col,row:s.row,x:s.x,y:s.y,button:n,action:r,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s=e=>(n(e),e.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(e)),o=e=>(n(e),this.cancel(e,!0)),a=e=>{e.buttons&&n(e)},l=e=>{e.buttons||n(e)};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?r.mousemove||(i.addEventListener("mousemove",l),r.mousemove=l):(i.removeEventListener("mousemove",r.mousemove),r.mousemove=null),16&e?r.wheel||(i.addEventListener("wheel",o,{passive:!1}),r.wheel=o):(i.removeEventListener("wheel",r.wheel),r.wheel=null),2&e?r.mouseup||(r.mouseup=s):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),4&e?r.mousedrag||(r.mousedrag=a):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(hP(i,"mousedown",e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(e)})),this._register(hP(i,"wheel",i=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(i))return!1;if(!this.buffer.hasScrollback){if(0===i.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return this.cancel(i,!0);let n=up.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(n,!0),this.cancel(i,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}paste(e){l6(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,i,n){this._selectionService.setSelection(e,i,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;i||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);let n=function(e,i,n,r){let s={type:0,cancel:!1,key:void 0},o=!!e.shiftKey|2*!!e.altKey|4*!!e.ctrlKey|8*!!e.metaKey;switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?i?s.key=up.ESC+"OA":s.key=up.ESC+"[A":"UIKeyInputLeftArrow"===e.key?i?s.key=up.ESC+"OD":s.key=up.ESC+"[D":"UIKeyInputRightArrow"===e.key?i?s.key=up.ESC+"OC":s.key=up.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(i?s.key=up.ESC+"OB":s.key=up.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":up.DEL,e.altKey&&(s.key=up.ESC+s.key);break;case 9:if(e.shiftKey){s.key=up.ESC+"[Z";break}s.key=up.HT,s.cancel=!0;break;case 13:s.key=e.altKey?up.ESC+up.CR:up.CR,s.cancel=!0;break;case 27:s.key=up.ESC,e.altKey&&(s.key=up.ESC+up.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;o?s.key=up.ESC+"[1;"+(o+1)+"D":i?s.key=up.ESC+"OD":s.key=up.ESC+"[D";break;case 39:if(e.metaKey)break;o?s.key=up.ESC+"[1;"+(o+1)+"C":i?s.key=up.ESC+"OC":s.key=up.ESC+"[C";break;case 38:if(e.metaKey)break;o?s.key=up.ESC+"[1;"+(o+1)+"A":i?s.key=up.ESC+"OA":s.key=up.ESC+"[A";break;case 40:if(e.metaKey)break;o?s.key=up.ESC+"[1;"+(o+1)+"B":i?s.key=up.ESC+"OB":s.key=up.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(s.key=up.ESC+"[2~");break;case 46:o?s.key=up.ESC+"[3;"+(o+1)+"~":s.key=up.ESC+"[3~";break;case 36:o?s.key=up.ESC+"[1;"+(o+1)+"H":i?s.key=up.ESC+"OH":s.key=up.ESC+"[H";break;case 35:o?s.key=up.ESC+"[1;"+(o+1)+"F":i?s.key=up.ESC+"OF":s.key=up.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=up.ESC+"[5;"+(o+1)+"~":s.key=up.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=up.ESC+"[6;"+(o+1)+"~":s.key=up.ESC+"[6~";break;case 112:o?s.key=up.ESC+"[1;"+(o+1)+"P":s.key=up.ESC+"OP";break;case 113:o?s.key=up.ESC+"[1;"+(o+1)+"Q":s.key=up.ESC+"OQ";break;case 114:o?s.key=up.ESC+"[1;"+(o+1)+"R":s.key=up.ESC+"OR";break;case 115:o?s.key=up.ESC+"[1;"+(o+1)+"S":s.key=up.ESC+"OS";break;case 116:o?s.key=up.ESC+"[15;"+(o+1)+"~":s.key=up.ESC+"[15~";break;case 117:o?s.key=up.ESC+"[17;"+(o+1)+"~":s.key=up.ESC+"[17~";break;case 118:o?s.key=up.ESC+"[18;"+(o+1)+"~":s.key=up.ESC+"[18~";break;case 119:o?s.key=up.ESC+"[19;"+(o+1)+"~":s.key=up.ESC+"[19~";break;case 120:o?s.key=up.ESC+"[20;"+(o+1)+"~":s.key=up.ESC+"[20~";break;case 121:o?s.key=up.ESC+"[21;"+(o+1)+"~":s.key=up.ESC+"[21~";break;case 122:o?s.key=up.ESC+"[23;"+(o+1)+"~":s.key=up.ESC+"[23~";break;case 123:o?s.key=up.ESC+"[24;"+(o+1)+"~":s.key=up.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if((!n||r)&&e.altKey&&!e.metaKey){let i=fA[e.keyCode]?.[+!!e.shiftKey];if(i)s.key=up.ESC+i;else if(e.keyCode>=65&&e.keyCode<=90){let i=String.fromCharCode(e.ctrlKey?e.keyCode-64:e.keyCode+32);e.shiftKey&&(i=i.toUpperCase()),s.key=up.ESC+i}else if(32===e.keyCode)s.key=up.ESC+(e.ctrlKey?up.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let i=e.code.slice(3,4);e.shiftKey||(i=i.toLowerCase()),s.key=up.ESC+i,s.cancel=!0}}else!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?!e.key||e.ctrlKey||e.altKey||e.metaKey||!(e.keyCode>=48)||1!==e.key.length?e.key&&e.ctrlKey&&("_"===e.key&&(s.key=up.US),"@"===e.key&&(s.key=up.NUL)):s.key=e.key:65===e.keyCode&&(s.type=1);else e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?s.key=up.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?s.key=up.DEL:219===e.keyCode?s.key=up.ESC:220===e.keyCode?s.key=up.FS:221===e.keyCode&&(s.key=up.GS)}return s}(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===n.type||2===n.type){let i=this.rows-1;return this.scrollLines(2===n.type?-i:i),this.cancel(e,!0)}return 1===n.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&90>=e.key.charCodeAt(0))||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):((n.key===up.ETX||n.key===up.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)?this.cancel(e,!0):void(this._keyDownHandled=!0))}_isThirdLevelShift(e,i){let n=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return"keypress"===i.type?n:n&&(!i.keyCode||i.keyCode>47)}_keyUp(e){var i;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(i=e).keyCode||17===i.keyCode||18===i.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(null===e.which||void 0===e.which)i=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;i=e.which}return!!i&&(!e.altKey&&!e.ctrlKey&&!e.metaKey||!!this._isThirdLevelShift(this.browser,e))&&(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(pB));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(up.ESC+"[I"):this.coreService.triggerDataEvent(up.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${up.ESC}[4;${n};${i}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${up.ESC}[6;${s};${r}t`)}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}},fU=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let n={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(n),i.dispose=()=>this._wrappedAddonDispose(n),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){i=n;break}if(-1===i)throw Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(i,1)}},fV=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new cs)}translateToString(e,i,n){return this._line.translateToString(e,i,n)}},fq=class{constructor(e,i){this._buffer=e,this.type=i}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let i=this._buffer.lines.get(e);if(i)return new fV(i)}getNullCell(){return new cs}},fK=class extends c${constructor(e){super(),this._core=e,this._onBufferChange=this._register(new dA),this.onBufferChange=this._onBufferChange.event,this._normal=new fq(this._core.buffers.normal,"normal"),this._alternate=new fq(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},fY=class{constructor(e){this._core=e}registerCsiHandler(e,i){return this._core.registerCsiHandler(e,e=>i(e.toArray()))}addCsiHandler(e,i){return this.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._core.registerDcsHandler(e,(e,n)=>i(e,n.toArray()))}addDcsHandler(e,i){return this.registerDcsHandler(e,i)}registerEscHandler(e,i){return this._core.registerEscHandler(e,i)}addEscHandler(e,i){return this.registerEscHandler(e,i)}registerOscHandler(e,i){return this._core.registerOscHandler(e,i)}addOscHandler(e,i){return this.registerOscHandler(e,i)}},fX=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},fJ=["cols","rows"],fG=0,fZ=class extends c${constructor(e){super(),this._core=this._register(new f$(e)),this._addonManager=this._register(new fU),this._publicOptions={...this._core.options};let i=e=>this._core.options[e],n=(e,i)=>{this._checkReadonlyOptions(e),this._core.options[e]=i};for(let e in this._core.options){let r={get:i.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(fJ.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new fY(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new fX(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new fK(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let i in e)this._publicOptions[i]=e[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,i=!0){this._core.input(e,i)}resize(e,i){this._verifyIntegers(e,i),this._core.resize(e,i)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,i,n){this._verifyIntegers(e,i,n),this._core.select(e,i,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,i){this._verifyIntegers(e,i),this._core.selectLines(e,i)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,i){this._core.write(e,i)}writeln(e,i){this._core.write(e),this._core.write(`\r
26
+ `,i)}paste(e){this._core.paste(e)}refresh(e,i){this._verifyIntegers(e,i),this._core.refresh(e,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return l3},set promptLabel(t){l3=t},get tooMuchOutput(){return l4},set tooMuchOutput(t){l4=t}}}_verifyIntegers(...e){for(fG of e)if(fG===1/0||isNaN(fG)||fG%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(fG of e)if(fG&&(fG===1/0||isNaN(fG)||fG%1!=0||fG<0))throw Error("This API only accepts positive integers")}},fQ=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),s=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),a={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},l=a.top+a.bottom;return{cols:Math.max(2,Math.floor((s-(a.right+a.left)-i)/e.css.cell.width)),rows:Math.max(1,Math.floor((r-l)/e.css.cell.height))}}},f0=class{constructor(e,i,n,r={}){this._terminal=e,this._regex=i,this._handler=n,this._options=r}provideLinks(e,i){let n=f1.computeLink(e,this._regex,this._terminal,this._handler);i(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(i,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(i,n,r)}},e))}},f1=class e{static computeLink(i,n,r,s){let o=RegExp(n.source,(n.flags||"")+"g"),[a,l]=e._getWindowedLineStrings(i-1,r),c=a.join(""),d,h=[];for(;d=o.exec(c);){let i=d[0];if(!function(e){try{let i=new URL(e),n=i.password&&i.username?`${i.protocol}//${i.username}:${i.password}@${i.host}`:i.username?`${i.protocol}//${i.username}@${i.host}`:`${i.protocol}//${i.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}(i))continue;let[n,o]=e._mapStrIdx(r,l,0,d.index),[a,c]=e._mapStrIdx(r,n,o,i.length);if(-1===n||-1===o||-1===a||-1===c)continue;let u={start:{x:o+1,y:n+1},end:{x:c,y:a+1}};h.push({range:u,text:i,activate:s})}return h}static _getWindowedLineStrings(e,i){let n,r=e,s=e,o=0,a="",l=[];if(n=i.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&" "!==e[0]){for(o=0;(n=i.buffer.active.getLine(--r))&&o<2048&&(o+=(a=n.translateToString(!0)).length,l.push(a),!(!n.isWrapped||-1!==a.indexOf(" "))););l.reverse()}for(l.push(e),o=0;(n=i.buffer.active.getLine(++s))&&n.isWrapped&&o<2048&&(o+=(a=n.translateToString(!0)).length,l.push(a),-1===a.indexOf(" ")););}return[l,r]}static _mapStrIdx(e,i,n,r){let s=e.buffer.active,o=s.getNullCell(),a=n;for(;r;){let e=s.getLine(i);if(!e)return[-1,-1];for(let n=a;n<e.length;++n){e.getCell(n,o);let a=o.getChars();if(o.getWidth()&&(r-=a.length||1,n===e.length-1&&""===a)){let e=s.getLine(i+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(r+=1))}if(r<0)return[i,n]}i++,a=0}return[i,a]}},f2=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f5(e,i){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}var f3=class{constructor(e=f5,i={}){this._handler=e,this._options=i}activate(e){this._terminal=e;let i=this._options,n=i.urlRegex||f2;this._linkProvider=this._terminal.registerLinkProvider(new f0(this._terminal,n,this._handler,i))}dispose(){this._linkProvider?.dispose()}};let f4=new Map,f6={background:"#ffffff",foreground:"#222222",cursor:"#1456f0",cursorAccent:"#ffffff",selectionBackground:"rgba(20, 86, 240, 0.2)",black:"#222222",red:"#ef4444",green:"#16a34a",yellow:"#ca8a04",blue:"#1456f0",magenta:"#ea5ec1",cyan:"#0891b2",white:"#e5e7eb",brightBlack:"#45515e",brightRed:"#f87171",brightGreen:"#22c55e",brightYellow:"#eab308",brightBlue:"#3b82f6",brightMagenta:"#f472b6",brightCyan:"#06b6d4",brightWhite:"#f9fafb"},f8={background:"#0f1117",foreground:"#e5e7eb",cursor:"#3b82f6",cursorAccent:"#0f1117",selectionBackground:"rgba(59, 130, 246, 0.25)",black:"#0f1117",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#ea5ec1",cyan:"#06b6d4",white:"#e5e7eb",brightBlack:"#8b8fa3",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#f472b6",brightCyan:"#22d3ee",brightWhite:"#f9fafb"};function f9({sessionId:e,workspaceId:i}){let n=(0,iO.useRef)(null),r=(0,iO.useRef)(null),s=(0,iO.useRef)(null),{resolvedTheme:o}=(0,s0.useTheme)(),a=(0,iO.useCallback)(i=>{let{sessionId:n,data:s}=i;n===e&&r.current&&r.current.write(s)},[e]);return(0,iO.useEffect)(()=>{let l,c,d;if(!n.current)return;let h=(0,lZ.getWS)(i),u=f4.get(e);if(u)l=u.xterm,c=u.fit,l.element&&n.current.appendChild(l.element),requestAnimationFrame(()=>c.fit());else{let i;l=new fZ({cursorBlink:!0,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:"dark"===o?f8:f6}),c=new fQ,l.loadAddon(c),l.loadAddon(new f3),l.open(n.current),requestAnimationFrame(()=>c.fit()),f4.set(e,{xterm:l,fit:c});let r=(i=lX.get(e),lX.delete(e),i);r&&l.write(r)}r.current=l,s.current=c,d=l.onData(i=>{h.send("terminal.input",{sessionId:e,data:i})}),h.on("terminal.output",a),h.send("terminal.resize",{sessionId:e,cols:l.cols,rows:l.rows});let p=new ResizeObserver(()=>{try{c.fit()}catch{}h.send("terminal.resize",{sessionId:e,cols:l.cols,rows:l.rows})});return p.observe(n.current),()=>{let i;p.disconnect(),d.dispose(),h.off("terminal.output",a);let{sessions:n}=lJ.getState();!n.some(i=>i.id===e)&&(i=f4.get(e))&&(i.xterm.dispose(),f4.delete(e))}},[e,i,a]),(0,iO.useEffect)(()=>{r.current&&o&&(r.current.options.theme="dark"===o?f8:f6)},[o]),(0,iM.jsx)("div",{ref:n,className:"h-full w-full"})}var f7=e.i(260218),me=e.i(681622),mt=e.i(226624),mi=e.i(817854);function mn({open:e,onOpenChange:i,command:n,defaultCwd:r,onSubmit:s}){let o=(0,n2.useTranslations)("commands"),[a,l]=(0,iO.useState)(n?.name??""),[c,d]=(0,iO.useState)(n?.command??""),[h,u]=(0,iO.useState)(n?.cwd??r??""),[p,f]=(0,iO.useState)(n?.shell??""),[m,g]=(0,iO.useState)(n?.env?Object.entries(n.env).map(([e,i])=>({key:e,value:i})):[]),[v,y]=(0,iO.useState)(n?.autoRestart??!1),[_,b]=(0,iO.useState)(!1);(0,iO.useEffect)(()=>{e&&(l(n?.name??""),d(n?.command??""),u(n?.cwd??r??""),f(n?.shell??""),g(n?.env?Object.entries(n.env).map(([e,i])=>({key:e,value:i})):[]),y(n?.autoRestart??!1))},[e,n,r]);let w=async()=>{if(a.trim()&&c.trim()){b(!0);try{let e={};for(let i of m)i.key.trim()&&(e[i.key.trim()]=i.value);await s({name:a.trim(),command:c,cwd:h||void 0,shell:p||void 0,env:Object.keys(e).length>0?e:void 0,autoRestart:v||void 0}),i(!1)}finally{b(!1)}}};return(0,iM.jsx)(lq.Dialog,{open:e,onOpenChange:i,children:(0,iM.jsxs)(lq.DialogContent,{className:"sm:max-w-[480px]",children:[(0,iM.jsx)(lq.DialogHeader,{children:(0,iM.jsx)(lq.DialogTitle,{children:o(n?"editCommand":"addCommand")})}),(0,iM.jsxs)("div",{className:"flex flex-col gap-3 py-2",children:[(0,iM.jsxs)("div",{children:[(0,iM.jsx)(mi.Label,{className:"text-xs",children:o("name")}),(0,iM.jsx)(me.Input,{value:a,onChange:e=>l(e.target.value),placeholder:"dev",className:"mt-1"})]}),(0,iM.jsxs)("div",{children:[(0,iM.jsx)(mi.Label,{className:"text-xs",children:o("command")}),(0,iM.jsx)(me.Input,{value:c,onChange:e=>d(e.target.value),placeholder:"pnpm dev",className:"mt-1 font-mono text-sm"})]}),(0,iM.jsxs)("div",{children:[(0,iM.jsx)(mi.Label,{className:"text-xs",children:o("workingDirectory")}),(0,iM.jsx)(me.Input,{value:h,onChange:e=>u(e.target.value),placeholder:r,className:"mt-1 font-mono text-xs"})]}),(0,iM.jsxs)("div",{children:[(0,iM.jsx)(mi.Label,{className:"text-xs",children:o("shell")}),(0,iM.jsx)(me.Input,{value:p,onChange:e=>f(e.target.value),placeholder:"Default",className:"mt-1"})]}),(0,iM.jsxs)("div",{children:[(0,iM.jsxs)("div",{className:"flex items-center justify-between",children:[(0,iM.jsx)(mi.Label,{className:"text-xs",children:o("environmentVariables")}),(0,iM.jsx)(f7.Button,{variant:"ghost",size:"sm",className:"h-5 px-1 text-xs",onClick:()=>g(e=>[...e,{key:"",value:""}]),children:(0,iM.jsx)(lU.Plus,{size:12})})]}),(0,iM.jsx)("div",{className:"flex flex-col gap-1 mt-1",children:m.map((e,i)=>(0,iM.jsxs)("div",{className:"flex items-center gap-1",children:[(0,iM.jsx)(me.Input,{value:e.key,onChange:e=>g(n=>n.map((n,r)=>r===i?{...n,key:e.target.value}:n)),placeholder:"KEY",className:"h-7 text-xs font-mono flex-1"}),(0,iM.jsx)(me.Input,{value:e.value,onChange:e=>g(n=>n.map((n,r)=>r===i?{...n,value:e.target.value}:n)),placeholder:"value",className:"h-7 text-xs font-mono flex-1"}),(0,iM.jsx)(f7.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>g(e=>e.filter((e,n)=>n!==i)),children:(0,iM.jsx)(sg.X,{size:12})})]},i))})]}),(0,iM.jsxs)("div",{className:"flex items-center gap-2",children:[(0,iM.jsx)(mt.Switch,{checked:v,onCheckedChange:y}),(0,iM.jsx)(mi.Label,{className:"text-xs",children:o("autoRestart")})]})]}),(0,iM.jsxs)(lq.DialogFooter,{children:[(0,iM.jsx)(f7.Button,{variant:"outline",onClick:()=>i(!1),children:o("cancel")}),(0,iM.jsx)(f7.Button,{onClick:w,disabled:!a.trim()||!c.trim()||_,children:o(n?"save":"addCommand")})]})]})})}var mr=e.i(434805),ms=e.i(344118);function mo({open:e,onOpenChange:i,defaultPath:n,onImport:r}){let s=(0,n2.useTranslations)("commands"),[o,a]=(0,iO.useState)(n??""),[l,c]=(0,iO.useState)([]),[d,h]=(0,iO.useState)(!1),[u,p]=(0,iO.useState)(!1);(0,iO.useEffect)(()=>{e&&(a(n??""),c([]))},[e,n]);let f=(0,iO.useCallback)(async e=>{if(a(e),c([]),e){h(!0);try{let i=await (0,lG.fetchWithAuth)(`/api/folder/read-file?path=${encodeURIComponent(e)}`);if(!i.ok)return void c([]);let n=await i.json();n.scripts&&"object"==typeof n.scripts?c(Object.entries(n.scripts).map(([e,i])=>({name:e,command:String(i),selected:!0}))):c([])}catch{c([])}finally{h(!1)}}},[]),m=async()=>{let e=l.filter(e=>e.selected);if(0!==e.length){p(!0);try{let n=o.includes("/")?o.substring(0,o.lastIndexOf("/")):o;await r(e.map(e=>({name:e.name,command:e.command,folder:n}))),i(!1)}finally{p(!1)}}};return(0,iM.jsx)(lq.Dialog,{open:e,onOpenChange:i,children:(0,iM.jsxs)(lq.DialogContent,{className:"sm:max-w-[520px]",children:[(0,iM.jsxs)(lq.DialogHeader,{children:[(0,iM.jsx)(lq.DialogTitle,{children:s("importTitle")}),(0,iM.jsx)(lq.DialogDescription,{children:s("importDescription")})]}),(0,iM.jsxs)("div",{className:"flex flex-col gap-3 py-2",children:[(0,iM.jsxs)("div",{children:[(0,iM.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:s("selectProject")}),(0,iM.jsx)(mr.FolderPicker,{value:o,onChange:f,allowFiles:!0,fileFilter:"package.json"})]}),l.length>0&&(0,iM.jsxs)("div",{className:"flex flex-col border border-border rounded-lg overflow-hidden",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/50 border-b border-border",children:[(0,iM.jsx)("button",{onClick:()=>{let e=l.every(e=>e.selected);c(i=>i.map(i=>({...i,selected:!e})))},className:`shrink-0 w-4 h-4 rounded border flex items-center justify-center transition-colors ${l.every(e=>e.selected)?"bg-primary border-primary text-primary-foreground":"border-border hover:border-primary"}`,children:l.every(e=>e.selected)&&(0,iM.jsx)(ms.Check,{size:10})}),(0,iM.jsxs)("span",{className:"text-xs font-medium",children:[s("parsedScripts")," (",l.length,")"]})]}),(0,iM.jsx)("div",{className:"max-h-[280px] overflow-y-auto",children:l.map((e,i)=>(0,iM.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-accent cursor-pointer border-b border-border last:border-b-0",onClick:()=>{c(e=>e.map((e,n)=>n===i?{...e,selected:!e.selected}:e))},children:[(0,iM.jsx)("button",{className:`shrink-0 w-4 h-4 rounded border flex items-center justify-center transition-colors ${e.selected?"bg-primary border-primary text-primary-foreground":"border-border hover:border-primary"}`,children:e.selected&&(0,iM.jsx)(ms.Check,{size:10})}),(0,iM.jsx)("span",{className:"text-xs font-medium w-24 truncate shrink-0",children:e.name}),(0,iM.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate flex-1",children:e.command})]},e.name))})]}),!d&&o&&0===l.length&&(0,iM.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:s("noScripts")}),d&&(0,iM.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,iM.jsx)(rc.Loader2,{className:"size-4 animate-spin text-muted-foreground"})})]}),(0,iM.jsxs)(lq.DialogFooter,{children:[(0,iM.jsx)(f7.Button,{variant:"outline",onClick:()=>i(!1),children:s("cancel")}),(0,iM.jsx)(f7.Button,{onClick:m,disabled:0===l.filter(e=>e.selected).length||u,children:s("addSelected")})]})]})})}var ma=e.i(193251);let ml=(0,nP.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var mc=e.i(962562);function md({command:e,running:i,onRun:n,onClose:r,onEdit:s,onDelete:o}){let[a,l]=(0,iO.useState)(!1);return(0,iM.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 text-xs hover:bg-accent group cursor-default",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[(0,iM.jsx)("button",{onClick:i?r:n,className:`shrink-0 p-0.5 rounded ${i?"text-green-500 hover:text-destructive":"text-muted-foreground hover:text-foreground"}`,children:i?(0,iM.jsx)(sg.X,{size:12}):(0,iM.jsx)(ml,{size:12})}),(0,iM.jsx)("span",{className:"truncate flex-1 font-mono",children:e.name}),i&&(0,iM.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}),a&&(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsx)("button",{onClick:s,className:"shrink-0 p-0.5 text-muted-foreground hover:text-foreground",children:(0,iM.jsx)(mc.Pencil,{size:11})}),(0,iM.jsx)("button",{onClick:o,className:"shrink-0 p-0.5 text-muted-foreground hover:text-destructive",children:(0,iM.jsx)(nZ.Trash2,{size:11})})]})]})}function mh({search:e,onSearchChange:i,commands:n,customCommands:r,folderGroups:s,customOpen:o,onCustomOpenChange:a,collapsedFolders:l,onToggleFolder:c,onImport:d,onAddCommand:h,workspaceId:u,isRunning:p,runningMap:f,removeSession:m,run:g,remove:v,setEditingCommand:y,setDialogOpen:_,tc:b}){return(0,iM.jsxs)("div",{className:"flex flex-col h-full max-h-[50vh]",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-1 px-1.5 py-1.5 border-b border-border",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-1 flex-1 bg-muted rounded px-1.5 py-0.5",children:[(0,iM.jsx)(ri.Search,{size:12,className:"text-muted-foreground shrink-0"}),(0,iM.jsx)("input",{value:e,onChange:e=>i(e.target.value),placeholder:b("searchPlaceholder"),className:"flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground min-w-0"}),e&&(0,iM.jsx)("button",{onClick:()=>i(""),className:"text-muted-foreground hover:text-foreground",children:(0,iM.jsx)(sg.X,{size:10})})]}),(0,iM.jsx)("button",{onClick:d,className:"shrink-0 p-1 text-muted-foreground hover:text-foreground transition-colors",title:b("import"),children:(0,iM.jsx)(ma.Download,{size:13})})]}),(0,iM.jsx)("div",{className:"flex-1 overflow-y-auto py-1",children:0===n.length?(0,iM.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:b("noCommands")}):(0,iM.jsxs)(iM.Fragment,{children:[r.length>0&&(0,iM.jsxs)(n0.Collapsible,{open:o,onOpenChange:a,children:[(0,iM.jsxs)("div",{className:"flex items-center gap-1 px-2 py-0.5 group",children:[(0,iM.jsxs)(n0.CollapsibleTrigger,{className:"flex items-center gap-1 flex-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider hover:text-foreground",children:[o?(0,iM.jsx)(ra.ChevronDown,{size:10,className:"shrink-0"}):(0,iM.jsx)(ro.ChevronRight,{size:10,className:"shrink-0"}),(0,iM.jsx)("span",{children:b("customCommands")}),(0,iM.jsxs)("span",{className:"text-muted-foreground/60",children:["(",r.length,")"]})]}),(0,iM.jsx)("button",{onClick:h,className:"shrink-0 p-0.5 text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",title:b("addCommand"),children:(0,iM.jsx)(lU.Plus,{size:12})})]}),(0,iM.jsx)(n0.CollapsibleContent,{children:r.map(e=>(0,iM.jsx)(md,{command:e,running:p(e.id),onRun:()=>g(u,e.id),onClose:()=>{let i=f[e.id];i&&m(i.sessionId)},onEdit:()=>{y(e),_(!0)},onDelete:()=>v(u,e.id)},e.id))})]}),Object.entries(s).map(([e,i])=>{let n=!0!==l[e];return(0,iM.jsxs)(n0.Collapsible,{open:n,onOpenChange:()=>c(e),children:[(0,iM.jsx)("div",{className:"flex items-center gap-1 px-2 py-0.5 mt-1 group",children:(0,iM.jsxs)(n0.CollapsibleTrigger,{className:"flex items-center gap-1 flex-1 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider hover:text-foreground",children:[n?(0,iM.jsx)(ra.ChevronDown,{size:10,className:"shrink-0"}):(0,iM.jsx)(ro.ChevronRight,{size:10,className:"shrink-0"}),(0,iM.jsx)("span",{className:"truncate",children:e.split("/").pop()||e}),(0,iM.jsxs)("span",{className:"text-muted-foreground/60",children:["(",i.length,")"]})]})}),(0,iM.jsx)(n0.CollapsibleContent,{children:i.map(e=>(0,iM.jsx)(md,{command:e,running:p(e.id),onRun:()=>g(u,e.id),onClose:()=>{let i=f[e.id];i&&m(i.sessionId)},onEdit:()=>{y(e),_(!0)},onDelete:()=>v(u,e.id)},e.id))})]},e)}),0===r.length&&(0,iM.jsxs)("div",{className:"flex items-center gap-1 px-2 py-0.5 group",children:[(0,iM.jsx)("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider flex-1",children:b("customCommands")}),(0,iM.jsx)("button",{onClick:h,className:"shrink-0 p-0.5 text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",title:b("addCommand"),children:(0,iM.jsx)(lU.Plus,{size:12})})]})]})})]})}let mu=(0,nP.default)("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),mp=(0,nP.default)("power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),mf=(0,nP.default)("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),mm=(0,nP.default)("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]);var mg=e.i(378371),mv=e.i(212965),my=e.i(767467);let m_=(0,nP.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);function mx(e="light"){try{navigator.vibrate?.("heavy"===e?30:"medium"===e?15:5)}catch{}}let mb={a:"\x01",b:"\x02",c:"\x03",d:"\x04",e:"\x05",f:"\x06",g:"\x07",h:"\b",i:" ",j:"\n",k:"\v",l:"\f",m:"\r",n:"\x0e",o:"\x0f",p:"\x10",q:"\x11",r:"\x12",s:"\x13",t:"\x14",u:"\x15",v:"\x16",w:"\x17",x:"\x18",y:"\x19",z:"\x1a","[":"\x1b","]":"\x1d","\\":"\x1c"},mw=[["`","1","2","3","4","5","6","7","8","9","0","-","="],["q","w","e","r","t","y","u","i","o","p","[","]","\\"],["a","s","d","f","g","h","j","k","l",";","'","Enter"],["z","x","c","v","b","n","m",",",".","/","⌫"]];function mS({onKey:e}){let[i,n]=(0,iO.useState)(new Set),r=(0,iO.useCallback)(e=>{mx("medium"),n(i=>{let n=new Set(i);return n.has(e)?n.delete(e):n.add(e),n})},[]),s=(0,iO.useCallback)(r=>{let s,o=i.has("ctrl"),a=i.has("alt"),l=i.has("shift");s="Enter"===r?"\r":"⌫"===r?"":o&&mb[r]?mb[r]:l?r.toUpperCase():r,a&&(s="\x1b"+s),e(s),mx(),n(new Set)},[i,e]),o="flex-1 h-10 min-w-0 flex items-center justify-center rounded text-sm font-mono bg-muted hover:bg-accent active:scale-92 active:bg-primary/20 select-none cursor-pointer transition-all duration-100";return(0,iM.jsxs)("div",{className:"flex flex-col gap-1 p-2 max-w-[800px] w-[calc(100vw-16px)]",children:[(0,iM.jsxs)("div",{className:"flex gap-0.5 mb-0.5",children:[["ctrl","alt","shift"].map(e=>(0,iM.jsx)("button",{onClick:()=>r(e),className:`flex-1 h-9 rounded text-xs font-semibold uppercase tracking-wide select-none cursor-pointer transition-all duration-100 active:scale-92 ${i.has(e)?"bg-primary text-primary-foreground":"bg-muted hover:bg-accent text-muted-foreground active:bg-primary/20"}`,children:e},e)),(0,iM.jsx)("button",{onClick:()=>{mx(),e(" ")},className:o,children:"Tab"}),(0,iM.jsx)("button",{onClick:()=>{mx(),e("\x1b")},className:o,children:"Esc"}),(0,iM.jsx)("button",{onClick:()=>{mx(),e("\x1b[A")},className:o,children:"↑"}),(0,iM.jsx)("button",{onClick:()=>{mx(),e("\x1b[B")},className:o,children:"↓"}),(0,iM.jsx)("button",{onClick:()=>{mx(),e("\x1b[D")},className:o,children:"←"}),(0,iM.jsx)("button",{onClick:()=>{mx(),e("\x1b[C")},className:o,children:"→"})]}),mw.map((e,n)=>(0,iM.jsx)("div",{className:"flex gap-0.5",children:e.map((e,r)=>{let a="Enter"===e,l="⌫"===e;return(0,iM.jsx)("button",{onClick:()=>s(e),className:`${o} ${a?"flex-[1.5]":""} ${l?"flex-[1.2]":""} ${i.has("ctrl")&&mb[e]?"text-primary font-bold":""}`,children:e},`${n}-${r}`)})},n)),(0,iM.jsx)("div",{className:"flex gap-0.5",children:(0,iM.jsx)("button",{onClick:()=>{mx(),s(" ")},className:`${o} flex-[5]`,children:"Space"})})]})}function mk({activeId:e,sendInput:i,onPaste:n}){let r=(0,n2.useTranslations)("terminal"),s=n=>{e&&i(e,n)};return(0,iM.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 border-t border-border bg-muted/50 shrink-0",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,iM.jsx)("button",{onClick:()=>s("\x1b[A"),className:"p-1.5 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:"↑",children:(0,iM.jsx)(mg.ArrowUp,{size:14})}),(0,iM.jsx)("button",{onClick:()=>s("\x1b[B"),className:"p-1.5 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:"↓",children:(0,iM.jsx)(mv.ArrowDown,{size:14})}),(0,iM.jsx)("button",{onClick:()=>s("\x1b[D"),className:"p-1.5 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:"←",children:(0,iM.jsx)(my.ArrowLeft,{size:14})}),(0,iM.jsx)("button",{onClick:()=>s("\x1b[C"),className:"p-1.5 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:"→",children:(0,iM.jsx)(m_,{size:14})})]}),(0,iM.jsx)("div",{className:"w-px h-4 bg-border"}),(0,iM.jsxs)(lK.Popover,{children:[(0,iM.jsx)(lK.PopoverTrigger,{render:(0,iM.jsxs)("button",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:r("virtualKeyboard"),children:[(0,iM.jsx)(mu,{size:14}),(0,iM.jsx)("span",{className:"hidden sm:inline",children:r("virtualKeyboard")})]})}),(0,iM.jsx)(lK.PopoverContent,{align:"start",side:"top",sideOffset:4,className:"p-0 max-w-[800px] w-[calc(100vw-16px)]",children:(0,iM.jsx)(mS,{onKey:e=>s(e)})})]}),(0,iM.jsxs)("button",{onClick:()=>s("\x03"),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:"Ctrl+C",children:[(0,iM.jsx)(mp,{size:14}),(0,iM.jsx)("span",{className:"hidden sm:inline",children:r("sendCtrlC")})]}),(0,iM.jsxs)("button",{onClick:()=>s("clear\n"),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:r("clearScreen"),children:[(0,iM.jsx)(mf,{size:14}),(0,iM.jsx)("span",{className:"hidden sm:inline",children:r("clearScreen")})]}),(0,iM.jsxs)("button",{onClick:n,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:r("pasteCommand"),children:[(0,iM.jsx)(mm,{size:14}),(0,iM.jsx)("span",{className:"hidden sm:inline",children:r("pasteCommand")})]})]})}let mC=[{value:"/bin/zsh",label:"zsh"},{value:"/bin/bash",label:"bash"}],mT=[{value:"cmd.exe",label:"CMD"},{value:"powershell.exe",label:"PowerShell"}],mE=null;async function mD(){if(mE)return mE;try{let e=await fetch("/api/health"),i=await e.json();mE="win32"===i.platform?mT:mC}catch{mE=mC}return mE}function mN({workspaceId:e,boundDirs:i}){let{sessions:n,activeId:r,init:s,createSession:o,setActive:a,removeSession:l}=lJ(),{commands:c,load:d,run:h,remove:u,update:p,create:f,isRunning:m,runningMap:g}=lQ(),{sendInput:v}=lJ(),y=(0,n2.useTranslations)("terminal"),_=(0,n2.useTranslations)("commands"),[b,w]=(0,iO.useState)(!1),[S,k]=(0,iO.useState)(void 0),[C,T]=(0,iO.useState)(!1),[E,D]=(0,iO.useState)(),[N,M]=(0,iO.useState)(!1),[O,R]=(0,iO.useState)(""),[A,L]=(0,iO.useState)(!0),[j,I]=(0,iO.useState)({}),[P,B]=(0,iO.useState)(!1),[z,F]=(0,iO.useState)(!1),[H,W]=(0,iO.useState)(""),[$,U]=(0,iO.useState)([]),V=(0,iO.useCallback)(()=>{if(0!==i.length&&1===i.length)return i[0]},[i]),q=(0,iO.useCallback)(e=>{let n=V();if(void 0===n&&i.length>1){k(e),w(!0);return}o(e,n)},[V,i.length,o]),K=(0,iO.useCallback)(e=>{w(!1),o(S,e),k(void 0)},[S,o]),Y=(0,iO.useRef)(null);(0,iO.useEffect)(()=>{s((0,lZ.getWS)(e),()=>{0===lJ.getState().sessions.length&&q()}),Y.current!==e&&(Y.current=e)},[e]),(0,iO.useEffect)(()=>{e&&d(e)},[e]),(0,iO.useEffect)(()=>{mD().then(U)},[]);let{customCommands:X,folderGroups:J}=(0,iO.useMemo)(()=>{let e=O?c.filter(e=>e.name.toLowerCase().includes(O.toLowerCase())||e.command.toLowerCase().includes(O.toLowerCase())):c,i=[],n={};for(let r of e)r.folder?(n[r.folder]||(n[r.folder]=[]),n[r.folder].push(r)):i.push(r);return{customCommands:i,folderGroups:n}},[c,O]),G=e=>{I(i=>({...i,[e]:!i[e]}))},Z=async i=>{for(let n of i)await f(e,{name:n.name,command:n.command,folder:n.folder,cwd:n.folder})},Q=async()=>{try{let e=await navigator.clipboard.readText();W(e)}catch{W("")}F(!0)};return(0,iM.jsxs)("div",{className:"flex flex-col h-full bg-background",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-0.5 px-1 py-0.5 bg-muted border-b border-border overflow-x-auto",children:[n.map(e=>{var i;let s;return(0,iM.jsxs)("button",{onClick:()=>a(e.id),className:`flex items-center gap-1 px-2 py-1 text-xs rounded-t transition-colors shrink-0 ${r===e.id?"bg-background text-foreground":"text-muted-foreground hover:text-foreground hover:bg-background/50"}`,children:[(0,iM.jsx)("span",{className:"font-mono text-[10px] opacity-60",children:e.name??(i=e.shell,s=$??mC,i?s.find(e=>e.value===i)?.label??i:s[0].label)}),!e.name&&(0,iM.jsx)("span",{children:n.indexOf(e)+1}),(0,iM.jsx)("span",{onClick:i=>{i.stopPropagation(),l(e.id)},className:"ml-1 hover:text-destructive cursor-pointer",children:(0,iM.jsx)(sg.X,{size:12})})]},e.id)}),(0,iM.jsxs)(lz.DropdownMenu,{children:[(0,iM.jsx)(lz.DropdownMenuTrigger,{render:(0,iM.jsxs)("button",{className:"flex items-center gap-0.5 h-6 px-1.5 text-muted-foreground hover:text-foreground transition-colors",title:y("newTerminal"),children:[(0,iM.jsx)(lU.Plus,{size:14}),(0,iM.jsx)(ra.ChevronDown,{size:10})]})}),(0,iM.jsx)(lz.DropdownMenuContent,{align:"start",className:"min-w-[120px]",children:$.map(e=>(0,iM.jsx)(lz.DropdownMenuItem,{onClick:()=>q(e.value),className:"text-xs",children:e.label},e.value))})]}),(0,iM.jsx)("div",{className:"md:hidden ml-auto",children:(0,iM.jsxs)(lK.Popover,{open:P,onOpenChange:B,children:[(0,iM.jsx)(lK.PopoverTrigger,{render:(0,iM.jsx)("button",{className:"flex items-center gap-1 h-6 px-1.5 text-muted-foreground hover:text-foreground transition-colors",title:_("title"),children:(0,iM.jsx)(lV.Terminal,{size:14})})}),(0,iM.jsx)(lK.PopoverContent,{align:"end",sideOffset:4,className:"w-[260px] p-0 overflow-hidden",children:(0,iM.jsx)(mh,{search:O,onSearchChange:R,commands:c,customCommands:X,folderGroups:J,customOpen:A,onCustomOpenChange:L,collapsedFolders:j,onToggleFolder:G,onImport:()=>{M(!0),B(!1)},onAddCommand:()=>{D(void 0),T(!0),B(!1)},workspaceId:e,isRunning:m,runningMap:g,removeSession:l,run:h,remove:u,setEditingCommand:D,setDialogOpen:e=>{if(T(e),!e)return},tc:_})})]})})]}),(0,iM.jsxs)("div",{className:"flex flex-row flex-1 overflow-hidden",children:[(0,iM.jsx)("div",{className:"hidden md:flex w-[200px] flex-col border-r border-border shrink-0 overflow-hidden",children:(0,iM.jsx)(mh,{search:O,onSearchChange:R,commands:c,customCommands:X,folderGroups:J,customOpen:A,onCustomOpenChange:L,collapsedFolders:j,onToggleFolder:G,onImport:()=>M(!0),onAddCommand:()=>{D(void 0),T(!0)},workspaceId:e,isRunning:m,runningMap:g,removeSession:l,run:h,remove:u,setEditingCommand:D,setDialogOpen:T,tc:_})}),(0,iM.jsx)("div",{className:"flex-1 overflow-hidden relative",children:0===n.length?(0,iM.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:y("noSession")}):n.map(i=>(0,iM.jsx)("div",{className:"absolute inset-0",style:{display:r===i.id?"block":"none"},children:(0,iM.jsx)(f9,{sessionId:i.id,workspaceId:e})},i.id))})]}),(0,iM.jsx)(mk,{activeId:r,sendInput:v,onPaste:Q}),(0,iM.jsx)(lq.Dialog,{open:b,onOpenChange:w,children:(0,iM.jsxs)(lq.DialogContent,{children:[(0,iM.jsxs)(lq.DialogHeader,{children:[(0,iM.jsx)(lq.DialogTitle,{children:y("selectWorkingDirectory")}),(0,iM.jsx)(lq.DialogDescription,{children:y("selectWorkingDirectoryDescription")})]}),(0,iM.jsx)("div",{className:"flex flex-col gap-2 py-2",children:i.map(e=>(0,iM.jsxs)("button",{onClick:()=>K(e),className:"flex items-center gap-2 px-3 py-2 text-sm text-left rounded-md border border-border hover:bg-accent hover:text-accent-foreground transition-colors",children:[(0,iM.jsx)(nz.FolderOpen,{size:14,className:"shrink-0 text-muted-foreground"}),(0,iM.jsx)("span",{className:"truncate font-mono text-xs",children:e})]},e))})]})}),(0,iM.jsx)(mn,{open:C,onOpenChange:T,command:E,defaultCwd:i[0],onSubmit:async i=>{E?await p(e,E.id,i):await f(e,i)}}),(0,iM.jsx)(mo,{open:N,onOpenChange:M,defaultPath:i[0],onImport:Z}),(0,iM.jsx)(lq.Dialog,{open:z,onOpenChange:F,children:(0,iM.jsxs)(lq.DialogContent,{children:[(0,iM.jsxs)(lq.DialogHeader,{children:[(0,iM.jsx)(lq.DialogTitle,{children:y("pasteCommand")}),(0,iM.jsx)(lq.DialogDescription,{children:y("pasteCommandDescription")})]}),(0,iM.jsx)("textarea",{value:H,onChange:e=>W(e.target.value),className:"w-full h-40 rounded-md border border-border bg-background px-3 py-2 text-sm font-mono resize-y focus:outline-none focus:ring-1 focus:ring-ring",placeholder:y("pasteCommandPlaceholder")}),(0,iM.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,iM.jsx)("button",{onClick:()=>F(!1),className:"px-3 py-1.5 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:y("cancel")}),(0,iM.jsx)("button",{disabled:!H.trim()||!r,onClick:()=>{if(!r)return;let e=H.split("\n"),i=0;for(let n of e){let e=n.trim();e&&(setTimeout(()=>v(r,e+"\n"),i),i+=300)}F(!1)},className:"px-3 py-1.5 rounded-md text-xs bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",children:y("confirm")})]})]})})]})}var mM=e.i(31807),mO=e.i(355819),mR=e.i(325443),mA=e.i(938306),mL=e.i(511800),mj=e.i(562918),mI=e.i(188815),mP=e.i(611176);function mB({candidates:e,selected:i,onToggle:n,searchPlaceholder:r,emptyText:s,label:o}){let[a,l]=(0,iO.useState)(""),c=e.filter(e=>`${e.label} ${e.description||""}`.toLowerCase().includes(a.toLowerCase()));return(0,iM.jsxs)("div",{className:"space-y-2",children:[o&&(0,iM.jsx)("label",{className:"text-sm font-medium",children:o}),(0,iM.jsx)(me.Input,{value:a,onChange:e=>l(e.target.value),placeholder:r}),(0,iM.jsxs)("div",{className:"max-h-40 overflow-y-auto space-y-0.5",children:[0===c.length&&(0,iM.jsx)("p",{className:"text-sm text-muted-foreground py-2 text-center",children:s||"No items found"}),c.map(e=>(0,iM.jsxs)("button",{type:"button",onClick:()=>n(e.id),className:"flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[(0,iM.jsx)(mP.AgentIcon,{agentId:"user"!==e.id?e.id:void 0,name:e.label,className:"size-5 rounded-full"}),(0,iM.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,iM.jsx)("span",{className:"block truncate",children:e.label}),e.description&&(0,iM.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,iM.jsx)("div",{className:`flex items-center justify-center size-4 rounded border shrink-0 ${i.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input"}`})]},e.id))]}),i.length>0&&(0,iM.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(i=>{let r=e.find(e=>e.id===i),s=r?.label||i;return(0,iM.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:["user"===i?s:(0,iM.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,iM.jsx)(mP.AgentIcon,{agentId:i,name:s,className:"size-3.5 rounded-full"}),s]}),(0,iM.jsx)("button",{type:"button",onClick:()=>n(i),className:"hover:text-destructive",children:(0,iM.jsx)(sg.X,{className:"size-3"})})]},i)})})]})}function mz(e){return e.name?.trim()||e.role}function mF(e,i){return e.find(e=>e.id===i)}function mH(e,i){if("user"===i)return"user";let n=mF(e,i);return n?mz(n):i}function mW(e,i){let n=new Set(e.map(e=>e.id)),r=[],s=new Set;for(let e of i)n.has(e)&&(s.has(e)||(s.add(e),r.push(e)));return r}function m$({open:e,onOpenChange:i,channel:n,agents:r=[],onSubmit:s}){let o=(0,n2.useTranslations)("chat"),a=(0,n2.useTranslations)("common"),l=[{value:"general",label:o("channel.general")},{value:"issue",label:o("channel.issue")},{value:"agent",label:o("channel.agent")}],[c,d]=(0,iO.useState)(""),[h,u]=(0,iO.useState)("general"),[p,f]=(0,iO.useState)([]),[m,g]=(0,iO.useState)(0),v=r.filter(e=>!1!==e.enabled).map(e=>({id:e.id,label:mH(r,e.id)}));return(0,iO.useEffect)(()=>{e&&queueMicrotask(()=>{n?(d(n.name),u(n.type),f([...n.members])):(d(""),u("general"),f(["user"])),g(e=>e+1)})},[e,n]),(0,iM.jsx)(lq.Dialog,{open:e,onOpenChange:i,children:(0,iM.jsxs)(lq.DialogContent,{className:"sm:max-w-md max-h-[85vh] p-0 gap-0 flex flex-col overflow-hidden",children:[(0,iM.jsxs)(lq.DialogHeader,{className:"px-4 py-4 shrink-0",children:[(0,iM.jsx)(lq.DialogTitle,{children:o(n?"channel.edit":"channel.create")}),(0,iM.jsx)(lq.DialogDescription,{children:o(n?"channel.edit":"channel.create")})]}),(0,iM.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 pb-4",children:(0,iM.jsxs)("div",{className:"space-y-4 pt-2",children:[(0,iM.jsxs)("div",{className:"space-y-2",children:[(0,iM.jsx)("label",{className:"text-sm font-medium",children:a("name")}),(0,iM.jsx)(me.Input,{value:c,onChange:e=>d(e.target.value),placeholder:o("channel.namePlaceholder"),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})]}),(0,iM.jsxs)("div",{className:"space-y-2",children:[(0,iM.jsx)("label",{className:"text-sm font-medium",children:o("channel.type")}),(0,iM.jsx)(mI.SearchSelect,{value:h,onChange:e=>u(e),options:l,allowCustom:!1,placeholder:o("channel.selectType")})]}),(0,iM.jsx)(mB,{candidates:v,selected:p,onToggle:e=>{f(i=>i.includes(e)?i.filter(i=>i!==e):[...i,e])},label:o("channel.members"),searchPlaceholder:o("channel.addMember"),emptyText:o("channel.noAgents")||"No agents found"},m),(0,iM.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,iM.jsx)(f7.Button,{variant:"outline",onClick:()=>i(!1),children:a("cancel")}),(0,iM.jsx)(f7.Button,{onClick:()=>{c.trim()&&(s({name:c.trim(),type:h,members:p}),i(!1))},disabled:!c.trim(),children:a(n?"save":"create")})]})]})})]})})}let mU={general:{className:"bg-muted text-muted-foreground",icon:nI.Hash},issue:{className:"bg-amber-500/15 text-amber-600",icon:mL.AlertCircle},agent:{className:"bg-blue-500/15 text-blue-600",icon:mA.MessageCircle}};function mV({workspaceId:e}){let i=(0,n2.useTranslations)("chat"),n=(0,n2.useTranslations)("common"),{channels:r,activeChannelId:s,messages:o,loadChannels:a,createChannel:l,updateChannel:c,setActiveChannel:d}=(0,mM.useChannelStore)(),[h,u]=(0,iO.useState)(!1),[p,f]=(0,iO.useState)(null),m=(0,mO.useAgentStore)(e=>e.agents),g=(0,mO.useAgentStore)(e=>e.ensure);(0,iO.useEffect)(()=>{a(e),g()},[e,a,g]),(0,iO.useEffect)(()=>{let i=(0,lZ.getWS)(e).on("channel.updated",e=>{mM.useChannelStore.setState(i=>{let n=i.channels.findIndex(i=>i.id===e.id);if(n>=0){let r=[...i.channels];return r[n]=e,{channels:r}}return{channels:[...i.channels,e]}})});return()=>{i()}},[e]);let v=async i=>{let n=mW(m,i.members);p?await c(e,p.id,{name:i.name,type:i.type,members:n}):await l(e,i.name,i.type,n)},y=async i=>{await fetch(`/api/workspaces/${e}/files/reveal?channelId=${i}`,{method:"POST"})};return(0,iM.jsxs)("div",{className:"flex flex-col h-full",children:[(0,iM.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b text-xs font-medium text-muted-foreground",children:[(0,iM.jsx)("span",{children:i("channel.general")}),(0,iM.jsx)("button",{onClick:()=>u(!0),className:"p-0.5 hover:bg-accent rounded",children:(0,iM.jsx)(lU.Plus,{className:"size-3.5"})})]}),(0,iM.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[0===r.length?(0,iM.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 px-4 text-center",children:[(0,iM.jsx)("div",{className:"rounded-full bg-muted p-3",children:(0,iM.jsx)(mA.MessageCircle,{className:"h-5 w-5 text-muted-foreground"})}),(0,iM.jsxs)("div",{children:[(0,iM.jsx)("p",{className:"text-sm font-medium",children:i("channel.noMembers")}),(0,iM.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:i("channel.create")})]}),(0,iM.jsxs)(f7.Button,{size:"sm",variant:"outline",onClick:()=>u(!0),children:[(0,iM.jsx)(lU.Plus,{className:"h-3.5 w-3.5 mr-1"}),n("add")]})]}):null,r.map(e=>{let r,a=function(e){if(!e||0===e.length)return null;let i=e[e.length-1];return i?{text:(i.content??"").replace(/<[^>]*>/g,"").slice(0,60)||"...",status:i.status}:null}(o[e.id]),l=mU[e.type],c=a?.status==="streaming"||a?.status==="pending",h=e.members.filter(e=>"user"!==e);return(0,iM.jsxs)(sK,{children:[(0,iM.jsxs)(sY,{className:(0,n1.cn)("flex items-start gap-2.5 w-full px-3 py-2 text-sm hover:bg-accent transition-colors text-left",s===e.id&&"bg-accent text-accent-foreground"),onClick:()=>d(e.id),children:[(r=l.icon,(0,iM.jsx)(r,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 mt-1"})),(0,iM.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,iM.jsx)("span",{className:"truncate font-medium text-[13px]",children:e.name}),(0,iM.jsx)(mj.Badge,{variant:"secondary",className:(0,n1.cn)("text-[10px] px-1 py-0 h-4 rounded",l.className),children:i(`channel.${e.type}`)}),c&&(0,iM.jsxs)("span",{className:"relative flex h-2 w-2",children:[(0,iM.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,iM.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]}),h.length>0&&(0,iM.jsx)(mR.Bot,{className:"h-3 w-3 text-muted-foreground shrink-0"})]}),a?(0,iM.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:a.text}):(0,iM.jsx)("p",{className:"text-xs text-muted-foreground/50 mt-0.5",children:i("emptyState")})]})]}),(0,iM.jsxs)(sX,{children:[(0,iM.jsxs)(sJ,{onClick:()=>{f(e),u(!0)},children:[(0,iM.jsx)(mc.Pencil,{className:"size-3.5"}),n("edit")]}),(0,iM.jsxs)(sJ,{onClick:()=>y(e.id),children:[(0,iM.jsx)(nz.FolderOpen,{className:"size-3.5"}),n("open")]})]})]},e.id)})]}),(0,iM.jsx)(m$,{open:h,onOpenChange:e=>{u(e),e||f(null)},workspaceId:e,channel:p,agents:m,onSubmit:v})]})}var mq=e.i(159619);let mK=(0,nP.default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]),mY=(0,nP.default)("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]);var mX=e.i(951841);let mJ=(0,nP.default)("user-minus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);function mG({open:e,onOpenChange:i,memberName:n,displayName:r,channelId:s,workspaceId:o,channels:a=[]}){let[l,c]=(0,iO.useState)(!1),{channels:d,updateChannel:h}=(0,mM.useChannelStore)(),u=(0,mO.useAgentStore)(e=>e.agents),p="user"!==n?u.find(e=>e.id===n):void 0,f=r||p?.name||n,m=(0,mX.useUserAvatar)(),g="user"===n?m:null,v=d.find(e=>e.id===s),y=v?.members.includes(n),_=async()=>{if(v&&y){c(!0);try{await h(o,s,{members:v.members.filter(e=>e!==n)}),i(!1)}finally{c(!1)}}};return(0,iM.jsx)(lq.Dialog,{open:e,onOpenChange:i,children:(0,iM.jsxs)(lq.DialogContent,{className:"sm:max-w-sm",children:[(0,iM.jsxs)(lq.DialogHeader,{children:[(0,iM.jsx)(lq.DialogTitle,{children:"成员信息"}),(0,iM.jsx)(lq.DialogDescription,{})]}),(0,iM.jsxs)("div",{className:"flex items-center gap-3 pt-2",children:[(0,iM.jsx)(mP.AgentIcon,{agentId:"user"!==n?n:void 0,name:f,avatarUrl:g||void 0,className:"size-12 rounded-full"}),(0,iM.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,iM.jsx)("p",{className:"text-sm font-medium truncate",children:f}),(0,iM.jsx)("p",{className:"text-xs text-muted-foreground",children:"user"===n?"成员":p?.role||n})]})]}),a.length>0&&(0,iM.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,iM.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"所在频道"}),(0,iM.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map(e=>(0,iM.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:[(0,iM.jsx)(nH.MessageSquare,{className:"size-3"}),e]},e))})]}),y&&"user"!==n&&(0,iM.jsxs)("button",{onClick:_,disabled:l,className:"flex items-center justify-center gap-2 w-full mt-2 px-3 py-2 rounded-md text-sm text-destructive hover:bg-destructive/10 disabled:opacity-50 transition-colors",children:[(0,iM.jsx)(mJ,{className:"size-4"}),l?"移除中...":"从频道移除"]})]})})}let mZ=(0,nP.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var mQ=e.i(250438);let m0=(0,nP.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var m1=e.i(839374),m1=m1,m2=e.i(905724),m2=m2;let m5=(0,nP.default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),m3=(0,nP.default)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]);function m4(){}function m6(){}let m8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,m9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,m7={};function ge(e,i){return((i||m7).jsx?m9:m8).test(e)}let gt=/[ \t\n\f\r]/g;function gi(e){return""===e.replace(gt,"")}class gn{constructor(e,i){this.attribute=i,this.property=e}}gn.prototype.attribute="",gn.prototype.booleanish=!1,gn.prototype.boolean=!1,gn.prototype.commaOrSpaceSeparated=!1,gn.prototype.commaSeparated=!1,gn.prototype.defined=!1,gn.prototype.mustUseProperty=!1,gn.prototype.number=!1,gn.prototype.overloadedBoolean=!1,gn.prototype.property="",gn.prototype.spaceSeparated=!1,gn.prototype.space=void 0;let gr=0,gs=gu(),go=gu(),ga=gu(),gl=gu(),gc=gu(),gd=gu(),gh=gu();function gu(){return 2**++gr}e.s(["boolean",0,gs,"booleanish",0,go,"commaOrSpaceSeparated",0,gh,"commaSeparated",0,gd,"number",0,gl,"overloadedBoolean",0,ga,"spaceSeparated",0,gc],527951);var gp=e.i(527951);let gf=Object.keys(gp);class gm extends gn{constructor(e,i,n,r){let s=-1;if(super(e,i),function(e,i,n){n&&(e[i]=n)}(this,"space",r),"number"==typeof n)for(;++s<gf.length;){const e=gf[s];!function(e,i,n){n&&(e[i]=n)}(this,gf[s],(n&gp[e])===gp[e])}}}function gg(e){return e.toLowerCase()}gm.prototype.defined=!0;let gv=/[A-Z]/g,gy=/-[a-z]/g,g_=/^data[-\w.:]+$/i;function gx(e){return"-"+e.toLowerCase()}function gb(e){return e.charAt(1).toUpperCase()}let gw={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"};class gS{constructor(e,i,n){this.normal=i,this.property=e,n&&(this.space=n)}}function gk(e,i){let n={},r={};for(let i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new gS(n,r,i)}function gC(e){let i={},n={};for(let[r,s]of Object.entries(e.properties)){let o=new gm(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),i[r]=o,n[gg(r)]=r,n[gg(o.attribute)]=r}return new gS(i,n,e.space)}gS.prototype.normal={},gS.prototype.property={},gS.prototype.space=void 0;let gT=gC({properties:{ariaActiveDescendant:null,ariaAtomic:go,ariaAutoComplete:null,ariaBusy:go,ariaChecked:go,ariaColCount:gl,ariaColIndex:gl,ariaColSpan:gl,ariaControls:gc,ariaCurrent:null,ariaDescribedBy:gc,ariaDetails:null,ariaDisabled:go,ariaDropEffect:gc,ariaErrorMessage:null,ariaExpanded:go,ariaFlowTo:gc,ariaGrabbed:go,ariaHasPopup:null,ariaHidden:go,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gc,ariaLevel:gl,ariaLive:null,ariaModal:go,ariaMultiLine:go,ariaMultiSelectable:go,ariaOrientation:null,ariaOwns:gc,ariaPlaceholder:null,ariaPosInSet:gl,ariaPressed:go,ariaReadOnly:go,ariaRelevant:null,ariaRequired:go,ariaRoleDescription:gc,ariaRowCount:gl,ariaRowIndex:gl,ariaRowSpan:gl,ariaSelected:go,ariaSetSize:gl,ariaSort:null,ariaValueMax:gl,ariaValueMin:gl,ariaValueNow:gl,ariaValueText:null,role:null},transform:(e,i)=>"role"===i?i:"aria-"+i.slice(4).toLowerCase()});function gE(e,i){return i in e?e[i]:i}function gD(e,i){return gE(e,i.toLowerCase())}let gN=gC({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:gd,acceptCharset:gc,accessKey:gc,action:null,allow:null,allowFullScreen:gs,allowPaymentRequest:gs,allowUserMedia:gs,alt:null,as:null,async:gs,autoCapitalize:null,autoComplete:gc,autoFocus:gs,autoPlay:gs,blocking:gc,capture:null,charSet:null,checked:gs,cite:null,className:gc,cols:gl,colSpan:null,content:null,contentEditable:go,controls:gs,controlsList:gc,coords:gl|gd,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gs,defer:gs,dir:null,dirName:null,disabled:gs,download:ga,draggable:go,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gs,formTarget:null,headers:gc,height:gl,hidden:ga,high:gl,href:null,hrefLang:null,htmlFor:gc,httpEquiv:gc,id:null,imageSizes:null,imageSrcSet:null,inert:gs,inputMode:null,integrity:null,is:null,isMap:gs,itemId:null,itemProp:gc,itemRef:gc,itemScope:gs,itemType:gc,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gs,low:gl,manifest:null,max:null,maxLength:gl,media:null,method:null,min:null,minLength:gl,multiple:gs,muted:gs,name:null,nonce:null,noModule:gs,noValidate:gs,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:gs,optimum:gl,pattern:null,ping:gc,placeholder:null,playsInline:gs,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gs,referrerPolicy:null,rel:gc,required:gs,reversed:gs,rows:gl,rowSpan:gl,sandbox:gc,scope:null,scoped:gs,seamless:gs,selected:gs,shadowRootClonable:gs,shadowRootDelegatesFocus:gs,shadowRootMode:null,shape:null,size:gl,sizes:null,slot:null,span:gl,spellCheck:go,src:null,srcDoc:null,srcLang:null,srcSet:null,start:gl,step:null,style:null,tabIndex:gl,target:null,title:null,translate:null,type:null,typeMustMatch:gs,useMap:null,value:go,width:gl,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gc,axis:null,background:null,bgColor:null,border:gl,borderColor:null,bottomMargin:gl,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gs,declare:gs,event:null,face:null,frame:null,frameBorder:null,hSpace:gl,leftMargin:gl,link:null,longDesc:null,lowSrc:null,marginHeight:gl,marginWidth:gl,noResize:gs,noHref:gs,noShade:gs,noWrap:gs,object:null,profile:null,prompt:null,rev:null,rightMargin:gl,rules:null,scheme:null,scrolling:go,standby:null,summary:null,text:null,topMargin:gl,valueType:null,version:null,vAlign:null,vLink:null,vSpace:gl,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gs,disableRemotePlayback:gs,prefix:null,property:null,results:gl,security:null,unselectable:null},space:"html",transform:gD}),gM=gC({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:gh,accentHeight:gl,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:gl,amplitude:gl,arabicForm:null,ascent:gl,attributeName:null,attributeType:null,azimuth:gl,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:gl,by:null,calcMode:null,capHeight:gl,className:gc,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:gl,diffuseConstant:gl,direction:null,display:null,dur:null,divisor:gl,dominantBaseline:null,download:gs,dx:null,dy:null,edgeMode:null,editable:null,elevation:gl,enableBackground:null,end:null,event:null,exponent:gl,externalResourcesRequired:null,fill:null,fillOpacity:gl,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:gd,g2:gd,glyphName:gd,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:gl,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:gl,horizOriginX:gl,horizOriginY:gl,id:null,ideographic:gl,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:gl,k:gl,k1:gl,k2:gl,k3:gl,k4:gl,kernelMatrix:gh,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:gl,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:gl,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:gl,overlineThickness:gl,paintOrder:null,panose1:null,path:null,pathLength:gl,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gc,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:gl,pointsAtY:gl,pointsAtZ:gl,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gh,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gh,rev:gh,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gh,requiredFeatures:gh,requiredFonts:gh,requiredFormats:gh,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:gl,specularExponent:gl,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:gl,strikethroughThickness:gl,string:null,stroke:null,strokeDashArray:gh,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:gl,strokeOpacity:gl,strokeWidth:null,style:null,surfaceScale:gl,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gh,tabIndex:gl,tableValues:null,target:null,targetX:gl,targetY:gl,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gh,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:gl,underlineThickness:gl,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:gl,values:null,vAlphabetic:gl,vMathematical:gl,vectorEffect:null,vHanging:gl,vIdeographic:gl,version:null,vertAdvY:gl,vertOriginX:gl,vertOriginY:gl,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:gl,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:gE}),gO=gC({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,i)=>"xlink:"+i.slice(5).toLowerCase()}),gR=gC({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gD}),gA=gC({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,i)=>"xml:"+i.slice(3).toLowerCase()}),gL=gk([gT,gN,gO,gR,gA],"html"),gj=gk([gT,gM,gO,gR,gA],"svg");var gI=e.i(763185);let gP=gz("end"),gB=gz("start");function gz(e){return function(i){let n=i&&i.position&&i.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function gF(e){return e&&"object"==typeof e?"position"in e||"type"in e?gW(e.position):"start"in e||"end"in e?gW(e):"line"in e||"column"in e?gH(e):"":""}function gH(e){return g$(e&&e.line)+":"+g$(e&&e.column)}function gW(e){return gH(e&&e.start)+"-"+gH(e&&e.end)}function g$(e){return e&&"number"==typeof e?e:1}class gU extends Error{constructor(e,i,n){super(),"string"==typeof i&&(n=i,i=void 0);let r="",s={},o=!1;if(i&&(s="line"in i&&"column"in i||"start"in i&&"end"in i?{place:i}:"type"in i?{ancestors:[i],place:i.position}:{...i}),"string"==typeof e?r=e:!s.cause&&e&&(o=!0,r=e.message,s.cause=e),!s.ruleId&&!s.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?s.ruleId=n:(s.source=n.slice(0,e),s.ruleId=n.slice(e+1))}if(!s.place&&s.ancestors&&s.ancestors){const e=s.ancestors[s.ancestors.length-1];e&&(s.place=e.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=a?a.line:void 0,this.name=gF(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&"string"==typeof s.cause.stack?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gU.prototype.file="",gU.prototype.name="",gU.prototype.reason="",gU.prototype.message="",gU.prototype.stack="",gU.prototype.column=void 0,gU.prototype.line=void 0,gU.prototype.ancestors=void 0,gU.prototype.cause=void 0,gU.prototype.fatal=void 0,gU.prototype.place=void 0,gU.prototype.ruleId=void 0,gU.prototype.source=void 0;let gV={}.hasOwnProperty,gq=new Map,gK=/[A-Z]/g,gY=new Set(["table","tbody","thead","tfoot","tr"]),gX=new Set(["td","th"]),gJ="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gG(e,i,n){var r,s,o,a,l,c,d,h,u;let p,f,m,g,v,y,_,b,w,S,k;return"element"===i.type?(r=e,s=i,o=n,f=p=r.schema,"svg"===s.tagName.toLowerCase()&&"html"===p.space&&(r.schema=gj),r.ancestors.push(s),m=g1(r,s.tagName,!1),g=function(e,i){let n,r,s={};for(r in i.properties)if("children"!==r&&gV.call(i.properties,r)){let o=function(e,i,n){let r=function(e,i){let n=gg(i),r=i,s=gn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&g_.test(i)){if("-"===i.charAt(4)){let e=i.slice(5).replace(gy,gb);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=i.slice(4);if(!gy.test(e)){let n=e.replace(gv,gx);"-"!==n.charAt(0)&&(n="-"+n),i="data"+n}}s=gm}return new s(r,i)}(e.schema,i);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){var s;let i;if(Array.isArray(n)&&(n=r.commaSeparated?(i={},(""===(s=n)[s.length-1]?[...s,""]:s).join((i.padRight?" ":"")+","+(!1===i.padLeft?"":" ")).trim()):n.join(" ").trim()),"style"===r.property){let i="object"==typeof n?n:function(e,i){try{return(0,gI.default)(i,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let i=new gU("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=gJ+"#cannot-parse-style-attribute",i}}(e,String(n));return"css"===e.stylePropertyNameCase&&(i=function(e){let i,n={};for(i in e)gV.call(e,i)&&(n[function(e){let i=e.replace(gK,g5);return"ms-"===i.slice(0,3)&&(i="-"+i),i}(i)]=e[i]);return n}(i)),["style",i]}return["react"===e.elementAttributeNameCase&&r.space?gw[r.property]||r.property:r.attribute,n]}}(e,r,i.properties[r]);if(o){let[r,a]=o;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof a&&gX.has(i.tagName)?n=a:s[r]=a}}return n&&((s.style||(s.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),s}(r,s),v=g0(r,s),gY.has(s.tagName)&&(v=v.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&gi(e.value):gi(e))})),gZ(r,g,m,s),gQ(g,v),r.ancestors.pop(),r.schema=p,r.create(s,m,g,o)):"mdxFlowExpression"===i.type||"mdxTextExpression"===i.type?function(e,i){if(i.data&&i.data.estree&&e.evaluater){let n=i.data.estree.body[0];return m4("ExpressionStatement"===n.type),e.evaluater.evaluateExpression(n.expression)}g2(e,i.position)}(e,i):"mdxJsxFlowElement"===i.type||"mdxJsxTextElement"===i.type?(a=e,l=i,c=n,_=y=a.schema,"svg"===l.name&&"html"===y.space&&(a.schema=gj),a.ancestors.push(l),b=null===l.name?a.Fragment:g1(a,l.name,!0),w=function(e,i){let n={};for(let r of i.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){let i=r.data.estree.body[0];m4("ExpressionStatement"===i.type);let s=i.expression;m4("ObjectExpression"===s.type);let o=s.properties[0];m4("SpreadElement"===o.type),Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else g2(e,i.position);else{let s,o=r.name;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){let i=r.value.data.estree.body[0];m4("ExpressionStatement"===i.type),s=e.evaluater.evaluateExpression(i.expression)}else g2(e,i.position);else s=null===r.value||r.value;n[o]=s}return n}(a,l),S=g0(a,l),gZ(a,w,b,l),gQ(w,S),a.ancestors.pop(),a.schema=y,a.create(l,b,w,c)):"mdxjsEsm"===i.type?function(e,i){if(i.data&&i.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(i.data.estree);g2(e,i.position)}(e,i):"root"===i.type?(d=e,h=i,u=n,gQ(k={},g0(d,h)),d.create(h,d.Fragment,k,u)):"text"===i.type?i.value:void 0}function gZ(e,i,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(i.node=r)}function gQ(e,i){if(i.length>0){let n=i.length>1?i:i[0];n&&(e.children=n)}}function g0(e,i){let n=[],r=-1,s=e.passKeys?new Map:gq;for(;++r<i.children.length;){let o,a=i.children[r];if(e.passKeys){let e="element"===a.type?a.tagName:"mdxJsxFlowElement"===a.type||"mdxJsxTextElement"===a.type?a.name:void 0;if(e){let i=s.get(e)||0;o=e+"-"+i,s.set(e,i+1)}}let l=gG(e,a,o);void 0!==l&&n.push(l)}return n}function g1(e,i,n){let r;if(n)if(i.includes(".")){let e,n=i.split("."),s=-1;for(;++s<n.length;){let i=ge(n[s])?{type:"Identifier",name:n[s]}:{type:"Literal",value:n[s]};e=e?{type:"MemberExpression",object:e,property:i,computed:!!(s&&"Literal"===i.type),optional:!1}:i}m4(e,"always a result"),r=e}else r=ge(i)&&!/^[a-z]/.test(i)?{type:"Identifier",name:i}:{type:"Literal",value:i};else r={type:"Literal",value:i};if("Literal"===r.type){let i=r.value;return gV.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);g2(e)}function g2(e,i){let n=new gU("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:i,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=gJ+"#cannot-handle-mdx-estrees-without-createevaluater",n}function g5(e){return"-"+e.toLowerCase()}let g3={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"]},g4={};function g6(e,i){let n=i||g4;return g8(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function g8(e,i,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(i&&"alt"in e&&e.alt)return e.alt;if("children"in e)return g9(e.children,i,n)}return Array.isArray(e)?g9(e,i,n):""}function g9(e,i,n){let r=[],s=-1;for(;++s<e.length;)r[s]=g8(e[s],i,n);return r.join("")}function g7(e,i,n,r){let s,o=e.length,a=0;if(i=i<0?-i>o?0:o+i:i>o?o:i,n=n>0?n:0,r.length<1e4)(s=Array.from(r)).unshift(i,n),e.splice(...s);else for(n&&e.splice(i,n);a<r.length;)(s=r.slice(a,a+1e4)).unshift(i,0),e.splice(...s),a+=1e4,i+=1e4}function ve(e,i){return e.length>0?(g7(e,e.length,0,i),e):i}let vt={}.hasOwnProperty;function vi(e){let i={},n=-1;for(;++n<e.length;)!function(e,i){let n;for(n in i){let r,s=(vt.call(e,n)?e[n]:void 0)||(e[n]={}),o=i[n];if(o)for(r in o){vt.call(s,r)||(s[r]=[]);let e=o[r];!function(e,i){let n=-1,r=[];for(;++n<i.length;)("after"===i[n].add?e:r).push(i[n]);g7(e,0,0,r)}(s[r],Array.isArray(e)?e:e?[e]:[])}}}(i,e[n]);return i}let vn=vm(/[A-Za-z]/),vr=vm(/[\dA-Za-z]/),vs=vm(/[#-'*+\--9=?A-Z^-~]/);function vo(e){return null!==e&&(e<32||127===e)}let va=vm(/\d/),vl=vm(/[\dA-Fa-f]/),vc=vm(/[!-/:-@[-`{-~]/);function vd(e){return null!==e&&e<-2}function vh(e){return null!==e&&(e<0||32===e)}function vu(e){return -2===e||-1===e||32===e}let vp=vm(/\p{P}|\p{S}/u),vf=vm(/\s/);function vm(e){return function(i){return null!==i&&i>-1&&e.test(String.fromCharCode(i))}}function vg(e,i,n,r){let s=r?r-1:1/0,o=0;return function(r){return vu(r)?(e.enter(n),function r(a){return vu(a)&&o++<s?(e.consume(a),r):(e.exit(n),i(a))}(r)):i(r)}}let vv={tokenize:function(e){let i,n=e.attempt(this.parser.constructs.contentInitial,function(i){return null===i?void e.consume(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),vg(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let s=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=s),i=s,function i(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return vd(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),i)}(r)}(n)});return n}},vy={tokenize:function(e){let i,n,r,s=this,o=[],a=0;return l;function l(i){if(a<o.length){let n=o[a];return s.containerState=n[1],e.attempt(n[0].continuation,c,d)(i)}return d(i)}function c(e){if(a++,s.containerState._closeFlow){let n;s.containerState._closeFlow=void 0,i&&y();let r=s.events.length,o=r;for(;o--;)if("exit"===s.events[o][0]&&"chunkFlow"===s.events[o][1].type){n=s.events[o][1].end;break}v(a);let l=r;for(;l<s.events.length;)s.events[l][1].end={...n},l++;return g7(s.events,o+1,0,s.events.slice(r)),s.events.length=l,d(e)}return l(e)}function d(n){if(a===o.length){if(!i)return p(n);if(i.currentConstruct&&i.currentConstruct.concrete)return m(n);s.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return s.containerState={},e.check(v_,h,u)(n)}function h(e){return i&&y(),v(a),p(e)}function u(e){return s.parser.lazy[s.now().line]=a!==o.length,r=s.now().offset,m(e)}function p(i){return s.containerState={},e.attempt(v_,f,m)(i)}function f(e){return a++,o.push([s.currentConstruct,s.containerState]),p(e)}function m(r){if(null===r){i&&y(),v(0),e.consume(r);return}return i=i||s.parser.flow(s.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:n}),function i(n){if(null===n){g(e.exit("chunkFlow"),!0),v(0),e.consume(n);return}return vd(n)?(e.consume(n),g(e.exit("chunkFlow")),a=0,s.interrupt=void 0,l):(e.consume(n),i)}(r)}function g(e,o){let l=s.sliceStream(e);if(o&&l.push(null),e.previous=n,n&&(n.next=e),n=e,i.defineSkip(e.start),i.write(l),s.parser.lazy[e.start.line]){let e,n,o=i.events.length;for(;o--;)if(i.events[o][1].start.offset<r&&(!i.events[o][1].end||i.events[o][1].end.offset>r))return;let l=s.events.length,c=l;for(;c--;)if("exit"===s.events[c][0]&&"chunkFlow"===s.events[c][1].type){if(e){n=s.events[c][1].end;break}e=!0}for(v(a),o=l;o<s.events.length;)s.events[o][1].end={...n},o++;g7(s.events,c+1,0,s.events.slice(l)),s.events.length=o}}function v(i){let n=o.length;for(;n-- >i;){let i=o[n];s.containerState=i[1],i[0].exit.call(s,e)}o.length=i}function y(){i.write([null]),n=void 0,i=void 0,s.containerState._closeFlow=void 0}}},v_={tokenize:function(e,i,n){return vg(e,e.attempt(this.parser.constructs.document,i,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},vx={partial:!0,tokenize:function(e,i,n){return function(i){return vu(i)?vg(e,r,"linePrefix")(i):r(i)};function r(e){return null===e||vd(e)?i(e):n(e)}}};class vb{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw 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,i){let n=null==i?1/0:i;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,i,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(i||0),1/0);return n&&vw(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),vw(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),vw(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let i=this.left.splice(e,1/0);vw(this.right,i.reverse())}else{let i=this.right.splice(this.left.length+this.right.length-e,1/0);vw(this.left,i.reverse())}}}function vw(e,i){let n=0;if(i.length<1e4)e.push(...i);else for(;n<i.length;)e.push(...i.slice(n,n+1e4)),n+=1e4}function vS(e){let i,n,r,s,o,a,l,c={},d=-1,h=new vb(e);for(;++d<h.length;){for(;d in c;)d=c[d];if(i=h.get(d),d&&"chunkFlow"===i[1].type&&"listItemPrefix"===h.get(d-1)[1].type&&((r=0)<(a=i[1]._tokenizer.events).length&&"lineEndingBlank"===a[r][1].type&&(r+=2),r<a.length&&"content"===a[r][1].type))for(;++r<a.length&&"content"!==a[r][1].type;)"chunkText"===a[r][1].type&&(a[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===i[0])i[1].contentType&&(Object.assign(c,function(e,i){let n,r,s=e.get(i)[1],o=e.get(i)[2],a=i-1,l=[],c=s._tokenizer;!c&&(c=o.parser[s.contentType](s.start),s._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));let d=c.events,h=[],u={},p=-1,f=s,m=0,g=0,v=[0];for(;f;){for(;e.get(++a)[1]!==f;);l.push(a),!f._tokenizer&&(n=o.sliceStream(f),f.next||n.push(null),r&&c.defineSkip(f.start),f._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(n),f._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),r=f,f=f.next}for(f=s;++p<d.length;)"exit"===d[p][0]&&"enter"===d[p-1][0]&&d[p][1].type===d[p-1][1].type&&d[p][1].start.line!==d[p][1].end.line&&(g=p+1,v.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(c.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),p=v.length;p--;){let i=d.slice(v[p],v[p+1]),n=l.pop();h.push([n,n+i.length-1]),e.splice(n,2,i)}for(h.reverse(),p=-1;++p<h.length;)u[m+h[p][0]]=m+h[p][1],m+=h[p][1]-h[p][0]-1;return u}(h,d)),d=c[d],l=!0);else if(i[1]._container){for(r=d,n=void 0;r--;)if("lineEnding"===(s=h.get(r))[1].type||"lineEndingBlank"===s[1].type)"enter"===s[0]&&(n&&(h.get(n)[1].type="lineEndingBlank"),s[1].type="lineEnding",n=r);else if("linePrefix"===s[1].type||"listItemIndent"===s[1].type);else break;n&&(i[1].end={...h.get(n)[1].start},(o=h.slice(n,d)).unshift(i),h.splice(n,d-n+1,o))}}return g7(e,0,1/0,h.slice(0)),!l}let vk={resolve:function(e){return vS(e),e},tokenize:function(e,i){let n;return function(i){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(i)};function r(i){return null===i?s(i):vd(i)?e.check(vC,o,s)(i):(e.consume(i),r)}function s(n){return e.exit("chunkContent"),e.exit("content"),i(n)}function o(i){return e.consume(i),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},vC={partial:!0,tokenize:function(e,i,n){let r=this;return function(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),vg(e,s,"linePrefix")};function s(s){if(null===s||vd(s))return n(s);let o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?i(s):e.interrupt(r.parser.constructs.flow,n,i)(s)}}},vT={tokenize:function(e){let i=this,n=e.attempt(vx,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),i.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,vg(e,e.attempt(this.parser.constructs.flow,r,e.attempt(vk,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),i.currentConstruct=void 0,n)}}},vE={resolveAll:vO()},vD=vM("string"),vN=vM("text");function vM(e){return{resolveAll:vO("text"===e?vR:void 0),tokenize:function(i){let n=this,r=this.parser.constructs[e],s=i.attempt(r,o,a);return o;function o(e){return c(e)?s(e):a(e)}function a(e){return null===e?void i.consume(e):(i.enter("data"),i.consume(e),l)}function l(e){return c(e)?(i.exit("data"),s(e)):(i.consume(e),l)}function c(e){if(null===e)return!0;let i=r[e],s=-1;if(i)for(;++s<i.length;){let e=i[s];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function vO(e){return function(i,n){let r,s=-1;for(;++s<=i.length;)void 0===r?i[s]&&"data"===i[s][1].type&&(r=s,s++):i[s]&&"data"===i[s][1].type||(s!==r+2&&(i[r][1].end=i[s-1][1].end,i.splice(r+2,s-r-2),s=r+2),r=void 0);return e?e(i,n):i}}function vR(e,i){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,s=e[n-1][1],o=i.sliceStream(s),a=o.length,l=-1,c=0;for(;a--;){let e=o[a];if("string"==typeof e){for(l=e.length;32===e.charCodeAt(l-1);)c++,l--;if(l)break;l=-1}else if(-2===e)r=!0,c++;else if(-1===e);else{a++;break}}if(i._contentTypeTextTrailing&&n===e.length&&(c=0),c){let o={type:n===e.length||r||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:s.start._bufferIndex+l,_index:s.start._index+a,line:s.end.line,column:s.end.column-c,offset:s.end.offset-c},end:{...s.end}};s.end={...o.start},s.start.offset===s.end.offset?Object.assign(s,o):(e.splice(n,0,["enter",o,i],["exit",o,i]),n+=2)}n++}return e}function vA(e){return null===e||vh(e)||vf(e)?1:vp(e)?2:void 0}function vL(e,i,n){let r=[],s=-1;for(;++s<e.length;){let o=e[s].resolveAll;o&&!r.includes(o)&&(i=o(i,n),r.push(o))}return i}let vj={name:"attention",resolveAll:function(e,i){let n,r,s,o,a,l,c,d,h=-1;for(;++h<e.length;)if("enter"===e[h][0]&&"attentionSequence"===e[h][1].type&&e[h][1]._close){for(n=h;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&i.sliceSerialize(e[n][1]).charCodeAt(0)===i.sliceSerialize(e[h][1]).charCodeAt(0)){if((e[n][1]._close||e[h][1]._open)&&(e[h][1].end.offset-e[h][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[h][1].end.offset-e[h][1].start.offset)%3))continue;l=e[n][1].end.offset-e[n][1].start.offset>1&&e[h][1].end.offset-e[h][1].start.offset>1?2:1;let u={...e[n][1].end},p={...e[h][1].start};vI(u,-l),vI(p,l),o={type:l>1?"strongSequence":"emphasisSequence",start:u,end:{...e[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[h][1].start},end:p},s={type:l>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[h][1].start}},r={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[n][1].end={...o.start},e[h][1].start={...a.end},c=[],e[n][1].end.offset-e[n][1].start.offset&&(c=ve(c,[["enter",e[n][1],i],["exit",e[n][1],i]])),c=ve(c,[["enter",r,i],["enter",o,i],["exit",o,i],["enter",s,i]]),c=ve(c,vL(i.parser.constructs.insideSpan.null,e.slice(n+1,h),i)),c=ve(c,[["exit",s,i],["enter",a,i],["exit",a,i],["exit",r,i]]),e[h][1].end.offset-e[h][1].start.offset?(d=2,c=ve(c,[["enter",e[h][1],i],["exit",e[h][1],i]])):d=0,g7(e,n-1,h-n+3,c),h=n+c.length-d-2;break}}for(h=-1;++h<e.length;)"attentionSequence"===e[h][1].type&&(e[h][1].type="data");return e},tokenize:function(e,i){let n,r=this.parser.constructs.attentionMarkers.null,s=this.previous,o=vA(s);return function(a){return n=a,e.enter("attentionSequence"),function a(l){if(l===n)return e.consume(l),a;let c=e.exit("attentionSequence"),d=vA(l),h=!d||2===d&&o||r.includes(l),u=!o||2===o&&d||r.includes(s);return c._open=!!(42===n?h:h&&(o||!u)),c._close=!!(42===n?u:u&&(d||!h)),i(l)}(a)}}};function vI(e,i){e.column+=i,e.offset+=i,e._bufferIndex+=i}let vP={continuation:{tokenize:function(e,i,n){let r=this;return function(i){return vu(i)?vg(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)};function s(r){return e.attempt(vP,i,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,i,n){let r=this;return function(i){if(62===i){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)};function s(n){return vu(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),i):(e.exit("blockQuotePrefix"),i(n))}}},vB={name:"characterEscape",tokenize:function(e,i,n){return function(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),r};function r(r){return vc(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),i):n(r)}}},vz=document.createElement("i");function vF(e){let i="&"+e+";";vz.innerHTML=i;let n=vz.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==i&&n}let vH={name:"characterReference",tokenize:function(e,i,n){let r,s,o=this,a=0;return function(i){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(i),e.exit("characterReferenceMarker"),l};function l(i){return 35===i?(e.enter("characterReferenceMarkerNumeric"),e.consume(i),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),r=31,s=vr,d(i))}function c(i){return 88===i||120===i?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(i),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,s=vl,d):(e.enter("characterReferenceValue"),r=7,s=va,d(i))}function d(l){if(59===l&&a){let r=e.exit("characterReferenceValue");return s!==vr||vF(o.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),e.exit("characterReference"),i):n(l)}return s(l)&&a++<r?(e.consume(l),d):n(l)}}},vW={partial:!0,tokenize:function(e,i,n){let r=this;return function(i){return null===i?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)};function s(e){return r.parser.lazy[r.now().line]?n(e):i(e)}}},v$={concrete:!0,name:"codeFenced",tokenize:function(e,i,n){let r,s=this,o={partial:!0,tokenize:function(e,i,n){let o=0;return function(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),a};function a(i){return e.enter("codeFencedFence"),vu(i)?vg(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):c(i)}function c(i){return i===r?(e.enter("codeFencedFenceSequence"),function i(s){return s===r?(o++,e.consume(s),i):o>=l?(e.exit("codeFencedFenceSequence"),vu(s)?vg(e,d,"whitespace")(s):d(s)):n(s)}(i)):n(i)}function d(r){return null===r||vd(r)?(e.exit("codeFencedFence"),i(r)):n(r)}}},a=0,l=0;return function(i){var o;let d;return o=i,a=(d=s.events[s.events.length-1])&&"linePrefix"===d[1].type?d[2].sliceSerialize(d[1],!0).length:0,r=o,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function i(s){return s===r?(l++,e.consume(s),i):l<3?n(s):(e.exit("codeFencedFenceSequence"),vu(s)?vg(e,c,"whitespace")(s):c(s))}(o)};function c(o){return null===o||vd(o)?(e.exit("codeFencedFence"),s.interrupt?i(o):e.check(vW,h,m)(o)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function i(s){return null===s||vd(s)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(s)):vu(s)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),vg(e,d,"whitespace")(s)):96===s&&s===r?n(s):(e.consume(s),i)}(o))}function d(i){return null===i||vd(i)?c(i):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function i(s){return null===s||vd(s)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(s)):96===s&&s===r?n(s):(e.consume(s),i)}(i))}function h(i){return e.attempt(o,m,u)(i)}function u(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),p}function p(i){return a>0&&vu(i)?vg(e,f,"linePrefix",a+1)(i):f(i)}function f(i){return null===i||vd(i)?e.check(vW,h,m)(i):(e.enter("codeFlowValue"),function i(n){return null===n||vd(n)?(e.exit("codeFlowValue"),f(n)):(e.consume(n),i)}(i))}function m(n){return e.exit("codeFenced"),i(n)}}},vU={name:"codeIndented",tokenize:function(e,i,n){let r=this;return function(i){return e.enter("codeIndented"),vg(e,s,"linePrefix",5)(i)};function s(i){let s=r.events[r.events.length-1];return s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?function i(n){return null===n?o(n):vd(n)?e.attempt(vV,i,o)(n):(e.enter("codeFlowValue"),function n(r){return null===r||vd(r)?(e.exit("codeFlowValue"),i(r)):(e.consume(r),n)}(n))}(i):n(i)}function o(n){return e.exit("codeIndented"),i(n)}}},vV={partial:!0,tokenize:function(e,i,n){let r=this;return s;function s(i){return r.parser.lazy[r.now().line]?n(i):vd(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):vg(e,o,"linePrefix",5)(i)}function o(e){let o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?i(e):vd(e)?s(e):n(e)}}};function vq(e,i,n,r,s,o,a,l,c){let d=c||1/0,h=0;return function(i){return 60===i?(e.enter(r),e.enter(s),e.enter(o),e.consume(i),e.exit(o),u):null===i||32===i||41===i||vo(i)?n(i):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),m(i))};function u(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(s),e.exit(r),i):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(n))}function p(i){return 62===i?(e.exit("chunkString"),e.exit(l),u(i)):null===i||60===i||vd(i)?n(i):(e.consume(i),92===i?f:p)}function f(i){return 60===i||62===i||92===i?(e.consume(i),p):p(i)}function m(s){return!h&&(null===s||41===s||vh(s))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),i(s)):h<d&&40===s?(e.consume(s),h++,m):41===s?(e.consume(s),h--,m):null===s||32===s||40===s||vo(s)?n(s):(e.consume(s),92===s?g:m)}function g(i){return 40===i||41===i||92===i?(e.consume(i),m):m(i)}}function vK(e,i,n,r,s,o){let a,l=this,c=0;return function(i){return e.enter(r),e.enter(s),e.consume(i),e.exit(s),e.enter(o),d};function d(u){return c>999||null===u||91===u||93===u&&!a||94===u&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(u):93===u?(e.exit(o),e.enter(s),e.consume(u),e.exit(s),e.exit(r),i):vd(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(u))}function h(i){return null===i||91===i||93===i||vd(i)||c++>999?(e.exit("chunkString"),d(i)):(e.consume(i),a||(a=!vu(i)),92===i?u:h)}function u(i){return 91===i||92===i||93===i?(e.consume(i),c++,h):h(i)}}function vY(e,i,n,r,s,o){let a;return function(i){return 34===i||39===i||40===i?(e.enter(r),e.enter(s),e.consume(i),e.exit(s),a=40===i?41:i,l):n(i)};function l(n){return n===a?(e.enter(s),e.consume(n),e.exit(s),e.exit(r),i):(e.enter(o),c(n))}function c(i){return i===a?(e.exit(o),l(a)):null===i?n(i):vd(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),vg(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(i))}function d(i){return i===a||null===i||vd(i)?(e.exit("chunkString"),c(i)):(e.consume(i),92===i?h:d)}function h(i){return i===a||92===i?(e.consume(i),d):d(i)}}function vX(e,i){let n;return function r(s){return vd(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):vu(s)?vg(e,r,n?"linePrefix":"lineSuffix")(s):i(s)}}function vJ(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}let vG={partial:!0,tokenize:function(e,i,n){return function(i){return vh(i)?vX(e,r)(i):n(i)};function r(i){return vY(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(i)}function s(i){return vu(i)?vg(e,o,"whitespace")(i):o(i)}function o(e){return null===e||vd(e)?i(e):n(e)}}},vZ=["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"],vQ=["pre","script","style","textarea"],v0={partial:!0,tokenize:function(e,i,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(vx,i,n)}}},v1={partial:!0,tokenize:function(e,i,n){let r=this;return function(i){return vd(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)};function s(e){return r.parser.lazy[r.now().line]?n(e):i(e)}}},v2={name:"labelEnd",resolveAll:function(e){let i=-1,n=[];for(;++i<e.length;){let r=e[i][1];if(n.push(e[i]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",i+=e}}return e.length!==n.length&&g7(e,0,e.length,n),e},resolveTo:function(e,i){let n,r,s,o,a=e.length,l=0;for(;a--;)if(n=e[a][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[a][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(s){if("enter"===e[a][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=a,"labelLink"!==n.type)){l=2;break}}else"labelEnd"===n.type&&(s=a);let c={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[r][1].start},end:{...e[s][1].end}},h={type:"labelText",start:{...e[r+l+2][1].end},end:{...e[s-2][1].start}};return o=ve(o=[["enter",c,i],["enter",d,i]],e.slice(r+1,r+l+3)),o=ve(o,[["enter",h,i]]),o=ve(o,vL(i.parser.constructs.insideSpan.null,e.slice(r+l+4,s-3),i)),o=ve(o,[["exit",h,i],e[s-2],e[s-1],["exit",d,i]]),o=ve(o,e.slice(s+1)),o=ve(o,[["exit",c,i]]),g7(e,r,e.length,o),e},tokenize:function(e,i,n){let r,s,o=this,a=o.events.length;for(;a--;)if(("labelImage"===o.events[a][1].type||"labelLink"===o.events[a][1].type)&&!o.events[a][1]._balanced){r=o.events[a][1];break}return function(i){return r?r._inactive?h(i):(s=o.parser.defined.includes(vJ(o.sliceSerialize({start:r.end,end:o.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelEnd"),l):n(i)};function l(i){return 40===i?e.attempt(v5,d,s?d:h)(i):91===i?e.attempt(v3,d,s?c:h)(i):s?d(i):h(i)}function c(i){return e.attempt(v4,d,h)(i)}function d(e){return i(e)}function h(e){return r._balanced=!0,n(e)}}},v5={tokenize:function(e,i,n){return function(i){return e.enter("resource"),e.enter("resourceMarker"),e.consume(i),e.exit("resourceMarker"),r};function r(i){return vh(i)?vX(e,s)(i):s(i)}function s(i){return 41===i?d(i):vq(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(i)}function o(i){return vh(i)?vX(e,l)(i):d(i)}function a(e){return n(e)}function l(i){return 34===i||39===i||40===i?vY(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(i):d(i)}function c(i){return vh(i)?vX(e,d)(i):d(i)}function d(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),i):n(r)}}},v3={tokenize:function(e,i,n){let r=this;return function(i){return vK.call(r,e,s,o,"reference","referenceMarker","referenceString")(i)};function s(e){return r.parser.defined.includes(vJ(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?i(e):n(e)}function o(e){return n(e)}}},v4={tokenize:function(e,i,n){return function(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),i):n(r)}}},v6={name:"labelStartImage",resolveAll:v2.resolveAll,tokenize:function(e,i,n){let r=this;return function(i){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(i),e.exit("labelImageMarker"),s};function s(i){return 91===i?(e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelImage"),o):n(i)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):i(e)}}},v8={name:"labelStartLink",resolveAll:v2.resolveAll,tokenize:function(e,i,n){let r=this;return function(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s};function s(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):i(e)}}},v9={name:"lineEnding",tokenize:function(e,i){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),vg(e,i,"linePrefix")}}},v7={name:"thematicBreak",tokenize:function(e,i,n){let r,s=0;return function(o){var a;return e.enter("thematicBreak"),r=a=o,function o(a){return a===r?(e.enter("thematicBreakSequence"),function i(n){return n===r?(e.consume(n),s++,i):(e.exit("thematicBreakSequence"),vu(n)?vg(e,o,"whitespace")(n):o(n))}(a)):s>=3&&(null===a||vd(a))?(e.exit("thematicBreak"),i(a)):n(a)}(a)}}},ye={continuation:{tokenize:function(e,i,n){let r=this;return r.containerState._closeFlow=void 0,e.check(vx,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,vg(e,i,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!vu(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(yi,i,s)(n))});function s(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,vg(e,e.attempt(ye,i,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,i,n){let r=this,s=r.events[r.events.length-1],o=s&&"linePrefix"===s[1].type?s[2].sliceSerialize(s[1],!0).length:0,a=0;return function(i){let s=r.containerState.type||(42===i||43===i||45===i?"listUnordered":"listOrdered");if("listUnordered"===s?!r.containerState.marker||i===r.containerState.marker:va(i)){if(r.containerState.type||(r.containerState.type=s,e.enter(s,{_container:!0})),"listUnordered"===s)return e.enter("listItemPrefix"),42===i||45===i?e.check(v7,n,l)(i):l(i);if(!r.interrupt||49===i)return e.enter("listItemPrefix"),e.enter("listItemValue"),function i(s){return va(s)&&++a<10?(e.consume(s),i):(!r.interrupt||a<2)&&(r.containerState.marker?s===r.containerState.marker:41===s||46===s)?(e.exit("listItemValue"),l(s)):n(s)}(i)}return n(i)};function l(i){return e.enter("listItemMarker"),e.consume(i),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||i,e.check(vx,r.interrupt?n:c,e.attempt(yt,h,d))}function c(e){return r.containerState.initialBlankLine=!0,o++,h(e)}function d(i){return vu(i)?(e.enter("listItemPrefixWhitespace"),e.consume(i),e.exit("listItemPrefixWhitespace"),h):n(i)}function h(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,i(n)}}},yt={partial:!0,tokenize:function(e,i,n){let r=this;return vg(e,function(e){let s=r.events[r.events.length-1];return!vu(e)&&s&&"listItemPrefixWhitespace"===s[1].type?i(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},yi={partial:!0,tokenize:function(e,i,n){let r=this;return vg(e,function(e){let s=r.events[r.events.length-1];return s&&"listItemIndent"===s[1].type&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?i(e):n(e)},"listItemIndent",r.containerState.size+1)}},yn={name:"setextUnderline",resolveTo:function(e,i){let n,r,s,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),s||"definition"!==e[o][1].type||(s=o);let a={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",s?(e.splice(r,0,["enter",a,i]),e.splice(s+1,0,["exit",e[n][1],i]),e[n][1].end={...e[s][1].end}):e[n][1]=a,e.push(["exit",a,i]),e},tokenize:function(e,i,n){let r,s=this;return function(i){var a;let l,c=s.events.length;for(;c--;)if("lineEnding"!==s.events[c][1].type&&"linePrefix"!==s.events[c][1].type&&"content"!==s.events[c][1].type){l="paragraph"===s.events[c][1].type;break}return!s.parser.lazy[s.now().line]&&(s.interrupt||l)?(e.enter("setextHeadingLine"),r=i,a=i,e.enter("setextHeadingLineSequence"),function i(n){return n===r?(e.consume(n),i):(e.exit("setextHeadingLineSequence"),vu(n)?vg(e,o,"lineSuffix")(n):o(n))}(a)):n(i)};function o(r){return null===r||vd(r)?(e.exit("setextHeadingLine"),i(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,i,n){let r,s=this;return function(i){var r;return e.enter("definition"),r=i,vK.call(s,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function o(i){return(r=vJ(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),58===i)?(e.enter("definitionMarker"),e.consume(i),e.exit("definitionMarker"),a):n(i)}function a(i){return vh(i)?vX(e,l)(i):l(i)}function l(i){return vq(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(i)}function c(i){return e.attempt(vG,d,d)(i)}function d(i){return vu(i)?vg(e,h,"whitespace")(i):h(i)}function h(o){return null===o||vd(o)?(e.exit("definition"),s.parser.defined.push(r),i(o)):n(o)}}}},"disable",0,{null:[]},"document",0,{42:ye,43:ye,45:ye,48:ye,49:ye,50:ye,51:ye,52:ye,53:ye,54:ye,55:ye,56:ye,57:ye,62:vP},"flow",0,{35:{name:"headingAtx",resolve:function(e,i){let n,r,s=e.length-2,o=3;return"whitespace"===e[3][1].type&&(o+=2),s-2>o&&"whitespace"===e[s][1].type&&(s-=2),"atxHeadingSequence"===e[s][1].type&&(o===s-1||s-4>o&&"whitespace"===e[s-2][1].type)&&(s-=o+1===s?2:4),s>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[s][1].end},r={type:"chunkText",start:e[o][1].start,end:e[s][1].end,contentType:"text"},g7(e,o,s-o+1,[["enter",n,i],["enter",r,i],["exit",r,i],["exit",n,i]])),e},tokenize:function(e,i,n){let r=0;return function(s){var o;return e.enter("atxHeading"),o=s,e.enter("atxHeadingSequence"),function s(o){return 35===o&&r++<6?(e.consume(o),s):null===o||vh(o)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function i(r){return 35===r?(e.consume(r),i):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||vd(r)?(e.exit("atxHeading"),i(r)):vu(r)?vg(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function i(r){return null===r||35===r||vh(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),i)}(r))}(o)):n(o)}(o)}}},42:v7,45:[yn,v7],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let i=e.length;for(;i--&&("enter"!==e[i][0]||"htmlFlow"!==e[i][1].type););return i>1&&"linePrefix"===e[i-2][1].type&&(e[i][1].start=e[i-2][1].start,e[i+1][1].start=e[i-2][1].start,e.splice(i-2,2)),e},tokenize:function(e,i,n){let r,s,o,a,l,c=this;return function(i){var n;return n=i,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),d};function d(a){return 33===a?(e.consume(a),h):47===a?(e.consume(a),s=!0,f):63===a?(e.consume(a),r=3,c.interrupt?i:L):vn(a)?(e.consume(a),o=String.fromCharCode(a),m):n(a)}function h(s){return 45===s?(e.consume(s),r=2,u):91===s?(e.consume(s),r=5,a=0,p):vn(s)?(e.consume(s),r=4,c.interrupt?i:L):n(s)}function u(r){return 45===r?(e.consume(r),c.interrupt?i:L):n(r)}function p(r){let s="CDATA[";return r===s.charCodeAt(a++)?(e.consume(r),a===s.length)?c.interrupt?i:T:p:n(r)}function f(i){return vn(i)?(e.consume(i),o=String.fromCharCode(i),m):n(i)}function m(a){if(null===a||47===a||62===a||vh(a)){let l=47===a,d=o.toLowerCase();return!l&&!s&&vQ.includes(d)?(r=1,c.interrupt?i(a):T(a)):vZ.includes(o.toLowerCase())?(r=6,l)?(e.consume(a),g):c.interrupt?i(a):T(a):(r=7,c.interrupt&&!c.parser.lazy[c.now().line]?n(a):s?function i(n){return vu(n)?(e.consume(n),i):k(n)}(a):v(a))}return 45===a||vr(a)?(e.consume(a),o+=String.fromCharCode(a),m):n(a)}function g(r){return 62===r?(e.consume(r),c.interrupt?i:T):n(r)}function v(i){return 47===i?(e.consume(i),k):58===i||95===i||vn(i)?(e.consume(i),y):vu(i)?(e.consume(i),v):k(i)}function y(i){return 45===i||46===i||58===i||95===i||vr(i)?(e.consume(i),y):_(i)}function _(i){return 61===i?(e.consume(i),b):vu(i)?(e.consume(i),_):v(i)}function b(i){return null===i||60===i||61===i||62===i||96===i?n(i):34===i||39===i?(e.consume(i),l=i,w):vu(i)?(e.consume(i),b):function i(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||vh(n)?_(n):(e.consume(n),i)}(i)}function w(i){return i===l?(e.consume(i),l=null,S):null===i||vd(i)?n(i):(e.consume(i),w)}function S(e){return 47===e||62===e||vu(e)?v(e):n(e)}function k(i){return 62===i?(e.consume(i),C):n(i)}function C(i){return null===i||vd(i)?T(i):vu(i)?(e.consume(i),C):n(i)}function T(i){return 45===i&&2===r?(e.consume(i),M):60===i&&1===r?(e.consume(i),O):62===i&&4===r?(e.consume(i),j):63===i&&3===r?(e.consume(i),L):93===i&&5===r?(e.consume(i),A):vd(i)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(v0,I,E)(i)):null===i||vd(i)?(e.exit("htmlFlowData"),E(i)):(e.consume(i),T)}function E(i){return e.check(v1,D,I)(i)}function D(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),N}function N(i){return null===i||vd(i)?E(i):(e.enter("htmlFlowData"),T(i))}function M(i){return 45===i?(e.consume(i),L):T(i)}function O(i){return 47===i?(e.consume(i),o="",R):T(i)}function R(i){if(62===i){let n=o.toLowerCase();return vQ.includes(n)?(e.consume(i),j):T(i)}return vn(i)&&o.length<8?(e.consume(i),o+=String.fromCharCode(i),R):T(i)}function A(i){return 93===i?(e.consume(i),L):T(i)}function L(i){return 62===i?(e.consume(i),j):45===i&&2===r?(e.consume(i),L):T(i)}function j(i){return null===i||vd(i)?(e.exit("htmlFlowData"),I(i)):(e.consume(i),j)}function I(n){return e.exit("htmlFlow"),i(n)}}},61:yn,95:v7,96:v$,126:v$},"flowInitial",0,{[-2]:vU,[-1]:vU,32:vU},"insideSpan",0,{null:[vj,vE]},"string",0,{38:vH,92:vB},"text",0,{[-5]:v9,[-4]:v9,[-3]:v9,33:v6,38:vH,42:vj,60:[{name:"autolink",tokenize:function(e,i,n){let r=0;return function(i){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(i),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s};function s(i){return vn(i)?(e.consume(i),o):64===i?n(i):l(i)}function o(i){return 43===i||45===i||46===i||vr(i)?(r=1,function i(n){return 58===n?(e.consume(n),r=0,a):(43===n||45===n||46===n||vr(n))&&r++<32?(e.consume(n),i):(r=0,l(n))}(i)):l(i)}function a(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),i):null===r||32===r||60===r||vo(r)?n(r):(e.consume(r),a)}function l(i){return 64===i?(e.consume(i),c):vs(i)?(e.consume(i),l):n(i)}function c(s){return vr(s)?function s(o){return 46===o?(e.consume(o),r=0,c):62===o?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(o),e.exit("autolinkMarker"),e.exit("autolink"),i):function i(o){if((45===o||vr(o))&&r++<63){let n=45===o?i:s;return e.consume(o),n}return n(o)}(o)}(s):n(s)}}},{name:"htmlText",tokenize:function(e,i,n){let r,s,o,a=this;return function(i){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(i),l};function l(i){return 33===i?(e.consume(i),c):47===i?(e.consume(i),w):63===i?(e.consume(i),_):vn(i)?(e.consume(i),k):n(i)}function c(i){return 45===i?(e.consume(i),d):91===i?(e.consume(i),s=0,f):vn(i)?(e.consume(i),y):n(i)}function d(i){return 45===i?(e.consume(i),p):n(i)}function h(i){return null===i?n(i):45===i?(e.consume(i),u):vd(i)?(o=h,R(i)):(e.consume(i),h)}function u(i){return 45===i?(e.consume(i),p):h(i)}function p(e){return 62===e?O(e):45===e?u(e):h(e)}function f(i){let r="CDATA[";return i===r.charCodeAt(s++)?(e.consume(i),s===r.length?m:f):n(i)}function m(i){return null===i?n(i):93===i?(e.consume(i),g):vd(i)?(o=m,R(i)):(e.consume(i),m)}function g(i){return 93===i?(e.consume(i),v):m(i)}function v(i){return 62===i?O(i):93===i?(e.consume(i),v):m(i)}function y(i){return null===i||62===i?O(i):vd(i)?(o=y,R(i)):(e.consume(i),y)}function _(i){return null===i?n(i):63===i?(e.consume(i),b):vd(i)?(o=_,R(i)):(e.consume(i),_)}function b(e){return 62===e?O(e):_(e)}function w(i){return vn(i)?(e.consume(i),S):n(i)}function S(i){return 45===i||vr(i)?(e.consume(i),S):function i(n){return vd(n)?(o=i,R(n)):vu(n)?(e.consume(n),i):O(n)}(i)}function k(i){return 45===i||vr(i)?(e.consume(i),k):47===i||62===i||vh(i)?C(i):n(i)}function C(i){return 47===i?(e.consume(i),O):58===i||95===i||vn(i)?(e.consume(i),T):vd(i)?(o=C,R(i)):vu(i)?(e.consume(i),C):O(i)}function T(i){return 45===i||46===i||58===i||95===i||vr(i)?(e.consume(i),T):function i(n){return 61===n?(e.consume(n),E):vd(n)?(o=i,R(n)):vu(n)?(e.consume(n),i):C(n)}(i)}function E(i){return null===i||60===i||61===i||62===i||96===i?n(i):34===i||39===i?(e.consume(i),r=i,D):vd(i)?(o=E,R(i)):vu(i)?(e.consume(i),E):(e.consume(i),N)}function D(i){return i===r?(e.consume(i),r=void 0,M):null===i?n(i):vd(i)?(o=D,R(i)):(e.consume(i),D)}function N(i){return null===i||34===i||39===i||60===i||61===i||96===i?n(i):47===i||62===i||vh(i)?C(i):(e.consume(i),N)}function M(e){return 47===e||62===e||vh(e)?C(e):n(e)}function O(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),i):n(r)}function R(i){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),A}function A(i){return vu(i)?vg(e,L,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):L(i)}function L(i){return e.enter("htmlTextData"),o(i)}}}],91:v8,92:[{name:"hardBreakEscape",tokenize:function(e,i,n){return function(i){return e.enter("hardBreakEscape"),e.consume(i),r};function r(r){return vd(r)?(e.exit("hardBreakEscape"),i(r)):n(r)}}},vB],93:v2,95:vj,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let i,n,r=e.length-4,s=3;if(("lineEnding"===e[3][1].type||"space"===e[s][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(i=s;++i<r;)if("codeTextData"===e[i][1].type){e[s][1].type="codeTextPadding",e[r][1].type="codeTextPadding",s+=2,r-=2;break}}for(i=s-1,r++;++i<=r;)void 0===n?i!==r&&"lineEnding"!==e[i][1].type&&(n=i):(i===r||"lineEnding"===e[i][1].type)&&(e[n][1].type="codeTextData",i!==n+2&&(e[n][1].end=e[i-1][1].end,e.splice(n+2,i-n-2),r-=i-n-2,i=n+2),n=void 0);return e},tokenize:function(e,i,n){let r,s,o=0;return function(i){return e.enter("codeText"),e.enter("codeTextSequence"),function i(n){return 96===n?(e.consume(n),o++,i):(e.exit("codeTextSequence"),a(n))}(i)};function a(c){return null===c?n(c):32===c?(e.enter("space"),e.consume(c),e.exit("space"),a):96===c?(s=e.enter("codeTextSequence"),r=0,function n(a){return 96===a?(e.consume(a),r++,n):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),i(a)):(s.type="codeTextData",l(a))}(c)):vd(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):(e.enter("codeTextData"),l(c))}function l(i){return null===i||32===i||96===i||vd(i)?(e.exit("codeTextData"),a(i)):(e.consume(i),l)}}}}],119210);var yr=e.i(119210);let ys=/[\0\t\n\r]/g;function yo(e,i){let n=Number.parseInt(e,i);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let ya=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function yl(e,i,n){if(i)return i;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),i=120===e||88===e;return yo(n.slice(i?2:1),i?16:10)}return vF(n)||e}let yc={}.hasOwnProperty;function yd(e){return{line:e.line,column:e.column,offset:e.offset}}function yh(e,i){if(e)throw Error("Cannot close `"+e.type+"` ("+gF({start:e.start,end:e.end})+"): a different token (`"+i.type+"`, "+gF({start:i.start,end:i.end})+") is open");throw Error("Cannot close document, a token (`"+i.type+"`, "+gF({start:i.start,end:i.end})+") is still open")}function yu(e){let i=this;i.parser=function(n){var r,s;let o,a,l,c;return"object"==typeof(r={...i.data("settings"),...e,extensions:i.data("micromarkExtensions")||[],mdastExtensions:i.data("fromMarkdownExtensions")||[]})&&(s=r,r=void 0),(function(e){let i={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(y),autolinkProtocol:d,autolinkEmail:d,atxHeading:r(m),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:d,characterReference:d,codeFenced:r(f),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:r(f,s),codeText:r(function(){return{type:"inlineCode",value:""}},s),codeTextData:d,data:d,codeFlowValue:d,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(g),hardBreakTrailing:r(g),htmlFlow:r(v,s),htmlFlowData:d,htmlText:r(v,s),htmlTextData:d,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:s,link:r(y),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(_,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(_),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:r(m),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:a(),atxHeadingSequence:function(e){let i=this.stack[this.stack.length-1];i.depth||(i.depth=this.sliceSerialize(e).length)},autolink:a(),autolinkEmail:function(e){h.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){h.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:a(),characterEscapeValue:h,characterReferenceMarkerHexadecimal:p,characterReferenceMarkerNumeric:p,characterReferenceValue:function(e){let i,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(i=yo(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):i=vF(n);let s=this.stack[this.stack.length-1];s.value+=i},characterReference:function(e){this.stack.pop().position.end=yd(e.end)},codeFenced:a(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:h,codeIndented:a(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:a(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:h,data:h,definition:a(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let i=this.resume(),n=this.stack[this.stack.length-1];n.label=i,n.identifier=vJ(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:a(),hardBreakEscape:a(u),hardBreakTrailing:a(u),htmlFlow:a(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:h,htmlText:a(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:h,image:a(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let i=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=i,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],i=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=i},labelText:function(e){let i=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=i.replace(ya,yl),n.identifier=vJ(i).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=yd(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&i.canContainEols.includes(n.type)&&(d.call(this,e),h.call(this,e))},link:a(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let i=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=i,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:function(e){let i=this.resume(),n=this.stack[this.stack.length-1];n.label=i,n.identifier=vJ(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:a(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:a(),thematicBreak:a()}};!function e(i,n){let r=-1;for(;++r<n.length;){let s=n[r];Array.isArray(s)?e(i,s):function(e,i){let n;for(n in i)if(yc.call(i,n))switch(n){case"canContainEols":{let r=i[n];r&&e[n].push(...r);break}case"transforms":{let r=i[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=i[n];r&&Object.assign(e[n],r)}}}(i,s)}}(i,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},a={stack:[r],tokenStack:[],config:i,enter:o,exit:l,buffer:s,resume:c,data:n},d=[],h=-1;for(;++h<e.length;)("listOrdered"===e[h][1].type||"listUnordered"===e[h][1].type)&&("enter"===e[h][0]?d.push(h):h=function(e,i,n){let r,s,o,a,l=i-1,c=-1,d=!1;for(;++l<=n;){let i=e[l];switch(i[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===i[0]?c++:c--,a=void 0;break;case"lineEndingBlank":"enter"===i[0]&&(!r||a||c||o||(o=l),a=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:a=void 0}if(!c&&"enter"===i[0]&&"listItemPrefix"===i[1].type||-1===c&&"exit"===i[0]&&("listUnordered"===i[1].type||"listOrdered"===i[1].type)){if(r){let a=l;for(s=void 0;a--;){let i=e[a];if("lineEnding"===i[1].type||"lineEndingBlank"===i[1].type){if("exit"===i[0])continue;s&&(e[s][1].type="lineEndingBlank",d=!0),i[1].type="lineEnding",s=a}else if("linePrefix"===i[1].type||"blockQuotePrefix"===i[1].type||"blockQuotePrefixWhitespace"===i[1].type||"blockQuoteMarker"===i[1].type||"listItemIndent"===i[1].type);else break}o&&(!s||o<s)&&(r._spread=!0),r.end=Object.assign({},s?e[s][1].start:i[1].end),e.splice(s||l,0,["exit",r,i[2]]),l++,n++}if("listItemPrefix"===i[1].type){let s={type:"listItem",_spread:!1,start:Object.assign({},i[1].start),end:void 0};r=s,e.splice(l,0,["enter",s,i[2]]),l++,n++,o=void 0,a=!0}}}return e[i][1]._spread=d,n}(e,d.pop(),h));for(h=-1;++h<e.length;){let n=i[e[h][0]];yc.call(n,e[h][1].type)&&n[e[h][1].type].call(Object.assign({sliceSerialize:e[h][2].sliceSerialize},a),e[h][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||yh).call(a,void 0,e[0])}for(r.position={start:yd(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:yd(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},h=-1;++h<i.transforms.length;)r=i.transforms[h](r)||r;return r};function r(e,i){return function(n){o.call(this,e(n),n),i&&i.call(this,n)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(e,i,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([i,n||void 0]),e.position={start:yd(i.start),end:void 0}}function a(e){return function(i){e&&e.call(this,i),l.call(this,i)}}function l(e,i){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(i?i.call(this,e,r[0]):(r[1]||yh).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+gF({start:e.start,end:e.end})+"): it’s not open");n.position.end=yd(e.end)}function c(){return g6(this.stack.pop())}function d(e){let i=this.stack[this.stack.length-1].children,n=i[i.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:yd(e.start),end:void 0},i.push(n)),this.stack.push(n)}function h(e){let i=this.stack.pop();i.value+=this.sliceSerialize(e),i.position.end=yd(e.end)}function u(){this.data.atHardBreak=!0}function p(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function m(){return{type:"heading",depth:0,children:[]}}function g(){return{type:"break"}}function v(){return{type:"html",value:""}}function y(){return{type:"link",title:null,url:"",children:[]}}function _(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(s)(function(e){for(;!vS(e););return e}((function(e){let i={constructs:vi([yr,...(e||{}).extensions||[]]),content:n(vv),defined:[],document:n(vy),flow:n(vT),lazy:{},string:n(vD),text:n(vN)};return i;function n(e){return function(n){return function(e,i,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},s={},o=[],a=[],l=[],c={attempt:m(function(e,i){g(e,i.from)}),check:m(f),consume:function(e){vd(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=e},enter:function(e,i){let n=i||{};return n.type=e,n.start=p(),d.events.push(["enter",n,d]),l.push(n),n},exit:function(e){let i=l.pop();return i.end=p(),d.events.push(["exit",i,d]),i},interrupt:m(f,{interrupt:!0})},d={code:null,containerState:{},defineSkip:function(e){s[e.line]=e.column,v()},events:[],now:p,parser:e,previous:null,sliceSerialize:function(e,i){return function(e,i){let n,r=-1,s=[];for(;++r<e.length;){let o,a=e[r];if("string"==typeof a)o=a;else switch(a){case -5:o="\r";break;case -4:o="\n";break;case -3:o="\r\n";break;case -2:o=i?" ":" ";break;case -1:if(!i&&n)continue;o=" ";break;default:o=String.fromCharCode(a)}n=-2===a,s.push(o)}return s.join("")}(u(e),i)},sliceStream:u,write:function(e){return(a=ve(a,e),function(){let e;for(;r._index<a.length;){let n=a[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var i;i=n.charCodeAt(r._bufferIndex),h=h(i)}else h=h(n)}}(),null!==a[a.length-1])?[]:(g(i,0),d.events=vL(o,d.events,d),d.events)}},h=i.tokenize.call(d,c);return i.resolveAll&&o.push(i),d;function u(e){return function(e,i){let n,r=i.start._index,s=i.start._bufferIndex,o=i.end._index,a=i.end._bufferIndex;if(r===o)n=[e[r].slice(s,a)];else{if(n=e.slice(r,o),s>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(s):n.shift()}a>0&&n.push(e[o].slice(0,a))}return n}(a,e)}function p(){let{_bufferIndex:e,_index:i,line:n,column:s,offset:o}=r;return{_bufferIndex:e,_index:i,line:n,column:s,offset:o}}function f(e,i){i.restore()}function m(e,i){return function(n,s,o){var a;let h,u,f,m;return Array.isArray(n)?g(n):"tokenize"in n?g([n]):(a=n,function(e){let i=null!==e&&a[e],n=null!==e&&a.null;return g([...Array.isArray(i)?i:i?[i]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function g(e){return(h=e,u=0,0===e.length)?o:y(e[u])}function y(e){return function(n){let s,o,a,h,u;return(s=p(),o=d.previous,a=d.currentConstruct,h=d.events.length,u=Array.from(l),m={from:h,restore:function(){r=s,d.previous=o,d.currentConstruct=a,d.events.length=h,l=u,v()}},f=e,e.partial||(d.currentConstruct=e),e.name&&d.parser.constructs.disable.null.includes(e.name))?b(n):e.tokenize.call(i?Object.assign(Object.create(d),i):d,c,_,b)(n)}}function _(i){return e(f,m),s}function b(e){return(m.restore(),++u<h.length)?y(h[u]):o}}}function g(e,i){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&g7(d.events,i,d.events.length-i,e.resolve(d.events.slice(i),d)),e.resolveTo&&(d.events=e.resolveTo(d.events,d))}function v(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}(i,e,n)}}})(s).document().write((a=1,l="",c=!0,function(e,i,n){let r,s,d,h,u,p=[];for(e=l+("string"==typeof e?e.toString():new TextDecoder(i||void 0).decode(e)),d=0,l="",c&&(65279===e.charCodeAt(0)&&d++,c=void 0);d<e.length;){if(ys.lastIndex=d,h=(r=ys.exec(e))&&void 0!==r.index?r.index:e.length,u=e.charCodeAt(h),!r){l=e.slice(d);break}if(10===u&&d===h&&o)p.push(-3),o=void 0;else switch(o&&(p.push(-5),o=void 0),d<h&&(p.push(e.slice(d,h)),a+=h-d),u){case 0:p.push(65533),a++;break;case 9:for(s=4*Math.ceil(a/4),p.push(-2);a++<s;)p.push(-1);break;case 10:p.push(-4),a=1;break;default:o=!0,a=1}d=h+1}return n&&(o&&p.push(-5),l&&p.push(l),p.push(null)),p})(n,r,!0))))}}let yp="object"==typeof self?self:globalThis,yf=e=>{var i;let n,r;return(i=new Map,n=(e,n)=>(i.set(n,e),e),r=s=>{if(i.has(s))return i.get(s);let[o,a]=e[s];switch(o){case 0:case -1:return n(a,s);case 1:{let e=n([],s);for(let i of a)e.push(r(i));return e}case 2:{let e=n({},s);for(let[i,n]of a)e[r(i)]=r(n);return e}case 3:return n(new Date(a),s);case 4:{let{source:e,flags:i}=a;return n(new RegExp(e,i),s)}case 5:{let e=n(new Map,s);for(let[i,n]of a)e.set(r(i),r(n));return e}case 6:{let e=n(new Set,s);for(let i of a)e.add(r(i));return e}case 7:{let{name:e,message:i}=a;return n(new yp[e](i),s)}case 8:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{let{buffer:e}=new Uint8Array(a);return n(new DataView(e),a)}}return n(new yp[o](a),s)})(0)},{toString:ym}={},{keys:yg}=Object,yv=e=>{let i=typeof e;if("object"!==i||!e)return[0,i];let n=ym.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},yy=([e,i])=>0===e&&("function"===i||"symbol"===i),y_=(e,{json:i,lossy:n}={})=>{var r,s,o;let a,l,c=[];return(r=!(i||n),s=!!i,o=new Map,a=(e,i)=>{let n=c.push(e)-1;return o.set(i,n),n},l=e=>{if(o.has(e))return o.get(e);let[i,n]=yv(e);switch(i){case 0:{let s=e;switch(n){case"bigint":i=8,s=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);s=null;break;case"undefined":return a([-1],e)}return a([i,s],e)}case 1:{if(n){let i=e;return"DataView"===n?i=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(i=new Uint8Array(e)),a([n,[...i]],e)}let r=[],s=a([i,r],e);for(let i of e)r.push(l(i));return s}case 2:{if(n)switch(n){case"BigInt":return a([n,e.toString()],e);case"Boolean":case"Number":case"String":return a([n,e.valueOf()],e)}if(s&&"toJSON"in e)return l(e.toJSON());let o=[],c=a([i,o],e);for(let i of yg(e))(r||!yy(yv(e[i])))&&o.push([l(i),l(e[i])]);return c}case 3:return a([i,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return a([i,{source:n,flags:r}],e)}case 5:{let n=[],s=a([i,n],e);for(let[i,s]of e)(r||!(yy(yv(i))||yy(yv(s))))&&n.push([l(i),l(s)]);return s}case 6:{let n=[],s=a([i,n],e);for(let i of e)(r||!yy(yv(i)))&&n.push(l(i));return s}}let{message:c}=e;return a([i,{name:n,message:c}],e)})(e),c},yx="function"==typeof structuredClone?(e,i)=>i&&("json"in i||"lossy"in i)?yf(y_(e,i)):structuredClone(e):(e,i)=>yf(y_(e,i));function yb(e){let i=[],n=-1,r=0,s=0;for(;++n<e.length;){let o=e.charCodeAt(n),a="";if(37===o&&vr(e.charCodeAt(n+1))&&vr(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){let i=e.charCodeAt(n+1);o<56320&&i>56319&&i<57344?(a=String.fromCharCode(o,i),s=1):a="�"}else a=String.fromCharCode(o);a&&(i.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return i.join("")+e.slice(r)}function yw(e,i){let n=[{type:"text",value:"↩"}];return i>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),n}function yS(e,i){return"Back to reference "+(e+1)+(i>1?"-"+i:"")}let yk=function(e){var i,n;if(null==e)return yT;if("function"==typeof e)return yC(e);if("object"==typeof e){return Array.isArray(e)?function(e){let i=[],n=-1;for(;++n<e.length;)i[n]=yk(e[n]);return yC(function(...e){let n=-1;for(;++n<i.length;)if(i[n].apply(this,e))return!0;return!1})}(e):(i=e,yC(function(e){let n;for(n in i)if(e[n]!==i[n])return!1;return!0}))}if("string"==typeof e){return n=e,yC(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function yC(e){return function(i,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(i)&&e.call(this,i,"number"==typeof n?n:void 0,r||void 0))}}function yT(){return!0}let yE=[];function yD(e,i,n,r){let s;"function"==typeof i&&"function"!=typeof n?(r=n,n=i):s=i;let o=yk(s),a=r?-1:1;(function e(s,l,c){let d=s&&"object"==typeof s?s:{};if("string"==typeof d.type){let e="string"==typeof d.tagName?d.tagName:"string"==typeof d.name?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+s.type+(e?"<"+e+">":"")+")"})}return h;function h(){var d;let h,u,p,f=yE;if((!i||o(s,l,c[c.length-1]||void 0))&&!1===(f=Array.isArray(d=n(s,c))?d:"number"==typeof d?[!0,d]:null==d?yE:[d])[0])return f;if("children"in s&&s.children&&s.children&&"skip"!==f[0])for(u=(r?s.children.length:-1)+a,p=c.concat(s);u>-1&&u<s.children.length;){if(!1===(h=e(s.children[u],u,p)())[0])return h;u="number"==typeof h[1]?h[1]:u+a}return f}})(e,void 0,[])()}function yN(e,i,n,r){let s,o,a;"function"==typeof i&&"function"!=typeof n?(o=void 0,a=i,s=n):(o=i,a=n,s=r),yD(e,o,function(e,i){let n=i[i.length-1],r=n?n.children.indexOf(e):void 0;return a(e,r,n)},s)}function yM(e,i){let n=i.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(i.label||i.identifier)+"]"),"imageReference"===i.type)return[{type:"text",value:"!["+i.alt+r}];let s=e.all(i),o=s[0];o&&"text"===o.type?o.value="["+o.value:s.unshift({type:"text",value:"["});let a=s[s.length-1];return a&&"text"===a.type?a.value+=r:s.push({type:"text",value:r}),s}function yO(e){let i=e.spread;return null==i?e.children.length>1:i}function yR(e,i,n){let r=0,s=e.length;if(i){let i=e.codePointAt(r);for(;9===i||32===i;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;9===i||32===i;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}let yA={blockquote:function(e,i){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(i),!0)};return e.patch(i,n),e.applyData(i,n)},break:function(e,i){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(i,n),[e.applyData(i,n),{type:"text",value:"\n"}]},code:function(e,i){let n=i.value?i.value+"\n":"",r={},s=i.lang?i.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return i.meta&&(o.data={meta:i.meta}),e.patch(i,o),o={type:"element",tagName:"pre",properties:{},children:[o=e.applyData(i,o)]},e.patch(i,o),o},delete:function(e,i){let n={type:"element",tagName:"del",properties:{},children:e.all(i)};return e.patch(i,n),e.applyData(i,n)},emphasis:function(e,i){let n={type:"element",tagName:"em",properties:{},children:e.all(i)};return e.patch(i,n),e.applyData(i,n)},footnoteReference:function(e,i){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",s=String(i.identifier).toUpperCase(),o=yb(s.toLowerCase()),a=e.footnoteOrder.indexOf(s),l=e.footnoteCounts.get(s);void 0===l?(l=0,e.footnoteOrder.push(s),n=e.footnoteOrder.length):n=a+1,l+=1,e.footnoteCounts.set(s,l);let c={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+o,id:r+"fnref-"+o+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(i,c);let d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(i,d),e.applyData(i,d)},heading:function(e,i){let n={type:"element",tagName:"h"+i.depth,properties:{},children:e.all(i)};return e.patch(i,n),e.applyData(i,n)},html:function(e,i){if(e.options.allowDangerousHtml){let n={type:"raw",value:i.value};return e.patch(i,n),e.applyData(i,n)}},imageReference:function(e,i){let n=String(i.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yM(e,i);let s={src:yb(r.url||""),alt:i.alt};null!==r.title&&void 0!==r.title&&(s.title=r.title);let o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(i,o),e.applyData(i,o)},image:function(e,i){let n={src:yb(i.url)};null!==i.alt&&void 0!==i.alt&&(n.alt=i.alt),null!==i.title&&void 0!==i.title&&(n.title=i.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(i,r),e.applyData(i,r)},inlineCode:function(e,i){let n={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};e.patch(i,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(i,r),e.applyData(i,r)},linkReference:function(e,i){let n=String(i.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yM(e,i);let s={href:yb(r.url||"")};null!==r.title&&void 0!==r.title&&(s.title=r.title);let o={type:"element",tagName:"a",properties:s,children:e.all(i)};return e.patch(i,o),e.applyData(i,o)},link:function(e,i){let n={href:yb(i.url)};null!==i.title&&void 0!==i.title&&(n.title=i.title);let r={type:"element",tagName:"a",properties:n,children:e.all(i)};return e.patch(i,r),e.applyData(i,r)},listItem:function(e,i,n){let r=e.all(i),s=n?function(e){let i=!1;if("list"===e.type){i=e.spread||!1;let n=e.children,r=-1;for(;!i&&++r<n.length;)i=yO(n[r])}return i}(n):yO(i),o={},a=[];if("boolean"==typeof i.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let l=-1;for(;++l<r.length;){let e=r[l];(s||0!==l||"element"!==e.type||"p"!==e.tagName)&&a.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||s?a.push(e):a.push(...e.children)}let c=r[r.length-1];c&&(s||"element"!==c.type||"p"!==c.tagName)&&a.push({type:"text",value:"\n"});let d={type:"element",tagName:"li",properties:o,children:a};return e.patch(i,d),e.applyData(i,d)},list:function(e,i){let n={},r=e.all(i),s=-1;for("number"==typeof i.start&&1!==i.start&&(n.start=i.start);++s<r.length;){let e=r[s];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let o={type:"element",tagName:i.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(i,o),e.applyData(i,o)},paragraph:function(e,i){let n={type:"element",tagName:"p",properties:{},children:e.all(i)};return e.patch(i,n),e.applyData(i,n)},root:function(e,i){let n={type:"root",children:e.wrap(e.all(i))};return e.patch(i,n),e.applyData(i,n)},strong:function(e,i){let n={type:"element",tagName:"strong",properties:{},children:e.all(i)};return e.patch(i,n),e.applyData(i,n)},table:function(e,i){let n=e.all(i),r=n.shift(),s=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(i.children[0],n),s.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=gB(i.children[1]),a=gP(i.children[i.children.length-1]);o&&a&&(r.position={start:o,end:a}),s.push(r)}let o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(i,o),e.applyData(i,o)},tableCell:function(e,i){let n={type:"element",tagName:"td",properties:{},children:e.all(i)};return e.patch(i,n),e.applyData(i,n)},tableRow:function(e,i,n){let r=n?n.children:void 0,s=0===(r?r.indexOf(i):1)?"th":"td",o=n&&"table"===n.type?n.align:void 0,a=o?o.length:i.children.length,l=-1,c=[];for(;++l<a;){let n=i.children[l],r={},a=o?o[l]:void 0;a&&(r.align=a);let d={type:"element",tagName:s,properties:r,children:[]};n&&(d.children=e.all(n),e.patch(n,d),d=e.applyData(n,d)),c.push(d)}let d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(i,d),e.applyData(i,d)},text:function(e,i){let n={type:"text",value:function(e){let i=String(e),n=/\r?\n|\r/g,r=n.exec(i),s=0,o=[];for(;r;)o.push(yR(i.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(i);return o.push(yR(i.slice(s),s>0,!1)),o.join("")}(String(i.value))};return e.patch(i,n),e.applyData(i,n)},thematicBreak:function(e,i){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(i,n),e.applyData(i,n)},toml:yL,yaml:yL,definition:yL,footnoteDefinition:yL};function yL(){}let yj={}.hasOwnProperty,yI={};function yP(e,i){e.position&&(i.position=function(e){let i=gB(e),n=gP(e);if(i&&n)return{start:i,end:n}}(e))}function yB(e,i){let n=i;if(e&&e.data){let i=e.data.hName,r=e.data.hChildren,s=e.data.hProperties;"string"==typeof i&&("element"===n.type?n.tagName=i:n={type:"element",tagName:i,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&s&&Object.assign(n.properties,yx(s)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function yz(e,i){let n=[],r=-1;for(i&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return i&&e.length>0&&n.push({type:"text",value:"\n"}),n}function yF(e){let i=0,n=e.charCodeAt(i);for(;9===n||32===n;)i++,n=e.charCodeAt(i);return e.slice(i)}function yH(e,i){let n,r,s,o,a=(n=i||yI,r=new Map,s=new Map,o={all:function(e){let i=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let s=o.one(n[r],e);if(s){if(r&&"break"===n[r-1].type&&(Array.isArray(s)||"text"!==s.type||(s.value=yF(s.value)),!Array.isArray(s)&&"element"===s.type)){let e=s.children[0];e&&"text"===e.type&&(e.value=yF(e.value))}Array.isArray(s)?i.push(...s):i.push(s)}}}return i},applyData:yB,definitionById:r,footnoteById:s,footnoteCounts:new Map,footnoteOrder:[],handlers:{...yA,...n.handlers},one:function(e,i){let n=e.type,r=o.handlers[n];if(yj.call(o.handlers,n)&&r)return r(o,e,i);if(o.options.passThrough&&o.options.passThrough.includes(n)){if("children"in e){let{children:i,...n}=e,r=yx(n);return r.children=o.all(e),r}return yx(e)}return(o.options.unknownHandler||function(e,i){let n=i.data||{},r="value"in i&&!(yj.call(n,"hProperties")||yj.call(n,"hChildren"))?{type:"text",value:i.value}:{type:"element",tagName:"div",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)})(o,e,i)},options:n,patch:yP,wrap:yz},yN(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let i="definition"===e.type?r:s,n=String(e.identifier).toUpperCase();i.has(n)||i.set(n,e)}}),o),l=a.one(e,void 0),c=function(e){let i="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||yw,r=e.options.footnoteBackLabel||yS,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[],c=-1;for(;++c<e.footnoteOrder.length;){let s=e.footnoteById.get(e.footnoteOrder[c]);if(!s)continue;let o=e.all(s),a=String(s.identifier).toUpperCase(),d=yb(a.toLowerCase()),h=0,u=[],p=e.footnoteCounts.get(a);for(;void 0!==p&&++h<=p;){u.length>0&&u.push({type:"text",value:" "});let e="string"==typeof n?n:n(c,h);"string"==typeof e&&(e={type:"text",value:e}),u.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+d+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=o[o.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...u)}else o.push(...u);let m={type:"element",tagName:"li",properties:{id:i+"fn-"+d},children:e.wrap(o,!0)};e.patch(s,m),l.push(m)}if(0!==l.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...yx(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:"\n"}]}}(a),d=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return c&&(m4("children"in d),d.children.push({type:"text",value:"\n"},c)),d}function yW(e,i){return e&&"run"in e?async function(n,r){let s=yH(n,{file:r,...i});await e.run(s,r)}:function(n,r){return yH(n,{file:r,...e||i})}}function y$(e){if(e)throw e}var yU=e.i(975609);function yV(e){if("object"!=typeof e||null===e)return!1;let i=Object.getPrototypeOf(e);return(null===i||i===Object.prototype||null===Object.getPrototypeOf(i))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let yq=function(e,i){let n;if(void 0!==i&&"string"!=typeof i)throw TypeError('"ext" argument must be a string');yJ(e);let r=0,s=-1,o=e.length;if(void 0===i||0===i.length||i.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else s<0&&(n=!0,s=o+1);return s<0?"":e.slice(r,s)}if(i===e)return"";let a=-1,l=i.length-1;for(;o--;)if(47===e.codePointAt(o)){if(n){r=o+1;break}}else a<0&&(n=!0,a=o+1),l>-1&&(e.codePointAt(o)===i.codePointAt(l--)?l<0&&(s=o):(l=-1,s=a));return r===s?s=a:s<0&&(s=e.length),e.slice(r,s)},yK=function(e){let i;if(yJ(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(i){n=r;break}}else i||(i=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},yY=function(e){let i;yJ(e);let n=e.length,r=-1,s=0,o=-1,a=0;for(;n--;){let l=e.codePointAt(n);if(47===l){if(i){s=n+1;break}continue}r<0&&(i=!0,r=n+1),46===l?o<0?o=n:1!==a&&(a=1):o>-1&&(a=-1)}return o<0||r<0||0===a||1===a&&o===r-1&&o===s+1?"":e.slice(o,r)},yX=function(...e){var i;let n,r,s,o=-1;for(;++o<e.length;)yJ(e[o]),e[o]&&(s=void 0===s?e[o]:s+"/"+e[o]);return void 0===s?".":(yJ(i=s),n=47===i.codePointAt(0),0!==(r=function(e,i){let n,r,s="",o=0,a=-1,l=0,c=-1;for(;++c<=e.length;){if(c<e.length)n=e.codePointAt(c);else if(47===n)break;else n=47;if(47===n){if(a===c-1||1===l);else if(a!==c-1&&2===l){if(s.length<2||2!==o||46!==s.codePointAt(s.length-1)||46!==s.codePointAt(s.length-2)){if(s.length>2){if((r=s.lastIndexOf("/"))!==s.length-1){r<0?(s="",o=0):o=(s=s.slice(0,r)).length-1-s.lastIndexOf("/"),a=c,l=0;continue}}else if(s.length>0){s="",o=0,a=c,l=0;continue}}i&&(s=s.length>0?s+"/..":"..",o=2)}else s.length>0?s+="/"+e.slice(a+1,c):s=e.slice(a+1,c),o=c-a-1;a=c,l=0}else 46===n&&l>-1?l++:l=-1}return s}(i,!n)).length||n||(r="."),r.length>0&&47===i.codePointAt(i.length-1)&&(r+="/"),n?"/"+r:r)};function yJ(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function yG(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let yZ=["history","path","basename","stem","extname","dirname"];class yQ{constructor(e){let i,n;i=e?yG(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in i?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<yZ.length;){const e=yZ[r];e in i&&void 0!==i[e]&&null!==i[e]&&(this[e]="history"===e?[...i[e]]:i[e])}for(n in i)yZ.includes(n)||(this[n]=i[n])}get basename(){return"string"==typeof this.path?yq(this.path):void 0}set basename(e){y1(e,"basename"),y0(e,"basename"),this.path=yX(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?yK(this.path):void 0}set dirname(e){y2(this.basename,"dirname"),this.path=yX(e||"",this.basename)}get extname(){return"string"==typeof this.path?yY(this.path):void 0}set extname(e){if(y0(e,"extname"),y2(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=yX(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){yG(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!yG(e)){let i=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let i=e.pathname,n=-1;for(;++n<i.length;)if(37===i.codePointAt(n)&&50===i.codePointAt(n+1)){let e=i.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(i)}(e)}(e)),y1(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?yq(this.path,this.extname):void 0}set stem(e){y1(e,"stem"),y0(e,"stem"),this.path=yX(this.dirname||"",e+(this.extname||""))}fail(e,i,n){let r=this.message(e,i,n);throw r.fatal=!0,r}info(e,i,n){let r=this.message(e,i,n);return r.fatal=void 0,r}message(e,i,n){let r=new gU(e,i,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function y0(e,i){if(e&&e.includes("/"))throw Error("`"+i+"` cannot be a path: did not expect `/`")}function y1(e,i){if(!e)throw Error("`"+i+"` cannot be empty")}function y2(e,i){if(!e)throw Error("Setting `"+i+"` requires `path` to be set too")}let y5=function(e){let i=this.constructor.prototype,n=i[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,i),r},y3={}.hasOwnProperty;class y4 extends y5{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],i={run:function(...i){let n=-1,r=i.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function s(o,...a){let l=e[++n],c=-1;if(o)return void r(o);for(;++c<i.length;)(null===a[c]||void 0===a[c])&&(a[c]=i[c]);i=a,l?(function(e,i){let n;return function(...i){let o,a=e.length>i.length;a&&i.push(r);try{o=e.apply(this,i)}catch(e){if(a&&n)throw e;return r(e)}a||(o&&o.then&&"function"==typeof o.then?o.then(s,r):o instanceof Error?r(o):s(o))};function r(e,...s){n||(n=!0,i(e,...s))}function s(e){r(null,e)}})(l,s)(...a):r(null,...a)}(null,...i)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),i}};return i}()}copy(){let e=new y4,i=-1;for(;++i<this.attachers.length;){let n=this.attachers[i];e.use(...n)}return e.data((0,yU.default)(!0,{},this.namespace)),e}data(e,i){return"string"==typeof e?2==arguments.length?(y7("data",this.frozen),this.namespace[e]=i,this):y3.call(this.namespace,e)&&this.namespace[e]||void 0:e?(y7("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...i]=this.attachers[this.freezeIndex];if(!1===i[0])continue;!0===i[0]&&(i[0]=void 0);let n=e.call(this,...i);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let i=_i(e),n=this.parser||this.Parser;return y8("parse",n),n(String(i),i)}process(e,i){let n=this;return this.freeze(),y8("process",this.parser||this.Parser),y9("process",this.compiler||this.Compiler),i?r(void 0,i):new Promise(r);function r(r,s){let o=_i(e),a=n.parse(o);function l(e,n){e||!n?s(e):r?r(n):(m4(i,"`done` is defined if `resolve` is not"),i(void 0,n))}n.run(a,o,function(e,i,r){var s,o;if(e||!i||!r)return l(e);let a=n.stringify(i,r);"string"==typeof(s=a)||(o=s)&&"object"==typeof o&&"byteLength"in o&&"byteOffset"in o?r.value=a:r.result=a,l(e,r)})}}processSync(e){let i,n=!1;return this.freeze(),y8("processSync",this.parser||this.Parser),y9("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,y$(e),i=r}),_t("processSync","process",n),m4(i,"we either bailed on an error or have a tree"),i}run(e,i,n){_e(e),this.freeze();let r=this.transformers;return n||"function"!=typeof i||(n=i,i=void 0),n?s(void 0,n):new Promise(s);function s(s,o){m4("function"!=typeof i,"`file` can’t be a `done` anymore, we checked");let a=_i(i);r.run(e,a,function(i,r,a){let l=r||e;i?o(i):s?s(l):(m4(n,"`done` is defined if `resolve` is not"),n(void 0,l,a))})}}runSync(e,i){let n,r=!1;return this.run(e,i,function(e,i){y$(e),n=i,r=!0}),_t("runSync","run",r),m4(n,"we either bailed on an error or have a tree"),n}stringify(e,i){this.freeze();let n=_i(i),r=this.compiler||this.Compiler;return y9("stringify",r),_e(e),r(e,n)}use(e,...i){let n=this.attachers,r=this.namespace;if(y7("use",this.frozen),null==e);else if("function"==typeof e)a(e,i);else if("object"==typeof e)Array.isArray(e)?o(e):s(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function s(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,yU.default)(!0,r.settings,e.settings))}function o(e){let i=-1;if(null==e);else if(Array.isArray(e))for(;++i<e.length;)!function(e){if("function"==typeof e)a(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[i,...n]=e;a(i,n)}else s(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[i]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function a(e,i){let r=-1,s=-1;for(;++r<n.length;)if(n[r][0]===e){s=r;break}if(-1===s)n.push([e,...i]);else if(i.length>0){let[r,...o]=i,a=n[s][1];yV(a)&&yV(r)&&(r=(0,yU.default)(!0,a,r)),n[s]=[e,r,...o]}}}}let y6=new y4().freeze();function y8(e,i){if("function"!=typeof i)throw TypeError("Cannot `"+e+"` without `parser`")}function y9(e,i){if("function"!=typeof i)throw TypeError("Cannot `"+e+"` without `compiler`")}function y7(e,i){if(i)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function _e(e){if(!yV(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function _t(e,i,n){if(!n)throw Error("`"+e+"` finished async. Use `"+i+"` instead")}function _i(e){var i;return(i=e)&&"object"==typeof i&&"message"in i&&"messages"in i?e:new yQ(e)}let _n=[],_r={allowDangerousHtml:!0},_s=/^(https?|ircs?|mailto|xmpp)$/i,_o=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function _a(e){var i;let n,r,s,o,a,l=(n=(i=e).rehypePlugins||_n,r=i.remarkPlugins||_n,s=i.remarkRehypeOptions?{...i.remarkRehypeOptions,..._r}:_r,y6().use(yu).use(r).use(yW,s).use(n)),c=(o=e.children||"",a=new yQ,"string"==typeof o?a.value=o:m6("Unexpected value `"+o+"` for `children` prop, expected `string`"),a);return function(e,i){let n=i.allowedElements,r=i.allowElement,s=i.components,o=i.disallowedElements,a=i.skipHtml,l=i.unwrapDisallowed,c=i.urlTransform||_l;for(let e of _o)Object.hasOwn(i,e.from)&&m6("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return n&&o&&m6("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),yN(e,function(e,i,s){if("raw"===e.type&&s&&"number"==typeof i)return a?s.children.splice(i,1):s.children[i]={type:"text",value:e.value},i;if("element"===e.type){let i;for(i in g3)if(Object.hasOwn(g3,i)&&Object.hasOwn(e.properties,i)){let n=e.properties[i],r=g3[i];(null===r||r.includes(e.tagName))&&(e.properties[i]=c(String(n||""),i,e))}}if("element"===e.type){let a=n?!n.includes(e.tagName):!!o&&o.includes(e.tagName);if(!a&&r&&"number"==typeof i&&(a=!r(e,i,s)),a&&s&&"number"==typeof i)return l&&e.children?s.children.splice(i,1,...e.children):s.children.splice(i,1),i}}),function(e,i){var n,r,s,o;let a;if(!i||void 0===i.Fragment)throw TypeError("Expected `Fragment` in options");let l=i.filePath||void 0;if(i.development){if("function"!=typeof i.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=l,r=i.jsxDEV,a=function(e,i,s,o){let a=Array.isArray(s.children),l=gB(e);return r(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:n,lineNumber:l?l.line:void 0},void 0)}}else{if("function"!=typeof i.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof i.jsxs)throw TypeError("Expected `jsxs` in production options");s=i.jsx,o=i.jsxs,a=function(e,i,n,r){let a=Array.isArray(n.children)?o:s;return r?a(i,n,r):a(i,n)}}let c={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:a,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:l,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:!1!==i.passKeys,passNode:i.passNode||!1,schema:"svg"===i.space?gj:gL,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==i.tableCellAlignToStyle},d=gG(c,e,void 0);return d&&"string"!=typeof d?d:c.create(e,c.Fragment,{children:d||void 0},void 0)}(e,{Fragment:iM.Fragment,components:s,ignoreInvalidStyle:!0,jsx:iM.jsx,jsxs:iM.jsxs,passKeys:!0,passNode:!0})}(l.runSync(l.parse(c),c),e)}function _l(e){let i=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return -1===i||-1!==s&&i>s||-1!==n&&i>n||-1!==r&&i>r||_s.test(e.slice(0,i))?e:""}function _c(e,i){let n=String(e);if("string"!=typeof i)throw TypeError("Expected character");let r=0,s=n.indexOf(i);for(;-1!==s;)r++,s=n.indexOf(i,s+i.length);return r}let _d="phrasing",_h=["autolink","link","image","label"];function _u(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function _p(e){this.config.enter.autolinkProtocol.call(this,e)}function _f(e){this.config.exit.autolinkProtocol.call(this,e)}function _m(e){this.config.exit.data.call(this,e);let i=this.stack[this.stack.length-1];m4("link"===i.type),i.url="http://"+this.sliceSerialize(e)}function _g(e){this.config.exit.autolinkEmail.call(this,e)}function _v(e){this.exit(e)}function _y(e){!function(e,i,n){let r=yk((n||{}).ignore||[]),s=function(e){let i=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var s;let e=n[r];i.push(["string"==typeof(s=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(s),"g"):s,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return i}(i),o=-1;for(;++o<s.length;)yD(e,"text",a);function a(e,i){let n,a=-1;for(;++a<i.length;){let e=i[a],s=n?n.children:void 0;if(r(e,s?s.indexOf(e):void 0,n))return;n=e}if(n)return function(e,i){let n=i[i.length-1],r=s[o][0],a=s[o][1],l=0,c=n.children.indexOf(e),d=!1,h=[];r.lastIndex=0;let u=r.exec(e.value);for(;u;){let n=u.index,s={index:u.index,input:u.input,stack:[...i,e]},o=a(...u,s);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),!1===o?r.lastIndex=n+1:(l!==n&&h.push({type:"text",value:e.value.slice(l,n)}),Array.isArray(o)?h.push(...o):o&&h.push(o),l=n+u[0].length,d=!0),!r.global)break;u=r.exec(e.value)}return d?(l<e.value.length&&h.push({type:"text",value:e.value.slice(l)}),n.children.splice(c,1,...h)):h=[e],c+h.length}(e,i)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,__],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,_x]],{ignore:["link","linkReference"]})}function __(e,i,n,r,s){let o,a="";if(!_b(s))return!1;if(/^w/i.test(i)&&(n=i+n,i="",a="http://"),(o=n.split(".")).length<2||o[o.length-1]&&(/_/.test(o[o.length-1])||!/[a-zA-Z\d]/.test(o[o.length-1]))||o[o.length-2]&&(/_/.test(o[o.length-2])||!/[a-zA-Z\d]/.test(o[o.length-2])))return!1;let l=function(e){let i=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!i)return[e,void 0];e=e.slice(0,i.index);let n=i[0],r=n.indexOf(")"),s=_c(e,"("),o=_c(e,")");for(;-1!==r&&s>o;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),o++;return[e,n]}(n+r);if(!l[0])return!1;let c={type:"link",title:null,url:a+i+l[0],children:[{type:"text",value:i+l[0]}]};return l[1]?[c,{type:"text",value:l[1]}]:c}function _x(e,i,n,r){return!(!_b(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+i+"@"+n,children:[{type:"text",value:i+"@"+n}]}}function _b(e,i){let n=e.input.charCodeAt(e.index-1);return(0===e.index||vf(n)||vp(n))&&(!i||47!==n)}function _w(){this.buffer()}function _S(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function _k(){this.buffer()}function _C(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function _T(e){let i=this.resume(),n=this.stack[this.stack.length-1];m4("footnoteReference"===n.type),n.identifier=vJ(this.sliceSerialize(e)).toLowerCase(),n.label=i}function _E(e){this.exit(e)}function _D(e){let i=this.resume(),n=this.stack[this.stack.length-1];m4("footnoteDefinition"===n.type),n.identifier=vJ(this.sliceSerialize(e)).toLowerCase(),n.label=i}function _N(e){this.exit(e)}function _M(e,i,n,r){let s=n.createTracker(r),o=s.move("[^"),a=n.enter("footnoteReference"),l=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),l(),a(),o+=s.move("]")}function _O(e,i,n){return 0===i?e:_R(e,i,n)}function _R(e,i,n){return(n?"":" ")+e}_M.peek=function(){return"["};let _A=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function _L(e){this.enter({type:"delete",children:[]},e)}function _j(e){this.exit(e)}function _I(e,i,n,r){let s=n.createTracker(r),o=n.enter("strikethrough"),a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),o(),a}function _P(e){return e.length}function _B(e){let i="string"==typeof e?e.codePointAt(0):0;return 67===i||99===i?99:76===i||108===i?108:114*(82===i||114===i)}_I.peek=function(){return"~"};function _z(e,i,n){let r=e.value||"",s="`",o=-1;for(;RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){let e,i=n.unsafe[o],s=n.compilePattern(i);if(i.atBreak)for(;e=s.exec(r);){let i=e.index;10===r.charCodeAt(i)&&13===r.charCodeAt(i-1)&&i--,r=r.slice(0,i)+" "+r.slice(e.index+1)}}return s+r+s}_z.peek=function(){return"`"};yk(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let _F=function(e,i,n,r){let s=function(e){let i=e.options.listItemIndent||"one";if("tab"!==i&&"one"!==i&&"mixed"!==i)throw Error("Cannot serialize items with `"+i+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return i}(n),o=n.bulletCurrent||function(e){let i=e.options.bullet||"*";if("*"!==i&&"+"!==i&&"-"!==i)throw Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}(n);i&&"list"===i.type&&i.ordered&&(o=("number"==typeof i.start&&i.start>-1?i.start:1)+(!1===n.options.incrementListMarker?0:i.children.indexOf(e))+o);let a=o.length+1;("tab"===s||"mixed"===s&&(i&&"list"===i.type&&i.spread||e.spread))&&(a=4*Math.ceil(a/4));let l=n.createTracker(r);l.move(o+" ".repeat(a-o.length)),l.shift(a);let c=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,l.current()),function(e,i,n){return i?(n?"":" ".repeat(a))+e:(n?o:o+" ".repeat(a-o.length))+e});return c(),d};function _H(e){let i=e._align;m4(i,"expected `_align` on table"),this.enter({type:"table",align:i.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function _W(e){this.exit(e),this.data.inTable=void 0}function _$(e){this.enter({type:"tableRow",children:[]},e)}function _U(e){this.exit(e)}function _V(e){this.enter({type:"tableCell",children:[]},e)}function _q(e){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,_K));let n=this.stack[this.stack.length-1];m4("inlineCode"===n.type),n.value=i,this.exit(e)}function _K(e,i){return"|"===i?i:e}function _Y(e){let i=this.stack[this.stack.length-2];m4("listItem"===i.type),i.checked="taskListCheckValueChecked"===e.type}function _X(e){let i=this.stack[this.stack.length-2];if(i&&"listItem"===i.type&&"boolean"==typeof i.checked){let e=this.stack[this.stack.length-1];m4("paragraph"===e.type);let n=e.children[0];if(n&&"text"===n.type){let r,s=i.children,o=-1;for(;++o<s.length;){let e=s[o];if("paragraph"===e.type){r=e;break}}r===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function _J(e,i,n,r){let s=e.children[0],o="boolean"==typeof e.checked&&s&&"paragraph"===s.type,a="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);o&&l.move(a);let c=_F(e,i,n,{...r,...l.current()});return o&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+a})),c}let _G={tokenize:function(e,i,n){let r=0;return function i(o){return(87===o||119===o)&&r<3?(r++,e.consume(o),i):46===o&&3===r?(e.consume(o),s):n(o)};function s(e){return null===e?n(e):i(e)}},partial:!0},_Z={tokenize:function(e,i,n){let r,s,o;return a;function a(i){return 46===i||95===i?e.check(_0,c,l)(i):null===i||vh(i)||vf(i)||45!==i&&vp(i)?c(i):(o=!0,e.consume(i),a)}function l(i){return 95===i?r=!0:(s=r,r=void 0),e.consume(i),a}function c(e){return s||r||!o?n(e):i(e)}},partial:!0},_Q={tokenize:function(e,i){let n=0,r=0;return s;function s(a){return 40===a?(n++,e.consume(a),s):41===a&&r<n?o(a):33===a||34===a||38===a||39===a||41===a||42===a||44===a||46===a||58===a||59===a||60===a||63===a||93===a||95===a||126===a?e.check(_0,i,o)(a):null===a||vh(a)||vf(a)?i(a):(e.consume(a),s)}function o(i){return 41===i&&r++,e.consume(i),s}},partial:!0},_0={tokenize:function(e,i,n){return r;function r(a){return 33===a||34===a||39===a||41===a||42===a||44===a||46===a||58===a||59===a||63===a||95===a||126===a?(e.consume(a),r):38===a?(e.consume(a),o):93===a?(e.consume(a),s):60===a||null===a||vh(a)||vf(a)?i(a):n(a)}function s(e){return null===e||40===e||91===e||vh(e)||vf(e)?i(e):r(e)}function o(i){return vn(i)?function i(s){return 59===s?(e.consume(s),r):vn(s)?(e.consume(s),i):n(s)}(i):n(i)}},partial:!0},_1={tokenize:function(e,i,n){return function(i){return e.consume(i),r};function r(e){return vr(e)?n(e):i(e)}},partial:!0},_2={name:"wwwAutolink",tokenize:function(e,i,n){let r=this;return function(i){return 87!==i&&119!==i||!_8.call(r,r.previous)||xt(r.events)?n(i):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(_G,e.attempt(_Z,e.attempt(_Q,s),n),n)(i))};function s(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),i(n)}},previous:_8},_5={name:"protocolAutolink",tokenize:function(e,i,n){let r=this,s="",o=!1;return function(i){return(72===i||104===i)&&_9.call(r,r.previous)&&!xt(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(i),e.consume(i),a):n(i)};function a(i){if(vn(i)&&s.length<5)return s+=String.fromCodePoint(i),e.consume(i),a;if(58===i){let n=s.toLowerCase();if("http"===n||"https"===n)return e.consume(i),l}return n(i)}function l(i){return 47===i?(e.consume(i),o)?c:(o=!0,l):n(i)}function c(i){return null===i||vo(i)||vh(i)||vf(i)||vp(i)?n(i):e.attempt(_Z,e.attempt(_Q,d),n)(i)}function d(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),i(n)}},previous:_9},_3={name:"emailAutolink",tokenize:function(e,i,n){let r,s,o=this;return function(i){return!xe(i)||!_7.call(o,o.previous)||xt(o.events)?n(i):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function i(r){return xe(r)?(e.consume(r),i):64===r?(e.consume(r),a):n(r)}(i))};function a(i){return 46===i?e.check(_1,c,l)(i):45===i||95===i||vr(i)?(s=!0,e.consume(i),a):c(i)}function l(i){return e.consume(i),r=!0,a}function c(a){return s&&r&&vn(o.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),i(a)):n(a)}},previous:_7},_4={},_6=48;for(;_6<123;)_4[_6]=_3,58==++_6?_6=65:91===_6&&(_6=97);function _8(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||vh(e)}function _9(e){return!vn(e)}function _7(e){return!(47===e||xe(e))}function xe(e){return 43===e||45===e||46===e||95===e||vr(e)}function xt(e){let i=e.length,n=!1;for(;i--;){let r=e[i][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}_4[43]=_3,_4[45]=_3,_4[46]=_3,_4[95]=_3,_4[72]=[_3,_5],_4[104]=[_3,_5],_4[87]=[_3,_2],_4[119]=[_3,_2];let xi={tokenize:function(e,i,n){let r=this;return vg(e,function(e){let s=r.events[r.events.length-1];return s&&"gfmFootnoteDefinitionIndent"===s[1].type&&4===s[2].sliceSerialize(s[1],!0).length?i(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function xn(e,i,n){let r,s=this,o=s.events.length,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);for(;o--;){let e=s.events[o][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(o){if(!r||!r._balanced)return n(o);let l=vJ(s.sliceSerialize({start:r.end,end:s.now()}));return 94===l.codePointAt(0)&&a.includes(l.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(o),e.exit("gfmFootnoteCallLabelMarker"),i(o)):n(o)}}function xr(e,i){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;let o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},l=[e[n+1],e[n+2],["enter",r,i],e[n+3],e[n+4],["enter",s,i],["exit",s,i],["enter",o,i],["enter",a,i],["exit",a,i],["exit",o,i],e[e.length-2],e[e.length-1],["exit",r,i]];return e.splice(n,e.length-n+1,...l),e}function xs(e,i,n){let r,s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]),a=0;return function(i){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),l};function l(i){return 94!==i?n(i):(e.enter("gfmFootnoteCallMarker"),e.consume(i),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(l){if(a>999||93===l&&!r||null===l||91===l||vh(l))return n(l);if(93===l){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return o.includes(vJ(s.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),i):n(l)}return vh(l)||(r=!0),a++,e.consume(l),92===l?d:c}function d(i){return 91===i||92===i||93===i?(e.consume(i),a++,c):c(i)}}function xo(e,i,n){let r,s,o=this,a=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),l=0;return function(i){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(i),e.exit("gfmFootnoteDefinitionLabelMarker"),c};function c(i){return 94===i?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(i),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(i)}function d(i){if(l>999||93===i&&!s||null===i||91===i||vh(i))return n(i);if(93===i){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=vJ(o.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(i),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),u}return vh(i)||(s=!0),l++,e.consume(i),92===i?h:d}function h(i){return 91===i||92===i||93===i?(e.consume(i),l++,d):d(i)}function u(i){return 58===i?(e.enter("definitionMarker"),e.consume(i),e.exit("definitionMarker"),a.includes(r)||a.push(r),vg(e,p,"gfmFootnoteDefinitionWhitespace")):n(i)}function p(e){return i(e)}}function xa(e,i,n){return e.check(vx,i,e.attempt(xi,i,n))}function xl(e){e.exit("gfmFootnoteDefinition")}class xc{constructor(){this.map=[]}add(e,i,n){!function(e,i,n,r){let s=0;if(0!==n||0!==r.length){for(;s<e.map.length;){if(e.map[s][0]===i){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([i,n,r])}}(this,e,i,n)}consume(e){if(this.map.sort(function(e,i){return e[0]-i[0]}),0===this.map.length)return;let i=this.map.length,n=[];for(;i>0;)i-=1,n.push(e.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),e.length=this.map[i][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let i of r)e.push(i);r=n.pop()}this.map.length=0}}function xd(e,i,n){let r,s=this,o=0,a=0;return function(e){let i=s.events.length-1;for(;i>-1;){let e=s.events[i][1].type;if("lineEnding"===e||"linePrefix"===e)i--;else break}let r=i>-1?s.events[i][1].type:null,o="tableHead"===r||"tableRow"===r?_:l;return o===_&&s.parser.lazy[s.now().line]?n(e):o(e)};function l(i){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=i)||(r=!0,a+=1),c(n)}function c(i){return null===i?n(i):vd(i)?a>1?(a=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),u):n(i):vu(i)?vg(e,c,"whitespace")(i):(a+=1,r&&(r=!1,o+=1),124===i)?(e.enter("tableCellDivider"),e.consume(i),e.exit("tableCellDivider"),r=!0,c):(e.enter("data"),d(i))}function d(i){return null===i||124===i||vh(i)?(e.exit("data"),c(i)):(e.consume(i),92===i?h:d)}function h(i){return 92===i||124===i?(e.consume(i),d):d(i)}function u(i){return(s.interrupt=!1,s.parser.lazy[s.now().line])?n(i):(e.enter("tableDelimiterRow"),r=!1,vu(i))?vg(e,p,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):p(i)}function p(i){return 45===i||58===i?m(i):124===i?(r=!0,e.enter("tableCellDivider"),e.consume(i),e.exit("tableCellDivider"),f):n(i)}function f(i){return vu(i)?vg(e,m,"whitespace")(i):m(i)}function m(i){return 58===i?(a+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(i),e.exit("tableDelimiterMarker"),g):45===i?(a+=1,g(i)):null===i||vd(i)?y(i):n(i)}function g(i){return 45===i?(e.enter("tableDelimiterFiller"),function i(n){return 45===n?(e.consume(n),i):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(n))}(i)):n(i)}function v(i){return vu(i)?vg(e,y,"whitespace")(i):y(i)}function y(s){if(124===s)return p(s);if(null===s||vd(s))return r&&o===a?(e.exit("tableDelimiterRow"),e.exit("tableHead"),i(s)):n(s);return n(s)}function _(i){return e.enter("tableRow"),b(i)}function b(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),b):null===n||vd(n)?(e.exit("tableRow"),i(n)):vu(n)?vg(e,b,"whitespace")(n):(e.enter("data"),w(n))}function w(i){return null===i||124===i||vh(i)?(e.exit("data"),b(i)):(e.consume(i),92===i?S:w)}function S(i){return 92===i||124===i?(e.consume(i),w):w(i)}}function xh(e,i){let n,r,s,o=-1,a=!0,l=0,c=[0,0,0,0],d=[0,0,0,0],h=!1,u=0,p=new xc;for(;++o<e.length;){let f=e[o],m=f[1];"enter"===f[0]?"tableHead"===m.type?(h=!1,0!==u&&(xp(p,i,u,n,r),r=void 0,u=0),n={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(o,0,[["enter",n,i]])):"tableRow"===m.type||"tableDelimiterRow"===m.type?(a=!0,s=void 0,c=[0,0,0,0],d=[0,o+1,0,0],h&&(h=!1,r={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(o,0,[["enter",r,i]])),l="tableDelimiterRow"===m.type?2:r?3:1):l&&("data"===m.type||"tableDelimiterMarker"===m.type||"tableDelimiterFiller"===m.type)?(a=!1,0===d[2]&&(0!==c[1]&&(d[0]=d[1],s=xu(p,i,c,l,void 0,s),c=[0,0,0,0]),d[2]=o)):"tableCellDivider"===m.type&&(a?a=!1:(0!==c[1]&&(d[0]=d[1],s=xu(p,i,c,l,void 0,s)),d=[(c=d)[1],o,0,0])):"tableHead"===m.type?(h=!0,u=o):"tableRow"===m.type||"tableDelimiterRow"===m.type?(u=o,0!==c[1]?(d[0]=d[1],s=xu(p,i,c,l,o,s)):0!==d[1]&&(s=xu(p,i,d,l,o,s)),l=0):l&&("data"===m.type||"tableDelimiterMarker"===m.type||"tableDelimiterFiller"===m.type)&&(d[3]=o)}for(0!==u&&xp(p,i,u,n,r),p.consume(i.events),o=-1;++o<i.events.length;){let e=i.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,i){let n=!1,r=[];for(;i<e.length;){let s=e[i];if(n){if("enter"===s[0])"tableContent"===s[1].type&&r.push("tableDelimiterMarker"===e[i+1][1].type?"left":"none");else if("tableContent"===s[1].type){if("tableDelimiterMarker"===e[i-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===s[1].type)break}else"enter"===s[0]&&"tableDelimiterRow"===s[1].type&&(n=!0);i+=1}return r}(i.events,o))}return e}function xu(e,i,n,r,s,o){0!==n[0]&&(o.end=Object.assign({},xf(i.events,n[0])),e.add(n[0],0,[["exit",o,i]]));let a=xf(i.events,n[1]);if(o={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",o,i]]),0!==n[2]){let s=xf(i.events,n[2]),o=xf(i.events,n[3]),a={type:"tableContent",start:Object.assign({},s),end:Object.assign({},o)};if(e.add(n[2],0,[["enter",a,i]]),2!==r){let r=i.events[n[2]],s=i.events[n[3]];if(r[1].end=Object.assign({},s[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let i=n[2]+1,r=n[3]-n[2]-1;e.add(i,r,[])}}e.add(n[3]+1,0,[["exit",a,i]])}return void 0!==s&&(o.end=Object.assign({},xf(i.events,s)),e.add(s,0,[["exit",o,i]]),o=void 0),o}function xp(e,i,n,r,s){let o=[],a=xf(i.events,n);s&&(s.end=Object.assign({},a),o.push(["exit",s,i])),r.end=Object.assign({},a),o.push(["exit",r,i]),e.add(n+1,0,o)}function xf(e,i){let n=e[i],r="enter"===n[0]?"start":"end";return n[1][r]}let xm={name:"tasklistCheck",tokenize:function(e,i,n){let r=this;return function(i){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(i),e.exit("taskListCheckMarker"),s):n(i)};function s(i){return vh(i)?(e.enter("taskListCheckValueUnchecked"),e.consume(i),e.exit("taskListCheckValueUnchecked"),o):88===i||120===i?(e.enter("taskListCheckValueChecked"),e.consume(i),e.exit("taskListCheckValueChecked"),o):n(i)}function o(i){return 93===i?(e.enter("taskListCheckMarker"),e.consume(i),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(i)}function a(r){return vd(r)?i(r):vu(r)?e.check({tokenize:xg},i,n)(r):n(r)}}};function xg(e,i,n){return vg(e,function(e){return null===e?n(e):i(e)},"whitespace")}let xv={};function xy(e){let i,n,r,s=e||xv,o=this.data(),a=o.micromarkExtensions||(o.micromarkExtensions=[]),l=o.fromMarkdownExtensions||(o.fromMarkdownExtensions=[]),c=o.toMarkdownExtensions||(o.toMarkdownExtensions=[]);a.push(vi([{text:_4},{document:{91:{name:"gfmFootnoteDefinition",tokenize:xo,continuation:{tokenize:xa},exit:xl}},text:{91:{name:"gfmFootnoteCall",tokenize:xs},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:xn,resolveTo:xr}}},(i=(s||{}).singleTilde,n={name:"strikethrough",tokenize:function(e,n,r){let s=this.previous,o=this.events,a=0;return function(l){return 126===s&&"characterEscape"!==o[o.length-1][1].type?r(l):(e.enter("strikethroughSequenceTemporary"),function o(l){let c=vA(s);if(126===l)return a>1?r(l):(e.consume(l),a++,o);if(a<2&&!i)return r(l);let d=e.exit("strikethroughSequenceTemporary"),h=vA(l);return d._open=!h||2===h&&!!c,d._close=!c||2===c&&!!h,n(l)}(l))}},resolveAll:function(e,i){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let s={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},o={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a=[["enter",s,i],["enter",e[r][1],i],["exit",e[r][1],i],["enter",o,i]],l=i.parser.constructs.insideSpan.null;l&&g7(a,a.length,0,vL(l,e.slice(r+1,n),i)),g7(a,a.length,0,[["exit",o,i],["enter",e[n][1],i],["exit",e[n][1],i],["exit",s,i]]),g7(e,r-1,n-r+3,a),n=r+a.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==i&&(i=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:xd,resolveAll:xh}}},{text:{91:xm}}])),l.push([{transforms:[_y],enter:{literalAutolink:_u,literalAutolinkEmail:_p,literalAutolinkHttp:_p,literalAutolinkWww:_p},exit:{literalAutolink:_v,literalAutolinkEmail:_g,literalAutolinkHttp:_f,literalAutolinkWww:_m}},{enter:{gfmFootnoteCallString:_w,gfmFootnoteCall:_S,gfmFootnoteDefinitionLabelString:_k,gfmFootnoteDefinition:_C},exit:{gfmFootnoteCallString:_T,gfmFootnoteCall:_E,gfmFootnoteDefinitionLabelString:_D,gfmFootnoteDefinition:_N}},{canContainEols:["delete"],enter:{strikethrough:_L},exit:{strikethrough:_j}},{enter:{table:_H,tableData:_V,tableHeader:_V,tableRow:_$},exit:{codeText:_q,table:_W,tableData:_U,tableHeader:_U,tableRow:_U}},{exit:{taskListCheckValueChecked:_Y,taskListCheckValueUnchecked:_Y,paragraph:_X}}]),c.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:_d,notInConstruct:_h},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:_d,notInConstruct:_h},{character:":",before:"[ps]",after:"\\/",inConstruct:_d,notInConstruct:_h}]},(r=!1,s&&s.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:function(e,i,n,s){let o=n.createTracker(s),a=o.move("[^"),l=n.enter("footnoteDefinition"),c=n.enter("label");return a+=o.move(n.safe(n.associationId(e),{before:a,after:"]"})),c(),a+=o.move("]:"),e.children&&e.children.length>0&&(o.shift(4),a+=o.move((r?"\n":" ")+n.indentLines(n.containerFlow(e,o.current()),r?_R:_O))),l(),a},footnoteReference:_M},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_A}],handlers:{delete:_I}},function(e){let i=e||{},n=i.tableCellPadding,r=i.tablePipeAlign,s=i.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,i,n){let r=_z(e,i,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,i,n,r){return l(function(e,i,n){let r=e.children,s=-1,o=[],a=i.enter("table");for(;++s<r.length;)o[s]=c(r[s],i,n);return a(),o}(e,n,r),e.align)},tableCell:a,tableRow:function(e,i,n,r){let s=l([c(e,n,r)]);return s.slice(0,s.indexOf("\n"))}}};function a(e,i,n,r){let s=n.enter("tableCell"),a=n.enter("phrasing"),l=n.containerPhrasing(e,{...r,before:o,after:o});return a(),s(),l}function l(e,i){return function(e,i){let n=i||{},r=(n.align||[]).concat(),s=n.stringLength||_P,o=[],a=[],l=[],c=[],d=0,h=-1;for(;++h<e.length;){let i=[],r=[],o=-1;for(e[h].length>d&&(d=e[h].length);++o<e[h].length;){var u;let a=null==(u=e[h][o])?"":String(u);if(!1!==n.alignDelimiters){let e=s(a);r[o]=e,(void 0===c[o]||e>c[o])&&(c[o]=e)}i.push(a)}a[h]=i,l[h]=r}let p=-1;if("object"==typeof r&&"length"in r)for(;++p<d;)o[p]=_B(r[p]);else{let e=_B(r);for(;++p<d;)o[p]=e}p=-1;let f=[],m=[];for(;++p<d;){let e=o[p],i="",r="";99===e?(i=":",r=":"):108===e?i=":":114===e&&(r=":");let s=!1===n.alignDelimiters?1:Math.max(1,c[p]-i.length-r.length),a=i+"-".repeat(s)+r;!1!==n.alignDelimiters&&((s=i.length+s+r.length)>c[p]&&(c[p]=s),m[p]=s),f[p]=a}a.splice(1,0,f),l.splice(1,0,m),h=-1;let g=[];for(;++h<a.length;){let e=a[h],i=l[h];p=-1;let r=[];for(;++p<d;){let s=e[p]||"",a="",l="";if(!1!==n.alignDelimiters){let e=c[p]-(i[p]||0),n=o[p];114===n?a=" ".repeat(e):99===n?e%2?(a=" ".repeat(e/2+.5),l=" ".repeat(e/2-.5)):l=a=" ".repeat(e/2):l=" ".repeat(e)}!1===n.delimiterStart||p||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==s)&&(!1!==n.delimiterStart||p)&&r.push(" "),!1!==n.alignDelimiters&&r.push(a),r.push(s),!1!==n.alignDelimiters&&r.push(l),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||p!==d-1)&&r.push("|")}g.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return g.join("\n")}(e,{align:i,alignDelimiters:r,padding:n,stringLength:s})}function c(e,i,n){let r=e.children,s=-1,o=[],l=i.enter("tableRow");for(;++s<r.length;)o[s]=a(r[s],e,i,n);return l(),o}}(s),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:_J}}]})}let x_={pre:({children:e})=>(0,iM.jsx)("pre",{className:"bg-background/50 rounded-md p-3 overflow-x-auto text-xs my-2",children:e}),code:({className:e,children:i,...n})=>e?(0,iM.jsx)("code",{className:e,...n,children:i}):(0,iM.jsx)("code",{className:"bg-background/50 px-1 py-0.5 rounded text-xs font-mono",...n,children:i}),p:({children:e})=>(0,iM.jsx)("p",{className:"mb-2 last:mb-0",children:e}),ul:({children:e})=>(0,iM.jsx)("ul",{className:"list-disc pl-4 mb-2 space-y-1",children:e}),ol:({children:e})=>(0,iM.jsx)("ol",{className:"list-decimal pl-4 mb-2 space-y-1",children:e}),li:({children:e})=>(0,iM.jsx)("li",{className:"text-sm",children:e}),h1:({children:e})=>(0,iM.jsx)("h1",{className:"text-lg font-bold mb-2",children:e}),h2:({children:e})=>(0,iM.jsx)("h2",{className:"text-base font-bold mb-2",children:e}),h3:({children:e})=>(0,iM.jsx)("h3",{className:"text-sm font-bold mb-1",children:e}),blockquote:({children:e})=>(0,iM.jsx)("blockquote",{className:"border-l-2 border-muted-foreground/30 pl-3 my-2 text-muted-foreground",children:e}),a:({href:e,children:i})=>(0,iM.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:no-underline",children:i}),table:({children:e})=>(0,iM.jsx)("div",{className:"overflow-x-auto my-2",children:(0,iM.jsx)("table",{className:"text-xs border-collapse",children:e})}),th:({children:e})=>(0,iM.jsx)("th",{className:"border border-muted px-2 py-1 bg-muted/50 font-semibold text-left",children:e}),td:({children:e})=>(0,iM.jsx)("td",{className:"border border-muted px-2 py-1",children:e})};function xx({content:e}){return(0,iM.jsx)(_a,{remarkPlugins:[xy],components:x_,children:e})}let xb=({size:e=16})=>(0,iM.jsxs)("svg",{height:e,strokeLinejoin:"round",style:{color:"currentcolor"},viewBox:"0 0 16 16",width:e,children:[(0,iM.jsx)("title",{children:"Loader"}),(0,iM.jsxs)("g",{clipPath:"url(#clip0_2393_1490)",children:[(0,iM.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,iM.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,iM.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,iM.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,iM.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,iM.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,iM.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,iM.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,iM.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,iM.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),(0,iM.jsx)("defs",{children:(0,iM.jsx)("clipPath",{id:"clip0_2393_1490",children:(0,iM.jsx)("rect",{fill:"white",height:"16",width:"16"})})})]}),xw=({className:e,size:i=16,...n})=>(0,iM.jsx)("div",{className:(0,n1.cn)("inline-flex animate-spin items-center justify-center",e),...n,children:(0,iM.jsx)(xb,{size:i})});var xS=e.i(368942),xk=e.i(304271),xC=e.i(564822);function xT({oldContent:e,newContent:i,path:n}){let r,s=(r=n.split(".").pop()?.toLowerCase())?({ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",md:"markdown",css:"css",html:"html",py:"python",rs:"rust",go:"go",yaml:"yaml",yml:"yaml"})[r]:void 0,o=(0,iO.useRef)(null),{resolvedTheme:a}=(0,s0.useTheme)(),l=(0,xC.useIsMobile)();return(0,iO.useEffect)(()=>()=>{let e=o.current;e&&(e.setModel(null),o.current=null)},[]),(0,iM.jsxs)("div",{className:"h-full w-full flex flex-col",children:[(0,iM.jsx)("div",{className:"text-xs text-muted-foreground px-2 py-1 border-b bg-muted/30 font-mono truncate",children:n}),(0,iM.jsx)("div",{className:"flex-1",children:(0,iM.jsx)(xk.DiffEditor,{original:e,modified:i,language:s,theme:"dark"===a?"vs-dark":"vs",onMount:e=>{o.current=e},options:{readOnly:!0,renderSideBySide:!l,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:"on"}})})]})}var xE=e.i(946899),xE=xE;e.s([],352264),e.i(352264);let xD=iO.createContext(void 0);function xN(){let e=iO.useContext(xD);if(void 0===e)throw Error((0,rT.default)(10));return e}let xM={value:()=>null},xO=iO.forwardRef(function(e,i){let{render:n,className:r,disabled:s=!1,hiddenUntilFound:o,keepMounted:a,loopFocus:l=!0,onValueChange:c,multiple:d=!1,orientation:h="vertical",value:u,defaultValue:p,style:f,...m}=e,g=(0,st.useDirection)(),v=iO.useMemo(()=>{if(void 0===u)return p??[]},[u,p]),y=(0,rS.useStableCallback)(c),_=iO.useRef([]),[b,w]=(0,rb.useControlled)({controlled:u,default:v,name:"Accordion",state:"value"}),S=(0,rS.useStableCallback)((e,i)=>{let n=(0,rF.createChangeEventDetails)(rH.REASONS.none);if(d)if(i){let i=b.slice();if(i.push(e),y(i,n),n.isCanceled)return;w(i)}else{let i=b.filter(i=>i!==e);if(y(i,n),n.isCanceled)return;w(i)}else{let i=b[0]===e?[]:[e];if(y(i,n),n.isCanceled)return;w(i)}}),k=iO.useMemo(()=>({value:b,disabled:s,orientation:h}),[b,s,h]),C=iO.useMemo(()=>({accordionItemRefs:_,direction:g,disabled:s,handleValueChange:S,hiddenUntilFound:o??!1,keepMounted:a??!1,loopFocus:l,orientation:h,state:k,value:b}),[g,s,S,o,a,l,h,k,b]),T=(0,rk.useRenderElement)("div",e,{state:k,ref:i,props:[{dir:g,role:"region"},m],stateAttributesMapping:xM});return(0,iM.jsx)(xD.Provider,{value:C,children:(0,iM.jsx)(rC.CompositeList,{elementsRef:_,children:T})})});var xR=e.i(257295),xA=e.i(619279);let xL=iO.createContext(void 0);function xj(){let e=iO.useContext(xL);if(void 0===e)throw Error((0,rT.default)(9));return e}var xI=e.i(439485);let xP=((IQ={}).index="data-index",IQ.disabled="data-disabled",IQ.open="data-open",IQ),xB={...xI.collapsibleOpenStateMapping,index:e=>Number.isInteger(e)?{[xP.index]:String(e)}:null,...rG.transitionStatusMapping,value:()=>null},xz=iO.forwardRef(function(e,i){let{className:n,disabled:r=!1,onOpenChange:s,render:o,value:a,style:l,...c}=e,{ref:d,index:h}=(0,r0.useCompositeListItem)(),u=(0,r6.useMergedRefs)(i,d),{disabled:p,handleValueChange:f,state:m,value:g}=xN(),v=(0,rL.useBaseUiId)(),y=a??v,_=r||p,b=iO.useMemo(()=>{if(!g)return!1;for(let e=0;e<g.length;e+=1)if(g[e]===y)return!0;return!1},[g,y]),w=(0,rS.useStableCallback)((e,i)=>{s?.(e,i),i.isCanceled||f(y,e)}),S=(0,xR.useCollapsibleRoot)({open:b,onOpenChange:w,disabled:_}),k=iO.useMemo(()=>({open:S.open,disabled:S.disabled,hidden:!S.mounted,transitionStatus:S.transitionStatus}),[S.open,S.disabled,S.mounted,S.transitionStatus]),C=iO.useMemo(()=>({...S,onOpenChange:w,state:k}),[S,k,w]),T=iO.useMemo(()=>({...m,index:h,disabled:_,open:b}),[_,h,b,m]),[E,D]=iO.useState((0,rL.useBaseUiId)()),N=iO.useMemo(()=>({open:b,state:T,setTriggerId:D,triggerId:E}),[b,T,D,E]),M=(0,rk.useRenderElement)("div",e,{state:T,ref:u,props:c,stateAttributesMapping:xB});return(0,iM.jsx)(xA.CollapsibleRootContext.Provider,{value:C,children:(0,iM.jsx)(xL.Provider,{value:N,children:M})})}),xF=iO.forwardRef(function(e,i){let{render:n,className:r,style:s,...o}=e,{state:a}=xj();return(0,rk.useRenderElement)("h3",e,{state:a,ref:i,props:o,stateAttributesMapping:xB})}),xH=new Set([r8.ARROW_DOWN,r8.ARROW_UP,r8.ARROW_RIGHT,r8.ARROW_LEFT,r8.HOME,r8.END]),xW=iO.forwardRef(function(e,i){let{disabled:n,className:r,id:s,render:o,nativeButton:a=!0,style:l,...c}=e,{panelId:d,open:h,handleTrigger:u,disabled:p}=(0,xA.useCollapsibleRootContext)(),{getButtonProps:f,buttonRef:m}=(0,rj.useButton)({disabled:n??p,focusableWhenDisabled:!0,native:a,composite:!0}),{accordionItemRefs:g,direction:v,loopFocus:y,orientation:_}=xN(),b="rtl"===v,w="horizontal"===_,{state:S,setTriggerId:k,triggerId:C}=xj();(0,rw.useIsoLayoutEffect)(()=>(s&&k(s),()=>{k(void 0)}),[s,k]);let T=iO.useMemo(()=>({"aria-controls":h?d:void 0,"aria-expanded":h,id:C,tabIndex:0,onClick:u,onKeyDown(e){if(!xH.has(e.key))return;(0,sk.stopEvent)(e);let i=function(e){let{current:i}=e,n=[];for(let e=0;e<i.length;e+=1){let r=i[e];if(!r4(r)){let e=r?.querySelector('[type="button"], [role="button"]');e&&!r4(e)&&n.push(e)}}return n}(g),n=i.length-1,r=-1,s=i.indexOf(e.currentTarget);function o(){r=y?s+1>n?0:s+1:Math.min(s+1,n)}function a(){r=y&&0===s?n:s-1}switch(e.key){case r8.ARROW_DOWN:w||o();break;case r8.ARROW_UP:w||a();break;case r8.ARROW_RIGHT:w&&(b?a():o());break;case r8.ARROW_LEFT:w&&(b?o():a());break;case"Home":r=0;break;case"End":r=n}r>-1&&i[r].focus()}}),[g,u,C,w,b,y,h,d]);return(0,rk.useRenderElement)("button",e,{state:S,ref:[i,m],props:[T,c,f],stateAttributesMapping:xI.triggerOpenStateMapping})});var x$=e.i(18158);let xU=((I0={}).accordionPanelHeight="--accordion-panel-height",I0.accordionPanelWidth="--accordion-panel-width",I0),xV=iO.forwardRef(function(e,i){let{className:n,hiddenUntilFound:r,keepMounted:s,id:o,render:a,style:l,...c}=e,{hiddenUntilFound:d,keepMounted:h}=xN(),{abortControllerRef:u,animationTypeRef:p,height:f,mounted:m,onOpenChange:g,open:v,panelId:y,panelRef:_,runOnceAnimationsFinish:b,setDimensions:w,setHiddenUntilFound:S,setKeepMounted:k,setMounted:C,setOpen:T,setVisible:E,transitionDimensionRef:D,visible:N,width:M,setPanelIdState:O,transitionStatus:R}=(0,xA.useCollapsibleRootContext)(),A=r??d,L=s??h;(0,rw.useIsoLayoutEffect)(()=>{if(o)return O(o),()=>{O(void 0)}},[o,O]),(0,rw.useIsoLayoutEffect)(()=>{S(A)},[S,A]),(0,rw.useIsoLayoutEffect)(()=>{k(L)},[k,L]),(0,rZ.useOpenChangeComplete)({open:v&&"idle"===R,ref:_,onComplete(){v&&w({width:void 0,height:void 0})}});let{props:j}=(0,x$.useCollapsiblePanel)({abortControllerRef:u,animationTypeRef:p,externalRef:i,height:f,hiddenUntilFound:A,id:o??y,keepMounted:L,mounted:m,onOpenChange:g,open:v,panelRef:_,runOnceAnimationsFinish:b,setDimensions:w,setMounted:C,setOpen:T,setVisible:E,transitionDimensionRef:D,visible:N,width:M}),{state:I,triggerId:P}=xj(),B=iO.useMemo(()=>({...I,transitionStatus:R}),[I,R]),z=(0,rk.useRenderElement)("div",e,{state:B,ref:[i,_],props:[j,{"aria-labelledby":P,role:"region",style:{[xU.accordionPanelHeight]:void 0===f?"auto":`${f}px`,[xU.accordionPanelWidth]:void 0===M?"auto":`${M}px`}},c],stateAttributesMapping:xB});return L||A||m?z:null});e.s(["Header",0,xF,"Item",0,xz,"Panel",0,xV,"Root",0,xO,"Trigger",0,xW],127284);var xq=e.i(127284),xq=xq,xK=e.i(380797),xK=xK;function xY({className:e,...i}){return(0,iM.jsx)(xq.Root,{"data-slot":"accordion",className:(0,n1.cn)("flex w-full flex-col",e),...i})}function xX({className:e,...i}){return(0,iM.jsx)(xq.Item,{"data-slot":"accordion-item",className:(0,n1.cn)("not-last:border-b",e),...i})}function xJ({className:e,children:i,...n}){return(0,iM.jsx)(xq.Header,{className:"flex",children:(0,iM.jsxs)(xq.Trigger,{"data-slot":"accordion-trigger",className:(0,n1.cn)("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",e),...n,children:[i,(0,iM.jsx)(mQ.ChevronDownIcon,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),(0,iM.jsx)(xK.default,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function xG({className:e,children:i,...n}){return(0,iM.jsx)(xq.Panel,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...n,children:(0,iM.jsx)("div",{className:(0,n1.cn)("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:i})})}let xZ=(0,iO.memo)(({className:e,...i})=>(0,iM.jsx)("div",{className:(0,n1.cn)("not-prose w-full rounded-md border",e),...i})),xQ=(0,iO.memo)(({className:e,name:i,model:n,...r})=>(0,iM.jsx)("div",{className:(0,n1.cn)("flex w-full items-center justify-between gap-4 p-3",e),...r,children:(0,iM.jsxs)("div",{className:"flex items-center gap-2",children:[(0,iM.jsx)(xE.default,{className:"size-4 text-muted-foreground"}),(0,iM.jsx)("span",{className:"font-medium text-sm",children:i}),n&&(0,iM.jsx)(mj.Badge,{className:"font-mono text-xs",variant:"secondary",children:n})]})})),x0=(0,iO.memo)(({className:e,...i})=>(0,iM.jsx)("div",{className:(0,n1.cn)("space-y-4 p-4 pt-0",e),...i})),x1=(0,iO.memo)(({className:e,children:i,...n})=>{let r=(0,n2.useTranslations)("chat");return(0,iM.jsxs)("div",{className:(0,n1.cn)("space-y-2",e),...n,children:[(0,iM.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:r("subagent.instructions")}),(0,iM.jsx)("div",{className:"rounded-md bg-muted/50 p-3 text-muted-foreground text-sm",children:(0,iM.jsx)("p",{children:i})})]})}),x2=(0,iO.memo)(({className:e,...i})=>{let n=(0,n2.useTranslations)("chat");return(0,iM.jsxs)("div",{className:(0,n1.cn)("space-y-2",e),children:[(0,iM.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:n("subagent.tools")}),(0,iM.jsx)(xY,{className:"rounded-md border",multiple:!0,...i})]})}),x5=(0,iO.memo)(({className:e,tool:i,value:n,...r})=>{let s="jsonSchema"in i&&i.jsonSchema?i.jsonSchema:i.inputSchema,o=(0,n2.useTranslations)("chat");return(0,iM.jsxs)(xX,{className:(0,n1.cn)("border-b last:border-b-0",e),value:n,...r,children:[(0,iM.jsx)(xJ,{className:"px-3 py-2 text-sm hover:no-underline",children:i.description??o("subagent.noDescription")}),(0,iM.jsx)(xG,{className:"px-3 pb-3",children:(0,iM.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,iM.jsx)("pre",{className:"overflow-auto p-3 font-mono text-xs",children:JSON.stringify(s,null,2)})})})]})}),x3=(0,iO.memo)(({className:e,schema:i,...n})=>{let r=(0,n2.useTranslations)("chat");return(0,iM.jsxs)("div",{className:(0,n1.cn)("space-y-2",e),...n,children:[(0,iM.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:r("subagent.outputSchema")}),(0,iM.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,iM.jsx)("pre",{className:"overflow-auto p-3 font-mono text-xs",children:i})})]})});xZ.displayName="Agent",xQ.displayName="AgentHeader",x0.displayName="AgentContent",x1.displayName="AgentInstructions",x2.displayName="AgentTools",x5.displayName="AgentTool",x3.displayName="AgentOutput";var m2=m2,x4=e.i(551157),x4=x4;let x6=(0,nP.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),x8=(0,nP.default)("music-2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]),x9=(0,nP.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),x7=(0,nP.default)("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);var be=e.i(422373);e.s([],339090),e.i(339090);var bt=e.i(166392),bi=e.i(538501),bn=e.i(427396),br=e.i(389124);let bs=iO.createContext(void 0);function bo(e){let i=iO.useContext(bs);if(void 0===i&&!e)throw Error((0,rT.default)(50));return i}var ba=e.i(332976),bl=e.i(493696),bc=e.i(549154),bd=e.i(695011),bh=e.i(561213),bu=e.i(107164);let bp={...bd.popupStoreSelectors,instantType:(0,ba.createSelector)(e=>e.instantType),hasViewport:(0,ba.createSelector)(e=>e.hasViewport)};class bf extends bl.ReactStore{constructor(e){super({...(0,bd.createInitialPopupStoreState)(),instantType:void 0,hasViewport:!1,...e},{popupRef:iO.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new bh.PopupTriggerMap,closeDelayRef:{current:300}},bp)}setOpen=(e,i)=>{let n=i.reason,r=n===rH.REASONS.triggerHover,s=e&&n===rH.REASONS.triggerFocus,o=!e&&(n===rH.REASONS.triggerPress||n===rH.REASONS.escapeKey);if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,i),i.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,i);let a=()=>{let r={open:e};s?r.instantType="focus":o?r.instantType="dismiss":n===rH.REASONS.triggerHover&&(r.instantType=void 0);let a=i.trigger?.id??null;(a||e)&&(r.activeTriggerId=a,r.activeTriggerElement=i.trigger??null),this.update(r)};r?iL.flushSync(a):a()};static useStore(e,i){let n=(0,bc.useRefWithInit)(()=>new bf(i)).current,r=e??n,s=(0,bu.useSyncedFloatingRootContext)({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=s,r}}var bm=e.i(279501);function bg(e){let{open:i,defaultOpen:n=!1,onOpenChange:r,onOpenChangeComplete:s,actionsRef:o,handle:a,triggerId:l,defaultTriggerId:c=null,children:d}=e,h=bf.useStore(a?.store,{open:n,openProp:i,activeTriggerId:c,triggerIdProp:l});(0,bt.useOnFirstRender)(()=>{void 0===i&&!1===h.state.open&&!0===n&&h.update({open:!0,activeTriggerId:c})}),h.useControlledProp("openProp",i),h.useControlledProp("triggerIdProp",l),h.useContextCallback("onOpenChange",r),h.useContextCallback("onOpenChangeComplete",s);let u=h.useState("open"),p=h.select("floatingRootContext"),f=h.useState("activeTriggerId"),m=h.useState("payload");(0,bm.useImplicitActiveTrigger)(h);let{forceUnmount:g}=(0,bm.useOpenStateTransitions)(u,h);(0,rw.useIsoLayoutEffect)(()=>{u&&null==f&&h.set("payload",void 0)},[h,f,u]);let v=iO.useCallback(()=>{h.setOpen(!1,(0,rF.createChangeEventDetails)(rH.REASONS.imperativeAction))},[h]);iO.useImperativeHandle(o,()=>({unmount:g,close:v}),[g,v]);let y=(0,bi.useDismiss)(p),{getReferenceProps:_,getTriggerProps:b,getFloatingProps:w}=(0,bn.useInteractions)([y]),S=iO.useMemo(()=>_(),[_]),k=iO.useMemo(()=>b(),[b]),C=iO.useMemo(()=>w(),[w]);return h.useSyncedValues({activeTriggerProps:S,inactiveTriggerProps:k,popupProps:C}),(0,iM.jsx)(bs.Provider,{value:h,children:"function"==typeof d?d({payload:m}):d})}let bv=iO.createContext(void 0);var by=e.i(384389);let b_=iO.forwardRef(function(e,i){let{keepMounted:n=!1,...r}=e;return bo().useState("mounted")||n?(0,iM.jsx)(bv.Provider,{value:n,children:(0,iM.jsx)(by.FloatingPortalLite,{ref:i,...r})}):null});var bx=e.i(499198),bb=e.i(604921),bw=e.i(480283);let bS=iO.forwardRef(function(e,i){let{render:n,className:r,delay:s,closeDelay:o,id:a,payload:l,handle:c,style:d,...h}=e,u=bo(!0),p=c?.store??u;if(!p)throw Error((0,rT.default)(89));let f=(0,rL.useBaseUiId)(a),m=p.useState("isTriggerActive",f),g=p.useState("isOpenedByTrigger",f),v=p.useState("floatingRootContext"),y=iO.useRef(null),_=s??600,b=o??300,{registerTrigger:w,isMountedByThisTrigger:S}=(0,bm.useTriggerDataForwarding)(f,y,p,{payload:l});(0,rw.useIsoLayoutEffect)(()=>{S&&(p.context.closeDelayRef.current=b)},[p,S,b]);let k=(0,bw.useHoverReferenceInteraction)(v,{mouseOnly:!0,move:!1,handleClose:(0,bx.safePolygon)(),delay:()=>({open:_,close:b}),triggerElementRef:y,isActiveTrigger:m,isClosing:()=>"ending"===p.select("transitionStatus")}),C=(0,bb.useFocus)(v,{delay:_}),T=p.useState("triggerProps",S);return(0,rk.useRenderElement)("a",e,{state:{open:g},ref:[i,w,y],props:[k,C.reference,T,{id:f},h],stateAttributesMapping:sC.triggerOpenStateMapping})}),bk=iO.createContext(void 0);function bC(){let e=iO.useContext(bk);if(void 0===e)throw Error((0,rT.default)(49));return e}var bT=e.i(576557),bE=e.i(576487),bD=e.i(909852),bN=e.i(263635);let bM=iO.forwardRef(function(e,i){let{render:n,className:r,anchor:s,positionMethod:o="absolute",side:a="bottom",align:l="center",sideOffset:c=0,alignOffset:d=0,collisionBoundary:h="clipping-ancestors",collisionPadding:u=5,arrowPadding:p=5,sticky:f=!1,disableAnchorTracking:m=!1,collisionAvoidance:g=bE.POPUP_COLLISION_AVOIDANCE,style:v,...y}=e,_=bo(),b=function(){let e=iO.useContext(bv);if(void 0===e)throw Error((0,rT.default)(48));return e}(),w=(0,br.useFloatingNodeId)(),S=_.useState("open"),k=_.useState("mounted"),C=_.useState("floatingRootContext"),T=_.useState("instantType"),E=_.useState("transitionStatus"),D=_.useState("hasViewport"),N=(0,bT.useAnchorPositioning)({anchor:s,floatingRootContext:C,positionMethod:o,mounted:k,side:a,sideOffset:c,align:l,alignOffset:d,arrowPadding:p,collisionBoundary:h,collisionPadding:u,sticky:f,disableAnchorTracking:m,keepMounted:b,nodeId:w,collisionAvoidance:g,adaptiveOrigin:D?bD.adaptiveOrigin:void 0}),M={open:S,side:N.side,align:N.align,anchorHidden:N.anchorHidden,instant:T},O=(0,bN.usePositioner)(e,M,{styles:N.positionerStyles,transitionStatus:E,props:y,refs:[i,_.useStateSetter("positionerElement")],hidden:!k,inert:!S});return(0,iM.jsx)(bk.Provider,{value:N,children:(0,iM.jsx)(br.FloatingNode,{id:w,children:O})})});var bO=e.i(328657),bR=e.i(795914);let bA={...sC.popupStateMapping,...rG.transitionStatusMapping},bL=iO.forwardRef(function(e,i){let{className:n,render:r,style:s,...o}=e,a=bo(),{side:l,align:c}=bC(),d=a.useState("open"),h=a.useState("instantType"),u=a.useState("transitionStatus"),p=a.useState("popupProps"),f=a.useState("floatingRootContext");(0,rZ.useOpenChangeComplete)({open:d,ref:a.context.popupRef,onComplete(){d&&a.context.onOpenChangeComplete?.(!0)}});let m=(0,rS.useStableCallback)(()=>a.context.closeDelayRef.current);return(0,bR.useHoverFloatingInteraction)(f,{closeDelay:m}),(0,rk.useRenderElement)("div",e,{state:{open:d,side:l,align:c,instant:h,transitionStatus:u},ref:[i,a.context.popupRef,a.useStateSetter("popupElement")],props:[p,(0,bO.getDisabledMountTransitionStyles)(u),o],stateAttributesMapping:bA})}),bj=iO.forwardRef(function(e,i){let{render:n,className:r,style:s,...o}=e,a=bo(),{arrowRef:l,side:c,align:d,arrowUncentered:h,arrowStyles:u}=bC(),p=a.useState("open");return(0,rk.useRenderElement)("div",e,{state:{open:p,side:c,align:d,uncentered:h},ref:[l,i],props:[{style:u,"aria-hidden":!0},o],stateAttributesMapping:sC.popupStateMapping})}),bI={...sC.popupStateMapping,...rG.transitionStatusMapping},bP=iO.forwardRef(function(e,i){let{render:n,className:r,style:s,...o}=e,a=bo(),l=a.useState("open"),c=a.useState("mounted"),d=a.useState("transitionStatus");return(0,rk.useRenderElement)("div",e,{state:{open:l,transitionStatus:d},ref:[i],props:[{role:"presentation",hidden:!c,style:{pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none"}},o],stateAttributesMapping:bI})}),bB=((I1={}).popupWidth="--popup-width",I1.popupHeight="--popup-height",I1);var bz=e.i(3310);let bF={activationDirection:e=>e?{"data-activation-direction":e}:null},bH=iO.forwardRef(function(e,i){let{render:n,className:r,style:s,children:o,...a}=e,l=bo(),c=bC(),d=l.useState("instantType"),{children:h,state:u}=(0,bz.usePopupViewport)({store:l,side:c.side,cssVars:bB,children:o}),p={activationDirection:u.activationDirection,transitioning:u.transitioning,instant:d};return(0,rk.useRenderElement)("div",e,{state:p,ref:i,props:[a,{children:h}],stateAttributesMapping:bF})});class bW{constructor(){this.store=new bf}open(e){let i=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!i)throw Error((0,rT.default)(88,e));this.store.setOpen(!0,(0,rF.createChangeEventDetails)(rH.REASONS.imperativeAction,void 0,i))}close(){this.store.setOpen(!1,(0,rF.createChangeEventDetails)(rH.REASONS.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Arrow",0,bj,"Backdrop",0,bP,"Handle",0,bW,"Popup",0,bL,"Portal",0,b_,"Positioner",0,bM,"Root",0,function(e){return bo(!0)?(0,iM.jsx)(bg,{...e}):(0,iM.jsx)(br.FloatingTree,{children:(0,iM.jsx)(bg,{...e})})},"Trigger",0,bS,"Viewport",0,bH,"createHandle",0,function(){return new bW}],981923);var b$=e.i(981923),b$=b$;function bU({openDelay:e,closeDelay:i,...n}){return(0,iM.jsx)(b$.Root,{"data-slot":"hover-card",...n})}function bV({delay:e=0,closeDelay:i=0,...n}){return(0,iM.jsx)(b$.Trigger,{"data-slot":"hover-card-trigger",delay:e,closeDelay:i,...n})}function bq({className:e,side:i="bottom",sideOffset:n=6,align:r="center",alignOffset:s=0,children:o,...a}){return(0,iM.jsx)(b$.Portal,{children:(0,iM.jsx)(b$.Positioner,{align:r,alignOffset:s,side:i,sideOffset:n,className:"isolate z-50",children:(0,iM.jsx)(b$.Popup,{"data-slot":"hover-card-content",className:(0,n1.cn)("z-50 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...a,children:o})})})}let bK=e=>{if("source-document"===e.type)return"source";let i=e.mediaType??"";return i.startsWith("image/")?"image":i.startsWith("video/")?"video":i.startsWith("audio/")?"audio":i.startsWith("application/")||i.startsWith("text/")?"document":"unknown"},bY=(0,iO.createContext)(null),bX=(0,iO.createContext)(null),bJ=()=>{let e=(0,iO.useContext)(bX);if(!e)throw Error("Attachment components must be used within <Attachment>");return e},bG=({variant:e="grid",className:i,children:n,...r})=>{let s=(0,iO.useMemo)(()=>({variant:e}),[e]);return(0,iM.jsx)(bY.Provider,{value:s,children:(0,iM.jsx)("div",{className:(0,n1.cn)("flex items-start","list"===e?"flex-col gap-2":"flex-wrap gap-2","grid"===e&&"ml-auto w-fit",i),...r,children:n})})},bZ=({data:e,onRemove:i,className:n,children:r,...s})=>{let{variant:o}=(0,iO.useContext)(bY)??{variant:"grid"},a=bK(e),l=(0,iO.useMemo)(()=>({data:e,mediaCategory:a,onRemove:i,variant:o}),[e,a,i,o]);return(0,iM.jsx)(bX.Provider,{value:l,children:(0,iM.jsx)("div",{className:(0,n1.cn)("group relative","grid"===o&&"size-24 overflow-hidden rounded-lg","inline"===o&&["flex h-8 cursor-pointer select-none items-center gap-1.5","rounded-md border border-border px-1.5","font-medium text-sm transition-all","hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"],"list"===o&&["flex w-full items-center gap-3 rounded-lg border p-3","hover:bg-accent/50"],n),...s,children:r})})},bQ=({fallbackIcon:e,className:i,...n})=>{let{data:r,mediaCategory:s,variant:o}=bJ(),a="inline"===o?"size-3":"size-4";return(0,iM.jsx)("div",{className:(0,n1.cn)("flex shrink-0 items-center justify-center overflow-hidden","grid"===o&&"size-full bg-muted","inline"===o&&"size-5 rounded bg-background","list"===o&&"size-12 rounded bg-muted",i),...n,children:(()=>{if("image"===s&&"file"===r.type&&r.url){let e,i;return e=r.url,i=r.filename,"grid"===o?(0,iM.jsx)("img",{alt:i||"Image",className:"size-full object-cover",height:96,src:e,width:96}):(0,iM.jsx)("img",{alt:i||"Image",className:"size-full rounded object-cover",height:20,src:e,width:20})}if("video"===s&&"file"===r.type&&r.url)return(0,iM.jsx)("video",{className:"size-full object-cover",muted:!0,src:r.url});let i={image:x6,video:x7,audio:x8,source:x4.default,document:m2.default,unknown:x9}[s];return e??(0,iM.jsx)(i,{className:(0,n1.cn)(a,"text-muted-foreground")})})()})},b0=({showMediaType:e=!1,className:i,...n})=>{let{data:r,variant:s}=bJ(),o=function(e){let i=(0,n2.useTranslations)("chat");if("source-document"===e.type)return e.title||e.filename||i("attachments.source");let n=bK(e);return e.filename||i("image"===n?"attachments.image":"attachments.attachment")}(r);return"grid"===s?null:(0,iM.jsxs)("div",{className:(0,n1.cn)("min-w-0 flex-1",i),...n,children:[(0,iM.jsx)("span",{className:"block truncate",children:o}),e&&r.mediaType&&(0,iM.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:r.mediaType})]})},b1=({label:e,className:i,children:n,...r})=>{let{onRemove:s,variant:o}=bJ(),a=(0,n2.useTranslations)("chat"),l=e??a("attachments.remove");return s?(0,iM.jsxs)(f7.Button,{"aria-label":l,className:(0,n1.cn)("grid"===o&&["absolute top-2 right-2 size-6 rounded-full p-0","bg-background/80 backdrop-blur-sm","opacity-0 transition-opacity group-hover:opacity-100","hover:bg-background","[&>svg]:size-3"],"inline"===o&&["size-5 rounded p-0","opacity-0 transition-opacity group-hover:opacity-100","[&>svg]:size-2.5"],"list"===o&&["size-8 shrink-0 rounded p-0","[&>svg]:size-4"],i),onClick:e=>{e.stopPropagation(),s()},type:"button",variant:"ghost",...r,children:[n??(0,iM.jsx)(be.XIcon,{}),(0,iM.jsx)("span",{className:"sr-only",children:l})]}):null};function b2({className:e,...i}){return(0,iM.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,n1.cn)("rounded-lg border bg-background p-3 text-sm",e),...i})}function b5({className:e,...i}){return(0,iM.jsx)("div",{"data-slot":"alert-description",className:(0,n1.cn)("text-muted-foreground",e),...i})}let b3=(0,iO.createContext)(null),b4=()=>{let e=(0,iO.useContext)(b3);if(!e)throw Error("Confirmation components must be used within Confirmation");return e},b6=({className:e,approval:i,state:n,...r})=>i&&"input-streaming"!==n&&"input-available"!==n?(0,iM.jsx)(b3.Provider,{value:{approval:i,state:n},children:(0,iM.jsx)(b2,{className:(0,n1.cn)("flex flex-col gap-2",e),...r})}):null,b8=({className:e,...i})=>(0,iM.jsx)(b5,{className:(0,n1.cn)("inline",e),...i}),b9=({children:e})=>{let{state:i}=b4();return"approval-requested"!==i?null:e},b7=({children:e})=>{let{approval:i,state:n}=b4();return i?.approved&&("approval-responded"===n||"output-denied"===n||"output-available"===n)?e:null},we=({children:e})=>{let{approval:i,state:n}=b4();return i?.approved!==!1||"approval-responded"!==n&&"output-denied"!==n&&"output-available"!==n?null:e},wt=({className:e,...i})=>{let{state:n}=b4();return"approval-requested"!==n?null:(0,iM.jsx)("div",{className:(0,n1.cn)("flex items-center justify-end gap-2 self-end",e),...i})},wi=e=>(0,iM.jsx)(f7.Button,{className:"h-8 px-3 text-sm",type:"button",...e});var wn=e.i(660748);let wr=(0,iO.createContext)(null),ws=()=>{let e=(0,iO.useContext)(wr);if(!e)throw Error("Context components must be used within Context");return e},wo=({usedTokens:e,maxTokens:i,usage:n,modelId:r,children:s,...o})=>{let a=(0,xC.useIsMobile)();return(0,iM.jsx)(wr.Provider,{value:{usedTokens:e,maxTokens:i,usage:n,modelId:r,isMobile:a},children:a?(0,iM.jsx)(lK.Popover,{...o,children:s}):(0,iM.jsx)(bU,{...o,children:s})})},wa=()=>{let{usedTokens:e,maxTokens:i,usage:n}=ws(),r=e-(n?.cachedInputTokens??0),s=2*Math.PI*10;return(0,iM.jsxs)("svg",{"aria-label":"Model context usage",height:"20",role:"img",style:{color:"currentcolor"},viewBox:"0 0 24 24",width:"20",children:[(0,iM.jsx)("circle",{cx:12,cy:12,fill:"none",opacity:"0.25",r:10,stroke:"currentColor",strokeWidth:2}),(0,iM.jsx)("circle",{cx:12,cy:12,fill:"none",opacity:"0.7",r:10,stroke:"currentColor",strokeDasharray:`${s} ${s}`,strokeDashoffset:s*(1-r/i),strokeLinecap:"round",strokeWidth:2,style:{transformOrigin:"center",transform:"rotate(-90deg)"}})]})},wl=({children:e,...i})=>{let{usedTokens:n,maxTokens:r,usage:s,isMobile:o}=ws(),a=n-(s?.cachedInputTokens??0),l=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}).format(a/r),c=((0,iO.isValidElement)(e)?e:void 0)??(0,iM.jsxs)(f7.Button,{type:"button",variant:"ghost",...i,children:[(0,iM.jsx)("span",{className:"font-medium text-muted-foreground",children:l}),(0,iM.jsx)(wa,{})]});return o?(0,iM.jsx)(lK.PopoverTrigger,{render:c}):(0,iM.jsx)(bV,{delay:0,closeDelay:0,render:c})},wc=({className:e,...i})=>{let{isMobile:n}=ws(),r=n?lK.PopoverContent:bq;return(0,iM.jsx)(r,{className:(0,n1.cn)("min-w-60 divide-y overflow-hidden p-0",e),...i})},wd=({children:e,className:i,...n})=>{let{usedTokens:r,maxTokens:s,usage:o}=ws(),a=(r-(o?.cachedInputTokens??0))/s,l=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}).format(a),c=new Intl.NumberFormat("en-US",{notation:"compact"}).format(r),d=new Intl.NumberFormat("en-US",{notation:"compact"}).format(s);return(0,iM.jsx)("div",{className:(0,n1.cn)("w-full space-y-2 p-3",i),...n,children:e??(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsxs)("div",{className:"flex items-center justify-between gap-3 text-xs",children:[(0,iM.jsx)("p",{children:l}),(0,iM.jsxs)("p",{className:"font-mono text-muted-foreground",children:[c," / ",d]})]}),(0,iM.jsx)("div",{className:"space-y-2",children:(0,iM.jsx)(wn.Progress,{className:"bg-muted",value:100*a})})]})})},wh=({children:e,className:i,...n})=>(0,iM.jsx)("div",{className:(0,n1.cn)("w-full p-3",i),...n,children:e}),wu=({children:e,className:i,...n})=>{let{modelId:r,usage:s}=ws(),o=(0,n2.useTranslations)("chat"),a=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format((void 0)??0);return(0,iM.jsx)("div",{className:(0,n1.cn)("flex w-full items-center justify-between gap-3 bg-secondary p-3 text-xs",i),...n,children:e??(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:o("context.totalCost")}),(0,iM.jsx)("span",{children:a})]})})},wp=({className:e,children:i,...n})=>{let{usage:r,modelId:s}=ws(),o=(0,n2.useTranslations)("chat"),a=r?.inputTokens??0;if(i)return i;if(!a)return null;let l=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format((void 0)??0);return(0,iM.jsxs)("div",{className:(0,n1.cn)("flex items-center justify-between text-xs",e),...n,children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:o("context.input")}),(0,iM.jsx)(wv,{costText:l,tokens:a})]})},wf=({className:e,children:i,...n})=>{let{usage:r,modelId:s}=ws(),o=(0,n2.useTranslations)("chat"),a=r?.outputTokens??0;if(i)return i;if(!a)return null;let l=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format((void 0)??0);return(0,iM.jsxs)("div",{className:(0,n1.cn)("flex items-center justify-between text-xs",e),...n,children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:o("context.output")}),(0,iM.jsx)(wv,{costText:l,tokens:a})]})},wm=({className:e,children:i,...n})=>{let{usage:r,modelId:s}=ws(),o=(0,n2.useTranslations)("chat"),a=r?.reasoningTokens??0;if(i)return i;if(!a)return null;let l=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format((void 0)??0);return(0,iM.jsxs)("div",{className:(0,n1.cn)("flex items-center justify-between text-xs",e),...n,children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:o("context.reasoning")}),(0,iM.jsx)(wv,{costText:l,tokens:a})]})},wg=({className:e,children:i,...n})=>{let{usage:r,modelId:s}=ws(),o=(0,n2.useTranslations)("chat"),a=r?.cachedInputTokens??0;if(i)return i;if(!a)return null;let l=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format((void 0)??0);return(0,iM.jsxs)("div",{className:(0,n1.cn)("flex items-center justify-between text-xs",e),...n,children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:o("context.cache")}),(0,iM.jsx)(wv,{costText:l,tokens:a})]})},wv=({tokens:e,costText:i})=>(0,iM.jsxs)("span",{children:[void 0===e?"—":new Intl.NumberFormat("en-US",{notation:"compact"}).format(e),i?(0,iM.jsxs)("span",{className:"ml-2 text-muted-foreground",children:["• ",i]}):null]});var wy=e.i(757106),wy=wy;let w_=(0,nP.default)("dot",[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]]),wx=(0,iO.createContext)(null),wb=()=>{let e=(0,iO.useContext)(wx);if(!e)throw Error("ChainOfThought components must be used within ChainOfThought");return e},ww=(0,iO.memo)(({className:e,open:i,defaultOpen:n=!1,onOpenChange:r,children:s,...o})=>{let[a,l]=(0,iO.useState)(n),c=i??a,d=(0,iO.useCallback)(e=>{void 0===i&&l(e),r?.(e)},[r,i]),h=(0,iO.useMemo)(()=>({isOpen:c,setIsOpen:d}),[c,d]);return(0,iM.jsx)(wx.Provider,{value:h,children:(0,iM.jsx)("div",{className:(0,n1.cn)("not-prose max-w-prose overflow-hidden space-y-4",e),...o,children:s})})}),wS=(0,iO.memo)(({className:e,children:i,loading:n,...r})=>{let{isOpen:s,setIsOpen:o}=wb(),a=(0,n2.useTranslations)("chat");return(0,iM.jsx)(n0.Collapsible,{onOpenChange:o,open:s,children:(0,iM.jsxs)(n0.CollapsibleTrigger,{className:(0,n1.cn)("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:[(0,iM.jsx)(wy.default,{className:"size-4"}),(0,iM.jsx)("span",{className:"flex-1 text-left",children:i??a("chainOfThought.defaultHeader")}),n&&(0,iM.jsx)(xw,{size:14}),(0,iM.jsx)(mQ.ChevronDownIcon,{className:(0,n1.cn)("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),wk=(0,iO.memo)(({className:e,icon:i=w_,label:n,description:r,status:s="complete",children:o,...a})=>(0,iM.jsxs)("div",{className:(0,n1.cn)("flex gap-2 text-sm",{complete:"text-muted-foreground",active:"text-foreground",pending:"text-muted-foreground/50"}[s],"fade-in-0 slide-in-from-top-2 animate-in",e),...a,children:[(0,iM.jsxs)("div",{className:"relative mt-0.5",children:[(0,iM.jsx)(i,{className:"size-4"}),(0,iM.jsx)("div",{className:"-mx-px absolute top-7 bottom-0 left-1/2 w-px bg-border"})]}),(0,iM.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,iM.jsx)("div",{children:n}),r&&(0,iM.jsx)("div",{className:"text-muted-foreground text-xs",children:r}),o]})]})),wC=(0,iO.memo)(({className:e,...i})=>(0,iM.jsx)("div",{className:(0,n1.cn)("flex flex-wrap items-center gap-2",e),...i})),wT=(0,iO.memo)(({className:e,children:i,...n})=>(0,iM.jsx)(mj.Badge,{className:(0,n1.cn)("gap-1 px-2 py-0.5 font-normal text-xs",e),variant:"secondary",...n,children:i})),wE=(0,iO.memo)(({className:e,children:i,...n})=>{let{isOpen:r}=wb();return(0,iM.jsx)(n0.Collapsible,{open:r,children:(0,iM.jsx)(n0.CollapsibleContent,{className:(0,n1.cn)("mt-2 space-y-3","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:i})})}),wD=(0,iO.memo)(({className:e,children:i,caption:n,...r})=>(0,iM.jsxs)("div",{className:(0,n1.cn)("mt-2 space-y-2",e),...r,children:[(0,iM.jsx)("div",{className:"relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3",children:i}),n&&(0,iM.jsx)("p",{className:"text-muted-foreground text-xs",children:n})]}));ww.displayName="ChainOfThought",wS.displayName="ChainOfThoughtHeader",wk.displayName="ChainOfThoughtStep",wC.displayName="ChainOfThoughtSearchResults",wT.displayName="ChainOfThoughtSearchResult",wE.displayName="ChainOfThoughtContent",wD.displayName="ChainOfThoughtImage";var m1=m1,wN=e.i(184591),wN=wN,wM=e.i(875350),wO=e.i(341807);let wR=(0,iO.memo)(({children:e,as:i="p",className:n,duration:r=2,spread:s=2})=>{let o=(0,iO.useMemo)(()=>(e?.length??0)*s,[e,s]);return(0,iM.jsx)(i,{children:(0,iM.jsx)(wO.motion.span,{animate:{backgroundPosition:"0% center"},className:(0,n1.cn)("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",n),initial:{backgroundPosition:"100% center"},style:{"--spread":`${o}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{repeat:1/0,duration:r,ease:"linear"},children:e})})}),wA=(0,iO.createContext)({output:"",isStreaming:!1,autoScroll:!0}),wL=({output:e,isStreaming:i=!1,autoScroll:n=!0,onClear:r,className:s,children:o,...a})=>(0,iM.jsx)(wA.Provider,{value:{output:e,isStreaming:i,autoScroll:n,onClear:r},children:(0,iM.jsx)("div",{className:(0,n1.cn)("flex flex-col overflow-hidden rounded-lg border bg-zinc-950 text-zinc-100",s),...a,children:o??(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsxs)(wj,{children:[(0,iM.jsx)(wI,{}),(0,iM.jsxs)("div",{className:"flex items-center gap-1",children:[(0,iM.jsx)(wP,{}),(0,iM.jsxs)(wB,{children:[(0,iM.jsx)(wz,{}),r&&(0,iM.jsx)(wF,{})]})]})]}),(0,iM.jsx)(wH,{})]})})}),wj=({className:e,children:i,...n})=>(0,iM.jsx)("div",{className:(0,n1.cn)("flex items-center justify-between border-zinc-800 border-b px-4 py-2",e),...n,children:i}),wI=({className:e,children:i,...n})=>{let r=(0,n2.useTranslations)("chat");return(0,iM.jsxs)("div",{className:(0,n1.cn)("flex items-center gap-2 text-sm text-zinc-400",e),...n,children:[(0,iM.jsx)(wN.default,{className:"size-4"}),i??r("terminal.title")]})},wP=({className:e,children:i,...n})=>{let{isStreaming:r}=(0,iO.useContext)(wA),s=(0,n2.useTranslations)("chat");return r?(0,iM.jsx)("div",{className:(0,n1.cn)("flex items-center gap-2 text-xs text-zinc-400",e),...n,children:i??(0,iM.jsx)(wR,{className:"w-16",children:s("terminal.running")})}):null},wB=({className:e,children:i,...n})=>(0,iM.jsx)("div",{className:(0,n1.cn)("flex items-center gap-1",e),...n,children:i}),wz=({onCopy:e,onError:i,timeout:n=2e3,children:r,className:s,...o})=>{let[a,l]=(0,iO.useState)(!1),{output:c}=(0,iO.useContext)(wA),d=(0,n2.useTranslations)("chat"),h=async()=>{if(!navigator?.clipboard?.writeText)return void i?.(Error(d("terminal.clipboardUnavailable")));try{await navigator.clipboard.writeText(c),l(!0),e?.(),setTimeout(()=>l(!1),n)}catch(e){i?.(e)}},u=a?sq.CheckIcon:m1.default;return(0,iM.jsx)(f7.Button,{className:(0,n1.cn)("size-7 shrink-0 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",s),onClick:h,size:"icon",variant:"ghost",...o,children:r??(0,iM.jsx)(u,{size:14})})},wF=({children:e,className:i,...n})=>{let{onClear:r}=(0,iO.useContext)(wA);return r?(0,iM.jsx)(f7.Button,{className:(0,n1.cn)("size-7 shrink-0 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",i),onClick:r,size:"icon",variant:"ghost",...n,children:e??(0,iM.jsx)(wM.Trash2Icon,{size:14})}):null},wH=({className:e,children:i,...n})=>{let{output:r,isStreaming:s,autoScroll:o}=(0,iO.useContext)(wA),a=(0,iO.useRef)(null);return(0,iO.useEffect)(()=>{o&&a.current&&(a.current.scrollTop=a.current.scrollHeight)},[r,o]),(0,iM.jsx)("div",{className:(0,n1.cn)("max-h-96 overflow-auto p-4 font-mono text-sm leading-relaxed",e),ref:a,...n,children:i??(0,iM.jsxs)("pre",{className:"whitespace-pre-wrap break-words",children:[r.replace(/\u001b\[[0-9;]*m/g,""),s&&(0,iM.jsx)("span",{className:"ml-0.5 inline-block h-4 w-2 animate-pulse bg-zinc-100"})]})})};function wW(){let e=(0,n2.useTranslations)("chat");return(0,iM.jsx)("div",{className:"flex h-full items-center justify-center text-muted-foreground text-xs",children:e("readonlyCodeBlock.loading")})}let w$=(0,sm.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,iM.jsx)(wW,{})});function wU({value:e,language:i="plaintext",title:n,height:r=220}){let{resolvedTheme:s}=(0,s0.useTheme)();return(0,iM.jsxs)("div",{className:"overflow-hidden rounded-md border bg-background",children:[n?(0,iM.jsx)("div",{className:"border-b bg-muted/30 px-2 py-1 font-mono text-muted-foreground text-xs",children:n}):null,(0,iM.jsx)("div",{style:{height:r},children:(0,iM.jsx)(w$,{height:"100%",language:i,value:e,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,lineNumbers:"on",renderLineHighlight:"none",wordWrap:"on",folding:!1,overviewRulerLanes:0},theme:"dark"===s?"vs-dark":"vs"})})]})}function wV({message:e,isUser:i,workspaceId:n}){let r=(0,n2.useTranslations)("chat"),s=e.parts??[],o=s.filter(e=>"context"!==e.type),a=o.some(e=>"text"===e.type),l=0===s.length&&e.content;return(0,iM.jsxs)("div",{className:"space-y-3",children:[e.attachments?.length?(0,iM.jsx)(w3,{attachments:e.attachments,isUser:i}):null,o.length>0?o.map(i=>(0,iM.jsx)(wX,{part:function(e){if("text"!==e.type)return e;let i=wK(e.text);return i===e.text?e:{...e,text:i}}(i),message:e,workspaceId:n},i.id)):null,!a&&l?i?(0,iM.jsx)(w4,{content:e.content}):(0,iM.jsx)(xx,{content:wK(e.content)}):null,"pending"===e.status&&0===o.length?(0,iM.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,iM.jsx)(xw,{size:14}),(0,iM.jsx)("span",{children:r("messageParts.agentProcessing")})]}):null]})}function wq({message:e}){let i=e.parts?.find(e=>"context"===e.type),n=(0,xS.useLLMStore)(e=>e.models),r=(0,xS.useLLMStore)(e=>e.ensure),s=i?.modelId?n.find(e=>e.modelId===i.modelId||e.name===i.modelId):void 0,o=s?.maxContextTokens??i?.maxTokens;return((0,iO.useEffect)(()=>{i&&r()},[r,i]),i&&o)?(0,iM.jsxs)(wo,{usedTokens:i.usedTokens,maxTokens:o,modelId:i.modelId,usage:{inputTokens:i.usage?.inputTokens??0,outputTokens:i.usage?.outputTokens??0,totalTokens:i.usage?.totalTokens??i.usedTokens,cachedInputTokens:i.usage?.cachedInputTokens??0,reasoningTokens:i.usage?.reasoningTokens??0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0}},children:[(0,iM.jsx)(wl,{className:"h-5 gap-1 px-1.5 text-[10px]"}),(0,iM.jsxs)(wc,{children:[(0,iM.jsx)(wd,{}),(0,iM.jsxs)(wh,{className:"space-y-2",children:[(0,iM.jsx)(wp,{}),(0,iM.jsx)(wf,{}),(0,iM.jsx)(wm,{}),(0,iM.jsx)(wg,{})]}),(0,iM.jsx)(wu,{})]})]}):null}function wK(e){let i=[...e.split(/\r?\n/)];for(;i.length>1&&i.length%2==0;){let e=i.length/2,n=i.slice(0,e),r=i.slice(e);if(wY(n.join("\n"))!==wY(r.join("\n")))break;i=n}return i.join("\n")}function wY(e){return e.trim().replace(/\s+/g," ")}function wX({part:e,message:i,workspaceId:n}){let r=(0,n2.useTranslations)("chat");switch(e.type){case"text":return(0,iM.jsx)(xx,{content:e.text});case"user_message":return(0,iM.jsx)(wJ,{text:e.text,senderName:e.senderName||"用户"});case"reasoning":return(0,iM.jsxs)(ww,{defaultOpen:"streaming"===e.status,className:"max-w-none",children:[(0,iM.jsx)(wS,{loading:"streaming"===e.status,children:r("streaming"===e.status?"messageParts.agentThinking":"messageParts.aiIntermediateOutput")}),(0,iM.jsx)(wE,{className:"max-h-[300px] overflow-y-auto",children:(0,iM.jsx)(wk,{icon:m3,label:r("streaming"===e.status?"messageParts.streamingResponse":"messageParts.intermediateMessage"),status:"streaming"===e.status?"active":"complete",children:(0,iM.jsx)(xx,{content:e.text})})})]});case"chain":return(0,iM.jsxs)(ww,{defaultOpen:"pending"===i.status,className:"max-w-none",children:[(0,iM.jsx)(wS,{loading:"pending"===i.status||"streaming"===i.status,children:r("messageParts.chainSteps",{count:e.chains.length})}),(0,iM.jsx)(wE,{className:"max-h-[300px] overflow-y-auto",children:e.chains.map(e=>{let r="completed"===e.status;return"message"===e.kind?(0,iM.jsx)(wZ,{text:e.text??e.title,status:r?"complete":"active"},e.id):(0,iM.jsx)(wQ,{chain:e,message:i,workspaceId:n,status:r?"complete":"active"},e.id)})})]});case"terminal":return(0,iM.jsx)(wL,{output:e.command?`$ ${e.command}
27
+ ${e.output}`:e.output,isStreaming:"streaming"===e.status,className:"error"===e.status?"border-destructive/40":void 0});case"confirmation":{var s,o;let i=(s=e.id,(o=e.approval)&&void 0!==o.approved?{id:o.id,approved:o.approved,reason:o.reason}:{id:o?.id??s});return(0,iM.jsxs)(b6,{approval:i,state:void 0===i.approved?"approval-requested":"approval-responded",children:[(0,iM.jsxs)(b8,{children:[(0,iM.jsxs)(b9,{children:[e.title,e.description?(0,iM.jsx)("span",{className:"block text-xs",children:e.description}):null]}),(0,iM.jsx)(b7,{children:e.title}),(0,iM.jsx)(we,{children:e.approval?.reason??e.title})]}),(0,iM.jsxs)(wt,{children:[(0,iM.jsx)(wi,{variant:"outline",children:r("messageParts.reject")}),(0,iM.jsx)(wi,{children:r("messageParts.approve")})]})]})}case"context":default:return null;case"subagent":return(0,iM.jsxs)(xZ,{children:[(0,iM.jsx)(xQ,{name:e.name,model:e.model}),e.instructions||e.output||e.tools?.length?(0,iM.jsxs)(x0,{children:[e.instructions?(0,iM.jsx)(x1,{children:e.instructions}):null,e.output?(0,iM.jsxs)("div",{className:"space-y-2",children:[(0,iM.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:r("messageParts.result")}),(0,iM.jsx)("div",{className:"rounded-md bg-muted/50 p-3 text-sm",children:(0,iM.jsx)(xx,{content:e.output})})]}):null,e.tools?.length?(0,iM.jsx)(x2,{children:e.tools.map((e,i)=>(0,iM.jsx)(x5,{value:`tool-${i}`,tool:{description:e.description??e.name,inputSchema:e.inputSchema,jsonSchema:e.jsonSchema}},`${e.name??"tool"}-${i}`))}):null]}):null]});case"ask_user_question":if("answered"!==e.status&&!e.answer)return null;return(0,iM.jsx)(wG,{question:e.question,answer:e.answer??""})}}function wJ({text:e,senderName:i}){return(0,iM.jsxs)("div",{className:"not-prose rounded-md border border-primary/20 bg-primary/5 px-3 py-2 text-sm",children:[(0,iM.jsxs)("div",{className:"mb-1 text-xs font-medium text-primary",children:[i,":"]}),(0,iM.jsx)(w4,{content:e})]})}function wG({question:e,answer:i}){return(0,iM.jsxs)("div",{className:"not-prose flex items-start gap-2 rounded-md border bg-muted/30 px-3 py-2 text-sm",children:[(0,iM.jsx)(m5,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,iM.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,iM.jsx)("div",{className:"truncate text-muted-foreground",children:e}),(0,iM.jsx)("div",{className:"font-medium",children:i})]})]})}function wZ({text:e,status:i}){let n=(0,n2.useTranslations)("chat"),[r,s]=(0,iO.useState)(!1);return(0,iM.jsx)(wk,{icon:m3,label:(0,iM.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,iM.jsx)("span",{children:n("messageParts.aiMessage")}),(0,iM.jsx)(f7.Button,{type:"button",variant:"ghost",size:"icon",className:"ml-auto size-5",onClick:()=>s(!r),children:(0,iM.jsx)(mQ.ChevronDownIcon,{className:(0,n1.cn)("size-3.5 transition-transform",r&&"rotate-180")})})]}),status:i,children:r?(0,iM.jsx)(xx,{content:e}):null})}function wQ({chain:e,message:i,workspaceId:n,status:r}){var s;let o=(0,rd.useEditorStore)(e=>e.openFile),[a,l]=(0,iO.useState)(!1),[c,d]=(0,iO.useState)(null),[h,u]=(0,iO.useState)(!1),[p,f]=(0,iO.useState)(null),[m,g]=(0,iO.useState)(!1),v=(0,n2.useTranslations)("chat"),y=async()=>{e.filePath&&await o(n,e.filePath)},_=async()=>{if(c||!e.detailId)return c;u(!0),f(null);try{let r=await fetch(`/api/workspaces/${n}/channels/${i.channelId}/messages/${i.id}/tool-details/${e.detailId}`);if(!r.ok)throw Error(await r.text());let s=await r.json();return d(s),s}catch(e){return f(e instanceof Error?e.message:v("messageParts.failedToLoadDetails")),null}finally{u(!1)}},b=async()=>{let e=!a;l(e),e&&!h&&await _()},w=async()=>{var i;let n=c??await _(),r=n?void 0!==(i=n).input||void 0!==i.output?JSON.stringify({input:i.input,output:i.output},null,2):i.raw??"":e.command??e.title;try{await navigator.clipboard.writeText(r),g(!0),setTimeout(()=>g(!1),1500)}catch{}};return(0,iM.jsx)(wk,{icon:"complete"===r?mZ:m0,label:(0,iM.jsxs)("div",{className:"group/tool-step flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,iM.jsx)("span",{children:e.filePath?e.title.replace(RegExp(`\\s+${((s=e.filePath).split(/[\\/]/).filter(Boolean).at(-1)??s).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`),""):e.title}),e.description?(0,iM.jsx)("span",{className:"min-w-0 max-w-72 truncate text-muted-foreground text-xs",children:e.description}):null,e.filePath?(0,iM.jsxs)(f7.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 max-w-full gap-1 px-1.5 text-xs",onClick:y,children:[(0,iM.jsx)(m2.default,{className:"size-3"}),(0,iM.jsx)("span",{className:"max-w-52 truncate",children:e.filePath})]}):null,(0,iM.jsx)(f7.Button,{type:"button",variant:"ghost",size:"icon",className:"ml-auto size-5 shrink-0 opacity-0 transition-opacity group-hover/tool-step:opacity-100 focus-visible:opacity-100",onClick:w,children:m?(0,iM.jsx)(sq.CheckIcon,{className:"size-3 text-green-500"}):(0,iM.jsx)(m1.default,{className:"size-3"})}),e.detailId?(0,iM.jsx)(f7.Button,{type:"button",variant:"ghost",size:"icon",className:"size-5 shrink-0",onClick:b,children:(0,iM.jsx)(mQ.ChevronDownIcon,{className:(0,n1.cn)("size-3.5 transition-transform",a&&"rotate-180")})}):null]}),description:e.command,status:r,children:a?(0,iM.jsx)("div",{className:"space-y-2",children:h?(0,iM.jsx)("div",{className:"rounded-md border bg-muted/40 p-2 text-muted-foreground text-xs",children:v("messageParts.loadingDetails")}):p?(0,iM.jsx)("div",{className:"rounded-md border bg-muted/40 p-2 text-destructive text-xs",children:p}):c?(0,iM.jsx)(w0,{detail:c,toolName:e.toolName,filePath:e.filePath}):(0,iM.jsx)("div",{className:"rounded-md border bg-muted/40 p-2 text-muted-foreground text-xs",children:v("messageParts.noDetails")})}):null})}function w0({detail:e,toolName:i,filePath:n}){var r,s;let o,a=(0,n2.useTranslations)("chat");if(/^(Bash|Shell|Command)$/i.test(i??"")){let i=function(e){if(!e||"object"!=typeof e)return"string"==typeof e?e:void 0;let i=e.command??e.Command;return"string"==typeof i?i:void 0}(e.input),n="string"==typeof e.output?e.output:JSON.stringify(e.output??"",null,2);return(0,iM.jsx)(wL,{output:i?`$ ${i}
28
+ ${n}`:n})}let l=function(e,i,n){if(!e||"object"!=typeof e)return null;let r=w5(e.file_path)??w5(e.path)??n??"edit",s=function(e){if(!e||"object"!=typeof e)return;let i=w5(e.content);if(void 0!==i)return i;let n=e.file;if(n&&"object"==typeof n)return w5(n.content)}(i),o=w5(e.old_string),a=w5(e.new_string);if(void 0!==o&&void 0!==a)return{path:r,oldContent:o,newContent:s??a};let l=Array.isArray(e.edits)?e.edits:[];return l.length>0?{path:r,oldContent:l.map((e,i)=>e&&"object"==typeof e?w5(e.old_string)??`#${i+1}`:`#${i+1}`).join("\n\n"),newContent:s??l.map((e,i)=>e&&"object"==typeof e?w5(e.new_string)??`#${i+1}`:`#${i+1}`).join("\n\n")}:null}(e.input,e.output,n);if(l&&/^(Edit|MultiEdit)$/i.test(i??""))return(0,iM.jsx)("div",{className:"h-80 overflow-hidden rounded-md border bg-background",children:(0,iM.jsx)(xT,{oldContent:l.oldContent,newContent:l.newContent,path:l.path})});let c=(r=e,s=a,o=[],void 0!==r.input&&o.push({title:s("messageParts.input"),value:w1(r.input),language:w2(r.input)?"json":"plaintext",height:180}),void 0!==r.output&&o.push({title:s("messageParts.output"),value:w1(r.output),language:w2(r.output)?"json":"plaintext",height:220}),o);return 0===c.length&&e.raw?(0,iM.jsx)(wU,{title:a("messageParts.raw"),value:e.raw,language:"plaintext"}):(0,iM.jsx)("div",{className:"space-y-2",children:c.map(e=>(0,iM.jsx)(wU,{title:e.title,value:e.value,language:e.language,height:e.height},e.title))})}function w1(e){return"string"==typeof e?e:JSON.stringify(e,null,2)}function w2(e){return"string"!=typeof e}function w5(e){return"string"==typeof e?e:void 0}function w3({attachments:e,isUser:i}){return(0,iM.jsx)(bG,{variant:"inline",className:i?"justify-end":"justify-start",children:e.map((e,i)=>{var n,r;return(0,iM.jsxs)(bZ,{data:(n=e,r=i,{id:`${n.path||n.name}-${r}`,type:"file",filename:n.name,mediaType:n.type,url:n.url||n.path}),children:[(0,iM.jsx)(bQ,{}),(0,iM.jsx)(b0,{showMediaType:!0})]},`${e.path}-${i}`)})})}function w4({content:e}){return/<[a-z][\s\S]*>/i.test(e)?(0,iM.jsx)("span",{className:"tiptap tiptap-message",dangerouslySetInnerHTML:{__html:e}}):(0,iM.jsx)("span",{className:"whitespace-pre-wrap break-words",children:e})}function w6({message:e,workspaceId:i,onEdit:n,onDelete:r,onReply:s}){let o=(0,n2.useTranslations)("common"),a="user"===e.senderId,l=(0,mO.useAgentStore)(e=>e.agents),c=a?void 0:l.find(i=>i.id===e.senderId),d=a?o("you"):c?.name||e.senderId,h=(0,mX.useUserAvatar)(),u=new Date(e.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),[p,f]=(0,iO.useState)(!1),[m,g]=(0,iO.useState)(!1),v=e.replies??[],y="streaming"===e.status||"pending"===e.status||"waiting_for_user"===e.status,[_,b]=(0,iO.useState)(()=>e.metadata?.duration??0);(0,iO.useEffect)(()=>{if(!y&&e.metadata?.duration!=null)return void b(e.metadata.duration);if(!y)return;let i=new Date(e.createdAt).getTime();b(Date.now()-i);let n=setInterval(()=>b(Date.now()-i),1e3);return()=>clearInterval(n)},[e.metadata?.duration,e.createdAt,y]);let w=!a&&(y||"completed"===e.status||"error"===e.status)&&_>0,S=(0,iO.useCallback)(async()=>{let i=w8(e.content)?e.content.replace(/<[^>]*>/g,""):e.content;await navigator.clipboard.writeText(i),f(!0),setTimeout(()=>f(!1),2e3)},[e.content]);return(0,iM.jsxs)("div",{className:`group flex gap-2 px-3 py-1.5 ${a?"flex-row-reverse":""}`,children:[(0,iM.jsx)(mP.AgentIcon,{agentId:a?void 0:e.senderId,name:d,avatarUrl:a&&h||void 0,onClick:()=>g(!0),className:"size-7 rounded-full"}),(0,iM.jsxs)("div",{className:`flex flex-col min-w-0 w-[80%] ${a?"items-end":"items-start"}`,children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,iM.jsx)("span",{className:"text-xs font-medium text-foreground",children:d}),e.senderRole&&(0,iM.jsx)("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:e.senderRole}),e.metadata?.model&&(0,iM.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground",children:e.metadata.model}),(0,iM.jsx)(wq,{message:e}),(0,iM.jsx)("span",{className:"text-[10px] text-muted-foreground",children:u})]}),(0,iM.jsxs)("div",{className:`min-w-0 max-w-full text-sm rounded-lg px-3 py-2 ${a?"bg-primary text-primary-foreground":"bg-muted"}`,children:[(0,iM.jsx)(wV,{message:e,isUser:a,workspaceId:i}),w&&(0,iM.jsxs)("div",{className:"flex items-center justify-end gap-1 mt-1 pt-1 border-t border-border/30",children:[(0,iM.jsx)(mK,{className:"h-3 w-3 text-muted-foreground"}),(0,iM.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[function(e){let i=Math.floor(e/1e3);if(i<60)return`${i}s`;let n=Math.floor(i/60);if(n<60)return`${n}m ${i%60}s`;let r=Math.floor(n/60);return`${r}h ${n%60}m`}(_),y&&(0,iM.jsx)("span",{className:"animate-pulse ml-0.5",children:"..."})]})]})]}),v.length>0?(0,iM.jsx)("div",{className:"mt-1 flex w-full justify-end",children:(0,iM.jsxs)(lK.Popover,{children:[(0,iM.jsxs)(lK.PopoverTrigger,{render:(0,iM.jsx)("button",{type:"button",className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors"}),children:["有 ",v.length," 条回复消息"]}),(0,iM.jsx)(lK.PopoverContent,{align:"end",sideOffset:4,className:"w-96 max-w-[calc(100vw-2rem)] p-2",children:(0,iM.jsx)("div",{className:"max-h-96 space-y-2 overflow-y-auto pr-1",children:v.map(e=>(0,iM.jsxs)("div",{className:"rounded-md border bg-muted/30 px-3 py-2 text-sm",children:[(0,iM.jsxs)("div",{className:"mb-1 flex items-center justify-between gap-2 text-xs text-muted-foreground",children:[(0,iM.jsx)("span",{children:"user"===e.senderId?o("you"):e.senderRole||e.senderId}),(0,iM.jsx)("span",{children:new Date(e.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),(0,iM.jsx)("div",{className:"whitespace-pre-wrap break-words",children:w8(e.content)?e.content.replace(/<[^>]*>/g,""):e.content})]},e.id))})})]})}):null,(0,iM.jsxs)("div",{className:"flex items-center gap-0.5 h-6 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,iM.jsx)("button",{onClick:()=>s?.(e),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"回复",children:(0,iM.jsx)(mY,{className:"h-3.5 w-3.5"})}),(0,iM.jsx)("button",{onClick:S,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"复制",children:p?(0,iM.jsx)(ms.Check,{className:"h-3.5 w-3.5 text-green-500"}):(0,iM.jsx)(mq.Copy,{className:"h-3.5 w-3.5"})}),a&&(0,iM.jsx)("button",{onClick:()=>n?.(e),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"编辑",children:(0,iM.jsx)(mc.Pencil,{className:"h-3.5 w-3.5"})}),(0,iM.jsx)("button",{onClick:()=>r?.(e),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-destructive transition-colors",title:"删除",children:(0,iM.jsx)(nZ.Trash2,{className:"h-3.5 w-3.5"})})]})]}),(0,iM.jsx)(mG,{open:m,onOpenChange:g,memberName:e.senderId,channelId:e.channelId,workspaceId:i})]})}function w8(e){return/<[a-z][\s\S]*>/i.test(e)}var w9={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};let w7=(e,i,n,r)=>{let s=(0,iO.forwardRef)(({color:n="currentColor",size:s=24,stroke:o=2,title:a,className:l,children:c,...d},h)=>(0,iO.createElement)("svg",{ref:h,...w9[e],width:s,height:s,className:["tabler-icon",`tabler-icon-${i}`,l].join(" "),..."filled"===e?{fill:n}:{strokeWidth:o,stroke:n},...d},[a&&(0,iO.createElement)("title",{key:"svg-title"},a),...r.map(([e,i])=>(0,iO.createElement)(e,i)),...Array.isArray(c)?c:[c]]));return s.displayName=`${n}`,s},Se=w7("outline","chevron-down","ChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),St=w7("outline","circle-check","CircleCheck",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l2 2l4 -4",key:"svg-1"}]]),Si=w7("outline","circle-dashed","CircleDashed",[["path",{d:"M8.56 3.69a9 9 0 0 0 -2.92 1.95",key:"svg-0"}],["path",{d:"M3.69 8.56a9 9 0 0 0 -.69 3.44",key:"svg-1"}],["path",{d:"M3.69 15.44a9 9 0 0 0 1.95 2.92",key:"svg-2"}],["path",{d:"M8.56 20.31a9 9 0 0 0 3.44 .69",key:"svg-3"}],["path",{d:"M15.44 20.31a9 9 0 0 0 2.92 -1.95",key:"svg-4"}],["path",{d:"M20.31 15.44a9 9 0 0 0 .69 -3.44",key:"svg-5"}],["path",{d:"M20.31 8.56a9 9 0 0 0 -1.95 -2.92",key:"svg-6"}],["path",{d:"M15.44 3.69a9 9 0 0 0 -3.44 -.69",key:"svg-7"}]]),Sn=w7("outline","file-text","FileText",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2",key:"svg-1"}],["path",{d:"M9 9l1 0",key:"svg-2"}],["path",{d:"M9 13l6 0",key:"svg-3"}],["path",{d:"M9 17l6 0",key:"svg-4"}]]),Sr=w7("outline","loader-2","Loader2",[["path",{d:"M12 3a9 9 0 1 0 9 9",key:"svg-0"}]]),Ss=w7("outline","message-circle-plus","MessageCirclePlus",[["path",{d:"M12.007 19.98a9.869 9.869 0 0 1 -4.307 -.98l-4.7 1l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c1.992 1.7 2.93 4.04 2.747 6.34",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}]]),So=w7("outline","paperclip","Paperclip",[["path",{d:"M15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3l6.5 -6.5a3 3 0 0 0 -6 -6l-6.5 6.5a4.5 4.5 0 0 0 9 9l6.5 -6.5",key:"svg-0"}]]),Sa=w7("outline","pin","Pin",[["path",{d:"M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4",key:"svg-0"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-1"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-2"}]]),Sl=w7("filled","pin-filled","PinFilled",[["path",{d:"M15.113 3.21l.094 .083l5.5 5.5a1 1 0 0 1 -1.175 1.59l-3.172 3.171l-1.424 3.797a1 1 0 0 1 -.158 .277l-.07 .08l-1.5 1.5a1 1 0 0 1 -1.32 .082l-.095 -.083l-2.793 -2.792l-3.793 3.792a1 1 0 0 1 -1.497 -1.32l.083 -.094l3.792 -3.793l-2.792 -2.793a1 1 0 0 1 -.083 -1.32l.083 -.094l1.5 -1.5a1 1 0 0 1 .258 -.187l.098 -.042l3.796 -1.425l3.171 -3.17a1 1 0 0 1 1.497 -1.26z",key:"svg-0"}]]),Sc=w7("outline","plug","Plug",[["path",{d:"M9.785 6l8.215 8.215l-2.054 2.054a5.81 5.81 0 1 1 -8.215 -8.215l2.054 -2.054",key:"svg-0"}],["path",{d:"M4 20l3.5 -3.5",key:"svg-1"}],["path",{d:"M15 4l-3.5 3.5",key:"svg-2"}],["path",{d:"M20 9l-3.5 3.5",key:"svg-3"}]]),Sd=w7("outline","plus","Plus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]),Sh=w7("outline","puzzle","Puzzle",[["path",{d:"M4 7h3a1 1 0 0 0 1 -1v-1a2 2 0 0 1 4 0v1a1 1 0 0 0 1 1h3a1 1 0 0 1 1 1v3a1 1 0 0 0 1 1h1a2 2 0 0 1 0 4h-1a1 1 0 0 0 -1 1v3a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1v-1a2 2 0 0 0 -4 0v1a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h1a2 2 0 0 0 0 -4h-1a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1",key:"svg-0"}]]),Su=w7("outline","tools","Tools",[["path",{d:"M3 21h4l13 -13a1.5 1.5 0 0 0 -4 -4l-13 13v4",key:"svg-0"}],["path",{d:"M14.5 5.5l4 4",key:"svg-1"}],["path",{d:"M12 8l-5 -5l-4 4l5 5",key:"svg-2"}],["path",{d:"M7 8l-1.5 1.5",key:"svg-3"}],["path",{d:"M16 12l5 5l-4 4l-5 -5",key:"svg-4"}],["path",{d:"M16 17l-1.5 1.5",key:"svg-5"}]]),Sp=w7("outline","wand","Wand",[["path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3",key:"svg-0"}],["path",{d:"M15 6l3 3",key:"svg-1"}],["path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2",key:"svg-2"}],["path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2",key:"svg-3"}]]),Sf=w7("outline","chevron-up","ChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]);var Sm=iO,Sg=e.i(56032);function Sv(e){this.content=e}Sv.prototype={constructor:Sv,find:function(e){for(var i=0;i<this.content.length;i+=2)if(this.content[i]===e)return i;return -1},get:function(e){var i=this.find(e);return -1==i?void 0:this.content[i+1]},update:function(e,i,n){var r=n&&n!=e?this.remove(n):this,s=r.find(e),o=r.content.slice();return -1==s?o.push(n||e,i):(o[s+1]=i,n&&(o[s]=n)),new Sv(o)},remove:function(e){var i=this.find(e);if(-1==i)return this;var n=this.content.slice();return n.splice(i,2),new Sv(n)},addToStart:function(e,i){return new Sv([e,i].concat(this.remove(e).content))},addToEnd:function(e,i){var n=this.remove(e).content.slice();return n.push(e,i),new Sv(n)},addBefore:function(e,i,n){var r=this.remove(i),s=r.content.slice(),o=r.find(e);return s.splice(-1==o?s.length:o,0,i,n),new Sv(s)},forEach:function(e){for(var i=0;i<this.content.length;i+=2)e(this.content[i],this.content[i+1])},prepend:function(e){return(e=Sv.from(e)).size?new Sv(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Sv.from(e)).size?new Sv(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var i=this;e=Sv.from(e);for(var n=0;n<e.content.length;n+=2)i=i.remove(e.content[n]);return i},toObject:function(){var e={};return this.forEach(function(i,n){e[i]=n}),e},get size(){return this.content.length>>1}},Sv.from=function(e){if(e instanceof Sv)return e;var i=[];if(e)for(var n in e)i.push(n,e[n]);return new Sv(i)};class Sy{constructor(e,i){if(this.content=e,this.size=i||0,null==i)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,i,n,r=0,s){for(let o=0,a=0;a<i;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&!1!==n(l,r+a,s||null,o)&&l.content.size){let s=a+1;l.nodesBetween(Math.max(0,e-s),Math.min(l.content.size,i-s),n,r+s)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,i,n,r){let s="",o=!0;return this.nodesBetween(e,i,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,i-l):a.isLeaf?r?"function"==typeof r?r(a):r:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&n&&(o?o=!1:s+=n),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let i=this.lastChild,n=e.firstChild,r=this.content.slice(),s=0;for(i.isText&&i.sameMarkup(n)&&(r[r.length-1]=i.withText(i.text+n.text),s=1);s<e.content.length;s++)r.push(e.content[s]);return new Sy(r,this.size+e.size)}cut(e,i=this.size){if(0==e&&i==this.size)return this;let n=[],r=0;if(i>e)for(let s=0,o=0;o<i;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>i)&&(a=a.isText?a.cut(Math.max(0,e-o),Math.min(a.text.length,i-o)):a.cut(Math.max(0,e-o-1),Math.min(a.content.size,i-o-1))),n.push(a),r+=a.nodeSize),o=l}return new Sy(n,r)}cutByIndex(e,i){return e==i?Sy.empty:0==e&&i==this.content.length?this:new Sy(this.content.slice(e,i))}replaceChild(e,i){let n=this.content[e];if(n==i)return this;let r=this.content.slice(),s=this.size+i.nodeSize-n.nodeSize;return r[e]=i,new Sy(r,s)}addToStart(e){return new Sy([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Sy(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let i=0;i<this.content.length;i++)if(!this.content[i].eq(e.content[i]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let i=this.content[e];if(!i)throw RangeError("Index "+e+" out of range for "+this);return i}maybeChild(e){return this.content[e]||null}forEach(e){for(let i=0,n=0;i<this.content.length;i++){let r=this.content[i];e(r,n,i),n+=r.nodeSize}}findDiffStart(e,i=0){return function e(i,n,r){for(let s=0;;s++){if(s==i.childCount||s==n.childCount)return i.childCount==n.childCount?null:r;let o=i.child(s),a=n.child(s);if(o==a){r+=o.nodeSize;continue}if(!o.sameMarkup(a))return r;if(o.isText&&o.text!=a.text){for(let e=0;o.text[e]==a.text[e];e++)r++;return r}if(o.content.size||a.content.size){let i=e(o.content,a.content,r+1);if(null!=i)return i}r+=o.nodeSize}}(this,e,i)}findDiffEnd(e,i=this.size,n=e.size){return function e(i,n,r,s){for(let o=i.childCount,a=n.childCount;;){if(0==o||0==a)return o==a?null:{a:r,b:s};let l=i.child(--o),c=n.child(--a),d=l.nodeSize;if(l==c){r-=d,s-=d;continue}if(!l.sameMarkup(c))return{a:r,b:s};if(l.isText&&l.text!=c.text){let e=0,i=Math.min(l.text.length,c.text.length);for(;e<i&&l.text[l.text.length-e-1]==c.text[c.text.length-e-1];)e++,r--,s--;return{a:r,b:s}}if(l.content.size||c.content.size){let i=e(l.content,c.content,r-1,s-1);if(i)return i}r-=d,s-=d}}(this,e,i,n)}findIndex(e){if(0==e)return Sx(0,e);if(e==this.size)return Sx(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let i=0,n=0;;i++){let r=n+this.child(i).nodeSize;if(r>=e){if(r==e)return Sx(i+1,r);return Sx(i,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,i){if(!i)return Sy.empty;if(!Array.isArray(i))throw RangeError("Invalid input for Fragment.fromJSON");return new Sy(i.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Sy.empty;let i,n=0;for(let r=0;r<e.length;r++){let s=e[r];n+=s.nodeSize,r&&s.isText&&e[r-1].sameMarkup(s)?(i||(i=e.slice(0,r)),i[i.length-1]=s.withText(i[i.length-1].text+s.text)):i&&i.push(s)}return new Sy(i||e,n)}static from(e){if(!e)return Sy.empty;if(e instanceof Sy)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Sy([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Sy.empty=new Sy([],0);let S_={index:0,offset:0};function Sx(e,i){return S_.index=e,S_.offset=i,S_}function Sb(e,i){if(e===i)return!0;if(!(e&&"object"==typeof e)||!(i&&"object"==typeof i))return!1;let n=Array.isArray(e);if(Array.isArray(i)!=n)return!1;if(n){if(e.length!=i.length)return!1;for(let n=0;n<e.length;n++)if(!Sb(e[n],i[n]))return!1}else{for(let n in e)if(!(n in i)||!Sb(e[n],i[n]))return!1;for(let n in i)if(!(n in e))return!1}return!0}class Sw{constructor(e,i){this.type=e,this.attrs=i}addToSet(e){let i,n=!1;for(let r=0;r<e.length;r++){let s=e[r];if(this.eq(s))return e;if(this.type.excludes(s.type))i||(i=e.slice(0,r));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(i||(i=e.slice(0,r)),i.push(this),n=!0),i&&i.push(s)}}return i||(i=e.slice()),n||i.push(this),i}removeFromSet(e){for(let i=0;i<e.length;i++)if(this.eq(e[i]))return e.slice(0,i).concat(e.slice(i+1));return e}isInSet(e){for(let i=0;i<e.length;i++)if(this.eq(e[i]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Sb(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let i in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,i){if(!i)throw RangeError("Invalid input for Mark.fromJSON");let n=e.marks[i.type];if(!n)throw RangeError(`There is no mark type ${i.type} in this schema`);let r=n.create(i.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,i){if(e==i)return!0;if(e.length!=i.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(i[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return Sw.none;if(e instanceof Sw)return[e];let i=e.slice();return i.sort((e,i)=>e.type.rank-i.type.rank),i}}Sw.none=[];class SS extends Error{}class Sk{constructor(e,i,n){this.content=e,this.openStart=i,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,i){let n=function e(i,n,r,s){let{index:o,offset:a}=i.findIndex(n),l=i.maybeChild(o);if(a==n||l.isText)return s&&!s.canReplace(o,o,r)?null:i.cut(0,n).append(r).append(i.cut(n));let c=e(l.content,n-a-1,r,l);return c&&i.replaceChild(o,l.copy(c))}(this.content,e+this.openStart,i);return n&&new Sk(n,this.openStart,this.openEnd)}removeBetween(e,i){return new Sk(function e(i,n,r){let{index:s,offset:o}=i.findIndex(n),a=i.maybeChild(s),{index:l,offset:c}=i.findIndex(r);if(o==n||a.isText){if(c!=r&&!i.child(l).isText)throw RangeError("Removing non-flat range");return i.cut(0,n).append(i.cut(r))}if(s!=l)throw RangeError("Removing non-flat range");return i.replaceChild(s,a.copy(e(a.content,n-o-1,r-o-1)))}(this.content,e+this.openStart,i+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,i){if(!i)return Sk.empty;let n=i.openStart||0,r=i.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw RangeError("Invalid input for Slice.fromJSON");return new Sk(Sy.fromJSON(e,i.content),n,r)}static maxOpen(e,i=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(i||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(i||!n.type.spec.isolating);n=n.lastChild)r++;return new Sk(e,n,r)}}function SC(e,i){if(!i.type.compatibleContent(e.type))throw new SS("Cannot join "+i.type.name+" onto "+e.type.name)}function ST(e,i,n){let r=e.node(n);return SC(r,i.node(n)),r}function SE(e,i){let n=i.length-1;n>=0&&e.isText&&e.sameMarkup(i[n])?i[n]=e.withText(i[n].text+e.text):i.push(e)}function SD(e,i,n,r){let s=(i||e).node(n),o=0,a=i?i.index(n):s.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(SE(e.nodeAfter,r),o++));for(let e=o;e<a;e++)SE(s.child(e),r);i&&i.depth==n&&i.textOffset&&SE(i.nodeBefore,r)}function SN(e,i){return e.type.checkContent(i),e.copy(i)}function SM(e,i,n){let r=[];return SD(null,e,n,r),e.depth>n&&SE(SN(ST(e,i,n+1),SM(e,i,n+1)),r),SD(i,null,n,r),new Sy(r)}Sk.empty=new Sk(Sy.empty,0,0);class SO{constructor(e,i,n){this.pos=e,this.path=i,this.parentOffset=n,this.depth=i.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,i=this.index(this.depth);if(i==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(i);return n?e.child(i).cut(n):r}get nodeBefore(){let e=this.index(this.depth),i=this.pos-this.path[this.path.length-1];return i?this.parent.child(e).cut(0,i):0==e?null:this.parent.child(e-1)}posAtIndex(e,i){i=this.resolveDepth(i);let n=this.path[3*i],r=0==i?0:this.path[3*i-1]+1;for(let i=0;i<e;i++)r+=n.child(i).nodeSize;return r}marks(){let e=this.parent,i=this.index();if(0==e.content.size)return Sw.none;if(this.textOffset)return e.child(i).marks;let n=e.maybeChild(i-1),r=e.maybeChild(i);if(!n){let e=n;n=r,r=e}let s=n.marks;for(var o=0;o<s.length;o++)!1!==s[o].type.spec.inclusive||r&&s[o].isInSet(r.marks)||(s=s[o--].removeFromSet(s));return s}marksAcross(e){let i=this.parent.maybeChild(this.index());if(!i||!i.isInline)return null;let n=i.marks,r=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)!1!==n[s].type.spec.inclusive||r&&n[s].isInSet(r.marks)||(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let i=this.depth;i>0;i--)if(this.start(i)<=e&&this.end(i)>=e)return i;return 0}blockRange(e=this,i){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!i||i(this.node(n))))return new Sj(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let i=1;i<=this.depth;i++)e+=(e?"/":"")+this.node(i).type.name+"_"+this.index(i-1);return e+":"+this.parentOffset}static resolve(e,i){if(!(i>=0&&i<=e.content.size))throw RangeError("Position "+i+" out of range");let n=[],r=0,s=i;for(let i=e;;){let{index:e,offset:o}=i.content.findIndex(s),a=s-o;if(n.push(i,e,r+o),!a||(i=i.child(e)).isText)break;s=a-1,r+=o+1}return new SO(i,n,s)}static resolveCached(e,i){let n=SL.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==i)return r}else SL.set(e,n=new SR);let r=n.elts[n.i]=SO.resolve(e,i);return n.i=(n.i+1)%SA,r}}class SR{constructor(){this.elts=[],this.i=0}}let SA=12,SL=new WeakMap;class Sj{constructor(e,i,n){this.$from=e,this.$to=i,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let SI=Object.create(null);class SP{constructor(e,i,n,r=Sw.none){this.type=e,this.attrs=i,this.marks=r,this.content=n||Sy.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,i,n,r=0){this.content.nodesBetween(e,i,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,i,n,r){return this.content.textBetween(e,i,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,i,n){return this.type==e&&Sb(this.attrs,i||e.defaultAttrs||SI)&&Sw.sameSet(this.marks,n||Sw.none)}copy(e=null){return e==this.content?this:new SP(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new SP(this.type,this.attrs,this.content,e)}cut(e,i=this.content.size){return 0==e&&i==this.content.size?this:this.copy(this.content.cut(e,i))}slice(e,i=this.content.size,n=!1){if(e==i)return Sk.empty;let r=this.resolve(e),s=this.resolve(i),o=n?0:r.sharedDepth(i),a=r.start(o);return new Sk(r.node(o).content.cut(r.pos-a,s.pos-a),r.depth-o,s.depth-o)}replace(e,i,n){var r=this.resolve(e),s=this.resolve(i);if(n.openStart>r.depth)throw new SS("Inserted content deeper than insertion position");if(r.depth-n.openStart!=s.depth-n.openEnd)throw new SS("Inconsistent open depths");return function e(i,n,r,s){let o=i.index(s),a=i.node(s);if(o==n.index(s)&&s<i.depth-r.openStart){let l=e(i,n,r,s+1);return a.copy(a.content.replaceChild(o,l))}if(!r.content.size)return SN(a,SM(i,n,s));if(r.openStart||r.openEnd||i.depth!=s||n.depth!=s){let{start:e,end:o}=function(e,i){let n=i.depth-e.openStart,r=i.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=i.node(e).copy(Sy.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,i);return SN(a,function e(i,n,r,s,o){let a=i.depth>o&&ST(i,n,o+1),l=s.depth>o&&ST(r,s,o+1),c=[];return SD(null,i,o,c),a&&l&&n.index(o)==r.index(o)?(SC(a,l),SE(SN(a,e(i,n,r,s,o+1)),c)):(a&&SE(SN(a,SM(i,n,o+1)),c),SD(n,r,o,c),l&&SE(SN(l,SM(r,s,o+1)),c)),SD(s,null,o,c),new Sy(c)}(i,e,o,n,s))}{let e=i.parent,s=e.content;return SN(e,s.cut(0,i.parentOffset).append(r.content).append(s.cut(n.parentOffset)))}}(r,s,n,0)}nodeAt(e){for(let i=this;;){let{index:n,offset:r}=i.content.findIndex(e);if(!(i=i.maybeChild(n)))return null;if(r==e||i.isText)return i;e-=r+1}}childAfter(e){let{index:i,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(i),index:i,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:i,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(i),index:i,offset:n};let r=this.content.child(i-1);return{node:r,index:i-1,offset:n-r.nodeSize}}resolve(e){return SO.resolveCached(this,e)}resolveNoCache(e){return SO.resolve(this,e)}rangeHasMark(e,i,n){let r=!1;return i>e&&this.nodesBetween(e,i,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Sz(this.marks,e)}contentMatchAt(e){let i=this.type.contentMatch.matchFragment(this.content,0,e);if(!i)throw Error("Called contentMatchAt on a node with invalid content");return i}canReplace(e,i,n=Sy.empty,r=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,r,s),a=o&&o.matchFragment(this.content,i);if(!a||!a.validEnd)return!1;for(let e=r;e<s;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,i,n,r){if(r&&!this.type.allowsMarks(r))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,i);return!!o&&o.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Sw.none;for(let i=0;i<this.marks.length;i++){let n=this.marks[i];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Sw.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let i in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,i){let n;if(!i)throw RangeError("Invalid input for Node.fromJSON");if(i.marks){if(!Array.isArray(i.marks))throw RangeError("Invalid mark data for Node.fromJSON");n=i.marks.map(e.markFromJSON)}if("text"==i.type){if("string"!=typeof i.text)throw RangeError("Invalid text node in JSON");return e.text(i.text,n)}let r=Sy.fromJSON(e,i.content),s=e.nodeType(i.type).create(i.attrs,r,n);return s.type.checkAttrs(s.attrs),s}}SP.prototype.text=void 0;class SB extends SP{constructor(e,i,n,r){if(super(e,i,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Sz(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,i){return this.text.slice(e,i)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new SB(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new SB(this.type,this.attrs,e,this.marks)}cut(e=0,i=this.text.length){return 0==e&&i==this.text.length?this:this.withText(this.text.slice(e,i))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Sz(e,i){for(let n=e.length-1;n>=0;n--)i=e[n].type.name+"("+i+")";return i}class SF{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,i){var n;let r,s=new SH(e,i);if(null==s.next)return SF.empty;let o=function e(i){let n=[];do n.push(function(i){let n=[];do n.push(function(i){let n=function(i){if(i.eat("(")){let n=e(i);return i.eat(")")||i.err("Missing closing paren"),n}if(/\W/.test(i.next))i.err("Unexpected token '"+i.next+"'");else{let e=(function(e,i){let n=e.nodeTypes,r=n[i];if(r)return[r];let s=[];for(let e in n){let r=n[e];r.isInGroup(i)&&s.push(r)}return 0==s.length&&e.err("No node type or group '"+i+"' found"),s})(i,i.next).map(e=>(null==i.inline?i.inline=e.isInline:i.inline!=e.isInline&&i.err("Mixing inline and block content"),{type:"name",value:e}));return i.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(i);for(;;)if(i.eat("+"))n={type:"plus",expr:n};else if(i.eat("*"))n={type:"star",expr:n};else if(i.eat("?"))n={type:"opt",expr:n};else if(i.eat("{"))n=function(e,i){let n=SW(e),r=n;return e.eat(",")&&(r="}"!=e.next?SW(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:i}}(i,n);else break;return n}(i));while(i.next&&")"!=i.next&&"|"!=i.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(i));while(i.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(s);s.next&&s.err("Unexpected trailing text");let a=(n=function(e){let i=[[]];return s(function e(i,o){if("choice"==i.type)return i.exprs.reduce((i,n)=>i.concat(e(n,o)),[]);if("seq"==i.type)for(let r=0;;r++){let a=e(i.exprs[r],o);if(r==i.exprs.length-1)return a;s(a,o=n())}else if("star"==i.type){let a=n();return r(o,a),s(e(i.expr,a),a),[r(a)]}else if("plus"==i.type){let a=n();return s(e(i.expr,o),a),s(e(i.expr,a),a),[r(a)]}else if("opt"==i.type)return[r(o)].concat(e(i.expr,o));else if("range"==i.type){let a=o;for(let r=0;r<i.min;r++){let r=n();s(e(i.expr,a),r),a=r}if(-1==i.max)s(e(i.expr,a),a);else for(let o=i.min;o<i.max;o++){let o=n();r(a,o),s(e(i.expr,a),o),a=o}return[r(a)]}else if("name"==i.type)return[r(o,void 0,i.value)];else throw Error("Unknown expr type")}(e,0),n()),i;function n(){return i.push([])-1}function r(e,n,r){let s={term:r,to:n};return i[e].push(s),s}function s(e,i){e.forEach(e=>e.to=i)}}(o),r=Object.create(null),function e(i){let s=[];i.forEach(e=>{n[e].forEach(({term:e,to:i})=>{let r;if(e){for(let i=0;i<s.length;i++)s[i][0]==e&&(r=s[i][1]);SU(n,i).forEach(i=>{r||s.push([e,r=[]]),-1==r.indexOf(i)&&r.push(i)})}})});let o=r[i.join(",")]=new SF(i.indexOf(n.length-1)>-1);for(let i=0;i<s.length;i++){let n=s[i][1].sort(S$);o.next.push({type:s[i][0],next:r[n.join(",")]||e(n)})}return o}(SU(n,0)));return function(e,i){for(let n=0,r=[e];n<r.length;n++){let e=r[n],s=!e.validEnd,o=[];for(let i=0;i<e.next.length;i++){let{type:n,next:a}=e.next[i];o.push(n.name),s&&!(n.isText||n.hasRequiredAttrs())&&(s=!1),-1==r.indexOf(a)&&r.push(a)}s&&i.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(a,s),a}matchType(e){for(let i=0;i<this.next.length;i++)if(this.next[i].type==e)return this.next[i].next;return null}matchFragment(e,i=0,n=e.childCount){let r=this;for(let s=i;r&&s<n;s++)r=r.matchType(e.child(s).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:i}=this.next[e];if(!(i.isText||i.hasRequiredAttrs()))return i}return null}compatible(e){for(let i=0;i<this.next.length;i++)for(let n=0;n<e.next.length;n++)if(this.next[i].type==e.next[n].type)return!0;return!1}fillBefore(e,i=!1,n=0){let r=[this];return function s(o,a){let l=o.matchFragment(e,n);if(l&&(!i||l.validEnd))return Sy.from(a.map(e=>e.createAndFill()));for(let e=0;e<o.next.length;e++){let{type:i,next:n}=o.next[e];if(!(i.isText||i.hasRequiredAttrs())&&-1==r.indexOf(n)){r.push(n);let e=s(n,a.concat(i));if(e)return e}}return null}(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let i=this.computeWrapping(e);return this.wrapCache.push(e,i),i}computeWrapping(e){let i=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),s=r.match;if(s.matchType(e)){let e=[];for(let i=r;i.type;i=i.via)e.push(i.type);return e.reverse()}for(let e=0;e<s.next.length;e++){let{type:o,next:a}=s.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in i||r.type&&!a.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),i[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function i(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&i(n.next[r].next)}(this),e.map((i,n)=>{let r=n+(i.validEnd?"*":" ")+" ";for(let n=0;n<i.next.length;n++)r+=(n?", ":"")+i.next[n].type.name+"->"+e.indexOf(i.next[n].next);return r}).join("\n")}}SF.empty=new SF(!0);class SH{constructor(e,i){this.string=e,this.nodeTypes=i,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function SW(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let i=Number(e.next);return e.pos++,i}function S$(e,i){return i-e}function SU(e,i){let n=[];return function i(r){let s=e[r];if(1==s.length&&!s[0].term)return i(s[0].to);n.push(r);for(let e=0;e<s.length;e++){let{term:r,to:o}=s[e];r||-1!=n.indexOf(o)||i(o)}}(i),n.sort(S$)}function SV(e){let i=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;i[n]=r.default}return i}function Sq(e,i){let n=Object.create(null);for(let r in e){let s=i&&i[r];if(void 0===s){let i=e[r];if(i.hasDefault)s=i.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function SK(e,i,n,r){for(let r in i)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(i[n])}}function SY(e,i){let n=Object.create(null);if(i)for(let r in i)n[r]=new SJ(e,r,i[r]);return n}class SX{constructor(e,i,n){this.name=e,this.schema=i,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=SY(e,n.attrs),this.defaultAttrs=SV(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==SF.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Sq(this.attrs,e)}create(e=null,i,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new SP(this,this.computeAttrs(e),Sy.from(i),Sw.setFrom(n))}createChecked(e=null,i,n){return i=Sy.from(i),this.checkContent(i),new SP(this,this.computeAttrs(e),i,Sw.setFrom(n))}createAndFill(e=null,i,n){if(e=this.computeAttrs(e),(i=Sy.from(i)).size){let e=this.contentMatch.fillBefore(i);if(!e)return null;i=e.append(i)}let r=this.contentMatch.matchFragment(i),s=r&&r.fillBefore(Sy.empty,!0);return s?new SP(this,e,i.append(s),Sw.setFrom(n)):null}validContent(e){let i=this.contentMatch.matchFragment(e);if(!i||!i.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){SK(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let i=0;i<e.length;i++)if(!this.allowsMarkType(e[i].type))return!1;return!0}allowedMarks(e){let i;if(null==this.markSet)return e;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?i&&i.push(e[n]):i||(i=e.slice(0,n));return i?i.length?i:Sw.none:e}static compile(e,i){let n=Object.create(null);e.forEach((e,r)=>n[e]=new SX(e,i,r));let r=i.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class SJ{constructor(e,i,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,i,n){let r=n.split("|");return n=>{let s=null===n?"null":typeof n;if(0>r.indexOf(s))throw RangeError(`Expected value of type ${r} for attribute ${i} on type ${e}, got ${s}`)}}(e,i,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class SG{constructor(e,i,n,r){this.name=e,this.rank=i,this.schema=n,this.spec=r,this.attrs=SY(e,r.attrs),this.excluded=null;let s=SV(this.attrs);this.instance=s?new Sw(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Sw(this,Sq(this.attrs,e))}static compile(e,i){let n=Object.create(null),r=0;return e.forEach((e,s)=>n[e]=new SG(e,r++,i,s)),n}removeFromSet(e){for(var i=0;i<e.length;i++)e[i].type==this&&(e=e.slice(0,i).concat(e.slice(i+1)),i--);return e}isInSet(e){for(let i=0;i<e.length;i++)if(e[i].type==this)return e[i]}checkAttrs(e){SK(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class SZ{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let i=this.spec={};for(let n in e)i[n]=e[n];i.nodes=Sv.from(e.nodes),i.marks=Sv.from(e.marks||{}),this.nodes=SX.compile(this.spec.nodes,this),this.marks=SG.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let i=this.nodes[e],r=i.spec.content||"",s=i.spec.marks;if(i.contentMatch=n[r]||(n[r]=SF.parse(r,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet="_"==s?null:s?SQ(this,s.split(" ")):""!=s&&i.inlineContent?null:[]}for(let e in this.marks){let i=this.marks[e],n=i.spec.excludes;i.excluded=null==n?[i]:""==n?[]:SQ(this,n.split(" "))}this.nodeFromJSON=e=>SP.fromJSON(this,e),this.markFromJSON=e=>Sw.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,i=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof SX){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(i,n,r)}text(e,i){let n=this.nodes.text;return new SB(n,n.defaultAttrs,e,Sw.setFrom(i))}mark(e,i){return"string"==typeof e&&(e=this.marks[e]),e.create(i)}nodeType(e){let i=this.nodes[e];if(!i)throw RangeError("Unknown node type: "+e);return i}}function SQ(e,i){let n=[];for(let r=0;r<i.length;r++){let s=i[r],o=e.marks[s],a=o;if(o)n.push(o);else for(let i in e.marks){let r=e.marks[i];("_"==s||r.spec.group&&r.spec.group.split(" ").indexOf(s)>-1)&&n.push(a=r)}if(!a)throw SyntaxError("Unknown mark type: '"+i[r]+"'")}return n}class S0{constructor(e,i){this.schema=e,this.rules=i,this.tags=[],this.styles=[];let n=this.matchedStyles=[];i.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let i=/[^=]*/.exec(e.style)[0];0>n.indexOf(i)&&n.push(i),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let n=e.nodes[i.node];return n.contentMatch.matchType(n)})}parse(e,i={}){let n=new S6(this,i,!1);return n.addAll(e,Sw.none,i.from,i.to),n.finish()}parseSlice(e,i={}){let n=new S6(this,i,!0);return n.addAll(e,Sw.none,i.from,i.to),Sk.maxOpen(n.finish())}matchTag(e,i,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r,s;let n=this.tags[o];if(r=e,s=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,s)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||i.matchesContext(n.context))){if(n.getAttrs){let i=n.getAttrs(e);if(!1===i)continue;n.attrs=i||void 0}return n}}}matchStyle(e,i,n,r){for(let s=r?this.styles.indexOf(r)+1:0;s<this.styles.length;s++){let r=this.styles[s],o=r.style;if(0==o.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(o.length>e.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==i)){if(r.getAttrs){let e=r.getAttrs(i);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let i=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<i.length;r++){let e=i[r];if((null==e.priority?50:e.priority)<n)break}i.splice(r,0,e)}for(let i in e.marks){let r=e.marks[i].spec.parseDOM;r&&r.forEach(e=>{n(e=S8(e)),e.mark||e.ignore||e.clearMark||(e.mark=i)})}for(let i in e.nodes){let r=e.nodes[i].spec.parseDOM;r&&r.forEach(e=>{n(e=S8(e)),e.node||e.ignore||e.mark||(e.node=i)})}return i}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new S0(e,S0.schemaRules(e)))}}let S1={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},S2={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},S5={ol:!0,ul:!0};function S3(e,i,n){return null!=i?!!i|2*("full"===i):e&&"pre"==e.whitespace?3:-5&n}class S4{constructor(e,i,n,r,s,o){this.type=e,this.attrs=i,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=Sw.none,this.match=s||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let i=this.type.contentMatch.fillBefore(Sy.from(e));if(i)this.match=this.type.contentMatch.matchFragment(i);else{let i=this.type.contentMatch,n;return(n=i.findWrapping(e.type))?(this.match=i,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],i;e&&e.isText&&(i=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-i[0].length)))}let i=Sy.from(this.content);return!e&&this.match&&(i=i.append(this.match.fillBefore(Sy.empty,!0))),this.type?this.type.create(this.attrs,i,this.marks):i}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!S1.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class S6{constructor(e,i,n){this.parser=e,this.options=i,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=i.topNode,s,o=S3(null,i.preserveWhitespace,0)|4*!!n;s=r?new S4(r.type,r.attrs,Sw.none,!0,i.topMatch||r.type.contentMatch,o):n?new S4(null,null,Sw.none,!0,null,o):new S4(e.schema.topNodeType,null,Sw.none,!0,null,o),this.nodes=[s],this.find=i.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,i){3==e.nodeType?this.addTextNode(e,i):1==e.nodeType&&this.addElement(e,i)}addTextNode(e,i){let n=e.nodeValue,r=this.top,s=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===s||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)if("full"===s)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),i,!0),e[n]&&this.insertNode(o.text(e[n]),i,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],s=e.previousSibling;(!i||s&&"BR"==s.nodeName||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),i,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,i,n){let r=this.localPreserveWS,s=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;S5.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let i=e.firstChild,n=null;i;i=i.nextSibling){let e=1==i.nodeType?i.nodeName.toLowerCase():null;e&&S5.hasOwnProperty(e)&&n?(n.appendChild(i),i=n):"li"==e?n=i:e&&(n=null)}}(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,n));e:if(l?l.ignore:S2.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,i);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let n,r=this.needsBlock;if(S1.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),n=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,i);break e}let a=l&&l.skip?i:this.readStyles(e,i);a&&this.addAll(e,a),n&&this.sync(s),this.needsBlock=r}else{let n=this.readStyles(e,i);n&&this.addElementByRule(e,l,n,!1===l.consuming?a:void 0)}this.localPreserveWS=r}leafFallback(e,i){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),i)}ignoreFallback(e,i){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),i,!0)}readStyles(e,i){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],s=n.getPropertyValue(r);if(s)for(let e;;){let n=this.parser.matchStyle(r,s,this,e);if(!n)break;if(n.ignore)return null;if(i=n.clearMark?i.filter(e=>!n.clearMark(e)):i.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)e=n;else break}}return i}addElementByRule(e,i,n,r){let s,o;if(i.node)if((o=this.parser.schema.nodes[i.node]).isLeaf)this.insertNode(o.create(i.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,i.attrs||null,n,i.preserveWhitespace);e&&(s=!0,n=e)}else{let e=this.parser.schema.marks[i.mark];n=n.concat(e.create(i.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(i.getContent)this.findInside(e),i.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof i.contentElement?r=e.querySelector(i.contentElement):"function"==typeof i.contentElement?r=i.contentElement(e):i.contentElement&&(r=i.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}s&&this.sync(a)&&this.open--}addAll(e,i,n,r){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,a=null==r?null:e.childNodes[r];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,i);this.findAtPoint(e,s)}findPlace(e,i,n){let r,s;for(let i=this.open,o=0;i>=0;i--){let a=this.nodes[i],l=a.findWrapping(e);if(l&&(!r||r.length>l.length+o)&&(r=l,s=a,!l.length))break;if(a.solid){if(n)break;o+=2}}if(!r)return null;this.sync(s);for(let e=0;e<r.length;e++)i=this.enterInner(r[e],null,i,!1);return i}insertNode(e,i,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(i=this.enterInner(e,null,i))}let r=this.findPlace(e,i,n);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let n=Sw.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):S9(s.type,e.type))&&(n=s.addToSet(n));return i.content.push(e.mark(n)),!0}return!1}enter(e,i,n,r){let s=this.findPlace(e.create(i),n,!1);return s&&(s=this.enterInner(e,i,n,!0,r)),s}enterInner(e,i,n,r=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=S3(e,s,o.options);4&o.options&&0==o.content.length&&(a|=4);let l=Sw.none;return n=n.filter(i=>(o.type?!o.type.allowsMarkType(i.type):!S9(i.type,e))||(l=i.addToSet(l),!1)),this.nodes.push(new S4(e,i,l,r,null,a)),this.open++,n}closeExtra(e=!1){let i=this.nodes.length-1;if(i>this.open){for(;i>this.open;i--)this.nodes[i-1].content.push(this.nodes[i].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let i=this.open;i>=0;i--)if(this.nodes[i]==e)return this.open=i,!0;else this.localPreserveWS&&(this.nodes[i].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let i=this.open;i>=0;i--){let n=this.nodes[i].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;i&&e++}return e}findAtPoint(e,i){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==i&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let i=0;i<this.find.length;i++)null==this.find[i].pos&&1==e.nodeType&&e.contains(this.find[i].node)&&(this.find[i].pos=this.currentPos)}findAround(e,i,n){if(e!=i&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&i.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&(this.find[i].pos=this.currentPos-(e.nodeValue.length-this.find[i].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let i=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+ +!r,o=(e,a)=>{for(;e>=0;e--){let l=i[e];if(""==l){if(e==i.length-1||0==e)continue;for(;a>=s;a--)if(o(e-1,a))return!0;return!1}{let e=a>0||0==a&&r?this.nodes[a].type:n&&a>=s?n.node(a-s).type:null;if(!e||e.name!=l&&!e.isInGroup(l))return!1;a--}}return!0};return o(i.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let i=e.depth;i>=0;i--){let n=e.node(i).contentMatchAt(e.indexAfter(i)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let i=this.parser.schema.nodes[e];if(i.isTextblock&&i.defaultAttrs)return i}}}function S8(e){let i={};for(let n in e)i[n]=e[n];return i}function S9(e,i){let n=i.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(e))continue;let o=[],a=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:s}=e.edge(n);if(r==i||0>o.indexOf(s)&&a(s))return!0}};if(a(s.contentMatch))return!0}}class S7{constructor(e,i){this.nodes=e,this.marks=i}serializeFragment(e,i={},n){n||(n=kt(i).createDocumentFragment());let r=n,s=[];return e.forEach(e=>{if(s.length||e.marks.length){let n=0,o=0;for(;n<s.length&&o<e.marks.length;){let i=e.marks[o];if(!this.marks[i.type.name]){o++;continue}if(!i.eq(s[n][0])||!1===i.type.spec.spanning)break;n++,o++}for(;n<s.length;)r=s.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],a=this.serializeMark(n,e.isInline,i);a&&(s.push([n,r]),r.appendChild(a.dom),r=a.contentDOM||a.dom)}}r.appendChild(this.serializeNodeInner(e,i))}),n}serializeNodeInner(e,i){let{dom:n,contentDOM:r}=kn(kt(i),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,i,r)}return n}serializeNode(e,i={}){let n=this.serializeNodeInner(e,i);for(let r=e.marks.length-1;r>=0;r--){let s=this.serializeMark(e.marks[r],e.isInline,i);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,i,n={}){let r=this.marks[e.type.name];return r&&kn(kt(n),r(e,i),null,e.attrs)}static renderSpec(e,i,n=null,r){return kn(e,i,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new S7(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let i=ke(e.nodes);return i.text||(i.text=e=>e.text),i}static marksFromSchema(e){return ke(e.marks)}}function ke(e){let i={};for(let n in e){let r=e[n].spec.toDOM;r&&(i[n]=r)}return i}function kt(e){return e.document||window.document}let ki=new WeakMap;function kn(e,i,n,r){let s,o,a;if("string"==typeof i)return{dom:e.createTextNode(i)};if(null!=i.nodeType)return{dom:i};if(i.dom&&null!=i.dom.nodeType)return i;let l=i[0],c;if("string"!=typeof l)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=ki.get(r))&&ki.set(r,(a=null,!function e(i){if(i&&"object"==typeof i)if(Array.isArray(i))if("string"==typeof i[0])a||(a=[]),a.push(i);else for(let n=0;n<i.length;n++)e(i[n]);else for(let n in i)e(i[n])}(r),o=a)),c=o)&&c.indexOf(i)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let d=l.indexOf(" ");d>0&&(n=l.slice(0,d),l=l.slice(d+1));let h=n?e.createElementNS(n,l):e.createElement(l),u=i[1],p=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){for(let e in p=2,u)if(null!=u[e]){let i=e.indexOf(" ");i>0?h.setAttributeNS(e.slice(0,i),e.slice(i+1),u[e]):"style"==e&&h.style?h.style.cssText=u[e]:h.setAttribute(e,u[e])}}for(let o=p;o<i.length;o++){let a=i[o];if(0===a){if(o<i.length-1||o>p)throw RangeError("Content hole must be the only child of its parent node");return{dom:h,contentDOM:h}}{let{dom:i,contentDOM:o}=kn(e,a,n,r);if(h.appendChild(i),o){if(s)throw RangeError("Multiple content holes");s=o}}}return{dom:h,contentDOM:s}}class kr{constructor(e,i,n){this.pos=e,this.delInfo=i,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class ks{constructor(e,i=!1){if(this.ranges=e,this.inverted=i,!e.length&&ks.empty)return ks.empty}recover(e){let i=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)i+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+i+(e-(65535&e))/65536}mapResult(e,i=1){return this._map(e,i,!1)}map(e,i=1){return this._map(e,i,!0)}_map(e,i,n){let r=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],d=this.ranges[a+o],h=l+c;if(e<=h){let s=c?e==l?-1:e==h?1:i:i,o=l+r+(s<0?0:d);if(n)return o;let u=e==(i<0?l:h)?null:a/3+(e-l)*65536,p=e==l?2:e==h?1:4;return(i<0?e!=l:e!=h)&&(p|=8),new kr(o,p,u)}r+=d-c}return n?e+r:new kr(e+r,0,null)}touches(e,i){let n=0,r=65535&i,s=this.inverted?2:1,o=this.inverted?1:2;for(let i=0;i<this.ranges.length;i+=3){let a=this.ranges[i]-(this.inverted?n:0);if(a>e)break;let l=this.ranges[i+s];if(e<=a+l&&i==3*r)return!0;n+=this.ranges[i+o]-l}return!1}forEach(e){let i=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,s=0;r<this.ranges.length;r+=3){let o=this.ranges[r],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[r+i],d=this.ranges[r+n];e(a,a+c,l,l+d),s+=d-c}}invert(){return new ks(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?ks.empty:new ks(e<0?[0,-e,0]:[0,0,e])}}ks.empty=new ks([]);class ko{constructor(e,i,n=0,r=e?e.length:0){this.mirror=i,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||i)}get maps(){return this._maps}slice(e=0,i=this.maps.length){return new ko(this._maps,this.mirror,e,i)}appendMap(e,i){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=i&&this.setMirror(this._maps.length-1,i)}appendMapping(e){for(let i=0,n=this._maps.length;i<e._maps.length;i++){let r=e.getMirror(i);this.appendMap(e._maps[i],null!=r&&r<i?n+r:void 0)}}getMirror(e){if(this.mirror){for(let i=0;i<this.mirror.length;i++)if(this.mirror[i]==e)return this.mirror[i+(i%2?-1:1)]}}setMirror(e,i){this.mirror||(this.mirror=[]),this.mirror.push(e,i)}appendMappingInverted(e){for(let i=e.maps.length-1,n=this._maps.length+e._maps.length;i>=0;i--){let r=e.getMirror(i);this.appendMap(e._maps[i].invert(),null!=r&&r>i?n-r-1:void 0)}}invert(){let e=new ko;return e.appendMappingInverted(this),e}map(e,i=1){if(this.mirror)return this._map(e,i,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,i);return e}mapResult(e,i=1){return this._map(e,i,!1)}_map(e,i,n){let r=0;for(let n=this.from;n<this.to;n++){let s=this._maps[n].mapResult(e,i);if(null!=s.recover){let i=this.getMirror(n);if(null!=i&&i>n&&i<this.to){n=i,e=this._maps[i].recover(s.recover);continue}}r|=s.delInfo,e=s.pos}return n?e:new kr(e,r,null)}}let ka=Object.create(null);class kl{getMap(){return ks.empty}merge(e){return null}static fromJSON(e,i){if(!i||!i.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=ka[i.stepType];if(!n)throw RangeError(`No step type ${i.stepType} defined`);return n.fromJSON(e,i)}static jsonID(e,i){if(e in ka)throw RangeError("Duplicate use of step JSON ID "+e);return ka[e]=i,i.prototype.jsonID=e,i}}class kc{constructor(e,i){this.doc=e,this.failed=i}static ok(e){return new kc(e,null)}static fail(e){return new kc(null,e)}static fromReplace(e,i,n,r){try{return kc.ok(e.replace(i,n,r))}catch(e){if(e instanceof SS)return kc.fail(e.message);throw e}}}function kd(e,i,n){let r=[];for(let s=0;s<e.childCount;s++){let o=e.child(s);o.content.size&&(o=o.copy(kd(o.content,i,o))),o.isInline&&(o=i(o,n,s)),r.push(o)}return Sy.fromArray(r)}class kh extends kl{constructor(e,i,n){super(),this.from=e,this.to=i,this.mark=n}apply(e){let i=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),s=new Sk(kd(i.content,(e,i)=>e.isAtom&&i.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),i.openStart,i.openEnd);return kc.fromReplace(e,this.from,this.to,s)}invert(){return new ku(this.from,this.to,this.mark)}map(e){let i=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return i.deleted&&n.deleted||i.pos>=n.pos?null:new kh(i.pos,n.pos,this.mark)}merge(e){return e instanceof kh&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kh(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,i){if("number"!=typeof i.from||"number"!=typeof i.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new kh(i.from,i.to,e.markFromJSON(i.mark))}}kl.jsonID("addMark",kh);class ku extends kl{constructor(e,i,n){super(),this.from=e,this.to=i,this.mark=n}apply(e){let i=e.slice(this.from,this.to),n=new Sk(kd(i.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),i.openStart,i.openEnd);return kc.fromReplace(e,this.from,this.to,n)}invert(){return new kh(this.from,this.to,this.mark)}map(e){let i=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return i.deleted&&n.deleted||i.pos>=n.pos?null:new ku(i.pos,n.pos,this.mark)}merge(e){return e instanceof ku&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ku(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,i){if("number"!=typeof i.from||"number"!=typeof i.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ku(i.from,i.to,e.markFromJSON(i.mark))}}kl.jsonID("removeMark",ku);class kp extends kl{constructor(e,i){super(),this.pos=e,this.mark=i}apply(e){let i=e.nodeAt(this.pos);if(!i)return kc.fail("No node at mark step's position");let n=i.type.create(i.attrs,null,this.mark.addToSet(i.marks));return kc.fromReplace(e,this.pos,this.pos+1,new Sk(Sy.from(n),0,+!i.isLeaf))}invert(e){let i=e.nodeAt(this.pos);if(i){let e=this.mark.addToSet(i.marks);if(e.length==i.marks.length){for(let n=0;n<i.marks.length;n++)if(!i.marks[n].isInSet(e))return new kp(this.pos,i.marks[n]);return new kp(this.pos,this.mark)}}return new kf(this.pos,this.mark)}map(e){let i=e.mapResult(this.pos,1);return i.deletedAfter?null:new kp(i.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,i){if("number"!=typeof i.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new kp(i.pos,e.markFromJSON(i.mark))}}kl.jsonID("addNodeMark",kp);class kf extends kl{constructor(e,i){super(),this.pos=e,this.mark=i}apply(e){let i=e.nodeAt(this.pos);if(!i)return kc.fail("No node at mark step's position");let n=i.type.create(i.attrs,null,this.mark.removeFromSet(i.marks));return kc.fromReplace(e,this.pos,this.pos+1,new Sk(Sy.from(n),0,+!i.isLeaf))}invert(e){let i=e.nodeAt(this.pos);return i&&this.mark.isInSet(i.marks)?new kp(this.pos,this.mark):this}map(e){let i=e.mapResult(this.pos,1);return i.deletedAfter?null:new kf(i.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,i){if("number"!=typeof i.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new kf(i.pos,e.markFromJSON(i.mark))}}kl.jsonID("removeNodeMark",kf);class km extends kl{constructor(e,i,n,r=!1){super(),this.from=e,this.to=i,this.slice=n,this.structure=r}apply(e){return this.structure&&kv(e,this.from,this.to)?kc.fail("Structure replace would overwrite content"):kc.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ks([this.from,this.to-this.from,this.slice.size])}invert(e){return new km(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let i=e.mapResult(this.to,-1),n=this.from==this.to&&km.MAP_BIAS<0?i:e.mapResult(this.from,1);return n.deletedAcross&&i.deletedAcross?null:new km(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof km)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let i=this.slice.size+e.slice.size==0?Sk.empty:new Sk(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new km(e.from,this.to,i,this.structure)}{let i=this.slice.size+e.slice.size==0?Sk.empty:new Sk(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new km(this.from,this.to+(e.to-e.from),i,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,i){if("number"!=typeof i.from||"number"!=typeof i.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new km(i.from,i.to,Sk.fromJSON(e,i.slice),!!i.structure)}}km.MAP_BIAS=1,kl.jsonID("replace",km);class kg extends kl{constructor(e,i,n,r,s,o,a=!1){super(),this.from=e,this.to=i,this.gapFrom=n,this.gapTo=r,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(kv(e,this.from,this.gapFrom)||kv(e,this.gapTo,this.to)))return kc.fail("Structure gap-replace would overwrite content");let i=e.slice(this.gapFrom,this.gapTo);if(i.openStart||i.openEnd)return kc.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,i.content);return n?kc.fromReplace(e,this.from,this.to,n):kc.fail("Content does not fit in gap")}getMap(){return new ks([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let i=this.gapTo-this.gapFrom;return new kg(this.from,this.from+this.slice.size+i,this.from+this.insert,this.from+this.insert+i,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let i=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?i.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return i.deletedAcross&&n.deletedAcross||r<i.pos||s>n.pos?null:new kg(i.pos,n.pos,r,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,i){if("number"!=typeof i.from||"number"!=typeof i.to||"number"!=typeof i.gapFrom||"number"!=typeof i.gapTo||"number"!=typeof i.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new kg(i.from,i.to,i.gapFrom,i.gapTo,Sk.fromJSON(e,i.slice),i.insert,!!i.structure)}}function kv(e,i,n){let r=e.resolve(i),s=n-i,o=r.depth;for(;s>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,s--;if(s>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;s>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,s--}}return!1}function ky(e,i,n,r=n.contentMatch,s=!0){let o=e.doc.nodeAt(i),a=[],l=i+1;for(let i=0;i<o.childCount;i++){let c=o.child(i),d=l+c.nodeSize,h=r.matchType(c.type);if(h){r=h;for(let i=0;i<c.marks.length;i++)n.allowsMarkType(c.marks[i].type)||e.step(new ku(l,d,c.marks[i]));if(s&&c.isText&&"pre"!=n.whitespace){let e,i=/\r?\n|\r/g,r;for(;e=i.exec(c.text);)r||(r=new Sk(Sy.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),a.push(new km(l+e.index,l+e.index+e[0].length,r))}}else a.push(new km(l,d,Sk.empty));l=d}if(!r.validEnd){let i=r.fillBefore(Sy.empty,!0);e.replace(l,l,new Sk(i,0,0))}for(let i=a.length-1;i>=0;i--)e.step(a[i])}function k_(e){let i=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,s=0;;--n){let o=e.$from.node(n),a=e.$from.index(n)+r,l=e.$to.indexAfter(n)-s;if(n<e.depth&&o.canReplace(a,l,i))return n;if(0==n||o.type.spec.isolating||!((0==a||o.canReplace(a,o.childCount))&&(l==o.childCount||o.canReplace(0,l))))break;a&&(r=1),l<o.childCount&&(s=1)}return null}function kx(e,i,n=null,r=e){let s=function(e,i){let{parent:n,startIndex:r,endIndex:s}=e,o=n.contentMatchAt(r).findWrapping(i);if(!o)return null;let a=o.length?o[0]:i;return n.canReplaceWith(r,s,a)?o:null}(e,i),o=s&&function(e,i){let{parent:n,startIndex:r,endIndex:s}=e,o=n.child(r),a=i.contentMatch.findWrapping(o.type);if(!a)return null;let l=(a.length?a[a.length-1]:i).contentMatch;for(let e=r;l&&e<s;e++)l=l.matchType(n.child(e).type);return l&&l.validEnd?a:null}(r,i);return o?s.map(kb).concat({type:i,attrs:n}).concat(o.map(kb)):null}function kb(e){return{type:e,attrs:null}}function kw(e,i,n,r){i.forEach((s,o)=>{if(s.isText){let a,l=/\r?\n|\r/g;for(;a=l.exec(s.text);){let s=e.mapping.slice(r).map(n+1+o+a.index);e.replaceWith(s,s+1,i.type.schema.linebreakReplacement.create())}}})}function kS(e,i,n,r){i.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let s=e.mapping.slice(r).map(n+1+o);e.replaceWith(s,s+1,i.type.schema.text("\n"))}})}function kk(e,i,n=1,r){let s=e.resolve(i),o=s.depth-n,a=r&&r[r.length-1]||s.parent;if(o<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!a.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let e=s.depth-1,i=n-2;e>o;e--,i--){let n=s.node(e),o=s.index(e);if(n.type.spec.isolating)return!1;let a=n.content.cutByIndex(o,n.childCount),l=r&&r[i+1];l&&(a=a.replaceChild(0,l.type.create(l.attrs)));let c=r&&r[i]||n;if(!n.canReplace(o+1,n.childCount)||!c.type.validContent(a))return!1}let l=s.indexAfter(o),c=r&&r[0];return s.node(o).canReplaceWith(l,l,c?c.type:s.node(o+1).type)}function kC(e,i){let n=e.resolve(i),r=n.index();return kT(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function kT(e,i){return!!(e&&i&&!e.isLeaf&&function(e,i){i.content.size||e.type.compatibleContent(i.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let s=0;s<i.childCount;s++){let o=i.child(s),a=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(a))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,i))}function kE(e,i,n=-1){let r=e.resolve(i);for(let e=r.depth;;e--){let s,o,a=r.index(e);if(e==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(e+1),a++,o=r.node(e).maybeChild(a)):(s=r.node(e).maybeChild(a-1),o=r.node(e+1)),s&&!s.isTextblock&&kT(s,o)&&r.node(e).canReplace(a,a+1))return i;if(0==e)break;i=n<0?r.before(e):r.after(e)}}function kD(e,i,n){let r=e.resolve(i);if(!n.content.size)return i;let s=n.content;for(let e=0;e<n.openStart;e++)s=s.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let i=r.depth;i>=0;i--){let n=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,o=r.index(i)+ +(n>0),a=r.node(i),l=!1;if(1==e)l=a.canReplace(o,o,s);else{let e=a.contentMatchAt(o).findWrapping(s.firstChild.type);l=e&&a.canReplaceWith(o,o,e[0])}if(l)return 0==n?r.pos:n<0?r.before(i+1):r.after(i+1)}return null}function kN(e,i,n=i,r=Sk.empty){if(i==n&&!r.size)return null;let s=e.resolve(i),o=e.resolve(n);return kM(s,o,r)?new km(i,n,r):new kO(s,o,r).fit()}function kM(e,i,n){return!n.openStart&&!n.openEnd&&e.start()==i.start()&&e.parent.canReplace(e.index(),i.index(),n.content)}kl.jsonID("replaceAround",kg);class kO{constructor(e,i,n){this.$from=e,this.$to=i,this.unplaced=n,this.frontier=[],this.placed=Sy.empty;for(let i=0;i<=e.depth;i++){let n=e.node(i);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=Sy.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),i=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let s=this.placed,o=n.depth,a=r.depth;for(;o&&a&&1==s.childCount;)s=s.firstChild.content,o--,a--;let l=new Sk(s,o,a);return e>-1?new kg(n.pos,e,this.$to.pos,this.$to.end(),l,i):l.size||n.pos!=this.$to.pos?new km(n.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let i=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let s=i.firstChild;if(i.childCount>1&&(r=0),s.type.spec.isolating&&r<=n){e=n;break}i=s.content}for(let i=1;i<=2;i++)for(let n=1==i?e:this.unplaced.openStart;n>=0;n--){let e=null,r=(n?(e=kL(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let s=this.depth;s>=0;s--){let{type:o,match:a}=this.frontier[s],l,c=null;if(1==i&&(r?a.matchType(r.type)||(c=a.fillBefore(Sy.from(r),!1)):e&&o.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:s,parent:e,inject:c};if(2==i&&r&&(l=a.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:s,parent:e,wrap:l};if(e&&a.matchType(e.type))break}}}openMore(){let{content:e,openStart:i,openEnd:n}=this.unplaced,r=kL(e,i);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new Sk(e,i+1,Math.max(n,r.size+i>=e.size-n?i+1:0)),!0)}dropNode(){let{content:e,openStart:i,openEnd:n}=this.unplaced,r=kL(e,i);if(r.childCount<=1&&i>0){let s=e.size-i<=i+r.size;this.unplaced=new Sk(kR(e,i-1,1),i-1,s?i-1:n)}else this.unplaced=new Sk(kR(e,i,1),i,n)}placeNodes({sliceDepth:e,frontierDepth:i,parent:n,inject:r,wrap:s}){for(;this.depth>i;)this.closeFrontierNode();if(s)for(let e=0;e<s.length;e++)this.openFrontierNode(s[e]);let o=this.unplaced,a=n?n.content:o.content,l=o.openStart-e,c=0,d=[],{match:h,type:u}=this.frontier[i];if(r){for(let e=0;e<r.childCount;e++)d.push(r.child(e));h=h.matchFragment(r)}let p=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let e=a.child(c),i=h.matchType(e.type);if(!i)break;(++c>1||0==l||e.content.size)&&(h=i,d.push(function e(i,n,r){if(n<=0)return i;let s=i.content;return n>1&&(s=s.replaceChild(0,e(s.firstChild,n-1,1==s.childCount?r-1:0))),n>0&&(s=i.type.contentMatch.fillBefore(s).append(s),r<=0&&(s=s.append(i.type.contentMatch.matchFragment(s).fillBefore(Sy.empty,!0)))),i.copy(s)}(e.mark(u.allowedMarks(e.marks)),1==c?l:0,c==a.childCount?p:-1)))}let f=c==a.childCount;f||(p=-1),this.placed=kA(this.placed,i,Sy.from(d)),this.frontier[i].match=h,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,i=a;e<p;e++){let e=i.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),i=e.content}this.unplaced=f?0==e?Sk.empty:new Sk(kR(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new Sk(kR(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],i;if(!e.type.isTextblock||!kj(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(i=this.findCloseLevel(this.$to))&&i.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){t:for(let i=Math.min(this.depth,e.depth);i>=0;i--){let{match:n,type:r}=this.frontier[i],s=i<e.depth&&e.end(i+1)==e.pos+(e.depth-(i+1)),o=kj(e,i,r,n,s);if(o){for(let n=i-1;n>=0;n--){let{match:i,type:r}=this.frontier[n],s=kj(e,n,r,i,!0);if(!s||s.childCount)continue t}return{depth:i,fit:o,move:s?e.doc.resolve(e.after(i+1)):e}}}}close(e){let i=this.findCloseLevel(e);if(!i)return null;for(;this.depth>i.depth;)this.closeFrontierNode();i.fit.childCount&&(this.placed=kA(this.placed,i.depth,i.fit)),e=i.move;for(let n=i.depth+1;n<=e.depth;n++){let i=e.node(n),r=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,r)}return e}openFrontierNode(e,i=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=kA(this.placed,this.depth,Sy.from(e.create(i,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Sy.empty,!0);e.childCount&&(this.placed=kA(this.placed,this.frontier.length,e))}}function kR(e,i,n){return 0==i?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(kR(e.firstChild.content,i-1,n)))}function kA(e,i,n){return 0==i?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(kA(e.lastChild.content,i-1,n)))}function kL(e,i){for(let n=0;n<i;n++)e=e.firstChild.content;return e}function kj(e,i,n,r,s){let o=e.node(i),a=s?e.indexAfter(i):e.index(i);if(a==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,a);return l&&!function(e,i,n){for(let r=n;r<i.childCount;r++)if(!e.allowsMarks(i.child(r).marks))return!0;return!1}(n,o.content,a)?l:null}function kI(e,i){let n=[],r=Math.min(e.depth,i.depth);for(let s=r;s>=0;s--){let r=e.start(s);if(r<e.pos-(e.depth-s)||i.end(s)>i.pos+(i.depth-s)||e.node(s).type.spec.isolating||i.node(s).type.spec.isolating)break;(r==i.start(s)||s==e.depth&&s==i.depth&&e.parent.inlineContent&&i.parent.inlineContent&&s&&i.start(s-1)==r-1)&&n.push(s)}return n}class kP extends kl{constructor(e,i,n){super(),this.pos=e,this.attr=i,this.value=n}apply(e){let i=e.nodeAt(this.pos);if(!i)return kc.fail("No node at attribute step's position");let n=Object.create(null);for(let e in i.attrs)n[e]=i.attrs[e];n[this.attr]=this.value;let r=i.type.create(n,null,i.marks);return kc.fromReplace(e,this.pos,this.pos+1,new Sk(Sy.from(r),0,+!i.isLeaf))}getMap(){return ks.empty}invert(e){return new kP(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let i=e.mapResult(this.pos,1);return i.deletedAfter?null:new kP(i.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,i){if("number"!=typeof i.pos||"string"!=typeof i.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new kP(i.pos,i.attr,i.value)}}kl.jsonID("attr",kP);class kB extends kl{constructor(e,i){super(),this.attr=e,this.value=i}apply(e){let i=Object.create(null);for(let n in e.attrs)i[n]=e.attrs[n];i[this.attr]=this.value;let n=e.type.create(i,e.content,e.marks);return kc.ok(n)}getMap(){return ks.empty}invert(e){return new kB(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,i){if("string"!=typeof i.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new kB(i.attr,i.value)}}kl.jsonID("docAttr",kB);let kz=class extends Error{};(kz=function e(i){let n=Error.call(this,i);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),kz.prototype.constructor=kz,kz.prototype.name="TransformError";class kF{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ko}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let i=this.maybeStep(e);if(i.failed)throw new kz(i.failed);return this}maybeStep(e){let i=e.apply(this.doc);return i.failed||this.addStep(e,i.doc),i}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,i=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),i=r.map(i,-1)),r.forEach((n,r,s,o)=>{e=Math.min(e,s),i=Math.max(i,o)})}return 1e9==e?null:{from:e,to:i}}addStep(e,i){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=i}replace(e,i=e,n=Sk.empty){let r=kN(this.doc,e,i,n);return r&&this.step(r),this}replaceWith(e,i,n){return this.replace(e,i,new Sk(Sy.from(n),0,0))}delete(e,i){return this.replace(e,i,Sk.empty)}insert(e,i){return this.replaceWith(e,e,i)}replaceRange(e,i,n){return!function(e,i,n,r){if(!r.size)return e.deleteRange(i,n);let s=e.doc.resolve(i),o=e.doc.resolve(n);if(kM(s,o,r))return e.step(new km(i,n,r));let a=kI(s,o);0==a[a.length-1]&&a.pop();let l=-(s.depth+1);a.unshift(l);for(let e=s.depth,i=s.pos-1;e>0;e--,i--){let n=s.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(e)>-1?l=e:s.before(e)==i&&a.splice(1,0,-e)}let c=a.indexOf(l),d=[],h=r.openStart;for(let e=r.content,i=0;;i++){let n=e.firstChild;if(d.push(n),i==r.openStart)break;e=n.content}for(let e=h-1;e>=0;e--){var u;let i=d[e],n=(u=i.type).spec.defining||u.spec.definingForContent;if(n&&!i.sameMarkup(s.node(Math.abs(l)-1)))h=e;else if(n||!i.type.isTextblock)break}for(let i=r.openStart;i>=0;i--){let l=(i+h+1)%(r.openStart+1),u=d[l];if(u)for(let i=0;i<a.length;i++){let d=a[(i+c)%a.length],h=!0;d<0&&(h=!1,d=-d);let p=s.node(d-1),f=s.index(d-1);if(p.canReplaceWith(f,f,u.type,u.marks))return e.replace(s.before(d),h?o.after(d):n,new Sk(function e(i,n,r,s,o){if(n<r){let o=i.firstChild;i=i.replaceChild(0,o.copy(e(o.content,n+1,r,s,o)))}if(n>s){let e=o.contentMatchAt(0),n=e.fillBefore(i).append(i);i=n.append(e.matchFragment(n).fillBefore(Sy.empty,!0))}return i}(r.content,0,r.openStart,l),l,r.openEnd))}}let p=e.steps.length;for(let l=a.length-1;l>=0&&(e.replace(i,n,r),!(e.steps.length>p));l--){let e=a[l];e<0||(i=s.before(e),n=o.after(e))}}(this,e,i,n),this}replaceRangeWith(e,i,n){var r=e,s=i;if(!n.isInline&&r==s&&this.doc.resolve(r).parent.content.size){let e=function(e,i,n){let r=e.resolve(i);if(r.parent.canReplaceWith(r.index(),r.index(),n))return i;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let i=r.index(e);if(r.node(e).canReplaceWith(i,i,n))return r.before(e+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let i=r.indexAfter(e);if(r.node(e).canReplaceWith(i,i,n))return r.after(e+1);if(i<r.node(e).childCount)break}return null}(this.doc,r,n.type);null!=e&&(r=s=e)}return this.replaceRange(r,s,new Sk(Sy.from(n),0,0)),this}deleteRange(e,i){return!function(e,i,n){let r=e.doc.resolve(i),s=e.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&0==r.parentOffset&&0==s.parentOffset){let o=r.sharedDepth(n),a=!1;for(let e=r.depth;e>o;e--)r.node(e).type.spec.isolating&&(a=!0);for(let e=s.depth;e>o;e--)s.node(e).type.spec.isolating&&(a=!0);if(!a){for(let e=r.depth;e>0&&i==r.start(e);e--)i=r.before(e);for(let e=s.depth;e>0&&n==s.start(e);e--)n=s.before(e);r=e.doc.resolve(i),s=e.doc.resolve(n)}}let o=kI(r,s);for(let i=0;i<o.length;i++){let n=o[i],a=i==o.length-1;if(a&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),s.end(n));if(n>0&&(a||r.node(n-1).canReplace(r.index(n-1),s.indexAfter(n-1))))return e.delete(r.before(n),s.after(n))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(i-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return e.delete(r.before(o),n);e.delete(i,n)}(this,e,i),this}lift(e,i){return!function(e,i,n){let{$from:r,$to:s,depth:o}=i,a=r.before(o+1),l=s.after(o+1),c=a,d=l,h=Sy.empty,u=0;for(let e=o,i=!1;e>n;e--)i||r.index(e)>0?(i=!0,h=Sy.from(r.node(e).copy(h)),u++):c--;let p=Sy.empty,f=0;for(let e=o,i=!1;e>n;e--)i||s.after(e+1)<s.end(e)?(i=!0,p=Sy.from(s.node(e).copy(p)),f++):d++;e.step(new kg(c,d,a,l,new Sk(h.append(p),u,f),h.size-u,!0))}(this,e,i),this}join(e,i=1){return!function(e,i,n){let r=null,{linebreakReplacement:s}=e.doc.type.schema,o=e.doc.resolve(i-n),a=o.node().type;if(s&&a.inlineContent){let e="pre"==a.whitespace,i=!!a.contentMatch.matchType(s);e&&!i?r=!1:!e&&i&&(r=!0)}let l=e.steps.length;if(!1===r){let r=e.doc.resolve(i+n);kS(e,r.node(),r.before(),l)}a.inlineContent&&ky(e,i+n-1,a,o.node().contentMatchAt(o.index()),null==r);let c=e.mapping.slice(l),d=c.map(i-n);if(e.step(new km(d,c.map(i+n,-1),Sk.empty,!0)),!0===r){let i=e.doc.resolve(d);kw(e,i.node(),i.before(),e.steps.length)}}(this,e,i),this}wrap(e,i){return!function(e,i,n){let r=Sy.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let i=n[e].type.contentMatch.matchFragment(r);if(!i||!i.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Sy.from(n[e].type.create(n[e].attrs,r))}let s=i.start,o=i.end;e.step(new kg(s,o,s,o,new Sk(r,0,0),n.length,!0))}(this,e,i),this}setBlockType(e,i=e,n,r=null){var s=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let o=s.steps.length;return s.doc.nodesBetween(e,i,(e,i)=>{var a,l,c;let d,h,u="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,u)&&(a=s.doc,l=s.mapping.slice(o).map(i),c=n,h=(d=a.resolve(l)).index(),d.parent.canReplaceWith(h,h+1,c))){let r=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,i=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!i?r=!1:!e&&i&&(r=!0)}!1===r&&kS(s,e,i,o),ky(s,s.mapping.slice(o).map(i,1),n,void 0,null===r);let a=s.mapping.slice(o),l=a.map(i,1),c=a.map(i+e.nodeSize,1);return s.step(new kg(l,c,l+1,c-1,new Sk(Sy.from(n.create(u,null,e.marks)),0,0),1,!0)),!0===r&&kw(s,e,i,o),!1}}),this}setNodeMarkup(e,i,n=null,r){return!function(e,i,n,r,s){let o=e.doc.nodeAt(i);if(!o)throw RangeError("No node at given position");n||(n=o.type);let a=n.create(r,null,s||o.marks);if(o.isLeaf)return e.replaceWith(i,i+o.nodeSize,a);if(!n.validContent(o.content))throw RangeError("Invalid content for node type "+n.name);e.step(new kg(i,i+o.nodeSize,i+1,i+o.nodeSize-1,new Sk(Sy.from(a),0,0),1,!0))}(this,e,i,n,r),this}setNodeAttribute(e,i,n){return this.step(new kP(e,i,n)),this}setDocAttribute(e,i){return this.step(new kB(e,i)),this}addNodeMark(e,i){return this.step(new kp(e,i)),this}removeNodeMark(e,i){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(i instanceof Sw)i.isInSet(n.marks)&&this.step(new kf(e,i));else{let r=n.marks,s,o=[];for(;s=i.isInSet(r);)o.push(new kf(e,s)),r=s.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,i=1,n){return!function(e,i,n=1,r){let s=e.doc.resolve(i),o=Sy.empty,a=Sy.empty;for(let e=s.depth,i=s.depth-n,l=n-1;e>i;e--,l--){o=Sy.from(s.node(e).copy(o));let i=r&&r[l];a=Sy.from(i?i.type.create(i.attrs,a):s.node(e).copy(a))}e.step(new km(i,i,new Sk(o.append(a),n,n),!0))}(this,e,i,n),this}addMark(e,i,n){var r;let s,o,a,l;return r=this,a=[],l=[],r.doc.nodesBetween(e,i,(r,c,d)=>{if(!r.isInline)return;let h=r.marks;if(!n.isInSet(h)&&d.type.allowsMarkType(n.type)){let d=Math.max(c,e),u=Math.min(c+r.nodeSize,i),p=n.addToSet(h);for(let e=0;e<h.length;e++)h[e].isInSet(p)||(s&&s.to==d&&s.mark.eq(h[e])?s.to=u:a.push(s=new ku(d,u,h[e])));o&&o.to==d?o.to=u:l.push(o=new kh(d,u,n))}}),a.forEach(e=>r.step(e)),l.forEach(e=>r.step(e)),this}removeMark(e,i,n){var r;let s,o;return r=this,s=[],o=0,r.doc.nodesBetween(e,i,(r,a)=>{if(!r.isInline)return;o++;let l=null;if(n instanceof SG){let e=r.marks,i;for(;i=n.isInSet(e);)(l||(l=[])).push(i),e=i.removeFromSet(e)}else n?n.isInSet(r.marks)&&(l=[n]):l=r.marks;if(l&&l.length){let n=Math.min(a+r.nodeSize,i);for(let i=0;i<l.length;i++){let r=l[i],c;for(let e=0;e<s.length;e++){let i=s[e];i.step==o-1&&r.eq(s[e].style)&&(c=i)}c?(c.to=n,c.step=o):s.push({style:r,from:Math.max(a,e),to:n,step:o})}}}),s.forEach(e=>r.step(new ku(e.from,e.to,e.style))),this}clearIncompatible(e,i,n){return ky(this,e,i,n),this}}let kH=Object.create(null);class kW{constructor(e,i,n){this.$anchor=e,this.$head=i,this.ranges=n||[new k$(e.min(i),e.max(i))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let i=0;i<e.length;i++)if(e[i].$from.pos!=e[i].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,i=Sk.empty){let n=i.content.lastChild,r=null;for(let e=0;e<i.openEnd;e++)r=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],d=e.mapping.slice(s);e.replaceRange(d.map(l.pos),d.map(c.pos),a?Sk.empty:i),0==a&&kQ(e,s,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,i){let n=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){let{$from:o,$to:a}=r[s],l=e.mapping.slice(n),c=l.map(o.pos),d=l.map(a.pos);s?e.deleteRange(c,d):(e.replaceRangeWith(c,d,i),kQ(e,n,i.isInline?-1:1))}}static findFrom(e,i,n=!1){let r=e.parent.inlineContent?new kq(e):kZ(e.node(0),e.parent,e.pos,e.index(),i,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let s=i<0?kZ(e.node(0),e.node(r),e.before(r+1),e.index(r),i,n):kZ(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,i,n);if(s)return s}return null}static near(e,i=1){return this.findFrom(e,i)||this.findFrom(e,-i)||new kJ(e.node(0))}static atStart(e){return kZ(e,e,0,0,1)||new kJ(e)}static atEnd(e){return kZ(e,e,e.content.size,e.childCount,-1)||new kJ(e)}static fromJSON(e,i){if(!i||!i.type)throw RangeError("Invalid input for Selection.fromJSON");let n=kH[i.type];if(!n)throw RangeError(`No selection type ${i.type} defined`);return n.fromJSON(e,i)}static jsonID(e,i){if(e in kH)throw RangeError("Duplicate use of selection JSON ID "+e);return kH[e]=i,i.prototype.jsonID=e,i}getBookmark(){return kq.between(this.$anchor,this.$head).getBookmark()}}kW.prototype.visible=!0;class k${constructor(e,i){this.$from=e,this.$to=i}}let kU=!1;function kV(e){kU||e.parent.inlineContent||(kU=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class kq extends kW{constructor(e,i=e){kV(e),kV(i),super(e,i)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,i){let n=e.resolve(i.map(this.head));if(!n.parent.inlineContent)return kW.near(n);let r=e.resolve(i.map(this.anchor));return new kq(r.parent.inlineContent?r:n,n)}replace(e,i=Sk.empty){if(super.replace(e,i),i==Sk.empty){let i=this.$from.marksAcross(this.$to);i&&e.ensureMarks(i)}}eq(e){return e instanceof kq&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new kK(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,i){if("number"!=typeof i.anchor||"number"!=typeof i.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new kq(e.resolve(i.anchor),e.resolve(i.head))}static create(e,i,n=i){let r=e.resolve(i);return new this(r,n==i?r:e.resolve(n))}static between(e,i,n){let r=e.pos-i.pos;if((!n||r)&&(n=r>=0?1:-1),!i.parent.inlineContent){let e=kW.findFrom(i,n,!0)||kW.findFrom(i,-n,!0);if(!e)return kW.near(i,n);i=e.$head}return e.parent.inlineContent||(0==r?e=i:(e=(kW.findFrom(e,-n,!0)||kW.findFrom(e,n,!0)).$anchor).pos<i.pos!=r<0&&(e=i)),new kq(e,i)}}kW.jsonID("text",kq);class kK{constructor(e,i){this.anchor=e,this.head=i}map(e){return new kK(e.map(this.anchor),e.map(this.head))}resolve(e){return kq.between(e.resolve(this.anchor),e.resolve(this.head))}}class kY extends kW{constructor(e){let i=e.nodeAfter,n=e.node(0).resolve(e.pos+i.nodeSize);super(e,n),this.node=i}map(e,i){let{deleted:n,pos:r}=i.mapResult(this.anchor),s=e.resolve(r);return n?kW.near(s):new kY(s)}content(){return new Sk(Sy.from(this.node),0,0)}eq(e){return e instanceof kY&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new kX(this.anchor)}static fromJSON(e,i){if("number"!=typeof i.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new kY(e.resolve(i.anchor))}static create(e,i){return new kY(e.resolve(i))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}kY.prototype.visible=!1,kW.jsonID("node",kY);class kX{constructor(e){this.anchor=e}map(e){let{deleted:i,pos:n}=e.mapResult(this.anchor);return i?new kK(n,n):new kX(n)}resolve(e){let i=e.resolve(this.anchor),n=i.nodeAfter;return n&&kY.isSelectable(n)?new kY(i):kW.near(i)}}class kJ extends kW{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,i=Sk.empty){if(i==Sk.empty){e.delete(0,e.doc.content.size);let i=kW.atStart(e.doc);i.eq(e.selection)||e.setSelection(i)}else super.replace(e,i)}toJSON(){return{type:"all"}}static fromJSON(e){return new kJ(e)}map(e){return new kJ(e)}eq(e){return e instanceof kJ}getBookmark(){return kG}}kW.jsonID("all",kJ);let kG={map(){return this},resolve:e=>new kJ(e)};function kZ(e,i,n,r,s,o=!1){if(i.inlineContent)return kq.create(e,n);for(let a=r-(s>0?0:1);s>0?a<i.childCount:a>=0;a+=s){let r=i.child(a);if(r.isAtom){if(!o&&kY.isSelectable(r))return kY.create(e,n-(s<0?r.nodeSize:0))}else{let i=kZ(e,r,n+s,s<0?r.childCount:0,s,o);if(i)return i}n+=r.nodeSize*s}return null}function kQ(e,i,n){let r,s=e.steps.length-1;if(s<i)return;let o=e.steps[s];(o instanceof km||o instanceof kg)&&(e.mapping.maps[s].forEach((e,i,n,s)=>{null==r&&(r=s)}),e.setSelection(kW.near(e.doc.resolve(r),n)))}class k0 extends kF{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return Sw.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,i){super.addStep(e,i),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,i=!0){let n=this.selection;return i&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Sw.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,i,n){let r=this.doc.type.schema;if(null==i)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=i),!e)return this.deleteRange(i,n);let s=this.storedMarks;if(!s){let e=this.doc.resolve(i);s=n==i?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(i,n,r.text(e,s)),this.selection.empty||this.selection.to!=i+e.length||this.setSelection(kW.near(this.selection.$to)),this}}setMeta(e,i){return this.meta["string"==typeof e?e:e.key]=i,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function k1(e,i){return i&&e?e.bind(i):e}class k2{constructor(e,i,n){this.name=e,this.init=k1(i.init,n),this.apply=k1(i.apply,n)}}let k5=[new k2("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new k2("selection",{init:(e,i)=>e.selection||kW.atStart(i.doc),apply:e=>e.selection}),new k2("storedMarks",{init:e=>e.storedMarks||null,apply:(e,i,n,r)=>r.selection.$cursor?e.storedMarks:null}),new k2("scrollToSelection",{init:()=>0,apply:(e,i)=>e.scrolledIntoView?i+1:i})];class k3{constructor(e,i){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=k5.slice(),i&&i.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new k2(e.key,e.spec.state,e))})}}class k4{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,i=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=i){let i=this.config.plugins[n];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let i=[e],n=this.applyInner(e),r=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=r?r[o].n:0,c=r?r[o].state:this,d=l<i.length&&a.spec.appendTransaction.call(a,l?i.slice(l):i,c,n);if(d&&n.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:i.length}:{state:this,n:0})}i.push(d),n=n.applyInner(d),s=!0}r&&(r[o]={state:n,n:i.length})}}if(!s)return{state:n,transactions:i}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let i=new k4(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let s=n[r];i[s.name]=s.apply(e,this[s.name],this,i)}return i}get tr(){return new k0(this)}static create(e){let i=new k3(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new k4(i);for(let r=0;r<i.fields.length;r++)n[i.fields[r].name]=i.fields[r].init(e,n);return n}reconfigure(e){let i=new k3(this.schema,e.plugins),n=i.fields,r=new k4(i);for(let i=0;i<n.length;i++){let s=n[i].name;r[s]=this.hasOwnProperty(s)?this[s]:n[i].init(e,r)}return r}toJSON(e){let i={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(i.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],s=r.spec.state;s&&s.toJSON&&(i[n]=s.toJSON.call(r,this[r.key]))}return i}static fromJSON(e,i,n){if(!i)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let r=new k3(e.schema,e.plugins),s=new k4(r);return r.fields.forEach(r=>{if("doc"==r.name)s.doc=SP.fromJSON(e.schema,i.doc);else if("selection"==r.name)s.selection=kW.fromJSON(s.doc,i.selection);else if("storedMarks"==r.name)i.storedMarks&&(s.storedMarks=i.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let a=n[o],l=a.spec.state;if(a.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(i,o)){s[r.name]=l.fromJSON.call(a,e,i[o],s);return}}s[r.name]=r.init(e,s)}}),s}}class k6{constructor(e){this.spec=e,this.props={},e.props&&function e(i,n,r){for(let s in i){let o=i[s];o instanceof Function?o=o.bind(n):"handleDOMEvents"==s&&(o=e(o,n,{})),r[s]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:k9("plugin")}getState(e){return e[this.key]}}let k8=Object.create(null);function k9(e){return e in k8?e+"$"+ ++k8[e]:(k8[e]=0,e+"$")}class k7{constructor(e="key"){this.key=k9(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}let Ce=(e,i)=>!e.selection.empty&&(i&&i(e.tr.deleteSelection().scrollIntoView()),!0);function Ct(e,i){let{$cursor:n}=e.selection;return n&&(i?i.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let Ci=(e,i,n)=>{let r=Ct(e,n);if(!r)return!1;let s=Co(r);if(!s){let n=r.blockRange(),s=n&&k_(n);return null!=s&&(i&&i(e.tr.lift(n,s).scrollIntoView()),!0)}let o=s.nodeBefore;if(Cg(e,s,i,-1))return!0;if(0==r.parent.content.size&&(Cr(o,"end")||kY.isSelectable(o)))for(let n=r.depth;;n--){let a=kN(e.doc,r.before(n),r.after(n),Sk.empty);if(a&&a.slice.size<a.to-a.from){if(i){let n=e.tr.step(a);n.setSelection(Cr(o,"end")?kW.findFrom(n.doc.resolve(n.mapping.map(s.pos,-1)),-1):kY.create(n.doc,s.pos-o.nodeSize)),i(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!o.isAtom&&s.depth==r.depth-1&&(i&&i(e.tr.delete(s.pos-o.nodeSize,s.pos).scrollIntoView()),!0)};function Cn(e,i,n){let r=i.nodeBefore,s=i.pos-1;for(;!r.isTextblock;s--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let o=i.nodeAfter,a=i.pos+1;for(;!o.isTextblock;a++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let l=kN(e.doc,s,a,Sk.empty);if(!l||l.from!=s||l instanceof km&&l.slice.size>=a-s)return!1;if(n){let i=e.tr.step(l);i.setSelection(kq.create(i.doc,s)),n(i.scrollIntoView())}return!0}function Cr(e,i,n=!1){for(let r=e;r;r="start"==i?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let Cs=(e,i,n)=>{let{$head:r,empty:s}=e.selection,o=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=Co(r)}let a=o&&o.nodeBefore;return!!a&&!!kY.isSelectable(a)&&(i&&i(e.tr.setSelection(kY.create(e.doc,o.pos-a.nodeSize)).scrollIntoView()),!0)};function Co(e){if(!e.parent.type.spec.isolating)for(let i=e.depth-1;i>=0;i--){if(e.index(i)>0)return e.doc.resolve(e.before(i+1));if(e.node(i).type.spec.isolating)break}return null}function Ca(e,i){let{$cursor:n}=e.selection;return n&&(i?i.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let Cl=(e,i,n)=>{let r=Ca(e,n);if(!r)return!1;let s=Cd(r);if(!s)return!1;let o=s.nodeAfter;if(Cg(e,s,i,1))return!0;if(0==r.parent.content.size&&(Cr(o,"start")||kY.isSelectable(o))){let n=kN(e.doc,r.before(),r.after(),Sk.empty);if(n&&n.slice.size<n.to-n.from){if(i){let r=e.tr.step(n);r.setSelection(Cr(o,"start")?kW.findFrom(r.doc.resolve(r.mapping.map(s.pos)),1):kY.create(r.doc,r.mapping.map(s.pos))),i(r.scrollIntoView())}return!0}}return!!o.isAtom&&s.depth==r.depth-1&&(i&&i(e.tr.delete(s.pos,s.pos+o.nodeSize).scrollIntoView()),!0)},Cc=(e,i,n)=>{let{$head:r,empty:s}=e.selection,o=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=Cd(r)}let a=o&&o.nodeAfter;return!!a&&!!kY.isSelectable(a)&&(i&&i(e.tr.setSelection(kY.create(e.doc,o.pos)).scrollIntoView()),!0)};function Cd(e){if(!e.parent.type.spec.isolating)for(let i=e.depth-1;i>=0;i--){let n=e.node(i);if(e.index(i)+1<n.childCount)return e.doc.resolve(e.after(i+1));if(n.type.spec.isolating)break}return null}let Ch=(e,i)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(i&&i(e.tr.insertText("\n").scrollIntoView()),!0)};function Cu(e){for(let i=0;i<e.edgeCount;i++){let{type:n}=e.edge(i);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let Cp=(e,i)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),o=n.indexAfter(-1),a=Cu(s.contentMatchAt(o));if(!a||!s.canReplaceWith(o,o,a))return!1;if(i){let r=n.after(),s=e.tr.replaceWith(r,r,a.createAndFill());s.setSelection(kW.near(s.doc.resolve(r),1)),i(s.scrollIntoView())}return!0},Cf=(e,i)=>{let n=e.selection,{$from:r,$to:s}=n;if(n instanceof kJ||r.parent.inlineContent||s.parent.inlineContent)return!1;let o=Cu(s.parent.contentMatchAt(s.indexAfter()));if(!o||!o.isTextblock)return!1;if(i){let n=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=e.tr.insert(n,o.createAndFill());a.setSelection(kq.create(a.doc,n+1)),i(a.scrollIntoView())}return!0},Cm=(e,i)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(kk(e.doc,r))return i&&i(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),s=r&&k_(r);return null!=s&&(i&&i(e.tr.lift(r,s).scrollIntoView()),!0)};function Cg(e,i,n,r){let s,o,a,l=i.nodeBefore,c=i.nodeAfter,d,h,u=l.type.spec.isolating||c.type.spec.isolating;if(!u&&(s=i.nodeBefore,o=i.nodeAfter,a=i.index(),s&&o&&s.type.compatibleContent(o.type)&&(!s.content.size&&i.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!!i.parent.canReplace(a,a+1)&&!!(o.isTextblock||kC(e.doc,i.pos))&&(n&&n(e.tr.join(i.pos).scrollIntoView()),!0))))return!0;let p=!u&&i.parent.canReplace(i.index(),i.index()+1);if(p&&(d=(h=l.contentMatchAt(l.childCount)).findWrapping(c.type))&&h.matchType(d[0]||c.type).validEnd){if(n){let r=i.pos+c.nodeSize,s=Sy.empty;for(let e=d.length-1;e>=0;e--)s=Sy.from(d[e].create(null,s));s=Sy.from(l.copy(s));let o=e.tr.step(new kg(i.pos-1,r,i.pos,r,new Sk(s,1,0),d.length,!0)),a=o.doc.resolve(r+2*d.length);a.nodeAfter&&a.nodeAfter.type==l.type&&kC(o.doc,a.pos)&&o.join(a.pos),n(o.scrollIntoView())}return!0}let f=c.type.spec.isolating||r>0&&u?null:kW.findFrom(i,1),m=f&&f.$from.blockRange(f.$to),g=m&&k_(m);if(null!=g&&g>=i.depth)return n&&n(e.tr.lift(m,g).scrollIntoView()),!0;if(p&&Cr(c,"start",!0)&&Cr(l,"end")){let r=l,s=[];for(;s.push(r),!r.isTextblock;)r=r.lastChild;let o=c,a=1;for(;!o.isTextblock;o=o.firstChild)a++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=Sy.empty;for(let e=s.length-1;e>=0;e--)r=Sy.from(s[e].copy(r));n(e.tr.step(new kg(i.pos-s.length,i.pos+c.nodeSize,i.pos+a,i.pos+c.nodeSize-a,new Sk(r,s.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Cv(e){return function(i,n){let r=i.selection,s=e<0?r.$from:r.$to,o=s.depth;for(;s.node(o).isInline;){if(!o)return!1;o--}return!!s.node(o).isTextblock&&(n&&n(i.tr.setSelection(kq.create(i.doc,e<0?s.start(o):s.end(o)))),!0)}}let Cy=Cv(-1),C_=Cv(1);function Cx(e,i=null){return function(n,r){let s=!1;for(let r=0;r<n.selection.ranges.length&&!s;r++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[r];n.doc.nodesBetween(o,a,(r,o)=>{if(s)return!1;if(!(!r.isTextblock||r.hasMarkup(e,i)))if(r.type==e)s=!0;else{let i=n.doc.resolve(o),r=i.index();s=i.parent.canReplaceWith(r,r+1,e)}})}if(!s)return!1;if(r){let s=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[r];s.setBlockType(o,a,e,i)}r(s.scrollIntoView())}return!0}}function Cb(...e){return function(i,n,r){for(let s=0;s<e.length;s++)if(e[s](i,n,r))return!0;return!1}}let Cw=Cb(Ce,Ci,Cs),CS=Cb(Ce,Cl,Cc),Ck={Enter:Cb(Ch,Cf,Cm,(e,i)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof kY&&e.selection.node.isBlock)return!!n.parentOffset&&!!kk(e.doc,n.pos)&&(i&&i(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,a,l=!1,c=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let i;l=n.end(e)==n.pos+(n.depth-e),c=n.start(e)==n.pos-(n.depth-e),a=Cu(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));s.unshift(i||(l&&a?{type:a}:null)),o=e;break}if(1==e)return!1;s.unshift(null)}let d=e.tr;(e.selection instanceof kq||e.selection instanceof kJ)&&d.deleteSelection();let h=d.mapping.map(n.pos),u=kk(d.doc,h,s.length,s);if(u||(s[0]=a?{type:a}:null,u=kk(d.doc,h,s.length,s)),!u)return!1;if(d.split(h,s.length,s),!l&&c&&n.node(o).type!=a){let e=d.mapping.map(n.before(o)),i=d.doc.resolve(e);a&&n.node(o-1).canReplaceWith(i.index(),i.index()+1,a)&&d.setNodeMarkup(d.mapping.map(n.before(o)),a)}return i&&i(d.scrollIntoView()),!0}),"Mod-Enter":Cp,Backspace:Cw,"Mod-Backspace":Cw,"Shift-Backspace":Cw,Delete:CS,"Mod-Delete":CS,"Mod-a":(e,i)=>(i&&i(e.tr.setSelection(new kJ(e.doc))),!0)},CC={"Ctrl-h":Ck.Backspace,"Alt-Backspace":Ck["Mod-Backspace"],"Ctrl-d":Ck.Delete,"Ctrl-Alt-Backspace":Ck["Mod-Delete"],"Alt-Delete":Ck["Mod-Delete"],"Alt-d":Ck["Mod-Delete"],"Ctrl-a":Cy,"Ctrl-e":C_};for(let e in Ck)CC[e]=Ck[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();let CT=function(e){for(var i=0;;i++)if(!(e=e.previousSibling))return i},CE=function(e){let i=e.assignedSlot||e.parentNode;return i&&11==i.nodeType?i.host:i},CD=null,CN=function(e,i,n){let r=CD||(CD=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,i||0),r},CM=function(){CD=null},CO=function(e,i,n,r){return n&&(CA(e,i,n,r,-1)||CA(e,i,n,r,1))},CR=/^(img|br|input|textarea|hr)$/i;function CA(e,i,n,r,s){for(var o;;){if(e==n&&i==r)return!0;if(i==(s<0?0:CL(e))){let n=e.parentNode;if(!n||1!=n.nodeType||Cj(e)||CR.test(e.nodeName)||"false"==e.contentEditable)return!1;i=CT(e)+(s<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[i+(s<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(o=n.pmViewDesc)||!o.ignoreForSelection)return!1;else i+=s;else e=n,i=s<0?CL(e):0}}}function CL(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Cj(e){let i;for(let n=e;n&&!(i=n.pmViewDesc);n=n.parentNode);return i&&i.node&&i.node.isBlock&&(i.dom==e||i.contentDOM==e)}let CI=function(e){return e.focusNode&&CO(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function CP(e,i){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=i,n}let CB="u">typeof navigator?navigator:null,Cz="u">typeof document?document:null,CF=CB&&CB.userAgent||"",CH=/Edge\/(\d+)/.exec(CF),CW=/MSIE \d/.exec(CF),C$=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(CF),CU=!!(CW||C$||CH),CV=CW?document.documentMode:C$?+C$[1]:CH?+CH[1]:0,Cq=!CU&&/gecko\/(\d+)/i.test(CF);Cq&&(/Firefox\/(\d+)/.exec(CF)||[0,0])[1];let CK=!CU&&/Chrome\/(\d+)/.exec(CF),CY=!!CK,CX=CK?+CK[1]:0,CJ=!CU&&!!CB&&/Apple Computer/.test(CB.vendor),CG=CJ&&(/Mobile\/\w+/.test(CF)||!!CB&&CB.maxTouchPoints>2),CZ=CG||!!CB&&/Mac/.test(CB.platform),CQ=!!CB&&/Win/.test(CB.platform),C0=/Android \d/.test(CF),C1=!!Cz&&"webkitFontSmoothing"in Cz.documentElement.style,C2=C1?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function C5(e,i){return"number"==typeof e?e:e[i]}function C3(e,i,n){let r=e.someProp("scrollThreshold")||0,s=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let a=n||e.dom;a;){if(1!=a.nodeType){a=CE(a);continue}let e=a,n=e==o.body,l=n?function(e){let i=e.defaultView&&e.defaultView.visualViewport;return i?{left:0,right:i.width,top:0,bottom:i.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(o):function(e){let i=e.getBoundingClientRect(),n=i.width/e.offsetWidth||1,r=i.height/e.offsetHeight||1;return{left:i.left,right:i.left+e.clientWidth*n,top:i.top,bottom:i.top+e.clientHeight*r}}(e),c=0,d=0;if(i.top<l.top+C5(r,"top")?d=-(l.top-i.top+C5(s,"top")):i.bottom>l.bottom-C5(r,"bottom")&&(d=i.bottom-i.top>l.bottom-l.top?i.top+C5(s,"top")-l.top:i.bottom-l.bottom+C5(s,"bottom")),i.left<l.left+C5(r,"left")?c=-(l.left-i.left+C5(s,"left")):i.right>l.right-C5(r,"right")&&(c=i.right-l.right+C5(s,"right")),c||d)if(n)o.defaultView.scrollBy(c,d);else{let n=e.scrollLeft,r=e.scrollTop;d&&(e.scrollTop+=d),c&&(e.scrollLeft+=c);let s=e.scrollLeft-n,o=e.scrollTop-r;i={left:i.left-s,top:i.top-o,right:i.right-s,bottom:i.bottom-o}}let h=n?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(h))break;a="absolute"==h?a.offsetParent:CE(a)}}function C4(e){let i=[],n=e.ownerDocument;for(let r=e;r&&(i.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=CE(r));return i}function C6(e,i){for(let n=0;n<e.length;n++){let{dom:r,top:s,left:o}=e[n];r.scrollTop!=s+i&&(r.scrollTop=s+i),r.scrollLeft!=o&&(r.scrollLeft=o)}}let C8=null;function C9(e,i){return e.left>=i.left-1&&e.left<=i.right+1&&e.top>=i.top-1&&e.top<=i.bottom+1}function C7(e){return e.top<e.bottom||e.left<e.right}function Te(e,i){let n=e.getClientRects();if(n.length){let e=n[i<0?0:n.length-1];if(C7(e))return e}return Array.prototype.find.call(n,C7)||e.getBoundingClientRect()}let Tt=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ti(e,i,n){let{node:r,offset:s,atom:o}=e.docView.domFromPos(i,n<0?-1:1),a=C1||Cq;if(3==r.nodeType)if(a&&(Tt.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let e=Te(CN(r,s,s),n);if(Cq&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let i=Te(CN(r,s-1,s-1),-1);if(i.top==e.top){let n=Te(CN(r,s,s+1),-1);if(n.top!=e.top)return Tn(n,n.left<i.left)}}return e}else{let e=s,i=s,o=n<0?1:-1;return n<0&&!s?(i++,o=-1):n>=0&&s==r.nodeValue.length?(e--,o=1):n<0?e--:i++,Tn(Te(CN(r,e,i),o),o<0)}if(!e.state.doc.resolve(i-(o||0)).parent.inlineContent){if(null==o&&s&&(n<0||s==CL(r))){let e=r.childNodes[s-1];if(1==e.nodeType)return Tr(e.getBoundingClientRect(),!1)}if(null==o&&s<CL(r)){let e=r.childNodes[s];if(1==e.nodeType)return Tr(e.getBoundingClientRect(),!0)}return Tr(r.getBoundingClientRect(),n>=0)}if(null==o&&s&&(n<0||s==CL(r))){let e=r.childNodes[s-1],i=3==e.nodeType?CN(e,CL(e)-!a):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(i)return Tn(Te(i,1),!1)}if(null==o&&s<CL(r)){let e=r.childNodes[s];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let i=e?3==e.nodeType?CN(e,0,+!a):1==e.nodeType?e:null:null;if(i)return Tn(Te(i,-1),!0)}return Tn(Te(3==r.nodeType?CN(r):r,-n),n>=0)}function Tn(e,i){if(0==e.width)return e;let n=i?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Tr(e,i){if(0==e.height)return e;let n=i?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Ts(e,i,n){let r=e.state,s=e.root.activeElement;r!=i&&e.updateState(i),s!=e.dom&&e.focus();try{return n()}finally{r!=i&&e.updateState(r),s!=e.dom&&s&&s.focus()}}let To=/[\u0590-\u08ac]/,Ta=null,Tl=null,Tc=!1;class Td{constructor(e,i,n,r){this.parent=e,this.children=i,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,i,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let i=0;i<this.children.length;i++)e+=this.children[i].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let i=0,n=this.posAtStart;;i++){let r=this.children[i];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,i,n){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[i-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[i];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}if(e==this.dom&&this.contentDOM)r=i>CT(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==i)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(null==r&&i==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,i=!1){for(let n=!0,r=e;r;r=r.parentNode){let s=this.getDesc(r),o;if(s&&(!i||s.node))if(!n||!(o=s.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return s;else n=!1}}getDesc(e){let i=e.pmViewDesc;for(let e=i;e;e=e.parent)if(e==this)return i}posFromDOM(e,i,n){for(let r=e;r;r=r.parentNode){let s=this.getDesc(r);if(s)return s.localPosFromDOM(e,i,n)}return -1}descAt(e){for(let i=0,n=0;i<this.children.length;i++){let r=this.children[i],s=n+r.size;if(n==e&&s!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let i=r.children[e];if(i.size){r=i;break}}return r}if(e<s)return r.descAt(e-n-r.border);n=s}}domFromPos(e,i){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let i=0;n<this.children.length;n++){let s=this.children[n],o=i+s.size;if(o>e||s instanceof Tv){r=e-i;break}i=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,i);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Th&&e.side>=0;n--);if(i<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&i&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,i):{node:this.contentDOM,offset:e?CT(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,i):{node:this.contentDOM,offset:e?CT(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,i,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:i,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,s=-1;for(let o=n,a=0;;a++){let n=this.children[a],l=o+n.size;if(-1==r&&e<=l){let s=o+n.border;if(e>=s&&i<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,i,s);e=o;for(let i=a;i>0;i--){let n=this.children[i-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=CT(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>i||a==this.children.length-1)){i=l;for(let e=a+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){s=CT(n.dom);break}i+=n.size}-1==s&&(s=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:i,fromOffset:r,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let i=this.children[e<0?0:this.children.length-1];return 0==i.size||i.emptyChildAt(e)}domAfterPos(e){let{node:i,offset:n}=this.domFromPos(e,0);if(1!=i.nodeType||n==i.childNodes.length)throw RangeError("No node after pos "+e);return i.childNodes[n]}setSelection(e,i,n,r=!1){let s=Math.min(e,i),o=Math.max(e,i);for(let a=0,l=0;a<this.children.length;a++){let c=this.children[a],d=l+c.size;if(s>l&&o<d)return c.setSelection(e-l-c.border,i-l-c.border,n,r);l=d}let a=this.domFromPos(e,e?-1:1),l=i==e?a:this.domFromPos(i,i?-1:1),c=n.root.getSelection(),d=n.domSelectionRange(),h=!1;if((Cq||CJ)&&e==i){let{node:e,offset:i}=a;if(3==e.nodeType){if((h=!!(i&&"\n"==e.nodeValue[i-1]))&&i==e.nodeValue.length)for(let i=e,n;i;i=i.parentNode){if(n=i.nextSibling){"BR"==n.nodeName&&(a=l={node:n.parentNode,offset:CT(n)+1});break}let e=i.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[i-1];h=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(Cq&&d.focusNode&&d.focusNode!=l.node&&1==d.focusNode.nodeType){let e=d.focusNode.childNodes[d.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||h&&CJ)&&CO(a.node,a.offset,d.anchorNode,d.anchorOffset)&&CO(l.node,l.offset,d.focusNode,d.focusOffset))return;let u=!1;if((c.extend||e==i)&&!(h&&Cq)){c.collapse(a.node,a.offset);try{e!=i&&c.extend(l.node,l.offset),u=!0}catch(e){}}if(!u){if(e>i){let e=a;a=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,i){for(let n=0,r=0;r<this.children.length;r++){let s=this.children[r],o=n+s.size;if(n==o?e<=o&&i>=n:e<o&&i>n){let r=n+s.border,a=o-s.border;if(e>=r&&i<=a){this.dirty=e==n||i==o?2:1,e==r&&i==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=3:s.markDirty(e-r,i-r);return}s.dirty=s.dom!=s.contentDOM||s.dom.parentNode!=this.contentDOM||s.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let i=this.parent;i;i=i.parent,e++){let n=1==e?2:1;i.dirty<n&&(i.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Th extends Td{constructor(e,i,n,r){let s,o=i.type.toDOM;if("function"==typeof o&&(o=o(n,()=>s?s.parent?s.parent.posBeforeChild(s):void 0:r)),!i.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=i,this.widget=i,s=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let i=this.widget.spec.stopEvent;return!!i&&i(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Tu extends Td{constructor(e,i,n,r){super(e,[],i,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,i){return e!=this.textDOM?this.posAtStart+(i?this.size:0):this.posAtStart+i}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Tp extends Td{constructor(e,i,n,r,s){super(e,[],n,r),this.mark=i,this.spec=s}static create(e,i,n,r){let s=r.nodeViews[i.type.name],o=s&&s(i,r,n);return o&&o.dom||(o=S7.renderSpec(document,i.type.spec.toDOM(i,n),null,i.attrs)),new Tp(e,i,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,i){if(super.markDirty(e,i),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,i,n){let r=Tp.create(this.parent,this.mark,!0,n),s=this.children,o=this.size;i<o&&(s=TD(s,i,o,n)),e>0&&(s=TD(s,0,e,n));for(let e=0;e<s.length;e++)s[e].parent=r;return r.children=s,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Tf extends Td{constructor(e,i,n,r,s,o,a,l,c){super(e,[],s,o),this.node=i,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=a}static create(e,i,n,r,s,o){let a=s.nodeViews[i.type.name],l,c=a&&a(i,s,()=>l?l.parent?l.parent.posBeforeChild(l):void 0:o,n,r),d=c&&c.dom,h=c&&c.contentDOM;if(i.isText)if(d){if(3!=d.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(i.text);else if(!d){let e=S7.renderSpec(document,i.type.spec.toDOM(i),null,i.attrs);({dom:d,contentDOM:h}=e)}h||i.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable="false"),i.type.spec.draggable&&(d.draggable=!0));let u=d;return(d=TS(d,n,i),c)?l=new Ty(e,i,n,r,d,h||null,u,c,s,o+1):i.isText?new Tg(e,i,n,r,d,u,s):new Tf(e,i,n,r,d,h||null,u,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let i=this.children.length-1;i>=0;i--){let n=this.children[i];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Sy.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,i,n){return 0==this.dirty&&e.eq(this.node)&&Tk(i,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,i){let n=this.node.inlineContent,r=i,s=e.composing?this.localCompositionInfo(e,i):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new TT(this,o&&o.node,e);(function(e,i,n,r){let s=i.locals(e),o=0;if(0==s.length){for(let n=0;n<e.childCount;n++){let a=e.child(n);r(a,s,i.forChild(o,a),n),o+=a.nodeSize}return}let a=0,l=[],c=null;for(let d=0;;){let h,u,p,f;for(;a<s.length&&s[a].to==o;){let e=s[a++];e.widget&&(h?(u||(u=[h])).push(e):h=e)}if(h)if(u){u.sort(TE);for(let e=0;e<u.length;e++)n(u[e],d,!!c)}else n(h,d,!!c);if(c)f=-1,p=c,c=null;else if(d<e.childCount)f=d,p=e.child(d++);else break;for(let e=0;e<l.length;e++)l[e].to<=o&&l.splice(e--,1);for(;a<s.length&&s[a].from<=o&&s[a].to>o;)l.push(s[a++]);let m=o+p.nodeSize;if(p.isText){let e=m;a<s.length&&s[a].from<e&&(e=s[a].from);for(let i=0;i<l.length;i++)l[i].to<e&&(e=l[i].to);e<m&&(c=p.cut(e-o),p=p.cut(0,e-o),m=e,f=-1)}else for(;a<s.length&&s[a].to<m;)a++;let g=p.isInline&&!p.isLeaf?l.filter(e=>!e.inline):l.slice();r(p,g,i.forChild(o,p),f),o=m}})(this.node,this.innerDeco,(i,s,o)=>{i.spec.marks?l.syncToMarks(i.spec.marks,n,e,s):i.type.side>=0&&!o&&l.syncToMarks(s==this.node.childCount?Sw.none:this.node.child(s).marks,n,e,s),l.placeWidget(i,e,r)},(i,o,c,d)=>{let h;l.syncToMarks(i.marks,n,e,d),l.findNodeMatch(i,o,c,d)||a&&e.state.selection.from>r&&e.state.selection.to<r+i.nodeSize&&(h=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(i,o,c,h,e)||l.updateNextNode(i,o,c,e,d,r)||l.addNode(i,o,c,e,r),r+=i.nodeSize}),l.syncToMarks([],n,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(i,n,r){let s=i.firstChild,o=!1;for(let a=0;a<n.length;a++){let l=n[a],c=l.dom;if(c.parentNode==i){for(;c!=s;)s=TC(s),o=!0;s=s.nextSibling}else o=!0,i.insertBefore(c,s);if(l instanceof Tp){let n=s?s.previousSibling:i.lastChild;e(l.contentDOM,l.children,r),s=n?n.nextSibling:i.firstChild}}for(;s;)s=TC(s),o=!0;o&&r.trackWrites==i&&(r.trackWrites=null)}(this.contentDOM,this.children,e),CG&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let i=e.style.cssText;e.style.cssText=i+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=i}}(this.dom))}localCompositionInfo(e,i){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof kq)||n<i||r>i+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(!this.node.inlineContent)return{node:s,pos:-1,text:""};{let e=s.nodeValue,o=function(e,i,n,r){for(let s=0,o=0;s<e.childCount&&o<=r;){let a=e.child(s++),l=o;if(o+=a.nodeSize,!a.isText)continue;let c=a.text;for(;s<e.childCount;){let i=e.child(s++);if(o+=i.nodeSize,!i.isText)break;c+=i.text}if(o>=n){if(o>=r&&c.slice(r-i.length-l,r-l)==i)return r-i.length;let e=l<r?c.lastIndexOf(i,r-l-1):-1;if(e>=0&&e+i.length+l>=n)return l+e;if(n==r&&c.length>=r+i.length-l&&c.slice(r-l,r-l+i.length)==i)return r}}return -1}(this.node.content,e,n-i,r-i);return o<0?null:{node:s,pos:o,text:e}}}protectLocalComposition(e,{node:i,pos:n,text:r}){if(this.getDesc(i))return;let s=i;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new Tu(this,s,i,r);e.input.compositionNodes.push(o),this.children=TD(this.children,n,n+r.length,e,o)}update(e,i,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,i,n,r),!0)}updateInner(e,i,n,r){this.updateOuterDeco(i),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(Tk(e,this.outerDeco))return;let i=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Tw(this.dom,this.nodeDOM,Tb(this.outerDeco,this.node,i),Tb(e,this.node,i)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Tm(e,i,n,r,s){TS(r,i,e);let o=new Tf(void 0,e,i,n,r,r,r,s,0);return o.contentDOM&&o.updateChildren(s,0),o}class Tg extends Tf{constructor(e,i,n,r,s,o,a){super(e,i,n,r,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,i,n,r){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(i),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let i=this.nodeDOM;i;i=i.parentNode)if(i==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,i,n){return e==this.nodeDOM?this.posAtStart+Math.min(i,this.node.text.length):super.localPosFromDOM(e,i,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,i,n){let r=this.node.cut(e,i),s=document.createTextNode(r.text);return new Tg(this.parent,r,this.outerDeco,this.innerDeco,s,s,n)}markDirty(e,i){super.markDirty(e,i),this.dom!=this.nodeDOM&&(0==e||i==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Tv extends Td{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Ty extends Tf{constructor(e,i,n,r,s,o,a,l,c,d){super(e,i,n,r,s,o,a,c,d),this.spec=l}update(e,i,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,i,n);return s&&this.updateInner(e,i,n,r),s}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,i,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,i,n,r){this.spec.setSelection?this.spec.setSelection(e,i,n.root):super.setSelection(e,i,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let T_=function(e){e&&(this.nodeName=e)};T_.prototype=Object.create(null);let Tx=[new T_];function Tb(e,i,n){if(0==e.length)return Tx;let r=n?Tx[0]:new T_,s=[r];for(let o=0;o<e.length;o++){let a=e[o].type.attrs;if(a)for(let e in a.nodeName&&s.push(r=new T_(a.nodeName)),a){let o=a[e];null!=o&&(n&&1==s.length&&s.push(r=new T_(i.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}return s}function Tw(e,i,n,r){if(n==Tx&&r==Tx)return i;let s=i;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let i;a&&a.nodeName==o.nodeName&&s!=e&&(i=s.parentNode)&&i.nodeName.toLowerCase()==o.nodeName||((i=document.createElement(o.nodeName)).pmIsDeco=!0,i.appendChild(s),a=Tx[0]),s=i}!function(e,i,n){for(let r in i)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=i[r]&&e.setAttribute(r,n[r]);if(i.class!=n.class){let r=i.class?i.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)-1==s.indexOf(r[i])&&e.classList.remove(r[i]);for(let i=0;i<s.length;i++)-1==r.indexOf(s[i])&&e.classList.add(s[i]);0==e.classList.length&&e.removeAttribute("class")}if(i.style!=n.style){if(i.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(i.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}(s,a||Tx[0],o)}return s}function TS(e,i,n){return Tw(e,e,Tx,Tb(i,n,1!=e.nodeType))}function Tk(e,i){if(e.length!=i.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(i[n].type))return!1;return!0}function TC(e){let i=e.nextSibling;return e.parentNode.removeChild(e),i}class TT{constructor(e,i,n){this.lock=i,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,i){let n=i,r=n.children.length,s=e.childCount,o=new Map,a=[];i:for(;s>0;){let l;for(;;)if(r){let e=n.children[r-1];if(e instanceof Tp)n=e,r=e.children.length;else{l=e,r--;break}}else if(n==i)break i;else r=n.parent.children.indexOf(n),n=n.parent;let c=l.node;if(c){if(c!=e.child(s-1))break;--s,o.set(l,s),a.push(l)}}return{index:s,matched:o,matches:a.reverse()}}(e.node.content,e)}destroyBetween(e,i){if(e!=i){for(let n=e;n<i;n++)this.top.children[n].destroy();this.top.children.splice(e,i-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,i,n,r){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&!1!==e[s].type.spec.spanning;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let s=-1,a=this.top.children.length;r<this.preMatch.index&&(a=Math.min(this.index+3,a));for(let i=this.index;i<a;i++){let n=this.top.children[i];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){s=i;break}}if(s>-1)s>this.index&&(this.changed=!0,this.destroyBetween(this.index,s)),this.top=this.top.children[this.index];else{let r=Tp.create(this.top,e[o],i,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,i,n,r){let s=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,i,n))s=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,i,n)&&!this.preMatch.matched.has(o)){s=r;break}}return!(s<0)&&(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,i,n,r,s){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,i,n,s)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let i=e.parentNode;if(!i)return -1;if(i==this.top.contentDOM){let i=e.pmViewDesc;if(i){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==i)return e}return -1}e=i}}updateNextNode(e,i,n,r,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Tf){let c=this.preMatch.matched.get(l);if(null!=c&&c!=s)return!1;let d=l.dom,h,u=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&3!=l.dirty&&Tk(i,l.outerDeco));if(!u&&l.update(e,i,n,r))return this.destroyBetween(this.index,a),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(h=this.recreateWrapper(l,e,i,n,r,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=2,h.updateChildren(r,o+1),h.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,i,n,r,s,o){if(e.dirty||i.isAtom||!e.children.length||!e.node.content.eq(i.content)||!Tk(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let a=Tf.create(this.top,i,n,r,s,o);if(a.contentDOM)for(let i of(a.children=e.children,e.children=[],a.children))i.parent=a;return e.destroy(),a}addNode(e,i,n,r,s){let o=Tf.create(this.top,e,i,n,r,s);o.contentDOM&&o.updateChildren(r,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,i,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new Th(this.top,e,i,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],i=this.top;for(;e instanceof Tp;)e=(i=e).children[i.children.length-1];(!e||!(e instanceof Tg)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((CJ||CY)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",i),this.addHackNode("BR",this.top))}addHackNode(e,i){if(i==this.top&&this.index<i.children.length&&i.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new Tv(this.top,[],n,null);i!=this.top?i.children.push(r):i.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function TE(e,i){return e.type.side-i.type.side}function TD(e,i,n,r,s){let o=[];for(let a=0,l=0;a<e.length;a++){let c=e[a],d=l,h=l+=c.size;d>=n||h<=i?o.push(c):(d<i&&o.push(c.slice(0,i-d,r)),s&&(o.push(s),s=void 0),h>n&&o.push(c.slice(n-d,c.size,r)))}return o}function TN(e,i=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let s=e.docView.nearestDesc(n.focusNode),o=s&&0==s.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let l=r.resolve(a),c,d;if(CI(n)){for(c=a;s&&!s.node;)s=s.parent;let e=s.node;if(s&&e.isAtom&&kY.isSelectable(e)&&s.parent&&!(e.isInline&&function(e,i,n){for(let r=0==i,s=i==CL(e);r||s;){if(e==n)return!0;let i=CT(e);if(!(e=e.parentNode))return!1;r=r&&0==i,s=s&&i==CL(e)}}(n.focusNode,n.focusOffset,s.dom))){let e=s.posBefore;d=new kY(a==e?l:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let i=a,s=a;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);i=Math.min(i,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),s=Math.max(s,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(i<0)return null;[c,a]=s==e.state.selection.anchor?[s,i]:[i,s],l=r.resolve(a)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let h=r.resolve(c);if(!d){let n="pointer"==i||e.state.selection.head<l.pos&&!o?1:-1;d=TB(e,h,l,n)}return d}function TM(e){return e.editable?e.hasFocus():TF(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function TO(e,i=!1){let n=e.state.selection;if(TI(e,n),TM(e)){if(!i&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&CY){let i=e.domSelectionRange(),n=e.domObserver.currentSelection;if(i.anchorNode&&n.anchorNode&&CO(i.anchorNode,i.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let i=e.domSelection();if(!i)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?i.collapse(n.parentNode,CT(n)+1):i.collapse(n,0),!r&&!e.state.selection.visible&&CU&&CV<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var r;let s,o,a,l,{anchor:c,head:d}=n,h,u;TR&&!(n instanceof kq)&&(n.$from.parent.inlineContent||(h=TA(e,n.from)),n.empty||n.$from.parent.inlineContent||(u=TA(e,n.to))),e.docView.setSelection(c,d,e,i),TR&&(h&&Tj(h),u&&Tj(u)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((s=(r=e).dom.ownerDocument).removeEventListener("selectionchange",r.input.hideSelectionGuard),a=(o=r.domSelectionRange()).anchorNode,l=o.anchorOffset,s.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(o.anchorNode!=a||o.anchorOffset!=l)&&(s.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!TM(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let TR=CJ||CY&&CX<63;function TA(e,i){let{node:n,offset:r}=e.docView.domFromPos(i,0),s=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(CJ&&s&&"false"==s.contentEditable)return TL(s);if((!s||"false"==s.contentEditable)&&(!o||"false"==o.contentEditable)){if(s)return TL(s);else if(o)return TL(o)}}function TL(e){return e.contentEditable="true",CJ&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Tj(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function TI(e,i){if(i instanceof kY){let n=e.docView.descAt(i.from);n!=e.lastSelectedViewDesc&&(TP(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else TP(e)}function TP(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function TB(e,i,n,r){return e.someProp("createSelectionBetween",r=>r(e,i,n))||kq.between(i,n,r)}function Tz(e){return(!e.editable||!!e.hasFocus())&&TF(e)}function TF(e){let i=e.domSelectionRange();if(!i.anchorNode)return!1;try{return e.dom.contains(3==i.anchorNode.nodeType?i.anchorNode.parentNode:i.anchorNode)&&(e.editable||e.dom.contains(3==i.focusNode.nodeType?i.focusNode.parentNode:i.focusNode))}catch(e){return!1}}function TH(e,i){let{$anchor:n,$head:r}=e.selection,s=i>0?n.max(r):n.min(r),o=s.parent.inlineContent?s.depth?e.doc.resolve(i>0?s.after():s.before()):null:s;return o&&kW.findFrom(o,i)}function TW(e,i){return e.dispatch(e.state.tr.setSelection(i).scrollIntoView()),!0}function T$(e,i,n){let r=e.state.selection;if(r instanceof kq){if(n.indexOf("s")>-1){let{$head:n}=r,s=n.textOffset?null:i<0?n.nodeBefore:n.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=e.state.doc.resolve(n.pos+s.nodeSize*(i<0?-1:1));return TW(e,new kq(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(i>0?"forward":"backward")){let n=TH(e.state,i);return!!n&&n instanceof kY&&TW(e,n)}else if(!(CZ&&n.indexOf("m")>-1)){let n=r.$head,s=n.textOffset?null:i<0?n.nodeBefore:n.nodeAfter,o;if(!s||s.isText)return!1;let a=i<0?n.pos-s.nodeSize:n.pos;return!!(s.isAtom||(o=e.docView.descAt(a))&&!o.contentDOM)&&(kY.isSelectable(s)?TW(e,new kY(i<0?e.state.doc.resolve(n.pos-s.nodeSize):n)):!!C1&&TW(e,new kq(e.state.doc.resolve(i<0?a:a+s.nodeSize))))}}else{if(r instanceof kY&&r.node.isInline)return TW(e,new kq(i>0?r.$to:r.$from));let n=TH(e.state,i);return!!n&&TW(e,n)}}function TU(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function TV(e,i){let n=e.pmViewDesc;return n&&0==n.size&&(i<0||e.nextSibling||"BR"!=e.nodeName)}function Tq(e,i){return i<0?function(e){let i=e.domSelectionRange(),n=i.focusNode,r=i.focusOffset;if(!n)return;let s,o,a=!1;for(Cq&&1==n.nodeType&&r<TU(n)&&TV(n.childNodes[r],-1)&&(a=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(TV(e,-1))s=n,o=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(TK(n))break;else{let i=n.previousSibling;for(;i&&TV(i,-1);)s=n.parentNode,o=CT(i),i=i.previousSibling;if(i)r=TU(n=i);else{if((n=n.parentNode)==e.dom)break;r=0}}a?TY(e,n,r):s&&TY(e,s,o)}(e):function(e){let i,n,r=e.domSelectionRange(),s=r.focusNode,o=r.focusOffset;if(!s)return;let a=TU(s);for(;;)if(o<a){if(1!=s.nodeType)break;if(TV(s.childNodes[o],1))i=s,n=++o;else break}else if(TK(s))break;else{let r=s.nextSibling;for(;r&&TV(r,1);)i=r.parentNode,n=CT(r)+1,r=r.nextSibling;if(r)o=0,a=TU(s=r);else{if((s=s.parentNode)==e.dom)break;o=a=0}}i&&TY(e,i,n)}(e)}function TK(e){let i=e.pmViewDesc;return i&&i.node&&i.node.isBlock}function TY(e,i,n){if(3!=i.nodeType){let e,r;(r=function(e,i){for(;e&&i==e.childNodes.length&&!Cj(e);)i=CT(e)+1,e=e.parentNode;for(;e&&i<e.childNodes.length;){let n=e.childNodes[i];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,i=0}}(i,n))?(i=r,n=0):(e=function(e,i){for(;e&&!i&&!Cj(e);)i=CT(e),e=e.parentNode;for(;e&&i;){let n=e.childNodes[i-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;i=(e=n).childNodes.length}}(i,n))&&(i=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(CI(r)){let e=document.createRange();e.setEnd(i,n),e.setStart(i,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(i,n);e.domObserver.setCurSelection();let{state:s}=e;setTimeout(()=>{e.state==s&&TO(e)},50)}function TX(e,i){let n=e.state.doc.resolve(i);if(!(CY||CQ)&&n.parent.inlineContent){let r=e.coordsAtPos(i);if(i>n.start()){let n=e.coordsAtPos(i-1),s=(n.top+n.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(i<n.end()){let n=e.coordsAtPos(i+1),s=(n.top+n.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function TJ(e,i,n){let r=e.state.selection;if(r instanceof kq&&!r.empty||n.indexOf("s")>-1||CZ&&n.indexOf("m")>-1)return!1;let{$from:s,$to:o}=r;if(!s.parent.inlineContent||e.endOfTextblock(i<0?"up":"down")){let n=TH(e.state,i);if(n&&n instanceof kY)return TW(e,n)}if(!s.parent.inlineContent){let n=i<0?s:o,a=r instanceof kJ?kW.near(n,i):kW.findFrom(n,i);return!!a&&TW(e,a)}return!1}function TG(e,i){if(!(e.state.selection instanceof kq))return!0;let{$head:n,$anchor:r,empty:s}=e.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(e.endOfTextblock(i>0?"forward":"backward"))return!0;let o=!n.textOffset&&(i<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return i<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function TZ(e,i,n){e.domObserver.stop(),i.contentEditable=n,e.domObserver.start()}function TQ(e,i){e.someProp("transformCopied",n=>{i=n(i,e)});let n=[],{content:r,openStart:s,openEnd:o}=i;for(;s>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){s--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let a=e.someProp("clipboardSerializer")||S7.fromSchema(e.state.schema),l=T8(),c=l.createElement("div");c.appendChild(a.serializeFragment(r,{document:l}));let d=c.firstChild,h,u=0;for(;d&&1==d.nodeType&&(h=T4[d.nodeName.toLowerCase()]);){for(let e=h.length-1;e>=0;e--){let i=l.createElement(h[e]);for(;c.firstChild;)i.appendChild(c.firstChild);c.appendChild(i),u++}d=c.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${s} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:c,text:e.someProp("clipboardTextSerializer",n=>n(i,e))||i.content.textBetween(0,i.content.size,"\n\n"),slice:i}}function T0(e,i,n,r,s){let o,a,l=s.parent.type.spec.code;if(!n&&!i)return null;let c=!!i&&(r||l||!n);if(c){if(e.someProp("transformPastedText",n=>{i=n(i,l||r,e)}),l)return a=new Sk(Sy.from(e.state.schema.text(i.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",i=>{a=i(a,e,!0)}),a;let n=e.someProp("clipboardTextParser",n=>n(i,s,r,e));if(n)a=n;else{let n=s.marks(),{schema:r}=e.state,a=S7.fromSchema(r);o=document.createElement("div"),i.split(/(?:\r\n?|\n)+/).forEach(e=>{let i=o.appendChild(document.createElement("p"));e&&i.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",i=>{n=i(n,e)}),o=function(e){var i;let n,r=/^(\s*<meta [^>]*>)*/.exec(e);r&&(e=e.slice(r[0].length));let s=T8().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e),a;if((a=o&&T4[o[1].toLowerCase()])&&(e=a.map(e=>"<"+e+">").join("")+e+a.map(e=>"</"+e+">").reverse().join("")),s.innerHTML=(i=e,(n=window.trustedTypes)?(T9||(T9=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),T9.createHTML(i)):i),a)for(let e=0;e<a.length;e++)s=s.querySelector(a[e])||s;return s}(n),C1&&function(e){let i=e.querySelectorAll(CY?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<i.length;n++){let r=i[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(o);let d=o&&o.querySelector("[data-pm-slice]"),h=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let e=+h[3];e>0;e--){let e=o.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;o=e}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||S0.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||h),context:s,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||T1.test(e.parentNode.nodeName)?null:{ignore:!0}})),h)a=function(e,i){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(i)}catch(i){return e}let{content:s,openStart:o,openEnd:a}=e;for(let e=r.length-2;e>=0;e-=2){let i=n.nodes[r[e]];if(!i||i.hasRequiredAttrs())break;s=Sy.from(i.create(r[e+1],s)),o++,a++}return new Sk(s,o,a)}(T3(a,+h[1],+h[2]),h[4]);else if((a=Sk.maxOpen(function(e,i){if(e.childCount<2)return e;for(let n=i.depth;n>=0;n--){let r=i.node(n).contentMatchAt(i.index(n)),s,o=[];if(e.forEach(e=>{if(!o)return;let i=r.findWrapping(e.type),n;if(!i)return o=null;if(n=o.length&&s.length&&function e(i,n,r,s,o){if(o<i.length&&o<n.length&&i[o]==n[o]){let a=e(i,n,r,s.lastChild,o+1);if(a)return s.copy(s.content.replaceChild(s.childCount-1,a));if(s.contentMatchAt(s.childCount).matchType(o==i.length-1?r.type:i[o+1]))return s.copy(s.content.append(Sy.from(T2(r,i,o+1))))}}(i,s,e,o[o.length-1],0))o[o.length-1]=n;else{o.length&&(o[o.length-1]=function e(i,n){if(0==n)return i;let r=i.content.replaceChild(i.childCount-1,e(i.lastChild,n-1)),s=i.contentMatchAt(i.childCount).fillBefore(Sy.empty,!0);return i.copy(r.append(s))}(o[o.length-1],s.length));let n=T2(e,i);o.push(n),r=r.matchType(n.type),s=i}}),o)return Sy.from(o)}return e}(a.content,s),!0)).openStart||a.openEnd){let e=0,i=0;for(let i=a.content.firstChild;e<a.openStart&&!i.type.spec.isolating;e++,i=i.firstChild);for(let e=a.content.lastChild;i<a.openEnd&&!e.type.spec.isolating;i++,e=e.lastChild);a=T3(a,e,i)}return e.someProp("transformPasted",i=>{a=i(a,e,c)}),a}let T1=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function T2(e,i,n=0){for(let r=i.length-1;r>=n;r--)e=i[r].create(null,Sy.from(e));return e}function T5(e,i,n,r,s,o){let a=i<0?e.firstChild:e.lastChild,l=a.content;return e.childCount>1&&(o=0),s<r-1&&(l=T5(l,i,n,r,s+1,o)),s>=n&&(l=i<0?a.contentMatchAt(0).fillBefore(l,o<=s).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(Sy.empty,!0))),e.replaceChild(i<0?0:e.childCount-1,a.copy(l))}function T3(e,i,n){return i<e.openStart&&(e=new Sk(T5(e.content,-1,i,e.openStart,0,e.openEnd),i,e.openEnd)),n<e.openEnd&&(e=new Sk(T5(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let T4={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},T6=null;function T8(){return T6||(T6=document.implementation.createHTMLDocument("title"))}let T9=null,T7={},Ee={},Et={touchstart:!0,touchmove:!0};class Ei{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function En(e,i){e.input.lastSelectionOrigin=i,e.input.lastSelectionTime=Date.now()}function Er(e){e.someProp("handleDOMEvents",i=>{for(let n in i)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=i=>Es(e,i))})}function Es(e,i){return e.someProp("handleDOMEvents",n=>{let r=n[i.type];return!!r&&(r(e,i)||i.defaultPrevented)})}function Eo(e){return{left:e.clientX,top:e.clientY}}function Ea(e,i,n,r,s){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(i,i=>r>o.depth?i(e,n,o.nodeAfter,o.before(r),s,!0):i(e,n,o.node(r),o.before(r),s,!1)))return!0;return!1}function El(e,i,n){if(e.focused||e.focus(),e.state.selection.eq(i))return;let r=e.state.tr.setSelection(i);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}Ee.keydown=(e,i)=>{if((e.input.shiftKey=16==i.keyCode||i.shiftKey,!Eh(e,i))&&(e.input.lastKeyCode=i.keyCode,e.input.lastKeyCodeTime=Date.now(),!C0||!CY||13!=i.keyCode))if(229!=i.keyCode&&e.domObserver.forceFlush(),!CG||13!=i.keyCode||i.ctrlKey||i.altKey||i.metaKey)e.someProp("handleKeyDown",n=>n(e,i))||function(e,i){let n,r=i.keyCode,s=(n="",i.ctrlKey&&(n+="c"),i.metaKey&&(n+="m"),i.altKey&&(n+="a"),i.shiftKey&&(n+="s"),n);if(8==r||CZ&&72==r&&"c"==s)return TG(e,-1)||Tq(e,-1);if(46==r&&!i.shiftKey||CZ&&68==r&&"c"==s)return TG(e,1)||Tq(e,1);if(13==r||27==r)return!0;if(37==r||CZ&&66==r&&"c"==s){let i=37==r?"ltr"==TX(e,e.state.selection.from)?-1:1:-1;return T$(e,i,s)||Tq(e,i)}if(39==r||CZ&&70==r&&"c"==s){let i=39==r?"ltr"==TX(e,e.state.selection.from)?1:-1:1;return T$(e,i,s)||Tq(e,i)}else if(38==r||CZ&&80==r&&"c"==s)return TJ(e,-1,s)||Tq(e,-1);else if(40==r||CZ&&78==r&&"c"==s)return function(e){if(!CJ||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:i,focusOffset:n}=e.domSelectionRange();if(i&&1==i.nodeType&&0==n&&i.firstChild&&"false"==i.firstChild.contentEditable){let n=i.firstChild;TZ(e,n,"true"),setTimeout(()=>TZ(e,n,"false"),20)}return!1}(e)||TJ(e,1,s)||Tq(e,1);else if(s==(CZ?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,i)?i.preventDefault():En(e,"key");else{let i=Date.now();e.input.lastIOSEnter=i,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==i&&(e.someProp("handleKeyDown",i=>i(e,CP(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},Ee.keyup=(e,i)=>{16==i.keyCode&&(e.input.shiftKey=!1)},Ee.keypress=(e,i)=>{if(Eh(e,i)||!i.charCode||i.ctrlKey&&!i.altKey||CZ&&i.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,i)))return void i.preventDefault();let n=e.state.selection;if(!(n instanceof kq)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(i.charCode),s=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",i=>i(e,n.$from.pos,n.$to.pos,r,s))||e.dispatch(s()),i.preventDefault()}};let Ec=CZ?"metaKey":"ctrlKey";T7.mousedown=(e,i)=>{var n;let r,s;e.input.shiftKey=i.shiftKey;let o=Em(e),a=Date.now(),l="singleClick";a-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-i.clientX)*r+(s=n.y-i.clientY)*s<100&&!i[Ec]&&e.input.lastClick.button==i.button&&("singleClick"==e.input.lastClick.type?l="doubleClick":"doubleClick"==e.input.lastClick.type&&(l="tripleClick")),e.input.lastClick={time:a,x:i.clientX,y:i.clientY,type:l,button:i.button};let c=e.posAtCoords(Eo(i));c&&("singleClick"==l?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Ed(e,c,i,!!o)):("doubleClick"==l?function(e,i,n,r){return Ea(e,"handleDoubleClickOn",i,n,r)||e.someProp("handleDoubleClick",n=>n(e,i,r))}:function(e,i,n,r){return Ea(e,"handleTripleClickOn",i,n,r)||e.someProp("handleTripleClick",n=>n(e,i,r))||function(e,i,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==i)return!!r.inlineContent&&(El(e,kq.create(r,0,r.content.size),"pointer"),!0);let s=r.resolve(i);for(let i=s.depth+1;i>0;i--){let n=i>s.depth?s.nodeAfter:s.node(i),o=s.before(i);if(n.inlineContent)El(e,kq.create(r,o+1,o+1+n.content.size),"pointer");else{if(!kY.isSelectable(n))continue;El(e,kY.create(r,o),"pointer")}return!0}}(e,n,r)})(e,c.pos,c.inside,i)?i.preventDefault():En(e,"pointer"))};class Ed{constructor(e,i,n,r){let s,o;if(this.view=e,this.pos=i,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Ec],this.allowDefault=n.shiftKey,i.inside>-1)s=e.state.doc.nodeAt(i.inside),o=i.inside;else{let n=e.state.doc.resolve(i.pos);s=n.parent,o=n.depth?n.before():0}const a=r?null:n.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:c}=e.state;0==n.button&&(s.type.spec.draggable&&!1!==s.type.spec.selectable||c instanceof kY&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Cq&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),En(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>TO(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let i=this.pos;if(this.view.state.doc!=this.startDoc&&(i=this.view.posAtCoords(Eo(e))),this.updateAllowDefault(e),this.allowDefault||!i)En(this.view,"pointer");else{var n,r,s,o;(n=this.view,r=i.pos,s=i.inside,o=this.selectNode,Ea(n,"handleClickOn",r,s,e)||n.someProp("handleClick",i=>i(n,r,e))||(o?function(e,i){if(-1==i)return!1;let n=e.state.selection,r,s;n instanceof kY&&(r=n.node);let o=e.state.doc.resolve(i);for(let e=o.depth+1;e>0;e--){let i=e>o.depth?o.nodeAfter:o.node(e);if(kY.isSelectable(i)){s=r&&n.$from.depth>0&&e>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?o.before(n.$from.depth):o.before(e);break}}return null!=s&&(El(e,kY.create(e.state.doc,s),"pointer"),!0)}(n,s):function(e,i){if(-1==i)return!1;let n=e.state.doc.resolve(i),r=n.nodeAfter;return!!(r&&r.isAtom&&kY.isSelectable(r))&&(El(e,new kY(n),"pointer"),!0)}(n,s)))?e.preventDefault():0==e.button&&(this.flushed||CJ&&this.mightDrag&&!this.mightDrag.node.isAtom||CY&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(i.pos-this.view.state.selection.from),Math.abs(i.pos-this.view.state.selection.to)))?(El(this.view,kW.near(this.view.state.doc.resolve(i.pos)),"pointer"),e.preventDefault()):En(this.view,"pointer")}}move(e){this.updateAllowDefault(e),En(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function Eh(e,i){return!!e.composing||!!(CJ&&500>Math.abs(i.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}T7.touchstart=e=>{e.input.lastTouch=Date.now(),Em(e),En(e,"pointer")},T7.touchmove=e=>{e.input.lastTouch=Date.now(),En(e,"pointer")},T7.contextmenu=e=>Em(e);let Eu=C0?5e3:-1;function Ep(e,i){clearTimeout(e.input.composingTimeout),i>-1&&(e.input.composingTimeout=setTimeout(()=>Em(e),i))}function Ef(e){let i;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((i=document.createEvent("Event")).initEvent("event",!0,!0),i.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Em(e,i=!1){if(!C0||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Ef(e),i||e.docView&&e.docView.dirty){let n=TN(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||i)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}Ee.compositionstart=Ee.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:i}=e,n=i.selection.$to;if(i.selection instanceof kq&&(i.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||CY&&CQ&&function(e){let{focusNode:i,focusOffset:n}=e.domSelectionRange();if(!i||1!=i.nodeType||n>=i.childNodes.length)return!1;let r=i.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),Em(e,!0),e.markCursor=null;else if(Em(e,!i.selection.empty),Cq&&i.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let i=e.domSelectionRange();for(let n=i.focusNode,r=i.focusOffset;n&&1==n.nodeType&&0!=r;){let i=r<0?n.lastChild:n.childNodes[r-1];if(!i)break;if(3==i.nodeType){let n=e.domSelection();n&&n.collapse(i,i.nodeValue.length);break}n=i,r=-1}}e.input.composing=!0}Ep(e,Eu)},Ee.compositionend=(e,i)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=i.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Ep(e,20))};let Eg=CU&&CV<15||CG&&C2<604;function Ev(e,i,n,r,s){let o=T0(e,i,n,r,e.state.selection.$from);if(e.someProp("handlePaste",i=>i(e,s,o||Sk.empty)))return!0;if(!o)return!1;let a=0==o.openStart&&0==o.openEnd&&1==o.content.childCount?o.content.firstChild:null,l=a?e.state.tr.replaceSelectionWith(a,r):e.state.tr.replaceSelection(o);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ey(e){let i=e.getData("text/plain")||e.getData("Text");if(i)return i;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}T7.copy=Ee.cut=(e,i)=>{let n=e.state.selection,r="cut"==i.type;if(n.empty)return;let s=Eg?null:i.clipboardData,{dom:o,text:a}=TQ(e,n.content());s?(i.preventDefault(),s.clearData(),s.setData("text/html",o.innerHTML),s.setData("text/plain",a)):function(e,i){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(i),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(i),e.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Ee.paste=(e,i)=>{if(e.composing&&!C0)return;let n=Eg?null:i.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&Ev(e,Ey(n),n.getData("text/html"),r,i)?i.preventDefault():function(e,i){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ev(e,r.value,null,s,i):Ev(e,r.textContent,r.innerHTML,s,i)},50)}(e,i)};class E_{constructor(e,i,n){this.slice=e,this.move=i,this.node=n}}let Ex=CZ?"altKey":"ctrlKey";function Eb(e,i){let n;return e.someProp("dragCopies",e=>{n=n||e(i)}),null!=n?!n:!i[Ex]}for(let e in T7.dragstart=(e,i)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!i.dataTransfer)return;let s=e.state.selection,o=s.empty?null:e.posAtCoords(Eo(i));if(o&&o.pos>=s.from&&o.pos<=(s instanceof kY?s.to-1:s.to));else if(r&&r.mightDrag)n=kY.create(e.state.doc,r.mightDrag.pos);else if(i.target&&1==i.target.nodeType){let r=e.docView.nearestDesc(i.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=kY.create(e.state.doc,r.posBefore))}let a=(n||e.state.selection).content(),{dom:l,text:c,slice:d}=TQ(e,a);i.dataTransfer.files.length&&CY&&!(CX>120)||i.dataTransfer.clearData(),i.dataTransfer.setData(Eg?"Text":"text/html",l.innerHTML),i.dataTransfer.effectAllowed="copyMove",Eg||i.dataTransfer.setData("text/plain",c),e.dragging=new E_(d,Eb(e,i),n)},T7.dragend=e=>{let i=e.dragging;window.setTimeout(()=>{e.dragging==i&&(e.dragging=null)},50)},Ee.dragover=Ee.dragenter=(e,i)=>i.preventDefault(),Ee.drop=(e,i)=>{try{!function(e,i,n){if(!i.dataTransfer)return;let r=e.posAtCoords(Eo(i));if(!r)return;let s=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",i=>{o=i(o,e,!1)}):o=T0(e,Ey(i.dataTransfer),Eg?null:i.dataTransfer.getData("text/html"),!1,s);let a=!!(n&&Eb(e,i));if(e.someProp("handleDrop",n=>n(e,i,o||Sk.empty,a)))return i.preventDefault();if(!o)return;i.preventDefault();let l=o?kD(e.state.doc,s.pos,o):s.pos;null==l&&(l=s.pos);let c=e.state.tr;if(a){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let d=c.mapping.map(l),h=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,u=c.doc;if(h?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(u))return;let p=c.doc.resolve(d);if(h&&kY.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new kY(p));else{let i=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,s)=>i=s),c.setSelection(TB(e,p,c.doc.resolve(i)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}(e,i,e.dragging)}finally{e.dragging=null}},T7.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&TO(e)},20))},T7.blur=(e,i)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),i.relatedTarget&&e.dom.contains(i.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},T7.beforeinput=(e,i)=>{if(CY&&C0&&"deleteContentBackward"==i.inputType){e.domObserver.flushSoon();let{domChangeCount:i}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=i||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",i=>i(e,CP(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}},Ee)T7[e]=Ee[e];function Ew(e,i){if(e==i)return!0;for(let n in e)if(e[n]!==i[n])return!1;for(let n in i)if(!(n in e))return!1;return!0}class ES{constructor(e,i){this.toDOM=e,this.spec=i||ED,this.side=this.spec.side||0}map(e,i,n,r){let{pos:s,deleted:o}=e.mapResult(i.from+r,this.side<0?-1:1);return o?null:new ET(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof ES&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ew(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ek{constructor(e,i){this.attrs=e,this.spec=i||ED}map(e,i,n,r){let s=e.map(i.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(i.to+r,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new ET(s,o,this)}valid(e,i){return i.from<i.to}eq(e){return this==e||e instanceof Ek&&Ew(this.attrs,e.attrs)&&Ew(this.spec,e.spec)}static is(e){return e.type instanceof Ek}destroy(){}}class EC{constructor(e,i){this.attrs=e,this.spec=i||ED}map(e,i,n,r){let s=e.mapResult(i.from+r,1);if(s.deleted)return null;let o=e.mapResult(i.to+r,-1);return o.deleted||o.pos<=s.pos?null:new ET(s.pos-n,o.pos-n,this)}valid(e,i){let{index:n,offset:r}=e.content.findIndex(i.from),s;return r==i.from&&!(s=e.child(n)).isText&&r+s.nodeSize==i.to}eq(e){return this==e||e instanceof EC&&Ew(this.attrs,e.attrs)&&Ew(this.spec,e.spec)}destroy(){}}class ET{constructor(e,i,n){this.from=e,this.to=i,this.type=n}copy(e,i){return new ET(e,i,this.type)}eq(e,i=0){return this.type.eq(e.type)&&this.from+i==e.from&&this.to+i==e.to}map(e,i,n){return this.type.map(e,this,i,n)}static widget(e,i,n){return new ET(e,e,new ES(i,n))}static inline(e,i,n,r){return new ET(e,i,new Ek(n,r))}static node(e,i,n,r){return new ET(e,i,new EC(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ek}get widget(){return this.type instanceof ES}}let EE=[],ED={};class EN{constructor(e,i){this.local=e.length?e:EE,this.children=i.length?i:EE}static create(e,i){return i.length?Ej(i,e,0,ED):EM}find(e,i,n){let r=[];return this.findInner(null==e?0:e,null==i?1e9:i,r,0,n),r}findInner(e,i,n,r,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=i&&a.to>=e&&(!s||s(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<i&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,i-a,n,r+a,s)}}map(e,i,n){return this==EM||0==e.maps.length?this:this.mapInner(e,i,0,0,n||ED)}mapInner(e,i,n,r,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,n,r);l&&l.type.valid(i,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?function(e,i,n,r,s,o,a){let l=e.slice();for(let e=0,i=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,s,o)=>{let a=o-s-(n-e);for(let s=0;s<l.length;s+=3){let o=l[s+1];if(o<0||e>o+i-r)continue;let c=l[s]+i-r;n>=c?l[s+1]=e<=c?-2:-1:e>=i&&a&&(l[s]+=a,l[s+1]+=a)}r+=a}),i=n.maps[e].map(i,-1)}let c=!1;for(let i=0;i<l.length;i+=3)if(l[i+1]<0){if(-2==l[i+1]){c=!0,l[i+1]=-1;continue}let d=n.map(e[i]+o),h=d-s;if(h<0||h>=r.content.size){c=!0;continue}let u=n.map(e[i+1]+o,-1)-s,{index:p,offset:f}=r.content.findIndex(h),m=r.maybeChild(p);if(m&&f==h&&f+m.nodeSize==u){let r=l[i+2].mapInner(n,m,d+1,e[i]+o+1,a);r!=EM?(l[i]=h,l[i+1]=u,l[i+2]=r):(l[i+1]=-2,c=!0)}else c=!0}if(c){let c=Ej(function(e,i,n,r,s,o,a){for(let l=0;l<e.length;l+=3)-1==e[l+1]&&function e(i,o){for(let e=0;e<i.local.length;e++){let l=i.local[e].map(r,s,o);l?n.push(l):a.onRemove&&a.onRemove(i.local[e].spec)}for(let n=0;n<i.children.length;n+=3)e(i.children[n+2],i.children[n]+o+1)}(e[l+2],i[l]+o+1);return n}(l,e,i,n,s,o,a),r,0,a);i=c.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,i=0;e<c.children.length;e+=3){let n=c.children[e];for(;i<l.length&&l[i]<n;)i+=3;l.splice(i,0,c.children[e],c.children[e+1],c.children[e+2])}}return new EN(i.sort(EI),l)}(this.children,o||[],e,i,n,r,s):o?new EN(o.sort(EI),EE):EM}add(e,i){return i.length?this==EM?EN.create(e,i):this.addInner(e,i,0):this}addInner(e,i,n){let r,s=0;e.forEach((e,o)=>{let a=o+n,l;if(l=EA(i,e,a)){for(r||(r=this.children.slice());s<r.length&&r[s]<o;)s+=3;r[s]==o?r[s+2]=r[s+2].addInner(e,l,a+1):r.splice(s,0,o,o+e.nodeSize,Ej(l,e,a+1,ED)),s+=3}});let o=ER(s?EL(i):i,-n);for(let i=0;i<o.length;i++)o[i].type.valid(e,o[i])||o.splice(i--,1);return new EN(o.length?this.local.concat(o).sort(EI):this.local,r||this.children)}remove(e){return 0==e.length||this==EM?this:this.removeInner(e,0)}removeInner(e,i){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let s,o=n[r]+i,a=n[r+1]+i;for(let i=0,n;i<e.length;i++)(n=e[i])&&n.from>o&&n.to<a&&(e[i]=null,(s||(s=[])).push(n));if(!s)continue;n==this.children&&(n=this.children.slice());let l=n[r+2].removeInner(s,o+1);l!=EM?n[r+2]=l:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,s;n<e.length;n++)if(s=e[n])for(let e=0;e<r.length;e++)r[e].eq(s,i)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new EN(r,n):EM}forChild(e,i){let n,r;if(this==EM)return this;if(i.isLeaf)return EN.empty;for(let i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(n=this.children[i+2]);break}let s=e+1,o=s+i.content.size;for(let e=0;e<this.local.length;e++){let i=this.local[e];if(i.from<o&&i.to>s&&i.type instanceof Ek){let e=Math.max(s,i.from)-s,n=Math.min(o,i.to)-s;e<n&&(r||(r=[])).push(i.copy(e,n))}}if(r){let e=new EN(r.sort(EI),EE);return n?new EO([e,n]):e}return n||EM}eq(e){if(this==e)return!0;if(!(e instanceof EN)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let i=0;i<this.local.length;i++)if(!this.local[i].eq(e.local[i]))return!1;for(let i=0;i<this.children.length;i+=3)if(this.children[i]!=e.children[i]||this.children[i+1]!=e.children[i+1]||!this.children[i+2].eq(e.children[i+2]))return!1;return!0}locals(e){return EP(this.localsInner(e))}localsInner(e){if(this==EM)return EE;if(e.inlineContent||!this.local.some(Ek.is))return this.local;let i=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Ek||i.push(this.local[e]);return i}forEachSet(e){e(this)}}EN.empty=new EN([],[]),EN.removeOverlap=EP;let EM=EN.empty;class EO{constructor(e){this.members=e}map(e,i){let n=this.members.map(n=>n.map(e,i,ED));return EO.from(n)}forChild(e,i){if(i.isLeaf)return EN.empty;let n=[];for(let r=0;r<this.members.length;r++){let s=this.members[r].forChild(e,i);s!=EM&&(s instanceof EO?n=n.concat(s.members):n.push(s))}return EO.from(n)}eq(e){if(!(e instanceof EO)||e.members.length!=this.members.length)return!1;for(let i=0;i<this.members.length;i++)if(!this.members[i].eq(e.members[i]))return!1;return!0}locals(e){let i,n=!0;for(let r=0;r<this.members.length;r++){let s=this.members[r].localsInner(e);if(s.length)if(i){n&&(i=i.slice(),n=!1);for(let e=0;e<s.length;e++)i.push(s[e])}else i=s}return i?EP(n?i:i.sort(EI)):EE}static from(e){switch(e.length){case 0:return EM;case 1:return e[0];default:return new EO(e.every(e=>e instanceof EN)?e:e.reduce((e,i)=>e.concat(i instanceof EN?i:i.members),[]))}}forEachSet(e){for(let i=0;i<this.members.length;i++)this.members[i].forEachSet(e)}}function ER(e,i){if(!i||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let s=e[r];n.push(new ET(s.from+i,s.to+i,s.type))}return n}function EA(e,i,n){if(i.isLeaf)return null;let r=n+i.nodeSize,s=null;for(let i=0,o;i<e.length;i++)(o=e[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),e[i]=null);return s}function EL(e){let i=[];for(let n=0;n<e.length;n++)null!=e[n]&&i.push(e[n]);return i}function Ej(e,i,n,r){let s=[],o=!1;i.forEach((i,a)=>{let l=EA(e,i,a+n);if(l){o=!0;let e=Ej(l,i,n+a+1,r);e!=EM&&s.push(a,a+i.nodeSize,e)}});let a=ER(o?EL(e):e,-n).sort(EI);for(let e=0;e<a.length;e++)a[e].type.valid(i,a[e])||(r.onRemove&&r.onRemove(a[e].spec),a.splice(e--,1));return a.length||s.length?new EN(a,s):EM}function EI(e,i){return e.from-i.from||e.to-i.to}function EP(e){let i=e;for(let n=0;n<i.length-1;n++){let r=i[n];if(r.from!=r.to)for(let s=n+1;s<i.length;s++){let o=i[s];if(o.from==r.from){o.to!=r.to&&(i==e&&(i=e.slice()),i[s]=o.copy(o.from,r.to),EB(i,s+1,o.copy(r.to,o.to)));continue}o.from<r.to&&(i==e&&(i=e.slice()),i[n]=r.copy(r.from,o.from),EB(i,s,r.copy(o.from,r.to)));break}}return i}function EB(e,i,n){for(;i<e.length&&EI(n,e[i])>0;)i++;e.splice(i,0,n)}function Ez(e){let i=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=EM&&i.push(r)}),e.cursorWrapper&&i.push(EN.create(e.state.doc,[e.cursorWrapper.deco])),EO.from(i)}let EF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},EH=CU&&CV<=11;class EW{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class E${constructor(e,i){this.view=e,this.handleDOMChange=i,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new EW,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let e=0;e<i.length;e++)this.queue.push(i[e]);CU&&CV<=11&&i.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():CJ&&e.composing&&i.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),EH&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,EF)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let i=0;i<e.length;i++)this.queue.push(e[i]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Tz(this.view)){if(this.suppressingSelectionUpdates)return TO(this.view);if(CU&&CV<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&CO(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let i=new Set,n;for(let n=e.focusNode;n;n=CE(n))i.add(n);for(let r=e.anchorNode;r;r=CE(r))if(i.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:i}=this;if(!i.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=i.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Tz(i)&&!this.ignoreSelectionChange(r),o=-1,a=-1,l=!1,c=[];if(i.editable)for(let e=0;e<n.length;e++){let i=this.registerMutation(n[e],c);i&&(o=o<0?i.from:Math.min(i.from,o),a=a<0?i.to:Math.max(i.to,a),i.typeOver&&(l=!0))}if(c.some(e=>"BR"==e.nodeName)&&(8==i.input.lastKeyCode||46==i.input.lastKeyCode)){for(let e of c)if("BR"==e.nodeName&&e.parentNode){let i=e.nextSibling;for(;i&&1==i.nodeType;){if("false"==i.contentEditable){e.parentNode.removeChild(e);break}i=i.firstChild}}}else if(Cq&&c.length){let e=c.filter(e=>"BR"==e.nodeName);if(2==e.length){let[i,n]=e;i.parentNode&&i.parentNode.parentNode==n.parentNode?n.remove():i.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(e,i){for(let n=i.parentNode;n&&n!=e.dom;n=n.parentNode){let i=e.docView.nearestDesc(n,!0);if(i&&i.node.isBlock)return n}return null}(i,n)!=e)&&r.remove()}}}let d=null;o<0&&s&&i.input.lastFocus>Date.now()-200&&Math.max(i.input.lastTouch,i.input.lastClick.time)<Date.now()-300&&CI(r)&&(d=TN(i))&&d.eq(kW.near(i.state.doc.resolve(0),1))?(i.input.lastFocus=0,TO(i),this.currentSelection.set(r),i.scrollToSelection()):(o>-1||s)&&(o>-1&&(i.docView.markDirty(o,a),e=i,!EU.has(e)&&(EU.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=Cq,EV||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),EV=!0))),i.input.badSafariComposition&&(i.input.badSafariComposition=!1,function(e,i){var n;let{focusNode:r,focusOffset:s}=e.domSelectionRange();for(let o of i)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let i=o.nextSibling;for(;i&&"TD"!=i.nodeName&&"TH"!=i.nodeName;)i=i.nextSibling;if(i){let n=i;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,s)}else o.parentNode.removeChild(o)}}(i,c)),this.handleDOMChange(o,a,l,c),i.docView&&i.docView.dirty?i.updateState(i.state):this.currentSelection.eq(r)||TO(i),this.currentSelection.set(r))}registerMutation(e,i){if(i.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];i.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,s=e.nextSibling;if(CU&&CV<=11&&e.addedNodes.length)for(let i=0;i<e.addedNodes.length;i++){let{previousSibling:n,nextSibling:o}=e.addedNodes[i];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(s=o)}let o=r&&r.parentNode==e.target?CT(r)+1:0,a=n.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?CT(s):e.target.childNodes.length;return{from:a,to:n.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let EU=new WeakMap,EV=!1;function Eq(e,i){let n=i.startContainer,r=i.startOffset,s=i.endContainer,o=i.endOffset,a=e.domAtPos(e.state.selection.anchor);return CO(a.node,a.offset,s,o)&&([n,r,s,o]=[s,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:o}}function EK(e){let i=e.pmViewDesc;if(i)return i.parseRule();if("BR"==e.nodeName&&e.parentNode){if(CJ&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||CJ&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let EY=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function EX(e,i,n){return Math.max(n.anchor,n.head)>i.content.size?null:TB(e,i.resolve(n.anchor),i.resolve(n.head))}function EJ(e,i,n){let r=e.depth,s=i?e.end():e.pos;for(;r>0&&(i||e.indexAfter(r)==e.node(r).childCount);)r--,s++,i=!1;if(n){let i=e.node(r).maybeChild(e.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function EG(e){if(2!=e.length)return!1;let i=e.charCodeAt(0),n=e.charCodeAt(1);return i>=56320&&i<=57343&&n>=55296&&n<=56319}class EZ{constructor(e,i){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Ei,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=i,this.state=i.state,this.directPlugins=i.plugins||[],this.directPlugins.forEach(E5),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=E1(this),E0(this),this.nodeViews=E2(this),this.docView=Tm(this.state.doc,EQ(this),Ez(this),this.dom,this),this.domObserver=new E$(this,(e,i,n,r)=>(function(e,i,n,r,s){let o,a,l,c=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,i<0){let i=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=TN(e,i);if(n&&!e.state.selection.eq(n)){if(CY&&C0&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",i=>i(e,CP(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==i?r.setMeta("pointer",!0):"key"==i&&r.scrollIntoView(),c&&r.setMeta("composition",c),e.dispatch(r)}return}let d=e.state.doc.resolve(i),h=d.sharedDepth(n);i=d.before(h+1),n=e.state.doc.resolve(n).after(h+1);let u=e.state.selection,p=function(e,i,n){let r,{node:s,fromOffset:o,toOffset:a,from:l,to:c}=e.docView.parseRange(i,n),d=e.domSelectionRange(),h=d.anchorNode;if(h&&e.dom.contains(1==h.nodeType?h:h.parentNode)&&(r=[{node:h,offset:d.anchorOffset}],CI(d)||r.push({node:d.focusNode,offset:d.focusOffset})),CY&&8===e.input.lastKeyCode)for(let e=a;e>o;e--){let i=s.childNodes[e-1],n=i.pmViewDesc;if("BR"==i.nodeName&&!n){a=e;break}if(!n||n.size)break}let u=e.state.doc,p=e.someProp("domParser")||S0.fromSchema(e.state.schema),f=u.resolve(l),m=null,g=p.parse(s,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:o,to:a,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:r,ruleFromNode:EK,context:f});if(r&&null!=r[0].pos){let e=r[0].pos,i=r[1]&&r[1].pos;null==i&&(i=e),m={anchor:e+l,head:i+l}}return{doc:g,sel:m,from:l,to:c}}(e,i,n),f=e.state.doc,m=f.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(o=e.state.selection.to,a="end"):(o=e.state.selection.from,a="start"),e.input.lastKeyCode=null;let g=function(e,i,n,r,s){let o=e.findDiffStart(i,n);if(null==o)return null;let{a:a,b:l}=e.findDiffEnd(i,n+e.size,n+i.size);if("end"==s){let e=Math.max(0,o-Math.min(a,l));r-=a+e-o}if(a<o&&e.size<i.size){let e=r<=o&&r>=a?o-r:0;(o-=e)&&o<i.size&&EG(i.textBetween(o-1,o+1))&&(o+=e?1:-1),l=o+(l-a),a=o}else if(l<o){let i=r<=o&&r>=l?o-r:0;(o-=i)&&o<e.size&&EG(e.textBetween(o-1,o+1))&&(o+=i?1:-1),a=o+(a-l),l=o}return{start:o,endA:a,endB:l}}(m.content,p.doc.content,p.from,o,a);if(g&&e.input.domChangeCount++,(CG&&e.input.lastIOSEnter>Date.now()-225||C0)&&s.some(e=>1==e.nodeType&&!EY.test(e.nodeName))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",i=>i(e,CP(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!g)if(r&&u instanceof kq&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))g={start:u.from,endA:u.to,endB:u.to};else{if(p.sel){let i=EX(e,e.state.doc,p.sel);if(i&&!i.eq(e.state.selection)){let n=e.state.tr.setSelection(i);c&&n.setMeta("composition",c),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof kq&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),CU&&CV<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&"  "==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);let v=p.doc.resolveNoCache(g.start-p.from),y=p.doc.resolveNoCache(g.endB-p.from),_=f.resolve(g.start),b=v.sameParent(y)&&v.parent.inlineContent&&_.end()>=g.endA;if((CG&&e.input.lastIOSEnter>Date.now()-225&&(!b||s.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!b&&v.pos<p.doc.content.size&&(!v.sameParent(y)||!v.parent.inlineContent)&&v.pos<y.pos&&!/\S/.test(p.doc.textBetween(v.pos,y.pos,"","")))&&e.someProp("handleKeyDown",i=>i(e,CP(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>g.start&&function(e,i,n,r,s){if(n-i<=s.pos-r.pos||EJ(r,!0,!1)<s.pos)return!1;let o=e.resolve(i);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==i+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let a=e.resolve(EJ(o,!0,!0));return!(!a.parent.isTextblock||a.pos>n||EJ(a,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(f,g.start,g.endA,v,y)&&e.someProp("handleKeyDown",i=>i(e,CP(8,"Backspace")))){C0&&CY&&e.domObserver.suppressSelectionUpdates();return}CY&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),C0&&!b&&v.start()!=y.start()&&0==y.parentOffset&&v.depth==y.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,y=p.doc.resolveNoCache(g.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(i){return i(e,CP(13,"Enter"))})},20));let w=g.start,S=g.endA,k=i=>{let n=i||e.state.tr.replace(w,S,p.doc.slice(g.start-p.from,g.endB-p.from));if(p.sel){let i=EX(e,n.doc,p.sel);i&&!(CY&&e.composing&&i.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(i.head==w||i.head==n.mapping.map(S)-1)||CU&&i.empty&&i.head==w)&&n.setSelection(i)}return c&&n.setMeta("composition",c),n.scrollIntoView()};if(b)if(v.pos==y.pos){CU&&CV<=11&&0==v.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>TO(e),20));let i=k(e.state.tr.delete(w,S)),n=f.resolve(g.start).marksAcross(f.resolve(g.endA));n&&i.ensureMarks(n),e.dispatch(i)}else if(g.endA==g.endB&&(l=function(e,i){let n=e.firstChild.marks,r=i.firstChild.marks,s=n,o=r,a,l,c;for(let e=0;e<r.length;e++)s=r[e].removeFromSet(s);for(let e=0;e<n.length;e++)o=n[e].removeFromSet(o);if(1==s.length&&0==o.length)l=s[0],a="add",c=e=>e.mark(l.addToSet(e.marks));else{if(0!=s.length||1!=o.length)return null;l=o[0],a="remove",c=e=>e.mark(l.removeFromSet(e.marks))}let d=[];for(let e=0;e<i.childCount;e++)d.push(c(i.child(e)));if(Sy.from(d).eq(e))return{mark:l,type:a}}(v.parent.content.cut(v.parentOffset,y.parentOffset),_.parent.content.cut(_.parentOffset,g.endA-_.start())))){let i=k(e.state.tr);"add"==l.type?i.addMark(w,S,l.mark):i.removeMark(w,S,l.mark),e.dispatch(i)}else if(v.parent.child(v.index()).isText&&v.index()==y.index()-!y.textOffset){let i=v.parent.textBetween(v.parentOffset,y.parentOffset),n=()=>k(e.state.tr.insertText(i,w,S));e.someProp("handleTextInput",r=>r(e,w,S,i,n))||e.dispatch(n())}else e.dispatch(k());else e.dispatch(k())})(this,e,i,n,r)),this.domObserver.start(),function(e){for(let i in T7){let n=T7[i];e.dom.addEventListener(i,e.input.eventHandlers[i]=i=>{!function(e,i){if(!i.bubbles)return!0;if(i.defaultPrevented)return!1;for(let n=i.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(i))return!1;return!0}(e,i)||Es(e,i)||!e.editable&&i.type in Ee||n(e,i)},Et[i]?{passive:!0}:void 0)}CJ&&e.dom.addEventListener("input",()=>null),Er(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let i in this._props={},e)this._props[i]=e[i];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Er(this);let i=this._props;this._props=e,e.plugins&&(e.plugins.forEach(E5),this.directPlugins=e.plugins),this.updateStateInner(e.state,i)}setProps(e){let i={};for(let e in this._props)i[e]=this._props[e];for(let n in i.state=this.state,e)i[n]=e[n];this.update(i)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,i){var n,r,s;let o=this.state,a=!1,l=!1;e.storedMarks&&this.composing&&(Ef(this),l=!0),this.state=e;let c=o.plugins!=e.plugins||this._props.plugins!=i.plugins;if(c||this._props.plugins!=i.plugins||this._props.nodeViews!=i.nodeViews){let e=E2(this);(function(e,i){let n=0,r=0;for(let r in e){if(e[r]!=i[r])return!0;n++}for(let e in i)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,a=!0)}(c||i.handleDOMEvents!=this._props.handleDOMEvents)&&Er(this),this.editable=E1(this),E0(this);let d=Ez(this),h=EQ(this),u=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",p=a||!this.docView.matchesNode(e.doc,h,d);(p||!e.selection.eq(o.selection))&&(l=!0);let f="preserve"==u&&l&&null==this.dom.style.overflowAnchor&&function(e){let i,n,r=e.dom.getBoundingClientRect(),s=Math.max(0,r.top);for(let o=(r.left+r.right)/2,a=s+1;a<Math.min(innerHeight,r.bottom);a+=5){let r=e.root.elementFromPoint(o,a);if(!r||r==e.dom||!e.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=s-20){i=r,n=l.top;break}}return{refDOM:i,refTop:n,stack:C4(e.dom)}}(this);if(l){let i,n,l;this.domObserver.stop();let c=p&&(CU||CY)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(r=o.selection,s=e.selection,l=Math.min(r.$anchor.sharedDepth(r.head),s.$anchor.sharedDepth(s.head)),r.$anchor.start(l)!=s.$anchor.start(l));if(p){let i=CY?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let i=e.domSelectionRange();if(!i.focusNode)return null;let n=function(e,i){for(;;){if(3==e.nodeType&&i)return e;if(1==e.nodeType&&i>0){if("false"==e.contentEditable)return null;i=CL(e=e.childNodes[i-1])}else{if(!e.parentNode||Cj(e))return null;i=CT(e),e=e.parentNode}}}(i.focusNode,i.focusOffset),r=function(e,i){for(;;){if(3==e.nodeType&&i<e.nodeValue.length)return e;if(1==e.nodeType&&i<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[i],i=0}else{if(!e.parentNode||Cj(e))return null;i=CT(e)+1,e=e.parentNode}}}(i.focusNode,i.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=e.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}(this)),(a||!this.docView.update(e.doc,h,d,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=Tm(e.doc,h,d,this.dom,this)),!i||this.trackWrites&&this.dom.contains(this.trackWrites)||(c=!0)}c||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(i=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),CO(i.node,i.offset,n.anchorNode,n.anchorOffset)))?TO(this,c):(TI(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null==(n=this.dragging)?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():f&&function({refDOM:e,refTop:i,stack:n}){let r=e?e.getBoundingClientRect().top:0;C6(n,0==r?0:r-i)}(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof kY){let i=this.docView.domAfterPos(this.state.selection.from);1==i.nodeType&&C3(this,i.getBoundingClientRect(),e)}else C3(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let i=0;i<this.pluginViews.length;i++){let n=this.pluginViews[i];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let i=this.directPlugins[e];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let i=this.state.plugins[e];i.spec.view&&this.pluginViews.push(i.spec.view(this))}}}updateDraggedNode(e,i){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-i.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new E_(e.slice,e.move,r<0?void 0:kY.create(this.state.doc,r))}someProp(e,i){let n=this._props&&this._props[e],r;if(null!=n&&(r=i?i(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let s=this.directPlugins[n].props[e];if(null!=s&&(r=i?i(s):s))return r}let s=this.state.plugins;if(s)for(let n=0;n<s.length;n++){let o=s[n].props[e];if(null!=o&&(r=i?i(o):o))return r}}hasFocus(){if(CU){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(C8)return e.focus(C8);let i=C4(e);e.focus(null==C8?{get preventScroll(){return C8={preventScroll:!0},!0}}:void 0),C8||(C8=!1,C6(i,0))}(this.dom),TO(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,i){var n;let r,s,o=e.dom.ownerDocument,a,l=0,c=function(e,i,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(i,n);if(r)return{node:r.offsetNode,offset:Math.min(CL(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(i,n);if(r)return{node:r.startContainer,offset:Math.min(CL(r.startContainer),r.startOffset)}}}(o,i.left,i.top);c&&({node:a,offset:l}=c);let d=(e.root.elementFromPoint?e.root:o).elementFromPoint(i.left,i.top);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){let n=e.dom.getBoundingClientRect();if(!C9(i,n)||!(d=function e(i,n,r){let s=i.childNodes.length;if(s&&r.top<r.bottom)for(let o=Math.max(0,Math.min(s-1,Math.floor(s*(n.top-r.top)/(r.bottom-r.top))-2)),a=o;;){let r=i.childNodes[a];if(1==r.nodeType){let i=r.getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(C9(n,o))return e(r,n,o)}}if((a=(a+1)%s)==o)break}return i}(e.dom,i,n)))return null}if(CJ)for(let e=d;a&&e;e=CE(e))e.draggable&&(a=void 0);if(d=(r=(n=d).parentNode)&&/^li$/i.test(r.nodeName)&&i.left<n.getBoundingClientRect().left?r:n,a){let n;if(Cq&&1==a.nodeType&&(l=Math.min(l,a.childNodes.length))<a.childNodes.length){let e=a.childNodes[l],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=i.left&&n.bottom>i.top&&l++}C1&&l&&1==a.nodeType&&1==(n=a.childNodes[l-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=i.top&&l--,a==e.dom&&l==a.childNodes.length-1&&1==a.lastChild.nodeType&&i.top>a.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(0==l||1!=a.nodeType||"BR"!=a.childNodes[l-1].nodeName)&&(s=function(e,i,n,r){let s=-1;for(let n=i,o=!1;n!=e.dom;){let i=e.docView.nearestDesc(n,!0),a;if(!i)return null;if(1==i.dom.nodeType&&(i.node.isBlock&&i.parent||!i.contentDOM)&&((a=i.dom.getBoundingClientRect()).width||a.height)&&(i.node.isBlock&&i.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(i.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?s=i.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(s=i.posAfter),o=!0),!i.contentDOM&&s<0&&!i.node.isText))return(i.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?i.posBefore:i.posAfter;n=i.dom.parentNode}return s>-1?s:e.docView.posFromDOM(i,n,-1)}(e,a,l,i))}null==s&&(s=function(e,i,n){let{node:r,offset:s}=function e(i,n){let r,s,o,a=2e8,l,c=0,d=n.top,h=n.top;for(let e=i.firstChild,u=0;e;e=e.nextSibling,u++){let i;if(1==e.nodeType)i=e.getClientRects();else{if(3!=e.nodeType)continue;i=CN(e).getClientRects()}for(let p=0;p<i.length;p++){let f=i[p];if(f.top<=d&&f.bottom>=h){d=Math.max(f.bottom,d),h=Math.min(f.top,h);let i=f.left>n.left?f.left-n.left:f.right<n.left?n.left-f.right:0;if(i<a){o=e,a=i,l=i&&3==o.nodeType?{left:f.right<n.left?f.right:f.left,top:n.top}:n,1==e.nodeType&&i&&(c=u+ +(n.left>=(f.left+f.right)/2));continue}}else f.top>n.top&&!r&&f.left<=n.left&&f.right>=n.left&&(r=e,s={left:Math.max(f.left,Math.min(f.right,n.left)),top:f.top});!o&&(n.left>=f.right&&n.top>=f.top||n.left>=f.left&&n.top>=f.bottom)&&(c=u+1)}}return(!o&&r&&(o=r,l=s,a=0),o&&3==o.nodeType)?function(e,i){let n=e.nodeValue.length,r=document.createRange(),s;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=Te(r,1);if(n.top!=n.bottom&&C9(i,n)){s={node:e,offset:o+ +(i.left>=(n.left+n.right)/2)};break}}return r.detach(),s||{node:e,offset:0}}(o,l):!o||a&&1==o.nodeType?{node:i,offset:c}:e(o,l)}(i,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,s,o)}(e,d,i));let h=e.docView.nearestDesc(d,!0);return{pos:s,inside:h?h.posAtStart-h.border:-1}}(this,e)}coordsAtPos(e,i=1){return Ti(this,e,i)}domAtPos(e,i=0){return this.docView.domFromPos(e,i)}nodeDOM(e){let i=this.docView.descAt(e);return i?i.nodeDOM:null}posAtDOM(e,i,n=-1){let r=this.docView.posFromDOM(e,i,n);if(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,i){return function(e,i,n){let r,s;return Ta==i&&Tl==n?Tc:(Ta=i,Tl=n,Tc="up"==n||"down"==n?(r=i.selection,s="up"==n?r.$from:r.$to,Ts(e,i,()=>{let{node:i}=e.docView.domFromPos(s.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(i,!0);if(!n)break;if(n.node.isBlock){i=n.contentDOM||n.dom;break}i=n.dom.parentNode}let r=Ti(e,s.pos,1);for(let e=i.firstChild;e;e=e.nextSibling){let i;if(1==e.nodeType)i=e.getClientRects();else{if(3!=e.nodeType)continue;i=CN(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<i.length;e++){let s=i[e];if(s.bottom>s.top+1&&("up"==n?r.top-s.top>(s.bottom-r.top)*2:s.bottom-r.bottom>(r.bottom-s.top)*2))return!1}}return!0})):function(e,i,n){let{$head:r}=i.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,o=s==r.parent.content.size,a=e.domSelection();return a?To.test(r.parent.textContent)&&a.modify?Ts(e,i,()=>{let{focusNode:i,focusOffset:s,anchorNode:o,anchorOffset:l}=e.domSelectionRange(),c=a.caretBidiLevel;a.modify("move",n,"character");let d=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:h,focusOffset:u}=e.domSelectionRange(),p=h&&!d.contains(1==h.nodeType?h:h.parentNode)||i==h&&s==u;try{a.collapse(o,l),i&&(i!=o||s!=l)&&a.extend&&a.extend(i,s)}catch(e){}return null!=c&&(a.caretBidiLevel=c),p}):"left"==n||"backward"==n?!s:o:r.pos==r.start()||r.pos==r.end()}(e,i,n))}(this,i||this.state,e)}pasteHTML(e,i){return Ev(this,"",e,!1,i||new ClipboardEvent("paste"))}pasteText(e,i){return Ev(this,e,null,!0,i||new ClipboardEvent("paste"))}serializeForClipboard(e){return TQ(this,e)}destroy(){if(this.docView){for(let e in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ez(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,CM()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!Es(this,e)&&T7[e.type]&&(this.editable||!(e.type in Ee))&&T7[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?CJ&&11===this.root.nodeType&&function(e){let i=e.activeElement;for(;i&&i.shadowRoot;)i=i.shadowRoot.activeElement;return i}(this.dom.ownerDocument)==this.dom&&function(e,i){let n;if(i.getComposedRanges){let n=i.getComposedRanges(e.root)[0];if(n)return Eq(e,n)}function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Eq(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function EQ(e){let i=Object.create(null);return i.class="ProseMirror",i.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?i.class+=" "+n[e]:"style"==e?i.style=(i.style?i.style+";":"")+n[e]:i[e]||"contenteditable"==e||"nodeName"==e||(i[e]=String(n[e]))}),i.translate||(i.translate="no"),[ET.node(0,e.state.doc.content.size,i)]}function E0(e){if(e.markCursor){let i=document.createElement("img");i.className="ProseMirror-separator",i.setAttribute("mark-placeholder","true"),i.setAttribute("alt",""),e.cursorWrapper={dom:i,deco:ET.widget(e.state.selection.from,i,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function E1(e){return!e.someProp("editable",i=>!1===i(e.state))}function E2(e){let i=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(i,n)||(i[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),i}function E5(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}EZ.prototype.dispatch=function(e){let i=this._props.dispatchTransaction;i?i.call(this,e):this.updateState(this.state.apply(e))};for(var E3={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},E4={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},E6="u">typeof navigator&&/Mac/.test(navigator.platform),E8="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),E9=0;E9<10;E9++)E3[48+E9]=E3[96+E9]=String(E9);for(var E9=1;E9<=24;E9++)E3[E9+111]="F"+E9;for(var E9=65;E9<=90;E9++)E3[E9]=String.fromCharCode(E9+32),E4[E9]=String.fromCharCode(E9);for(var E7 in E3)E4.hasOwnProperty(E7)||(E4[E7]=E3[E7]);let De="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Dt="u">typeof navigator&&/Win/.test(navigator.platform);function Di(e,i,n=!0){return i.altKey&&(e="Alt-"+e),i.ctrlKey&&(e="Ctrl-"+e),i.metaKey&&(e="Meta-"+e),n&&i.shiftKey&&(e="Shift-"+e),e}function Dn(e){let i=function(e){let i=Object.create(null);for(let n in e)i[function(e){let i,n,r,s,o=e.split(/-(?!$)/),a=o[o.length-1];"Space"==a&&(a=" ");for(let e=0;e<o.length-1;e++){let a=o[e];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))i=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else if(/^s(hift)?$/i.test(a))r=!0;else if(/^mod$/i.test(a))De?s=!0:n=!0;else throw Error("Unrecognized modifier name: "+a)}return i&&(a="Alt-"+a),n&&(a="Ctrl-"+a),s&&(a="Meta-"+a),r&&(a="Shift-"+a),a}(n)]=e[n];return i}(e);return function(e,n){var r;let s=("Esc"==(r=!(E6&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||E8&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?E4:E3)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),o,a=i[Di(s,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(1==s.length&&" "!=s){if(n.shiftKey){let r=i[Di(s,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Dt&&n.ctrlKey&&n.altKey)&&(o=E3[n.keyCode])&&o!=s){let r=i[Di(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var Dr=Object.defineProperty,Ds=(e,i)=>{for(var n in i)Dr(e,n,{get:i[n],enumerable:!0})};function Do(e){let{state:i,transaction:n}=e,{selection:r}=n,{doc:s}=n,{storedMarks:o}=n;return{...i,apply:i.apply.bind(i),applyTransaction:i.applyTransaction.bind(i),plugins:i.plugins,schema:i.schema,reconfigure:i.reconfigure.bind(i),toJSON:i.toJSON.bind(i),get storedMarks(){return o},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,o=n.storedMarks,n}}}var Da=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:i,state:n}=this,{view:r}=i,{tr:s}=n,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([e,i])=>[e,(...e)=>{let n=i(...e)(o);return s.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(s),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,i=!0){let{rawCommands:n,editor:r,state:s}=this,{view:o}=r,a=[],l=!!e,c=e||s.tr,d=()=>(l||!i||c.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(c),a.every(e=>!0===e)),h={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,i),s=n(...e)(r);return a.push(s),h}])),run:d};return h}createCan(e){let{rawCommands:i,state:n}=this,r=e||n.tr,s=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(i).map(([e,i])=>[e,(...e)=>i(...e)({...s,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,i=!0){let{rawCommands:n,editor:r,state:s}=this,{view:o}=r,a={tr:e,editor:r,view:o,state:Do({state:s,transaction:e}),dispatch:i?()=>void 0:void 0,chain:()=>this.createChain(e,i),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,i])=>[e,(...e)=>i(...e)(a)]))}};return a}},Dl={};Ds(Dl,{blur:()=>Dc,clearContent:()=>Dd,clearNodes:()=>Dh,command:()=>Du,createParagraphNear:()=>Dp,cut:()=>Df,deleteCurrentNode:()=>Dm,deleteNode:()=>Dv,deleteRange:()=>Dy,deleteSelection:()=>D_,enter:()=>Dx,exitCode:()=>Db,extendMarkRange:()=>DD,first:()=>DN,focus:()=>Dj,forEach:()=>DI,insertContent:()=>DP,insertContentAt:()=>DH,joinBackward:()=>DU,joinDown:()=>D$,joinForward:()=>DV,joinItemBackward:()=>Dq,joinItemForward:()=>DK,joinTextblockBackward:()=>DY,joinTextblockForward:()=>DX,joinUp:()=>DW,keyboardShortcut:()=>DG,lift:()=>DQ,liftEmptyBlock:()=>D0,liftListItem:()=>D1,newlineInCode:()=>D2,resetAttributes:()=>D4,scrollIntoView:()=>D6,selectAll:()=>D8,selectNodeBackward:()=>D9,selectNodeForward:()=>D7,selectParentNode:()=>Ne,selectTextblockEnd:()=>Nt,selectTextblockStart:()=>Ni,setContent:()=>Nr,setMark:()=>NB,setMeta:()=>Nz,setNode:()=>NF,setNodeSelection:()=>NH,setTextDirection:()=>NW,setTextSelection:()=>N$,sinkListItem:()=>NU,splitBlock:()=>Nq,splitListItem:()=>NK,toggleList:()=>NJ,toggleMark:()=>NG,toggleNode:()=>NZ,toggleWrap:()=>NQ,undoInputRule:()=>N0,unsetAllMarks:()=>N1,unsetMark:()=>N2,unsetTextDirection:()=>N5,updateAttributes:()=>N3,wrapIn:()=>N4,wrapInList:()=>N6});var Dc=()=>({editor:e,view:i})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(i.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),Dd=(e=!0)=>({commands:i})=>i.setContent("",{emitUpdate:e}),Dh=()=>({state:e,tr:i,dispatch:n})=>{let{selection:r}=i,{ranges:s}=r;return!n||(s.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:s}=i,o=r.resolve(s.map(n)),a=r.resolve(s.map(n+e.nodeSize)),l=o.blockRange(a);if(!l)return;let c=k_(l);if(e.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.index());i.setNodeMarkup(l.start,e)}(c||0===c)&&i.lift(l,c)})}),!0)},Du=e=>i=>e(i),Dp=()=>({state:e,dispatch:i})=>Cf(e,i),Df=(e,i)=>({editor:n,tr:r})=>{let{state:s}=n,o=s.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let a=r.mapping.map(i);return r.insert(a,o.content),r.setSelection(new kq(r.doc.resolve(Math.max(a-1,0)))),!0},Dm=()=>({tr:e,dispatch:i})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let s=e.selection.$anchor;for(let n=s.depth;n>0;n-=1)if(s.node(n).type===r.type){if(i){let i=s.before(n),r=s.after(n);e.delete(i,r).scrollIntoView()}return!0}return!1};function Dg(e,i){if("string"==typeof e){if(!i.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return i.nodes[e]}return e}var Dv=e=>({tr:i,state:n,dispatch:r})=>{let s=Dg(e,n.schema),o=i.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===s){if(r){let n=o.before(e),r=o.after(e);i.delete(n,r).scrollIntoView()}return!0}return!1},Dy=e=>({tr:i,dispatch:n})=>{let{from:r,to:s}=e;return n&&i.delete(r,s),!0},D_=()=>({state:e,dispatch:i})=>Ce(e,i),Dx=()=>({commands:e})=>e.keyboardShortcut("Enter"),Db=()=>({state:e,dispatch:i})=>Cp(e,i);function Dw(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function DS(e,i,n={strict:!0}){let r=Object.keys(i);return!r.length||r.every(r=>n.strict?i[r]===e[r]:Dw(i[r])?i[r].test(e[r]):i[r]===e[r])}function Dk(e,i,n={}){return e.find(e=>e.type===i&&DS(Object.fromEntries(Object.keys(n).map(i=>[i,e.attrs[i]])),n))}function DC(e,i,n={}){return!!Dk(e,i,n)}function DT(e,i,n){if(!e||!i)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===i)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===i))return;if(!n){let e=r.node.marks.find(e=>e.type===i);e&&(n=e.attrs)}if(!Dk([...r.node.marks],i,n))return;let s=r.index,o=e.start()+r.offset,a=s+1,l=o+r.node.nodeSize;for(;s>0&&DC([...e.parent.child(s-1).marks],i,n);)s-=1,o-=e.parent.child(s).nodeSize;for(;a<e.parent.childCount&&DC([...e.parent.child(a).marks],i,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:o,to:l}}function DE(e,i){if("string"==typeof e){if(!i.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return i.marks[e]}return e}var DD=(e,i)=>({tr:n,state:r,dispatch:s})=>{let o=DE(e,r.schema),{doc:a,selection:l}=n,{$from:c,from:d,to:h}=l;if(s){let e=DT(c,o,i);if(e&&e.from<=d&&e.to>=h){let i=kq.create(a,e.from,e.to);n.setSelection(i)}}return!0},DN=e=>i=>{let n="function"==typeof e?e(i):e;for(let e=0;e<n.length;e+=1)if(n[e](i))return!0;return!1};function DM(e){return e instanceof kq}function DO(e=0,i=0,n=0){return Math.min(Math.max(e,i),n)}function DR(e,i=null){if(!i)return null;let n=kW.atStart(e),r=kW.atEnd(e);if("start"===i||!0===i)return n;if("end"===i)return r;let s=n.from,o=r.to;return"all"===i?kq.create(e,DO(0,s,o),DO(e.content.size,s,o)):kq.create(e,DO(i,s,o),DO(i,s,o))}function DA(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function DL(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Dj=(e=null,i={})=>({editor:n,view:r,tr:s,dispatch:o})=>{i={scrollIntoView:!0,...i};let a=()=>{(DL()||DA())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!DL()&&!DA()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==i?void 0:i.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(o&&null===e&&!DM(n.state.selection))return a(),!0;let l=DR(s.doc,e)||n.state.selection,c=n.state.selection.eq(l);return o&&(c||s.setSelection(l),c&&s.storedMarks&&s.setStoredMarks(s.storedMarks),a()),!0},DI=(e,i)=>n=>e.every((e,r)=>i(e,{...n,index:r})),DP=(e,i)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,i),DB=e=>{let i=e.childNodes;for(let n=i.length-1;n>=0;n-=1){let r=i[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&DB(r)}return e};function Dz(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let i=`<body>${e}</body>`;return DB(new window.DOMParser().parseFromString(i,"text/html").body)}function DF(e,i,n){if(e instanceof SP||e instanceof Sy)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,s="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return Sy.fromArray(e.map(e=>i.nodeFromJSON(e)));let r=i.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),DF("",i,n)}if(s){if(n.errorOnInvalidContent){let r=!1,s="",o=new SZ({topNode:i.spec.topNode,marks:i.spec.marks,nodes:i.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,s="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?S0.fromSchema(o).parseSlice(Dz(e),n.parseOptions):S0.fromSchema(o).parse(Dz(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${s}`)})}let r=S0.fromSchema(i);return n.slice?r.parseSlice(Dz(e),n.parseOptions).content:r.parse(Dz(e),n.parseOptions)}return DF("",i,n)}var DH=(e,i,n)=>({tr:r,dispatch:s,editor:o})=>{var a;if(s){let s,l;n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c=e=>{o.emit("contentError",{editor:o,error:e,disableCollaboration:()=>{"collaboration"in o.storage&&"object"==typeof o.storage.collaboration&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{DF(i,o.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(e){c(e)}try{s=DF(i,o.schema,{parseOptions:d,errorOnInvalidContent:null!=(a=n.errorOnInvalidContent)?a:o.options.enableContentCheck})}catch(e){return c(e),!1}let{from:h,to:u}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,f=!0;if((!("type"in s)?s:[s]).forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,f=!!f&&e.isBlock}),h===u&&f){let{parent:e}=r.doc.resolve(h);!e.isTextblock||e.type.spec.code||e.childCount||(h-=1,u+=1)}if(p){if(Array.isArray(i))l=i.map(e=>e.text||"").join("");else if(i instanceof Sy){let e="";i.forEach(i=>{i.text&&(e+=i.text)}),l=e}else l="object"==typeof i&&i&&i.text?i.text:i;r.insertText(l,h,u)}else{l=s;let e=r.doc.resolve(h),i=e.node(),n=0===e.parentOffset,o=i.isText||i.isTextblock,a=i.content.size>0;n&&o&&a&&f&&(h=Math.max(0,h-1)),r.replaceWith(h,u,l)}n.updateSelection&&function(e,i){let n=e.steps.length-1;if(n<i)return;let r=e.steps[n];if(!(r instanceof km||r instanceof kg))return;let s=e.mapping.maps[n],o=0;s.forEach((e,i,n,r)=>{0===o&&(o=r)}),e.setSelection(kW.near(e.doc.resolve(o),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:l}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:l})}return!0},DW=()=>({state:e,dispatch:i})=>((e,i)=>{let n=e.selection,r=n instanceof kY,s;if(r){if(n.node.isTextblock||!kC(e.doc,n.from))return!1;s=n.from}else if(null==(s=kE(e.doc,n.from,-1)))return!1;if(i){let n=e.tr.join(s);r&&n.setSelection(kY.create(n.doc,s-e.doc.resolve(s).nodeBefore.nodeSize)),i(n.scrollIntoView())}return!0})(e,i),D$=()=>({state:e,dispatch:i})=>((e,i)=>{let n=e.selection,r;if(n instanceof kY){if(n.node.isTextblock||!kC(e.doc,n.to))return!1;r=n.to}else if(null==(r=kE(e.doc,n.to,1)))return!1;return i&&i(e.tr.join(r).scrollIntoView()),!0})(e,i),DU=()=>({state:e,dispatch:i})=>Ci(e,i),DV=()=>({state:e,dispatch:i})=>Cl(e,i),Dq=()=>({state:e,dispatch:i,tr:n})=>{try{let r=kE(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),i&&i(n),!0}catch{return!1}},DK=()=>({state:e,dispatch:i,tr:n})=>{try{let r=kE(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),i&&i(n),!0}catch{return!1}},DY=()=>({state:e,dispatch:i})=>((e,i,n)=>{let r=Ct(e,n);if(!r)return!1;let s=Co(r);return!!s&&Cn(e,s,i)})(e,i),DX=()=>({state:e,dispatch:i})=>((e,i,n)=>{let r=Ca(e,n);if(!r)return!1;let s=Cd(r);return!!s&&Cn(e,s,i)})(e,i);function DJ(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var DG=e=>({editor:i,view:n,tr:r,dispatch:s})=>{let o=(function(e){let i,n,r,s,o=e.split(/-(?!$)/),a=o[o.length-1];"Space"===a&&(a=" ");for(let e=0;e<o.length-1;e+=1){let a=o[e];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))i=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else if(/^s(hift)?$/i.test(a))r=!0;else if(/^mod$/i.test(a))DL()||DJ()?s=!0:n=!0;else throw Error(`Unrecognized modifier name: ${a}`)}return i&&(a=`Alt-${a}`),n&&(a=`Ctrl-${a}`),s&&(a=`Meta-${a}`),r&&(a=`Shift-${a}`),a})(e).split(/-(?!$)/),a=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),l=new KeyboardEvent("keydown",{key:"Space"===a?" ":a,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),c=i.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,l))});return null==c||c.steps.forEach(e=>{let i=e.map(r.mapping);i&&s&&r.maybeStep(i)}),!0};function DZ(e,i,n={}){let{from:r,to:s,empty:o}=e.selection,a=i?Dg(i,e.schema):null,l=[];e.doc.nodesBetween(r,s,(e,i)=>{if(e.isText)return;let n=Math.max(r,i),o=Math.min(s,i+e.nodeSize);l.push({node:e,from:n,to:o})});let c=s-r,d=l.filter(e=>!a||a.name===e.node.type.name).filter(e=>DS(e.node.attrs,n,{strict:!1}));return o?!!d.length:d.reduce((e,i)=>e+i.to-i.from,0)>=c}var DQ=(e,i={})=>({state:n,dispatch:r})=>{let s=Dg(e,n.schema);return!!DZ(n,s,i)&&((e,i)=>{let{$from:n,$to:r}=e.selection,s=n.blockRange(r),o=s&&k_(s);return null!=o&&(i&&i(e.tr.lift(s,o).scrollIntoView()),!0)})(n,r)},D0=()=>({state:e,dispatch:i})=>Cm(e,i),D1=e=>({state:i,dispatch:n})=>{var r;return(r=Dg(e,i.schema),function(e,i){let{$from:n,$to:s}=e.selection,o=n.blockRange(s,e=>e.childCount>0&&e.firstChild.type==r);return!!o&&(!i||(n.node(o.depth-1).type==r?function(e,i,n,r){let s=e.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(s.step(new kg(o-1,a,o,a,new Sk(Sy.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Sj(s.doc.resolve(r.$from.pos),s.doc.resolve(a),r.depth));let l=k_(r);if(null==l)return!1;s.lift(r,l);let c=s.doc.resolve(s.mapping.map(o,-1)-1);return kC(s.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&s.join(c.pos),i(s.scrollIntoView()),!0}(e,i,r,o):function(e,i,n){let r=e.tr,s=n.parent;for(let e=n.end,i=n.endIndex-1,o=n.startIndex;i>o;i--)e-=s.child(i).nodeSize,r.delete(e-1,e+1);let o=r.doc.resolve(n.start),a=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,c=n.endIndex==s.childCount,d=o.node(-1),h=o.index(-1);if(!d.canReplace(h+ +!l,h+1,a.content.append(c?Sy.empty:Sy.from(s))))return!1;let u=o.pos,p=u+a.nodeSize;return r.step(new kg(u-!!l,p+ +!!c,u+1,p-1,new Sk((l?Sy.empty:Sy.from(s.copy(Sy.empty))).append(c?Sy.empty:Sy.from(s.copy(Sy.empty))),+!l,+!c),+!l)),i(r.scrollIntoView()),!0}(e,i,o)))})(i,n)},D2=()=>({state:e,dispatch:i})=>Ch(e,i);function D5(e,i){return i.nodes[e]?"node":i.marks[e]?"mark":null}function D3(e,i){let n="string"==typeof i?[i]:i;return Object.keys(e).reduce((i,r)=>(n.includes(r)||(i[r]=e[r]),i),{})}var D4=(e,i)=>({tr:n,state:r,dispatch:s})=>{let o=null,a=null,l=D5("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(o=Dg(e,r.schema)),"mark"===l&&(a=DE(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&(c=!0,s&&n.setNodeMarkup(r,void 0,D3(e.attrs,i))),a&&e.marks.length&&e.marks.forEach(o=>{a===o.type&&(c=!0,s&&n.addMark(r,r+e.nodeSize,a.create(D3(o.attrs,i))))})})}),c},D6=()=>({tr:e,dispatch:i})=>(i&&e.scrollIntoView(),!0),D8=()=>({tr:e,dispatch:i})=>{if(i){let i=new kJ(e.doc);e.setSelection(i)}return!0},D9=()=>({state:e,dispatch:i})=>Cs(e,i),D7=()=>({state:e,dispatch:i})=>Cc(e,i),Ne=()=>({state:e,dispatch:i})=>((e,i)=>{let{$from:n,to:r}=e.selection,s,o=n.sharedDepth(r);return 0!=o&&(s=n.before(o),i&&i(e.tr.setSelection(kY.create(e.doc,s))),!0)})(e,i),Nt=()=>({state:e,dispatch:i})=>C_(e,i),Ni=()=>({state:e,dispatch:i})=>Cy(e,i);function Nn(e,i,n={},r={}){return DF(e,i,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Nr=(e,{errorOnInvalidContent:i,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:o,dispatch:a,commands:l})=>{let{doc:c}=o;if("full"!==r.preserveWhitespace){let l=Nn(e,s.schema,r,{errorOnInvalidContent:null!=i?i:s.options.enableContentCheck});return a&&o.replaceWith(0,c.content.size,l).setMeta("preventUpdate",!n),!0}return a&&o.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=i?i:s.options.enableContentCheck})};function Ns(e,i){let n=DE(i,e.schema),{from:r,to:s,empty:o}=e.selection,a=[];o?(e.storedMarks&&a.push(...e.storedMarks),a.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,s,e=>{a.push(...e.marks)});let l=a.find(e=>e.type.name===n.name);return l?{...l.attrs}:{}}function No(e,i){let n=new kF(e);return i.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Na(e){return i=>(function(e,i){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(i(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}})(i.$from,e)}function Nl(e,i,n){return void 0===e.config[i]&&e.parent?Nl(e.parent,i,n):"function"==typeof e.config[i]?e.config[i].bind({...n,parent:e.parent?Nl(e.parent,i,n):null}):e.config[i]}function Nc(e){return e.map(e=>{let i={name:e.name,options:e.options,storage:e.storage},n=Nl(e,"addExtensions",i);return n?[e,...Nc(n())]:e}).flat(10)}function Nd(e,i){let n=S7.fromSchema(i).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function Nh(e){return"function"==typeof e}function Nu(e,i,...n){return Nh(e)?i?e.bind(i)(...n):e(...n):e}function Np(e){let i=e.filter(e=>"extension"===e.type);return{baseExtensions:i,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Nf(e){let i=[],{nodeExtensions:n,markExtensions:r}=Np(e),s=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},a=n.filter(e=>"text"!==e.name).map(e=>e.name),l=r.map(e=>e.name),c=[...a,...l];return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:s},r=Nl(e,"addGlobalAttributes",n);r&&r().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?c:"nodes"===e.types?a:"marks"===e.types?l:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{i.push({type:n,name:e,attribute:{...o,...r}})})})})}),s.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=Nl(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let s={...o,...r};"function"==typeof(null==s?void 0:s.default)&&(s.default=s.default()),(null==s?void 0:s.isRequired)&&(null==s?void 0:s.default)===void 0&&delete s.default,i.push({type:e.name,name:n,attribute:s})})}),i}function Nm(e){let i=[],n=function(e){let i=[],n="",r=!1,s=!1,o=0,a=e.length;for(let l=0;l<a;l+=1){let a=e[l];if("'"===a&&!s){r=!r,n+=a;continue}if('"'===a&&!r){s=!s,n+=a;continue}if(!r&&!s){if("("===a){o+=1,n+=a;continue}if(")"===a&&o>0){o-=1,n+=a;continue}if(";"===a&&0===o){i.push(n),n="";continue}}n+=a}return n&&i.push(n),i}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],s=r.indexOf(":");if(-1===s)continue;let o=r.slice(0,s).trim(),a=r.slice(s+1).trim();o&&a&&i.push([o,a])}return i}function Ng(...e){return e.filter(e=>!!e).reduce((e,i)=>{let n={...e};return Object.entries(i).forEach(([e,i])=>{if(!n[e]){n[e]=i;return}if("class"===e){let r=i?String(i).split(" "):[],s=n[e]?n[e].split(" "):[],o=r.filter(e=>!s.includes(e));n[e]=[...s,...o].join(" ")}else if("style"===e){let r=new Map([...Nm(n[e]),...Nm(i)]);n[e]=Array.from(r.entries()).map(([e,i])=>`${e}: ${i}`).join("; ")}else n[e]=i}),n},{})}function Nv(e,i){return i.filter(i=>i.type===e.type.name).filter(e=>e.attribute.rendered).map(i=>i.attribute.renderHTML?i.attribute.renderHTML(e.attrs)||{}:{[i.name]:e.attrs[i.name]}).reduce((e,i)=>Ng(e,i),{})}function Ny(e,i){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let s=i.reduce((e,i)=>{var r;let s=i.attribute.parseHTML?i.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(i.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==s?e:{...e,[i.name]:s}},{});return{...r,...s}}}}function N_(e){return Object.fromEntries(Object.entries(e).filter(([e,i])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(i))&&null!=i))}function Nx(e){var i,n;let r={};return!(null==(i=null==e?void 0:e.attribute)?void 0:i.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function Nb(e){return e.sort((e,i)=>{let n=Nl(e,"priority")||100,r=Nl(i,"priority")||100;return n>r?-1:+(n<r)})}function Nw(e){var i;let n=Nb(Nc(e)),r=Array.from(new Set((i=n.map(e=>e.name)).filter((e,n)=>i.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function NS(e,i,n){let{from:r,to:s}=i,{blockSeparator:o="\n\n",textSerializers:a={}}=n||{},l="";return e.nodesBetween(r,s,(e,n,c,d)=>{var h;e.isBlock&&n>r&&(l+=o);let u=null==a?void 0:a[e.type.name];if(u)return c&&(l+=u({node:e,pos:n,parent:c,index:d,range:i})),!1;e.isText&&(l+=null==(h=null==e?void 0:e.text)?void 0:h.slice(Math.max(r,n)-n,s-n))}),l}function Nk(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,i])=>[e,i.spec.toText]))}function NC(e,i){let n=D5("string"==typeof i?i:i.name,e.schema);return"node"===n?function(e,i){let n=Dg(i,e.schema),{from:r,to:s}=e.selection,o=[];e.doc.nodesBetween(r,s,e=>{o.push(e)});let a=o.reverse().find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}(e,i):"mark"===n?Ns(e,i):{}}function NT(e){let i,{mapping:n,steps:r}=e,s=[];return n.maps.forEach((e,i)=>{let o=[];if(e.ranges.length)e.forEach((e,i)=>{o.push({from:e,to:i})});else{let{from:e,to:n}=r[i];if(void 0===e||void 0===n)return;o.push({from:e,to:n})}o.forEach(({from:e,to:r})=>{let o=n.slice(i).map(e,-1),a=n.slice(i).map(r),l=n.invert().map(o,-1),c=n.invert().map(a);s.push({oldRange:{from:l,to:c},newRange:{from:o,to:a}})})}),1===(i=function(e,i=JSON.stringify){let n={};return e.filter(e=>{let r=i(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(s)).length?i:i.filter((e,n)=>!i.filter((e,i)=>i!==n).some(i=>e.oldRange.from>=i.oldRange.from&&e.oldRange.to<=i.oldRange.to&&e.newRange.from>=i.newRange.from&&e.newRange.to<=i.newRange.to))}function NE(e,i,n){let r=[];return e===i?n.resolve(e).marks().forEach(i=>{let s=DT(n.resolve(e),i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(e,i,(e,i)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:i,to:i+e.nodeSize,mark:n})))}),r}function ND(e,i){return i.nodes[e]||i.marks[e]||null}function NN(e,i,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===i&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function NM(e,i,n={}){let{empty:r,ranges:s}=e.selection,o=i?DE(i,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>DS(e.attrs,n,{strict:!1}));let a=0,l=[];if(s.forEach(({$from:i,$to:n})=>{let r=i.pos,s=n.pos;e.doc.nodesBetween(r,s,(e,i)=>{if(o&&e.inlineContent&&!e.type.allowsMarkType(o))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,i),c=Math.min(s,i+e.nodeSize);a+=c-n,l.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),0===a)return!1;let c=l.filter(e=>!o||o.name===e.mark.type.name).filter(e=>DS(e.mark.attrs,n,{strict:!1})).reduce((e,i)=>e+i.to-i.from,0),d=l.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,i)=>e+i.to-i.from,0);return(c>0?c+d:c)>=a}function NO(e,i){return Array.isArray(i)?i.some(i=>("string"==typeof i?i:i.name)===e.name):i}function NR(e,i){let{nodeExtensions:n}=Np(i),r=n.find(i=>i.name===e);if(!r)return!1;let s={name:r.name,options:r.options,storage:r.storage},o=Nu(Nl(r,"group",s));return"string"==typeof o&&o.split(" ").includes("list")}function NA(e,{checkChildren:i=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(i){let r=!0;return e.content.forEach(e=>{!1!==r&&(NA(e,{ignoreWhitespace:n,checkChildren:i})||(r=!1))}),r}return!1}function NL(e){return e instanceof kY}var Nj=class e{constructor(e){this.position=e}static fromJSON(i){return new e(i.position)}toJSON(){return{position:this.position}}};function NI(e,i){let n=i.mapping.mapResult(e.position);return{position:new Nj(n.pos),mapResult:n}}function NP(e){return new Nj(e)}var NB=(e,i={})=>({tr:n,state:r,dispatch:s})=>{let{selection:o}=n,{empty:a,ranges:l}=o,c=DE(e,r.schema);if(s)if(a){let e=Ns(r,c);n.addStoredMark(c.create({...e,...i}))}else l.forEach(e=>{let s=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(s,o,(e,r)=>{let a=Math.max(r,s),l=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(a,l,c.create({...e.attrs,...i}))}):n.addMark(a,l,c.create(i))})});return function(e,i,n){var r;let{selection:s}=i,o=null;if(DM(s)&&(o=s.$cursor),o){let i=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(i)||!i.some(e=>e.type.excludes(n)))}let{ranges:a}=s;return a.some(({$from:i,$to:r})=>{let s=0===i.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(i.pos,r.pos,(e,i,r)=>{if(s)return!1;if(e.isInline){let i=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));s=i&&o}return!s}),s})}(r,n,c)},Nz=(e,i)=>({tr:n})=>(n.setMeta(e,i),!0),NF=(e,i={})=>({state:n,dispatch:r,chain:s})=>{let o,a=Dg(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock)?s().command(({commands:e})=>!!Cx(a,{...o,...i})(n)||e.clearNodes()).command(({state:e})=>Cx(a,{...o,...i})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},NH=e=>({tr:i,dispatch:n})=>{if(n){let{doc:n}=i,r=DO(e,0,n.content.size),s=kY.create(n,r);i.setSelection(s)}return!0},NW=(e,i)=>({tr:n,state:r,dispatch:s})=>{let o,a,{selection:l}=r;return"number"==typeof i?(o=i,a=i):i&&"from"in i&&"to"in i?(o=i.from,a=i.to):(o=l.from,a=l.to),s&&n.doc.nodesBetween(o,a,(i,r)=>{i.isText||n.setNodeMarkup(r,void 0,{...i.attrs,dir:e})}),!0},N$=e=>({tr:i,dispatch:n})=>{if(n){let{doc:n}=i,{from:r,to:s}="number"==typeof e?{from:e,to:e}:e,o=kq.atStart(n).from,a=kq.atEnd(n).to,l=DO(r,o,a),c=DO(s,o,a),d=kq.create(n,l,c);i.setSelection(d)}return!0},NU=e=>({state:i,dispatch:n})=>{var r;return(r=Dg(e,i.schema),function(e,i){let{$from:n,$to:s}=e.selection,o=n.blockRange(s,e=>e.childCount>0&&e.firstChild.type==r);if(!o)return!1;let a=o.startIndex;if(0==a)return!1;let l=o.parent,c=l.child(a-1);if(c.type!=r)return!1;if(i){let n=c.lastChild&&c.lastChild.type==l.type,s=Sy.from(n?r.create():null),a=new Sk(Sy.from(r.create(null,Sy.from(l.type.create(null,s)))),n?3:1,0),d=o.start,h=o.end;i(e.tr.step(new kg(d-(n?3:1),h,d,h,a,1,!0)).scrollIntoView())}return!0})(i,n)};function NV(e,i){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==i?void 0:i.includes(e.type.name));e.tr.ensureMarks(r)}}var Nq=({keepMarks:e=!0}={})=>({tr:i,state:n,dispatch:r,editor:s})=>{let{selection:o,doc:a}=i,{$from:l,$to:c}=o,d=NN(s.extensionManager.attributes,l.node().type.name,l.node().attrs);if(o instanceof kY&&o.node.isBlock)return!!l.parentOffset&&!!kk(a,l.pos)&&(r&&(e&&NV(n,s.extensionManager.splittableMarks),i.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let h=c.parentOffset===c.parent.content.size,u=0===l.depth?void 0:function(e){for(let i=0;i<e.edgeCount;i+=1){let{type:n}=e.edge(i);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(l.node(-1).contentMatchAt(l.indexAfter(-1))),p=h&&u?[{type:u,attrs:d}]:void 0,f=kk(i.doc,i.mapping.map(l.pos),1,p);if(!p&&!f&&kk(i.doc,i.mapping.map(l.pos),1,u?[{type:u}]:void 0)&&(f=!0,p=u?[{type:u,attrs:d}]:void 0),r){if(f&&(o instanceof kq&&i.deleteSelection(),i.split(i.mapping.map(l.pos),1,p),u&&!h&&!l.parentOffset&&l.parent.type!==u)){let e=i.mapping.map(l.before()),n=i.doc.resolve(e);l.node(-1).canReplaceWith(n.index(),n.index()+1,u)&&i.setNodeMarkup(i.mapping.map(l.before()),u)}e&&NV(n,s.extensionManager.splittableMarks),i.scrollIntoView()}return f},NK=(e,i={})=>({tr:n,state:r,dispatch:s,editor:o})=>{var a;let l=Dg(e,r.schema),{$from:c,$to:d}=r.selection,h=r.selection.node;if(h&&h.isBlock||c.depth<2||!c.sameParent(d))return!1;let u=c.node(-1);if(u.type!==l)return!1;let p=o.extensionManager.attributes;if(0===c.parent.content.size&&c.node(-1).childCount===c.indexAfter(-1)){if(2===c.depth||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(s){let e=Sy.empty,r=c.index(-1)?1:c.index(-2)?2:3;for(let i=c.depth-r;i>=c.depth-3;i-=1)e=Sy.from(c.node(i).copy(e));let s=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,o={...NN(p,c.node().type.name,c.node().attrs),...i},d=(null==(a=l.contentMatch.defaultType)?void 0:a.createAndFill(o))||void 0;e=e.append(Sy.from(l.createAndFill(null,d)||void 0));let h=c.before(c.depth-(r-1));n.replace(h,c.after(-s),new Sk(e,4-r,0));let u=-1;n.doc.nodesBetween(h,n.doc.content.size,(e,i)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=i+1)}),u>-1&&n.setSelection(kq.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=d.pos===c.end()?u.contentMatchAt(0).defaultType:null,m={...NN(p,u.type.name,u.attrs),...i},g={...NN(p,c.node().type.name,c.node().attrs),...i};n.delete(c.pos,d.pos);let v=f?[{type:l,attrs:m},{type:f,attrs:g}]:[{type:l,attrs:m}];if(!kk(n.doc,c.pos,2))return!1;if(s){let{selection:e,storedMarks:i}=r,{splittableMarks:a}=o.extensionManager,l=i||e.$to.parentOffset&&e.$from.marks();if(n.split(c.pos,2,v).scrollIntoView(),!l||!s)return!0;let d=l.filter(e=>a.includes(e.type.name));n.ensureMarks(d)}return!0},NY=(e,i)=>{let n=Na(e=>e.type===i)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;let s=e.doc.nodeAt(r);return!(n.node.type===(null==s?void 0:s.type)&&kC(e.doc,n.pos))||(e.join(n.pos),!0)},NX=(e,i)=>{let n=Na(e=>e.type===i)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;let s=e.doc.nodeAt(r);return!(n.node.type===(null==s?void 0:s.type)&&kC(e.doc,r))||(e.join(r),!0)},NJ=(e,i,n,r={})=>({editor:s,tr:o,state:a,dispatch:l,chain:c,commands:d,can:h})=>{let{extensions:u,splittableMarks:p}=s.extensionManager,f=Dg(e,a.schema),m=Dg(i,a.schema),{selection:g,storedMarks:v}=a,{$from:y,$to:_}=g,b=y.blockRange(_),w=v||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;let S=Na(e=>NR(e.type.name,u))(g),k=0===g.from&&g.to===a.doc.content.size,C=a.doc.content.content,T=1===C.length?C[0]:null,E=k&&T&&NR(T.type.name,u)?{node:T,pos:0,depth:0}:null,D=null!=S?S:E,N=!!S&&b.depth>=1&&b.depth-S.depth<=1,M=!!E;if((N||M)&&D){if(D.node.type===f)return k&&M?c().command(({tr:e,dispatch:i})=>{let n=function(e){let i=e.doc,n=i.firstChild;if(!n)return null;let r=i.resolve(1),s=i.resolve(n.nodeSize-1);return kq.between(r,s)}(e);return!!n&&(e.setSelection(n),i&&i(e),!0)}).liftListItem(m).run():d.liftListItem(m);if(NR(D.node.type.name,u)&&f.validContent(D.node.content))return c().command(()=>(o.setNodeMarkup(D.pos,f),!0)).command(()=>NY(o,f)).command(()=>NX(o,f)).run()}return n&&w&&l?c().command(()=>{let e=h().wrapInList(f,r),i=w.filter(e=>p.includes(e.type.name));return o.ensureMarks(i),!!e||d.clearNodes()}).wrapInList(f,r).command(()=>NY(o,f)).command(()=>NX(o,f)).run():c().command(()=>!!h().wrapInList(f,r)||d.clearNodes()).wrapInList(f,r).command(()=>NY(o,f)).command(()=>NX(o,f)).run()},NG=(e,i={},n={})=>({state:r,commands:s})=>{let{extendEmptyMarkRange:o=!1}=n,a=DE(e,r.schema);return NM(r,a,i)?s.unsetMark(a,{extendEmptyMarkRange:o}):s.setMark(a,i)},NZ=(e,i,n={})=>({state:r,commands:s})=>{let o,a=Dg(e,r.schema),l=Dg(i,r.schema),c=DZ(r,a,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),c)?s.setNode(l,o):s.setNode(a,{...o,...n})},NQ=(e,i={})=>({state:n,commands:r})=>{let s=Dg(e,n.schema);return DZ(n,s,i)?r.lift(s):r.wrapIn(s,i)},N0=()=>({state:e,dispatch:i})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let s,o=n[r];if(o.spec.isInputRules&&(s=o.getState(e))){if(i){let i=e.tr,n=s.transform;for(let e=n.steps.length-1;e>=0;e-=1)i.step(n.steps[e].invert(n.docs[e]));if(s.text){let n=i.doc.resolve(s.from).marks();i.replaceWith(s.from,s.to,e.schema.text(s.text,n))}else i.delete(s.from,s.to)}return!0}}return!1},N1=()=>({tr:e,dispatch:i})=>{let{selection:n}=e,{empty:r,ranges:s}=n;return!!r||(i&&s.forEach(i=>{e.removeMark(i.$from.pos,i.$to.pos)}),!0)},N2=(e,i={})=>({tr:n,state:r,dispatch:s})=>{var o;let{extendEmptyMarkRange:a=!1}=i,{selection:l}=n,c=DE(e,r.schema),{$from:d,empty:h,ranges:u}=l;if(!s)return!0;if(h&&a){let{from:e,to:i}=l,r=null==(o=d.marks().find(e=>e.type===c))?void 0:o.attrs,s=DT(d,c,r);s&&(e=s.from,i=s.to),n.removeMark(e,i,c)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,c)});return n.removeStoredMark(c),!0},N5=e=>({tr:i,state:n,dispatch:r})=>{let s,o,{selection:a}=n;return"number"==typeof e?(s=e,o=e):e&&"from"in e&&"to"in e?(s=e.from,o=e.to):(s=a.from,o=a.to),r&&i.doc.nodesBetween(s,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,i.setNodeMarkup(n,void 0,r)}),!0},N3=(e,i={})=>({tr:n,state:r,dispatch:s})=>{let o=null,a=null,l=D5("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(o=Dg(e,r.schema)),"mark"===l&&(a=DE(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let l,d,h,u,p=e.$from.pos,f=e.$to.pos;n.selection.empty?r.doc.nodesBetween(p,f,(e,i)=>{o&&o===e.type&&(c=!0,h=Math.max(i,p),u=Math.min(i+e.nodeSize,f),l=i,d=e)}):r.doc.nodesBetween(p,f,(e,r)=>{r<p&&o&&o===e.type&&(c=!0,h=Math.max(r,p),u=Math.min(r+e.nodeSize,f),l=r,d=e),r>=p&&r<=f&&(o&&o===e.type&&(c=!0,s&&n.setNodeMarkup(r,void 0,{...e.attrs,...i})),a&&e.marks.length&&e.marks.forEach(o=>{if(a===o.type&&(c=!0,s)){let s=Math.max(r,p),l=Math.min(r+e.nodeSize,f);n.addMark(s,l,a.create({...o.attrs,...i}))}}))}),d&&(void 0!==l&&s&&n.setNodeMarkup(l,void 0,{...d.attrs,...i}),a&&d.marks.length&&d.marks.forEach(e=>{a===e.type&&s&&n.addMark(h,u,a.create({...e.attrs,...i}))}))}),c},N4=(e,i={})=>({state:n,dispatch:r})=>(function(e,i=null){return function(n,r){let{$from:s,$to:o}=n.selection,a=s.blockRange(o),l=a&&kx(a,e,i);return!!l&&(r&&r(n.tr.wrap(a,l).scrollIntoView()),!0)}})(Dg(e,n.schema),i)(n,r),N6=(e,i={})=>({state:n,dispatch:r})=>(function(e,i=null){return function(n,r){let{$from:s,$to:o}=n.selection,a=s.blockRange(o);if(!a)return!1;let l=r?n.tr:null;return!!function(e,i,n,r=null){let s=!1,o=i,a=i.$from.doc;if(i.depth>=2&&i.$from.node(i.depth-1).type.compatibleContent(n)&&0==i.startIndex){if(0==i.$from.index(i.depth-1))return!1;let e=a.resolve(i.start-2);o=new Sj(e,e,i.depth),i.endIndex<i.parent.childCount&&(i=new Sj(i.$from,a.resolve(i.$to.end(i.depth)),i.depth)),s=!0}let l=kx(o,n,r,i);return!!l&&(e&&function(e,i,n,r,s){let o=Sy.empty;for(let e=n.length-1;e>=0;e--)o=Sy.from(n[e].type.create(n[e].attrs,o));e.step(new kg(i.start-2*!!r,i.end,i.start,i.end,new Sk(o,0,0),n.length,!0));let a=0;for(let e=0;e<n.length;e++)n[e].type==s&&(a=e+1);let l=n.length-a,c=i.start+n.length-2*!!r,d=i.parent;for(let n=i.startIndex,r=i.endIndex,s=!0;n<r;n++,s=!1)!s&&kk(e.doc,c,l)&&(e.split(c,l),c+=2*l),c+=d.child(n).nodeSize}(e,i,l,s,n),!0)}(l,a,e,i)&&(r&&r(l.scrollIntoView()),!0)}})(Dg(e,n.schema),i)(n,r),N8=class{constructor(){this.callbacks={}}on(e,i){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(i),this}emit(e,...i){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,i)),this}off(e,i){let n=this.callbacks[e];return n&&(i?this.callbacks[e]=n.filter(e=>e!==i):delete this.callbacks[e]),this}once(e,i){let n=(...r)=>{this.off(e,n),i.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},N9=class{constructor(e){var i;this.find=e.find,this.handler=e.handler,this.undoable=null==(i=e.undoable)||i}};function N7(e){var i;let{editor:n,from:r,to:s,text:o,rules:a,plugin:l}=e,{view:c}=n;if(c.composing)return!1;let d=c.state.doc.resolve(r);if(d.parent.type.spec.code||(null==(i=d.nodeBefore||d.nodeAfter)?void 0:i.marks.find(e=>e.type.spec.code)))return!1;let h=!1,u=((e,i=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-i),r,(e,i,s,o)=>{var a,l;let c=(null==(l=(a=e.type.spec).toText)?void 0:l.call(a,{node:e,pos:i,parent:s,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?c:c.slice(0,Math.max(0,r-i))}),n})(d)+o;return a.forEach(e=>{if(h)return;let i=((e,i)=>{if(Dw(i))return i.exec(e);let n=i(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(u,e.find);if(!i)return;let a=c.state.tr,d=Do({state:c.state,transaction:a}),p={from:r-(i[0].length-o.length),to:s},{commands:f,chain:m,can:g}=new Da({editor:n,state:d});null!==e.handler({state:d,range:p,match:i,commands:f,chain:m,can:g})&&a.steps.length&&(e.undoable&&a.setMeta(l,{transform:a,from:r,to:s,text:o}),c.dispatch(a),h=!0)}),h}function Me(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var Mt=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...Nu(Nl(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Nu(Nl(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){let i=this.extend({...this.config,addOptions:()=>(function e(i,n){let r={...i};return Me(i)&&Me(n)&&Object.keys(n).forEach(s=>{Me(n[s])&&Me(i[s])?r[s]=e(i[s],n[s]):r[s]=n[s]}),r})(this.options,e)});return i.name=this.name,i.parent=this.parent,i}extend(e={}){let i=new this.constructor({...this.config,...e});return i.parent=this,this.child=i,i.name="name"in e?e.name:i.parent.name,i}},Mi=class e extends Mt{constructor(){super(...arguments),this.type="mark"}static create(i={}){return new e("function"==typeof i?i():i)}static handleExit({editor:e,mark:i}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let s=r.marks();if(!s.find(e=>(null==e?void 0:e.type.name)===i.name))return!1;let o=s.find(e=>(null==e?void 0:e.type.name)===i.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let i="function"==typeof e?e():e;return super.extend(i)}},Mn=class{constructor(e){this.find=e.find,this.handler=e.handler}},Mr=null,Ms=class{constructor(e,i){this.splittableMarks=[],this.editor=i,this.baseExtensions=e,this.extensions=Nw(e),this.schema=function(e,i){var n;let r=Nf(e),{nodeExtensions:s,markExtensions:o}=Np(e),a=null==(n=s.find(e=>Nl(e,"topNode")))?void 0:n.name;return new SZ({topNode:a,nodes:Object.fromEntries(s.map(n=>{let s=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:i},a=N_({...e.reduce((e,i)=>{let r=Nl(i,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:Nu(Nl(n,"content",o)),marks:Nu(Nl(n,"marks",o)),group:Nu(Nl(n,"group",o)),inline:Nu(Nl(n,"inline",o)),atom:Nu(Nl(n,"atom",o)),selectable:Nu(Nl(n,"selectable",o)),draggable:Nu(Nl(n,"draggable",o)),code:Nu(Nl(n,"code",o)),whitespace:Nu(Nl(n,"whitespace",o)),linebreakReplacement:Nu(Nl(n,"linebreakReplacement",o)),defining:Nu(Nl(n,"defining",o)),isolating:Nu(Nl(n,"isolating",o)),attrs:Object.fromEntries(s.map(Nx))}),l=Nu(Nl(n,"parseHTML",o));l&&(a.parseDOM=l.map(e=>Ny(e,s)));let c=Nl(n,"renderHTML",o);c&&(a.toDOM=e=>c({node:e,HTMLAttributes:Nv(e,s)}));let d=Nl(n,"renderText",o);return d&&(a.toText=d),[n.name,a]})),marks:Object.fromEntries(o.map(n=>{let s=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:i},a=N_({...e.reduce((e,i)=>{let r=Nl(i,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:Nu(Nl(n,"inclusive",o)),excludes:Nu(Nl(n,"excludes",o)),group:Nu(Nl(n,"group",o)),spanning:Nu(Nl(n,"spanning",o)),code:Nu(Nl(n,"code",o)),attrs:Object.fromEntries(s.map(Nx))}),l=Nu(Nl(n,"parseHTML",o));l&&(a.parseDOM=l.map(e=>Ny(e,s)));let c=Nl(n,"renderHTML",o);return c&&(a.toDOM=e=>c({mark:e,HTMLAttributes:Nv(e,s)})),[n.name,a]}))})}(this.extensions,i),this.setupExtensions()}get commands(){return this.extensions.reduce((e,i)=>{let n={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:this.editor,type:ND(i.name,this.schema)},r=Nl(i,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return Nb([...this.extensions].reverse()).flatMap(i=>{let n={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:ND(i.name,this.schema)},r=[],s=Nl(i,"addKeyboardShortcuts",n),o={};if("mark"===i.type&&Nl(i,"exitable",n)&&(o.ArrowRight=()=>Mi.handleExit({editor:e,mark:i})),s){let i=Object.fromEntries(Object.entries(s()).map(([i,n])=>[i,()=>n({editor:e})]));o={...o,...i}}let a=new k6({props:{handleKeyDown:Dn(o)}});r.push(a);let l=Nl(i,"addInputRules",n);if(NO(i,e.options.enableInputRules)&&l){let i=l();if(i&&i.length){let n=function(e){let{editor:i,rules:n}=e,r=new k6({state:{init:()=>null,apply(e,s,o){let a=e.getMeta(r);if(a)return a;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=Nd(Sy.from(e),o.schema));let{from:s}=l,a=s+e.length;N7({editor:i,from:s,to:a,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:s}},props:{handleTextInput:(e,s,o,a)=>N7({editor:i,from:s,to:o,text:a,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:s}=e.state.selection;s&&N7({editor:i,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,s){if("Enter"!==s.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&N7({editor:i,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:i}),s=Array.isArray(n)?n:[n];r.push(...s)}}let c=Nl(i,"addPasteRules",n);if(NO(i,e.options.enablePasteRules)&&c){let i=c();if(i&&i.length){let n=function(e){let i,{editor:n,rules:r}=e,s=null,o=!1,a=!1,l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{i="u">typeof DragEvent?new DragEvent("drop"):null}catch{i=null}let c=({state:e,from:r,to:s,rule:o,pasteEvt:a})=>{let c=e.tr;if(function(e){let{editor:i,state:n,from:r,to:s,rule:o,pasteEvent:a,dropEvent:l}=e,{commands:c,chain:d,can:h}=new Da({editor:i,state:n}),u=[];return n.doc.nodesBetween(r,s,(e,i)=>{var p,f,m,g,v;if((null==(f=null==(p=e.type)?void 0:p.spec)?void 0:f.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(v=null!=(g=null==(m=e.content)?void 0:m.size)?g:e.nodeSize)?v:0,_=Math.max(r,i),b=Math.min(s,i+y);_>=b||((e,i,n)=>{if(Dw(i))return[...e.matchAll(i)];let r=i(e,n);return r?r.map(i=>{let n=[i.text];return n.index=i.index,n.input=e,n.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(i.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(_-i,b-i,void 0,""),o.find,a).forEach(e=>{if(void 0===e.index)return;let i=_+e.index+1,r=i+e[0].length,s={from:n.tr.mapping.map(i),to:n.tr.mapping.map(r)},p=o.handler({state:n,range:s,match:e,commands:c,chain:d,can:h,pasteEvent:a,dropEvent:l});u.push(p)})}),u.every(e=>null!==e)}({editor:n,state:Do({state:e,transaction:c}),from:Math.max(r-1,0),to:s.b-1,rule:o,pasteEvent:a,dropEvent:i})&&c.steps.length){try{i="u">typeof DragEvent?new DragEvent("drop"):null}catch{i=null}return l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,c}};return r.map(e=>new k6({view(e){let i=i=>{var r;(s=(null==(r=e.dom.parentElement)?void 0:r.contains(i.target))?e.dom.parentElement:null)&&(Mr=n)},r=()=>{Mr&&(Mr=null)};return window.addEventListener("dragstart",i),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",i),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(a=s===e.dom.parentElement,i=n,!a){let e=Mr;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let i=e.state.selection;i&&e.commands.deleteRange({from:i.from,to:i.to})},10)}return!1},paste:(e,i)=>{var n;let r=null==(n=i.clipboardData)?void 0:n.getData("text/html");return l=i,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(i,n,r)=>{let s=i[0],d="paste"===s.getMeta("uiEvent")&&!o,h="drop"===s.getMeta("uiEvent")&&!a,u=s.getMeta("applyPasteRules"),p=!!u;if(!d&&!h&&!p)return;if(p){var f,m;let i,{text:n}=u;"string"==typeof n||(n=Nd(Sy.from(n),r.schema));let{from:s}=u,o=s+n.length;return c({rule:e,state:r,from:s,to:{b:o},pasteEvt:(f=n,null==(m=(i=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||m.setData("text/html",f),i)})}let g=n.doc.content.findDiffStart(r.doc.content),v=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof g&&v&&g!==v.b)return c({rule:e,state:r,from:g,to:v,pasteEvt:l})}}))}({editor:e,rules:i});r.push(...n)}}let d=Nl(i,"addProseMirrorPlugins",n);if(d){let e=d();r.push(...e)}return r})}get attributes(){return Nf(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:i}=Np(this.extensions);return Object.fromEntries(i.filter(e=>!!Nl(e,"addNodeView")).map(i=>{let n=this.attributes.filter(e=>e.type===i.name),r={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:Dg(i.name,this.schema)},s=Nl(i,"addNodeView",r);if(!s)return[];let o=s();return o?[i.name,(r,s,a,l,c)=>{let d=Nv(r,n);return o({node:r,view:s,getPos:a,decorations:l,innerDecorations:c,editor:e,extension:i,HTMLAttributes:d})}]:[]}))}dispatchTransaction(e){let{editor:i}=this;return Nb([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:i,type:ND(n.name,this.schema)},s=Nl(n,"dispatchTransaction",r);return s?i=>{s.call(r,{transaction:i,next:e})}:e},e)}transformPastedHTML(e){let{editor:i}=this;return Nb([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:i,type:ND(n.name,this.schema)},s=Nl(n,"transformPastedHTML",r);return s?(i,n)=>{let o=e(i,n);return s.call(r,o)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:i}=Np(this.extensions);return Object.fromEntries(i.filter(e=>!!Nl(e,"addMarkView")).map(i=>{let n=this.attributes.filter(e=>e.type===i.name),r={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:DE(i.name,this.schema)},s=Nl(i,"addMarkView",r);return s?[i.name,(r,o,a)=>{let l=Nv(r,n);return s()({mark:r,view:o,inline:a,editor:e,extension:i,HTMLAttributes:l,updateAttributes:i=>{!function(e,i,n={}){let{state:r}=i,{doc:s,tr:o}=r;s.descendants((i,r)=>{let s=o.mapping.map(r),a=o.mapping.map(r)+i.nodeSize,l=null;if(i.marks.forEach(i=>{if(i!==e)return!1;l=i}),!l)return;let c=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(c=!0)}),c){let i=e.type.create({...e.attrs,...n});o.removeMark(s,a,e.type),o.addMark(s,a,i)}}),o.docChanged&&i.view.dispatch(o)}(r,e,i)}})}]:[]}))}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var i;let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ND(e.name,this.schema)};"mark"===e.type&&(null==(i=Nu(Nl(e,"keepOnSplit",n)))||i)&&this.splittableMarks.push(e.name);let r=Nl(e,"onBeforeCreate",n),s=Nl(e,"onCreate",n),o=Nl(e,"onUpdate",n),a=Nl(e,"onSelectionUpdate",n),l=Nl(e,"onTransaction",n),c=Nl(e,"onFocus",n),d=Nl(e,"onBlur",n),h=Nl(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),h&&this.editor.on("destroy",h)})}};Ms.resolve=Nw,Ms.sort=Nb,Ms.flatten=Nc,Ds({},{ClipboardTextSerializer:()=>Ma,Commands:()=>Ml,Delete:()=>Mc,Drop:()=>Md,Editable:()=>Mh,FocusEvents:()=>Mp,Keymap:()=>Mf,Paste:()=>Mm,Tabindex:()=>Mg,TextDirection:()=>Mv,focusEventsPluginKey:()=>Mu});var Mo=class e extends Mt{constructor(){super(...arguments),this.type="extension"}static create(i={}){return new e("function"==typeof i?i():i)}configure(e){return super.configure(e)}extend(e){let i="function"==typeof e?e():e;return super.extend(i)}},Ma=Mo.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new k6({key:new k7("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:i,schema:n}=e,{doc:r,selection:s}=i,{ranges:o}=s,a=Math.min(...o.map(e=>e.$from.pos)),l=Math.max(...o.map(e=>e.$to.pos)),c=Nk(n);return NS(r,{from:a,to:l},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Ml=Mo.create({name:"commands",addCommands:()=>({...Dl})}),Mc=Mo.create({name:"delete",onUpdate({transaction:e,appendedTransactions:i}){var n,r,s;let o=()=>{var n,r,s,o;if(null!=(o=null==(s=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:s.call(r,e))?o:e.getMeta("y-sync$"))return;let a=No(e.before,[e,...i]);NT(a).forEach(i=>{a.mapping.mapResult(i.oldRange.from).deletedAfter&&a.mapping.mapResult(i.oldRange.to).deletedBefore&&a.before.nodesBetween(i.oldRange.from,i.oldRange.to,(n,r)=>{let s=r+n.nodeSize-2,o=i.oldRange.from<=r&&s<=i.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:s,newFrom:a.mapping.map(r),newTo:a.mapping.map(s),deletedRange:i.oldRange,newRange:i.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:a})})});let l=a.mapping;a.steps.forEach((i,n)=>{var r,s;if(i instanceof ku){let o=l.slice(n).map(i.from,-1),c=l.slice(n).map(i.to),d=l.invert().map(o,-1),h=l.invert().map(c),u=o>0&&(null==(r=a.doc.nodeAt(o-1))?void 0:r.marks.some(e=>e.eq(i.mark))),p=null==(s=a.doc.nodeAt(c))?void 0:s.marks.some(e=>e.eq(i.mark));this.editor.emit("delete",{type:"mark",mark:i.mark,from:i.from,to:i.to,deletedRange:{from:d,to:h},newRange:{from:o,to:c},partial:!!(p||u),editor:this.editor,transaction:e,combinedTransform:a})}})};null==(s=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||s?setTimeout(o,0):o()}}),Md=Mo.create({name:"drop",addProseMirrorPlugins(){return[new k6({key:new k7("tiptapDrop"),props:{handleDrop:(e,i,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:i,slice:n,moved:r})}}})]}}),Mh=Mo.create({name:"editable",addProseMirrorPlugins(){return[new k6({key:new k7("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Mu=new k7("focusEvents"),Mp=Mo.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new k6({key:Mu,props:{handleDOMEvents:{focus:(i,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return i.dispatch(r),!1},blur:(i,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return i.dispatch(r),!1}}}})]}}),Mf=Mo.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:i})=>{let{selection:n,doc:r}=i,{empty:s,$anchor:o}=n,{pos:a,parent:l}=o,c=o.parent.isTextblock&&a>0?i.doc.resolve(a-1):o,d=c.parent.type.spec.isolating,h=o.pos-o.parentOffset,u=d&&1===c.parent.childCount?h===o.pos:kW.atStart(r).from===a;return!!s&&!!l.type.isTextblock&&!l.textContent.length&&!!u&&(!u||"paragraph"!==o.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),i=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:i,"Mod-Delete":i,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},s={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":i,"Ctrl-Alt-Backspace":i,"Alt-Delete":i,"Alt-d":i,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return DL()||DJ()?s:r},addProseMirrorPlugins(){return[new k6({key:new k7("clearDocument"),appendTransaction:(e,i,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!i.doc.eq(n.doc),s=e.some(e=>e.getMeta("preventClearDocument"));if(!r||s)return;let{empty:o,from:a,to:l}=i.selection,c=kW.atStart(i.doc).from,d=kW.atEnd(i.doc).to;if(o||a!==c||l!==d||!NA(n.doc))return;let h=n.tr,u=Do({state:n,transaction:h}),{commands:p}=new Da({editor:this.editor,state:u});if(p.clearNodes(),h.steps.length)return h}})]}}),Mm=Mo.create({name:"paste",addProseMirrorPlugins(){return[new k6({key:new k7("tiptapPaste"),props:{handlePaste:(e,i,n)=>{this.editor.emit("paste",{editor:this.editor,event:i,slice:n})}}})]}}),Mg=Mo.create({name:"tabindex",addProseMirrorPlugins(){return[new k6({key:new k7("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Mv=Mo.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=Np(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let i=e.getAttribute("dir");return i&&("ltr"===i||"rtl"===i||"auto"===i)?i:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new k6({key:new k7("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),My=class e{constructor(e,i,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=i,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let i=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);i=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:i,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let i=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(i),this.editor)}get before(){let i=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return i.depth!==this.depth&&(i=this.resolvedPos.doc.resolve(this.from-3)),new e(i,this.editor)}get after(){let i=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return i.depth!==this.depth&&(i=this.resolvedPos.doc.resolve(this.to+3)),new e(i,this.editor)}get children(){let i=[];return this.node.content.forEach((n,r)=>{let s=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,a=n.isInline,l=this.pos+r+ +!o;if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(l);if(!s&&!a&&c.depth<=this.depth)return;let d=new e(c,this.editor,s,s||a?n:null);s&&(d.actualDepth=this.depth+1),i.push(d)}),i}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,i={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(i).length>0){let e=r.node.attrs,n=Object.keys(i);for(let r=0;r<n.length;r+=1){let s=n[r];if(e[s]!==i[s])break}}else n=r;r=r.parent}return n}querySelector(e,i={}){return this.querySelectorAll(e,i,!0)[0]||null}querySelectorAll(e,i={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;let s=Object.keys(i);return this.children.forEach(o=>{n&&r.length>0||(o.node.type.name===e&&s.every(e=>i[e]===o.node.attrs[e])&&r.push(o),n&&r.length>0||(r=r.concat(o.querySelectorAll(e,i,n))))}),r}setAttribute(e){let{tr:i}=this.editor.state;i.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(i)}},M_=`.ProseMirror {
29
+ position: relative;
30
+ }
31
+
32
+ .ProseMirror {
33
+ word-wrap: break-word;
34
+ white-space: pre-wrap;
35
+ white-space: break-spaces;
36
+ -webkit-font-variant-ligatures: none;
37
+ font-variant-ligatures: none;
38
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
39
+ }
40
+
41
+ .ProseMirror [contenteditable="false"] {
42
+ white-space: normal;
43
+ }
44
+
45
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
46
+ white-space: pre-wrap;
47
+ }
48
+
49
+ .ProseMirror pre {
50
+ white-space: pre-wrap;
51
+ }
52
+
53
+ img.ProseMirror-separator {
54
+ display: inline !important;
55
+ border: none !important;
56
+ margin: 0 !important;
57
+ width: 0 !important;
58
+ height: 0 !important;
59
+ }
60
+
61
+ .ProseMirror-gapcursor {
62
+ display: none;
63
+ pointer-events: none;
64
+ position: absolute;
65
+ margin: 0;
66
+ }
67
+
68
+ .ProseMirror-gapcursor:after {
69
+ content: "";
70
+ display: block;
71
+ position: absolute;
72
+ top: -2px;
73
+ width: 20px;
74
+ border-top: 1px solid black;
75
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
76
+ }
77
+
78
+ @keyframes ProseMirror-cursor-blink {
79
+ to {
80
+ visibility: hidden;
81
+ }
82
+ }
83
+
84
+ .ProseMirror-hideselection *::selection {
85
+ background: transparent;
86
+ }
87
+
88
+ .ProseMirror-hideselection *::-moz-selection {
89
+ background: transparent;
90
+ }
91
+
92
+ .ProseMirror-hideselection * {
93
+ caret-color: transparent;
94
+ }
95
+
96
+ .ProseMirror-focused .ProseMirror-gapcursor {
97
+ display: block;
98
+ }`,Mx=class extends N8{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"u">typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:NI,createMappablePosition:NP},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:i,moved:n})=>this.options.onDrop(e,i,n)),this.on("paste",({event:e,slice:i})=>this.options.onPaste(e,i)),this.on("delete",this.options.onDelete);const i=this.createDoc(),n=DR(i,this.options.autofocus);this.editorState=k4.create({doc:i,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("u"<typeof document)throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"u">typeof document&&(this.css=function(e,i){let n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;let r=document.createElement("style");return i&&r.setAttribute("nonce",i),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}(M_,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,i=!0){this.setOptions({editable:e}),i&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,i)=>{if(this.editorView)return this.editorView[i];if("state"===i)return this.editorState;if(i in e)return Reflect.get(e,i);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${i}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,i){let n=Nh(i)?i(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let i=this.state.plugins,n=i;if([].concat(e).forEach(e=>{let i="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(i))}),i.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,i;let n=[...this.options.enableCoreExtensions?[Mh,Ma.configure({blockSeparator:null==(i=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:i.blockSeparator}),Ml,Mp,Mf,Mg,Md,Mm,Mc,Mv.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new Ms(n,this)}createCommandManager(){this.commandManager=new Da({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Nn(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(i){if(!(i instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(i.message))throw i;this.emit("contentError",{editor:this,error:i,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=Nn(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:i,enableExtensionDispatchTransaction:n}=this.options,r=i.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r,o=i.transformPastedHTML,a=this.extensionManager.transformPastedHTML(o);this.editorView=new EZ(e,{...i,attributes:{role:"textbox",...null==i?void 0:i.attributes},dispatchTransaction:s,transformPastedHTML:a,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let i=this.capturedTransaction;return this.capturedTransaction=null,i}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>{var i;return null==(i=this.capturedTransaction)?void 0:i.step(e)});return}let{state:i,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(i.selection),s=n.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:i}),!s)return;this.view.updateState(i),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let a=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),l=null==a?void 0:a.getMeta("focus"),c=null==a?void 0:a.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:a}),c&&this.emit("blur",{editor:this,event:c.event,transaction:a}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||o.doc.eq(i.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return NC(this.state,e)}isActive(e,i){let n="string"==typeof e?e:null,r="string"==typeof e?i:e;return function(e,i,n={}){if(!i)return DZ(e,null,n)||NM(e,null,n);let r=D5(i,e.schema);return"node"===r?DZ(e,i,n):"mark"===r&&NM(e,i,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Nd(this.state.doc.content,this.schema)}getText(e){var i,n;let r,{blockSeparator:s="\n\n",textSerializers:o={}}=e||{};return i=this.state.doc,n={blockSeparator:s,textSerializers:{...Nk(this.schema),...o}},r={from:0,to:i.content.size},NS(i,r,n)}get isEmpty(){return NA(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,i;return null==(i=null==(e=this.editorView)?void 0:e.isDestroyed)||i}$node(e,i){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,i))||null}$nodes(e,i){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,i))||null}$pos(e){return new My(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function Mb(e){return new N9({find:e.find,handler:({state:i,range:n,match:r})=>{let s=Nu(e.getAttributes,void 0,r);if(!1===s||null===s)return null;let{tr:o}=i,a=r[r.length-1],l=r[0];if(a){let r=l.search(/\S/),c=n.from+l.indexOf(a),d=c+a.length;if(NE(n.from,n.to,i.doc).filter(i=>i.mark.type.excluded.find(n=>n===e.type&&n!==i.mark.type)).filter(e=>e.to>c).length)return null;d<n.to&&o.delete(d,n.to),c>n.from&&o.delete(n.from+r,c);let h=n.from+r+a.length;o.addMark(n.from+r,h,e.type.create(s||{})),o.removeStoredMark(e.type)}},undoable:e.undoable})}function Mw(e){return new N9({find:e.find,handler:({state:i,range:n,match:r})=>{let s=i.doc.resolve(n.from),o=Nu(e.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e.type))return null;i.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)},undoable:e.undoable})}function MS(e){return new N9({find:e.find,handler:({state:i,range:n,match:r,chain:s})=>{let o=Nu(e.getAttributes,void 0,r)||{},a=i.tr.delete(n.from,n.to),l=a.doc.resolve(n.from).blockRange(),c=l&&kx(l,e.type,o);if(!c)return null;if(a.wrap(l,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=i,{splittableMarks:s}=e.editor.extensionManager,o=r||n.$to.parentOffset&&n.$from.marks();if(o){let e=o.filter(e=>s.includes(e.type.name));a.ensureMarks(e)}}if(e.keepAttributes){let i="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";s().updateAttributes(i,o).run()}let d=a.doc.resolve(n.from-1).nodeBefore;d&&d.type===e.type&&kC(a.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,d))&&a.join(n.from-1)},undoable:e.undoable})}function Mk(e){if(!(null==e?void 0:e.trim()))return{};let i={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);s&&(i.class=s.map(e=>e.trim().slice(1)).join(" "));let o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(i.id=o[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var s;let o=n[parseInt((null==(s=r.match(/__QUOTED_(\d+)__/))?void 0:s[1])||"0",10)];o&&(i[e]=o.slice(1,-1))});let a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(i[e]=!0)}),i}function MC(e){if(!e||0===Object.keys(e).length)return"";let i=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>i.push(`.${e}`)),e.id&&i.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?i.push(e):!1!==n&&null!=n&&i.push(`${e}="${String(n)}"`))}),i.join(" ")}function MT(e){let{nodeName:i,name:n,parseAttributes:r=Mk,serializeAttributes:s=MC,defaultAttributes:o={},requiredAttributes:a=[],allowedAttributes:l}=e,c=n||i;return{parseMarkdown:(e,n)=>{let r={...o,...e.attributes};return n.createNode(i,r,[])},markdownTokenizer:{name:i,level:"block",start(e){var i;let n=RegExp(`^:::${c}(?:\\s|$)`,"m"),r=null==(i=e.match(n))?void 0:i.index;return void 0!==r?r:-1},tokenize(e,n,s){let o=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),l=e.match(o);if(!l)return;let d=r(l[1]||"");if(!a.find(e=>!(e in d)))return{type:i,raw:l[0],attributes:d}}},renderMarkdown:e=>{let i=s((e=>{if(!l)return e;let i={};return l.forEach(n=>{n in e&&(i[n]=e[n])}),i})(e.attrs||{})),n=i?` {${i}}`:"";return`:::${c}${n} :::`}}}function ME(e){let{nodeName:i,name:n,getContent:r,parseAttributes:s=Mk,serializeAttributes:o=MC,defaultAttributes:a={},content:l="block",allowedAttributes:c}=e,d=n||i;return{parseMarkdown:(e,n)=>{let s;if(r){let i=r(e);s="string"==typeof i?[{type:"text",text:i}]:i}else s="block"===l?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let o={...a,...e.attributes};return n.createNode(i,o,s)},markdownTokenizer:{name:i,level:"block",start(e){var i;let n=RegExp(`^:::${d}`,"m"),r=null==(i=e.match(n))?void 0:i.index;return void 0!==r?r:-1},tokenize(e,n,r){var o;let a=RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),c=e.match(a);if(!c)return;let[h,u=""]=c,p=s(u),f=1,m=h.length,g="",v=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(m);for(v.lastIndex=0;;){let n=v.exec(y);if(null===n)break;let s=n.index,a=n[1];if(null==(o=n[2])||!o.endsWith(":::")){if(a)f+=1;else if(0==(f-=1)){let o=y.slice(0,s);g=o.trim();let a=e.slice(0,m+s+n[0].length),c=[];if(g)if("block"===l)for((c=r.blockTokens(o)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;c.pop()}else c=r.inlineTokens(g);return{type:i,raw:a,attributes:p,content:g,tokens:c}}}}}},renderMarkdown:(e,i)=>{let n=o((e=>{if(!c)return e;let i={};return c.forEach(n=>{n in e&&(i[n]=e[n])}),i})(e.attrs||{})),r=n?` {${n}}`:"",s=i.renderChildren(e.content||[],"\n\n");return`:::${d}${r}
99
+
100
+ ${s}
101
+
102
+ :::`}}}function MD(e){if(!e.trim())return{};let i={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,s,o,a]=r;i[s]=o||a,r=n.exec(e)}return i}function MN(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,i])=>`${e}="${i}"`).join(" ")}function MM(e){let{nodeName:i,name:n,getContent:r,parseAttributes:s=MD,serializeAttributes:o=MN,defaultAttributes:a={},selfClosing:l=!1,allowedAttributes:c}=e,d=n||i,h=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{let s={...a,...e.attributes};if(l)return n.createNode(i,s);let o=r?r(e):e.content||"";return o?n.createNode(i,s,[n.createTextNode(o)]):n.createNode(i,s,[])},markdownTokenizer:{name:i,level:"inline",start(e){let i=l?RegExp(`\\[${h}\\s*[^\\]]*\\]`):RegExp(`\\[${h}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${h}\\]`),n=e.match(i),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){let o=l?RegExp(`^\\[${h}\\s*([^\\]]*)\\]`):RegExp(`^\\[${h}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${h}\\]`),a=e.match(o);if(!a)return;let c="",d="";if(l){let[,e]=a;d=e}else{let[,e,i]=a;d=e,c=i||""}let u=s(d.trim());return{type:i,raw:a[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let i="";r?i=r(e):e.content&&e.content.length>0&&(i=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let n=o((e=>{if(!c)return e;let i={};return c.forEach(n=>{let r="string"==typeof n?n:n.name,s="string"==typeof n?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(void 0!==s&&n===s)return;i[r]=n}}),i})(e.attrs||{})),s=n?` ${n}`:"";return l?`[${d}${s}]`:`[${d}${s}]${i}[/${d}]`}}}function MO(e,i,n){var r,s,o,a;let l=e.split("\n"),c=[],d="",h=0,u=i.baseIndentSize||2;for(;h<l.length;){let e,p=l[h],f=p.match(i.itemPattern);if(!f)if(c.length>0)break;else{if(""!==p.trim())return;h+=1,d=`${d}${p}
103
+ `;continue}let m=i.extractItemData(f),{indentLevel:g,mainContent:v}=m;d=`${d}${p}
104
+ `;let y=[v];for(h+=1;h<l.length;){let e=l[h];if(""===e.trim()){let i=l.slice(h+1).findIndex(e=>""!==e.trim());if(-1===i)break;if(((null==(s=null==(r=l[h+1+i].match(/^(\s*)/))?void 0:r[1])?void 0:s.length)||0)>g){y.push(e),d=`${d}${e}
105
+ `,h+=1;continue}break}if(((null==(a=null==(o=e.match(/^(\s*)/))?void 0:o[1])?void 0:a.length)||0)>g)y.push(e),d=`${d}${e}
106
+ `,h+=1;else break}let _=y.slice(1);if(_.length>0){let r=_.map(e=>e.slice(g+u)).join("\n");r.trim()&&(e=i.customNestedParser?i.customNestedParser(r):n.blockTokens(r))}let b=i.createToken(m,e);c.push(b)}if(0!==c.length)return{items:c,raw:d}}function MR(e,i,n,r){if(!e||!Array.isArray(e.content))return"";let s="function"==typeof n?n(r):n,[o,...a]=e.content,l=i.renderChildren([o]),c=`${s}${l}`;return a&&a.length>0&&a.forEach((e,n)=>{var r,s;let o=null!=(s=null==(r=i.renderChild)?void 0:r.call(i,e,n+1))?s:i.renderChildren([e]);if(null!=o){let n=o.split("\n").map(e=>e?i.indent(e):i.indent("")).join("\n");c+="paragraph"===e.type?`
107
+
108
+ ${n}`:`
109
+ ${n}`}}),c}Ds({},{createAtomBlockMarkdownSpec:()=>MT,createBlockMarkdownSpec:()=>ME,createInlineMarkdownSpec:()=>MM,parseAttributes:()=>Mk,parseIndentedBlocks:()=>MO,renderNestedMarkdownContent:()=>MR,serializeAttributes:()=>MC});var MA=class e extends Mt{constructor(){super(...arguments),this.type="node"}static create(i={}){return new e("function"==typeof i?i():i)}configure(e){return super.configure(e)}extend(e){let i="function"==typeof e?e():e;return super.extend(i)}};function ML(e){return new Mn({find:e.find,handler:({state:i,range:n,match:r,pasteEvent:s})=>{let o=Nu(e.getAttributes,void 0,r,s);if(!1===o||null===o)return null;let{tr:a}=i,l=r[r.length-1],c=r[0],d=n.to;if(l){let s=c.search(/\S/),h=n.from+c.indexOf(l),u=h+l.length;if(NE(n.from,n.to,i.doc).filter(i=>i.mark.type.excluded.find(n=>n===e.type&&n!==i.mark.type)).filter(e=>e.to>h).length)return null;u<n.to&&a.delete(u,n.to),h>n.from&&a.delete(n.from+s,h),d=n.from+s+l.length,a.addMark(n.from+s,d,e.type.create(o||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||a.removeStoredMark(e.type)}}})}let{getOwnPropertyNames:Mj,getOwnPropertySymbols:MI}=Object,{hasOwnProperty:MP}=Object.prototype;function MB(e,i){return function(n,r,s){return e(n,r,s)&&i(n,r,s)}}function Mz(e){return function(i,n,r){if(!i||!n||"object"!=typeof i||"object"!=typeof n)return e(i,n,r);let{cache:s}=r,o=s.get(i),a=s.get(n);if(o&&a)return o===n&&a===i;s.set(i,n),s.set(n,i);let l=e(i,n,r);return s.delete(i),s.delete(n),l}}function MF(e){return Mj(e).concat(MI(e))}let MH=Object.hasOwn||((e,i)=>MP.call(e,i));function MW(e,i){return e===i||!e&&!i&&e!=e&&i!=i}let{getOwnPropertyDescriptor:M$,keys:MU}=Object;function MV(e,i){return e.byteLength===i.byteLength&&M5(new Uint8Array(e),new Uint8Array(i))}function Mq(e,i,n){let r=e.length;if(i.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],i[r],r,r,e,i,n))return!1;return!0}function MK(e,i){return e.byteLength===i.byteLength&&M5(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(i.buffer,i.byteOffset,i.byteLength))}function MY(e,i){return MW(e.getTime(),i.getTime())}function MX(e,i){return e.name===i.name&&e.message===i.message&&e.cause===i.cause&&e.stack===i.stack}function MJ(e,i){return e===i}function MG(e,i,n){let r,s,o=e.size;if(o!==i.size)return!1;if(!o)return!0;let a=Array(o),l=e.entries(),c=0;for(;(r=l.next())&&!r.done;){let o=i.entries(),l=!1,d=0;for(;(s=o.next())&&!s.done;){if(a[d]){d++;continue}let o=r.value,h=s.value;if(n.equals(o[0],h[0],c,d,e,i,n)&&n.equals(o[1],h[1],o[0],h[0],e,i,n)){l=a[d]=!0;break}d++}if(!l)return!1;c++}return!0}function MZ(e,i,n){let r=MU(e),s=r.length;if(MU(i).length!==s)return!1;for(;s-- >0;)if(!M4(e,i,n,r[s]))return!1;return!0}function MQ(e,i,n){let r,s,o,a=MF(e),l=a.length;if(MF(i).length!==l)return!1;for(;l-- >0;)if(!M4(e,i,n,r=a[l])||(s=M$(e,r),o=M$(i,r),(s||o)&&(!s||!o||s.configurable!==o.configurable||s.enumerable!==o.enumerable||s.writable!==o.writable)))return!1;return!0}function M0(e,i){return MW(e.valueOf(),i.valueOf())}function M1(e,i){return e.source===i.source&&e.flags===i.flags}function M2(e,i,n){let r,s,o=e.size;if(o!==i.size)return!1;if(!o)return!0;let a=Array(o),l=e.values();for(;(r=l.next())&&!r.done;){let o=i.values(),l=!1,c=0;for(;(s=o.next())&&!s.done;){if(!a[c]&&n.equals(r.value,s.value,r.value,s.value,e,i,n)){l=a[c]=!0;break}c++}if(!l)return!1}return!0}function M5(e,i){let n=e.byteLength;if(i.byteLength!==n||e.byteOffset!==i.byteOffset)return!1;for(;n-- >0;)if(e[n]!==i[n])return!1;return!0}function M3(e,i){return e.hostname===i.hostname&&e.pathname===i.pathname&&e.protocol===i.protocol&&e.port===i.port&&e.hash===i.hash&&e.username===i.username&&e.password===i.password}function M4(e,i,n,r){return("_owner"===r||"__o"===r||"__v"===r)&&(!!e.$$typeof||!!i.$$typeof)||MH(i,r)&&n.equals(e[r],i[r],r,r,e,i,n)}let M6={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},M8=Object.prototype.toString,M9=M7();function M7(e={}){let{circular:i=!1,createInternalComparator:n,createState:r,strict:s=!1}=e,o=function({areArrayBuffersEqual:e,areArraysEqual:i,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:o,areMapsEqual:a,areNumbersEqual:l,areObjectsEqual:c,arePrimitiveWrappersEqual:d,areRegExpsEqual:h,areSetsEqual:u,areTypedArraysEqual:p,areUrlsEqual:f,unknownTagComparators:m}){return function(g,v,y){if(g===v)return!0;if(null==g||null==v)return!1;let _=typeof g;if(_!==typeof v)return!1;if("object"!==_)return"number"===_?l(g,v,y):"function"===_&&o(g,v,y);let b=g.constructor;if(b!==v.constructor)return!1;if(b===Object)return c(g,v,y);if(Array.isArray(g))return i(g,v,y);if(b===Date)return r(g,v,y);if(b===RegExp)return h(g,v,y);if(b===Map)return a(g,v,y);if(b===Set)return u(g,v,y);let w=M8.call(g);if("[object Date]"===w)return r(g,v,y);if("[object RegExp]"===w)return h(g,v,y);if("[object Map]"===w)return a(g,v,y);if("[object Set]"===w)return u(g,v,y);if("[object Object]"===w)return"function"!=typeof g.then&&"function"!=typeof v.then&&c(g,v,y);if("[object URL]"===w)return f(g,v,y);if("[object Error]"===w)return s(g,v,y);if("[object Arguments]"===w)return c(g,v,y);if(M6[w])return p(g,v,y);if("[object ArrayBuffer]"===w)return e(g,v,y);if("[object DataView]"===w)return n(g,v,y);if("[object Boolean]"===w||"[object Number]"===w||"[object String]"===w)return d(g,v,y);if(m){let e=m[w];if(!e){let i=null!=g?g[Symbol.toStringTag]:void 0;i&&(e=m[i])}if(e)return e(g,v,y)}return!1}}(function({circular:e,createCustomConfig:i,strict:n}){let r={areArrayBuffersEqual:MV,areArraysEqual:n?MQ:Mq,areDataViewsEqual:MK,areDatesEqual:MY,areErrorsEqual:MX,areFunctionsEqual:MJ,areMapsEqual:n?MB(MG,MQ):MG,areNumbersEqual:MW,areObjectsEqual:n?MQ:MZ,arePrimitiveWrappersEqual:M0,areRegExpsEqual:M1,areSetsEqual:n?MB(M2,MQ):M2,areTypedArraysEqual:n?MB(M5,MQ):M5,areUrlsEqual:M3,unknownTagComparators:void 0};if(i&&(r=Object.assign({},r,i(r))),e){let e=Mz(r.areArraysEqual),i=Mz(r.areMapsEqual),n=Mz(r.areObjectsEqual),s=Mz(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:i,areObjectsEqual:n,areSetsEqual:s})}return r}(e)),a=n?n(o):function(e,i,n,r,s,a,l){return o(e,i,l)};return function({circular:e,comparator:i,createState:n,equals:r,strict:s}){if(n)return function(o,a){let{cache:l=e?new WeakMap:void 0,meta:c}=n();return i(o,a,{cache:l,equals:r,meta:c,strict:s})};if(e)return function(e,n){return i(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};let o={cache:void 0,equals:r,meta:void 0,strict:s};return function(e,n){return i(e,n,o)}}({circular:i,comparator:o,createState:r,equals:a,strict:s})}M7({strict:!0}),M7({circular:!0}),M7({circular:!0,strict:!0}),M7({createInternalComparator:()=>MW}),M7({strict:!0,createInternalComparator:()=>MW}),M7({circular:!0,createInternalComparator:()=>MW}),M7({circular:!0,createInternalComparator:()=>MW,strict:!0});var Oe=e.i(596482),Ot=({contentComponent:e})=>{let i=(0,Sg.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,iM.jsx)(iM.Fragment,{children:Object.values(i)})},Oi=class extends Sm.default.Component{constructor(e){super(e),this.editorContentRef=Sm.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let i=this.props.editor;if(i&&!i.isDestroyed&&(null==(e=i.view.dom)?void 0:e.parentNode)){let e,n;if(i.contentComponent)return;let r=this.editorContentRef.current;r.append(...i.view.dom.parentNode.childNodes),i.setOptions({element:r}),e=new Set,n={},i.contentComponent={subscribe:i=>(e.add(i),()=>{e.delete(i)}),getSnapshot:()=>n,getServerSnapshot:()=>n,setRenderer(i,r){n={...n,[i]:iL.default.createPortal(r.reactElement,r.element,i)},e.forEach(e=>e())},removeRenderer(i){let r={...n};delete r[i],n=r,e.forEach(e=>e())}},i.createNodeViews(),i.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;let i=this.props.editor;if(i){i.isEditorContentInitialized=!1,i.isDestroyed||i.view.setProps({nodeViews:{}}),i.contentComponent=null;try{if(!(null==(e=i.view.dom)?void 0:e.parentNode))return;let n=document.createElement("div");n.append(...i.view.dom.parentNode.childNodes),i.setOptions({element:n})}catch{}}}render(){let{editor:e,innerRef:i,...n}=this.props;return(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsx)("div",{ref:((...e)=>i=>{e.forEach(e=>{"function"==typeof e?e(i):e&&(e.current=i)})})(i,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&(0,iM.jsx)(Ot,{contentComponent:e.contentComponent})]})}},On=(0,Sm.forwardRef)((e,i)=>{let n=Sm.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return Sm.default.createElement(Oi,{key:n,innerRef:i,...e})}),Or=Sm.default.memo(On),Os="u">typeof window?Sm.useLayoutEffect:Sm.useEffect,Oo=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},i=this.editor;return i.on("transaction",e),()=>{i.off("transaction",e)}}}};function Oa(e){var i;let[n]=(0,Sm.useState)(()=>new Oo(e.editor)),r=(0,Oe.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(i=e.equalityFn)?i:M9);return Os(()=>n.watch(e.editor),[e.editor,n]),(0,Sm.useDebugValue)(r),r}var Ol="u"<typeof window,Oc=Ol||!!("u">typeof window&&window.next),Od=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?Ol||Oc?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender)?this.createEditor():null}createEditor(){return new Mx({...this.options.current,onBeforeCreate:(...e)=>{var i,n;return null==(n=(i=this.options.current).onBeforeCreate)?void 0:n.call(i,...e)},onBlur:(...e)=>{var i,n;return null==(n=(i=this.options.current).onBlur)?void 0:n.call(i,...e)},onCreate:(...e)=>{var i,n;return null==(n=(i=this.options.current).onCreate)?void 0:n.call(i,...e)},onDestroy:(...e)=>{var i,n;return null==(n=(i=this.options.current).onDestroy)?void 0:n.call(i,...e)},onFocus:(...e)=>{var i,n;return null==(n=(i=this.options.current).onFocus)?void 0:n.call(i,...e)},onSelectionUpdate:(...e)=>{var i,n;return null==(n=(i=this.options.current).onSelectionUpdate)?void 0:n.call(i,...e)},onTransaction:(...e)=>{var i,n;return null==(n=(i=this.options.current).onTransaction)?void 0:n.call(i,...e)},onUpdate:(...e)=>{var i,n;return null==(n=(i=this.options.current).onUpdate)?void 0:n.call(i,...e)},onContentError:(...e)=>{var i,n;return null==(n=(i=this.options.current).onContentError)?void 0:n.call(i,...e)},onDrop:(...e)=>{var i,n;return null==(n=(i=this.options.current).onDrop)?void 0:n.call(i,...e)},onPaste:(...e)=>{var i,n;return null==(n=(i=this.options.current).onPaste)?void 0:n.call(i,...e)},onDelete:(...e)=>{var i,n;return null==(n=(i=this.options.current).onDelete)?void 0:n.call(i,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,i){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&i.extensions?e.extensions.length===i.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=i.extensions)?void 0:r[n])}):e[n]===i[n]))}onRender(i){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===i.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(i),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((i,n)=>i===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,i=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){i&&i.setOptions(this.options.current);return}i&&!i.isDestroyed&&(i.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Oh(e={},i=[]){let n=(0,Sm.useRef)(e);n.current=e;let[r]=(0,Sm.useState)(()=>new Od(n)),s=(0,Sg.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,Sm.useDebugValue)(s),(0,Sm.useEffect)(r.onRender(i)),Oa({editor:s,selector:({transactionNumber:i})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===i?0:i+1}),s}var Ou=(0,Sm.createContext)({editor:null});Ou.Consumer;var Op=(0,Sm.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});function Of(e){return!!("function"==typeof e&&e.prototype&&e.prototype.isReactComponent)}function Om(e){return!!("object"==typeof e&&e.$$typeof&&("Symbol(react.forward_ref)"===e.$$typeof.toString()||"react.forward_ref"===e.$$typeof.description))}Sm.default.forwardRef((e,i)=>{let{onDragStart:n}=(0,Sm.useContext)(Op),r=e.as||"div";return(0,iM.jsx)(r,{...e,ref:i,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});var Og=class{constructor(e,{editor:i,props:n={},as:r="div",className:s=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(0xffffffff*Math.random()).toString(),this.component=e,this.editor=i,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isEditorContentInitialized?(0,iL.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let i=this.component,n=this.props,r=this.editor,s=function(){try{if(Sm.version)return parseInt(Sm.version.split(".")[0],10)>=19}catch{}return!1}(),o=function(e){if(Of(e)||Om(e))return!0;if("object"==typeof e&&e.$$typeof&&("Symbol(react.memo)"===e.$$typeof.toString()||"react.memo"===e.$$typeof.description)){let i=e.type;if(i)return Of(i)||Om(i)}return!1}(i),a={...n};a.ref&&!(s||o)&&delete a.ref,!a.ref&&(s||o)&&(a.ref=e=>{this.ref=e}),this.reactElement=(0,iM.jsx)(i,{...a}),null==(e=null==r?void 0:r.contentComponent)||e.setRenderer(this.id,this)}updateProps(e={}){this.destroyed||(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let i=this.editor;null==(e=null==i?void 0:i.contentComponent)||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(i=>{this.element.setAttribute(i,e[i])})}};Sm.default.createContext({markViewContentRef:()=>{}});var Ov=(0,Sm.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function Oy({editor:e,instance:i,children:n}){let r=null!=e?e:i;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let s=(0,Sm.useMemo)(()=>({editor:r}),[r]),o=(0,Sm.useMemo)(()=>({editor:r}),[r]);return(0,iM.jsx)(Ou.Provider,{value:o,children:(0,iM.jsx)(Ov.Provider,{value:s,children:n})})}function O_({...e}){let{editor:i}=(0,Sm.useContext)(Ov);return(0,iM.jsx)(Or,{editor:i,...e})}Ov.displayName="TiptapContext",Oy.displayName="Tiptap",O_.displayName="Tiptap.Content",Object.assign(Oy,{Content:O_});var Ox=(e,i)=>{if("slot"===e)return 0;if(e instanceof Function)return e(i);let{children:n,...r}=null!=i?i:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},Ob=/^\s*>\s$/,Ow=MA.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return Ox("blockquote",{...Ng(this.options.HTMLAttributes,e),children:Ox("slot",{})})},parseMarkdown:(e,i)=>{var n;let r=null!=(n=i.parseBlockChildren)?n:i.parseChildren;return i.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,i)=>{if(!e.content)return"";let n=[];return e.content.forEach((e,r)=>{var s,o;let a=(null!=(o=null==(s=i.renderChild)?void 0:s.call(i,e,r))?o:i.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(a.join("\n"))}),n.join(`
110
+ >
111
+ `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[MS({find:Ob,type:this.type})]}}),OS=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ok=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,OC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,OT=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,OE=Mi.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return Ox("strong",{...Ng(this.options.HTMLAttributes,e),children:Ox("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,i)=>i.applyMark("bold",i.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,i)=>`**${i.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Mb({find:OS,type:this.type}),Mb({find:OC,type:this.type})]},addPasteRules(){return[ML({find:Ok,type:this.type}),ML({find:OT,type:this.type})]}}),OD=/(^|[^`])`([^`]+)`(?!`)$/,ON=/(^|[^`])`([^`]+)`(?!`)/g,OM=Mi.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",Ng(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,i)=>i.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,i)=>e.content?`\`${i.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Mb({find:OD,type:this.type})]},addPasteRules(){return[ML({find:ON,type:this.type})]}}),OO=/^```([a-z]+)?[\s\n]$/,OR=/^~~~([a-z]+)?[\s\n]$/,OA=MA.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var i;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...(null==(i=e.firstElementChild)?void 0:i.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:i}){return["pre",Ng(this.options.HTMLAttributes,i),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,i)=>{var n,r;return(null==(n=e.raw)?void 0:n.startsWith("```"))===!1&&(null==(r=e.raw)?void 0:r.startsWith("~~~"))===!1&&"indented"!==e.codeBlockStyle?[]:i.createNode("codeBlock",{language:e.lang||null},e.text?[i.createTextNode(e.text)]:[])},renderMarkdown:(e,i)=>{var n;let r=(null==(n=e.attrs)?void 0:n.language)||"";return e.content?[`\`\`\`${r}`,i.renderChildren(e.content),"```"].join("\n"):`\`\`\`${r}
112
+
113
+ \`\`\``},addCommands(){return{setCodeBlock:e=>({commands:i})=>i.setNode(this.name,e),toggleCodeBlock:e=>({commands:i})=>i.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:i}=this.editor.state.selection,n=1===i.pos;return!!e&&i.parent.type.name===this.name&&(!!n||!i.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var i;if(!this.options.enableTabIndentation)return!1;let n=null!=(i=this.options.tabSize)?i:4,{state:r}=e,{selection:s}=r,{$from:o,empty:a}=s;if(o.parent.type!==this.type)return!1;let l=" ".repeat(n);return a?e.commands.insertContent(l):e.commands.command(({tr:e})=>{let{from:i,to:n}=s,o=r.doc.textBetween(i,n,"\n","\n").split("\n").map(e=>l+e).join("\n");return e.replaceWith(i,n,r.schema.text(o)),!0})},"Shift-Tab":({editor:e})=>{var i;if(!this.options.enableTabIndentation)return!1;let n=null!=(i=this.options.tabSize)?i:4,{state:r}=e,{selection:s}=r,{$from:o,empty:a}=s;return o.parent.type===this.type&&(a?e.commands.command(({tr:e})=>{var i;let{pos:s}=o,a=o.start(),l=o.end(),c=r.doc.textBetween(a,l,"\n","\n").split("\n"),d=0,h=0,u=s-a;for(let e=0;e<c.length;e+=1){if(h+c[e].length>=u){d=e;break}h+=c[e].length+1}let p=Math.min(((null==(i=c[d].match(/^ */))?void 0:i[0])||"").length,n);if(0===p)return!0;let f=a;for(let e=0;e<d;e+=1)f+=c[e].length+1;return e.delete(f,f+p),s-f<=p&&e.setSelection(kq.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:o}=s,a=r.doc.textBetween(i,o,"\n","\n").split("\n").map(e=>{var i;let r=Math.min(((null==(i=e.match(/^ */))?void 0:i[0])||"").length,n);return e.slice(r)}).join("\n");return e.replaceWith(i,o,r.schema.text(a)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:i}=e,{selection:n}=i,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith("\n\n");return!!o&&!!a&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:i}=e,{selection:n,doc:r}=i,{$from:s,empty:o}=n;if(!o||s.parent.type!==this.type||s.parentOffset!==s.parent.nodeSize-2)return!1;let a=s.after();return void 0!==a&&(r.nodeAt(a)?e.commands.command(({tr:e})=>(e.setSelection(kW.near(r.resolve(a))),!0)):e.commands.exitCode())}}},addInputRules(){return[Mw({find:OO,type:this.type,getAttributes:e=>({language:e[1]})}),Mw({find:OR,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new k6({key:new k7("codeBlockVSCodeHandler"),props:{handlePaste:(e,i)=>{if(!i.clipboardData||this.editor.isActive(this.type.name))return!1;let n=i.clipboardData.getData("text/plain"),r=i.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,o=null==s?void 0:s.mode;if(!n||!o)return!1;let{tr:a,schema:l}=e.state,c=l.text(n.replace(/\r\n?/g,"\n"));return a.replaceSelectionWith(this.type.create({language:o},c)),a.selection.$from.parent.type!==this.type&&a.setSelection(kq.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),e.dispatch(a),!0}}})]}}),OL=MA.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,i)=>e.content?i.renderChildren(e.content,"\n\n"):""}),Oj=MA.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",Ng(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>`
114
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:i,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:s}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=s||e.$to.parentOffset&&e.$from.marks();return i().insertContent({type:this.name}).command(({tr:e,dispatch:i})=>{if(i&&l&&o){let i=l.filter(e=>a.includes(e.type.name));e.ensureMarks(i)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),OI=MA.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:i}){let n=this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0];return[`h${n}`,Ng(this.options.HTMLAttributes,i),0]},parseMarkdown:(e,i)=>i.createNode("heading",{level:e.depth||1},i.parseInline(e.tokens||[])),renderMarkdown:(e,i)=>{var n;let r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,s="#".repeat(r);return e.content?`${s} ${i.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:i})=>!!this.options.levels.includes(e.level)&&i.setNode(this.name,e),toggleHeading:e=>({commands:i})=>!!this.options.levels.includes(e.level)&&i.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,i)=>({...e,...{[`Mod-Alt-${i}`]:()=>this.editor.commands.toggleHeading({level:i})}}),{})},addInputRules(){return this.options.levels.map(e=>Mw({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),OP=MA.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",Ng(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,i)=>i.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:i})=>{if(!function(e,i){let{selection:n}=e,{$from:r}=n;if(n instanceof kY){let e=r.index();return r.parent.canReplaceWith(e,e+1,i)}let s=r.depth;for(;s>=0;){let e=r.index(s);if(r.node(s).contentMatchAt(e).matchType(i))return!0;s-=1}return!1}(i,i.schema.nodes[this.name]))return!1;let{selection:n}=i,{$to:r}=n,s=e();return NL(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:e,tr:i,dispatch:n})=>{if(n){let{$to:n}=i.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?i.setSelection(kq.create(i.doc,n.pos+1)):n.nodeAfter.isBlock?i.setSelection(kY.create(i.doc,n.pos)):i.setSelection(kq.create(i.doc,n.pos));else{let s=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,o=null==s?void 0:s.create();o&&(i.insert(r,o),i.setSelection(kq.create(i.doc,r+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){var e;return[new N9({find:(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type}).find,handler:({state:i,range:n,match:r})=>{let s=Nu(e.getAttributes,void 0,r)||{},{tr:o}=i,a=n.from,l=n.to,c=e.type.create(s);if(r[1]){let e=a+r[0].lastIndexOf(r[1]);e>l?e=l:l=e+r[1].length;let i=r[0][r[0].length-1];o.insertText(i,a+r[0].length-1),o.replaceWith(e,l,c)}else if(r[0]){let i=e.type.isInline?a:a-1;o.insert(i,e.type.create(s)).delete(o.mapping.map(a),o.mapping.map(l))}o.scrollIntoView()},undoable:e.undoable})]}}),OB=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Oz=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,OF=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,OH=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,OW=Mi.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Ng(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,i)=>i.applyMark("italic",i.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(e,i)=>`*${i.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Mb({find:OB,type:this.type}),Mb({find:OF,type:this.type})]},addPasteRules(){return[ML({find:Oz,type:this.type}),ML({find:OH,type:this.type})]}});let O$="numeric",OU="ascii",OV="alpha",Oq="asciinumeric",OK="alphanumeric",OY="domain",OX="emoji",OJ="whitespace";function OG(e,i,n){for(let r in i[O$]&&(i[Oq]=!0,i[OK]=!0),i[OU]&&(i[Oq]=!0,i[OV]=!0),i[Oq]&&(i[OK]=!0),i[OV]&&(i[OK]=!0),i[OK]&&(i[OY]=!0),i[OX]&&(i[OY]=!0),i){let i=(r in n||(n[r]=[]),n[r]);0>i.indexOf(e)&&i.push(e)}}function OZ(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}OZ.groups={},OZ.prototype={accepts(){return!!this.t},go(e){let i=this.j[e];if(i)return i;for(let i=0;i<this.jr.length;i++){let n=this.jr[i][0],r=this.jr[i][1];if(r&&n.test(e))return r}return this.jd},has(e,i=!1){return i?e in this.j:!!this.go(e)},ta(e,i,n,r){for(let s=0;s<e.length;s++)this.tt(e[s],i,n,r)},tr(e,i,n,r){let s;return r=r||OZ.groups,i&&i.j?s=i:(s=new OZ(i),n&&r&&OG(i,n,r)),this.jr.push([e,s]),s},ts(e,i,n,r){let s=this,o=e.length;if(!o)return s;for(let i=0;i<o-1;i++)s=s.tt(e[i]);return s.tt(e[o-1],i,n,r)},tt(e,i,n,r){if(r=r||OZ.groups,i&&i.j)return this.j[e]=i,i;let s,o=this.go(e);return o?(Object.assign((s=new OZ).j,o.j),s.jr.push.apply(s.jr,o.jr),s.jd=o.jd,s.t=o.t):s=new OZ,i&&(r&&(s.t&&"string"==typeof s.t?OG(i,Object.assign(function(e,i){let n={};for(let r in i)i[r].indexOf(e)>=0&&(n[r]=!0);return n}(s.t,r),n),r):n&&OG(i,n,r)),s.t=i),this.j[e]=s,s}};let OQ=(e,i,n,r,s)=>e.ta(i,n,r,s),O0=(e,i,n,r,s)=>e.tr(i,n,r,s),O1=(e,i,n,r,s)=>e.ts(i,n,r,s),O2=(e,i,n,r,s)=>e.tt(i,n,r,s),O5="WORD",O3="UWORD",O4="ASCIINUMERICAL",O6="ALPHANUMERICAL",O8="LOCALHOST",O9="UTLD",O7="SCHEME",Re="SLASH_SCHEME",Rt="OPENBRACE",Ri="CLOSEBRACE",Rn="OPENBRACKET",Rr="CLOSEBRACKET",Rs="OPENPAREN",Ro="CLOSEPAREN",Ra="OPENANGLEBRACKET",Rl="CLOSEANGLEBRACKET",Rc="FULLWIDTHLEFTPAREN",Rd="FULLWIDTHRIGHTPAREN",Rh="LEFTCORNERBRACKET",Ru="RIGHTCORNERBRACKET",Rp="LEFTWHITECORNERBRACKET",Rf="RIGHTWHITECORNERBRACKET",Rm="FULLWIDTHLESSTHAN",Rg="FULLWIDTHGREATERTHAN",Rv="AMPERSAND",Ry="APOSTROPHE",R_="ASTERISK",Rx="BACKSLASH",Rb="BACKTICK",Rw="CARET",RS="COLON",Rk="COMMA",RC="DOLLAR",RT="EQUALS",RE="EXCLAMATION",RD="HYPHEN",RN="PERCENT",RM="PIPE",RO="PLUS",RR="POUND",RA="QUERY",RL="QUOTE",Rj="FULLWIDTHMIDDLEDOT",RI="SEMI",RP="SLASH",RB="TILDE",Rz="UNDERSCORE",RF="EMOJI";var RH=Object.freeze({__proto__:null,ALPHANUMERICAL:O6,AMPERSAND:Rv,APOSTROPHE:Ry,ASCIINUMERICAL:O4,ASTERISK:R_,AT:"AT",BACKSLASH:Rx,BACKTICK:Rb,CARET:Rw,CLOSEANGLEBRACKET:Rl,CLOSEBRACE:Ri,CLOSEBRACKET:Rr,CLOSEPAREN:Ro,COLON:RS,COMMA:Rk,DOLLAR:RC,DOT:"DOT",EMOJI:RF,EQUALS:RT,EXCLAMATION:RE,FULLWIDTHGREATERTHAN:Rg,FULLWIDTHLEFTPAREN:Rc,FULLWIDTHLESSTHAN:Rm,FULLWIDTHMIDDLEDOT:Rj,FULLWIDTHRIGHTPAREN:Rd,HYPHEN:RD,LEFTCORNERBRACKET:Rh,LEFTWHITECORNERBRACKET:Rp,LOCALHOST:O8,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:Ra,OPENBRACE:Rt,OPENBRACKET:Rn,OPENPAREN:Rs,PERCENT:RN,PIPE:RM,PLUS:RO,POUND:RR,QUERY:RA,QUOTE:RL,RIGHTCORNERBRACKET:Ru,RIGHTWHITECORNERBRACKET:Rf,SCHEME:O7,SEMI:RI,SLASH:RP,SLASH_SCHEME:Re,SYM:"SYM",TILDE:RB,TLD:"TLD",UNDERSCORE:Rz,UTLD:O9,UWORD:O3,WORD:O5,WS:"WS"});let RW=/[a-z]/,R$=/\p{L}/u,RU=/\p{Emoji}/u,RV=/\d/,Rq=/\s/,RK=null,RY=null;function RX(e,i){let n=function(e){let i=[],n=e.length,r=0;for(;r<n;){let s,o=e.charCodeAt(r),a=o<55296||o>56319||r+1===n||(s=e.charCodeAt(r+1))<56320||s>57343?e[r]:e.slice(r,r+2);i.push(a),r+=a.length}return i}(i.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,s=[],o=0,a=0;for(;a<r;){let l=e,c=null,d=0,h=null,u=-1,p=-1;for(;a<r&&(c=l.go(n[a]));)(l=c).accepts()?(u=0,p=0,h=l):u>=0&&(u+=n[a].length,p++),d+=n[a].length,o+=n[a].length,a++;o-=u,a-=p,d-=u,s.push({t:h.t,v:i.slice(o-d,o),s:o-d,e:o})}return s}function RJ(e,i,n,r,s){let o,a=i.length;for(let n=0;n<a-1;n++){let a=i[n];e.j[a]?o=e.j[a]:((o=new OZ(r)).jr=s.slice(),e.j[a]=o),e=o}return(o=new OZ(n)).jr=s.slice(),e.j[i[a-1]]=o,o}function RG(e){let i=[],n=[],r=0;for(;r<e.length;){let s=0;for(;"0123456789".indexOf(e[r+s])>=0;)s++;if(s>0){i.push(n.join(""));for(let i=parseInt(e.substring(r,r+s),10);i>0;i--)n.pop();r+=s}else n.push(e[r]),r++}return i}let RZ={defaultProtocol:"http",events:null,format:R0,formatHref:R0,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function RQ(e,i=null){let n=Object.assign({},RZ);e&&(n=Object.assign(n,e instanceof RQ?e.o:e));let r=n.ignoreTags,s=[];for(let e=0;e<r.length;e++)s.push(r[e].toUpperCase());this.o=n,i&&(this.defaultRender=i),this.ignoreTags=s}function R0(e){return e}function R1(e,i){this.t="token",this.v=e,this.tk=i}function R2(e,i){class n extends R1{constructor(i,n){super(i,n),this.t=e}}for(let e in i)n.prototype[e]=i[e];return n.t=e,n}RQ.prototype={o:RZ,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,i,n){let r=null!=i,s=this.o[e];return s&&("object"==typeof s?"function"==typeof(s=n.t in s?s[n.t]:RZ[e])&&r&&(s=s(i,n)):"function"==typeof s&&r&&(s=s(i,n.t,n))),s},getObj(e,i,n){let r=this.o[e];return"function"==typeof r&&null!=i&&(r=r(i,n.t,n)),r},render(e){let i=e.render(this);return(this.get("render",null,e)||this.defaultRender)(i,e.t,e)}},R1.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let i=this.toString(),n=e.get("truncate",i,this),r=e.get("format",i,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=RZ.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){let i=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",i,this),r=e.get("tagName",i,this),s=this.toFormattedString(e),o={},a=e.get("className",i,this),l=e.get("target",i,this),c=e.get("rel",i,this),d=e.getObj("attributes",i,this),h=e.getObj("events",i,this);return o.href=n,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:r,attributes:o,content:s,eventListeners:h}}};let R5=R2("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),R3=R2("text"),R4=R2("nl"),R6=R2("url",{isLink:!0,toHref(e=RZ.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==O8&&e[1].t===RS}}),R8=e=>new OZ(e);function R9(e,i,n){let r=n[0].s,s=n[n.length-1].e;return new e(i.slice(r,s),n)}let R7="u">typeof console&&console&&console.warn||(()=>{}),Ae={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function At(e,i=!1){if(Ae.initialized&&R7(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
115
+ 1. Must only contain digits, lowercase ASCII letters or "-"
116
+ 2. Cannot start or end with "-"
117
+ 3. "-" cannot repeat`);Ae.customSchemes.push([e,i])}function Ai(e){return Ae.initialized||function(){Ae.scanner=function(e=[]){let i={};OZ.groups=i;let n=new OZ;null==RK&&(RK=RG("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==RY&&(RY=RG("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),O2(n,"'",Ry),O2(n,"{",Rt),O2(n,"}",Ri),O2(n,"[",Rn),O2(n,"]",Rr),O2(n,"(",Rs),O2(n,")",Ro),O2(n,"<",Ra),O2(n,">",Rl),O2(n,"(",Rc),O2(n,")",Rd),O2(n,"「",Rh),O2(n,"」",Ru),O2(n,"『",Rp),O2(n,"』",Rf),O2(n,"<",Rm),O2(n,">",Rg),O2(n,"&",Rv),O2(n,"*",R_),O2(n,"@","AT"),O2(n,"`",Rb),O2(n,"^",Rw),O2(n,":",RS),O2(n,",",Rk),O2(n,"$",RC),O2(n,".","DOT"),O2(n,"=",RT),O2(n,"!",RE),O2(n,"-",RD),O2(n,"%",RN),O2(n,"|",RM),O2(n,"+",RO),O2(n,"#",RR),O2(n,"?",RA),O2(n,'"',RL),O2(n,"/",RP),O2(n,";",RI),O2(n,"~",RB),O2(n,"_",Rz),O2(n,"\\",Rx),O2(n,"・",Rj);let r=O0(n,RV,"NUM",{[O$]:!0});O0(r,RV,r);let s=O0(r,RW,O4,{[Oq]:!0}),o=O0(r,R$,O6,{[OK]:!0}),a=O0(n,RW,O5,{[OU]:!0});O0(a,RV,s),O0(a,RW,a),O0(s,RV,s),O0(s,RW,s);let l=O0(n,R$,O3,{[OV]:!0});O0(l,RW),O0(l,RV,o),O0(l,R$,l),O0(o,RV,o),O0(o,RW),O0(o,R$,o);let c=O2(n,"\n","NL",{[OJ]:!0}),d=O2(n,"\r","WS",{[OJ]:!0}),h=O0(n,Rq,"WS",{[OJ]:!0});O2(n,"",h),O2(d,"\n",c),O2(d,"",h),O0(d,Rq,h),O2(h,"\r"),O2(h,"\n"),O0(h,Rq,h),O2(h,"",h);let u=O0(n,RU,RF,{[OX]:!0});O2(u,"#"),O0(u,RU,u),O2(u,"️",u);let p=O2(u,"‍");O2(p,"#"),O0(p,RU,u);let f=[[RW,a],[RV,s]],m=[[RW,null],[R$,l],[RV,o]];for(let e=0;e<RK.length;e++)RJ(n,RK[e],"TLD",O5,f);for(let e=0;e<RY.length;e++)RJ(n,RY[e],O9,O3,m);OG("TLD",{tld:!0,ascii:!0},i),OG(O9,{utld:!0,alpha:!0},i),RJ(n,"file",O7,O5,f),RJ(n,"mailto",O7,O5,f),RJ(n,"http",Re,O5,f),RJ(n,"https",Re,O5,f),RJ(n,"ftp",Re,O5,f),RJ(n,"ftps",Re,O5,f),OG(O7,{scheme:!0,ascii:!0},i),OG(Re,{slashscheme:!0,ascii:!0},i),e=e.sort((e,i)=>e[0]>i[0]?1:-1);for(let i=0;i<e.length;i++){let r=e[i][0],s=e[i][1]?{scheme:!0}:{slashscheme:!0};r.indexOf("-")>=0?s[OY]=!0:RW.test(r)?RV.test(r)?s[Oq]=!0:s[OU]=!0:s[O$]=!0,O1(n,r,r,s)}return O1(n,"localhost",O8,{ascii:!0}),n.jd=new OZ("SYM"),{start:n,tokens:Object.assign({groups:i},RH)}}(Ae.customSchemes);for(let e=0;e<Ae.tokenQueue.length;e++)Ae.tokenQueue[e][1]({scanner:Ae.scanner});Ae.parser=function({groups:e}){let i=e.domain.concat([Rv,R_,"AT",Rx,Rb,Rw,RC,RT,RD,"NUM",RN,RM,RO,RR,RP,"SYM",RB,Rz]),n=[Ry,RS,Rk,"DOT",RE,RN,RA,RL,RI,Ra,Rl,Rt,Ri,Rr,Rn,Rs,Ro,Rc,Rd,Rh,Ru,Rp,Rf,Rm,Rg],r=[Rv,Ry,R_,Rx,Rb,Rw,RC,RT,RD,Rt,Ri,RN,RM,RO,RR,RA,RP,"SYM",RB,Rz],s=R8(),o=O2(s,RB);OQ(o,r,o),OQ(o,e.domain,o);let a=R8(),l=R8(),c=R8();OQ(s,e.domain,a),OQ(s,e.scheme,l),OQ(s,e.slashscheme,c),OQ(a,r,o),OQ(a,e.domain,a);let d=O2(a,"AT");O2(o,"AT",d),O2(l,"AT",d),O2(c,"AT",d);let h=O2(o,"DOT");OQ(h,r,o),OQ(h,e.domain,o);let u=R8();OQ(d,e.domain,u),OQ(u,e.domain,u);let p=O2(u,"DOT");OQ(p,e.domain,u);let f=R8(R5);OQ(p,e.tld,f),OQ(p,e.utld,f),O2(d,O8,f);let m=O2(u,RD);O2(m,RD,m),OQ(m,e.domain,u),OQ(f,e.domain,u),O2(f,"DOT",p),O2(f,RD,m),OQ(O2(f,RS),e.numeric,R5);let g=O2(a,RD),v=O2(a,"DOT");O2(g,RD,g),OQ(g,e.domain,a),OQ(v,r,o),OQ(v,e.domain,a);let y=R8(R6);OQ(v,e.tld,y),OQ(v,e.utld,y),OQ(y,e.domain,a),OQ(y,r,o),O2(y,"DOT",v),O2(y,RD,g),O2(y,"AT",d);let _=O2(y,RS),b=R8(R6);OQ(_,e.numeric,b);let w=R8(R6),S=R8();OQ(w,i,w),OQ(w,n,S),OQ(S,i,w),OQ(S,n,S),O2(y,RP,w),O2(b,RP,w);let k=O2(l,RS),C=O2(c,RS),T=O2(C,RP),E=O2(T,RP);OQ(l,e.domain,a),O2(l,"DOT",v),O2(l,RD,g),OQ(c,e.domain,a),O2(c,"DOT",v),O2(c,RD,g),OQ(k,e.domain,w),O2(k,RP,w),O2(k,RA,w),OQ(E,e.domain,w),OQ(E,i,w),O2(E,RP,w);let D=[[Rt,Ri],[Rn,Rr],[Rs,Ro],[Ra,Rl],[Rc,Rd],[Rh,Ru],[Rp,Rf],[Rm,Rg]];for(let e=0;e<D.length;e++){let[r,s]=D[e],o=O2(w,r);O2(S,r,o),O2(o,s,w);let a=R8(R6);OQ(o,i,a);let l=R8();OQ(o,n),OQ(a,i,a),OQ(a,n,l),OQ(l,i,a),OQ(l,n,l),O2(a,s,w),O2(l,s,w)}return O2(s,O8,y),O2(s,"NL",R4),{start:s,tokens:RH}}(Ae.scanner.tokens);for(let e=0;e<Ae.pluginQueue.length;e++)Ae.pluginQueue[e][1]({scanner:Ae.scanner,parser:Ae.parser});Ae.initialized=!0}(),function(e,i,n){let r=n.length,s=0,o=[],a=[];for(;s<r;){let l=e,c=null,d=null,h=0,u=null,p=-1;for(;s<r&&!(c=l.go(n[s].t));)a.push(n[s++]);for(;s<r&&(d=c||l.go(n[s].t));)c=null,(l=d).accepts()?(p=0,u=l):p>=0&&p++,s++,h++;if(p<0)(s-=h)<r&&(a.push(n[s]),s++);else{a.length>0&&(o.push(R9(R3,i,a)),a=[]),s-=p,h-=p;let e=u.t,r=n.slice(s-h,s);o.push(R9(e,i,r))}}return a.length>0&&o.push(R9(R3,i,a)),o}(Ae.parser.start,e,RX(Ae.scanner.start,e))}function An(e,i=null,n=null){if(i&&"object"==typeof i){if(n)throw Error(`linkifyjs: Invalid link type ${i}; must be a string`);n=i,i=null}let r=new RQ(n),s=Ai(e),o=[];for(let e=0;e<s.length;e++){let n=s[e];n.isLink&&(!i||n.t===i)&&r.check(n)&&o.push(n.toFormattedObject(r))}return o}Ai.scan=RX;var Ar="[\0-   ᠎ -\u2029  ]",As=new RegExp(Ar),Ao=RegExp(`${Ar}$`),Aa=RegExp(Ar,"g");function Al(e,i){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return i&&i.forEach(e=>{let i="string"==typeof e?e:e.scheme;i&&n.push(i)}),!e||e.replace(Aa,"").match(RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Ac=Mi.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"==typeof e?At(e):At(e.scheme,e.optionalSlashes)})},onDestroy(){OZ.groups={},Ae.scanner=null,Ae.parser=null,Ae.tokenQueue=[],Ae.pluginQueue=[],Ae.customSchemes=[],Ae.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,i)=>!!Al(e,i.protocols),validate:e=>!!e,shouldAutoLink:e=>{let i=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(i||n&&!e.includes("@"))return!0;let r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{let i=e.getAttribute("href");return!!i&&!!this.options.isAllowedUri(i,{defaultValidate:e=>!!Al(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Al(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ng(this.options.HTMLAttributes,e),0]:["a",Ng(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,i)=>i.applyMark("link",i.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,i)=>{var n,r,s,o;let a=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",l=null!=(o=null==(s=e.attrs)?void 0:s.title)?o:"",c=i.renderChildren(e);return l?`[${c}](${a} "${l}")`:`[${c}](${a})`},addCommands(){return{setLink:e=>({chain:i})=>{let{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Al(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&i().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:i})=>{let{href:n}=e||{};return(!n||!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Al(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&i().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ML({find:e=>{let i=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,s=An(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Al(e,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(e=>{this.options.shouldAutoLink(e.value)&&i.push({text:e.value,data:{href:e.href},index:e.start})})}return i},type:this.type,getAttributes:e=>{var i;return{href:null==(i=e.data)?void 0:i.href}}})]},addProseMirrorPlugins(){var e,i,n;let r=[],{protocols:s,defaultProtocol:o}=this.options;return this.options.autolink&&r.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Al(e,s),protocols:s,defaultProtocol:o}),shouldAutoLink:this.options.shouldAutoLink},new k6({key:new k7("autolink"),appendTransaction:(i,n,r)=>{let s=i.some(e=>e.docChanged)&&!n.doc.eq(r.doc),o=i.some(e=>e.getMeta("preventAutolink"));if(!s||o)return;let{tr:a}=r;if(NT(No(n.doc,[...i])).forEach(({newRange:i})=>{var n,s;let o,l,c,d=(n=r.doc,s=e=>e.isTextblock,c=[],n.nodesBetween(i.from,i.to,(e,i)=>{s(e)&&c.push({node:e,pos:i})}),c);if(d.length>1)o=d[0],l=r.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(d.length){let e=r.doc.textBetween(i.from,i.to," "," ");if(!Ao.test(e))return;o=d[0],l=r.doc.textBetween(o.pos,i.to,void 0," ")}if(o&&l){let i=l.split(As).filter(Boolean);if(i.length<=0)return!1;let n=i[i.length-1],s=o.pos+l.lastIndexOf(n);if(!n)return!1;let c=Ai(n).map(i=>i.toObject(e.defaultProtocol));if(!(1===c.length?c[0].isLink:3===c.length&&!!c[1].isLink&&["()","[]"].includes(c[0].value+c[2].value)))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(i=>e.validate(i.value)).filter(i=>e.shouldAutoLink(i.value)).forEach(i=>{NE(i.from,i.to,r.doc).some(i=>i.mark.type===e.type)||a.addMark(i.from,i.to,e.type.create({href:i.href}))})}}),a.steps.length)return a}}))),r.push((i={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new k6({key:new k7("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,o;if(0!==r.button||!e.editable)return!1;let a=null;if(r.target instanceof HTMLAnchorElement)a=r.target;else{let e=r.target;if(!e)return!1;let n=i.editor.view.dom;(a=e.closest("a"))&&!n.contains(a)&&(a=null)}if(!a)return!1;let l=!1;if(i.enableClickSelection&&(l=i.editor.commands.extendMarkRange(i.type.name)),i.openOnClick){let n=NC(e.state,i.type.name),r=null!=(s=a.href)?s:n.href,c=null!=(o=a.target)?o:n.target;r&&(window.open(r,c),l=!0)}return l}}}))),this.options.linkOnPaste&&r.push((n={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new k6({key:new k7("handlePasteLink"),props:{handlePaste:(e,i,r)=>{let{shouldAutoLink:s}=n,{state:o}=e,{selection:a}=o,{empty:l}=a;if(l)return!1;let c="";r.content.forEach(e=>{c+=e.textContent});let d=An(c,{defaultProtocol:n.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!!c&&!!d&&(void 0===s||!!s(d.value))&&n.editor.commands.setMark(n.type,{href:d.href})}}}))),r}}),Ad=Object.defineProperty,Ah="textStyle",Au=/^\s*([-+*])\s$/,Ap=MA.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",Ng(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,i)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?i.parseChildren(e.items):[]},renderMarkdown:(e,i)=>e.content?i.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:i})=>this.options.keepAttributes?i().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Ah)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=MS({find:Au,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=MS({find:Au,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ah),editor:this.editor})),[e]}}),Af=MA.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",Ng(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,i)=>{var n;if("list_item"!==e.type)return[];let r=null!=(n=i.parseBlockChildren)?n:i.parseChildren,s=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>"paragraph"===e.type))s=r(e.tokens);else{let n=e.tokens[0];if(n&&"text"===n.type&&n.tokens&&n.tokens.length>0){if(s=[{type:"paragraph",content:i.parseInline(n.tokens)}],e.tokens.length>1){let i=r(e.tokens.slice(1));s.push(...i)}}else s=r(e.tokens)}return 0===s.length&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(e,i,n)=>MR(e,i,e=>{var i,n;if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){let r=(null==(n=null==(i=e.meta)?void 0:i.parentAttrs)?void 0:n.start)||1;return`${r+e.index}. `}return"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Am={},Ag={findListItemPos:()=>Ay,getNextListDepth:()=>A_,handleBackspace:()=>AS,handleDelete:()=>AT,hasListBefore:()=>Ax,hasListItemAfter:()=>AE,hasListItemBefore:()=>Ab,listItemHasSubList:()=>Aw,nextListIsDeeper:()=>Ak,nextListIsHigher:()=>AC};for(var Av in Ag)Ad(Am,Av,{get:Ag[Av],enumerable:!0});var Ay=(e,i)=>{let{$from:n}=i.selection,r=Dg(e,i.schema),s=n.depth,o=n.pos,a=null;for(;s>0&&null===a;)n.node(s).type===r?a=s:(s-=1,o-=1);return null===a?null:{$pos:i.doc.resolve(o),depth:a}},A_=(e,i)=>{let n=Ay(e,i);if(!n)return!1;let[,r]=((e,i,n,r=20)=>{let s=e.doc.resolve(n),o=r,a=null;for(;o>0&&null===a;){let e=s.node(o);(null==e?void 0:e.type.name)===i?a=e:o-=1}return[a,o]})(i,e,n.$pos.pos+4);return r},Ax=(e,i,n)=>{let{$anchor:r}=e.selection,s=Math.max(0,r.pos-2),o=e.doc.resolve(s).node();return!!o&&!!n.includes(o.type.name)},Ab=(e,i)=>{var n;let{$anchor:r}=i.selection,s=i.doc.resolve(r.pos-2);return 0!==s.index()&&(null==(n=s.nodeBefore)?void 0:n.type.name)===e},Aw=(e,i,n)=>{if(!n)return!1;let r=Dg(e,i.schema),s=!1;return n.descendants(e=>{e.type===r&&(s=!0)}),s},AS=(e,i,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!DZ(e.state,i)&&Ax(e.state,i,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),s=[];r.node().descendants((e,n)=>{e.type.name===i&&s.push({node:e,pos:n})});let o=s.at(-1);if(!o)return!1;let a=e.state.doc.resolve(r.start()+o.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},a.end()).joinForward().run()}if(!DZ(e.state,i)||!(e=>{let{$from:i,$to:n}=e.selection;return!(i.parentOffset>0)&&i.pos===n.pos})(e.state))return!1;let r=Ay(i,e.state);if(!r)return!1;let s=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=Aw(i,e.state,s);return Ab(i,e.state)&&!o?e.commands.joinItemBackward():e.chain().liftListItem(i).run()},Ak=(e,i)=>{let n=A_(e,i),r=Ay(e,i);return!!r&&!!n&&n>r.depth},AC=(e,i)=>{let n=A_(e,i),r=Ay(e,i);return!!r&&!!n&&n<r.depth},AT=(e,i)=>{if(!DZ(e.state,i)||!((e,i)=>{let{$from:n,$to:r,$anchor:s}=e.selection;if(i){let n=Na(e=>e.type.name===i)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return s.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2)&&n.pos===r.pos})(e.state,i))return!1;let{selection:n}=e.state,{$from:r,$to:s}=n;return!(!n.empty&&r.sameParent(s))&&(Ak(i,e.state)?e.chain().focus(e.state.selection.from+4).lift(i).joinBackward().run():AC(i,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},AE=(e,i)=>{var n;let{$anchor:r}=i.selection,s=i.doc.resolve(r.pos-r.parentOffset-2);return s.index()!==s.parent.childCount-1&&(null==(n=s.nodeAfter)?void 0:n.type.name)===e},AD=Mo.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let i=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&AT(e,n)&&(i=!0)}),i},"Mod-Delete":({editor:e})=>{let i=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&AT(e,n)&&(i=!0)}),i},Backspace:({editor:e})=>{let i=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&AS(e,n,r)&&(i=!0)}),i},"Mod-Backspace":({editor:e})=>{let i=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&AS(e,n,r)&&(i=!0)}),i}}}}),AN=/^(\s*)(\d+)\.\s+(.*)$/,AM=/^\s/,AO="textStyle",AR=/^(\d+)\.\s$/,AA=MA.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:i,...n}=e;return 1===i?["ol",Ng(this.options.HTMLAttributes,n),0]:["ol",Ng(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,i)=>{var n;if("list"!==e.type||!e.ordered)return[];let r=e.start||1,s=e.items?(n=e.items,n.map(e=>{if("list_item"!==e.type)return i.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...i.parseChildren([e]));else if("text"===e.type&&e.tokens){let r=i.parseChildren([e]);n.push({type:"paragraph",content:r})}else{let r=i.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})):[];return 1!==r?{type:"orderedList",attrs:{start:r},content:s}:{type:"orderedList",content:s}},renderMarkdown:(e,i)=>e.content?i.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{let i=e.match(/^(\s*)(\d+)\.\s+/),n=null==i?void 0:i.index;return void 0!==n?n:-1},tokenize:(e,i,n)=>{var r;let s=e.split("\n"),[o,a]=function(e){let i=[],n=0,r=0;for(;n<e.length;){let s=e[n],o=s.match(AN);if(!o)break;let[,a,l,c]=o,d=a.length,h=[c],u=n+1,p=[s],f=!1;for(;u<e.length;){let i=e[u];if(i.match(AN))break;if(""===i.trim())p.push(i),h.push(""),f=!0,u+=1;else if(i.match(AM))p.push(i),h.push(i.slice(d+2)),u+=1;else{if(f)break;p.push(i),h.push(i),u+=1}}i.push({indent:d,number:parseInt(l,10),content:h.join("\n").trim(),contentLines:h,raw:p.join("\n")}),r=u,n=u}return[i,r]}(s);if(0===o.length)return;let l=function e(i,n,r){let s=[],o=0;for(;o<i.length;){let a=i[o];if(a.indent===n){let{paragraphLines:l,blockLines:c}=function(e){let i=[],n=[],r=!1;return e.forEach(e=>{let s;if(r)return void n.push(e);if(""===e.trim()||i.length>0&&(s=e.trimStart(),/^[-+*]\s+/.test(s)||/^\d+\.\s+/.test(s)||/^>\s?/.test(s)||/^```/.test(s)||/^~~~/.test(s))){r=!0,n.push(e);return}i.push(e)}),{paragraphLines:i,blockLines:n}}(a.contentLines),d=l.join("\n").trim(),h=[];d&&h.push({type:"paragraph",raw:d,tokens:r.inlineTokens(d)});let u=c.join("\n").trim();if(u){let e=r.blockTokens(u);h.push(...e)}let p=o+1,f=[];for(;p<i.length&&i[p].indent>n;)f.push(i[p]),p+=1;if(f.length>0){let i=Math.min(...f.map(e=>e.indent)),n=e(f,i,r);h.push({type:"list",ordered:!0,start:f[0].number,items:n,raw:f.map(e=>e.raw).join("\n")})}s.push({type:"list_item",raw:a.raw,tokens:h}),o=p}else o+=1}return s}(o,0,n);if(0!==l.length)return{type:"list",ordered:!0,start:(null==(r=o[0])?void 0:r.number)||1,items:l,raw:s.slice(0,a).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:i})=>this.options.keepAttributes?i().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(AO)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=MS({find:AR,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,i)=>i.childCount+i.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=MS({find:AR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(AO)}),joinPredicate:(e,i)=>i.childCount+i.attrs.start===+e[1],editor:this.editor})),[e]}}),AL=/^\s*(\[([( |x])?\])\s$/,Aj=MA.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let i=e.getAttribute("data-checked");return""===i||"true"===i},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:i}){return["li",Ng(this.options.HTMLAttributes,i,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,i)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(i.createNode("paragraph",{},i.parseInline(e.tokens))):e.text?n.push(i.createNode("paragraph",{},[i.createNode("text",{text:e.text})])):n.push(i.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=i.parseChildren(e.nestedTokens);n.push(...r)}return i.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,i)=>{var n;let r=(null==(n=e.attrs)?void 0:n.checked)?"x":" ";return MR(e,i,`- [${r}] `)},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:i,getPos:n,editor:r})=>{let s=document.createElement("li"),o=document.createElement("label"),a=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),d=e=>{var i,n;l.ariaLabel=(null==(n=null==(i=this.options.a11y)?void 0:i.checkboxLabel)?void 0:n.call(i,e,l.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};d(e),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",e=>e.preventDefault()),l.addEventListener("change",i=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}let{checked:s}=i.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let i=n();if("number"!=typeof i)return!1;let r=e.doc.nodeAt(i);return e.setNodeMarkup(i,void 0,{...null==r?void 0:r.attrs,checked:s}),!0}).run(),r.isEditable||!this.options.onReadOnlyChecked||this.options.onReadOnlyChecked(e,s)||(l.checked=!l.checked)}),Object.entries(this.options.HTMLAttributes).forEach(([e,i])=>{s.setAttribute(e,i)}),s.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,o.append(l,a),s.append(o,c),Object.entries(i).forEach(([e,i])=>{s.setAttribute(e,i)});let h=new Set(Object.keys(i));return{dom:s,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;s.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,d(e);let i=Nv(e,r.extensionManager.attributes),n=new Set(Object.keys(i)),o=this.options.HTMLAttributes;return h.forEach(e=>{n.has(e)||(e in o?s.setAttribute(e,o[e]):s.removeAttribute(e))}),Object.entries(i).forEach(([e,i])=>{null==i?e in o?s.setAttribute(e,o[e]):s.removeAttribute(e):s.setAttribute(e,i)}),h=n,!0}}}},addInputRules(){return[MS({find:AL,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),AI=MA.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Ng(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,i)=>i.createNode("taskList",{},i.parseChildren(e.items||[])),renderMarkdown:(e,i)=>e.content?i.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var i;let n=null==(i=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:i.index;return void 0!==n?n:-1},tokenize(e,i,n){let r=e=>{let i=MO(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,i)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:i}),customNestedParser:r},n);return i?[{type:"taskList",raw:i.raw,items:i.items}]:n.blockTokens(e)},s=MO(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,i)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:i}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Mo.create({name:"listKit",addExtensions(){let e=[];return!1!==this.options.bulletList&&e.push(Ap.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(Af.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(AD.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(AA.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(Aj.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(AI.configure(this.options.taskList)),e}});var AP="&nbsp;",AB=MA.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",Ng(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,i)=>{let n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return i.parseChildren([n[0]]);let r=i.parseInline(n);return 1===n.length&&"text"===n[0].type&&(n[0].raw===AP||n[0].text===AP||" "===n[0].raw||" "===n[0].text)&&1===r.length&&"text"===r[0].type&&(r[0].text===AP||" "===r[0].text)?i.createNode("paragraph",void 0,[]):i.createNode("paragraph",void 0,r)},renderMarkdown:(e,i,n)=>{var r,s;if(!e)return"";let o=Array.isArray(e.content)?e.content:[];if(0===o.length){let e=Array.isArray(null==(r=null==n?void 0:n.previousNode)?void 0:r.content)?n.previousNode.content:[];return(null==(s=null==n?void 0:n.previousNode)?void 0:s.type)==="paragraph"&&0===e.length?AP:""}return i.renderChildren(o)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Az=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,AF=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,AH=Mi.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",Ng(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,i)=>i.applyMark("strike",i.parseInline(e.tokens||[])),renderMarkdown:(e,i)=>`~~${i.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Mb({find:Az,type:this.type})]},addPasteRules(){return[ML({find:AF,type:this.type})]}}),AW=MA.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),A$=Mi.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",Ng(this.options.HTMLAttributes,e),0]},parseMarkdown(e,i){return i.applyMark(this.name||"underline",i.parseInline(e.tokens||[]))},renderMarkdown:(e,i)=>`++${i.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,i,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let s=r[2].trim();return{type:"underline",raw:r[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});class AU{constructor(e,i){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!=(n=i.width)?n:1,this.color=!1===i.color?void 0:i.color||"black",this.class=i.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let n=e=>{this[i](e)};return e.dom.addEventListener(i,n),{name:i,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:i})=>this.editorView.dom.removeEventListener(e,i))}update(e,i){null!=this.cursorPos&&i.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,i,n=this.editorView.state.doc.resolve(this.cursorPos),r=!n.parent.inlineContent,s,o=this.editorView.dom,a=o.getBoundingClientRect(),l=a.width/o.offsetWidth,c=a.height/o.offsetHeight;if(r){let e=n.nodeBefore,i=n.nodeAfter;if(e||i){let n=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(n){let r=n.getBoundingClientRect(),o=e?r.bottom:r.top;e&&i&&(o=(o+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let a=this.width/2*c;s={left:r.left,right:r.right,top:o-a,bottom:o+a}}}}if(!s){let e=this.editorView.coordsAtPos(this.cursorPos),i=this.width/2*l;s={left:e.left-i,right:e.left+i,top:e.top,bottom:e.bottom}}let d=this.editorView.dom.offsetParent;if(!this.element&&(this.element=d.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),d&&(d!=document.body||"static"!=getComputedStyle(d).position)){let n=d.getBoundingClientRect(),r=n.width/d.offsetWidth,s=n.height/d.offsetHeight;e=n.left-d.scrollLeft*r,i=n.top-d.scrollTop*s}else e=-pageXOffset,i=-pageYOffset;this.element.style.left=(s.left-e)/l+"px",this.element.style.top=(s.top-i)/c+"px",this.element.style.width=(s.right-s.left)/l+"px",this.element.style.height=(s.bottom-s.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let i=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=i&&i.inside>=0&&this.editorView.state.doc.nodeAt(i.inside),r=n&&n.type.spec.disableDropCursor,s="function"==typeof r?r(this.editorView,i,e):r;if(i&&!s){let e=i.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let i=kD(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=i&&(e=i)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class AV extends kW{constructor(e){super(e,e)}map(e,i){let n=e.resolve(i.map(this.head));return AV.valid(n)?new AV(n):kW.near(n)}content(){return Sk.empty}eq(e){return e instanceof AV&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,i){if("number"!=typeof i.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new AV(e.resolve(i.pos))}getBookmark(){return new Aq(this.anchor)}static valid(e){let i=e.parent;if(i.inlineContent||!function(e){for(let i=e.depth;i>=0;i--){let n=e.index(i),r=e.node(i);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||AK(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let i=e.depth;i>=0;i--){let n=e.indexAfter(i),r=e.node(i);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||AK(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=i.type.spec.allowGapCursor;if(null!=n)return n;let r=i.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,i,n=!1){n:for(;;){if(!n&&AV.valid(e))return e;let r=e.pos,s=null;for(let n=e.depth;;n--){let o=e.node(n);if(i>0?e.indexAfter(n)<o.childCount:e.index(n)>0){s=o.child(i>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=i;let a=e.doc.resolve(r);if(AV.valid(a))return a}for(;;){let o=i>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!kY.isSelectable(s)){e=e.doc.resolve(r+s.nodeSize*i),n=!1;continue n}break}s=o,r+=i;let a=e.doc.resolve(r);if(AV.valid(a))return a}return null}}}AV.prototype.visible=!1,AV.findFrom=AV.findGapCursorFrom,kW.jsonID("gapcursor",AV);class Aq{constructor(e){this.pos=e}map(e){return new Aq(e.map(this.pos))}resolve(e){let i=e.resolve(this.pos);return AV.valid(i)?new AV(i):kW.near(i)}}function AK(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let AY=Dn({ArrowLeft:AX("horiz",-1),ArrowRight:AX("horiz",1),ArrowUp:AX("vert",-1),ArrowDown:AX("vert",1)});function AX(e,i){let n="vert"==e?i>0?"down":"up":i>0?"right":"left";return function(e,r,s){let o=e.selection,a=i>0?o.$to:o.$from,l=o.empty;if(o instanceof kq){if(!s.endOfTextblock(n)||0==a.depth)return!1;l=!1,a=e.doc.resolve(i>0?a.after():a.before())}let c=AV.findGapCursorFrom(a,i,l);return!!c&&(r&&r(e.tr.setSelection(new AV(c))),!0)}}function AJ(e,i,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(i);if(!AV.valid(r))return!1;let s=e.posAtCoords({left:n.clientX,top:n.clientY});return!(s&&s.inside>-1&&kY.isSelectable(e.state.doc.nodeAt(s.inside)))&&(e.dispatch(e.state.tr.setSelection(new AV(r))),!0)}function AG(e,i){if("insertCompositionText"!=i.inputType||!(e.state.selection instanceof AV))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let s=Sy.empty;for(let e=r.length-1;e>=0;e--)s=Sy.from(r[e].createAndFill(null,s));let o=e.state.tr.replace(n.pos,n.pos,new Sk(s,0,0));return o.setSelection(kq.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function AZ(e){if(!(e.selection instanceof AV))return null;let i=document.createElement("div");return i.className="ProseMirror-gapcursor",EN.create(e.doc,[ET.widget(e.selection.head,i,{key:"gapcursor"})])}var AQ=function(){};AQ.prototype.append=function(e){return e.length?(e=AQ.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},AQ.prototype.prepend=function(e){return e.length?AQ.from(e).append(this):this},AQ.prototype.appendInner=function(e){return new A1(this,e)},AQ.prototype.slice=function(e,i){return(void 0===e&&(e=0),void 0===i&&(i=this.length),e>=i)?AQ.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,i))},AQ.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},AQ.prototype.forEach=function(e,i,n){void 0===i&&(i=0),void 0===n&&(n=this.length),i<=n?this.forEachInner(e,i,n,0):this.forEachInvertedInner(e,i,n,0)},AQ.prototype.map=function(e,i,n){void 0===i&&(i=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(i,n){return r.push(e(i,n))},i,n),r},AQ.from=function(e){return e instanceof AQ?e:e&&e.length?new A0(e):AQ.empty};var A0=function(e){function i(i){e.call(this),this.values=i}i.__proto__=e,i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i;var n={length:{configurable:!0},depth:{configurable:!0}};return i.prototype.flatten=function(){return this.values},i.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new i(this.values.slice(e,n))},i.prototype.getInner=function(e){return this.values[e]},i.prototype.forEachInner=function(e,i,n,r){for(var s=i;s<n;s++)if(!1===e(this.values[s],r+s))return!1},i.prototype.forEachInvertedInner=function(e,i,n,r){for(var s=i-1;s>=n;s--)if(!1===e(this.values[s],r+s))return!1},i.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new i(this.values.concat(e.flatten()))},i.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new i(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(i.prototype,n),i}(AQ);AQ.empty=new A0([]);var A1=function(e){function i(i,n){e.call(this),this.left=i,this.right=n,this.length=i.length+n.length,this.depth=Math.max(i.depth,n.depth)+1}return i.__proto__=e,i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i,i.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},i.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},i.prototype.forEachInner=function(e,i,n,r){var s=this.left.length;if(i<s&&!1===this.left.forEachInner(e,i,Math.min(n,s),r)||n>s&&!1===this.right.forEachInner(e,Math.max(i-s,0),Math.min(this.length,n)-s,r+s))return!1},i.prototype.forEachInvertedInner=function(e,i,n,r){var s=this.left.length;if(i>s&&!1===this.right.forEachInvertedInner(e,i-s,Math.max(n,s)-s,r+s)||n<s&&!1===this.left.forEachInvertedInner(e,Math.min(i,s),n,r))return!1},i.prototype.sliceInner=function(e,i){if(0==e&&i==this.length)return this;var n=this.left.length;return i<=n?this.left.slice(e,i):e>=n?this.right.slice(e-n,i-n):this.left.slice(e,n).append(this.right.slice(0,i-n))},i.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new i(this.left,n)},i.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new i(n,this.right)},i.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new i(this.left,new i(this.right,e)):new i(this,e)},i}(AQ);class A2{constructor(e,i){this.items=e,this.eventCount=i}popEvent(e,i){let n,r,s,o;if(0==this.eventCount)return null;let a=this.items.length;for(;;a--)if(this.items.get(a-1).selection){--a;break}i&&(r=(n=this.remapping(a,this.items.length)).maps.length);let l=e.tr,c=[],d=[];return this.items.forEach((e,i)=>{if(!e.step){n||(r=(n=this.remapping(a,i+1)).maps.length),r--,d.push(e);return}if(n){d.push(new A5(e.map));let i=e.step.map(n.slice(r)),s;i&&l.maybeStep(i).doc&&(s=l.mapping.maps[l.mapping.maps.length-1],c.push(new A5(s,void 0,void 0,c.length+d.length))),r--,s&&n.appendMap(s,r)}else l.maybeStep(e.step);if(e.selection)return s=n?e.selection.map(n.slice(r)):e.selection,o=new A2(this.items.slice(0,a).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:l,selection:s}}addTransform(e,i,n,r){var s,o;let a,l=[],c=this.eventCount,d=this.items,h=!r&&d.length?d.get(d.length-1):null;for(let n=0;n<e.steps.length;n++){let s=e.steps[n].invert(e.docs[n]),o=new A5(e.mapping.maps[n],s,i),a;(a=h&&h.merge(o))&&(o=a,n?l.pop():d=d.slice(0,d.length-1)),l.push(o),i&&(c++,i=void 0),r||(h=o)}let u=c-n.depth;return u>A4&&(s=d,o=u,s.forEach((e,i)=>{if(e.selection&&0==o--)return a=i,!1}),d=s.slice(a),c-=u),new A2(d.append(l),c)}remapping(e,i){let n=new ko;return this.items.forEach((i,r)=>{let s=null!=i.mirrorOffset&&r-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,s)},e,i),n}addMaps(e){return 0==this.eventCount?this:new A2(this.items.append(e.map(e=>new A5(e))),this.eventCount)}rebased(e,i){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-i),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(e=>{e.selection&&a--},r);let l=i;this.items.forEach(i=>{let r=s.getMirror(--l);if(null==r)return;o=Math.min(o,r);let c=s.maps[r];if(i.step){let o=e.steps[r].invert(e.docs[r]),d=i.selection&&i.selection.map(s.slice(l+1,r));d&&a++,n.push(new A5(c,o,d))}else n.push(new A5(c))},r);let c=[];for(let e=i;e<o;e++)c.push(new A5(s.maps[e]));let d=new A2(this.items.slice(0,r).append(c).append(n),a);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(i=>{!i.step&&e++}),e}compress(e=this.items.length){let i=this.remapping(0,e),n=i.maps.length,r=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)r.push(o),o.selection&&s++;else if(o.step){let e=o.step.map(i.slice(n)),a=e&&e.getMap();if(n--,a&&i.appendMap(a,n),e){let l=o.selection&&o.selection.map(i.slice(n));l&&s++;let c=new A5(a.invert(),e,l),d,h=r.length-1;(d=r.length&&r[h].merge(c))?r[h]=d:r.push(c)}}else o.map&&n--},this.items.length,0),new A2(AQ.from(r.reverse()),s)}}A2.empty=new A2(AQ.empty,0);class A5{constructor(e,i,n,r){this.map=e,this.step=i,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let i=e.step.merge(this.step);if(i)return new A5(i.getMap().invert(),i,this.selection)}}}class A3{constructor(e,i,n,r,s){this.done=e,this.undone=i,this.prevRanges=n,this.prevTime=r,this.prevComposition=s}}let A4=20;function A6(e){let i=[];for(let n=e.length-1;n>=0&&0==i.length;n--)e[n].forEach((e,n,r,s)=>i.push(r,s));return i}function A8(e,i){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let s=i.map(e[r],1),o=i.map(e[r+1],-1);s<=o&&n.push(s,o)}return n}let A9=!1,A7=null;function Le(e){let i=e.plugins;if(A7!=i){A9=!1,A7=i;for(let e=0;e<i.length;e++)if(i[e].spec.historyPreserveItems){A9=!0;break}}return A9}let Lt=new k7("history"),Li=new k7("closeHistory");function Ln(e,i){return(n,r)=>{let s=Lt.getState(n);if(!s||0==(e?s.undone:s.done).eventCount)return!1;if(r){let o=function(e,i,n){let r=Le(i),s=Lt.get(i).spec.config,o=(n?e.undone:e.done).popEvent(i,r);if(!o)return null;let a=o.selection.resolve(o.transform.doc),l=(n?e.done:e.undone).addTransform(o.transform,i.selection.getBookmark(),s,r),c=new A3(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(a).setMeta(Lt,{redo:n,historyState:c})}(s,n,e);o&&r(i?o.scrollIntoView():o)}return!0}}let Lr=Ln(!1,!0),Ls=Ln(!0,!0);Ln(!1,!1),Ln(!0,!1),Mo.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let i=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=i.textBetween(0,i.content.size,void 0," ");return this.options.textCounter(e)}return i.nodeSize},this.storage.words=e=>{let i=(null==e?void 0:e.node)||this.editor.state.doc,n=i.textBetween(0,i.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new k6({key:new k7("characterCount"),appendTransaction:(i,n,r)=>{if(e)return;let s=this.options.limit;if(null==s||0===s){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>s){console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);let i=r.tr.deleteRange(0,o-s);return e=!0,i}e=!0},filterTransaction:(e,i)=>{let n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;let r=this.storage.characters({node:i.doc}),s=this.storage.characters({node:e.doc});if(s<=n||r>n&&s>n&&s<=r)return!0;if(r>n&&s>n&&s>r||!e.getMeta("paste"))return!1;let o=e.selection.$head.pos;return e.deleteRange(o-(s-n),o),!(this.storage.characters({node:e.doc})>n)}})]}});var Lo=Mo.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new k6({view:i=>new AU(i,e)})}(this.options)]}});Mo.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new k6({key:new k7("focus"),props:{decorations:({doc:e,selection:i})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:s}=i,o=[];if(!n||!r)return EN.create(e,[]);let a=0;"deepest"===this.options.mode&&e.descendants((e,i)=>{if(!e.isText){if(!(s>=i&&s<=i+e.nodeSize-1))return!1;a+=1}});let l=0;return e.descendants((e,i)=>!e.isText&&!!(s>=i&&s<=i+e.nodeSize-1)&&((l+=1,"deepest"===this.options.mode&&a-l>0||"shallowest"===this.options.mode&&l>1)?"deepest"===this.options.mode:void o.push(ET.node(i,i+e.nodeSize,{class:this.options.className})))),EN.create(e,o)}}})]}});var La=Mo.create({name:"gapCursor",addProseMirrorPlugins:()=>[new k6({props:{decorations:AZ,createSelectionBetween:(e,i,n)=>i.pos==n.pos&&AV.valid(n)?new AV(n):null,handleClick:AJ,handleKeyDown:AY,handleDOMEvents:{beforeinput:AG}}})],extendNodeSchema(e){var i;let n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(i=Nu(Nl(e,"allowGapCursor",n)))?i:null}}}),Ll="placeholder",Lc=Mo.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Ll,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${this.options.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${Ll}`;return[new k6({key:new k7("placeholder"),props:{decorations:({doc:i,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=n,o=[];if(!r)return null;let a=this.editor.isEmpty;return i.descendants((i,n)=>{let r=s>=n&&s<=n+i.nodeSize,l=!i.isLeaf&&NA(i);if(!i.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&l){let s=[this.options.emptyNodeClass];a&&s.push(this.options.emptyEditorClass);let l=ET.node(n,n+i.nodeSize,{class:s.join(" "),[e]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:i,pos:n,hasAnchor:r}):this.options.placeholder});o.push(l)}return this.options.includeChildren}),EN.create(i,o)}}})]}});function Ld({types:e,node:i}){return i&&Array.isArray(e)&&e.includes(i.type)||(null==i?void 0:i.type)===e}Mo.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:i}=this;return[new k6({key:new k7("selection"),props:{decorations:n=>n.selection.empty||e.isFocused||!e.isEditable||NL(n.selection)||e.view.dragging?null:EN.create(n.doc,[ET.inline(n.selection.from,n.selection.to,{class:i.className})])}})]}});var Lh=Mo.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let i=new k7(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new k6({key:i,appendTransaction:(e,r,s)=>{let{doc:o,tr:a,schema:l}=s,c=i.getState(s),d=o.content.size,h=l.nodes[n];if(!e.some(e=>e.getMeta("skipTrailingNode"))&&c)return a.insert(d,h.create())},state:{init:(e,i)=>!Ld({node:i.tr.doc.lastChild,types:r}),apply:(e,i)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?i:!Ld({node:e.doc.lastChild,types:r})}})]}}),Lu=Mo.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:i})=>Lr(e,i),redo:()=>({state:e,dispatch:i})=>Ls(e,i)}),addProseMirrorPlugins(){return[function(e={}){return new k6({key:Lt,state:{init:()=>new A3(A2.empty,A2.empty,null,0,-1),apply:(i,n,r)=>(function(e,i,n,r){let s=n.getMeta(Lt),o;if(s)return s.historyState;n.getMeta(Li)&&(e=new A3(e.done,e.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(a&&a.getMeta(Lt))if(a.getMeta(Lt).redo)return new A3(e.done.addTransform(n,void 0,r,Le(i)),e.undone,A6(n.mapping.maps),e.prevTime,e.prevComposition);else return new A3(e.done,e.undone.addTransform(n,void 0,r,Le(i)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))if(o=n.getMeta("rebased"))return new A3(e.done.rebased(n,o),e.undone.rebased(n,o),A8(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new A3(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),A8(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let s=n.getMeta("composition"),o=0==e.prevTime||!a&&e.prevComposition!=s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,i){if(!i)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let s=0;s<i.length;s+=2)e<=i[s+1]&&r>=i[s]&&(n=!0)}),n}(n,e.prevRanges)),l=a?A8(e.prevRanges,n.mapping):A6(n.mapping.maps);return new A3(e.done.addTransform(n,o?i.selection.getBookmark():void 0,r,Le(i)),A2.empty,l,n.time,null==s?e.prevComposition:s)}})(n,r,i,e)},config:e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},props:{handleDOMEvents:{beforeinput(e,i){let n=i.inputType,r="historyUndo"==n?Lr:"historyRedo"==n?Ls:null;return!!r&&!!e.editable&&(i.preventDefault(),r(e.state,e.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Lp=Mo.create({name:"starterKit",addExtensions(){var e,i,n,r;let s=[];return!1!==this.options.bold&&s.push(OE.configure(this.options.bold)),!1!==this.options.blockquote&&s.push(Ow.configure(this.options.blockquote)),!1!==this.options.bulletList&&s.push(Ap.configure(this.options.bulletList)),!1!==this.options.code&&s.push(OM.configure(this.options.code)),!1!==this.options.codeBlock&&s.push(OA.configure(this.options.codeBlock)),!1!==this.options.document&&s.push(OL.configure(this.options.document)),!1!==this.options.dropcursor&&s.push(Lo.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&s.push(La.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&s.push(Oj.configure(this.options.hardBreak)),!1!==this.options.heading&&s.push(OI.configure(this.options.heading)),!1!==this.options.undoRedo&&s.push(Lu.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&s.push(OP.configure(this.options.horizontalRule)),!1!==this.options.italic&&s.push(OW.configure(this.options.italic)),!1!==this.options.listItem&&s.push(Af.configure(this.options.listItem)),!1!==this.options.listKeymap&&s.push(AD.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&s.push(Ac.configure(null==(i=this.options)?void 0:i.link)),!1!==this.options.orderedList&&s.push(AA.configure(this.options.orderedList)),!1!==this.options.paragraph&&s.push(AB.configure(this.options.paragraph)),!1!==this.options.strike&&s.push(AH.configure(this.options.strike)),!1!==this.options.text&&s.push(AW.configure(this.options.text)),!1!==this.options.underline&&s.push(A$.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&s.push(Lh.configure(null==(r=this.options)?void 0:r.trailingNode)),s}});function Lf(e){var i;let{char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:a,$position:l}=e,c=r&&!s,d=n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),h=RegExp(`\\s${d}$`),u=a?"^":"",p=s?"":d,f=c?RegExp(`${u}${d}.*?(?=\\s${p}|$)`,"gm"):RegExp(`${u}(?:^)?${d}[^\\s${p}]*`,"gm"),m=(null==(i=l.nodeBefore)?void 0:i.isText)&&l.nodeBefore.text;if(!m)return null;let g=l.pos-m.length,v=Array.from(m.matchAll(f)).pop();if(!v||void 0===v.input||void 0===v.index)return null;let y=v.input.slice(Math.max(0,v.index-1),v.index),_=RegExp(`^[${null==o?void 0:o.join("")}\0]?$`).test(y);if(null!==o&&!_)return null;let b=g+v.index,w=b+v[0].length;return(c&&h.test(m.slice(w-1,w+1))&&(v[0]+=" ",w+=1),b<l.pos&&w>=l.pos)?{range:{from:b,to:w},query:v[0].slice(n.length),text:v[0]}:null}var Lm=new k7("suggestion");function Lg({pluginKey:e=Lm,editor:i,char:n="@",allowSpaces:r=!1,allowToIncludeChar:s=!1,allowedPrefixes:o=[" "],startOfLine:a=!1,decorationTag:l="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:h="is-empty",command:u=()=>null,items:p=()=>[],render:f=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=Lf,shouldShow:v,shouldResetDismissed:y}){let _,b=null==f?void 0:f(),w=r&&!s,S=()=>{let e=i.state.selection.$anchor.pos,{top:n,right:r,bottom:s,left:o}=i.view.coordsAtPos(e);try{return new DOMRect(o,n,r-o,s-n)}catch{return null}},k=(n,r)=>r?()=>{let r=e.getState(i.state),s=null==r?void 0:r.decorationId,o=n.dom.querySelector(`[data-decoration-id="${s}"]`);return(null==o?void 0:o.getBoundingClientRect())||null}:S,C=new k6({key:e,view(){return{update:async(e,n)=>{var r,s,o,a,l,c,d;let h=null==(r=this.key)?void 0:r.getState(n),f=null==(s=this.key)?void 0:s.getState(e.state),m=h.active&&f.active&&h.range.from!==f.range.from,g=!h.active&&f.active,v=h.active&&!f.active,y=!g&&!v&&h.query!==f.query,w=g||m&&y,S=y||m,C=v||m&&y;if(!w&&!S&&!C)return;let T=C&&!w?h:f,E=e.dom.querySelector(`[data-decoration-id="${T.decorationId}"]`);_={editor:i,range:T.range,query:T.query,text:T.text,items:[],command:e=>u({editor:i,range:T.range,props:e}),decorationNode:E,clientRect:k(e,E)},w&&(null==(o=null==b?void 0:b.onBeforeStart)||o.call(b,_)),S&&(null==(a=null==b?void 0:b.onBeforeUpdate)||a.call(b,_)),(S||w)&&(_.items=await p({editor:i,query:T.query})),C&&(null==(l=null==b?void 0:b.onExit)||l.call(b,_)),S&&(null==(c=null==b?void 0:b.onUpdate)||c.call(b,_)),w&&(null==(d=null==b?void 0:b.onStart)||d.call(b,_))},destroy:()=>{var e;_&&(null==(e=null==b?void 0:b.onExit)||e.call(b,_))}}},state:{init:()=>({active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}),apply(l,c,d,h){let{isEditable:u}=i,{composing:p}=i.view,{selection:f}=l,{empty:_,from:b}=f,S={...c},k=l.getMeta(e);if(k&&k.exit)return S.active=!1,S.decorationId=null,S.range={from:0,to:0},S.query=null,S.text=null,S.dismissedRange=c.active?{...c.range}:c.dismissedRange,S;if(S.composing=p,l.docChanged&&null!==S.dismissedRange&&(S.dismissedRange={from:l.mapping.map(S.dismissedRange.from),to:l.mapping.map(S.dismissedRange.to)}),u&&(_||i.view.composing)){(b<c.range.from||b>c.range.to)&&!p&&!c.composing&&(S.active=!1);let e=g({char:n,allowSpaces:r,allowToIncludeChar:s,allowedPrefixes:o,startOfLine:a,$position:f.$from}),d=`id_${Math.floor(0xffffffff*Math.random())}`;e&&m({editor:i,state:h,range:e.range,isActive:c.active})&&(!v||v({editor:i,range:e.range,query:e.query,text:e.text,transaction:l}))?(null===S.dismissedRange||(({match:e,dismissedRange:n,state:r,transaction:s})=>(null==y?!void 0:!y({editor:i,state:r,range:n,match:e,transaction:s,allowSpaces:w}))&&(w?e.range.from===n.from:e.range.from===n.from&&!(s.docChanged&&s.steps.some(e=>{let i=e.slice;if(!(null==i?void 0:i.content))return!1;let n=i.content.textBetween(0,i.content.size,"\n");return/\s/.test(n)}))))({match:e,dismissedRange:S.dismissedRange,state:h,transaction:l})||(S.dismissedRange=null),null===S.dismissedRange?(S.active=!0,S.decorationId=c.decorationId?c.decorationId:d,S.range=e.range,S.query=e.query,S.text=e.text):S.active=!1):(e||(S.dismissedRange=null),S.active=!1)}else S.active=!1;return S.active||(S.decorationId=null,S.range={from:0,to:0},S.query=null,S.text=null),S}},props:{handleKeyDown(n,r){var s,o;let{active:a,range:l}=C.getState(n.state);if(!a)return!1;if("Escape"===r.key||"Esc"===r.key){let o=C.getState(n.state);return null==(s=null==b?void 0:b.onKeyDown)||s.call(b,{view:n,event:r,range:o.range}),!function(n,r){var s;try{let r=e.getState(n.state),o=(null==r?void 0:r.decorationId)?n.dom.querySelector(`[data-decoration-id="${r.decorationId}"]`):null,a={editor:i,range:(null==r?void 0:r.range)||{from:0,to:0},query:(null==r?void 0:r.query)||null,text:(null==r?void 0:r.text)||null,items:[],command:e=>u({editor:i,range:(null==r?void 0:r.range)||{from:0,to:0},props:e}),decorationNode:o,clientRect:k(n,o)};null==(s=null==b?void 0:b.onExit)||s.call(b,a)}catch{}let o=n.state.tr.setMeta(r,{exit:!0});n.dispatch(o)}(n,e),!0}return(null==(o=null==b?void 0:b.onKeyDown)?void 0:o.call(b,{view:n,event:r,range:l}))||!1},decorations(e){let{active:i,range:n,decorationId:r,query:s}=C.getState(e);if(!i)return null;let o=!(null==s?void 0:s.length),a=[c];return o&&a.push(h),EN.create(e.doc,[ET.inline(n.from,n.to,{nodeName:l,class:a.join(" "),"data-decoration-id":r,"data-decoration-content":d})])}}});return C}function Lv(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(i=>(function({editor:e,overrideSuggestionOptions:i,extensionName:n,char:r="@"}){return{editor:e,char:r,pluginKey:new k7,command:({editor:e,range:i,props:s})=>{var o,a,l;let c=e.view.state.selection.$to.nodeAfter;(null==(o=null==c?void 0:c.text)?void 0:o.startsWith(" "))&&(i.to+=1),e.chain().focus().insertContentAt(i,[{type:n,attrs:{...s,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),null==(l=null==(a=e.view.dom.ownerDocument.defaultView)?void 0:a.getSelection())||l.collapseToEnd()},allow:({state:e,range:i})=>{let r=e.doc.resolve(i.from),s=e.schema.nodes[n];return!!r.parent.type.contentMatch.matchType(s)},...i}})({editor:e.editor,overrideSuggestionOptions:i,extensionName:e.name,char:i.char}))}function Ly(e,i){let n=Lv(e),r=n.find(e=>e.char===i);return r||(n.length?n[0]:null)}var L_=MA.create({name:"mention",priority:101,addOptions:()=>({HTMLAttributes:{},renderText({node:e,suggestion:i}){var n,r;return`${null!=(n=null==i?void 0:i.char)?n:"@"}${null!=(r=e.attrs.label)?r:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:i,suggestion:n}){var r,s;return["span",Ng(this.HTMLAttributes,e.HTMLAttributes),`${null!=(r=null==n?void 0:n.char)?r:"@"}${null!=(s=i.attrs.label)?s:i.attrs.id}`]},suggestions:[],suggestion:{}}),group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes:()=>({id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}),parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:i}){let n=Ly(this,e.attrs.mentionSuggestionChar);if(void 0!==this.options.renderLabel)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ng({"data-type":this.name},this.options.HTMLAttributes,i),this.options.renderLabel({options:this.options,node:e,suggestion:n})];let r={...this.options};r.HTMLAttributes=Ng({"data-type":this.name},this.options.HTMLAttributes,i);let s=this.options.renderHTML({options:r,node:e,suggestion:n});return"string"==typeof s?["span",Ng({"data-type":this.name},this.options.HTMLAttributes,i),s]:s},...MM({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:e=>{let i={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,s,o,a]=r,l=null!=o?o:a;i["char"===s?"mentionSuggestionChar":s]=l,r=n.exec(e)}return i},serializeAttributes:e=>Object.entries(e).filter(([,e])=>null!=e).map(([e,i])=>`${"mentionSuggestionChar"===e?"char":e}="${i}"`).join(" ")}),renderText({node:e}){let i={options:this.options,node:e,suggestion:Ly(this,e.attrs.mentionSuggestionChar)};return void 0!==this.options.renderLabel?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(i)):this.options.renderText(i)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:i})=>{let n=!1,{selection:r}=i,{empty:s,anchor:o}=r;if(!s)return!1;let a=new SP,l=0;return i.doc.nodesBetween(o-1,o,(e,i)=>{if(e.type.name===this.name)return n=!0,a=e,l=i,!1}),n&&e.insertText(this.options.deleteTriggerWithBackspace?"":a.attrs.mentionSuggestionChar,l,l+a.nodeSize),n})}},addProseMirrorPlugins(){return Lv(this).map(Lg)}}),Lx=e.i(898822);let Lb=(0,nP.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),Lw=(0,nP.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);function LS({editor:e,canSubmit:i,onSubmit:n,onStop:r,isProcessing:s=!1,actions:o,className:a,dropzoneProps:l,hiddenInput:c,replyLabel:d,onCancelReply:h}){return(0,iM.jsx)("div",{className:a,children:(0,iM.jsxs)("div",{className:"bg-background border border-border rounded-2xl overflow-hidden",...l,children:[c,d?(0,iM.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b px-3 py-1.5 text-xs text-muted-foreground",children:[(0,iM.jsxs)("span",{className:"min-w-0 truncate",children:["回复给 ",d]}),(0,iM.jsx)("button",{type:"button",onClick:h,className:"inline-flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted hover:text-foreground",title:"取消回复",children:(0,iM.jsx)(sg.X,{className:"size-3"})})]}):null,(0,iM.jsx)("div",{className:"px-3 pt-3 pb-2",children:(0,iM.jsx)(Or,{editor:e})}),(0,iM.jsxs)("div",{className:"flex items-center justify-between px-2 pb-2",children:[(0,iM.jsx)("div",{className:"flex items-center gap-1",children:o}),s?(0,iM.jsx)(f7.Button,{onClick:r,className:"size-7 p-0 rounded-full bg-destructive hover:bg-destructive/90 text-destructive-foreground",children:(0,iM.jsx)(Lw,{className:"size-3",fill:"currentColor"})}):i?(0,iM.jsx)(f7.Button,{onClick:n,className:"size-7 p-0 rounded-full bg-primary",children:(0,iM.jsx)(Lb,{className:"size-3"})}):null]})]})})}function Lk(e){if(null==e)return window;if("[object Window]"!==e.toString()){var i=e.ownerDocument;return i&&i.defaultView||window}return e}function LC(e){var i=Lk(e).Element;return e instanceof i||e instanceof Element}function LT(e){var i=Lk(e).HTMLElement;return e instanceof i||e instanceof HTMLElement}function LE(e){if("u"<typeof ShadowRoot)return!1;var i=Lk(e).ShadowRoot;return e instanceof i||e instanceof ShadowRoot}var LD=Math.max,LN=Math.min,LM=Math.round;function LO(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function LR(){return!/^((?!chrome|android).)*safari/i.test(LO())}function LA(e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1);var r=e.getBoundingClientRect(),s=1,o=1;i&&LT(e)&&(s=e.offsetWidth>0&&LM(r.width)/e.offsetWidth||1,o=e.offsetHeight>0&&LM(r.height)/e.offsetHeight||1);var a=(LC(e)?Lk(e):window).visualViewport,l=!LR()&&n,c=(r.left+(l&&a?a.offsetLeft:0))/s,d=(r.top+(l&&a?a.offsetTop:0))/o,h=r.width/s,u=r.height/o;return{width:h,height:u,top:d,right:c+h,bottom:d+u,left:c,x:c,y:d}}function LL(e){var i=Lk(e);return{scrollLeft:i.pageXOffset,scrollTop:i.pageYOffset}}function Lj(e){return e?(e.nodeName||"").toLowerCase():null}function LI(e){return((LC(e)?e.ownerDocument:e.document)||window.document).documentElement}function LP(e){return LA(LI(e)).left+LL(e).scrollLeft}function LB(e){return Lk(e).getComputedStyle(e)}function Lz(e){var i=LB(e),n=i.overflow,r=i.overflowX,s=i.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+r)}function LF(e){var i=LA(e),n=e.offsetWidth,r=e.offsetHeight;return 1>=Math.abs(i.width-n)&&(n=i.width),1>=Math.abs(i.height-r)&&(r=i.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function LH(e){return"html"===Lj(e)?e:e.assignedSlot||e.parentNode||(LE(e)?e.host:null)||LI(e)}function LW(e,i){void 0===i&&(i=[]);var n,r=function e(i){return["html","body","#document"].indexOf(Lj(i))>=0?i.ownerDocument.body:LT(i)&&Lz(i)?i:e(LH(i))}(e),s=r===(null==(n=e.ownerDocument)?void 0:n.body),o=Lk(r),a=s?[o].concat(o.visualViewport||[],Lz(r)?r:[]):r,l=i.concat(a);return s?l:l.concat(LW(LH(a)))}function L$(e){return LT(e)&&"fixed"!==LB(e).position?e.offsetParent:null}function LU(e){for(var i=Lk(e),n=L$(e);n&&["table","td","th"].indexOf(Lj(n))>=0&&"static"===LB(n).position;)n=L$(n);return n&&("html"===Lj(n)||"body"===Lj(n)&&"static"===LB(n).position)?i:n||function(e){var i=/firefox/i.test(LO());if(/Trident/i.test(LO())&&LT(e)&&"fixed"===LB(e).position)return null;var n=LH(e);for(LE(n)&&(n=n.host);LT(n)&&0>["html","body"].indexOf(Lj(n));){var r=LB(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||i&&"filter"===r.willChange||i&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||i}var LV="bottom",Lq="right",LK="left",LY="auto",LX=["top",LV,Lq,LK],LJ="start",LG="viewport",LZ="popper",LQ=LX.reduce(function(e,i){return e.concat([i+"-"+LJ,i+"-end"])},[]),L0=[].concat(LX,[LY]).reduce(function(e,i){return e.concat([i,i+"-"+LJ,i+"-end"])},[]),L1=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function L2(e,i){var n=i.getRootNode&&i.getRootNode();if(e.contains(i))return!0;if(n&&LE(n)){var r=i;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function L5(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function L3(e,i,n){var r,s,o,a,l,c,d,h,u,p;return i===LG?L5(function(e,i){var n=Lk(e),r=LI(e),s=n.visualViewport,o=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){o=s.width,a=s.height;var d=LR();(d||!d&&"fixed"===i)&&(l=s.offsetLeft,c=s.offsetTop)}return{width:o,height:a,x:l+LP(e),y:c}}(e,n)):LC(i)?((r=LA(i,!1,"fixed"===n)).top=r.top+i.clientTop,r.left=r.left+i.clientLeft,r.bottom=r.top+i.clientHeight,r.right=r.left+i.clientWidth,r.width=i.clientWidth,r.height=i.clientHeight,r.x=r.left,r.y=r.top,r):L5((s=LI(e),a=LI(s),l=LL(s),c=null==(o=s.ownerDocument)?void 0:o.body,d=LD(a.scrollWidth,a.clientWidth,c?c.scrollWidth:0,c?c.clientWidth:0),h=LD(a.scrollHeight,a.clientHeight,c?c.scrollHeight:0,c?c.clientHeight:0),u=-l.scrollLeft+LP(s),p=-l.scrollTop,"rtl"===LB(c||a).direction&&(u+=LD(a.clientWidth,c?c.clientWidth:0)-d),{width:d,height:h,x:u,y:p}))}function L4(e){return e.split("-")[0]}function L6(e){return e.split("-")[1]}function L8(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function L9(e){var i,n=e.reference,r=e.element,s=e.placement,o=s?L4(s):null,a=s?L6(s):null,l=n.x+n.width/2-r.width/2,c=n.y+n.height/2-r.height/2;switch(o){case"top":i={x:l,y:n.y-r.height};break;case LV:i={x:l,y:n.y+n.height};break;case Lq:i={x:n.x+n.width,y:c};break;case LK:i={x:n.x-r.width,y:c};break;default:i={x:n.x,y:n.y}}var d=o?L8(o):null;if(null!=d){var h="y"===d?"height":"width";switch(a){case LJ:i[d]=i[d]-(n[h]/2-r[h]/2);break;case"end":i[d]=i[d]+(n[h]/2-r[h]/2)}}return i}function L7(){return{top:0,right:0,bottom:0,left:0}}function je(e){return Object.assign({},L7(),e)}function jt(e,i){return i.reduce(function(i,n){return i[n]=e,i},{})}function ji(e,i){void 0===i&&(i={});var n,r,s,o,a,l,c,d,h=i,u=h.placement,p=void 0===u?e.placement:u,f=h.strategy,m=void 0===f?e.strategy:f,g=h.boundary,v=h.rootBoundary,y=h.elementContext,_=void 0===y?LZ:y,b=h.altBoundary,w=h.padding,S=void 0===w?0:w,k=je("number"!=typeof S?S:jt(S,LX)),C=e.rects.popper,T=e.elements[void 0!==b&&b?_===LZ?"reference":LZ:_],E=(n=LC(T)?T:T.contextElement||LI(e.elements.popper),r=void 0===g?"clippingParents":g,s=void 0===v?LG:v,c=(l=[].concat("clippingParents"===r?(o=LW(LH(n)),!LC(a=["absolute","fixed"].indexOf(LB(n).position)>=0&&LT(n)?LU(n):n)?[]:o.filter(function(e){return LC(e)&&L2(e,a)&&"body"!==Lj(e)})):[].concat(r),[s]))[0],(d=l.reduce(function(e,i){var r=L3(n,i,m);return e.top=LD(r.top,e.top),e.right=LN(r.right,e.right),e.bottom=LN(r.bottom,e.bottom),e.left=LD(r.left,e.left),e},L3(n,c,m))).width=d.right-d.left,d.height=d.bottom-d.top,d.x=d.left,d.y=d.top,d),D=LA(e.elements.reference),N=L9({reference:D,element:C,strategy:"absolute",placement:p}),M=L5(Object.assign({},C,N)),O=_===LZ?M:D,R={top:E.top-O.top+k.top,bottom:O.bottom-E.bottom+k.bottom,left:E.left-O.left+k.left,right:O.right-E.right+k.right},A=e.modifiersData.offset;if(_===LZ&&A){var L=A[p];Object.keys(R).forEach(function(e){var i=[Lq,LV].indexOf(e)>=0?1:-1,n=["top",LV].indexOf(e)>=0?"y":"x";R[e]+=L[n]*i})}return R}var jn={placement:"bottom",modifiers:[],strategy:"absolute"};function jr(){for(var e=arguments.length,i=Array(e),n=0;n<e;n++)i[n]=arguments[n];return!i.some(function(e){return!(e&&"function"==typeof e.getBoundingClientRect)})}var js={passive:!0},jo={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ja(e){var i,n,r,s,o,a,l,c=e.popper,d=e.popperRect,h=e.placement,u=e.variation,p=e.offsets,f=e.position,m=e.gpuAcceleration,g=e.adaptive,v=e.roundOffsets,y=e.isFixed,_=p.x,b=void 0===_?0:_,w=p.y,S=void 0===w?0:w,k="function"==typeof v?v({x:b,y:S}):{x:b,y:S};b=k.x,S=k.y;var C=p.hasOwnProperty("x"),T=p.hasOwnProperty("y"),E=LK,D="top",N=window;if(g){var M=LU(c),O="clientHeight",R="clientWidth";M===Lk(c)&&"static"!==LB(M=LI(c)).position&&"absolute"===f&&(O="scrollHeight",R="scrollWidth"),("top"===h||(h===LK||h===Lq)&&"end"===u)&&(D=LV,S-=(y&&M===N&&N.visualViewport?N.visualViewport.height:M[O])-d.height,S*=m?1:-1),(h===LK||("top"===h||h===LV)&&"end"===u)&&(E=Lq,b-=(y&&M===N&&N.visualViewport?N.visualViewport.width:M[R])-d.width,b*=m?1:-1)}var A=Object.assign({position:f},g&&jo),L=!0===v?(i={x:b,y:S},n=Lk(c),r=i.x,s=i.y,{x:LM(r*(o=n.devicePixelRatio||1))/o||0,y:LM(s*o)/o||0}):{x:b,y:S};return(b=L.x,S=L.y,m)?Object.assign({},A,((l={})[D]=T?"0":"",l[E]=C?"0":"",l.transform=1>=(N.devicePixelRatio||1)?"translate("+b+"px, "+S+"px)":"translate3d("+b+"px, "+S+"px, 0)",l)):Object.assign({},A,((a={})[D]=T?S+"px":"",a[E]=C?b+"px":"",a.transform="",a))}let jl={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var i=e.state;Object.keys(i.elements).forEach(function(e){var n=i.styles[e]||{},r=i.attributes[e]||{},s=i.elements[e];LT(s)&&Lj(s)&&(Object.assign(s.style,n),Object.keys(r).forEach(function(e){var i=r[e];!1===i?s.removeAttribute(e):s.setAttribute(e,!0===i?"":i)}))})},effect:function(e){var i=e.state,n={popper:{position:i.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(i.elements.popper.style,n.popper),i.styles=n,i.elements.arrow&&Object.assign(i.elements.arrow.style,n.arrow),function(){Object.keys(i.elements).forEach(function(e){var r=i.elements[e],s=i.attributes[e]||{},o=Object.keys(i.styles.hasOwnProperty(e)?i.styles[e]:n[e]).reduce(function(e,i){return e[i]="",e},{});LT(r)&&Lj(r)&&(Object.assign(r.style,o),Object.keys(s).forEach(function(e){r.removeAttribute(e)}))})}},requires:["computeStyles"]};var jc={left:"right",right:"left",bottom:"top",top:"bottom"};function jd(e){return e.replace(/left|right|bottom|top/g,function(e){return jc[e]})}var jh={start:"end",end:"start"};function ju(e){return e.replace(/start|end/g,function(e){return jh[e]})}function jp(e,i,n){return LD(e,LN(i,n))}function jf(e,i,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-i.height-n.y,right:e.right-i.width+n.x,bottom:e.bottom-i.height+n.y,left:e.left-i.width-n.x}}function jm(e){return["top",Lq,LV,LK].some(function(i){return e[i]>=0})}var jg=(I3=void 0===(I5=(I2={defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var i=e.state,n=e.instance,r=e.options,s=r.scroll,o=void 0===s||s,a=r.resize,l=void 0===a||a,c=Lk(i.elements.popper),d=[].concat(i.scrollParents.reference,i.scrollParents.popper);return o&&d.forEach(function(e){e.addEventListener("scroll",n.update,js)}),l&&c.addEventListener("resize",n.update,js),function(){o&&d.forEach(function(e){e.removeEventListener("scroll",n.update,js)}),l&&c.removeEventListener("resize",n.update,js)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var i=e.state,n=e.name;i.modifiersData[n]=L9({reference:i.rects.reference,element:i.rects.popper,strategy:"absolute",placement:i.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var i=e.state,n=e.options,r=n.gpuAcceleration,s=n.adaptive,o=n.roundOffsets,a=void 0===o||o,l={placement:L4(i.placement),variation:L6(i.placement),popper:i.elements.popper,popperRect:i.rects.popper,gpuAcceleration:void 0===r||r,isFixed:"fixed"===i.options.strategy};null!=i.modifiersData.popperOffsets&&(i.styles.popper=Object.assign({},i.styles.popper,ja(Object.assign({},l,{offsets:i.modifiersData.popperOffsets,position:i.options.strategy,adaptive:void 0===s||s,roundOffsets:a})))),null!=i.modifiersData.arrow&&(i.styles.arrow=Object.assign({},i.styles.arrow,ja(Object.assign({},l,{offsets:i.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),i.attributes.popper=Object.assign({},i.attributes.popper,{"data-popper-placement":i.placement})},data:{}},jl,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var i=e.state,n=e.options,r=e.name,s=n.offset,o=void 0===s?[0,0]:s,a=L0.reduce(function(e,n){var r,s,a,l,c,d;return e[n]=(r=i.rects,a=[LK,"top"].indexOf(s=L4(n))>=0?-1:1,c=(l="function"==typeof o?o(Object.assign({},r,{placement:n})):o)[0],d=l[1],c=c||0,d=(d||0)*a,[LK,Lq].indexOf(s)>=0?{x:d,y:c}:{x:c,y:d}),e},{}),l=a[i.placement],c=l.x,d=l.y;null!=i.modifiersData.popperOffsets&&(i.modifiersData.popperOffsets.x+=c,i.modifiersData.popperOffsets.y+=d),i.modifiersData[r]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var i=e.state,n=e.options,r=e.name;if(!i.modifiersData[r]._skip){for(var s=n.mainAxis,o=void 0===s||s,a=n.altAxis,l=void 0===a||a,c=n.fallbackPlacements,d=n.padding,h=n.boundary,u=n.rootBoundary,p=n.altBoundary,f=n.flipVariations,m=void 0===f||f,g=n.allowedAutoPlacements,v=i.options.placement,y=L4(v)===v,_=c||(y||!m?[jd(v)]:function(e){if(L4(e)===LY)return[];var i=jd(e);return[ju(e),i,ju(i)]}(v)),b=[v].concat(_).reduce(function(e,n){var r,s,o,a,l,c,p,f,v,y,_,b;return e.concat(L4(n)===LY?(s=(r={placement:n,boundary:h,rootBoundary:u,padding:d,flipVariations:m,allowedAutoPlacements:g}).placement,o=r.boundary,a=r.rootBoundary,l=r.padding,c=r.flipVariations,f=void 0===(p=r.allowedAutoPlacements)?L0:p,0===(_=(y=(v=L6(s))?c?LQ:LQ.filter(function(e){return L6(e)===v}):LX).filter(function(e){return f.indexOf(e)>=0})).length&&(_=y),Object.keys(b=_.reduce(function(e,n){return e[n]=ji(i,{placement:n,boundary:o,rootBoundary:a,padding:l})[L4(n)],e},{})).sort(function(e,i){return b[e]-b[i]})):n)},[]),w=i.rects.reference,S=i.rects.popper,k=new Map,C=!0,T=b[0],E=0;E<b.length;E++){var D=b[E],N=L4(D),M=L6(D)===LJ,O=["top",LV].indexOf(N)>=0,R=O?"width":"height",A=ji(i,{placement:D,boundary:h,rootBoundary:u,altBoundary:p,padding:d}),L=O?M?Lq:LK:M?LV:"top";w[R]>S[R]&&(L=jd(L));var j=jd(L),I=[];if(o&&I.push(A[N]<=0),l&&I.push(A[L]<=0,A[j]<=0),I.every(function(e){return e})){T=D,C=!1;break}k.set(D,I)}if(C)for(var P=m?3:1,B=function(e){var i=b.find(function(i){var n=k.get(i);if(n)return n.slice(0,e).every(function(e){return e})});if(i)return T=i,"break"},z=P;z>0&&"break"!==B(z);z--);i.placement!==T&&(i.modifiersData[r]._skip=!0,i.placement=T,i.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var i=e.state,n=e.options,r=e.name,s=n.mainAxis,o=n.altAxis,a=n.boundary,l=n.rootBoundary,c=n.altBoundary,d=n.padding,h=n.tether,u=void 0===h||h,p=n.tetherOffset,f=void 0===p?0:p,m=ji(i,{boundary:a,rootBoundary:l,padding:d,altBoundary:c}),g=L4(i.placement),v=L6(i.placement),y=!v,_=L8(g),b="x"===_?"y":"x",w=i.modifiersData.popperOffsets,S=i.rects.reference,k=i.rects.popper,C="function"==typeof f?f(Object.assign({},i.rects,{placement:i.placement})):f,T="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),E=i.modifiersData.offset?i.modifiersData.offset[i.placement]:null,D={x:0,y:0};if(w){if(void 0===s||s){var N,M="y"===_?"top":LK,O="y"===_?LV:Lq,R="y"===_?"height":"width",A=w[_],L=A+m[M],j=A-m[O],I=u?-k[R]/2:0,P=v===LJ?S[R]:k[R],B=v===LJ?-k[R]:-S[R],z=i.elements.arrow,F=u&&z?LF(z):{width:0,height:0},H=i.modifiersData["arrow#persistent"]?i.modifiersData["arrow#persistent"].padding:L7(),W=H[M],$=H[O],U=jp(0,S[R],F[R]),V=y?S[R]/2-I-U-W-T.mainAxis:P-U-W-T.mainAxis,q=y?-S[R]/2+I+U+$+T.mainAxis:B+U+$+T.mainAxis,K=i.elements.arrow&&LU(i.elements.arrow),Y=K?"y"===_?K.clientTop||0:K.clientLeft||0:0,X=null!=(N=null==E?void 0:E[_])?N:0,J=jp(u?LN(L,A+V-X-Y):L,A,u?LD(j,A+q-X):j);w[_]=J,D[_]=J-A}if(void 0!==o&&o){var G,Z,Q="x"===_?"top":LK,ee="x"===_?LV:Lq,et=w[b],ei="y"===b?"height":"width",en=et+m[Q],er=et-m[ee],es=-1!==["top",LK].indexOf(g),eo=null!=(Z=null==E?void 0:E[b])?Z:0,ea=es?en:et-S[ei]-k[ei]-eo+T.altAxis,el=es?et+S[ei]+k[ei]-eo-T.altAxis:er,ec=u&&es?(G=jp(ea,et,el))>el?el:G:jp(u?ea:en,et,u?el:er);w[b]=ec,D[b]=ec-et}i.modifiersData[r]=D}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var i,n=e.state,r=e.name,s=e.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,l=L4(n.placement),c=L8(l),d=[LK,Lq].indexOf(l)>=0?"height":"width";if(o&&a){var h,u=(h=s.padding,je("number"!=typeof(h="function"==typeof h?h(Object.assign({},n.rects,{placement:n.placement})):h)?h:jt(h,LX))),p=LF(o),f="y"===c?"top":LK,m="y"===c?LV:Lq,g=n.rects.reference[d]+n.rects.reference[c]-a[c]-n.rects.popper[d],v=a[c]-n.rects.reference[c],y=LU(o),_=y?"y"===c?y.clientHeight||0:y.clientWidth||0:0,b=u[f],w=_-p[d]-u[m],S=_/2-p[d]/2+(g/2-v/2),k=jp(b,S,w);n.modifiersData[r]=((i={})[c]=k,i.centerOffset=k-S,i)}},effect:function(e){var i=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null==r||("string"!=typeof r||(r=i.elements.popper.querySelector(r)))&&L2(i.elements.popper,r)&&(i.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var i=e.state,n=e.name,r=i.rects.reference,s=i.rects.popper,o=i.modifiersData.preventOverflow,a=ji(i,{elementContext:"reference"}),l=ji(i,{altBoundary:!0}),c=jf(a,r),d=jf(l,s,o),h=jm(c),u=jm(d);i.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:h,hasPopperEscaped:u},i.attributes.popper=Object.assign({},i.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":u})}}]}).defaultModifiers)?[]:I5,I6=void 0===(I4=I2.defaultOptions)?jn:I4,function(e,i,n){void 0===n&&(n=I6);var r,s,o={placement:"bottom",orderedModifiers:[],options:Object.assign({},jn,I6),modifiersData:{},elements:{reference:e,popper:i},attributes:{},styles:{}},a=[],l=!1,c={state:o,setOptions:function(n){var r,s,l,h,u,p,f="function"==typeof n?n(o.options):n;d(),o.options=Object.assign({},I6,o.options,f),o.scrollParents={reference:LC(e)?LW(e):e.contextElement?LW(e.contextElement):[],popper:LW(i)};var m=(s=Object.keys(r=[].concat(I3,o.options.modifiers).reduce(function(e,i){var n=e[i.name];return e[i.name]=n?Object.assign({},n,i,{options:Object.assign({},n.options,i.options),data:Object.assign({},n.data,i.data)}):i,e},{})).map(function(e){return r[e]}),l=new Map,h=new Set,u=[],s.forEach(function(e){l.set(e.name,e)}),s.forEach(function(e){h.has(e.name)||function e(i){h.add(i.name),[].concat(i.requires||[],i.requiresIfExists||[]).forEach(function(i){if(!h.has(i)){var n=l.get(i);n&&e(n)}}),u.push(i)}(e)}),p=u,L1.reduce(function(e,i){return e.concat(p.filter(function(e){return e.phase===i}))},[]));return o.orderedModifiers=m.filter(function(e){return e.enabled}),o.orderedModifiers.forEach(function(e){var i=e.name,n=e.options,r=e.effect;if("function"==typeof r){var s=r({state:o,name:i,instance:c,options:void 0===n?{}:n});a.push(s||function(){})}}),c.update()},forceUpdate:function(){if(!l){var e=o.elements,i=e.reference,n=e.popper;if(jr(i,n)){o.rects={reference:(r=LU(n),s="fixed"===o.options.strategy,a=LT(r),p=LT(r)&&(h=LM((d=r.getBoundingClientRect()).width)/r.offsetWidth||1,u=LM(d.height)/r.offsetHeight||1,1!==h||1!==u),f=LI(r),m=LA(i,p,s),g={scrollLeft:0,scrollTop:0},v={x:0,y:0},(a||!a&&!s)&&(("body"!==Lj(r)||Lz(f))&&(g=function(e){return e!==Lk(e)&&LT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:LL(e)}(r)),LT(r)?(v=LA(r,!0),v.x+=r.clientLeft,v.y+=r.clientTop):f&&(v.x=LP(f))),{x:m.left+g.scrollLeft-v.x,y:m.top+g.scrollTop-v.y,width:m.width,height:m.height}),popper:LF(n)},o.reset=!1,o.placement=o.options.placement,o.orderedModifiers.forEach(function(e){return o.modifiersData[e.name]=Object.assign({},e.data)});for(var r,s,a,d,h,u,p,f,m,g,v,y=0;y<o.orderedModifiers.length;y++){if(!0===o.reset){o.reset=!1,y=-1;continue}var _=o.orderedModifiers[y],b=_.fn,w=_.options,S=void 0===w?{}:w,k=_.name;"function"==typeof b&&(o=b({state:o,options:S,name:k,instance:c})||o)}}}},update:(r=function(){return new Promise(function(e){c.forceUpdate(),e(o)})},function(){return s||(s=new Promise(function(e){Promise.resolve().then(function(){s=void 0,e(r())})})),s}),destroy:function(){d(),l=!0}};if(!jr(e,i))return c;function d(){a.forEach(function(e){return e()}),a=[]}return c.setOptions(n).then(function(e){!l&&n.onFirstUpdate&&n.onFirstUpdate(e)}),c}),jv="tippy-content",jy="tippy-arrow",j_="tippy-svg-arrow",jx={passive:!0,capture:!0},jb=function(){return document.body};function jw(e,i,n){if(Array.isArray(e)){var r=e[i];return null==r?Array.isArray(n)?n[i]:n:r}return e}function jS(e,i){var n=({}).toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(i+"]")>-1}function jk(e,i){return"function"==typeof e?e.apply(void 0,i):e}function jC(e,i){var n;return 0===i?e:function(r){clearTimeout(n),n=setTimeout(function(){e(r)},i)}}function jT(e){return[].concat(e)}function jE(e,i){-1===e.indexOf(i)&&e.push(i)}function jD(e){return[].slice.call(e)}function jN(e){return Object.keys(e).reduce(function(i,n){return void 0!==e[n]&&(i[n]=e[n]),i},{})}function jM(){return document.createElement("div")}function jO(e){return["Element","Fragment"].some(function(i){return jS(e,i)})}function jR(e,i){e.forEach(function(e){e&&(e.style.transitionDuration=i+"ms")})}function jA(e,i){e.forEach(function(e){e&&e.setAttribute("data-state",i)})}function jL(e,i,n){var r=i+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){e[r](i,n)})}function jj(e,i){for(var n,r=i;r;){if(e.contains(r))return!0;r=null==r.getRootNode||null==(n=r.getRootNode())?void 0:n.host}return!1}var jI={isTouch:!1},jP=0;function jB(){!jI.isTouch&&(jI.isTouch=!0,window.performance&&document.addEventListener("mousemove",jz))}function jz(){var e=performance.now();e-jP<20&&(jI.isTouch=!1,document.removeEventListener("mousemove",jz)),jP=e}function jF(){var e=document.activeElement;if(e&&e._tippy&&e._tippy.reference===e){var i=e._tippy;e.blur&&!i.state.isVisible&&e.blur()}}var jH=!!("u">typeof window&&"u">typeof document)&&!!window.msCrypto,jW=Object.assign({appendTo:jb,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),j$=Object.keys(jW);function jU(e){var i=(e.plugins||[]).reduce(function(i,n){var r,s=n.name,o=n.defaultValue;return s&&(i[s]=void 0!==e[s]?e[s]:null!=(r=jW[s])?r:o),i},{});return Object.assign({},e,i)}function jV(e,i){var n,r=Object.assign({},i,{content:jk(i.content,[e])},i.ignoreAttributes?{}:((n=i.plugins)?Object.keys(jU(Object.assign({},jW,{plugins:n}))):j$).reduce(function(i,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return i;if("content"===n)i[n]=r;else try{i[n]=JSON.parse(r)}catch(e){i[n]=r}return i},{}));return r.aria=Object.assign({},jW.aria,r.aria),r.aria={expanded:"auto"===r.aria.expanded?i.interactive:r.aria.expanded,content:"auto"===r.aria.content?i.interactive?null:"describedby":r.aria.content},r}function jq(e,i){e.innerHTML=i}function jK(e){var i=jM();return!0===e?i.className=jy:(i.className=j_,jO(e)?i.appendChild(e):jq(i,e)),i}function jY(e,i){jO(i.content)?(jq(e,""),e.appendChild(i.content)):"function"!=typeof i.content&&(i.allowHTML?jq(e,i.content):e.textContent=i.content)}function jX(e){var i=e.firstElementChild,n=jD(i.children);return{box:i,content:n.find(function(e){return e.classList.contains(jv)}),arrow:n.find(function(e){return e.classList.contains(jy)||e.classList.contains(j_)}),backdrop:n.find(function(e){return e.classList.contains("tippy-backdrop")})}}function jJ(e){var i=jM(),n=jM();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=jM();function s(n,r){var s=jX(i),o=s.box,a=s.content,l=s.arrow;r.theme?o.setAttribute("data-theme",r.theme):o.removeAttribute("data-theme"),"string"==typeof r.animation?o.setAttribute("data-animation",r.animation):o.removeAttribute("data-animation"),r.inertia?o.setAttribute("data-inertia",""):o.removeAttribute("data-inertia"),o.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?o.setAttribute("role",r.role):o.removeAttribute("role"),(n.content!==r.content||n.allowHTML!==r.allowHTML)&&jY(a,e.props),r.arrow?l?n.arrow!==r.arrow&&(o.removeChild(l),o.appendChild(jK(r.arrow))):o.appendChild(jK(r.arrow)):l&&o.removeChild(l)}return r.className=jv,r.setAttribute("data-state","hidden"),jY(r,e.props),i.appendChild(n),n.appendChild(r),s(e.props,e.props),{popper:i,onUpdate:s}}jJ.$$tippy=!0;var jG=1,jZ=[],jQ=[];function j0(e,i){void 0===i&&(i={});var n,r=jW.plugins.concat(i.plugins||[]);document.addEventListener("touchstart",jB,jx),window.addEventListener("blur",jF);var s=Object.assign({},i,{plugins:r}),o=(jO(n=e)?[n]:jS(n,"NodeList")?jD(n):Array.isArray(n)?n:jD(document.querySelectorAll(n))).reduce(function(e,i){var n=i&&function(e,i){var n,r,s,o,a,l,c,d,h=jV(e,Object.assign({},jW,jU(jN(i)))),u=!1,p=!1,f=!1,m=!1,g=[],v=jC(K,h.interactiveDebounce),y=jG++,_=(n=h.plugins).filter(function(e,i){return n.indexOf(e)===i}),b={id:y,reference:e,popper:jM(),popperInstance:null,props:h,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:_,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(s),cancelAnimationFrame(o)},setProps:function(i){if(!b.state.isDestroyed){A("onBeforeUpdate",[b,i]),V();var n=b.props,r=jV(e,Object.assign({},n,jN(i),{ignoreAttributes:!0}));b.props=r,U(),n.interactiveDebounce!==r.interactiveDebounce&&(I(),v=jC(K,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?jT(n.triggerTarget).forEach(function(e){e.removeAttribute("aria-expanded")}):r.triggerTarget&&e.removeAttribute("aria-expanded"),j(),R(),k&&k(n,r),b.popperInstance&&(G(),Q().forEach(function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})),A("onAfterUpdate",[b,i])}},setContent:function(e){b.setProps({content:e})},show:function(){var i=b.state.isVisible,n=b.state.isDestroyed,r=!b.state.isEnabled,s=jI.isTouch&&!b.props.touch,o=jw(b.props.duration,0,jW.duration);if(!(i||n||r||s||(d||e).hasAttribute("disabled"))&&(A("onShow",[b],!1),!1!==b.props.onShow(b))){if(b.state.isVisible=!0,N()&&(S.style.visibility="visible"),R(),F(),b.state.isMounted||(S.style.transition="none"),N()){var a,l,h,u=jX(S);jR([u.box,u.content],0)}c=function(){var e;if(b.state.isVisible&&!m){if(m=!0,S.offsetHeight,S.style.transition=b.props.moveTransition,N()&&b.props.animation){var i=jX(S),n=i.box,r=i.content;jR([n,r],o),jA([n,r],"visible")}L(),j(),jE(jQ,b),null==(e=b.popperInstance)||e.forceUpdate(),A("onMount",[b]),b.props.animation&&N()&&W(o,function(){b.state.isShown=!0,A("onShown",[b])})}},l=b.props.appendTo,h=d||e,(a=b.props.interactive&&l===jb||"parent"===l?h.parentNode:jk(l,[h])).contains(S)||a.appendChild(S),b.state.isMounted=!0,G()}},hide:function(){var e=!b.state.isVisible,i=b.state.isDestroyed,n=!b.state.isEnabled,r=jw(b.props.duration,1,jW.duration);if(!e&&!i&&!n&&(A("onHide",[b],!1),!1!==b.props.onHide(b))){if(b.state.isVisible=!1,b.state.isShown=!1,m=!1,u=!1,N()&&(S.style.visibility="hidden"),I(),H(),R(!0),N()){var s,o=jX(S),a=o.box,l=o.content;b.props.animation&&(jR([a,l],r),jA([a,l],"hidden"))}(L(),j(),b.props.animation)?N()&&(s=b.unmount,W(r,function(){!b.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&s()})):b.unmount()}},hideWithInteractivity:function(e){M().addEventListener("mousemove",v),jE(jZ,v),v(e)},enable:function(){b.state.isEnabled=!0},disable:function(){b.hide(),b.state.isEnabled=!1},unmount:function(){b.state.isVisible&&b.hide(),b.state.isMounted&&(Z(),Q().forEach(function(e){e._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),jQ=jQ.filter(function(e){return e!==b}),b.state.isMounted=!1,A("onHidden",[b]))},destroy:function(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),V(),delete e._tippy,b.state.isDestroyed=!0,A("onDestroy",[b]))}};if(!h.render)return b;var w=h.render(b),S=w.popper,k=w.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+b.id,b.popper=S,e._tippy=b,S._tippy=b;var C=_.map(function(e){return e.fn(b)}),T=e.hasAttribute("aria-expanded");return U(),j(),R(),A("onCreate",[b]),h.showOnCreate&&ee(),S.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),S.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&M().addEventListener("mousemove",v)}),b;function E(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function D(){return"hold"===E()[0]}function N(){var e;return!!(null!=(e=b.props.render)&&e.$$tippy)}function M(){var i,n,r=(d||e).parentNode;return r&&null!=(n=jT(r)[0])&&null!=(i=n.ownerDocument)&&i.body?n.ownerDocument:document}function O(e){return b.state.isMounted&&!b.state.isVisible||jI.isTouch||a&&"focus"===a.type?0:jw(b.props.delay,+!e,jW.delay)}function R(e){void 0===e&&(e=!1),S.style.pointerEvents=b.props.interactive&&!e?"":"none",S.style.zIndex=""+b.props.zIndex}function A(e,i,n){if(void 0===n&&(n=!0),C.forEach(function(n){n[e]&&n[e].apply(n,i)}),n){var r;(r=b.props)[e].apply(r,i)}}function L(){var i=b.props.aria;if(i.content){var n="aria-"+i.content,r=S.id;jT(b.props.triggerTarget||e).forEach(function(e){var i=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,i?i+" "+r:r);else{var s=i&&i.replace(r,"").trim();s?e.setAttribute(n,s):e.removeAttribute(n)}})}}function j(){!T&&b.props.aria.expanded&&jT(b.props.triggerTarget||e).forEach(function(i){b.props.interactive?i.setAttribute("aria-expanded",b.state.isVisible&&i===(d||e)?"true":"false"):i.removeAttribute("aria-expanded")})}function I(){M().removeEventListener("mousemove",v),jZ=jZ.filter(function(e){return e!==v})}function P(i){if(!jI.isTouch||!f&&"mousedown"!==i.type){var n=i.composedPath&&i.composedPath()[0]||i.target;if(!(b.props.interactive&&jj(S,n))){if(jT(b.props.triggerTarget||e).some(function(e){return jj(e,n)})){if(jI.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else A("onClickOutside",[b,i]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),p=!0,setTimeout(function(){p=!1}),b.state.isMounted||H())}}}function B(){f=!0}function z(){f=!1}function F(){var e=M();e.addEventListener("mousedown",P,!0),e.addEventListener("touchend",P,jx),e.addEventListener("touchstart",z,jx),e.addEventListener("touchmove",B,jx)}function H(){var e=M();e.removeEventListener("mousedown",P,!0),e.removeEventListener("touchend",P,jx),e.removeEventListener("touchstart",z,jx),e.removeEventListener("touchmove",B,jx)}function W(e,i){var n=jX(S).box;function r(e){e.target===n&&(jL(n,"remove",r),i())}if(0===e)return i();jL(n,"remove",l),jL(n,"add",r),l=r}function $(i,n,r){void 0===r&&(r=!1),jT(b.props.triggerTarget||e).forEach(function(e){e.addEventListener(i,n,r),g.push({node:e,eventType:i,handler:n,options:r})})}function U(){D()&&($("touchstart",q,{passive:!0}),$("touchend",Y,{passive:!0})),b.props.trigger.split(/\s+/).filter(Boolean).forEach(function(e){if("manual"!==e)switch($(e,q),e){case"mouseenter":$("mouseleave",Y);break;case"focus":$(jH?"focusout":"blur",X);break;case"focusin":$("focusout",X)}})}function V(){g.forEach(function(e){var i=e.node,n=e.eventType,r=e.handler,s=e.options;i.removeEventListener(n,r,s)}),g=[]}function q(e){var i,n=!1;if(!(!b.state.isEnabled||J(e))&&!p){var r=(null==(i=a)?void 0:i.type)==="focus";a=e,d=e.currentTarget,j(),!b.state.isVisible&&jS(e,"MouseEvent")&&jZ.forEach(function(i){return i(e)}),"click"===e.type&&(0>b.props.trigger.indexOf("mouseenter")||u)&&!1!==b.props.hideOnClick&&b.state.isVisible?n=!0:ee(e),"click"===e.type&&(u=!n),n&&!r&&et(e)}}function K(i){var n,r,s,o=i.target,a=(d||e).contains(o)||S.contains(o);("mousemove"!==i.type||!a)&&(n=Q().concat(S).map(function(e){var i,n=null==(i=e._tippy.popperInstance)?void 0:i.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:h}:null}).filter(Boolean),r=i.clientX,s=i.clientY,n.every(function(e){var i=e.popperRect,n=e.popperState,o=e.props.interactiveBorder,a=n.placement.split("-")[0],l=n.modifiersData.offset;if(!l)return!0;var c="bottom"===a?l.top.y:0,d="top"===a?l.bottom.y:0,h="right"===a?l.left.x:0,u="left"===a?l.right.x:0,p=i.top-s+c>o,f=s-i.bottom-d>o,m=i.left-r+h>o,g=r-i.right-u>o;return p||f||m||g})&&(I(),et(i)))}function Y(e){if(!(J(e)||b.props.trigger.indexOf("click")>=0&&u)){if(b.props.interactive)return void b.hideWithInteractivity(e);et(e)}}function X(i){0>b.props.trigger.indexOf("focusin")&&i.target!==(d||e)||b.props.interactive&&i.relatedTarget&&S.contains(i.relatedTarget)||et(i)}function J(e){return!!jI.isTouch&&D()!==e.type.indexOf("touch")>=0}function G(){Z();var i=b.props,n=i.popperOptions,r=i.placement,s=i.offset,o=i.getReferenceClientRect,a=i.moveTransition,l=N()?jX(S).arrow:null,h=o?{getBoundingClientRect:o,contextElement:o.contextElement||d||e}:e,u=[{name:"offset",options:{offset:s}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!a}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var i=e.state;if(N()){var n=jX(S).box;["placement","reference-hidden","escaped"].forEach(function(e){"placement"===e?n.setAttribute("data-placement",i.placement):i.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)}),i.attributes.popper={}}}}];N()&&l&&u.push({name:"arrow",options:{element:l,padding:3}}),u.push.apply(u,(null==n?void 0:n.modifiers)||[]),b.popperInstance=jg(h,S,Object.assign({},n,{placement:r,onFirstUpdate:c,modifiers:u}))}function Z(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Q(){return jD(S.querySelectorAll("[data-tippy-root]"))}function ee(e){b.clearDelayTimeouts(),e&&A("onTrigger",[b,e]),F();var i=O(!0),n=E(),s=n[0],o=n[1];jI.isTouch&&"hold"===s&&o&&(i=o),i?r=setTimeout(function(){b.show()},i):b.show()}function et(e){if(b.clearDelayTimeouts(),A("onUntrigger",[b,e]),!b.state.isVisible)return void H();if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0)||!u){var i=O(!1);i?s=setTimeout(function(){b.state.isVisible&&b.hide()},i):o=requestAnimationFrame(function(){b.hide()})}}}(i,s);return n&&e.push(n),e},[]);return jO(e)?o[0]:o}function j1(e){return e.description??e.email??""}j0.defaultProps=jW,j0.setDefaultProps=function(e){Object.keys(e).forEach(function(i){jW[i]=e[i]})},j0.currentInput=jI,Object.assign({},jl,{effect:function(e){var i=e.state,n={popper:{position:i.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(i.elements.popper.style,n.popper),i.styles=n,i.elements.arrow&&Object.assign(i.elements.arrow.style,n.arrow)}}),j0.setDefaultProps({render:jJ});let j2=(0,iO.forwardRef)(function(e,i){let[n,r]=(0,iO.useState)(0),s=(0,n2.useTranslations)("composer");return((0,iO.useEffect)(()=>{r(0)},[e.items]),(0,iO.useImperativeHandle)(i,()=>({onKeyDown:({event:i})=>{if(!e.items.length)return!1;if("ArrowUp"===i.key)return i.preventDefault(),r(i=>(i+e.items.length-1)%e.items.length),!0;if("ArrowDown"===i.key)return i.preventDefault(),r(i=>(i+1)%e.items.length),!0;if("Enter"===i.key){let r;return i.preventDefault(),(r=e.items[n])&&e.command(r),!0}return!1}}),[e.items,n]),e.items.length)?(0,iM.jsxs)("div",{className:"suggestion-menu",children:[(0,iM.jsx)("div",{className:"suggestion-header",children:s("selectOption")}),(0,iM.jsx)("div",{className:"suggestion-list",children:e.items.map((i,s)=>{let o=s===n;return(0,iM.jsxs)("div",{className:"suggestion-item","data-selected":o?"true":"false",onMouseEnter:()=>r(s),onMouseDown:n=>{n.preventDefault(),e.command(i)},children:[(0,iM.jsx)("div",{className:"suggestion-title",children:i.label??i.name??i.title??i.id}),j1(i)?(0,iM.jsx)("div",{className:"suggestion-desc",children:j1(i)}):null]},i.id)})})]}):(0,iM.jsx)("div",{className:"suggestion-menu",children:(0,iM.jsx)("div",{className:"suggestion-empty",children:s("noMatch")})})});function j5(){let e=null,i=null;return{onStart(n){e=new Og(j2,{props:n,editor:n.editor}),n.clientRect&&(i=j0("body",{getReferenceClientRect:()=>n.clientRect?.()??new DOMRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(n){e?.updateProps(n),i?.[0]&&n.clientRect&&i[0].setProps({getReferenceClientRect:()=>n.clientRect?.()??new DOMRect})},onKeyDown:i=>!!e?.ref&&"object"==typeof e.ref&&"onKeyDown"in e.ref&&e.ref.onKeyDown(i),onExit(){i?.[0]?.destroy(),e?.destroy()}}}let j3=[{id:"heading1",title:"标题 1",description:"切换为一级标题"},{id:"blockquote",title:"引用",description:"切换为引用块"},{id:"divider",title:"分割线",description:"插入一条分割线"},{id:"attach",title:"添加附件",description:"打开文件选择器"}];function j4(e){return Mo.create({name:"slashCommand",addOptions:()=>({suggestion:{char:"/",items:({query:e})=>{let i=e.toLowerCase();return j3.filter(e=>`${e.title} ${e.description}`.toLowerCase().includes(i)).map(e=>({id:e.id,title:e.title,description:e.description}))},command:({editor:i,range:n,props:r})=>{switch(i.chain().focus().deleteRange(n).run(),r.id){case"heading1":i.chain().focus().toggleHeading({level:1}).run();break;case"blockquote":i.chain().focus().toggleBlockquote().run();break;case"divider":i.chain().focus().setHorizontalRule().run();break;case"attach":e?.()}},render:()=>j5()}}),addProseMirrorPlugins(){return[Lg({editor:this.editor,...this.options.suggestion})]}})}var j6=e.i(444433);function j8(e,i){return e.subject||e.title||e.activeForm||e.content||i}let j9=(0,iO.forwardRef)(function({channelName:e,channelId:i,workspaceId:n,channel:r,agents:s,messages:o=[],onSend:a,isProcessing:l=!1,onStop:c,replyTo:d,onCancelReply:h},u){let p=(0,n2.useTranslations)("chat"),[f,m]=(0,iO.useState)(!1),[g,v]=(0,iO.useState)([]),[y,_]=(0,iO.useState)([]),[b,w]=(0,iO.useState)(!1),[S,k]=(0,iO.useState)(!1),C=(0,iO.useRef)(l),T=(0,iO.useRef)(a),E=(0,iO.useRef)(null),D=(0,iO.useRef)(null),N=(0,iO.useRef)(!1),M=(0,iO.useRef)(null),O=(0,iO.useRef)(s),R=(0,iO.useRef)(r),{saveDraft:A,clearDraft:L,updateChannel:j}=(0,mM.useChannelStore)(),I=r.pinnedMentionId,P=I===g[0]&&!!I,B=(0,iO.useMemo)(()=>{if(0===g.length)return[];let e=new Map(s.map(e=>[e.id,e]));return g.map(i=>e.get(i)).filter(e=>!!e)},[s,g])[0],z=function(e){if(!e)return[];let i=e.mcpServers;return!i||"object"!=typeof i||Array.isArray(i)?[]:Object.keys(i)}(B?.mcps),F=B?.skills??[],H=(0,iO.useMemo)(()=>{let e=new Set(B?.tools??[]);return(j6.BUILT_IN_AGENT_TOOLS??[]).filter(i=>e.has(i.name)).map(e=>{var i;return{...e,icon:"CreateCurrentChannelIssue"===(i=e.name)?Sd:"ViewCurrentChannelIssue"===i?Sn:"AddCurrentChannelComment"===i?Ss:Su}})},[B?.tools]),W=(0,iO.useMemo)(()=>{let e=new Map;for(let i of o)i.senderId&&"user"!==i.senderId&&e.set(i.senderId,i.createdAt);return e},[o]),$=(0,iO.useMemo)(()=>{let e=B?.id;return[...s].sort((i,n)=>{if(i.id===e)return -1;if(n.id===e)return 1;let r=W.get(i.id)??"";return(W.get(n.id)??"").localeCompare(r)})},[s,B?.id,W]);(0,iO.useEffect)(()=>{C.current=l},[l]),(0,iO.useEffect)(()=>{T.current=a},[a]),(0,iO.useEffect)(()=>{O.current=s},[s]),(0,iO.useEffect)(()=>{R.current=r},[r]);let U=(0,iO.useCallback)(e=>{D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{e.trim()?A(n,i,e):L(n,i)},1e3)},[n,i,A,L]),V=(0,iO.useCallback)(async()=>{let e=E.current;if(!e||C.current||N.current)return;let r=e.getText().trim();if(!r&&0===y.length)return;let s=Ie(e.getJSON());N.current=!0,w(!0),D.current&&(clearTimeout(D.current),D.current=null);try{let o=await Promise.all(y.map(j7));T.current(r?function(e){if(!e)return e;let i=e.replace(/<\/?p>/g,"");return/<[^>]+>/.test(i)?e:e.replace(/<\/p>\s*<p>/g,"\n").replace(/<\/?p>/g,"")}(e.getHTML()):"",s,o,d?.id),e.commands.clearContent(),_(e=>(e.forEach(e=>URL.revokeObjectURL(e.preview)),[])),v([]),h?.(),L(n,i)}finally{N.current=!1,w(!1)}},[y,n,i,d?.id,h,L]),{getRootProps:q,getInputProps:K,open:Y}=(0,Lx.useDropzone)({noClick:!0,noKeyboard:!0,multiple:!0,accept:{"image/*":[],"application/pdf":[".pdf"],"application/msword":[".doc"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"text/*":[".txt",".md",".csv",".json"]},onDrop:e=>{_(i=>[...i,...e.map(e=>({file:e,preview:URL.createObjectURL(e)}))])}});(0,iO.useEffect)(()=>()=>{y.forEach(e=>URL.revokeObjectURL(e.preview))},[y]);let X=(0,iO.useCallback)((e,i)=>{let{tr:n}=e.state,r=!1,s=[];e.state.doc.descendants((e,n)=>{"mention"===e.type.name&&e.attrs?.id!==i&&s.push({pos:n,nodeSize:e.nodeSize})});for(let e=s.length-1;e>=0;e--){let{pos:i,nodeSize:o}=s[e];n.delete(i,i+o),r=!0}r&&e.view.dispatch(n)},[]),J=(0,iO.useMemo)(()=>L_.configure({HTMLAttributes:{class:"mention"},suggestion:{char:"@",items:({query:e})=>{let i=e.toLowerCase();return O.current.filter(e=>!1!==e.enabled&&`${e.name} ${e.role} ${e.description||""}`.toLowerCase().includes(i)).slice(0,6).map(e=>({id:e.id,label:e.name||e.role,description:`${e.role}${e.description?` \xb7 ${e.description}`:""}`}))},command:({editor:e,range:i,props:n})=>{X(e,n.id),e.chain().focus().insertContentAt(i,[{type:"mention",attrs:n}]).run()},render:()=>j5()}}),[X]),G=(0,iO.useMemo)(()=>j4(()=>{document.querySelector("[data-chat-file-input]")?.click()}),[]),Z=(0,iO.useRef)(V);Z.current=V;let Q=Oh({immediatelyRender:!1,extensions:[Lp,Lc.configure({placeholder:p("input.placeholder",{channel:e})}),J,G],editorProps:{attributes:{class:"tiptap tiptap-chat"},handleKeyDown:(e,i)=>"Enter"===i.key&&!i.shiftKey&&!document.querySelector(".suggestion-menu")&&(i.preventDefault(),Z.current(),!0),handlePaste:(e,i)=>{let n,r=i.clipboardData?.getData("text/html");if(r?.includes('data-type="mention"'))return!1;let s=i.clipboardData?.getData("text/plain");if(!s||!/@\S+/.test(s))return!1;let o=O.current;if(0===o.length)return!1;let a=/@(\S+)/g,l=!1;for(;null!==(n=a.exec(s));)if(o.some(e=>e.name===n[1]||e.id===n[1]||e.role===n[1])){l=!0;break}if(!l)return!1;let c=E.current;return!!c&&(c.commands.insertContent(It(s,o)),!0)}},content:"",onUpdate:({editor:e})=>{let i=Ie(e.getJSON());v(e=>e.length===i.length&&e.every((e,n)=>e===i[n])?e:i),U(e.getHTML())}},[J,G,e]);(0,iO.useEffect)(()=>{E.current=Q},[Q]);let ee=(0,iO.useCallback)(e=>{if(!Q||g[0]===e.id)return;X(Q,e.id);let i=Q.getText().trim(),n=[{type:"mention",attrs:{id:e.id,label:e.name||e.role}},{type:"text",text:" "+i}];Q.commands.setContent({type:"doc",content:[{type:"paragraph",content:n}]},{emitUpdate:!0}),Q.commands.focus("end")},[Q,g,X]);(0,iO.useEffect)(()=>{if(!Q||M.current===i)return;M.current=i,D.current&&(clearTimeout(D.current),D.current=null);let e=R.current.draft,n=R.current.pinnedMentionId,r=n?O.current.find(e=>e.id===n):void 0,s=e?.content?e.content:r?[{type:"mention",attrs:{id:r.id,label:r.name||r.role}},{type:"text",text:" "}]:"";Q.commands.setContent(s,{emitUpdate:!1}),v(Ie(Q.getJSON()))},[Q,i]),(0,iO.useImperativeHandle)(u,()=>({setContent:(e,i)=>{if(Q){if(e.includes('data-type="mention"'))Q.commands.setContent(e,{emitUpdate:!1});else{let n=/<[a-z][\s\S]*>/i.test(e)?e.replace(/<[^>]*>/g,""):e,r=i??O.current;r.length>0&&/@\S+/.test(n)?Q.commands.setContent(It(n,r),{emitUpdate:!1}):Q.commands.setContent(n,{emitUpdate:!1})}Q.commands.focus("end")}},focus:()=>{Q?.commands.focus("end")}}),[Q]);let et=(0,iO.useCallback)(()=>{V()},[V]),ei=(!!Oa({editor:Q,selector:e=>!!e.editor?.getText().trim()})||y.length>0)&&!b,en=(0,iO.useCallback)(e=>{_(i=>{let n=[...i],[r]=n.splice(e,1);return r&&URL.revokeObjectURL(r.preview),n})},[]),er=(0,iO.useCallback)(()=>{let e=g[0];e&&j(n,i,{pinnedMentionId:P?void 0:e})},[g,P,n,i,j]),es=(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsxs)(lz.DropdownMenu,{children:[(0,iM.jsx)(lz.DropdownMenuTrigger,{render:(0,iM.jsx)(f7.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full border border-border hover:bg-accent"}),children:(0,iM.jsx)(Sd,{className:"size-3"})}),(0,iM.jsx)(lz.DropdownMenuContent,{align:"start",className:"max-w-xs rounded-2xl p-1.5",children:(0,iM.jsx)(lz.DropdownMenuGroup,{className:"space-y-1",children:(0,iM.jsxs)(lz.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs",onClick:Y,children:[(0,iM.jsx)(So,{size:16,className:"opacity-60"}),p("input.attachFiles")]})})})]}),(0,iM.jsxs)(f7.Button,{variant:"ghost",size:"sm",onClick:()=>k(!S),className:(0,n1.cn)("h-7 px-2 rounded-full border border-border hover:bg-accent",{"bg-primary/10 text-primary border-primary/30":S,"text-muted-foreground":!S}),children:[(0,iM.jsx)(Sp,{className:"size-3"}),(0,iM.jsx)("span",{className:"text-xs",children:p("input.autoMode")})]})]});return(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsx)("div",{className:"flex justify-center -mt-0.5",children:(0,iM.jsx)("button",{type:"button",onClick:()=>m(e=>!e),className:"p-0.5 text-muted-foreground/60 hover:text-foreground transition-colors",children:(0,iM.jsx)(Sf,{className:(0,n1.cn)("size-3.5 transition-transform",f&&"rotate-180")})})}),!f&&(0,iM.jsxs)("div",{className:"border-t px-4 py-2",children:[$.length>1&&(0,iM.jsx)("div",{className:"flex items-center gap-1 mb-1.5 overflow-x-auto scrollbar-none",children:$.map(e=>{let i=e.id===B?.id;return(0,iM.jsxs)("button",{type:"button",onClick:()=>ee(e),className:(0,n1.cn)("shrink-0 inline-flex items-center gap-1 h-6 pl-0.5 pr-1 rounded-full text-xs transition-all",i?"bg-primary/10 text-primary border border-primary/30":"text-muted-foreground border border-transparent hover:bg-accent"),children:[(0,iM.jsx)(mP.AgentIcon,{agentId:e.id,name:e.name||e.role,avatarUrl:e.avatarUrl,className:"size-5 rounded-full text-[9px]"}),(0,iM.jsx)("span",{className:"max-w-[80px] truncate",children:e.name||e.role}),i?(0,iM.jsx)("span",{role:"button",tabIndex:0,onClick:e=>{e.stopPropagation(),er()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.stopPropagation(),er())},className:(0,n1.cn)("inline-flex items-center justify-center size-4 rounded-full hover:bg-primary/20 transition-colors",P?"text-primary":"text-primary/50"),title:P?p("input.unpinAgent"):p("input.pinAgent"),children:P?(0,iM.jsx)(Sl,{className:"size-2.5"}):(0,iM.jsx)(Sa,{className:"size-2.5"})}):I===e.id?(0,iM.jsx)(Sl,{className:"size-2.5 text-muted-foreground/50"}):null]},e.id)})}),$.length<=1&&B&&(0,iM.jsxs)("div",{className:"flex items-center gap-1 mb-1.5",children:[(0,iM.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground bg-muted/50 rounded-full px-2 py-0.5",children:["@",B.name||B.role]}),(0,iM.jsx)("button",{type:"button",onClick:er,className:(0,n1.cn)("inline-flex items-center justify-center size-5 rounded-full hover:bg-accent transition-colors",P?"text-primary":"text-muted-foreground"),title:P?p("input.unpinAgent"):p("input.pinAgent"),children:P?(0,iM.jsx)(Sl,{className:"size-3"}):(0,iM.jsx)(Sa,{className:"size-3"})})]}),(0,iM.jsx)(LS,{editor:Q,canSubmit:ei,onSubmit:et,onStop:c,isProcessing:l||b,actions:es,dropzoneProps:q(),hiddenInput:(0,iM.jsx)("input",{...K(),"data-chat-file-input":""}),replyLabel:d?.label,onCancelReply:h}),y.length>0&&(0,iM.jsx)(bG,{variant:"inline",className:"mt-2 justify-start",children:y.map((e,i)=>{var n;return(0,iM.jsxs)(bZ,{data:(n=e,{id:`${n.file.name}-${n.file.lastModified}`,type:"file",filename:n.file.name,mediaType:n.file.type,url:n.preview}),onRemove:()=>en(i),children:[(0,iM.jsx)(bQ,{}),(0,iM.jsx)(b0,{}),(0,iM.jsx)(b1,{})]},`${e.file.name}-${e.file.lastModified}-${i}`)})}),(0,iM.jsxs)("div",{className:"flex items-center gap-0 pt-2",children:[(0,iM.jsxs)(lz.DropdownMenu,{children:[(0,iM.jsxs)(lz.DropdownMenuTrigger,{render:(0,iM.jsx)(f7.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 rounded-full border border-transparent hover:bg-accent text-muted-foreground text-xs"}),children:[(0,iM.jsx)(Sc,{className:"size-3"}),(0,iM.jsxs)("span",{children:[p("input.mcp"),z.length?` ${z.length}`:""]}),(0,iM.jsx)(Se,{className:"size-3"})]}),(0,iM.jsx)(lz.DropdownMenuContent,{align:"start",className:"max-w-xs rounded-2xl p-1.5 bg-popover border-border",children:(0,iM.jsx)(lz.DropdownMenuGroup,{className:"space-y-1",children:z.length?z.map(e=>(0,iM.jsxs)(lz.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs",children:[(0,iM.jsx)(Sc,{size:16,className:"opacity-60"}),e]},e)):(0,iM.jsxs)(lz.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs text-muted-foreground",children:[(0,iM.jsx)(Sc,{size:16,className:"opacity-60"}),p("input.noMcp")]})})})]}),(0,iM.jsxs)(lz.DropdownMenu,{children:[(0,iM.jsxs)(lz.DropdownMenuTrigger,{render:(0,iM.jsx)(f7.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 rounded-full border border-transparent hover:bg-accent text-muted-foreground text-xs"}),children:[(0,iM.jsx)(Sh,{className:"size-3"}),(0,iM.jsxs)("span",{children:[p("input.skill"),F.length?` ${F.length}`:""]}),(0,iM.jsx)(Se,{className:"size-3"})]}),(0,iM.jsx)(lz.DropdownMenuContent,{align:"start",className:"max-w-xs rounded-2xl p-1.5 bg-popover border-border",children:(0,iM.jsx)(lz.DropdownMenuGroup,{className:"space-y-1",children:F.length?F.map(e=>(0,iM.jsxs)(lz.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs",children:[(0,iM.jsx)(Sh,{size:16,className:"opacity-60"}),e]},e)):(0,iM.jsxs)(lz.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs text-muted-foreground",children:[(0,iM.jsx)(Sh,{size:16,className:"opacity-60"}),p("input.noSkills")]})})})]}),(0,iM.jsxs)(lz.DropdownMenu,{children:[(0,iM.jsxs)(lz.DropdownMenuTrigger,{render:(0,iM.jsx)(f7.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 rounded-full border border-transparent hover:bg-accent text-muted-foreground text-xs"}),children:[(0,iM.jsx)(Su,{className:"size-3"}),(0,iM.jsxs)("span",{children:[p("input.tools"),H.length?` ${H.length}`:""]}),(0,iM.jsx)(Se,{className:"size-3"})]}),(0,iM.jsx)(lz.DropdownMenuContent,{align:"start",className:"max-w-xs rounded-2xl p-1.5 bg-popover border-border",children:(0,iM.jsx)(lz.DropdownMenuGroup,{className:"space-y-1",children:H.length?H.map(({name:e,label:i,icon:n})=>(0,iM.jsxs)(lz.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs",children:[(0,iM.jsx)(n,{size:16,className:"opacity-60"}),i]},e)):(0,iM.jsxs)(lz.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs text-muted-foreground",children:[(0,iM.jsx)(Su,{size:16,className:"opacity-60"}),p("input.noTools")]})})})]}),r.todos&&r.todos.length>0&&(0,iM.jsxs)(lz.DropdownMenu,{children:[(0,iM.jsxs)(lz.DropdownMenuTrigger,{render:(0,iM.jsx)(f7.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 rounded-full border border-transparent hover:bg-accent text-muted-foreground text-xs"}),children:[(0,iM.jsx)(St,{className:"size-3"}),(0,iM.jsxs)("span",{children:[p("input.todos")," ",r.todos.length]}),(0,iM.jsx)(Se,{className:"size-3"})]}),(0,iM.jsx)(lz.DropdownMenuContent,{align:"start",className:"max-w-xs rounded-2xl p-1.5 bg-popover border-border",children:(0,iM.jsx)(lz.DropdownMenuGroup,{className:"space-y-0.5",children:r.todos.map((e,i)=>(0,iM.jsxs)(lz.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs gap-2",onSelect:e=>e.preventDefault(),children:["completed"===e.status?(0,iM.jsx)(St,{size:14,className:"text-green-500 shrink-0"}):"in_progress"===e.status?(0,iM.jsx)(Sr,{size:14,className:"text-blue-500 shrink-0 animate-spin",style:{animationDuration:"3s"}}):(0,iM.jsx)(Si,{size:14,className:"text-muted-foreground shrink-0"}),(0,iM.jsx)("span",{className:(0,n1.cn)("truncate","completed"===e.status&&"line-through text-muted-foreground"),children:j8(e,p("untitledTodo"))})]},e.id||`${j8(e,p("untitledTodo"))}-${i}`))})})]}),(0,iM.jsx)("div",{className:"flex-1"})]})]})]})});async function j7(e){let i=new FormData;i.append("file",e.file);let n=await fetch("/api/upload",{method:"POST",body:i});if(!n.ok)throw Error(`Upload failed: ${e.file.name}`);let r=await n.json();return{name:r.name,path:r.url,url:r.url,type:r.type,size:r.size}}function Ie(e){let i=new Set,n=e=>{if(e&&("mention"===e.type&&"string"==typeof e.attrs?.id&&i.add(e.attrs.id),Array.isArray(e.content)))for(let i of e.content)n(i)};return n(e),[...i]}function It(e,i){return e?{type:"doc",content:e.split("\n").map(e=>{let n=function(e,i){let n,r=[],s=/@(\S+)/g,o=0;for(;null!==(n=s.exec(e));){n.index>o&&r.push({type:"text",text:e.slice(o,n.index)});let a=n[1],l=i.find(e=>e.name===a||e.id===a||e.role===a);l?r.push({type:"mention",attrs:{id:l.id,label:l.name||l.role}}):r.push({type:"text",text:n[0]}),o=s.lastIndex}return o<e.length&&r.push({type:"text",text:e.slice(o)}),r}(e,i);return{type:"paragraph",content:n.length>0?n:void 0}})}:{type:"doc",content:[{type:"paragraph"}]}}let Ii=({className:e,status:i,...n})=>(0,iM.jsx)(mj.Badge,{className:(0,n1.cn)("flex items-center gap-2","group",i,e),variant:"secondary",...n}),In=({className:e,...i})=>(0,iM.jsxs)("span",{className:(0,n1.cn)("relative flex h-2 w-2",e),...i,children:[(0,iM.jsx)("span",{className:(0,n1.cn)("absolute inline-flex h-full w-full animate-ping rounded-full opacity-75","group-[.online]:bg-emerald-500","group-[.offline]:bg-red-500","group-[.maintenance]:bg-blue-500","group-[.degraded]:bg-amber-500")}),(0,iM.jsx)("span",{className:(0,n1.cn)("relative inline-flex h-2 w-2 rounded-full","group-[.online]:bg-emerald-500","group-[.offline]:bg-red-500","group-[.maintenance]:bg-blue-500","group-[.degraded]:bg-amber-500")})]}),Ir=({className:e,children:i,...n})=>(0,iM.jsx)("span",{className:(0,n1.cn)("text-muted-foreground",e),...n,children:i??(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsx)("span",{className:"hidden group-[.online]:block",children:"Online"}),(0,iM.jsx)("span",{className:"hidden group-[.offline]:block",children:"Offline"}),(0,iM.jsx)("span",{className:"hidden group-[.maintenance]:block",children:"Maintenance"}),(0,iM.jsx)("span",{className:"hidden group-[.degraded]:block",children:"Degraded"})]})}),Is=(0,nP.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var Io=e.i(14452),Ia=e.i(191118);let Il=(0,nP.default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),Ic=(0,nP.default)("user-plus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);function Id({name:e,agentId:i,description:n,onClick:r}){return(0,iM.jsxs)("button",{type:"button",onClick:r,className:"flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left transition-colors",children:[(0,iM.jsx)(mP.AgentIcon,{agentId:i,name:e,className:"size-7 rounded-full"}),(0,iM.jsxs)("span",{className:"min-w-0",children:[(0,iM.jsx)("span",{className:"block text-sm truncate",children:e}),n&&(0,iM.jsx)("span",{className:"block text-xs text-muted-foreground truncate",children:n})]})]})}function Ih({open:e,onOpenChange:i,candidates:n,onAdd:r}){let[s,o]=(0,iO.useState)([]),[a,l]=(0,iO.useState)(0),c=e=>{e||(o([]),l(e=>e+1)),i(e)};return(0,iM.jsx)(lq.Dialog,{open:e,onOpenChange:c,children:(0,iM.jsxs)(lq.DialogContent,{className:"sm:max-w-sm",children:[(0,iM.jsxs)(lq.DialogHeader,{children:[(0,iM.jsx)(lq.DialogTitle,{children:"添加成员"}),(0,iM.jsx)(lq.DialogDescription,{children:"选择要添加到频道的成员"})]}),(0,iM.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,iM.jsx)(mB,{candidates:n,selected:s,onToggle:e=>{o(i=>i.includes(e)?i.filter(i=>i!==e):[...i,e])},searchPlaceholder:"搜索成员...",emptyText:"无可用成员"},a),(0,iM.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,iM.jsx)(f7.Button,{variant:"outline",onClick:()=>c(!1),children:"取消"}),(0,iM.jsxs)(f7.Button,{onClick:()=>{0!==s.length&&(r(s),c(!1))},disabled:0===s.length,children:[(0,iM.jsx)(Ic,{className:"size-3.5 mr-1"}),"添加 (",s.length,")"]})]})]})]})})}let Iu={general:{status:"online"},issue:{status:"degraded"},agent:{status:"maintenance"}};function Ip({workspaceId:e,channel:i,agents:n,allChannels:r}){let s=(0,n2.useTranslations)("chat"),o=(0,n2.useTranslations)("common"),{updateChannel:a,deleteChannel:l}=(0,mM.useChannelStore)(),[c,d]=(0,iO.useState)(!1),[h,u]=(0,iO.useState)(!1),[p,f]=(0,iO.useState)(""),[m,g]=(0,iO.useState)(!1),[v,y]=(0,iO.useState)(!1);Iu[i.type];let _=n.filter(e=>!1!==e.enabled),b=new Set(i.members),w=_.filter(e=>!b.has(e.id)).map(e=>({id:e.id,label:mz(e),description:e.role})),S=async()=>{await l(e,i.id),y(!1)};return(0,iM.jsxs)("div",{className:"flex flex-col h-full",children:[(0,iM.jsx)("div",{className:"flex items-center justify-between px-4 h-12 border-b shrink-0",children:(0,iM.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:["agent"===i.type?(0,iM.jsx)(mR.Bot,{className:"size-4 text-muted-foreground shrink-0"}):"issue"===i.type?(0,iM.jsx)(mL.AlertCircle,{className:"size-4 text-muted-foreground shrink-0"}):(0,iM.jsx)(nI.Hash,{className:"size-4 text-muted-foreground shrink-0"}),(0,iM.jsxs)("span",{className:"text-sm font-medium truncate",children:["#",i.name]})]})}),(0,iM.jsxs)(ss,{defaultValue:"info",className:"flex flex-col flex-1 min-h-0",children:[(0,iM.jsxs)(sa,{className:"w-full rounded-none border-b bg-transparent h-9 p-0 shrink-0",children:[(0,iM.jsxs)(sl,{value:"info",className:"flex-1 gap-1.5 data-[state=active]:shadow-none data-[state=active]:border-b-2 data-[state=active]:border-primary rounded-none",children:[(0,iM.jsx)(Is,{className:"size-3.5"}),s("channel.info")]}),(0,iM.jsxs)(sl,{value:"members",className:"flex-1 gap-1.5 data-[state=active]:shadow-none data-[state=active]:border-b-2 data-[state=active]:border-primary rounded-none",children:[(0,iM.jsx)(Il,{className:"size-3.5"}),s("channel.members")]})]}),(0,iM.jsxs)(Ia.ScrollArea,{className:"flex-1 min-h-0",children:[(0,iM.jsxs)(sc,{value:"info",className:"p-4 mt-0 space-y-4",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-3",children:[(0,iM.jsx)("div",{className:"flex items-center justify-center size-10 rounded-lg bg-muted",children:"agent"===i.type?(0,iM.jsx)(mR.Bot,{className:"size-5 text-muted-foreground"}):"issue"===i.type?(0,iM.jsx)(mL.AlertCircle,{className:"size-5 text-muted-foreground"}):(0,iM.jsx)(nI.Hash,{className:"size-5 text-muted-foreground"})}),(0,iM.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,iM.jsxs)("p",{className:"text-sm font-medium",children:["#",i.name]}),(0,iM.jsxs)("p",{className:"text-xs text-muted-foreground",children:[s("channel.type")," ",s(`channel.${i.type}`)]})]}),(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon-sm",onClick:()=>d(!0),children:(0,iM.jsx)(mc.Pencil,{className:"size-3.5"})})]}),(0,iM.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:s("channel.channelId")}),(0,iM.jsxs)("span",{className:"font-mono text-xs",children:[i.id.slice(0,8),"..."]})]}),(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:s("channel.memberCount")}),(0,iM.jsx)("span",{children:i.members.length})]}),(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:s("channel.createdAt")}),(0,iM.jsx)("span",{children:new Date(i.createdAt).toLocaleDateString()})]})]})]}),(0,iM.jsxs)(sc,{value:"members",className:"p-4 mt-0 space-y-1",children:[0===i.members.length&&(0,iM.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:s("channel.noMembers")}),i.members.map(e=>(0,iM.jsx)(Id,{name:mH(_,e),agentId:"user"!==e?e:void 0,description:"user"!==e?e:void 0,onClick:()=>{f(e),u(!0)}},e)),(0,iM.jsxs)(f7.Button,{variant:"ghost",size:"sm",className:"w-full mt-2 text-xs text-muted-foreground",onClick:()=>g(!0),children:[(0,iM.jsx)(Ic,{className:"size-3.5 mr-1"}),s("channel.addMember")]})]})]})]}),(0,iM.jsx)("div",{className:"shrink-0 p-3 border-t",children:(0,iM.jsxs)(f7.Button,{variant:"ghost",size:"sm",className:"w-full text-xs text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>y(!0),children:[(0,iM.jsx)(nZ.Trash2,{className:"size-3.5 mr-1"}),s("channel.delete")]})}),(0,iM.jsx)(m$,{open:c,onOpenChange:d,workspaceId:e,channel:i,agents:n,onSubmit:n=>a(e,i.id,{...n,members:mW(_,n.members)})}),(0,iM.jsx)(mG,{open:h,onOpenChange:u,memberName:p,displayName:mH(_,p),channelId:i.id,workspaceId:e,channels:r.filter(e=>e.members.includes(p)).map(e=>e.name)}),(0,iM.jsx)(Ih,{open:m,onOpenChange:g,candidates:w,onAdd:n=>{a(e,i.id,{members:mW(_,[...i.members,...n])})}}),(0,iM.jsx)(lq.Dialog,{open:v,onOpenChange:y,children:(0,iM.jsxs)(lq.DialogContent,{children:[(0,iM.jsxs)(lq.DialogHeader,{children:[(0,iM.jsx)(lq.DialogTitle,{children:s("channel.delete")}),(0,iM.jsx)(lq.DialogDescription,{children:s("channel.deleteConfirm")})]}),(0,iM.jsxs)(lq.DialogFooter,{children:[(0,iM.jsx)(lq.DialogClose,{render:(0,iM.jsx)(f7.Button,{variant:"outline"}),children:o("cancel")}),(0,iM.jsxs)(f7.Button,{variant:"destructive",onClick:S,children:[(0,iM.jsx)(nZ.Trash2,{className:"size-3.5"}),o("delete")]})]})]})})]})}var If=e.i(249673);function Im({messages:e}){var i;let n,[r,s]=(0,iO.useState)(null),[o,a]=(0,iO.useState)(!1),[l,c]=(0,iO.useState)(0),d=(0,iO.useRef)(null),h=(0,iO.useCallback)(i=>{s(i);let n=document.getElementById(`msg-${e[i].id}`);n?.scrollIntoView({behavior:"smooth",block:"center"})},[e]),u=(0,iO.useCallback)((e,i)=>{if(!i||!d.current)return;s(e);let n=d.current.getBoundingClientRect(),r=i.getBoundingClientRect();c(r.top-n.top+r.height/2)},[]);return 0===e.length?null:(0,iM.jsxs)("div",{ref:d,className:"absolute right-2 top-1/2 -translate-y-1/2 z-10 flex flex-col items-center",onMouseEnter:()=>a(!0),onMouseLeave:()=>{a(!1),s(null)},children:[(0,iM.jsx)("button",{className:`flex-shrink-0 mb-0.5 flex items-center justify-center size-5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-all ${o?"opacity-100":"opacity-0 pointer-events-none"} ${null===r||r<=0?"invisible":""}`,onClick:()=>{null!==r&&r>0&&h(r-1)},children:(0,iM.jsx)(If.ChevronUp,{className:"size-3.5"})}),(0,iM.jsx)("div",{className:"flex-1 w-full max-h-[70vh] overflow-y-auto scrollbar-none",children:(0,iM.jsx)("div",{className:"flex flex-col gap-[3px] px-1 py-0.5",children:e.map((e,i)=>(0,iM.jsx)("div",{className:"flex justify-center",children:(0,iM.jsx)("button",{className:`h-[4px] rounded-full transition-all duration-150 ${r===i?"bg-primary w-6":"user"===e.senderId?"bg-primary/30 hover:bg-primary/50 w-5":"bg-muted-foreground/25 hover:bg-muted-foreground/40 w-5"}`,onClick:()=>h(i),onMouseEnter:e=>u(i,e.currentTarget)})},e.id))})}),(0,iM.jsx)("button",{className:`flex-shrink-0 mt-0.5 flex items-center justify-center size-5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-all ${o?"opacity-100":"opacity-0 pointer-events-none"} ${null===r||r>=e.length-1?"invisible":""}`,onClick:()=>{null!==r&&r<e.length-1&&h(r+1)},children:(0,iM.jsx)(ra.ChevronDown,{className:"size-3.5"})}),o&&null!==r&&(0,iM.jsxs)("div",{className:"absolute right-full mr-3 w-56 rounded-lg border bg-popover p-2.5 shadow-lg z-50 animate-in fade-in-0 zoom-in-95 duration-75",style:{top:l,transform:"translateY(-50%)"},children:[(0,iM.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,iM.jsx)("span",{className:"font-medium text-xs",children:"user"===e[r].senderId?"You":(0,mO.findAgentById)(e[r].senderId)?.name??e[r].senderId}),(0,iM.jsx)("span",{className:"text-[10px] text-muted-foreground",children:new Date(e[r].createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),(0,iM.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-3 leading-relaxed",children:(i=e[r].content,(n=/<[a-z][\s\S]*>/i.test(i)?i.replace(/<[^>]*>/g,""):i).length>150?n.slice(0,150)+"...":n)})]})]})}e.s([],594533),e.i(594533);let Ig=iO.createContext(void 0);function Iv(){let e=iO.useContext(Ig);if(void 0===e)throw Error((0,rT.default)(13));return e}let Iy={imageLoadingStatus:()=>null},I_=iO.forwardRef(function(e,i){let{className:n,render:r,style:s,...o}=e,[a,l]=iO.useState("idle"),c=iO.useMemo(()=>({imageLoadingStatus:a,setImageLoadingStatus:l}),[a,l]),d=(0,rk.useRenderElement)("span",e,{state:{imageLoadingStatus:a},ref:i,props:o,stateAttributesMapping:Iy});return(0,iM.jsx)(Ig.Provider,{value:c,children:d})}),Ix={...Iy,...rG.transitionStatusMapping},Ib=iO.forwardRef(function(e,i){let{className:n,render:r,onLoadingStatusChange:s,referrerPolicy:o,crossOrigin:a,style:l,...c}=e,d=Iv(),h=function(e,{referrerPolicy:i,crossOrigin:n}){let[r,s]=iO.useState("idle");return(0,rw.useIsoLayoutEffect)(()=>{if(!e)return s("error"),r3.NOOP;let r=!0,o=new window.Image,a=e=>()=>{r&&s(e)};return s("loading"),o.onload=a("loaded"),o.onerror=a("error"),i&&(o.referrerPolicy=i),o.crossOrigin=n??null,o.src=e,o.complete&&s(o.naturalWidth>0?"loaded":"error"),()=>{r=!1}},[e,n,i]),r}(e.src,{referrerPolicy:o,crossOrigin:a}),u="loaded"===h,{mounted:p,transitionStatus:f,setMounted:m}=(0,rQ.useTransitionStatus)(u),g=iO.useRef(null),v=(0,rS.useStableCallback)(e=>{s?.(e),d.setImageLoadingStatus(e)});(0,rw.useIsoLayoutEffect)(()=>{"idle"!==h&&v(h)},[h,v]),(0,rZ.useOpenChangeComplete)({open:u,ref:g,onComplete(){u||m(!1)}});let y=(0,rk.useRenderElement)("img",e,{state:{imageLoadingStatus:h,transitionStatus:f},ref:[i,g],props:c,stateAttributesMapping:Ix,enabled:p});return p?y:null}),Iw=iO.forwardRef(function(e,i){let{className:n,render:r,delay:s,style:o,...a}=e,{imageLoadingStatus:l}=Iv(),[c,d]=iO.useState(void 0===s),h=(0,sS.useTimeout)();return iO.useEffect(()=>(void 0!==s&&h.start(s,()=>d(!0)),h.clear),[h,s]),(0,rk.useRenderElement)("span",e,{state:{imageLoadingStatus:l},ref:i,props:a,stateAttributesMapping:Iy,enabled:"loaded"!==l&&c})});function IS({className:e,...i}){return(0,iM.jsx)("div",{"data-slot":"avatar-group",className:(0,n1.cn)("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",e),...i})}function Ik({className:e,...i}){return(0,iM.jsx)("div",{"data-slot":"avatar-group-count",className:(0,n1.cn)("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",e),...i})}e.s(["Fallback",0,Iw,"Image",0,Ib,"Root",0,I_],505621),e.i(505621);var IC=e.i(327964);let IT=(0,lY.create)(e=>({activePanel:"channel-list",setActivePanel:i=>e({activePanel:i})})),IE={general:{status:"online"},issue:{status:"degraded"},agent:{status:"maintenance"}};function ID({members:e}){let i=e.filter(e=>"user"!==e).slice(0,4),n=e.length-i.length-!!e.includes("user");return(0,iM.jsxs)(IS,{className:"ml-1 [&>[data-slot=avatar]]:size-5",children:[i.map(e=>(0,iM.jsx)(mP.AgentIcon,{agentId:e,className:"size-5 rounded-full"},e)),n>0&&(0,iM.jsxs)(Ik,{className:"!size-5 text-[10px]",children:["+",n]})]})}function IN({workspaceId:e}){let i=(0,n2.useTranslations)("chat"),n=(0,n2.useTranslations)("common"),{activeChannelId:r,channels:s,messages:o,loadMessages:a,sendMessage:l,addMessage:c,updateMessage:d,stopProcessingMessages:h,deleteMessage:u,clearMessages:p}=(0,mM.useChannelStore)(),f=(0,iO.useRef)(null),[m,g]=(0,iO.useState)(!1),[v,y]=(0,iO.useState)(null),[_,b]=(0,iO.useState)(!1),[w,S]=(0,iO.useState)(null),k=(0,iO.useRef)(null),C=(0,mO.useAgentStore)(e=>e.agents),T=(0,mO.useAgentStore)(e=>e.ensure),E=s.find(e=>e.id===r),D=(0,iO.useMemo)(()=>r&&o[r]||[],[r,o]),N=(0,iO.useMemo)(()=>(function(e){for(let i=e.length-1;i>=0;i-=1){let n=e[i];if("waiting_for_user"!==n.status)continue;let r=n.parts?.find(e=>"ask_user_question"===e.type&&"answered"!==e.status);if(r&&"ask_user_question"===r.type)return{messageId:n.id,questionId:r.id,question:r.question,choices:r.choices??[]}}return null})(D),[D]),M=(0,iO.useMemo)(()=>{let e=C.filter(e=>!1!==e.enabled);if(!E)return[];let i=new Set;return E.members.filter(e=>"user"!==e).map(i=>mF(e,i)).filter(e=>!(!e||i.has(e.id))&&(i.add(e.id),!0))},[E,C]);(0,iO.useEffect)(()=>{r&&a(e,r),T()},[r,e,a,T]),(0,iO.useEffect)(()=>{let i=(0,lZ.getWS)(e),n=i.on("channel.message",e=>{e.channelId===r&&c(e.channelId,e)}),s=i.on("channel.message.updated",e=>{e.channelId===r&&d(e.channelId,e)}),o=i.on("channel.message.deleted",e=>{e.channelId===r&&u(e.channelId,e.messageId)}),a=i.on("channel.messages.cleared",e=>{e.channelId===r&&mM.useChannelStore.setState(e=>({messages:{...e.messages,[r]:[]}}))}),l=i.on("channel.updated",e=>{e.id===r&&mM.useChannelStore.setState(i=>({channels:i.channels.map(i=>i.id===e.id?e:i)}))});return()=>{n(),s(),o(),a(),l()}},[e,r,c,d,u]),(0,iO.useEffect)(()=>{f.current?.scrollIntoView({behavior:"smooth"})},[D.length]),(0,iO.useEffect)(()=>{if(!r||!e)return;let i=D[D.length-1];if(!i||!["pending","streaming","waiting_for_user"].includes(i.status??""))return;let n=setInterval(()=>{a(e,r)},3e3);return()=>clearInterval(n)},[r,e,D.length,D[D.length-1]?.status,a]);let O=(0,iO.useCallback)((i,n,s,o)=>{r&&l(e,r,i,n,s,o)},[e,r,l]),R=D.length>0&&["pending","streaming","waiting_for_user"].includes(D[D.length-1].status??""),A=(0,iO.useCallback)(()=>{r&&(h(r),(0,lZ.getWS)(e).send("channel.stop",{channelId:r}))},[e,r,h]),L=(0,iO.useCallback)(e=>{k.current?.setContent(e.content,M)},[M]),j=(0,iO.useCallback)(e=>{y(e)},[]),I=(0,iO.useCallback)(e=>{let i="user"===e.senderId?void 0:C.find(i=>i.id===e.senderId);S({id:e.id,label:"user"===e.senderId?n("you"):i?.name||e.senderId}),k.current?.focus?.()},[C,n]),P=(0,iO.useCallback)(async()=>{v&&(await fetch(`/api/workspaces/${e}/channels/${v.channelId}/messages/${v.id}`,{method:"DELETE"}),y(null))},[e,v]);if(!E)return(0,iM.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:i("emptyState")});let B=(()=>{let e=IE[E.type];if(0===D.length)return{label:i("status.idle"),status:"degraded"};let n=D[D.length-1].status;if("waiting_for_user"===n)return{label:i("status.waitingForUser"),status:"degraded"};if("streaming"===n||"pending"===n)return{label:i("status.running"),status:"maintenance"};if("completed"===n)return{label:i("status.success"),status:"online"};if("error"===n){let e=D.slice(-3);return e.length>=3&&e.every(e=>"error"===e.status)?{label:i("status.error"),status:"offline"}:{label:i("status.running"),status:"degraded"}}return{label:i(`channelType.${E.type}`),status:e.status}})();return(0,iM.jsxs)("div",{className:"flex h-full",children:[(0,iM.jsxs)("div",{className:"flex flex-col flex-1 min-w-0",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b",children:[(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon-sm",className:"md:hidden shrink-0",onClick:()=>IT.getState().setActivePanel("channel-list"),children:(0,iM.jsx)(my.ArrowLeft,{className:"size-4"})}),(0,iM.jsxs)("span",{className:"text-sm font-semibold truncate shrink min-w-0",children:["# ",E.name]}),(0,iM.jsxs)(Ii,{status:B.status,children:[(0,iM.jsx)(In,{}),(0,iM.jsx)(Ir,{children:B.label})]}),(0,iM.jsx)(ID,{members:E.members}),(0,iM.jsx)("div",{className:"flex-1"}),E.issueId&&(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon-sm",onClick:()=>IC.useIssueStore.getState().setActiveIssue(E.issueId),title:i("viewRelatedIssue"),children:(0,iM.jsx)(nQ.ExternalLink,{className:"size-4"})}),D.length>0&&(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon-sm",onClick:()=>b(!0),children:(0,iM.jsx)(nZ.Trash2,{className:"size-4"})}),(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon-sm",onClick:()=>g(!0),children:(0,iM.jsx)(Is,{className:"size-4"})})]}),(0,iM.jsxs)("div",{className:"flex-1 min-h-0 relative",children:[(0,iM.jsxs)("div",{className:"h-full overflow-y-auto overflow-x-hidden py-2",children:[D.map(i=>(0,iM.jsx)("div",{id:`msg-${i.id}`,children:(0,iM.jsx)(w6,{message:i,workspaceId:e,onEdit:L,onDelete:j,onReply:I})},i.id)),(0,iM.jsx)("div",{ref:f})]}),(0,iM.jsx)(Im,{messages:D})]}),N?(0,iM.jsx)(IM,{question:N,onAnswer:i=>{(0,lZ.getWS)(e).send("channel.answer_question",{channelId:E.id,messageId:N.messageId,questionId:N.questionId,answer:i})}}):null,(0,iM.jsx)(j9,{ref:k,channelName:E.name,channelId:E.id,workspaceId:e,channel:E,agents:M,messages:D,onSend:O,isProcessing:R,onStop:A,replyTo:w,onCancelReply:()=>S(null)})]}),(0,iM.jsx)(Io.Sheet,{open:m,onOpenChange:g,children:(0,iM.jsxs)(Io.SheetContent,{side:"right",className:"w-80 p-0 gap-0",children:[(0,iM.jsxs)(Io.SheetHeader,{className:"sr-only",children:[(0,iM.jsx)(Io.SheetTitle,{children:E.name}),(0,iM.jsx)(Io.SheetDescription,{children:"Channel info panel"})]}),(0,iM.jsx)(Ip,{workspaceId:e,channel:E,agents:C,allChannels:s})]})}),(0,iM.jsx)(lq.Dialog,{open:!!v,onOpenChange:e=>{e||y(null)},children:(0,iM.jsxs)(lq.DialogContent,{children:[(0,iM.jsxs)(lq.DialogHeader,{children:[(0,iM.jsx)(lq.DialogTitle,{children:i("deleteMessage.title")}),(0,iM.jsx)(lq.DialogDescription,{children:i("deleteMessage.description")})]}),(0,iM.jsxs)(lq.DialogFooter,{children:[(0,iM.jsx)(lq.DialogClose,{render:(0,iM.jsx)(f7.Button,{variant:"outline"}),children:n("cancel")}),(0,iM.jsxs)(f7.Button,{variant:"destructive",onClick:P,children:[(0,iM.jsx)(nZ.Trash2,{className:"size-3.5"}),n("delete")]})]})]})}),(0,iM.jsx)(lq.Dialog,{open:_,onOpenChange:b,children:(0,iM.jsxs)(lq.DialogContent,{children:[(0,iM.jsxs)(lq.DialogHeader,{children:[(0,iM.jsx)(lq.DialogTitle,{children:i("clearMessages.title")}),(0,iM.jsx)(lq.DialogDescription,{children:i("clearMessages.description",{channel:E?.name})})]}),(0,iM.jsxs)(lq.DialogFooter,{children:[(0,iM.jsx)(lq.DialogClose,{render:(0,iM.jsx)(f7.Button,{variant:"outline"}),children:n("cancel")}),(0,iM.jsxs)(f7.Button,{variant:"destructive",onClick:async()=>{E&&await p(e,E.id),b(!1)},children:[(0,iM.jsx)(nZ.Trash2,{className:"size-3.5"}),i("clearMessages.confirm")]})]})]})})]})}function IM({question:e,onAnswer:i}){let n=(0,n2.useTranslations)("chat"),[r,s]=(0,iO.useState)(""),[o,a]=(0,iO.useState)(!1),l=e=>{let n=e.trim();n&&!o&&(a(!0),i(n),s(""))};return(0,iM.jsx)("div",{className:"border-t bg-background px-4 py-3",children:(0,iM.jsx)("div",{className:"rounded-md border bg-muted/30 p-3",children:(0,iM.jsxs)("div",{className:"flex items-start gap-2",children:[(0,iM.jsx)(m5,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,iM.jsxs)("div",{className:"min-w-0 flex-1 space-y-3",children:[(0,iM.jsx)("div",{className:"text-sm font-medium",children:e.question}),e.choices.length>0?(0,iM.jsx)("div",{className:"flex flex-wrap gap-2",children:e.choices.map(e=>(0,iM.jsx)(f7.Button,{type:"button",size:"sm",variant:"outline",disabled:o,onClick:()=>l(e),className:"h-8",children:e},e))}):null,(0,iM.jsxs)("form",{className:"flex gap-2",onSubmit:e=>{e.preventDefault(),l(r)},children:[(0,iM.jsx)(me.Input,{value:r,onChange:e=>s(e.target.value),disabled:o,className:"h-8 text-sm",placeholder:n("pendingQuestion.placeholder")}),(0,iM.jsx)(f7.Button,{type:"submit",size:"icon-sm",disabled:!r.trim()||o,children:(0,iM.jsx)(Lb,{className:"size-3.5"})})]})]})]})})})}var IO=e.i(592039),IR=e.i(612505),IR=IR,IA=e.i(788010),IL=e.i(302773);function Ij({open:e,onOpenChange:i,agents:n=[],onSubmit:r}){let[s,o]=(0,iO.useState)(""),[a,l]=(0,iO.useState)(""),[c,d]=(0,iO.useState)([]),[h,u]=(0,iO.useState)(""),{workflows:p,loadWorkflows:f}=(0,IL.useWorkflowStore)(),m=(0,n2.useTranslations)("issue"),g=(0,n2.useTranslations)("common"),v=n.filter(e=>!1!==e.enabled).map(e=>({id:e.id,label:mH(n,e.id)}));(0,iO.useEffect)(()=>{e&&f()},[e,f]);let y=e=>{e||(o(""),l(""),d([]),u("")),i(e)};return(0,iM.jsx)(lq.Dialog,{open:e,onOpenChange:y,children:(0,iM.jsxs)(lq.DialogContent,{className:"sm:max-w-md",children:[(0,iM.jsxs)(lq.DialogHeader,{children:[(0,iM.jsx)(lq.DialogTitle,{children:m("create.title")}),(0,iM.jsx)(lq.DialogDescription,{children:m("create.description")})]}),(0,iM.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,iM.jsx)(me.Input,{placeholder:m("create.titlePlaceholder"),value:s,onChange:e=>o(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,iM.jsx)(IA.Textarea,{placeholder:m("create.descriptionPlaceholder"),value:a,onChange:e=>l(e.target.value),rows:3}),(0,iM.jsxs)("div",{className:"space-y-1.5",children:[(0,iM.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Workflow Template"}),(0,iM.jsxs)("select",{value:h,onChange:e=>{let i=e.target.value;if(u(i),i){let e=p.find(e=>e.id===i);if(e){let i=e.nodes.map(e=>e.data.agentConfigId);d(e=>Array.from(new Set([...e,...i])))}}},className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[(0,iM.jsx)("option",{value:"",children:"None (use default pipeline)"}),p.map(e=>(0,iM.jsxs)("option",{value:e.id,children:[e.name," (",e.nodes.length," agents)"]},e.id))]})]}),(0,iM.jsx)(mB,{candidates:v,selected:c,onToggle:e=>{d(i=>i.includes(e)?i.filter(i=>i!==e):[...i,e])},label:m("create.membersLabel"),searchPlaceholder:m("create.searchAgent"),emptyText:m("create.noAgents")},String(e)),(0,iM.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,iM.jsx)(f7.Button,{variant:"outline",onClick:()=>y(!1),children:g("cancel")}),(0,iM.jsx)(f7.Button,{onClick:()=>{s.trim()&&(r({title:s.trim(),description:a.trim(),members:c,workflowId:h||void 0}),y(!1))},disabled:!s.trim(),children:m("create.submit")})]})]})]})})}let II=["draft","planned","in_progress","review_pending","changes_requested","approved","completed","archived"];function IP({issue:e,open:i,onOpenChange:n,agents:r=[],onSave:s}){let[o,a]=(0,iO.useState)(e.title),[l,c]=(0,iO.useState)(e.description),[d,h]=(0,iO.useState)(e.status),[u,p]=(0,iO.useState)(e.members||[]),[f,m]=(0,iO.useState)(""),[g,v]=(0,iO.useState)(!1),[y,_]=(0,iO.useState)(e.workflowId??""),{workflows:b,loadWorkflows:w}=(0,IL.useWorkflowStore)(),S=(0,n2.useTranslations)("issue"),k=(0,n2.useTranslations)("common");(0,iO.useEffect)(()=>{i&&(a(e.title),c(e.description),h(e.status),p(e.members?.length?[...e.members]:[]),m(""),_(e.workflowId??""))},[i,e]),(0,iO.useEffect)(()=>{i&&w()},[i,w]);let C=e=>{p(i=>i.includes(e)?i.filter(i=>i!==e):[...i,e])},T=async()=>{if(o.trim()){v(!0);try{await s({title:o.trim(),description:l.trim(),status:d,members:u,workflowId:"__none__"===y?null:y||null}),n(!1)}finally{v(!1)}}},E=r.filter(e=>!1!==e.enabled&&`${e.name||""} ${e.role||""}`.toLowerCase().includes(f.toLowerCase()));return(0,iM.jsx)(lq.Dialog,{open:i,onOpenChange:n,children:(0,iM.jsxs)(lq.DialogContent,{className:"sm:max-w-md max-h-[85vh] p-0 gap-0 flex flex-col overflow-hidden",children:[(0,iM.jsxs)(lq.DialogHeader,{className:"px-4 py-4 shrink-0",children:[(0,iM.jsx)(lq.DialogTitle,{children:S("edit.title")}),(0,iM.jsx)(lq.DialogDescription,{children:S("edit.description")})]}),(0,iM.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 pb-4",children:(0,iM.jsxs)("div",{className:"space-y-3",children:[(0,iM.jsx)(me.Input,{placeholder:S("edit.titlePlaceholder"),value:o,onChange:e=>a(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,iM.jsx)(IA.Textarea,{placeholder:S("edit.descriptionPlaceholder"),value:l,onChange:e=>c(e.target.value),rows:3}),(0,iM.jsxs)("div",{className:"space-y-1.5",children:[(0,iM.jsx)("label",{className:"text-sm font-medium text-foreground",children:S("edit.statusLabel")}),(0,iM.jsx)("select",{value:d,onChange:e=>h(e.target.value),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:II.map(e=>(0,iM.jsx)("option",{value:e,children:S(`status.${e}`)},e))})]}),(0,iM.jsxs)("div",{className:"space-y-1.5",children:[(0,iM.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Workflow Template"}),(0,iM.jsxs)("select",{value:y||"__none__",onChange:e=>(e=>{if(_(e),!e)return;let i=b.find(i=>i.id===e);if(!i)return;let n=i.nodes.map(e=>e.data.agentConfigId);p(e=>Array.from(new Set([...e,...n])))})("__none__"===e.target.value?"":e.target.value),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[(0,iM.jsx)("option",{value:"__none__",children:"None (use default pipeline)"}),b.map(e=>(0,iM.jsxs)("option",{value:e.id,children:[e.name," (",e.nodes.length," agents)"]},e.id))]})]}),(0,iM.jsxs)("div",{className:"space-y-2",children:[(0,iM.jsx)("label",{className:"text-sm font-medium",children:S("edit.membersLabel")}),(0,iM.jsx)(me.Input,{value:f,onChange:e=>m(e.target.value),placeholder:S("edit.searchAgent")}),(0,iM.jsxs)("div",{className:"max-h-36 overflow-y-auto space-y-0.5",children:[0===E.length&&(0,iM.jsx)("p",{className:"text-sm text-muted-foreground py-2 text-center",children:S("edit.noAgents")}),E.map(e=>(0,iM.jsxs)("button",{type:"button",onClick:()=>C(e.id),className:"flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[(0,iM.jsx)(mP.AgentIcon,{agentId:e.id,name:mH(r,e.id),className:"size-5 rounded-full"}),(0,iM.jsx)("span",{className:"flex-1 truncate",children:mH(r,e.id)}),(0,iM.jsx)("div",{className:`flex items-center justify-center size-4 rounded border ${u.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input"}`})]},e.id))]}),u.length>0&&(0,iM.jsx)("div",{className:"flex flex-wrap gap-1.5",children:u.map(e=>(0,iM.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:["user"===e?k("user"):(0,iM.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,iM.jsx)(mP.AgentIcon,{agentId:e,name:mH(r,e),className:"size-3.5 rounded-full"}),mH(r,e)]}),(0,iM.jsx)("button",{type:"button",onClick:()=>C(e),className:"hover:text-destructive",children:(0,iM.jsx)(sg.X,{className:"size-3"})})]},e))})]}),(0,iM.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,iM.jsx)(f7.Button,{variant:"outline",onClick:()=>n(!1),children:k("cancel")}),(0,iM.jsx)(f7.Button,{onClick:T,disabled:!o.trim()||g,children:g?k("saving"):k("save")})]})]})})]})})}let IB={draft:"bg-muted text-muted-foreground",planned:"bg-blue-500/10 text-blue-600 dark:text-blue-400",in_progress:"bg-amber-500/10 text-amber-600 dark:text-amber-400",review_pending:"bg-purple-500/10 text-purple-600 dark:text-purple-400",changes_requested:"bg-orange-500/10 text-orange-600 dark:text-orange-400",approved:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",completed:"bg-green-600/10 text-green-600 dark:text-green-400",archived:"bg-muted text-muted-foreground",error:"bg-destructive/10 text-destructive"},Iz=["in_progress","review_pending","changes_requested","draft","planned","approved","completed","error","archived"];function IF({workspaceId:e}){let{issues:i,activeIssueId:n,loading:r,loadIssues:s,createIssue:o,updateIssue:a,deleteIssue:l,setActiveIssue:c}=(0,IC.useIssueStore)(),{agents:d,ensure:h}=(0,mO.useAgentStore)(),[u,p]=(0,iO.useState)(!1),[f,m]=(0,iO.useState)(null),g=(0,n2.useTranslations)("issue"),v=(0,n2.useTranslations)("common");(0,iO.useEffect)(()=>{s(e),h()},[e,s,h]);let y=async i=>{await o(e,i.title,i.description,i.members,i.workflowId)},_=Iz.map(e=>({status:e,items:i.filter(i=>i.status===e)})).filter(e=>e.items.length>0);return r?(0,iM.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:v("loading")}):(0,iM.jsxs)("div",{className:"flex flex-col h-full",children:[(0,iM.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b text-xs font-medium text-muted-foreground",children:[(0,iM.jsx)("span",{children:g("list.title")}),(0,iM.jsx)("button",{onClick:()=>p(!0),className:"p-0.5 hover:bg-accent rounded",children:(0,iM.jsx)(lU.Plus,{className:"size-3.5"})})]}),(0,iM.jsxs)(Ia.ScrollArea,{className:"flex-1",children:[0===_.length&&(0,iM.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 px-4 text-center py-12",children:[(0,iM.jsx)("div",{className:"rounded-full bg-muted p-3",children:(0,iM.jsx)(IR.default,{className:"h-5 w-5 text-muted-foreground"})}),(0,iM.jsxs)("div",{children:[(0,iM.jsx)("p",{className:"text-sm font-medium",children:g("list.emptyTitle")}),(0,iM.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:g("list.emptyDescription")})]}),(0,iM.jsxs)(f7.Button,{size:"sm",variant:"outline",onClick:()=>p(!0),children:[(0,iM.jsx)(lU.Plus,{className:"h-3.5 w-3.5 mr-1"}),g("list.addIssue")]})]}),_.map(i=>(0,iM.jsxs)("div",{children:[(0,iM.jsxs)("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground uppercase",children:[g(`status.${i.status}`)," (",i.items.length,")"]}),i.items.map(i=>(0,iM.jsxs)(sK,{children:[(0,iM.jsxs)(sY,{onClick:()=>c(i.id),className:`w-full text-left px-3 py-2 hover:bg-accent/50 transition-colors flex items-start gap-2 ${n===i.id?"bg-accent":""}`,children:[(0,iM.jsx)(IO.CircleDot,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),(0,iM.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,iM.jsx)("div",{className:"text-sm font-medium truncate",children:i.title}),(0,iM.jsx)("div",{className:"text-xs text-muted-foreground",children:g("list.taskCount",{count:i.tasks.length})})]}),(0,iM.jsx)(mj.Badge,{variant:"outline",className:`text-[10px] shrink-0 border-none ${IB[i.status]}`,children:g(`status.${i.status}`)})]}),(0,iM.jsxs)(sX,{children:[(0,iM.jsxs)(sJ,{onClick:()=>m(i),children:[(0,iM.jsx)(mc.Pencil,{className:"size-4 mr-2"}),v("edit")]}),(0,iM.jsx)(sG,{}),(0,iM.jsxs)(sJ,{variant:"destructive",onClick:()=>l(e,i.id),children:[(0,iM.jsx)(nZ.Trash2,{className:"size-4 mr-2"}),v("delete")]})]})]},i.id))]},i.status))]}),(0,iM.jsx)(Ij,{open:u,onOpenChange:p,agents:d,onSubmit:y}),f&&(0,iM.jsx)(IP,{issue:f,open:!!f,onOpenChange:e=>{e||m(null)},agents:d,onSave:async i=>{await a(e,f.id,i),m(null)}})]})}var IH=e.i(873111),IW=e.i(357301),I$=e.i(327962);let IU=(0,nP.default)("messages-square",[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]),IV={draft:"secondary",planned:"outline",in_progress:"default",review_pending:"outline",changes_requested:"destructive",approved:"default",completed:"secondary",archived:"outline",error:"destructive"},Iq={pending:"secondary",running:"default",reviewing:"outline",waiting_review:"outline",retrying:"outline",done:"secondary",failed:"destructive",cancelled:"outline"};function IK({issue:e,workspaceId:i,t:n,setEditOpen:r,setInfoOpen:s,startIssue:o,resumeIssue:a,members:l,enabledAgents:c}){return(0,iM.jsxs)("div",{className:"shrink-0 p-4 pb-3 border-b",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon-sm",className:"md:hidden shrink-0",onClick:()=>IT.getState().setActivePanel("issue-list"),children:(0,iM.jsx)(my.ArrowLeft,{className:"size-4"})}),(0,iM.jsx)("h2",{className:"text-lg font-semibold truncate shrink min-w-0",children:e.title}),(0,iM.jsx)(mj.Badge,{variant:IV[e.status],children:n(`status.${e.status}`)}),(0,iM.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon-sm",onClick:()=>r(!0),children:(0,iM.jsx)(mc.Pencil,{className:"size-4"})}),(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon-sm",title:n("detail.openChatChannel"),onClick:()=>{e?.channelId&&mM.useChannelStore.getState().setActiveChannel(e.channelId)},children:(0,iM.jsx)(IU,{className:"size-4"})}),(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon-sm",onClick:()=>s(!0),children:(0,iM.jsx)(Is,{className:"size-4"})})]})]}),(0,iM.jsxs)("div",{className:"flex items-center gap-3 text-[11px] text-muted-foreground",children:[l.length>0&&(0,iM.jsxs)("span",{className:"flex items-center gap-1",children:[(0,iM.jsx)(IS,{children:l.slice(0,4).map(e=>(0,iM.jsx)(mP.AgentIcon,{agentId:"user"!==e?e:void 0,name:mH(c,e),className:"size-6 rounded-full"},e))}),(0,iM.jsx)("span",{children:n("detail.memberCount",{count:l.length})})]}),(0,iM.jsxs)("span",{className:"flex items-center gap-1",children:[(0,iM.jsx)(mK,{className:"h-3 w-3"}),n("detail.created")," ",new Date(e.createdAt).toLocaleDateString()]}),(0,iM.jsxs)("span",{className:"flex items-center gap-1",children:[(0,iM.jsx)(mK,{className:"h-3 w-3"}),n("detail.updated")," ",new Date(e.updatedAt).toLocaleDateString()]}),e.branch&&(0,iM.jsxs)("span",{className:"flex items-center gap-1",children:[(0,iM.jsx)(I$.GitBranch,{className:"h-3 w-3"}),e.branch]}),e.prUrl&&(0,iM.jsxs)("span",{children:[n("detail.pr")," ",e.prUrl]})]}),e.description&&(0,iM.jsx)("p",{className:"text-sm text-muted-foreground mt-2",children:e.description}),"draft"===e.status&&(0,iM.jsx)("div",{className:"mt-2",children:(0,iM.jsxs)(f7.Button,{size:"sm",variant:"outline",onClick:()=>o(i,e.id),children:[(0,iM.jsx)(ml,{className:"h-3 w-3 mr-1"}),n("detail.start")]})}),"error"===e.status&&(0,iM.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,iM.jsxs)(f7.Button,{size:"sm",variant:"outline",onClick:()=>a(i,e.id),children:[(0,iM.jsx)(IW.RotateCcw,{className:"h-3 w-3 mr-1"}),n("detail.resumeFailed")]}),e.retryPaused&&(0,iM.jsx)("span",{className:"text-[11px] text-muted-foreground",children:n("detail.retryPaused",{failed:e.retryCount,total:e.maxRetries})})]})]})}var IY=Symbol.for("preact-signals");function IX(){if(I7>1)I7--;else{var e,i=!1,n=Pn;for(Pn=void 0;void 0!==n;)n.S.v===n.v&&(n.S.i=n.i),n=n.o;for(;void 0!==I9;){var r=I9;for(I9=void 0,Pe++;void 0!==r;){var s=r.u;if(r.u=void 0,r.f&=-3,!(8&r.f)&&Pl(r))try{r.c()}catch(n){i||(e=n,i=!0)}r=s}}if(Pe=0,I7--,i)throw e}}function IJ(e){if(I7>0)return e();Pi=++Pt,I7++;try{return e()}finally{IX()}}var IG=void 0;function IZ(e){var i=IG;IG=void 0;try{return e()}finally{IG=i}}var IQ,I0,I1,I2,I5,I3,I4,I6,I8,I9=void 0,I7=0,Pe=0,Pt=0,Pi=0,Pn=void 0,Pr=0;function Ps(e){if(void 0!==IG){var i=e.n;if(void 0===i||i.t!==IG)return i={i:0,S:e,p:IG.s,n:void 0,t:IG,e:void 0,x:void 0,r:i},void 0!==IG.s&&(IG.s.n=i),IG.s=i,e.n=i,32&IG.f&&e.S(i),i;if(-1===i.i)return i.i=0,void 0!==i.n&&(i.n.p=i.p,void 0!==i.p&&(i.p.n=i.n),i.p=IG.s,i.n=void 0,IG.s.n=i,IG.s=i),i}}function Po(e,i){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=null==i?void 0:i.watched,this.Z=null==i?void 0:i.unwatched,this.name=null==i?void 0:i.name}function Pa(e,i){return new Po(e,i)}function Pl(e){for(var i=e.s;void 0!==i;i=i.n)if(i.S.i!==i.i||!i.S.h()||i.S.i!==i.i)return!0;return!1}function Pc(e){for(var i=e.s;void 0!==i;i=i.n){var n=i.S.n;if(void 0!==n&&(i.r=n),i.S.n=i,i.i=-1,void 0===i.n){e.s=i;break}}}function Pd(e){for(var i=e.s,n=void 0;void 0!==i;){var r=i.p;-1===i.i?(i.S.U(i),void 0!==r&&(r.n=i.n),void 0!==i.n&&(i.n.p=r)):n=i,i.S.n=i.r,void 0!==i.r&&(i.r=void 0),i=r}e.s=n}function Ph(e,i){Po.call(this,void 0),this.x=e,this.s=void 0,this.g=Pr-1,this.f=4,this.W=null==i?void 0:i.watched,this.Z=null==i?void 0:i.unwatched,this.name=null==i?void 0:i.name}function Pu(e){var i=e.m;if(e.m=void 0,"function"==typeof i){I7++;var n=IG;IG=void 0;try{i()}catch(i){throw e.f&=-2,e.f|=8,Pp(e),i}finally{IG=n,IX()}}}function Pp(e){for(var i=e.s;void 0!==i;i=i.n)i.S.U(i);e.x=void 0,e.s=void 0,Pu(e)}function Pf(e){if(IG!==this)throw Error("Out-of-order effect");Pd(this),IG=e,this.f&=-2,8&this.f&&Pp(this),IX()}function Pm(e,i){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=null==i?void 0:i.name,I8&&I8.push(this)}function Pg(e,i){var n=new Pm(e,i);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}Po.prototype.brand=IY,Po.prototype.h=function(){return!0},Po.prototype.S=function(e){var i=this,n=this.t;n!==e&&void 0===e.e&&(e.x=n,this.t=e,void 0!==n?n.e=e:IZ(function(){var e;null==(e=i.W)||e.call(i)}))},Po.prototype.U=function(e){var i=this;if(void 0!==this.t){var n=e.e,r=e.x;void 0!==n&&(n.x=r,e.e=void 0),void 0!==r&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,void 0===r&&IZ(function(){var e;null==(e=i.Z)||e.call(i)}))}},Po.prototype.subscribe=function(e){var i=this;return Pg(function(){var n=i.value,r=IG;IG=void 0;try{e(n)}finally{IG=r}},{name:"sub"})},Po.prototype.valueOf=function(){return this.value},Po.prototype.toString=function(){return this.value+""},Po.prototype.toJSON=function(){return this.value},Po.prototype.peek=function(){var e=IG;IG=void 0;try{return this.value}finally{IG=e}},Object.defineProperty(Po.prototype,"value",{get:function(){var e=Ps(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Pe>100)throw Error("Cycle detected");0!==I7&&0===Pe&&this.l!==Pi&&(this.l=Pi,Pn={S:this,v:this.v,i:this.i,o:Pn}),this.v=e,this.i++,Pr++,I7++;try{for(var i=this.t;void 0!==i;i=i.x)i.t.N()}finally{IX()}}}}),Ph.prototype=new Po,Ph.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f)||(this.f&=-5,this.g===Pr))return!0;if(this.g=Pr,this.f|=1,this.i>0&&!Pl(this))return this.f&=-2,!0;var e=IG;try{Pc(this),IG=this;var i=this.x();(16&this.f||this.v!==i||0===this.i)&&(this.v=i,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return IG=e,Pd(this),this.f&=-2,!0},Ph.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var i=this.s;void 0!==i;i=i.n)i.S.S(i)}Po.prototype.S.call(this,e)},Ph.prototype.U=function(e){if(void 0!==this.t&&(Po.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var i=this.s;void 0!==i;i=i.n)i.S.U(i)}},Ph.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Ph.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var e=Ps(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Pm.prototype.c=function(){var e=this.S();try{if(8&this.f||void 0===this.x)return;var i=this.x();"function"==typeof i&&(this.m=i)}finally{e()}},Pm.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,Pu(this),Pc(this),I7++;var e=IG;return IG=this,Pf.bind(this,e)},Pm.prototype.N=function(){2&this.f||(this.f|=2,this.u=I9,I9=this)},Pm.prototype.d=function(){this.f|=8,1&this.f||Pp(this)},Pm.prototype.dispose=function(){this.d()};var Pv=Object.create,Py=Object.defineProperty,P_=Object.defineProperties,Px=Object.getOwnPropertyDescriptor,Pb=Object.getOwnPropertyDescriptors,Pw=Object.getOwnPropertySymbols,PS=Object.prototype.hasOwnProperty,Pk=Object.prototype.propertyIsEnumerable,PC=e=>{throw TypeError(e)},PT=(e,i,n)=>i in e?Py(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,PE=(e,i)=>Py(e,"name",{value:i,configurable:!0}),PD=["class","method","getter","setter","accessor","field","value","get","set"],PN=e=>void 0!==e&&"function"!=typeof e?PC("Function expected"):e,PM=(e,i,n,r,s)=>({kind:PD[e],name:i,metadata:r,addInitializer:e=>n._?PC("Already initialized"):s.push(PN(e||null))}),PO=(e,i)=>{let n,r;return PT(i,(n="metadata",(r=Symbol[n])?r:Symbol.for("Symbol."+n)),e[3])},PR=(e,i,n,r)=>{for(var s=0,o=e[i>>1],a=o&&o.length;s<a;s++)1&i?o[s].call(n):r=o[s].call(n,r);return r},PA=(e,i,n,r,s,o)=>{var a,l,c,d,h,u=7&i,p=!!(8&i),f=!!(16&i),m=u>3?e.length+1:u?p?1:2:0,g=PD[u+5],v=u>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),_=u&&(f||p||(s=s.prototype),u<5&&(u>3||!f)&&Px(u<4?s:{get[n](){return PI(this,o)},set[n](x){return PB(this,o,x)}},n));u?f&&u<4&&PE(o,(u>2?"set ":u>1?"get ":"")+n):PE(s,n);for(var b=r.length-1;b>=0;b--)d=PM(u,n,c={},e[3],y),u&&(d.static=p,d.private=f,h=d.access={has:f?e=>Pj(s,e):e=>n in e},3^u&&(h.get=f?e=>(1^u?PI:Pz)(e,s,4^u?o:_.get):e=>e[n]),u>2&&(h.set=f?(e,i)=>PB(e,s,i,4^u?o:_.set):(e,i)=>e[n]=i)),l=(0,r[b])(u?u<4?f?o:_[g]:u>4?void 0:{get:_.get,set:_.set}:s,d),c._=1,4^u||void 0===l?PN(l)&&(u>4?v.unshift(l):u?f?o=l:_[g]=l:s=l):"object"!=typeof l||null===l?PC("Object expected"):(PN(a=l.get)&&(_.get=a),PN(a=l.set)&&(_.set=a),PN(a=l.init)&&v.unshift(a));return u||PO(e,s),_&&Py(s,n,_),f?4^u?o:_:s},PL=(e,i,n)=>i.has(e)||PC("Cannot "+n),Pj=(e,i)=>Object(i)!==i?PC('Cannot use the "in" operator on this value'):e.has(i),PI=(e,i,n)=>(PL(e,i,"read from private field"),n?n.call(e):i.get(e)),PP=(e,i,n)=>i.has(e)?PC("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,n),PB=(e,i,n,r)=>(PL(e,i,"write to private field"),r?r.call(e,n):i.set(e,n),n),Pz=(e,i,n)=>(PL(e,i,"access private method"),n);function PF(e,i){if(i){let n;return new Ph(()=>{let r=e();return r&&n&&i(n,r)?n:(n=r,r)},void 0)}return new Ph(e,void 0)}function PH(e,i){if(Object.is(e,i))return!0;if(null===e||null===i)return!1;if("function"==typeof e&&"function"==typeof i)return e===i;if(e instanceof Set&&i instanceof Set){if(e.size!==i.size)return!1;for(let n of e)if(!i.has(n))return!1;return!0}if(Array.isArray(e))return!!Array.isArray(i)&&e.length===i.length&&!e.some((e,n)=>!PH(e,i[n]));if("object"==typeof e&&"object"==typeof i){let n=Object.keys(e),r=Object.keys(i);return n.length===r.length&&!n.some(n=>!PH(e[n],i[n]))}return!1}function PW({get:e},i){return{init:e=>Pa(e),get(){return e.call(this).value},set(i){let n=e.call(this);n.peek()!==i&&(n.value=i)}}}function P$(e,i){let n=new WeakMap;return function(){let i=n.get(this);return i||(i=PF(e.bind(this)),n.set(this,i)),i.value}}function PU(e=!0){return function(i,n){n.addInitializer(function(){let i="field"===n.kind||n.static?this:Object.getPrototypeOf(this),r=Object.getOwnPropertyDescriptor(i,n.name);r&&Object.defineProperty(i,n.name,P_(((e,i)=>{for(var n in i||(i={}))PS.call(i,n)&&PT(e,n,i[n]);if(Pw)for(var n of Pw(i))Pk.call(i,n)&&PT(e,n,i[n]);return e})({},r),Pb({enumerable:e})))})}}function PV(...e){let i=e.map(e=>Pg(e));return()=>i.forEach(e=>e())}j=[PW],L=[PW],A=[PW],R=[PU()],O=[PU()],M=[PU()];var Pq=class{constructor(e,i=Object.is){this.defaultValue=e,this.equals=i,PR(I,5,this),PP(this,H),PP(this,P,PR(I,8,this)),PR(I,11,this),PP(this,W,PR(I,12,this)),PR(I,15,this),PP(this,q,PR(I,16,this)),PR(I,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return PI(this,H,Y)}get initial(){return PI(this,H,z)}get previous(){return PI(this,H,U)}set current(e){let i=IZ(()=>PI(this,H,Y));e&&i&&this.equals(i,e)||IJ(()=>{PI(this,H,z)||PB(this,H,e,F),PB(this,H,i,V),PB(this,H,e,X)})}reset(e=this.defaultValue){IJ(()=>{PB(this,H,void 0,V),PB(this,H,e,F),PB(this,H,e,X)})}};function PK(e){return IZ(()=>{let i={};for(let n in e)i[n]=e[n];return i})}I=[,,,Pv(null)],P=new WeakMap,H=new WeakSet,W=new WeakMap,q=new WeakMap,z=(B=PA(I,20,"#initial",j,H,P)).get,F=B.set,U=($=PA(I,20,"#previous",L,H,W)).get,V=$.set,Y=(K=PA(I,20,"#current",A,H,q)).get,X=K.set,PA(I,2,"current",R,Pq),PA(I,2,"initial",O,Pq),PA(I,2,"previous",M,Pq),PO(I,Pq);var PY=class{constructor(){PP(this,J,new WeakMap)}get(e,i){var n;return e?null==(n=PI(this,J).get(e))?void 0:n.get(i):void 0}set(e,i,n){var r;if(e)return PI(this,J).has(e)||PI(this,J).set(e,new Map),null==(r=PI(this,J).get(e))?void 0:r.set(i,n)}clear(e){var i;return e?null==(i=PI(this,J).get(e))?void 0:i.clear():void 0}};J=new WeakMap;var PX=Object.create,PJ=Object.defineProperty,PG=Object.getOwnPropertyDescriptor,PZ=Object.getOwnPropertySymbols,PQ=Object.prototype.hasOwnProperty,P0=Object.prototype.propertyIsEnumerable,P1=(e,i)=>(i=Symbol[e])?i:Symbol.for("Symbol."+e),P2=e=>{throw TypeError(e)},P5=Math.pow,P3=(e,i,n)=>i in e?PJ(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,P4=(e,i)=>PJ(e,"name",{value:i,configurable:!0}),P6=["class","method","getter","setter","accessor","field","value","get","set"],P8=e=>void 0!==e&&"function"!=typeof e?P2("Function expected"):e,P9=(e,i,n,r,s)=>({kind:P6[e],name:i,metadata:r,addInitializer:e=>n._?P2("Already initialized"):s.push(P8(e||null))}),P7=(e,i)=>P3(i,P1("metadata"),e[3]),Be=(e,i,n,r,s,o)=>{var a,l,c,d,h,u=7&i,p=!!(8&i),f=!!(16&i),m=u>3?e.length+1:u?p?1:2:0,g=P6[u+5],v=u>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),_=u&&(f||p||(s=s.prototype),u<5&&(u>3||!f)&&PG(u<4?s:{get[n](){return Bn(this,o)},set[n](x){return Br(this,o,x)}},n));u?f&&u<4&&P4(o,(u>2?"set ":u>1?"get ":"")+n):P4(s,n);for(var b=r.length-1;b>=0;b--)d=P9(u,n,c={},e[3],y),u&&(d.static=p,d.private=f,h=d.access={has:f?e=>Bi(s,e):e=>n in e},3^u&&(h.get=f?e=>(1^u?Bn:Bs)(e,s,4^u?o:_.get):e=>e[n]),u>2&&(h.set=f?(e,i)=>Br(e,s,i,4^u?o:_.set):(e,i)=>e[n]=i)),l=(0,r[b])(u?u<4?f?o:_[g]:u>4?void 0:{get:_.get,set:_.set}:s,d),c._=1,4^u||void 0===l?P8(l)&&(u>4?v.unshift(l):u?f?o=l:_[g]=l:s=l):"object"!=typeof l||null===l?P2("Object expected"):(P8(a=l.get)&&(_.get=a),P8(a=l.set)&&(_.set=a),P8(a=l.init)&&v.unshift(a));return u||P7(e,s),_&&PJ(s,n,_),f?4^u?o:_:s},Bt=(e,i,n)=>i.has(e)||P2("Cannot "+n),Bi=(e,i)=>Object(i)!==i?P2('Cannot use the "in" operator on this value'):e.has(i),Bn=(e,i,n)=>(Bt(e,i,"read from private field"),n?n.call(e):i.get(e)),Br=(e,i,n,r)=>(Bt(e,i,"write to private field"),r?r.call(e,n):i.set(e,n),n),Bs=(e,i,n)=>(Bt(e,i,"access private method"),n),Bo=class e{constructor(e,i){this.x=e,this.y=i}static delta(i,n){return new e(i.x-n.x,i.y-n.y)}static distance(e,i){return Math.hypot(e.x-i.x,e.y-i.y)}static equals(e,i){return e.x===i.x&&e.y===i.y}static from({x:i,y:n}){return new e(i,n)}},Ba=class e{constructor(e,i,n,r){this.left=e,this.top=i,this.width=n,this.height=r,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(i,n){let{top:r,left:s,width:o,height:a,scale:l}=this,c=new e(s+i,r+n,o,a);return c.scale=((e,i)=>{for(var n in i||(i={}))PQ.call(i,n)&&P3(e,n,i[n]);if(PZ)for(var n of PZ(i))P0.call(i,n)&&P3(e,n,i[n]);return e})({},l),c}get boundingRectangle(){let{width:e,height:i,left:n,top:r,right:s,bottom:o}=this;return{width:e,height:i,left:n,top:r,right:s,bottom:o}}get center(){let{left:e,top:i,right:n,bottom:r}=this;return new Bo((e+n)/2,(i+r)/2)}get area(){let{width:e,height:i}=this;return e*i}equals(i){if(!(i instanceof e))return!1;let{left:n,top:r,width:s,height:o}=this;return n===i.left&&r===i.top&&s===i.width&&o===i.height}containsPoint(e){let{top:i,left:n,bottom:r,right:s}=this;return i<=e.y&&e.y<=r&&n<=e.x&&e.x<=s}intersectionArea(i){var n,r;let s,o,a,l;return i instanceof e?(n=this,s=Math.max((r=i).top,n.top),o=Math.max(r.left,n.left),a=Math.min(r.left+r.width,n.left+n.width),l=Math.min(r.top+r.height,n.top+n.height),o<a&&s<l?(a-o)*(l-s):0):0}intersectionRatio(e){let{area:i}=this,n=this.intersectionArea(e);return n/(e.area+i-n)}get bottom(){let{top:e,height:i}=this;return e+i}get right(){let{left:e,width:i}=this;return e+i}get aspectRatio(){let{width:e,height:i}=this;return e/i}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:i,left:n,width:r,height:s}){return new e(n,i,r,s)}static delta(e,i,n={x:"center",y:"center"}){let r=(e,i)=>{let r=n[i],s="x"===i?e.left:e.top,o="x"===i?e.width:e.height;return"start"==r?s:"end"==r?s+o:s+o/2};return Bo.delta({x:r(e,"x"),y:r(e,"y")},{x:r(i,"x"),y:r(i,"y")})}static intersectionRatio(i,n){return e.from(i).intersectionRatio(e.from(n))}},Bl=class extends(Q=Pq,Z=[P$],G=[P$],Q){constructor(e){super(Bo.from(e),(e,i)=>Bo.equals(e,i)),((e,i,n,r)=>{for(var s=0,o=e[i>>1],a=o&&o.length;s<a;s++)1&i?o[s].call(n):r=o[s].call(n,r)})(et,5,this),((e,i,n)=>i.has(e)?P2("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,n))(this,ee,0),this.velocity={x:0,y:0}}get delta(){return Bo.delta(this.current,this.initial)}get direction(){let{current:e,previous:i}=this;if(!i)return null;let n={x:e.x-i.x,y:e.y-i.y};return n.x||n.y?Math.abs(n.x)>Math.abs(n.y)?n.x>0?"right":"left":n.y>0?"down":"up":null}get current(){return super.current}set current(e){let{current:i}=this,n=Bo.from(e),r={x:n.x-i.x,y:n.y-i.y},s=Date.now(),o=s-Bn(this,ee),a=e=>Math.round(e/o*100);IJ(()=>{Br(this,ee,s),this.velocity={x:a(r.x),y:a(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(Bo.from(e)),this.velocity={x:0,y:0}}};function Bc({x:e,y:i},n){let r=Math.abs(e),s=Math.abs(i);return"number"==typeof n?Math.sqrt(P5(r,2)+P5(s,2))>n:"x"in n&&"y"in n?r>n.x&&s>n.y:"x"in n?r>n.x:"y"in n&&s>n.y}et=[,,,PX(null!=(b=null==Q?void 0:Q[P1("metadata")])?b:null)],ee=new WeakMap,Be(et,2,"delta",Z,Bl),Be(et,2,"direction",G,Bl),P7(et,Bl);var Bd=((w=Bd||{}).Horizontal="x",w.Vertical="y",w),Bh=Object.values(Bd),Bu=Object.create,Bp=Object.defineProperty,Bf=Object.defineProperties,Bm=Object.getOwnPropertyDescriptor,Bg=Object.getOwnPropertyDescriptors,Bv=Object.getOwnPropertySymbols,By=Object.prototype.hasOwnProperty,B_=Object.prototype.propertyIsEnumerable,Bx=(e,i)=>(i=Symbol[e])?i:Symbol.for("Symbol."+e),Bb=e=>{throw TypeError(e)},Bw=(e,i,n)=>i in e?Bp(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,BS=(e,i)=>{for(var n in i||(i={}))By.call(i,n)&&Bw(e,n,i[n]);if(Bv)for(var n of Bv(i))B_.call(i,n)&&Bw(e,n,i[n]);return e},Bk=(e,i)=>Bf(e,Bg(i)),BC=(e,i)=>Bp(e,"name",{value:i,configurable:!0}),BT=(e,i)=>{var n={};for(var r in e)By.call(e,r)&&0>i.indexOf(r)&&(n[r]=e[r]);if(null!=e&&Bv)for(var r of Bv(e))0>i.indexOf(r)&&B_.call(e,r)&&(n[r]=e[r]);return n},BE=e=>{var i;return[,,,Bu(null!=(i=null==e?void 0:e[Bx("metadata")])?i:null)]},BD=["class","method","getter","setter","accessor","field","value","get","set"],BN=e=>void 0!==e&&"function"!=typeof e?Bb("Function expected"):e,BM=(e,i,n,r,s)=>({kind:BD[e],name:i,metadata:r,addInitializer:e=>n._?Bb("Already initialized"):s.push(BN(e||null))}),BO=(e,i)=>Bw(i,Bx("metadata"),e[3]),BR=(e,i,n,r)=>{for(var s=0,o=e[i>>1],a=o&&o.length;s<a;s++)1&i?o[s].call(n):r=o[s].call(n,r);return r},BA=(e,i,n,r,s,o)=>{var a,l,c,d,h,u=7&i,p=!!(8&i),f=!!(16&i),m=u>3?e.length+1:u?p?1:2:0,g=BD[u+5],v=u>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),_=u&&(f||p||(s=s.prototype),u<5&&(u>3||!f)&&Bm(u<4?s:{get[n](){return BI(this,o)},set[n](x){return BB(this,o,x)}},n));u?f&&u<4&&BC(o,(u>2?"set ":u>1?"get ":"")+n):BC(s,n);for(var b=r.length-1;b>=0;b--)d=BM(u,n,c={},e[3],y),u&&(d.static=p,d.private=f,h=d.access={has:f?e=>Bj(s,e):e=>n in e},3^u&&(h.get=f?e=>(1^u?BI:Bz)(e,s,4^u?o:_.get):e=>e[n]),u>2&&(h.set=f?(e,i)=>BB(e,s,i,4^u?o:_.set):(e,i)=>e[n]=i)),l=(0,r[b])(u?u<4?f?o:_[g]:u>4?void 0:{get:_.get,set:_.set}:s,d),c._=1,4^u||void 0===l?BN(l)&&(u>4?v.unshift(l):u?f?o=l:_[g]=l:s=l):"object"!=typeof l||null===l?Bb("Object expected"):(BN(a=l.get)&&(_.get=a),BN(a=l.set)&&(_.set=a),BN(a=l.init)&&v.unshift(a));return u||BO(e,s),_&&Bp(s,n,_),f?4^u?o:_:s},BL=(e,i,n)=>i.has(e)||Bb("Cannot "+n),Bj=(e,i)=>Object(i)!==i?Bb('Cannot use the "in" operator on this value'):e.has(i),BI=(e,i,n)=>(BL(e,i,"read from private field"),n?n.call(e):i.get(e)),BP=(e,i,n)=>i.has(e)?Bb("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,n),BB=(e,i,n,r)=>(BL(e,i,"write to private field"),r?r.call(e,n):i.set(e,n),n),Bz=(e,i,n)=>(BL(e,i,"access private method"),n);function BF(e,i){return{plugin:e,options:i}}function BH(e){return i=>BF(e,i)}function BW(e){return"function"==typeof e?{plugin:e,options:void 0}:e}ei=[PW];var B$=class{constructor(e,i){this.manager=e,this.options=i,BP(this,er,BR(en,8,this,!1)),BR(en,11,this),BP(this,es,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return IZ(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){let i=Pg(e.bind(this));return BI(this,es).add(i),i}destroy(){BI(this,es).forEach(e=>e())}static configure(e){return BF(this,e)}};en=BE(null),er=new WeakMap,es=new WeakMap,BA(en,4,"disabled",ei,B$,er),BO(en,B$);var BU=class extends B${},BV=class{constructor(e){this.manager=e,this.instances=new Map,BP(this,eo,[])}get values(){return Array.from(this.instances.values())}set values(e){let i=e.map(BW).reduce((e,i)=>{let n=e.find(({plugin:e})=>e===i.plugin);return n?(n.options=i.options,e):[...e,i]},[]),n=i.map(({plugin:e})=>e);for(let e of BI(this,eo))if(!n.includes(e)){if(e.prototype instanceof BU)continue;this.unregister(e)}for(let{plugin:e,options:n}of i)this.register(e,n);BB(this,eo,n)}get(e){return this.instances.get(e)}register(e,i){let n=this.instances.get(e);if(n)return n.options!==i&&(n.options=i),n;let r=new e(this.manager,i);return this.instances.set(e,r),r}unregister(e){let i=this.instances.get(e);i&&(i.destroy(),this.instances.delete(e))}destroy(){for(let e of this.instances.values())e.destroy();this.instances.clear()}};function Bq(e,i){return e.priority===i.priority?e.type===i.type?i.value-e.value:i.type-e.type:i.priority-e.priority}eo=new WeakMap;var BK=[],BY=class extends B${constructor(e){super(e),BP(this,ea),BP(this,el),this.computeCollisions=this.computeCollisions.bind(this),BB(this,el,Pa(BK)),this.destroy=PV(()=>{let e=this.computeCollisions(),i=IZ(()=>this.manager.dragOperation.position.current);if(e!==BK){let e=BI(this,ea);if(BB(this,ea,i),e&&i.x==e.x&&i.y==e.y)return}else BB(this,ea,void 0);BI(this,el).value=e},()=>{let{dragOperation:e}=this.manager;e.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){IZ(()=>{e?BI(this,el).value=this.computeCollisions():BB(this,ea,void 0)})}computeCollisions(e,i){let{registry:n,dragOperation:r}=this.manager,{source:s,shape:o,status:a}=r;if(!a.initialized||!o)return BK;let l=[],c=[];for(let o of null!=e?e:n.droppables){if(o.disabled||s&&!o.accepts(s))continue;let e=null!=i?i:o.collisionDetector;if(!e)continue;c.push(o),o.shape;let n=IZ(()=>e({droppable:o,dragOperation:r}));n&&(null!=o.collisionPriority&&(n.priority=o.collisionPriority),l.push(n))}return 0===c.length?BK:(l.sort(Bq),l)}get collisions(){return BI(this,el).value}};ea=new WeakMap,el=new WeakMap,eh=[PW],ed=[PW],ec=[PW];var BX=class e{constructor(e,i){BP(this,em,BR(ef,8,this)),BR(ef,11,this),BP(this,eg),BP(this,ev,BR(ef,12,this)),BR(ef,15,this),BP(this,ey,BR(ef,16,this)),BR(ef,19,this);const{effects:n,id:r,data:s={},disabled:o=!1,register:a=!0}=e;let l=r;BB(this,eg,Pa(r)),this.manager=i,this.data=s,this.disabled=o,this.effects=()=>{var e;return[()=>{let{id:e,manager:i}=this;if(e!==l)return l=e,null==i||i.registry.register(this),()=>null==i?void 0:i.registry.unregister(this)},...null!=(e=null==n?void 0:n())?e:[]]},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),i&&a&&queueMicrotask(this.register)}get id(){var i,n;let r=BI(this,eg).value;return null!=(n=null==(i=e.pendingIdChanges)?void 0:i.get(this))?n:r}set id(i){var n,r;i!==(null!=(r=null==(n=e.pendingIdChanges)?void 0:n.get(this))?r:BI(this,eg).peek())&&(e.pendingIdChanges||(e.pendingIdChanges=new Map,queueMicrotask(()=>Bz(e,eu,ep).call(e))),e.pendingIdChanges.set(this,i))}register(){var e;return null==(e=this.manager)?void 0:e.registry.register(this)}unregister(){var e;null==(e=this.manager)||e.registry.unregister(this)}destroy(){var e;null==(e=this.manager)||e.registry.unregister(this)}};ef=BE(null),eu=new WeakSet,ep=function(){let e=BX.pendingIdChanges;BX.pendingIdChanges=null,e&&IJ(()=>{for(let[i,n]of e)BI(i,eg).value=n})},em=new WeakMap,eg=new WeakMap,ev=new WeakMap,ey=new WeakMap,BA(ef,4,"manager",eh,BX,em),BA(ef,4,"data",ed,BX,ev),BA(ef,4,"disabled",ec,BX,ey),BP(BX,eu),BO(ef,BX),BX.pendingIdChanges=null;var BJ=BX,BG=class{constructor(){this.map=Pa(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,i)=>{let n=this.map.peek(),r=n.get(e),s=()=>this.unregister(e,i);if(r===i)return s;if(r&&r.id===e){let e=this.cleanupFunctions.get(r);null==e||e(),this.cleanupFunctions.delete(r)}let o=new Map(n);for(let[r,s]of n)if(s===i&&r!==e){o.delete(r);break}o.set(e,i),this.map.value=o;let a=PV(...i.effects());return this.cleanupFunctions.set(i,a),s},this.unregister=(e,i)=>{let n=this.map.peek();if(n.get(e)!==i)return;let r=this.cleanupFunctions.get(i);null==r||r(),this.cleanupFunctions.delete(i);let s=new Map(n);s.delete(e),this.map.value=s}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(let e of this){let i=this.cleanupFunctions.get(e);null==i||i(),e.destroy()}this.map.value=new Map}},BZ=class extends(eC=BJ,ek=[PW],eS=[PW],ew=[PW],eb=[P$],ex=[P$],e_=[P$],eC){constructor(e,i){var{modifiers:n,type:r,sensors:s,plugins:o,effects:a}=e,l=BT(e,["modifiers","type","sensors","plugins","effects"]);super(Bk(BS({},l),{effects:()=>{var e;return[...null!=(e=null==a?void 0:a())?e:[],()=>{let{manager:e,plugins:i}=this;if(e&&i)for(let n of i){let{plugin:i}=BW(n);e.registry.plugins.register(i)}}]}}),i),BR(eT,5,this),BP(this,eE,BR(eT,8,this)),BR(eT,11,this),BP(this,eD,BR(eT,12,this)),BR(eT,15,this),BP(this,eN,BR(eT,16,this,this.isDragSource?"dragging":"idle")),BR(eT,19,this),this.type=r,this.sensors=s,this.modifiers=n,this.alignment=l.alignment,this.plugins=o}pluginConfig(e){if(this.plugins)for(let i of this.plugins){let n=BW(i);if(n.plugin===e)return n.options}}get isDropping(){return"dropping"===this.status&&this.isDragSource}get isDragging(){return"dragging"===this.status&&this.isDragSource}get isDragSource(){var e,i;return(null==(i=null==(e=this.manager)?void 0:e.dragOperation.source)?void 0:i.id)===this.id}};eT=BE(eC),eE=new WeakMap,eD=new WeakMap,eN=new WeakMap,BA(eT,4,"type",ek,BZ,eE),BA(eT,4,"modifiers",eS,BZ,eD),BA(eT,4,"status",ew,BZ,eN),BA(eT,2,"isDropping",eb,BZ),BA(eT,2,"isDragging",ex,BZ),BA(eT,2,"isDragSource",e_,BZ),BO(eT,BZ);var BQ=class extends(eI=BJ,ej=[PW],eL=[PW],eA=[PW],eR=[PW],eO=[PW],eM=[P$],eI){constructor(e,i){var{accept:n,collisionDetector:r,collisionPriority:s,type:o}=e;super(BT(e,["accept","collisionDetector","collisionPriority","type"]),i),BR(eP,5,this),BP(this,eB,BR(eP,8,this)),BR(eP,11,this),BP(this,ez,BR(eP,12,this)),BR(eP,15,this),BP(this,eF,BR(eP,16,this)),BR(eP,19,this),BP(this,eH,BR(eP,20,this)),BR(eP,23,this),BP(this,eW,BR(eP,24,this)),BR(eP,27,this),this.accept=n,this.collisionDetector=r,this.collisionPriority=s,this.type=o}accepts(e){let{accept:i}=this;return!i||("function"==typeof i?i(e):!!e.type&&(Array.isArray(i)?i.includes(e.type):e.type===i))}get isDropTarget(){var e,i;return(null==(i=null==(e=this.manager)?void 0:e.dragOperation.target)?void 0:i.id)===this.id}};eP=BE(eI),eB=new WeakMap,ez=new WeakMap,eF=new WeakMap,eH=new WeakMap,eW=new WeakMap,BA(eP,4,"accept",ej,BQ,eB),BA(eP,4,"type",eL,BQ,ez),BA(eP,4,"collisionDetector",eA,BQ,eF),BA(eP,4,"collisionPriority",eR,BQ,eH),BA(eP,4,"shape",eO,BQ,eW),BA(eP,2,"isDropTarget",eM,BQ),BO(eP,BQ);var B0=class{constructor(){this.registry=new Map}addEventListener(e,i){let{registry:n}=this,r=new Set(n.get(e));return r.add(i),n.set(e,r),()=>this.removeEventListener(e,i)}removeEventListener(e,i){let{registry:n}=this,r=new Set(n.get(e));r.delete(i),n.set(e,r)}dispatch(e,...i){let{registry:n}=this,r=n.get(e);if(r)for(let e of r)e(...i)}},B1=class extends B0{constructor(e){super(),this.manager=e}dispatch(e,i){let n=[i,this.manager];super.dispatch(e,...n)}};function B2(e,i=!0){let n=!1;return Bk(BS({},e),{cancelable:i,get defaultPrevented(){return n},preventDefault(){i&&(n=!0)}})}var B5=class extends BU{constructor(e){super(e);let i=[];this.destroy=PV(()=>{let{dragOperation:n,collisionObserver:r}=e;n.status.initializing&&(i=[],r.enable())},()=>{let n,{collisionObserver:r,monitor:s}=e,{collisions:o}=r;if(r.isDisabled()||BJ.pendingIdChanges)return;let a=B2({collisions:o});if(s.dispatch("collision",a),a.defaultPrevented||(n=i,o.map(({id:e})=>e).join("")===n.map(({id:e})=>e).join("")))return;i=o;let[l]=o;IZ(()=>{var i;(null==l?void 0:l.id)!==(null==(i=e.dragOperation.target)?void 0:i.id)&&(r.disable(),e.actions.setDropTarget(null==l?void 0:l.id).then(()=>{r.enable()}))})})}},B3=((S=B3||{})[S.Lowest=0]="Lowest",S[S.Low=1]="Low",S[S.Normal=2]="Normal",S[S.High=3]="High",S[S.Highest=4]="Highest",S),B4=((k=B4||{})[k.Collision=0]="Collision",k[k.ShapeIntersection=1]="ShapeIntersection",k[k.PointerIntersection=2]="PointerIntersection",k);eX=[PW],eY=[P$],eK=[P$],eq=[P$],eV=[P$],eU=[P$],e$=[P$];var B6=class{constructor(){BR(eJ,5,this),BP(this,eG,BR(eJ,8,this,"idle")),BR(eJ,11,this)}get current(){return this.value}get idle(){return"idle"===this.value}get initializing(){return"initializing"===this.value}get initialized(){let{value:e}=this;return"idle"!==e&&"initialization-pending"!==e}get dragging(){return"dragging"===this.value}get dropped(){return"dropped"===this.value}set(e){this.value=e}};eJ=BE(null),eG=new WeakMap,BA(eJ,4,"value",eX,B6,eG),BA(eJ,2,"current",eY,B6),BA(eJ,2,"idle",eK,B6),BA(eJ,2,"initializing",eq,B6),BA(eJ,2,"initialized",eV,B6),BA(eJ,2,"dragging",eU,B6),BA(eJ,2,"dropped",e$,B6),BO(eJ,B6);var B8=class{constructor(e){this.manager=e}setDragSource(e){let{dragOperation:i}=this.manager;i.sourceIdentifier="string"==typeof e||"number"==typeof e?e:e.id}setDropTarget(e){return IZ(()=>{let{dragOperation:i}=this.manager,n=null!=e?e:null;if(i.targetIdentifier===n)return Promise.resolve(!1);i.targetIdentifier=n;let r=B2({operation:i.snapshot()});return i.status.dragging&&this.manager.monitor.dispatch("dragover",r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return IZ(()=>{let{dragOperation:i}=this.manager;if(null!=e.source&&this.setDragSource(e.source),!i.source)throw Error("Cannot start a drag operation without a drag source");if(!i.status.idle)throw Error("Cannot start a drag operation while another is active");let n=new AbortController,{event:r,coordinates:s}=e;IJ(()=>{i.status.set("initialization-pending"),i.shape=null,i.canceled=!1,i.activatorEvent=null!=r?r:null,i.position.reset(s)});let o=B2({operation:i.snapshot()});return(this.manager.monitor.dispatch("beforedragstart",o),o.defaultPrevented)?(i.reset(),n.abort()):(i.status.set("initializing"),i.controller=n,this.manager.renderer.rendering.then(()=>{if(n.signal.aborted)return;let{status:e}=i;"initializing"===e.current&&IJ(()=>{i.status.set("dragging"),this.manager.monitor.dispatch("dragstart",{nativeEvent:r,operation:i.snapshot(),cancelable:!1})})})),n})}move(e){return IZ(()=>{var i,n;let{dragOperation:r}=this.manager,{status:s,controller:o}=r;if(!s.dragging||!o||o.signal.aborted)return;let a=B2({nativeEvent:e.event,operation:r.snapshot(),by:e.by,to:e.to},null==(i=e.cancelable)||i);(null==(n=e.propagate)||n)&&this.manager.monitor.dispatch("dragmove",a),queueMicrotask(()=>{var i,n,s,o,l;if(a.defaultPrevented)return;let c=null!=(l=e.to)?l:{x:r.position.current.x+(null!=(n=null==(i=e.by)?void 0:i.x)?n:0),y:r.position.current.y+(null!=(o=null==(s=e.by)?void 0:s.y)?o:0)};r.position.current=c})})}stop(e={}){return IZ(()=>{var i,n;let r,{dragOperation:s}=this.manager,{controller:o}=s;if(!o||o.signal.aborted)return;o.abort();let a=()=>{this.manager.renderer.rendering.then(()=>{s.status.set("dropped");let e=IZ(()=>{var e;return(null==(e=s.source)?void 0:e.status)==="dropping"}),i=()=>{s.controller===o&&(s.controller=void 0),s.reset()};if(e){let{source:e}=s,n=Pg(()=>{(null==e?void 0:e.status)==="idle"&&(n(),i())})}else this.manager.renderer.rendering.then(i)})};s.canceled=null!=(i=e.canceled)&&i,this.manager.monitor.dispatch("dragend",{nativeEvent:e.event,operation:s.snapshot(),canceled:null!=(n=e.canceled)&&n,suspend:()=>{let e={resume:()=>{},abort:()=>{}};return r=new Promise((i,n)=>{e.resume=i,e.abort=n}),e}}),r?r.then(a).catch(()=>s.reset()):a()})}},B9=class extends B${constructor(e,i){super(e,i),this.manager=e,this.options=i}},B7=class extends AbortController{constructor(e,i){for(const n of(super(),this.constraints=e,this.onActivate=i,this.activated=!1,null!=e?e:[]))n.controller=this}onEvent(e){var i;if(!this.activated)if(null==(i=this.constraints)?void 0:i.length)for(let i of this.constraints)i.onEvent(e);else this.activate(e)}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},ze=class{constructor(e){this.options=e,BP(this,eZ)}set controller(e){BB(this,eZ,e),e.signal.addEventListener("abort",()=>this.abort())}activate(e){var i;null==(i=BI(this,eZ))||i.activate(e)}};eZ=new WeakMap;var zt=class extends B${constructor(e,i){super(e,i),this.manager=e,this.options=i}apply(e){return e.transform}},zi=class{constructor(e){this.draggables=new BG,this.droppables=new BG,this.plugins=new BV(e),this.sensors=new BV(e),this.modifiers=new BV(e)}register(e,i){if(e instanceof BZ)return this.draggables.register(e.id,e);if(e instanceof BQ)return this.droppables.register(e.id,e);if(e.prototype instanceof zt)return this.modifiers.register(e,i);if(e.prototype instanceof B9)return this.sensors.register(e,i);if(e.prototype instanceof B$)return this.plugins.register(e,i);throw Error("Invalid instance type")}unregister(e){if(e instanceof BJ)return e instanceof BZ?this.draggables.unregister(e.id,e):e instanceof BQ?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof zt)return this.modifiers.unregister(e);if(e.prototype instanceof B9)return this.sensors.unregister(e);if(e.prototype instanceof B$)return this.plugins.unregister(e);throw Error("Invalid instance type")}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}};e8=[P$],e6=[PW],e4=[PW],e3=[PW],e5=[PW],e2=[PW],e1=[P$],e0=[P$],eQ=[P$];var zn=class{constructor(e){BR(tt,5,this),BP(this,e9),BP(this,e7),BP(this,te,new Pq(void 0,(e,i)=>e&&i?e.equals(i):e===i)),this.status=new B6,BP(this,ti,BR(tt,8,this,!1)),BR(tt,11,this),BP(this,tn,BR(tt,12,this,null)),BR(tt,15,this),BP(this,tr,BR(tt,16,this,null)),BR(tt,19,this),BP(this,ts,BR(tt,20,this,null)),BR(tt,23,this),BP(this,to,BR(tt,24,this,[])),BR(tt,27,this),this.position=new Bl({x:0,y:0}),BP(this,ta,{x:0,y:0}),BB(this,e9,e)}get shape(){let{current:e,initial:i,previous:n}=BI(this,te);return e&&i?{current:e,initial:i,previous:n}:null}set shape(e){e?BI(this,te).current=e:BI(this,te).reset()}get source(){var e;let i=this.sourceIdentifier;if(null==i)return null;let n=BI(this,e9).registry.draggables.get(i);return n&&BB(this,e7,n),null!=(e=null!=n?n:BI(this,e7))?e:null}get target(){var e;let i=this.targetIdentifier;return null!=i&&null!=(e=BI(this,e9).registry.droppables.get(i))?e:null}get transform(){let{x:e,y:i}=this.position.delta,n={x:e,y:i};for(let e of this.modifiers)n=e.apply(Bk(BS({},this.snapshot()),{transform:n}));return BB(this,ta,n),n}snapshot(){return IZ(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:BI(this,ta),shape:this.shape?PK(this.shape):null,position:PK(this.position),status:PK(this.status),canceled:this.canceled}))}reset(){IJ(()=>{this.status.set("idle"),this.sourceIdentifier=null,this.targetIdentifier=null,BI(this,te).reset(),this.position.reset({x:0,y:0}),BB(this,ta,{x:0,y:0}),this.modifiers=[]})}};tt=BE(null),e9=new WeakMap,e7=new WeakMap,te=new WeakMap,ti=new WeakMap,tn=new WeakMap,tr=new WeakMap,ts=new WeakMap,to=new WeakMap,ta=new WeakMap,BA(tt,2,"shape",e8,zn),BA(tt,4,"canceled",e6,zn,ti),BA(tt,4,"activatorEvent",e4,zn,tn),BA(tt,4,"sourceIdentifier",e3,zn,tr),BA(tt,4,"targetIdentifier",e5,zn,ts),BA(tt,4,"modifiers",e2,zn,to),BA(tt,2,"source",e1,zn),BA(tt,2,"target",e0,zn),BA(tt,2,"transform",eQ,zn),BO(tt,zn);var zr={get rendering(){return Promise.resolve()}};function zs(e,i){return"function"==typeof e?e(i):null!=e?e:i}var zo=class{constructor(e){var i;this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(e=>e.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};const n=null!=e?e:{},r=zs(n.plugins,[]),s=zs(n.sensors,[]),o=zs(n.modifiers,[]),a=null!=(i=n.renderer)?i:zr,l=new B1(this),c=new zi(this);this.registry=c,this.monitor=l,this.renderer=a,this.actions=new B8(this),this.dragOperation=new zn(this),this.collisionObserver=new BY(this),this.plugins=[B5,...r],this.modifiers=o,this.sensors=s;const{destroy:d}=this,h=PV(()=>{var e,i,n;let r=IZ(()=>this.dragOperation.modifiers),s=this.modifiers;for(let e of r)s.includes(e)||e.destroy();this.dragOperation.modifiers=null!=(n=null==(i=null==(e=this.dragOperation.source)?void 0:e.modifiers)?void 0:i.map(e=>{let{plugin:i,options:n}=BW(e);return new i(this,n)}))?n:s});this.destroy=()=>{h(),d()}}get plugins(){return this.registry.plugins.values}set plugins(e){this.registry.plugins.values=e}get modifiers(){return this.registry.modifiers.values}set modifiers(e){this.registry.modifiers.values=e}get sensors(){return this.registry.sensors.values}set sensors(e){this.registry.sensors.values=e}},za=e=>{throw TypeError(e)},zl=(e,i,n)=>i.has(e)||za("Cannot "+n),zc=(e,i,n)=>(zl(e,i,"read from private field"),i.get(e)),zd=(e,i,n)=>i.has(e)?za("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,n),zh=(e,i,n,r)=>(zl(e,i,"write to private field"),i.set(e,n),n),zu=(e,i,n)=>(zl(e,i,"access private method"),n);function zp(e){return!!e&&(e instanceof KeyframeEffect||"getKeyframes"in e&&"function"==typeof e.getKeyframes)}function zf(e,i){let n=e.getAnimations(),r=null;for(let e of n){if("running"!==e.playState)continue;let{effect:n}=e,s=(zp(n)?n.getKeyframes():[]).filter(i);s.length>0&&(r=[s[s.length-1],e])}return r}function zm(e){let{width:i,height:n,top:r,left:s,bottom:o,right:a}=e.getBoundingClientRect();return{width:i,height:n,top:r,left:s,bottom:o,right:a}}function zg(e){let i=Object.prototype.toString.call(e);return"[object Window]"===i||"[object global]"===i}function zv(e){return"nodeType"in e}function zy(e){var i,n,r;return e?zg(e)?e:zv(e)?"defaultView"in e?null!=(i=e.defaultView)?i:window:null!=(r=null==(n=e.ownerDocument)?void 0:n.defaultView)?r:window:window:window}function z_(e){let{Document:i}=zy(e);return e instanceof i||"nodeType"in e&&e.nodeType===Node.DOCUMENT_NODE}function zx(e){return!(!e||zg(e))&&(e instanceof zy(e).HTMLElement||"namespaceURI"in e&&"string"==typeof e.namespaceURI&&e.namespaceURI.endsWith("html"))}function zb(e){return e instanceof zy(e).SVGElement||"namespaceURI"in e&&"string"==typeof e.namespaceURI&&e.namespaceURI.endsWith("svg")}function zw(e){return e?zg(e)?e.document:zv(e)?z_(e)?e:zx(e)||zb(e)?e.ownerDocument:document:document:document}function zS(e,i=e.getBoundingClientRect(),n=0){var r,s,o,a,l;let c=i,{ownerDocument:d}=e,h=null!=(r=d.defaultView)?r:window,u=e.parentElement;for(;u&&u!==d.documentElement;){if(!function(e){if("DETAILS"===e.tagName&&!1===e.open)return!1;let{overflow:i,overflowX:n,overflowY:r}=getComputedStyle(e);return"visible"===i&&"visible"===n&&"visible"===r}(u)){let e=u.getBoundingClientRect(),i=n*(e.bottom-e.top),r=n*(e.right-e.left),s=n*(e.bottom-e.top),o=n*(e.right-e.left);(c={top:Math.max(c.top,e.top-i),right:Math.min(c.right,e.right+r),bottom:Math.min(c.bottom,e.bottom+s),left:Math.max(c.left,e.left-o),width:0,height:0}).width=c.right-c.left,c.height=c.bottom-c.top}u=u.parentElement}let p=h.visualViewport,f=null!=(s=null==p?void 0:p.offsetTop)?s:0,m=null!=(o=null==p?void 0:p.offsetLeft)?o:0,g=null!=(a=null==p?void 0:p.width)?a:h.innerWidth,v=null!=(l=null==p?void 0:p.height)?l:h.innerHeight,y=n*v,_=n*g;return(c={top:Math.max(c.top,f-y),right:Math.min(c.right,m+g+_),bottom:Math.min(c.bottom,f+v+y),left:Math.max(c.left,m-_),width:0,height:0}).width=c.right-c.left,c.height=c.bottom-c.top,c.width<0&&(c.width=0),c.height<0&&(c.height=0),c}function zk(e){return{x:e.clientX,y:e.clientY}}var zC="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function zT(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function zE(){var e,i;let n=zT()?window.visualViewport:null;return{x:null!=(e=null==n?void 0:n.offsetLeft)?e:0,y:null!=(i=null==n?void 0:n.offsetTop)?i:0}}function zD(e){return!!e&&!!zv(e)&&e instanceof zy(e).ShadowRoot}function zN(e){if(e&&zv(e)){let i=e.getRootNode();if(zD(i)||i instanceof Document)return i}return zw(e)}function zM(e){return e.matchMedia("(prefers-reduced-motion: reduce)").matches}function zO(e){return"value"in e}function zR(e){return"CANVAS"===e.tagName}var zA=new WeakMap,zL=class{constructor(){this.entries=new Set,this.clear=()=>{for(let e of this.entries){let[i,{type:n,listener:r,options:s}]=e;i.removeEventListener(n,r,s)}this.entries.clear()}}bind(e,i){let n=Array.isArray(e)?e:[e],r=Array.isArray(i)?i:[i],s=[];for(let e of n)for(let i of r){let{type:n,listener:r,options:o}=i,a=[e,i];e.addEventListener(n,r,o),this.entries.add(a),s.push(a)}let o=this.entries;return function(){for(let e of s){let[i,{type:n,listener:r,options:s}]=e;i.removeEventListener(n,r,s),o.delete(e)}}}};function zj(e){let i=null==e?void 0:e.ownerDocument.defaultView;if(i&&i.self!==i.parent)return i.frameElement}function zI(e,i){let n,r;return function(...s){let o=this;if(r){let a;null==n||n(),a=setTimeout(()=>{e.apply(o,s),r=performance.now()},i-(performance.now()-r)),n=()=>clearTimeout(a)}else e.apply(o,s),r=performance.now()}}var zP=zC?ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},zB=class extends zP{constructor(e){super(i=>{zc(this,tl)?e(i,this):zh(this,tl,!0)}),zd(this,tl,!1)}};tl=new WeakMap;var zz=Array.from({length:100},(e,i)=>i/100),zF=class{constructor(e,i,n={debug:!1,skipInitial:!1}){this.element=e,this.callback=i,zd(this,tv),this.disconnect=()=>{var e,i,n;zh(this,tm,!0),null==(e=zc(this,th))||e.disconnect(),null==(i=zc(this,tu))||i.disconnect(),zc(this,tp).disconnect(),null==(n=zc(this,tf))||n.remove()},zd(this,tc,!0),zd(this,td),zd(this,th),zd(this,tu),zd(this,tp),zd(this,tf),zd(this,tm,!1),zd(this,tg,zI(()=>{var e,i,n;let{element:r}=this;if(null==(e=zc(this,tu))||e.disconnect(),zc(this,tm)||!zc(this,tc)||!r.isConnected)return;let s=null!=(i=r.ownerDocument)?i:document,{innerHeight:o,innerWidth:a}=null!=(n=s.defaultView)?n:window,l=r.getBoundingClientRect(),{top:c,left:d,bottom:h,right:u}=zS(r,l),p=-Math.floor(c),f=-Math.floor(d),m=-Math.floor(a-u),g=-Math.floor(o-h),v=`${p}px ${m}px ${g}px ${f}px`;this.boundingClientRect=l,zh(this,tu,new IntersectionObserver(e=>{let[i]=e,{intersectionRect:n}=i;1!==(1!==i.intersectionRatio?i.intersectionRatio:Ba.intersectionRatio(n,zS(r)))&&zc(this,tg).call(this)},{threshold:zz,rootMargin:v,root:s})),zc(this,tu).observe(r),zu(this,tv,ty).call(this)},75)),this.boundingClientRect=e.getBoundingClientRect(),zh(this,tc,function(e,i=e.getBoundingClientRect()){let{width:n,height:r}=zS(e,i);return n>0&&r>0}(e,this.boundingClientRect));let r=!0;this.callback=e=>{r&&(r=!1,n.skipInitial)||i(e)};const s=e.ownerDocument;(null==n?void 0:n.debug)&&(zh(this,tf,document.createElement("div")),zc(this,tf).style.background="rgba(0,0,0,0.15)",zc(this,tf).style.position="fixed",zc(this,tf).style.pointerEvents="none",s.body.appendChild(zc(this,tf))),zh(this,tp,new IntersectionObserver(i=>{var n,r;let{boundingClientRect:s,isIntersecting:o}=i[i.length-1],{width:a,height:l}=s,c=zc(this,tc);zh(this,tc,o),(a||l)&&(c&&!o?(null==(n=zc(this,tu))||n.disconnect(),this.callback(null),null==(r=zc(this,th))||r.disconnect(),zh(this,th,void 0),zc(this,tf)&&(zc(this,tf).style.visibility="hidden")):zc(this,tg).call(this),o&&!zc(this,th)&&(zh(this,th,new zB(zc(this,tg))),zc(this,th).observe(e)))},{threshold:zz,root:s})),zc(this,tc)&&!n.skipInitial&&this.callback(this.boundingClientRect),zc(this,tp).observe(e)}};tc=new WeakMap,td=new WeakMap,th=new WeakMap,tu=new WeakMap,tp=new WeakMap,tf=new WeakMap,tm=new WeakMap,tg=new WeakMap,tv=new WeakSet,ty=function(){var e,i;!zc(this,tm)&&(zu(this,tv,t_).call(this),(e=this.boundingClientRect)===(i=zc(this,td))||e&&i&&e.top==i.top&&e.left==i.left&&e.right==i.right&&e.bottom==i.bottom||(this.callback(this.boundingClientRect),zh(this,td,this.boundingClientRect)))},t_=function(){if(zc(this,tf)){let{top:e,left:i,width:n,height:r}=zS(this.element);zc(this,tf).style.overflow="hidden",zc(this,tf).style.visibility="visible",zc(this,tf).style.top=`${Math.floor(e)}px`,zc(this,tf).style.left=`${Math.floor(i)}px`,zc(this,tf).style.width=`${Math.floor(n)}px`,zc(this,tf).style.height=`${Math.floor(r)}px`}};var zH=new WeakMap,zW=new WeakMap,z$=class{constructor(e,i,n){this.callback=i,zd(this,tx),zd(this,tb,!1),zd(this,tw),zd(this,tS,zI(e=>{if(!zc(this,tb)&&e.target&&"contains"in e.target&&"function"==typeof e.target.contains){for(let i of zc(this,tw))if(e.target.contains(i)){this.callback(zc(this,tx).boundingClientRect);break}}},75));const r=function(e){let i=new Set,n=zj(e);for(;n;)i.add(n),n=zj(n);return i}(e),s=function(e,i){let n=new Set;for(let r of e){let e=function(e,i){let n=zH.get(e);return n||(n={disconnect:new zF(e,i=>{let n=zH.get(e);n&&n.callbacks.forEach(e=>e(i))},{skipInitial:!0}).disconnect,callbacks:new Set}),n.callbacks.add(i),zH.set(e,n),()=>{n.callbacks.delete(i),0===n.callbacks.size&&(zH.delete(e),n.disconnect())}}(r,i);n.add(e)}return()=>n.forEach(e=>e())}(r,i),o=function(e,i){var n;let r=e.ownerDocument;if(!zW.has(r)){let e=new AbortController,i=new Set;document.addEventListener("scroll",e=>i.forEach(i=>i(e)),{capture:!0,passive:!0,signal:e.signal}),zW.set(r,{disconnect:()=>e.abort(),listeners:i})}let{listeners:s,disconnect:o}=null!=(n=zW.get(r))?n:{};return s&&o?(s.add(i),()=>{s.delete(i),0===s.size&&(o(),zW.delete(r))}):()=>{}}(e,zc(this,tS));zh(this,tw,r),zh(this,tx,new zF(e,i,n)),this.disconnect=()=>{zc(this,tb)||(zh(this,tb,!0),s(),o(),zc(this,tx).disconnect())}}};function zU(e){return"showPopover"in e&&"hidePopover"in e&&"function"==typeof e.showPopover&&"function"==typeof e.hidePopover}function zV(e){try{zU(e)&&e.isConnected&&e.hasAttribute("popover")&&!e.matches(":popover-open")&&e.showPopover()}catch(e){}}function zq(e){return!!zC&&!!e&&e===zw(e).scrollingElement}function zK(e){var i,n;let r=zy(e),s=zq(e)?function(e){var i,n,r,s;let{documentElement:o}=zw(e),a=zy(e).visualViewport,l=null!=(i=null==a?void 0:a.width)?i:o.clientWidth,c=null!=(n=null==a?void 0:a.height)?n:o.clientHeight,d=null!=(r=null==a?void 0:a.offsetTop)?r:0,h=null!=(s=null==a?void 0:a.offsetLeft)?s:0;return{top:d,left:h,right:h+l,bottom:d+c,width:l,height:c}}(e):zm(e),o=r.visualViewport,a=zq(e)?{height:null!=(i=null==o?void 0:o.height)?i:r.innerHeight,width:null!=(n=null==o?void 0:o.width)?n:r.innerWidth}:{height:e.clientHeight,width:e.clientWidth},l={current:{x:e.scrollLeft,y:e.scrollTop},max:{x:e.scrollWidth-a.width,y:e.scrollHeight-a.height}},c=l.current.y<=0,d=l.current.x<=0,h=l.current.y>=l.max.y,u=l.current.x>=l.max.x;return{rect:s,position:l,isTop:c,isLeft:d,isBottom:h,isRight:u}}tx=new WeakMap,tb=new WeakMap,tw=new WeakMap,tS=new WeakMap;var zY=class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{let{tasks:e,resolvers:i}=this;for(let i of(this.pending=!1,this.tasks=new Set,this.resolvers=new Set,e))i();for(let e of i)e()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(e=>this.resolvers.add(e))}},zX=new zY(e=>{"function"==typeof requestAnimationFrame?requestAnimationFrame(e):e()}),zJ=new zY(e=>setTimeout(e,50)),zG=new Map,zZ=zG.clear.bind(zG);function zQ(e,i=!1){if(!i)return z0(e);let n=zG.get(e);return n||(n=z0(e),zG.set(e,n),zJ.schedule(zZ)),n}function z0(e){return zy(e).getComputedStyle(e)}var z1={excludeElement:!0,escapeShadowDOM:!0};function z2(e,i=z1){let{limit:n,excludeElement:r,escapeShadowDOM:s}=i,o=new Set;return e?function i(a){if(null!=n&&o.size>=n||!a)return o;if(z_(a)&&null!=a.scrollingElement&&!o.has(a.scrollingElement))return o.add(a.scrollingElement),o;if(s&&zD(a))return i(a.host);if(!zx(a))return zb(a)?i(a.parentElement):o;if(o.has(a))return o;let l=zQ(a,!0);if(r&&a===e||function(e,i=zQ(e,!0)){let n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{let r=i[e];return"string"==typeof r&&n.test(r)})}(a,l)&&o.add(a),function(e,i=zQ(e,!0)){return"fixed"===i.position||"sticky"===i.position}(a,l)){let{scrollingElement:e}=a.ownerDocument;return e&&o.add(e),o}return i(a.parentNode)}(e):o}function z5(e,i=window.frameElement){let n={x:0,y:0,scaleX:1,scaleY:1};if(!e)return n;let r=zj(e);for(;r&&r!==i;){let e=zm(r),{x:i,y:s}=function(e,i=zm(e)){let n=Math.round(i.width),r=Math.round(i.height);if(zx(e))return{x:n/e.offsetWidth,y:r/e.offsetHeight};let s=zQ(e,!0);return{x:(parseFloat(s.width)||n)/n,y:(parseFloat(s.height)||r)/r}}(r,e);n.x=n.x+e.left,n.y=n.y+e.top,n.scaleX=n.scaleX*i,n.scaleY=n.scaleY*s,r=zj(r)}return n}function z3(e){if("none"===e)return null;let[i,n,r="0"]=e.split(" "),s={x:parseFloat(i),y:parseFloat(n),z:parseInt(r,10)};return isNaN(s.x)&&isNaN(s.y)?null:{x:isNaN(s.x)?0:s.x,y:isNaN(s.y)?0:s.y,z:isNaN(s.z)?0:s.z}}function z4(e){var i,n,r,s,o,a,l,c,d;let{scale:h,transform:u,translate:p}=e,f=function(e){if("none"===e)return null;let i=e.split(" "),n=parseFloat(i[0]),r=parseFloat(i[1]);return isNaN(n)&&isNaN(r)?null:{x:isNaN(n)?r:n,y:isNaN(r)?n:r}}(h),m=z3(p),g=function(e){if(e.startsWith("matrix3d(")){let i=e.slice(9,-1).split(/, /);return{x:+i[12],y:+i[13],scaleX:+i[0],scaleY:+i[5]}}if(e.startsWith("matrix(")){let i=e.slice(7,-1).split(/, /);return{x:+i[4],y:+i[5],scaleX:+i[0],scaleY:+i[3]}}return null}(u);if(!g&&!f&&!m)return null;let v={x:null!=(i=null==f?void 0:f.x)?i:1,y:null!=(n=null==f?void 0:f.y)?n:1},y={x:null!=(r=null==m?void 0:m.x)?r:0,y:null!=(s=null==m?void 0:m.y)?s:0},_={x:null!=(o=null==g?void 0:g.x)?o:0,y:null!=(a=null==g?void 0:g.y)?a:0,scaleX:null!=(l=null==g?void 0:g.scaleX)?l:1,scaleY:null!=(c=null==g?void 0:g.scaleY)?c:1};return{x:y.x+_.x,y:y.y+_.y,z:null!=(d=null==m?void 0:m.z)?d:0,scaleX:v.x*_.scaleX,scaleY:v.y*_.scaleY}}var z6=((C=z6||{})[C.Idle=0]="Idle",C[C.Forward=1]="Forward",C[C.Reverse=-1]="Reverse",C),z8={x:.2,y:.2},z9={x:10,y:10};function z7(e,{block:i="nearest",inline:n="nearest"}={}){if(!zx(e))return;let r=z2(e),s=[];for(let o of r){if(!zx(o))continue;let{top:r,left:a}=function(e,i){let n=Fe(e),r=Fe(i);return{top:n.top-r.top-i.clientTop,left:n.left-r.left-i.clientLeft}}(e,o),l=r,c=a;for(let e of s)l-=e.scrollTop,c-=e.scrollLeft;if("none"!==i){let n=l<o.scrollTop;n!==l+e.offsetHeight>o.scrollTop+o.clientHeight&&("center"===i?o.scrollTop=l-o.clientHeight/2+e.offsetHeight/2:n?o.scrollTop=l:o.scrollTop=l+e.offsetHeight-o.clientHeight)}if("none"!==n){let i=c<o.scrollLeft;i!==c+e.offsetWidth>o.scrollLeft+o.clientWidth&&("center"===n?o.scrollLeft=c-o.clientWidth/2+e.offsetWidth/2:i?o.scrollLeft=c:o.scrollLeft=c+e.offsetWidth-o.clientWidth)}s.push(o)}}function Fe(e){let i=0,n=0,r=e;for(;r;){i+=r.offsetTop,n+=r.offsetLeft;let e=r.offsetParent;if(!zx(e))break;i+=e.clientTop,n+=e.clientLeft,r=e}return{top:i,left:n}}function Ft({element:e,keyframes:i,options:n}){return e.animate(i,n).finished}function Fi(e,i=zQ(e).translate,n=!0){if(n){let i=zf(e,e=>"translate"in e);if(i){let{translate:e=""}=i[0];if("string"==typeof e){let i=z3(e);if(i)return i}}}if(i){let e=z3(i);if(e)return e}return{x:0,y:0,z:0}}var Fn=new zY(e=>setTimeout(e,0)),Fr=new Map,Fs=Fr.clear.bind(Fr),Fo=class extends Ba{constructor(e,i={}){var n,r,s,o;let a;const{frameTransform:l=z5(e),ignoreTransforms:c,getBoundingClientRect:d=zm}=i,h=function(e,i){let n=(function(e){let i=e.ownerDocument,n=Fr.get(i);if(n)return n;n=i.getAnimations(),Fr.set(i,n),Fn.schedule(Fs);let r=n.filter(i=>zp(i.effect)&&i.effect.target===e);return Fr.set(e,r),n})(e).filter(e=>{var n,r;if(zp(e.effect)){let{target:s}=e.effect;if(null==(r=s&&(null==(n=i.isValidTarget)?void 0:n.call(i,s)))||r)return e.effect.getKeyframes().some(e=>{for(let n of i.properties)if(e[n])return!0})}}).map(e=>{let{effect:i,currentTime:n}=e,r=null==i?void 0:i.getComputedTiming().duration;if(!e.pending&&"finished"!==e.playState&&"number"==typeof r&&"number"==typeof n&&n<r)return e.currentTime=r,()=>{e.currentTime=n}});if(n.length>0)return()=>n.forEach(e=>null==e?void 0:e())}(e,{properties:["transform","translate","scale","width","height"],isValidTarget:i=>(i!==e||zT())&&i.contains(e)}),u=d(e);let{top:p,left:f,width:m,height:g}=u;const v=zQ(e),y=z4(v),_={x:null!=(n=null==y?void 0:y.scaleX)?n:1,y:null!=(r=null==y?void 0:y.scaleY)?r:1},b=function(e,i){let n,r,s,o=e.getAnimations();if(!o.length)return null;let a=!1;for(let e of o){if("running"!==e.playState)continue;let i=zp(e.effect)?e.effect.getKeyframes():[],o=i[i.length-1];if(!o)continue;let{transform:l,translate:c,scale:d}=o;"string"==typeof l&&l&&(n=l,a=!0),"string"==typeof c&&c&&(r=c,a=!0),"string"==typeof d&&d&&(s=d,a=!0)}return a?z4({transform:null!=n?n:i.transform,translate:null!=r?r:i.translate,scale:null!=s?s:i.scale}):null}(e,v);null==h||h(),y&&(a=function(e,i,n){let{scaleX:r,scaleY:s,x:o,y:a}=i,l=e.left-o-(1-r)*parseFloat(n),c=e.top-a-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),d=r?e.width/r:e.width,h=s?e.height/s:e.height;return{width:d,height:h,top:c,right:l+d,bottom:c+h,left:l}}(u,y,v.transformOrigin),(c||b)&&(p=a.top,f=a.left,m=a.width,g=a.height));const w={width:null!=(s=null==a?void 0:a.width)?s:m,height:null!=(o=null==a?void 0:a.height)?o:g};if(b&&!c&&a){const e=function(e,i,n){let{scaleX:r,scaleY:s,x:o,y:a}=i,l=e.left+o+(1-r)*parseFloat(n),c=e.top+a+(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),d=r?e.width*r:e.width,h=s?e.height*s:e.height;return{width:d,height:h,top:c,right:l+d,bottom:c+h,left:l}}(a,b,v.transformOrigin);p=e.top,f=e.left,m=e.width,g=e.height,_.x=b.scaleX,_.y=b.scaleY}l&&(c||(f*=l.scaleX,m*=l.scaleX,p*=l.scaleY,g*=l.scaleY),f+=l.x,p+=l.y),super(f,p,m,g),this.scale=_,this.intrinsicWidth=w.width,this.intrinsicHeight=w.height}};function Fa(e){return"style"in e&&"object"==typeof e.style&&null!==e.style&&"setProperty"in e.style&&"removeProperty"in e.style&&"function"==typeof e.style.setProperty&&"function"==typeof e.style.removeProperty}var Fl=class{constructor(e){this.element=e,this.initial=new Map}set(e,i=""){let{element:n}=this;if(Fa(n))for(let[r,s]of Object.entries(e)){let e=`${i}${r}`;this.initial.has(e)||this.initial.set(e,n.style.getPropertyValue(e)),n.style.setProperty(e,"string"==typeof s?s:`${s}px`)}}remove(e,i=""){let{element:n}=this;if(Fa(n))for(let r of e){let e=`${i}${r}`;n.style.removeProperty(e)}}reset(){let{element:e}=this;if(Fa(e)){for(let[i,n]of this.initial)e.style.setProperty(i,n);""===e.getAttribute("style")&&e.removeAttribute("style")}}};function Fc(e){return!!e&&(e instanceof zy(e).Element||zv(e)&&e.nodeType===Node.ELEMENT_NODE)}function Fd(e){if(!e)return!1;let{KeyboardEvent:i}=zy(e.target);return e instanceof i}var Fh={};function Fu(e){let i=null==Fh[e]?0:Fh[e]+1;return Fh[e]=i,`${e}-${i}`}var Fp=e=>{var i;return null!=(i=(({dragOperation:e,droppable:i})=>{let n=e.position.current;if(!n)return null;let{id:r}=i;return i.shape&&i.shape.containsPoint(n)?{id:r,value:1/Bo.distance(i.shape.center,n),type:B4.PointerIntersection,priority:B3.High}:null})(e))?i:(({dragOperation:e,droppable:i})=>{let{shape:n}=e;if(!i.shape||!(null==n?void 0:n.current))return null;let r=n.current.intersectionArea(i.shape);if(r){let{position:s}=e,o=Bo.distance(i.shape.center,s.current),a=r/(n.current.area+i.shape.area-r);return{id:i.id,value:a/o,type:B4.ShapeIntersection,priority:B3.Normal}}return null})(e)},Ff=e=>{let{dragOperation:i,droppable:n}=e,{shape:r,position:s}=i;if(!n.shape)return null;let o=r?Ba.from(r.current.boundingRectangle).corners:void 0,a=Ba.from(n.shape.boundingRectangle).corners.reduce((e,i,n)=>{var r;return e+Bo.distance(Bo.from(i),null!=(r=null==o?void 0:o[n])?r:s.current)},0);return{id:n.id,value:1/(a/4),type:B4.Collision,priority:B3.Normal}},Fm=Object.create,Fg=Object.defineProperty,Fv=Object.defineProperties,Fy=Object.getOwnPropertyDescriptor,F_=Object.getOwnPropertyDescriptors,Fx=Object.getOwnPropertySymbols,Fb=Object.prototype.hasOwnProperty,Fw=Object.prototype.propertyIsEnumerable,FS=(e,i)=>(i=Symbol[e])?i:Symbol.for("Symbol."+e),Fk=e=>{throw TypeError(e)},FC=(e,i,n)=>i in e?Fg(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,FT=(e,i)=>{for(var n in i||(i={}))Fb.call(i,n)&&FC(e,n,i[n]);if(Fx)for(var n of Fx(i))Fw.call(i,n)&&FC(e,n,i[n]);return e},FE=(e,i)=>Fg(e,"name",{value:i,configurable:!0}),FD=(e,i)=>{var n={};for(var r in e)Fb.call(e,r)&&0>i.indexOf(r)&&(n[r]=e[r]);if(null!=e&&Fx)for(var r of Fx(e))0>i.indexOf(r)&&Fw.call(e,r)&&(n[r]=e[r]);return n},FN=e=>{var i;return[,,,Fm(null!=(i=null==e?void 0:e[FS("metadata")])?i:null)]},FM=["class","method","getter","setter","accessor","field","value","get","set"],FO=e=>void 0!==e&&"function"!=typeof e?Fk("Function expected"):e,FR=(e,i,n,r,s)=>({kind:FM[e],name:i,metadata:r,addInitializer:e=>n._?Fk("Already initialized"):s.push(FO(e||null))}),FA=(e,i)=>FC(i,FS("metadata"),e[3]),FL=(e,i,n,r)=>{for(var s=0,o=e[i>>1],a=o&&o.length;s<a;s++)1&i?o[s].call(n):r=o[s].call(n,r);return r},Fj=(e,i,n,r,s,o)=>{var a,l,c,d,h,u=7&i,p=!!(8&i),f=!!(16&i),m=u>3?e.length+1:u?p?1:2:0,g=FM[u+5],v=u>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),_=u&&(f||p||(s=s.prototype),u<5&&(u>3||!f)&&Fy(u<4?s:{get[n](){return FB(this,o)},set[n](x){return FF(this,o,x)}},n));u?f&&u<4&&FE(o,(u>2?"set ":u>1?"get ":"")+n):FE(s,n);for(var b=r.length-1;b>=0;b--)d=FR(u,n,c={},e[3],y),u&&(d.static=p,d.private=f,h=d.access={has:f?e=>FP(s,e):e=>n in e},3^u&&(h.get=f?e=>(1^u?FB:FH)(e,s,4^u?o:_.get):e=>e[n]),u>2&&(h.set=f?(e,i)=>FF(e,s,i,4^u?o:_.set):(e,i)=>e[n]=i)),l=(0,r[b])(u?u<4?f?o:_[g]:u>4?void 0:{get:_.get,set:_.set}:s,d),c._=1,4^u||void 0===l?FO(l)&&(u>4?v.unshift(l):u?f?o=l:_[g]=l:s=l):"object"!=typeof l||null===l?Fk("Object expected"):(FO(a=l.get)&&(_.get=a),FO(a=l.set)&&(_.set=a),FO(a=l.init)&&v.unshift(a));return u||FA(e,s),_&&Fg(s,n,_),f?4^u?o:_:s},FI=(e,i,n)=>i.has(e)||Fk("Cannot "+n),FP=(e,i)=>Object(i)!==i?Fk('Cannot use the "in" operator on this value'):e.has(i),FB=(e,i,n)=>(FI(e,i,"read from private field"),n?n.call(e):i.get(e)),Fz=(e,i,n)=>i.has(e)?Fk("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,n),FF=(e,i,n,r)=>(FI(e,i,"write to private field"),r?r.call(e,n):i.set(e,n),n),FH=(e,i,n)=>(FI(e,i,"access private method"),n),FW={draggable:"To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item in a given direction. Press space again to drop the item in its new position, or press escape to cancel."},F$={dragstart({operation:{source:e}}){if(e)return`Picked up draggable item ${e.id}.`},dragover({operation:{source:e,target:i}}){if(e&&e.id!==(null==i?void 0:i.id))return i?`Draggable item ${e.id} was moved over droppable target ${i.id}.`:`Draggable item ${e.id} is no longer over a droppable target.`},dragend({operation:{source:e,target:i},canceled:n}){if(e)return n?`Dragging was cancelled. Draggable item ${e.id} was dropped.`:i?`Draggable item ${e.id} was dropped over droppable target ${i.id}`:`Draggable item ${e.id} was dropped.`}},FU=["dragover","dragmove"],FV=class extends B${constructor(e,i){let n,r,s,o;super(e);const{id:a,idPrefix:{description:l="dnd-kit-description",announcement:c="dnd-kit-announcement"}={},announcements:d=F$,screenReaderInstructions:h=FW,debounce:u=500}=null!=i?i:{},p=a?`${l}-${a}`:Fu(l),f=a?`${c}-${a}`:Fu(c),m=(e=o)=>{s&&e&&(null==s?void 0:s.nodeValue)!==e&&(s.nodeValue=e)},g=()=>zX.schedule(m),v=function(e,i){let n,r=()=>{clearTimeout(n),n=setTimeout(e,i)};return r.cancel=()=>clearTimeout(n),r}(g,u),y=Object.entries(d).map(([e,i])=>this.manager.monitor.addEventListener(e,(n,r)=>{let a=s;if(!a)return;let l=null==i?void 0:i(n,r);l&&a.nodeValue!==l&&(o=l,FU.includes(e)?v():(g(),v.cancel()))})),_=()=>{var e;let i=[];if(!(null==n?void 0:n.isConnected)){let r;e=h.draggable,(r=document.createElement("div")).id=p,r.style.setProperty("display","none"),r.textContent=e,n=r,i.push(n)}if(!(null==r?void 0:r.isConnected)){let e;(e=document.createElement("div")).id=f,e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.style.setProperty("position","fixed"),e.style.setProperty("width","1px"),e.style.setProperty("height","1px"),e.style.setProperty("margin","-1px"),e.style.setProperty("border","0"),e.style.setProperty("padding","0"),e.style.setProperty("overflow","hidden"),e.style.setProperty("clip","rect(0 0 0 0)"),e.style.setProperty("clip-path","inset(100%)"),e.style.setProperty("white-space","nowrap"),r=e,s=document.createTextNode(""),r.appendChild(s),i.push(r)}i.length>0&&document.body.append(...i)},b=new Set;function w(){for(let e of b)e()}this.registerEffect(()=>{var e;for(let i of(b.clear(),this.manager.registry.draggables.value)){let s=null!=(e=i.handle)?e:i.element;if(s){for(let e of(n&&r||b.add(_),(!["input","select","textarea","a","button"].includes(s.tagName.toLowerCase())||zT())&&!s.hasAttribute("tabindex")&&b.add(()=>s.setAttribute("tabindex","0")),s.hasAttribute("role")||"button"===s.tagName.toLowerCase()||b.add(()=>s.setAttribute("role","button")),s.hasAttribute("aria-roledescription")||b.add(()=>s.setAttribute("aria-roledescription","draggable")),s.hasAttribute("aria-describedby")||b.add(()=>s.setAttribute("aria-describedby",p)),["aria-pressed","aria-grabbed"])){let n=String(i.isDragging);s.getAttribute(e)!==n&&b.add(()=>s.setAttribute(e,n))}let e=String(i.disabled);s.getAttribute("aria-disabled")!==e&&b.add(()=>s.setAttribute("aria-disabled",e))}}b.size>0&&zX.schedule(w)}),this.destroy=()=>{super.destroy(),null==n||n.remove(),null==r||r.remove(),y.forEach(e=>e())}}},Fq=new Map,FK=class extends(tD=BU,tE=[PW],tT=[P$],tC=[P$],tk=[P$],tD){constructor(e,i){super(e,i),FL(tM,5,this),Fz(this,tR),Fz(this,tN,new Set),Fz(this,tO,FL(tM,8,this,new Set)),FL(tM,11,this),this.registerEffect(FH(this,tR,tA))}register(e){return FB(this,tN).add(e),()=>{FB(this,tN).delete(e)}}addRoot(e){return IZ(()=>{let i=new Set(this.additionalRoots);i.add(e),this.additionalRoots=i}),()=>{IZ(()=>{let i=new Set(this.additionalRoots);i.delete(e),this.additionalRoots=i})}}get sourceRoot(){var e;let{source:i}=this.manager.dragOperation;return zN(null!=(e=null==i?void 0:i.element)?e:null)}get targetRoot(){var e;let{target:i}=this.manager.dragOperation;return zN(null!=(e=null==i?void 0:i.element)?e:null)}get roots(){let{status:e}=this.manager.dragOperation;return e.initializing||e.initialized?new Set([...[this.sourceRoot,this.targetRoot].filter(e=>null!=e),...this.additionalRoots]):new Set}};tM=FN(tD),tN=new WeakMap,tO=new WeakMap,tR=new WeakSet,tA=function(){let{roots:e}=this,i=[];for(let n of e)for(let e of FB(this,tN))i.push(FH(this,tR,tL).call(this,n,e));return()=>{for(let e of i)e()}},tL=function(e,i){let n=Fq.get(e);n||(n=new Map,Fq.set(e,n));let r=n.get(i);if(!r){let s=z_(e)?FH(this,tR,tj).call(this,e,n,i):FH(this,tR,tI).call(this,e,n,i);if(!s)return()=>{};r=s,n.set(i,r)}r.refCount++;let s=!1;return()=>{s||(s=!0,r.refCount--,0===r.refCount&&r.cleanup())}},tj=function(e,i,n){var r;let s=e.createElement("style"),{nonce:o}=null!=(r=this.options)?r:{};o&&s.setAttribute("nonce",o),s.textContent=n,e.head.prepend(s);let a=new MutationObserver(i=>{for(let n of i)for(let i of Array.from(n.removedNodes))if(i===s)return void e.head.prepend(s)});return a.observe(e.head,{childList:!0}),{refCount:0,cleanup:()=>{a.disconnect(),s.remove(),i.delete(n),0===i.size&&Fq.delete(e)}}},tI=function(e,i,n){"adoptedStyleSheets"in e&&Array.isArray(e.adoptedStyleSheets);let r=e.ownerDocument.defaultView,{CSSStyleSheet:s}=null!=r?r:{};if(!s)return null;let o=new s;return o.replaceSync(n),e.adoptedStyleSheets.push(o),{refCount:0,cleanup:()=>{var r;if(zD(e)&&(null==(r=e.host)?void 0:r.isConnected)){let i=e.adoptedStyleSheets.indexOf(o);-1!==i&&e.adoptedStyleSheets.splice(i,1)}i.delete(n),0===i.size&&Fq.delete(e)}}},Fj(tM,4,"additionalRoots",tE,FK,tO),Fj(tM,2,"sourceRoot",tT,FK),Fj(tM,2,"targetRoot",tC,FK),Fj(tM,2,"roots",tk,FK),FA(tM,FK),FK.configure=BH(FK);var FY=class extends B${constructor(e,i){super(e,i),this.manager=e;const{cursor:n="grabbing"}=null!=i?i:{},r=e.registry.plugins.get(FK),s=null==r?void 0:r.register(`* { cursor: ${n} !important; }`);if(s){const e=this.destroy.bind(this);this.destroy=()=>{s(),e()}}}},FX="data-dnd-",FJ=`${FX}dropping`,FG="--dnd-",FZ=`${FX}dragging`,FQ=`${FX}placeholder`,F0=[FZ,FQ,"popover","aria-pressed","aria-grabbing"],F1=["view-transition-name"],F2=`
118
+ :is(:root,:host) [${FZ}] {
119
+ position: fixed !important;
120
+ pointer-events: none !important;
121
+ touch-action: none;
122
+ z-index: calc(infinity);
123
+ will-change: translate;
124
+ top: var(${FG}top, 0px) !important;
125
+ left: var(${FG}left, 0px) !important;
126
+ right: unset !important;
127
+ bottom: unset !important;
128
+ width: var(${FG}width, auto);
129
+ max-width: var(${FG}width, auto);
130
+ height: var(${FG}height, auto);
131
+ max-height: var(${FG}height, auto);
132
+ transform: var(${FG}transform, none) !important;
133
+ transition: var(${FG}transition) !important;
134
+ }
135
+
136
+ :is(:root,:host) [${FQ}] {
137
+ transition: none;
138
+ }
139
+
140
+ :is(:root,:host) [${FQ}='hidden'] {
141
+ visibility: hidden;
142
+ }
143
+
144
+ [${FZ}] * {
145
+ pointer-events: none !important;
146
+ }
147
+
148
+ [${FZ}]:not([${FJ}]) {
149
+ translate: var(${FG}translate) !important;
150
+ }
151
+
152
+ [${FZ}][style*='${FG}scale'] {
153
+ scale: var(${FG}scale) !important;
154
+ transform-origin: var(${FG}transform-origin) !important;
155
+ }
156
+
157
+ @layer dnd-kit {
158
+ :where([${FZ}][popover]) {
159
+ overflow: visible;
160
+ background: unset;
161
+ border: unset;
162
+ margin: unset;
163
+ padding: unset;
164
+ color: inherit;
165
+
166
+ &:is(input, button) {
167
+ border: revert;
168
+ background: revert;
169
+ }
170
+ }
171
+ }
172
+ [${FZ}]::backdrop, [${FX}overlay]:not([${FZ}]) {
173
+ display: none;
174
+ visibility: hidden;
175
+ }
176
+ `.replace(/\n+/g," ").replace(/\s+/g," ").trim();function F5(e,i){return e===i||zj(e)===zj(i)}function F3(e){let{target:i}=e;"newState"in e&&"closed"===e.newState&&Fc(i)&&i.hasAttribute("popover")&&requestAnimationFrame(()=>zV(i))}function F4(e){return"TR"===e.tagName}var F6=class extends(tB=B$,tP=[PW],tB){constructor(e,i){super(e,i),Fz(this,tH),Fz(this,tF,FL(tz,8,this)),FL(tz,11,this),this.state={initial:{},current:{}};const n=e.registry.plugins.get(FK),r=null==n?void 0:n.register(F2);if(r){const e=this.destroy.bind(this);this.destroy=()=>{r(),e()}}this.registerEffect(FH(this,tH,tW).bind(this,n)),this.registerEffect(FH(this,tH,t$))}};tz=FN(tB),tF=new WeakMap,tH=new WeakSet,tW=function(e){let{overlay:i}=this;if(!i||!e)return;let n=zN(i);if(n)return e.addRoot(n)},t$=function(){var e,i,n,r,s,o,a,l;let c,d,h,{state:u,manager:p,options:f}=this,{dragOperation:m}=p,{position:g,source:v,status:y}=m;if(y.idle){u.current={},u.initial={};return}if(!v)return;let{element:_}=v,b=v.pluginConfig(F6),w=null!=(i=null!=(e=null==b?void 0:b.feedback)?e:null==f?void 0:f.feedback)?i:"default",S="function"==typeof w?w(v,p):w;if(!_||"none"===S||!y.initialized||y.initializing)return;let{initial:k}=u,C=null!=(n=this.overlay)?n:_,T=z5(C),E=z5(_),D=!F5(_,C),N=new Fo(_,{frameTransform:D?E:null,ignoreTransforms:!D}),M={x:E.scaleX/T.scaleX,y:E.scaleY/T.scaleY},{width:O,height:R,top:A,left:L}=N;D&&(O/=M.x,R/=M.y);let j=new Fl(C),I=zQ(_),{transition:P,translate:B,boxSizing:z,paddingBlockStart:F,paddingBlockEnd:H,paddingInlineStart:W,paddingInlineEnd:$,borderInlineStartWidth:U,borderInlineEndWidth:V,borderBlockStartWidth:q,borderBlockEndWidth:K}=I,Y=P.split(",").filter(e=>!/^\s*(transform|translate|scale)\b/.test(e)).join(","),X=z4(I),J=I.transform,G="clone"===S,Z="content-box"===z,Q=Z?parseInt(W)+parseInt($)+parseInt(U)+parseInt(V):0,ee=Z?parseInt(F)+parseInt(H)+parseInt(q)+parseInt(K):0,et="move"===S||this.overlay?null:function(e,i="hidden"){return IZ(()=>{let n,r,s,{element:o,manager:a}=e;if(!o||!a)return;let l=function(e,i){let n=new Map;for(let r of i)if(r.element&&(e===r.element||e.contains(r.element))){let e=`${FX}${Fu("dom-id")}`;r.element.setAttribute(e,""),n.set(r,e)}return n}(o,a.registry.droppables),c=[],d=(n="input, textarea, select, canvas, [contenteditable]",r=o.cloneNode(!0),s=Array.from(o.querySelectorAll(n)),Array.from(r.querySelectorAll(n)).forEach((e,i)=>{let n=s[i];if(zO(e)&&zO(n)&&("file"!==e.type&&(e.value=n.value),"radio"===e.type&&e.name&&(e.name=`Cloned__${e.name}`)),zR(e)&&zR(n)&&n.width>0&&n.height>0){let i=e.getContext("2d");null==i||i.drawImage(n,0,0)}}),r),{remove:h}=d;return function(e,i,n){for(let[r,s]of e){if(!r.element)continue;let e=`[${s}]`,o=i.matches(e)?i:i.querySelector(e);if(r.element.removeAttribute(s),!o)continue;let a=r.element;r.proxy=o,o.removeAttribute(s),zA.set(a,o),n.push(()=>{zA.delete(a),r.proxy=void 0})}}(l,d,c),function(e,i="hidden"){e.setAttribute("inert","true"),e.setAttribute("tab-index","-1"),e.setAttribute("aria-hidden","true"),e.setAttribute(FQ,i)}(d,i),d.remove=()=>{c.forEach(e=>e()),h.call(d)},d})}(v,G?"clone":"hidden"),ei=IZ(()=>Fd(p.dragOperation.activatorEvent));if(!k.translate){if(this.overlay&&X)k.translate={x:X.x,y:X.y};else if("none"!==B){let e=z3(B);e&&(k.translate=e)}}if(!k.transformOrigin){let e=IZ(()=>g.current),i=L+(null!=(r=null==X?void 0:X.x)?r:0),n=A+(null!=(s=null==X?void 0:X.y)?s:0);k.transformOrigin={x:(e.x-i*T.scaleX-T.x)/(O*T.scaleX),y:(e.y-n*T.scaleY-T.y)/(R*T.scaleY)}}let{transformOrigin:en}=k,er=A*T.scaleY+T.y,es=L*T.scaleX+T.x;if(!k.coordinates&&(k.coordinates={x:es,y:er},1!==M.x||1!==M.y)){let{scaleX:e,scaleY:i}=E,{x:n,y:r}=en;k.coordinates.x+=(O*e-O)*n,k.coordinates.y+=(R*i-R)*r}k.dimensions||(k.dimensions={width:O,height:R}),k.frameTransform||(k.frameTransform=T);let eo={x:k.coordinates.x-es,y:k.coordinates.y-er},ea={width:(k.dimensions.width*k.frameTransform.scaleX-O*T.scaleX)*en.x,height:(k.dimensions.height*k.frameTransform.scaleY-R*T.scaleY)*en.y},el={x:eo.x/T.scaleX+ea.width,y:eo.y/T.scaleY+ea.height},ec={left:L+el.x,top:A+el.y};C.setAttribute(FZ,"true");let ed=IZ(()=>m.transform),eh=null!=(o=k.translate)?o:{x:0,y:0},eu=ed.x*T.scaleX+eh.x,ep=ed.y*T.scaleY+eh.y,ef=zE();j.set({width:O-Q,height:R-ee,top:ec.top+ef.y,left:ec.left+ef.x,translate:`${eu}px ${ep}px 0`,transform:this.overlay?"none":J,transition:Y?`${Y}, translate 0ms linear`:"translate 0ms linear",scale:D?`${M.x} ${M.y}`:"","transform-origin":`${100*en.x}% ${100*en.y}%`},FG),et&&(_.insertAdjacentElement("afterend",et),(null==f?void 0:f.rootElement)&&("function"==typeof f.rootElement?f.rootElement(v):f.rootElement).appendChild(_)),zU(C)&&(C.hasAttribute("popover")||C.setAttribute("popover","manual"),zV(C),C.addEventListener("beforetoggle",F3));let em=(l={placeholder:et,element:_,feedbackElement:C,frameTransform:T,transformOrigin:en,width:O,height:R,top:A,left:L,widthOffset:Q,heightOffset:ee,delta:el,styles:j,dragOperation:m,getTranslate:()=>u.current.translate,getElementMutationObserver:()=>c,getSavedCellWidths:()=>h,setSavedCellWidths:e=>{h=e}},new ResizeObserver(()=>{var e,i,n;let r=new Fo(l.placeholder,{frameTransform:l.frameTransform,ignoreTransforms:!0}),s=null!=(e=l.transformOrigin)?e:{x:1,y:1},o=(l.width-r.width)*s.x+l.delta.x,a=(l.height-r.height)*s.y+l.delta.y,c=zE();if(l.styles.set({width:r.width-l.widthOffset,height:r.height-l.heightOffset,top:l.top+a+c.y,left:l.left+o+c.x},FG),null==(i=l.getElementMutationObserver())||i.takeRecords(),F4(l.element)&&F4(l.placeholder)){let e=Array.from(l.element.cells),i=Array.from(l.placeholder.cells);for(let[n,r]of(l.getSavedCellWidths()||l.setSavedCellWidths(e.map(e=>e.style.width)),e.entries())){let e=i[n];r.style.width=`${e.getBoundingClientRect().width}px`}}let d=null!=(n=l.getTranslate())?n:{x:0,y:0},h=l.left+o+c.x+d.x,u=l.top+a+c.y+d.y,p=r.width-l.widthOffset,f=r.height-l.heightOffset,m=l.frameTransform;l.dragOperation.shape=new Ba(h*m.scaleX+m.x,u*m.scaleY+m.y,p*m.scaleX,f*m.scaleY)})),eg=new Fo(C);IZ(()=>m.shape=eg);let ev=zy(C),ey=e=>{this.manager.actions.stop({event:e})},e_=zM(ev);if(ei&&ev.addEventListener("resize",ey),"idle"===IZ(()=>v.status)&&requestAnimationFrame(()=>v.status="dragging"),et){let e,i;em.observe(et),(e=new MutationObserver(e=>{let i=!1;for(let n of e){if(n.target!==_){i=!0;continue}if("attributes"!==n.type)continue;let e=n.attributeName;if(e.startsWith("aria-")||F0.includes(e))continue;let r=_.getAttribute(e);if("style"===e){if(Fa(_)&&Fa(et)){let e=_.style;for(let i of Array.from(et.style))""===e.getPropertyValue(i)&&et.style.removeProperty(i);for(let i of Array.from(e)){if(F1.includes(i)||i.startsWith(FG))continue;let n=e.getPropertyValue(i);et.style.setProperty(i,n)}}}else null!==r?et.setAttribute(e,r):et.removeAttribute(e)}i&&G&&et.replaceChildren(..._.cloneNode(!0).childNodes)})).observe(_,{attributes:!0,subtree:!0,childList:!0}),c=e,(i=new MutationObserver(e=>{for(let i of e)if(0!==i.addedNodes.length)for(let e of Array.from(i.addedNodes)){if(e.contains(_)&&_.nextElementSibling!==et){_.insertAdjacentElement("afterend",et),zV(C);return}if(e.contains(et)&&et.previousElementSibling!==_){et.insertAdjacentElement("beforebegin",_),zV(C);return}}_.isConnected&&et.isConnected&&_.nextElementSibling!==et&&(_.insertAdjacentElement("afterend",et),zV(C))})).observe(_.ownerDocument.body,{childList:!0,subtree:!0}),d=i}let ex=null==(a=p.dragOperation.source)?void 0:a.id,eb=()=>{var e;if(!ei||null==ex)return;let i=p.registry.draggables.get(ex),n=null!=(e=null==i?void 0:i.handle)?e:null==i?void 0:i.element;zx(n)&&n.focus()},ew=()=>{var e;if(null==c||c.disconnect(),null==d||d.disconnect(),em.disconnect(),ev.removeEventListener("resize",ey),zU(C)&&(C.removeEventListener("beforetoggle",F3),C.removeAttribute("popover")),C.removeAttribute(FZ),j.reset(),h&&F4(_))for(let[i,n]of Array.from(_.cells).entries())n.style.width=null!=(e=h[i])?e:"";v.status="idle";let i=null!=u.current.translate,n=m.status.dragging;et&&(!n&&i||et.parentElement!==C.parentElement)&&C.isConnected&&et.replaceWith(C),null==et||et.remove()},eS=null==f?void 0:f.dropAnimation,ek=this,eC=PV(()=>{var e,i,n;let{transform:r,status:s}=m;if((r.x||r.y||u.current.translate)&&s.dragging){let s=null!=(e=k.translate)?e:{x:0,y:0},o={x:r.x/T.scaleX+s.x,y:r.y/T.scaleY+s.y},a=u.current.translate,l=IZ(()=>m.modifiers),d=IZ(()=>{var e;return null==(e=m.shape)?void 0:e.current}),h=null==f?void 0:f.keyboardTransition,p=ei&&!e_&&null!==h?`${null!=(i=null==h?void 0:h.duration)?i:250}ms ${null!=(n=null==h?void 0:h.easing)?n:"cubic-bezier(0.25, 1, 0.5, 1)"}`:"0ms linear";if(j.set({transition:Y?`${Y}, translate ${p}`:`translate ${p}`,translate:`${o.x}px ${o.y}px 0`},FG),null==c||c.takeRecords(),d&&d!==eg&&a&&!l.length){let e=Bo.delta(o,a);m.shape=Ba.from(d.boundingRectangle).translate(e.x*T.scaleX,e.y*T.scaleY)}else m.shape=new Fo(C);u.current.translate=o}},function(){if(m.status.dropped){this.dispose(),v.status="dropping";let e=(null==b?void 0:b.dropAnimation)!==void 0?b.dropAnimation:void 0!==ek.dropAnimation?ek.dropAnimation:eS,i=u.current.translate,n=null!=i;if(i||_===C||(i={x:0,y:0}),!i||null===e)return void ew();p.renderer.rendering.then(()=>{!function(e){var i,n,r,s;let{animation:o}=e;if("function"==typeof o)return Promise.resolve(o({source:e.source,element:e.element,feedbackElement:e.feedbackElement,placeholder:e.placeholder,translate:e.translate,moved:e.moved})).then(()=>{e.cleanup(),requestAnimationFrame(e.restoreFocus)});let{duration:a=250,easing:l="ease"}=null!=o?o:{};zV(e.feedbackElement);let[,c]=null!=(i=zf(e.feedbackElement,e=>"translate"in e))?i:[];null==c||c.pause();let d=null!=(n=e.placeholder)?n:e.element,h={frameTransform:F5(e.feedbackElement,d)?null:void 0},u=new Fo(e.feedbackElement,h),p=null!=(r=z3(zQ(e.feedbackElement).translate))?r:e.translate,f=new Fo(d,h),m=Ba.delta(u,f,e.alignment),g={x:p.x-m.x,y:p.y-m.y},v=Math.round(u.intrinsicHeight)!==Math.round(f.intrinsicHeight)?{minHeight:[`${u.intrinsicHeight}px`,`${f.intrinsicHeight}px`],maxHeight:[`${u.intrinsicHeight}px`,`${f.intrinsicHeight}px`]}:{},y=Math.round(u.intrinsicWidth)!==Math.round(f.intrinsicWidth)?{minWidth:[`${u.intrinsicWidth}px`,`${f.intrinsicWidth}px`],maxWidth:[`${u.intrinsicWidth}px`,`${f.intrinsicWidth}px`]}:{};e.styles.set({transition:e.transition},FG),e.feedbackElement.setAttribute(FJ,""),null==(s=e.getElementMutationObserver())||s.takeRecords(),Ft({element:e.feedbackElement,keyframes:Fv(FT(FT({},v),y),F_({translate:[`${p.x}px ${p.y}px 0`,`${g.x}px ${g.y}px 0`]})),options:{duration:zM(zy(e.feedbackElement))?0:e.moved||e.feedbackElement!==e.element?a:0,easing:l}}).then(()=>{e.feedbackElement.removeAttribute(FJ),null==c||c.finish(),e.cleanup(),requestAnimationFrame(e.restoreFocus)})}({source:v,element:_,feedbackElement:C,placeholder:et,translate:i,moved:n,transition:P,alignment:v.alignment,styles:j,animation:null!=e?e:void 0,getElementMutationObserver:()=>c,cleanup:ew,restoreFocus:eb})})}});return()=>{ew(),eC()}},Fj(tz,4,"overlay",tP,F6,tF),FA(tz,F6),F6.configure=BH(F6),tq=[PW],tK=z6.Forward,tU=[PW],tV=z6.Reverse;var F8=class{constructor(){Fz(this,tX,FL(tY,8,this,!0)),FL(tY,11,this),Fz(this,tJ,FL(tY,12,this,!0)),FL(tY,15,this)}isLocked(e){return e!==z6.Idle&&(null==e?!0===this[z6.Forward]&&!0===this[z6.Reverse]:!0===this[e])}unlock(e){e!==z6.Idle&&(this[e]=!1)}};tY=FN(null),tX=new WeakMap,tJ=new WeakMap,Fj(tY,4,tK,tq,F8,tX),Fj(tY,4,tV,tU,F8,tJ),FA(tY,F8);var F9=[z6.Forward,z6.Reverse],F7=class{constructor(){this.x=new F8,this.y=new F8}isLocked(){return this.x.isLocked()&&this.y.isLocked()}},He=class extends B${constructor(e){super(e);const i=Pa(new F7);let n=null;this.signal=i,Pg(()=>{let{status:r}=e.dragOperation;if(!r.initialized){n=null,i.value=new F7;return}let{delta:s}=e.dragOperation.position;if(n){let e={x:Ht(s.x,n.x),y:Ht(s.y,n.y)},r=i.peek();IJ(()=>{for(let i of Bh)for(let n of F9)e[i]===n&&r[i].unlock(n);i.value=r})}n=s})}get current(){return this.signal.peek()}};function Ht(e,i){return Math.sign(e-i)}var Hi=class extends(tZ=BU,tG=[PW],tZ){constructor(e){super(e),Fz(this,t0,FL(tQ,8,this,!1)),FL(tQ,11,this),Fz(this,t1),Fz(this,t2,()=>{if(!FB(this,t1))return;let{element:e,by:i}=FB(this,t1);i.y&&(e.scrollTop+=i.y),i.x&&(e.scrollLeft+=i.x)}),this.scroll=(e,i)=>{var n;if(this.disabled)return!1;let r=this.getScrollableElements();if(!r)return FF(this,t1,void 0),!1;let{position:s}=this.manager.dragOperation,o=null==s?void 0:s.current;if(o){let{by:s}=null!=e?e:{},a=s?{x:Hn(s.x),y:Hn(s.y)}:void 0,l=a?void 0:this.scrollIntentTracker.current;if(null==l?void 0:l.isLocked())return!1;for(let e of r){let r=function(e,i){let{isTop:n,isBottom:r,isLeft:s,isRight:o,position:a}=zK(e),{x:l,y:c}=null!=i?i:{x:0,y:0},d=!n&&a.current.y+c>0,h=!r&&a.current.y+c<a.max.y,u=!s&&a.current.x+l>0,p=!o&&a.current.x+l<a.max.x;return{top:d,bottom:h,left:u,right:p,x:u||p,y:d||h}}(e,s);if(r.x||r.y){let{speed:r,direction:c}=function(e,i,n,r=25,s=z8,o=z9){let{x:a,y:l}=i,{rect:c,isTop:d,isBottom:h,isLeft:u,isRight:p}=zK(e),f=z5(e),m=z4(zQ(e,!0)),g=null!==m&&(null==m?void 0:m.scaleX)<0,v=null!==m&&(null==m?void 0:m.scaleY)<0,y=new Ba(c.left*f.scaleX+f.x,c.top*f.scaleY+f.y,c.width*f.scaleX,c.height*f.scaleY),_={x:0,y:0},b={x:0,y:0},w={height:y.height*s.y,width:y.width*s.x};return w.height>0&&(!d||v&&!h)&&l<=y.top+w.height&&(null==n?void 0:n.y)!==1&&a>=y.left-o.x&&a<=y.right+o.x?(_.y=v?1:-1,b.y=r*Math.abs((y.top+w.height-l)/w.height)):w.height>0&&(!h||v&&!d)&&l>=y.bottom-w.height&&(null==n?void 0:n.y)!==-1&&a>=y.left-o.x&&a<=y.right+o.x&&(_.y=v?-1:1,b.y=r*Math.abs((y.bottom-w.height-l)/w.height)),w.width>0&&(!p||g&&!u)&&a>=y.right-w.width&&(null==n?void 0:n.x)!==-1&&l>=y.top-o.y&&l<=y.bottom+o.y?(_.x=g?-1:1,b.x=r*Math.abs((y.right-w.width-a)/w.width)):w.width>0&&(!u||g&&!p)&&a<=y.left+w.width&&(null==n?void 0:n.x)!==1&&l>=y.top-o.y&&l<=y.bottom+o.y&&(_.x=g?1:-1,b.x=r*Math.abs((y.left+w.width-a)/w.width)),{direction:_,speed:b}}(e,o,a,null==i?void 0:i.acceleration,null==i?void 0:i.threshold);if(l)for(let e of Bh)l[e].isLocked(c[e])&&(r[e]=0,c[e]=0);if(c.x||c.y){let{x:i,y:o}=null!=s?s:c,a=i*r.x,l=o*r.y;if(a||l){let i=null==(n=FB(this,t1))?void 0:n.by;if(this.autoScrolling&&i&&(i.x&&!a||i.y&&!l))continue;return FF(this,t1,{element:e,by:{x:a,y:l}}),zX.schedule(FB(this,t2)),!0}}}}}return FF(this,t1,void 0),!1};let i=null,n=null;const r=PF(()=>{let{position:n,source:r}=e.dragOperation;if(!n)return null;let s=function e(i,{x:n,y:r}){var s;let o=i.elementFromPoint(n,r);if((null==(s=o)?void 0:s.tagName)==="IFRAME"){let{contentDocument:i}=o;if(i){let{left:s,top:a}=o.getBoundingClientRect();return e(i,{x:n-s,y:r-a})}}return o}(zN(null==r?void 0:r.element),n.current);return s&&(i=s),null!=s?s:i}),s=PF(()=>{let i=r.value,{documentElement:s}=zw(i);if(!i||i===s){let{target:i}=e.dragOperation,r=null==i?void 0:i.element;if(r){let e=z2(r,{excludeElement:!1});return n=e,e}}if(i){let e=z2(i,{excludeElement:!1});return this.autoScrolling&&n&&e.size<(null==n?void 0:n.size)?n:(n=e,e)}return n=null,null},PH);this.getScrollableElements=()=>s.value,this.scrollIntentTracker=new He(e),this.destroy=e.monitor.addEventListener("dragmove",i=>{!this.disabled&&!i.defaultPrevented&&Fd(e.dragOperation.activatorEvent)&&i.by&&this.scroll({by:i.by})&&i.preventDefault()})}};function Hn(e){return e>0?z6.Forward:e<0?z6.Reverse:z6.Idle}tQ=FN(tZ),t0=new WeakMap,t1=new WeakMap,t2=new WeakMap,Fj(tQ,4,"autoScrolling",tG,Hi,t0),FA(tQ,Hi);var Hr=new class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{let{tasks:e,resolvers:i}=this;for(let i of(this.pending=!1,this.tasks=new Set,this.resolvers=new Set,e))i();for(let e of i)e()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(e=>this.resolvers.add(e))}}(e=>{"function"==typeof requestAnimationFrame?requestAnimationFrame(e):e()}),Hs=class extends B${constructor(e,i){super(e,i);const n=e.registry.plugins.get(Hi);if(!n)throw Error("AutoScroller plugin depends on Scroller plugin");this.destroy=Pg(()=>{var i,r,s;if(this.disabled)return;let{position:o,status:a}=e.dragOperation;if(a.dragging){let e={acceleration:null==(i=this.options)?void 0:i.acceleration,threshold:"number"==typeof(null==(r=this.options)?void 0:r.threshold)?{x:this.options.threshold,y:this.options.threshold}:null==(s=this.options)?void 0:s.threshold};if(n.scroll(void 0,e)){n.autoScrolling=!0;let i=setInterval(()=>Hr.schedule(()=>n.scroll(void 0,e)),10);return()=>{clearInterval(i)}}n.autoScrolling=!1}})}};Hs.configure=BH(Hs);var Ho={capture:!0,passive:!0},Ha=class extends BU{constructor(e){super(e),Fz(this,t5),this.handleScroll=()=>{null==FB(this,t5)&&FF(this,t5,setTimeout(()=>{this.manager.collisionObserver.forceUpdate(!1),FF(this,t5,void 0)},50))};const{dragOperation:i}=this.manager;this.destroy=Pg(()=>{var e,n,r;if(i.status.dragging){let s=null!=(r=null==(n=null==(e=i.source)?void 0:e.element)?void 0:n.ownerDocument)?r:document;return s.addEventListener("scroll",this.handleScroll,Ho),()=>{s.removeEventListener("scroll",this.handleScroll,Ho)}}})}};t5=new WeakMap;var Hl=class extends B${constructor(e){super(e),this.manager=e;const i=e.registry.plugins.get(FK),n=null==i?void 0:i.register("* { user-select: none !important; -webkit-user-select: none !important; }");if(this.destroy=Pg(()=>{let{dragOperation:e}=this.manager;if(e.status.initialized)return Hc(),document.addEventListener("selectionchange",Hc,{capture:!0}),()=>{document.removeEventListener("selectionchange",Hc,{capture:!0})}}),n){const e=this.destroy.bind(this);this.destroy=()=>{n(),e()}}}};function Hc(){var e;null==(e=document.getSelection())||e.removeAllRanges()}var Hd=Object.freeze({offset:10,keyboardCodes:{start:["Space","Enter"],cancel:["Escape"],end:["Space","Enter","Tab"],up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]},preventActivation(e,i){var n;let r=null!=(n=i.handle)?n:i.element;return e.target!==r}}),Hh=class extends B9{constructor(e,i){super(e),this.manager=e,this.options=i,Fz(this,t3,[]),this.listeners=new zL,this.handleSourceKeyDown=(e,i,n)=>{if(this.disabled||e.defaultPrevented||!Fc(e.target)||i.disabled)return;let{keyboardCodes:r=Hd.keyboardCodes,preventActivation:s=Hd.preventActivation}=null!=n?n:{};!r.start.includes(e.code)||!this.manager.dragOperation.status.idle||null!=s&&s(e,i)||this.handleStart(e,i,n)}}bind(e,i=this.options){return Pg(()=>{var n;let r=null!=(n=e.handle)?n:e.element,s=n=>{Fd(n)&&this.handleSourceKeyDown(n,e,i)};if(r)return r.addEventListener("keydown",s),()=>{r.removeEventListener("keydown",s)}})}handleStart(e,i,n){let{element:r}=i;if(!r)throw Error("Source draggable does not have an associated element");e.preventDefault(),e.stopImmediatePropagation(),z7(r);let{center:s}=new Fo(r);if(this.manager.actions.start({event:e,coordinates:{x:s.x,y:s.y},source:i}).signal.aborted)return this.cleanup();this.sideEffects();let o=zw(r),a=[this.listeners.bind(o,[{type:"keydown",listener:e=>this.handleKeyDown(e,i,n),options:{capture:!0}}])];FB(this,t3).push(...a)}handleKeyDown(e,i,n){let{keyboardCodes:r=Hd.keyboardCodes}=null!=n?n:{};if(Hu(e,[...r.end,...r.cancel])){e.preventDefault();let i=Hu(e,r.cancel);this.handleEnd(e,i);return}Hu(e,r.up)?this.handleMove("up",e):Hu(e,r.down)&&this.handleMove("down",e),Hu(e,r.left)?this.handleMove("left",e):Hu(e,r.right)&&this.handleMove("right",e)}handleEnd(e,i){this.manager.actions.stop({event:e,canceled:i}),this.cleanup()}handleMove(e,i){var n,r;let{shape:s}=this.manager.dragOperation,o=i.shiftKey?5:1,a={x:0,y:0},l=null!=(r=null==(n=this.options)?void 0:n.offset)?r:Hd.offset;if("number"==typeof l&&(l={x:l,y:l}),s){switch(e){case"up":a={x:0,y:-l.y*o};break;case"down":a={x:0,y:l.y*o};break;case"left":a={x:-l.x*o,y:0};break;case"right":a={x:l.x*o,y:0}}(a.x||a.y)&&(i.preventDefault(),this.manager.actions.move({event:i,by:a}))}}sideEffects(){let e=this.manager.registry.plugins.get(Hs);(null==e?void 0:e.disabled)===!1&&(e.disable(),FB(this,t3).push(()=>{e.enable()}))}cleanup(){FB(this,t3).forEach(e=>e()),FF(this,t3,[])}destroy(){this.cleanup(),this.listeners.clear()}};function Hu(e,i){return i.includes(e.code)}t3=new WeakMap,Hh.configure=BH(Hh),Hh.defaults=Hd;var Hp=class extends ze{constructor(){super(...arguments),Fz(this,t4)}onEvent(e){switch(e.type){case"pointerdown":FF(this,t4,zk(e));break;case"pointermove":if(!FB(this,t4))return;let{x:i,y:n}=zk(e),r={x:i-FB(this,t4).x,y:n-FB(this,t4).y},{tolerance:s}=this.options;if(s&&Bc(r,s))return void this.abort();Bc(r,this.options.value)&&this.activate(e);break;case"pointerup":this.abort()}}abort(){FF(this,t4,void 0)}};t4=new WeakMap;var Hf=class extends ze{constructor(){super(...arguments),Fz(this,t6),Fz(this,t8)}onEvent(e){switch(e.type){case"pointerdown":FF(this,t8,zk(e)),FF(this,t6,setTimeout(()=>this.activate(e),this.options.value));break;case"pointermove":if(!FB(this,t8))return;let{x:i,y:n}=zk(e);Bc({x:i-FB(this,t8).x,y:n-FB(this,t8).y},this.options.tolerance)&&this.abort();break;case"pointerup":this.abort()}}abort(){FB(this,t6)&&(clearTimeout(FB(this,t6)),FF(this,t8,void 0),FF(this,t6,void 0))}};t6=new WeakMap,t8=new WeakMap;var Hm=class{};Hm.Delay=Hf,Hm.Distance=Hp;var Hg=Object.freeze({activationConstraints(e,i){var n;let{pointerType:r,target:s}=e;if(!("mouse"===r&&Fc(s)&&(i.handle===s||(null==(n=i.handle)?void 0:n.contains(s)))))return"touch"===r?[new Hm.Delay({value:250,tolerance:5})]:function(e){var i;if(!Fc(e))return!1;let{tagName:n}=e;return"INPUT"===n||"TEXTAREA"===n||(i=e).hasAttribute("contenteditable")&&"false"!==i.getAttribute("contenteditable")}(s)&&!e.defaultPrevented?[new Hm.Delay({value:200,tolerance:0})]:[new Hm.Delay({value:200,tolerance:10}),new Hm.Distance({value:5})]},preventActivation(e,i){var n;let{target:r}=e;return!(r===i.element||r===i.handle||!Fc(r)||(null==(n=i.handle)?void 0:n.contains(r)))&&!!r.closest(`
177
+ input:not([disabled]),
178
+ select:not([disabled]),
179
+ textarea:not([disabled]),
180
+ button:not([disabled]),
181
+ a[href],
182
+ [contenteditable]:not([contenteditable="false"])
183
+ `)}}),Hv=class extends B9{constructor(e,i){super(e),this.manager=e,this.options=i,Fz(this,t9,new Set),this.listeners=new zL,this.latest={event:void 0,coordinates:void 0},this.handleMove=()=>{let{event:e,coordinates:i}=this.latest;e&&i&&this.manager.actions.move({event:e,to:i})},this.handleCancel=this.handleCancel.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}activationConstraints(e,i,n=this.options){let{activationConstraints:r=Hg.activationConstraints}=null!=n?n:{};return"function"==typeof r?r(e,i):r}bind(e,i=this.options){return Pg(()=>{var n,r;let s=new AbortController,{signal:o}=s,a=n=>{(function(e){if(!e)return!1;let{PointerEvent:i}=zy(e.target);return e instanceof i})(n)&&this.handlePointerDown(n,e,i)},l=[null!=(n=e.handle)?n:e.element];for(let n of((null==i?void 0:i.activatorElements)&&(l=Array.isArray(i.activatorElements)?i.activatorElements:i.activatorElements(e)),l)){n&&(!(r=n.ownerDocument.defaultView)||Hx.has(r)||(r.addEventListener("touchmove",H_,{capture:!1,passive:!1}),Hx.add(r)),n.addEventListener("pointerdown",a,{signal:o}))}return()=>s.abort()})}handlePointerDown(e,i,n){if(this.disabled||!e.isPrimary||0!==e.button||!Fc(e.target)||i.disabled||"sensor"in e||!this.manager.dragOperation.status.idle)return;let{preventActivation:r=Hg.preventActivation}=null!=n?n:{};if(null==r?void 0:r(e,i))return;let{target:s}=e,o=zx(s)&&s.draggable&&"true"===s.getAttribute("draggable"),a=z5(i.element),{x:l,y:c}=zk(e);this.initialCoordinates={x:l*a.scaleX+a.x,y:c*a.scaleY+a.y};let d=this.activationConstraints(e,i,n);e.sensor=this;let h=new B7(d,e=>this.handleStart(i,e));h.signal.onabort=()=>this.handleCancel(e),h.onEvent(e),this.controller=h;let u=function e(i=document,n=new Set){if(n.has(i))return[];n.add(i);let r=[i];for(let s of Array.from(i.querySelectorAll("iframe, frame")))try{let i=s.contentDocument;i&&!n.has(i)&&r.push(...e(i,n))}catch(e){}try{let s=i.defaultView;if(s&&s!==window.top){let o=s.parent;o&&o.document&&o.document!==i&&r.push(...e(o.document,n))}}catch(e){}return r}(),p=this.listeners.bind(u,[{type:"pointermove",listener:e=>this.handlePointerMove(e,i)},{type:"pointerup",listener:this.handlePointerUp,options:{capture:!0}},{type:"pointercancel",listener:this.handleCancel},{type:"dragstart",listener:o?this.handleCancel:Hy,options:{capture:!0}}]),f=()=>{p(),this.initialCoordinates=void 0};FB(this,t9).add(f)}handlePointerMove(e,i){var n,r;if((null==(n=this.controller)?void 0:n.activated)===!1){null==(r=this.controller)||r.onEvent(e);return}if(this.manager.dragOperation.status.dragging){let n=zk(e),r=z5(i.element);n.x=n.x*r.scaleX+r.x,n.y=n.y*r.scaleY+r.y,e.preventDefault(),e.stopPropagation(),this.latest.event=e,this.latest.coordinates=n,zX.schedule(this.handleMove)}}handlePointerUp(e){let{status:i}=this.manager.dragOperation;if(!i.idle){e.preventDefault(),e.stopPropagation();let n=!i.initialized;this.manager.actions.stop({event:e,canceled:n})}this.cleanup()}handleKeyDown(e){"Escape"===e.key&&(e.preventDefault(),this.handleCancel(e))}handleStart(e,i){let{manager:n,initialCoordinates:r}=this;if(!r||!n.dragOperation.status.idle||i.defaultPrevented)return;if(n.actions.start({coordinates:r,event:i,source:e}).signal.aborted)return this.cleanup();i.preventDefault();let s=zw(i.target).body;try{s.setPointerCapture(i.pointerId)}catch(e){this.handleCancel(i);return}let o=Fc(i.target)?[i.target,s]:s,a=this.listeners.bind(o,[{type:"touchmove",listener:Hy,options:{passive:!1}},{type:"click",listener:Hy},{type:"contextmenu",listener:Hy},{type:"keydown",listener:this.handleKeyDown}]);FB(this,t9).add(a)}handleCancel(e){let{dragOperation:i}=this.manager;i.status.initialized&&this.manager.actions.stop({event:e,canceled:!0}),this.cleanup()}cleanup(){let{controller:e}=this;this.controller=void 0,e&&!e.signal.aborted&&e.abort(),this.latest={event:void 0,coordinates:void 0},FB(this,t9).forEach(e=>e()),FB(this,t9).clear()}destroy(){this.cleanup(),this.listeners.clear()}};function Hy(e){e.preventDefault()}function H_(){}t9=new WeakMap,Hv.configure=BH(Hv),Hv.defaults=Hg;var Hx=new WeakSet,Hb=[],Hw=[FV,Hs,FY,F6,Hl],HS=[Hv,Hh],Hk=class extends zo{constructor(e={}){const i=zs(e.plugins,Hw),n=zs(e.sensors,HS),r=zs(e.modifiers,Hb);super(((e,i)=>Fv(e,F_(i)))(FT({},e),{plugins:[Ha,Hi,FK,...i],sensors:n,modifiers:r}))}},HC=class extends(it=BZ,ie=[PW],t7=[PW],it){constructor(e,i){var{element:n,effects:r=()=>[],handle:s}=e;super(FT({effects:()=>[...r(),()=>{var e,i;let{manager:n}=this;if(!n)return;let r=(null!=(i=null==(e=this.sensors)?void 0:e.map(BW))?i:[...n.sensors]).map(e=>{let i=e instanceof B9?e:n.registry.register(e.plugin),r=e instanceof B9?void 0:e.options;return i.bind(this,r)});return function(){r.forEach(e=>e())}}]},FD(e,["element","effects","handle"])),i),Fz(this,ir,FL(ii,8,this)),FL(ii,11,this),Fz(this,is,FL(ii,12,this)),FL(ii,15,this),this.element=n,this.handle=s}};ii=FN(it),ir=new WeakMap,is=new WeakMap,Fj(ii,4,"handle",ie,HC,ir),Fj(ii,4,"element",t7,HC,is),FA(ii,HC);var HT=class extends(il=BQ,ia=[PW],io=[PW],il){constructor(e,i){var{element:n,effects:r=()=>[]}=e,s=FD(e,["element","effects"]);const{collisionDetector:o=Fp}=s,a=e=>{let{manager:i,element:n}=this;if(!n||null===e){this.shape=void 0;return}if(!i)return;let r=new Fo(n),s=IZ(()=>this.shape);return r&&(null==s?void 0:s.equals(r))?s:(this.shape=r,r)},l=Pa(!1);super(((e,i)=>Fv(e,F_(i)))(FT({},s),{collisionDetector:o,effects:()=>[...r(),()=>{let{element:e,manager:i}=this;if(!i)return;let{dragOperation:n}=i,{source:r}=n;l.value=!!(r&&n.status.initialized&&e&&!this.disabled&&this.accepts(r))},()=>{let{element:e}=this;if(l.value&&e){let i=new z$(e,a);return()=>{i.disconnect(),this.shape=void 0}}},()=>{var e;if(null==(e=this.manager)?void 0:e.dragOperation.status.initialized)return()=>{this.shape=void 0}}]}),i),Fz(this,im),Fz(this,id,FL(ic,8,this)),FL(ic,11,this),Fz(this,ig,FL(ic,12,this)),FL(ic,15,this),this.element=n,this.refreshShape=()=>a()}set element(e){FF(this,im,e,ip)}get element(){var e;return null!=(e=this.proxy)?e:FB(this,im,iu)}};function HE(e){var i;if(null!=e)return null!=e&&"object"==typeof e&&"current"in e?null!=(i=e.current)?i:void 0:e}ic=FN(il),id=new WeakMap,im=new WeakSet,ig=new WeakMap,iu=(ih=Fj(ic,20,"#element",ia,im,id)).get,ip=ih.set,Fj(ic,4,"proxy",io,HT,ig),FA(ic,HT);var HD="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement?iO.useLayoutEffect:iO.useEffect;function HN(e,i){e()}function HM(e){let i=(0,iO.useRef)(e);return HD(()=>{i.current=e},[e]),i}function HO(e,i,n=iO.useEffect,r=Object.is){let s=(0,iO.useRef)(e);n(()=>{let n=s.current;r(e,n)||(s.current=e,i(e,n))},[i,e])}function HR(e,i){let n=(0,iO.useRef)(HE(e));HD(()=>{let r=HE(e);r!==n.current&&(n.current=r,i(r))})}var HA=Object.getOwnPropertySymbols,HL=Object.prototype.hasOwnProperty,Hj=Object.prototype.propertyIsEnumerable,HI=new Hk,HP=(0,iO.createContext)(HI),HB=(0,iO.memo)((0,iO.forwardRef)(({children:e},i)=>{let[n,r]=(0,iO.useState)(0),s=(0,iO.useRef)(null),o=(0,iO.useRef)(null),a=(0,iO.useMemo)(()=>({renderer:{get rendering(){var e;return null!=(e=s.current)?e:Promise.resolve()}},trackRendering(e){s.current||(s.current=new Promise(e=>{o.current=e})),(0,iO.startTransition)(()=>{e(),r(e=>e+1)})}}),[]);return HD(()=>{var e;null==(e=o.current)||e.call(o),s.current=null},[e,n]),(0,iO.useImperativeHandle)(i,()=>a),null})),Hz=[void 0,PH];function HF(e){let i;var n,{children:r,onCollision:s,onBeforeDragStart:o,onDragStart:a,onDragMove:l,onDragOver:c,onDragEnd:d}=e,h=((e,i)=>{var n={};for(var r in e)HL.call(e,r)&&0>i.indexOf(r)&&(n[r]=e[r]);if(null!=e&&HA)for(var r of HA(e))0>i.indexOf(r)&&Hj.call(e,r)&&(n[r]=e[r]);return n})(e,["children","onCollision","onBeforeDragStart","onDragStart","onDragMove","onDragOver","onDragEnd"]);let u=(0,iO.useRef)(null),{plugins:p,modifiers:f,sensors:m}=h,g=zs(p,Hw),v=zs(m,HS),y=zs(f,Hb),_=HM(o),b=HM(a),w=HM(c),S=HM(l),k=HM(d),C=HM(s),T=(n=()=>{var e;return null!=(e=h.manager)?e:new Hk(h)},(i=(0,iO.useRef)(null)).current||(i.current=n()),(0,iO.useInsertionEffect)(()=>()=>{var e;return null==(e=i.current)?void 0:e.destroy()},[]),i.current);return(0,iO.useEffect)(()=>{if(!u.current)throw Error("Renderer not found");let{renderer:e,trackRendering:i}=u.current,{monitor:n}=T;T.renderer=e;let r=[n.addEventListener("beforedragstart",e=>{let n=_.current;n&&i(()=>n(e,T))}),n.addEventListener("dragstart",e=>{var i;return null==(i=b.current)?void 0:i.call(b,e,T)}),n.addEventListener("dragover",e=>{let n=w.current;n&&i(()=>n(e,T))}),n.addEventListener("dragmove",e=>{let n=S.current;n&&i(()=>n(e,T))}),n.addEventListener("dragend",e=>{let n=k.current;n&&i(()=>n(e,T))}),n.addEventListener("collision",e=>{var i;return null==(i=C.current)?void 0:i.call(C,e,T)})];return()=>r.forEach(e=>e())},[T]),HO(g,()=>T&&(T.plugins=g),...Hz),HO(v,()=>T&&(T.sensors=v),...Hz),HO(y,()=>T&&(T.modifiers=y),...Hz),(0,iM.jsxs)(HP.Provider,{value:T,children:[(0,iM.jsx)(HB,{ref:u,children:r}),r]})}var HH=Object.create,HW=Object.defineProperty,H$=Object.getOwnPropertyDescriptor,HU=(e,i)=>(i=Symbol[e])?i:Symbol.for("Symbol."+e),HV=e=>{throw TypeError(e)},Hq=["class","method","getter","setter","accessor","field","value","get","set"],HK=e=>void 0!==e&&"function"!=typeof e?HV("Function expected"):e,HY=(e,i,n,r,s)=>({kind:Hq[e],name:i,metadata:r,addInitializer:e=>n._?HV("Already initialized"):s.push(HK(e||null))}),HX=(e,i,n,r,s,o)=>{for(var a,l,c,d=7&i,h=Hq[d+5],u=e[2]||(e[2]=[]),p=H$(s=s.prototype,n),f=r.length-1;f>=0;f--)(c=HY(d,n,l={},e[3],u)).static=!1,c.private=!1,(c.access={has:e=>n in e}).get=e=>e[n],a=(0,r[f])(p[h],c),l._=1,HK(a)&&(p[h]=a);return p&&HW(s,n,p),s},HJ=(e,i,n)=>i.has(e)||HV("Cannot "+n),HG=class e{constructor(e,i){this.x=e,this.y=i}static delta(i,n){return new e(i.x-n.x,i.y-n.y)}static distance(e,i){return Math.hypot(e.x-i.x,e.y-i.y)}static equals(e,i){return e.x===i.x&&e.y===i.y}static from({x:i,y:n}){return new e(i,n)}},HZ=class extends(i_=Pq,iy=[P$],iv=[P$],i_){constructor(e){super(HG.from(e),(e,i)=>HG.equals(e,i)),((e,i,n,r)=>{for(var s=0,o=e[i>>1],a=o&&o.length;s<a;s++)o[s].call(n)})(ib,5,this),((e,i,n)=>i.has(e)?HV("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,n))(this,ix,0),this.velocity={x:0,y:0}}get delta(){return HG.delta(this.current,this.initial)}get direction(){let{current:e,previous:i}=this;if(!i)return null;let n={x:e.x-i.x,y:e.y-i.y};return n.x||n.y?Math.abs(n.x)>Math.abs(n.y)?n.x>0?"right":"left":n.y>0?"down":"up":null}get current(){return super.current}set current(e){let i,{current:n}=this,r=HG.from(e),s={x:r.x-n.x,y:r.y-n.y},o=Date.now(),a=o-(HJ(this,i=ix,"read from private field"),i.get(this)),l=e=>Math.round(e/a*100);IJ(()=>{let e;HJ(this,e=ix,"write to private field"),e.set(this,o),this.velocity={x:l(s.x),y:l(s.y)},super.current=r})}reset(e=this.defaultValue){super.reset(HG.from(e)),this.velocity={x:0,y:0}}};ib=[,,,HH(null!=(T=null==i_?void 0:i_[HU("metadata")])?T:null)],ix=new WeakMap,HX(ib,2,"delta",iy,HZ),HX(ib,2,"direction",iv,HZ),E=ib,g=HU("metadata"),v=E[3],g in HZ?HW(HZ,g,{enumerable:!0,configurable:!0,writable:!0,value:v}):HZ[g]=v;var HQ=((D=HQ||{}).Horizontal="x",D.Vertical="y",D);Object.values(HQ);var H0=Object.create,H1=Object.defineProperty,H2=Object.defineProperties,H5=Object.getOwnPropertyDescriptor,H3=Object.getOwnPropertyDescriptors,H4=Object.getOwnPropertySymbols,H6=Object.prototype.hasOwnProperty,H8=Object.prototype.propertyIsEnumerable,H9=e=>{throw TypeError(e)},H7=(e,i,n)=>i in e?H1(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,We=(e,i)=>{for(var n in i||(i={}))H6.call(i,n)&&H7(e,n,i[n]);if(H4)for(var n of H4(i))H8.call(i,n)&&H7(e,n,i[n]);return e},Wt=["class","method","getter","setter","accessor","field","value","get","set"],Wi=e=>void 0!==e&&"function"!=typeof e?H9("Function expected"):e,Wn=(e,i,n,r,s)=>({kind:Wt[e],name:i,metadata:r,addInitializer:e=>n._?H9("Already initialized"):s.push(Wi(e||null))}),Wr=(e,i,n,r)=>{for(var s=0,o=e[i>>1],a=o&&o.length;s<a;s++)1&i?o[s].call(n):r=o[s].call(n,r);return r},Ws=(e,i,n,r,s,o)=>{for(var a,l,c,d,h,u=7&i,p=e.length+1,f=Wt[u+5],m=e[p-1]=[],g=e[p]||(e[p]=[]),v=(s=s.prototype,H5({get[n](){return Wa(this,o)},set[n](x){return Wc(this,o,x)}},n)),y=r.length-1;y>=0;y--)(d=Wn(u,n,c={},e[3],g)).static=!1,d.private=!1,(h=d.access={has:e=>n in e}).get=e=>e[n],h.set=(e,i)=>e[n]=i,l=(0,r[y])({get:v.get,set:v.set},d),c._=1,void 0===l?Wi(l)&&(v[f]=l):"object"!=typeof l||null===l?H9("Object expected"):(Wi(a=l.get)&&(v.get=a),Wi(a=l.set)&&(v.set=a),Wi(a=l.init)&&m.unshift(a));return v&&H1(s,n,v),s},Wo=(e,i,n)=>i.has(e)||H9("Cannot "+n),Wa=(e,i,n)=>(Wo(e,i,"read from private field"),i.get(e)),Wl=(e,i,n)=>i.has(e)?H9("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,n),Wc=(e,i,n,r)=>(Wo(e,i,"write to private field"),i.set(e,n),n);function Wd(e){return e instanceof WO||e instanceof WM}var Wh=class extends B${constructor(e){super(e);const i=Pg(()=>{let{dragOperation:i}=e;if(Fd(i.activatorEvent)&&Wd(i.source)&&i.status.initialized){let i=e.registry.plugins.get(Hi);if(i)return i.disable(),()=>i.enable()}}),n=e.monitor.addEventListener("dragmove",(e,i)=>{queueMicrotask(()=>{if(this.disabled||e.defaultPrevented||!e.nativeEvent)return;let{dragOperation:n}=i;if(!Fd(e.nativeEvent)||!Wd(n.source)||!n.shape)return;let{actions:r,collisionObserver:s,registry:o}=i,{by:a}=e;if(!a)return;let l=function(e){let{x:i,y:n}=e;return i>0?"right":i<0?"left":n>0?"down":n<0?"up":void 0}(a),{source:c,target:d}=n,{center:h}=n.shape.current,u=[],p=[];IJ(()=>{for(let e of o.droppables){let{id:i}=e;if(!e.accepts(c)||i===(null==d?void 0:d.id)&&Wd(e)||!e.element)continue;let n=e.shape,r=new Fo(e.element,{getBoundingClientRect:e=>zS(e,void 0,.2)});r.height&&r.width&&("down"==l&&h.y+10<r.center.y||"up"==l&&h.y-10>r.center.y||"left"==l&&h.x-10>r.center.x||"right"==l&&h.x+10<r.center.x)&&(u.push(e),e.shape=r,p.push(()=>e.shape=n))}}),e.preventDefault(),s.disable();let f=s.computeCollisions(u,Ff);IJ(()=>p.forEach(e=>e()));let[m]=f;if(!m)return;let{id:g}=m,{index:v,group:y}=c.sortable;r.setDropTarget(g).then(()=>{let{source:e,target:i,shape:o}=n;if(!e||!Wd(e)||!o)return;let{index:a,group:l,target:c}=e.sortable,d=v!==a||y!==l,h=d?c:null==i?void 0:i.element;if(!h)return;z7(h);let u=new Fo(h);if(!u)return;let p=Ba.delta(u,Ba.from(o.current.boundingRectangle),e.alignment);r.move({by:p}),d?r.setDropTarget(e.id).then(()=>s.enable()):s.enable()})})});this.destroy=()=>{n(),i()}}},Wu=Object.defineProperty,Wp=Object.defineProperties,Wf=Object.getOwnPropertyDescriptors,Wm=Object.getOwnPropertySymbols,Wg=Object.prototype.hasOwnProperty,Wv=Object.prototype.propertyIsEnumerable,Wy=(e,i,n)=>i in e?Wu(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,W_=(e,i)=>{for(var n in i||(i={}))Wg.call(i,n)&&Wy(e,n,i[n]);if(Wm)for(var n of Wm(i))Wv.call(i,n)&&Wy(e,n,i[n]);return e};function Wx(e,i,n){if(i===n)return e;let r=e.slice();return r.splice(n,0,r.splice(i,1)[0]),r}function Wb(e){return"initialIndex"in e&&"number"==typeof e.initialIndex&&"index"in e&&"number"==typeof e.index}var Ww="__default__";function WS(e,i,n,r){n.insertAdjacentElement(r<i?"afterend":"beforebegin",e)}function Wk(e,i){return e.index-i.index}function WC(e){return Array.from(e).sort(Wk)}var WT=[Wh,class extends B${constructor(e){super(e);const i=()=>{let i=new Map;for(let n of e.registry.droppables)if(n instanceof WO){let{sortable:e}=n,{group:r}=e,s=i.get(r);s||(s=new Set,i.set(r,s)),s.add(e)}for(let[e,n]of i)i.set(e,new Set(WC(n)));return i},n=[e.monitor.addEventListener("dragover",(e,n)=>{if(this.disabled)return;let{dragOperation:r}=n,{source:s,target:o}=r;if(!Wd(s)||!Wd(o)||s.sortable===o.sortable)return;let a=i(),l=s.sortable.group===o.sortable.group,c=a.get(s.sortable.group),d=l?c:a.get(o.sortable.group);c&&d&&queueMicrotask(()=>{e.defaultPrevented||n.renderer.rendering.then(()=>{var r,h,u;let p=i();for(let[e,i]of a.entries())for(let[n,s]of Array.from(i).entries())if(s.index!==n||s.group!==e||!(null==(r=p.get(e))?void 0:r.has(s)))return;let f=s.sortable.element,m=o.sortable.element;if(!m||!f||!l&&o.id===s.sortable.group)return;let g=WC(c),v=l?g:WC(d),y=null!=(h=s.sortable.group)?h:Ww,_=null!=(u=o.sortable.group)?u:Ww,b={[y]:g,[_]:v},w=function(e,i,n){var r,s,o;let a,l,{source:c,target:d,canceled:h}=i.operation;if(!c||!d||h)return"preventDefault"in i&&i.preventDefault(),e;let u=(e,i)=>e===i||"object"==typeof e&&"id"in e&&e.id===i;if(Array.isArray(e)){let r=e.findIndex(e=>u(e,c.id)),s=e.findIndex(e=>u(e,d.id));if(-1===r||-1===s){if(Wb(c)){let r=c.initialIndex,s=c.index;return r===s||r<0||r>=e.length?("preventDefault"in i&&i.preventDefault(),e):n(e,r,s)}return e}if(!h&&"index"in c&&"number"==typeof c.index){let i=c.index;if(i!==r)return n(e,r,i)}return n(e,r,s)}let p=Object.entries(e),f=-1,m=-1;for(let[e,i]of p)if(-1===f&&-1!==(f=i.findIndex(e=>u(e,c.id)))&&(a=e),-1===m&&-1!==(m=i.findIndex(e=>u(e,d.id)))&&(l=e),-1!==f&&-1!==m)break;if(-1===f&&Wb(c)){let r=c.initialGroup,s=c.initialIndex,o=c.group,a=c.index;if(null==r||null==o||!(r in e)||!(o in e)||r===o&&s===a)return"preventDefault"in i&&i.preventDefault(),e;if(r===o)return Wp(W_({},e),Wf({[r]:n(e[r],s,a)}));let l=e[r][s];return Wp(W_({},e),Wf({[r]:[...e[r].slice(0,s),...e[r].slice(s+1)],[o]:[...e[o].slice(0,a),l,...e[o].slice(a)]}))}if(!c.manager)return e;let{dragOperation:g}=c.manager,v=null!=(s=null==(r=g.shape)?void 0:r.current.center)?s:g.position.current;if(null==l&&d.id in e){let i=d.shape&&v.y>d.shape.center.y?e[d.id].length:0;l=d.id,m=i}if(null==a||null==l||a===l&&f===m){if(null!=a&&a===l&&f===m&&Wb(c)){let i=null!=c.group&&c.group!==a,r=c.index!==f;if(i||r){let i=null!=(o=c.group)?o:a;if(i in e){if(a===i)return Wp(W_({},e),Wf({[a]:n(e[a],f,c.index)}));let r=e[a][f];return Wp(W_({},e),Wf({[a]:[...e[a].slice(0,f),...e[a].slice(f+1)],[i]:[...e[i].slice(0,c.index),r,...e[i].slice(c.index)]}))}}}return"preventDefault"in i&&i.preventDefault(),e}if(a===l)return Wp(W_({},e),Wf({[a]:n(e[a],f,m)}));let y=+!!(d.shape&&Math.round(v.y)>Math.round(d.shape.center.y)),_=e[a][f];return Wp(W_({},e),Wf({[a]:[...e[a].slice(0,f),...e[a].slice(f+1)],[l]:[...e[l].slice(0,m+y),_,...e[l].slice(m+y)]}))}(b,e,Wx);if(b===w)return;let S=w[_].indexOf(s.sortable),k=w[_].indexOf(o.sortable);n.collisionObserver.disable(),WS(f,S,m,k),IJ(()=>{for(let[e,i]of w[y].entries())i.index=e;if(!l)for(let[e,i]of w[_].entries())i.group=o.sortable.group,i.index=e}),n.actions.setDropTarget(s.id).then(()=>n.collisionObserver.enable())})})}),e.monitor.addEventListener("dragend",(e,n)=>{if(!e.canceled)return;let{dragOperation:r}=n,{source:s}=r;Wd(s)&&(s.sortable.initialIndex!==s.sortable.index||s.sortable.initialGroup!==s.sortable.group)&&queueMicrotask(()=>{let e=i(),r=e.get(s.sortable.initialGroup);r&&n.renderer.rendering.then(()=>{for(let[i,n]of e.entries())for(let[e,r]of Array.from(n).entries())if(r.index!==e||r.group!==i)return;let i=WC(r),n=s.sortable.element,o=i[s.sortable.initialIndex],a=null==o?void 0:o.element;o&&a&&n&&(WS(n,o.index,a,s.index),IJ(()=>{for(let[i,n]of e.entries())for(let e of Array.from(n).values())e.index=e.initialIndex,e.group=e.initialGroup}))})})})];this.destroy=()=>{for(let e of n)e()}}}],WE={duration:250,easing:"cubic-bezier(0.25, 1, 0.5, 1)",idle:!1},WD=new PY;iS=[PW],iw=[PW];var WN=class{constructor(e,i){Wl(this,iC,Wr(ik,8,this)),Wr(ik,11,this),Wl(this,iT),Wl(this,iE),Wl(this,iD,Wr(ik,12,this)),Wr(ik,15,this),Wl(this,iN),this.register=()=>(IJ(()=>{var e,i;null==(e=this.manager)||e.registry.register(this.droppable),null==(i=this.manager)||i.registry.register(this.draggable)}),()=>this.unregister()),this.unregister=()=>{IJ(()=>{var e,i;null==(e=this.manager)||e.registry.unregister(this.droppable),null==(i=this.manager)||i.registry.unregister(this.draggable)})},this.destroy=()=>{IJ(()=>{this.droppable.destroy(),this.draggable.destroy()})};var{effects:n=()=>[],group:r,index:s,sensors:o,type:a,transition:l=WE,plugins:c}=e,d=((e,i)=>{var n={};for(var r in e)H6.call(e,r)&&0>i.indexOf(r)&&(n[r]=e[r]);if(null!=e&&H4)for(var r of H4(e))0>i.indexOf(r)&&H8.call(e,r)&&(n[r]=e[r]);return n})(e,["effects","group","index","sensors","type","transition","plugins"]);const h=zs(c,WT);this.droppable=new WO(d,i,this),this.draggable=new WM(((e,i)=>H2(e,H3(i)))(We({},d),{plugins:h,effects:()=>[()=>{var e,i,n;let r=null==(e=this.manager)?void 0:e.dragOperation.status;(null==r?void 0:r.initializing)&&this.id===(null==(n=null==(i=this.manager)?void 0:i.dragOperation.source)?void 0:n.id)&&WD.clear(this.manager),(null==r?void 0:r.dragging)&&WD.set(this.manager,this.id,IZ(()=>({initialIndex:this.index,initialGroup:this.group})))},()=>{let{index:e,group:i,manager:n}=this,r=Wa(this,iE),s=Wa(this,iT);(e!==r||i!==s)&&(Wc(this,iE,e),Wc(this,iT,i),this.animate())},()=>{var e,i;let{target:n}=this,{isDragSource:r}=this.draggable;"move"===(null!=(i=null==(e=this.draggable.pluginConfig(F6))?void 0:e.feedback)?i:"default")&&r&&(this.droppable.disabled=!n)},...n()],type:a,sensors:o}),i,this),Wc(this,iN,d.element),this.manager=i,this.index=s,Wc(this,iE,s),this.group=r,Wc(this,iT,r),this.type=a,this.transition=l}get initialIndex(){var e,i;return null!=(i=null==(e=WD.get(this.manager,this.id))?void 0:e.initialIndex)?i:this.index}get initialGroup(){var e,i;return null!=(i=null==(e=WD.get(this.manager,this.id))?void 0:e.initialGroup)?i:this.group}animate(){IZ(()=>{let{manager:e,transition:i}=this,{shape:n}=this.droppable;if(!e)return;let{idle:r}=e.dragOperation.status;n&&i&&(!r||i.idle)&&e.renderer.rendering.then(()=>{let{element:r}=this;if(!r)return;for(let e of r.getAnimations())"transitionProperty"in e&&("transform"===e.transitionProperty||"translate"===e.transitionProperty||"scale"===e.transitionProperty)&&e.cancel();let s=this.refreshShape();if(!s)return;let o={x:n.boundingRectangle.left-s.boundingRectangle.left,y:n.boundingRectangle.top-s.boundingRectangle.top},{translate:a}=zQ(r),l=Fi(r,a,!1),c=Fi(r,a);if(o.x||o.y){let n=zM(zy(r))?H2(We({},i),H3({duration:0})):i;Ft({element:r,keyframes:{translate:[`${l.x+o.x}px ${l.y+o.y}px ${l.z}`,`${c.x}px ${c.y}px ${c.z}`]},options:n}).then(()=>{e.dragOperation.status.dragging||(this.droppable.shape=void 0)})}})})}get manager(){return this.draggable.manager}set manager(e){IJ(()=>{this.draggable.manager=e,this.droppable.manager=e})}set element(e){IJ(()=>{let i=Wa(this,iN),n=this.droppable.element,r=this.draggable.element;n&&n!==i||(this.droppable.element=e),r&&r!==i||(this.draggable.element=e),Wc(this,iN,e)})}get element(){var e,i;let n=Wa(this,iN);if(n)return null!=(i=null!=(e=zA.get(n))?e:n)?i:this.droppable.element}set target(e){this.droppable.element=e}get target(){return this.droppable.element}set source(e){this.draggable.element=e}get source(){return this.draggable.element}get disabled(){return this.draggable.disabled&&this.droppable.disabled}set plugins(e){this.draggable.plugins=zs(e,WT)}set disabled(e){IJ(()=>{this.droppable.disabled=e,this.draggable.disabled=e})}set data(e){IJ(()=>{this.droppable.data=e,this.draggable.data=e})}set handle(e){this.draggable.handle=e}set id(e){this.droppable.id=e,this.draggable.id=e}get id(){return this.droppable.id}set sensors(e){this.draggable.sensors=e}set modifiers(e){this.draggable.modifiers=e}set collisionPriority(e){this.droppable.collisionPriority=e}set collisionDetector(e){this.droppable.collisionDetector=null!=e?e:Fp}set alignment(e){this.draggable.alignment=e}get alignment(){return this.draggable.alignment}set type(e){IJ(()=>{this.droppable.type=e,this.draggable.type=e})}get type(){return this.draggable.type}set accept(e){this.droppable.accept=e}get accept(){return this.droppable.accept}get isDropTarget(){return this.droppable.isDropTarget}get isDragSource(){return this.draggable.isDragSource}get isDragging(){return this.draggable.isDragging}get isDropping(){return this.draggable.isDropping}get status(){return this.draggable.status}refreshShape(){return this.droppable.refreshShape()}accepts(e){return this.droppable.accepts(e)}};ik=[,,,H0(null)],iC=new WeakMap,iT=new WeakMap,iE=new WeakMap,iD=new WeakMap,iN=new WeakMap,Ws(ik,4,"index",iS,WN,iC),Ws(ik,4,"group",iw,WN,iD),N=ik,H7(WN,(y="metadata",(_=Symbol[y])?_:Symbol.for("Symbol."+y)),N[3]);var WM=class extends HC{constructor(e,i,n){super(e,i),this.sortable=n}get index(){return this.sortable.index}get initialIndex(){return this.sortable.initialIndex}get group(){return this.sortable.group}get initialGroup(){return this.sortable.initialGroup}},WO=class extends HT{constructor(e,i,n){super(e,i),this.sortable=n}get index(){return this.sortable.index}get group(){return this.sortable.group}},WR=Object.defineProperty,WA=Object.defineProperties,WL=Object.getOwnPropertyDescriptors,Wj=Object.getOwnPropertySymbols,WI=Object.prototype.hasOwnProperty,WP=Object.prototype.propertyIsEnumerable,WB=(e,i,n)=>i in e?WR(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,Wz=(e,i)=>{for(var n in i||(i={}))WI.call(i,n)&&WB(e,n,i[n]);if(Wj)for(var n of Wj(i))WP.call(i,n)&&WB(e,n,i[n]);return e};function WF(e,i,n){return"isDragSource"===e&&!n&&!!i}let WH=(0,nP.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);function WW({task:e,index:i,workspaceId:n,onRetry:r,onCancel:s,onEdit:o,onDelete:a,tTask:l}){let c="pending"===e.status,d=c||"running"===e.status||"reviewing"===e.status||"retrying"===e.status,h=c||d,{ref:u,isDragging:p}=function(e){let i,n,r,{accept:s,collisionDetector:o,collisionPriority:a,id:l,data:c,element:d,handle:h,index:u,group:p,disabled:f,modifiers:m,sensors:g,target:v,type:y,plugins:_}=e,b=Wz(Wz({},WE),e.transition),w=function(e){var i;let n=null!=(i=(0,iO.useContext)(HP))?i:void 0,[r]=(0,iO.useState)(()=>e(n));return r.manager!==n&&(r.manager=n),HD(r.register,[n,r]),r}(i=>new WN(WA(Wz({},e),WL({transition:b,register:!1,handle:HE(h),element:HE(d),target:HE(v)})),i)),S=(i=(0,iO.useRef)(new Map),n=(0,iO.useState)(0)[1],r=(0,iO.useCallback)(()=>{n(e=>e+1)},[n]),HD(()=>w?Pg(()=>{var e;let n=!1,s=!1;for(let r of i.current){let[o]=r,a=IZ(()=>r[1]),l=w[o];a!==l&&(n=!0,i.current.set(o,l),s=null!=(e=null==WF?void 0:WF(o,a,l))&&e)}n&&(s?queueMicrotask(()=>(0,iL.flushSync)(r)):r())}):void i.current.clear(),[w]),(0,iO.useMemo)(()=>w?new Proxy(w,{get(e,n){let r=e[n];return i.current.set(n,r),r}}):w,[w]));return HO(l,()=>w.id=l),HD(()=>{IJ(()=>{w.group=p,w.index=u})},[w,p,u]),HO(y,()=>w.type=y),HO(s,()=>w.accept=s,void 0,PH),HO(c,()=>c&&(w.data=c)),HO(u,()=>{var e;(null==(e=w.manager)?void 0:e.dragOperation.status.idle)&&(null==b?void 0:b.idle)&&w.refreshShape()},HN),HR(h,e=>w.handle=e),HR(d,e=>w.element=e),HR(v,e=>w.target=e),HO(f,()=>w.disabled=!0===f),HO(g,()=>w.sensors=g),HO(o,()=>w.collisionDetector=o),HO(a,()=>w.collisionPriority=a),HO(_,()=>w.plugins=_,void 0,PH),HO(b,()=>w.transition=b,void 0,PH),HO(m,()=>w.modifiers=m,void 0,PH),HO(e.alignment,()=>w.alignment=e.alignment),{sortable:S,get isDragging(){return S.isDragging},get isDropping(){return S.isDropping},get isDragSource(){return S.isDragSource},get isDropTarget(){return S.isDropTarget},handleRef:(0,iO.useCallback)(e=>{w.handle=null!=e?e:void 0},[w]),ref:(0,iO.useCallback)(e=>{var i,n;(e||null==(i=w.element)||!i.isConnected||(null==(n=w.manager)?void 0:n.dragOperation.status.idle))&&(w.element=null!=e?e:void 0)},[w]),sourceRef:(0,iO.useCallback)(e=>{var i,n;(e||null==(i=w.source)||!i.isConnected||(null==(n=w.manager)?void 0:n.dragOperation.status.idle))&&(w.source=null!=e?e:void 0)},[w]),targetRef:(0,iO.useCallback)(e=>{var i,n;(e||null==(i=w.target)||!i.isConnected||(null==(n=w.manager)?void 0:n.dragOperation.status.idle))&&(w.target=null!=e?e:void 0)},[w])}}({id:e.id,index:i,disabled:!h});return(0,iM.jsxs)("div",{ref:u,className:["inline-flex items-center gap-2 px-2.5 py-1.5 rounded-lg border bg-card group transition-colors hover:bg-accent/30 min-w-0",p&&"opacity-50 shadow-lg scale-105",!h&&"opacity-70"].filter(Boolean).join(" "),style:{cursor:h?"grab":"default"},children:[(0,iM.jsx)(mP.AgentIcon,{agentId:e.agentConfigId,className:"h-6 w-6 shrink-0 rounded"}),(0,iM.jsx)("span",{className:"text-sm min-w-0 shrink",children:e.title}),(0,iM.jsx)(mj.Badge,{variant:Iq[e.status],className:"text-[10px] shrink-0",children:l(`status.${e.status}`)}),(0,iM.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[c&&(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>o(e),children:(0,iM.jsx)(mc.Pencil,{className:"h-3 w-3"})}),(c||"cancelled"===e.status||"done"===e.status)&&(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive hover:text-destructive opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>a(n,e.id),children:(0,iM.jsx)(nZ.Trash2,{className:"h-3 w-3"})}),"failed"===e.status&&(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>r(n,e.id),children:(0,iM.jsx)(IW.RotateCcw,{className:"h-3 w-3"})}),d&&(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>s(n,e.id),children:(0,iM.jsx)(WH,{className:"h-3 w-3"})})]})]})}function W$({issue:e,workspaceId:i,issueTasks:n,agents:r,t:s,tTask:o,tc:a,retryTask:l,cancelTask:c,reorderTasks:d,createTask:h,updateTask:u,deleteTask:p}){let[f,m]=(0,iO.useState)(!1),[g,v]=(0,iO.useState)(null),[y,_]=(0,iO.useState)(""),[b,w]=(0,iO.useState)(""),[S,k]=(0,iO.useState)(""),C=async()=>{y.trim()&&(g?await u(i,g.id,{title:y.trim(),description:b.trim(),agentConfigId:S||void 0}):await h(i,e.id,y.trim(),b.trim(),S||void 0),_(""),w(""),k(""),v(null),m(!1))},T=e=>{v(e),_(e.title),w(e.description),k(e.agentConfigId??""),m(!0)},E=async(e,i)=>{await p(e,i)};return(0,iM.jsxs)("div",{className:"shrink-0 p-4 pb-2 max-h-[180px] overflow-y-auto",children:[(0,iM.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,iM.jsx)("h3",{className:"text-sm font-medium",children:s("detail.tasks",{count:n.length})}),(0,iM.jsxs)(lq.Dialog,{open:f,onOpenChange:e=>{m(e),e||v(null)},children:[(0,iM.jsx)(lq.DialogTrigger,{render:(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{v(null),_(""),w(""),k(""),m(!0)}}),children:(0,iM.jsx)(lU.Plus,{className:"h-4 w-4"})}),(0,iM.jsxs)(lq.DialogContent,{children:[(0,iM.jsx)(lq.DialogHeader,{children:(0,iM.jsx)(lq.DialogTitle,{children:s(g?"detail.editTask":"detail.addTask")})}),(0,iM.jsxs)("div",{className:"space-y-3",children:[(0,iM.jsx)(me.Input,{placeholder:s("detail.taskTitlePlaceholder"),value:y,onChange:e=>_(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,iM.jsx)(IA.Textarea,{placeholder:s("detail.taskDescriptionPlaceholder"),value:b,onChange:e=>w(e.target.value),rows:3}),r.length>0&&(0,iM.jsxs)("div",{className:"space-y-1",children:[(0,iM.jsx)("label",{className:"text-xs text-muted-foreground",children:"Agent"}),(0,iM.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(0,iM.jsxs)("button",{type:"button",onClick:()=>k(""),className:(0,n1.cn)("flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-colors border",S?"border-transparent hover:bg-muted":"border-primary bg-primary/10 text-primary"),children:[(0,iM.jsx)("span",{className:"size-4 rounded bg-muted flex items-center justify-center text-[10px]",children:"—"}),s("detail.noAgent")]}),r.map(e=>(0,iM.jsxs)("button",{type:"button",onClick:()=>k(e.id),className:(0,n1.cn)("flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-colors border",S===e.id?"border-primary bg-primary/10 text-primary":"border-transparent hover:bg-muted"),children:[(0,iM.jsx)(mP.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,apiBase:e.apiBase,className:"size-4 rounded-full"}),(0,iM.jsx)("span",{className:"truncate max-w-[80px]",children:e.name}),S===e.id&&(0,iM.jsx)(ms.Check,{className:"size-3 shrink-0"})]},e.id))]})]}),(0,iM.jsx)(f7.Button,{onClick:C,disabled:!y.trim(),size:"sm",children:g?a("save"):s("detail.addTask")})]})]})]})]}),0===n.length?(0,iM.jsx)("div",{className:"text-sm text-muted-foreground",children:s("detail.noTasks")}):(0,iM.jsx)(HF,{onDragEnd:r=>{if(r.canceled)return;let s=r.operation?.source,o=r.operation?.target;if(!s||!o||s.id===o.id)return;let a=n.map(e=>e.id),l=a.indexOf(String(s.id)),c=a.indexOf(String(o.id));if(-1===l||-1===c)return;let h=Array.from(a),[u]=h.splice(l,1);h.splice(c,0,u),d(i,e.id,h)},children:(0,iM.jsx)("div",{className:"flex gap-2 overflow-x-auto pb-1 scrollbar-thin",children:n.map((e,n)=>(0,iM.jsx)(WW,{task:e,index:n,workspaceId:i,onRetry:l,onCancel:c,onEdit:T,onDelete:E,tTask:o},e.id))})})]})}var WU=e.i(799773);function WV({comment:e,expanded:i,workspaceId:n,onDelete:r,onUpdate:s,onExpandedChange:o}){let[a,l]=(0,iO.useState)(!1),[c,d]=(0,iO.useState)(e.content),[h,u]=(0,iO.useState)(!1),[p,f]=(0,iO.useState)(!1),m=(0,iO.useRef)(null),g=(0,iO.useRef)(null),v="user"===e.senderId,y=(0,mO.useAgentStore)(e=>e.agents),_=v?void 0:y.find(i=>i.id===e.senderId),b=(0,mM.useChannelStore)(e=>e.setActiveChannel),w=(0,mM.useChannelStore)(e=>e.loadMessages),S=e.metadata?.channelId,k=e.metadata?.messageId,C=e.metadata?.phase,T=e.metadata?.taskId,E=(0,n2.useTranslations)("issue"),D=(0,n2.useTranslations)("common");(0,iO.useEffect)(()=>{d(e.content),l(!1)},[e.id,e.content]),(0,iO.useEffect)(()=>{let e=g.current;e&&f(e.scrollHeight>300)},[e.content,i]);let N=v?D("you"):_?.name||e.senderId,M=(0,mX.useUserAvatar)();(0,iO.useEffect)(()=>{a&&m.current&&(m.current.focus(),m.current.setSelectionRange(c.length,c.length))},[a,c.length]);let O=async()=>{await navigator.clipboard.writeText(e.content),u(!0),setTimeout(()=>u(!1),1500)},R=async()=>{S&&k&&(b(S),await w(n,S),window.setTimeout(()=>{document.getElementById(`msg-${k}`)?.scrollIntoView({block:"center",behavior:"smooth"})},80))},A=()=>{let i=c.trim();if(!i||i===e.content){l(!1),d(e.content);return}s(n,e.id,i),l(!1)};return(0,iM.jsx)("div",{className:"py-3 border-b last:border-b-0 group",children:(0,iM.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,iM.jsx)(mP.AgentIcon,{agentId:v?void 0:e.senderId,name:N,avatarUrl:v&&M||void 0,className:"size-7 rounded-full"}),(0,iM.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,iM.jsx)("span",{className:"text-xs font-medium",children:N}),e.metadata?.model&&(0,iM.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground",children:e.metadata.model}),(0,iM.jsx)("span",{className:"text-[10px] text-muted-foreground",children:new Date(e.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),(0,iM.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[e.senderRole&&(0,iM.jsx)("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:e.senderRole}),C&&(0,iM.jsx)("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:C.replace("_"," ")}),T&&(0,iM.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground",children:E("message.task",{taskId:T.slice(0,8)})})]}),(0,iM.jsx)("div",{className:"flex items-center gap-2",children:S&&k?(0,iM.jsxs)(f7.Button,{variant:"ghost",size:"sm",className:"h-5 gap-1 px-1.5 text-[10px] text-muted-foreground",onClick:R,children:[(0,iM.jsx)(nQ.ExternalLink,{className:"size-3"}),E("message.openMessage")]}):null}),a?(0,iM.jsx)("textarea",{ref:m,value:c,onChange:e=>d(e.target.value),onKeyDown:i=>{"Enter"!==i.key||i.shiftKey||(i.preventDefault(),A()),"Escape"===i.key&&(l(!1),d(e.content))},onBlur:A,className:"w-full text-sm bg-muted/50 rounded-lg px-3 py-2 resize-none focus:outline-none focus:ring-1 focus:ring-primary min-h-[60px]"}):(0,iM.jsxs)("div",{className:"relative",children:[(0,iM.jsx)("div",{ref:g,className:`text-sm whitespace-pre-wrap break-words ${!i?"max-h-[300px] overflow-hidden":""}`,children:e.content}),p&&!i&&(0,iM.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-background to-transparent flex items-end justify-center pb-1",children:(0,iM.jsx)(f7.Button,{variant:"ghost",size:"sm",className:"h-6 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{o?.(e.id,!0)},children:E("message.expandMore")})}),i&&p&&(0,iM.jsx)(f7.Button,{variant:"ghost",size:"sm",className:"h-6 mt-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{o?.(e.id,!1)},children:E("message.collapse")})]})]}),!a&&(0,iM.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{l(!0),d(e.content)},children:(0,iM.jsx)(mc.Pencil,{className:"h-3 w-3"})}),(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:O,children:h?(0,iM.jsx)(ms.Check,{className:"h-3 w-3 text-green-500"}):(0,iM.jsx)(mq.Copy,{className:"h-3 w-3"})}),(0,iM.jsx)(f7.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive hover:text-destructive",onClick:()=>r(e.id),children:(0,iM.jsx)(nZ.Trash2,{className:"h-3 w-3"})})]})]})})}function Wq({comments:e,onNavigate:i}){let[n,r]=(0,iO.useState)(null),[s,o]=(0,iO.useState)(!1),[a,l]=(0,iO.useState)(0),c=(0,iO.useRef)(null),d=(0,n2.useTranslations)("common"),h=(0,iO.useCallback)(e=>{r(e),i(e)},[i]),u=(0,iO.useCallback)((e,i)=>{if(!i||!c.current)return;r(e);let n=c.current.getBoundingClientRect(),s=i.getBoundingClientRect();l(s.top-n.top+s.height/2)},[]);return 0===e.length?null:(0,iM.jsxs)("div",{ref:c,className:"absolute right-2 top-1/2 -translate-y-1/2 z-10 flex flex-col items-center",onMouseEnter:()=>o(!0),onMouseLeave:()=>{o(!1),r(null)},children:[(0,iM.jsx)("button",{className:`flex-shrink-0 mb-0.5 flex items-center justify-center size-5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-all ${s?"opacity-100":"opacity-0 pointer-events-none"} ${null===n||n<=0?"invisible":""}`,onClick:()=>{null!==n&&n>0&&h(n-1)},children:(0,iM.jsx)(If.ChevronUp,{className:"size-3.5"})}),(0,iM.jsx)("div",{className:"flex-1 w-full max-h-[50vh] overflow-y-auto scrollbar-none",children:(0,iM.jsx)("div",{className:"flex flex-col gap-[3px] px-1 py-0.5",children:e.map((e,i)=>(0,iM.jsx)("div",{className:"flex justify-center",children:(0,iM.jsx)("button",{className:`h-[4px] rounded-full transition-all duration-150 ${n===i?"bg-primary w-6":"user"===e.senderId?"bg-primary/30 hover:bg-primary/50 w-5":"bg-muted-foreground/25 hover:bg-muted-foreground/40 w-5"}`,onClick:()=>h(i),onMouseEnter:e=>u(i,e.currentTarget)})},e.id))})}),(0,iM.jsx)("button",{className:`flex-shrink-0 mt-0.5 flex items-center justify-center size-5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-all ${s?"opacity-100":"opacity-0 pointer-events-none"} ${null===n||n>=e.length-1?"invisible":""}`,onClick:()=>{null!==n&&n<e.length-1&&h(n+1)},children:(0,iM.jsx)(ra.ChevronDown,{className:"size-3.5"})}),s&&null!==n&&(0,iM.jsxs)("div",{className:"absolute right-full mr-3 w-56 rounded-lg border bg-popover p-2.5 shadow-lg z-50 animate-in fade-in-0 zoom-in-95 duration-75",style:{top:a,transform:"translateY(-50%)"},children:[(0,iM.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,iM.jsx)("span",{className:"font-medium text-xs",children:"user"===e[n].senderId?d("you"):(0,mO.findAgentById)(e[n].senderId)?.name??e[n].senderId}),(0,iM.jsx)("span",{className:"text-[10px] text-muted-foreground",children:new Date(e[n].createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),(0,iM.jsxs)("p",{className:"text-xs text-muted-foreground line-clamp-3 leading-relaxed",children:[e[n].content.slice(0,150),e[n].content.length>150?"...":""]})]})]})}function WK({issue:e,workspaceId:i,comments:n,expandedCommentIds:r,commentsViewportRef:s,commentRefs:o,onDeleteComment:a,onUpdateComment:l,onExpandedChange:c,scrollToComment:d,t:h}){return(0,iM.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col border-t",children:[(0,iM.jsx)("div",{className:"shrink-0 px-4 pt-2",children:(0,iM.jsx)("h3",{className:"text-sm font-medium mb-3",children:h("detail.comments",{count:n.length})})}),e.description&&(0,iM.jsx)("div",{className:"shrink-0 px-4 pb-3 border-b",children:(0,iM.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,iM.jsx)("div",{className:"flex items-center justify-center h-7 w-7 rounded-full bg-primary text-primary-foreground shrink-0",children:(0,iM.jsx)(WU.User,{className:"h-3.5 w-3.5"})}),(0,iM.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,iM.jsx)("span",{className:"text-xs font-medium",children:h("detail.author")}),(0,iM.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[h("detail.commented")," ",new Date(e.createdAt).toLocaleDateString()]})]}),(0,iM.jsx)("div",{className:"text-sm bg-muted/50 rounded-lg px-3 py-2 whitespace-pre-wrap",children:e.description})]})]})}),(0,iM.jsx)("div",{className:"flex-1 min-h-0 relative",children:n.length>0?(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsxs)("div",{ref:s,className:"h-full overflow-y-auto",children:[n.map(e=>(0,iM.jsx)("div",{ref:i=>{i?o.current.set(e.id,i):o.current.delete(e.id)},className:"px-4",children:(0,iM.jsx)(WV,{comment:e,expanded:r.has(e.id),workspaceId:i,onDelete:a,onUpdate:l,onExpandedChange:c})},e.id)),(0,iM.jsx)("div",{className:"h-20 pointer-events-none"})]}),(0,iM.jsx)(Wq,{comments:n,onNavigate:d})]}):null})]})}function WY({issue:e,workspaceId:i,open:n,onOpenChange:r,issueTasks:s,members:o,enabledAgents:a,onAddMembers:l,onDeleteIssue:c,t:d}){let[h,u]=(0,iO.useState)(!1),p=new Set(o),f=a.filter(e=>!p.has(e.id)).map(e=>({id:e.id,label:mz(e),description:e.role}));return(0,iM.jsxs)(Io.Sheet,{open:n,onOpenChange:r,children:[(0,iM.jsxs)(Io.SheetContent,{side:"right",className:"w-80 p-0 gap-0",children:[(0,iM.jsxs)(Io.SheetHeader,{className:"sr-only",children:[(0,iM.jsx)(Io.SheetTitle,{children:d("detail.tabInfo")}),(0,iM.jsx)(Io.SheetDescription,{children:e.title})]}),(0,iM.jsxs)("div",{className:"flex items-center gap-2 px-4 h-12 border-b shrink-0",children:[(0,iM.jsx)(IO.CircleDot,{className:"size-4 text-muted-foreground shrink-0"}),(0,iM.jsx)("span",{className:"text-sm font-medium truncate",children:e.title})]}),(0,iM.jsxs)(ss,{defaultValue:"info",className:"flex flex-col flex-1 min-h-0",children:[(0,iM.jsxs)(sa,{className:"w-full rounded-none border-b bg-transparent h-9 p-0 shrink-0",children:[(0,iM.jsxs)(sl,{value:"info",className:"flex-1 gap-1.5 data-[state=active]:shadow-none data-[state=active]:border-b-2 data-[state=active]:border-primary rounded-none",children:[(0,iM.jsx)(Is,{className:"size-3.5"}),d("detail.tabInfo")]}),(0,iM.jsxs)(sl,{value:"members",className:"flex-1 gap-1.5 data-[state=active]:shadow-none data-[state=active]:border-b-2 data-[state=active]:border-primary rounded-none",children:[(0,iM.jsx)(Il,{className:"size-3.5"}),d("detail.tabMembers")]})]}),(0,iM.jsxs)(Ia.ScrollArea,{className:"min-h-0 flex-1",children:[(0,iM.jsxs)(sc,{value:"info",className:"p-4 mt-0 space-y-4",children:[(0,iM.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:d("detail.infoStatus")}),(0,iM.jsx)(mj.Badge,{variant:IV[e.status],className:"text-[10px]",children:d(`status.${e.status}`)})]}),(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:d("detail.infoIssueId")}),(0,iM.jsxs)("span",{className:"font-mono text-xs",children:[e.id.slice(0,8),"..."]})]}),(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:d("detail.infoTaskCount")}),(0,iM.jsx)("span",{children:s.length})]}),(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:d("detail.infoMemberCount")}),(0,iM.jsx)("span",{children:o.length})]}),(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:d("detail.infoCreatedAt")}),(0,iM.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString()})]}),(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:d("detail.infoUpdatedAt")}),(0,iM.jsx)("span",{children:new Date(e.updatedAt).toLocaleDateString()})]}),e.branch&&(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:d("detail.infoBranch")}),(0,iM.jsxs)("span",{className:"font-mono text-xs flex items-center gap-1",children:[(0,iM.jsx)(I$.GitBranch,{className:"h-3 w-3"}),e.branch]})]}),e.prUrl&&(0,iM.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:d("detail.infoPr")}),(0,iM.jsx)("span",{className:"text-xs truncate max-w-[140px]",children:e.prUrl})]})]}),e.description&&(0,iM.jsxs)("div",{className:"space-y-1",children:[(0,iM.jsx)("span",{className:"text-xs text-muted-foreground",children:d("detail.infoDescription")}),(0,iM.jsx)("p",{className:"text-sm bg-muted/50 rounded-lg px-3 py-2 whitespace-pre-wrap",children:e.description})]})]}),(0,iM.jsxs)(sc,{value:"members",className:"p-4 mt-0 space-y-1",children:[o.map(e=>(0,iM.jsxs)("div",{className:"flex items-center gap-2 py-1.5",children:[(0,iM.jsx)(mP.AgentIcon,{agentId:"user"!==e?e:void 0,name:mH(a,e),className:"size-6 rounded-full"}),(0,iM.jsxs)("div",{className:"min-w-0",children:[(0,iM.jsx)("p",{className:"text-sm truncate",children:mH(a,e)}),(0,iM.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e})]})]},e)),(0,iM.jsxs)(f7.Button,{variant:"ghost",size:"sm",className:"w-full mt-2 text-xs text-muted-foreground",onClick:()=>u(!0),children:[(0,iM.jsx)(Ic,{className:"size-3.5 mr-1"}),d("detail.addMember")]})]})]})]}),(0,iM.jsx)("div",{className:"shrink-0 p-3 border-t",children:(0,iM.jsxs)(f7.Button,{variant:"ghost",size:"sm",className:"w-full text-destructive hover:text-destructive",onClick:c,children:[(0,iM.jsx)(nZ.Trash2,{className:"size-3.5 mr-1.5"}),d("detail.deleteIssue")]})})]}),(0,iM.jsx)(Ih,{open:h,onOpenChange:u,candidates:f,onAdd:l})]})}function WX({workspaceId:e}){let{issues:i,activeIssueId:n,startIssue:r,resumeIssue:s,updateIssue:o,deleteIssue:a}=(0,IC.useIssueStore)(),{tasks:l,loadTasks:c,retryTask:d,cancelTask:h,createTask:u,updateTask:p,deleteTask:f,reorderTasks:m}=(0,IH.useTaskStore)(),g=(0,mO.useAgentStore)(e=>e.agents),v=(0,mO.useAgentStore)(e=>e.ensure),[y,_]=(0,iO.useState)(!1),[b,w]=(0,iO.useState)(!1),[S,k]=(0,iO.useState)([]),[C,T]=(0,iO.useState)(()=>new Set),[E,D]=(0,iO.useState)(!1),N=(0,iO.useRef)(null),M=(0,iO.useRef)(new Map),O=(0,n2.useTranslations)("issue"),R=(0,n2.useTranslations)("task"),A=(0,n2.useTranslations)("common"),L=i.find(e=>e.id===n),j=(0,iO.useCallback)(async i=>{let n=await fetch(`/api/workspaces/${e}/issues/${i}/comments`);n.ok&&k(await n.json())},[e]);(0,iO.useEffect)(()=>{L&&(c(e,L.id),Promise.resolve().then(()=>j(L.id)))},[L,e,c,j]),(0,iO.useEffect)(()=>{v()},[v]),(0,iO.useEffect)(()=>{if(!L)return;let i=(0,lZ.getWS)(e),n=L.id,r=i.on("issue.updated",e=>{e.id===n&&j(n)});return()=>{r()}},[L,e,j]);let I=(0,iO.useMemo)(()=>L_.configure({HTMLAttributes:{class:"mention"},suggestion:{char:"@",items:({query:e})=>{let i=e.toLowerCase();return g.filter(e=>!1!==e.enabled&&`${e.name} ${e.role} ${e.description||""}`.toLowerCase().includes(i)).slice(0,6).map(e=>({id:e.id,label:e.name||e.role,description:`${e.role}${e.description?` \xb7 ${e.description}`:""}`}))},command:({editor:e,range:i,props:n})=>{e.chain().focus().insertContentAt(i,[{type:"mention",attrs:n}]).run()},render:()=>j5()}}),[g]),P=(0,iO.useMemo)(()=>j4(),[]),B=Oh({immediatelyRender:!1,extensions:[Lp,Lc.configure({placeholder:O("detail.commentPlaceholder")}),I,P],editorProps:{attributes:{class:"tiptap tiptap-chat"},handleKeyDown:(e,i)=>"Enter"===i.key&&!i.shiftKey&&!document.querySelector(".suggestion-menu")&&(i.preventDefault(),z(),!0)},content:""}),z=(0,iO.useCallback)(()=>{var i;let n,r;if(!B||!L)return;let s=B.getText().trim();if(!s)return;let o=(i=B.getJSON(),n=new Set,(r=e=>{if(e&&("mention"===e.type&&"string"==typeof e.attrs?.id&&n.add(e.attrs.id),Array.isArray(e.content)))for(let i of e.content)r(i)})(i),[...n]);fetch(`/api/workspaces/${e}/issues/${L.id}/comments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s,mentions:o})}).then(async e=>{if(!e.ok)return;let i=await e.json();k(e=>[...e,i]),B.commands.clearContent(),setTimeout(()=>{N.current?.scrollTo({top:N.current.scrollHeight,behavior:"smooth"})},50)})},[B,L,e]),F=!!B?.getText().trim(),H=async i=>{if(!L)return;let n=await fetch(`/api/workspaces/${e}/issues/${L.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({members:mW(Y,[...K,...i])})}),r=await n.json();IC.useIssueStore.getState().upsertIssue(r)},W=(0,iO.useCallback)(async i=>{L&&(await fetch(`/api/workspaces/${e}/issues/${L.id}/comments/${i}`,{method:"DELETE"}),k(e=>e.filter(e=>e.id!==i)))},[L,e]),$=(0,iO.useCallback)((e,i)=>{T(n=>{let r=new Set(n);return i?r.add(e):r.delete(e),r})},[]),U=(0,iO.useCallback)(async(e,i,n)=>{if(!L)return;let r=await fetch(`/api/workspaces/${e}/issues/${L.id}/comments/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})});if(!r.ok)return;let s=await r.json();k(e=>e.map(e=>e.id===s.id?s:e))},[L]),V=(0,iO.useCallback)(e=>{let i=S[e];i&&M.current.get(i.id)?.scrollIntoView({block:"start",behavior:"smooth"})},[S]),q=(0,iO.useMemo)(()=>{if(!L)return[];let e=l.filter(e=>e.issueId===L.id),i=L.tasks??[],n=new Map(i.map((e,i)=>[e,i])),r=i.length;return e.sort((e,i)=>(n.get(e.id)??r)-(n.get(i.id)??r))},[l,L]),K=L?.members??[],Y=g.filter(e=>!1!==e.enabled);return L?(0,iM.jsxs)("div",{className:"flex h-full overflow-hidden",children:[(0,iM.jsxs)("div",{className:"flex flex-col flex-1 min-w-0 overflow-hidden relative",children:[(0,iM.jsx)(IK,{issue:L,workspaceId:e,t:O,setEditOpen:w,setInfoOpen:_,startIssue:r,resumeIssue:s,members:K,enabledAgents:Y}),(0,iM.jsx)(W$,{issue:L,workspaceId:e,issueTasks:q,agents:Y,t:O,tTask:R,tc:A,retryTask:d,cancelTask:h,reorderTasks:m,createTask:u,updateTask:p,deleteTask:f}),(0,iM.jsx)(WK,{issue:L,workspaceId:e,comments:S,expandedCommentIds:C,commentsViewportRef:N,commentRefs:M,onDeleteComment:W,onUpdateComment:U,onExpandedChange:$,scrollToComment:V,t:O}),E?(0,iM.jsx)("div",{className:"absolute bottom-4 left-4 right-4 z-10 animate-in slide-in-from-bottom-2 duration-200",children:(0,iM.jsxs)("div",{className:"relative",children:[(0,iM.jsx)("button",{onClick:()=>D(!1),className:"absolute -top-2 -right-2 z-20 size-6 rounded-full bg-muted border shadow-sm flex items-center justify-center hover:bg-muted/80 transition-colors",children:(0,iM.jsx)(sg.X,{className:"size-3.5"})}),(0,iM.jsx)(LS,{editor:B,canSubmit:F,onSubmit:z})]})}):(0,iM.jsxs)("button",{onClick:()=>D(!0),className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-2 px-4 py-2 rounded-full bg-primary text-primary-foreground shadow-lg hover:bg-primary/90 transition-all z-10",children:[(0,iM.jsx)(nH.MessageSquare,{className:"size-4"}),(0,iM.jsx)("span",{className:"text-sm font-medium",children:O("detail.comment")})]})]}),(0,iM.jsx)(WY,{issue:L,workspaceId:e,open:y,onOpenChange:_,issueTasks:q,members:K,enabledAgents:Y,onAddMembers:H,onDeleteIssue:()=>{a(e,L.id)},t:O}),L&&(0,iM.jsx)(IP,{issue:L,open:b,onOpenChange:w,agents:Y,onSave:async i=>{await o(e,L.id,i)}})]}):(0,iM.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:O("detail.selectIssue")})}var WJ=e.i(381253);let WG=(0,nP.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var WZ=e.i(415360),WQ=e.i(129981);let W0=/not a git repository/i;function W1(e){return e instanceof Error&&W0.test(e.message)}let W2=(0,lY.create)(e=>({status:null,diffs:[],selectedFile:null,log:[],branches:[],loading:!1,error:null,notGitRepo:!1,loadStatus:async i=>{try{let n=await fetch(`/api/workspaces/${i}/git/status`);if(!n.ok)throw Error(await n.text());let r=await n.json();e({status:r,notGitRepo:!1})}catch(i){e({error:i.message,notGitRepo:W1(i)})}},loadDiffs:async(i,n)=>{e({loading:!0});try{let r=n?`/api/workspaces/${i}/git/diff?path=${encodeURIComponent(n)}`:`/api/workspaces/${i}/git/diff`,s=await fetch(r);if(!s.ok)throw Error(await s.text());let o=await s.json();e({diffs:o,loading:!1,notGitRepo:!1})}catch(i){e({error:i.message,loading:!1,notGitRepo:W1(i)})}},loadLog:async i=>{try{let n=await fetch(`/api/workspaces/${i}/git/log`);if(!n.ok)throw Error(await n.text());let r=await n.json();e({log:r,notGitRepo:!1})}catch(i){e({error:i.message,notGitRepo:W1(i)})}},loadBranches:async i=>{try{let n=await fetch(`/api/workspaces/${i}/git/branches`);if(!n.ok)throw Error(await n.text());let r=await n.json();e({branches:r,notGitRepo:!1})}catch(i){e({error:i.message,notGitRepo:W1(i)})}},initRepo:async i=>{try{let n=await fetch(`/api/workspaces/${i}/git/init`,{method:"POST"});if(!n.ok)throw Error(await n.text());e({error:null,notGitRepo:!1})}catch(i){e({error:i.message})}},commit:async(i,n)=>{try{let e=await fetch(`/api/workspaces/${i}/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n})});if(!e.ok)throw Error(await e.text())}catch(i){e({error:i.message})}},discard:async(i,n)=>{try{let e=await fetch(`/api/workspaces/${i}/git/discard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:n})});if(!e.ok)throw Error(await e.text())}catch(i){e({error:i.message})}},discardAll:async i=>{try{let e=await fetch(`/api/workspaces/${i}/git/discard-all`,{method:"POST"});if(!e.ok)throw Error(await e.text())}catch(i){e({error:i.message})}},checkout:async(i,n)=>{try{let e=await fetch(`/api/workspaces/${i}/git/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:n})});if(!e.ok)throw Error(await e.text())}catch(i){e({error:i.message})}},push:async e=>{let i=await fetch(`/api/workspaces/${e}/git/push`,{method:"POST"});if(!i.ok)throw Error((await i.json().catch(()=>({error:"Push failed"}))).error)},pull:async e=>{let i=await fetch(`/api/workspaces/${e}/git/pull`,{method:"POST"});if(!i.ok)throw Error((await i.json().catch(()=>({error:"Pull failed"}))).error)},getRemotes:async e=>{let i=await fetch(`/api/workspaces/${e}/git/remotes`);if(!i.ok)throw Error(await i.text());return i.json()},addRemote:async(e,i,n)=>{let r=await fetch(`/api/workspaces/${e}/git/remotes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,url:n})});if(!r.ok)throw Error((await r.json().catch(()=>({error:"Failed to add remote"}))).error)},selectFile:i=>e({selectedFile:i})}));function W5({workspaceId:e,onInitialized:i}){let n=(0,n2.useTranslations)("git.notInitialized"),r=W2(e=>e.initRepo),[s,o]=(0,iO.useState)(!1),a=(0,iO.useCallback)(async()=>{o(!0),await r(e),o(!1),i()},[e,r,i]);return(0,iM.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-4",children:[(0,iM.jsx)(I$.GitBranch,{size:32,className:"text-muted-foreground/40"}),(0,iM.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:n("message")}),(0,iM.jsx)("button",{onClick:a,disabled:s,className:"text-xs px-3 py-1.5 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed",children:n(s?"initializing":"initialize")})]})}function W3({open:e,onOpenChange:i,onSubmit:n}){let r=(0,n2.useTranslations)("git.remote"),s=(0,n2.useTranslations)("common"),[o,a]=(0,iO.useState)("origin"),[l,c]=(0,iO.useState)(""),[d,h]=(0,iO.useState)(!1),u=async()=>{if(o.trim()&&l.trim()){h(!0);try{await n(o.trim(),l.trim()),c(""),i(!1)}finally{h(!1)}}};return(0,iM.jsx)(lq.Dialog,{open:e,onOpenChange:i,children:(0,iM.jsxs)(lq.DialogContent,{className:"sm:max-w-md",children:[(0,iM.jsx)(lq.DialogHeader,{children:(0,iM.jsx)(lq.DialogTitle,{children:r("bindTitle")})}),(0,iM.jsxs)("div",{className:"space-y-3",children:[(0,iM.jsxs)("div",{children:[(0,iM.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:r("nameLabel")}),(0,iM.jsx)(me.Input,{value:o,onChange:e=>a(e.target.value),placeholder:r("namePlaceholder"),className:"h-8 text-xs"})]}),(0,iM.jsxs)("div",{children:[(0,iM.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:r("urlLabel")}),(0,iM.jsx)(me.Input,{value:l,onChange:e=>c(e.target.value),placeholder:r("urlPlaceholder"),className:"h-8 text-xs",onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})]})]}),(0,iM.jsxs)(lq.DialogFooter,{children:[(0,iM.jsx)(lq.DialogClose,{render:(0,iM.jsx)(f7.Button,{variant:"outline",size:"sm"}),children:s("cancel")}),(0,iM.jsx)(f7.Button,{size:"sm",onClick:u,disabled:!o.trim()||!l.trim()||d,children:r(d?"adding":"addRemote")})]})]})})}let W4=(0,sm.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,iM.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-xs",children:"Loading editor..."})}),W6={modified:"text-yellow-600",added:"text-green-600",deleted:"text-red-600",renamed:"text-blue-600",untracked:"text-gray-500"},W8={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"U"};function W9({workspaceId:e}){let i,n,r=(0,n2.useTranslations)("git.changes"),s=(0,n2.useTranslations)("common"),{status:o,diffs:a,selectedFile:l,loading:c,notGitRepo:d,branches:h,loadStatus:u,loadDiffs:p,loadBranches:f,commit:m,discard:g,discardAll:v,checkout:y,selectFile:_,push:b,pull:w,getRemotes:S,addRemote:k}=W2(),C=(0,rd.useEditorStore)(e=>e.openFile),{resolvedTheme:T}=(0,s0.useTheme)(),[E,D]=(0,iO.useState)(""),[N,M]=(0,iO.useState)(!1),[O,R]=(0,iO.useState)(!1),[A,L]=(0,iO.useState)(!1),[j,I]=(0,iO.useState)(!1),[P,B]=(0,iO.useState)(!1),[z,F]=(0,iO.useState)(!1),[H,W]=(0,iO.useState)(""),[$,U]=(0,iO.useState)(!1),[V,q]=(0,iO.useState)(null),K=(0,iO.useRef)(null),Y=(0,xC.useIsMobile)(),X=(0,iO.useRef)(null),[J,G]=(0,iO.useState)(!1),Z=(0,iO.useCallback)(()=>{u(e),p(e)},[e,u,p]);(0,iO.useEffect)(()=>{Z(),f(e)},[e,Z,f]);let Q=(0,iO.useCallback)(e=>{_(e===l?null:e)},[l,_]),ee=(0,iO.useCallback)((i,n)=>{i.stopPropagation(),C(e,n)},[e,C]),et=(0,iO.useCallback)(async(i,n)=>{i.stopPropagation(),await g(e,n),Z()},[e,g,Z]),ei=(0,iO.useCallback)(async()=>{await v(e),Z()},[e,v,Z]),en=(0,iO.useCallback)(async i=>{L(!1),await y(e,i),Z(),f(e)},[e,y,Z,f]),er=(0,iO.useCallback)(async()=>{E.trim()&&(M(!0),_(null),await m(e,E.trim()),D(""),M(!1),Z())},[e,E,m,Z,_]),es=(0,iO.useCallback)(async()=>{if(!O&&!N){R(!0);try{let i=await fetch(`/api/workspaces/${e}/git/generate-commit-message`,{method:"POST"});if(!i.ok){let e=await i.json().catch(()=>({error:"Failed to generate"}));throw Error(e.error)}let n=await i.json();n.message&&D(n.message)}catch(e){sZ.toast.error(e.message||r("failedCommitMessage"))}finally{R(!1)}}},[e,O,N]),eo=(0,iO.useCallback)(e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&er()},[er]),ea=(0,iO.useCallback)(async()=>{I(!0);try{if(!(await S(e)).length)return void B(!0);await b(e),await w(e),sZ.toast.success(r("syncedSuccessfully")),Z()}catch(e){e.message?.includes("No remote")?B(!0):sZ.toast.error(r("syncFailed"),{description:e.message})}finally{I(!1)}},[e,b,w,S,Z]),el=(0,iO.useCallback)(async(i,n)=>{await k(e,i,n),sZ.toast.success(r("syncedSuccessfully"));try{await b(e),await w(e),sZ.toast.success(r("syncedSuccessfully")),Z()}catch(e){sZ.toast.error(r("syncFailed"),{description:e.message})}},[e,k,b,w,Z]),ec=(0,iO.useCallback)(async()=>{try{let i=await fetch(`/api/workspaces/${e}/files/content?path=.gitignore`),n=await i.json();W(n.content??"")}catch{W("")}F(!0)},[e]),ed=(0,iO.useCallback)(async()=>{U(!0);try{await fetch(`/api/workspaces/${e}/files/content`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:".gitignore",content:H})}),F(!1),Z()}finally{U(!1)}},[e,H,Z]),eh=(0,iO.useCallback)(async i=>{q(null);try{let n=await fetch(`/api/workspaces/${e}/files/content?path=.gitignore`),r=(await n.json()).content??"";if(r.split("\n").filter(Boolean).includes(i))return;let s=r&&!r.endsWith("\n")?r+"\n"+i+"\n":r+i+"\n";await fetch(`/api/workspaces/${e}/files/content`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:".gitignore",content:s})}),Z()}catch{}},[e,Z]),eu=(0,iO.useCallback)((e,i)=>{e.preventDefault(),e.stopPropagation(),q({x:e.clientX,y:e.clientY,path:i})},[]);if((0,iO.useEffect)(()=>{if(!V)return;let e=()=>q(null);return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[V]),(0,iO.useEffect)(()=>{let e=X.current;if(!e)return;let i=new ResizeObserver(e=>{for(let i of e)G(i.contentRect.height<300)});return i.observe(e),()=>i.disconnect()},[]),d)return(0,iM.jsxs)("div",{className:"flex flex-col h-full",children:[(0,iM.jsx)("div",{className:"flex items-center px-2 py-1.5 border-b",children:(0,iM.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:r("title")})}),(0,iM.jsx)(W5,{workspaceId:e,onInitialized:Z})]});let ep=a.find(e=>e.path===l),ef=(o?.files.length??0)>0;return(0,iM.jsxs)("div",{ref:X,className:`flex h-full overflow-hidden rounded-t-xl bg-background ${Y?"flex-col":""}`,children:[(0,iM.jsxs)("div",{className:`flex flex-col bg-muted/20 ${Y?"w-full border-b max-h-[40%]":J?"w-40 border-r":"w-64 border-r"}`,children:[(0,iM.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b",children:[(0,iM.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,iM.jsxs)("button",{onClick:()=>L(!A),className:"flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground w-full",children:[(0,iM.jsx)(I$.GitBranch,{size:13,className:"shrink-0"}),(0,iM.jsx)("span",{className:"truncate",children:o?.branch??"..."}),o&&ef&&(0,iM.jsxs)("span",{className:"text-muted-foreground",children:["(",o.files.length,")"]}),(0,iM.jsx)(ra.ChevronDown,{size:12,className:"shrink-0"})]}),A&&(0,iM.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-48 bg-popover border rounded shadow-md py-0.5 max-h-60 overflow-auto",children:[h.map(e=>(0,iM.jsx)("button",{onClick:()=>en(e.name),className:`w-full text-left px-2 py-1 text-xs hover:bg-accent truncate ${e.current?"font-semibold text-foreground":"text-muted-foreground"}`,children:e.name},e.name)),0===h.length&&(0,iM.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:r("noBranches")})]})]}),ef&&(0,iM.jsx)("button",{onClick:ei,className:"p-1 text-muted-foreground hover:text-destructive",title:r("discardAll"),children:(0,iM.jsx)(nZ.Trash2,{size:13})}),(0,iM.jsx)("button",{onClick:Z,className:"p-1 text-muted-foreground hover:text-foreground",title:s("refresh"),children:(0,iM.jsx)(rp.RefreshCw,{size:13})}),(0,iM.jsx)("button",{onClick:ec,className:"p-1 text-muted-foreground hover:text-foreground",title:r("editGitignore"),children:(0,iM.jsx)(nW.FileText,{size:13})})]}),A&&(0,iM.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>L(!1)}),(0,iM.jsxs)("div",{className:"flex-1 overflow-auto",children:[c&&!o&&(0,iM.jsx)("div",{className:"p-2 text-xs text-muted-foreground",children:s("loading")}),o?.files.map(e=>(0,iM.jsxs)("div",{onClick:()=>Q(e.path),onContextMenu:i=>eu(i,e.path),className:`group w-full text-left px-2 py-1 text-xs font-mono flex items-center gap-1.5 hover:bg-accent cursor-pointer ${l===e.path?"bg-accent":""}`,children:[(0,iM.jsx)("span",{className:`w-4 text-center font-bold shrink-0 ${W6[e.status]}`,children:W8[e.status]}),(0,iM.jsx)("span",{className:"truncate flex-1",children:e.path}),(0,iM.jsxs)("span",{className:"hidden group-hover:flex items-center gap-0.5 shrink-0",children:[(0,iM.jsx)("button",{onClick:i=>ee(i,e.path),className:"p-0.5 rounded hover:bg-accent/80",title:s("open"),children:(0,iM.jsx)(WJ.FileCode,{size:13})}),(0,iM.jsx)("button",{onClick:i=>et(i,e.path),className:"p-0.5 rounded hover:bg-accent/80",title:r("discardAll"),children:(0,iM.jsx)(IW.RotateCcw,{size:13})})]})]},e.path)),o?.clean&&(0,iM.jsx)("div",{className:"p-2 text-xs text-muted-foreground",children:r("noChanges")})]}),(!J||Y)&&ef&&(0,iM.jsxs)("div",{className:"border-t p-2 space-y-1.5",children:[(0,iM.jsxs)("div",{className:"relative",children:[(0,iM.jsx)("textarea",{value:E,onChange:e=>D(e.target.value),onKeyDown:eo,placeholder:r("commitMessagePlaceholder"),rows:3,className:"w-full resize-none text-xs px-2 pt-1 pr-8 pb-7 border rounded bg-background disabled:opacity-50",disabled:N||O}),(0,iM.jsx)("button",{type:"button",onClick:es,disabled:O||N||!ef,className:"absolute bottom-1.5 right-1.5 p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"AI generate commit message",children:O?(0,iM.jsx)(rc.Loader2,{size:14,className:"animate-spin"}):(0,iM.jsx)(WZ.Sparkles,{size:14})})]}),(0,iM.jsx)("button",{onClick:er,disabled:!E.trim()||N,className:"w-full text-xs px-2 py-1 rounded bg-primary text-primary-foreground disabled:opacity-50 disabled:cursor-not-allowed",children:N?r("committing"):r("commit")})]}),!ef&&(o?.ahead??0)>0&&(0,iM.jsx)("div",{className:"border-t p-2",children:(0,iM.jsxs)("button",{onClick:ea,disabled:j,className:"w-full text-xs px-2 py-1 rounded bg-primary text-primary-foreground disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-1.5",children:[j?(0,iM.jsx)(rc.Loader2,{size:13,className:"animate-spin"}):(0,iM.jsx)(WQ.Upload,{size:13}),j?r("syncing"):r("syncChanges")]})})]}),J&&!Y&&ef&&(0,iM.jsxs)("div",{className:"w-52 border-r flex flex-col p-2 space-y-1.5",children:[(0,iM.jsxs)("div",{className:"relative flex-1 flex flex-col",children:[(0,iM.jsx)("textarea",{value:E,onChange:e=>D(e.target.value),onKeyDown:eo,placeholder:r("commitMessagePlaceholder"),className:"w-full flex-1 resize-none text-xs px-2 pt-1 pr-8 pb-1 border rounded bg-background disabled:opacity-50",disabled:N||O}),(0,iM.jsx)("button",{type:"button",onClick:es,disabled:O||N||!ef,className:"absolute top-1.5 right-1.5 p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"AI generate commit message",children:O?(0,iM.jsx)(rc.Loader2,{size:14,className:"animate-spin"}):(0,iM.jsx)(WZ.Sparkles,{size:14})})]}),(0,iM.jsx)("button",{onClick:er,disabled:!E.trim()||N,className:"w-full text-xs px-2 py-1 rounded bg-primary text-primary-foreground disabled:opacity-50 disabled:cursor-not-allowed",children:N?r("committing"):r("commit")})]}),(0,iM.jsx)("div",{className:`flex-1 ${Y?"min-h-0":""}`,children:ep?(0,iM.jsx)(xT,{oldContent:ep.oldContent,newContent:ep.newContent,path:ep.path}):(0,iM.jsx)("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:ef?r("selectFileDiff"):r("noChangesToShow")})}),(0,iM.jsx)(lq.Dialog,{open:z,onOpenChange:F,children:(0,iM.jsxs)(lq.DialogContent,{className:"sm:max-w-2xl",children:[(0,iM.jsx)(lq.DialogHeader,{children:(0,iM.jsx)(lq.DialogTitle,{children:".gitignore"})}),(0,iM.jsx)("div",{className:"h-80 border rounded overflow-hidden",children:(0,iM.jsx)(W4,{height:"100%",language:"plaintext",value:H,onChange:e=>W(e??""),options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},lineNumbers:"on"},theme:"dark"===T?"vs-dark":"vs"})}),(0,iM.jsxs)(lq.DialogFooter,{children:[(0,iM.jsx)(lq.DialogClose,{render:(0,iM.jsx)(f7.Button,{variant:"outline",size:"sm"}),children:s("cancel")}),(0,iM.jsx)(f7.Button,{size:"sm",onClick:ed,disabled:$,children:$?s("saving"):s("save")})]})]})}),V&&(0,iM.jsxs)("div",{ref:K,className:"fixed z-[100] bg-popover border rounded-lg shadow-md py-1 text-xs min-w-40 ring-1 ring-foreground/10",style:{left:V.x,top:V.y},children:[(0,iM.jsxs)("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-accent text-left",onClick:()=>eh(V.path.split("/").pop()),children:[(0,iM.jsx)(WG,{size:13}),(0,iM.jsx)("span",{children:r("ignoreThisFile")}),(0,iM.jsx)("span",{className:"ml-auto text-muted-foreground truncate max-w-24",children:V.path.split("/").pop()})]}),(0,iM.jsxs)("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-accent text-left",onClick:()=>{let e=V.path.lastIndexOf("/"),i=e>=0?V.path.substring(0,e+1):"";i&&eh(i)},children:[(0,iM.jsx)(WG,{size:13}),(0,iM.jsx)("span",{children:r("ignoreFilePath",{path:(i=V.path.lastIndexOf("/"))>=0?V.path.substring(0,i+1):V.path})}),(0,iM.jsx)("span",{className:"ml-auto text-muted-foreground truncate max-w-24",children:(n=V.path.lastIndexOf("/"))>=0?V.path.substring(0,n+1):V.path})]})]}),(0,iM.jsx)(W3,{open:P,onOpenChange:B,onSubmit:el})]})}function W7({count:e,kind:i}){return e<=0?null:(0,iM.jsx)("span",{className:"absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-foreground px-1 text-[9px] font-medium leading-none text-background",children:e})}function $e({workspaceId:e}){let i=(0,n2.useTranslations)("git.commits"),n=(0,n2.useTranslations)("common"),{log:r,loading:s,notGitRepo:o,status:a,loadLog:l,loadStatus:c,push:d,pull:h,getRemotes:u,addRemote:p}=W2(),[f,m]=(0,iO.useState)(null),[g,v]=(0,iO.useState)(!1),[y,_]=(0,iO.useState)(null),b=a?.ahead??0,w=a?.behind??0,S=b>0?b:-1,k=(0,iO.useCallback)(()=>{l(e),c(e)},[e,l,c]);(0,iO.useEffect)(()=>{k()},[k]);let C=async n=>{m(n);try{if(!(await u(e)).length){_(n),v(!0);return}await T(n)}catch(e){e.message?.includes("No remote")?(_(n),v(!0)):sZ.toast.error("push"===n?i("pushFailed"):i("pullFailed"),{description:e.message})}finally{m(null)}},T=async n=>{"push"===n?(await d(e),sZ.toast.success(i("pushedSuccessfully"))):(await h(e),sZ.toast.success(i("pulledSuccessfully"))),k()},E=async(n,r)=>{await p(e,n,r),sZ.toast.success(i("remoteAdded")),y&&(await T(y),_(null))};return o?(0,iM.jsxs)("div",{className:"flex flex-col h-full overflow-hidden rounded-t-xl bg-background",children:[(0,iM.jsx)("div",{className:"flex items-center px-2 py-1.5 border-b",children:(0,iM.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:i("title")})}),(0,iM.jsx)(W5,{workspaceId:e,onInitialized:k})]}):(0,iM.jsxs)("div",{className:"flex flex-col h-full overflow-hidden rounded-t-xl bg-background",children:[(0,iM.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b",children:[(0,iM.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:r.length>0?i("titleWithCount",{count:r.length}):i("title")}),(0,iM.jsxs)("div",{className:"flex items-center gap-1",children:[(0,iM.jsxs)("button",{onClick:()=>C("push"),disabled:null!==f,className:"relative p-1 text-muted-foreground hover:text-foreground disabled:opacity-50",title:b>0?i("pushNCommits",{count:b}):"Push",children:["push"===f?(0,iM.jsx)(rc.Loader2,{size:13,className:"animate-spin"}):(0,iM.jsx)(WQ.Upload,{size:13}),(0,iM.jsx)(W7,{count:b,kind:"push"})]}),(0,iM.jsxs)("button",{onClick:()=>C("pull"),disabled:null!==f,className:"relative p-1 text-muted-foreground hover:text-foreground disabled:opacity-50",title:w>0?i("pullNCommits",{count:w}):"Pull",children:["pull"===f?(0,iM.jsx)(rc.Loader2,{size:13,className:"animate-spin"}):(0,iM.jsx)(ma.Download,{size:13}),(0,iM.jsx)(W7,{count:w,kind:"pull"})]}),(0,iM.jsx)("button",{onClick:k,className:"text-muted-foreground hover:text-foreground",children:(0,iM.jsx)(rp.RefreshCw,{size:13})})]})]}),(0,iM.jsxs)("div",{className:"flex-1 overflow-auto",children:[s&&!r.length&&(0,iM.jsx)("div",{className:"p-2 text-xs text-muted-foreground",children:n("loading")}),r.map((e,n)=>{let r=n===S;return(0,iM.jsxs)("div",{className:`px-2 py-1.5 border-b hover:bg-accent cursor-default ${r?"border-l-2 border-l-blue-500":""}`,children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2",children:[r&&(0,iM.jsx)("span",{title:i("remoteTrackingBranch"),children:(0,iM.jsx)(nV,{size:13,className:"shrink-0 text-blue-500"})}),(0,iM.jsx)("code",{className:"text-xs font-mono text-blue-600 shrink-0",children:e.hash.slice(0,7)}),(0,iM.jsx)("span",{className:"text-xs truncate",children:e.message.split("\n")[0]})]}),(0,iM.jsxs)("div",{className:`flex items-center gap-2 mt-0.5 ${r?"pl-[21px]":""}`,children:[(0,iM.jsx)("span",{className:"text-xs text-muted-foreground",children:e.author}),(0,iM.jsx)("span",{className:"text-xs text-muted-foreground",children:new Date(e.date).toLocaleDateString()})]})]},e.hash)}),!s&&!r.length&&(0,iM.jsx)("div",{className:"p-2 text-xs text-muted-foreground",children:i("noCommits")})]}),(0,iM.jsx)(W3,{open:g,onOpenChange:v,onSubmit:E})]})}function $t({workspaceId:e}){let i=(0,n2.useTranslations)("git.graph"),n=(0,n2.useTranslations)("common"),r=(0,n2.useTranslations)("home.time"),{log:s,status:o,notGitRepo:a,loadLog:l,loadStatus:c}=W2(),d=(0,iO.useCallback)(()=>{l(e),c(e)},[e,l,c]);if((0,iO.useEffect)(()=>{d()},[d]),a)return(0,iM.jsxs)("div",{className:"flex flex-col h-full overflow-hidden rounded-t-xl bg-background",children:[(0,iM.jsx)("div",{className:"flex items-center px-2 py-1.5 border-b",children:(0,iM.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:i("title")})}),(0,iM.jsx)(W5,{workspaceId:e,onInitialized:d})]});let h=o?.branch??"—",u=o?.ahead??0,p=o?.behind??0;return(0,iM.jsxs)("div",{className:"flex flex-col h-full overflow-hidden rounded-t-xl bg-background",children:[(0,iM.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,iM.jsx)(I$.GitBranch,{size:14}),(0,iM.jsx)("span",{className:"font-mono font-medium",children:h}),u>0&&(0,iM.jsxs)("span",{className:"text-green-600",children:["↑",u]}),p>0&&(0,iM.jsxs)("span",{className:"text-red-500",children:["↓",p]})]}),(0,iM.jsx)("button",{onClick:d,className:"text-muted-foreground hover:text-foreground",children:(0,iM.jsx)(rp.RefreshCw,{size:13})})]}),(0,iM.jsxs)("div",{className:"flex-1 overflow-auto pl-4",children:[s.map((e,i)=>{let n=i===s.length-1;return(0,iM.jsxs)("div",{className:"flex items-start gap-2 py-1",children:[(0,iM.jsxs)("div",{className:"flex flex-col items-center shrink-0 pt-1",children:[(0,iM.jsx)(nV,{size:14,className:"text-blue-500 shrink-0"}),!n&&(0,iM.jsx)("div",{className:"w-px flex-1 bg-border min-h-4"})]}),(0,iM.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,iM.jsx)("div",{className:"text-xs truncate",children:e.message.split("\n")[0]}),(0,iM.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,iM.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:e.hash.slice(0,7)}),(0,iM.jsx)("span",{className:"text-xs text-muted-foreground",children:e.author}),(0,iM.jsx)("span",{className:"text-xs text-muted-foreground",children:function(e,i){let n=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(n<1)return i("justNow");if(n<60)return i("minutesAgo",{n:n});let r=Math.floor(n/60);if(r<24)return i("hoursAgo",{n:r});let s=Math.floor(r/24);return s<30?i("daysAgo",{n:s}):new Date(e).toLocaleDateString()}(e.date,r)})]})]})]},e.hash)}),!s.length&&(0,iM.jsx)("div",{className:"p-2 text-xs text-muted-foreground",children:n("noData")})]})]})}var $i=e.i(588591),$n=e.i(36539),$n=$n,$r=e.i(92457);let $s=(0,nP.default)("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);var $o=e.i(638322),$a=e.i(515104);function $l({workspaceId:e}){var i;let n=(0,n2.useTranslations)("projectSettings"),r=(0,n2.useTranslations)("common"),[s,o]=(0,iO.useState)(null),[a,l]=(0,iO.useState)(""),[c,d]=(0,iO.useState)(""),[h,u]=(0,iO.useState)(!0),[p,f]=(0,iO.useState)(!1),[m,g]=(0,iO.useState)(!1),[v,y]=(0,iO.useState)(!1),[_,b]=(0,iO.useState)(!1),[w,S]=(0,iO.useState)(!1),[k,C]=(0,iO.useState)(!1),[T,E]=(0,iO.useState)({status:"idle"}),D=(0,iO.useRef)(!1),[N,M]=(0,iO.useState)(!1),[O,R]=(0,iO.useState)("default"),[A,L]=(0,iO.useState)($d()),j=(0,mM.useChannelStore)(e=>e.channels),I=(0,IC.useIssueStore)(e=>e.issues),P=(0,mM.useChannelStore)(e=>e.loadChannels),B=(0,IC.useIssueStore)(e=>e.loadIssues);(0,iO.useEffect)(()=>{Promise.all([fetch(`/api/workspaces/${e}`).then(e=>e.json()),fetch(`/api/workspaces/${e}/prompt`).then(e=>e.json()),P(e),B(e)]).then(([e,i])=>{o(e),l(i.prompt??""),d(i.prompt??"");let n=e.notificationSettings??$d();L(n),u(!1),(0,$a.getNotificationPermission)().then(e=>{if(R(e),"granted"===e&&"native"===n.provider&&!n.native?.permissionGranted){let e={...n,native:{permissionGranted:!0}};L(e),V(e)}})}).catch(()=>u(!1))},[e,P,B]);let z=s?.autoProcessIssues!==!1,F=a!==c,H=(0,mO.useAgentStore)(e=>e.agents).filter(e=>"bot"===e.role&&!1!==e.enabled),W=!!(A.wechat?.token&&A.wechat?.accountId);(0,iO.useEffect)(()=>{if(!A.enabled||"wechat"!==A.provider||!["wait","scaned"].includes(T.status))return;let i=window.setInterval(()=>{D.current||(D.current=!0,fetch(`/api/workspaces/${e}/notifications/wechat/qr?poll=1`,{method:"POST"}).then(async e=>{let i=await e.json().catch(()=>null);if(!e.ok)throw Error(i?.error||"Failed to poll WeChat QR status");E({status:i.status??"wait",qrcodeImgContent:i.qrcodeImgContent??T.qrcodeImgContent,accountId:i.accountId,baseUrl:i.baseUrl}),i.workspace&&(o(i.workspace),L(i.workspace.notificationSettings??$d()),sZ.toast.success(n("wechat.connectedToast")))}).catch(e=>{sZ.toast.error(n("wechat.pollFailed"),{description:e instanceof Error?e.message:void 0})}).finally(()=>{D.current=!1}))},2e3);return()=>window.clearInterval(i)},[A.enabled,A.provider,T.status,T.qrcodeImgContent,e]);let $=async i=>{if(s&&!p){f(!0);try{let n=await fetch(`/api/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoProcessIssues:i})}),r=await n.json();o(r)}finally{f(!1)}}},U=async()=>{if(!m){g(!0);try{let i=await fetch(`/api/workspaces/${e}/prompt`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a})});if(!i.ok){let e=await i.json().catch(()=>null);throw Error(e?.error||"Failed to save workspace prompt")}let r=await i.json();l(r.prompt),d(r.prompt),sZ.toast.success(n("prompt.saveSuccess"))}catch(e){sZ.toast.error(n("prompt.saveFailed"),{description:e instanceof Error?e.message:void 0})}finally{g(!1)}}},V=async i=>{if(!s||v)return null;y(!0);try{let n=await fetch(`/api/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationSettings:i})});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error||"Failed to save notification settings")}let r=await n.json();return o(r),L(r.notificationSettings??$d()),r}catch(e){return sZ.toast.error(n("notifications.saveFailed"),{description:e instanceof Error?e.message:void 0}),null}finally{y(!1)}},q=e=>{let i={...A,...e,lark:{...A.lark,...e.lark},wechat:{...A.wechat,...e.wechat}};L(i),V(i)},K=async()=>{if(!_){b(!0);try{if(!await V(A))throw Error("Failed to save notification settings");let i=await fetch(`/api/workspaces/${e}/notifications/start`,{method:"POST"});if(!i.ok){let e=await i.json().catch(()=>null);throw Error(e?.error||"Failed to start notification service")}let r=await i.json();r.workspace?(o(r.workspace),L(r.workspace.notificationSettings??$d())):L({...A,serviceRunning:!0}),sZ.toast.success(n("notifications.startSuccess"))}catch(e){sZ.toast.error(n("notifications.startFailed"),{description:e instanceof Error?e.message:void 0})}finally{b(!1)}}},Y=async()=>{if(!_){b(!0);try{let i=await fetch(`/api/workspaces/${e}/notifications/stop`,{method:"POST"});if(!i.ok){let e=await i.json().catch(()=>null);throw Error(e?.error||"Failed to stop notification service")}let r=await i.json();r.workspace?(o(r.workspace),L(r.workspace.notificationSettings??$d())):L({...A,serviceRunning:!1}),sZ.toast.success(n("notifications.stopSuccess"))}catch(e){sZ.toast.error(n("notifications.stopFailed"),{description:e instanceof Error?e.message:void 0})}finally{b(!1)}}},X=async()=>{if(!w){S(!0);try{let i=await fetch(`/api/workspaces/${e}/notifications/test`,{method:"POST"}),r=await i.json().catch(()=>null);if(!i.ok)throw Error(r?.reason||r?.error||"Failed to send test notification");sZ.toast.success(n("notifications.testSuccess"))}catch(e){sZ.toast.error(n("notifications.testFailed"),{description:e instanceof Error?e.message:void 0})}finally{S(!1)}}},J=async()=>{if(!k){C(!0);try{if(!await V({...A,provider:"wechat"}))throw Error("Failed to save notification settings");let i=await fetch(`/api/workspaces/${e}/notifications/wechat/qr${W?"?refresh=1":""}`,{method:"POST"}),n=await i.json().catch(()=>null);if(!i.ok)throw Error(n?.error||"Failed to get WeChat QR code");E({status:n.status??"wait",qrcodeImgContent:n.qrcodeImgContent,accountId:n.accountId,baseUrl:n.baseUrl}),n.workspace&&(o(n.workspace),L(n.workspace.notificationSettings??$d()))}catch(e){sZ.toast.error(n("wechat.getQrFailed"),{description:e instanceof Error?e.message:void 0})}finally{C(!1)}}};return h?(0,iM.jsxs)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:[(0,iM.jsx)(rc.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),n("loading")]}):s?(0,iM.jsxs)(Ia.ScrollArea,{className:"h-full",children:[(0,iM.jsx)("div",{className:"flex items-center px-2 py-1.5 border-b text-xs font-medium text-muted-foreground",children:(0,iM.jsx)("span",{children:n("title")})}),(0,iM.jsxs)("div",{className:"p-4 space-y-6",children:[(0,iM.jsxs)("div",{className:"space-y-3",children:[(0,iM.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:n("info.title")}),(0,iM.jsx)($h,{icon:(0,iM.jsx)(nz.FolderOpen,{size:14}),label:n("info.path"),value:s.boundDirs[0]??"-"}),(0,iM.jsx)($h,{icon:(0,iM.jsx)(nI.Hash,{size:14}),label:n("info.channels"),value:String(j.length)}),(0,iM.jsx)($h,{icon:(0,iM.jsx)(nB,{size:14}),label:n("info.issues"),value:String(I.length)})]}),(0,iM.jsxs)("div",{className:"space-y-3",children:[(0,iM.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:n("automation.title")}),(0,iM.jsxs)("div",{className:"flex items-center justify-between rounded-md border px-3 py-2.5",children:[(0,iM.jsxs)("div",{className:"space-y-0.5 pr-4",children:[(0,iM.jsx)(mi.Label,{htmlFor:"auto-process",className:"text-sm font-medium",children:n("automation.autoProcess")}),(0,iM.jsx)("p",{className:"text-xs text-muted-foreground",children:n("automation.autoProcessDescription")})]}),(0,iM.jsxs)("div",{className:"flex items-center gap-2",children:[p&&(0,iM.jsx)(rc.Loader2,{className:"h-3 w-3 animate-spin text-muted-foreground"}),(0,iM.jsx)(mt.Switch,{id:"auto-process",checked:z,onCheckedChange:$,disabled:p})]})]})]}),(0,iM.jsxs)("div",{className:"space-y-3",children:[(0,iM.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:n("notifications.title")}),(0,iM.jsxs)("div",{className:"space-y-4 rounded-md border px-3 py-3",children:[(0,iM.jsxs)("div",{className:"flex items-center justify-between",children:[(0,iM.jsxs)("div",{className:"space-y-0.5 pr-4",children:[(0,iM.jsx)(mi.Label,{htmlFor:"message-notifications",className:"text-sm font-medium",children:n("notifications.messageNotifications")}),(0,iM.jsx)("p",{className:"text-xs text-muted-foreground",children:n("notifications.messageNotificationsDescription")})]}),(0,iM.jsxs)("div",{className:"flex items-center gap-2",children:[v&&(0,iM.jsx)(rc.Loader2,{className:"h-3 w-3 animate-spin text-muted-foreground"}),(0,iM.jsx)(mt.Switch,{id:"message-notifications",checked:A.enabled,onCheckedChange:e=>q({enabled:e}),disabled:v})]})]}),A.enabled&&(0,iM.jsxs)("div",{className:"space-y-4",children:[(0,iM.jsxs)(ss,{value:A.provider,onValueChange:e=>q({provider:e}),children:[(0,iM.jsxs)(sa,{className:"grid w-full grid-cols-3",children:[(0,iM.jsx)(sl,{value:"lark",children:n("notifications.lark")}),(0,iM.jsx)(sl,{value:"wechat",children:n("notifications.wechat")}),(0,iM.jsx)(sl,{value:"native",children:n("notifications.native")})]}),(0,iM.jsxs)(sc,{value:"lark",className:"space-y-3 pt-2",children:[(0,iM.jsxs)("div",{className:"grid gap-2",children:[(0,iM.jsx)(mi.Label,{htmlFor:"lark-app-id",className:"text-xs text-muted-foreground",children:n("notifications.appId")}),(0,iM.jsx)(me.Input,{id:"lark-app-id",value:A.lark?.appId??"",onChange:e=>L({...A,lark:{...A.lark,appId:e.target.value}}),placeholder:"cli_xxx",disabled:_})]}),(0,iM.jsxs)("div",{className:"grid gap-2",children:[(0,iM.jsx)(mi.Label,{htmlFor:"lark-app-secret",className:"text-xs text-muted-foreground",children:n("notifications.appSecret")}),(0,iM.jsx)(me.Input,{id:"lark-app-secret",type:"password",value:A.lark?.appSecret??"",onChange:e=>L({...A,lark:{...A.lark,appSecret:e.target.value}}),placeholder:"app secret",disabled:_})]}),(0,iM.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,iM.jsxs)(f7.Button,{type:"button",size:"sm",variant:A.serviceRunning?"outline":"default",onClick:A.serviceRunning?Y:K,disabled:_||v||!A.lark?.appId||!A.lark?.appSecret,children:[_?(0,iM.jsx)(rc.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,iM.jsx)(Lb,{className:"mr-2 h-3.5 w-3.5"}),A.serviceRunning?n("notifications.stopService"):n("notifications.startService")]}),(0,iM.jsxs)(f7.Button,{type:"button",size:"sm",variant:"outline",onClick:X,disabled:w||v||!A.serviceRunning,children:[w&&(0,iM.jsx)(rc.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),n("notifications.testSend")]})]})]}),(0,iM.jsxs)(sc,{value:"wechat",className:"space-y-3 pt-2",children:[(0,iM.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2.5",children:[(0,iM.jsxs)("div",{className:"min-w-0",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[W?(0,iM.jsx)(mZ,{className:"h-4 w-4 text-emerald-600"}):(0,iM.jsx)($s,{className:"h-4 w-4"}),n("wechat.robot")]}),(0,iM.jsx)("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:W?n("wechat.connected",{accountId:A.wechat?.accountId??""}):"scaned"===T.status?n("wechat.scanned"):"expired"===T.status?n("wechat.expired"):n("wechat.scanQr")})]}),(0,iM.jsxs)(f7.Button,{type:"button",size:"sm",variant:"outline",onClick:J,disabled:k||v||_,children:[k?(0,iM.jsx)(rc.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,iM.jsx)(rp.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),W?n("wechat.refreshLogin"):n("wechat.getQr")]})]}),T.qrcodeImgContent&&!W&&(0,iM.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-dashed px-3 py-3",children:[(0,iM.jsx)("img",{src:(i=T.qrcodeImgContent,`https://api.qrserver.com/v1/create-qr-code/?size=180x180&margin=8&data=${encodeURIComponent(i)}`),alt:"WeChat robot login QR code",className:"h-36 w-36 shrink-0 rounded border bg-white p-2"}),(0,iM.jsxs)("div",{className:"min-w-0 space-y-1 text-xs text-muted-foreground",children:[(0,iM.jsx)("p",{children:n("wechat.status",{status:"scaned"===T.status?"scanned":T.status})}),(0,iM.jsx)("p",{className:"break-all",children:n("wechat.loginUrl",{url:T.qrcodeImgContent})})]})]}),(0,iM.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,iM.jsxs)(f7.Button,{type:"button",size:"sm",variant:A.serviceRunning?"outline":"default",onClick:A.serviceRunning?Y:K,disabled:_||v||!W,children:[_?(0,iM.jsx)(rc.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,iM.jsx)(Lb,{className:"mr-2 h-3.5 w-3.5"}),A.serviceRunning?n("notifications.stopService"):n("notifications.startService")]}),(0,iM.jsxs)(f7.Button,{type:"button",size:"sm",variant:"outline",onClick:X,disabled:w||v||!A.serviceRunning,children:[w&&(0,iM.jsx)(rc.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),n("notifications.testSend")]})]})]}),(0,iM.jsxs)(sc,{value:"native",className:"space-y-3 pt-2",children:[(0,iM.jsx)("p",{className:"text-xs text-muted-foreground",children:n("notifications.nativeDescription")}),(0,iM.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2.5",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,iM.jsx)($r.Monitor,{className:"h-4 w-4 text-muted-foreground"}),(0,iM.jsxs)("span",{className:"font-medium",children:["granted"===O&&(0,iM.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,iM.jsx)(mZ,{className:"h-4 w-4 text-emerald-600"}),n("notifications.nativePermissionGranted")]}),"denied"===O&&n("notifications.nativePermissionDenied"),"default"===O&&n("notifications.nativePermissionDefault"),"unsupported"===O&&n("notifications.nativePermissionUnsupported")]})]}),"unsupported"!==O&&"granted"!==O&&(0,iM.jsx)(f7.Button,{type:"button",size:"sm",variant:"outline",onClick:async()=>{let e=await (0,$a.requestNotificationPermission)();R(e),"granted"===e?(q({native:{permissionGranted:!0}}),sZ.toast.success(n("notifications.nativePermissionGrantedToast"))):"denied"===e&&sZ.toast.error(n("notifications.nativePermissionDeniedToast"))},disabled:"denied"===O,children:n("notifications.nativeRequestPermission")})]}),(0,iM.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,iM.jsx)(f7.Button,{type:"button",size:"sm",variant:"outline",onClick:async()=>{try{await (0,$a.sendNativeNotification)("Agent Spaces",n("notifications.nativeTestSuccess")),sZ.toast.success(n("notifications.nativeTestSuccess"))}catch{sZ.toast.error(n("notifications.nativeTestFailed"))}},disabled:"granted"!==O,children:n("notifications.testSend")})})]})]}),(0,iM.jsxs)("div",{className:"space-y-2",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,iM.jsx)(mR.Bot,{className:"h-3.5 w-3.5"}),n("botAgent.title")]}),(0,iM.jsxs)("div",{className:"flex gap-2",children:[(0,iM.jsxs)("select",{value:A.botAgentId??"",onChange:e=>{q({botAgentId:e.target.value||void 0})},disabled:v,className:"h-8 min-w-0 flex-1 rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:[(0,iM.jsx)("option",{value:"",children:n("botAgent.selectAgent")}),H.map(e=>(0,iM.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,iM.jsx)(f7.Button,{type:"button",size:"sm",variant:"outline",onClick:()=>M(!0),children:r("manage")})]})]}),(0,iM.jsxs)("div",{className:"space-y-2",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,iM.jsx)($n.default,{className:"h-3.5 w-3.5"}),n("events.title")]}),(0,iM.jsx)("div",{className:"grid gap-2",children:$c.map(e=>(0,iM.jsxs)("label",{className:"flex items-center gap-2 rounded-md border px-3 py-2 text-sm",children:[(0,iM.jsx)("input",{type:"checkbox",className:"h-4 w-4 accent-primary",checked:A.events.includes(e.value),onChange:i=>{var n,r;let s;return n=e.value,r=i.target.checked,s=new Set(A.events),void(r?s.add(n):s.delete(n),q({events:Array.from(s)}))},disabled:v}),(0,iM.jsx)("span",{children:n(e.labelKey)})]},e.value))})]})]})]})]}),(0,iM.jsxs)("div",{className:"space-y-3",children:[(0,iM.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:n("prompt.title")}),(0,iM.jsxs)("div",{className:"space-y-3 rounded-md border px-3 py-3",children:[(0,iM.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,iM.jsx)(mi.Label,{htmlFor:"workspace-prompt",className:"text-sm font-medium",children:n("prompt.workspacePrompt")}),(0,iM.jsx)($o.TooltipProvider,{delay:200,children:(0,iM.jsxs)($o.Tooltip,{children:[(0,iM.jsx)($o.TooltipTrigger,{className:"inline-flex",children:(0,iM.jsx)(Is,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),(0,iM.jsx)($o.TooltipContent,{side:"top",className:"max-w-xs",children:(0,iM.jsx)("p",{children:n("prompt.description")})})]})})]}),(0,iM.jsx)(IA.Textarea,{id:"workspace-prompt",value:a,onChange:e=>l(e.target.value),className:"min-h-36 resize-y text-sm"}),(0,iM.jsx)("div",{className:"flex justify-end",children:(0,iM.jsxs)(f7.Button,{type:"button",size:"sm",onClick:U,disabled:m||!F,children:[m&&(0,iM.jsx)(rc.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),n("prompt.savePrompt")]})})]})]})]}),(0,iM.jsx)($i.AgentDialog,{open:N,onOpenChange:M,roleFilter:"bot"})]}):(0,iM.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:n("workspaceNotFound")})}let $c=[{value:"issue_started",labelKey:"events.issueStarted"},{value:"issue_completed",labelKey:"events.issueCompleted"},{value:"issue_task_completed",labelKey:"events.taskCompleted"}];function $d(){return{enabled:!1,provider:"lark",events:["issue_started","issue_completed","issue_task_completed"],lark:{},wechat:{}}}function $h({icon:e,label:i,value:n}){return(0,iM.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,iM.jsx)("span",{className:"text-muted-foreground",children:e}),(0,iM.jsx)("span",{className:"text-muted-foreground shrink-0",children:i}),(0,iM.jsx)("span",{className:"truncate text-foreground ml-auto",title:n,children:n})]})}var $u=e.i(506037);let $p={"channel-list":(0,iM.jsx)(nI.Hash,{size:16}),"issue-list":(0,iM.jsx)(nB,{size:16}),workfolder:(0,iM.jsx)(nz.FolderOpen,{size:16}),"code-editor":(0,iM.jsx)(nF,{size:16}),chat:(0,iM.jsx)(nH.MessageSquare,{size:16}),"issue-detail":(0,iM.jsx)(nW.FileText,{size:16}),terminal:(0,iM.jsx)(n$,{size:16}),"git-changes":(0,iM.jsx)(nU,{size:16}),"git-commits":(0,iM.jsx)(nV,{size:16}),"git-graph":(0,iM.jsx)(nq,{size:16}),"project-settings":(0,iM.jsx)(nK.Settings2,{size:16})},$f={"code-editor":"workfolder",chat:"channel-list","issue-detail":"issue-list"},$m={global:{tabSetEnableTabStrip:!0,borderEnableDrop:!0,tabEnableClose:!1,tabEnableRename:!1,tabSetEnableMaximize:!1},borders:[{type:"border",location:"bottom",children:[{type:"tab",name:"Terminal",component:"terminal"},{type:"tab",name:"Changes",component:"git-changes"},{type:"tab",name:"Commits",component:"git-commits"},{type:"tab",name:"Graph",component:"git-graph"}]}],layout:{type:"row",children:[{type:"tabset",weight:.25,children:[{type:"tab",name:"Settings",component:"project-settings",id:"project-settings"},{type:"tab",name:"Channels",component:"channel-list",id:"channel-list"},{type:"tab",name:"Issues",component:"issue-list",id:"issue-list"},{type:"tab",name:"Workfolder",component:"workfolder",id:"workfolder"}]},{type:"tabset",weight:.75,children:[{type:"tab",name:"Code Editor",component:"code-editor",id:"code-editor"},{type:"tab",name:"Chat",component:"chat",id:"chat"},{type:"tab",name:"Issue Detail",component:"issue-detail",id:"issue-detail"}]}]}};function $g({workspaceId:e,boundDirs:i}){let n=(0,xC.useIsMobile)(),r=(0,IC.useIssueStore)(),s=(0,IH.useTaskStore)(),o=(0,IC.useIssueStore)(e=>e.activeIssueId),a=(0,IC.useIssueStore)(e=>e.issueSelectSeq),l=(0,rd.useEditorStore)(e=>e.activeFilePath),c=(0,mM.useChannelStore)(e=>e.activeChannelId),d=(0,mM.useChannelStore)(e=>e.channelSelectSeq),h=W2(e=>e.status),{activePanel:u,setActivePanel:p}=IT(),f=(0,rd.useEditorStore)(e=>e.loadEditorState),m=(0,rd.useEditorStore)(e=>e.revealPath);(0,rd.useEditorStore)(e=>e.clearRevealPath);let[g,v]=(0,iO.useState)(()=>{try{let i=localStorage.getItem(`flexlayout-${e}`);if(i)return ne.fromJson(JSON.parse(i))}catch{}return ne.fromJson($m)});(0,iO.useEffect)(()=>{let i=()=>{localStorage.removeItem(`flexlayout-${e}`),v(ne.fromJson($m))};return window.addEventListener("reset-layout",i),()=>window.removeEventListener("reset-layout",i)},[e]),(0,iO.useEffect)(()=>{f(e)},[e,f]),(0,iO.useEffect)(()=>{if(o)if(n)p("issue-detail");else{let e=g.getNodeById("issue-detail");e&&e instanceof iq&&g.doAction(iF.selectTab(e.getId()))}},[a,o,g,n,p]),(0,iO.useEffect)(()=>{if(c)if(n)p("chat");else{let e=g.getNodeById("chat");e&&e instanceof iq&&g.doAction(iF.selectTab(e.getId()))}},[d,c,g,n,p]),(0,iO.useEffect)(()=>{if(l)if(n)p("code-editor");else{let e=g.getNodeById("code-editor");e&&e instanceof iq&&g.doAction(iF.selectTab(e.getId()))}else if(0===rd.useEditorStore.getState().openFiles.length)if(n)p("workfolder");else{let e=g.getNodeById("workfolder");e&&e instanceof iq&&g.doAction(iF.selectTab(e.getId()))}},[l,g,n,p]),(0,iO.useEffect)(()=>{if(m)if(n)p("workfolder");else{let e=g.getNodeById("workfolder");e&&e instanceof iq&&g.doAction(iF.selectTab(e.getId()))}},[m,g,n,p]),(0,iO.useEffect)(()=>{W2.getState().loadStatus(e);let i=setInterval(()=>{W2.getState().loadStatus(e)},3e4);return()=>clearInterval(i)},[e]),(0,iO.useEffect)(()=>{if(!n)return;let i=W2.getState();"git-changes"===u?(i.loadStatus(e),i.loadDiffs(e)):"git-commits"===u?i.loadLog(e):"git-graph"===u&&(i.loadLog(e),i.loadStatus(e))},[u,e,n]);let y=(0,iO.useCallback)(()=>{let i=sv.useWorkspaceStore.getState().workspaces.find(i=>i.id===e),n=i?.notificationSettings;return n?.enabled&&"native"===n.provider&&n.native?.permissionGranted},[e]);(0,iO.useEffect)(()=>{let i=(0,lZ.getWS)(e),n=$u.useNotificationStore.getState();n.load(e);let o=[i.on("issue.created",e=>r.upsertIssue(e)),i.on("issue.updated",e=>r.upsertIssue(e)),i.on("issue.status_changed",i=>{if(r.loadIssues(e),y()){let{from:e,to:n}=i,r=`Status changed: ${e} → ${n}`;(0,$a.sendNativeNotification)("Issue Status Updated",r)}}),i.on("task.created",e=>s.upsertTask(e)),i.on("task.updated",e=>s.upsertTask(e)),i.on("task.status_changed",i=>{let n=IC.useIssueStore.getState().activeIssueId;if(n&&s.loadTasks(e,n),y()){let{from:e,to:n}=i,r=`Status changed: ${e} → ${n}`;(0,$a.sendNativeNotification)("Task Status Updated",r)}}),i.on("notification.created",e=>{n.addNotification(e)}),i.on("notification.cleared",()=>{n.reset()})];return()=>o.forEach(e=>e())},[r,s,e,y]);let _=(0,iO.useCallback)(n=>{switch(n.getComponent()){case"channel-list":return(0,iM.jsx)(mV,{workspaceId:e});case"issue-list":return(0,iM.jsx)(IF,{workspaceId:e});case"workfolder":return(0,iM.jsx)(sf,{workspaceId:e});case"code-editor":return(0,iM.jsx)(l$,{workspaceId:e});case"chat":return(0,iM.jsx)(IN,{workspaceId:e});case"issue-detail":return(0,iM.jsx)(WX,{workspaceId:e});case"terminal":return(0,iM.jsx)(mN,{workspaceId:e,boundDirs:i});case"git-changes":return(0,iM.jsx)(W9,{workspaceId:e});case"git-commits":return(0,iM.jsx)($e,{workspaceId:e});case"git-graph":return(0,iM.jsx)($t,{workspaceId:e});case"project-settings":return(0,iM.jsx)($l,{workspaceId:e});default:return(0,iM.jsx)($y,{name:n.getName()})}},[i,e]),b=(0,iO.useCallback)((e,i)=>{let n=e.getComponent(),r=n?$p[n]:void 0;if(!r)return;let s=null;"git-changes"===n&&h&&!h.clean?s=(0,iM.jsx)("span",{className:"ml-0.5 text-[10px] font-medium text-orange-500 leading-none",children:h.files.length}):"git-commits"===n&&h&&h.ahead>0?s=(0,iM.jsxs)("span",{className:"ml-0.5 text-[10px] font-medium text-blue-500 leading-none",children:["↑",h.ahead]}):"git-graph"===n&&h&&(s=(0,iM.jsx)("span",{className:"ml-0.5 text-[10px] font-medium text-muted-foreground leading-none max-w-[80px] truncate",children:h.branch})),i.content=(0,iM.jsxs)("span",{title:e.getName(),className:"flex items-center justify-center",children:[r,s]})},[h]),w=(0,iO.useCallback)((i,n)=>{if(n.type!==iF.SELECT_TAB)try{localStorage.setItem(`flexlayout-${e}`,JSON.stringify(i.toJson()))}catch{}if(n.type!==iF.SELECT_TAB)return;let r=i.getNodeById(n.data.tabNode);if(!r||!(r instanceof iq))return;let s=r.getComponent(),o=$f[s??""];if(o){let e=i.getNodeById(o);e&&e instanceof iq&&i.doAction(iF.selectTab(e.getId()))}let a=W2.getState();"git-changes"===s?(a.loadStatus(e),a.loadDiffs(e)):"git-commits"===s?a.loadLog(e):"git-graph"===s&&(a.loadLog(e),a.loadStatus(e))},[e]);return n?(0,iM.jsx)("div",{className:"relative h-full w-full",children:(0,iM.jsx)($v,{panel:u,workspaceId:e,boundDirs:i})}):(0,iM.jsx)("div",{className:"relative h-full w-full",children:(0,iM.jsx)(nj,{model:g,factory:_,onRenderTab:b,onModelChange:w})})}function $v({panel:e,workspaceId:i,boundDirs:n}){switch(e){case"channel-list":default:return(0,iM.jsx)(mV,{workspaceId:i});case"chat":return(0,iM.jsx)(IN,{workspaceId:i});case"issue-list":return(0,iM.jsx)(IF,{workspaceId:i});case"issue-detail":return(0,iM.jsx)(WX,{workspaceId:i});case"workfolder":return(0,iM.jsx)(sf,{workspaceId:i});case"code-editor":return(0,iM.jsx)(l$,{workspaceId:i});case"terminal":return(0,iM.jsx)(mN,{workspaceId:i,boundDirs:n});case"git-changes":return(0,iM.jsx)(W9,{workspaceId:i});case"git-commits":return(0,iM.jsx)($e,{workspaceId:i});case"git-graph":return(0,iM.jsx)($t,{workspaceId:i});case"project-settings":return(0,iM.jsx)($l,{workspaceId:i})}}function $y({name:e}){return(0,iM.jsxs)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:[e," (coming soon)"]})}let $_=[{id:"channel-list",icon:nI.Hash,group:"channel"},{id:"chat",icon:nH.MessageSquare,group:"channel"},{id:"issue-list",icon:nB,group:"issue"},{id:"issue-detail",icon:nU,group:"issue"},{id:"workfolder",icon:nz.FolderOpen,group:"workfolder"},{id:"code-editor",icon:nF,group:"workfolder"},{id:"terminal",icon:n$,group:"tools"},{id:"git-changes",icon:nU,group:"git"},{id:"git-commits",icon:nV,group:"git"},{id:"git-graph",icon:nq,group:"git"},{id:"project-settings",icon:nK.Settings2,group:"settings"}];function $x(){let{activePanel:e,setActivePanel:i}=IT();return(0,iM.jsx)("div",{className:"relative shrink-0 bg-background pt-[env(safe-area-inset-top)]",children:(0,iM.jsx)("div",{className:"flex items-center h-10 border-b px-1 gap-0.5 shrink-0 overflow-x-auto md:hidden",children:$_.map((n,r)=>{let s=n.icon,o=r>0?$_[r-1].group:null,a=null!==o&&o!==n.group;return(0,iM.jsxs)("div",{className:"flex items-center shrink-0",children:[a&&(0,iM.jsx)("div",{className:"w-px h-4 bg-border mx-0.5"}),(0,iM.jsx)("button",{onClick:()=>i(n.id),className:(0,n1.cn)("flex items-center justify-center size-8 rounded-md transition-colors",e===n.id?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50"),children:(0,iM.jsx)(s,{size:16})})]},n.id)})})})}var $b=e.i(233297);e.s(["WorkspaceClient",0,function(){let e=function(){let e=(0,iR.useSearchParams)().get("workspaceId")||"",[i,n]=(0,iO.useState)("");return(0,iO.useEffect)(()=>{let e=window.location.pathname.match(/\/workspace\/([^/]+)/);n(e?.[1]||"")},[]),(0,iO.useMemo)(()=>e||i,[i,e])}(),i=(0,iR.useRouter)(),[n,r]=(0,iO.useState)(null),[s,o]=(0,iO.useState)(null),a=(0,sv.useWorkspaceStore)(e=>e.upsertWorkspace);return((0,iO.useEffect)(()=>{e&&fetch(`/api/workspaces/${e}`).then(e=>{if(!e.ok)throw Error("Not found");return e.json()}).then(e=>{r(e),a(e)}).catch(e=>o(e.message))},[e,a]),s)?(0,iM.jsxs)("div",{className:"h-full flex flex-col items-center justify-center gap-4",children:[(0,iM.jsx)("p",{className:"text-destructive",children:s}),(0,iM.jsx)("button",{type:"button",onClick:()=>(0,$b.tauriNavigate)(i,"/"),className:"text-sm underline",children:"Back to home"})]}):n?(0,iM.jsxs)("div",{className:"h-full min-h-0 flex flex-col overflow-hidden",children:[(0,iM.jsx)($x,{}),(0,iM.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:(0,iM.jsx)($g,{workspaceId:n.id,boundDirs:n.boundDirs})})]}):(0,iM.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:"Loading..."})}],191871)}]);