@camstack/addon-admin-ui 1.0.3 → 1.0.5

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 (86) hide show
  1. package/dist/assets/{AddLocationWizard-ty_4uW1H.js → AddLocationWizard-B5dkIoQ2.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-CIvGYL8Z.js → AddonCollectionPage-DVB69ClF.js} +1 -1
  3. package/dist/assets/Addons-Bfvs6-g0.js +1 -0
  4. package/dist/assets/{AdminTabs-7T1CldHN.js → AdminTabs-BWNsXXy4.js} +1 -1
  5. package/dist/assets/{BrokerForm-DzjaLHmG.js → BrokerForm-DYIjeusD.js} +1 -1
  6. package/dist/assets/{BrokerStep-B3pEVZ2L.js → BrokerStep-DjzuHh1z.js} +1 -1
  7. package/dist/assets/{Capabilities-D2qn1TDV.js → Capabilities-hicnOVum.js} +1 -1
  8. package/dist/assets/{CapabilityBadges-BWnECBvl.js → CapabilityBadges-CSyidKVA.js} +1 -1
  9. package/dist/assets/Cluster-AyC6G6sS.js +7 -0
  10. package/dist/assets/{Dashboard-HorCsmCt.js → Dashboard-BkLuDhPq.js} +1 -1
  11. package/dist/assets/{Data-hispFwBv.js → Data-Beh_0Rmk.js} +1 -1
  12. package/dist/assets/{DetectionIntelligence-BtnTELA6.js → DetectionIntelligence-BfxtDLUn.js} +1 -1
  13. package/dist/assets/DeviceDetail-DGlm0ka0.js +2 -0
  14. package/dist/assets/{Devices-XIivtEYO.js → Devices-DzX3RWXL.js} +1 -1
  15. package/dist/assets/{EmbedPlayerPage-CIF0Ft1g.js → EmbedPlayerPage-WJHXt2K5.js} +1 -1
  16. package/dist/assets/{FormBuilder-DVLWBVys.js → FormBuilder-C_FGp6fK.js} +1 -1
  17. package/dist/assets/Identity-oMA7lRlr.js +1 -0
  18. package/dist/assets/IntegrationDetail-DUzh5vXL.js +1 -0
  19. package/dist/assets/{Integrations-CxuWXvnl.js → Integrations-DMJL2wGt.js} +1 -1
  20. package/dist/assets/{Integrations-CxFwUmeX.js → Integrations-DdxCeVlW.js} +1 -1
  21. package/dist/assets/{Logs-DYrcsFh9.js → Logs-Czo2ju6R.js} +1 -1
  22. package/dist/assets/{MotionZonesSettings-CepMSlXn.js → MotionZonesSettings-DSz0ZQ3J.js} +1 -1
  23. package/dist/assets/{MyAccess-C-zxwxTM.js → MyAccess-CiRVe6o4.js} +1 -1
  24. package/dist/assets/{Network-D5ppyqPS.js → Network-2_yW2eMz.js} +1 -1
  25. package/dist/assets/{NodeAddonsSettingsPanel-B4ru8rzf.js → NodeAddonsSettingsPanel-CWOXJvnI.js} +1 -1
  26. package/dist/assets/Pipeline-MNGNVhOO.js +1 -0
  27. package/dist/assets/{PrivacyMaskSettings-Cut8tYhS.js → PrivacyMaskSettings-CrWASNzq.js} +1 -1
  28. package/dist/assets/{ProviderIcon-BpqSF3Hu.js → ProviderIcon-DU7EkOsQ.js} +1 -1
  29. package/dist/assets/{Settings-CriiXyFu.js → Settings-Ba4e7VPd.js} +1 -1
  30. package/dist/assets/{Showroom-KHowYChm.js → Showroom-fzNXeqzs.js} +1 -1
  31. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Cus-LW9c.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-OIn_kS_J.js} +1 -1
  32. package/dist/assets/{bell-C1jXqDWz.js → bell-PpkN_TgJ.js} +1 -1
  33. package/dist/assets/circle-check-big-BzSkZiMj.js +1 -0
  34. package/dist/assets/{copy-tH10joFB.js → copy-D3XNVDYo.js} +1 -1
  35. package/dist/assets/dist-CyLsBIs8.js +1 -0
  36. package/dist/assets/{dist-mzJ_Pmak.js → dist-DyYmhGqc.js} +1 -1
  37. package/dist/assets/{download-DyMeaCfZ.js → download-BHYjG90K.js} +1 -1
  38. package/dist/assets/{hostInit-8PN225l2.js → hostInit-BykkFKC1.js} +1 -1
  39. package/dist/assets/index-COZOEwaJ.css +2 -0
  40. package/dist/assets/index-DpTstpp_.js +4 -0
  41. package/dist/assets/{key-round-eCBxaKT6.js → key-round-Dn1oOWgV.js} +1 -1
  42. package/dist/assets/{mf-entry-bootstrap-0-137d5c5b.js → mf-entry-bootstrap-0-04dcd8db.js} +2 -2
  43. package/dist/assets/{pencil-xW8n5CLs.js → pencil-Kbj4_JBR.js} +1 -1
  44. package/dist/assets/{player-overlays-DzZKARlk.js → player-overlays-zGqQhGgE.js} +1 -1
  45. package/dist/assets/plus-CPqVcqUV.js +1 -0
  46. package/dist/assets/{radio-CWnAI4na.js → radio-CTfNJnG5.js} +1 -1
  47. package/dist/assets/{refresh-cw-BKhUNMXQ.js → refresh-cw-BnmOdHXx.js} +1 -1
  48. package/dist/assets/remoteEntry-BKwb226y.js +1 -0
  49. package/dist/assets/{rotate-ccw-BXu8SIv5.js → rotate-ccw-UF_FErzF.js} +1 -1
  50. package/dist/assets/rotate-cw-B4szmAxG.js +1 -0
  51. package/dist/assets/search-C07n9Z2S.js +1 -0
  52. package/dist/assets/{server-X3K4ldX4.js → server-DK5PS_QF.js} +1 -1
  53. package/dist/assets/{sparkles-ChgPFrhX.js → sparkles-B5Duaxbv.js} +1 -1
  54. package/dist/assets/square-Bex0hnGW.js +1 -0
  55. package/dist/assets/{square-check-big-Bzz95oCZ.js → square-check-big-qiutr_Ci.js} +1 -1
  56. package/dist/assets/src-DqOo0bwK.js +1 -0
  57. package/dist/assets/src-Dxc7AUYA.js +34 -0
  58. package/dist/assets/{upload-BeG8PyHB.js → upload-Btk1HMIN.js} +1 -1
  59. package/dist/assets/{useDevice-B7VwJa4X.js → useDevice-uoMH2oPD.js} +1 -1
  60. package/dist/assets/{useEventInvalidation-Cf9VIpDW.js → useEventInvalidation-DDUSWISR.js} +1 -1
  61. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BLisQvKo.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-s1j_uW8u.js} +2 -2
  62. package/dist/assets/{wifi-DYJHTrlD.js → wifi-DH-9OMrB.js} +1 -1
  63. package/dist/assets/{zap-DLiiHws-.js → zap-Cpoh2hjh.js} +1 -1
  64. package/dist/index.html +6 -6
  65. package/dist/server/addon.js +122 -27
  66. package/dist/sw.js +1 -1
  67. package/dist/workbox-14d7584c.js +1 -0
  68. package/package.json +1 -1
  69. package/dist/assets/Addons-CWtFT6QM.js +0 -1
  70. package/dist/assets/Cluster-BVUZdAyW.js +0 -7
  71. package/dist/assets/DeviceDetail-OXTiYiO9.js +0 -2
  72. package/dist/assets/Identity-8krGNqDO.js +0 -1
  73. package/dist/assets/IntegrationDetail-Dyg4wlgs.js +0 -1
  74. package/dist/assets/Pipeline-CS6lN8Ww.js +0 -1
  75. package/dist/assets/circle-check-big-is5GRKO9.js +0 -1
  76. package/dist/assets/dist-CGRDjIOZ.js +0 -1
  77. package/dist/assets/index-CAfPe666.js +0 -4
  78. package/dist/assets/index-CTiiXuB_.css +0 -2
  79. package/dist/assets/plus-DVpT3Ja2.js +0 -1
  80. package/dist/assets/remoteEntry-BOZn_K50.js +0 -1
  81. package/dist/assets/rotate-cw-BO4D9G2F.js +0 -1
  82. package/dist/assets/search-DyWYI0Yj.js +0 -1
  83. package/dist/assets/square-Faey8y7b.js +0 -1
  84. package/dist/assets/src-C5tvi19O.js +0 -34
  85. package/dist/assets/src-CrhOk7JL.js +0 -1
  86. package/dist/workbox-9c191d2f.js +0 -1
package/dist/sw.js CHANGED
@@ -1 +1 @@
1
- if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,r)=>{const n=s||("document"in self?document.currentScript.src:"")||location.href;if(e[n])return;let a={};const u=s=>l(s,n),o={module:{uri:n},exports:a,require:u};e[n]=Promise.all(i.map(s=>o[s]||u(s))).then(s=>(r(...s),a))}}define(["./workbox-9c191d2f"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"index.html",revision:"6bb9d28e0d0c1f49b7d79147674e64fe"},{url:"favicon.svg",revision:"e28b845cc4cd4ebbe254e7d9d424f0c8"},{url:"icons/icon-512.png",revision:"f714f744e5e29a9a7c5481122ed1840d"},{url:"icons/icon-192.png",revision:"d61bc87dfde2cd635f8920b7445da4f0"},{url:"icons/apple-touch-icon.png",revision:"f8b42413aad2df56c29ec7375db56778"},{url:"brand/logo-wide-light.svg",revision:"77a5c7896c8ddf23f3ab5831462e8a9c"},{url:"brand/logo-wide-dark.svg",revision:"7600383a290ae26ae0b4683152205e57"},{url:"brand/logo-light.svg",revision:"0886d0a8fadd10a2ba36de70dd2c8c91"},{url:"brand/logo-horizontal-light.svg",revision:"cf6e7160b02e96a03e1e23b7e895a58d"},{url:"brand/logo-horizontal-dark.svg",revision:"5d90e24eb8a0ebacc692045ef2cca447"},{url:"brand/logo-dark.svg",revision:"fce2740bf6d9bbe8f1762d3aa36ef416"},{url:"assets/zap-DLiiHws-.js",revision:null},{url:"assets/wifi-DYJHTrlD.js",revision:null},{url:"assets/vite-preload-helper-zJ_50EbN.js",revision:null},{url:"assets/virtual_mf-exposes___mfe_internal__admin_ui_host__remoteEntry-_hash_-DnnXQRkG.js",revision:null},{url:"assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BLisQvKo.js",revision:null},{url:"assets/virtualExposes-SIMIW5lI.js",revision:null},{url:"assets/useEventInvalidation-Cf9VIpDW.js",revision:null},{url:"assets/useDevice-B7VwJa4X.js",revision:null},{url:"assets/upload-BeG8PyHB.js",revision:null},{url:"assets/src-CrhOk7JL.js",revision:null},{url:"assets/src-C5tvi19O.js",revision:null},{url:"assets/square-check-big-Bzz95oCZ.js",revision:null},{url:"assets/square-Faey8y7b.js",revision:null},{url:"assets/sparkles-ChgPFrhX.js",revision:null},{url:"assets/server-X3K4ldX4.js",revision:null},{url:"assets/search-DyWYI0Yj.js",revision:null},{url:"assets/schemas-CuE8EXQ7.js",revision:null},{url:"assets/rotate-cw-BO4D9G2F.js",revision:null},{url:"assets/rotate-ccw-BXu8SIv5.js",revision:null},{url:"assets/rolldown-runtime-Cyuzqnbw.js",revision:null},{url:"assets/remoteEntry-BOZn_K50.js",revision:null},{url:"assets/refresh-cw-BKhUNMXQ.js",revision:null},{url:"assets/radio-CWnAI4na.js",revision:null},{url:"assets/plus-DVpT3Ja2.js",revision:null},{url:"assets/player-overlays-DzZKARlk.js",revision:null},{url:"assets/pencil-xW8n5CLs.js",revision:null},{url:"assets/mf-entry-bootstrap-0-137d5c5b.js",revision:null},{url:"assets/key-round-eCBxaKT6.js",revision:null},{url:"assets/index-CTiiXuB_.css",revision:null},{url:"assets/index-CAfPe666.js",revision:null},{url:"assets/hostInit-8PN225l2.js",revision:null},{url:"assets/hls-IujbK-0_.js",revision:null},{url:"assets/format-size-CO9d3C3-.js",revision:null},{url:"assets/download-DyMeaCfZ.js",revision:null},{url:"assets/dist-mzJ_Pmak.js",revision:null},{url:"assets/dist-CGRDjIOZ.js",revision:null},{url:"assets/copy-tH10joFB.js",revision:null},{url:"assets/circle-check-big-is5GRKO9.js",revision:null},{url:"assets/browser-BHo8W_uH.js",revision:null},{url:"assets/bell-C1jXqDWz.js",revision:null},{url:"assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-PYw2UAZ_.js",revision:null},{url:"assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DQOBkcAT.js",revision:null},{url:"assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-C1rR7FKs.js",revision:null},{url:"assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare__konva__loadShare__.js-B7XYY0cV.js",revision:null},{url:"assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DEeasWo3.js",revision:null},{url:"assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CSJxMxg6.js",revision:null},{url:"assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js",revision:null},{url:"assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-Cus-LW9c.js",revision:null},{url:"assets/StatusBadge-CkYubfRG.js",revision:null},{url:"assets/Showroom-KHowYChm.js",revision:null},{url:"assets/Settings-CriiXyFu.js",revision:null},{url:"assets/SchemaTabBar-ByWwzBUZ.js",revision:null},{url:"assets/ProviderIcon-BpqSF3Hu.js",revision:null},{url:"assets/PrivacyMaskSettings-Cut8tYhS.js",revision:null},{url:"assets/Pipeline-CS6lN8Ww.js",revision:null},{url:"assets/NodeAddonsSettingsPanel-B4ru8rzf.js",revision:null},{url:"assets/Network-D5ppyqPS.js",revision:null},{url:"assets/MyAccess-C-zxwxTM.js",revision:null},{url:"assets/MotionZonesSettings-CepMSlXn.js",revision:null},{url:"assets/MaskShapeCanvas-C5K6H6Th.js",revision:null},{url:"assets/Logs-DYrcsFh9.js",revision:null},{url:"assets/Integrations-CxuWXvnl.js",revision:null},{url:"assets/Integrations-CxFwUmeX.js",revision:null},{url:"assets/IntegrationDetail-Dyg4wlgs.js",revision:null},{url:"assets/Identity-8krGNqDO.js",revision:null},{url:"assets/FormBuilder-DVLWBVys.js",revision:null},{url:"assets/EmbedPlayerPage-CIF0Ft1g.js",revision:null},{url:"assets/Devices-XIivtEYO.js",revision:null},{url:"assets/DeviceDetail-OXTiYiO9.js",revision:null},{url:"assets/DetectionIntelligence-BtnTELA6.js",revision:null},{url:"assets/Data-hispFwBv.js",revision:null},{url:"assets/Dashboard-HorCsmCt.js",revision:null},{url:"assets/Cluster-BVUZdAyW.js",revision:null},{url:"assets/CapabilityBadges-BWnECBvl.js",revision:null},{url:"assets/Capabilities-D2qn1TDV.js",revision:null},{url:"assets/BrokerStep-B3pEVZ2L.js",revision:null},{url:"assets/BrokerForm-DzjaLHmG.js",revision:null},{url:"assets/AdminTabs-7T1CldHN.js",revision:null},{url:"assets/AdminPage-CN6ZMhf0.js",revision:null},{url:"assets/Addons-CWtFT6QM.js",revision:null},{url:"assets/AddonCollectionPage-CIvGYL8Z.js",revision:null},{url:"assets/AddLocationWizard-ty_4uW1H.js",revision:null}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("/index.html"),{denylist:[/^\/trpc/,/^\/api/,/^\/addon/,/^\/assets\//,/^\/__mfe_internal__/,/\.[a-z0-9]+$/i]}))});
1
+ if(!self.define){let e,t={};const n=(n,s)=>(n=new URL(n+".js",s).href,t[n]||new Promise(t=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=t,document.head.appendChild(e)}else e=n,importScripts(n),t()}).then(()=>{let e=t[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e}));self.define=(s,i)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(t[o])return;let r={};const c=e=>n(e,o),m={module:{uri:o},exports:r,require:c};t[o]=Promise.all(s.map(e=>m[e]||c(e))).then(e=>(i(...e),r))}}define(["./workbox-14d7584c"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.registerRoute(({request:e})=>"navigate"===e.mode,new e.NetworkFirst({cacheName:"camstack-admin-html",networkTimeoutSeconds:5,plugins:[new e.ExpirationPlugin({maxEntries:4})]}),"GET"),e.registerRoute(({url:e})=>e.pathname.startsWith("/assets/")||e.pathname.startsWith("/icons/"),new e.NetworkFirst({cacheName:"camstack-admin-assets",plugins:[new e.ExpirationPlugin({maxEntries:200,maxAgeSeconds:86400})]}),"GET")});
@@ -0,0 +1 @@
1
+ define(["exports"],function(t){"use strict";try{self["workbox:core:7.4.0"]&&_()}catch(t){}const e=(t,...e)=>{let s=t;return e.length>0&&(s+=` :: ${JSON.stringify(e)}`),s};class s extends Error{constructor(t,s){super(e(t,s)),this.name=t,this.details=s}}try{self["workbox:routing:7.4.0"]&&_()}catch(t){}const n=t=>t&&"object"==typeof t?t:{handle:t};class r{constructor(t,e,s="GET"){this.handler=n(e),this.match=t,this.method=s}setCatchHandler(t){this.catchHandler=n(t)}}class i extends r{constructor(t,e,s){super(({url:e})=>{const s=t.exec(e.href);if(s&&(e.origin===location.origin||0===s.index))return s.slice(1)},e,s)}}class a{constructor(){this.t=new Map,this.i=new Map}get routes(){return this.t}addFetchListener(){self.addEventListener("fetch",t=>{const{request:e}=t,s=this.handleRequest({request:e,event:t});s&&t.respondWith(s)})}addCacheListener(){self.addEventListener("message",t=>{if(t.data&&"CACHE_URLS"===t.data.type){const{payload:e}=t.data,s=Promise.all(e.urlsToCache.map(e=>{"string"==typeof e&&(e=[e]);const s=new Request(...e);return this.handleRequest({request:s,event:t})}));t.waitUntil(s),t.ports&&t.ports[0]&&s.then(()=>t.ports[0].postMessage(!0))}})}handleRequest({request:t,event:e}){const s=new URL(t.url,location.href);if(!s.protocol.startsWith("http"))return;const n=s.origin===location.origin,{params:r,route:i}=this.findMatchingRoute({event:e,request:t,sameOrigin:n,url:s});let a=i&&i.handler;const o=t.method;if(!a&&this.i.has(o)&&(a=this.i.get(o)),!a)return;let c;try{c=a.handle({url:s,request:t,event:e,params:r})}catch(t){c=Promise.reject(t)}const h=i&&i.catchHandler;return c instanceof Promise&&(this.o||h)&&(c=c.catch(async n=>{if(h)try{return await h.handle({url:s,request:t,event:e,params:r})}catch(t){t instanceof Error&&(n=t)}if(this.o)return this.o.handle({url:s,request:t,event:e});throw n})),c}findMatchingRoute({url:t,sameOrigin:e,request:s,event:n}){const r=this.t.get(s.method)||[];for(const i of r){let r;const a=i.match({url:t,sameOrigin:e,request:s,event:n});if(a)return r=a,(Array.isArray(r)&&0===r.length||a.constructor===Object&&0===Object.keys(a).length||"boolean"==typeof a)&&(r=void 0),{route:i,params:r}}return{}}setDefaultHandler(t,e="GET"){this.i.set(e,n(t))}setCatchHandler(t){this.o=n(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(t){if(!this.t.has(t.method))throw new s("unregister-route-but-not-found-with-method",{method:t.method});const e=this.t.get(t.method).indexOf(t);if(!(e>-1))throw new s("unregister-route-route-not-registered");this.t.get(t.method).splice(e,1)}}let o;const c=()=>(o||(o=new a,o.addFetchListener(),o.addCacheListener()),o);const h={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},u=t=>[h.prefix,t,h.suffix].filter(t=>t&&t.length>0).join("-"),l=t=>t||u(h.runtime);function f(t){t.then(()=>{})}const w=new Set;function d(){return d=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},d.apply(null,arguments)}let p,m;const y=new WeakMap,g=new WeakMap,v=new WeakMap,D=new WeakMap,b=new WeakMap;let q={get(t,e,s){if(t instanceof IDBTransaction){if("done"===e)return g.get(t);if("objectStoreNames"===e)return t.objectStoreNames||v.get(t);if("store"===e)return s.objectStoreNames[1]?void 0:s.objectStore(s.objectStoreNames[0])}return E(t[e])},set:(t,e,s)=>(t[e]=s,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function R(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(m||(m=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(I(this),e),E(y.get(this))}:function(...e){return E(t.apply(I(this),e))}:function(e,...s){const n=t.call(I(this),e,...s);return v.set(n,e.sort?e.sort():[e]),E(n)}}function x(t){return"function"==typeof t?R(t):(t instanceof IDBTransaction&&function(t){if(g.has(t))return;const e=new Promise((e,s)=>{const n=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),n()},i=()=>{s(t.error||new DOMException("AbortError","AbortError")),n()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)});g.set(t,e)}(t),e=t,(p||(p=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(t,q):t);var e}function E(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,s)=>{const n=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(E(t.result)),n()},i=()=>{s(t.error),n()};t.addEventListener("success",r),t.addEventListener("error",i)});return e.then(e=>{e instanceof IDBCursor&&y.set(e,t)}).catch(()=>{}),b.set(e,t),e}(t);if(D.has(t))return D.get(t);const e=x(t);return e!==t&&(D.set(t,e),b.set(e,t)),e}const I=t=>b.get(t);const B=["get","getKey","getAll","getAllKeys","count"],O=["put","add","delete","clear"],k=new Map;function C(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(k.get(e))return k.get(e);const s=e.replace(/FromIndex$/,""),n=e!==s,r=O.includes(s);if(!(s in(n?IDBIndex:IDBObjectStore).prototype)||!r&&!B.includes(s))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let a=i.store;return n&&(a=a.index(e.shift())),(await Promise.all([a[s](...e),r&&i.done]))[0]};return k.set(e,i),i}q=(t=>d({},t,{get:(e,s,n)=>C(e,s)||t.get(e,s,n),has:(e,s)=>!!C(e,s)||t.has(e,s)}))(q);try{self["workbox:expiration:7.4.0"]&&_()}catch(t){}const N="cache-entries",j=t=>{const e=new URL(t,location.href);return e.hash="",e.href};class P{constructor(t){this.h=null,this.u=t}l(t){const e=t.createObjectStore(N,{keyPath:"id"});e.createIndex("cacheName","cacheName",{unique:!1}),e.createIndex("timestamp","timestamp",{unique:!1})}p(t){this.l(t),this.u&&function(t,{blocked:e}={}){const s=indexedDB.deleteDatabase(t);e&&s.addEventListener("blocked",t=>e(t.oldVersion,t)),E(s).then(()=>{})}(this.u)}async setTimestamp(t,e){const s={url:t=j(t),timestamp:e,cacheName:this.u,id:this.m(t)},n=(await this.getDb()).transaction(N,"readwrite",{durability:"relaxed"});await n.store.put(s),await n.done}async getTimestamp(t){const e=await this.getDb(),s=await e.get(N,this.m(t));return null==s?void 0:s.timestamp}async expireEntries(t,e){const s=await this.getDb();let n=await s.transaction(N).store.index("timestamp").openCursor(null,"prev");const r=[];let i=0;for(;n;){const s=n.value;s.cacheName===this.u&&(t&&s.timestamp<t||e&&i>=e?r.push(n.value):i++),n=await n.continue()}const a=[];for(const t of r)await s.delete(N,t.id),a.push(t.url);return a}m(t){return this.u+"|"+j(t)}async getDb(){return this.h||(this.h=await function(t,e,{blocked:s,upgrade:n,blocking:r,terminated:i}={}){const a=indexedDB.open(t,e),o=E(a);return n&&a.addEventListener("upgradeneeded",t=>{n(E(a.result),t.oldVersion,t.newVersion,E(a.transaction),t)}),s&&a.addEventListener("blocked",t=>s(t.oldVersion,t.newVersion,t)),o.then(t=>{i&&t.addEventListener("close",()=>i()),r&&t.addEventListener("versionchange",t=>r(t.oldVersion,t.newVersion,t))}).catch(()=>{}),o}("workbox-expiration",1,{upgrade:this.p.bind(this)})),this.h}}class M{constructor(t,e={}){this.v=!1,this.D=!1,this.q=e.maxEntries,this.R=e.maxAgeSeconds,this.I=e.matchOptions,this.u=t,this.B=new P(t)}async expireEntries(){if(this.v)return void(this.D=!0);this.v=!0;const t=this.R?Date.now()-1e3*this.R:0,e=await this.B.expireEntries(t,this.q),s=await self.caches.open(this.u);for(const t of e)await s.delete(t,this.I);this.v=!1,this.D&&(this.D=!1,f(this.expireEntries()))}async updateTimestamp(t){await this.B.setTimestamp(t,Date.now())}async isURLExpired(t){if(this.R){const e=await this.B.getTimestamp(t),s=Date.now()-1e3*this.R;return void 0===e||e<s}return!1}async delete(){this.D=!1,await this.B.expireEntries(1/0)}}try{self["workbox:strategies:7.4.0"]&&_()}catch(t){}const T={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};function U(t,e){const s=new URL(t);for(const t of e)s.searchParams.delete(t);return s.href}class W{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}}function S(t){return"string"==typeof t?new Request(t):t}class A{constructor(t,e){this.O={},Object.assign(this,e),this.event=e.event,this._=t,this.k=new W,this.C=[],this.N=[...t.plugins],this.j=new Map;for(const t of this.N)this.j.set(t,{});this.event.waitUntil(this.k.promise)}async fetch(t){const{event:e}=this;let n=S(t);if("navigate"===n.mode&&e instanceof FetchEvent&&e.preloadResponse){const t=await e.preloadResponse;if(t)return t}const r=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))n=await t({request:n.clone(),event:e})}catch(t){if(t instanceof Error)throw new s("plugin-error-request-will-fetch",{thrownErrorMessage:t.message})}const i=n.clone();try{let t;t=await fetch(n,"navigate"===n.mode?void 0:this._.fetchOptions);for(const s of this.iterateCallbacks("fetchDidSucceed"))t=await s({event:e,request:i,response:t});return t}catch(t){throw r&&await this.runCallbacks("fetchDidFail",{error:t,event:e,originalRequest:r.clone(),request:i.clone()}),t}}async fetchAndCachePut(t){const e=await this.fetch(t),s=e.clone();return this.waitUntil(this.cachePut(t,s)),e}async cacheMatch(t){const e=S(t);let s;const{cacheName:n,matchOptions:r}=this._,i=await this.getCacheKey(e,"read"),a=Object.assign(Object.assign({},r),{cacheName:n});s=await caches.match(i,a);for(const t of this.iterateCallbacks("cachedResponseWillBeUsed"))s=await t({cacheName:n,matchOptions:r,cachedResponse:s,request:i,event:this.event})||void 0;return s}async cachePut(t,e){const n=S(t);var r;await(r=0,new Promise(t=>setTimeout(t,r)));const i=await this.getCacheKey(n,"write");if(!e)throw new s("cache-put-with-no-response",{url:(a=i.url,new URL(String(a),location.href).href.replace(new RegExp(`^${location.origin}`),""))});var a;const o=await this.P(e);if(!o)return!1;const{cacheName:c,matchOptions:h}=this._,u=await self.caches.open(c),l=this.hasCallback("cacheDidUpdate"),f=l?await async function(t,e,s,n){const r=U(e.url,s);if(e.url===r)return t.match(e,n);const i=Object.assign(Object.assign({},n),{ignoreSearch:!0}),a=await t.keys(e,i);for(const e of a)if(r===U(e.url,s))return t.match(e,n)}(u,i.clone(),["__WB_REVISION__"],h):null;try{await u.put(i,l?o.clone():o)}catch(t){if(t instanceof Error)throw"QuotaExceededError"===t.name&&await async function(){for(const t of w)await t()}(),t}for(const t of this.iterateCallbacks("cacheDidUpdate"))await t({cacheName:c,oldResponse:f,newResponse:o.clone(),request:i,event:this.event});return!0}async getCacheKey(t,e){const s=`${t.url} | ${e}`;if(!this.O[s]){let n=t;for(const t of this.iterateCallbacks("cacheKeyWillBeUsed"))n=S(await t({mode:e,request:n,event:this.event,params:this.params}));this.O[s]=n}return this.O[s]}hasCallback(t){for(const e of this._.plugins)if(t in e)return!0;return!1}async runCallbacks(t,e){for(const s of this.iterateCallbacks(t))await s(e)}*iterateCallbacks(t){for(const e of this._.plugins)if("function"==typeof e[t]){const s=this.j.get(e),n=n=>{const r=Object.assign(Object.assign({},n),{state:s});return e[t](r)};yield n}}waitUntil(t){return this.C.push(t),t}async doneWaiting(){for(;this.C.length;){const t=this.C.splice(0),e=(await Promise.allSettled(t)).find(t=>"rejected"===t.status);if(e)throw e.reason}}destroy(){this.k.resolve(null)}async P(t){let e=t,s=!1;for(const t of this.iterateCallbacks("cacheWillUpdate"))if(e=await t({request:this.request,response:e,event:this.event})||void 0,s=!0,!e)break;return s||e&&200!==e.status&&(e=void 0),e}}class L{constructor(t={}){this.cacheName=l(t.cacheName),this.plugins=t.plugins||[],this.fetchOptions=t.fetchOptions,this.matchOptions=t.matchOptions}handle(t){const[e]=this.handleAll(t);return e}handleAll(t){t instanceof FetchEvent&&(t={event:t,request:t.request});const e=t.event,s="string"==typeof t.request?new Request(t.request):t.request,n="params"in t?t.params:void 0,r=new A(this,{event:e,request:s,params:n}),i=this.M(r,s,e);return[i,this.T(i,r,s,e)]}async M(t,e,n){let r;await t.runCallbacks("handlerWillStart",{event:n,request:e});try{if(r=await this.U(e,t),!r||"error"===r.type)throw new s("no-response",{url:e.url})}catch(s){if(s instanceof Error)for(const i of t.iterateCallbacks("handlerDidError"))if(r=await i({error:s,event:n,request:e}),r)break;if(!r)throw s}for(const s of t.iterateCallbacks("handlerWillRespond"))r=await s({event:n,request:e,response:r});return r}async T(t,e,s,n){let r,i;try{r=await t}catch(i){}try{await e.runCallbacks("handlerDidRespond",{event:n,request:s,response:r}),await e.doneWaiting()}catch(t){t instanceof Error&&(i=t)}if(await e.runCallbacks("handlerDidComplete",{event:n,request:s,response:r,error:i}),e.destroy(),i)throw i}}t.ExpirationPlugin=class{constructor(t={}){this.cachedResponseWillBeUsed=async({event:t,request:e,cacheName:s,cachedResponse:n})=>{if(!n)return null;const r=this.W(n),i=this.S(s);f(i.expireEntries());const a=i.updateTimestamp(e.url);if(t)try{t.waitUntil(a)}catch(t){}return r?n:null},this.cacheDidUpdate=async({cacheName:t,request:e})=>{const s=this.S(t);await s.updateTimestamp(e.url),await s.expireEntries()},this.A=t,this.R=t.maxAgeSeconds,this.L=new Map,t.purgeOnQuotaError&&function(t){w.add(t)}(()=>this.deleteCacheAndMetadata())}S(t){if(t===l())throw new s("expire-custom-caches-only");let e=this.L.get(t);return e||(e=new M(t,this.A),this.L.set(t,e)),e}W(t){if(!this.R)return!0;const e=this.F(t);if(null===e)return!0;return e>=Date.now()-1e3*this.R}F(t){if(!t.headers.has("date"))return null;const e=t.headers.get("date"),s=new Date(e).getTime();return isNaN(s)?null:s}async deleteCacheAndMetadata(){for(const[t,e]of this.L)await self.caches.delete(t),await e.delete();this.L=new Map}},t.NetworkFirst=class extends L{constructor(t={}){super(t),this.plugins.some(t=>"cacheWillUpdate"in t)||this.plugins.unshift(T),this.H=t.networkTimeoutSeconds||0}async U(t,e){const n=[],r=[];let i;if(this.H){const{id:s,promise:a}=this.$({request:t,logs:n,handler:e});i=s,r.push(a)}const a=this.K({timeoutId:i,request:t,logs:n,handler:e});r.push(a);const o=await e.waitUntil((async()=>await e.waitUntil(Promise.race(r))||await a)());if(!o)throw new s("no-response",{url:t.url});return o}$({request:t,logs:e,handler:s}){let n;return{promise:new Promise(e=>{n=setTimeout(async()=>{e(await s.cacheMatch(t))},1e3*this.H)}),id:n}}async K({timeoutId:t,request:e,logs:s,handler:n}){let r,i;try{i=await n.fetchAndCachePut(e)}catch(t){t instanceof Error&&(r=t)}return t&&clearTimeout(t),!r&&i||(i=await n.cacheMatch(e)),i}},t.clientsClaim=function(){self.addEventListener("activate",()=>self.clients.claim())},t.registerRoute=function(t,e,n){let a;if("string"==typeof t){const s=new URL(t,location.href);a=new r(({url:t})=>t.href===s.href,e,n)}else if(t instanceof RegExp)a=new i(t,e,n);else if("function"==typeof t)a=new r(t,e,n);else{if(!(t instanceof r))throw new s("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});a=t}return c().registerRoute(a),a}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "CamStack Admin UI — Vite frontend build and server-side addon",
@@ -1 +0,0 @@
1
- import{$ as e,Bi as t,Ii as n,Ni as r,Q as i,Z as a,_t as o,at as s,ct as c,dr as l,dt as u,et as d,g as ee,ht as f,it as p,lt as te,m,mt as ne,nt as h,ot as re,pt as g,rt as _,tt as ie,ut as v,v as ae,vr as y,vt as oe,yt as b}from"./src-C5tvi19O.js";import{F as x,G as S,L as se,R as C,U as w,W as T,X as E,b as D,o as ce,x as O,y as k}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CK8iQdP1.js";import{p as le}from"./player-overlays-DzZKARlk.js";import{t as A}from"./download-DyMeaCfZ.js";import{t as ue}from"./plus-DVpT3Ja2.js";import{t as j}from"./refresh-cw-BKhUNMXQ.js";import{t as M}from"./search-DyWYI0Yj.js";import{t as N}from"./upload-BeG8PyHB.js";import{A as de,B as P,F,H as fe,P as pe,W as I,b as L,f as me,h as R,i as z,o as B,p as V,s as he,x as H}from"./index-CAfPe666.js";import{t as U}from"./AdminPage-CN6ZMhf0.js";import{t as ge}from"./NodeAddonsSettingsPanel-B4ru8rzf.js";var _e=P(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),W=P(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),ve=P(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),G=P(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]);E();function ye({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:i}){let a=n===`upload`||n===`local`,{data:o,isLoading:s}=_({name:e});return O(`div`,{className:`fixed z-50 w-72 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,style:{top:`auto`,bottom:`auto`},ref:e=>{if(!e)return;let t=e.parentElement?.getBoundingClientRect();if(!t)return;let n=window.innerHeight-t.bottom,r=t.top;n<280&&r>n?(e.style.bottom=`${window.innerHeight-t.top+4}px`,e.style.top=`auto`):(e.style.top=`${t.bottom+4}px`,e.style.bottom=`auto`),e.style.right=`${window.innerWidth-t.right}px`},onClick:e=>e.stopPropagation(),children:[O(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[D(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),D(`button`,{type:`button`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:D(z,{className:`h-3 w-3`})})]}),a&&O(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[D(N,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),O(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[O(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,D(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),s&&O(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[D(H,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),o&&D(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:o.map(e=>{let n=e.version===t,i=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version);return O(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[D(`span`,{className:`font-mono flex-1 ${n?`text-primary font-semibold`:i?`text-amber-400`:`text-foreground`}`,children:e.version}),e.distTags.map(e=>D(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),e.deprecated&&D(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),D(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()}),n&&!a?D(F,{className:`h-3 w-3 text-primary shrink-0`}):D(`button`,{type:`button`,onClick:()=>r(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:n?`Re-install ${e.version} from npm`:`Install ${e.version}`,children:D(A,{className:`h-3 w-3`})})]},e.version)})}),o&&o.length===0&&D(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var K={queued:{icon:W,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:H,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:j,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:F,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:ve,bg:`bg-danger/10 text-danger`,label:`failed`}};function q({item:e}){let t=K[e.status],n=t.icon;return O(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[D(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}var J=`device-export`;function Y(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===J)}function be({isBundle:e,installSource:t,addonId:n,iconPath:r,color:i}){let[a,o]=S(!1),s=i?{backgroundColor:`${i.startsWith(`#`)?i:`#${i}`}26`}:void 0,c=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,l=n&&r?`/api/addon-assets/${n}/${r}`:null,u=!!l&&!a;return O(`div`,{className:`relative flex-shrink-0`,children:[D(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${s?``:c}`,style:s,children:u?D(`img`,{src:l,alt:n,className:`h-5 w-5`,onError:()=>o(!0)}):D(e?G:R,{className:`h-4 w-4`})}),t===`local`&&D(`span`,{className:`absolute -top-1.5 -left-1.5 text-[7px] font-bold leading-none bg-orange-500 text-white px-1 py-0.5 rounded -rotate-12 shadow-sm`,children:`DEV`}),t===`npm`&&D(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:D(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:D(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&D(`span`,{className:`absolute -top-1.5 -left-1.5 flex items-center justify-center h-4 w-4 rounded bg-cyan-500 -rotate-12 shadow-sm`,children:D(N,{className:`h-2.5 w-2.5 text-white`})})]})}function xe({addonId:e}){let t=ce(),{data:n=`inherit`}=d({addonId:e}),r=f({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return D(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>D(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),r.mutate({addonId:e,channel:t})},disabled:r.isPending,className:`px-2.5 py-1 transition-colors capitalize ${n===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}function Se({addon:e,agents:t=[],clusterStatus:n,hideVersion:i,availableUpdate:a,onUpdate:o,isUpdating:s,bundle:c,bulkItem:l,disabledByBulk:d}){let[f,te]=S(!1),[ne,h]=S(!1),[re,_]=S(!1),[ie,v]=S(!1),[y,b]=S(!1),[x,se]=S(`logs`),C=ce(),w=le(),T=fe(),E=r(),{manifest:M}=e,N=e.installedOn??[],de=!c&&!M.protected&&M.removable!==!1,P=!!c,F=c?.displayName??M.name,I=c?.packageName??M.packageName,L=c?.version??M.packageVersion??M.version,R=c?.installSource??e.installSource,B=c?c.bundle?.description??c.addons[0]?.manifest.description:M.description;!c&&(M.components&&M.components.length>0||t.length);let U=oe({onSuccess:()=>{C.invalidateQueries({queryKey:[[`addons`]]}),C.invalidateQueries({queryKey:[[`addonPages`]]}),C.invalidateQueries({queryKey:[[`capabilities`]]})}}),W=u({onSuccess:()=>{C.invalidateQueries({queryKey:[[`addons`]]})}}),K=p({onSuccess:()=>{C.invalidateQueries({queryKey:[[`addons`]]}),C.invalidateQueries({queryKey:[[`addonPages`]]}),C.invalidateQueries({queryKey:[[`capabilities`]]}),C.invalidateQueries({queryKey:[[`integrations`]]})}}),J=g({onSuccess:()=>{C.invalidateQueries({queryKey:[[`addons`]]}),C.invalidateQueries({queryKey:[[`alerts`]]})}}),X=e.health,Z=X?.phase===`failed`&&!X.inGracePeriod,Ce=Z&&X?.nextRetryAt&&!X.retrying;return O(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${Z?`border-red-500/50`:`border-border`}`,children:[Z&&X&&O(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[D(ve,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),O(`div`,{className:`flex-1 min-w-0`,children:[O(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,X.retryCount,`)`]}),D(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:X.lastError?.message??`Unknown error`}),Ce&&X.nextRetryAt&&O(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(X.nextRetryAt).toLocaleTimeString()]})]}),O(`button`,{type:`button`,disabled:J.isPending||X.retrying,onClick:e=>{e.stopPropagation(),J.mutate({packageName:I})},className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[11px] font-semibold border border-red-400/40 bg-red-400/10 text-red-700 dark:text-red-300 hover:bg-red-400/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0`,title:`Reset retry counter and force immediate reload`,children:[D(j,{className:`h-3 w-3 ${J.isPending||X.retrying?`animate-spin`:``}`}),`Retry now`]})]}),O(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[D(be,{isBundle:P||!!M.components&&M.components.length>1,installSource:R,addonId:P?c.addons[0]?.manifest.id:M.id,iconPath:P?c.bundle?.icon??c.addons[0]?.manifest.icon:M.icon,color:P?c.addons[0]?.manifest.color:M.color}),O(`div`,{className:`flex-1 min-w-0`,children:[O(`div`,{className:`flex items-center gap-2`,children:[D(`span`,{className:`text-sm font-semibold text-foreground truncate`,children:F}),O(`span`,{className:`text-[10px] text-foreground-subtle font-mono shrink-0`,children:[`(`,I,`)`]}),P&&O(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,children:[D(G,{className:`h-3 w-3`}),c.addons.length]}),l!=null&&D(q,{item:l})]}),B&&D(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5 line-clamp-1`,children:B}),!P&&e.process&&O(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[D(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.mode===`forked`?`forked`:`in-process`}),e.process.pid!=null&&O(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),D(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:e.process.state===`crashed`||e.process.state===`failed`?`bg-red-500/15 text-red-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.state})]})]}),!i&&O(`div`,{className:`relative inline-flex items-center gap-1.5 shrink-0 pt-0.5`,children:[s?O(`span`,{className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400`,children:[D(H,{className:`h-3 w-3 animate-spin`}),`Updating to `,a,`…`]}):a&&o?O(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},disabled:d,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-semibold border border-primary/40 bg-primary/10 text-primary hover:bg-primary/20 transition-colors animate-pulse disabled:opacity-50 disabled:cursor-not-allowed`,title:`Update to ${a}`,children:[D(A,{className:`h-3 w-3`}),a]}):null,O(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),_(e=>!e)},disabled:d,className:[`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,R===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:a?`border-amber-500/30 bg-amber-500/10 text-amber-400 hover:bg-amber-500/20`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:a?`Current ${L} — newer ${a} available`:`View all versions`,children:[L,D(pe,{className:`h-3 w-3 opacity-50`})]}),re&&D(ye,{packageName:I,currentVersion:L,...R?{installSource:R}:{},onInstall:e=>{_(!1),K.mutate({packageName:I,version:e})},onClose:()=>_(!1)})]})]}),!P&&O(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[O(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),W.mutate({addonId:M.id})},disabled:W.isPending||d,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-blue-400 hover:border-blue-500/30 hover:bg-blue-500/10 disabled:opacity-50 transition-colors`,children:[D(j,{className:`h-3 w-3 ${W.isPending?`animate-spin`:``}`}),`Restart`]}),O(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),v(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${ie?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[D(V,{className:`h-3 w-3`}),`Logs`]}),!P&&O(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),b(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${y?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[D(me,{className:`h-3 w-3`}),`Settings`]}),D(`div`,{className:`flex-1`}),de&&O(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await E({title:`Uninstall ${M.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&U.mutate({packageName:M.packageName})},disabled:U.isPending||d,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-red-400 hover:border-red-500/30 hover:bg-red-500/10 disabled:opacity-50 transition-colors`,children:[D(he,{className:`h-3 w-3`}),U.isPending?`Removing...`:`Uninstall`]})]}),n&&n.nodes.length>1&&!P&&O(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[D(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),D(`div`,{className:`space-y-1`,children:n.nodes.map(e=>O(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[D(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`offline`?`bg-muted-foreground/30`:e.synced?`bg-success`:`bg-amber-500`}`}),D(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),D(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&D(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:`outdated`}),e.status===`offline`&&D(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&D(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),ie&&!P&&O(`div`,{className:`border-t border-border`,children:[O(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[O(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[D(`button`,{type:`button`,onClick:()=>se(`logs`),className:`px-2 py-0.5 transition-colors ${x===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),D(`button`,{type:`button`,onClick:()=>se(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${x===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),D(`div`,{className:`flex-1`}),D(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),v(!1)},className:`text-foreground-subtle hover:text-foreground`,children:D(z,{className:`h-3.5 w-3.5`})})]}),x===`logs`&&D(ee,{addonId:M.id,maxHeight:`max-h-64`,showFilters:!1}),x===`events`&&D(m,{addonId:M.id,category:`addon.*`,maxHeight:`max-h-64`})]}),P&&O(k,{children:[D(`button`,{type:`button`,onClick:()=>te(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:D(f?_e:pe,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),f&&D(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:c.addons.map(e=>D(Se,{addon:e,agents:t,hideVersion:!0},e.manifest.id))})]}),y&&!P&&D(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>b(!1),children:O(`div`,{className:`w-full max-w-lg max-h-[80vh] rounded-xl border border-border bg-surface shadow-2xl flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[O(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[O(`div`,{className:`flex items-center gap-2`,children:[D(me,{className:`h-4 w-4 text-primary`}),O(`h2`,{className:`text-sm font-semibold text-foreground`,children:[F,` Settings`]})]}),D(`button`,{onClick:()=>b(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:D(z,{className:`h-4 w-4`})})]}),O(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[D(ge,{nodeId:`hub`,addonIds:[M.id],level:`global`}),Y(M)&&O(`div`,{children:[D(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),D(ae,{addonId:M.id,trpc:w.trpcClient,onOpenDevice:e=>T(`/devices/${e}`)})]}),R===`npm`&&O(`div`,{children:[D(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),D(xe,{addonId:M.id})]}),M.components&&M.components.length>0&&O(`div`,{children:[O(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,M.components.length,`)`]}),D(`div`,{className:`flex flex-wrap gap-1`,children:M.components.map(e=>D(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),t.length>=2&&O(`div`,{children:[D(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),O(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[N.length===0&&D(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),N.map(e=>D(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),O(`div`,{className:`relative`,children:[O(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(e=>!e)},className:`inline-flex items-center gap-1 rounded-full border border-dashed border-border px-2 py-0.5 text-[10px] text-foreground-subtle hover:text-foreground hover:border-primary transition-colors`,title:`Install on more agents`,children:[D(ue,{className:`h-3 w-3`}),`Add agent`]}),ne&&O(`div`,{className:`absolute left-0 top-full mt-1 z-10 min-w-[160px] rounded-md border border-border bg-surface shadow-lg overflow-hidden`,children:[t.filter(e=>!e.isHub&&!N.includes(e.name)).map(e=>D(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(!1)},className:`w-full text-left px-3 py-1.5 text-[10px] text-foreground hover:bg-surface-hover transition-colors`,children:e.name},e.id)),t.filter(e=>!e.isHub&&!N.includes(e.name)).length===0&&D(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),D(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:D(`button`,{type:`button`,onClick:()=>b(!1),className:`rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:`Close`})})]})})]})}function X({addon:e,bulkItem:t,disabledByBulk:n,latestVersion:r,onUpdate:i,onRestart:a,onUninstall:o}){let{isSystem:s}=e,c=r!==null&&r!==e.currentVersion;return O(`tr`,{className:s?`bg-amber-500/5`:``,children:[D(`td`,{className:`px-2 py-1.5`,children:O(`div`,{className:`flex items-center gap-2`,children:[s&&D(L,{className:`w-3 h-3 text-amber-700`,"aria-label":`System package`}),D(`span`,{className:`font-mono text-xs`,children:e.name}),s&&D(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/15 text-amber-800 font-medium`,children:`SYSTEM`}),s&&D(`span`,{className:`ml-1 text-[10px] uppercase tracking-wide text-amber-700/80`,title:`Changes require a hub restart`,children:`requires restart`})]})}),D(`td`,{className:`px-2 py-1.5`,children:D(`span`,{className:`font-mono text-xs`,children:e.currentVersion})}),D(`td`,{className:`px-2 py-1.5`,children:D(`span`,{className:`font-mono text-xs`,children:r??`—`})}),D(`td`,{className:`px-2 py-1.5`,children:t!==null&&D(q,{item:t})}),D(`td`,{className:`px-2 py-1.5`,children:O(`div`,{className:`flex items-center gap-1`,children:[c&&D(`button`,{type:`button`,disabled:n,onClick:()=>i(r),className:`text-[10px] px-2 py-0.5 rounded bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-40`,children:`Update`}),D(`button`,{type:`button`,disabled:n,onClick:a,className:`text-[10px] px-2 py-0.5 rounded bg-muted text-muted-foreground hover:bg-muted/80 disabled:opacity-40`,children:`Restart`}),!s&&D(`button`,{type:`button`,disabled:n,onClick:o,className:`text-[10px] px-2 py-0.5 rounded bg-danger/10 text-danger hover:bg-danger/20 disabled:opacity-40`,children:`Uninstall`})]})})]})}E();var Z=`.tgz,.tar.gz,.zip`;function Ce({onUploadSuccess:e}){let[t,n]=S(!1),r=T(null),i=x(async t=>{n(!0);let r=new FormData;r.append(`file`,t);let i=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(`/api/addons/upload`,{method:`POST`,headers:{Authorization:`Bearer ${i}`},body:r})).json()).success&&e()}finally{n(!1)}},[e]);return O(k,{children:[D(`input`,{ref:r,type:`file`,accept:Z,onChange:x(e=>{let t=e.target.files?.[0];t&&i(t),e.target.value=``},[i]),className:`hidden`}),O(`button`,{type:`button`,onClick:()=>r.current?.click(),disabled:t,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[t?D(H,{className:`w-3.5 h-3.5 animate-spin`}):D(N,{className:`w-3.5 h-3.5`}),t?`Uploading...`:`Upload`]})]})}var we={regular:`Updating addons`,system:`Updating system packages`,restarting:`Restarting hub… (~10s)`,finalizing:`Finalizing`};function Te({state:e,onCancel:t}){let n=e.total===0?0:Math.round(e.completed/e.total*100),r=e.phase!==`restarting`&&!e.cancelled&&e.completedAtMs===void 0;return O(`div`,{className:`sticky top-0 z-30 bg-surface border-b border-border px-3 py-2 space-y-1.5`,children:[O(`div`,{className:`flex items-center gap-2 text-xs`,children:[D(H,{className:`w-3.5 h-3.5 animate-spin text-primary`}),D(`span`,{className:`font-medium`,children:we[e.phase]}),D(`span`,{className:`text-foreground-subtle`,children:`·`}),O(`span`,{className:`text-foreground-subtle`,children:[e.completed,`/`,e.total]}),e.current!==null&&O(k,{children:[D(`span`,{className:`text-foreground-subtle`,children:`·`}),D(`span`,{className:`font-mono text-foreground-subtle truncate`,children:e.current})]}),O(`div`,{className:`ml-auto flex items-center gap-2`,children:[e.failed>0&&O(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-danger/10 text-danger`,children:[e.failed,` failed`]}),D(`button`,{type:`button`,onClick:t,disabled:!r,className:`text-[10px] px-2 py-0.5 rounded border border-border hover:bg-surface-hover disabled:opacity-40`,children:`Cancel`})]})]}),D(`div`,{className:`h-1 bg-muted rounded overflow-hidden`,children:D(`div`,{className:`h-full bg-primary transition-[width] duration-200`,style:{width:`${n}%`}})}),e.phase===`system`&&O(`div`,{className:`text-[10px] text-amber-700 flex items-center gap-1`,children:[D(B,{className:`w-3 h-3`}),`System phase: the hub will restart once at the end (~10s).`]})]})}function Ee({pending:e,onCancel:t,onConfirm:n,isPending:r,error:i}){return D(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:O(`div`,{className:`bg-surface border border-border rounded-md shadow-xl p-5 max-w-md w-full mx-4 space-y-3`,children:[O(`div`,{className:`flex items-center gap-2`,children:[D(B,{className:`w-4 h-4 text-amber-700`}),D(`h3`,{className:`text-sm font-medium text-foreground`,children:`Update system package?`})]}),O(`div`,{className:`space-y-2 text-[11px] text-foreground-subtle`,children:[O(`div`,{children:[D(`span`,{className:`font-mono text-foreground`,children:e.packageName}),D(`span`,{className:`mx-1`,children:`·`}),O(`span`,{className:`font-mono`,children:[`v`,e.fromVersion]}),D(`span`,{className:`mx-1`,children:`→`}),O(`span`,{className:`font-mono text-amber-700`,children:[`v`,e.toVersion]})]}),D(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 p-2 text-amber-800`,children:`The hub will restart immediately after the install. Any in-flight requests will be dropped. The reconnect typically takes ~10 seconds.`}),i!==null&&D(`div`,{className:`rounded border border-danger/40 bg-danger/10 p-2 text-danger`,children:i})]}),O(`div`,{className:`flex justify-end gap-2 pt-1`,children:[D(`button`,{type:`button`,onClick:t,disabled:r,className:`px-3 py-1.5 text-[11px] rounded bg-surface hover:bg-surface-hover border border-border disabled:opacity-50`,children:`Cancel`}),O(`button`,{type:`button`,onClick:n,disabled:r,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded bg-amber-500/20 text-amber-800 hover:bg-amber-500/30 border border-amber-500/40 font-medium disabled:opacity-50`,children:[r?D(H,{className:`w-3 h-3 animate-spin`}):D(A,{className:`w-3 h-3`}),`Update & restart`]})]})]})})}E();function De(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Oe(e){let t=e;if(!t?.manifest)return null;let n={...t.manifest,name:t.manifest.name??t.manifest.id,version:t.manifest.version??`0.0.0`,capabilities:t.manifest.capabilities??[]},r=t.process,i=r?{pid:r.pid,mode:r.mode===`forked`?`forked`:`in-process`,state:r.state??`unknown`}:void 0,a=t.health,o=t.declaration?.execution,s=t.manifest.execution,c=o?.placement??s?.placement;return{manifest:n,enabled:!0,source:t.source,installSource:t.installSource,installedOn:[],...i?{process:i}:{},hasBackup:t.hasBackup,...a?{health:a}:{},...c?{placement:c}:{}}}function ke(e){let t=new Map,n=[];for(let r of e){let e=r.manifest.packageName;if(!e){n.push(r);continue}let i=t.get(e);if(i)i.addons.push(r);else{let n=r.manifest.bundle,i={packageName:e,displayName:n?.displayName??r.manifest.packageDisplayName??r.manifest.name,version:r.manifest.packageVersion,addons:[r],...r.installSource===void 0?{}:{installSource:r.installSource},...n===void 0?{}:{bundle:n}};t.set(e,i)}}let r=[];for(let e of t.values())e.bundle!==void 0||e.addons.length>=2?r.push({bundle:e,representative:e.addons[0]}):r.push(e.addons[0]);return r.push(...n),r}function Q(e){return`bundle`in e}function Ae({addons:e,clusterStatus:n,selectedNode:r,onRefresh:s,isRefreshing:l}){let u=ce(),[d,ee]=S(``),f=se(d),[m,g]=S(!1),_=T(null);C(()=>{if(!m)return;let e=e=>{_.current&&!_.current.contains(e.target)&&g(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[m]);let{data:v}=te({nodeId:r.id}),ae=w(()=>{let e=new Map;for(let t of v??[])e.set(t.name,t.latestVersion);return e},[v]),[y,oe]=S(null),[E,k]=S(null),le=b({onMutate:e=>{oe(e.name),k(null)},onSuccess:(e,t)=>{oe(null);let n=e;if(n&&n.success===!1){k({name:t.name,message:n.error??`Update failed (no error message returned by server)`});return}u.invalidateQueries({queryKey:[[`addons`]]}),u.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{oe(null),k({name:t.name,message:e instanceof Error?e.message:String(e)})}}),{data:ue}=ie(void 0),N=a({onSuccess:()=>{u.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:P,isFetching:fe}=ne({query:f||void 0},{enabled:m}),{data:pe}=re({nodeId:r.id},{staleTime:1/0}),[L,me]=S(null);t(`AddonsBulkUpdateProgress`,e=>{e.data?.nodeId===r.id&&me(e.data)});let R=w(()=>L===null?(pe??[])[0]??null:L,[L,pe]),z=R!==null&&R.completedAtMs===void 0,B=w(()=>R===null?new Map:new Map(R.items.map(e=>[e.name,e])),[R]),V=o(),he=i(),{data:U}=h(void 0),ge=U?.requestedAt,[_e,W]=S(null),[ve,G]=S(!1);C(()=>{if(U?.kind===`framework-bulk-update`&&U.requestedAt!==_e){W(U.requestedAt),G(!0);let e=window.setTimeout(()=>G(!1),6e3);return()=>window.clearTimeout(e)}},[ge,_e,U]);let{data:ye}=c(void 0),[K,q]=S(null),[J,Y]=S(null),be=b({onSuccess:()=>{q(null),u.invalidateQueries({queryKey:[[`addons`]]})},onError:e=>{Y(e instanceof Error?e.message:String(e))}}),xe=x(async()=>{let e=v??[];if(e.length===0)return;let t=e.map(e=>({name:e.name,version:e.latestVersion,isSystem:e.isSystem}));await V.mutateAsync({nodeId:r.id,items:t})},[v,r.id,V]),Z=p({onSuccess:()=>{u.invalidateQueries({queryKey:[[`addons`]]}),u.invalidateQueries({queryKey:[[`addonPages`]]}),u.invalidateQueries({queryKey:[[`capabilities`]]}),u.invalidateQueries({queryKey:[[`integrations`]]})}}),[we,Oe]=S(`type`),[Ae,je]=S(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Me=e=>{je(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[Ne,Pe]=I(),$=Ne.get(`capability`),Fe=w(()=>{let t=r.isHub?e:e.filter(e=>De(e.placement,r.isHub));return $&&(t=t.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===$))),t},[e,r.isHub,$]),Ie=()=>{let e=new URLSearchParams(Ne);e.delete(`capability`),Pe(e,{replace:!0})},Le=Ae===`flat`?Fe:ke(Fe),Re=w(()=>{let e=[...Le];switch(we){case`type`:e.sort((e,t)=>{let n=+!Q(e),r=+!Q(t);if(n!==r)return n-r;let i=Q(e)?e.bundle.displayName:e.manifest.name,a=Q(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=Q(e)?e.bundle.displayName:e.manifest.name,r=Q(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=Q(e)?e.bundle.installSource??``:e.installSource??``,r=Q(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[Le,we]);return O(`div`,{className:`space-y-4`,children:[E&&D(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:O(`div`,{className:`flex items-start justify-between gap-3`,children:[O(`div`,{className:`space-y-0.5`,children:[O(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,E.name]}),D(`div`,{className:`text-foreground-subtle font-mono`,children:E.message})]}),D(`button`,{type:`button`,onClick:()=>k(null),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})}),O(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[O(`div`,{className:`flex items-center gap-1.5`,children:[D(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),O(`select`,{value:we,onChange:e=>Oe(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[D(`option`,{value:`type`,children:`Bundles first`}),D(`option`,{value:`name`,children:`Name`}),D(`option`,{value:`source`,children:`Install source`})]})]}),O(`div`,{className:`flex items-center gap-1.5`,children:[D(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),D(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>D(`button`,{type:`button`,onClick:()=>Me(e),className:`px-2.5 py-1.5 transition-colors capitalize ${Ae===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?`Group multi-addon packages into a bundle card`:`Show every addon as its own card`,children:e},e))})]}),r.isHub&&O(`div`,{className:`flex items-center gap-1.5`,children:[D(j,{className:`h-3 w-3 text-foreground-subtle`}),D(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),D(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>D(`button`,{type:`button`,onClick:()=>N.mutate({channel:e}),disabled:N.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${ue?.channel===e?e===`off`?`bg-gray-700 text-gray-200`:e===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${e===`off`?``:`border-l border-border`}`,children:e},e))})]}),(v?.length??0)>0&&O(`button`,{type:`button`,onClick:()=>void xe(),disabled:V.isPending||z,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border border-blue-500/30 disabled:opacity-50 transition-colors font-medium`,children:[D(A,{className:`w-3 h-3 ${V.isPending?`animate-bounce`:``}`}),`Update All (`,v.length,`)`]}),O(`button`,{type:`button`,onClick:s,disabled:l||z,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[D(j,{className:`w-3 h-3 ${l?`animate-spin`:``}`}),`Refresh`]})]}),O(`div`,{className:`flex items-center gap-3`,children:[O(`div`,{className:`relative flex-1 min-w-[200px]`,ref:_,children:[D(M,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),D(`input`,{type:`text`,value:d,onChange:e=>{ee(e.target.value),g(!0)},onFocus:()=>g(!0),placeholder:`Search addons on npm...`,disabled:z,className:`w-full rounded-lg border border-border bg-background pl-9 pr-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed`}),fe&&D(H,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),m&&P&&P.length>0&&O(`div`,{className:`absolute left-0 right-0 top-full mt-1 z-40 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,children:[P.length>0&&O(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[`npm results (`,P.length,`)`]}),P&&P.length>0&&D(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:P.map(e=>O(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[D(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),O(`div`,{className:`flex-1 min-w-0`,children:[O(`div`,{className:`flex items-center gap-2`,children:[D(`span`,{className:`text-[11px] font-semibold truncate`,children:e.name}),O(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`v`,e.version]})]}),e.description&&D(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?O(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 shrink-0`,children:[D(F,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):O(`button`,{type:`button`,onClick:()=>Z.mutate({packageName:e.name}),disabled:Z.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[Z.isPending?D(H,{className:`h-3 w-3 animate-spin`}):D(A,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),D(Ce,{onUploadSuccess:()=>{u.invalidateQueries({queryKey:[[`addons`]]}),s()}})]}),$&&O(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[D(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),D(`span`,{className:`font-mono text-primary font-semibold`,children:$}),D(`button`,{type:`button`,onClick:Ie,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),R!==null&&D(Te,{state:R,onCancel:()=>he.mutate({id:R.id})}),ve&&O(`div`,{className:`fixed top-4 right-4 z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm max-w-sm pointer-events-auto`,children:[D(de,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),O(`div`,{children:[D(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),D(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),Fe.length===0&&D(`div`,{className:`text-xs text-foreground-subtle`,children:e.length===0?`No addons installed`:$?`No installed addons declare the "${$}" capability. Browse the npm catalog above to find a compatible addon.`:`No addons compatible with ${r.name} (placement filter active)`}),O(`div`,{className:`space-y-2`,children:[Re.map(e=>{if(Q(e)){let t=e.bundle.packageName,i=ae.get(t);return D(Se,{addon:e.representative,clusterStatus:n?.[e.representative.manifest.id],bundle:e.bundle,availableUpdate:i,isUpdating:y===t,onUpdate:i?()=>le.mutate({name:t,version:i,nodeId:r.id}):void 0,bulkItem:B.get(t)??null,disabledByBulk:z},t)}let t=e.manifest.packageName,i=ae.get(t);return D(Se,{addon:e,clusterStatus:n?.[e.manifest.id],availableUpdate:i,isUpdating:y===t,onUpdate:i?()=>le.mutate({name:e.manifest.packageName,version:i,nodeId:r.id}):void 0,bulkItem:B.get(t)??null,disabledByBulk:z},e.manifest.id)}),r.isHub&&(ye??[]).length>0&&D(`div`,{className:`rounded-md border border-border overflow-x-auto`,children:O(`table`,{className:`w-full text-xs`,children:[D(`thead`,{className:`bg-muted/40`,children:O(`tr`,{className:`text-left text-foreground-subtle`,children:[D(`th`,{className:`px-2 py-1.5 font-medium`,children:`Name`}),D(`th`,{className:`px-2 py-1.5 font-medium`,children:`Current`}),D(`th`,{className:`px-2 py-1.5 font-medium`,children:`Latest`}),D(`th`,{className:`px-2 py-1.5 font-medium`,children:`Status`}),D(`th`,{className:`px-2 py-1.5 font-medium`,children:`Actions`})]})}),D(`tbody`,{children:(ye??[]).map(e=>D(X,{addon:{name:e.packageName,currentVersion:e.currentVersion,isSystem:!0},bulkItem:B.get(e.packageName)??null,disabledByBulk:z,latestVersion:e.latestVersion,onUpdate:t=>{q({packageName:e.packageName,fromVersion:e.currentVersion,toVersion:t})},onRestart:()=>{},onUninstall:()=>{}},e.packageName))})]})})]}),K!==null&&D(Ee,{pending:K,onCancel:()=>{q(null),Y(null)},onConfirm:()=>{Y(null),be.mutate({name:K.packageName,version:K.toVersion})},isPending:be.isPending,error:J})]})}function je(){let t=ce(),{data:r,isLoading:i,isError:a}=s(),{data:o}=l(void 0),{data:c}=y(void 0,{refetchInterval:1e4}),u=w(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of c??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[c]),[d,ee]=S(`hub`),f=u.find(e=>e.id===d)??u[0],p=e(),te=v(),m=p.isPending||te.isPending,ne=async()=>{await p.mutateAsync({nodeId:d}),await te.mutateAsync(),t.invalidateQueries({queryKey:[[`addons`]]})},h=T(p);h.current=p,C(()=>{h.current.mutate({nodeId:`hub`})},[]);let re=(r??[]).map(Oe).filter(e=>e!==null);return O(U,{children:[O(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[D(n,{selectedNodeId:d,onSelect:ee}),O(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!i&&!a&&O(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[re.length,` installed`]}),O(`button`,{type:`button`,onClick:()=>void ne(),disabled:m,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:`Re-fetch addons + check npm for new versions`,children:[D(j,{className:`w-3 h-3 ${m?`animate-spin`:``}`}),`Check for updates`]})]})]}),!f.isHub&&O(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-[11px] text-foreground-subtle`,children:[`Showing only addons compatible with`,` `,D(`span`,{className:`font-medium text-foreground`,children:f.name}),` — agents only run`,` `,D(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,D(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),i&&D(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),a&&D(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!i&&!a&&D(Ae,{addons:re,clusterStatus:o,selectedNode:f,onRefresh:()=>void ne(),isRefreshing:m})]})}export{je as AddonsPage};