@blocklet/pages-kit-inner-components 0.0.18 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,542 +0,0 @@
1
- "use strict";var He=Object.create;var me=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Fe=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var Ve=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Oe(t))!De.call(e,r)&&r!==n&&me(e,r,{get:()=>t[r],enumerable:!(i=Me(t,r))||i.enumerable});return e};var pe=(e,t,n)=>(n=e!=null?He(Fe(e)):{},Ve(t||!e||!e.__esModule?me(n,"default",{value:e,enumerable:!0}):n,e));const o=require("react/jsx-runtime"),w=require("./state-CfaAw7fr.js"),Ge=require("@arcblock/ux/lib/Locale/context"),Je=require("@arcblock/ux/lib/Result"),Ke=require("@blocklet/pages-kit/builtin/page/header"),Xe=require("@blocklet/ui-react/lib/Header"),j=require("@emotion/css"),Y=require("@emotion/react"),Ye=require("@emotion/styled"),u=require("@mui/material"),Qe=require("isomorphic-dompurify"),Ze=require("lodash/isEmpty"),f=require("react"),et=require("react-helmet"),B=require("react-router-dom"),U=require("react-use"),P=require("ufo");require("@mui/icons-material");const J=require("@blocklet/ai-runtime/components"),tt=require("@mui/utils"),ot=require("lodash/pick"),nt=require("react-error-boundary"),Q=require("@iconify/react"),rt=require("react-markdown"),it=require("remark-gfm"),st=require("@mui/lab"),$=require("@arcblock/ux/lib/Theme"),at=require("@arcblock/react-hooks/lib/useBrowser"),ct=require("@arcblock/ux/lib/Colors"),ne=require("@blocklet/pages-kit/components"),lt=require("@mui/material/useMediaQuery"),ke=require("lodash"),ve=require("@iconify-icon/react"),dt=require("@arcblock/ux/lib/Screenshot"),ut=require("lodash/omit"),mt=require("@arcblock/ux/lib/Button"),pt=require("is-uri"),K=require("pathe"),xt=require("@blocklet/embed/message"),ht=require("ahooks"),ft=require("lodash/isEqual"),gt=require("@blocklet/embed/react"),bt=require("react-twitter-embed"),yt=require("@blocklet/ui-react/lib/Footer"),jt=require("webfontloader"),wt=require("@arcblock/did-connect/lib/Session"),S=e=>e&&e.__esModule?e:{default:e},_t=S(Je),kt=S(Xe),$e=S(Ye),vt=S(Qe),$t=S(Ze),Se=S(f),re=S(ot),St=S(rt),Ct=S(it),Bt=S(at),xe=S(ct),Ce=S(lt),It=S(dt),q=S(ut),Nt=S(mt),Z=S(pt),Pt=S(ft),Rt=S(yt),Tt=S(jt),qt=f.forwardRef(({onClick:e,...t},n)=>{const[i,r]=f.useState(!1),s=f.useCallback(async a=>{try{r(!0),await(e==null?void 0:e(a))}finally{r(!1)}},[e]);return o.jsx(st.LoadingButton,{ref:n,...t,loading:t.loading||i,onClick:s})});function zt({tip:e,tipSucceed:t,title:n,titleSucceed:i,icon:r,iconSucceed:s,autoReset:a,placement:c="top",...l}){const[d,m]=f.useState(!1),[x,h]=f.useState(),p=f.useRef(),y=()=>{h(void 0),a&&(p.current=window.setTimeout(()=>{m(!1)},3e3))},_=()=>{clearTimeout(p.current)},b=d?s:r,k=x?o.jsx(u.Box,{color:"error",children:x.message}):d&&t||e,g=d?i:n;return o.jsx(u.Tooltip,{title:k,disableInteractive:!0,placement:c,onClose:y,onOpen:_,children:o.jsx("span",{children:o.jsx(qt,{startIcon:b&&(typeof b=="string"?o.jsx(Q.Icon,{icon:b}):b),loadingPosition:b?"start":void 0,...l,onClick:async v=>{if(l.onClick)try{await l.onClick(v),m(!0)}catch(N){h(N)}},children:g})})})}const Et=Se.default.lazy(()=>import("react-syntax-highlighter").then(e=>({default:e.Prism}))),Wt=u.styled(e=>o.jsx(St.default,{...e,remarkPlugins:[Ct.default],components:{pre:Lt,code:({node:t,inline:n,className:i,children:r,...s})=>{if(!r)return null;const a=/language-(\w+)/.exec(i||"");return n?o.jsx(u.Box,{component:"code",className:i,...s,children:r}):o.jsx(u.Box,{component:Et,language:a==null?void 0:a[1],...s,sx:{borderRadius:1},children:String(r).replace(/\n$/,"")})},table:({className:t,children:n})=>o.jsx(u.Box,{sx:{overflow:"auto",my:1},children:o.jsx("table",{className:t,children:n})})}}))`
2
- width: 100%;
3
- overflow: hidden;
4
- word-break: break-word;
5
-
6
- > * {
7
- &:first-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
8
- margin-top: 0;
9
- }
10
- &:last-child /* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */ {
11
- margin-bottom: 0;
12
- }
13
- }
14
-
15
- pre {
16
- overflow: auto;
17
- }
18
-
19
- li {
20
- margin: 0;
21
- padding: 0;
22
- }
23
-
24
- li p {
25
- display: inline-block;
26
- vertical-align: top;
27
- margin: 0;
28
- padding: 0;
29
- }
30
-
31
- table {
32
- border-collapse: collapse;
33
- white-space: nowrap;
34
-
35
- th,
36
- td {
37
- border: 1px solid grey;
38
- padding: 4px 8px;
39
- }
40
- }
41
-
42
- a {
43
- color: ${({theme:e})=>e.palette.primary.main};
44
-
45
- :hover {
46
- text-decoration: underline;
47
- }
48
- }
49
-
50
- &.writing > *:last-child {
51
- &:after {
52
- content: '';
53
- display: inline-block;
54
- vertical-align: middle;
55
- height: 1.2em;
56
- margin-top: -0.2em;
57
- margin-left: 0.1em;
58
- border-right: 0.2em solid orange;
59
- border-radius: 10px;
60
- animation: blink-caret 0.75s step-end infinite;
61
-
62
- @keyframes blink-caret {
63
- from,
64
- to {
65
- border-color: transparent;
66
- }
67
- 50% {
68
- border-color: ${({theme:e})=>e.palette.secondary.main};
69
- }
70
- }
71
- }
72
- }
73
- `;function Lt({children:e}){const t=e==null?void 0:e.props;if(!(t!=null&&t.children))return null;const n=/language-(\w+)/.exec(t.className||""),i=n==null?void 0:n[1];return o.jsxs(u.Box,{component:"div",sx:{fontSize:14,borderRadius:1,bgcolor:"rgb(245, 242, 240)","> pre":{mt:"0 !important"}},children:[o.jsxs(u.Stack,{direction:"row",alignItems:"center",p:.5,pl:1.5,borderBottom:1,borderColor:"grey.200",children:[o.jsx(u.Box,{children:i}),o.jsx(u.Box,{flex:1}),o.jsx(zt,{autoReset:!0,title:o.jsx(Q.Icon,{icon:"tabler:copy"}),titleSucceed:o.jsx(Q.Icon,{icon:"tabler:copy-check"}),sx:{minWidth:32,minHeight:32,p:0,fontSize:18},onClick:()=>{window.navigator.clipboard.writeText(t.children)}})]}),e]})}function E({actions:e,center:t,className:n,align:i}){return e&&(e!=null&&e.length)?o.jsx(u.Box,{className:j.cx("flex gap-4 flex-wrap","lg:flex-row lg:gap-8",(t||i==="center")&&"justify-center",!t&&i==="right"&&"justify-end",!t&&i==="left"&&"justify-start",n),sx:{alignItems:"center"},children:e}):null}const At="section",Ut=u.styled(u.Box)`
74
- overflow: hidden;
75
-
76
- .section__title {
77
- margin-top: 0;
78
- font-weight: 700;
79
- }
80
- .section__title_non_big {
81
- font-size: 32px;
82
- @media (max-width: 600px) {
83
- font-size: 24px;
84
- }
85
- }
86
- &.base-info .section__tag {
87
- margin-top: 0;
88
- margin-bottom: 2vw;
89
- background-color: ${({theme:e})=>e.palette.primary.main};
90
- white-space: nowrap;
91
- max-width: 100%;
92
- display: inline-block;
93
- padding: 0 10px;
94
- justify-content: flex-start;
95
- overflow: hidden;
96
- text-overflow: ellipsis;
97
- font-size: 12px;
98
- color: #fff;
99
- border-radius: 4px;
100
- line-height: 20px;
101
- }
102
- .section__title {
103
- a {
104
- color: ${({theme:e})=>e.palette.primary.main};
105
- }
106
- p {
107
- margin-top: 0;
108
- margin-bottom: 0;
109
- }
110
- }
111
- .section__description {
112
- margin-bottom: 4vw;
113
- margin-top: 0;
114
- a {
115
- color: ${({theme:e})=>e.palette.primary.main};
116
- }
117
- p {
118
- margin-top: 0;
119
- margin-bottom: 0.5rem;
120
- }
121
- }
122
- @media (min-width: ${({theme:e})=>e.breakpoints.values[At]}px) {
123
- .section__tag {
124
- margin-bottom: 32px;
125
- }
126
- .section__title {
127
- margin-bottom: 32px;
128
- }
129
- .section__description {
130
- margin-bottom: 40px;
131
- }
132
- }
133
- `;function H({title:e,description:t,descriptionMarkdown:n,actions:i,className:r="",classes:s={},prepend:a,append:c,level:l=2,tag:d,badge:m,center:x,logo:h,titleAppearance:p,descriptionAppearance:y,..._}){if(!e&&!t&&!i&&!m&&!d&&!a&&!c&&!h)return null;const b=Math.max(Math.min(5,l+1),1),k={1:"xl:!text-3xl lg:!text-2xl md:!text-xl",2:"xl:!text-2xl lg:!text-xl md:!text-lg",3:"xl:!text-2xl lg:!text-xl md:!text-lg",4:"xl:!text-xl lg:!text-lg md:!text-md",5:"xl:!text-lg md:!text-md sm:!text-sm",6:"!text-sm"},g=l===0?"big":`h${b}`,v=l===0;return o.jsxs(Ut,{className:j.cx("base-info","lg:text-left",x&&"!text-center",r),..._,children:[a&&o.jsx("div",{children:a}),(d||m)&&o.jsx("div",{className:j.cx("section__tag",(s==null?void 0:s.tag)||(s==null?void 0:s.badge)),children:d||m}),h&&o.jsx("img",{className:"w-[120px] m-auto mb-8",src:h,alt:"info",loading:"lazy"}),e&&o.jsx(u.Typography,{sx:{whiteSpace:"pre-wrap",mb:t?"2vw":0,...(p==null?void 0:p.color)&&{color:`${p.color} !important`}},className:j.cx("section__title","text-gray-800","dark:text-gray-50",s.title,"page-kit-section__title",v?"":"section__title_non_big"),component:`h${Math.max(l,1)}`,variant:g,children:e}),t&&(n?o.jsx(u.Box,{sx:{...(y==null?void 0:y.color)&&{color:`${y.color} !important`}},component:Wt,className:j.cx("section__description","text-gray-800","dark:text-gray-100",k[b],s.description,"page-kit-section__description"),children:t}):o.jsx(u.Typography,{sx:{whiteSpace:"pre-wrap",...(y==null?void 0:y.color)&&{color:`${y.color} !important`}},className:j.cx("section__description","text-gray-800","dark:text-gray-100",k[b],s.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:t})),o.jsx(E,{actions:i,center:x,className:"mt-8"}),c&&o.jsx("div",{children:c})]})}const M=["actions","append","badge","tag","center","description","descriptionMarkdown","level","logo","prepend","title","titleAppearance","descriptionAppearance"];function Be(e){if(e.type===f.Fragment){const n=(e.props.children||[]).filter(i=>f.isValidElement(i));return n.length===1?Be(n[0]):n.length>1}return Array.isArray(e)}const R="&>*";function ie({children:e,col:t,gap:n,className:i,align:r,sx:s,type:a,...c}={children:null,className:"",col:3,gap:void 0,sx:{},align:"center",type:"default"}){const l=$.useTheme(),d=Number(Math.floor(100/t*100)/100),m={center:"justify-center items-center",left:"justify-start items-center",right:"justify-end items-center",top:"justify-center items-start",bottom:"justify-center items-end","top-left":"justify-start items-start","top-right":"justify-end items-start","bottom-left":"justify-start items-end","bottom-right":"justify-end items-end"},x=m[r]||m.center;let p=n??({2:6,3:4,4:4,5:3,6:3}[t]||0);Be(e)||(p=0);const _=(t-1)*p/t;let b={...s,gap:`${p}rem`};const k={[R]:{width:"100%"}},g={},v={},N={};switch(k.gap="1rem",g.gap=`${p/2}rem`,t){case 3:case 4:g[R]={width:`calc(50% - ${p/2}rem)`};break;case 5:case 6:k[R]={width:`calc(50% - ${p/2/2}rem)`},g[R]={width:`calc(50% - ${p/2/2}rem)`},v[R]={width:`calc(33.33% - ${p*2/3}rem)`};break}return b[R]={width:`calc(${d}% - ${_}rem)`},b[`@media (max-width: ${l.breakpoints.values.xl}px)`]=N,b[`@media (max-width: ${l.breakpoints.values.lg}px)`]=v,b[`@media (max-width: ${l.breakpoints.values.md}px)`]=g,b[`@media (max-width: ${l.breakpoints.values.sm}px)`]=k,a==="wall"&&(b={...s,gap:`${p}rem`},b[R]={width:`calc(${d}% - ${_}rem)`},k[R]={width:`calc(45% - ${p/2/2}rem)`},b[`@media (max-width: ${l.breakpoints.values.sm}px)`]=k),o.jsx(u.Box,{className:j.cx("flex flex-wrap flex-row h-full",x,i),sx:b,...c,children:e})}function Ht(){const e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")}function Mt(e=""){if(e.startsWith("data:image/svg+xml,"))return!0;const t=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,n=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return t.test(e)||n.test(e)}function ee(e){return(e==null?void 0:e.endsWith(".mp4"))||(e==null?void 0:e.endsWith(".m4v"))||(e==null?void 0:e.endsWith(".webm"))}function Ot(e){return e!=null&&e.endsWith(".mp4")||e!=null&&e.endsWith(".m4v")?"video/mp4":e!=null&&e.endsWith(".webm")?"video/webm":void 0}function Ft(e){let t={};return typeof e=="string"?w.isGradient(e)?t.image=e:(t.image=w.getImageAbsoluteUrl(e),w.isColorString(e)&&(t.color=e,t.image="")):t=e,t}function Dt(){const[e,t]=f.useState(Date.now());return f.useEffect(()=>{const n=()=>{t(Date.now())};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n)}},[]),e}function he(e,t,n,i,r){let s=null;const{color:a="",image:c}=Ft(t);return c&&Mt(c)?(delete n.backgroundColor,!(e.mobile.apple.device||Ht())&&ee(c)?s=o.jsx(u.Box,{component:"video",className:"section-bg",width:"100%",autoPlay:!0,loop:!0,muted:!0,controls:!1,playsInline:!0,poster:w.autoResizeImage(w.getImageAbsoluteUrl(i),1200,"quality"),src:ee(c)?c:w.autoResizeImage(c,1200,"quality"),sx:{position:"absolute",zIndex:-9999,right:0,left:0,top:0,width:"100%",height:"100%",objectFit:"cover"}},c):s=o.jsx(ne.ResponsiveImage,{src:c,sizesAttr:{sm:600,md:900,lg:1200},className:"section-bg",alt:"",width:"100%",loading:"lazy",sx:{position:"absolute",zIndex:-9999,right:0,left:0,top:0,width:"100%",height:"100%",objectFit:"cover"}},r||c)):c?n.backgroundImage=`${c} !important`:a&&(n.backgroundColor=`${a} !important`),s}function Vt({autoWidth:e,children:t,...n}){return e?o.jsx(u.Box,{display:"flex",...n,children:t}):o.jsx(u.Container,{...n,children:t})}function O({dark:e=!1,children:t,className:n,sx:i={},boxed:r={show:!1},padding:s="normal",boxProps:a,type:c,...l}){const d={...i},m=Ce.default(p=>p.breakpoints.down("md"));e&&(d.color=xe.default.common.white,d.backgroundColor=`${xe.default.grey[900]} !important`);const x={none:"py-0",small:"py-5 md:py-8 lg:py-8 xl:py-12",normal:"py-10 md:py-15 lg:py-20 xl:py-25",large:"py-15 md:py-20 lg:py-25 xl:py-30"};r.show&&(d.display="flex");const h=f.useMemo(()=>!Number(l.boxMaxWidth)||m?{width:"100%"}:c==="wall"&&l.boxMaxWidth?{maxWidth:`${l.boxMaxWidth}px !important`,width:"100%"}:{width:"100%"},[l.boxMaxWidth,m,c]);return o.jsx(Gt,{component:"section",styles:{...d},className:j.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",x[s],n,{dark:e}),...ke.omit(l,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:o.jsx(Vt,{autoWidth:l==null?void 0:l.autoWidth,className:j.cx("section-content h-full"),sx:h,children:r.show?o.jsx(Ie,{...a,boxed:r,children:t}):t})})}function Ie({background:e="",backgroundVideoPoster:t,children:n,sx:i={},boxed:r={show:!1},className:s="",styles:a={},...c}){const l={...a,...i};let d=null;const m=Ce.default(p=>p.breakpoints.up("sm")),x=Bt.default(),h=Dt();return e&&(d=he(x,e,l,t,h)),r.show&&(l.borderRadius="10px",l.padding===void 0&&(l.padding=m?"50px":"20px"),r!=null&&r.border&&(l.border="1px solid #c0c0c0"),r!=null&&r.background&&(d=he(x,r==null?void 0:r.background,l,r==null?void 0:r.backgroundVideoPoster,h))),o.jsxs(u.Box,{...c,sx:{...l,...d?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:j.cx(s,(r==null?void 0:r.boxShadow)&&"shadow-xl"),children:[d,n]})}const Gt=$.styled(Ie)`
134
- &:nth-of-type(even) {
135
- background: #f8f8f8;
136
- }
137
-
138
- @media (max-width: 600px) {
139
- .section__title {
140
- font-size: 24px;
141
- }
142
-
143
- .base-info {
144
- > *:last-child {
145
- margin-bottom: 0;
146
- }
147
- }
148
- }
149
- `;function Ne({icon:e,...t}){return o.jsx(ve.Icon,{icon:e,...t,ref:null})}function I(e,t){const n=re.default(e,t),i=q.default(e,t);return[n,i]}const Pe=["title","description","actions","badge","tag","prepend","append","logo"];function Jt({image:e,imageBorder:t,imageShadow:n,className:i,reverse:r=!1,fullSizeImage:s,...a}){const[c,l]=I(a,M),d=Object.keys(c).length>0&&Object.values(re.default(c,Pe)).filter(Boolean).length>0&&o.jsx(H,{...c}),m=f.isValidElement(e)?e:o.jsx(u.Box,{component:"img",src:e,alt:"",className:"block"}),x=["phone","macbook"].includes(t),h=e&&o.jsx(u.Box,{className:j.cx("section__image","m-auto, leading-[1] text-center",n&&"shadow-xl",c!=null&&c.center?"flex justify-center items-center":""),sx:{border:t===!0?"1px solid #c0c0c0":void 0,borderRadius:2,overflow:"hidden","> div":x?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:x?o.jsx(It.default,{type:t,sx:{width:"100%"},children:m}):m});return o.jsx(O,{className:j.cx("section--block",i,s&&!r&&j.css`
150
- .section-bg {
151
- height: 80%;
152
- }
153
- `),...l,boxProps:s?{sx:{padding:0,overflow:"hidden"}}:void 0,children:o.jsx(ie,{col:e?2:1,className:s?j.css`
154
- display: flex;
155
- flex-direction: column;
156
-
157
- > .base-info,
158
- > .section__image {
159
- width: 100%;
160
-
161
- > img,
162
- > video {
163
- width: 100%;
164
- }
165
- }
166
- `:void 0,children:r?o.jsxs(o.Fragment,{children:[h,d]}):o.jsxs(o.Fragment,{children:[d,h]})})})}const F=["editing","height","locale","dev"];function Kt(e){return o.jsx(Xt,{...e})}const Xt=$.styled(u.Box)`
167
- position: relative;
168
- `;function Yt({widget:e,reverse:t,projectId:n,assistantId:i,working:r,submitTitle:s,submitIcon:a,submitColor:c,placeholder:l,loadingIndicator:d,section:m,...x}){const[{editing:h},p]=I(x,F),[y,_]=I(p,M),b=n&&i?{projectId:n,gitRef:"main",assistantId:i,working:!0}:void 0,k={children:s,endIcon:a?o.jsx(Ne,{icon:a}):void 0,sx:{background:c||void 0,":hover":{background:c||void 0,opacity:.8}}},g=[],v=l&&o.jsx(u.Typography,{variant:"caption",color:"text.disabled",children:l}),N=d&&o.jsx(u.Typography,{variant:"caption",color:"text.disabled",children:d});Object.keys(y).length>0&&Object.values(re.default(y,Pe)).filter(Boolean).length>0&&g.push(o.jsx(H,{...y},"base-info")),b&&(e==="form"?g.push(o.jsx(J.AIForm,{identifier:b,SubmitProps:k},"form")):e==="result"?g.push(o.jsx(J.AIFormResult,{identifier:b,placeholder:v,loadingIndicator:N},"result")):g.push(o.jsxs(u.Stack,{width:"100%",gap:2,direction:"row",children:[o.jsx(J.AIForm,{identifier:b,BoxProps:{flex:1},SubmitProps:k}),o.jsx(J.AIFormResult,{identifier:b,BoxProps:{flex:1},placeholder:v,loadingIndicator:N})]},"form-result"))),t&&g.reverse();const W=u.useTheme(),G=f.useMemo(()=>u.createTheme(tt.deepmerge(W,{palette:{primary:c?{main:c}:void 0}})),[c,W]);return o.jsx(nt.ErrorBoundary,{fallbackRender:w.ErrorView,children:o.jsx(u.ThemeProvider,{theme:G,children:o.jsx(O,{..._,sx:h?{pointerEvents:"none"}:{},children:o.jsx(ie,{col:g.length,children:g})})})})}const Re=f.createContext({pages:[],project:void 0}),{Provider:Qt,Consumer:cn}=Re;function Te(){return f.useContext(Re)}function Zt({icon:e,className:t="",size:n="1rem",...i}){return o.jsx(eo,{component:Ne,className:j.cx("css-icon",t),size:n,...i,icon:e})}const eo=$.styled(u.Box)`
169
- &.css-icon {
170
- display: inline-block;
171
- width: ${({size:e})=>e};
172
- height: ${({size:e})=>e};
173
- }
174
- `;function to({icon:e,className:t="",size:n="1rem",imageMeta:i,...r}){const s=w.autoResizeImage(w.getImageAbsoluteUrl(e),540),[a,c]=f.useState(!1),l=$.useTheme();return a?o.jsx(Zt,{icon:"i-mdi:image",color:l.palette.grey[500],size:n,className:t,...r}):o.jsx(oo,{className:j.cx("image-icon",t),size:n,...r,children:o.jsx("img",{className:"image-icon__image",src:s,onError:()=>c(!0),width:i==null?void 0:i.naturalWidth,height:i==null?void 0:i.naturalHeight,alt:(i==null?void 0:i.filename)||"card-icon",loading:"lazy"})})}const oo=$.styled(u.Box)`
175
- display: inline-block;
176
- width: ${({size:e})=>e};
177
- height: ${({size:e})=>e};
178
- .image-icon__image {
179
- object-fit: contain;
180
- height: 100%;
181
- width: 100%;
182
- }
183
- `,se=e=>typeof e=="string"&&/^[\w-_]+:[\w-_]+$/.test(e);function te({icon:e,size:t="1rem",imageMeta:n,...i}){const r=window.isNaN(t)?t:`${t}px`;return se(e)?o.jsx(ve.Icon,{icon:e}):o.jsx(no,{component:to,imageMeta:n,className:"base-icon",icon:e,size:r,...i})}const no=$.styled(u.Box)`
184
- flex-shrink: 0;
185
- `;function A({text:e,children:t,icon:n="",endIcon:i,color:r="primary",link:s="",href:a="",...c}){const l=n?o.jsx(te,{icon:n}):null,d=i?o.jsx(te,{icon:i}):null,m=s||a,x={...c};return m&&(x.href=m,Z.default(m)&&(x.target=x.target||"_blank")),o.jsx(Nt.default,{startIcon:l,endIcon:d,color:r,...x,children:e||t})}function qe({editing:e,text:t,...n}){const{pages:i=[]}=Te(),r=i.find(s=>s.id===(n.link||n.linkId));if(e)return o.jsx(A,{...q.default(n,["link","linkId"]),children:t});if(r){const s=r.path||"/";return o.jsx(B.Link,{to:s,children:o.jsx(A,{...q.default(n,["link","linkId"]),children:t})})}return o.jsx(A,{...q.default(n,"linkId"),children:t})}function T({type:e="",icon:t="",size:n="3rem",className:i="",...r}){return o.jsx(te,{icon:t||e,size:n,className:j.cx("content-icon",i),...r})}T.propTypes={};T.defaultProps={type:"",icon:"",size:"3rem",color:"inherit",className:""};function ro({to:e,base:t,children:n,className:i,activeClassName:r="active",target:s="auto",autoExternalMark:a=!1,useRouterLink:c,...l}){const{pages:d=[],locale:m=""}={},x=t?K.join("/",t):t||"";let h=s==="auto"?"_self":s,p=K.join(x,e);const y=a?Z.default(p):!1;if(t)return p=K.join(x,m,e),o.jsx("a",{className:`no-underline ${i}`,href:P.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:n});if(Z.default(e))s==="auto"&&(h="_blank"),p=e;else{P.isRelative(p)&&(p=K.join(window.location.pathname,p));const _=P.parseURL(`${window.location.origin}${p}`),b=d.some(k=>k.pathname===_.pathname);if(c||b)return o.jsx(B.NavLink,{end:!0,to:P.withoutTrailingSlash(p),className:({isActive:k})=>j.cx(i,k?r:""),...l,children:n})}return o.jsxs("a",{className:`no-underline ${i}`,href:P.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:[n,y&&o.jsx(T,{icon:"i-mdi:arrow-top-right",size:"0.9em",className:"smart-link__mark",style:{marginLeft:5}})]})}function D({prepend:e,append:t,children:n,className:i="",dark:r=!1,border:s=!0,...a}){let c={};const{pages:l=[]}=Te(),d=l.find(h=>h.id===a.link),m=!n||Se.default.Children.toArray(n).every(h=>h===null);a.link&&(c={component:ro,to:(d==null?void 0:d.path)||a.link,useRouterLink:!0});const x=r&&s;return o.jsxs(io,{className:j.cx("base-card card",{"border-gray-200":s},{"dark:border-gray-500":x},{dark:r,"border-transparent":!s},i),...c,...q.default(a,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[e,!m&&o.jsx("div",{className:"card__body",children:n}),t]})}const io=$.styled(u.Box)`
186
- &.base-card {
187
- text-align: left;
188
- border-width: 1px;
189
- border-style: solid;
190
- border-radius: 12px;
191
- overflow: hidden;
192
- &,
193
- &:hover {
194
- text-decoration: none;
195
- }
196
- }
197
- .card__body {
198
- padding: 15px 15px;
199
- }
200
- `;function V({align:e="left",title:t,titleProps:n={},description:i,descriptionProps:r={}}){return o.jsxs(o.Fragment,{children:[t&&o.jsx(u.Typography,{className:j.cx("card__title text-gray-800","dark:text-gray-50"),component:"h5",variant:"h5",gutterBottom:!0,align:e,...n,children:t}),i&&o.jsx(u.Typography,{className:j.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:e,...r,children:i})]})}function so({image:e,title:t,description:n,imageProps:i={},imageMeta:r,imageSize:s,titleProps:a={},descriptionProps:c={},actions:l,align:d,...m}){const x=se(e),h=w.autoResizeImage(w.getImageAbsoluteUrl(e),540);return o.jsxs(ao,{className:"card-article",...m,prepend:o.jsx("div",{className:"card__image__wrap",children:x&&e?o.jsx(u.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(T,{icon:e,color:"primary.main"})}):h&&o.jsx("img",{className:"card__image",src:h,...i,alt:i.alt||(r==null?void 0:r.filename)||"card-image",width:r==null?void 0:r.naturalWidth,height:r==null?void 0:r.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"cover",objectPosition:"center"},loading:"lazy"})}),children:[t||n?o.jsx(V,{align:d,title:t,titleProps:a,description:n,descriptionProps:c}):null,l!=null&&l.length?o.jsx(E,{align:d,actions:l,className:"mt-4"}):null]})}const ao=$.styled(D)`
201
- ${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
202
- &:hover {
203
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
204
- }`:""}
205
-
206
- .card__image__wrap {
207
- padding-top: 61.8%;
208
- width: 100%;
209
- position: relative;
210
- }
211
- .card__image {
212
- position: absolute;
213
- top: 0;
214
- left: 0;
215
- bottom: 0;
216
- right: 0;
217
- width: 100%;
218
- height: 100%;
219
- object-position: top center;
220
- }
221
- `,fe="section";function ge({title:e,image:t,imageMeta:n,description:i,actions:r,align:s,listType:a="",className:c="",...l}){return o.jsxs(co,{className:j.cx("card",`list-type-${a}`,c),align:s,...l,children:[t&&o.jsx(T,{icon:t,color:"primary.main",size:a==="icon-title"?"1.2rem":"3rem",imageMeta:n}),e||i?o.jsx(V,{align:s,title:e,description:i}):null,r!=null&&r.length?o.jsx(E,{align:s,actions:r,className:"mt-4"}):null]})}const co=$.styled(D)`
222
- padding: 5vw 4vw;
223
- box-sizing: border-box;
224
- /* min-height: 320px; */
225
- color: inherit !important;
226
- border-radius: 0.5rem;
227
- /* ${({dark:e,theme:t})=>`background-color:${e?t.palette.grey[900]:t.palette.common.white};`} */
228
- @media (max-width: ${({theme:e})=>e.breakpoints.values[fe]}px) {
229
- padding: 1.5rem 2rem;
230
- }
231
- @media (max-width: ${({theme:e})=>e.breakpoints.values.sm}px) {
232
- height: auto;
233
- min-height: unset;
234
- }
235
-
236
- ${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
237
- &:hover {
238
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
239
- }`:""}
240
-
241
- .card__title {
242
- font-weight: 700;
243
- margin-top: 24px;
244
- margin-bottom: 12px;
245
- a {
246
- color: ${({theme:e})=>e.palette.primary.main};
247
- }
248
- }
249
- .card__description {
250
- a {
251
- color: ${({theme:e})=>e.palette.primary.main};
252
- }
253
- }
254
- .card__body {
255
- padding: 0;
256
- ${({align:e})=>`text-align:${e||"left"};`}
257
- }
258
-
259
- &.list-type-icon-title {
260
- padding: 1.2rem;
261
- .title-line {
262
- display: flex;
263
- }
264
- .card__title {
265
- margin: 0;
266
- font-size: 1em;
267
- }
268
- .css-icon {
269
- margin-right: 0.5rem;
270
- }
271
- }
272
-
273
- @media (min-width: ${({theme:e})=>e.breakpoints.values[fe]}px) {
274
- padding: 2rem 2rem;
275
- text-align: left;
276
- box-sizing: border-box;
277
- }
278
- `;function lo({image:e,title:t,description:n,imageProps:i={},imageMeta:r,imageSize:s,titleProps:a={},descriptionProps:c={},actions:l,align:d,...m}){const x=se(e),h=w.autoResizeImage(w.getImageAbsoluteUrl(e),540);return o.jsxs(uo,{className:"card-article",...m,prepend:o.jsx("div",{className:"card__image__wrap",children:x&&e?o.jsx(u.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(T,{icon:e,color:"primary.main"})}):h&&o.jsx(u.Box,{component:"img",className:"card__image",src:h,...i,alt:i.alt||(r==null?void 0:r.filename)||"card-image",width:r==null?void 0:r.naturalWidth,height:r==null?void 0:r.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"contain",objectPosition:"center"},loading:"lazy"})}),children:[t||n?o.jsx(V,{align:d,title:t,titleProps:a,description:n,descriptionProps:c}):null,l!=null&&l.length?o.jsx(E,{align:d,actions:l,className:"mt-4"}):null]})}const uo=$.styled(D)`
279
- ${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
280
- &:hover {
281
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
282
- }`:""}
283
-
284
- border-radius: 0 !important;
285
-
286
- .card__body {
287
- ${({align:e})=>`text-align:${e||"left"};`}
288
- }
289
-
290
- .card__image__wrap {
291
- width: 100%;
292
- height: 100%;
293
- position: relative;
294
- display: flex;
295
- justify-content: center;
296
- align-items: center;
297
- }
298
-
299
- .card__image {
300
- max-height: 60px;
301
- }
302
- `,be="section";function mo({title:e,image:t,imageMeta:n,iconSize:i=100,description:r,actions:s,align:a,className:c="",...l}){return o.jsx(po,{className:j.cx("card",c),...l,children:o.jsxs(u.Box,{className:"flex items-center",children:[t&&o.jsx(T,{icon:t,color:"primary.main",size:i,imageMeta:n}),o.jsxs(u.Box,{className:"flex-1 ml-4",children:[o.jsx(V,{align:a,title:e,description:r}),o.jsx(E,{align:a,actions:s,className:"mt-4"})]})]})})}const po=$.styled(D)`
303
- padding: 5vw 4vw;
304
- text-align: left;
305
- box-sizing: border-box;
306
- /* min-height: 320px; */
307
- color: inherit !important;
308
- border-radius: 0.5rem;
309
- /* ${({dark:e,theme:t})=>`background-color:${e?t.palette.grey[900]:t.palette.common.white};`} */
310
- @media (max-width: ${({theme:e})=>e.breakpoints.values[be]}px) {
311
- padding: 1.5rem 2rem;
312
- }
313
- @media (max-width: ${({theme:e})=>e.breakpoints.values.sm}px) {
314
- height: auto;
315
- min-height: unset;
316
- }
317
-
318
- ${e=>e.hoverStyle==="none"?"":e.link?`transition: box-shadow ease .3s;
319
- &:hover {
320
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
321
- }`:""}
322
-
323
- .card__title {
324
- font-weight: 700;
325
- margin-bottom: 12px;
326
- a {
327
- color: ${({theme:e})=>e.palette.primary.main};
328
- }
329
- }
330
- .card__description {
331
- a {
332
- color: ${({theme:e})=>e.palette.primary.main};
333
- }
334
- }
335
- .card__body {
336
- padding: 0;
337
- }
338
-
339
- &.list-type-icon-title {
340
- padding: 1.2rem;
341
- .title-line {
342
- display: flex;
343
- }
344
- .card__title {
345
- margin: 0;
346
- font-size: 1em;
347
- }
348
- .css-icon {
349
- margin-right: 0.5rem;
350
- }
351
- }
352
-
353
- @media (min-width: ${({theme:e})=>e.breakpoints.values[be]}px) {
354
- padding: 2rem 2rem;
355
- text-align: left;
356
- box-sizing: border-box;
357
- }
358
- `;function xo({title:e,titleProps:t={},description:n,descriptionProps:i={},image:r,imageMeta:s,className:a="",align:c,hoverStyle:l,...d}){return o.jsxs(ho,{className:j.cx("card-simple",a,`hover-style__${l}`),align:c,...d,children:[r&&o.jsx(T,{icon:r,color:"primary.main",imageMeta:s}),e||n?o.jsx(V,{align:c,title:e,titleProps:t,description:n,descriptionProps:i}):null]})}const ho=$.styled(D)`
359
- ${({dark:e,theme:t})=>`background-color:${e?t.palette.grey[900]:t.palette.common.white};`}
360
-
361
- &.hover-style__default {
362
- &.card-simple {
363
- &:hover {
364
- border-top-right-radius: 36px;
365
- }
366
- }
367
- .card__body {
368
- &:hover {
369
- &::before {
370
- width: 42px;
371
- height: 42px;
372
- transform: translate(50%, -50%) rotate(45deg);
373
- }
374
- &::after {
375
- transform: none;
376
- }
377
- }
378
- }
379
- }
380
-
381
- &.card-simple {
382
- border-radius: 8px;
383
- border-top-right-radius: 26px;
384
-
385
- .card__body {
386
- ${({align:e})=>`text-align:${e||"left"};`}
387
- }
388
-
389
- ${e=>e.link?`
390
- cursor: pointer;
391
- `:""}
392
- /* cursor: pointer; */
393
- /* &:hover {
394
- border-top-right-radius: 36px;
395
- } */
396
- transition: all 180ms ease 0s;
397
- overflow: visible;
398
- .card__title {
399
- margin: 12px 0;
400
- }
401
- .card__body {
402
- position: relative;
403
- padding: 20px 16px 18px;
404
- overflow: hidden;
405
- transition: all 180ms ease 0s;
406
- /* &:hover {
407
- &::before {
408
- width: 42px;
409
- height: 42px;
410
- transform: translate(50%, -50%) rotate(45deg);
411
- }
412
- &::after {
413
- transform: none;
414
- }
415
- } */
416
- &::before,
417
- &::after {
418
- content: ${({border:e})=>e?'""':""};
419
- transition: inherit;
420
- position: absolute;
421
- top: 0px;
422
- right: 0px;
423
- }
424
- &::before {
425
- z-index: 3;
426
- background: #fff;
427
- width: 30px;
428
- height: 30px;
429
- transform: translate(50%, -50%) rotate(45deg);
430
- box-shadow: 0 1px 0 0 #e9eaec;
431
- }
432
- &::after {
433
- z-index: 2;
434
- width: 28px;
435
- height: 28px;
436
- border-bottom-left-radius: 6px;
437
- background: #fcfcfd;
438
- box-shadow: -1px 1px 0 0 #e9eaec;
439
- transform: translate(8px, -8px);
440
- }
441
- }
442
- }
443
- `;function fo({type:e="default",...t}){const i={article:so,simple:xo,news:mo,default:ge,wall:lo}[e]||ge;return o.jsx(i,{...e==="news"?t:ke.omit(t,"iconSize")})}function go({list:e=[],align:t="top",cards:n,listBorder:i=!0,listType:r="",col:s=3,gap:a,iconColor:c,className:l="",type:d="default",dark:m=!1,textAlign:x="left",hoverStyle:h,...p}){return o.jsx(ie,{type:d,className:j.cx("card-list py-1",l,"items-stretch"),col:s,gap:a,align:t,...p,children:n||e.map(y=>o.jsx(fo,{borderColor:i,iconColor:c,type:d,listType:r,dark:m,...y,align:x,sx:{bgcolor:d==="wall"?void 0:m?"grey.900":"common.white"},style:a===0&&e.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},y.id))})}const bo=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"],yo=$.styled(O)`
444
- a .card {
445
- color: #404040;
446
- cursor: pointer;
447
- }
448
- a:not(.MuiButton-root) {
449
- color: ${({theme:e})=>e.palette.primary.main};
450
- &:hover,
451
- &:active {
452
- color: ${({theme:e})=>e.palette.primary.main};
453
- }
454
- }
455
- a:hover .card {
456
- color: #404040;
457
- }
458
- `;function jo({className:e,...t}){const[n,i]=I(t,M),[r,s]=I(i,bo);return o.jsxs(yo,{className:j.cx("section--card-list",e),type:t.type,...s,children:[Object.keys(n).length>0&&o.jsx(H,{center:!0,...n,className:"mb-[2.5vw]"}),o.jsx(go,{...r,dark:!!t.dark})]})}const wo=$.styled(jo)`
459
- .card__description {
460
- white-space: pre-wrap;
461
- }
462
- .section__description {
463
- }
464
- .card {
465
- /* background: inherit !important; */
466
- }
467
- &.dark .card-simple .card__body::before {
468
- background: #212121 !important;
469
- }
470
- .card-simple .card__body::after {
471
- background: inherit !important;
472
- }
473
- `;function _o({section:e,...t}){const[{editing:n},i]=I(t,F),r=f.useMemo(()=>{var s;return{...q.default(i,["listBorder","list","iconSize","imageSize"]),list:(s=i.list)==null?void 0:s.map(a=>{var c,l;return{...q.default(a,"icon","iconColor"),image:["news","simple","default"].includes(i.type)&&a.icon?a.icon:a.image,actions:(l=(c=a.actions)==null?void 0:c.map)==null?void 0:l.call(c,d=>o.jsx(qe,{...d,editing:n},d.id)),border:i.listBorder,iconSize:i.iconSize,imageSize:i.imageSize,hoverStyle:i.hoverStyle}})}},[i]);return o.jsx(wo,{style:n?{pointerEvents:"none"}:{},...r})}function ko({properties:e,section:t,locale:n,dev:i}){var r;return(r=t==null?void 0:t.config)!=null&&r.componentId?o.jsx(ne.CustomComponentRenderer,{instanceId:t.id,componentId:t.config.componentId,blockletId:t.config.blockletId,blockletTitle:t.config.blockletTitle,componentName:t.config.componentName,locale:n,properties:e,dev:i}):o.jsx(u.Box,{textAlign:"center",py:2,children:o.jsx(u.Typography,{variant:"caption",color:"text.secondary",children:"Please select component to render"})})}function vo({src:e,dataId:t,isEdit:n=!1,height:i="100%",onLoad:r=()=>{}}){return o.jsx(gt.EmbedIframe,{isEdit:n,embedId:t,src:e,height:i,onLoad:()=>{r()}})}function $o({dataId:e,src:t,actions:n,center:i,onLoad:r,...s}){const[a,c]=I(s,M);return o.jsxs(O,{...c,children:[Object.keys(a).length>0&&o.jsx(H,{center:i,...a}),o.jsx(vo,{dataId:e,src:t,onLoad:r,height:s.iframeHeight?`${s.iframeHeight}px`:"100%"}),o.jsx(E,{actions:n,center:i})]})}function So({section:e,id:t,src:n,...i}){const r=`${t}-${i.locale}`,[{editing:s},a]=I(i,F),c=f.useRef({}),l=JSON.parse(JSON.stringify(a)),{message:d}=xt.useMessage(r,"server"),m=ht.useLatest(JSON.parse(JSON.stringify(a.config)||"{}"));return f.useEffect(()=>{d&&d.onInit(()=>m.current)},[d]),f.useEffect(()=>{const x=JSON.parse(JSON.stringify(a.config)||"{}");Pt.default(c.current,x)||(c.current=x,d==null||d.send("config-set",x))},[d,a.config]),n?o.jsx($o,{...l,dataId:r,src:n,style:s?{pointerEvents:"none"}:{}}):o.jsx(Co,{children:'Please set the "src" attribute for this block'})}const Co=$.styled("div")`
474
- user-select: none;
475
- color: #999;
476
- padding: 8px;
477
- height: 200px;
478
- `,Bo=[/youtu\.be\/([^#&?]{11})/,/\?v=([^#&?]{11})/,/&v=([^#&?]{11})/,/embed\/([^#&?]{11})/,/\/v\/([^#&?]{11})/];function Io(e){var t;if(/youtu\.?be/.test(e))for(const n of Bo){const i=(t=n.exec(e))==null?void 0:t[1];if(i)return i}}function No(e){const t=Io(e);if(t)return`https://youtube.com/embed/${t}`}function Po({src:e}){return f.useEffect(()=>{import("@lottiefiles/lottie-player")},[]),o.jsx("lottie-player",{autoplay:!0,loop:!0,mode:"normal",src:e})}function Ro(e){return o.jsx(u.Box,{maxHeight:400,overflow:"hidden auto",children:o.jsx(bt.TwitterTimelineEmbed,{...e})})}function To({url:e}){const t=f.useRef(null),n=495,[i,r]=f.useState(t.current?t.current.offsetWidth*.5625:n),s=f.useCallback(()=>{const a=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,c=t.current?t.current.offsetWidth*.5625:n;return r(Math.floor(c*a))},[]);return f.useEffect(()=>{window.addEventListener("resize",s);const a=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,c=t.current?t.current.offsetWidth*.5625:n;return r(Math.floor(c*a)),function(){window.removeEventListener("resize",s)}},[i,s]),o.jsx(u.Box,{component:"iframe",ref:t,title:"youtube",width:"100%",height:`${i}px`,src:e,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sx:{display:"block"}})}const qo=$.styled(Jt)`
479
- .section__description {
480
- }
481
- `;function zo({hasImage:e,fullSizeImage:t,boxed:n,videoPoster:i,imageMeta:r,imageOptimization:s,imageSize:a,section:c,...l}){var p,y;const[{editing:d},m]=I({...l,boxed:t?void 0:n},F);let x=Eo(m.image,i,t,r,s,a);e||(x=null);let h=null;return m.actions&&(h=(y=(p=m.actions)==null?void 0:p.map)==null?void 0:y.call(p,(_,b)=>o.jsx(qe,{..._,editing:d},b))),o.jsx(qo,{...m,style:d?{pointerEvents:"none"}:{},image:x,fullSizeImage:e&&t,actions:h})}function Eo(e,t,n,i,r,s){if(e){if(e.endsWith(".json"))return o.jsx(Po,{src:e});if(e.indexOf("twitter.com")!==-1)return o.jsx(Ro,{sourceType:"url",url:e});const a=No(e);if(a)return o.jsx(To,{url:a});const{naturalWidth:c,naturalHeight:l,filename:d}=i||{};if(ee(e))return o.jsx("video",{width:c&&`${c}px`,height:l&&`${l}px`,controls:!0,autoPlay:!0,muted:!0,style:{display:"block",objectFit:s||"contain",borderRadius:"8px",width:"100%",height:"100%"},poster:w.autoResizeImage(w.getImageAbsoluteUrl(t),n?1200:540,r),children:o.jsx("source",{src:w.getImageAbsoluteUrl(e),type:Ot(e)})},e);const m=r==="quality"?1:.6;return o.jsx(ne.ResponsiveImage,{src:w.getImageAbsoluteUrl(e),sizesAttr:{sm:600*m,md:450*m,lg:540*m,...n&&{md:900*m,lg:1200*m}},width:c&&`${c}px`,height:l&&`${l}px`,alt:d??e,style:{objectFit:s||"contain",display:"block",width:"100%",height:"100%"},loading:"lazy"})}return null}const Wo=["production","draft"];function ze({mode:e,version:t}={}){const n=t&&typeof t=="number"?{mode:e,version:t}:{mode:e};return w.api.get(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages`,{params:n}).then(i=>i.data)}function Lo({mode:e,pages:t}){return w.api.post(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages/publish`,{mode:e,pages:t}).then(n=>n.data)}function Ao({locale:e,sort:t,page:n,limit:i,mode:r}={}){return w.api.get(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages/toc`,{params:{locale:e,sort:t,page:n,limit:i,mode:r}}).then(s=>s.data)}const ye=20;function Uo({style:e,sort:t,section:n,...i}){const[{editing:r,locale:s},a]=I(i,F),[c,l]=I(a,M),[d,m]=f.useState(),x=f.useRef(!1),h=U.useUpdate(),p=B.useNavigate(),y=f.useCallback(async()=>{if(!x.current){x.current=!0,h();try{const _=d?Math.floor(d.list.length/ye)+1:1,{list:b,total:k}=await Ao({locale:s,sort:t,page:_,limit:ye});m(g=>({list:((g==null?void 0:g.list)??[]).concat(b),total:k}))}finally{x.current=!1,h()}}},[d,s,t,h]);return U.useMount(()=>{y()}),o.jsxs(O,{...l,sx:r?{pointerEvents:"none"}:{},children:[Object.keys(c).length>0&&o.jsx(H,{...c}),d?o.jsxs(o.Fragment,{children:[o.jsx(u.Grid,{container:!0,spacing:2,justifyContent:"center",children:d==null?void 0:d.list.map(_=>o.jsx(u.Grid,{item:!0,xs:12,sm:e==="card"?6:12,md:e==="card"?3:12,children:o.jsxs(Ho,{elevation:0,className:j.cx(e==="card"&&"style-card"),onClick:r?void 0:()=>p(_.slug),children:[!!_.image&&o.jsx(u.CardMedia,{component:"img",alt:"",image:w.autoResizeImage(w.getImageAbsoluteUrl(_.image),540),loading:"lazy"}),o.jsxs(u.CardContent,{children:[o.jsx(u.Typography,{variant:"h6",component:"div",className:je,children:_.title||_.id}),o.jsx(u.Typography,{variant:"body2",className:je,children:_.description})]})]})},_.id))}),o.jsx(u.Box,{textAlign:"center",mt:2,children:d.total>d.list.length?o.jsx(A,{variant:"outlined",color:"secondary",onClick:y,loading:x.current,children:"More"}):o.jsx(A,{variant:"outlined",color:"secondary",disabled:!0,children:"No More"})})]}):o.jsx(u.Box,{p:2,textAlign:"center",children:o.jsx(u.CircularProgress,{size:24})})]})}const je=j.css`
482
- display: -webkit-box;
483
- -webkit-box-orient: vertical;
484
- -webkit-line-clamp: 2;
485
- overflow: hidden;
486
- text-overflow: ellipsis;
487
- `,Ho=$.styled(u.Card)`
488
- border: 1px solid #e0e0e0;
489
- background-color: transparent;
490
- cursor: pointer;
491
- display: flex;
492
- color: inherit;
493
-
494
- > .MuiCardMedia-root {
495
- width: 30vw;
496
- max-height: 50vw;
497
- }
498
-
499
- &.style-card {
500
- display: block;
501
-
502
- > .MuiCardMedia-root {
503
- width: 100%;
504
- max-height: 50vw;
505
- }
506
- }
507
- `,Mo={iframe:So,section:zo,"section-card-list":_o,toc:Uo,"ai-runtime":Yt,"custom-component":ko};function Oo({id:e,type:t,mode:n,config:i,section:r,...s}){const a=Mo[t],c=a&&o.jsx(a,{mode:n,...i,id:e,section:r});return t==="custom-component"?c:o.jsx(Kt,{...s,height:i.height,children:c})}const Fo=$.styled(Rt.default,{shouldForwardProp:e=>!!e})`
508
- & > div > .MuiContainer-root {
509
- max-width: unset;
510
- }
511
- `;function Do({meta:e,...t}){const n=$.useTheme();return o.jsx(Fo,{...t,meta:e,theme:n||{}})}function Ee(e){return o.jsx(u.Box,{display:"flex",flex:1,height:"100%",alignItems:"center",justifyContent:"center",...e,children:o.jsx(u.CircularProgress,{size:30})})}function Vo(e){return o.jsx(Go,{...e})}const Go=$.styled(u.Box)`
512
- position: fixed;
513
- left: 0;
514
- top: 0;
515
- z-index: 999999999999;
516
- width: 80px;
517
- font-size: 12px;
518
- text-align: center;
519
- opacity: 0.7;
520
- transform: translateX(-23%) translateY(70%) rotate(-45deg);
521
- pointer-events: none;
522
- `,Jo=e=>new Promise((t,n)=>{(e==null?void 0:e.length)>0?Tt.default.load({google:{families:e},fontactive:()=>{t("success")},fontinactive:()=>{n(new Error("load font fail"))}}):t("success")}),we=`Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
523
- sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`,_e={};function Ko({titleFontFamily:e,descriptionFontFamily:t}){const n=async i=>{if(i&&!document.querySelectorAll(`link[href*="${i}" i]`).length)try{_e[i]||(await Jo([i]),_e[i]=!0)}catch(r){console.error(r)}};return f.useEffect(()=>{e&&n(e),t&&n(t)},[e,t]),o.jsx(Y.Global,{styles:Y.css`
524
- #app {
525
- .page-kit-section__title {
526
- font-family: ${JSON.stringify(e)}, ${we};
527
- }
528
-
529
- .page-kit-section__description {
530
- font-family: ${JSON.stringify(t)}, ${we};
531
- }
532
- }
533
- `})}const{SessionProvider:ln,SessionContext:Xo,SessionConsumer:dn,withSession:un}=wt.createAuthServiceSessionContext();function ae(){return f.useContext(Xo)}function Yo(...e){var n;const{session:t}=ae();return e.includes((n=t.user)==null?void 0:n.role)}function Qo(...e){var i;const{session:t}=ae(),n=Yo(...e);return((i=window.blocklet)==null?void 0:i.tenantMode)==="multiple"?!!t.user:n}function Zo(e){return e!=null}function en(){const[e]=B.useSearchParams(),{session:t}=ae(),n=Qo("owner","admin","pagesEditor","member"),i=f.useMemo(()=>{const s=e.get("mode");return Wo.includes(s)?s:"production"},[e]),r=i==="production"?i:t.user?n?i:"production":null;return r?o.jsx(We,{mode:r}):null}function We({mode:e}){if(e!=="draft"){const t=window.__PAGE_STATE__;return t?o.jsx(X,{mode:e,state:t}):o.jsx(on,{mode:e,children:({state:n})=>o.jsx(X,{mode:e,state:n})})}return o.jsx(tn,{children:({state:t})=>o.jsx(X,{mode:e,state:t})})}const tn=f.lazy(()=>Promise.resolve().then(()=>require("./draft-data-DJNZo1YQ.js")));function on({mode:e,children:t}){const n=document.querySelector('meta[property="pages:version"]'),i=n==null?void 0:n.content,r=w.useProjectId(),s=f.useMemo(()=>{if(i==="{{pagesPublishedAt}}"){const l=localStorage.getItem(w.getProjectPageVersionKey(r??""));return Number(l)?Number(l):new Date().getTime()}return Number(i)},[i]),{loading:a,value:c}=U.useAsync(()=>ze({mode:e,version:s}),[e,s]);return a?o.jsx(Ee,{}):c?t({state:c}):null}function X({mode:e,state:t}){var y,_,b,k;const{t:n,locale:i}=Ge.useLocaleContext(),{pageIds:r,pages:s,supportedLocales:a,config:{defaultLocale:c},resources:l}=t,d=w.getAllComponents(t),m=f.useMemo(()=>a!=null&&a.some(g=>g.locale===i)?i:void 0,[i,a]),x=Object.values(s).find(g=>(g==null?void 0:g.slug)==="/")?void 0:Object.values(s)[0],h=f.useMemo(()=>r.map(g=>{const v=s[g];return v&&{id:v.id,path:P.joinURL("/",m||"",v.slug,e!=="production"?`?mode=${e}`:"")}}).filter(Zo),[r,s,m,e]),p=([...g])=>(e!=="production"&&g.unshift(o.jsx(f.Suspense,{fallback:o.jsx("div",{}),children:o.jsx(nn,{mode:"production",state:t})})),g);return o.jsxs(Qt,{value:{pages:h},children:[o.jsxs(B.Routes,{children:[x&&o.jsx(B.Route,{index:!0,element:o.jsx(B.Navigate,{to:P.joinURL("/",m||"",x.slug)})}),r.map(g=>{const v=s[g];return v?o.jsx(B.Route,{path:P.joinURL(":projectIdOrSlug?",v.slug),element:o.jsx(oe,{mode:e,components:d,page:v,locale:m,defaultLocale:c,headerAddons:p})},v.id):null}),l.pages&&Object.values(l.pages).map(({blockletId:g,page:v})=>o.jsx(B.Route,{path:P.joinURL("/",`@${g}`,v.slug),element:o.jsx(oe,{mode:e,components:d,page:v,locale:m,defaultLocale:c,headerAddons:p})},v.id)),o.jsx(B.Route,{path:"*",element:o.jsx(u.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:o.jsx(_t.default,{style:{background:"inherit"},status:404,extra:o.jsx(sn,{href:"/",children:n("common.back")})})})})]}),e!=="production"&&o.jsx(Vo,{sx:{bgcolor:"info.light"},children:e}),o.jsx(Ko,{titleFontFamily:(_=(y=t.config)==null?void 0:y.fontFamily)==null?void 0:_.title,descriptionFontFamily:(k=(b=t.config)==null?void 0:b.fontFamily)==null?void 0:k.description})]})}function oe({mode:e,components:t,page:n,locale:i,defaultLocale:r,headerAddons:s}){var b,k,g,v,N,W,G,ce,le;const a=((b=n.locales)==null?void 0:b[i])??((k=n.locales)==null?void 0:k[r])??{},c=a.title||((g=window.blocklet)==null?void 0:g.appName),l=a.description||((v=window.blocklet)==null?void 0:v.appDescription),d=w.autoResizeImage(w.getImageAbsoluteUrl(a.image),540),{logo:m,brand:x,description:h,...p}=Ke.useHeaderState(),y=f.useMemo(()=>z=>{var L;let C=(s==null?void 0:s(z))??z;return C=((L=p.addons)==null?void 0:L.call(p,C))??C,C},[p.addons,s]),_=(N=a.header)!=null&&N.translucent?Ae:Le;return o.jsxs(o.Fragment,{children:[!!a.backgroundColor&&o.jsx(Y.Global,{styles:Y.css`
534
- body {
535
- background-color: ${a.backgroundColor} !important;
536
- }
537
- `}),o.jsx(_,{hideNavMenu:!!((W=a.header)!=null&&W.hideNavMenus),translucentTextColor:(G=a.header)==null?void 0:G.translucentTextColor,...m?{logo:m}:{},...x?{brand:x}:{},...h?{description:h}:{},className:j.cx(((ce=a.header)==null?void 0:ce.sticky)&&"sticky","page-header"),maxWidth:!1,addons:y}),o.jsx(B.ScrollRestoration,{}),o.jsxs(et.Helmet,{children:[o.jsx("title",{children:c}),o.jsx("meta",{name:"og:title",content:c}),o.jsx("meta",{name:"og:description",content:l}),o.jsx("meta",{name:"og:image",content:d}),o.jsx("meta",{name:"twitter:image:src",content:d}),o.jsx("meta",{name:"twitter:image",content:d}),o.jsx("meta",{property:"twitter:description",content:l}),o.jsx("meta",{property:"twitter:title",content:c}),o.jsx("meta",{name:"description",content:l})]}),o.jsx(u.Stack,{flexGrow:1,children:n.sectionIds.map(z=>{var de,ue;const C=n.sections[z];if(!C||C.visibility==="hidden")return null;const L=(de=C.locales)==null?void 0:de[i],Ue=((ue=C.locales)==null?void 0:ue[r])??{};return o.jsx(Oo,{id:z,type:C.component,mode:e,section:C,config:{...$t.default(L)?Ue:L,locale:i,dev:e==="draft"?{mode:e,components:t,defaultLocale:r}:{mode:e}}},z)})}),!((le=a.footer)!=null&&le.hidden)&&o.jsx(Do,{})]})}const nn=f.lazy(()=>Promise.resolve().then(()=>require("./publish-button-B_ySfzVo.js"))),Le=$e.default(kt.default)`
538
- &.sticky {
539
- position: sticky;
540
- top: 0;
541
- }
542
- `;function rn({logo:e}){const[t,n]=f.useState(),{value:i}=U.useAsync(()=>new Promise(r=>{fetch("/.well-known/service/blocklet/logo-rect").then(s=>{const a=s.headers.get("content-type");a!=null&&a.includes("svg")&&s.text().then(c=>{n(c),r(null)}),r(s.url)})}),[]);if(e)return e;if(t)return o.jsx(u.Box,{sx:{filter:"initial !important"},dangerouslySetInnerHTML:{__html:vt.default.sanitize(t)}});if(i){const r=new URL(i);r.searchParams.set("imageFilter","convert"),r.searchParams.set("f","png"),r.searchParams.set("h","88"),r.searchParams.set("hash","00c22ff");const s=r.toString();return o.jsx("img",{src:s,alt:"logo"})}return null}function Ae({logo:e,translucentTextColor:t,...n}){const{y:i}=U.useWindowScroll();let r=Math.min(i/800,1),s="";if(r>.1){r=Math.max(r,.6);const a=Math.round(255*Math.min(1-r,.2));s=`rgb(${a}, ${a}, ${a})`}else s=t||"#EEEEEE";return o.jsx(Le,{logo:o.jsx(rn,{logo:e}),...n,className:j.cx(r<=.7&&"reverse-color"),style:{backgroundColor:`rgba(255,255,255,${r})`,"--logo-invert":r<=.7?1-r/6:1-r},sx:{backdropFilter:r>=.6?"blur(10px)":"blur(0px)",transition:"all 0.3s ease",position:"fixed !important",left:0,top:0,right:0,bgcolor:"transparent","&.reverse-color":{".navmenu-root>.navmenu-sub>span,\n .navmenu-root>.navmenu-item,\n .header-addons>button,\n .header-addons>a,\n .header-addons>div>button":{color:`${s} !important`}},".header-logo > div":{filter:"invert(var(--logo-invert))"},".header-logo":{color:s}}})}const sn=$e.default(u.Button)``;exports.Home=en;exports.HomeView=We;exports.Loading=Ee;exports.PageRoutes=X;exports.PageView=oe;exports.TranslucentHeader=Ae;exports.getPages=ze;exports.publishPages=Lo;