mirror of
https://github.com/detleph/components.git
synced 2026-09-04 08:36:03 +02:00
52 lines
28 KiB
JavaScript
52 lines
28 KiB
JavaScript
var Re=Object.defineProperty;var i=(e,t)=>Re(e,"name",{value:t,configurable:!0});import{b as W,r as c,j as m,a as F,F as se,R as le}from"./jsx-runtime.b99428f5.js";import{j as Pe}from"./iframe.5c9acd95.js";import{m as Ee}from"./make-decorator.82900f15.js";/**
|
|
* @remix-run/router v1.0.2
|
|
*
|
|
* 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 t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$.apply(this,arguments)}i($,"_extends$1");var C;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(C||(C={}));function _e(e){e===void 0&&(e={});let{initialEntries:t=["/"],initialIndex:r,v5Compat:n=!1}=e,a;a=t.map((f,y)=>h(f,typeof f=="string"?null:f.state,y===0?"default":void 0));let s=u(r==null?a.length-1:r),o=C.Pop,l=null;function u(f){return Math.min(Math.max(f,0),a.length-1)}i(u,"clampIndex");function d(){return a[s]}i(d,"getCurrentLocation");function h(f,y,v){y===void 0&&(y=null);let x=Ae(a?d().pathname:"/",f,y,v);return Te(x.pathname.charAt(0)==="/","relative pathnames are not supported in memory history: "+JSON.stringify(f)),x}return i(h,"createMemoryLocation"),{get index(){return s},get action(){return o},get location(){return d()},createHref(f){return typeof f=="string"?f:H(f)},push(f,y){o=C.Push;let v=h(f,y);s+=1,a.splice(s,a.length,v),n&&l&&l({action:o,location:v})},replace(f,y){o=C.Replace;let v=h(f,y);a[s]=v,n&&l&&l({action:o,location:v})},go(f){o=C.Pop,s=u(s+f),l&&l({action:o,location:d()})},listen(f){return l=f,()=>{l=null}}}}i(_e,"createMemoryHistory");function Te(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}i(Te,"warning$1");function we(){return Math.random().toString(36).substr(2,8)}i(we,"createKey");function Ae(e,t,r,n){return r===void 0&&(r=null),$({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?T(t):t,{state:r,key:t&&t.key||n||we()})}i(Ae,"createLocation");function H(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}i(H,"createPath");function T(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}i(T,"parsePath");var Q;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Q||(Q={}));function Oe(e,t,r){r===void 0&&(r="/");let n=typeof t=="string"?T(t):t,a=ce(n.pathname||"/",r);if(a==null)return null;let s=ue(e);Ie(s);let o=null;for(let l=0;o==null&&l<s.length;++l)o=Be(s[l],a);return o}i(Oe,"matchRoutes");function ue(e,t,r,n){return t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n=""),e.forEach((a,s)=>{let o={relativePath:a.path||"",caseSensitive:a.caseSensitive===!0,childrenIndex:s,route:a};o.relativePath.startsWith("/")&&(g(o.relativePath.startsWith(n),'Absolute route path "'+o.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),o.relativePath=o.relativePath.slice(n.length));let l=b([n,o.relativePath]),u=r.concat(o);a.children&&a.children.length>0&&(g(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+l+'".')),ue(a.children,t,u,l)),!(a.path==null&&!a.index)&&t.push({path:l,score:je(l,a.index),routesMeta:u})}),t}i(ue,"flattenRoutes");function Ie(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Ne(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}i(Ie,"rankRouteBranches");const Le=/^:\w+$/,ke=3,Me=2,De=1,$e=10,Ue=-2,Z=i(e=>e==="*","isSplat");function je(e,t){let r=e.split("/"),n=r.length;return r.some(Z)&&(n+=Ue),t&&(n+=Me),r.filter(a=>!Z(a)).reduce((a,s)=>a+(Le.test(s)?ke:s===""?De:$e),n)}i(je,"computeScore");function Ne(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}i(Ne,"compareIndexes");function Be(e,t){let{routesMeta:r}=e,n={},a="/",s=[];for(let o=0;o<r.length;++o){let l=r[o],u=o===r.length-1,d=a==="/"?t:t.slice(a.length)||"/",h=We({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},d);if(!h)return null;Object.assign(n,h.params);let p=l.route;s.push({params:n,pathname:b([a,h.pathname]),pathnameBase:Ke(b([a,h.pathnameBase])),route:p}),h.pathnameBase!=="/"&&(a=b([a,h.pathnameBase]))}return s}i(Be,"matchRouteBranch");function Ve(e,t){return t===void 0&&(t={}),e.replace(/:(\w+)/g,(r,n)=>(g(t[n]!=null,'Missing ":'+n+'" param'),t[n])).replace(/(\/?)\*/,(r,n,a,s)=>{const o="*";return t[o]==null?s==="/*"?"/":"":""+n+t[o]})}i(Ve,"generatePath");function We(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Fe(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let s=a[0],o=s.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:n.reduce((d,h,p)=>{if(h==="*"){let f=l[p]||"";o=s.slice(0,s.length-f.length).replace(/(.)\/+$/,"$1")}return d[h]=He(l[p]||"",h),d},{}),pathname:s,pathnameBase:o,pattern:e}}i(We,"matchPath");function Fe(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),he(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/:(\w+)/g,(o,l)=>(n.push(l),"([^\\/]+)"));return e.endsWith("*")?(n.push("*"),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}i(Fe,"compilePath");function He(e,t){try{return decodeURIComponent(e)}catch(r){return he(!1,'The value for the URL param "'+t+'" will not be decoded because'+(' the string "'+e+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),e}}i(He,"safelyDecodeURIComponent");function ce(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}i(ce,"stripBasename");function g(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}i(g,"invariant");function he(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}i(he,"warning");function Ge(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?T(e):e;return{pathname:r?r.startsWith("/")?r:Je(r,t):t,search:Ye(n),hash:ze(a)}}i(Ge,"resolvePath");function Je(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}i(Je,"resolvePathname");function N(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}i(N,"getInvalidPathError");function fe(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=T(e):(a=$({},e),g(!a.pathname||!a.pathname.includes("?"),N("?","pathname","search",a)),g(!a.pathname||!a.pathname.includes("#"),N("#","pathname","hash",a)),g(!a.search||!a.search.includes("#"),N("#","search","hash",a)));let s=e===""||a.pathname==="",o=s?"/":a.pathname,l;if(n||o==null)l=r;else{let p=t.length-1;if(o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),p-=1;a.pathname=f.join("/")}l=p>=0?t[p]:"/"}let u=Ge(a,l),d=o&&o!=="/"&&o.endsWith("/"),h=(s||o===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(d||h)&&(u.pathname+="/"),u}i(fe,"resolveTo");const b=i(e=>e.join("/").replace(/\/\/+/g,"/"),"joinPaths"),Ke=i(e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),"normalizePathname"),Ye=i(e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,"normalizeSearch"),ze=i(e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,"normalizeHash");class de{constructor(t,r,n){this.status=t,this.statusText=r||"",this.data=n}}i(de,"ErrorResponse");function qe(e){return e instanceof de}i(qe,"isRouteErrorResponse");/**
|
|
* React Router v6.4.2
|
|
*
|
|
* 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 G(){return G=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},G.apply(this,arguments)}i(G,"_extends");function Xe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}i(Xe,"isPolyfill");const Qe=typeof Object.is=="function"?Object.is:Xe,{useState:Ze,useEffect:et,useLayoutEffect:tt,useDebugValue:rt}=W;function nt(e,t,r){const n=t(),[{inst:a},s]=Ze({inst:{value:n,getSnapshot:t}});return tt(()=>{a.value=n,a.getSnapshot=t,B(a)&&s({inst:a})},[e,n,t]),et(()=>(B(a)&&s({inst:a}),e(i(()=>{B(a)&&s({inst:a})},"handleStoreChange"))),[e]),rt(n),n}i(nt,"useSyncExternalStore$2");function B(e){const t=e.getSnapshot,r=e.value;try{const n=t();return!Qe(r,n)}catch{return!0}}i(B,"checkIfSnapshotChanged");function at(e,t,r){return t()}i(at,"useSyncExternalStore$1");const ot=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",it=!ot,st=it?at:nt;"useSyncExternalStore"in W&&(e=>e.useSyncExternalStore)(W);const lt=c.exports.createContext(null),ut=c.exports.createContext(null),pe=c.exports.createContext(null),q=c.exports.createContext(null),w=c.exports.createContext(null),R=c.exports.createContext({outlet:null,matches:[]}),me=c.exports.createContext(null);function ct(e,t){let{relative:r}=t===void 0?{}:t;A()||g(!1);let{basename:n,navigator:a}=c.exports.useContext(q),{hash:s,pathname:o,search:l}=ge(e,{relative:r}),u=o;return n!=="/"&&(u=o==="/"?n:b([n,o])),a.createHref({pathname:u,search:l,hash:s})}i(ct,"useHref");function A(){return c.exports.useContext(w)!=null}i(A,"useInRouterContext");function P(){return A()||g(!1),c.exports.useContext(w).location}i(P,"useLocation");function ht(){return c.exports.useContext(w).navigationType}i(ht,"useNavigationType");function ve(e){return e.filter((t,r)=>r===0||!t.route.index&&t.pathnameBase!==e[r-1].pathnameBase)}i(ve,"getPathContributingMatches");function ye(){A()||g(!1);let{basename:e,navigator:t}=c.exports.useContext(q),{matches:r}=c.exports.useContext(R),{pathname:n}=P(),a=JSON.stringify(ve(r).map(l=>l.pathnameBase)),s=c.exports.useRef(!1);return c.exports.useEffect(()=>{s.current=!0}),c.exports.useCallback(function(l,u){if(u===void 0&&(u={}),!s.current)return;if(typeof l=="number"){t.go(l);return}let d=fe(l,JSON.parse(a),n,u.relative==="path");e!=="/"&&(d.pathname=d.pathname==="/"?e:b([e,d.pathname])),(u.replace?t.replace:t.push)(d,u.state,u)},[e,t,a,n])}i(ye,"useNavigate");function ft(){let{matches:e}=c.exports.useContext(R),t=e[e.length-1];return t?t.params:{}}i(ft,"useParams");function ge(e,t){let{relative:r}=t===void 0?{}:t,{matches:n}=c.exports.useContext(R),{pathname:a}=P(),s=JSON.stringify(ve(n).map(o=>o.pathnameBase));return c.exports.useMemo(()=>fe(e,JSON.parse(s),a,r==="path"),[e,s,a,r])}i(ge,"useResolvedPath");function dt(e,t){A()||g(!1);let r=c.exports.useContext(pe),{matches:n}=c.exports.useContext(R),a=n[n.length-1],s=a?a.params:{};a&&a.pathname;let o=a?a.pathnameBase:"/";a&&a.route;let l=P(),u;if(t){var d;let v=typeof t=="string"?T(t):t;o==="/"||((d=v.pathname)==null?void 0:d.startsWith(o))||g(!1),u=v}else u=l;let h=u.pathname||"/",p=o==="/"?h:h.slice(o.length)||"/",f=Oe(e,{pathname:p}),y=vt(f&&f.map(v=>Object.assign({},v,{params:Object.assign({},s,v.params),pathname:b([o,v.pathname]),pathnameBase:v.pathnameBase==="/"?o:b([o,v.pathnameBase])})),n,r||void 0);return t?m(w.Provider,{value:{location:G({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:C.Pop},children:y}):y}i(dt,"useRoutes");function pt(){let e=gt(),t=qe(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},s={padding:"2px 4px",backgroundColor:n};return F(se,{children:[m("h2",{children:"Unhandled Thrown Error!"}),m("h3",{style:{fontStyle:"italic"},children:t}),r?m("pre",{style:a,children:r}):null,m("p",{children:"\u{1F4BF} Hey developer \u{1F44B}"}),F("p",{children:["You can provide a way better UX than this when your app throws errors by providing your own\xA0",m("code",{style:s,children:"errorElement"})," props on\xA0",m("code",{style:s,children:"<Route>"})]})]})}i(pt,"DefaultErrorElement");class xe extends c.exports.Component{constructor(t){super(t),this.state={location:t.location,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location?{error:t.error,location:t.location}:{error:t.error||r.error,location:r.location}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error?m(me.Provider,{value:this.state.error,children:this.props.component}):this.props.children}}i(xe,"RenderErrorBoundary");function mt(e){let{routeContext:t,match:r,children:n}=e,a=c.exports.useContext(lt);return a&&r.route.errorElement&&(a._deepestRenderedBoundaryId=r.route.id),m(R.Provider,{value:t,children:n})}i(mt,"RenderedRoute");function vt(e,t,r){if(t===void 0&&(t=[]),e==null)if(r!=null&&r.errors)e=r.matches;else return null;let n=e,a=r==null?void 0:r.errors;if(a!=null){let s=n.findIndex(o=>o.route.id&&(a==null?void 0:a[o.route.id]));s>=0||g(!1),n=n.slice(0,Math.min(n.length,s+1))}return n.reduceRight((s,o,l)=>{let u=o.route.id?a==null?void 0:a[o.route.id]:null,d=r?o.route.errorElement||m(pt,{}):null,h=i(()=>m(mt,{match:o,routeContext:{outlet:s,matches:t.concat(n.slice(0,l+1))},children:u?d:o.route.element!==void 0?o.route.element:s}),"getChildren");return r&&(o.route.errorElement||l===0)?m(xe,{location:r.location,component:d,error:u,children:h()}):h()},null)}i(vt,"_renderMatches");var ee;(function(e){e.UseRevalidator="useRevalidator"})(ee||(ee={}));var J;(function(e){e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator"})(J||(J={}));function yt(e){let t=c.exports.useContext(pe);return t||g(!1),t}i(yt,"useDataRouterState");function gt(){var e;let t=c.exports.useContext(me),r=yt(J.UseRouteError),n=c.exports.useContext(R),a=n.matches[n.matches.length-1];return t||(n||g(!1),a.route.id||g(!1),(e=r.errors)==null?void 0:e[a.route.id])}i(gt,"useRouteError");function xt(e){let{basename:t,children:r,initialEntries:n,initialIndex:a}=e,s=c.exports.useRef();s.current==null&&(s.current=_e({initialEntries:n,initialIndex:a,v5Compat:!0}));let o=s.current,[l,u]=c.exports.useState({action:o.action,location:o.location});return c.exports.useLayoutEffect(()=>o.listen(u),[o]),m(St,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o})}i(xt,"MemoryRouter");function K(e){g(!1)}i(K,"Route");function St(e){let{basename:t="/",children:r=null,location:n,navigationType:a=C.Pop,navigator:s,static:o=!1}=e;A()&&g(!1);let l=t.replace(/^\/*/,"/"),u=c.exports.useMemo(()=>({basename:l,navigator:s,static:o}),[l,s,o]);typeof n=="string"&&(n=T(n));let{pathname:d="/",search:h="",hash:p="",state:f=null,key:y="default"}=n,v=c.exports.useMemo(()=>{let x=ce(d,l);return x==null?null:{pathname:x,search:h,hash:p,state:f,key:y}},[l,d,h,p,f,y]);return v==null?null:m(q.Provider,{value:u,children:m(w.Provider,{children:r,value:{location:v,navigationType:a}})})}i(St,"Router");function Ct(e){let{children:t,location:r}=e,n=c.exports.useContext(ut),a=n&&!t?n.router.routes:Y(t);return dt(a,r)}i(Ct,"Routes");var te;(function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"})(te||(te={}));new Promise(()=>{});function Y(e,t){t===void 0&&(t=[]);let r=[];return c.exports.Children.forEach(e,(n,a)=>{if(!c.exports.isValidElement(n))return;if(n.type===c.exports.Fragment){r.push.apply(r,Y(n.props.children,t));return}n.type!==K&&g(!1),!n.props.index||!n.props.children||g(!1);let s=[...t,a],o={id:n.props.id||s.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,hasErrorBoundary:n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle};n.props.children&&(o.children=Y(n.props.children,s)),r.push(o)}),r}i(Y,"createRoutesFromChildren");/**
|
|
* React Router DOM v6.4.2
|
|
*
|
|
* 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 bt(e,t){if(e==null)return{};var r={},n=Object.keys(e),a,s;for(s=0;s<n.length;s++)a=n[s],!(t.indexOf(a)>=0)&&(r[a]=e[a]);return r}i(bt,"_objectWithoutPropertiesLoose");function Rt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}i(Rt,"isModifiedEvent");function Pt(e,t){return e.button===0&&(!t||t==="_self")&&!Rt(e)}i(Pt,"shouldProcessLinkClick");function z(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}i(z,"createSearchParams");function Et(e,t){let r=z(e);for(let n of t.keys())r.has(n)||t.getAll(n).forEach(a=>{r.append(n,a)});return r}i(Et,"getSearchParamsForLocation");const _t=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],Tt=c.exports.forwardRef(i(function(t,r){let{onClick:n,relative:a,reloadDocument:s,replace:o,state:l,target:u,to:d,preventScrollReset:h}=t,p=bt(t,_t),f=ct(d,{relative:a}),y=wt(d,{replace:o,state:l,target:u,preventScrollReset:h,relative:a});function v(x){n&&n(x),x.defaultPrevented||y(x)}return i(v,"handleClick"),m("a",{...p,href:f,onClick:s?n:v,ref:r,target:u})},"LinkWithRef"));var re;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmitImpl="useSubmitImpl",e.UseFetcher="useFetcher"})(re||(re={}));var ne;(function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ne||(ne={}));function wt(e,t){let{target:r,replace:n,state:a,preventScrollReset:s,relative:o}=t===void 0?{}:t,l=ye(),u=P(),d=ge(e,{relative:o});return c.exports.useCallback(h=>{if(Pt(h,r)){h.preventDefault();let p=n!==void 0?n:H(u)===H(d);l(e,{replace:p,state:a,preventScrollReset:s,relative:o})}},[u,l,d,n,a,r,e,s,o])}i(wt,"useLinkClickHandler");function At(e){let t=c.exports.useRef(z(e)),r=P(),n=c.exports.useMemo(()=>Et(r.search,t.current),[r.search]),a=ye(),s=c.exports.useCallback((o,l)=>{const u=z(typeof o=="function"?o(n):o);a("?"+u,l)},[a,n]);return[n,s]}i(At,"useSearchParams");var k="storybook/react-router-v6",Ot="reactRouter",S={CLEAR:"".concat(k,"/clear"),NAVIGATION:"".concat(k,"/navigation"),STORY_LOADED:"".concat(k,"/story-loaded"),ROUTE_MATCHES:"".concat(k,"/route-matches")},It=i(function(){var t=P();return"".concat(t.pathname).concat(t.search).concat(t.hash)},"useCurrentUrl"),Se=le.createContext([]),Ce=i(function(){return le.useContext(Se)},"useDeepRouteMatches");function Lt(e,t){return $t(e)||Dt(e,t)||Mt(e,t)||kt()}i(Lt,"_slicedToArray$2");function kt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}i(kt,"_nonIterableRest$2");function Mt(e,t){if(!!e){if(typeof e=="string")return ae(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ae(e,t)}}i(Mt,"_unsupportedIterableToArray$2");function ae(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}i(ae,"_arrayLikeToArray$2");function Dt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],a=!0,s=!1,o,l;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));a=!0);}catch(u){s=!0,l=u}finally{try{!a&&r.return!=null&&r.return()}finally{if(s)throw l}}return n}}i(Dt,"_iterableToArrayLimit$2");function $t(e){if(Array.isArray(e))return e}i($t,"_arrayWithHoles$2");var Ut=i(function(){var t=P(),r=ft(),n=At(),a=Lt(n,1),s=a[0],o=ht(),l=Ce(),u={};s.forEach(function(p,f){u[f]=p});var d=It(),h=l.map(function(p){return[p.route.path,p.params]});return function(p){switch(p){case S.STORY_LOADED:{var f={url:d,path:t.pathname,routeParams:r,searchParams:u,routeMatches:h,hash:t.hash,routeState:t.state};return{key:t.key,type:S.STORY_LOADED,data:f}}case S.NAVIGATION:{var y={url:d,path:t.pathname,routeParams:r,searchParams:u,hash:t.hash,routeState:t.state,routeMatches:h,navigationType:o};return{key:t.key,type:S.NAVIGATION,data:y}}case S.ROUTE_MATCHES:return{key:"matches-".concat(t.key,"-").concat(h.length),type:S.ROUTE_MATCHES,data:{matches:h}}}}},"useRouterEvent");function jt(){var e={};return e.promise=new Promise(function(t,r){e.resolve=t,e.reject=r}),e}i(jt,"defer");function V(e,t){return Wt(e)||Vt(e,t)||Bt(e,t)||Nt()}i(V,"_slicedToArray$1");function Nt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}i(Nt,"_nonIterableRest$1");function Bt(e,t){if(!!e){if(typeof e=="string")return oe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oe(e,t)}}i(Bt,"_unsupportedIterableToArray$1");function oe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}i(oe,"_arrayLikeToArray$1");function Vt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],a=!0,s=!1,o,l;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));a=!0);}catch(u){s=!0,l=u}finally{try{!a&&r.return!=null&&r.return()}finally{if(s)throw l}}return n}}i(Vt,"_iterableToArrayLimit$1");function Wt(e){if(Array.isArray(e))return e}i(Wt,"_arrayWithHoles$1");var Ft=i(function(t){var r=t.children,n=Pe.getChannel(),a=P(),s=c.exports.useState(),o=V(s,2),l=o[0],u=o[1],d=c.exports.useState(!1),h=V(d,2),p=h[0],f=h[1],y=c.exports.useState([]),v=V(y,2),x=v[0],O=v[1],E=Ut(),_=Ce(),I=c.exports.useRef(jt());return c.exports.useLayoutEffect(function(){u(a)}),c.exports.useEffect(function(){p&&I.current.resolve()},[p]),c.exports.useEffect(function(){O(_);var L=setTimeout(function(){p||(f(!0),n.emit(S.STORY_LOADED,E(S.STORY_LOADED)))},0);return function(){return clearTimeout(L)}},[p,_]),c.exports.useEffect(function(){l!==void 0&&l.key!==a.key&&I.current.promise.then(function(){n.emit(S.NAVIGATION,E(S.NAVIGATION))})},[a]),c.exports.useEffect(function(){p&&_.length>x.length&&(O(_),n.emit(S.ROUTE_MATCHES,E(S.ROUTE_MATCHES)))},[_]),m(se,{children:r})},"RouterLogger");function Ht(e,t){return Yt(e)||Kt(e,t)||Jt(e,t)||Gt()}i(Ht,"_slicedToArray");function Gt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}i(Gt,"_nonIterableRest");function Jt(e,t){if(!!e){if(typeof e=="string")return ie(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ie(e,t)}}i(Jt,"_unsupportedIterableToArray");function ie(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}i(ie,"_arrayLikeToArray");function Kt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],a=!0,s=!1,o,l;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));a=!0);}catch(u){s=!0,l=u}finally{try{!a&&r.return!=null&&r.return()}finally{if(s)throw l}}return n}}i(Kt,"_iterableToArrayLimit");function Yt(e){if(Array.isArray(e))return e}i(Yt,"_arrayWithHoles");var zt=i(function(t){var r,n=t.children,a=t.browserPath,s=t.routePath,o=t.routeParams,l=t.searchParams,u=t.routeState,d=t.outlet,h=Ve(s,o),p=new URLSearchParams(l).toString(),f=p.length>0?"?".concat(p):"",y=c.exports.useState([]),v=Ht(y,2),x=v[0],O=v[1];R.Provider._context=new Proxy((r=R.Provider._context)!==null&&r!==void 0?r:{},{set:i(function(I,L,j){return L==="_currentValue"&&O(function(X){return j.matches.length>X.length?j.matches:X}),Reflect.set(I,L,j)},"set")});var E={search:f,state:u};return a!==void 0&&(E.pathname=a),a===void 0&&h!==""&&(E.pathname=h),m(Se.Provider,{value:x,children:m(xt,{initialEntries:[E],children:m(Ct,{children:m(K,{path:s,element:m(Ft,{children:n}),children:d&&m(K,{index:!0,element:d})})})})})},"StoryRouter");function U(e){return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},U(e)}i(U,"_typeof");var qt=Ee({name:"withRouter",parameterName:Ot,wrapper:i(function(t,r,n){var a=n.parameters,s=a===void 0?{}:a,o=s.routePath,l=o===void 0?"*":o,u=s.routeParams,d=s.routeState,h=s.searchParams,p=s.outlet,f=s.browserPath;if(typeof l!="string")throw new Error("React Router decorator : `path` must be a string");if(u!==void 0&&U(u)!=="object")throw new Error("React Router decorator : `params` must be an object with strings as values");if(h!==void 0&&U(h)!=="object")throw new Error("React Router decorator : `search` must be an object with strings as values");return m(zt,{browserPath:f,routePath:l,routeParams:u,searchParams:h,routeState:d,outlet:p,children:t(r)})},"wrapper")});module&&module.hot&&module.hot.decline&&module.hot.decline();const Xt=i(e=>c.exports.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",role:"img",...e},c.exports.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),c.exports.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})),"SvgSearch"),Qt="_tile_1c4l6_1",Zt="_background_1c4l6_12",er="_textContainer_1c4l6_40",tr="_iconContainer_1c4l6_46",M={tile:Qt,background:Zt,textContainer:er,iconContainer:tr},D=i(({text:e,icon:t,linkTo:r,onClick:n})=>F(Tt,{to:r,onClick:n,className:M.tile,children:[m("div",{className:M.background}),m("span",{className:M.iconContainer,children:m(t,{})}),m("span",{className:M.textContainer,children:e})]}),"Tile"),be=D;try{D.displayName="Tile",D.__docgenInfo={description:"",displayName:"Tile",props:{text:{defaultValue:null,description:"",name:"text",required:!0,type:{name:"string"}},icon:{defaultValue:null,description:"",name:"icon",required:!0,type:{name:"FunctionComponent<Component<SVGProps<SVGSVGElement>>> & { title?: string | undefined; }"}},linkTo:{defaultValue:null,description:"",name:"linkTo",required:!0,type:{name:"string"}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"(() => unknown)"}}}},typeof STORYBOOK_REACT_CLASSES<"u"&&(STORYBOOK_REACT_CLASSES["src/components/tile/Tile.tsx#Tile"]={docgenInfo:D.__docgenInfo,name:"Tile",path:"src/components/tile/Tile.tsx#Tile"})}catch{}const lr={parameters:{storySource:{source:`import React from "react";
|
|
import { withRouter } from "storybook-addon-react-router-v6";
|
|
// @ts-ignore
|
|
import { ReactComponent as Icon } from "../assets/search.svg";
|
|
|
|
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
|
|
import Tile from "../components/tile";
|
|
import { Link } from "react-router-dom";
|
|
|
|
export default { title: "Tile", component: Tile, decorators: [withRouter] } as ComponentMeta<typeof Tile>;
|
|
|
|
const Template: ComponentStory<typeof Tile> = (args) => <Tile {...args} />;
|
|
|
|
export const defaultTile = Template.bind({});
|
|
|
|
defaultTile.args = {
|
|
icon: Icon,
|
|
};
|
|
`,locationsMap:{"default-tile":{startLoc:{col:46,line:13},endLoc:{col:74,line:13},startBody:{col:46,line:13},endBody:{col:74,line:13}}}}},title:"Tile",component:be,decorators:[qt]},rr=i(e=>m(be,{...e}),"Template"),nr=rr.bind({});nr.args={icon:Xt};const ur=["defaultTile"];export{ur as __namedExportsOrder,lr as default,nr as defaultTile};
|
|
//# sourceMappingURL=Tile.stories.eca39a57.js.map
|