import{$t as e,A as t,C as n,Cn as r,E as i,En as a,F as o,Jt as s,Kt as c,Qt as l,Rt as u,Sn as d,St as f,Wt as p,Xt as m,Yt as h,Z as g,Zt as _,_ as ee,_n as v,_t as y,b,dn as x,en as S,fn as C,ft as w,gn as T,hn as E,l as D,ln as te,lt as O,m as k,n as A,nt as j,o as M,on as ne,ot as N,p as re,pn as P,qt as F,r as ie,rn as I,sn as L,t as R,u as z,un as B,ut as V,v as ae,x as H,yn as U,yt as oe}from"./useApi-CXAk43j3.js";import{a as se,c as ce,g as W,i as G,m as K,o as le,p as ue,r as de,u as fe}from"./index-4Ycp0GGC.js";import{c as pe,l as me,s as he,t as q}from"./useToolInfoService-BoFJqmDR.js";var ge={name:`WindowMaximizeIcon`,extends:b};function _e(e){return xe(e)||be(e)||ye(e)||ve()}function ve(){throw TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ye(e,t){if(e){if(typeof e==`string`)return Se(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Se(e,t):void 0}}function be(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function xe(e){if(Array.isArray(e))return Se(e)}function Se(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ce(e,t,n,r,i,a){return L(),m(`svg`,I({width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},e.pti()),_e(t[0]||=[F(`path`,{"fill-rule":`evenodd`,"clip-rule":`evenodd`,d:`M7 14H11.8C12.3835 14 12.9431 13.7682 13.3556 13.3556C13.7682 12.9431 14 12.3835 14 11.8V2.2C14 1.61652 13.7682 1.05694 13.3556 0.644365C12.9431 0.231785 12.3835 0 11.8 0H2.2C1.61652 0 1.05694 0.231785 0.644365 0.644365C0.231785 1.05694 0 1.61652 0 2.2V7C0 7.15913 0.063214 7.31174 0.175736 7.42426C0.288258 7.53679 0.44087 7.6 0.6 7.6C0.75913 7.6 0.911742 7.53679 1.02426 7.42426C1.13679 7.31174 1.2 7.15913 1.2 7V2.2C1.2 1.93478 1.30536 1.68043 1.49289 1.49289C1.68043 1.30536 1.93478 1.2 2.2 1.2H11.8C12.0652 1.2 12.3196 1.30536 12.5071 1.49289C12.6946 1.68043 12.8 1.93478 12.8 2.2V11.8C12.8 12.0652 12.6946 12.3196 12.5071 12.5071C12.3196 12.6946 12.0652 12.8 11.8 12.8H7C6.84087 12.8 6.68826 12.8632 6.57574 12.9757C6.46321 13.0883 6.4 13.2409 6.4 13.4C6.4 13.5591 6.46321 13.7117 6.57574 13.8243C6.68826 13.9368 6.84087 14 7 14ZM9.77805 7.42192C9.89013 7.534 10.0415 7.59788 10.2 7.59995C10.3585 7.59788 10.5099 7.534 10.622 7.42192C10.7341 7.30985 10.798 7.15844 10.8 6.99995V3.94242C10.8066 3.90505 10.8096 3.86689 10.8089 3.82843C10.8079 3.77159 10.7988 3.7157 10.7824 3.6623C10.756 3.55552 10.701 3.45698 10.622 3.37798C10.5099 3.2659 10.3585 3.20202 10.2 3.19995H7.00002C6.84089 3.19995 6.68828 3.26317 6.57576 3.37569C6.46324 3.48821 6.40002 3.64082 6.40002 3.79995C6.40002 3.95908 6.46324 4.11169 6.57576 4.22422C6.68828 4.33674 6.84089 4.39995 7.00002 4.39995H8.80006L6.19997 7.00005C6.10158 7.11005 6.04718 7.25246 6.04718 7.40005C6.04718 7.54763 6.10158 7.69004 6.19997 7.80005C6.30202 7.91645 6.44561 7.98824 6.59997 8.00005C6.75432 7.98824 6.89791 7.91645 6.99997 7.80005L9.60002 5.26841V6.99995C9.6021 7.15844 9.66598 7.30985 9.77805 7.42192ZM1.4 14H3.8C4.17066 13.9979 4.52553 13.8498 4.78763 13.5877C5.04973 13.3256 5.1979 12.9707 5.2 12.6V10.2C5.1979 9.82939 5.04973 9.47452 4.78763 9.21242C4.52553 8.95032 4.17066 8.80215 3.8 8.80005H1.4C1.02934 8.80215 0.674468 8.95032 0.412371 9.21242C0.150274 9.47452 0.00210008 9.82939 0 10.2V12.6C0.00210008 12.9707 0.150274 13.3256 0.412371 13.5877C0.674468 13.8498 1.02934 13.9979 1.4 14ZM1.25858 10.0586C1.29609 10.0211 1.34696 10 1.4 10H3.8C3.85304 10 3.90391 10.0211 3.94142 10.0586C3.97893 10.0961 4 10.147 4 10.2V12.6C4 12.6531 3.97893 12.704 3.94142 12.7415C3.90391 12.779 3.85304 12.8 3.8 12.8H1.4C1.34696 12.8 1.29609 12.779 1.25858 12.7415C1.22107 12.704 1.2 12.6531 1.2 12.6V10.2C1.2 10.147 1.22107 10.0961 1.25858 10.0586Z`,fill:`currentColor`},null,-1)]),16)}ge.render=Ce;var we={name:`WindowMinimizeIcon`,extends:b};function Te(e){return ke(e)||Oe(e)||De(e)||Ee()}function Ee(){throw TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function De(e,t){if(e){if(typeof e==`string`)return Ae(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ae(e,t):void 0}}function Oe(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function ke(e){if(Array.isArray(e))return Ae(e)}function Ae(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function je(e,t,n,r,i,a){return L(),m(`svg`,I({width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},e.pti()),Te(t[0]||=[F(`path`,{"fill-rule":`evenodd`,"clip-rule":`evenodd`,d:`M11.8 0H2.2C1.61652 0 1.05694 0.231785 0.644365 0.644365C0.231785 1.05694 0 1.61652 0 2.2V7C0 7.15913 0.063214 7.31174 0.175736 7.42426C0.288258 7.53679 0.44087 7.6 0.6 7.6C0.75913 7.6 0.911742 7.53679 1.02426 7.42426C1.13679 7.31174 1.2 7.15913 1.2 7V2.2C1.2 1.93478 1.30536 1.68043 1.49289 1.49289C1.68043 1.30536 1.93478 1.2 2.2 1.2H11.8C12.0652 1.2 12.3196 1.30536 12.5071 1.49289C12.6946 1.68043 12.8 1.93478 12.8 2.2V11.8C12.8 12.0652 12.6946 12.3196 12.5071 12.5071C12.3196 12.6946 12.0652 12.8 11.8 12.8H7C6.84087 12.8 6.68826 12.8632 6.57574 12.9757C6.46321 13.0883 6.4 13.2409 6.4 13.4C6.4 13.5591 6.46321 13.7117 6.57574 13.8243C6.68826 13.9368 6.84087 14 7 14H11.8C12.3835 14 12.9431 13.7682 13.3556 13.3556C13.7682 12.9431 14 12.3835 14 11.8V2.2C14 1.61652 13.7682 1.05694 13.3556 0.644365C12.9431 0.231785 12.3835 0 11.8 0ZM6.368 7.952C6.44137 7.98326 6.52025 7.99958 6.6 8H9.8C9.95913 8 10.1117 7.93678 10.2243 7.82426C10.3368 7.71174 10.4 7.55913 10.4 7.4C10.4 7.24087 10.3368 7.08826 10.2243 6.97574C10.1117 6.86321 9.95913 6.8 9.8 6.8H8.048L10.624 4.224C10.73 4.11026 10.7877 3.95982 10.7849 3.80438C10.7822 3.64894 10.7192 3.50063 10.6093 3.3907C10.4994 3.28077 10.3511 3.2178 10.1956 3.21506C10.0402 3.21232 9.88974 3.27002 9.776 3.376L7.2 5.952V4.2C7.2 4.04087 7.13679 3.88826 7.02426 3.77574C6.91174 3.66321 6.75913 3.6 6.6 3.6C6.44087 3.6 6.28826 3.66321 6.17574 3.77574C6.06321 3.88826 6 4.04087 6 4.2V7.4C6.00042 7.47975 6.01674 7.55862 6.048 7.632C6.07656 7.70442 6.11971 7.7702 6.17475 7.82524C6.2298 7.88029 6.29558 7.92344 6.368 7.952ZM1.4 8.80005H3.8C4.17066 8.80215 4.52553 8.95032 4.78763 9.21242C5.04973 9.47452 5.1979 9.82939 5.2 10.2V12.6C5.1979 12.9707 5.04973 13.3256 4.78763 13.5877C4.52553 13.8498 4.17066 13.9979 3.8 14H1.4C1.02934 13.9979 0.674468 13.8498 0.412371 13.5877C0.150274 13.3256 0.00210008 12.9707 0 12.6V10.2C0.00210008 9.82939 0.150274 9.47452 0.412371 9.21242C0.674468 8.95032 1.02934 8.80215 1.4 8.80005ZM3.94142 12.7415C3.97893 12.704 4 12.6531 4 12.6V10.2C4 10.147 3.97893 10.0961 3.94142 10.0586C3.90391 10.0211 3.85304 10 3.8 10H1.4C1.34696 10 1.29609 10.0211 1.25858 10.0586C1.22107 10.0961 1.2 10.147 1.2 10.2V12.6C1.2 12.6531 1.22107 12.704 1.25858 12.7415C1.29609 12.779 1.34696 12.8 1.4 12.8H3.8C3.85304 12.8 3.90391 12.779 3.94142 12.7415Z`,fill:`currentColor`},null,-1)]),16)}we.render=je;function Me(){y({variableName:t(`scrollbar.width`).name})}function Ne(){V({variableName:t(`scrollbar.width`).name})}var Pe=i.extend({name:`dialog`,style:`
    .p-dialog {
        max-height: 90%;
        transform: scale(1);
        border-radius: dt('dialog.border.radius');
        box-shadow: dt('dialog.shadow');
        background: dt('dialog.background');
        border: 1px solid dt('dialog.border.color');
        color: dt('dialog.color');
        will-change: transform;
    }

    .p-dialog-content {
        overflow-y: auto;
        padding: dt('dialog.content.padding');
        flex-grow: 1;
    }

    .p-dialog-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
        padding: dt('dialog.header.padding');
    }

    .p-dialog-title {
        font-weight: dt('dialog.title.font.weight');
        font-size: dt('dialog.title.font.size');
    }

    .p-dialog-footer {
        flex-shrink: 0;
        padding: dt('dialog.footer.padding');
        display: flex;
        justify-content: flex-end;
        gap: dt('dialog.footer.gap');
    }

    .p-dialog-header-actions {
        display: flex;
        align-items: center;
        gap: dt('dialog.header.gap');
    }

    .p-dialog-top .p-dialog,
    .p-dialog-bottom .p-dialog,
    .p-dialog-left .p-dialog,
    .p-dialog-right .p-dialog,
    .p-dialog-topleft .p-dialog,
    .p-dialog-topright .p-dialog,
    .p-dialog-bottomleft .p-dialog,
    .p-dialog-bottomright .p-dialog {
        margin: 1rem;
    }

    .p-dialog-maximized {
        width: 100vw !important;
        height: 100vh !important;
        top: 0px !important;
        left: 0px !important;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }

    .p-dialog .p-resizable-handle {
        position: absolute;
        font-size: 0.1px;
        display: block;
        cursor: se-resize;
        width: 12px;
        height: 12px;
        right: 1px;
        bottom: 1px;
    }

    .p-dialog-enter-active {
        animation: p-animate-dialog-enter 300ms cubic-bezier(.19,1,.22,1);
    }

    .p-dialog-leave-active {
        animation: p-animate-dialog-leave 300ms cubic-bezier(.19,1,.22,1);
    }

    @keyframes p-animate-dialog-enter {
        from {
            opacity: 0;
            transform: scale(0.93);
        }
    }

    @keyframes p-animate-dialog-leave {
        to {
            opacity: 0;
            transform: scale(0.93);
        }
    }
`,classes:{mask:function(e){var t=e.props,n=[`left`,`right`,`top`,`topleft`,`topright`,`bottom`,`bottomleft`,`bottomright`].find(function(e){return e===t.position});return[`p-dialog-mask`,{"p-overlay-mask p-overlay-mask-enter-active":t.modal},n?`p-dialog-${n}`:``]},root:function(e){var t=e.props,n=e.instance;return[`p-dialog p-component`,{"p-dialog-maximized":t.maximizable&&n.maximized}]},header:`p-dialog-header`,title:`p-dialog-title`,headerActions:`p-dialog-header-actions`,pcMaximizeButton:`p-dialog-maximize-button`,pcCloseButton:`p-dialog-close-button`,content:`p-dialog-content`,footer:`p-dialog-footer`},inlineStyles:{mask:function(e){var t=e.position,n=e.modal;return{position:`fixed`,height:`100%`,width:`100%`,left:0,top:0,display:`flex`,justifyContent:t===`left`||t===`topleft`||t===`bottomleft`?`flex-start`:t===`right`||t===`topright`||t===`bottomright`?`flex-end`:`center`,alignItems:t===`top`||t===`topleft`||t===`topright`?`flex-start`:t===`bottom`||t===`bottomleft`||t===`bottomright`?`flex-end`:`center`,pointerEvents:n?`auto`:`none`}},root:{display:`flex`,flexDirection:`column`,pointerEvents:`auto`}}}),J={name:`Dialog`,extends:{name:`BaseDialog`,extends:H,props:{header:{type:null,default:null},footer:{type:null,default:null},visible:{type:Boolean,default:!1},modal:{type:Boolean,default:null},contentStyle:{type:null,default:null},contentClass:{type:String,default:null},contentProps:{type:null,default:null},maximizable:{type:Boolean,default:!1},dismissableMask:{type:Boolean,default:!1},closable:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!1},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},position:{type:String,default:`center`},breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0},keepInViewport:{type:Boolean,default:!0},minX:{type:Number,default:0},minY:{type:Number,default:0},appendTo:{type:[String,Object],default:`body`},closeIcon:{type:String,default:void 0},maximizeIcon:{type:String,default:void 0},minimizeIcon:{type:String,default:void 0},closeButtonProps:{type:Object,default:function(){return{severity:`secondary`,text:!0,rounded:!0}}},maximizeButtonProps:{type:Object,default:function(){return{severity:`secondary`,text:!0,rounded:!0}}},_instance:null},style:Pe,provide:function(){return{$pcDialog:this,$parentInstance:this}}},inheritAttrs:!1,emits:[`update:visible`,`show`,`hide`,`after-hide`,`maximize`,`unmaximize`,`dragstart`,`dragend`],provide:function(){var e=this;return{dialogRef:c(function(){return e._instance})}},data:function(){return{containerVisible:this.visible,maximized:!1,focusableMax:null,focusableClose:null,target:null}},documentKeydownListener:null,container:null,mask:null,content:null,headerContainer:null,footerContainer:null,maximizableButton:null,closeButton:null,styleElement:null,dragging:null,documentDragListener:null,documentDragEndListener:null,lastPageX:null,lastPageY:null,maskMouseDownTarget:null,updated:function(){this.visible&&(this.containerVisible=this.visible)},beforeUnmount:function(){this.unbindDocumentState(),this.unbindGlobalListeners(),this.destroyStyle(),this.mask&&this.autoZIndex&&W.clear(this.mask),this.container=null,this.mask=null},mounted:function(){this.breakpoints&&this.createStyle()},methods:{close:function(){this.$emit(`update:visible`,!1)},onEnter:function(){this.$emit(`show`),this.target=document.activeElement,this.enableDocumentSettings(),this.bindGlobalListeners(),this.autoZIndex&&W.set(`modal`,this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal)},onAfterEnter:function(){this.focus()},onBeforeLeave:function(){this.modal&&!this.isUnstyled&&j(this.mask,`p-overlay-mask-leave-active`),this.dragging&&this.documentDragEndListener&&this.documentDragEndListener()},onLeave:function(){this.$emit(`hide`),O(this.target),this.target=null,this.focusableClose=null,this.focusableMax=null},onAfterLeave:function(){this.autoZIndex&&W.clear(this.mask),this.containerVisible=!1,this.unbindDocumentState(),this.unbindGlobalListeners(),this.$emit(`after-hide`)},onMaskMouseDown:function(e){this.maskMouseDownTarget=e.target},onMaskMouseUp:function(){this.dismissableMask&&this.modal&&this.mask===this.maskMouseDownTarget&&this.close()},focus:function(){var e=function(e){return e&&e.querySelector(`[autofocus]`)},t=this.$slots.footer&&e(this.footerContainer);t||(t=this.$slots.header&&e(this.headerContainer),t||(t=this.$slots.default&&e(this.content),t||(this.maximizable?(this.focusableMax=!0,t=this.maximizableButton):(this.focusableClose=!0,t=this.closeButton)))),t&&O(t,{focusVisible:!0})},maximize:function(e){this.maximized?(this.maximized=!1,this.$emit(`unmaximize`,e)):(this.maximized=!0,this.$emit(`maximize`,e)),this.modal||(this.maximized?Me():Ne())},enableDocumentSettings:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&Me()},unbindDocumentState:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&Ne()},onKeyDown:function(e){e.code===`Escape`&&this.closeOnEscape&&this.close()},bindDocumentKeyDownListener:function(){this.documentKeydownListener||(this.documentKeydownListener=this.onKeyDown.bind(this),window.document.addEventListener(`keydown`,this.documentKeydownListener))},unbindDocumentKeyDownListener:function(){this.documentKeydownListener&&=(window.document.removeEventListener(`keydown`,this.documentKeydownListener),null)},containerRef:function(e){this.container=e},maskRef:function(e){this.mask=e},contentRef:function(e){this.content=e},headerContainerRef:function(e){this.headerContainer=e},footerContainerRef:function(e){this.footerContainer=e},maximizableRef:function(e){this.maximizableButton=e?e.$el:void 0},closeButtonRef:function(e){this.closeButton=e?e.$el:void 0},createStyle:function(){if(!this.styleElement&&!this.isUnstyled){var e;this.styleElement=document.createElement(`style`),this.styleElement.type=`text/css`,N(this.styleElement,`nonce`,(e=this.$primevue)==null||(e=e.config)==null||(e=e.csp)==null?void 0:e.nonce),document.head.appendChild(this.styleElement);var t=``;for(var n in this.breakpoints)t+=`
                        @media screen and (max-width: ${n}) {
                            .p-dialog[${this.$attrSelector}] {
                                width: ${this.breakpoints[n]} !important;
                            }
                        }
                    `;this.styleElement.innerHTML=t}},destroyStyle:function(){this.styleElement&&=(document.head.removeChild(this.styleElement),null)},initDrag:function(e){e.target.closest(`div`).getAttribute(`data-pc-section`)!==`headeractions`&&this.draggable&&(this.dragging=!0,this.lastPageX=e.pageX,this.lastPageY=e.pageY,this.container.style.margin=`0`,document.body.setAttribute(`data-p-unselectable-text`,`true`),!this.isUnstyled&&g(document.body,{"user-select":`none`}),this.$emit(`dragstart`,e))},bindGlobalListeners:function(){this.draggable&&(this.bindDocumentDragListener(),this.bindDocumentDragEndListener()),this.closeOnEscape&&this.bindDocumentKeyDownListener()},unbindGlobalListeners:function(){this.unbindDocumentDragListener(),this.unbindDocumentDragEndListener(),this.unbindDocumentKeyDownListener()},bindDocumentDragListener:function(){var e=this;this.documentDragListener=function(t){if(e.dragging){var n=oe(e.container),r=o(e.container),i=t.pageX-e.lastPageX,a=t.pageY-e.lastPageY,s=e.container.getBoundingClientRect(),c=s.left+i,l=s.top+a,u=w(),d=getComputedStyle(e.container),f=parseFloat(d.marginLeft),p=parseFloat(d.marginTop);e.container.style.position=`fixed`,e.keepInViewport?(c>=e.minX&&c+n<u.width&&(e.lastPageX=t.pageX,e.container.style.left=c-f+`px`),l>=e.minY&&l+r<u.height&&(e.lastPageY=t.pageY,e.container.style.top=l-p+`px`)):(e.lastPageX=t.pageX,e.container.style.left=c-f+`px`,e.lastPageY=t.pageY,e.container.style.top=l-p+`px`)}},window.document.addEventListener(`mousemove`,this.documentDragListener)},unbindDocumentDragListener:function(){this.documentDragListener&&=(window.document.removeEventListener(`mousemove`,this.documentDragListener),null)},bindDocumentDragEndListener:function(){var e=this;this.documentDragEndListener=function(t){e.dragging&&(e.dragging=!1,document.body.removeAttribute(`data-p-unselectable-text`),!e.isUnstyled&&(document.body.style[`user-select`]=``),e.$emit(`dragend`,t))},window.document.addEventListener(`mouseup`,this.documentDragEndListener)},unbindDocumentDragEndListener:function(){this.documentDragEndListener&&=(window.document.removeEventListener(`mouseup`,this.documentDragEndListener),null)}},computed:{maximizeIconComponent:function(){return this.maximized?this.minimizeIcon?`span`:`WindowMinimizeIcon`:this.maximizeIcon?`span`:`WindowMaximizeIcon`},ariaLabelledById:function(){return this.header!=null||this.$attrs[`aria-labelledby`]!==null?this.$id+`_header`:null},closeAriaLabel:function(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0},dataP:function(){return f({maximized:this.maximized,modal:this.modal})}},directives:{ripple:ee,focustrap:le},components:{Button:k,Portal:fe,WindowMinimizeIcon:we,WindowMaximizeIcon:ge,TimesIcon:ae}};function Y(e){"@babel/helpers - typeof";return Y=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Y(e)}function Fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ie(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Fe(Object(n),!0).forEach(function(t){Le(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Le(e,t,n){return(t=Re(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Re(e){var t=ze(e,`string`);return Y(t)==`symbol`?t:t+``}function ze(e,t){if(Y(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Y(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Be=[`data-p`],Ve=[`aria-labelledby`,`aria-modal`,`data-p`],He=[`id`],Ue=[`data-p`];function We(t,n,i,o,c,d){var f=x(`Button`),g=x(`Portal`),_=C(`focustrap`);return L(),s(g,{appendTo:t.appendTo},{default:T(function(){return[c.containerVisible?(L(),m(`div`,I({key:0,ref:d.maskRef,class:t.cx(`mask`),style:t.sx(`mask`,!0,{position:t.position,modal:t.modal}),onMousedown:n[1]||=function(){return d.onMaskMouseDown&&d.onMaskMouseDown.apply(d,arguments)},onMouseup:n[2]||=function(){return d.onMaskMouseUp&&d.onMaskMouseUp.apply(d,arguments)},"data-p":d.dataP},t.ptm(`mask`)),[e(u,I({name:`p-dialog`,onEnter:d.onEnter,onAfterEnter:d.onAfterEnter,onBeforeLeave:d.onBeforeLeave,onLeave:d.onLeave,onAfterLeave:d.onAfterLeave,appear:``},t.ptm(`transition`)),{default:T(function(){return[t.visible?v((L(),m(`div`,I({key:0,ref:d.containerRef,class:t.cx(`root`),style:t.sx(`root`),role:`dialog`,"aria-labelledby":d.ariaLabelledById,"aria-modal":t.modal,"data-p":d.dataP},t.ptmi(`root`)),[t.$slots.container?B(t.$slots,`container`,{key:0,closeCallback:d.close,maximizeCallback:function(e){return d.maximize(e)},initDragCallback:d.initDrag}):(L(),m(p,{key:1},[t.showHeader?(L(),m(`div`,I({key:0,ref:d.headerContainerRef,class:t.cx(`header`),onMousedown:n[0]||=function(){return d.initDrag&&d.initDrag.apply(d,arguments)}},t.ptm(`header`)),[B(t.$slots,`header`,{class:r(t.cx(`title`))},function(){return[t.header?(L(),m(`span`,I({key:0,id:d.ariaLabelledById,class:t.cx(`title`)},t.ptm(`title`)),a(t.header),17,He)):h(``,!0)]}),F(`div`,I({class:t.cx(`headerActions`)},t.ptm(`headerActions`)),[t.maximizable?B(t.$slots,`maximizebutton`,{key:0,maximized:c.maximized,maximizeCallback:function(e){return d.maximize(e)}},function(){return[e(f,I({ref:d.maximizableRef,autofocus:c.focusableMax,class:t.cx(`pcMaximizeButton`),onClick:d.maximize,tabindex:t.maximizable?`0`:`-1`,unstyled:t.unstyled},t.maximizeButtonProps,{pt:t.ptm(`pcMaximizeButton`),"data-pc-group-section":`headericon`}),{icon:T(function(e){return[B(t.$slots,`maximizeicon`,{maximized:c.maximized},function(){return[(L(),s(P(d.maximizeIconComponent),I({class:[e.class,c.maximized?t.minimizeIcon:t.maximizeIcon]},t.ptm(`pcMaximizeButton`).icon),null,16,[`class`]))]})]}),_:3},16,[`autofocus`,`class`,`onClick`,`tabindex`,`unstyled`,`pt`])]}):h(``,!0),t.closable?B(t.$slots,`closebutton`,{key:1,closeCallback:d.close},function(){return[e(f,I({ref:d.closeButtonRef,autofocus:c.focusableClose,class:t.cx(`pcCloseButton`),onClick:d.close,"aria-label":d.closeAriaLabel,unstyled:t.unstyled},t.closeButtonProps,{pt:t.ptm(`pcCloseButton`),"data-pc-group-section":`headericon`}),{icon:T(function(e){return[B(t.$slots,`closeicon`,{},function(){return[(L(),s(P(t.closeIcon?`span`:`TimesIcon`),I({class:[t.closeIcon,e.class]},t.ptm(`pcCloseButton`).icon),null,16,[`class`]))]})]}),_:3},16,[`autofocus`,`class`,`onClick`,`aria-label`,`unstyled`,`pt`])]}):h(``,!0)],16)],16)):h(``,!0),F(`div`,I({ref:d.contentRef,class:[t.cx(`content`),t.contentClass],style:t.contentStyle,"data-p":d.dataP},Ie(Ie({},t.contentProps),t.ptm(`content`))),[B(t.$slots,`default`)],16,Ue),t.footer||t.$slots.footer?(L(),m(`div`,I({key:1,ref:d.footerContainerRef,class:t.cx(`footer`)},t.ptm(`footer`)),[B(t.$slots,`footer`,{},function(){return[l(a(t.footer),1)]})],16)):h(``,!0)],64))],16,Ve)),[[_,{disabled:!t.modal}]]):h(``,!0)]}),_:3},16,[`onEnter`,`onAfterEnter`,`onBeforeLeave`,`onLeave`,`onAfterLeave`])],16,Be)):h(``,!0)]}),_:3},8,[`appendTo`])}J.render=We;var Ge=i.extend({name:`confirmdialog`,style:`
    .p-confirmdialog .p-dialog-content {
        display: flex;
        align-items: center;
        gap: dt('confirmdialog.content.gap');
    }

    .p-confirmdialog-icon {
        color: dt('confirmdialog.icon.color');
        font-size: dt('confirmdialog.icon.size');
        width: dt('confirmdialog.icon.size');
        height: dt('confirmdialog.icon.size');
    }
`,classes:{root:`p-confirmdialog`,icon:`p-confirmdialog-icon`,message:`p-confirmdialog-message`,pcRejectButton:`p-confirmdialog-reject-button`,pcAcceptButton:`p-confirmdialog-accept-button`}}),Ke={name:`ConfirmDialog`,extends:{name:`BaseConfirmDialog`,extends:H,props:{group:String,breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0}},style:Ge,provide:function(){return{$pcConfirmDialog:this,$parentInstance:this}}},confirmListener:null,closeListener:null,data:function(){return{visible:!1,confirmation:null}},mounted:function(){var e=this;this.confirmListener=function(t){t&&t.group===e.group&&(e.confirmation=t,e.confirmation.onShow&&e.confirmation.onShow(),e.visible=!0)},this.closeListener=function(){e.visible=!1,e.confirmation=null},K.on(`confirm`,this.confirmListener),K.on(`close`,this.closeListener)},beforeUnmount:function(){K.off(`confirm`,this.confirmListener),K.off(`close`,this.closeListener)},methods:{accept:function(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject:function(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide:function(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1}},computed:{appendTo:function(){return this.confirmation?this.confirmation.appendTo:`body`},target:function(){return this.confirmation?this.confirmation.target:null},modal:function(){return this.confirmation?this.confirmation.modal==null?!0:this.confirmation.modal:!0},header:function(){return this.confirmation?this.confirmation.header:null},message:function(){return this.confirmation?this.confirmation.message:null},blockScroll:function(){return this.confirmation?this.confirmation.blockScroll:!0},position:function(){return this.confirmation?this.confirmation.position:null},acceptLabel:function(){if(this.confirmation){var e=this.confirmation;return e.acceptLabel||e.acceptProps?.label||this.$primevue.config.locale.accept}return this.$primevue.config.locale.accept},rejectLabel:function(){if(this.confirmation){var e=this.confirmation;return e.rejectLabel||e.rejectProps?.label||this.$primevue.config.locale.reject}return this.$primevue.config.locale.reject},acceptIcon:function(){var e;return this.confirmation?this.confirmation.acceptIcon:(e=this.confirmation)!=null&&e.acceptProps?this.confirmation.acceptProps.icon:null},rejectIcon:function(){var e;return this.confirmation?this.confirmation.rejectIcon:(e=this.confirmation)!=null&&e.rejectProps?this.confirmation.rejectProps.icon:null},autoFocusAccept:function(){return this.confirmation.defaultFocus===void 0||this.confirmation.defaultFocus===`accept`},autoFocusReject:function(){return this.confirmation.defaultFocus===`reject`},closeOnEscape:function(){return this.confirmation?this.confirmation.closeOnEscape:!0}},components:{Dialog:J,Button:k}};function qe(t,n,i,o,c,l){var u=x(`Button`),d=x(`Dialog`);return L(),s(d,{visible:c.visible,"onUpdate:visible":[n[2]||=function(e){return c.visible=e},l.onHide],role:`alertdialog`,class:r(t.cx(`root`)),modal:l.modal,header:l.header,blockScroll:l.blockScroll,appendTo:l.appendTo,position:l.position,breakpoints:t.breakpoints,closeOnEscape:l.closeOnEscape,draggable:t.draggable,pt:t.pt,unstyled:t.unstyled},_({default:T(function(){return[t.$slots.container?h(``,!0):(L(),m(p,{key:0},[t.$slots.message?(L(),s(P(t.$slots.message),{key:1,message:c.confirmation},null,8,[`message`])):(L(),m(p,{key:0},[B(t.$slots,`icon`,{},function(){return[t.$slots.icon?(L(),s(P(t.$slots.icon),{key:0,class:r(t.cx(`icon`))},null,8,[`class`])):c.confirmation.icon?(L(),m(`span`,I({key:1,class:[c.confirmation.icon,t.cx(`icon`)]},t.ptm(`icon`)),null,16)):h(``,!0)]}),F(`span`,I({class:t.cx(`message`)},t.ptm(`message`)),a(l.message),17)],64))],64))]}),_:2},[t.$slots.container?{name:`container`,fn:T(function(e){return[B(t.$slots,`container`,{message:c.confirmation,closeCallback:e.closeCallback,acceptCallback:l.accept,rejectCallback:l.reject,initDragCallback:e.initDragCallback})]}),key:`0`}:void 0,t.$slots.container?void 0:{name:`footer`,fn:T(function(){return[e(u,I({class:[t.cx(`pcRejectButton`),c.confirmation.rejectClass],autofocus:l.autoFocusReject,unstyled:t.unstyled,text:c.confirmation.rejectProps?.text||!1,onClick:n[0]||=function(e){return l.reject()}},c.confirmation.rejectProps,{label:l.rejectLabel,pt:t.ptm(`pcRejectButton`)}),_({_:2},[l.rejectIcon||t.$slots.rejecticon?{name:`icon`,fn:T(function(e){return[B(t.$slots,`rejecticon`,{},function(){return[F(`span`,I({class:[l.rejectIcon,e.class]},t.ptm(`pcRejectButton`).icon,{"data-pc-section":`rejectbuttonicon`}),null,16)]})]}),key:`0`}:void 0]),1040,[`class`,`autofocus`,`unstyled`,`text`,`label`,`pt`]),e(u,I({label:l.acceptLabel,class:[t.cx(`pcAcceptButton`),c.confirmation.acceptClass],autofocus:l.autoFocusAccept,unstyled:t.unstyled,onClick:n[1]||=function(e){return l.accept()}},c.confirmation.acceptProps,{pt:t.ptm(`pcAcceptButton`)}),_({_:2},[l.acceptIcon||t.$slots.accepticon?{name:`icon`,fn:T(function(e){return[B(t.$slots,`accepticon`,{},function(){return[F(`span`,I({class:[l.acceptIcon,e.class]},t.ptm(`pcAcceptButton`).icon,{"data-pc-section":`acceptbuttonicon`}),null,16)]})]}),key:`0`}:void 0]),1040,[`label`,`class`,`autofocus`,`unstyled`,`pt`])]}),key:`1`}]),1032,[`visible`,`class`,`modal`,`header`,`blockScroll`,`appendTo`,`position`,`breakpoints`,`closeOnEscape`,`draggable`,`onUpdate:visible`,`pt`,`unstyled`])}Ke.render=qe;var Je={class:`cache-stats`,"data-description":`tool cache stats`},Ye={class:`stat-line`},Xe={key:0,class:`stat-line stat-meta`},Ze={key:0},Qe={key:1},$e=A(S({__name:`ToolCacheStats`,props:{stats:{}},setup(e){function t(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function n(e){return new Date(e).toLocaleString()}return(r,i)=>(L(),m(`div`,Je,[F(`div`,Ye,[F(`strong`,null,a(e.stats.count),1),i[2]||=l(` tools `,-1),e.stats.totalBytes===void 0?h(``,!0):(L(),m(p,{key:0},[i[0]||=l(` · `,-1),F(`strong`,null,a(t(e.stats.totalBytes)),1)],64)),(L(!0),m(p,null,te(e.stats.bySource,(e,t)=>(L(),m(p,{key:t},[i[1]||=l(` · `,-1),F(`strong`,null,a(e),1),l(` `+a(t),1)],64))),128))]),e.stats.oldest||e.stats.newest?(L(),m(`div`,Xe,[e.stats.oldest?(L(),m(`span`,Ze,`Oldest: `+a(n(e.stats.oldest)),1)):h(``,!0),e.stats.newest?(L(),m(`span`,Qe,`Newest: `+a(n(e.stats.newest)),1)):h(``,!0)])):h(``,!0)]))}}),[[`__scopeId`,`data-v-0e88204f`]]),et={class:`cache-table`},tt={class:`list-toolbar`},nt={class:`undecodable-toggle`},rt={class:`count`},it={class:`empty-state`},at={key:0},ot={key:1},st={class:`tool-cell`},ct={key:0,class:`pi pi-exclamation-triangle warn-icon`},lt={class:`tool-id`},ut={key:0},dt={key:1,class:`muted`},ft=[`title`],pt=[`href`],mt=A(S({__name:`ToolCacheTable`,props:{entries:{},loading:{type:Boolean}},emits:[`view`,`refetch`,`delete`],setup(t,{emit:n}){let r=t,i=n,o=U(``),s=U(null),l=U(!1),u=c(()=>Array.from(new Set(r.entries.map(e=>e.source))).sort()),f=c(()=>{let e=o.value.toLowerCase();return r.entries.filter(t=>!(e&&!t.toolId.toLowerCase().includes(e)||s.value&&t.source!==s.value||l.value&&t.decodable))});function p(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function g(e){let t=Date.now()-new Date(e).getTime(),n=Math.round(t/1e3);if(n<60)return`${n}s ago`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<48?`${i}h ago`:`${Math.round(i/24)}d ago`}return(n,r)=>{let c=C(`tooltip`);return L(),m(`div`,et,[F(`div`,tt,[e(d(z),{class:`search-field`},{default:T(()=>[e(d(D),{class:`pi pi-search`}),e(d(M),{modelValue:o.value,"onUpdate:modelValue":r[0]||=e=>o.value=e,placeholder:`Filter by tool id…`,size:`small`},null,8,[`modelValue`])]),_:1}),e(d(ce),{modelValue:s.value,"onUpdate:modelValue":r[1]||=e=>s.value=e,options:u.value,placeholder:`All sources`,showClear:``,size:`small`,class:`source-select`},null,8,[`modelValue`,`options`]),F(`label`,nt,[e(d(ie),{modelValue:l.value,"onUpdate:modelValue":r[2]||=e=>l.value=e,binary:!0},null,8,[`modelValue`]),r[3]||=F(`span`,null,`Undecodable only`,-1)]),F(`span`,rt,a(f.value.length)+a(f.value.length===t.entries.length?``:` of ${t.entries.length}`)+` entries `,1)]),e(d(se),{value:f.value,loading:t.loading,dataKey:`cacheKey`,rowHover:!0,stripedRows:``,sortField:`cachedAt`,sortOrder:-1,paginator:f.value.length>25,rows:25,rowsPerPageOptions:[25,50,100]},{empty:T(()=>[F(`div`,it,[r[4]||=F(`i`,{class:`pi pi-database empty-icon`},null,-1),o.value||s.value||l.value?(L(),m(`p`,at,` No entries match the current filters. `)):(L(),m(`p`,ot,`The tool cache is empty.`))])]),default:T(()=>[e(d(G),{field:`toolId`,header:`Tool`,sortable:``},{body:T(({data:e})=>[F(`div`,st,[e.decodable?h(``,!0):v((L(),m(`i`,ct,null,512)),[[c,`Cached payload does not decode as a ParsedTool`,void 0,{right:!0}]]),F(`span`,lt,a(e.toolId),1)])]),_:1}),e(d(G),{field:`toolVersion`,header:`Version`,sortable:``,style:{width:`10rem`}}),e(d(G),{field:`source`,header:`Source`,sortable:``,style:{width:`7rem`}},{body:T(({data:t})=>[e(d(de),{value:t.source,severity:`secondary`},null,8,[`value`])]),_:1}),e(d(G),{field:`sizeBytes`,header:`Size`,sortable:``,style:{width:`7rem`}},{body:T(({data:e})=>[e.sizeBytes===void 0?(L(),m(`span`,dt,`—`)):(L(),m(`span`,ut,a(p(e.sizeBytes)),1))]),_:1}),e(d(G),{field:`cachedAt`,header:`Cached`,sortable:``,style:{width:`11rem`}},{body:T(({data:e})=>[F(`span`,{title:e.cachedAt},a(g(e.cachedAt)),9,ft)]),_:1}),e(d(G),{header:``,style:{width:`11rem`,"text-align":`right`}},{body:T(({data:t})=>[v(e(d(k),{icon:`pi pi-eye`,text:``,size:`small`,onClick:e=>i(`view`,t)},null,8,[`onClick`]),[[c,`View raw JSON`,void 0,{left:!0}]]),v(e(d(k),{icon:`pi pi-refresh`,text:``,size:`small`,disabled:!t.refetchable,onClick:e=>i(`refetch`,t)},null,8,[`disabled`,`onClick`]),[[c,t.refetchable?`Re-fetch from source`:`Cannot re-fetch — tool id is unknown/orphan`,void 0,{left:!0}]]),t.toolshedUrl?(L(),m(`a`,{key:0,href:t.toolshedUrl,target:`_blank`,rel:`noopener noreferrer`},[v(e(d(k),{icon:`pi pi-external-link`,text:``,size:`small`},null,512),[[c,`Open ToolShed`,void 0,{left:!0}]])],8,pt)):h(``,!0),v(e(d(k),{icon:`pi pi-trash`,text:``,size:`small`,severity:`danger`,onClick:e=>i(`delete`,t)},null,8,[`onClick`]),[[c,`Delete`,void 0,{left:!0}]])]),_:1})]),_:1},8,[`value`,`loading`,`paginator`])])}}}),[[`__scopeId`,`data-v-23645664`]]),ht={key:0,class:`loading-state`},gt={key:1,class:`error-state`},_t={key:2,class:`raw-json`},vt=A(S({__name:`ToolCacheRawDialog`,props:{modelValue:{type:Boolean},entry:{},load:{type:Function}},emits:[`update:modelValue`],setup(t,{emit:r}){let i=t,o=r,l=c({get:()=>i.modelValue,set:e=>o(`update:modelValue`,e)}),u=n(),f=U(null),p=U(!1),h=U(null),g=c(()=>f.value===null?``:JSON.stringify(f.value,null,2));E(()=>[i.modelValue,i.entry?.cacheKey],async([e,t])=>{if(!(!e||!t)){p.value=!0,h.value=null,f.value=null;try{f.value=(await i.load(t))?.contents??null}catch(e){h.value=e instanceof Error?e.message:String(e)}finally{p.value=!1}}});async function _(){await navigator.clipboard.writeText(g.value),u.add({severity:`success`,summary:`Copied`,life:1500})}return(n,r)=>(L(),s(d(J),{visible:l.value,"onUpdate:visible":r[1]||=e=>l.value=e,header:t.entry?.toolId??`Cached payload`,modal:``,style:{width:`70vw`},breakpoints:{"960px":`90vw`}},{footer:T(()=>[e(d(k),{label:`Copy`,icon:`pi pi-copy`,text:``,disabled:!g.value,onClick:_},null,8,[`disabled`]),e(d(k),{label:`Close`,icon:`pi pi-times`,onClick:r[0]||=e=>l.value=!1})]),default:T(()=>[p.value?(L(),m(`div`,ht,`Loading…`)):h.value?(L(),m(`div`,gt,a(h.value),1)):(L(),m(`pre`,_t,a(g.value),1))]),_:1},8,[`visible`,`header`]))}}),[[`__scopeId`,`data-v-5ded7233`]]),yt=U([]),bt=U({count:0,bySource:{}}),xt=U(!1),X=U(null);function Z(e,t){if(e&&typeof e==`object`&&`detail`in e){let t=e.detail;if(typeof t==`string`&&t.length>0)return t}return t}function St(){let e=R();async function t(t={}){xt.value=!0,X.value=null;try{let{data:n,error:r}=await e.GET(`/api/tool-cache`,{params:{query:t.decode?{decode:`1`}:{}}});r?X.value=Z(r,`Failed to load tool cache`):n&&(yt.value=n.entries,bt.value=n.stats)}finally{xt.value=!1}}async function n(t){let{data:n,error:r}=await e.GET(`/api/tool-cache/{cacheKey}`,{params:{path:{cacheKey:t}}});if(r)throw Error(Z(r,`Failed to load raw entry`));return n}async function r(n){X.value=null;let{error:r}=await e.DELETE(`/api/tool-cache/{cacheKey}`,{params:{path:{cacheKey:n}}});if(r){let e=Z(r,`Delete failed`);throw X.value=e,Error(e)}await t()}async function i(n){X.value=null;let{data:r,error:i}=await e.DELETE(`/api/tool-cache`,{params:{query:n?{prefix:n}:{}}});if(i){let e=Z(i,`Clear failed`);throw X.value=e,Error(e)}return await t(),r}async function a(n,r){X.value=null;let{data:i,error:a}=await e.POST(`/api/tool-cache/refetch`,{body:{toolId:n,...r?{toolVersion:r}:{}}});if(a){let e=Z(a,`Refetch failed`);throw X.value=e,Error(e)}return await t(),i}async function o(n,r){X.value=null;let{data:i,error:a}=await e.POST(`/api/tool-cache/add`,{body:{toolId:n,...r?{toolVersion:r}:{}}});if(a){let e=Z(a,`Add failed`);throw X.value=e,Error(e)}return await t(),i}return{entries:yt,stats:bt,loading:xt,error:X,refresh:t,loadRaw:n,del:r,clear:i,refetch:a,add:o}}var Ct=U([]),wt=U({count:0,bySource:{}}),Tt=U(!1),Q=U(null);function $(e){return e instanceof Error?e.message:String(e)}function Et(){async function e(e={}){Tt.value=!0,Q.value=null;try{let t=q().cache,n=await t.listCached(),r=[],i={},a,o,s=0,c=!1;for(let l of n){let n=he(l.tool_id),u=l.source!==`orphan`&&l.tool_id!==`unknown`&&l.tool_id!==``,d={cacheKey:l.cache_key,toolId:l.tool_id,toolVersion:l.tool_version,source:l.source,sourceUrl:l.source_url,cachedAt:l.cached_at,decodable:!0,refetchable:u};if(n!==null){let[e,t]=n.trsToolId.split(`~`);e&&t&&(d.toolshedUrl=`${n.toolshedUrl}/view/${e}/${t}`)}let f=await t.statCached(l.cache_key);f!==null&&(d.sizeBytes=f.sizeBytes),e.decode&&(d.decodable=await t.loadCached(l.cache_key)!==null),r.push(d),i[d.source]=(i[d.source]??0)+1,(a===void 0||d.cachedAt<a)&&(a=d.cachedAt),(o===void 0||d.cachedAt>o)&&(o=d.cachedAt),d.sizeBytes!==void 0&&(s+=d.sizeBytes,c=!0)}let l={count:r.length,bySource:i};a!==void 0&&(l.oldest=a),o!==void 0&&(l.newest=o),c&&(l.totalBytes=s),Ct.value=r,wt.value=l}catch(e){Q.value=$(e)}finally{Tt.value=!1}}async function t(e){let t=q().cache,n=await t.loadCachedRaw(e);if(n===null)throw Error(`No cached entry: ${e}`);return{contents:n,decodable:await t.loadCached(e)!==null}}async function n(t){Q.value=null;try{if(!await q().cache.removeCached(t))throw Error(`No cached entry: ${t}`);await e()}catch(e){let t=$(e);throw Q.value=t,e instanceof Error?e:Error(t)}}async function r(t){Q.value=null;try{let n=await q().cache.clearCache(t);return await e(),{removed:n}}catch(e){let t=$(e);throw Q.value=t,e instanceof Error?e:Error(t)}}async function i(t,n){Q.value=null;try{let r=await q().refetch(t,n??null,{force:!0});return await e(),r}catch(e){let t=$(e);throw Q.value=t,e instanceof Error?e:Error(t)}}async function a(t,n){Q.value=null;try{let r=await q().refetch(t,n??null);return await e(),{cacheKey:r.cacheKey,alreadyCached:r.alreadyCached}}catch(e){let t=$(e);throw Q.value=t,e instanceof Error?e:Error(t)}}return{entries:Ct,stats:wt,loading:Tt,error:Q,refresh:e,loadRaw:t,del:n,clear:r,refetch:i,add:a}}var Dt={class:`cache-panel`},Ot={class:`panel-header`},kt={class:`panel-actions`},At={class:`decode-toggle`},jt={class:`add-form`},Mt={class:`add-form`},Nt=A(S({__name:`ToolCachePanel`,props:{transport:{}},setup(t){let r=t,i=c(()=>r.transport===`server`?`Server-side cache`:`Client-side cache (IndexedDB)`),{entries:o,stats:u,loading:f,error:p,refresh:g,loadRaw:_,del:ee,clear:y,refetch:b,add:x}=r.transport===`server`?St():Et(),S=n(),w=ue(),E=U(null),D=U(!1),te=U(null),O=U(!1);function A(){g({decode:O.value})}function j(e){return e instanceof Error?e.message:String(e)}let N=U(!1),P=U(``),I=U(``),R=U(!1),z=U(!1),B=U(``),V=U(!1),ae=[{label:`Add tool…`,icon:`pi pi-plus`,command:()=>N.value=!0},{label:`Clear by prefix…`,icon:`pi pi-filter-slash`,command:()=>z.value=!0},{separator:!0},{label:`Clear all`,icon:`pi pi-trash`,command:()=>{w.require({message:`Remove all ${u.value.count} cached tools?`,header:`Clear cache`,icon:`pi pi-exclamation-triangle`,acceptProps:{severity:`danger`,label:`Clear all`},accept:async()=>{try{let e=await y();S.add({severity:`success`,summary:`Removed ${e?.removed??0} entries`,life:2500})}catch(e){S.add({severity:`error`,summary:j(e),life:4e3})}}})}}];function H(e){te.value=e,D.value=!0}function oe(e){w.require({message:`Delete cached entry for ${e.toolId} ${e.toolVersion}?`,header:`Delete entry`,icon:`pi pi-exclamation-triangle`,acceptProps:{severity:`danger`,label:`Delete`},accept:async()=>{try{await ee(e.cacheKey),S.add({severity:`success`,summary:`Deleted ${e.toolId}`,life:2e3})}catch(e){S.add({severity:`error`,summary:j(e),life:4e3})}}})}async function se(e){try{await b(e.toolId,e.toolVersion),S.add({severity:`success`,summary:`Re-fetched ${e.toolId} ${e.toolVersion}`,life:2500})}catch(e){S.add({severity:`error`,summary:`Failed: ${j(e)}`,life:4e3})}}async function ce(){if(P.value){R.value=!0;try{let e=await x(P.value,I.value||void 0);S.add({severity:`success`,summary:e?.alreadyCached?`Already cached`:`Added ${P.value}`,life:2500}),N.value=!1,P.value=``,I.value=``}catch(e){S.add({severity:`error`,summary:`Failed: ${j(e)}`,life:4e3})}finally{R.value=!1}}}async function W(){if(B.value){V.value=!0;try{let e=await y(B.value);S.add({severity:`success`,summary:`Removed ${e?.removed??0} entries`,life:2500}),z.value=!1,B.value=``}catch(e){S.add({severity:`error`,summary:j(e),life:4e3})}finally{V.value=!1}}}return ne(A),(n,r)=>{let c=C(`tooltip`);return L(),m(`section`,Dt,[F(`div`,Ot,[F(`h2`,null,a(i.value),1),F(`div`,kt,[v((L(),m(`label`,At,[e(d(ie),{modelValue:O.value,"onUpdate:modelValue":r[0]||=e=>O.value=e,binary:!0,onChange:A},null,8,[`modelValue`]),r[10]||=F(`span`,null,`Decode probe`,-1)])),[[c,`Probe each entry for decode-ability (slower)`,void 0,{bottom:!0}]]),e(d(k),{label:`Refresh`,icon:`pi pi-refresh`,text:``,loading:d(f),onClick:A},null,8,[`loading`]),e(d(k),{icon:`pi pi-ellipsis-v`,text:``,"aria-label":`Cache actions`,onClick:r[1]||=e=>E.value?.toggle(e)}),e(d(pe),{ref_key:`menu`,ref:E,model:ae,popup:!0},null,512)])]),d(p)?(L(),s(d(re),{key:0,severity:`error`,closable:!1},{default:T(()=>[l(a(d(p)),1)]),_:1})):h(``,!0),e($e,{stats:d(u)},null,8,[`stats`]),e(mt,{entries:d(o),loading:d(f),onView:H,onRefetch:se,onDelete:oe},null,8,[`entries`,`loading`]),e(vt,{modelValue:D.value,"onUpdate:modelValue":r[2]||=e=>D.value=e,entry:te.value,load:d(_)},null,8,[`modelValue`,`entry`,`load`]),e(d(J),{visible:N.value,"onUpdate:visible":r[6]||=e=>N.value=e,header:`Add tool to ${t.transport} cache`,modal:``,style:{width:`24rem`}},{footer:T(()=>[e(d(k),{label:`Cancel`,text:``,onClick:r[5]||=e=>N.value=!1}),e(d(k),{label:`Add`,icon:`pi pi-plus`,loading:R.value,onClick:ce},null,8,[`loading`])]),default:T(()=>[F(`div`,jt,[F(`label`,null,[r[11]||=F(`span`,null,`Tool ID`,-1),e(d(M),{modelValue:P.value,"onUpdate:modelValue":r[3]||=e=>P.value=e,placeholder:`toolshed.g2.../repos/owner/repo/tool/version`},null,8,[`modelValue`])]),F(`label`,null,[r[12]||=F(`span`,null,`Version (optional)`,-1),e(d(M),{modelValue:I.value,"onUpdate:modelValue":r[4]||=e=>I.value=e},null,8,[`modelValue`])])])]),_:1},8,[`visible`,`header`]),e(d(J),{visible:z.value,"onUpdate:visible":r[9]||=e=>z.value=e,header:`Clear by tool-id prefix`,modal:``,style:{width:`24rem`}},{footer:T(()=>[e(d(k),{label:`Cancel`,text:``,onClick:r[8]||=e=>z.value=!1}),e(d(k),{label:`Clear`,icon:`pi pi-trash`,severity:`danger`,loading:V.value,onClick:W},null,8,[`loading`])]),default:T(()=>[F(`div`,Mt,[F(`label`,null,[r[13]||=F(`span`,null,`Tool ID prefix`,-1),e(d(M),{modelValue:B.value,"onUpdate:modelValue":r[7]||=e=>B.value=e,placeholder:`e.g. toolshed.g2.bx.psu.edu/repos/iuc/`},null,8,[`modelValue`])])])]),_:1},8,[`visible`])])}}}),[[`__scopeId`,`data-v-5ba0c46d`]]),Pt={class:`view-header`},Ft={class:`header-actions`},It=`gxwf-ui:cache-transport`,Lt=A(S({__name:`ToolCacheView`,setup(t){function n(){try{let e=localStorage.getItem(It);if(e===`server`||e===`client`||e===`both`)return e}catch{}return`server`}let r=U(n());E(r,e=>{try{localStorage.setItem(It,e)}catch{}});let i=[{label:`Server`,value:`server`},{label:`Client`,value:`client`},{label:`Both`,value:`both`}];return(t,n)=>(L(),m(`div`,null,[F(`div`,Pt,[n[1]||=F(`div`,null,[F(`h1`,null,`Tool Cache`),F(`p`,{class:`subtitle`},[l(` Inspect and manage parsed-tool caches. The server-side cache lives on disk inside `),F(`code`,null,`gxwf-web`),l(`; the client-side cache is browser-local IndexedDB used by the client edge-annotations transport. `)])],-1),F(`div`,Ft,[e(d(me),{modelValue:r.value,"onUpdate:modelValue":n[0]||=e=>r.value=e,options:i,optionLabel:`label`,optionValue:`value`,allowEmpty:!1,"aria-label":`Cache transport`},null,8,[`modelValue`])])]),r.value===`server`||r.value===`both`?(L(),s(Nt,{key:0,transport:`server`})):h(``,!0),r.value===`client`||r.value===`both`?(L(),s(Nt,{key:1,transport:`client`})):h(``,!0),e(d(Ke))]))}}),[[`__scopeId`,`data-v-a92ad1cc`]]);export{Lt as default};