@shepai/cli 1.182.0 → 1.182.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.d.ts +8 -1
  2. package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.d.ts.map +1 -1
  3. package/dist/packages/core/src/application/use-cases/repositories/import-github-repository.use-case.d.ts +13 -1
  4. package/dist/packages/core/src/application/use-cases/repositories/import-github-repository.use-case.d.ts.map +1 -1
  5. package/dist/packages/core/src/application/use-cases/repositories/import-github-repository.use-case.js +44 -5
  6. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts +1 -0
  7. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts.map +1 -1
  8. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.js +15 -0
  9. package/dist/tsconfig.build.tsbuildinfo +1 -1
  10. package/package.json +1 -1
  11. package/web/.next/BUILD_ID +1 -1
  12. package/web/.next/build-manifest.json +2 -2
  13. package/web/.next/fallback-build-manifest.json +2 -2
  14. package/web/.next/prerender-manifest.json +3 -3
  15. package/web/.next/required-server-files.js +2 -2
  16. package/web/.next/required-server-files.json +2 -2
  17. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +32 -32
  18. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
  19. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
  20. package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +30 -30
  21. package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
  22. package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
  23. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +33 -33
  24. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  25. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  26. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +41 -41
  27. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  28. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  29. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +41 -41
  30. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  31. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  32. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +31 -31
  33. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  34. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  35. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +31 -31
  36. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  37. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  38. package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +30 -30
  39. package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
  40. package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
  41. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +33 -33
  42. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  43. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  44. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +41 -41
  45. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  46. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  47. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +41 -41
  48. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  49. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  50. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +30 -30
  51. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  52. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  53. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +31 -31
  54. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
  55. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
  56. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +31 -31
  57. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  58. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  59. package/web/.next/server/app/_global-error.html +2 -2
  60. package/web/.next/server/app/_global-error.rsc +1 -1
  61. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  62. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  63. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  64. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  65. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  66. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +7 -7
  67. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  68. package/web/.next/server/app/application/[id]/page/server-reference-manifest.json +15 -15
  69. package/web/.next/server/app/application/[id]/page.js.nft.json +1 -1
  70. package/web/.next/server/app/application/[id]/page_client-reference-manifest.js +1 -1
  71. package/web/.next/server/app/features/page/server-reference-manifest.json +7 -7
  72. package/web/.next/server/app/features/page_client-reference-manifest.js +1 -1
  73. package/web/.next/server/app/settings/page/server-reference-manifest.json +10 -10
  74. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  75. package/web/.next/server/app/skills/page/server-reference-manifest.json +15 -15
  76. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  77. package/web/.next/server/app/tools/page/server-reference-manifest.json +13 -13
  78. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  79. package/web/.next/server/app/version/page/server-reference-manifest.json +7 -7
  80. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  81. package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
  82. package/web/.next/server/chunks/[root-of-the-server]__c8f90b29._.js +1 -1
  83. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  84. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  85. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
  86. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
  87. package/web/.next/server/chunks/ssr/[root-of-the-server]__013a0318._.js +1 -1
  88. package/web/.next/server/chunks/ssr/[root-of-the-server]__013a0318._.js.map +1 -1
  89. package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js +1 -1
  90. package/web/.next/server/chunks/ssr/[root-of-the-server]__17dadd08._.js.map +1 -1
  91. package/web/.next/server/chunks/ssr/[root-of-the-server]__1925bef0._.js +1 -1
  92. package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js +1 -1
  93. package/web/.next/server/chunks/ssr/[root-of-the-server]__1a9687c4._.js.map +1 -1
  94. package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js +2 -2
  95. package/web/.next/server/chunks/ssr/[root-of-the-server]__24756fa9._.js.map +1 -1
  96. package/web/.next/server/chunks/ssr/[root-of-the-server]__4ee8be85._.js +1 -1
  97. package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js +1 -1
  98. package/web/.next/server/chunks/ssr/[root-of-the-server]__70986695._.js.map +1 -1
  99. package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js +1 -1
  100. package/web/.next/server/chunks/ssr/[root-of-the-server]__a5ea76a6._.js.map +1 -1
  101. package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js +1 -1
  102. package/web/.next/server/chunks/ssr/[root-of-the-server]__bb391c45._.js.map +1 -1
  103. package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js +1 -1
  104. package/web/.next/server/chunks/ssr/[root-of-the-server]__dd3e834e._.js.map +1 -1
  105. package/web/.next/server/chunks/ssr/[root-of-the-server]__e265da61._.js +1 -1
  106. package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js +1 -1
  107. package/web/.next/server/chunks/ssr/[root-of-the-server]__f3ca7bea._.js.map +1 -1
  108. package/web/.next/server/chunks/ssr/_0277d3b5._.js +1 -1
  109. package/web/.next/server/chunks/ssr/_0277d3b5._.js.map +1 -1
  110. package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
  111. package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
  112. package/web/.next/server/chunks/ssr/_5dec4047._.js +3 -0
  113. package/web/.next/server/chunks/ssr/{_a7184dfa._.js.map → _5dec4047._.js.map} +1 -1
  114. package/web/.next/server/chunks/ssr/{_21cc662b._.js → _73aa3b20._.js} +2 -2
  115. package/web/.next/server/chunks/ssr/{_21cc662b._.js.map → _73aa3b20._.js.map} +1 -1
  116. package/web/.next/server/chunks/ssr/{_177d29c6._.js → _774cbf7d._.js} +2 -2
  117. package/web/.next/server/chunks/ssr/{_177d29c6._.js.map → _774cbf7d._.js.map} +1 -1
  118. package/web/.next/server/chunks/ssr/{_503102fc._.js → _81e7a131._.js} +2 -2
  119. package/web/.next/server/chunks/ssr/{_503102fc._.js.map → _81e7a131._.js.map} +1 -1
  120. package/web/.next/server/chunks/ssr/_946a7fc6._.js +1 -1
  121. package/web/.next/server/chunks/ssr/_946a7fc6._.js.map +1 -1
  122. package/web/.next/server/chunks/ssr/{_575fe3ee._.js → _d75dcb43._.js} +2 -2
  123. package/web/.next/server/chunks/ssr/{_575fe3ee._.js.map → _d75dcb43._.js.map} +1 -1
  124. package/web/.next/server/chunks/ssr/_eff1b518._.js +1 -1
  125. package/web/.next/server/chunks/ssr/_eff1b518._.js.map +1 -1
  126. package/web/.next/server/chunks/ssr/_f227429a._.js +1 -1
  127. package/web/.next/server/chunks/ssr/_f227429a._.js.map +1 -1
  128. package/web/.next/server/chunks/ssr/_f86fc1bf._.js +1 -1
  129. package/web/.next/server/chunks/ssr/_f86fc1bf._.js.map +1 -1
  130. package/web/.next/server/chunks/ssr/_f8c55130._.js +1 -1
  131. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  132. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  133. package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js +1 -1
  134. package/web/.next/server/chunks/ssr/src_presentation_web_36f2bc45._.js +1 -1
  135. package/web/.next/server/chunks/ssr/src_presentation_web_36f2bc45._.js.map +1 -1
  136. package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js +1 -1
  137. package/web/.next/server/chunks/ssr/src_presentation_web_486908de._.js.map +1 -1
  138. package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js +1 -1
  139. package/web/.next/server/chunks/ssr/src_presentation_web_5c3596bc._.js.map +1 -1
  140. package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js +1 -1
  141. package/web/.next/server/chunks/ssr/src_presentation_web_6159fef8._.js.map +1 -1
  142. package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js +1 -1
  143. package/web/.next/server/chunks/ssr/src_presentation_web_6326f81e._.js.map +1 -1
  144. package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js +1 -1
  145. package/web/.next/server/chunks/ssr/src_presentation_web_6b2fdcd8._.js.map +1 -1
  146. package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js +1 -1
  147. package/web/.next/server/chunks/ssr/src_presentation_web_74703c9f._.js.map +1 -1
  148. package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js +1 -1
  149. package/web/.next/server/chunks/ssr/src_presentation_web_a8056dac._.js.map +1 -1
  150. package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js +1 -1
  151. package/web/.next/server/chunks/ssr/src_presentation_web_ad42cc73._.js.map +1 -1
  152. package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-ide_ts_baaca5d5._.js +3 -3
  153. package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js +1 -1
  154. package/web/.next/server/chunks/ssr/src_presentation_web_b00bfb08._.js.map +1 -1
  155. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js +1 -1
  156. package/web/.next/server/chunks/ssr/src_presentation_web_components_895e5bfa._.js.map +1 -1
  157. package/web/.next/server/chunks/ssr/src_presentation_web_components_common_base-drawer_base-drawer_tsx_97dfbbc8._.js +1 -1
  158. package/web/.next/server/chunks/ssr/src_presentation_web_components_common_base-drawer_base-drawer_tsx_97dfbbc8._.js.map +1 -1
  159. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  160. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  161. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js +1 -1
  162. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js.map +1 -1
  163. package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js +1 -1
  164. package/web/.next/server/chunks/ssr/src_presentation_web_f1edcf5e._.js.map +1 -1
  165. package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.js +1 -1
  166. package/web/.next/server/chunks/ssr/src_presentation_web_f9436804._.js.map +1 -1
  167. package/web/.next/server/pages/500.html +2 -2
  168. package/web/.next/server/server-reference-manifest.js +1 -1
  169. package/web/.next/server/server-reference-manifest.json +54 -54
  170. package/web/.next/static/chunks/{87a0df5389e06641.js → 2af89379fde6831d.js} +1 -1
  171. package/web/.next/static/chunks/{b87904ecdddde972.js → 3a71cab38909921e.js} +1 -1
  172. package/web/.next/static/chunks/{e4f0ca20b62bd66f.js → 4e53adb5d07b7e3d.js} +1 -1
  173. package/web/.next/static/chunks/{ceff12f8a2e5bc08.js → 503d2e86f83285f9.js} +1 -1
  174. package/web/.next/static/chunks/{8c9016ab8c1f6204.js → 5e7ac3508bef115f.js} +1 -1
  175. package/web/.next/static/chunks/761a7c542b358739.js +1 -0
  176. package/web/.next/static/chunks/{6afd16b2fe544054.js → 7bf6ed16395220c4.js} +2 -2
  177. package/web/.next/static/chunks/{be2e80436bc15812.js → 996e4ea45364bf3c.js} +2 -2
  178. package/web/.next/static/chunks/{b4aa3a83f2451e07.js → 9e9b60f127270dfd.js} +1 -1
  179. package/web/.next/static/chunks/{ac22076c64634ac1.js → a2601dbbcb657c7d.js} +1 -1
  180. package/web/.next/static/chunks/{de7de1db2a8788dd.js → a31f2264cedb23e9.js} +1 -1
  181. package/web/.next/static/chunks/{a2531137c7d36d54.js → abf7d1b66555b758.js} +1 -1
  182. package/web/.next/static/chunks/{33dc7a1041f4ab64.js → d488e6b5cbbc6833.js} +1 -1
  183. package/web/.next/static/chunks/{2424ab50273fe1d9.js → d984d1d8d506291c.js} +1 -1
  184. package/web/.next/static/chunks/e843a0d8e8c645c4.js +1 -0
  185. package/web/.next/static/chunks/{7604027076448f2b.js → f5ed0232d50b1ec8.js} +1 -1
  186. package/web/.next/server/chunks/ssr/_a7184dfa._.js +0 -3
  187. package/web/.next/static/chunks/94e8559ae19a16e1.js +0 -1
  188. package/web/.next/static/chunks/a0cfca1e5fd467e9.js +0 -1
  189. /package/web/.next/static/{EVCmRtpgNX9ebXGb-bV1G → 6GBQ7MHEYpZbJzqULwvXh}/_buildManifest.js +0 -0
  190. /package/web/.next/static/{EVCmRtpgNX9ebXGb-bV1G → 6GBQ7MHEYpZbJzqULwvXh}/_clientMiddlewareManifest.json +0 -0
  191. /package/web/.next/static/{EVCmRtpgNX9ebXGb-bV1G → 6GBQ7MHEYpZbJzqULwvXh}/_ssgManifest.js +0 -0
@@ -16,4 +16,4 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
16
16
  `))),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(id(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(eX(()=>{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===`
17
17
  `&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=er)))}_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 r=this._terminal.buffer,s=r.lines.length.toString();for(let n=e;n<=i;n++){let e=r.lines.get(r.ydisp+n),i=[],o=e?.translateToString(!0,void 0,void 0,i)||"",a=(r.ydisp+n+1).toString(),l=this._rowElements[n];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",s),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let r,s,n=e.target,o=this._rowElements[0===i?1:this._rowElements.length-2];if(n.getAttribute("aria-posinset")!==(0===i?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===o){if(0===i?(r=n,s=this._rowElements.pop(),this._rowContainer.removeChild(s)):(r=this._rowElements.shift(),s=n,this._rowContainer.removeChild(r)),r.removeEventListener("focus",this._topBoundaryFocusListener),s.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},r={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===r.node&&i.offset>r.offset)&&([i,r]=[r,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 s=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(r.node))return;let n=({node:e,offset:i})=>{let r=e instanceof Text?e.parentNode:e,s=parseInt(r?.getAttribute("aria-posinset"),10)-1;if(isNaN(s))return console.warn("row is invalid. Race condition?"),null;let n=this._rowColumns.get(r);if(!n)return console.warn("columns is null. Race condition?"),null;let o=i<n.length?n[i]:n.slice(-1)[0]+1;return o>=this._terminal.cols&&(++s,o=0),{row:s,column:o}},o=n(i),a=n(r);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,r=this._rowColumns.get(e)?.slice(-1)?.[0];if(!r)return;let s=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/i})`}};ng=ee([et(1,ew),et(2,eP),et(3,eR)],ng);var nv=class extends eZ{constructor(e,i,r,s,n){super(),this._element=e,this._mouseService=i,this._renderService=r,this._bufferService=s,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new to),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new to),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(eX(()=>{eq(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(id(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(id(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(id(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(id(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 r=e.composedPath();for(let e=0;e<r.length;e++){let i=r[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 r=!1;for(let[s,n]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(s)&&(r=this._checkLinkProviderResult(s,e,r)):n.provideLinks(e.y,i=>{if(this._isMouseOut)return;let n=i?.map(e=>({link:e}));this._activeProviderReplies?.set(s,n),r=this._checkLinkProviderResult(s,e,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let r=new Set;for(let s=0;s<i.size;s++){let n=i.get(s);if(n)for(let i=0;i<n.length;i++){let s=n[i],o=s.link.range.start.y<e?0:s.link.range.start.x,a=s.link.range.end.y>e?this._bufferService.cols:s.link.range.end.x;for(let e=o;e<=a;e++){if(r.has(e)){n.splice(i--,1);break}r.add(e)}}}}_checkLinkProviderResult(e,i,r){if(!this._activeProviderReplies)return r;let s=this._activeProviderReplies.get(e),n=!1;for(let i=0;i<e;i++)(!this._activeProviderReplies.has(i)||this._activeProviderReplies.get(i))&&(n=!0);if(!n&&s){let e=s.find(e=>this._linkAtPosition(e.link,i));e&&(r=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let e=0;e<this._activeProviderReplies.size;e++){let s=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,i));if(s){r=!0,this._handleNewLink(s);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){var i,r;if(!this._currentLink)return;let s=this._positionFromMouseEvent(e,this._element,this._mouseService);s&&this._mouseDownLink&&(i=this._mouseDownLink.link,r=this._currentLink.link,i.text===r.text&&i.range.start.x===r.range.start.x&&i.range.start.y===r.range.start.y&&i.range.end.x===r.range.end.x&&i.range.end.y===r.range.end.y)&&this._linkAtPosition(this._currentLink.link,s)&&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,eq(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,r=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(i,r),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,i,r){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(r,i.text)}_fireUnderlineEvent(e,i){let r=e.range,s=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-s-1,r.end.x,r.end.y-s-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)}_linkLeave(e,i,r){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(r,i.text)}_linkAtPosition(e,i){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,n=i.y*this._bufferService.cols+i.x;return r<=n&&n<=s}_positionFromMouseEvent(e,i,r){let s=r.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,r,s,n){return{x1:e,y1:i,x2:r,y2:s,cols:this._bufferService.cols,fg:n}}};nv=ee([et(1,eI),et(2,eR),et(3,em),et(4,eB)],nv);var nm=class extends na{constructor(e={}){super(e),this._linkifier=this._register(new eJ),this.browser=rI,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new eJ),this._onCursorMove=this._register(new to),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new to),this.onKey=this._onKey.event,this._onRender=this._register(new to),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new to),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new to),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new to),this.onBell=this._onBell.event,this._onFocus=this._register(new to),this._onBlur=this._register(new to),this._onA11yCharEmitter=this._register(new to),this._onA11yTabEmitter=this._register(new to),this._onWillOpen=this._register(new to),this._setup(),this._decorationService=this._instantiationService.createInstance(nf),this._instantiationService.setService(eD,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(rD),this._instantiationService.setService(eB,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(eO)),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(e9.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(e9.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(e9.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(e9.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(eX(()=>{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,r="";switch(i.index){case 256:e="foreground",r="10";break;case 257:e="background",r="11";break;case 258:e="cursor",r="12";break;default:e="ansi",r="4;"+i.index}switch(i.type){case 0:let s=sB.toColorRGB("ansi"===e?this._themeService.colors.ansi[i.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${iJ.ESC}]${r};${function(e,i=16){let[r,s,n]=e;return`rgb:${s8(r,i)}/${s8(s,i)}/${s8(n,i)}`}(s)}${i0.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[i.index]=i1.toColor(...i.color));else{let r=e;this._themeService.modifyColors(e=>e[r]=i1.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(ng,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(iJ.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(iJ.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 r=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,n=i.getWidth(r),o=this._renderService.dimensions.css.cell.width*n,a=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*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=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(id(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,r,s;return i=this.textarea,r=this.coreService,s=this.optionsService,void(e.stopPropagation(),e.clipboardData&&es(e.clipboardData.getData("text/plain"),i,r,s))};this._register(id(this.textarea,"paste",e)),this._register(id(this.element,"paste",e)),rA?this._register(id(this.element,"mousedown",e=>{2===e.button&&eo(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(id(this.element,"contextmenu",e=>{eo(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),rU&&this._register(id(this.element,"auxclick",e=>{1===e.button&&en(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(id(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(id(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(id(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(id(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(id(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(id(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(id(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(id(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 r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",ei),rY||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",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(rk,this.textarea,e.ownerDocument.defaultView??window,this._document??"u">typeof window?window.document:null)),this._instantiationService.setService(eP,this._coreBrowserService),this._register(id(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(id(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(rb,this._document,this._helperContainer),this._instantiationService.setService(eT,this._charSizeService),this._themeService=this._instantiationService.createInstance(so),this._instantiationService.setService(eL,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(ra),this._instantiationService.setService(eN,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(rJ,this.rows,this.screenElement)),this._instantiationService.setService(eR,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(iY,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(rT),this._instantiationService.setService(eI,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(nv,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(iH,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(r7,this.element,this.screenElement,s)),this._instantiationService.setService(eM,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(e9.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(iW,this.screenElement)),this._register(id(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(ng,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iU,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(iU,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ry,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function r(i){let r,s,n=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!n)return!1;switch(i.overrideType||i.type){case"mousemove":s=32,void 0===i.buttons?(r=3,void 0!==i.button&&(r=i.button<3?i.button:3)):r=1&i.buttons?0:4&i.buttons?1:2&i.buttons?2:3;break;case"mouseup":s=0,r=i.button<3?i.button:3;break;case"mousedown":s=1,r=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;s=o<0?0:1,r=4;break;default:return!1}return void 0!==s&&void 0!==r&&!(r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:s,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n=e=>(r(e),e.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(e)),o=e=>(r(e),this.cancel(e,!0)),a=e=>{e.buttons&&r(e)},l=e=>{e.buttons||r(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?s.mousemove||(i.addEventListener("mousemove",l),s.mousemove=l):(i.removeEventListener("mousemove",s.mousemove),s.mousemove=null),16&e?s.wheel||(i.addEventListener("wheel",o,{passive:!1}),s.wheel=o):(i.removeEventListener("wheel",s.wheel),s.wheel=null),2&e?s.mouseup||(s.mouseup=n):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),4&e?s.mousedrag||(s.mousedrag=a):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(id(i,"mousedown",e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return r(e),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(e)})),this._register(id(i,"wheel",i=>{if(!s.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 r=iJ.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(r,!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){es(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,r){this._selectionService.setSelection(e,i,r)}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 r=function(e,i,r,s){let n={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?n.key=iJ.ESC+"OA":n.key=iJ.ESC+"[A":"UIKeyInputLeftArrow"===e.key?i?n.key=iJ.ESC+"OD":n.key=iJ.ESC+"[D":"UIKeyInputRightArrow"===e.key?i?n.key=iJ.ESC+"OC":n.key=iJ.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(i?n.key=iJ.ESC+"OB":n.key=iJ.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":iJ.DEL,e.altKey&&(n.key=iJ.ESC+n.key);break;case 9:if(e.shiftKey){n.key=iJ.ESC+"[Z";break}n.key=iJ.HT,n.cancel=!0;break;case 13:n.key=e.altKey?iJ.ESC+iJ.CR:iJ.CR,n.cancel=!0;break;case 27:n.key=iJ.ESC,e.altKey&&(n.key=iJ.ESC+iJ.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;o?n.key=iJ.ESC+"[1;"+(o+1)+"D":i?n.key=iJ.ESC+"OD":n.key=iJ.ESC+"[D";break;case 39:if(e.metaKey)break;o?n.key=iJ.ESC+"[1;"+(o+1)+"C":i?n.key=iJ.ESC+"OC":n.key=iJ.ESC+"[C";break;case 38:if(e.metaKey)break;o?n.key=iJ.ESC+"[1;"+(o+1)+"A":i?n.key=iJ.ESC+"OA":n.key=iJ.ESC+"[A";break;case 40:if(e.metaKey)break;o?n.key=iJ.ESC+"[1;"+(o+1)+"B":i?n.key=iJ.ESC+"OB":n.key=iJ.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(n.key=iJ.ESC+"[2~");break;case 46:o?n.key=iJ.ESC+"[3;"+(o+1)+"~":n.key=iJ.ESC+"[3~";break;case 36:o?n.key=iJ.ESC+"[1;"+(o+1)+"H":i?n.key=iJ.ESC+"OH":n.key=iJ.ESC+"[H";break;case 35:o?n.key=iJ.ESC+"[1;"+(o+1)+"F":i?n.key=iJ.ESC+"OF":n.key=iJ.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=iJ.ESC+"[5;"+(o+1)+"~":n.key=iJ.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=iJ.ESC+"[6;"+(o+1)+"~":n.key=iJ.ESC+"[6~";break;case 112:o?n.key=iJ.ESC+"[1;"+(o+1)+"P":n.key=iJ.ESC+"OP";break;case 113:o?n.key=iJ.ESC+"[1;"+(o+1)+"Q":n.key=iJ.ESC+"OQ";break;case 114:o?n.key=iJ.ESC+"[1;"+(o+1)+"R":n.key=iJ.ESC+"OR";break;case 115:o?n.key=iJ.ESC+"[1;"+(o+1)+"S":n.key=iJ.ESC+"OS";break;case 116:o?n.key=iJ.ESC+"[15;"+(o+1)+"~":n.key=iJ.ESC+"[15~";break;case 117:o?n.key=iJ.ESC+"[17;"+(o+1)+"~":n.key=iJ.ESC+"[17~";break;case 118:o?n.key=iJ.ESC+"[18;"+(o+1)+"~":n.key=iJ.ESC+"[18~";break;case 119:o?n.key=iJ.ESC+"[19;"+(o+1)+"~":n.key=iJ.ESC+"[19~";break;case 120:o?n.key=iJ.ESC+"[20;"+(o+1)+"~":n.key=iJ.ESC+"[20~";break;case 121:o?n.key=iJ.ESC+"[21;"+(o+1)+"~":n.key=iJ.ESC+"[21~";break;case 122:o?n.key=iJ.ESC+"[23;"+(o+1)+"~":n.key=iJ.ESC+"[23~";break;case 123:o?n.key=iJ.ESC+"[24;"+(o+1)+"~":n.key=iJ.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if((!r||s)&&e.altKey&&!e.metaKey){let i=nl[e.keyCode]?.[+!!e.shiftKey];if(i)n.key=iJ.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()),n.key=iJ.ESC+i}else if(32===e.keyCode)n.key=iJ.ESC+(e.ctrlKey?iJ.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let i=e.code.slice(3,4);e.shiftKey||(i=i.toLowerCase()),n.key=iJ.ESC+i,n.cancel=!0}}else!r||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&&(n.key=iJ.US),"@"===e.key&&(n.key=iJ.NUL)):n.key=e.key:65===e.keyCode&&(n.type=1);else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key=iJ.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key=iJ.DEL:219===e.keyCode?n.key=iJ.ESC:220===e.keyCode?n.key=iJ.FS:221===e.keyCode&&(n.key=iJ.GS)}return n}(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===r.type||2===r.type){let i=this.rows-1;return this.scrollLines(2===r.type?-i:i),this.cancel(e,!0)}return 1===r.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.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):((r.key===iJ.ETX||r.key===iJ.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)?this.cancel(e,!0):void(this._keyDownHandled=!0))}_isThirdLevelShift(e,i){let r=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?r:r&&(!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(sf));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(iJ.ESC+"[I"):this.coreService.triggerDataEvent(iJ.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${iJ.ESC}[4;${r};${i}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${iJ.ESC}[6;${n};${s}t`)}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}},nS=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let r={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(r),i.dispose=()=>this._wrappedAddonDispose(r),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){i=r;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)}},ny=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 ef)}translateToString(e,i,r){return this._line.translateToString(e,i,r)}},nb=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 ny(i)}getNullCell(){return new ef}},nw=class extends eZ{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new to),this.onBufferChange=this._onBufferChange.event,this._normal=new nb(this._core.buffers.normal,"normal"),this._alternate=new nb(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)}},nC=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,r)=>i(e,r.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)}},nx=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}},nk=["cols","rows"],nE=0,nD=class extends eZ{constructor(e){super(),this._core=this._register(new nm(e)),this._addonManager=this._register(new nS),this._publicOptions={...this._core.options};let i=e=>this._core.options[e],r=(e,i)=>{this._checkReadonlyOptions(e),this._core.options[e]=i};for(let e in this._core.options){let s={get:i.bind(this,e),set:r.bind(this,e)};Object.defineProperty(this._publicOptions,e,s)}}_checkReadonlyOptions(e){if(nk.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 nC(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new nx(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 nw(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,r){this._verifyIntegers(e,i,r),this._core.select(e,i,r)}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
18
18
  `,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 ei},set promptLabel(t){ei=t},get tooMuchOutput(){return er},set tooMuchOutput(t){er=t}}}_verifyIntegers(...e){for(nE of e)if(nE===1/0||isNaN(nE)||nE%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(nE of e)if(nE&&(nE===1/0||isNaN(nE)||nE%1!=0||nE<0))throw Error("This API only accepts positive integers")}},nO=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,r=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(r.getPropertyValue("height")),n=Math.max(0,parseInt(r.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((n-(a.right+a.left)-i)/e.css.cell.width)),rows:Math.max(1,Math.floor((s-l)/e.css.cell.height))}}},nT=class{constructor(e,i,r,s={}){this._terminal=e,this._regex=i,this._handler=r,this._options=s}provideLinks(e,i){let r=nP.computeLink(e,this._regex,this._terminal,this._handler);i(this._addCallbacks(r))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(i,r)=>{if(this._options.hover){let{range:s}=e;this._options.hover(i,r,s)}},e))}},nP=class e{static computeLink(i,r,s,n){let o=RegExp(r.source,(r.flags||"")+"g"),[a,l]=e._getWindowedLineStrings(i-1,s),h=a.join(""),c,d=[];for(;c=o.exec(h);){let i=c[0];if(!function(e){try{let i=new URL(e),r=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(r.toLocaleLowerCase())}catch{return!1}}(i))continue;let[r,o]=e._mapStrIdx(s,l,0,c.index),[a,h]=e._mapStrIdx(s,r,o,i.length);if(-1===r||-1===o||-1===a||-1===h)continue;let u={start:{x:o+1,y:r+1},end:{x:h,y:a+1}};d.push({range:u,text:i,activate:n})}return d}static _getWindowedLineStrings(e,i){let r,s=e,n=e,o=0,a="",l=[];if(r=i.buffer.active.getLine(e)){let e=r.translateToString(!0);if(r.isWrapped&&" "!==e[0]){for(o=0;(r=i.buffer.active.getLine(--s))&&o<2048&&(o+=(a=r.translateToString(!0)).length,l.push(a),!(!r.isWrapped||-1!==a.indexOf(" "))););l.reverse()}for(l.push(e),o=0;(r=i.buffer.active.getLine(++n))&&r.isWrapped&&o<2048&&(o+=(a=r.translateToString(!0)).length,l.push(a),-1===a.indexOf(" ")););}return[l,s]}static _mapStrIdx(e,i,r,s){let n=e.buffer.active,o=n.getNullCell(),a=r;for(;s;){let e=n.getLine(i);if(!e)return[-1,-1];for(let r=a;r<e.length;++r){e.getCell(r,o);let a=o.getChars();if(o.getWidth()&&(s-=a.length||1,r===e.length-1&&""===a)){let e=n.getLine(i+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(s+=1))}if(s<0)return[i,r]}i++,a=0}return[i,a]}},nI=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function nR(e,i){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}var nM=class{constructor(e=nR,i={}){this._handler=e,this._options=i}activate(e){this._terminal=e;let i=this._options,r=i.urlRegex||nI;this._linkProvider=this._terminal.registerLinkProvider(new nT(this._terminal,r,this._handler,i))}dispose(){this._linkProvider?.dispose()}};let nN={background:"#0b0d10",foreground:"#e5e7eb",cursor:"#e5e7eb",cursorAccent:"#0b0d10",selectionBackground:"#3b82f680",black:"#1f2937",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e5e7eb",brightBlack:"#4b5563",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f9fafb"};function nL({cwd:e,className:i}){let r=(0,R.useRef)(null),s=(0,R.useRef)(null),n=(0,R.useRef)(null),o=(0,R.useRef)(null),a=(0,R.useRef)(null),[l,h]=(0,R.useState)("initializing"),[c,d]=(0,R.useState)(null);return(0,R.useEffect)(()=>{if(!r.current)return;let i=!1,l=new nD({cursorBlink:!0,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace',fontSize:13,lineHeight:1.2,theme:nN,allowProposedApi:!0,scrollback:5e3,convertEol:!0}),c=new nO;l.loadAddon(c),l.loadAddon(new nM),l.open(r.current),s.current=l,n.current=c;try{c.fit()}catch{}(async()=>{try{let r=await fetch("/api/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,cols:l.cols,rows:l.rows})});if(!r.ok){let e=await r.json().catch(()=>({error:r.statusText}));throw Error(e.error??`HTTP ${r.status}`)}let s=await r.json();if(i)return;o.current=s.sessionId;let n=new EventSource(`/api/terminal/${s.sessionId}/stream`);a.current=n,n.addEventListener("data",e=>{try{let i=JSON.parse(e.data);l.write(i.data)}catch{}}),n.addEventListener("exit",e=>{try{let i=JSON.parse(e.data);l.writeln(""),l.writeln(`\x1b[90m[process exited with code ${i.code??"null"}]\x1b[0m`)}catch{l.writeln("\x1b[90m[process exited]\x1b[0m")}h("exited"),n.close(),a.current=null}),n.onopen=()=>{i||h("connected")},n.onerror=()=>{i||h(e=>"initializing"===e?(d("Failed to connect to terminal stream"),"error"):e)},l.onData(e=>{let i=o.current;i&&fetch(`/api/terminal/${i}/input`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:e})}).catch(()=>{})});let c=null;l.onResize(({cols:e,rows:i})=>{let r=o.current;r&&(c&&clearTimeout(c),c=setTimeout(()=>{fetch(`/api/terminal/${r}/resize`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cols:e,rows:i})}).catch(()=>{})},50))})}catch(e){if(i)return;h("error"),d(e instanceof Error?e.message:String(e)),l.writeln(`\x1b[31m[terminal error: ${e instanceof Error?e.message:String(e)}]\x1b[0m`)}})();let u=new ResizeObserver(()=>{try{c.fit()}catch{}});return u.observe(r.current),()=>{i=!0,u.disconnect();let e=a.current;e&&(e.close(),a.current=null);let r=o.current;r&&(fetch(`/api/terminal/${r}`,{method:"DELETE",keepalive:!0}).catch(()=>{}),o.current=null);try{l.dispose()}catch{}s.current=null,n.current=null}},[e]),(0,I.jsxs)("div",{className:`relative flex min-h-0 flex-1 flex-col bg-[#0b0d10] ${i??""}`,children:["error"===l&&null!==c&&(0,I.jsx)("div",{className:"absolute top-2 left-2 z-10 rounded border border-red-500/40 bg-red-950/80 px-2 py-1 text-[11px] text-red-200",role:"alert",children:c}),(0,I.jsx)("div",{ref:r,className:"min-h-0 flex-1 px-2 py-2"})]})}let nB=(0,B.default)("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);var nA=e.i(56032);let nj=(0,R.createContext)(null);function nH(){let e=(0,R.useContext)(nj);if(null===e)throw Error("No Tree Api Provided");return e}let nW=(0,R.createContext)(null),nz=(0,R.createContext)(null),nF=(0,R.createContext)(0);function n$(){(0,R.useContext)(nF)}function nK(e,i,r){return Math.max(Math.min(e,r),i)}function nU(e){return e&&e.isLeaf}function nY(e){return e&&e.isInternal&&!e.isOpen}function nq(e){var i;return e&&e.isOpen&&!(null==(i=e.children)?void 0:i.length)}let nX=e=>{if(!e.parent)throw Error("Node does not have a parent");return e.parent.children.findIndex(i=>i.id===e.id)};function nV(){}function nG(e){let i,r=nJ(e);for(let o=0;o<r.length;++o)if(r[o]===e){var s,n;s=r,i=(n=o)+1<s.length?s[n+1]:s[0];break}null==i||i.focus()}function nZ(e){let i,r=nJ(e);for(let o=0;o<r.length;++o)if(r[o]===e){var s,n;s=r,i=(n=o)-1>=0?s[n-1]:s[s.length-1];break}null==i||i.focus()}function nJ(e){return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter(i=>i===e||!e.contains(i))}function nQ(e,i){return"boolean"==typeof i?i:"string"==typeof i?e[i]:i(e)}function n0(e){return null===e?null:n1(e)}function n1(e){return"string"==typeof e?e:e.id}function n2(...e){return i=>{e.forEach(e=>{"function"==typeof e?e(i):null!=e&&(e.current=i)})}}function n5(e,...i){if(e)return e(...i)}function n3(e){return new Promise((i,r)=>{let s=0;!function n(){100===(s+=1)&&r(),e()?i():setTimeout(n,10)}()})}function n6(e){var i,r;let s=e.focusedNode;return s?s.isOpen?0:s.parent?s.childIndex+1:0:null!=(r=null==(i=e.root.children)?void 0:i.length)?r:0}function n4(e){let i=e.focusedNode;return i?i.isOpen?i.id:i.parent&&!i.parent.isRoot?i.parent.id:null:null}e.s(["access",()=>nQ,"bound",()=>nK,"dfs",()=>function e(i,r){if(!i)return null;if(i.id===r)return i;if(i.children)for(let s of i.children){let i=e(s,r);if(i)return i}return null},"focusNextElement",()=>nG,"focusPrevElement",()=>nZ,"getInsertIndex",()=>n6,"getInsertParentId",()=>n4,"identify",()=>n1,"identifyNull",()=>n0,"indexOf",0,nX,"isClosed",()=>nY,"isDescendant",0,(e,i)=>{let r=e;for(;r;){if(r.id===i.id)return!0;r=r.parent}return!1},"isItem",()=>nU,"isOpenWithEmptyChildren",()=>nq,"mergeRefs",()=>n2,"noop",()=>nV,"safeRun",()=>n5,"waitFor",()=>n3,"walk",()=>function e(i,r){if(r(i),i.children)for(let s of i.children)e(s,r)}],55498);var n8=e.i(55498);let n7={display:"flex",alignItems:"center",zIndex:1},n9={flex:1,height:"2px",background:"#4B91E2",borderRadius:"1px"},oe={width:"4px",height:"4px",boxShadow:"0 0 0 3px #4B91E2",borderRadius:"50%"},ot=R.default.memo(function({top:e,left:i,indent:r}){return(0,I.jsxs)("div",{style:Object.assign(Object.assign({},n7),{position:"absolute",pointerEvents:"none",top:e-2+"px",left:i+"px",right:r+"px"}),children:[(0,I.jsx)("div",{style:Object.assign({},oe)}),(0,I.jsx)("div",{style:Object.assign({},n9)})]})});function oi({node:e,attrs:i,innerRef:r,children:s}){return(0,I.jsx)("div",Object.assign({},i,{ref:r,onFocus:e=>e.stopPropagation(),onClick:e.handleClick,children:s}))}function or(e){return(0,I.jsxs)("div",{ref:e.dragHandle,style:e.style,children:[(0,I.jsx)("span",{onClick:i=>{i.stopPropagation(),e.node.toggle()},children:e.node.isLeaf?"🌳":e.node.isOpen?"🗁":"🗀"})," ",e.node.isEditing?(0,I.jsx)(on,Object.assign({},e)):(0,I.jsx)(os,Object.assign({},e))]})}function os(e){return(0,I.jsx)(I.Fragment,{children:(0,I.jsx)("span",{children:e.node.data.name})})}function on({node:e}){let i=(0,R.useRef)();return(0,R.useEffect)(()=>{var e,r;null==(e=i.current)||e.focus(),null==(r=i.current)||r.select()},[]),(0,I.jsx)("input",{ref:i,defaultValue:e.data.name,onBlur:()=>e.reset(),onKeyDown:r=>{var s;"Escape"===r.key&&e.reset(),"Enter"===r.key&&e.submit((null==(s=i.current)?void 0:s.value)||"")}})}function oo(e){return{type:"EDIT",id:e}}function oa(e){return{type:"FOCUS",id:e}}class ol{constructor(e){this.handleClick=e=>{e.metaKey&&!this.tree.props.disableMultiSelection?this.isSelected?this.deselect():this.selectMulti():e.shiftKey&&!this.tree.props.disableMultiSelection?this.selectContiguous():(this.select(),this.activate())},this.tree=e.tree,this.id=e.id,this.data=e.data,this.level=e.level,this.children=e.children,this.parent=e.parent,this.isDraggable=e.isDraggable,this.rowIndex=e.rowIndex}get isRoot(){return this.id===oh}get isLeaf(){return!Array.isArray(this.children)}get isInternal(){return!this.isLeaf}get isOpen(){return!this.isLeaf&&this.tree.isOpen(this.id)}get isClosed(){return!this.isLeaf&&!this.tree.isOpen(this.id)}get isEditable(){return this.tree.isEditable(this.data)}get isEditing(){return this.tree.editingId===this.id}get isSelected(){return this.tree.isSelected(this.id)}get isOnlySelection(){return this.isSelected&&this.tree.hasOneSelection}get isSelectedStart(){var e;return this.isSelected&&!(null==(e=this.prev)?void 0:e.isSelected)}get isSelectedEnd(){var e;return this.isSelected&&!(null==(e=this.next)?void 0:e.isSelected)}get isFocused(){return this.tree.isFocused(this.id)}get isDragging(){return this.tree.isDragging(this.id)}get willReceiveDrop(){return this.tree.willReceiveDrop(this.id)}get state(){return{isClosed:this.isClosed,isDragging:this.isDragging,isEditing:this.isEditing,isFocused:this.isFocused,isInternal:this.isInternal,isLeaf:this.isLeaf,isOpen:this.isOpen,isSelected:this.isSelected,isSelectedEnd:this.isSelectedEnd,isSelectedStart:this.isSelectedStart,willReceiveDrop:this.willReceiveDrop}}get childIndex(){return this.parent&&this.parent.children?this.parent.children.findIndex(e=>e.id===this.id):-1}get next(){return null===this.rowIndex?null:this.tree.at(this.rowIndex+1)}get prev(){return null===this.rowIndex?null:this.tree.at(this.rowIndex-1)}get nextSibling(){var e,i;let r=this.childIndex;return null!=(i=null==(e=this.parent)?void 0:e.children[r+1])?i:null}isAncestorOf(e){if(!e)return!1;let i=e;for(;i;){if(i.id===this.id)return!0;i=i.parent}return!1}select(){this.tree.select(this)}deselect(){this.tree.deselect(this)}selectMulti(){this.tree.selectMulti(this)}selectContiguous(){this.tree.selectContiguous(this)}activate(){this.tree.activate(this)}focus(){this.tree.focus(this)}toggle(){this.tree.toggle(this)}open(){this.tree.open(this)}openParents(){this.tree.openParents(this)}close(){this.tree.close(this)}submit(e){this.tree.submit(this,e)}reset(){this.tree.reset()}clone(){return new ol(Object.assign({},this))}edit(){return this.tree.edit(this)}}let oh="__REACT_ARBORIST_INTERNAL_ROOT__";function oc(e){var i;let r=new ol({tree:e,id:oh,data:{id:oh},level:-1,parent:null,children:null,isDraggable:!0,rowIndex:null});return r.children=(null!=(i=e.props.data)?i:[]).map(i=>(function i(r,s,n){let o=e.accessId(r),a=new ol({tree:e,data:r,level:s,parent:n,id:o,children:null,isDraggable:e.isDraggable(r),rowIndex:null}),l=e.accessChildren(r);return l&&(a.children=l.map(e=>i(e,s+1,a))),a})(i,0,r)),r}function od(e={},i){if("VISIBILITY_OPEN"===i.type)return Object.assign(Object.assign({},e),{[i.id]:!0});if("VISIBILITY_CLOSE"===i.type)return Object.assign(Object.assign({},e),{[i.id]:!1});if("VISIBILITY_TOGGLE"===i.type){let r=e[i.id];return Object.assign(Object.assign({},e),{[i.id]:!r})}if("VISIBILITY_CLEAR"===i.type)return{};return e}let ou=e=>{var i;return{nodes:{open:{filtered:{},unfiltered:null!=(i=null==e?void 0:e.initialOpenState)?i:{}},focus:{id:null,treeFocused:!1},edit:{id:null},drag:{id:null,selectedIds:[],destinationParentId:null,destinationIndex:null},selection:{ids:new Set,anchor:null,mostRecent:null}},dnd:{cursor:{type:"none"},dragId:null,dragIds:[],parentId:null,index:-1}}},of=e=>({type:"SELECTION_ADD",ids:(Array.isArray(e)?e:[e]).map(n1)}),op=e=>({type:"SELECTION_REMOVE",ids:(Array.isArray(e)?e:[e]).map(n1)}),o_=e=>({type:"SELECTION_MOST_RECENT",id:null===e?null:n1(e)}),og=e=>({type:"SELECTION_ANCHOR",id:null===e?null:n1(e)}),ov=e=>({type:"DND_CURSOR",cursor:e}),om=(e,i)=>({type:"DND_HOVERING",parentId:e,index:i}),oS={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"};function oy({offset:e,mouse:i,id:r,dragIds:s,isDragging:n}){return(0,I.jsxs)(ob,{isDragging:n,children:[(0,I.jsx)(ow,{offset:e,children:(0,I.jsx)(ox,{id:r,dragIds:s})}),(0,I.jsx)(oC,{mouse:i,count:s.length})]})}let ob=(0,R.memo)(function(e){return e.isDragging?(0,I.jsx)("div",{style:oS,children:e.children}):null});function ow(e){return(0,I.jsx)("div",{className:"row preview",style:(e=>{if(!e)return{display:"none"};let{x:i,y:r}=e;return{transform:`translate(${i}px, ${r}px)`}})(e.offset),children:e.children})}function oC(e){let{count:i,mouse:r}=e;return i>1?(0,I.jsx)("div",{className:"selected-count",style:(e=>{if(!e)return{display:"none"};let{x:i,y:r}=e;return{transform:`translate(${i+10}px, ${r+10}px)`}})(r),children:i}):null}let ox=(0,R.memo)(function(e){let i=nH(),r=i.get(e.id);return r?(0,I.jsx)(i.renderNode,{preview:!0,node:r,style:{paddingLeft:r.level*i.indent,opacity:.2,background:"transparent"},tree:i}):null});function ok(){return(ok=Object.assign.bind()).apply(null,arguments)}function oE(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oD(e,i){return(oD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,i){return e.__proto__=i,e})(e,i)}var oO=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function oT(e,i){if(e.length!==i.length)return!1;for(var r,s,n=0;n<e.length;n++)if(!((r=e[n])===(s=i[n])||oO(r)&&oO(s))&&1)return!1;return!0}let oP=function(e,i){void 0===i&&(i=oT);var r,s,n=[],o=!1;return function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return o&&r===this&&i(a,n)||(s=e.apply(this,a),o=!0,r=this,n=a),s}};var oI="object"==typeof performance&&"function"==typeof performance.now?function(){return performance.now()}:function(){return Date.now()};function oR(e){cancelAnimationFrame(e.id)}var oM=-1;function oN(e){if(void 0===e&&(e=!1),-1===oM||e){var i=document.createElement("div"),r=i.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(i),oM=i.offsetWidth-i.clientWidth,document.body.removeChild(i)}return oM}var oL=null;function oB(e){if(void 0===e&&(e=!1),null===oL||e){var i=document.createElement("div"),r=i.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var s=document.createElement("div"),n=s.style;n.width="100px",n.height="100px",i.appendChild(s),document.body.appendChild(i),i.scrollLeft>0?oL="positive-descending":(i.scrollLeft=1,oL=0===i.scrollLeft?"negative":"positive-ascending"),document.body.removeChild(i)}return oL}var oA=function(e,i){return e},oj=function(e,i){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,i.instance},oH=(g=(p={getItemOffset:function(e,i){return i*e.itemSize},getItemSize:function(e,i){return e.itemSize},getEstimatedTotalSize:function(e){var i=e.itemCount;return e.itemSize*i},getOffsetForIndexAndAlignment:function(e,i,r,s,n,o){var a=e.direction,l=e.height,h=e.itemCount,c=e.itemSize,d=e.layout,u=e.width,f="horizontal"===a||"horizontal"===d?u:l,p=Math.max(0,h*c-f),_=Math.min(p,i*c),g=Math.max(0,i*c-f+c+o);switch("smart"===r&&(r=s>=g-f&&s<=_+f?"auto":"center"),r){case"start":return _;case"end":return g;case"center":var v=Math.round(g+(_-g)/2);if(v<Math.ceil(f/2))return 0;if(v>p+Math.floor(f/2))return p;return v;default:if(s>=g&&s<=_)return s;if(s<g)return g;return _}},getStartIndexForOffset:function(e,i){return Math.max(0,Math.min(e.itemCount-1,Math.floor(i/e.itemSize)))},getStopIndexForStartIndex:function(e,i,r){var s=e.direction,n=e.height,o=e.itemCount,a=e.itemSize,l=e.layout,h=e.width,c=Math.ceil((("horizontal"===s||"horizontal"===l?h:n)+r-i*a)/a);return Math.max(0,Math.min(o-1,i+c-1))},initInstanceProps:function(e){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(e){e.itemSize}}).getItemOffset,v=p.getEstimatedTotalSize,m=p.getItemSize,S=p.getOffsetForIndexAndAlignment,y=p.getStartIndexForOffset,b=p.getStopIndexForStartIndex,w=p.initInstanceProps,C=p.shouldResetStyleCacheOnItemSizeChange,x=p.validateProps,(_=function(e){function i(i){var r;return(r=e.call(this,i)||this)._instanceProps=w(r.props,oE(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:oE(r),isScrolling:!1,scrollDirection:"forward",scrollOffset:"number"==typeof r.props.initialScrollOffset?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=oP(function(e,i,s,n){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:i,visibleStartIndex:s,visibleStopIndex:n})}),r._callOnScroll=void 0,r._callOnScroll=oP(function(e,i,s){return r.props.onScroll({scrollDirection:e,scrollOffset:i,scrollUpdateWasRequested:s})}),r._getItemStyle=void 0,r._getItemStyle=function(e){var i,s=r.props,n=s.direction,o=s.itemSize,a=s.layout,l=r._getItemStyleCache(C&&o,C&&a,C&&n);if(l.hasOwnProperty(e))i=l[e];else{var h=g(r.props,e,r._instanceProps),c=m(r.props,e,r._instanceProps),d="horizontal"===n||"horizontal"===a,u="rtl"===n,f=d?h:0;l[e]=i={position:"absolute",left:u?void 0:f,right:u?f:void 0,top:d?0:h,height:d?"100%":c,width:d?c:"100%"}}return i},r._getItemStyleCache=void 0,r._getItemStyleCache=oP(function(e,i,r){return{}}),r._onScrollHorizontal=function(e){var i=e.currentTarget,s=i.clientWidth,n=i.scrollLeft,o=i.scrollWidth;r.setState(function(e){if(e.scrollOffset===n)return null;var i=r.props.direction,a=n;if("rtl"===i)switch(oB()){case"negative":a=-n;break;case"positive-descending":a=o-s-n}return a=Math.max(0,Math.min(a,o-s)),{isScrolling:!0,scrollDirection:e.scrollOffset<a?"forward":"backward",scrollOffset:a,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(e){var i=e.currentTarget,s=i.clientHeight,n=i.scrollHeight,o=i.scrollTop;r.setState(function(e){if(e.scrollOffset===o)return null;var i=Math.max(0,Math.min(o,n-s));return{isScrolling:!0,scrollDirection:e.scrollOffset<i?"forward":"backward",scrollOffset:i,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(e){var i=r.props.outerRef;r._outerRef=e,"function"==typeof i?i(e):null!=i&&"object"==typeof i&&i.hasOwnProperty("current")&&(i.current=e)},r._resetIsScrollingDebounced=function(){var e,i,s;null!==r._resetIsScrollingTimeoutId&&oR(r._resetIsScrollingTimeoutId),e=r._resetIsScrolling,i=oI(),r._resetIsScrollingTimeoutId=s={id:requestAnimationFrame(function r(){oI()-i>=150?e.call(null):s.id=requestAnimationFrame(r)})}},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}(r=i).prototype=Object.create((s=e).prototype),r.prototype.constructor=r,oD(r,s),i.getDerivedStateFromProps=function(e,i){return oj(e,i),x(e),null};var r,s,n=i.prototype;return n.scrollTo=function(e){e=Math.max(0,e),this.setState(function(i){return i.scrollOffset===e?null:{scrollDirection:i.scrollOffset<e?"forward":"backward",scrollOffset:e,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},n.scrollToItem=function(e,i){void 0===i&&(i="auto");var r=this.props,s=r.itemCount,n=r.layout,o=this.state.scrollOffset;e=Math.max(0,Math.min(e,s-1));var a=0;if(this._outerRef){var l=this._outerRef;a="vertical"===n?l.scrollWidth>l.clientWidth?oN():0:l.scrollHeight>l.clientHeight?oN():0}this.scrollTo(S(this.props,e,i,o,this._instanceProps,a))},n.componentDidMount=function(){var e=this.props,i=e.direction,r=e.initialScrollOffset,s=e.layout;if("number"==typeof r&&null!=this._outerRef){var n=this._outerRef;"horizontal"===i||"horizontal"===s?n.scrollLeft=r:n.scrollTop=r}this._callPropsCallbacks()},n.componentDidUpdate=function(){var e=this.props,i=e.direction,r=e.layout,s=this.state,n=s.scrollOffset;if(s.scrollUpdateWasRequested&&null!=this._outerRef){var o=this._outerRef;if("horizontal"===i||"horizontal"===r)if("rtl"===i)switch(oB()){case"negative":o.scrollLeft=-n;break;case"positive-ascending":o.scrollLeft=n;break;default:var a=o.clientWidth,l=o.scrollWidth;o.scrollLeft=l-a-n}else o.scrollLeft=n;else o.scrollTop=n}this._callPropsCallbacks()},n.componentWillUnmount=function(){null!==this._resetIsScrollingTimeoutId&&oR(this._resetIsScrollingTimeoutId)},n.render=function(){var e=this.props,i=e.children,r=e.className,s=e.direction,n=e.height,o=e.innerRef,a=e.innerElementType,l=e.innerTagName,h=e.itemCount,c=e.itemData,d=e.itemKey,u=void 0===d?oA:d,f=e.layout,p=e.outerElementType,_=e.outerTagName,g=e.style,m=e.useIsScrolling,S=e.width,y=this.state.isScrolling,b="horizontal"===s||"horizontal"===f,w=b?this._onScrollHorizontal:this._onScrollVertical,C=this._getRangeToRender(),x=C[0],k=C[1],E=[];if(h>0)for(var D=x;D<=k;D++)E.push((0,R.createElement)(i,{data:c,key:u(D,c),index:D,isScrolling:m?y:void 0,style:this._getItemStyle(D)}));var O=v(this.props,this._instanceProps);return(0,R.createElement)(p||_||"div",{className:r,onScroll:w,ref:this._outerRefSetter,style:ok({position:"relative",height:n,width:S,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:s},g)},(0,R.createElement)(a||l||"div",{children:E,ref:o,style:{height:b?"100%":O,pointerEvents:y?"none":void 0,width:b?O:"100%"}}))},n._callPropsCallbacks=function(){if("function"==typeof this.props.onItemsRendered&&this.props.itemCount>0){var e=this._getRangeToRender(),i=e[0],r=e[1],s=e[2],n=e[3];this._callOnItemsRendered(i,r,s,n)}if("function"==typeof this.props.onScroll){var o=this.state,a=o.scrollDirection,l=o.scrollOffset,h=o.scrollUpdateWasRequested;this._callOnScroll(a,l,h)}},n._getRangeToRender=function(){var e=this.props,i=e.itemCount,r=e.overscanCount,s=this.state,n=s.isScrolling,o=s.scrollDirection,a=s.scrollOffset;if(0===i)return[0,0,0,0];var l=y(this.props,a,this._instanceProps),h=b(this.props,l,a,this._instanceProps);return[Math.max(0,l-(n&&"backward"!==o?1:Math.max(1,r))),Math.max(0,Math.min(i-1,h+(n&&"forward"!==o?1:Math.max(1,r)))),l,h]},i}(R.PureComponent)).defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},_);function oW(){var e,i;let r=nH(),s=function(){let e=(0,R.useContext)(nz);if(null===e)throw Error("Provide a DnDContext");return e}().cursor;if(!s||"line"!==s.type)return null;let n=r.indent,o=r.rowHeight*s.index+(null!=(i=null!=(e=r.props.padding)?e:r.props.paddingTop)?i:0),a=n*s.level,l=r.renderCursor;return(0,I.jsx)(l,{top:o,left:a,indent:n})}var oz=function(e,i){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>i.indexOf(s)&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,s=Object.getOwnPropertySymbols(e);n<s.length;n++)0>i.indexOf(s[n])&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(r[s[n]]=e[s[n]]);return r};let oF=(0,R.forwardRef)(function(e,i){let{children:r}=e,s=oz(e,["children"]),n=nH();return(0,I.jsxs)("div",Object.assign({ref:i},s,{onClick:e=>{e.currentTarget===e.target&&n.deselectAll()},children:[(0,I.jsx)(o$,{}),r]}))}),o$=()=>{let e=nH();return(0,I.jsx)("div",{style:{height:e.visibleNodes.length*e.rowHeight,width:"100%",position:"absolute",left:"0",right:"0"},children:(0,I.jsx)(oW,{})})};var oK=function(e,i){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>i.indexOf(s)&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,s=Object.getOwnPropertySymbols(e);n<s.length;n++)0>i.indexOf(s[n])&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(r[s[n]]=e[s[n]]);return r};let oU=(0,R.forwardRef)(function(e,i){var r,s,n,o,{style:a}=e,l=oK(e,["style"]);let h=nH(),c=null!=(s=null!=(r=h.props.padding)?r:h.props.paddingTop)?s:0,d=null!=(o=null!=(n=h.props.padding)?n:h.props.paddingBottom)?o:0;return(0,I.jsx)("div",Object.assign({ref:i,style:Object.assign(Object.assign({},a),{height:`${parseFloat(a.height)+c+d}px`})},l))});var oY="u">typeof window?R.useLayoutEffect:R.useEffect;function oq(e){return(oq="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oX(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var oV=function(){var e;function i(e,r,s){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");oX(this,"spec",void 0),oX(this,"monitor",void 0),oX(this,"connector",void 0),this.spec=e,this.monitor=r,this.connector=s}return e=[{key:"beginDrag",value:function(){var e,i=this.spec,r=this.monitor;return null!=(e="object"===oq(i.item)?i.item:"function"==typeof i.item?i.item(r):{})?e:null}},{key:"canDrag",value:function(){var e=this.spec,i=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(i)}},{key:"isDragging",value:function(e,i){var r=this.spec,s=this.monitor,n=r.isDragging;return n?n(s):i===e.getSourceId()}},{key:"endDrag",value:function(){var e=this.spec,i=this.monitor,r=this.connector,s=e.end;s&&s(i.getItem(),i),r.reconnect()}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function oG(e,i){for(var r,s=arguments.length,n=Array(s>2?s-2:0),o=2;o<s;o++)n[o-2]=arguments[o];if(!e){if(void 0===i)r=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;(r=Error(i.replace(/%s/g,function(){return n[a++]}))).name="Invariant Violation"}throw r.framesToPop=1,r}}var oZ=(0,R.createContext)({dragDropManager:void 0});function oJ(){var e=(0,R.useContext)(oZ).dragDropManager;return oG(null!=e,"Expected drag drop context"),e}function oQ(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function o0(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function o1(e,i){var r,s=function(e){if(Array.isArray(e))return o0(e)}(r=i||[])||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||function(e,i){if(e){if("string"==typeof e)return o0(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o0(e,void 0)}}(r)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();return null==i&&"function"!=typeof e&&s.push(e),(0,R.useMemo)(function(){return"function"==typeof e?e():e},s)}function o2(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var o5=!1,o3=!1,o6=function(){var e;function i(e){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");o2(this,"internalMonitor",void 0),o2(this,"sourceId",null),this.internalMonitor=e.getMonitor()}return e=[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){oG(!o5,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return o5=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{o5=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;oG(!o3,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return o3=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{o3=!1}}},{key:"subscribeToStateChange",value:function(e,i){return this.internalMonitor.subscribeToStateChange(e,i)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,i){return this.internalMonitor.isOverTarget(e,i)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function o4(e){var i={};return Object.keys(e).forEach(function(r){var s=e[r];if(r.endsWith("Ref"))i[r]=e[r];else{var n=function(){var e,i,r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!(0,R.isValidElement)(n))return s(n,o),n;if("string"!=typeof n.type){var a=n.type.displayName||n.type.name||"the component";throw Error("Only native element nodes can now be passed to React DnD connectors."+"You can either wrap ".concat(a," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}return e=n,i=o?function(e){return s(e,o)}:s,(oG("string"!=typeof(r=e.ref),"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r)?(0,R.cloneElement)(e,{ref:function(e){o8(r,e),o8(i,e)}}):(0,R.cloneElement)(e,{ref:i})};i[r]=function(){return n}}}),i}function o8(e,i){"function"==typeof e?e(i):e.current=i}function o7(e){return(o7="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o9(e){return null!==e&&"object"===o7(e)&&Object.prototype.hasOwnProperty.call(e,"current")}function ae(e,i,r,s){var n=r?r.call(s,e,i):void 0;if(void 0!==n)return!!n;if(e===i)return!0;if("object"!=typeof e||!e||"object"!=typeof i||!i)return!1;var o=Object.keys(e),a=Object.keys(i);if(o.length!==a.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(i),h=0;h<o.length;h++){var c=o[h];if(!l(c))return!1;var d=e[c],u=i[c];if(!1===(n=r?r.call(s,d,u,c):void 0)||void 0===n&&d!==u)return!1}return!0}function at(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var ai=function(){var e;function i(e){var r=this;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");at(this,"hooks",o4({dragSource:function(e,i){r.clearDragSource(),r.dragSourceOptions=i||null,o9(e)?r.dragSourceRef=e:r.dragSourceNode=e,r.reconnectDragSource()},dragPreview:function(e,i){r.clearDragPreview(),r.dragPreviewOptions=i||null,o9(e)?r.dragPreviewRef=e:r.dragPreviewNode=e,r.reconnectDragPreview()}})),at(this,"handlerId",null),at(this,"dragSourceRef",null),at(this,"dragSourceNode",void 0),at(this,"dragSourceOptionsInternal",null),at(this,"dragSourceUnsubscribe",void 0),at(this,"dragPreviewRef",null),at(this,"dragPreviewNode",void 0),at(this,"dragPreviewOptionsInternal",null),at(this,"dragPreviewUnsubscribe",void 0),at(this,"lastConnectedHandlerId",null),at(this,"lastConnectedDragSource",null),at(this,"lastConnectedDragSourceOptions",null),at(this,"lastConnectedDragPreview",null),at(this,"lastConnectedDragPreviewOptions",null),at(this,"backend",void 0),this.backend=e}return e=[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,i=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();if(i&&this.disconnectDragSource(),this.handlerId){if(!e){this.lastConnectedDragSource=e;return}i&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions))}}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,i=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(i&&this.disconnectDragPreview(),this.handlerId){if(!e){this.lastConnectedDragPreview=e;return}i&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions))}}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!ae(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!ae(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}(),ar=e.i(65932);function as(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function an(e,i,r){var s,n=function(e){if(Array.isArray(e))return e}(s=(0,R.useState)(function(){return i(e)}))||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(s,2)||function(e,i){if(e){if("string"==typeof e)return as(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return as(e,2)}}(s,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[0],a=n[1],l=(0,R.useCallback)(function(){var s=i(e);!(0,ar.default)(o,s)&&(a(s),r&&r())},[o,e,r]);return oY(l),[o,l]}function ao(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function aa(e,i,r){var s,n,o,a;return o=(n=function(e){if(Array.isArray(e))return e}(s=an(i,e||function(){return{}},function(){return r.reconnect()}))||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(s,2)||function(e,i){if(e){if("string"==typeof e)return ao(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ao(e,2)}}(s,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],oY(function(){var e=i.getHandlerId();if(null!=e)return i.subscribeToStateChange(a,{handlerIds:[e]})},[i,a=n[1]]),o}function al(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var ah=function(){var e;function i(e,r){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");al(this,"spec",void 0),al(this,"monitor",void 0),this.spec=e,this.monitor=r}return e=[{key:"canDrop",value:function(){var e=this.spec,i=this.monitor;return!e.canDrop||e.canDrop(i.getItem(),i)}},{key:"hover",value:function(){var e=this.spec,i=this.monitor;e.hover&&e.hover(i.getItem(),i)}},{key:"drop",value:function(){var e=this.spec,i=this.monitor;if(e.drop)return e.drop(i.getItem(),i)}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function ac(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function ad(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var au=!1,af=function(){var e;function i(e){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");ad(this,"internalMonitor",void 0),ad(this,"targetId",null),this.internalMonitor=e.getMonitor()}return e=[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,i){return this.internalMonitor.subscribeToStateChange(e,i)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;oG(!au,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return au=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{au=!1}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function ap(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var a_=function(){var e;function i(e){var r=this;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");ap(this,"hooks",o4({dropTarget:function(e,i){r.clearDropTarget(),r.dropTargetOptions=i,o9(e)?r.dropTargetRef=e:r.dropTargetNode=e,r.reconnect()}})),ap(this,"handlerId",null),ap(this,"dropTargetRef",null),ap(this,"dropTargetNode",void 0),ap(this,"dropTargetOptionsInternal",null),ap(this,"unsubscribeDropTarget",void 0),ap(this,"lastConnectedHandlerId",null),ap(this,"lastConnectedDropTarget",null),ap(this,"lastConnectedDropTargetOptions",null),ap(this,"backend",void 0),this.backend=e}return e=[{key:"connectTarget",get:function(){return this.dropTarget}},{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var i=this.dropTarget;if(this.handlerId){if(!i){this.lastConnectedDropTarget=i;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=i,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,i,this.dropTargetOptions))}}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!ae(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function ag(e,i){var r,s,n,o,a,l,h,c,d,u=o1(e,i),f=(r=oJ(),(0,R.useMemo)(function(){return new af(r)},[r])),p=(s=u.options,n=oJ(),o=(0,R.useMemo)(function(){return new a_(n.getBackend())},[n]),oY(function(){return o.dropTargetOptions=s||null,o.reconnect(),function(){return o.disconnectDropTarget()}},[s]),o);return a=oJ(),l=(0,R.useMemo)(function(){return new ah(u,f)},[f]),(0,R.useEffect)(function(){l.spec=u},[u]),oY(function(){var e,i,r,s,n=function(e){if(Array.isArray(e))return e}((e=d,s=[r=(i=a.getRegistry()).addTarget(e,h),function(){return i.removeTarget(r)}]))||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(s,2)||function(e,i){if(e){if("string"==typeof e)return ac(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ac(e,2)}}(s,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[0],l=n[1];return f.receiveHandlerId(o),p.receiveHandlerId(o),l},[a,f,h=l,p,(c=u.accept,d=(0,R.useMemo)(function(){return oG(null!=u.accept,"accept must be defined"),Array.isArray(c)?c:[c]},[c])).map(function(e){return e.toString()}).join("|")]),[aa(u.collect,f,p),(0,R.useMemo)(function(){return p.hooks.dropTarget()},[p])]}function av(e,i){return{parentId:e||null,index:i}}function am(e,i){return{type:"line",index:e,level:i}}function aS(e,i){var r;let s=e;for(;s.parent&&s.level>i;)s=s.parent;return{parentId:(null==(r=s.parent)?void 0:r.id)||null,index:nX(s)+1}}function ay(e){var i,r,s;let n,o,a,l,h,c,d,u,f=(r=e.element,s=e.offset,n=r.getBoundingClientRect(),o=s.x-Math.round(n.x),a=s.y-Math.round(n.y),c=!(h=a<(l=n.height)/2),{x:o,inTopHalf:h,inBottomHalf:c,inMiddle:u=a>(d=l/4)&&a<l-d,atTop:!u&&h,atBottom:!u&&c}),p=e.indent,_=Math.round(Math.max(0,f.x-p)/p),{node:g,nextNode:v,prevNode:m}=e,[S,y]=function(e,i,r,s){if(!e)return[i,null];if(e.isInternal)if(s.atTop)return[i,e];else if(s.inMiddle)return[e,e];else return[e,r];return s.inTopHalf?[i,e]:[e,r]}(g,m,v,f);if(g&&g.isInternal&&f.inMiddle)return{drop:av(g.id,null),cursor:{type:"highlight",id:g.id}};if(!S)return{drop:av(null==(i=null==y?void 0:y.parent)?void 0:i.id,0),cursor:am(0,0)};if(nU(S)||nY(S)){let e=nK(_,(null==y?void 0:y.level)||0,S.level);return{drop:aS(S,e),cursor:am(S.rowIndex+1,e)}}if(nq(S)){let e=nK(_,0,S.level+1);return e>S.level?{drop:av(S.id,0),cursor:am(S.rowIndex+1,e)}:{drop:aS(S,e),cursor:am(S.rowIndex+1,e)}}return{drop:av(null==S?void 0:S.id,0),cursor:am(S.rowIndex+1,S.level+1)}}let ab=R.default.memo(function({index:e,style:i}){n$(),function(){if(null===(0,R.useContext)(nW))throw Error("Provide a NodesContext")}();let r=nH(),s=function(e){let i=nH(),r=i.at(e);if(!r)throw Error(`Could not find node for index: ${e}`);return(0,R.useMemo)(()=>{let s=r.clone();return i.visibleNodes[e]=s,s},[...Object.values(r.state),r])}(e),n=(0,R.useRef)(null),o=function(e){var i,r,s,n,o,a,l,h,c,d,u,f;let p=nH(),_=p.selectedIds,[g,v,m]=(oG(!(i=o1(()=>({canDrag:()=>e.isDraggable,type:"NODE",item:()=>{let i,r=p.isSelected(e.id)?Array.from(_):[e.id];return p.dispatch((i=e.id,{type:"DND_DRAG_START",id:i,dragIds:r})),{id:e.id,dragIds:r}},end:()=>{p.hideCursor(),p.dispatch({type:"DND_DRAG_END"})}}),[_,e])).begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)"),r=oJ(),s=(0,R.useMemo)(function(){return new o6(r)},[r]),n=i.options,o=i.previewOptions,a=oJ(),oY(function(){return l.dragSourceOptions=n||null,l.reconnect(),function(){return l.disconnectDragSource()}},[l=(0,R.useMemo)(function(){return new ai(a.getBackend())},[a]),n]),oY(function(){return l.dragPreviewOptions=o||null,l.reconnect(),function(){return l.disconnectDragPreview()}},[l,o]),h=l,c=oJ(),d=(0,R.useMemo)(function(){return new oV(i,s,h)},[s,h]),(0,R.useEffect)(function(){d.spec=i},[i]),oY(function(){if(null!=f){var e,i,r,n,o=function(e){if(Array.isArray(e))return e}((e=f,n=[r=(i=c.getRegistry()).addSource(e,u),function(){return i.removeSource(r)}]))||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(n,2)||function(e,i){if(e){if("string"==typeof e)return oQ(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oQ(e,2)}}(n,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=o[0],l=o[1];return s.receiveHandlerId(a),h.receiveHandlerId(a),l}},[c,s,h,u=d,f=(0,R.useMemo)(function(){var e=i.type;return oG(null!=e,"spec.type must be defined"),e},[i])]),[aa(i.collect,s,h),(0,R.useMemo)(function(){return h.hooks.dragSource()},[h]),(0,R.useMemo)(function(){return h.hooks.dragPreview()},[h])]);return(0,R.useEffect)(()=>{m((D||((D=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),D))},[m]),v}(s),a=function(e,i){let r=nH(),[s,n]=ag(()=>({accept:"NODE",canDrop:()=>r.canDrop(),hover:(s,n)=>{let o=n.getClientOffset();if(!e.current||!o)return;let{cursor:a,drop:l}=ay({element:e.current,offset:o,indent:r.indent,node:i,prevNode:i.prev,nextNode:i.next});l&&r.dispatch(om(l.parentId,l.index)),n.canDrop()?a&&r.showCursor(a):r.hideCursor()},drop:(e,i)=>{if(!i.canDrop())return null;let{parentId:s,index:n,dragIds:o}=r.state.dnd;n5(r.props.onMove,{dragIds:o,parentId:s===oh?null:s,index:null===n?0:n,dragNodes:r.dragNodes,parentNode:r.get(s)}),r.open(s)}}),[i,e.current,r.props]);return n}(n,s),l=(0,R.useCallback)(e=>{n.current=e,a(e)},[a]),h=r.indent*s.level,c=(0,R.useMemo)(()=>({paddingLeft:h}),[h]),d=(0,R.useMemo)(()=>{var e,s;return Object.assign(Object.assign({},i),{top:parseFloat(i.top)+(null!=(s=null!=(e=r.props.padding)?e:r.props.paddingTop)?s:0)})},[i,r.props.padding,r.props.paddingTop]),u={role:"treeitem","aria-level":s.level+1,"aria-selected":s.isSelected,"aria-expanded":s.isOpen,style:d,tabIndex:-1,className:r.props.rowClassName};(0,R.useEffect)(()=>{var e;!s.isEditing&&s.isFocused&&(null==(e=n.current)||e.focus({preventScroll:!0}))},[s.isEditing,s.isFocused,n.current]);let f=r.renderNode,p=r.renderRow;return(0,I.jsx)(p,{node:s,innerRef:l,attrs:u,children:(0,I.jsx)(f,{node:s,tree:r,style:c,dragHandle:o})})}),aw="",aC=null;function ax(){n$();let e=nH();return(0,I.jsx)("div",{role:"tree",style:{height:e.height,width:e.width,minHeight:0,minWidth:0},onContextMenu:e.props.onContextMenu,onClick:e.props.onClick,tabIndex:0,onFocus:i=>{i.currentTarget.contains(i.relatedTarget)||e.onFocus()},onBlur:i=>{i.currentTarget.contains(i.relatedTarget)||e.onBlur()},onKeyDown:i=>{var r;if(e.isEditing)return;if("Backspace"===i.key){if(!e.props.onDelete)return;let i=Array.from(e.selectedIds);if(i.length>1){let r=e.mostRecentNode;for(;r&&r.isSelected;)r=r.nextSibling;r||(r=e.lastNode),e.focus(r,{scroll:!1}),e.delete(Array.from(i))}else{let i=e.focusedNode;if(i){let r=i.nextSibling,s=i.parent;e.focus(r||s,{scroll:!1}),e.delete(i)}}return}if("Tab"===i.key&&!i.shiftKey){i.preventDefault(),nG(i.currentTarget);return}if("Tab"===i.key&&i.shiftKey){i.preventDefault(),nZ(i.currentTarget);return}if("ArrowDown"===i.key){i.preventDefault();let r=e.nextNode;if(i.metaKey){e.select(e.focusedNode),e.activate(e.focusedNode);return}{if(!i.shiftKey||e.props.disableMultiSelection)return void e.focus(r);if(!r)return;let s=e.focusedNode;return void(s?s.isSelected?e.selectContiguous(r):e.selectMulti(r):e.focus(e.firstNode))}}if("ArrowUp"===i.key){i.preventDefault();let r=e.prevNode;if(!i.shiftKey||e.props.disableMultiSelection)return void e.focus(r);{if(!r)return;let i=e.focusedNode;i?i.isSelected?e.selectContiguous(r):e.selectMulti(r):e.focus(e.lastNode);return}}if("ArrowRight"===i.key){let i=e.focusedNode;if(!i)return;i.isInternal&&i.isOpen?e.focus(e.nextNode):i.isInternal&&e.open(i.id);return}if("ArrowLeft"===i.key){let i=e.focusedNode;if(!i||i.isRoot)return;i.isInternal&&i.isOpen?e.close(i.id):(null==(r=i.parent)?void 0:r.isRoot)||e.focus(i.parent);return}if("a"===i.key&&i.metaKey&&!e.props.disableMultiSelection){i.preventDefault(),e.selectAll();return}if("a"===i.key&&!i.metaKey&&e.props.onCreate)return void e.createLeaf();if("A"===i.key&&!i.metaKey){if(!e.props.onCreate)return;e.createInternal();return}if("Home"===i.key){i.preventDefault(),e.focus(e.firstNode);return}if("End"===i.key){i.preventDefault(),e.focus(e.lastNode);return}if("Enter"===i.key){let i=e.focusedNode;if(!i||!i.isEditable||!e.props.onRename)return;setTimeout(()=>{i&&e.edit(i)});return}if(" "===i.key){i.preventDefault();let r=e.focusedNode;if(!r)return;r.isLeaf?(r.select(),r.activate()):r.toggle();return}if("*"===i.key){let i=e.focusedNode;if(!i)return;e.openSiblings(i);return}if("PageUp"===i.key){i.preventDefault(),e.pageUp();return}"PageDown"===i.key&&(i.preventDefault(),e.pageDown()),clearTimeout(aC),aw+=i.key,aC=setTimeout(()=>{aw=""},600);let s=e.visibleNodes.find(e=>{let i=e.data.name;return"string"==typeof i&&i.toLowerCase().startsWith(aw)});s&&e.focus(s.id)},children:(0,I.jsx)(oH,{className:e.props.className,outerRef:e.listEl,itemCount:e.visibleNodes.length,height:e.height,width:e.width,itemSize:e.rowHeight,overscanCount:e.overscanCount,itemKey:i=>{var r;return(null==(r=e.visibleNodes[i])?void 0:r.id)||i},outerElementType:oF,innerElementType:oU,onScroll:e.props.onScroll,onItemsRendered:e.onItemsRendered.bind(e),ref:e.list,children:ab})})}function ak(e){var i,r,s;let n,o,a;return e.isFiltered?(i=e.root,r=e.isMatch.bind(e),n={},o=[],!function e(i){if(!i.isRoot&&r(i)){n[i.id]=!0;let e=i.parent;for(;e;)n[e.id]=!0,e=e.parent}if(i.children)for(let r of i.children)e(r)}(i),!function e(i){var r;i.level>=0&&n[i.id]&&o.push(i),i.isOpen&&(null==(r=i.children)||r.forEach(e))}(i),o.forEach(aE),o):(s=e.root,a=[],!function e(i){var r;i.level>=0&&a.push(i),i.isOpen&&(null==(r=i.children)||r.forEach(e))}(s),a.forEach(aE),a)}function aE(e,i){e.rowIndex=i}let aD=e=>e.reduce((e,i,r)=>(e[i.id]=r,e),{});var aO=function(e,i,r,s){return new(r||(r=Promise))(function(n,o){function a(e){try{h(s.next(e))}catch(e){o(e)}}function l(e){try{h(s.throw(e))}catch(e){o(e)}}function h(e){var i;e.done?n(e.value):((i=e.value)instanceof r?i:new r(function(e){e(i)})).then(a,l)}h((s=s.apply(e,i||[])).next())})};let{safeRun:aT,identify:aP,identifyNull:aI}=n8;class aR{constructor(e,i,r,s){this.store=e,this.props=i,this.list=r,this.listEl=s,this.visibleStartIndex=0,this.visibleStopIndex=0,this.root=oc(this),this.visibleNodes=ak(this),this.idToIndex=aD(this.visibleNodes)}update(e){this.props=e,this.root=oc(this),this.visibleNodes=ak(this),this.idToIndex=aD(this.visibleNodes)}dispatch(e){return this.store.dispatch(e)}get state(){return this.store.getState()}get openState(){return this.state.nodes.open.unfiltered}get width(){var e;return null!=(e=this.props.width)?e:300}get height(){var e;return null!=(e=this.props.height)?e:500}get indent(){var e;return null!=(e=this.props.indent)?e:24}get rowHeight(){var e;return null!=(e=this.props.rowHeight)?e:24}get overscanCount(){var e;return null!=(e=this.props.overscanCount)?e:1}get searchTerm(){return(this.props.searchTerm||"").trim()}get matchFn(){var e;let i=null!=(e=this.props.searchMatch)?e:(e,i)=>JSON.stringify(Object.values(e.data)).toLocaleLowerCase().includes(i.toLocaleLowerCase());return e=>i(e,this.searchTerm)}accessChildren(e){var i;let r=this.props.childrenAccessor||"children";return null!=(i=n8.access(e,r))?i:null}accessId(e){let i=this.props.idAccessor||"id",r=n8.access(e,i);if(!r)throw Error("Data must contain an 'id' property or props.idAccessor must return a string");return r}get firstNode(){var e;return null!=(e=this.visibleNodes[0])?e:null}get lastNode(){var e;return null!=(e=this.visibleNodes[this.visibleNodes.length-1])?e:null}get focusedNode(){var e;return null!=(e=this.get(this.state.nodes.focus.id))?e:null}get mostRecentNode(){var e;return null!=(e=this.get(this.state.nodes.selection.mostRecent))?e:null}get nextNode(){let e=this.indexOf(this.focusedNode);return null===e?null:this.at(e+1)}get prevNode(){let e=this.indexOf(this.focusedNode);return null===e?null:this.at(e-1)}get(e){return e&&e in this.idToIndex&&this.visibleNodes[this.idToIndex[e]]||null}at(e){return this.visibleNodes[e]||null}nodesBetween(e,i){var r;if(null===e||null===i)return[];let s=null!=(r=this.indexOf(e))?r:0,n=this.indexOf(i);if(null===n)return[];let o=Math.min(s,n),a=Math.max(s,n);return this.visibleNodes.slice(o,a+1)}indexOf(e){let i=n8.identifyNull(e);return i?this.idToIndex[i]:null}get editingId(){return this.state.nodes.edit.id}createInternal(){return this.create({type:"internal"})}createLeaf(){return this.create({type:"leaf"})}create(){return aO(this,arguments,void 0,function*(e={}){var i,r;let s=void 0===e.parentId?n8.getInsertParentId(this):e.parentId,n=null!=(i=e.index)?i:n8.getInsertIndex(this),o=null!=(r=e.type)?r:"leaf",a=yield aT(this.props.onCreate,{type:o,parentId:s,index:n,parentNode:this.get(s)});a&&(this.focus(a),setTimeout(()=>{this.edit(a).then(()=>{this.select(a),this.activate(a)})}))})}delete(e){return aO(this,void 0,void 0,function*(){if(!e)return;let i=(Array.isArray(e)?e:[e]).map(aP),r=i.map(e=>this.get(e)).filter(e=>!!e);yield aT(this.props.onDelete,{nodes:r,ids:i})})}edit(e){let i=aP(e);return this.resolveEdit({cancelled:!0}),this.scrollTo(i),this.dispatch(oo(i)),new Promise(e=>{aR.editPromise=e})}submit(e,i){return aO(this,void 0,void 0,function*(){if(!e)return;let r=aP(e);yield aT(this.props.onRename,{id:r,name:i,node:this.get(r)}),this.dispatch(oo(null)),this.resolveEdit({cancelled:!1,value:i}),setTimeout(()=>this.onFocus())})}reset(){this.dispatch(oo(null)),this.resolveEdit({cancelled:!0}),setTimeout(()=>this.onFocus())}activate(e){let i=this.get(aI(e));i&&aT(this.props.onActivate,i)}resolveEdit(e){let i=aR.editPromise;i&&i(e),aR.editPromise=null}get selectedIds(){return this.state.nodes.selection.ids}get selectedNodes(){let e=[];for(let i of Array.from(this.selectedIds)){let r=this.get(i);r&&e.push(r)}return e}focus(e,i={}){e&&(this.props.selectionFollowsFocus?this.select(e):(this.dispatch(oa(aP(e))),!1!==i.scroll&&this.scrollTo(e),this.focusedNode&&aT(this.props.onFocus,this.focusedNode)))}pageUp(){var e,i;let r=this.visibleStartIndex,s=this.visibleStopIndex-r,n=null!=(i=null==(e=this.focusedNode)?void 0:e.rowIndex)?i:0;n=n>r?r:Math.max(r-s,0),this.focus(this.at(n))}pageDown(){var e,i;let r=this.visibleStartIndex,s=this.visibleStopIndex,n=s-r,o=null!=(i=null==(e=this.focusedNode)?void 0:e.rowIndex)?i:0;o=o<s?s:Math.min(o+n,this.visibleNodes.length-1),this.focus(this.at(o))}select(e,i={}){if(!e)return;let r=!1!==i.focus,s=aP(e);r&&this.dispatch(oa(s)),this.dispatch({type:"SELECTION_ONLY",id:n1(s)}),this.dispatch(og(s)),this.dispatch(o_(s)),this.scrollTo(s,i.align),this.focusedNode&&r&&aT(this.props.onFocus,this.focusedNode),aT(this.props.onSelect,this.selectedNodes)}deselect(e){if(!e)return;let i=aP(e);this.dispatch(op(i)),aT(this.props.onSelect,this.selectedNodes)}selectMulti(e){let i=this.get(aI(e));i&&(this.dispatch(oa(i.id)),this.dispatch(of(i.id)),this.dispatch(og(i.id)),this.dispatch(o_(i.id)),this.scrollTo(i),this.focusedNode&&aT(this.props.onFocus,this.focusedNode),aT(this.props.onSelect,this.selectedNodes))}selectContiguous(e){if(!e)return;let i=aP(e),{anchor:r,mostRecent:s}=this.state.nodes.selection;this.dispatch(oa(i)),this.dispatch(op(this.nodesBetween(r,s))),this.dispatch(of(this.nodesBetween(r,aI(i)))),this.dispatch(o_(i)),this.scrollTo(i),this.focusedNode&&aT(this.props.onFocus,this.focusedNode),aT(this.props.onSelect,this.selectedNodes)}deselectAll(){this.setSelection({ids:[],anchor:null,mostRecent:null}),aT(this.props.onSelect,this.selectedNodes)}selectAll(){var e;this.setSelection({ids:Object.keys(this.idToIndex),anchor:this.firstNode,mostRecent:this.lastNode}),this.dispatch(oa(null==(e=this.lastNode)?void 0:e.id)),this.focusedNode&&aT(this.props.onFocus,this.focusedNode),aT(this.props.onSelect,this.selectedNodes)}setSelection(e){var i;let r=new Set(null==(i=e.ids)?void 0:i.map(aP)),s=aI(e.anchor),n=aI(e.mostRecent);this.dispatch(Object.assign({type:"SELECTION_SET"},{ids:r,anchor:s,mostRecent:n})),aT(this.props.onSelect,this.selectedNodes)}get cursorParentId(){let{cursor:e}=this.state.dnd;return"highlight"===e.type?e.id:null}get cursorOverFolder(){return"highlight"===this.state.dnd.cursor.type}get dragNodes(){return this.state.dnd.dragIds.map(e=>this.get(e)).filter(e=>!!e)}get dragNode(){return this.get(this.state.nodes.drag.id)}get dragDestinationParent(){return this.get(this.state.nodes.drag.destinationParentId)}get dragDestinationIndex(){return this.state.nodes.drag.destinationIndex}canDrop(){var e;if(this.isFiltered)return!1;let i=null!=(e=this.get(this.state.dnd.parentId))?e:this.root,r=this.dragNodes,s=this.props.disableDrop;for(let e of r)if(!e||!i||e.isInternal&&n8.isDescendant(i,e))return!1;return"function"==typeof s?!s({parentNode:i,dragNodes:this.dragNodes,index:this.state.dnd.index||0}):"string"==typeof s?!i.data[s]:"boolean"!=typeof s||!s}hideCursor(){this.dispatch(ov({type:"none"}))}showCursor(e){this.dispatch(ov(e))}open(e){let i,r=aI(e);!r||this.isOpen(r)||(this.dispatch((i=r,{type:"VISIBILITY_OPEN",id:i,filtered:this.isFiltered})),aT(this.props.onToggle,r))}close(e){let i,r=aI(e);!r||this.isOpen(r)&&(this.dispatch((i=r,{type:"VISIBILITY_CLOSE",id:i,filtered:this.isFiltered})),aT(this.props.onToggle,r))}toggle(e){let i=aI(e);if(i)return this.isOpen(i)?this.close(i):this.open(i)}openParents(e){let i=aI(e);if(!i)return;let r=n8.dfs(this.root,i),s=null==r?void 0:r.parent;for(;s;)this.open(s.id),s=s.parent}openSiblings(e){let i=e.parent;if(i){if(i.children){let r=e.isOpen;for(let e of i.children)e.isInternal&&(r?this.close(e.id):this.open(e.id));this.scrollTo(this.focusedNode)}}else this.toggle(e.id)}openAll(){n8.walk(this.root,e=>{e.isInternal&&e.open()})}closeAll(){n8.walk(this.root,e=>{e.isInternal&&e.close()})}scrollTo(e,i="smart"){if(!e)return;let r=aP(e);return this.openParents(r),n8.waitFor(()=>r in this.idToIndex).then(()=>{var e;let s=this.idToIndex[r];void 0!==s&&(null==(e=this.list.current)||e.scrollToItem(s,i))}).catch(()=>{})}get isEditing(){return null!==this.state.nodes.edit.id}get isFiltered(){var e;return!!(null==(e=this.props.searchTerm)?void 0:e.trim())}get hasFocus(){return this.state.nodes.focus.treeFocused}get hasNoSelection(){return 0===this.state.nodes.selection.ids.size}get hasOneSelection(){return 1===this.state.nodes.selection.ids.size}get hasMultipleSelections(){return this.state.nodes.selection.ids.size>1}isSelected(e){return!!e&&this.state.nodes.selection.ids.has(e)}isOpen(e){var i,r,s;if(!e)return!1;if(e===oh)return!0;let n=null==(i=this.props.openByDefault)||i;return this.isFiltered?null==(r=this.state.nodes.open.filtered[e])||r:null!=(s=this.state.nodes.open.unfiltered[e])?s:n}isEditable(e){let i=this.props.disableEdit||(()=>!1);return!n8.access(e,i)}isDraggable(e){let i=this.props.disableDrag||(()=>!1);return!n8.access(e,i)}isDragging(e){let i=aI(e);return!!i&&this.state.nodes.drag.id===i}isFocused(e){return this.hasFocus&&this.state.nodes.focus.id===e}isMatch(e){return this.matchFn(e)}willReceiveDrop(e){let i=aI(e);if(!i)return!1;let{destinationParentId:r,destinationIndex:s}=this.state.nodes.drag;return i===r&&null===s}onFocus(){let e=this.focusedNode||this.firstNode;e&&this.dispatch(oa(e.id))}onBlur(){this.dispatch({type:"TREE_BLUR"})}onItemsRendered(e){this.visibleStartIndex=e.visibleStartIndex,this.visibleStopIndex=e.visibleStopIndex}get renderContainer(){return this.props.renderContainer||ax}get renderRow(){return this.props.renderRow||oi}get renderNode(){return this.props.children||or}get renderDragPreview(){return this.props.renderDragPreview||oy}get renderCursor(){return this.props.renderCursor||ot}}function aM(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var aN="function"==typeof Symbol&&Symbol.observable||"@@observable",aL=()=>Math.random().toString(36).substring(7).split("").join("."),aB={INIT:`@@redux/INIT${aL()}`,REPLACE:`@@redux/REPLACE${aL()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${aL()}`};function aA(e){let i,r=Object.keys(e),s={};for(let i=0;i<r.length;i++){let n=r[i];"function"==typeof e[n]&&(s[n]=e[n])}let n=Object.keys(s);try{Object.keys(s).forEach(e=>{let i=s[e];if(void 0===i(void 0,{type:aB.INIT}))throw Error(aM(12));if(void 0===i(void 0,{type:aB.PROBE_UNKNOWN_ACTION()}))throw Error(aM(13))})}catch(e){i=e}return function(e={},r){if(i)throw i;let o=!1,a={};for(let i=0;i<n.length;i++){let l=n[i],h=s[l],c=e[l],d=h(c,r);if(void 0===d)throw r&&r.type,Error(aM(14));a[l]=d,o=o||d!==c}return(o=o||n.length!==Object.keys(e).length)?a:e}}let aj=aA({nodes:aA({focus:function(e={id:null,treeFocused:!1},i){return"FOCUS"===i.type?Object.assign(Object.assign({},e),{id:i.id,treeFocused:!0}):"TREE_BLUR"===i.type?Object.assign(Object.assign({},e),{treeFocused:!1}):e},edit:function(e={id:null},i){return"EDIT"===i.type?Object.assign(Object.assign({},e),{id:i.id}):e},open:function(e={filtered:{},unfiltered:{}},i){return i.type.startsWith("VISIBILITY")?i.filtered?Object.assign(Object.assign({},e),{filtered:od(e.filtered,i)}):Object.assign(Object.assign({},e),{unfiltered:od(e.unfiltered,i)}):e},selection:function(e=ou().nodes.selection,i){let r=e.ids;switch(i.type){case"SELECTION_CLEAR":return Object.assign(Object.assign({},e),{ids:new Set});case"SELECTION_ONLY":return Object.assign(Object.assign({},e),{ids:new Set([i.id])});case"SELECTION_ADD":if(0===i.ids.length)return e;return i.ids.forEach(e=>r.add(e)),Object.assign(Object.assign({},e),{ids:new Set(r)});case"SELECTION_REMOVE":if(0===i.ids.length)return e;return i.ids.forEach(e=>r.delete(e)),Object.assign(Object.assign({},e),{ids:new Set(r)});case"SELECTION_SET":return Object.assign(Object.assign({},e),{ids:i.ids,mostRecent:i.mostRecent,anchor:i.anchor});case"SELECTION_MOST_RECENT":return Object.assign(Object.assign({},e),{mostRecent:i.id});case"SELECTION_ANCHOR":return Object.assign(Object.assign({},e),{anchor:i.id});default:return e}},drag:function(e=ou().nodes.drag,i){switch(i.type){case"DND_DRAG_START":return Object.assign(Object.assign({},e),{id:i.id,selectedIds:i.dragIds});case"DND_DRAG_END":return Object.assign(Object.assign({},e),{id:null,destinationParentId:null,destinationIndex:null,selectedIds:[]});case"DND_HOVERING":if(i.parentId!==e.destinationParentId||i.index!=e.destinationIndex)return Object.assign(Object.assign({},e),{destinationParentId:i.parentId,destinationIndex:i.index});return e;default:return e}}}),dnd:function(e=ou().dnd,i){switch(i.type){case"DND_CURSOR":return Object.assign(Object.assign({},e),{cursor:i.cursor});case"DND_DRAG_START":return Object.assign(Object.assign({},e),{dragId:i.id,dragIds:i.dragIds});case"DND_DRAG_END":return ou().dnd;case"DND_HOVERING":return Object.assign(Object.assign({},e),{parentId:i.parentId,index:i.index});default:return e}}});function aH(e){var i=null;return function(){return null==i&&(i=e()),i}}function aW(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var az=function(){var e;function i(e){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");aW(this,"entered",[]),aW(this,"isNodeInDocument",void 0),this.isNodeInDocument=e}return e=[{key:"enter",value:function(e){var i,r,s,n,o,a=this,l=this.entered.length;return this.entered=(i=this.entered.filter(function(i){return a.isNodeInDocument(i)&&(!i.contains||i.contains(e))}),r=[e],s=new Set,n=function(e){return s.add(e)},i.forEach(n),r.forEach(n),o=[],s.forEach(function(e){return o.push(e)}),o),0===l&&this.entered.length>0}},{key:"leave",value:function(e){var i,r=this.entered.length;return this.entered=(i=this.entered.filter(this.isNodeInDocument),i.filter(function(i){return i!==e})),r>0&&0===this.entered.length}},{key:"reset",value:function(){this.entered=[]}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}(),aF=aH(function(){return/firefox/i.test(navigator.userAgent)}),a$=aH(function(){return!!window.safari});function aK(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var aU=function(){var e;function i(e,r){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");aK(this,"xs",void 0),aK(this,"ys",void 0),aK(this,"c1s",void 0),aK(this,"c2s",void 0),aK(this,"c3s",void 0);for(var s,n,o,a=e.length,l=[],h=0;h<a;h++)l.push(h);l.sort(function(i,r){return e[i]<e[r]?-1:1});for(var c=[],d=[],u=[],f=0;f<a-1;f++)s=e[f+1]-e[f],n=r[f+1]-r[f],d.push(s),c.push(n),u.push(n/s);for(var p=[u[0]],_=0;_<d.length-1;_++){var g=u[_],v=u[_+1];if(g*v<=0)p.push(0);else{s=d[_];var m=d[_+1],S=s+m;p.push(3*S/((S+m)/g+(S+s)/v))}}p.push(u[u.length-1]);for(var y=[],b=[],w=0;w<p.length-1;w++){o=u[w];var C=p[w],x=1/d[w],k=C+p[w+1]-o-o;y.push((o-C-k)*x),b.push(k*x*x)}this.xs=e,this.ys=r,this.c1s=p,this.c2s=y,this.c3s=b}return e=[{key:"interpolate",value:function(e){var i,r=this.xs,s=this.ys,n=this.c1s,o=this.c2s,a=this.c3s,l=r.length-1;if(e===r[l])return s[l];for(var h=0,c=a.length-1;h<=c;){var d=r[i=Math.floor(.5*(h+c))];if(d<e)h=i+1;else{if(!(d>e))return s[i];c=i-1}}var u=e-r[l=Math.max(0,c)],f=u*u;return s[l]+n[l]*u+o[l]*f+a[l]*u*f}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function aY(e){var i=1===e.nodeType?e:e.parentElement;if(!i)return null;var r=i.getBoundingClientRect(),s=r.top;return{x:r.left,y:s}}function aq(e){return{x:e.clientX,y:e.clientY}}var aX="__NATIVE_FILE__",aV="__NATIVE_URL__",aG="__NATIVE_TEXT__",aZ="__NATIVE_HTML__";function aJ(e,i,r){var s=i.reduce(function(i,r){return i||e.getData(r)},"");return null!=s?s:r}function aQ(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}e.s(["FILE",()=>aX,"HTML",()=>aZ,"TEXT",()=>aG,"URL",()=>aV],59368);var a0=(aQ(O={},aX,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items},dataTransfer:function(e){return e}},matchesTypes:["Files"]}),aQ(O,aZ,{exposeProperties:{html:function(e,i){return aJ(e,i,"")},dataTransfer:function(e){return e}},matchesTypes:["Html","text/html"]}),aQ(O,aV,{exposeProperties:{urls:function(e,i){return aJ(e,i,"").split("\n")},dataTransfer:function(e){return e}},matchesTypes:["Url","text/uri-list"]}),aQ(O,aG,{exposeProperties:{text:function(e,i){return aJ(e,i,"")},dataTransfer:function(e){return e}},matchesTypes:["Text","text/plain"]}),O);function a1(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var a2=function(){var e;function i(e){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");a1(this,"item",void 0),a1(this,"config",void 0),this.config=e,this.item={},this.initializeExposedProperties()}return e=[{key:"initializeExposedProperties",value:function(){var e=this;Object.keys(this.config.exposeProperties).forEach(function(i){Object.defineProperty(e.item,i,{configurable:!0,enumerable:!0,get:function(){return console.warn("Browser doesn't allow reading \"".concat(i,'" until the drop event.')),null}})})}},{key:"loadDataTransfer",value:function(e){var i=this;if(e){var r={};Object.keys(this.config.exposeProperties).forEach(function(s){r[s]={value:i.config.exposeProperties[s](e,i.config.matchesTypes),configurable:!0,enumerable:!0}}),Object.defineProperties(this.item,r)}}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,i){return i===e.getSourceId()}},{key:"endDrag",value:function(){}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function a5(e){if(!e)return null;var i=Array.prototype.slice.call(e.types||[]);return Object.keys(a0).filter(function(e){return a0[e].matchesTypes.some(function(e){return i.indexOf(e)>-1})})[0]||null}var a3=e.i(59368);function a6(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var a4=function(){var e;function i(e,r){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");a6(this,"ownerDocument",null),a6(this,"globalContext",void 0),a6(this,"optionsArgs",void 0),this.globalContext=e,this.optionsArgs=r}return e=[{key:"window",get:function(){return this.globalContext?this.globalContext:"u">typeof window?window:void 0}},{key:"document",get:function(){var e;return null!=(e=this.globalContext)&&e.document?this.globalContext.document:this.window?this.window.document:void 0}},{key:"rootElement",get:function(){var e;return(null==(e=this.optionsArgs)?void 0:e.rootElement)||this.window}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function a8(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function a7(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?a8(Object(r),!0).forEach(function(i){a9(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a8(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function a9(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var le=function(){var e;function i(e,r,s){var n=this;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");a9(this,"options",void 0),a9(this,"actions",void 0),a9(this,"monitor",void 0),a9(this,"registry",void 0),a9(this,"enterLeaveCounter",void 0),a9(this,"sourcePreviewNodes",new Map),a9(this,"sourcePreviewNodeOptions",new Map),a9(this,"sourceNodes",new Map),a9(this,"sourceNodeOptions",new Map),a9(this,"dragStartSourceIds",null),a9(this,"dropTargetIds",[]),a9(this,"dragEnterTargetIds",[]),a9(this,"currentNativeSource",null),a9(this,"currentNativeHandle",null),a9(this,"currentDragSourceNode",null),a9(this,"altKeyPressed",!1),a9(this,"mouseMoveTimeoutTimer",null),a9(this,"asyncEndDragFrameId",null),a9(this,"dragOverTargetIds",null),a9(this,"lastClientOffset",null),a9(this,"hoverRafId",null),a9(this,"getSourceClientOffset",function(e){var i=n.sourceNodes.get(e);return i&&aY(i)||null}),a9(this,"endDragNativeItem",function(){n.isDraggingNativeItem()&&(n.actions.endDrag(),n.currentNativeHandle&&n.registry.removeSource(n.currentNativeHandle),n.currentNativeHandle=null,n.currentNativeSource=null)}),a9(this,"isNodeInDocument",function(e){return!!(e&&n.document&&n.document.body&&n.document.body.contains(e))}),a9(this,"endDragIfSourceWasRemovedFromDOM",function(){var e=n.currentDragSourceNode;!(null==e||n.isNodeInDocument(e))&&n.clearCurrentDragSourceNode()&&n.monitor.isDragging()&&n.actions.endDrag()}),a9(this,"handleTopDragStartCapture",function(){n.clearCurrentDragSourceNode(),n.dragStartSourceIds=[]}),a9(this,"handleTopDragStart",function(e){if(!e.defaultPrevented){var i=n.dragStartSourceIds;n.dragStartSourceIds=null;var r=aq(e);n.monitor.isDragging()&&n.actions.endDrag(),n.actions.beginDrag(i||[],{publishSource:!1,getSourceClientOffset:n.getSourceClientOffset,clientOffset:r});var s=e.dataTransfer,o=a5(s);if(n.monitor.isDragging()){if(s&&"function"==typeof s.setDragImage){var a=n.monitor.getSourceId(),l=n.sourceNodes.get(a),h=n.sourcePreviewNodes.get(a)||l;if(h){var c,d,u,f,p,_,g,v,m,S,y,b,w,C,x,k,E,D,O=n.getCurrentSourcePreviewNodeOptions(),T=O.anchorX,P=O.anchorY,I=O.offsetX,R=O.offsetY,M=(c={anchorX:T,anchorY:P},d={offsetX:I,offsetY:R},p=aY((f="IMG"===h.nodeName&&(aF()||!(null!=(u=document.documentElement)&&u.contains(h))))?l:h),_={x:r.x-p.x,y:r.y-p.y},g=l.offsetWidth,v=l.offsetHeight,m=c.anchorX,S=c.anchorY,C=(y=f?h.width:g,b=f?h.height:v,a$()&&f&&(b/=window.devicePixelRatio,y/=window.devicePixelRatio),w={dragPreviewWidth:y,dragPreviewHeight:b}).dragPreviewWidth,x=w.dragPreviewHeight,k=d.offsetX,E=d.offsetY,{x:0===k||k?k:new aU([0,.5,1],[_.x,_.x/g*C,_.x+C-g]).interpolate(m),y:0===E||E?E:(D=new aU([0,.5,1],[_.y,_.y/v*x,_.y+x-v]).interpolate(S),a$()&&f&&(D+=(window.devicePixelRatio-1)*x),D)});s.setDragImage(h,M.x,M.y)}}try{null==s||s.setData("application/json",{})}catch(e){}n.setCurrentDragSourceNode(e.target),n.getCurrentSourcePreviewNodeOptions().captureDraggingState?n.actions.publishDragSource():setTimeout(function(){return n.actions.publishDragSource()},0)}else if(o)n.beginDragNativeItem(o);else{if(s&&!s.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}}}),a9(this,"handleTopDragEndCapture",function(){n.clearCurrentDragSourceNode()&&n.monitor.isDragging()&&n.actions.endDrag()}),a9(this,"handleTopDragEnterCapture",function(e){if(n.dragEnterTargetIds=[],!(!n.enterLeaveCounter.enter(e.target)||n.monitor.isDragging())){var i=e.dataTransfer,r=a5(i);r&&n.beginDragNativeItem(r,i)}}),a9(this,"handleTopDragEnter",function(e){var i=n.dragEnterTargetIds;n.dragEnterTargetIds=[],n.monitor.isDragging()&&(n.altKeyPressed=e.altKey,i.length>0&&n.actions.hover(i,{clientOffset:aq(e)}),i.some(function(e){return n.monitor.canDropOnTarget(e)})&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=n.getCurrentDropEffect())))}),a9(this,"handleTopDragOverCapture",function(){n.dragOverTargetIds=[]}),a9(this,"handleTopDragOver",function(e){var i=n.dragOverTargetIds;if(n.dragOverTargetIds=[],!n.monitor.isDragging()){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none");return}n.altKeyPressed=e.altKey,n.lastClientOffset=aq(e),null===n.hoverRafId&&"u">typeof requestAnimationFrame&&(n.hoverRafId=requestAnimationFrame(function(){n.monitor.isDragging()&&n.actions.hover(i||[],{clientOffset:n.lastClientOffset}),n.hoverRafId=null})),(i||[]).some(function(e){return n.monitor.canDropOnTarget(e)})?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=n.getCurrentDropEffect())):n.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))}),a9(this,"handleTopDragLeaveCapture",function(e){n.isDraggingNativeItem()&&e.preventDefault(),n.enterLeaveCounter.leave(e.target)&&n.isDraggingNativeItem()&&setTimeout(function(){return n.endDragNativeItem()},0)}),a9(this,"handleTopDropCapture",function(e){if(n.dropTargetIds=[],n.isDraggingNativeItem()){var i;e.preventDefault(),null==(i=n.currentNativeSource)||i.loadDataTransfer(e.dataTransfer)}else a5(e.dataTransfer)&&e.preventDefault();n.enterLeaveCounter.reset()}),a9(this,"handleTopDrop",function(e){var i=n.dropTargetIds;n.dropTargetIds=[],n.actions.hover(i,{clientOffset:aq(e)}),n.actions.drop({dropEffect:n.getCurrentDropEffect()}),n.isDraggingNativeItem()?n.endDragNativeItem():n.monitor.isDragging()&&n.actions.endDrag()}),a9(this,"handleSelectStart",function(e){var i=e.target;"function"!=typeof i.dragDrop||"INPUT"===i.tagName||"SELECT"===i.tagName||"TEXTAREA"===i.tagName||i.isContentEditable||(e.preventDefault(),i.dragDrop())}),this.options=new a4(r,s),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new az(this.isNodeInDocument)}return e=[{key:"profile",value:function(){var e,i;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null==(e=this.dragStartSourceIds)?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null==(i=this.dragOverTargetIds)?void 0:i.length)||0}}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}},{key:"rootElement",get:function(){return this.options.rootElement}},{key:"setup",value:function(){var e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}},{key:"teardown",value:function(){var e,i=this.rootElement;void 0!==i&&(i.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null==(e=this.window)||e.cancelAnimationFrame(this.asyncEndDragFrameId)))}},{key:"connectDragPreview",value:function(e,i,r){var s=this;return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,i),function(){s.sourcePreviewNodes.delete(e),s.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,i,r){var s=this;this.sourceNodes.set(e,i),this.sourceNodeOptions.set(e,r);var n=function(i){return s.handleDragStart(i,e)},o=function(e){return s.handleSelectStart(e)};return i.setAttribute("draggable","true"),i.addEventListener("dragstart",n),i.addEventListener("selectstart",o),function(){s.sourceNodes.delete(e),s.sourceNodeOptions.delete(e),i.removeEventListener("dragstart",n),i.removeEventListener("selectstart",o),i.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,i){var r=this,s=function(i){return r.handleDragEnter(i,e)},n=function(i){return r.handleDragOver(i,e)},o=function(i){return r.handleDrop(i,e)};return i.addEventListener("dragenter",s),i.addEventListener("dragover",n),i.addEventListener("drop",o),function(){i.removeEventListener("dragenter",s),i.removeEventListener("dragover",n),i.removeEventListener("drop",o)}}},{key:"addEventListeners",value:function(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}},{key:"removeEventListeners",value:function(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),i=this.sourceNodeOptions.get(e);return a7({dropEffect:this.altKeyPressed?"copy":"move"},i||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return a7({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(a3).some(function(i){return a3[i]===e})}},{key:"beginDragNativeItem",value:function(e,i){var r;this.clearCurrentDragSourceNode(),this.currentNativeSource=((r=new a2(a0[e])).loadDataTransfer(i),r),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var i=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(function(){var e;return null==(e=i.rootElement)?void 0:e.addEventListener("mousemove",i.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:"clearCurrentDragSourceNode",value:function(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;null==(e=this.window)||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}},{key:"handleDragStart",value:function(e,i){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(i))}},{key:"handleDragEnter",value:function(e,i){this.dragEnterTargetIds.unshift(i)}},{key:"handleDragOver",value:function(e,i){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(i)}},{key:"handleDrop",value:function(e,i){this.dropTargetIds.unshift(i)}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}(),lt=function(e,i,r){return new le(e,i,r)},li="dnd-core/INIT_COORDS",lr="dnd-core/BEGIN_DRAG",ls="dnd-core/PUBLISH_DRAG_SOURCE",ln="dnd-core/HOVER",lo="dnd-core/DROP",la="dnd-core/END_DRAG";function ll(e,i){return{type:li,payload:{sourceClientOffset:i||null,clientOffset:e||null}}}function lh(e){return(lh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lc(e){return"object"===lh(e)}var ld={type:li,payload:{clientOffset:null,sourceClientOffset:null}};function lu(e,i){return null===i?null===e:Array.isArray(e)?e.some(function(e){return e===i}):e===i}function lf(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function lp(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?lf(Object(r),!0).forEach(function(i){var s,n,o;s=e,n=i,o=r[i],n in s?Object.defineProperty(s,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lf(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function l_(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var lg=function(){var e;function i(e,r){var s=this;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");l_(this,"store",void 0),l_(this,"monitor",void 0),l_(this,"backend",void 0),l_(this,"isSetUp",!1),l_(this,"handleRefCountChange",function(){var e=s.store.getState().refCount>0;s.backend&&(e&&!s.isSetUp?(s.backend.setup(),s.isSetUp=!0):!e&&s.isSetUp&&(s.backend.teardown(),s.isSetUp=!1))}),this.store=e,this.monitor=r,e.subscribe(this.handleRefCountChange)}return e=[{key:"receiveBackend",value:function(e){this.backend=e}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var e,i,r,s,n,o=this,a=this.store.dispatch,l={beginDrag:(e=this,function(){var i,r,s,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{publishSource:!0},a=o.publishSource,l=o.clientOffset,h=o.getSourceClientOffset,c=e.getMonitor(),d=e.getRegistry();e.dispatch(ll(l)),i=n,r=c,s=d,oG(!r.isDragging(),"Cannot call beginDrag while dragging."),i.forEach(function(e){oG(s.getSource(e),"Expected sourceIds to be registered.")});var u=function(e,i){for(var r=null,s=e.length-1;s>=0;s--)if(i.canDragSource(e[s])){r=e[s];break}return r}(n,c);if(null===u)return void e.dispatch(ld);var f=null;if(l){if(!h)throw Error("getSourceClientOffset must be defined");oG("function"==typeof h,"When clientOffset is provided, getSourceClientOffset must be a function."),f=h(u)}e.dispatch(ll(l,f));var p=d.getSource(u).beginDrag(c,u);if(null!=p)return oG(lc(p),"Item must be an object."),d.pinSource(u),{type:lr,payload:{itemType:d.getSourceType(u),item:p,sourceId:u,clientOffset:l||null,sourceClientOffset:f||null,isSourcePublic:!!(void 0===a||a)}}}),publishDragSource:(i=this,function(){if(i.getMonitor().isDragging())return{type:ls}}),hover:(r=this,function(e){var i,s,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.clientOffset;oG(Array.isArray(e),"Expected targetIds to be an array.");var l=e.slice(0),h=r.getMonitor(),c=r.getRegistry();return function(e,i,r){oG(i.isDragging(),"Cannot call hover while not dragging."),oG(!i.didDrop(),"Cannot call hover after drop.");for(var s=0;s<e.length;s++){var n=e[s];oG(e.lastIndexOf(n)===s,"Expected targetIds to be unique in the passed array."),oG(r.getTarget(n),"Expected targetIds to be registered.")}}(l,h,c),function(e,i,r){for(var s=e.length-1;s>=0;s--){var n=e[s];lu(i.getTargetType(n),r)||e.splice(s,1)}}(l,c,h.getItemType()),i=l,s=h,n=c,i.forEach(function(e){n.getTarget(e).hover(s,e)}),{type:ln,payload:{targetIds:l,clientOffset:a||null}}}),drop:(s=this,function(){var e,i,r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=s.getMonitor(),a=s.getRegistry();oG((e=o).isDragging(),"Cannot call drop while not dragging."),oG(!e.didDrop(),"Cannot call drop twice during one drag operation."),((r=(i=o).getTargetIds().filter(i.canDropOnTarget,i)).reverse(),r).forEach(function(e,i){var r,l,h,c,d,u,f,p=(r=e,l=i,h=a,c=o,oG(void 0===(f=u=(d=h.getTarget(r))?d.drop(c,r):void 0)||lc(f),"Drop result must either be an object or undefined."),void 0===u&&(u=0===l?{}:c.getDropResult()),u),_={type:lo,payload:{dropResult:lp(lp({},n),p)}};s.dispatch(_)})}),endDrag:(n=this,function(){var e=n.getMonitor(),i=n.getRegistry();oG(e.isDragging(),"Cannot call endDrag while not dragging.");var r=e.getSourceId();return null!=r&&(i.getSource(r,!0).endDrag(e,r),i.unpinSource()),{type:la}})};return Object.keys(l).reduce(function(e,i){var r=l[i];return e[i]=function(){for(var e=arguments.length,i=Array(e),s=0;s<e;s++)i[s]=arguments[s];var n=r.apply(o,i);void 0!==n&&a(n)},e},{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}();function lv(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var lm="function"==typeof Symbol&&Symbol.observable||"@@observable",lS=function(){return Math.random().toString(36).substring(7).split("").join(".")},ly={INIT:"@@redux/INIT"+lS(),REPLACE:"@@redux/REPLACE"+lS(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+lS()}},lb=function(e,i){return e===i};function lw(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function lC(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?lw(Object(r),!0).forEach(function(i){var s,n,o;s=e,n=i,o=r[i],n in s?Object.defineProperty(s,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lw(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}var lx={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null},lk="dnd-core/ADD_SOURCE",lE="dnd-core/ADD_TARGET",lD="dnd-core/REMOVE_SOURCE",lO="dnd-core/REMOVE_TARGET";function lT(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function lP(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?lT(Object(r),!0).forEach(function(i){var s,n,o;s=e,n=i,o=r[i],n in s?Object.defineProperty(s,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lT(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}var lI={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null},lR=[],lM=[];function lN(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,s)}return r}function lL(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?lN(Object(r),!0).forEach(function(i){var s,n,o;s=e,n=i,o=r[i],n in s?Object.defineProperty(s,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lN(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function lB(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e,i,r,s=arguments.length>1?arguments[1]:void 0;switch(s.type){case ln:break;case lk:case lE:case lO:case lD:return lR;default:return lM}var n=s.payload,o=n.targetIds,a=void 0===o?[]:o,l=n.prevTargetIds,h=void 0===l?[]:l,c=(e=new Map,i=function(i){e.set(i,e.has(i)?e.get(i)+1:1)},a.forEach(i),h.forEach(i),r=[],e.forEach(function(e,i){1===e&&r.push(i)}),r);if(!(c.length>0||!function(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:lb;if(e.length!==i.length)return!1;for(var s=0;s<e.length;++s)if(!r(e[s],i[s]))return!1;return!0}(a,h)))return lR;var d=h[h.length-1],u=a[a.length-1];return d!==u&&(d&&c.push(d),u&&c.push(u)),c}(i.dirtyHandlerIds,{type:r.type,payload:lL(lL({},r.payload),{},{prevTargetIds:(e=[],"dragOperation.targetIds".split(".").reduce(function(i,r){return i&&i[r]?i[r]:e||null},i))})}),dragOffset:function(){var e,i,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lx,s=arguments.length>1?arguments[1]:void 0,n=s.payload;switch(s.type){case li:case lr:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case ln:if(e=r.clientOffset,i=n.clientOffset,!e&&!i||e&&i&&e.x===i.x&&e.y===i.y)return r;return lC(lC({},r),{},{clientOffset:n.clientOffset});case la:case lo:return lx;default:return r}}(i.dragOffset,r),refCount:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case lk:case lE:return e+1;case lD:case lO:return e-1;default:return e}}(i.refCount,r),dragOperation:function(){var e,i,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:lI,s=arguments.length>1?arguments[1]:void 0,n=s.payload;switch(s.type){case lr:return lP(lP({},r),{},{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case ls:return lP(lP({},r),{},{isSourcePublic:!0});case ln:return lP(lP({},r),{},{targetIds:n.targetIds});case lO:if(-1===r.targetIds.indexOf(n.targetId))return r;return lP(lP({},r),{},{targetIds:(e=r.targetIds,i=n.targetId,e.filter(function(e){return e!==i}))});case lo:return lP(lP({},r),{},{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case la:return lP(lP({},r),{},{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return r}}(i.dragOperation,r),stateId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e+1}(i.stateId)}}function lA(e,i){return{x:e.x-i.x,y:e.y-i.y}}lR.__IS_NONE__=!0,lM.__IS_ALL__=!0;function lj(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}var lH=function(){var e;function i(e,r){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");lj(this,"store",void 0),lj(this,"registry",void 0),this.store=e,this.registry=r}return e=[{key:"subscribeToStateChange",value:function(e){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{handlerIds:void 0},s=r.handlerIds;oG("function"==typeof e,"listener must be a function."),oG(void 0===s||Array.isArray(s),"handlerIds, when specified, must be an array of strings.");var n=this.store.getState().stateId;return this.store.subscribe(function(){var r=i.store.getState(),o=r.stateId;try{o===n||o===n+1&&!function(e,i){return e!==lR&&(e===lM||void 0===i||i.filter(function(i){return e.indexOf(i)>-1}).length>0)}(r.dirtyHandlerIds,s)||e()}finally{n=o}})}},{key:"subscribeToOffsetChange",value:function(e){var i=this;oG("function"==typeof e,"listener must be a function.");var r=this.store.getState().dragOffset;return this.store.subscribe(function(){var s=i.store.getState().dragOffset;s!==r&&(r=s,e())})}},{key:"canDragSource",value:function(e){if(!e)return!1;var i=this.registry.getSource(e);return oG(i,"Expected to find a valid source. sourceId=".concat(e)),!this.isDragging()&&i.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var i=this.registry.getTarget(e);return oG(i,"Expected to find a valid target. targetId=".concat(e)),!(!this.isDragging()||this.didDrop())&&lu(this.registry.getTargetType(e),this.getItemType())&&i.canDrop(this,e)}},{key:"isDragging",value:function(){return!!this.getItemType()}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var i=this.registry.getSource(e,!0);return oG(i,"Expected to find a valid source. sourceId=".concat(e)),!!this.isDragging()&&!!this.isSourcePublic()&&this.registry.getSourceType(e)===this.getItemType()&&i.isDragging(this,e)}},{key:"isOverTarget",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shallow:!1};if(!e)return!1;var r=i.shallow;if(!this.isDragging())return!1;var s=this.registry.getTargetType(e),n=this.getItemType();if(n&&!lu(s,n))return!1;var o=this.getTargetIds();if(!o.length)return!1;var a=o.indexOf(e);return r?a===o.length-1:a>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return!!this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return function(e){var i=e.clientOffset,r=e.initialClientOffset,s=e.initialSourceClientOffset;return i&&r&&s?lA({x:i.x+s.x,y:i.y+s.y},r):null}(this.store.getState().dragOffset)}},{key:"getDifferenceFromInitialOffset",value:function(){var e,i,r;return i=(e=this.store.getState().dragOffset).clientOffset,r=e.initialClientOffset,i&&r?lA(i,r):null}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}(),lW=0;function lz(e){return(lz="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lF(e,i){i&&Array.isArray(e)?e.forEach(function(e){return lF(e,!1)}):oG("string"==typeof e||"symbol"===lz(e),i?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}(k=T||(T={})).SOURCE="SOURCE",k.TARGET="TARGET";let l$=e.g,lK=l$.MutationObserver||l$.WebKitMutationObserver;function lU(e){return function(){let i=setTimeout(s,0),r=setInterval(s,50);function s(){clearTimeout(i),clearInterval(r),e()}}}let lY="function"==typeof lK?function(e){let i=1,r=new lK(e),s=document.createTextNode("");return r.observe(s,{characterData:!0}),function(){s.data=i=-i}}:lU;class lq{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,i){this.onError=e,this.release=i,this.task=null}}let lX=new class{enqueueTask(e){let{queue:i,requestFlush:r}=this;i.length||(r(),this.flushing=!0),i[i.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let i=this.index;if(this.index++,e[i].call(),this.index>this.capacity){for(let i=0,r=e.length-this.index;i<r;i++)e[i]=e[i+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=lY(this.flush),this.requestErrorThrow=lU(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},lV=new class{create(e){let i=this.freeTasks,r=i.length?i.pop():new lq(this.onError,e=>i[i.length]=e);return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(lX.registerPendingError);function lG(e,i,r){return i in e?Object.defineProperty(e,i,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[i]=r,e}function lZ(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function lJ(e){switch(e[0]){case"S":return T.SOURCE;case"T":return T.TARGET;default:oG(!1,"Cannot parse handler ID: ".concat(e))}}function lQ(e,i){var r=e.entries(),s=!1;do{var n,o=r.next(),a=o.done;if((n=o.value,function(e){if(Array.isArray(e))return e}(n)||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(n,2)||function(e,i){if(e){if("string"==typeof e)return lZ(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lZ(e,2)}}(n,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[1]===i)return!0;s=!!a}while(!s)return!1}var l0=function(){var e;function i(e){if(!(this instanceof i))throw TypeError("Cannot call a class as a function");lG(this,"types",new Map),lG(this,"dragSources",new Map),lG(this,"dropTargets",new Map),lG(this,"pinnedSourceId",null),lG(this,"pinnedSource",null),lG(this,"store",void 0),this.store=e}return e=[{key:"addSource",value:function(e,i){lF(e),oG("function"==typeof i.canDrag,"Expected canDrag to be a function."),oG("function"==typeof i.beginDrag,"Expected beginDrag to be a function."),oG("function"==typeof i.endDrag,"Expected endDrag to be a function.");var r=this.addHandler(T.SOURCE,e,i);return this.store.dispatch({type:lk,payload:{sourceId:r}}),r}},{key:"addTarget",value:function(e,i){lF(e,!0),oG("function"==typeof i.canDrop,"Expected canDrop to be a function."),oG("function"==typeof i.hover,"Expected hover to be a function."),oG("function"==typeof i.drop,"Expected beginDrag to be a function.");var r=this.addHandler(T.TARGET,e,i);return this.store.dispatch({type:lE,payload:{targetId:r}}),r}},{key:"containsHandler",value:function(e){return lQ(this.dragSources,e)||lQ(this.dropTargets,e)}},{key:"getSource",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return oG(this.isSourceId(e),"Expected a valid source ID."),i&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}},{key:"getTarget",value:function(e){return oG(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return oG(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return oG(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return lJ(e)===T.SOURCE}},{key:"isTargetId",value:function(e){return lJ(e)===T.TARGET}},{key:"removeSource",value:function(e){var i=this;oG(this.getSource(e),"Expected an existing source."),this.store.dispatch({type:lD,payload:{sourceId:e}}),lX.enqueueTask(lV.create(function(){i.dragSources.delete(e),i.types.delete(e)}))}},{key:"removeTarget",value:function(e){oG(this.getTarget(e),"Expected an existing target."),this.store.dispatch({type:lO,payload:{targetId:e}}),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var i=this.getSource(e);oG(i,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=i}},{key:"unpinSource",value:function(){oG(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,i,r){var s=function(e){var i=(lW++).toString();switch(e){case T.SOURCE:return"S".concat(i);case T.TARGET:return"T".concat(i);default:throw Error("Unknown Handler Role: ".concat(e))}}(e);return this.types.set(s,i),e===T.SOURCE?this.dragSources.set(s,r):e===T.TARGET&&this.dropTargets.set(s,r),s}}],function(e,i){for(var r=0;r<i.length;r++){var s=i[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(i.prototype,e),i}(),l1=["children"];function l2(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}var l5=0,l3=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__"),l6=(0,R.memo)(function(i){var r,s,n=i.children,o=function(e){if(Array.isArray(e))return e}(s="manager"in(r=function(e,i){if(null==e)return{};var r,s,n=function(e,i){if(null==e)return{};var r,s,n={},o=Object.keys(e);for(s=0;s<o.length;s++)r=o[s],i.indexOf(r)>=0||(n[r]=e[r]);return n}(e,i);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)r=o[s],!(i.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}(i,l1))?[{dragDropManager:r.manager},!1]:[function(i){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return e.g}(),s=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;return r[l3]||(r[l3]={dragDropManager:function(e){var i,r,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=(i=o,r="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__,function e(i,r,s){if("function"==typeof r&&"function"==typeof s||"function"==typeof s&&"function"==typeof arguments[3])throw Error(lv(0));if("function"==typeof r&&void 0===s&&(s=r,r=void 0),void 0!==s){if("function"!=typeof s)throw Error(lv(1));return s(e)(i,r)}if("function"!=typeof i)throw Error(lv(2));var n,o=i,a=r,l=[],h=l,c=!1;function d(){h===l&&(h=l.slice())}function u(){if(c)throw Error(lv(3));return a}function f(e){if("function"!=typeof e)throw Error(lv(4));if(c)throw Error(lv(5));var i=!0;return d(),h.push(e),function(){if(i){if(c)throw Error(lv(6));i=!1,d();var r=h.indexOf(e);h.splice(r,1),l=null}}}function p(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var i=e;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(e)===i}(e))throw Error(lv(7));if(void 0===e.type)throw Error(lv(8));if(c)throw Error(lv(9));try{c=!0,a=o(a,e)}finally{c=!1}for(var i=l=h,r=0;r<i.length;r++)(0,i[r])();return e}return p({type:ly.INIT}),(n={dispatch:p,subscribe:f,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw Error(lv(10));o=e,p({type:ly.REPLACE})}})[lm]=function(){var e;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw Error(lv(11));function i(){e.next&&e.next(u())}return i(),{unsubscribe:f(i)}}})[lm]=function(){return this},e},n}(lB,i&&r&&r({name:"dnd-core",instanceId:"dnd-core"}))),l=new lH(a,new l0(a)),h=new lg(a,l),c=e(h,s,n);return h.receiveBackend(c),h}(i,r,s,n)}),r[l3]}(r.backend,r.context,r.options,r.debugMode),!r.context])||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(s,2)||function(e,i){if(e){if("string"==typeof e)return l2(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l2(e,2)}}(s,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),a=o[0],l=o[1];return(0,R.useEffect)(function(){if(l){var i=e.g;return++l5,function(){0==--l5&&(i[l3]=null)}}},[]),(0,I.jsx)(oZ.Provider,Object.assign({value:a},{children:n}),void 0)});let l4=ou();function l8({treeProps:e,imperativeHandle:i,children:r}){let s=(0,R.useRef)(null),n=(0,R.useRef)(null),o=(0,R.useRef)(function e(i,r,s){if("function"!=typeof i)throw Error(aM(2));if("function"==typeof r&&"function"==typeof s||"function"==typeof s&&"function"==typeof arguments[3])throw Error(aM(0));if("function"==typeof r&&void 0===s&&(s=r,r=void 0),void 0!==s){if("function"!=typeof s)throw Error(aM(1));return s(e)(i,r)}let n=i,o=r,a=new Map,l=a,h=0,c=!1;function d(){l===a&&(l=new Map,a.forEach((e,i)=>{l.set(i,e)}))}function u(){if(c)throw Error(aM(3));return o}function f(e){if("function"!=typeof e)throw Error(aM(4));if(c)throw Error(aM(5));let i=!0;d();let r=h++;return l.set(r,e),function(){if(i){if(c)throw Error(aM(6));i=!1,d(),l.delete(r),a=null}}}function p(e){if(!function(e){if("object"!=typeof e||null===e)return!1;let i=e;for(;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(e)===i||null===Object.getPrototypeOf(e)}(e))throw Error(aM(7));if(void 0===e.type)throw Error(aM(8));if("string"!=typeof e.type)throw Error(aM(17));if(c)throw Error(aM(9));try{c=!0,o=n(o,e)}finally{c=!1}return(a=l).forEach(e=>{e()}),e}return p({type:aB.INIT}),{dispatch:p,subscribe:f,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw Error(aM(10));n=e,p({type:aB.REPLACE})},[aN]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(aM(11));function i(){e.next&&e.next(u())}return i(),{unsubscribe:f(i)}},[aN](){return this}}}}}(aj,ou(e))),a=(0,nA.useSyncExternalStore)(o.current.subscribe,o.current.getState,()=>l4),l=(0,R.useMemo)(()=>new aR(o.current,e,s,n),[]),h=(0,R.useRef)(0);return(0,R.useMemo)(()=>{h.current+=1,l.update(e)},[...Object.values(e),a.nodes.open]),(0,R.useImperativeHandle)(i,()=>l),(0,R.useEffect)(()=>{l.props.selection?l.select(l.props.selection,{focus:!1}):l.deselectAll()},[l.props.selection]),(0,R.useEffect)(()=>{l.props.searchTerm||o.current.dispatch({type:"VISIBILITY_CLEAR",filtered:!0})},[l.props.searchTerm]),(0,I.jsx)(nj.Provider,{value:l,children:(0,I.jsx)(nF.Provider,{value:h.current,children:(0,I.jsx)(nW.Provider,{value:a.nodes,children:(0,I.jsx)(nz.Provider,{value:a.dnd,children:(0,I.jsx)(l6,Object.assign({backend:lt,options:{rootElement:l.props.dndRootElement||void 0}},e.dndManager&&{manager:e.dndManager},{children:r}))})})})})}function l7(e){return!function(){let e=nH(),[,i]=ag(()=>({accept:"NODE",canDrop:(i,r)=>!!r.isOver({shallow:!0})&&e.canDrop(),hover:(i,r)=>{if(!r.isOver({shallow:!0}))return;let s=r.getClientOffset();if(!e.listEl.current||!s)return;let{cursor:n,drop:o}=ay({element:e.listEl.current,offset:s,indent:e.indent,node:null,prevNode:e.visibleNodes[e.visibleNodes.length-1],nextNode:null});o&&e.dispatch(om(o.parentId,o.index)),r.canDrop()?n&&e.showCursor(n):e.hideCursor()}}),[e]);i(e.listEl)}(),e.children}function l9(){let e=nH().props.renderContainer||ax;return(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(e,{})})}function he(e,i){(null==i||i>e.length)&&(i=e.length);for(var r=0,s=Array(i);r<i;r++)s[r]=e[r];return s}function ht(){var e,i,r,s,n,o;let a=nH(),{offset:l,mouse:h,item:c,isDragging:d}=(e=e=>({offset:e.getSourceClientOffset(),mouse:e.getClientOffset(),item:e.getItem(),isDragging:e.isDragging()}),n=(s=function(e){if(Array.isArray(e))return e}(r=an(i=oJ().getMonitor(),e))||function(e,i){var r,s,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),2!==o.length);a=!0);}catch(e){l=!0,s=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw s}}return o}}(r,2)||function(e,i){if(e){if("string"==typeof e)return he(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return he(e,2)}}(r,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],o=s[1],(0,R.useEffect)(function(){return i.subscribeToOffsetChange(o)}),(0,R.useEffect)(function(){return i.subscribeToStateChange(o)}),n),u=a.props.renderDragPreview||oy;return(0,I.jsx)(u,{offset:l,mouse:h,id:(null==c?void 0:c.id)||null,dragIds:(null==c?void 0:c.dragIds)||[],isDragging:d})}class hi{constructor(e){this.root=function(e){let i=new hs({id:"ROOT"},null);return i.children=e.map(e=>hr(e,i)),i}(e)}get data(){var e,i;return null!=(i=null==(e=this.root.children)?void 0:e.map(e=>e.data))?i:[]}create(e){let i=e.parentId?this.find(e.parentId):this.root;if(!i)return null;i.addChild(e.data,e.index)}move(e){let i=this.find(e.id),r=e.parentId?this.find(e.parentId):this.root;i&&r&&(r.addChild(i.data,e.index),i.drop())}update(e){let i=this.find(e.id);i&&i.update(e.changes)}drop(e){let i=this.find(e.id);i&&i.drop()}find(e,i=this.root){if(!i)return null;if(i.id===e)return i;if(i.children)for(let r of i.children){let i=this.find(e,r);if(i)return i}return null}}function hr(e,i){let r=new hs(e,i);return e.children&&(r.children=e.children.map(e=>hr(e,r))),r}class hs{constructor(e,i){this.data=e,this.parent=i,this.id=e.id}hasParent(){return!!this.parent}get childIndex(){return this.hasParent()?this.parent.children.indexOf(this):-1}addChild(e,i){var r,s;let n=hr(e,this);this.children=null!=(r=this.children)?r:[],this.children.splice(i,0,n),this.data.children=null!=(s=this.data.children)?s:[],this.data.children.splice(i,0,e)}removeChild(e){var i,r;null==(i=this.children)||i.splice(e,1),null==(r=this.data.children)||r.splice(e,1)}update(e){if(this.hasParent()){let i=this.childIndex;this.parent.addChild(Object.assign(Object.assign({},this.data),e),i),this.drop()}}drop(){this.hasParent()&&this.parent.removeChild(this.childIndex)}}let hn=0,ho=(0,R.forwardRef)(function(e,i){let r=function(e){if(e.initialData&&e.data)throw Error("React Arborist Tree => Provide either a data or initialData prop, but not both.");if(e.initialData&&(e.onCreate||e.onDelete||e.onMove||e.onRename))throw Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
19
- Use the data prop if you want to provide your own handlers.`);if(!e.initialData)return e;{let[i,r]=function(e){let[i,r]=(0,R.useState)(e),s=(0,R.useMemo)(()=>new hi(i),[i]);return[i,{onMove:e=>{for(let i of e.dragIds)s.move({id:i,parentId:e.parentId,index:e.index});r(s.data)},onRename:({name:e,id:i})=>{s.update({id:i,changes:{name:e}}),r(s.data)},onCreate:({parentId:e,index:i,type:n})=>{let o={id:`simple-tree-id-${hn++}`,name:""};return"internal"===n&&(o.children=[]),s.create({parentId:e,index:i,data:o}),r(s.data),o},onDelete:e=>{e.ids.forEach(e=>s.drop({id:e})),r(s.data)}}]}(e.initialData);return Object.assign(Object.assign(Object.assign({},e),r),{data:i})}}(e);return(0,I.jsxs)(l8,{treeProps:r,imperativeHandle:i,children:[(0,I.jsx)(l7,{children:(0,I.jsx)(l9,{})}),(0,I.jsx)(ht,{})]})});var ha=e.i(99105),hl=e.i(76016),hh=e.i(76505),hh=hh;let hc=(0,B.default)("folder-closed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]),hd={current:null};function hu({node:e,style:i}){let r=e.data.isDirectory,s=e.isOpen;return(0,I.jsxs)("div",{style:i,className:(0,q.cn)("flex h-6 cursor-pointer items-center gap-1 rounded-sm px-1 text-[12px] select-none",e.isSelected?"bg-primary/10 text-foreground":"text-muted-foreground hover:bg-muted/60"),onMouseDown:i=>{if(0===i.button){if(r)return void e.toggle();e.select(),hd.current?.onOpenFile(e.data.path,"preview")}},onDoubleClick:i=>{r||(i.preventDefault(),hd.current?.onOpenFile(e.data.path,"persistent"))},children:[r?s?(0,I.jsx)(ha.ChevronDown,{className:"h-3 w-3 shrink-0"}):(0,I.jsx)(hl.ChevronRight,{className:"h-3 w-3 shrink-0"}):(0,I.jsx)("span",{className:"inline-block w-3 shrink-0"}),r?s?(0,I.jsx)(z.FolderOpen,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}):(0,I.jsx)(hc,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}):(0,I.jsx)(hh.default,{className:"h-3.5 w-3.5 shrink-0 text-sky-500"}),(0,I.jsx)("span",{className:"truncate",children:e.data.name})]})}function hf({tree:e,loading:i,error:r,activePath:s,onOpenFile:n}){let o=(0,R.useMemo)(()=>(function e(i){return i?i.map(i=>({id:i.path||i.name,name:i.name,isDirectory:i.isDirectory,path:i.path,children:i.isDirectory?e(i.children):void 0})):[]})(e?.children),[e]),a=(0,R.useRef)(null),l=(0,R.useRef)(null),[h,c]=(0,R.useState)({w:280,h:400});return((0,R.useEffect)(()=>(hd.current={onOpenFile:n},()=>{hd.current?.onOpenFile===n&&(hd.current=null)}),[n]),(0,R.useEffect)(()=>{let e=l.current;if(!e)return;let i=new ResizeObserver(e=>{let i=e[0]?.contentRect;i&&c({w:Math.floor(i.width),h:Math.floor(i.height)})});return i.observe(e),()=>i.disconnect()},[]),i&&!e)?(0,I.jsx)("div",{className:"text-muted-foreground flex h-full items-center justify-center text-xs",children:"Loading files…"}):r?(0,I.jsx)("div",{className:"text-destructive flex h-full items-center justify-center p-2 text-center text-xs",children:r}):e?(0,I.jsx)("div",{ref:l,className:"h-full w-full overflow-hidden",children:(0,I.jsx)(ho,{ref:a,data:o,openByDefault:!1,width:h.w,height:h.h,rowHeight:24,indent:12,padding:4,selection:s??void 0,children:hu})}):null}var hp=e.i(47901),h_=e.i(427),hg=e.i(12878),hv=e.i(87889),hm=e.i(86076),hh=hh;let hS=(0,B.default)("panel-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);var hy=e.i(60253),hb=function(e,i){return Number(e.toFixed(i))},hw=function(e,i,r){r&&"function"==typeof r&&r(e,i)},hC={easeOut:function(e){return-Math.cos(e*Math.PI)/2+.5},linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:-1+(4-2*e)*e},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}},hx=function(e){"number"==typeof e&&cancelAnimationFrame(e)},hk=function(e){e.mounted&&(hx(e.animation),e.isAnimating=!1,e.animation=null,e.velocity=null)};function hE(e,i,r,s){if(e.mounted){var n=new Date().getTime();hk(e),e.animation=function(){if(!e.mounted)return hx(e.animation);var o=new Date().getTime()-n,a=(0,hC[i])(o/r);o>=r?(s(1),e.animation=null):e.animation&&(s(a),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function hD(e,i,r,s){var n,o,a,l=(n=i.scale,o=i.positionX,a=i.positionY,!(Number.isNaN(n)||Number.isNaN(o)||Number.isNaN(a)));if(e.mounted&&l){var h=e.setState,c=e.state,d=c.scale,u=c.positionX,f=c.positionY,p=i.scale-d,_=i.positionX-u,g=i.positionY-f;0===r?h(i.scale,i.positionX,i.positionY):hE(e,s,r,function(i){1!==i?e.isAnimating=!0:e.isAnimating=!1,h(d+p*i,u+_*i,f+g*i)})}}var hO=function(e,i,r,s,n,o,a){var l=e>i?r*(a?.5:1):0,h=s>n?o*(a?.5:1):0;return{minPositionX:e-i-l,maxPositionX:l,minPositionY:s-n-h,maxPositionY:h,scaleWidthFactor:l,scaleHeightFactor:h}},hT=function(e,i){var r,s,n,o,a,l,h=e.wrapperComponent,c=e.contentComponent,d=e.setup,u=d.centerZoomedOut,f=d.disablePadding;if(!h||!c)throw Error("Components are not mounted");var p=(r=h.offsetWidth,s=h.offsetHeight,n=c.offsetWidth,o=c.offsetHeight,{wrapperWidth:r,wrapperHeight:s,newContentWidth:a=n*i,newDiffWidth:r-a,newContentHeight:l=o*i,newDiffHeight:s-l}),_=p.wrapperWidth,g=p.wrapperHeight,v=p.newContentWidth,m=p.newContentHeight,S=hO(_,v,p.newDiffWidth,g,m,p.newDiffHeight,!!u),y=_>=v&&g>=m;f&&y&&!u&&(S.minPositionX=0,S.maxPositionX=0,S.minPositionY=0,S.maxPositionY=0);var b=e.setup,w=b.minPositionX,C=b.maxPositionX,x=b.minPositionY,k=b.maxPositionY;return null!=w&&(S.minPositionX=_*(1-i)+w*i),null!=C&&(S.maxPositionX=C*i),null!=x&&(S.minPositionY=g*(1-i)+x*i),null!=k&&(S.maxPositionY=k*i),S},hP=function(e,i,r,s){return s?e<i?hb(i,2):e>r?hb(r,2):hb(e,2):hb(e,2)},hI=function(e,i){var r=hT(e,i);return e.bounds=r,r};function hR(e,i,r,s,n,o,a){var l=r.minPositionX,h=r.minPositionY,c=r.maxPositionX,d=r.maxPositionY,u=0,f=0;return a&&(u=n,f=o),{x:hP(e,l-u,c+u,s),y:hP(i,h-f,d+f,s)}}function hM(e,i,r,s,n,o){var a=e.state,l=a.scale,h=a.positionX,c=a.positionY,d=s-l;return"number"!=typeof i||"number"!=typeof r?(console.error("Mouse X and Y position were not provided!"),{x:h,y:c}):hR(h-i*d,c-r*d,n,o,0,0,null)}function hN(e,i,r,s,n){var o=n?s:0,a=Math.max(i-o,1e-7),l=r+o;return!Number.isNaN(r)&&e>=l?l:!Number.isNaN(i)&&e<=a?a:Math.max(e,1e-7)}var hL=function(e,i){var r=e.setup.panning.excluded,s=e.isInitialized,n=e.wrapperComponent,o=i.target,a="shadowRoot"in o&&"composedPath"in i?i.composedPath().some(function(e){return e instanceof Element&&(null==n?void 0:n.contains(e))}):null==n?void 0:n.contains(o);return!(!(s&&o&&a)||ce(o,r))&&"true"!==o.getAttribute("draggable")&&"true"!==o.getAttribute("contenteditable")&&!o.isContentEditable},hB=function(e){var i=e.isInitialized,r=e.isPanning,s=e.setup.panning.disabled;return!!(i&&r&&!s)},hA=function(e,i){var r=e.state,s=r.positionX,n=r.positionY;e.isPanning=!0,e.startCoords={x:i.clientX-s,y:i.clientY-n}},hj=function(e,i){var r=i.touches,s=e.state,n=s.positionX,o=s.positionY;e.isPanning=!0,1===r.length&&(e.startCoords={x:r[0].clientX-n,y:r[0].clientY-o})};function hH(e,i,r,s,n){var o=e.setup.limitToBounds,a=e.wrapperComponent,l=e.bounds,h=e.state,c=h.scale,d=h.positionX,u=h.positionY;if(null!==a&&null!==l&&(i!==d||r!==u)){var f=hR(i,r,l,o,s,n,a),p=f.x,_=f.y;e.setState(c,p,_)}}var hW=function(e,i,r){var s=e.startCoords,n=e.state,o=e.setup.panning,a=o.lockAxisX,l=o.lockAxisY,h=n.positionX,c=n.positionY;if(!s)return{x:h,y:c};var d=i-s.x,u=r-s.y;return{x:a?h:d,y:l?c:u}},hz=function(e,i,r){var s=e.setup,n=e.state,o=s.minScale,a=s.disablePadding,l=s.centerZoomedOut,h=null!=r?r:n.scale;return i>0&&h>=o&&!a&&!l?i:0};(E=P||(P={})).TRACK_PAD="track_pad",E.MOUSE="mouse",E.TOUCH="touch";var hF=function(e){var i=e.mounted,r=e.wrapperComponent,s=e.contentComponent,n=e.setup,o=n.disabled,a=n.velocityAnimation,l=n.limitToBounds,h=e.state.scale;return!a.disabled&&!o&&!!i&&!!r&&!!s&&(!l||r.offsetWidth<s.offsetWidth*h||r.offsetHeight<s.offsetHeight*h)},h$=function(e){var i=e.mounted,r=e.velocity,s=e.bounds,n=e.setup,o=n.disabled;return!!(!n.velocityAnimation.disabled&&!o&&i)&&!!r&&!!s};function hK(e,i,r,s,n,o,a,l,h,c){if(n){if(i>a&&r>a){var d=a+(e-a)*c;return d>h?h:d<a?a:d}if(i<o&&r<o){var d=o+(e-o)*c;return d<l?l:d>o?o:d}}return s?i:hP(e,o,a,n)}var hU=function(e,i,r){var s=e*r;return Number.isNaN(s)?0:e<0?Math.max(s,-i):Math.min(s,i)};function hY(e,i){var r=e.state,s=r.scale;e.panStartPosition={x:r.positionX,y:r.positionY},hk(e),hI(e,s),void 0!==window.TouchEvent&&i instanceof TouchEvent?hj(e,i):hA(e,i)}function hq(e,i){var r=e.state.scale,s=e.setup,n=s.minScale,o=s.autoAlignment,a=o.disabled,l=o.sizeX,h=o.sizeY,c=o.animationTime,d=o.animationType;if(!(a||r<n||!l&&!h)){var u=function(e){var i=e.state,r=i.positionX,s=i.positionY,n=i.scale,o=e.setup,a=o.disabled,l=o.limitToBounds,h=o.centerZoomedOut,c=e.wrapperComponent;if(!a&&c&&e.bounds){var d=e.bounds,u=d.maxPositionX,f=d.minPositionX,p=d.maxPositionY,_=d.minPositionY,g=r>u?c.offsetWidth:e.setup.minPositionX||0,v=s>p?c.offsetHeight:e.setup.minPositionY||0,m=hM(e,g,v,n,e.bounds,l||h),S=m.x,y=m.y;return{scale:n,positionX:r>u||r<f?S:r,positionY:s>p||s<_?y:s}}}(e);u&&hD(e,u,null!=i?i:c,d)}}function hX(e,i,r,s){var n=e.startCoords,o=e.setup.autoAlignment,a=o.sizeX,l=o.sizeY;if(n){var h=hW(e,i,r),c=h.x,d=h.y,u=hz(e,a),f=hz(e,l);!function(e,i,r){var s,n;if(hF(e)){var o=e.lastMousePosition,a=e.velocityTime,l=e.setup,h=e.wrapperComponent,c=l.velocityAnimation,d=c.maxStrengthMouse,u=c.maxStrengthTouch,f=c.sensitivityTouch,p=c.sensitivityMouse,_=Date.now();if(o&&a&&h){var g,v=Number.isNaN(g=h.offsetWidth/window.innerWidth)?1:Math.min(1,g),m=((s={})[P.TOUCH]=f,s[P.MOUSE]=p,s)[r],S=((n={})[P.TOUCH]=u,n[P.MOUSE]=d,n)[r],y=i.x-o.x,b=i.y-o.y;e.velocity={velocityX:hU(y/v,S,m),velocityY:hU(b/v,S,m),total:hU(Math.sqrt(y*y+b*b)/(_-a),S,m)}}e.lastMousePosition=i,e.velocityTime=_}}(e,{x:c,y:d},s),hH(e,c,d,u,f)}}function hV(e,i,r,s){var n=e.setup,o=n.minScale,a=n.maxScale,l=n.limitToBounds,h=hN(hb(i,2),o,a,0,!1),c=hI(e,h),d=hM(e,r,s,h,c,l);return{scale:h,positionX:d.x,positionY:d.y}}function hG(e,i,r){var s=e.state.scale,n=e.wrapperComponent,o=e.setup,a=o.minScale,l=o.maxScale,h=o.limitToBounds,c=o.zoomAnimation,d=c.disabled,u=c.animationTime,f=c.animationType,p=s>=a&&s<=l;if((s>=1||h)&&hq(e),!(d||p)&&n&&e.mounted){var _=hV(e,s<a?a:l,i||n.offsetWidth/2,r||n.offsetHeight/2);_&&hD(e,_,u,f)}}var hZ=function(){return(hZ=Object.assign||function(e){for(var i,r=1,s=arguments.length;r<s;r++)for(var n in i=arguments[r])Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);return e}).apply(this,arguments)};function hJ(e,i,r){if(r||2==arguments.length)for(var s,n=0,o=i.length;n<o;n++)!s&&n in i||(s||(s=Array.prototype.slice.call(i,0,n)),s[n]=i[n]);return e.concat(s||Array.prototype.slice.call(i))}"function"==typeof SuppressedError&&SuppressedError;var hQ={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,disablePadding:!1,smooth:!0,detached:!1,wheel:{step:.015,disabled:!1,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},trackPadPanning:{disabled:!0,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,allowLeftClickPan:!0,allowMiddleClickPan:!0,allowRightClickPan:!0,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,allowPanning:!0,excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},autoAlignment:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivityMouse:1,sensitivityTouch:1.2,maxStrengthMouse:20,maxStrengthTouch:40,inertia:1,animationTime:300,maxAnimationTime:800,animationType:"easeOut"}},h0="react-transform-wrapper",h1=function(e){var i,r,s,n,o,a,l,h,c,d=Math.max(null!=(i=e.minScale)?i:hQ.minScale,1e-7),u=null!=(r=e.maxScale)?r:hQ.maxScale,f=Math.min(Math.max(null!=(s=e.initialScale)?s:1,d),u);return{previousScale:f,scale:f,positionX:hP(null!=(n=e.initialPositionX)?n:0,null!=(o=e.minPositionX)?o:-1/0,null!=(a=e.maxPositionX)?a:1/0,null!=e.minPositionX||null!=e.maxPositionX),positionY:hP(null!=(l=e.initialPositionY)?l:0,null!=(h=e.minPositionY)?h:-1/0,null!=(c=e.maxPositionY)?c:1/0,null!=e.minPositionY||null!=e.maxPositionY)}},h2=function(e){var i=hZ({},hQ);return Object.keys(e).forEach(function(r){var s=void 0!==e[r];if(void 0!==hQ[r]&&s){var n=Object.prototype.toString.call(hQ[r]);"[object Object]"===n?i[r]=hZ(hZ({},hQ[r]),e[r]):"[object Array]"===n?i[r]=hJ(hJ([],hQ[r],!0),e[r],!0):i[r]=e[r]}}),i.minScale<=0&&(i.minScale=1e-7),i},h5=function(e,i,r){var s=e.state.scale,n=e.wrapperComponent,o=e.setup,a=o.maxScale,l=o.minScale,h=o.zoomAnimation,c=o.smooth,d=h.size;if(!n)throw Error("Wrapper is not mounted");return hN(hb(c?s*Math.exp(i*r):s+i*r,3),l,a,d,!1)};function h3(e,i,r,s,n){var o,a,l=e.wrapperComponent,h=e.state,c=h.scale,d=h.positionX,u=h.positionY,f=e.setup.zoomAnimation;if(!l)return console.error("No WrapperComponent found");var p=f.disabled?0:s,_=l.offsetWidth,g=l.offsetHeight,v=h5(e,i,r),m=hV(e,v,(_/2-d)/c,(g/2-u)/c);if(!m)return console.error("Error during zoom event. New transformation state was not calculated.");var S=e.props,y=S.onZoomStart,b=S.onZoom,w=S.onZoomStop,C=new MouseEvent("mousemove",{bubbles:!0}),x=h8(e);hw(x,C,y),hw(x,C,b),hD(e,m,p,n);var k=null!=(a=null==(o=l.ownerDocument)?void 0:o.defaultView)?a:"u">typeof window?window:null;k&&k.setTimeout(function(){e.mounted&&hw(h8(e),C,w)},p)}function h6(e,i,r,s){var n,o,a=e.setup,l=e.wrapperComponent,h=e.contentComponent,c=a.limitToBounds,d=a.centerOnInit,u=h1(e.props),f=e.state,p=f.scale,_=f.positionX,g=f.positionY;if(l){var v=u.positionX,m=u.positionY;if(d&&h){var S=cr(u.scale,l,h);v=S.positionX,m=S.positionY}var y=hR(v,m,hT(e,u.scale),c,0,0,l),b={scale:u.scale,positionX:y.x,positionY:y.y};if(p!==u.scale||_!==u.positionX||g!==u.positionY){null==s||s();var w=e.props,C=w.onZoomStart,x=w.onZoom,k=w.onZoomStop,E=new MouseEvent("mousemove",{bubbles:!0}),D=h8(e);hw(D,E,C),hw(D,E,x),hD(e,b,i,r);var O=null!=(o=null==(n=l.ownerDocument)?void 0:n.defaultView)?o:"u">typeof window?window:null;O&&O.setTimeout(function(){e.mounted&&hw(h8(e),E,k)},i)}}}var h4=function(e){return{instance:e,state:e.state,zoomIn:function(i,r,s){void 0===i&&(i=.5),void 0===r&&(r=300),void 0===s&&(s="easeOut"),h3(e,1,i,r,s)},zoomOut:function(i,r,s){void 0===i&&(i=.5),void 0===r&&(r=300),void 0===s&&(s="easeOut"),h3(e,-1,i,r,s)},setTransform:function(i,r,s,n,o){void 0===n&&(n=300),void 0===o&&(o="easeOut");var a=e.state,l=a.positionX,h=a.positionY,c=a.scale,d=e.wrapperComponent,u=e.contentComponent;!e.setup.disabled&&d&&u&&hD(e,{positionX:Number.isNaN(i)?l:i,positionY:Number.isNaN(r)?h:r,scale:Number.isNaN(s)?c:s},n,o)},resetTransform:function(i,r){void 0===i&&(i=200),void 0===r&&(r="easeOut"),h6(e,i,r)},centerView:function(i,r,s){void 0===r&&(r=200),void 0===s&&(s="easeOut");var n=e.state,o=e.wrapperComponent,a=e.contentComponent;o&&a&&hD(e,cr(i||n.scale,o,a),r,s)},zoomToElement:function(i,r,s,n,o,a){void 0===s&&(s=600),void 0===n&&(n="easeOut"),void 0===o&&(o=0),void 0===a&&(a=0),hk(e);var l=e.wrapperComponent,h="string"==typeof i?document.getElementById(i):i;if(l&&h&&l.contains(h)){var c=function(e,i,r,s,n){void 0===s&&(s=0),void 0===n&&(n=0);var o,a,l,h,c,d=e.wrapperComponent,u=e.contentComponent,f=e.state,p=e.setup,_=p.limitToBounds,g=p.minScale,v=p.maxScale;if(!d||!u)return f;var m=d.getBoundingClientRect(),S=i.getBoundingClientRect(),y=(o=i.getBoundingClientRect(),a=d.getBoundingClientRect(),l=u.getBoundingClientRect(),h=a.x*f.scale,c=a.y*f.scale,{x:(o.x-l.x+h)/f.scale,y:(o.y-l.y+c)/f.scale}),b=y.x,w=y.y,C=S.width/f.scale,x=S.height/f.scale,k=d.offsetWidth/C,E=d.offsetHeight/x,D=hN(r||Math.min(k,E),g,v,0,!1),O=(m.width-C*D)/2,T=(m.height-x*D)/2,P=hR((m.left-b)*D+O+s,(m.top-w)*D+T+n,hT(e,D),_,0,0,d);return{positionX:P.x,positionY:P.y,scale:D}}(e,h,r,o,a);hD(e,c,s,n)}}}},h8=function(e){var i={};return Object.assign(i,{instance:e,state:e.state}),Object.assign(i,h4(e)),i};function h7(){try{return{get passive(){return!1}}}catch(e){return!1}}var h9=".".concat(h0),ce=function(e,i){return i.some(function(i){return e.matches("".concat(h9," ").concat(i,", ").concat(h9," .").concat(i,", ").concat(h9," ").concat(i," *, ").concat(h9," .").concat(i," *"))})},ct=function(e){e&&clearTimeout(e)},ci=function(e,i,r){var s=Number.parseFloat(r.toFixed(8));return"translate(".concat(e,"px, ").concat(i,"px) scale(").concat(s,")")},cr=function(e,i,r){var s=r.offsetWidth*e,n=r.offsetHeight*e;return{scale:e,positionX:(i.offsetWidth-s)/2,positionY:(i.offsetHeight-n)/2}},cs=function(e,i){var r=e.setup.wheel,s=r.disabled,n=r.wheelDisabled,o=r.touchPadDisabled,a=r.excluded,l=e.isInitialized,h=e.isPanning,c=i.target;return!(!(l&&!h&&!s&&c)||n&&!i.ctrlKey||o&&i.ctrlKey||ce(c,a))&&!!e.isPressingKeys(e.setup.wheel.activationKeys)},cn=function(e,i){var r=e.setup,s=r.disabled,n=r.trackPadPanning,o=n.activationKeys,a=n.excluded;return!(!e.wrapperComponent||!e.contentComponent||s||n.disabled||i.ctrlKey||cs(e,i)||ce(i.target,a))&&!!e.isPressingKeys(o)};function co(e,i,r){var s=i.getBoundingClientRect(),n=0,o=0;if("clientX"in e)n=(e.clientX-s.left)/r,o=(e.clientY-s.top)/r;else{var a=e.touches[0];n=(a.clientX-s.left)/r,o=(a.clientY-s.top)/r}return(Number.isNaN(n)||Number.isNaN(o))&&console.error("No mouse or touch offset found"),{x:n,y:o}}var ca=function(e,i,r,s,n){var o=e.state.scale,a=e.wrapperComponent,l=e.setup,h=l.maxScale,c=l.minScale,d=l.zoomAnimation,u=l.disablePadding,f=d.size,p=d.disabled;if(!a)throw Error("Wrapper is not mounted");var _=o+i*r;return n?_:hN(_,c,h,f,!s&&!p&&!u)},cl=function(e,i){var r=e.previousWheelEvent,s=e.state.scale,n=e.setup,o=n.maxScale,a=n.minScale;return!!r&&(!!(s<o)||!!(s>a)||Math.sign(r.deltaY)!==Math.sign(i.deltaY)||!!(r.deltaY>0)&&!!(r.deltaY<i.deltaY)||!!(r.deltaY<0)&&!!(r.deltaY>i.deltaY)||Math.sign(r.deltaY)!==Math.sign(i.deltaY))},ch=function(e,i){var r=e.setup.pinch,s=r.disabled,n=r.excluded,o=e.isInitialized,a=i.target;return!(!(o&&!s&&a)||ce(a,n))},cc=function(e){var i=e.setup.pinch.disabled,r=e.isInitialized,s=e.pinchStartDistance;return!!(r&&!i&&null!==s)},cd=function(e,i,r){var s=r.getBoundingClientRect(),n=e.touches,o=n[0].clientX-s.left,a=n[0].clientY-s.top;return{x:(o+(n[1].clientX-s.left))/2/i,y:(a+(n[1].clientY-s.top))/2/i}},cu=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},cf=function(e,i){var r=e.pinchStartScale,s=e.pinchStartDistance,n=e.setup,o=n.maxScale,a=n.minScale,l=n.zoomAnimation,h=n.disablePadding,c=n.pinch,d=l.size,u=l.disabled,f=c.step;if(!r||null===s)throw Error("Pinch touches distance was not provided");if(i<0)return e.state.scale;var p=r+f/5*(i/s*r-r);return hN(p===1/0?0:hb(p,10),a,o,d,!u&&!h)},cp=function(e,i){var r=e.props,s=r.onWheelStart,n=r.onZoomStart;e.wheelStopEventTimer||(hk(e),hw(h8(e),i,s),hw(h8(e),i,n))},c_=function(e,i){var r,s=e.props,n=s.onWheel,o=s.onZoom,a=e.contentComponent,l=e.setup,h=e.state.scale,c=l.limitToBounds,d=l.centerZoomedOut,u=l.zoomAnimation,f=l.wheel,p=l.disablePadding,_=l.smooth,g=u.size,v=u.disabled,m=f.step;if(!a)throw Error("Component not mounted");i.preventDefault(),i.stopPropagation();var S=ca(e,(r=i?i.deltaY<0?1:-1:0,r),_?m*Math.abs(i.deltaY):m,!i.ctrlKey);if(h!==S){var y=hI(e,S),b=co(i,a,h),w=hM(e,b.x,b.y,S,y,c&&(v||0===g||d||p)),C=w.x,x=w.y;e.previousWheelEvent=i,e.setState(S,C,x),hw(h8(e),i,n),hw(h8(e),i,o)}},cg=function(e,i){var r=e.props,s=r.onWheelStop,n=r.onZoomStop;ct(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(hG(e,i.x,i.y),e.wheelAnimationTimer=null)},100),cl(e,i)&&(ct(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,hw(h8(e),i,s),hw(h8(e),i,n))},160))},cv=function(e,i){var r=e.props,s=r.onWheelStart,n=r.onPanningStart;e.wheelStopEventTimer||(hk(e),hw(h8(e),i,s),hw(h8(e),i,n))},cm=function(e,i){var r=e.props,s=r.onWheelStop,n=r.onPanningStop;ct(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(hG(e,i.x,i.y),e.wheelAnimationTimer=null)},100),cl(e,i)&&(ct(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,hw(h8(e),i,s),hw(h8(e),i,n))},160))},cS=function(e){for(var i=0,r=0,s=0;s<2;s+=1)i+=e.touches[s].clientX,r+=e.touches[s].clientY;return{x:i/2,y:r/2}},cy=function(e,i){var r=cu(i);e.pinchStartDistance=r,e.lastDistance=r,e.pinchStartScale=e.state.scale,e.isPanning=!1,e.isPinching=!0,e.pinchPreviousCenter=cS(i),hk(e)},cb=function(e,i){var r=e.contentComponent,s=e.pinchStartDistance,n=e.wrapperComponent,o=e.pinchPreviousCenter,a=e.state.scale,l=e.setup,h=l.limitToBounds,c=l.centerZoomedOut,d=l.zoomAnimation,u=l.autoAlignment,f=l.pinch,p=l.panning,_=d.disabled,g=d.size,v=f.allowPanning;if(null!==s&&r){var m=cd(i,a,r);if(Number.isFinite(m.x)&&Number.isFinite(m.y)){var S=cu(i),y=cf(e,S),b=cS(i),w=a/y,C=(b.x-((null==o?void 0:o.x)||0))*w,x=(b.y-((null==o?void 0:o.y)||0))*w;if(y!==a||0!==C||0!==x){e.pinchPreviousCenter=b;var k=hI(e,y),E=hM(e,m.x,m.y,y,k,h&&(_||0===g||c)),D=E.x,O=E.y;if(e.pinchMidpoint=m,e.lastDistance=S,p.disabled||!v)e.setState(y,D,O);else{var T=u.sizeX,P=u.sizeY,I=hR(D+C,O+x,k,h,hz(e,T,y),hz(e,P,y),n),R=I.x,M=I.y;e.setState(y,R,M)}}}}},cw=function(e){var i=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,e.isPinching=!1,hG(e,null==i?void 0:i.x,null==i?void 0:i.y)},cC=function(e,i){var r=e.props.onZoomStop,s=e.setup.doubleClick.animationTime;ct(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,hw(h8(e),i,r)},s)},cx=function(e,i){var r=e.props,s=r.onZoomStart,n=r.onZoom,o=e.setup.doubleClick,a=o.animationTime,l=o.animationType;hw(h8(e),i,s),h6(e,a,l,function(){return hw(h8(e),i,n)}),cC(e,i)},ck=function(e,i){var r=e.isInitialized,s=e.setup,n=e.wrapperComponent,o=s.doubleClick,a=o.disabled,l=o.excluded,h=i.target,c=null==n?void 0:n.contains(h);return!(!(r&&h&&c&&!a)||ce(h,l))},cE=function(e){var i=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.onTransformCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.isWheelPanning=!1,this.startCoords=null,this.panStartPosition=null,this.lastTouch=null,this.isPinching=!1,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.pinchPreviousCenter=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.isAnimating=!1,this.animation=null,this.pressedKeys={},this.mount=function(){i.initializeWindowEvents()},this.unmount=function(){i.cleanupWindowEvents()},this.update=function(e){i.props=e,i.wrapperComponent&&i.contentComponent&&hI(i,i.state.scale),i.setup=h2(e)},this.initializeWindowEvents=function(){var e,r,s,n,o=h7(),a=null==(e=i.wrapperComponent)?void 0:e.ownerDocument,l=null==a?void 0:a.defaultView;null==(r=i.wrapperComponent)||r.addEventListener("wheel",i.onWheelPanning,o),null==(s=i.wrapperComponent)||s.addEventListener("keyup",i.setKeyUnPressed,o),null==(n=i.wrapperComponent)||n.addEventListener("keydown",i.setKeyPressed,o),null==l||l.addEventListener("mousedown",i.onPanningStart,o),null==l||l.addEventListener("mousemove",i.onPanning,o),null==l||l.addEventListener("mouseup",i.onPanningStop,o),null==a||a.addEventListener("mouseleave",i.clearPanning,o),null==l||l.addEventListener("keyup",i.setKeyUnPressed,o),null==l||l.addEventListener("keydown",i.setKeyPressed,o),null==l||l.addEventListener("blur",i.handleWindowBlur)},this.cleanupWindowEvents=function(){var e,r,s,n,o,a=h7(),l=null==(e=i.wrapperComponent)?void 0:e.ownerDocument,h=null==l?void 0:l.defaultView;null==h||h.removeEventListener("mousedown",i.onPanningStart,a),null==h||h.removeEventListener("mousemove",i.onPanning,a),null==h||h.removeEventListener("mouseup",i.onPanningStop,a),null==l||l.removeEventListener("mouseleave",i.clearPanning,a),null==h||h.removeEventListener("keyup",i.setKeyUnPressed,a),null==h||h.removeEventListener("keydown",i.setKeyPressed,a),null==h||h.removeEventListener("blur",i.handleWindowBlur),document.removeEventListener("mouseleave",i.clearPanning,a),null==(r=i.wrapperComponent)||r.removeEventListener("wheel",i.onWheelPanning,a),null==(s=i.wrapperComponent)||s.removeEventListener("keyup",i.setKeyUnPressed,a),null==(n=i.wrapperComponent)||n.removeEventListener("keydown",i.setKeyPressed,a),hk(i),null==(o=i.observer)||o.disconnect()},this.handleInitializeWrapperEvents=function(e){var r=h7();e.addEventListener("wheel",i.onWheelZoom,r),e.addEventListener("dblclick",i.onDoubleClick,r),e.addEventListener("touchstart",i.onTouchPanningStart,r),e.addEventListener("touchmove",i.onTouchPanning,r),e.addEventListener("touchend",i.onTouchPanningStop,r)},this.handleInitialize=function(e){var r=i.setup.centerOnInit;i.applyTransformation(),i.onInitCallbacks.forEach(function(e){return e(h8(i))}),r&&(i.setCenter(),i.observer=new ResizeObserver(function(){var r,s=e.offsetWidth,n=e.offsetHeight;(s>0||n>0)&&(i.onInitCallbacks.forEach(function(e){return e(h8(i))}),i.setCenter(),null==(r=i.observer)||r.disconnect())}),setTimeout(function(){var e;null==(e=i.observer)||e.disconnect()},5e3),i.observer.observe(e))},this.onWheelZoom=function(e){i.setup.disabled||(i.syncModifierKeys(e),cs(i,e)&&(cp(i,e),c_(i,e),cg(i,e)))},this.onWheelPanning=function(e){var r=i.props.onPanning,s=i.setup.trackPadPanning,n=s.lockAxisX,o=s.lockAxisY;if(i.syncModifierKeys(e),cn(i,e)){e.preventDefault(),e.stopPropagation();var a=i.state,l=a.positionX,h=a.positionY,c=l-e.deltaX,d=h-e.deltaY,u=n?l:c,f=o?h:d,p=i.setup.autoAlignment,_=p.sizeX,g=p.sizeY,v=hz(i,_),m=hz(i,g);(u!==l||f!==h)&&(cv(i,e),hH(i,u,f,v,m),hw(h8(i),e,r),cm(i,e))}},this.onPanningStart=function(e){var r=i.setup.disabled,s=i.props.onPanningStart;r||(i.syncModifierKeys(e),hL(i,e)&&i.isPressingKeys(i.setup.panning.activationKeys)&&(0!==e.button||i.setup.panning.allowLeftClickPan)&&(1!==e.button||i.setup.panning.allowMiddleClickPan)&&(2!==e.button||i.setup.panning.allowRightClickPan)&&(e.preventDefault(),e.stopPropagation(),hk(i),hY(i,e),hw(h8(i),e,s)))},this.onPanning=function(e){var r=i.setup.disabled,s=i.props.onPanning;r||((i.syncModifierKeys(e),i.isPanning&&0===e.buttons)?i.clearPanning(e):!hB(i)||i.isPressingKeys(i.setup.panning.activationKeys)&&(e.preventDefault(),e.stopPropagation(),hX(i,e.clientX,e.clientY,P.MOUSE),hw(h8(i),e,s)))},this.onPanningStop=function(e){var r=i.setup.panning.velocityDisabled,s=i.props.onPanningStop;i.isPanning&&(!function(e,i){if(e.isPanning){var r=e.velocity,s=e.wrapperComponent,n=e.contentComponent;e.isPanning=!1;var o=e.state,a=o.positionX,l=o.positionY,h=o.scale,c=e.panStartPosition;if(e.panStartPosition=null,c){var d=a-c.x,u=l-c.y;if(d*d+u*u<=25)return}e.isAnimating=!1,e.animation=null;var f=(null==s?void 0:s.offsetWidth)||0,p=(null==s?void 0:s.offsetHeight)||0,_=((null==n?void 0:n.offsetWidth)||0)*h,g=((null==n?void 0:n.offsetHeight)||0)*h,v=!e.setup.limitToBounds||f<_||p<g;!i&&r&&r.total>.1&&v?function(e){var i=e.velocity,r=e.bounds,s=e.setup,n=e.wrapperComponent;if(h$(e)&&i&&r&&n){var o,a,l,h=i.velocityX,c=i.velocityY,d=i.total,u=r.maxPositionX,f=r.minPositionX,p=r.maxPositionY,_=r.minPositionY,g=s.limitToBounds,v=s.autoAlignment,m=s.zoomAnimation,S=s.panning,y=S.lockAxisY,b=S.lockAxisX,w=m.animationType,C=v.sizeX,x=v.sizeY,k=v.velocityAlignmentTime,E=Math.max((a=(o=e.setup.velocityAnimation).animationTime,l=o.maxAnimationTime,Math.min(a*Math.max(1,Math.abs(d/o.inertia)),l)),k),D=hz(e,C),O=hz(e,x),T=D*n.offsetWidth/100,P=O*n.offsetHeight/100,I=u+T,R=f-T,M=p+P,N=_-P,L=e.state,B=new Date().getTime();hE(e,w,E,function(i){var r=e.state,s=r.scale,n=r.positionX,o=r.positionY,a=new Date().getTime()-B,l=1-(0,hC[v.animationType])(Math.min(1,a/k)),d=1-i,m=n+h*d,S=o+c*d,w=hK(m,L.positionX,n,b,g,f,u,R,I,l),C=hK(S,L.positionY,o,y,g,_,p,N,M,l);if(n!==m||o!==S){e.setState(s,w,C);var x=e.props.onPanning;x&&x(h8(e),{})}})}}(e):hq(e)}}(i,r),hw(h8(i),e,s))},this.onPinchStart=function(e){var r=i.setup.disabled,s=i.props.onPinchStart;r||ch(i,e)&&(cy(i,e),hk(i),hw(h8(i),e,s))},this.onPinch=function(e){var r=i.setup.disabled,s=i.props.onPinch;r||cc(i)&&(e.preventDefault(),e.stopPropagation(),cb(i,e),hw(h8(i),e,s))},this.onPinchStop=function(e){var r=i.props.onPinchStop;i.pinchStartScale&&(cw(i),hw(h8(i),e,r))},this.onTouchPanningStart=function(e){var r=i.setup,s=r.disabled,n=r.doubleClick,o=i.props.onPanningStart;if(!s){var a=!(null==n?void 0:n.disabled),l=i.lastTouch&&new Date-i.lastTouch<200;if(a&&l&&1===e.touches.length)i.onDoubleClick(e);else{i.lastTouch=+new Date,hk(i);var h=e.touches,c=1===h.length,d=2===h.length,u=hL(i,e);if(c){if(!u)return;hk(i),hY(i,e),hw(h8(i),e,o)}d&&i.onPinchStart(e)}}},this.onTouchPanning=function(e){var r=i.setup.disabled,s=i.props.onPanning;if(i.isPanning&&1===e.touches.length){if(r||!hB(i))return;e.cancelable&&e.preventDefault(),e.stopPropagation();var n=e.touches[0];hX(i,n.clientX,n.clientY,P.TOUCH),hw(h8(i),e,s)}else e.touches.length>1&&i.onPinch(e)},this.onTouchPanningStop=function(e){i.onPanningStop(e),i.onPinchStop(e)},this.onDoubleClick=function(e){i.setup.disabled||ck(i,e)&&function(e,i){var r,s=e.setup,n=e.doubleClickStopEventTimer,o=e.state,a=e.contentComponent,l=o.scale,h=e.props,c=h.onZoomStart,d=h.onZoom,u=s.doubleClick,f=u.disabled,p=u.mode,_=u.step,g=u.animationTime,v=u.animationType;if(!f&&!n){if("reset"===p)return cx(e,i);if(!a)return console.error("No ContentComponent found");var m=(r=e.state.scale,"toggle"===p?1===r?1:-1:"zoomOut"===p?-1:1),S=h5(e,m,_);if(l!==S){hw(h8(e),i,c);var y=co(i,a,l),b=hV(e,S,y.x,y.y);if(!b)return console.error("Error during zoom event. New transformation state was not calculated.");hw(h8(e),i,d),hD(e,b,g,v),cC(e,i)}}}(i,e)},this.clearPanning=function(e){i.isPanning&&i.onPanningStop(e)},this.handleWindowBlur=function(){i.pressedKeys={},i.isPanning&&(i.isPanning=!1,i.startCoords=null)},this.syncModifierKeys=function(e){var r=e.ctrlKey,s=e.metaKey,n=e.shiftKey,o=e.altKey;"boolean"==typeof r&&(i.pressedKeys.Control=r),"boolean"==typeof s&&(i.pressedKeys.Meta=s),"boolean"==typeof n&&(i.pressedKeys.Shift=n),"boolean"==typeof o&&(i.pressedKeys.Alt=o)},this.setKeyPressed=function(e){i.pressedKeys[e.key]=!0},this.setKeyUnPressed=function(e){i.pressedKeys[e.key]=!1},this.isPressingKeys=function(e){return"function"==typeof e?e(Object.entries(i.pressedKeys).filter(function(e){return e[1]}).map(function(e){return e[0]})):!e.length||!!e.every(function(e){return i.pressedKeys[e]})},this.setCenter=function(){if(i.wrapperComponent&&i.contentComponent){var e=cr(i.state.scale,i.wrapperComponent,i.contentComponent);i.setState(e.scale,e.positionX,e.positionY)}},this.handleTransformStyles=function(e,r,s){return i.props.customTransform?i.props.customTransform(e,r,s):ci(e,r,s)},this.getContext=function(){return h8(i)},this.applyTransformation=function(){if(i.mounted&&i.contentComponent){var e=i.state,r=e.scale,s=e.positionX,n=e.positionY,o=i.handleTransformStyles(s,n,r);i.props.detached||(i.contentComponent.style.transform=o),i.onTransformCallbacks.forEach(function(e){return e({scale:r,positionX:s,positionY:n,previousScale:i.state.previousScale,ref:h8(i)})})}},this.setState=function(e,r,s){var n=i.props.onTransform;if(Number.isNaN(e)||Number.isNaN(r)||Number.isNaN(s))console.error("Detected NaN set state values");else{var o=Math.max(e,1e-7);o!==i.state.scale&&(i.state.previousScale=i.state.scale,i.state.scale=o),i.state.positionX=r,i.state.positionY=s,i.applyTransformation();var a=h8(i);i.onChangeCallbacks.forEach(function(e){return e(a)}),hw(a,{scale:i.state.scale,positionX:r,positionY:s},n)}},this.onTransform=function(e){return i.onTransformCallbacks.has(e)||i.onTransformCallbacks.add(e),function(){i.onTransformCallbacks.delete(e)}},this.onChange=function(e){return i.onChangeCallbacks.has(e)||i.onChangeCallbacks.add(e),function(){i.onChangeCallbacks.delete(e)}},this.onInit=function(e){return i.onInitCallbacks.has(e)||i.onInitCallbacks.add(e),function(){i.onInitCallbacks.delete(e)}},this.init=function(e,r){i.cleanupWindowEvents(),i.wrapperComponent=e,i.contentComponent=r,hI(i,i.state.scale),i.handleInitializeWrapperEvents(e),i.handleInitialize(r),i.initializeWindowEvents(),i.isInitialized=!0;var s,n=h8(i);hw(n,void 0,i.props.onInit),s=i.props.ref,null!=s&&("function"==typeof s?s(n):s.current=n)},this.props=e,this.setup=h2(this.props),this.state=h1(this.props)},cD=R.default.createContext(null),cO=R.default.forwardRef(function(e,i){var r,s,n=(0,R.useRef)(new cE(e)).current,o=(r=e.children,s=h4(n),"function"==typeof r?r(s):r);return(0,R.useImperativeHandle)(i,function(){return h4(n)},[n]),(0,R.useEffect)(function(){n.update(e)},[n,e]),(0,I.jsx)(cD.Provider,hZ({value:n},{children:o}))});R.default.forwardRef(function(e,i){var r,s=(0,R.useRef)(null),n=(0,R.useContext)(cD);return(0,R.useEffect)(function(){return n.onChange(function(e){s.current&&(s.current.style.transform=n.handleTransformStyles(0,0,1/e.instance.state.scale))})},[n]),(0,I.jsx)("div",hZ({},e,{ref:(r=[s,i],function(e){r.forEach(function(i){"function"==typeof i?i(e):null!=i&&(i.current=e)})})}))});!function(e,i){void 0===i&&(i={});var r=i.insertAt;if(e&&"u">typeof document){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===r&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".transform-component-module_wrapper__SPB86 {\n position: relative;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n overflow: hidden;\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none;\n margin: 0;\n padding: 0;\n transform: translate3d(0, 0, 0);\n}\n.transform-component-module_content__FBWxo {\n display: flex;\n flex-wrap: wrap;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n margin: 0;\n padding: 0;\n transform-origin: 0% 0%;\n}\n.transform-component-module_content__FBWxo img {\n pointer-events: none;\n}\n.transform-component-module_infiniteGrid__Z-aP3 {\n position: absolute;\n inset: 0;\n pointer-events: none;\n background-image: radial-gradient(\n circle,\n rgba(0, 0, 0, 0.12) 1px,\n transparent 1px\n );\n background-size: 20px 20px;\n background-position: 0 0;\n}\n");var cT=function(e){var i=e.children,r=e.wrapperClass,s=e.contentClass,n=e.wrapperStyle,o=e.contentStyle,a=e.wrapperProps,l=e.contentProps,h=e.infinite,c=void 0!==h&&h,d=(0,R.useContext)(cD),u=d.init,f=d.cleanupWindowEvents,p=(0,R.useRef)(null),_=(0,R.useRef)(null),g=(0,R.useRef)(null);return(0,R.useEffect)(function(){var e=p.current,i=_.current;return null!==e&&null!==i&&u&&(null==u||u(e,i)),function(){null==f||f()}},[]),(0,R.useEffect)(function(){if(c){var e=g.current;if(e){var i=function(){var i=d.state,r=i.positionX,s=i.positionY;e.style.backgroundPosition="".concat(r,"px ").concat(s,"px")};return i(),d.onChange(i)}}},[c,d]),(0,I.jsxs)("div",hZ({},void 0===a?{}:a,{ref:p,className:"".concat(h0," ").concat("transform-component-module_wrapper__SPB86"," ").concat(void 0===r?"":r),style:n},{children:[c&&(0,I.jsx)("div",{ref:g,className:"transform-component-module_infiniteGrid__Z-aP3","aria-hidden":!0}),(0,I.jsx)("div",hZ({},void 0===l?{}:l,{ref:_,className:"".concat("react-transform-component"," ").concat("transform-component-module_content__FBWxo"," ").concat(void 0===s?"":s),style:hZ(hZ({},o),{transform:ci(d.state.positionX,d.state.positionY,d.state.scale)})},{children:i}))]}))};R.default.forwardRef(function(e,i){var r=e.x,s=e.y,n=e.width,o=e.height,a=e.margin,l=void 0===a?0:a,h=e.threshold,c=void 0===h?0:h,d=e.placeholder,u=void 0===d?null:d,f=e.onShow,p=e.onHide,_=e.children,g=e.className,v=e.style,m=(0,R.useContext)(cD),S=(0,R.useState)(!1),y=S[0],b=S[1],w=(0,R.useRef)(!1),C=(0,R.useRef)(f),x=(0,R.useRef)(p);return(C.current=f,x.current=p,(0,R.useEffect)(function(){var e,i=function(){var e,i,a=m.wrapperComponent;if(a){var h=function(e){var i=e.elementX,r=e.elementY,s=e.elementWidth,n=e.elementHeight,o=e.scale,a=e.positionX,l=e.positionY,h=e.viewportWidth,c=e.viewportHeight,d=e.margin,u=void 0===d?0:d,f=e.threshold,p=void 0===f?0:f,_={x:-u,y:-u,width:h+2*u,height:c+2*u},g={x:i*o+a,y:r*o+l,width:s*o,height:n*o};if(p<=0){var v=g.x<_.x+_.width&&g.x+g.width>_.x,m=g.y<_.y+_.height&&g.y+g.height>_.y;return v&&m}var S=g.width*g.height;return!(S<=0)&&Math.max(0,Math.min(_.x+_.width,g.x+g.width)-Math.max(_.x,g.x))*Math.max(0,Math.min(_.y+_.height,g.y+g.height)-Math.max(_.y,g.y))/S>=p}({elementX:r,elementY:s,elementWidth:n,elementHeight:o,scale:m.state.scale,positionX:m.state.positionX,positionY:m.state.positionY,viewportWidth:a.offsetWidth,viewportHeight:a.offsetHeight,margin:l,threshold:c});h!==w.current&&(w.current=h,b(h),h?null==(e=C.current)||e.call(C):null==(i=x.current)||i.call(x))}};i();var a=m.onChange(i);return m.wrapperComponent||(e=m.onInit(function(){return i()})),function(){a(),null==e||e()}},[m,r,s,n,o,l,c]),y)?(0,I.jsx)("div",hZ({ref:i,className:g,style:v},{children:_})):u?(0,I.jsx)(I.Fragment,{children:u}):null});var cP=e.i(81181),cI=e.i(30702);let cR=(0,B.default)("flip-horizontal-2",[["path",{d:"m3 7 5 5-5 5V7",key:"couhi7"}],["path",{d:"m21 7-5 5 5 5V7",key:"6ouia7"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]),cM=(0,B.default)("flip-vertical-2",[["path",{d:"m17 3-5 5-5-5h10",key:"1ftt6x"}],["path",{d:"m17 21-5-5-5 5h10",key:"1m0wmu"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]),cN=(0,B.default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);var cL=e.i(87538),cB=e.i(34808),cA=e.i(9388),cj=e.i(3214),cH=e.i(38227);let cW=(0,B.default)("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);var cz=e.i(6910);let cF=R.useLayoutEffect;function c$(){let[e,i]=(0,R.useState)("light");return cF(()=>{let e=document.documentElement,r=()=>i("u"<typeof document?"light":document.documentElement.classList.contains("dark")?"dark":"light");r();let s=new MutationObserver(r);return s.observe(e,{attributes:!0,attributeFilter:["class"]}),()=>s.disconnect()},[]),e}let cK=["checkered","black","white","transparent"];function cU({applicationId:e,path:i}){let r,s=`/api/applications/${e}/files/raw?path=${encodeURIComponent(i)}`,n="dark"===c$(),o=(0,R.useMemo)(()=>{let e,i;return e=n?"#1e1e1e":"#ffffff",i=n?"#2a2a2a":"#e5e7eb",{checkered:{backgroundImage:`linear-gradient(45deg, ${i} 25%, transparent 25%), linear-gradient(-45deg, ${i} 25%, transparent 25%), linear-gradient(45deg, transparent 75%, ${i} 75%), linear-gradient(-45deg, transparent 75%, ${i} 75%)`,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:e},black:{backgroundColor:"#000000"},white:{backgroundColor:"#ffffff"},transparent:{backgroundColor:e}}},[n]),a=n?"bg-[#1e1e1e]":"bg-[#ffffff]",l=(0,R.useRef)(null),[h,c]=(0,R.useState)("checkered"),[d,u]=(0,R.useState)(0),[f,p]=(0,R.useState)(!1),[_,g]=(0,R.useState)(!1),[v,m]=(0,R.useState)(1),[S,y]=(0,R.useState)(null),[b,w]=(0,R.useState)(null),[C,x]=(0,R.useState)(null);(0,R.useEffect)(()=>{u(0),p(!1),g(!1),m(1),y(null),w(null),x(null),l.current?.resetTransform?.()},[i]),(0,R.useEffect)(()=>{let e=!1;return(async()=>{try{let i=await fetch(s,{cache:"no-store"});if(!i.ok)return void x(`Failed to load image (${i.status})`);let r=await i.arrayBuffer();e||w(r.byteLength)}catch(i){e||x(i instanceof Error?i.message:String(i))}})(),()=>{e=!0}},[s]);let k=async()=>{try{let e=new URL(s,window.location.origin).toString();await navigator.clipboard.writeText(e),L.toast.success("Image URL copied")}catch{L.toast.error("Failed to copy URL")}};return C?(0,I.jsx)("div",{className:(0,q.cn)("flex h-full items-center justify-center text-xs text-red-500 dark:text-red-400",a),children:C}):(0,I.jsxs)("div",{className:(0,q.cn)("flex h-full min-h-0 flex-col",a),children:[(0,I.jsx)(cY,{scale:v,dimensions:S,bytes:b,bgMode:h,flipH:f,flipV:_,onZoomIn:()=>l.current?.zoomIn?.(.25),onZoomOut:()=>l.current?.zoomOut?.(.25),onReset:()=>l.current?.resetTransform?.(),onFit:()=>l.current?.centerView?.(1),onActualSize:()=>l.current?.setTransform?.(0,0,1),onRotateCcw:()=>u(e=>(e+270)%360),onRotateCw:()=>u(e=>(e+90)%360),onFlipH:()=>p(e=>!e),onFlipV:()=>g(e=>!e),onCycleBackground:()=>{c(e=>{let i=cK.indexOf(e);return cK[(i+1)%cK.length]})},onCopyUrl:k,onOpenInNewTab:()=>window.open(s,"_blank","noopener,noreferrer"),downloadHref:s,downloadName:-1===(r=i.lastIndexOf("/"))?i:i.slice(r+1)}),(0,I.jsx)("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:o[h],children:(0,I.jsx)(cO,{ref:l,initialScale:1,minScale:.1,maxScale:40,centerOnInit:!0,wheel:{step:.05},doubleClick:{mode:"reset"},pinch:{step:2},onTransform:(e,i)=>m(i.scale),children:(0,I.jsx)(cT,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%"},children:(0,I.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,I.jsx)("img",{src:s,alt:i,draggable:!1,onLoad:e=>{let i=e.currentTarget;y({w:i.naturalWidth,h:i.naturalHeight})},style:{transform:`rotate(${d}deg) scaleX(${f?-1:1}) scaleY(${_?-1:1})`,transformOrigin:"center",maxWidth:"90%",maxHeight:"90%",objectFit:"contain",imageRendering:v>=4?"pixelated":"auto",transition:"transform 120ms ease"}})})})})})]})}function cY({scale:e,dimensions:i,bytes:r,bgMode:s,flipH:n,flipV:o,onZoomIn:a,onZoomOut:l,onReset:h,onFit:c,onActualSize:d,onRotateCcw:u,onRotateCw:f,onFlipH:p,onFlipV:_,onCycleBackground:g,onCopyUrl:v,onOpenInNewTab:m,downloadHref:S,downloadName:y}){return(0,I.jsxs)("div",{className:"border-border bg-background/95 text-muted-foreground flex h-9 shrink-0 items-center gap-0.5 border-b px-2 text-[11px]",children:[(0,I.jsx)(cX,{label:"Zoom out",onClick:l,icon:(0,I.jsx)(cB.Minus,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Zoom in",onClick:a,icon:(0,I.jsx)(cj.Plus,{className:"h-3.5 w-3.5"})}),(0,I.jsxs)("button",{type:"button",onClick:h,className:"text-foreground hover:bg-muted/60 h-6 min-w-[3.25rem] rounded-sm px-1.5 text-center font-mono tabular-nums",title:"Reset zoom",children:[Math.round(100*e),"%"]}),(0,I.jsx)(cq,{}),(0,I.jsx)(cX,{label:"Fit to screen",onClick:c,icon:(0,I.jsx)(cL.Maximize2,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Actual size (1:1)",onClick:d,icon:(0,I.jsx)(cz.Square,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cq,{}),(0,I.jsx)(cX,{label:"Rotate 90° counter-clockwise",onClick:u,icon:(0,I.jsx)(cH.RotateCcw,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Rotate 90° clockwise",onClick:f,icon:(0,I.jsx)(cW,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Flip horizontal",onClick:p,icon:(0,I.jsx)(cR,{className:"h-3.5 w-3.5"}),active:n}),(0,I.jsx)(cX,{label:"Flip vertical",onClick:_,icon:(0,I.jsx)(cM,{className:"h-3.5 w-3.5"}),active:o}),(0,I.jsx)(cq,{}),(0,I.jsx)(cX,{label:`Background: ${s}`,onClick:g,icon:(0,I.jsx)(cA.Monitor,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Copy URL",onClick:v,icon:(0,I.jsx)(cN,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Open in new tab",onClick:m,icon:(0,I.jsx)(cI.ExternalLink,{className:"h-3.5 w-3.5"})}),(0,I.jsx)("a",{href:S,download:y,className:"text-muted-foreground hover:text-foreground hover:bg-muted/60 flex h-6 w-6 items-center justify-center rounded-sm",title:"Download",children:(0,I.jsx)(cP.Download,{className:"h-3.5 w-3.5"})}),(0,I.jsx)("div",{className:"flex-1"}),(0,I.jsxs)("div",{className:"flex items-center gap-2 font-mono text-[10px]",children:[i?(0,I.jsxs)("span",{children:[i.w," × ",i.h]}):null,(0,I.jsx)("span",{children:null==r||Number.isNaN(r)?"—":r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:`${(r/1048576).toFixed(2)} MB`})]})]})}function cq(){return(0,I.jsx)("span",{className:"bg-border/60 mx-1 h-4 w-px shrink-0"})}function cX({label:e,onClick:i,icon:r,active:s}){return(0,I.jsx)("button",{type:"button",onClick:i,"aria-label":e,title:e,className:(0,q.cn)("hover:bg-muted/60 flex h-6 w-6 items-center justify-center rounded-sm transition-colors",s?"text-foreground bg-muted/60":"text-muted-foreground hover:text-foreground"),children:r})}let cV=(0,hp.default)(()=>e.A(63812),{loadableGenerated:{modules:[58480]},ssr:!1,loading:()=>(0,I.jsx)("div",{className:"text-muted-foreground flex h-full items-center justify-center text-xs",children:"Loading editor…"})}),cG={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",md:"markdown",mdx:"markdown",css:"css",scss:"scss",html:"html",yml:"yaml",yaml:"yaml",toml:"ini",ini:"ini",sh:"shell",bash:"shell",py:"python",go:"go",rs:"rust",java:"java",sql:"sql",xml:"xml",dockerfile:"dockerfile"};function cZ({applicationId:e,openFiles:i,activePath:r,onSelect:s,onClose:n,onChange:o,onSave:a,onPromote:l,onToggleViewMode:h,sidebarCollapsed:c,onShowSidebar:d}){let u=(0,R.useMemo)(()=>i.find(e=>e.path===r)??null,[i,r]),f="dark"===c$();(0,R.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key)&&(e.preventDefault(),a())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]);let p=(0,R.useCallback)(e=>{u&&o(u.path,e??"")},[u,o]);return(0,I.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,I.jsxs)("div",{role:"tablist","aria-label":"Open files",className:"border-border bg-muted/30 flex h-8 shrink-0 items-center border-b",children:[(0,I.jsx)("div",{className:"flex min-w-0 flex-1 items-center overflow-x-auto",children:0===i.length?(0,I.jsx)("div",{className:"text-muted-foreground px-3 text-[11px]",children:"No file open"}):i.map(e=>{var i;let o,a=e.content!==e.originalContent,h=e.path===r;return(0,I.jsxs)("div",{role:"tab","aria-selected":h,onClick:()=>s(e.path),onDoubleClick:()=>l(e.path),className:(0,q.cn)("group border-border flex h-8 shrink-0 cursor-pointer items-center gap-1.5 border-r px-3 text-[11px]",h?"bg-background text-foreground":"text-muted-foreground hover:bg-muted/60"),title:e.isPreview?`${e.path} — preview (double-click tab or edit to keep open)`:e.path,children:[(0,I.jsx)(hh.default,{className:"h-3 w-3 shrink-0 text-sky-500"}),(0,I.jsx)("span",{className:(0,q.cn)("truncate",e.isPreview&&"italic"),children:-1===(o=(i=e.path).lastIndexOf("/"))?i:i.slice(o+1)}),a?(0,I.jsx)("span",{className:"bg-primary/70 inline-block h-1.5 w-1.5 rounded-full","aria-label":"Unsaved changes"}):null,(0,I.jsx)("button",{type:"button",onClick:i=>{i.stopPropagation(),n(e.path)},className:"text-muted-foreground/70 hover:text-foreground ml-1 rounded-sm p-0.5","aria-label":`Close ${e.path}`,children:(0,I.jsx)(hy.X,{className:"h-3 w-3"})})]},e.path)})}),u?.isMarkdown?(0,I.jsx)("button",{type:"button",onClick:()=>h(u.path),className:"text-muted-foreground hover:text-foreground border-border flex h-8 w-8 shrink-0 items-center justify-center border-l","aria-label":"rendered"===u.viewMode?"Show markdown source":"Show markdown preview",title:"rendered"===u.viewMode?"Show markdown source":"Show markdown preview",children:"rendered"===u.viewMode?(0,I.jsx)(hm.FileCode,{className:"h-3.5 w-3.5"}):(0,I.jsx)(hv.Eye,{className:"h-3.5 w-3.5"})}):null,c?(0,I.jsx)("button",{type:"button",onClick:d,className:"text-muted-foreground hover:text-foreground border-border flex h-8 w-8 shrink-0 items-center justify-center border-l","aria-label":"Show file explorer",title:"Show file explorer",children:(0,I.jsx)(hS,{className:"h-3.5 w-3.5"})}):null]}),(0,I.jsx)("div",{className:(0,q.cn)("min-h-0 flex-1",f?"bg-[#1e1e1e]":"bg-[#ffffff]"),children:u?u.isImage?(0,I.jsx)(cU,{applicationId:e,path:u.path}):u.binary?(0,I.jsx)(cJ,{children:"Binary file — preview not available"}):u.tooLarge?(0,I.jsx)(cJ,{children:"File is too large to preview"}):u.isMarkdown&&"rendered"===u.viewMode?(0,I.jsx)(c0,{source:u.content,isDark:f}):(0,I.jsx)(cV,{height:"100%",theme:f?"vs-dark":"vs",language:function(e){let i=e.split("/").pop()??e;if("dockerfile"===i.toLowerCase())return"dockerfile";let r=i.includes(".")?i.split(".").pop()?.toLowerCase():"";return(r?cG[r]:void 0)??"plaintext"}(u.path),value:u.content,onChange:p,options:{fontSize:13,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"off",renderWhitespace:"selection",smoothScrolling:!0}},u.path):(0,I.jsx)(cJ,{children:"Select a file from the tree to start editing"})})]})}function cJ({children:e}){return(0,I.jsx)("div",{className:"text-muted-foreground flex h-full items-center justify-center text-xs",children:e})}let cQ={h1:({children:e})=>(0,I.jsx)("h1",{className:"border-border text-foreground mt-6 mb-4 border-b pb-2 text-2xl font-semibold",children:e}),h2:({children:e})=>(0,I.jsx)("h2",{className:"border-border text-foreground mt-5 mb-3 border-b pb-1 text-xl font-semibold",children:e}),h3:({children:e})=>(0,I.jsx)("h3",{className:"text-foreground mt-4 mb-2 text-lg font-semibold",children:e}),p:({children:e})=>(0,I.jsx)("p",{className:"my-3",children:e}),a:({children:e,href:i})=>(0,I.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",className:"text-sky-600 underline hover:text-sky-500 dark:text-sky-400 dark:hover:text-sky-300",children:e}),ul:({children:e})=>(0,I.jsx)("ul",{className:"my-3 ml-6 list-disc",children:e}),ol:({children:e})=>(0,I.jsx)("ol",{className:"my-3 ml-6 list-decimal",children:e}),li:({children:e})=>(0,I.jsx)("li",{className:"my-1",children:e}),blockquote:({children:e})=>(0,I.jsx)("blockquote",{className:"border-border text-muted-foreground my-3 border-l-4 pl-4 italic",children:e}),code:({className:e,children:i})=>e?(0,I.jsx)("code",{className:(0,q.cn)("font-mono text-[12px]",e),children:i}):(0,I.jsx)("code",{className:"bg-muted rounded px-1.5 py-0.5 font-mono text-[12px] text-pink-600 dark:text-pink-300",children:i}),pre:({children:e})=>(0,I.jsx)("pre",{className:"border-border bg-muted/60 my-4 overflow-auto rounded-md border p-3",children:e}),hr:()=>(0,I.jsx)("hr",{className:"border-border my-6"}),table:({children:e})=>(0,I.jsx)("table",{className:"border-border my-4 border-collapse border",children:e}),th:({children:e})=>(0,I.jsx)("th",{className:"border-border bg-muted/60 border px-3 py-1 text-left font-semibold",children:e}),td:({children:e})=>(0,I.jsx)("td",{className:"border-border border px-3 py-1",children:e})};function c0({source:e,isDark:i}){return(0,I.jsx)("div",{className:(0,q.cn)("text-foreground h-full overflow-auto px-8 py-6 text-[13px]",i?"bg-[#1e1e1e]":"bg-[#ffffff]"),children:(0,I.jsx)("div",{className:"markdown-preview mx-auto max-w-3xl leading-6",children:(0,I.jsx)(h_.default,{remarkPlugins:[hg.default],components:cQ,children:e})})})}async function c1(e){let i=await fetch(`/api/applications/${e}/files`,{cache:"no-store"});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error??`Failed to load file tree (${i.status})`);return(await i.json()).tree}async function c2(e,i){let r=`/api/applications/${e}/files/content?path=${encodeURIComponent(i)}`,s=await fetch(r,{cache:"no-store"});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error??`Failed to read file (${s.status})`);return await s.json()}async function c5(e,i,r){let s=await fetch(`/api/applications/${e}/files/content`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:r})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error??`Failed to save file (${s.status})`)}let c3=new Set(["png","jpg","jpeg","gif","webp","avif","bmp","ico","svg"]),c6=new Set(["md","mdx","markdown"]);function c4(e){let i=e.split("/").pop()??e,r=i.lastIndexOf(".");return -1===r?"":i.slice(r+1).toLowerCase()}function c8({applicationId:e}){let i=function(e){let[i,r]=(0,R.useState)(null),[s,n]=(0,R.useState)(null),[o,a]=(0,R.useState)(!0),[l,h]=(0,R.useState)([]),[c,d]=(0,R.useState)(null),u=(0,R.useRef)([]);(0,R.useEffect)(()=>{u.current=l},[l]);let f=(0,R.useCallback)(async()=>{try{let i=await c1(e);r(i),n(null)}catch(e){n(e instanceof Error?e.message:String(e))}finally{a(!1)}},[e]);(0,R.useEffect)(()=>{f()},[f]);let p=(0,R.useCallback)(async(i,r)=>{let s=r?.mode??"preview",n=u.current.find(e=>e.path===i);if(n){d(i),"persistent"===s&&n.isPreview&&h(e=>e.map(e=>e.path===i?{...e,isPreview:!1}:e));return}try{if(c3.has(c4(i))){let e={path:i,originalContent:"",content:"",isImage:!0,viewMode:"rendered",isPreview:"preview"===s};h(i=>{if("preview"===s){let r=i.findIndex(e=>e.isPreview);if(-1!==r){let s=i.slice();return s[r]=e,s}}return[...i,e]}),d(i);return}let r=await c2(e,i),n=r.path||i,o=c6.has(c4(n)),a={path:n,originalContent:r.content,content:r.content,tooLarge:r.tooLarge,binary:r.binary,isMarkdown:o,viewMode:o?"rendered":"source",isPreview:"preview"===s};h(e=>{if("preview"===s){let i=e.findIndex(e=>e.isPreview);if(-1!==i){let r=e.slice();return r[i]=a,r}}return[...e,a]}),d(n)}catch(e){L.toast.error("Could not open file",{description:e instanceof Error?e.message:String(e)})}},[e]),_=(0,R.useCallback)(e=>{h(i=>i.map(i=>i.path===e?{...i,isPreview:!1}:i))},[]),g=(0,R.useCallback)(e=>{h(i=>i.map(i=>i.path===e?{...i,viewMode:"rendered"===i.viewMode?"source":"rendered"}:i))},[]),v=(0,R.useCallback)(e=>{h(i=>{let r=i.filter(i=>i.path!==e);return d(s=>{if(s!==e)return s;if(0===r.length)return null;let n=Math.min(i.findIndex(i=>i.path===e),r.length-1);return r[Math.max(0,n)].path}),r})},[]),m=(0,R.useCallback)(e=>{d(e)},[]),S=(0,R.useCallback)((e,i)=>{h(r=>r.map(r=>r.path===e?{...r,content:i,isPreview:!r.isPreview&&r.isPreview}:r))},[]),y=(0,R.useCallback)(async()=>{let i=u.current.find(e=>e.path===c);if(i&&i.content!==i.originalContent)try{await c5(e,i.path,i.content),h(e=>e.map(e=>e.path===i.path?{...e,originalContent:i.content}:e)),L.toast.success("Saved",{description:i.path})}catch(e){L.toast.error("Failed to save",{description:e instanceof Error?e.message:String(e)})}},[e,c]);return(0,R.useEffect)(()=>{let i=new EventSource(`/api/applications/${e}/files/watch`),r=null;return i.addEventListener("change",i=>{try{let s=JSON.parse(i.data);if(r||(r=setTimeout(()=>{r=null,f()},250)),!u.current.some(e=>e.path===s.path)||s.isDirectory)return;if("deleted"===s.kind)return void L.toast.message("File deleted on disk",{description:s.path});(async()=>{try{let i=await c2(e,s.path);h(e=>e.map(e=>e.path!==s.path||e.content!==e.originalContent?e:{...e,originalContent:i.content,content:i.content,tooLarge:i.tooLarge,binary:i.binary}))}catch{}})()}catch{}}),i.onerror=()=>{},()=>{i.close(),r&&clearTimeout(r)}},[e,f]),{tree:i,treeError:s,treeLoading:o,openFiles:l,activePath:c,openFile:p,closeFile:v,selectFile:m,promoteFile:_,updateBuffer:S,toggleViewMode:g,saveActive:y}}(e),[r,s]=(0,R.useState)(260),[n,o]=(0,R.useState)(!1),a=(0,R.useRef)(null),l=(0,R.useRef)(!1),h=(0,R.useCallback)(e=>{e.preventDefault(),l.current=!0,e.currentTarget.setPointerCapture(e.pointerId)},[]),c=(0,R.useCallback)(e=>{if(!l.current||!a.current)return;let i=a.current.getBoundingClientRect();s(Math.max(160,Math.min(i.right-e.clientX,i.width-300)))},[]),d=(0,R.useCallback)(()=>{l.current=!1},[]),u=(0,R.useCallback)(()=>o(!1),[]),f=(0,R.useCallback)(()=>o(!0),[]),p=(0,R.useCallback)((e,r)=>{i.openFile(e,{mode:r})},[i]);return(0,I.jsxs)("div",{ref:a,className:"bg-background flex h-full min-h-0 flex-1","data-testid":"ide-tab",children:[(0,I.jsx)("section",{className:"min-w-0 flex-1",children:(0,I.jsx)(cZ,{applicationId:e,openFiles:i.openFiles,activePath:i.activePath,onSelect:i.selectFile,onClose:i.closeFile,onChange:i.updateBuffer,onSave:i.saveActive,onPromote:i.promoteFile,onToggleViewMode:i.toggleViewMode,sidebarCollapsed:n,onShowSidebar:u})}),!n&&(0,I.jsx)("div",{role:"separator","aria-orientation":"vertical",className:"border-border hover:bg-primary/20 relative w-px shrink-0 cursor-col-resize border-l transition-colors",onPointerDown:h,onPointerMove:c,onPointerUp:d,children:(0,I.jsx)("span",{className:"absolute inset-y-0 -right-1 -left-1"})}),!n&&(0,I.jsxs)("aside",{className:"border-border flex min-h-0 shrink-0 flex-col border-l",style:{width:r},children:[(0,I.jsxs)("div",{className:"text-muted-foreground border-border bg-muted/30 flex h-8 shrink-0 items-center justify-between border-b px-2 text-[10px] font-medium tracking-wide uppercase",children:[(0,I.jsx)("span",{children:"Explorer"}),(0,I.jsx)("button",{type:"button",onClick:f,className:"text-muted-foreground hover:text-foreground -mr-1 flex h-6 w-6 items-center justify-center rounded-sm","aria-label":"Hide file explorer",title:"Hide file explorer",children:(0,I.jsx)(nB,{className:"h-3.5 w-3.5"})})]}),(0,I.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:(0,I.jsx)(hf,{tree:i.tree,loading:i.treeLoading,error:i.treeError,activePath:i.activePath,onOpenFile:p})})]})]})}var c7=e.i(24042),c9=e.i(83428),de=e.i(70002);function dt({deploy:e,className:i,variant:r="full"}){let s=(0,R.useCallback)(()=>{e.url&&window.open(e.url,"_blank","noopener,noreferrer")},[e.url]);if(e.status===Y.DeploymentState.Booting||e.deployLoading)return(0,I.jsxs)("button",{type:"button",onClick:e.stop,disabled:e.stopLoading,className:(0,q.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-amber-500/40 bg-amber-500/10 px-2 text-[11px] font-medium text-amber-600 transition-colors hover:bg-amber-500/20 dark:text-amber-400",i),title:"Dev server is starting — click to stop","aria-label":"Stop starting dev server",children:[(0,I.jsx)(c9.Loader2,{className:"h-3 w-3 animate-spin"}),(0,I.jsx)("span",{children:"Starting…"})]});if(e.status===Y.DeploymentState.Ready&&e.url&&"compact"===r)return(0,I.jsx)("button",{type:"button",onClick:e.stop,disabled:e.stopLoading,className:(0,q.cn)("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-red-500/30 bg-red-500/5 text-red-600 transition-colors hover:border-red-500/60 hover:bg-red-500/15 dark:text-red-400",i),title:"Stop dev server","aria-label":"Stop dev server",children:e.stopLoading?(0,I.jsx)(c9.Loader2,{className:"h-3 w-3 animate-spin"}):(0,I.jsx)(cz.Square,{className:"h-3 w-3 fill-current"})});if(e.status===Y.DeploymentState.Ready&&e.url){let r=e.url.replace(/^https?:\/\//,"");return(0,I.jsxs)("div",{className:(0,q.cn)("inline-flex h-7 shrink-0 items-stretch overflow-hidden rounded-md border border-violet-500/40 bg-violet-500/10 text-[11px] font-medium text-violet-700 dark:text-violet-300",i),children:[(0,I.jsxs)("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 px-2 font-mono transition-colors hover:bg-violet-500/20",title:`Open ${e.url}`,"aria-label":`Open dev server at ${e.url}`,children:[(0,I.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,I.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-violet-400 opacity-60"}),(0,I.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-violet-500"})]}),(0,I.jsx)("span",{className:"truncate",children:r}),(0,I.jsx)(cI.ExternalLink,{className:"h-3 w-3 opacity-60"})]}),(0,I.jsx)("span",{className:"w-px bg-violet-500/30","aria-hidden":!0}),(0,I.jsx)("button",{type:"button",onClick:e.stop,disabled:e.stopLoading,className:"inline-flex items-center justify-center px-1.5 text-red-600 transition-colors hover:bg-red-500/20 dark:text-red-400",title:"Stop dev server","aria-label":"Stop dev server",children:e.stopLoading?(0,I.jsx)(c9.Loader2,{className:"h-3 w-3 animate-spin"}):(0,I.jsx)(cz.Square,{className:"h-3 w-3 fill-current"})})]})}return e.deployError?(0,I.jsxs)("button",{type:"button",onClick:e.deploy,className:(0,q.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-red-500/40 bg-red-500/10 px-2 text-[11px] font-medium text-red-600 transition-colors hover:bg-red-500/20 dark:text-red-400",i),title:e.deployError,"aria-label":"Retry starting dev server",children:[(0,I.jsx)(de.TriangleAlert,{className:"h-3 w-3"}),(0,I.jsx)("span",{children:"Retry"})]}):(0,I.jsxs)("button",{type:"button",onClick:e.deploy,className:(0,q.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-violet-500/50 bg-gradient-to-br from-indigo-500/15 to-violet-500/20 px-2.5 text-[11px] font-medium text-violet-700 transition-colors hover:from-indigo-500/25 hover:to-violet-500/30 dark:text-violet-300",i),title:"Install dependencies and preview the app","aria-label":"Preview app",children:[(0,I.jsx)(c7.Play,{className:"h-3 w-3 fill-current"}),(0,I.jsx)("span",{children:"Preview"})]})}var di=e.i(32494);function dr({deploy:e}){let i=(0,R.useCallback)(()=>{e.url&&window.open(e.url,"_blank","noopener,noreferrer")},[e.url]);return e.status===Y.DeploymentState.Ready&&e.url?(0,I.jsxs)("div",{className:"bg-background flex min-h-0 flex-1 flex-col",children:[(0,I.jsxs)("div",{className:"border-border bg-muted/70 text-foreground flex h-8 shrink-0 items-center gap-2 border-b px-2 text-[11px] dark:bg-neutral-900",children:[(0,I.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,I.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),(0,I.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-emerald-500"})]}),(0,I.jsx)("span",{className:"text-foreground/90 truncate font-mono",children:e.url}),(0,I.jsx)("div",{className:"flex-1"}),(0,I.jsxs)("button",{type:"button",onClick:i,className:"text-muted-foreground hover:text-foreground hover:bg-background/60 inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors dark:hover:bg-neutral-800",title:"Open in a new browser tab",children:[(0,I.jsx)(cI.ExternalLink,{className:"h-3 w-3"}),(0,I.jsx)("span",{children:"Open"})]})]}),(0,I.jsx)("iframe",{src:e.url,className:"min-h-0 w-full flex-1 border-0 bg-white",title:"Application preview"},e.url)]}):e.status===Y.DeploymentState.Booting||e.deployLoading?(0,I.jsx)(ds,{icon:(0,I.jsx)(c9.Loader2,{className:"text-muted-foreground h-8 w-8 animate-spin"}),title:"Starting dev server…",description:"Installing dependencies and booting the app. This can take a minute on the first run."}):e.deployError?(0,I.jsx)(ds,{icon:(0,I.jsx)(de.TriangleAlert,{className:"h-8 w-8 text-red-500"}),title:"Failed to start dev server",description:e.deployError,actionLabel:"Retry",onAction:e.deploy}):(0,I.jsx)(ds,{icon:(0,I.jsx)(di.Globe,{className:"text-muted-foreground h-8 w-8"}),title:"No dev server running",description:"Click Preview to install dependencies and start the app. The preview will appear here.",actionLabel:"Preview",actionIcon:(0,I.jsx)(c7.Play,{className:"h-3.5 w-3.5 fill-current"}),onAction:e.deploy})}function ds({icon:e,title:i,description:r,actionLabel:s,actionIcon:n,onAction:o}){return(0,I.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:(0,I.jsxs)("div",{className:"flex max-w-sm flex-col items-center gap-3 text-center",children:[e,(0,I.jsx)("h3",{className:"text-foreground text-sm font-semibold",children:i}),(0,I.jsx)("p",{className:"text-muted-foreground text-xs leading-relaxed",children:r}),s&&o?(0,I.jsxs)("button",{type:"button",onClick:o,className:"mt-2 inline-flex h-8 items-center gap-1.5 rounded-md border border-violet-500/50 bg-gradient-to-br from-indigo-500/15 to-violet-500/20 px-3 text-xs font-medium text-violet-700 transition-colors hover:from-indigo-500/25 hover:to-violet-500/30 dark:text-violet-300",children:[n,(0,I.jsx)("span",{children:s})]}):null]})})}var dn=e.i(8537),da=e.i(80554),dl=e.i(98440),dh=e.i(35094),dc=e.i(21023);let dd=(0,dc.createServerReference)("40f91c50f5dac7021d5ceb2486c068765fbb6ac789",dc.callServer,void 0,dc.findSourceMapURL,"getApplicationDebugPrompt");var du=e.i(96886);let df=["ide","terminal","web"],dp={ide:"IDE",terminal:"Terminal",web:"Web"};function d_({application:e,activeView:i,onViewChange:r,onBack:s,initialChatState:n,deploy:o}){return(0,I.jsxs)("header",{className:(0,q.cn)("bg-background/95 supports-[backdrop-filter]:bg-background/70 sticky top-0 z-20 flex shrink-0 items-center gap-2 border-b px-3 backdrop-blur","h-11"),children:[(0,I.jsx)(X.Button,{variant:"ghost",size:"icon","aria-label":"Back to canvas",onClick:s,className:"h-7 w-7",children:(0,I.jsx)(A,{className:"h-3.5 w-3.5"})}),(0,I.jsx)("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-gradient-to-br from-indigo-500 to-violet-500",children:(0,I.jsx)(j.LayoutGrid,{className:"h-3 w-3 text-white"})}),(0,I.jsx)("h1",{className:"min-w-0 truncate text-sm font-semibold",children:e.name}),(0,I.jsx)(dy,{applicationId:e.id,persistedStatus:e.status,deployReady:o.status===Y.DeploymentState.Ready}),(0,I.jsx)(db,{}),(0,I.jsx)(dg,{repositoryPath:e.repositoryPath}),(0,I.jsx)("div",{className:"flex-1"}),(0,I.jsx)(dm,{featureId:`app-${e.id}`,initialChatState:n}),(0,I.jsx)(dS,{applicationId:e.id}),(0,I.jsx)(dt,{deploy:o}),(0,I.jsx)(dw,{active:i,onChange:r})]})}function dg({repositoryPath:e}){let i,r,s=(0,R.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),L.toast.success("Path copied",{description:e})}catch{L.toast.error("Failed to copy path")}},[e]),n=(0,R.useCallback)(async()=>{let i=await (0,dh.openFolder)(e);i.success||L.toast.error("Could not open folder",{description:i.error})},[e]);return(0,I.jsxs)("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5 text-xs",children:[(0,I.jsx)("span",{className:"truncate font-mono text-[11px]",title:e,children:-1===(r=(i=e.replace(/\\/g,"/").replace(/\/+$/,"")).lastIndexOf("/"))?i:i.slice(r+1)}),(0,I.jsx)(X.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-foreground h-5 w-5",onClick:s,"aria-label":"Copy path",title:"Copy path",children:(0,I.jsx)(W.Copy,{className:"h-3 w-3"})}),(0,I.jsx)(X.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-foreground h-5 w-5",onClick:n,"aria-label":"Open in file manager",title:"Open in file manager",children:(0,I.jsx)(z.FolderOpen,{className:"h-3 w-3"})}),(0,I.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,I.jsx)(dv,{repositoryPath:e})]})}function dv({repositoryPath:e}){let{data:i}=(0,N.useQuery)({queryKey:["git-repo-info",e],queryFn:()=>(0,du.getGitRepoInfo)(e,1),enabled:!!e,refetchInterval:5e3,refetchOnWindowFocus:!0,staleTime:2e3}),r=i?.currentBranch?.trim(),s=r&&r.length>0?r:"main",n=i?.workingTree.untracked??0,o=i?.workingTree.modified??0,a=i?.diffStats?.insertions??0,l=i?.diffStats?.deletions??0,h=n>0||o>0,c=(0,R.useCallback)(()=>{L.toast.info("Commit (not wired up yet)",{description:`Would commit ${o} edited / ${n} added file(s) on ${s}`})},[n,o,s]),d=(0,R.useCallback)(()=>{L.toast.info("Commit & Push (not wired up yet)",{description:`Would commit and push ${o} edited / ${n} added file(s) on ${s}`})},[n,o,s]);return(0,I.jsxs)("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[(0,I.jsxs)("span",{className:"flex items-center gap-1",title:`Branch: ${s}`,children:[(0,I.jsx)(H.GitBranch,{className:"h-3 w-3"}),s]}),n>0?(0,I.jsxs)("span",{className:"flex items-center gap-0.5 text-emerald-500",title:`${n} added ${1===n?"file":"files"}`,children:[(0,I.jsx)(K.FilePlus,{className:"h-3 w-3"}),n]}):null,o>0?(0,I.jsxs)("span",{className:"flex items-center gap-0.5 text-amber-500",title:`${o} edited ${1===o?"file":"files"}`,children:[(0,I.jsx)(U.default,{className:"h-3 w-3"}),o]}):null,a>0||l>0?(0,I.jsxs)("span",{className:"flex items-center gap-1",title:`${a} insertions, ${l} deletions vs HEAD`,children:[a>0?(0,I.jsxs)("span",{className:"text-emerald-500",children:["+",a]}):null,l>0?(0,I.jsxs)("span",{className:"text-rose-500",children:["-",l]}):null]}):null,h?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("button",{type:"button",onClick:c,className:"border-border bg-background text-foreground hover:bg-muted inline-flex h-6 shrink-0 items-center gap-1 rounded-md border px-2 text-[11px] font-medium transition-colors",title:"Commit working tree changes",children:"Commit"}),(0,I.jsx)("button",{type:"button",onClick:d,className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-md border border-indigo-500/40 bg-indigo-500/10 px-2 text-[11px] font-medium text-indigo-600 transition-colors hover:bg-indigo-500/20 dark:text-indigo-400",title:"Commit and push to remote",children:"Commit & Push"})]}):null]})}function dm({featureId:e,initialChatState:i}){let{data:r}=(0,N.useQuery)({queryKey:(0,dl.chatQueryKey)(e),queryFn:()=>(0,dl.fetchChatState)(e),initialData:i,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),s=r?.sessionInfo,n=s?.sessionId??null,o=s?.model??null,a=n?n.slice(0,8):null,l=(0,R.useCallback)(async()=>{if(n)try{await navigator.clipboard.writeText(n),L.toast.success("Session ID copied",{description:n})}catch{L.toast.error("Failed to copy session id")}},[n]);return(0,I.jsxs)("button",{type:"button",onClick:l,disabled:!n,className:(0,q.cn)("border-border/60 bg-muted/40 text-muted-foreground inline-flex h-6 shrink-0 items-center gap-1.5 rounded-md border px-2 font-mono text-[10px] transition-colors",n?"hover:bg-muted hover:text-foreground cursor-pointer":"cursor-default opacity-60"),title:n?`Click to copy full session id: ${n}`:"No session yet","aria-label":n?"Copy session id":"No active session",children:[(0,I.jsx)($.Cpu,{className:"h-3 w-3 opacity-60"}),(0,I.jsx)("span",{className:"font-medium",children:o??"agent"}),(0,I.jsx)("span",{className:"text-muted-foreground/50",children:"·"}),(0,I.jsx)("span",{children:a??"—"})]})}function dS({applicationId:e}){let[i,r]=(0,R.useState)(!1),s=(0,R.useCallback)(async()=>{if(!i){r(!0);try{let i=await dd(e);if(i.error||!i.combined)return void L.toast.error("Failed to build prompt",{description:i.error});await navigator.clipboard.writeText(i.combined);let r=i.systemPrompt?.length??0,s=i.userMessage?.length??0;L.toast.success("Prompt copied to clipboard",{description:`${r} chars system + ${s} chars user`})}catch(e){L.toast.error("Failed to copy prompt",{description:e instanceof Error?e.message:String(e)})}finally{r(!1)}}},[e,i]);return(0,I.jsx)(X.Button,{variant:"ghost",size:"icon",onClick:s,disabled:i,className:"text-muted-foreground hover:text-foreground h-7 w-7","aria-label":"Copy full generated prompt (debug)",title:"Copy full generated prompt (debug) — system + user message",children:(0,I.jsx)(F.ClipboardList,{className:"h-3.5 w-3.5"})})}function dy({applicationId:e,persistedStatus:i,deployReady:r}){let s=(0,da.useTurnStatus)(`app-${e}`),n="processing"===s?{label:"In Progress",dotClass:"bg-violet-500",pulse:!0}:"awaiting_input"===s?{label:"Warning",dotClass:"bg-amber-500",pulse:!0}:r?{label:"Live",dotClass:"bg-emerald-500",pulse:!0}:"Error"===i?{label:"Error",dotClass:"bg-red-500",pulse:!1}:{label:"Ready",dotClass:"bg-sky-500",pulse:!1};return(0,I.jsxs)("span",{className:"border-border/60 inline-flex h-5 shrink-0 items-center gap-1 rounded-full border px-2 text-[10px] font-medium tracking-wide uppercase",children:[(0,I.jsx)("span",{className:(0,q.cn)("relative flex h-1.5 w-1.5 items-center justify-center rounded-full",n.dotClass),children:n.pulse?(0,I.jsx)("span",{className:(0,q.cn)("absolute inline-flex h-full w-full animate-ping rounded-full opacity-60",n.dotClass)}):null}),n.label]})}function db(){return(0,I.jsx)("span",{className:"bg-border/60 mx-1 h-4 w-px shrink-0"})}function dw({active:e,onChange:i}){return(0,I.jsx)("div",{role:"tablist","aria-label":"Right pane view",className:"bg-muted/60 flex items-center rounded-md p-0.5",children:df.map(r=>{let s=r===e;return(0,I.jsx)("button",{type:"button",role:"tab","aria-selected":s,onClick:()=>i(r),className:(0,q.cn)("h-6 cursor-pointer rounded-sm px-2.5 text-[11px] font-medium transition-colors",s?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:dp[r]},r)})})}function dC({left:e,right:i}){let r=(0,R.useRef)(null),[s,n]=(0,R.useState)(.4),o=(0,R.useRef)(!1),a=(0,R.useCallback)(e=>{e.preventDefault(),o.current=!0,e.currentTarget.setPointerCapture(e.pointerId)},[]),l=(0,R.useCallback)(e=>{if(!o.current||!r.current)return;let i=r.current.getBoundingClientRect(),s=i.width;n(Math.max(400,Math.min(e.clientX-i.left,s-400))/s)},[]),h=(0,R.useCallback)(()=>{o.current=!1},[]);return(0,I.jsxs)("div",{ref:r,className:"flex min-h-0 flex-1",children:[(0,I.jsx)("div",{className:"flex min-h-0 flex-col overflow-hidden",style:{flexBasis:`${100*s}%`,flexShrink:0},children:e}),(0,I.jsx)("div",{role:"separator","aria-orientation":"vertical",className:"group border-border hover:bg-primary/20 relative w-px shrink-0 cursor-col-resize border-l transition-colors",onPointerDown:a,onPointerMove:l,onPointerUp:h,children:(0,I.jsx)("span",{className:"absolute inset-y-0 -right-1 -left-1"})}),(0,I.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:i})]})}function dx({activeView:e,applicationId:i,terminalCwd:r,deploy:s}){let n=s.status===Y.DeploymentState.Ready||s.status===Y.DeploymentState.Booting||s.deployLoading||!!s.deployError;return(0,I.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,I.jsx)("div",{className:(0,q.cn)("absolute inset-0 flex min-h-0 flex-col","terminal"===e?"visible":"pointer-events-none invisible"),"aria-hidden":"terminal"!==e,children:(0,I.jsx)(nL,{cwd:r})}),(0,I.jsx)("div",{className:(0,q.cn)("absolute inset-0 flex min-h-0 flex-col","ide"===e?"visible":"pointer-events-none invisible"),"aria-hidden":"ide"!==e,children:(0,I.jsx)(c8,{applicationId:i})}),n?(0,I.jsx)("div",{className:(0,q.cn)("absolute inset-0 flex min-h-0 flex-col","web"===e?"visible":"pointer-events-none invisible"),"aria-hidden":"web"!==e,children:(0,I.jsx)(dr,{deploy:s})}):"web"===e&&(0,I.jsx)(dr,{deploy:s})]})}function dk({application:e,initialChatState:i}){let r=(0,M.useRouter)(),[s,n]=(0,R.useState)("ide"),o=(0,dn.useDeployAction)({targetId:e.id,targetType:"application",repositoryPath:e.repositoryPath}),a=(0,R.useRef)(!1);(0,R.useEffect)(()=>{o.status===Y.DeploymentState.Ready&&o.url&&!a.current&&(a.current=!0,n("web")),o.status!==Y.DeploymentState.Ready&&(a.current=!1)},[o.status,o.url]);let l=(0,R.useCallback)(()=>{r.push("/"),r.refresh()},[r]);return(0,I.jsxs)("div",{className:"bg-background flex h-dvh flex-col",children:[(0,I.jsx)(d_,{application:e,activeView:s,onViewChange:n,onBack:l,initialChatState:i,deploy:o}),(0,I.jsx)(dC,{left:(0,I.jsx)(V.ChatTab,{featureId:`app-${e.id}`,worktreePath:e.repositoryPath,initialAgent:e.agentType,initialModel:e.modelOverride,initialChatState:i,hideHeader:!0,workflowPlaceholder:G,onAllStepsComplete:()=>{o.status===Y.DeploymentState.Ready||o.status===Y.DeploymentState.Booting||o.deployLoading||o.deploy()}}),right:(0,I.jsx)(dx,{activeView:s,applicationId:e.id,terminalCwd:e.repositoryPath,deploy:o})})]})}e.s(["ApplicationPage",()=>dk],97687)}]);
19
+ Use the data prop if you want to provide your own handlers.`);if(!e.initialData)return e;{let[i,r]=function(e){let[i,r]=(0,R.useState)(e),s=(0,R.useMemo)(()=>new hi(i),[i]);return[i,{onMove:e=>{for(let i of e.dragIds)s.move({id:i,parentId:e.parentId,index:e.index});r(s.data)},onRename:({name:e,id:i})=>{s.update({id:i,changes:{name:e}}),r(s.data)},onCreate:({parentId:e,index:i,type:n})=>{let o={id:`simple-tree-id-${hn++}`,name:""};return"internal"===n&&(o.children=[]),s.create({parentId:e,index:i,data:o}),r(s.data),o},onDelete:e=>{e.ids.forEach(e=>s.drop({id:e})),r(s.data)}}]}(e.initialData);return Object.assign(Object.assign(Object.assign({},e),r),{data:i})}}(e);return(0,I.jsxs)(l8,{treeProps:r,imperativeHandle:i,children:[(0,I.jsx)(l7,{children:(0,I.jsx)(l9,{})}),(0,I.jsx)(ht,{})]})});var ha=e.i(99105),hl=e.i(76016),hh=e.i(76505),hh=hh;let hc=(0,B.default)("folder-closed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]),hd={current:null};function hu({node:e,style:i}){let r=e.data.isDirectory,s=e.isOpen;return(0,I.jsxs)("div",{style:i,className:(0,q.cn)("flex h-6 cursor-pointer items-center gap-1 rounded-sm px-1 text-[12px] select-none",e.isSelected?"bg-primary/10 text-foreground":"text-muted-foreground hover:bg-muted/60"),onMouseDown:i=>{if(0===i.button){if(r)return void e.toggle();e.select(),hd.current?.onOpenFile(e.data.path,"preview")}},onDoubleClick:i=>{r||(i.preventDefault(),hd.current?.onOpenFile(e.data.path,"persistent"))},children:[r?s?(0,I.jsx)(ha.ChevronDown,{className:"h-3 w-3 shrink-0"}):(0,I.jsx)(hl.ChevronRight,{className:"h-3 w-3 shrink-0"}):(0,I.jsx)("span",{className:"inline-block w-3 shrink-0"}),r?s?(0,I.jsx)(z.FolderOpen,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}):(0,I.jsx)(hc,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}):(0,I.jsx)(hh.default,{className:"h-3.5 w-3.5 shrink-0 text-sky-500"}),(0,I.jsx)("span",{className:"truncate",children:e.data.name})]})}function hf({tree:e,loading:i,error:r,activePath:s,onOpenFile:n}){let o=(0,R.useMemo)(()=>(function e(i){return i?i.map(i=>({id:i.path||i.name,name:i.name,isDirectory:i.isDirectory,path:i.path,children:i.isDirectory?e(i.children):void 0})):[]})(e?.children),[e]),a=(0,R.useRef)(null),l=(0,R.useRef)(null),[h,c]=(0,R.useState)({w:280,h:400});return((0,R.useEffect)(()=>(hd.current={onOpenFile:n},()=>{hd.current?.onOpenFile===n&&(hd.current=null)}),[n]),(0,R.useEffect)(()=>{let e=l.current;if(!e)return;let i=new ResizeObserver(e=>{let i=e[0]?.contentRect;i&&c({w:Math.floor(i.width),h:Math.floor(i.height)})});return i.observe(e),()=>i.disconnect()},[]),i&&!e)?(0,I.jsx)("div",{className:"text-muted-foreground flex h-full items-center justify-center text-xs",children:"Loading files…"}):r?(0,I.jsx)("div",{className:"text-destructive flex h-full items-center justify-center p-2 text-center text-xs",children:r}):e?(0,I.jsx)("div",{ref:l,className:"h-full w-full overflow-hidden",children:(0,I.jsx)(ho,{ref:a,data:o,openByDefault:!1,width:h.w,height:h.h,rowHeight:24,indent:12,padding:4,selection:s??void 0,children:hu})}):null}var hp=e.i(47901),h_=e.i(427),hg=e.i(12878),hv=e.i(87889),hm=e.i(86076),hh=hh;let hS=(0,B.default)("panel-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);var hy=e.i(60253),hb=function(e,i){return Number(e.toFixed(i))},hw=function(e,i,r){r&&"function"==typeof r&&r(e,i)},hC={easeOut:function(e){return-Math.cos(e*Math.PI)/2+.5},linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:-1+(4-2*e)*e},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}},hx=function(e){"number"==typeof e&&cancelAnimationFrame(e)},hk=function(e){e.mounted&&(hx(e.animation),e.isAnimating=!1,e.animation=null,e.velocity=null)};function hE(e,i,r,s){if(e.mounted){var n=new Date().getTime();hk(e),e.animation=function(){if(!e.mounted)return hx(e.animation);var o=new Date().getTime()-n,a=(0,hC[i])(o/r);o>=r?(s(1),e.animation=null):e.animation&&(s(a),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function hD(e,i,r,s){var n,o,a,l=(n=i.scale,o=i.positionX,a=i.positionY,!(Number.isNaN(n)||Number.isNaN(o)||Number.isNaN(a)));if(e.mounted&&l){var h=e.setState,c=e.state,d=c.scale,u=c.positionX,f=c.positionY,p=i.scale-d,_=i.positionX-u,g=i.positionY-f;0===r?h(i.scale,i.positionX,i.positionY):hE(e,s,r,function(i){1!==i?e.isAnimating=!0:e.isAnimating=!1,h(d+p*i,u+_*i,f+g*i)})}}var hO=function(e,i,r,s,n,o,a){var l=e>i?r*(a?.5:1):0,h=s>n?o*(a?.5:1):0;return{minPositionX:e-i-l,maxPositionX:l,minPositionY:s-n-h,maxPositionY:h,scaleWidthFactor:l,scaleHeightFactor:h}},hT=function(e,i){var r,s,n,o,a,l,h=e.wrapperComponent,c=e.contentComponent,d=e.setup,u=d.centerZoomedOut,f=d.disablePadding;if(!h||!c)throw Error("Components are not mounted");var p=(r=h.offsetWidth,s=h.offsetHeight,n=c.offsetWidth,o=c.offsetHeight,{wrapperWidth:r,wrapperHeight:s,newContentWidth:a=n*i,newDiffWidth:r-a,newContentHeight:l=o*i,newDiffHeight:s-l}),_=p.wrapperWidth,g=p.wrapperHeight,v=p.newContentWidth,m=p.newContentHeight,S=hO(_,v,p.newDiffWidth,g,m,p.newDiffHeight,!!u),y=_>=v&&g>=m;f&&y&&!u&&(S.minPositionX=0,S.maxPositionX=0,S.minPositionY=0,S.maxPositionY=0);var b=e.setup,w=b.minPositionX,C=b.maxPositionX,x=b.minPositionY,k=b.maxPositionY;return null!=w&&(S.minPositionX=_*(1-i)+w*i),null!=C&&(S.maxPositionX=C*i),null!=x&&(S.minPositionY=g*(1-i)+x*i),null!=k&&(S.maxPositionY=k*i),S},hP=function(e,i,r,s){return s?e<i?hb(i,2):e>r?hb(r,2):hb(e,2):hb(e,2)},hI=function(e,i){var r=hT(e,i);return e.bounds=r,r};function hR(e,i,r,s,n,o,a){var l=r.minPositionX,h=r.minPositionY,c=r.maxPositionX,d=r.maxPositionY,u=0,f=0;return a&&(u=n,f=o),{x:hP(e,l-u,c+u,s),y:hP(i,h-f,d+f,s)}}function hM(e,i,r,s,n,o){var a=e.state,l=a.scale,h=a.positionX,c=a.positionY,d=s-l;return"number"!=typeof i||"number"!=typeof r?(console.error("Mouse X and Y position were not provided!"),{x:h,y:c}):hR(h-i*d,c-r*d,n,o,0,0,null)}function hN(e,i,r,s,n){var o=n?s:0,a=Math.max(i-o,1e-7),l=r+o;return!Number.isNaN(r)&&e>=l?l:!Number.isNaN(i)&&e<=a?a:Math.max(e,1e-7)}var hL=function(e,i){var r=e.setup.panning.excluded,s=e.isInitialized,n=e.wrapperComponent,o=i.target,a="shadowRoot"in o&&"composedPath"in i?i.composedPath().some(function(e){return e instanceof Element&&(null==n?void 0:n.contains(e))}):null==n?void 0:n.contains(o);return!(!(s&&o&&a)||ce(o,r))&&"true"!==o.getAttribute("draggable")&&"true"!==o.getAttribute("contenteditable")&&!o.isContentEditable},hB=function(e){var i=e.isInitialized,r=e.isPanning,s=e.setup.panning.disabled;return!!(i&&r&&!s)},hA=function(e,i){var r=e.state,s=r.positionX,n=r.positionY;e.isPanning=!0,e.startCoords={x:i.clientX-s,y:i.clientY-n}},hj=function(e,i){var r=i.touches,s=e.state,n=s.positionX,o=s.positionY;e.isPanning=!0,1===r.length&&(e.startCoords={x:r[0].clientX-n,y:r[0].clientY-o})};function hH(e,i,r,s,n){var o=e.setup.limitToBounds,a=e.wrapperComponent,l=e.bounds,h=e.state,c=h.scale,d=h.positionX,u=h.positionY;if(null!==a&&null!==l&&(i!==d||r!==u)){var f=hR(i,r,l,o,s,n,a),p=f.x,_=f.y;e.setState(c,p,_)}}var hW=function(e,i,r){var s=e.startCoords,n=e.state,o=e.setup.panning,a=o.lockAxisX,l=o.lockAxisY,h=n.positionX,c=n.positionY;if(!s)return{x:h,y:c};var d=i-s.x,u=r-s.y;return{x:a?h:d,y:l?c:u}},hz=function(e,i,r){var s=e.setup,n=e.state,o=s.minScale,a=s.disablePadding,l=s.centerZoomedOut,h=null!=r?r:n.scale;return i>0&&h>=o&&!a&&!l?i:0};(E=P||(P={})).TRACK_PAD="track_pad",E.MOUSE="mouse",E.TOUCH="touch";var hF=function(e){var i=e.mounted,r=e.wrapperComponent,s=e.contentComponent,n=e.setup,o=n.disabled,a=n.velocityAnimation,l=n.limitToBounds,h=e.state.scale;return!a.disabled&&!o&&!!i&&!!r&&!!s&&(!l||r.offsetWidth<s.offsetWidth*h||r.offsetHeight<s.offsetHeight*h)},h$=function(e){var i=e.mounted,r=e.velocity,s=e.bounds,n=e.setup,o=n.disabled;return!!(!n.velocityAnimation.disabled&&!o&&i)&&!!r&&!!s};function hK(e,i,r,s,n,o,a,l,h,c){if(n){if(i>a&&r>a){var d=a+(e-a)*c;return d>h?h:d<a?a:d}if(i<o&&r<o){var d=o+(e-o)*c;return d<l?l:d>o?o:d}}return s?i:hP(e,o,a,n)}var hU=function(e,i,r){var s=e*r;return Number.isNaN(s)?0:e<0?Math.max(s,-i):Math.min(s,i)};function hY(e,i){var r=e.state,s=r.scale;e.panStartPosition={x:r.positionX,y:r.positionY},hk(e),hI(e,s),void 0!==window.TouchEvent&&i instanceof TouchEvent?hj(e,i):hA(e,i)}function hq(e,i){var r=e.state.scale,s=e.setup,n=s.minScale,o=s.autoAlignment,a=o.disabled,l=o.sizeX,h=o.sizeY,c=o.animationTime,d=o.animationType;if(!(a||r<n||!l&&!h)){var u=function(e){var i=e.state,r=i.positionX,s=i.positionY,n=i.scale,o=e.setup,a=o.disabled,l=o.limitToBounds,h=o.centerZoomedOut,c=e.wrapperComponent;if(!a&&c&&e.bounds){var d=e.bounds,u=d.maxPositionX,f=d.minPositionX,p=d.maxPositionY,_=d.minPositionY,g=r>u?c.offsetWidth:e.setup.minPositionX||0,v=s>p?c.offsetHeight:e.setup.minPositionY||0,m=hM(e,g,v,n,e.bounds,l||h),S=m.x,y=m.y;return{scale:n,positionX:r>u||r<f?S:r,positionY:s>p||s<_?y:s}}}(e);u&&hD(e,u,null!=i?i:c,d)}}function hX(e,i,r,s){var n=e.startCoords,o=e.setup.autoAlignment,a=o.sizeX,l=o.sizeY;if(n){var h=hW(e,i,r),c=h.x,d=h.y,u=hz(e,a),f=hz(e,l);!function(e,i,r){var s,n;if(hF(e)){var o=e.lastMousePosition,a=e.velocityTime,l=e.setup,h=e.wrapperComponent,c=l.velocityAnimation,d=c.maxStrengthMouse,u=c.maxStrengthTouch,f=c.sensitivityTouch,p=c.sensitivityMouse,_=Date.now();if(o&&a&&h){var g,v=Number.isNaN(g=h.offsetWidth/window.innerWidth)?1:Math.min(1,g),m=((s={})[P.TOUCH]=f,s[P.MOUSE]=p,s)[r],S=((n={})[P.TOUCH]=u,n[P.MOUSE]=d,n)[r],y=i.x-o.x,b=i.y-o.y;e.velocity={velocityX:hU(y/v,S,m),velocityY:hU(b/v,S,m),total:hU(Math.sqrt(y*y+b*b)/(_-a),S,m)}}e.lastMousePosition=i,e.velocityTime=_}}(e,{x:c,y:d},s),hH(e,c,d,u,f)}}function hV(e,i,r,s){var n=e.setup,o=n.minScale,a=n.maxScale,l=n.limitToBounds,h=hN(hb(i,2),o,a,0,!1),c=hI(e,h),d=hM(e,r,s,h,c,l);return{scale:h,positionX:d.x,positionY:d.y}}function hG(e,i,r){var s=e.state.scale,n=e.wrapperComponent,o=e.setup,a=o.minScale,l=o.maxScale,h=o.limitToBounds,c=o.zoomAnimation,d=c.disabled,u=c.animationTime,f=c.animationType,p=s>=a&&s<=l;if((s>=1||h)&&hq(e),!(d||p)&&n&&e.mounted){var _=hV(e,s<a?a:l,i||n.offsetWidth/2,r||n.offsetHeight/2);_&&hD(e,_,u,f)}}var hZ=function(){return(hZ=Object.assign||function(e){for(var i,r=1,s=arguments.length;r<s;r++)for(var n in i=arguments[r])Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);return e}).apply(this,arguments)};function hJ(e,i,r){if(r||2==arguments.length)for(var s,n=0,o=i.length;n<o;n++)!s&&n in i||(s||(s=Array.prototype.slice.call(i,0,n)),s[n]=i[n]);return e.concat(s||Array.prototype.slice.call(i))}"function"==typeof SuppressedError&&SuppressedError;var hQ={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,disablePadding:!1,smooth:!0,detached:!1,wheel:{step:.015,disabled:!1,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},trackPadPanning:{disabled:!0,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,allowLeftClickPan:!0,allowMiddleClickPan:!0,allowRightClickPan:!0,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,allowPanning:!0,excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},autoAlignment:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivityMouse:1,sensitivityTouch:1.2,maxStrengthMouse:20,maxStrengthTouch:40,inertia:1,animationTime:300,maxAnimationTime:800,animationType:"easeOut"}},h0="react-transform-wrapper",h1=function(e){var i,r,s,n,o,a,l,h,c,d=Math.max(null!=(i=e.minScale)?i:hQ.minScale,1e-7),u=null!=(r=e.maxScale)?r:hQ.maxScale,f=Math.min(Math.max(null!=(s=e.initialScale)?s:1,d),u);return{previousScale:f,scale:f,positionX:hP(null!=(n=e.initialPositionX)?n:0,null!=(o=e.minPositionX)?o:-1/0,null!=(a=e.maxPositionX)?a:1/0,null!=e.minPositionX||null!=e.maxPositionX),positionY:hP(null!=(l=e.initialPositionY)?l:0,null!=(h=e.minPositionY)?h:-1/0,null!=(c=e.maxPositionY)?c:1/0,null!=e.minPositionY||null!=e.maxPositionY)}},h2=function(e){var i=hZ({},hQ);return Object.keys(e).forEach(function(r){var s=void 0!==e[r];if(void 0!==hQ[r]&&s){var n=Object.prototype.toString.call(hQ[r]);"[object Object]"===n?i[r]=hZ(hZ({},hQ[r]),e[r]):"[object Array]"===n?i[r]=hJ(hJ([],hQ[r],!0),e[r],!0):i[r]=e[r]}}),i.minScale<=0&&(i.minScale=1e-7),i},h5=function(e,i,r){var s=e.state.scale,n=e.wrapperComponent,o=e.setup,a=o.maxScale,l=o.minScale,h=o.zoomAnimation,c=o.smooth,d=h.size;if(!n)throw Error("Wrapper is not mounted");return hN(hb(c?s*Math.exp(i*r):s+i*r,3),l,a,d,!1)};function h3(e,i,r,s,n){var o,a,l=e.wrapperComponent,h=e.state,c=h.scale,d=h.positionX,u=h.positionY,f=e.setup.zoomAnimation;if(!l)return console.error("No WrapperComponent found");var p=f.disabled?0:s,_=l.offsetWidth,g=l.offsetHeight,v=h5(e,i,r),m=hV(e,v,(_/2-d)/c,(g/2-u)/c);if(!m)return console.error("Error during zoom event. New transformation state was not calculated.");var S=e.props,y=S.onZoomStart,b=S.onZoom,w=S.onZoomStop,C=new MouseEvent("mousemove",{bubbles:!0}),x=h8(e);hw(x,C,y),hw(x,C,b),hD(e,m,p,n);var k=null!=(a=null==(o=l.ownerDocument)?void 0:o.defaultView)?a:"u">typeof window?window:null;k&&k.setTimeout(function(){e.mounted&&hw(h8(e),C,w)},p)}function h6(e,i,r,s){var n,o,a=e.setup,l=e.wrapperComponent,h=e.contentComponent,c=a.limitToBounds,d=a.centerOnInit,u=h1(e.props),f=e.state,p=f.scale,_=f.positionX,g=f.positionY;if(l){var v=u.positionX,m=u.positionY;if(d&&h){var S=cr(u.scale,l,h);v=S.positionX,m=S.positionY}var y=hR(v,m,hT(e,u.scale),c,0,0,l),b={scale:u.scale,positionX:y.x,positionY:y.y};if(p!==u.scale||_!==u.positionX||g!==u.positionY){null==s||s();var w=e.props,C=w.onZoomStart,x=w.onZoom,k=w.onZoomStop,E=new MouseEvent("mousemove",{bubbles:!0}),D=h8(e);hw(D,E,C),hw(D,E,x),hD(e,b,i,r);var O=null!=(o=null==(n=l.ownerDocument)?void 0:n.defaultView)?o:"u">typeof window?window:null;O&&O.setTimeout(function(){e.mounted&&hw(h8(e),E,k)},i)}}}var h4=function(e){return{instance:e,state:e.state,zoomIn:function(i,r,s){void 0===i&&(i=.5),void 0===r&&(r=300),void 0===s&&(s="easeOut"),h3(e,1,i,r,s)},zoomOut:function(i,r,s){void 0===i&&(i=.5),void 0===r&&(r=300),void 0===s&&(s="easeOut"),h3(e,-1,i,r,s)},setTransform:function(i,r,s,n,o){void 0===n&&(n=300),void 0===o&&(o="easeOut");var a=e.state,l=a.positionX,h=a.positionY,c=a.scale,d=e.wrapperComponent,u=e.contentComponent;!e.setup.disabled&&d&&u&&hD(e,{positionX:Number.isNaN(i)?l:i,positionY:Number.isNaN(r)?h:r,scale:Number.isNaN(s)?c:s},n,o)},resetTransform:function(i,r){void 0===i&&(i=200),void 0===r&&(r="easeOut"),h6(e,i,r)},centerView:function(i,r,s){void 0===r&&(r=200),void 0===s&&(s="easeOut");var n=e.state,o=e.wrapperComponent,a=e.contentComponent;o&&a&&hD(e,cr(i||n.scale,o,a),r,s)},zoomToElement:function(i,r,s,n,o,a){void 0===s&&(s=600),void 0===n&&(n="easeOut"),void 0===o&&(o=0),void 0===a&&(a=0),hk(e);var l=e.wrapperComponent,h="string"==typeof i?document.getElementById(i):i;if(l&&h&&l.contains(h)){var c=function(e,i,r,s,n){void 0===s&&(s=0),void 0===n&&(n=0);var o,a,l,h,c,d=e.wrapperComponent,u=e.contentComponent,f=e.state,p=e.setup,_=p.limitToBounds,g=p.minScale,v=p.maxScale;if(!d||!u)return f;var m=d.getBoundingClientRect(),S=i.getBoundingClientRect(),y=(o=i.getBoundingClientRect(),a=d.getBoundingClientRect(),l=u.getBoundingClientRect(),h=a.x*f.scale,c=a.y*f.scale,{x:(o.x-l.x+h)/f.scale,y:(o.y-l.y+c)/f.scale}),b=y.x,w=y.y,C=S.width/f.scale,x=S.height/f.scale,k=d.offsetWidth/C,E=d.offsetHeight/x,D=hN(r||Math.min(k,E),g,v,0,!1),O=(m.width-C*D)/2,T=(m.height-x*D)/2,P=hR((m.left-b)*D+O+s,(m.top-w)*D+T+n,hT(e,D),_,0,0,d);return{positionX:P.x,positionY:P.y,scale:D}}(e,h,r,o,a);hD(e,c,s,n)}}}},h8=function(e){var i={};return Object.assign(i,{instance:e,state:e.state}),Object.assign(i,h4(e)),i};function h7(){try{return{get passive(){return!1}}}catch(e){return!1}}var h9=".".concat(h0),ce=function(e,i){return i.some(function(i){return e.matches("".concat(h9," ").concat(i,", ").concat(h9," .").concat(i,", ").concat(h9," ").concat(i," *, ").concat(h9," .").concat(i," *"))})},ct=function(e){e&&clearTimeout(e)},ci=function(e,i,r){var s=Number.parseFloat(r.toFixed(8));return"translate(".concat(e,"px, ").concat(i,"px) scale(").concat(s,")")},cr=function(e,i,r){var s=r.offsetWidth*e,n=r.offsetHeight*e;return{scale:e,positionX:(i.offsetWidth-s)/2,positionY:(i.offsetHeight-n)/2}},cs=function(e,i){var r=e.setup.wheel,s=r.disabled,n=r.wheelDisabled,o=r.touchPadDisabled,a=r.excluded,l=e.isInitialized,h=e.isPanning,c=i.target;return!(!(l&&!h&&!s&&c)||n&&!i.ctrlKey||o&&i.ctrlKey||ce(c,a))&&!!e.isPressingKeys(e.setup.wheel.activationKeys)},cn=function(e,i){var r=e.setup,s=r.disabled,n=r.trackPadPanning,o=n.activationKeys,a=n.excluded;return!(!e.wrapperComponent||!e.contentComponent||s||n.disabled||i.ctrlKey||cs(e,i)||ce(i.target,a))&&!!e.isPressingKeys(o)};function co(e,i,r){var s=i.getBoundingClientRect(),n=0,o=0;if("clientX"in e)n=(e.clientX-s.left)/r,o=(e.clientY-s.top)/r;else{var a=e.touches[0];n=(a.clientX-s.left)/r,o=(a.clientY-s.top)/r}return(Number.isNaN(n)||Number.isNaN(o))&&console.error("No mouse or touch offset found"),{x:n,y:o}}var ca=function(e,i,r,s,n){var o=e.state.scale,a=e.wrapperComponent,l=e.setup,h=l.maxScale,c=l.minScale,d=l.zoomAnimation,u=l.disablePadding,f=d.size,p=d.disabled;if(!a)throw Error("Wrapper is not mounted");var _=o+i*r;return n?_:hN(_,c,h,f,!s&&!p&&!u)},cl=function(e,i){var r=e.previousWheelEvent,s=e.state.scale,n=e.setup,o=n.maxScale,a=n.minScale;return!!r&&(!!(s<o)||!!(s>a)||Math.sign(r.deltaY)!==Math.sign(i.deltaY)||!!(r.deltaY>0)&&!!(r.deltaY<i.deltaY)||!!(r.deltaY<0)&&!!(r.deltaY>i.deltaY)||Math.sign(r.deltaY)!==Math.sign(i.deltaY))},ch=function(e,i){var r=e.setup.pinch,s=r.disabled,n=r.excluded,o=e.isInitialized,a=i.target;return!(!(o&&!s&&a)||ce(a,n))},cc=function(e){var i=e.setup.pinch.disabled,r=e.isInitialized,s=e.pinchStartDistance;return!!(r&&!i&&null!==s)},cd=function(e,i,r){var s=r.getBoundingClientRect(),n=e.touches,o=n[0].clientX-s.left,a=n[0].clientY-s.top;return{x:(o+(n[1].clientX-s.left))/2/i,y:(a+(n[1].clientY-s.top))/2/i}},cu=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},cf=function(e,i){var r=e.pinchStartScale,s=e.pinchStartDistance,n=e.setup,o=n.maxScale,a=n.minScale,l=n.zoomAnimation,h=n.disablePadding,c=n.pinch,d=l.size,u=l.disabled,f=c.step;if(!r||null===s)throw Error("Pinch touches distance was not provided");if(i<0)return e.state.scale;var p=r+f/5*(i/s*r-r);return hN(p===1/0?0:hb(p,10),a,o,d,!u&&!h)},cp=function(e,i){var r=e.props,s=r.onWheelStart,n=r.onZoomStart;e.wheelStopEventTimer||(hk(e),hw(h8(e),i,s),hw(h8(e),i,n))},c_=function(e,i){var r,s=e.props,n=s.onWheel,o=s.onZoom,a=e.contentComponent,l=e.setup,h=e.state.scale,c=l.limitToBounds,d=l.centerZoomedOut,u=l.zoomAnimation,f=l.wheel,p=l.disablePadding,_=l.smooth,g=u.size,v=u.disabled,m=f.step;if(!a)throw Error("Component not mounted");i.preventDefault(),i.stopPropagation();var S=ca(e,(r=i?i.deltaY<0?1:-1:0,r),_?m*Math.abs(i.deltaY):m,!i.ctrlKey);if(h!==S){var y=hI(e,S),b=co(i,a,h),w=hM(e,b.x,b.y,S,y,c&&(v||0===g||d||p)),C=w.x,x=w.y;e.previousWheelEvent=i,e.setState(S,C,x),hw(h8(e),i,n),hw(h8(e),i,o)}},cg=function(e,i){var r=e.props,s=r.onWheelStop,n=r.onZoomStop;ct(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(hG(e,i.x,i.y),e.wheelAnimationTimer=null)},100),cl(e,i)&&(ct(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,hw(h8(e),i,s),hw(h8(e),i,n))},160))},cv=function(e,i){var r=e.props,s=r.onWheelStart,n=r.onPanningStart;e.wheelStopEventTimer||(hk(e),hw(h8(e),i,s),hw(h8(e),i,n))},cm=function(e,i){var r=e.props,s=r.onWheelStop,n=r.onPanningStop;ct(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(hG(e,i.x,i.y),e.wheelAnimationTimer=null)},100),cl(e,i)&&(ct(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,hw(h8(e),i,s),hw(h8(e),i,n))},160))},cS=function(e){for(var i=0,r=0,s=0;s<2;s+=1)i+=e.touches[s].clientX,r+=e.touches[s].clientY;return{x:i/2,y:r/2}},cy=function(e,i){var r=cu(i);e.pinchStartDistance=r,e.lastDistance=r,e.pinchStartScale=e.state.scale,e.isPanning=!1,e.isPinching=!0,e.pinchPreviousCenter=cS(i),hk(e)},cb=function(e,i){var r=e.contentComponent,s=e.pinchStartDistance,n=e.wrapperComponent,o=e.pinchPreviousCenter,a=e.state.scale,l=e.setup,h=l.limitToBounds,c=l.centerZoomedOut,d=l.zoomAnimation,u=l.autoAlignment,f=l.pinch,p=l.panning,_=d.disabled,g=d.size,v=f.allowPanning;if(null!==s&&r){var m=cd(i,a,r);if(Number.isFinite(m.x)&&Number.isFinite(m.y)){var S=cu(i),y=cf(e,S),b=cS(i),w=a/y,C=(b.x-((null==o?void 0:o.x)||0))*w,x=(b.y-((null==o?void 0:o.y)||0))*w;if(y!==a||0!==C||0!==x){e.pinchPreviousCenter=b;var k=hI(e,y),E=hM(e,m.x,m.y,y,k,h&&(_||0===g||c)),D=E.x,O=E.y;if(e.pinchMidpoint=m,e.lastDistance=S,p.disabled||!v)e.setState(y,D,O);else{var T=u.sizeX,P=u.sizeY,I=hR(D+C,O+x,k,h,hz(e,T,y),hz(e,P,y),n),R=I.x,M=I.y;e.setState(y,R,M)}}}}},cw=function(e){var i=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,e.isPinching=!1,hG(e,null==i?void 0:i.x,null==i?void 0:i.y)},cC=function(e,i){var r=e.props.onZoomStop,s=e.setup.doubleClick.animationTime;ct(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,hw(h8(e),i,r)},s)},cx=function(e,i){var r=e.props,s=r.onZoomStart,n=r.onZoom,o=e.setup.doubleClick,a=o.animationTime,l=o.animationType;hw(h8(e),i,s),h6(e,a,l,function(){return hw(h8(e),i,n)}),cC(e,i)},ck=function(e,i){var r=e.isInitialized,s=e.setup,n=e.wrapperComponent,o=s.doubleClick,a=o.disabled,l=o.excluded,h=i.target,c=null==n?void 0:n.contains(h);return!(!(r&&h&&c&&!a)||ce(h,l))},cE=function(e){var i=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.onTransformCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.isWheelPanning=!1,this.startCoords=null,this.panStartPosition=null,this.lastTouch=null,this.isPinching=!1,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.pinchPreviousCenter=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.isAnimating=!1,this.animation=null,this.pressedKeys={},this.mount=function(){i.initializeWindowEvents()},this.unmount=function(){i.cleanupWindowEvents()},this.update=function(e){i.props=e,i.wrapperComponent&&i.contentComponent&&hI(i,i.state.scale),i.setup=h2(e)},this.initializeWindowEvents=function(){var e,r,s,n,o=h7(),a=null==(e=i.wrapperComponent)?void 0:e.ownerDocument,l=null==a?void 0:a.defaultView;null==(r=i.wrapperComponent)||r.addEventListener("wheel",i.onWheelPanning,o),null==(s=i.wrapperComponent)||s.addEventListener("keyup",i.setKeyUnPressed,o),null==(n=i.wrapperComponent)||n.addEventListener("keydown",i.setKeyPressed,o),null==l||l.addEventListener("mousedown",i.onPanningStart,o),null==l||l.addEventListener("mousemove",i.onPanning,o),null==l||l.addEventListener("mouseup",i.onPanningStop,o),null==a||a.addEventListener("mouseleave",i.clearPanning,o),null==l||l.addEventListener("keyup",i.setKeyUnPressed,o),null==l||l.addEventListener("keydown",i.setKeyPressed,o),null==l||l.addEventListener("blur",i.handleWindowBlur)},this.cleanupWindowEvents=function(){var e,r,s,n,o,a=h7(),l=null==(e=i.wrapperComponent)?void 0:e.ownerDocument,h=null==l?void 0:l.defaultView;null==h||h.removeEventListener("mousedown",i.onPanningStart,a),null==h||h.removeEventListener("mousemove",i.onPanning,a),null==h||h.removeEventListener("mouseup",i.onPanningStop,a),null==l||l.removeEventListener("mouseleave",i.clearPanning,a),null==h||h.removeEventListener("keyup",i.setKeyUnPressed,a),null==h||h.removeEventListener("keydown",i.setKeyPressed,a),null==h||h.removeEventListener("blur",i.handleWindowBlur),document.removeEventListener("mouseleave",i.clearPanning,a),null==(r=i.wrapperComponent)||r.removeEventListener("wheel",i.onWheelPanning,a),null==(s=i.wrapperComponent)||s.removeEventListener("keyup",i.setKeyUnPressed,a),null==(n=i.wrapperComponent)||n.removeEventListener("keydown",i.setKeyPressed,a),hk(i),null==(o=i.observer)||o.disconnect()},this.handleInitializeWrapperEvents=function(e){var r=h7();e.addEventListener("wheel",i.onWheelZoom,r),e.addEventListener("dblclick",i.onDoubleClick,r),e.addEventListener("touchstart",i.onTouchPanningStart,r),e.addEventListener("touchmove",i.onTouchPanning,r),e.addEventListener("touchend",i.onTouchPanningStop,r)},this.handleInitialize=function(e){var r=i.setup.centerOnInit;i.applyTransformation(),i.onInitCallbacks.forEach(function(e){return e(h8(i))}),r&&(i.setCenter(),i.observer=new ResizeObserver(function(){var r,s=e.offsetWidth,n=e.offsetHeight;(s>0||n>0)&&(i.onInitCallbacks.forEach(function(e){return e(h8(i))}),i.setCenter(),null==(r=i.observer)||r.disconnect())}),setTimeout(function(){var e;null==(e=i.observer)||e.disconnect()},5e3),i.observer.observe(e))},this.onWheelZoom=function(e){i.setup.disabled||(i.syncModifierKeys(e),cs(i,e)&&(cp(i,e),c_(i,e),cg(i,e)))},this.onWheelPanning=function(e){var r=i.props.onPanning,s=i.setup.trackPadPanning,n=s.lockAxisX,o=s.lockAxisY;if(i.syncModifierKeys(e),cn(i,e)){e.preventDefault(),e.stopPropagation();var a=i.state,l=a.positionX,h=a.positionY,c=l-e.deltaX,d=h-e.deltaY,u=n?l:c,f=o?h:d,p=i.setup.autoAlignment,_=p.sizeX,g=p.sizeY,v=hz(i,_),m=hz(i,g);(u!==l||f!==h)&&(cv(i,e),hH(i,u,f,v,m),hw(h8(i),e,r),cm(i,e))}},this.onPanningStart=function(e){var r=i.setup.disabled,s=i.props.onPanningStart;r||(i.syncModifierKeys(e),hL(i,e)&&i.isPressingKeys(i.setup.panning.activationKeys)&&(0!==e.button||i.setup.panning.allowLeftClickPan)&&(1!==e.button||i.setup.panning.allowMiddleClickPan)&&(2!==e.button||i.setup.panning.allowRightClickPan)&&(e.preventDefault(),e.stopPropagation(),hk(i),hY(i,e),hw(h8(i),e,s)))},this.onPanning=function(e){var r=i.setup.disabled,s=i.props.onPanning;r||((i.syncModifierKeys(e),i.isPanning&&0===e.buttons)?i.clearPanning(e):!hB(i)||i.isPressingKeys(i.setup.panning.activationKeys)&&(e.preventDefault(),e.stopPropagation(),hX(i,e.clientX,e.clientY,P.MOUSE),hw(h8(i),e,s)))},this.onPanningStop=function(e){var r=i.setup.panning.velocityDisabled,s=i.props.onPanningStop;i.isPanning&&(!function(e,i){if(e.isPanning){var r=e.velocity,s=e.wrapperComponent,n=e.contentComponent;e.isPanning=!1;var o=e.state,a=o.positionX,l=o.positionY,h=o.scale,c=e.panStartPosition;if(e.panStartPosition=null,c){var d=a-c.x,u=l-c.y;if(d*d+u*u<=25)return}e.isAnimating=!1,e.animation=null;var f=(null==s?void 0:s.offsetWidth)||0,p=(null==s?void 0:s.offsetHeight)||0,_=((null==n?void 0:n.offsetWidth)||0)*h,g=((null==n?void 0:n.offsetHeight)||0)*h,v=!e.setup.limitToBounds||f<_||p<g;!i&&r&&r.total>.1&&v?function(e){var i=e.velocity,r=e.bounds,s=e.setup,n=e.wrapperComponent;if(h$(e)&&i&&r&&n){var o,a,l,h=i.velocityX,c=i.velocityY,d=i.total,u=r.maxPositionX,f=r.minPositionX,p=r.maxPositionY,_=r.minPositionY,g=s.limitToBounds,v=s.autoAlignment,m=s.zoomAnimation,S=s.panning,y=S.lockAxisY,b=S.lockAxisX,w=m.animationType,C=v.sizeX,x=v.sizeY,k=v.velocityAlignmentTime,E=Math.max((a=(o=e.setup.velocityAnimation).animationTime,l=o.maxAnimationTime,Math.min(a*Math.max(1,Math.abs(d/o.inertia)),l)),k),D=hz(e,C),O=hz(e,x),T=D*n.offsetWidth/100,P=O*n.offsetHeight/100,I=u+T,R=f-T,M=p+P,N=_-P,L=e.state,B=new Date().getTime();hE(e,w,E,function(i){var r=e.state,s=r.scale,n=r.positionX,o=r.positionY,a=new Date().getTime()-B,l=1-(0,hC[v.animationType])(Math.min(1,a/k)),d=1-i,m=n+h*d,S=o+c*d,w=hK(m,L.positionX,n,b,g,f,u,R,I,l),C=hK(S,L.positionY,o,y,g,_,p,N,M,l);if(n!==m||o!==S){e.setState(s,w,C);var x=e.props.onPanning;x&&x(h8(e),{})}})}}(e):hq(e)}}(i,r),hw(h8(i),e,s))},this.onPinchStart=function(e){var r=i.setup.disabled,s=i.props.onPinchStart;r||ch(i,e)&&(cy(i,e),hk(i),hw(h8(i),e,s))},this.onPinch=function(e){var r=i.setup.disabled,s=i.props.onPinch;r||cc(i)&&(e.preventDefault(),e.stopPropagation(),cb(i,e),hw(h8(i),e,s))},this.onPinchStop=function(e){var r=i.props.onPinchStop;i.pinchStartScale&&(cw(i),hw(h8(i),e,r))},this.onTouchPanningStart=function(e){var r=i.setup,s=r.disabled,n=r.doubleClick,o=i.props.onPanningStart;if(!s){var a=!(null==n?void 0:n.disabled),l=i.lastTouch&&new Date-i.lastTouch<200;if(a&&l&&1===e.touches.length)i.onDoubleClick(e);else{i.lastTouch=+new Date,hk(i);var h=e.touches,c=1===h.length,d=2===h.length,u=hL(i,e);if(c){if(!u)return;hk(i),hY(i,e),hw(h8(i),e,o)}d&&i.onPinchStart(e)}}},this.onTouchPanning=function(e){var r=i.setup.disabled,s=i.props.onPanning;if(i.isPanning&&1===e.touches.length){if(r||!hB(i))return;e.cancelable&&e.preventDefault(),e.stopPropagation();var n=e.touches[0];hX(i,n.clientX,n.clientY,P.TOUCH),hw(h8(i),e,s)}else e.touches.length>1&&i.onPinch(e)},this.onTouchPanningStop=function(e){i.onPanningStop(e),i.onPinchStop(e)},this.onDoubleClick=function(e){i.setup.disabled||ck(i,e)&&function(e,i){var r,s=e.setup,n=e.doubleClickStopEventTimer,o=e.state,a=e.contentComponent,l=o.scale,h=e.props,c=h.onZoomStart,d=h.onZoom,u=s.doubleClick,f=u.disabled,p=u.mode,_=u.step,g=u.animationTime,v=u.animationType;if(!f&&!n){if("reset"===p)return cx(e,i);if(!a)return console.error("No ContentComponent found");var m=(r=e.state.scale,"toggle"===p?1===r?1:-1:"zoomOut"===p?-1:1),S=h5(e,m,_);if(l!==S){hw(h8(e),i,c);var y=co(i,a,l),b=hV(e,S,y.x,y.y);if(!b)return console.error("Error during zoom event. New transformation state was not calculated.");hw(h8(e),i,d),hD(e,b,g,v),cC(e,i)}}}(i,e)},this.clearPanning=function(e){i.isPanning&&i.onPanningStop(e)},this.handleWindowBlur=function(){i.pressedKeys={},i.isPanning&&(i.isPanning=!1,i.startCoords=null)},this.syncModifierKeys=function(e){var r=e.ctrlKey,s=e.metaKey,n=e.shiftKey,o=e.altKey;"boolean"==typeof r&&(i.pressedKeys.Control=r),"boolean"==typeof s&&(i.pressedKeys.Meta=s),"boolean"==typeof n&&(i.pressedKeys.Shift=n),"boolean"==typeof o&&(i.pressedKeys.Alt=o)},this.setKeyPressed=function(e){i.pressedKeys[e.key]=!0},this.setKeyUnPressed=function(e){i.pressedKeys[e.key]=!1},this.isPressingKeys=function(e){return"function"==typeof e?e(Object.entries(i.pressedKeys).filter(function(e){return e[1]}).map(function(e){return e[0]})):!e.length||!!e.every(function(e){return i.pressedKeys[e]})},this.setCenter=function(){if(i.wrapperComponent&&i.contentComponent){var e=cr(i.state.scale,i.wrapperComponent,i.contentComponent);i.setState(e.scale,e.positionX,e.positionY)}},this.handleTransformStyles=function(e,r,s){return i.props.customTransform?i.props.customTransform(e,r,s):ci(e,r,s)},this.getContext=function(){return h8(i)},this.applyTransformation=function(){if(i.mounted&&i.contentComponent){var e=i.state,r=e.scale,s=e.positionX,n=e.positionY,o=i.handleTransformStyles(s,n,r);i.props.detached||(i.contentComponent.style.transform=o),i.onTransformCallbacks.forEach(function(e){return e({scale:r,positionX:s,positionY:n,previousScale:i.state.previousScale,ref:h8(i)})})}},this.setState=function(e,r,s){var n=i.props.onTransform;if(Number.isNaN(e)||Number.isNaN(r)||Number.isNaN(s))console.error("Detected NaN set state values");else{var o=Math.max(e,1e-7);o!==i.state.scale&&(i.state.previousScale=i.state.scale,i.state.scale=o),i.state.positionX=r,i.state.positionY=s,i.applyTransformation();var a=h8(i);i.onChangeCallbacks.forEach(function(e){return e(a)}),hw(a,{scale:i.state.scale,positionX:r,positionY:s},n)}},this.onTransform=function(e){return i.onTransformCallbacks.has(e)||i.onTransformCallbacks.add(e),function(){i.onTransformCallbacks.delete(e)}},this.onChange=function(e){return i.onChangeCallbacks.has(e)||i.onChangeCallbacks.add(e),function(){i.onChangeCallbacks.delete(e)}},this.onInit=function(e){return i.onInitCallbacks.has(e)||i.onInitCallbacks.add(e),function(){i.onInitCallbacks.delete(e)}},this.init=function(e,r){i.cleanupWindowEvents(),i.wrapperComponent=e,i.contentComponent=r,hI(i,i.state.scale),i.handleInitializeWrapperEvents(e),i.handleInitialize(r),i.initializeWindowEvents(),i.isInitialized=!0;var s,n=h8(i);hw(n,void 0,i.props.onInit),s=i.props.ref,null!=s&&("function"==typeof s?s(n):s.current=n)},this.props=e,this.setup=h2(this.props),this.state=h1(this.props)},cD=R.default.createContext(null),cO=R.default.forwardRef(function(e,i){var r,s,n=(0,R.useRef)(new cE(e)).current,o=(r=e.children,s=h4(n),"function"==typeof r?r(s):r);return(0,R.useImperativeHandle)(i,function(){return h4(n)},[n]),(0,R.useEffect)(function(){n.update(e)},[n,e]),(0,I.jsx)(cD.Provider,hZ({value:n},{children:o}))});R.default.forwardRef(function(e,i){var r,s=(0,R.useRef)(null),n=(0,R.useContext)(cD);return(0,R.useEffect)(function(){return n.onChange(function(e){s.current&&(s.current.style.transform=n.handleTransformStyles(0,0,1/e.instance.state.scale))})},[n]),(0,I.jsx)("div",hZ({},e,{ref:(r=[s,i],function(e){r.forEach(function(i){"function"==typeof i?i(e):null!=i&&(i.current=e)})})}))});!function(e,i){void 0===i&&(i={});var r=i.insertAt;if(e&&"u">typeof document){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===r&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".transform-component-module_wrapper__SPB86 {\n position: relative;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n overflow: hidden;\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none;\n margin: 0;\n padding: 0;\n transform: translate3d(0, 0, 0);\n}\n.transform-component-module_content__FBWxo {\n display: flex;\n flex-wrap: wrap;\n width: -moz-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: fit-content;\n margin: 0;\n padding: 0;\n transform-origin: 0% 0%;\n}\n.transform-component-module_content__FBWxo img {\n pointer-events: none;\n}\n.transform-component-module_infiniteGrid__Z-aP3 {\n position: absolute;\n inset: 0;\n pointer-events: none;\n background-image: radial-gradient(\n circle,\n rgba(0, 0, 0, 0.12) 1px,\n transparent 1px\n );\n background-size: 20px 20px;\n background-position: 0 0;\n}\n");var cT=function(e){var i=e.children,r=e.wrapperClass,s=e.contentClass,n=e.wrapperStyle,o=e.contentStyle,a=e.wrapperProps,l=e.contentProps,h=e.infinite,c=void 0!==h&&h,d=(0,R.useContext)(cD),u=d.init,f=d.cleanupWindowEvents,p=(0,R.useRef)(null),_=(0,R.useRef)(null),g=(0,R.useRef)(null);return(0,R.useEffect)(function(){var e=p.current,i=_.current;return null!==e&&null!==i&&u&&(null==u||u(e,i)),function(){null==f||f()}},[]),(0,R.useEffect)(function(){if(c){var e=g.current;if(e){var i=function(){var i=d.state,r=i.positionX,s=i.positionY;e.style.backgroundPosition="".concat(r,"px ").concat(s,"px")};return i(),d.onChange(i)}}},[c,d]),(0,I.jsxs)("div",hZ({},void 0===a?{}:a,{ref:p,className:"".concat(h0," ").concat("transform-component-module_wrapper__SPB86"," ").concat(void 0===r?"":r),style:n},{children:[c&&(0,I.jsx)("div",{ref:g,className:"transform-component-module_infiniteGrid__Z-aP3","aria-hidden":!0}),(0,I.jsx)("div",hZ({},void 0===l?{}:l,{ref:_,className:"".concat("react-transform-component"," ").concat("transform-component-module_content__FBWxo"," ").concat(void 0===s?"":s),style:hZ(hZ({},o),{transform:ci(d.state.positionX,d.state.positionY,d.state.scale)})},{children:i}))]}))};R.default.forwardRef(function(e,i){var r=e.x,s=e.y,n=e.width,o=e.height,a=e.margin,l=void 0===a?0:a,h=e.threshold,c=void 0===h?0:h,d=e.placeholder,u=void 0===d?null:d,f=e.onShow,p=e.onHide,_=e.children,g=e.className,v=e.style,m=(0,R.useContext)(cD),S=(0,R.useState)(!1),y=S[0],b=S[1],w=(0,R.useRef)(!1),C=(0,R.useRef)(f),x=(0,R.useRef)(p);return(C.current=f,x.current=p,(0,R.useEffect)(function(){var e,i=function(){var e,i,a=m.wrapperComponent;if(a){var h=function(e){var i=e.elementX,r=e.elementY,s=e.elementWidth,n=e.elementHeight,o=e.scale,a=e.positionX,l=e.positionY,h=e.viewportWidth,c=e.viewportHeight,d=e.margin,u=void 0===d?0:d,f=e.threshold,p=void 0===f?0:f,_={x:-u,y:-u,width:h+2*u,height:c+2*u},g={x:i*o+a,y:r*o+l,width:s*o,height:n*o};if(p<=0){var v=g.x<_.x+_.width&&g.x+g.width>_.x,m=g.y<_.y+_.height&&g.y+g.height>_.y;return v&&m}var S=g.width*g.height;return!(S<=0)&&Math.max(0,Math.min(_.x+_.width,g.x+g.width)-Math.max(_.x,g.x))*Math.max(0,Math.min(_.y+_.height,g.y+g.height)-Math.max(_.y,g.y))/S>=p}({elementX:r,elementY:s,elementWidth:n,elementHeight:o,scale:m.state.scale,positionX:m.state.positionX,positionY:m.state.positionY,viewportWidth:a.offsetWidth,viewportHeight:a.offsetHeight,margin:l,threshold:c});h!==w.current&&(w.current=h,b(h),h?null==(e=C.current)||e.call(C):null==(i=x.current)||i.call(x))}};i();var a=m.onChange(i);return m.wrapperComponent||(e=m.onInit(function(){return i()})),function(){a(),null==e||e()}},[m,r,s,n,o,l,c]),y)?(0,I.jsx)("div",hZ({ref:i,className:g,style:v},{children:_})):u?(0,I.jsx)(I.Fragment,{children:u}):null});var cP=e.i(81181),cI=e.i(30702);let cR=(0,B.default)("flip-horizontal-2",[["path",{d:"m3 7 5 5-5 5V7",key:"couhi7"}],["path",{d:"m21 7-5 5 5 5V7",key:"6ouia7"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]),cM=(0,B.default)("flip-vertical-2",[["path",{d:"m17 3-5 5-5-5h10",key:"1ftt6x"}],["path",{d:"m17 21-5-5-5 5h10",key:"1m0wmu"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]),cN=(0,B.default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);var cL=e.i(87538),cB=e.i(34808),cA=e.i(9388),cj=e.i(3214),cH=e.i(38227);let cW=(0,B.default)("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);var cz=e.i(6910);let cF=R.useLayoutEffect;function c$(){let[e,i]=(0,R.useState)("light");return cF(()=>{let e=document.documentElement,r=()=>i("u"<typeof document?"light":document.documentElement.classList.contains("dark")?"dark":"light");r();let s=new MutationObserver(r);return s.observe(e,{attributes:!0,attributeFilter:["class"]}),()=>s.disconnect()},[]),e}let cK=["checkered","black","white","transparent"];function cU({applicationId:e,path:i}){let r,s=`/api/applications/${e}/files/raw?path=${encodeURIComponent(i)}`,n="dark"===c$(),o=(0,R.useMemo)(()=>{let e,i;return e=n?"#1e1e1e":"#ffffff",i=n?"#2a2a2a":"#e5e7eb",{checkered:{backgroundImage:`linear-gradient(45deg, ${i} 25%, transparent 25%), linear-gradient(-45deg, ${i} 25%, transparent 25%), linear-gradient(45deg, transparent 75%, ${i} 75%), linear-gradient(-45deg, transparent 75%, ${i} 75%)`,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:e},black:{backgroundColor:"#000000"},white:{backgroundColor:"#ffffff"},transparent:{backgroundColor:e}}},[n]),a=n?"bg-[#1e1e1e]":"bg-[#ffffff]",l=(0,R.useRef)(null),[h,c]=(0,R.useState)("checkered"),[d,u]=(0,R.useState)(0),[f,p]=(0,R.useState)(!1),[_,g]=(0,R.useState)(!1),[v,m]=(0,R.useState)(1),[S,y]=(0,R.useState)(null),[b,w]=(0,R.useState)(null),[C,x]=(0,R.useState)(null);(0,R.useEffect)(()=>{u(0),p(!1),g(!1),m(1),y(null),w(null),x(null),l.current?.resetTransform?.()},[i]),(0,R.useEffect)(()=>{let e=!1;return(async()=>{try{let i=await fetch(s,{cache:"no-store"});if(!i.ok)return void x(`Failed to load image (${i.status})`);let r=await i.arrayBuffer();e||w(r.byteLength)}catch(i){e||x(i instanceof Error?i.message:String(i))}})(),()=>{e=!0}},[s]);let k=async()=>{try{let e=new URL(s,window.location.origin).toString();await navigator.clipboard.writeText(e),L.toast.success("Image URL copied")}catch{L.toast.error("Failed to copy URL")}};return C?(0,I.jsx)("div",{className:(0,q.cn)("flex h-full items-center justify-center text-xs text-red-500 dark:text-red-400",a),children:C}):(0,I.jsxs)("div",{className:(0,q.cn)("flex h-full min-h-0 flex-col",a),children:[(0,I.jsx)(cY,{scale:v,dimensions:S,bytes:b,bgMode:h,flipH:f,flipV:_,onZoomIn:()=>l.current?.zoomIn?.(.25),onZoomOut:()=>l.current?.zoomOut?.(.25),onReset:()=>l.current?.resetTransform?.(),onFit:()=>l.current?.centerView?.(1),onActualSize:()=>l.current?.setTransform?.(0,0,1),onRotateCcw:()=>u(e=>(e+270)%360),onRotateCw:()=>u(e=>(e+90)%360),onFlipH:()=>p(e=>!e),onFlipV:()=>g(e=>!e),onCycleBackground:()=>{c(e=>{let i=cK.indexOf(e);return cK[(i+1)%cK.length]})},onCopyUrl:k,onOpenInNewTab:()=>window.open(s,"_blank","noopener,noreferrer"),downloadHref:s,downloadName:-1===(r=i.lastIndexOf("/"))?i:i.slice(r+1)}),(0,I.jsx)("div",{className:"relative min-h-0 flex-1 overflow-hidden",style:o[h],children:(0,I.jsx)(cO,{ref:l,initialScale:1,minScale:.1,maxScale:40,centerOnInit:!0,wheel:{step:.05},doubleClick:{mode:"reset"},pinch:{step:2},onTransform:(e,i)=>m(i.scale),children:(0,I.jsx)(cT,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%"},children:(0,I.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,I.jsx)("img",{src:s,alt:i,draggable:!1,onLoad:e=>{let i=e.currentTarget;y({w:i.naturalWidth,h:i.naturalHeight})},style:{transform:`rotate(${d}deg) scaleX(${f?-1:1}) scaleY(${_?-1:1})`,transformOrigin:"center",maxWidth:"90%",maxHeight:"90%",objectFit:"contain",imageRendering:v>=4?"pixelated":"auto",transition:"transform 120ms ease"}})})})})})]})}function cY({scale:e,dimensions:i,bytes:r,bgMode:s,flipH:n,flipV:o,onZoomIn:a,onZoomOut:l,onReset:h,onFit:c,onActualSize:d,onRotateCcw:u,onRotateCw:f,onFlipH:p,onFlipV:_,onCycleBackground:g,onCopyUrl:v,onOpenInNewTab:m,downloadHref:S,downloadName:y}){return(0,I.jsxs)("div",{className:"border-border bg-background/95 text-muted-foreground flex h-9 shrink-0 items-center gap-0.5 border-b px-2 text-[11px]",children:[(0,I.jsx)(cX,{label:"Zoom out",onClick:l,icon:(0,I.jsx)(cB.Minus,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Zoom in",onClick:a,icon:(0,I.jsx)(cj.Plus,{className:"h-3.5 w-3.5"})}),(0,I.jsxs)("button",{type:"button",onClick:h,className:"text-foreground hover:bg-muted/60 h-6 min-w-[3.25rem] rounded-sm px-1.5 text-center font-mono tabular-nums",title:"Reset zoom",children:[Math.round(100*e),"%"]}),(0,I.jsx)(cq,{}),(0,I.jsx)(cX,{label:"Fit to screen",onClick:c,icon:(0,I.jsx)(cL.Maximize2,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Actual size (1:1)",onClick:d,icon:(0,I.jsx)(cz.Square,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cq,{}),(0,I.jsx)(cX,{label:"Rotate 90° counter-clockwise",onClick:u,icon:(0,I.jsx)(cH.RotateCcw,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Rotate 90° clockwise",onClick:f,icon:(0,I.jsx)(cW,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Flip horizontal",onClick:p,icon:(0,I.jsx)(cR,{className:"h-3.5 w-3.5"}),active:n}),(0,I.jsx)(cX,{label:"Flip vertical",onClick:_,icon:(0,I.jsx)(cM,{className:"h-3.5 w-3.5"}),active:o}),(0,I.jsx)(cq,{}),(0,I.jsx)(cX,{label:`Background: ${s}`,onClick:g,icon:(0,I.jsx)(cA.Monitor,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Copy URL",onClick:v,icon:(0,I.jsx)(cN,{className:"h-3.5 w-3.5"})}),(0,I.jsx)(cX,{label:"Open in new tab",onClick:m,icon:(0,I.jsx)(cI.ExternalLink,{className:"h-3.5 w-3.5"})}),(0,I.jsx)("a",{href:S,download:y,className:"text-muted-foreground hover:text-foreground hover:bg-muted/60 flex h-6 w-6 items-center justify-center rounded-sm",title:"Download",children:(0,I.jsx)(cP.Download,{className:"h-3.5 w-3.5"})}),(0,I.jsx)("div",{className:"flex-1"}),(0,I.jsxs)("div",{className:"flex items-center gap-2 font-mono text-[10px]",children:[i?(0,I.jsxs)("span",{children:[i.w," × ",i.h]}):null,(0,I.jsx)("span",{children:null==r||Number.isNaN(r)?"—":r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:`${(r/1048576).toFixed(2)} MB`})]})]})}function cq(){return(0,I.jsx)("span",{className:"bg-border/60 mx-1 h-4 w-px shrink-0"})}function cX({label:e,onClick:i,icon:r,active:s}){return(0,I.jsx)("button",{type:"button",onClick:i,"aria-label":e,title:e,className:(0,q.cn)("hover:bg-muted/60 flex h-6 w-6 items-center justify-center rounded-sm transition-colors",s?"text-foreground bg-muted/60":"text-muted-foreground hover:text-foreground"),children:r})}let cV=(0,hp.default)(()=>e.A(63812),{loadableGenerated:{modules:[58480]},ssr:!1,loading:()=>(0,I.jsx)("div",{className:"text-muted-foreground flex h-full items-center justify-center text-xs",children:"Loading editor…"})}),cG={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",md:"markdown",mdx:"markdown",css:"css",scss:"scss",html:"html",yml:"yaml",yaml:"yaml",toml:"ini",ini:"ini",sh:"shell",bash:"shell",py:"python",go:"go",rs:"rust",java:"java",sql:"sql",xml:"xml",dockerfile:"dockerfile"};function cZ({applicationId:e,openFiles:i,activePath:r,onSelect:s,onClose:n,onChange:o,onSave:a,onPromote:l,onToggleViewMode:h,sidebarCollapsed:c,onShowSidebar:d}){let u=(0,R.useMemo)(()=>i.find(e=>e.path===r)??null,[i,r]),f="dark"===c$();(0,R.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&("s"===e.key||"S"===e.key)&&(e.preventDefault(),a())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]);let p=(0,R.useCallback)(e=>{u&&o(u.path,e??"")},[u,o]);return(0,I.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,I.jsxs)("div",{role:"tablist","aria-label":"Open files",className:"border-border bg-muted/30 flex h-8 shrink-0 items-center border-b",children:[(0,I.jsx)("div",{className:"flex min-w-0 flex-1 items-center overflow-x-auto",children:0===i.length?(0,I.jsx)("div",{className:"text-muted-foreground px-3 text-[11px]",children:"No file open"}):i.map(e=>{var i;let o,a=e.content!==e.originalContent,h=e.path===r;return(0,I.jsxs)("div",{role:"tab","aria-selected":h,onClick:()=>s(e.path),onDoubleClick:()=>l(e.path),className:(0,q.cn)("group border-border flex h-8 shrink-0 cursor-pointer items-center gap-1.5 border-r px-3 text-[11px]",h?"bg-background text-foreground":"text-muted-foreground hover:bg-muted/60"),title:e.isPreview?`${e.path} — preview (double-click tab or edit to keep open)`:e.path,children:[(0,I.jsx)(hh.default,{className:"h-3 w-3 shrink-0 text-sky-500"}),(0,I.jsx)("span",{className:(0,q.cn)("truncate",e.isPreview&&"italic"),children:-1===(o=(i=e.path).lastIndexOf("/"))?i:i.slice(o+1)}),a?(0,I.jsx)("span",{className:"bg-primary/70 inline-block h-1.5 w-1.5 rounded-full","aria-label":"Unsaved changes"}):null,(0,I.jsx)("button",{type:"button",onClick:i=>{i.stopPropagation(),n(e.path)},className:"text-muted-foreground/70 hover:text-foreground ml-1 rounded-sm p-0.5","aria-label":`Close ${e.path}`,children:(0,I.jsx)(hy.X,{className:"h-3 w-3"})})]},e.path)})}),u?.isMarkdown?(0,I.jsx)("button",{type:"button",onClick:()=>h(u.path),className:"text-muted-foreground hover:text-foreground border-border flex h-8 w-8 shrink-0 items-center justify-center border-l","aria-label":"rendered"===u.viewMode?"Show markdown source":"Show markdown preview",title:"rendered"===u.viewMode?"Show markdown source":"Show markdown preview",children:"rendered"===u.viewMode?(0,I.jsx)(hm.FileCode,{className:"h-3.5 w-3.5"}):(0,I.jsx)(hv.Eye,{className:"h-3.5 w-3.5"})}):null,c?(0,I.jsx)("button",{type:"button",onClick:d,className:"text-muted-foreground hover:text-foreground border-border flex h-8 w-8 shrink-0 items-center justify-center border-l","aria-label":"Show file explorer",title:"Show file explorer",children:(0,I.jsx)(hS,{className:"h-3.5 w-3.5"})}):null]}),(0,I.jsx)("div",{className:(0,q.cn)("min-h-0 flex-1",f?"bg-[#1e1e1e]":"bg-[#ffffff]"),children:u?u.isImage?(0,I.jsx)(cU,{applicationId:e,path:u.path}):u.binary?(0,I.jsx)(cJ,{children:"Binary file — preview not available"}):u.tooLarge?(0,I.jsx)(cJ,{children:"File is too large to preview"}):u.isMarkdown&&"rendered"===u.viewMode?(0,I.jsx)(c0,{source:u.content,isDark:f}):(0,I.jsx)(cV,{height:"100%",theme:f?"vs-dark":"vs",language:function(e){let i=e.split("/").pop()??e;if("dockerfile"===i.toLowerCase())return"dockerfile";let r=i.includes(".")?i.split(".").pop()?.toLowerCase():"";return(r?cG[r]:void 0)??"plaintext"}(u.path),value:u.content,onChange:p,options:{fontSize:13,minimap:{enabled:!0},scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:"off",renderWhitespace:"selection",smoothScrolling:!0}},u.path):(0,I.jsx)(cJ,{children:"Select a file from the tree to start editing"})})]})}function cJ({children:e}){return(0,I.jsx)("div",{className:"text-muted-foreground flex h-full items-center justify-center text-xs",children:e})}let cQ={h1:({children:e})=>(0,I.jsx)("h1",{className:"border-border text-foreground mt-6 mb-4 border-b pb-2 text-2xl font-semibold",children:e}),h2:({children:e})=>(0,I.jsx)("h2",{className:"border-border text-foreground mt-5 mb-3 border-b pb-1 text-xl font-semibold",children:e}),h3:({children:e})=>(0,I.jsx)("h3",{className:"text-foreground mt-4 mb-2 text-lg font-semibold",children:e}),p:({children:e})=>(0,I.jsx)("p",{className:"my-3",children:e}),a:({children:e,href:i})=>(0,I.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",className:"text-sky-600 underline hover:text-sky-500 dark:text-sky-400 dark:hover:text-sky-300",children:e}),ul:({children:e})=>(0,I.jsx)("ul",{className:"my-3 ml-6 list-disc",children:e}),ol:({children:e})=>(0,I.jsx)("ol",{className:"my-3 ml-6 list-decimal",children:e}),li:({children:e})=>(0,I.jsx)("li",{className:"my-1",children:e}),blockquote:({children:e})=>(0,I.jsx)("blockquote",{className:"border-border text-muted-foreground my-3 border-l-4 pl-4 italic",children:e}),code:({className:e,children:i})=>e?(0,I.jsx)("code",{className:(0,q.cn)("font-mono text-[12px]",e),children:i}):(0,I.jsx)("code",{className:"bg-muted rounded px-1.5 py-0.5 font-mono text-[12px] text-pink-600 dark:text-pink-300",children:i}),pre:({children:e})=>(0,I.jsx)("pre",{className:"border-border bg-muted/60 my-4 overflow-auto rounded-md border p-3",children:e}),hr:()=>(0,I.jsx)("hr",{className:"border-border my-6"}),table:({children:e})=>(0,I.jsx)("table",{className:"border-border my-4 border-collapse border",children:e}),th:({children:e})=>(0,I.jsx)("th",{className:"border-border bg-muted/60 border px-3 py-1 text-left font-semibold",children:e}),td:({children:e})=>(0,I.jsx)("td",{className:"border-border border px-3 py-1",children:e})};function c0({source:e,isDark:i}){return(0,I.jsx)("div",{className:(0,q.cn)("text-foreground h-full overflow-auto px-8 py-6 text-[13px]",i?"bg-[#1e1e1e]":"bg-[#ffffff]"),children:(0,I.jsx)("div",{className:"markdown-preview mx-auto max-w-3xl leading-6",children:(0,I.jsx)(h_.default,{remarkPlugins:[hg.default],components:cQ,children:e})})})}async function c1(e){let i=await fetch(`/api/applications/${e}/files`,{cache:"no-store"});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error??`Failed to load file tree (${i.status})`);return(await i.json()).tree}async function c2(e,i){let r=`/api/applications/${e}/files/content?path=${encodeURIComponent(i)}`,s=await fetch(r,{cache:"no-store"});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error??`Failed to read file (${s.status})`);return await s.json()}async function c5(e,i,r){let s=await fetch(`/api/applications/${e}/files/content`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:r})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error??`Failed to save file (${s.status})`)}let c3=new Set(["png","jpg","jpeg","gif","webp","avif","bmp","ico","svg"]),c6=new Set(["md","mdx","markdown"]);function c4(e){let i=e.split("/").pop()??e,r=i.lastIndexOf(".");return -1===r?"":i.slice(r+1).toLowerCase()}function c8({applicationId:e}){let i=function(e){let[i,r]=(0,R.useState)(null),[s,n]=(0,R.useState)(null),[o,a]=(0,R.useState)(!0),[l,h]=(0,R.useState)([]),[c,d]=(0,R.useState)(null),u=(0,R.useRef)([]);(0,R.useEffect)(()=>{u.current=l},[l]);let f=(0,R.useCallback)(async()=>{try{let i=await c1(e);r(i),n(null)}catch(e){n(e instanceof Error?e.message:String(e))}finally{a(!1)}},[e]);(0,R.useEffect)(()=>{f()},[f]);let p=(0,R.useCallback)(async(i,r)=>{let s=r?.mode??"preview",n=u.current.find(e=>e.path===i);if(n){d(i),"persistent"===s&&n.isPreview&&h(e=>e.map(e=>e.path===i?{...e,isPreview:!1}:e));return}try{if(c3.has(c4(i))){let e={path:i,originalContent:"",content:"",isImage:!0,viewMode:"rendered",isPreview:"preview"===s};h(i=>{if("preview"===s){let r=i.findIndex(e=>e.isPreview);if(-1!==r){let s=i.slice();return s[r]=e,s}}return[...i,e]}),d(i);return}let r=await c2(e,i),n=r.path||i,o=c6.has(c4(n)),a={path:n,originalContent:r.content,content:r.content,tooLarge:r.tooLarge,binary:r.binary,isMarkdown:o,viewMode:o?"rendered":"source",isPreview:"preview"===s};h(e=>{if("preview"===s){let i=e.findIndex(e=>e.isPreview);if(-1!==i){let r=e.slice();return r[i]=a,r}}return[...e,a]}),d(n)}catch(e){L.toast.error("Could not open file",{description:e instanceof Error?e.message:String(e)})}},[e]),_=(0,R.useCallback)(e=>{h(i=>i.map(i=>i.path===e?{...i,isPreview:!1}:i))},[]),g=(0,R.useCallback)(e=>{h(i=>i.map(i=>i.path===e?{...i,viewMode:"rendered"===i.viewMode?"source":"rendered"}:i))},[]),v=(0,R.useCallback)(e=>{h(i=>{let r=i.filter(i=>i.path!==e);return d(s=>{if(s!==e)return s;if(0===r.length)return null;let n=Math.min(i.findIndex(i=>i.path===e),r.length-1);return r[Math.max(0,n)].path}),r})},[]),m=(0,R.useCallback)(e=>{d(e)},[]),S=(0,R.useCallback)((e,i)=>{h(r=>r.map(r=>r.path===e?{...r,content:i,isPreview:!r.isPreview&&r.isPreview}:r))},[]),y=(0,R.useCallback)(async()=>{let i=u.current.find(e=>e.path===c);if(i&&i.content!==i.originalContent)try{await c5(e,i.path,i.content),h(e=>e.map(e=>e.path===i.path?{...e,originalContent:i.content}:e)),L.toast.success("Saved",{description:i.path})}catch(e){L.toast.error("Failed to save",{description:e instanceof Error?e.message:String(e)})}},[e,c]);return(0,R.useEffect)(()=>{let i=new EventSource(`/api/applications/${e}/files/watch`),r=null;return i.addEventListener("change",i=>{try{let s=JSON.parse(i.data);if(r||(r=setTimeout(()=>{r=null,f()},250)),!u.current.some(e=>e.path===s.path)||s.isDirectory)return;if("deleted"===s.kind)return void L.toast.message("File deleted on disk",{description:s.path});(async()=>{try{let i=await c2(e,s.path);h(e=>e.map(e=>e.path!==s.path||e.content!==e.originalContent?e:{...e,originalContent:i.content,content:i.content,tooLarge:i.tooLarge,binary:i.binary}))}catch{}})()}catch{}}),i.onerror=()=>{},()=>{i.close(),r&&clearTimeout(r)}},[e,f]),{tree:i,treeError:s,treeLoading:o,openFiles:l,activePath:c,openFile:p,closeFile:v,selectFile:m,promoteFile:_,updateBuffer:S,toggleViewMode:g,saveActive:y}}(e),[r,s]=(0,R.useState)(260),[n,o]=(0,R.useState)(!1),a=(0,R.useRef)(null),l=(0,R.useRef)(!1),h=(0,R.useCallback)(e=>{e.preventDefault(),l.current=!0,e.currentTarget.setPointerCapture(e.pointerId)},[]),c=(0,R.useCallback)(e=>{if(!l.current||!a.current)return;let i=a.current.getBoundingClientRect();s(Math.max(160,Math.min(i.right-e.clientX,i.width-300)))},[]),d=(0,R.useCallback)(()=>{l.current=!1},[]),u=(0,R.useCallback)(()=>o(!1),[]),f=(0,R.useCallback)(()=>o(!0),[]),p=(0,R.useCallback)((e,r)=>{i.openFile(e,{mode:r})},[i]);return(0,I.jsxs)("div",{ref:a,className:"bg-background flex h-full min-h-0 flex-1","data-testid":"ide-tab",children:[(0,I.jsx)("section",{className:"min-w-0 flex-1",children:(0,I.jsx)(cZ,{applicationId:e,openFiles:i.openFiles,activePath:i.activePath,onSelect:i.selectFile,onClose:i.closeFile,onChange:i.updateBuffer,onSave:i.saveActive,onPromote:i.promoteFile,onToggleViewMode:i.toggleViewMode,sidebarCollapsed:n,onShowSidebar:u})}),!n&&(0,I.jsx)("div",{role:"separator","aria-orientation":"vertical",className:"border-border hover:bg-primary/20 relative w-px shrink-0 cursor-col-resize border-l transition-colors",onPointerDown:h,onPointerMove:c,onPointerUp:d,children:(0,I.jsx)("span",{className:"absolute inset-y-0 -right-1 -left-1"})}),!n&&(0,I.jsxs)("aside",{className:"border-border flex min-h-0 shrink-0 flex-col border-l",style:{width:r},children:[(0,I.jsxs)("div",{className:"text-muted-foreground border-border bg-muted/30 flex h-8 shrink-0 items-center justify-between border-b px-2 text-[10px] font-medium tracking-wide uppercase",children:[(0,I.jsx)("span",{children:"Explorer"}),(0,I.jsx)("button",{type:"button",onClick:f,className:"text-muted-foreground hover:text-foreground -mr-1 flex h-6 w-6 items-center justify-center rounded-sm","aria-label":"Hide file explorer",title:"Hide file explorer",children:(0,I.jsx)(nB,{className:"h-3.5 w-3.5"})})]}),(0,I.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:(0,I.jsx)(hf,{tree:i.tree,loading:i.treeLoading,error:i.treeError,activePath:i.activePath,onOpenFile:p})})]})]})}var c7=e.i(24042),c9=e.i(83428),de=e.i(70002);function dt({deploy:e,className:i,variant:r="full"}){let s=(0,R.useCallback)(()=>{e.url&&window.open(e.url,"_blank","noopener,noreferrer")},[e.url]);if(e.status===Y.DeploymentState.Booting||e.deployLoading)return(0,I.jsxs)("button",{type:"button",onClick:e.stop,disabled:e.stopLoading,className:(0,q.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-amber-500/40 bg-amber-500/10 px-2 text-[11px] font-medium text-amber-600 transition-colors hover:bg-amber-500/20 dark:text-amber-400",i),title:"Dev server is starting — click to stop","aria-label":"Stop starting dev server",children:[(0,I.jsx)(c9.Loader2,{className:"h-3 w-3 animate-spin"}),(0,I.jsx)("span",{children:"Starting…"})]});if(e.status===Y.DeploymentState.Ready&&e.url&&"compact"===r)return(0,I.jsx)("button",{type:"button",onClick:e.stop,disabled:e.stopLoading,className:(0,q.cn)("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-red-500/30 bg-red-500/5 text-red-600 transition-colors hover:border-red-500/60 hover:bg-red-500/15 dark:text-red-400",i),title:"Stop dev server","aria-label":"Stop dev server",children:e.stopLoading?(0,I.jsx)(c9.Loader2,{className:"h-3 w-3 animate-spin"}):(0,I.jsx)(cz.Square,{className:"h-3 w-3 fill-current"})});if(e.status===Y.DeploymentState.Ready&&e.url){let r=e.url.replace(/^https?:\/\//,"");return(0,I.jsxs)("div",{className:(0,q.cn)("inline-flex h-7 shrink-0 items-stretch overflow-hidden rounded-md border border-violet-500/40 bg-violet-500/10 text-[11px] font-medium text-violet-700 dark:text-violet-300",i),children:[(0,I.jsxs)("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 px-2 font-mono transition-colors hover:bg-violet-500/20",title:`Open ${e.url}`,"aria-label":`Open dev server at ${e.url}`,children:[(0,I.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,I.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-violet-400 opacity-60"}),(0,I.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-violet-500"})]}),(0,I.jsx)("span",{className:"truncate",children:r}),(0,I.jsx)(cI.ExternalLink,{className:"h-3 w-3 opacity-60"})]}),(0,I.jsx)("span",{className:"w-px bg-violet-500/30","aria-hidden":!0}),(0,I.jsx)("button",{type:"button",onClick:e.stop,disabled:e.stopLoading,className:"inline-flex items-center justify-center px-1.5 text-red-600 transition-colors hover:bg-red-500/20 dark:text-red-400",title:"Stop dev server","aria-label":"Stop dev server",children:e.stopLoading?(0,I.jsx)(c9.Loader2,{className:"h-3 w-3 animate-spin"}):(0,I.jsx)(cz.Square,{className:"h-3 w-3 fill-current"})})]})}return e.deployError?(0,I.jsxs)("button",{type:"button",onClick:e.deploy,className:(0,q.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-red-500/40 bg-red-500/10 px-2 text-[11px] font-medium text-red-600 transition-colors hover:bg-red-500/20 dark:text-red-400",i),title:e.deployError,"aria-label":"Retry starting dev server",children:[(0,I.jsx)(de.TriangleAlert,{className:"h-3 w-3"}),(0,I.jsx)("span",{children:"Retry"})]}):(0,I.jsxs)("button",{type:"button",onClick:e.deploy,className:(0,q.cn)("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-violet-500/50 bg-gradient-to-br from-indigo-500/15 to-violet-500/20 px-2.5 text-[11px] font-medium text-violet-700 transition-colors hover:from-indigo-500/25 hover:to-violet-500/30 dark:text-violet-300",i),title:"Install dependencies and preview the app","aria-label":"Preview app",children:[(0,I.jsx)(c7.Play,{className:"h-3 w-3 fill-current"}),(0,I.jsx)("span",{children:"Preview"})]})}var di=e.i(32494);function dr({deploy:e}){let i=(0,R.useCallback)(()=>{e.url&&window.open(e.url,"_blank","noopener,noreferrer")},[e.url]);return e.status===Y.DeploymentState.Ready&&e.url?(0,I.jsxs)("div",{className:"bg-background flex min-h-0 flex-1 flex-col",children:[(0,I.jsxs)("div",{className:"border-border bg-muted/70 text-foreground flex h-8 shrink-0 items-center gap-2 border-b px-2 text-[11px] dark:bg-neutral-900",children:[(0,I.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,I.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-60"}),(0,I.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-emerald-500"})]}),(0,I.jsx)("span",{className:"text-foreground/90 truncate font-mono",children:e.url}),(0,I.jsx)("div",{className:"flex-1"}),(0,I.jsxs)("button",{type:"button",onClick:i,className:"text-muted-foreground hover:text-foreground hover:bg-background/60 inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors dark:hover:bg-neutral-800",title:"Open in a new browser tab",children:[(0,I.jsx)(cI.ExternalLink,{className:"h-3 w-3"}),(0,I.jsx)("span",{children:"Open"})]})]}),(0,I.jsx)("iframe",{src:e.url,className:"min-h-0 w-full flex-1 border-0 bg-white",title:"Application preview"},e.url)]}):e.status===Y.DeploymentState.Booting||e.deployLoading?(0,I.jsx)(ds,{icon:(0,I.jsx)(c9.Loader2,{className:"text-muted-foreground h-8 w-8 animate-spin"}),title:"Starting dev server…",description:"Installing dependencies and booting the app. This can take a minute on the first run."}):e.deployError?(0,I.jsx)(ds,{icon:(0,I.jsx)(de.TriangleAlert,{className:"h-8 w-8 text-red-500"}),title:"Failed to start dev server",description:e.deployError,actionLabel:"Retry",onAction:e.deploy}):(0,I.jsx)(ds,{icon:(0,I.jsx)(di.Globe,{className:"text-muted-foreground h-8 w-8"}),title:"No dev server running",description:"Click Preview to install dependencies and start the app. The preview will appear here.",actionLabel:"Preview",actionIcon:(0,I.jsx)(c7.Play,{className:"h-3.5 w-3.5 fill-current"}),onAction:e.deploy})}function ds({icon:e,title:i,description:r,actionLabel:s,actionIcon:n,onAction:o}){return(0,I.jsx)("div",{className:"flex min-h-0 flex-1 items-center justify-center p-6",children:(0,I.jsxs)("div",{className:"flex max-w-sm flex-col items-center gap-3 text-center",children:[e,(0,I.jsx)("h3",{className:"text-foreground text-sm font-semibold",children:i}),(0,I.jsx)("p",{className:"text-muted-foreground text-xs leading-relaxed",children:r}),s&&o?(0,I.jsxs)("button",{type:"button",onClick:o,className:"mt-2 inline-flex h-8 items-center gap-1.5 rounded-md border border-violet-500/50 bg-gradient-to-br from-indigo-500/15 to-violet-500/20 px-3 text-xs font-medium text-violet-700 transition-colors hover:from-indigo-500/25 hover:to-violet-500/30 dark:text-violet-300",children:[n,(0,I.jsx)("span",{children:s})]}):null]})})}var dn=e.i(8537),da=e.i(80554),dl=e.i(98440),dh=e.i(3402),dc=e.i(21023);let dd=(0,dc.createServerReference)("40944a288e4871edb2ec62b9df6ed2c6684a794d95",dc.callServer,void 0,dc.findSourceMapURL,"getApplicationDebugPrompt");var du=e.i(79988);let df=["ide","terminal","web"],dp={ide:"IDE",terminal:"Terminal",web:"Web"};function d_({application:e,activeView:i,onViewChange:r,onBack:s,initialChatState:n,deploy:o}){return(0,I.jsxs)("header",{className:(0,q.cn)("bg-background/95 supports-[backdrop-filter]:bg-background/70 sticky top-0 z-20 flex shrink-0 items-center gap-2 border-b px-3 backdrop-blur","h-11"),children:[(0,I.jsx)(X.Button,{variant:"ghost",size:"icon","aria-label":"Back to canvas",onClick:s,className:"h-7 w-7",children:(0,I.jsx)(A,{className:"h-3.5 w-3.5"})}),(0,I.jsx)("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-gradient-to-br from-indigo-500 to-violet-500",children:(0,I.jsx)(j.LayoutGrid,{className:"h-3 w-3 text-white"})}),(0,I.jsx)("h1",{className:"min-w-0 truncate text-sm font-semibold",children:e.name}),(0,I.jsx)(dy,{applicationId:e.id,persistedStatus:e.status,deployReady:o.status===Y.DeploymentState.Ready}),(0,I.jsx)(db,{}),(0,I.jsx)(dg,{repositoryPath:e.repositoryPath}),(0,I.jsx)("div",{className:"flex-1"}),(0,I.jsx)(dm,{featureId:`app-${e.id}`,initialChatState:n}),(0,I.jsx)(dS,{applicationId:e.id}),(0,I.jsx)(dt,{deploy:o}),(0,I.jsx)(dw,{active:i,onChange:r})]})}function dg({repositoryPath:e}){let i,r,s=(0,R.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),L.toast.success("Path copied",{description:e})}catch{L.toast.error("Failed to copy path")}},[e]),n=(0,R.useCallback)(async()=>{let i=await (0,dh.openFolder)(e);i.success||L.toast.error("Could not open folder",{description:i.error})},[e]);return(0,I.jsxs)("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5 text-xs",children:[(0,I.jsx)("span",{className:"truncate font-mono text-[11px]",title:e,children:-1===(r=(i=e.replace(/\\/g,"/").replace(/\/+$/,"")).lastIndexOf("/"))?i:i.slice(r+1)}),(0,I.jsx)(X.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-foreground h-5 w-5",onClick:s,"aria-label":"Copy path",title:"Copy path",children:(0,I.jsx)(W.Copy,{className:"h-3 w-3"})}),(0,I.jsx)(X.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-foreground h-5 w-5",onClick:n,"aria-label":"Open in file manager",title:"Open in file manager",children:(0,I.jsx)(z.FolderOpen,{className:"h-3 w-3"})}),(0,I.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,I.jsx)(dv,{repositoryPath:e})]})}function dv({repositoryPath:e}){let{data:i}=(0,N.useQuery)({queryKey:["git-repo-info",e],queryFn:()=>(0,du.getGitRepoInfo)(e,1),enabled:!!e,refetchInterval:5e3,refetchOnWindowFocus:!0,staleTime:2e3}),r=i?.currentBranch?.trim(),s=r&&r.length>0?r:"main",n=i?.workingTree.untracked??0,o=i?.workingTree.modified??0,a=i?.diffStats?.insertions??0,l=i?.diffStats?.deletions??0,h=n>0||o>0,c=(0,R.useCallback)(()=>{L.toast.info("Commit (not wired up yet)",{description:`Would commit ${o} edited / ${n} added file(s) on ${s}`})},[n,o,s]),d=(0,R.useCallback)(()=>{L.toast.info("Commit & Push (not wired up yet)",{description:`Would commit and push ${o} edited / ${n} added file(s) on ${s}`})},[n,o,s]);return(0,I.jsxs)("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[(0,I.jsxs)("span",{className:"flex items-center gap-1",title:`Branch: ${s}`,children:[(0,I.jsx)(H.GitBranch,{className:"h-3 w-3"}),s]}),n>0?(0,I.jsxs)("span",{className:"flex items-center gap-0.5 text-emerald-500",title:`${n} added ${1===n?"file":"files"}`,children:[(0,I.jsx)(K.FilePlus,{className:"h-3 w-3"}),n]}):null,o>0?(0,I.jsxs)("span",{className:"flex items-center gap-0.5 text-amber-500",title:`${o} edited ${1===o?"file":"files"}`,children:[(0,I.jsx)(U.default,{className:"h-3 w-3"}),o]}):null,a>0||l>0?(0,I.jsxs)("span",{className:"flex items-center gap-1",title:`${a} insertions, ${l} deletions vs HEAD`,children:[a>0?(0,I.jsxs)("span",{className:"text-emerald-500",children:["+",a]}):null,l>0?(0,I.jsxs)("span",{className:"text-rose-500",children:["-",l]}):null]}):null,h?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("button",{type:"button",onClick:c,className:"border-border bg-background text-foreground hover:bg-muted inline-flex h-6 shrink-0 items-center gap-1 rounded-md border px-2 text-[11px] font-medium transition-colors",title:"Commit working tree changes",children:"Commit"}),(0,I.jsx)("button",{type:"button",onClick:d,className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-md border border-indigo-500/40 bg-indigo-500/10 px-2 text-[11px] font-medium text-indigo-600 transition-colors hover:bg-indigo-500/20 dark:text-indigo-400",title:"Commit and push to remote",children:"Commit & Push"})]}):null]})}function dm({featureId:e,initialChatState:i}){let{data:r}=(0,N.useQuery)({queryKey:(0,dl.chatQueryKey)(e),queryFn:()=>(0,dl.fetchChatState)(e),initialData:i,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),s=r?.sessionInfo,n=s?.sessionId??null,o=s?.model??null,a=n?n.slice(0,8):null,l=(0,R.useCallback)(async()=>{if(n)try{await navigator.clipboard.writeText(n),L.toast.success("Session ID copied",{description:n})}catch{L.toast.error("Failed to copy session id")}},[n]);return(0,I.jsxs)("button",{type:"button",onClick:l,disabled:!n,className:(0,q.cn)("border-border/60 bg-muted/40 text-muted-foreground inline-flex h-6 shrink-0 items-center gap-1.5 rounded-md border px-2 font-mono text-[10px] transition-colors",n?"hover:bg-muted hover:text-foreground cursor-pointer":"cursor-default opacity-60"),title:n?`Click to copy full session id: ${n}`:"No session yet","aria-label":n?"Copy session id":"No active session",children:[(0,I.jsx)($.Cpu,{className:"h-3 w-3 opacity-60"}),(0,I.jsx)("span",{className:"font-medium",children:o??"agent"}),(0,I.jsx)("span",{className:"text-muted-foreground/50",children:"·"}),(0,I.jsx)("span",{children:a??"—"})]})}function dS({applicationId:e}){let[i,r]=(0,R.useState)(!1),s=(0,R.useCallback)(async()=>{if(!i){r(!0);try{let i=await dd(e);if(i.error||!i.combined)return void L.toast.error("Failed to build prompt",{description:i.error});await navigator.clipboard.writeText(i.combined);let r=i.systemPrompt?.length??0,s=i.userMessage?.length??0;L.toast.success("Prompt copied to clipboard",{description:`${r} chars system + ${s} chars user`})}catch(e){L.toast.error("Failed to copy prompt",{description:e instanceof Error?e.message:String(e)})}finally{r(!1)}}},[e,i]);return(0,I.jsx)(X.Button,{variant:"ghost",size:"icon",onClick:s,disabled:i,className:"text-muted-foreground hover:text-foreground h-7 w-7","aria-label":"Copy full generated prompt (debug)",title:"Copy full generated prompt (debug) — system + user message",children:(0,I.jsx)(F.ClipboardList,{className:"h-3.5 w-3.5"})})}function dy({applicationId:e,persistedStatus:i,deployReady:r}){let s=(0,da.useTurnStatus)(`app-${e}`),n="processing"===s?{label:"In Progress",dotClass:"bg-violet-500",pulse:!0}:"awaiting_input"===s?{label:"Warning",dotClass:"bg-amber-500",pulse:!0}:r?{label:"Live",dotClass:"bg-emerald-500",pulse:!0}:"Error"===i?{label:"Error",dotClass:"bg-red-500",pulse:!1}:{label:"Ready",dotClass:"bg-sky-500",pulse:!1};return(0,I.jsxs)("span",{className:"border-border/60 inline-flex h-5 shrink-0 items-center gap-1 rounded-full border px-2 text-[10px] font-medium tracking-wide uppercase",children:[(0,I.jsx)("span",{className:(0,q.cn)("relative flex h-1.5 w-1.5 items-center justify-center rounded-full",n.dotClass),children:n.pulse?(0,I.jsx)("span",{className:(0,q.cn)("absolute inline-flex h-full w-full animate-ping rounded-full opacity-60",n.dotClass)}):null}),n.label]})}function db(){return(0,I.jsx)("span",{className:"bg-border/60 mx-1 h-4 w-px shrink-0"})}function dw({active:e,onChange:i}){return(0,I.jsx)("div",{role:"tablist","aria-label":"Right pane view",className:"bg-muted/60 flex items-center rounded-md p-0.5",children:df.map(r=>{let s=r===e;return(0,I.jsx)("button",{type:"button",role:"tab","aria-selected":s,onClick:()=>i(r),className:(0,q.cn)("h-6 cursor-pointer rounded-sm px-2.5 text-[11px] font-medium transition-colors",s?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:dp[r]},r)})})}function dC({left:e,right:i}){let r=(0,R.useRef)(null),[s,n]=(0,R.useState)(.4),o=(0,R.useRef)(!1),a=(0,R.useCallback)(e=>{e.preventDefault(),o.current=!0,e.currentTarget.setPointerCapture(e.pointerId)},[]),l=(0,R.useCallback)(e=>{if(!o.current||!r.current)return;let i=r.current.getBoundingClientRect(),s=i.width;n(Math.max(400,Math.min(e.clientX-i.left,s-400))/s)},[]),h=(0,R.useCallback)(()=>{o.current=!1},[]);return(0,I.jsxs)("div",{ref:r,className:"flex min-h-0 flex-1",children:[(0,I.jsx)("div",{className:"flex min-h-0 flex-col overflow-hidden",style:{flexBasis:`${100*s}%`,flexShrink:0},children:e}),(0,I.jsx)("div",{role:"separator","aria-orientation":"vertical",className:"group border-border hover:bg-primary/20 relative w-px shrink-0 cursor-col-resize border-l transition-colors",onPointerDown:a,onPointerMove:l,onPointerUp:h,children:(0,I.jsx)("span",{className:"absolute inset-y-0 -right-1 -left-1"})}),(0,I.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:i})]})}function dx({activeView:e,applicationId:i,terminalCwd:r,deploy:s}){let n=s.status===Y.DeploymentState.Ready||s.status===Y.DeploymentState.Booting||s.deployLoading||!!s.deployError;return(0,I.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,I.jsx)("div",{className:(0,q.cn)("absolute inset-0 flex min-h-0 flex-col","terminal"===e?"visible":"pointer-events-none invisible"),"aria-hidden":"terminal"!==e,children:(0,I.jsx)(nL,{cwd:r})}),(0,I.jsx)("div",{className:(0,q.cn)("absolute inset-0 flex min-h-0 flex-col","ide"===e?"visible":"pointer-events-none invisible"),"aria-hidden":"ide"!==e,children:(0,I.jsx)(c8,{applicationId:i})}),n?(0,I.jsx)("div",{className:(0,q.cn)("absolute inset-0 flex min-h-0 flex-col","web"===e?"visible":"pointer-events-none invisible"),"aria-hidden":"web"!==e,children:(0,I.jsx)(dr,{deploy:s})}):"web"===e&&(0,I.jsx)(dr,{deploy:s})]})}function dk({application:e,initialChatState:i}){let r=(0,M.useRouter)(),[s,n]=(0,R.useState)("ide"),o=(0,dn.useDeployAction)({targetId:e.id,targetType:"application",repositoryPath:e.repositoryPath}),a=(0,R.useRef)(!1);(0,R.useEffect)(()=>{o.status===Y.DeploymentState.Ready&&o.url&&!a.current&&(a.current=!0,n("web")),o.status!==Y.DeploymentState.Ready&&(a.current=!1)},[o.status,o.url]);let l=(0,R.useCallback)(()=>{r.push("/"),r.refresh()},[r]);return(0,I.jsxs)("div",{className:"bg-background flex h-dvh flex-col",children:[(0,I.jsx)(d_,{application:e,activeView:s,onViewChange:n,onBack:l,initialChatState:i,deploy:o}),(0,I.jsx)(dC,{left:(0,I.jsx)(V.ChatTab,{featureId:`app-${e.id}`,worktreePath:e.repositoryPath,initialAgent:e.agentType,initialModel:e.modelOverride,initialChatState:i,hideHeader:!0,workflowPlaceholder:G,onAllStepsComplete:()=>{o.status===Y.DeploymentState.Ready||o.status===Y.DeploymentState.Booting||o.deployLoading||o.deploy()}}),right:(0,I.jsx)(dx,{activeView:s,applicationId:e.id,terminalCwd:e.repositoryPath,deploy:o})})]})}e.s(["ApplicationPage",()=>dk],97687)}]);