1import{d as o,j as m,F as v,r,s as E,t as k,v as y}from"./index-yjs0jCN1.js";function j(e,u){e&&window.dispatchEvent(new CustomEvent(e,{detail:{id:u}}))}function M(e){return e instanceof Promise}function B({actions:e,label:u,eventName:d,onPress:s,icon:l,id:i,appearance:h,preAction:a,postAction:t}){const n=e!=null&&e.length?o.SplitButton:o.Button;return m.jsx(n,{iconBefore:l??null,appearance:h,onPress:async()=>{M(a)?await a():a==null||a(),j(d,i),M(s)?await s():s==null||s(),M(t)?await t():t==null||t()},content:e!=null&&e.length?m.jsx(o.Menu,{items:e==null?void 0:e.map(({id:f,label:x,eventName:c,icon:g,onPress:C})=>({key:f,title:x,icon:g,onPress:()=>{a==null||a(),j(c,f),C==null||C(),t==null||t()}}))}):null,children:m.jsx(v,{id:i,defaultMessage:u})})}const w=r.createContext({actions:{}});function F(){return r.useContext(w)}function L(e,u){const{actions:d}=F();E(e,u),d[e]=u}function R(e){const{pathname:u}=k(),d=y(),s=e.backPath||(u==null?void 0:u.split("/").slice(0,-1).join("/")),l=r.useMemo(()=>(e.actions||[]).concat(d.filter(t=>{var n;return(n=t.handle)==null?void 0:n.actions}).flatMap(t=>{var n;return(n=t.handle)==null?void 0:n.actions}))??[],[d,e.actions]),i=r.useMemo(()=>l.reduce((t,{eventName:n,id:f,onPress:x})=>{const c=f;return n&&(t[c]=()=>j(n,f)),x&&(t[c]=x),t},{}),[l]),h=r.useCallback(t=>m.jsx(w.Provider,{value:{actions:i},...t}),[i]),a=r.useMemo(()=>{const t=()=>m.jsx(r.Fragment,{children:l.map(n=>"render"in n?n.render():m.jsx(B,{...n},n.id))});return t.displayName="Actions",t},[l]);return{actions:l,Actions:a,backPath:s,AdminContextProvider:h}}export{L as a,R as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.