UNPKG

sui-explorer-local

Version:
11 lines (10 loc) 5.79 kB
import{j as f}from"./jsx-runtime-ffb262ed.js";import{c as U}from"./index-dca19ccf.js";import{r as u}from"./index-76fb7be0.js";import"./index-d3ea75b5.js";import{N as T,s as q,u as N,a as V,b as j,c as A,d as w}from"./index-1489375c.js";/** * React Router DOM v6.22.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function _(){return _=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_.apply(this,arguments)}function Q(e,a){if(e==null)return{};var t={},r=Object.keys(e),n,s;for(s=0;s<r.length;s++)n=r[s],!(a.indexOf(n)>=0)&&(t[n]=e[n]);return t}function W(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function z(e,a){return e.button===0&&(!a||a==="_self")&&!W(e)}function g(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((a,t)=>{let r=e[t];return a.concat(Array.isArray(r)?r.map(n=>[t,n]):[[t,r]])},[]))}function K(e,a){let t=g(e);return a&&a.forEach((r,n)=>{t.has(n)||a.getAll(n).forEach(s=>{t.append(n,s)})}),t}const I=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],M="6";try{window.__reactRouterVersion=M}catch{}const Y=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",D=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,G=u.forwardRef(function(a,t){let{onClick:r,relative:n,reloadDocument:s,replace:l,state:i,target:c,to:o,preventScrollReset:p,unstable_viewTransition:m}=a,y=Q(a,I),{basename:O}=u.useContext(T),S,v=!1;if(typeof o=="string"&&D.test(o)&&(S=o,Y))try{let d=new URL(window.location.href),h=o.startsWith("//")?new URL(d.protocol+o):new URL(o),k=q(h.pathname,O);h.origin===d.origin&&k!=null?o=k+h.search+h.hash:v=!0}catch{}let C=N(o,{relative:n}),F=H(o,{replace:l,state:i,target:c,preventScrollReset:p,relative:n,unstable_viewTransition:m});function B(d){r&&r(d),d.defaultPrevented||F(d)}return u.createElement("a",_({},y,{href:S||C,onClick:v||s?r:B,ref:t,target:c}))});var E;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(E||(E={}));var L;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(L||(L={}));function H(e,a){let{target:t,replace:r,state:n,preventScrollReset:s,relative:l,unstable_viewTransition:i}=a===void 0?{}:a,c=V(),o=j(),p=A(e,{relative:l});return u.useCallback(m=>{if(z(m,t)){m.preventDefault();let y=r!==void 0?r:w(o)===w(p);c(e,{replace:y,state:n,preventScrollReset:s,relative:l,unstable_viewTransition:i})}},[o,c,p,r,n,t,e,s,l,i])}function X(e){let a=u.useRef(g(e)),t=u.useRef(!1),r=j(),n=u.useMemo(()=>K(r.search,t.current?null:a.current),[r.search]),s=V(),l=u.useCallback((i,c)=>{const o=g(typeof i=="function"?i(n):i);t.current=!0,s("?"+o,c)},[s,n]);return[n,l]}const x=["network"],b=u.forwardRef(({to:e,...a},t)=>{const r=N(e),[n]=X(),[s,l]=r.split("?"),i=u.useMemo(()=>{const c=new URLSearchParams(l);return x.forEach(o=>{n.has(o)&&c.set(o,n.get(o))}),c.toString()},[l,n]);return f.jsx(G,{ref:t,to:{pathname:s,search:i},...a})});try{x.displayName="PRESERVE_QUERY",x.__docgenInfo={description:"Query params that we want to be preserved between all pages.",displayName:"PRESERVE_QUERY",props:{}}}catch{}try{b.displayName="LinkWithQuery",b.__docgenInfo={description:"",displayName:"LinkWithQuery",props:{}}}catch{}const R=u.forwardRef(({href:e,to:a,...t},r)=>e?f.jsx("a",{ref:r,target:"_blank",rel:"noreferrer noopener",href:e,...t}):a?f.jsx(b,{to:a,ref:r,...t}):f.jsx("button",{...t,type:t.type||"button",ref:r}));try{R.displayName="ButtonOrLink",R.__docgenInfo={description:"",displayName:"ButtonOrLink",props:{}}}catch{}const $=U([],{variants:{variant:{text:"text-body font-semibold text-steel-dark hover:text-steel-darker active:text-steel disabled:text-gray-60",mono:"font-mono text-body font-medium text-hero-dark hover:text-hero-darkest break-all",textHeroDark:"text-pBody font-medium text-hero-dark hover:text-hero-darkest"},uppercase:{true:"uppercase"},size:{md:"!text-body",sm:"!text-bodySmall",captionSmall:"!text-captionSmall"}},defaultVariants:{variant:"text"}}),J=U(["flex-nowrap items-center"],{variants:{gap:{"gap-1":"gap-1","gap-2":"gap-2"},display:{"inline-flex":"inline-flex",block:"block",flex:"flex"}},defaultVariants:{gap:"gap-2",display:"inline-flex"}});function P({variant:e,uppercase:a,size:t,before:r,after:n,children:s,display:l,gap:i,...c}){return f.jsx(R,{className:$({variant:e,size:t,uppercase:a}),...c,children:f.jsxs("div",{className:J({gap:i,display:l}),children:[r,s,n]})})}try{P.displayName="Link",P.__docgenInfo={description:"",displayName:"Link",props:{before:{defaultValue:null,description:"",name:"before",required:!1,type:{name:"ReactNode"}},after:{defaultValue:null,description:"",name:"after",required:!1,type:{name:"ReactNode"}},variant:{defaultValue:null,description:"",name:"variant",required:!1,type:{name:'"text" | "mono" | "textHeroDark" | null'}},uppercase:{defaultValue:null,description:"",name:"uppercase",required:!1,type:{name:"boolean | null"}},size:{defaultValue:null,description:"",name:"size",required:!1,type:{name:'"sm" | "md" | "captionSmall" | null'}},gap:{defaultValue:null,description:"",name:"gap",required:!1,type:{name:'"gap-1" | "gap-2" | null'}},display:{defaultValue:null,description:"",name:"display",required:!1,type:{name:'"inline-flex" | "block" | "flex" | null'}}}}}catch{}export{P as L};