import{j as i,c as j,ao as H,a as k,am as N,r as w,cY as A,cZ as D,cI as F,M as K,I as J,J as P,K as X,b as R,t as B,d as V,s as L,e as T}from"./main-78369d74.js";import{C as Y}from"./ChevronRight-4d13b02f.js";function Z(t){const{isCurrent:e,sizeStyle:n,isMenuTrigger:f,isClickable:y,isDisabled:d,onSelected:h,className:S,isMenuItem:m,isLink:s}=t,p=typeof t.children=="function"?t.children({isMenuItem:m}):t.children;if(m)return p;const x=f?{}:{tabIndex:s&&!d?0:void 0,role:s?"link":void 0,"aria-disabled":s?d:void 0,"aria-current":e&&s?"page":void 0,onClick:()=>h==null?void 0:h()};return i.jsxs("li",{className:j(`relative inline-flex min-w-0 flex-shrink-0 items-center justify-start ${n==null?void 0:n.font}`,(!y||d)&&"pointer-events-none",!e&&d&&"text-disabled"),children:[i.jsx("div",{...x,className:j(S,"cursor-pointer overflow-hidden whitespace-nowrap rounded px-8",!f&&"py-4 hover:bg-hover",!f&&s&&"outline-none focus-visible:ring"),children:p}),e===!1&&i.jsx(Y,{size:n==null?void 0:n.icon,className:j(d?"text-disabled":"text-muted")})]})}const q=H(i.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHorizOutlined"),G=1,Q=10;function ie(t){const{size:e="md",children:n,isDisabled:f,className:y,currentIsClickable:d,isNavigation:h}=t,{trans:S}=k(),m=U(e),s=[];N.Children.forEach(n,r=>{N.isValidElement(r)&&s.push(r)});const p=w.useRef(null),x=w.useRef(null),[E,C]=A(s.length),$=w.useCallback(()=>{const r=c=>{var z;const a=x.current;if(!a)return;const o=Array.from(a.children);if(!o.length)return;const b=a.offsetWidth,I=s.length>c;let l=0,u=0,v=Q;if(l+=o.shift().offsetWidth,u++,I&&(l+=((z=o.shift())==null?void 0:z.offsetWidth)??0,v--),l>=b&&u--,o.length>0){const M=o.pop();M.style.overflow="visible",l+=M.offsetWidth,l<b&&u++,M.style.overflow=""}for(const M of o.reverse())l+=M.offsetWidth,l<b&&u++;return Math.max(G,Math.min(v,u))};C(function*(){yield s.length;const c=r(s.length);yield c,c<s.length&&c>1&&(yield r(c))})},[x,n,C]);D({ref:p,onResize:$}),F($,[n]);let g=s;if(s.length>E){const r=s.length-1;g=[i.jsx(Z,{sizeStyle:m,isMenuTrigger:!0,children:i.jsxs(K,{selectionMode:"single",selectedValue:r,children:[i.jsx(J,{"aria-label":"…",disabled:f,size:m.btn,children:i.jsx(q,{})}),i.jsx(P,{children:s.map((b,I)=>{const l=r===I;return i.jsx(X,{value:I,onSelected:()=>{var u,v;l||(v=(u=b.props).onSelected)==null||v.call(u)},children:w.cloneElement(b,{isMenuItem:!0})},I)})})]})},"menu")];const a=[...s];let o=E;E>1&&(g.unshift(a.shift()),o--),g.push(...a.slice(-o))}const W=g.length-1,O=g.map((r,c)=>{const a=c===W,o=!a||d;return w.cloneElement(r,{key:r.key||c,isCurrent:a,sizeStyle:m,isClickable:o,isDisabled:f,isLink:h&&r.key!=="menu"})}),_=h?"nav":"div";return i.jsx(_,{className:j(y,"w-full min-w-0"),"aria-label":S({message:"Breadcrumbs"}),ref:p,children:i.jsx("ol",{ref:x,className:j("flex flex-nowrap justify-start",m.minHeight),children:O})})}function U(t){switch(t){case"sm":return{font:"text-sm",icon:"sm",btn:"sm",minHeight:"min-h-36"};case"lg":return{font:"text-lg",icon:"md",btn:"md",minHeight:"min-h-42"};case"xl":return{font:"text-xl",icon:"md",btn:"md",minHeight:"min-h-42"};default:return{font:"text-base",icon:"md",btn:"md",minHeight:"min-h-42"}}}function re(){const{trans:t}=k();return R({mutationFn:e=>ee(e),onSuccess:(e,n)=>{B(n.delete?t(V("Subscription deleted.")):t(V("Subscription cancelled.")))},onError:e=>L(e)})}function ee({subscriptionId:t,...e}){return T.post(`billing/subscriptions/${t}/cancel`,e).then(n=>n.data)}function oe(){const{trans:t}=k();return R({mutationFn:e=>te(e),onSuccess:()=>{B(t(V("Subscription renewed.")))},onError:e=>L(e)})}function te({subscriptionId:t}){return T.post(`billing/subscriptions/${t}/resume`).then(e=>e.data)}const ce=H(i.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"}),"OpenInNewOutlined");export{ie as B,q as M,ce as O,Z as a,oe as b,re as u};
//# sourceMappingURL=OpenInNew-307c172e.js.map
