@blocklet/pages-kit-inner-components 0.4.99 → 0.4.100

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.
@@ -0,0 +1,507 @@
1
+ "use strict";var $t=Object.create;var ot=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var Ct=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var It=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of St(e))!Nt.call(t,n)&&n!==r&&ot(t,n,{get:()=>e[n],enumerable:!(i=Bt(e,n))||i.enumerable});return t};var nt=(t,e,r)=>(r=t!=null?$t(Ct(t)):{},It(e||!t||!t.__esModule?ot(r,"default",{value:t,enumerable:!0}):r,t));const o=require("react/jsx-runtime");require("@mui/icons-material");const u=require("@mui/material"),f=require("react"),Pt=require("lodash/keyBy"),w=require("./state-BoXTl4DM.js"),U=require("@blocklet/ai-runtime/components"),Rt=require("@mui/utils"),Tt=require("lodash/pick"),Wt=require("react-error-boundary"),pt=require("@blocklet/pages-kit/contexts/color"),y=require("@emotion/css"),D=require("@iconify/react"),zt=require("react-markdown"),qt=require("remark-gfm"),Et=require("@mui/lab"),_=require("@arcblock/ux/lib/Theme"),Lt=require("@arcblock/react-hooks/lib/useBrowser"),At=require("@arcblock/ux/lib/Colors"),G=require("@blocklet/pages-kit/components"),rt=require("@blocklet/pages-kit/utils/style"),Ft=require("@mui/material/useMediaQuery"),Ut=require("lodash/omit"),xt=require("@iconify-icon/react"),Ot=require("@arcblock/ux/lib/Screenshot"),J=require("react-router-dom"),Dt=require("@arcblock/ux/lib/Button"),Mt=require("is-uri"),O=require("pathe"),T=require("ufo"),Ht=require("@blocklet/embed/message"),Vt=require("ahooks"),Gt=require("lodash/isEqual"),Jt=require("@blocklet/embed/react"),Yt=require("react-twitter-embed"),it=require("react-use"),$=t=>t&&t.__esModule?t:{default:t},ht=$(f),Y=$(Pt),X=$(Tt),Xt=$(zt),Kt=$(qt),Qt=$(Lt),st=$(At),ft=$(Ft),C=$(Ut),Zt=$(Ot),te=$(Dt),M=$(Mt),ee=$(Gt),oe=[{title:"None",value:"none",sx:{py:0}},{title:"Small",value:"small",sx:{py:{xs:2.5,md:4,lg:4,xl:6}}},{title:"Normal",value:"normal",sx:{py:{xs:5,md:7.5,lg:10,xl:12.5}}},{title:"Large",value:"large",sx:{py:{xs:7.5,md:10,lg:12.5,xl:15}}}],ne=[{title:"None",value:"none",sx:{px:0}},{title:"Small",value:"small",sx:{px:{xs:2.5,md:4,lg:4,xl:6}}},{title:"Normal",value:"normal",sx:{px:{xs:5,md:7.5,lg:10,xl:12.5}}},{title:"Large",value:"large",sx:{px:{xs:7.5,md:10,lg:12.5,xl:15}}}],re=[{title:"Full Width",value:"full",sx:{maxWidth:"100%"}},{title:"Small",value:"sm",sx:{maxWidth:t=>t.breakpoints.values.sm,width:"100%",mx:"auto"}},{title:"Normal",value:"md",sx:{maxWidth:t=>t.breakpoints.values.md,width:"100%",mx:"auto"}},{title:"Large",value:"lg",sx:{maxWidth:t=>t.breakpoints.values.lg,width:"100%",mx:"auto"}},{title:"Extra Large",value:"xl",sx:{maxWidth:t=>t.breakpoints.values.xl,width:"100%",mx:"auto"}}],ie=Y.default(oe,"value"),se=Y.default(ne,"value"),ae=Y.default(re,"value"),le=new Map([["paddingY",ie],["paddingX",se],["maxWidth",ae]]);function gt(t){var c;const{type:e,value:r,format:i="sx",defaultValue:n=null}=t,s=le.get(e);return s&&s!=null&&s[r]&&(c=s==null?void 0:s[r])!=null&&c[i]?s[r][i]:n}const bt=f.createContext({page:null,getPageMeta:()=>({}),getPageMetaStyle:()=>({})});function ce(){return f.useContext(bt)}function de({page:t,children:e,defaultLocale:r="en",currentLocale:i}){const n=f.useMemo(()=>t?JSON.parse(JSON.stringify(t)):null,[JSON.stringify(t)]),s=f.useCallback(()=>{var d;if(!n)return{};const l=i||r;return((d=n.locales)==null?void 0:d[l])??{}},[n,r,i]),c=f.useCallback((l="sx")=>{const d=s();return!d||!d.style?{}:Object.entries(d.style||{}).reduce((p,[h,x])=>{if(!x)return p;const g=gt({type:h,value:x,format:l});return g?{...p,...g}:p},{})},[s]),a=f.useMemo(()=>({page:n,getPageMeta:s,getPageMetaStyle:c}),[n,s,c]);return o.jsx(bt.Provider,{value:a,children:e})}const ue=f.forwardRef(({onClick:t,...e},r)=>{const[i,n]=f.useState(!1),s=f.useCallback(async c=>{try{n(!0),await(t==null?void 0:t(c))}finally{n(!1)}},[t]);return o.jsx(Et.LoadingButton,{ref:r,...e,loading:e.loading||i,onClick:s})});function me({tip:t,tipSucceed:e,title:r,titleSucceed:i,icon:n,iconSucceed:s,autoReset:c,placement:a="top",...l}){const[d,m]=f.useState(!1),[p,h]=f.useState(),x=f.useRef(),g=()=>{h(void 0),c&&(x.current=window.setTimeout(()=>{m(!1)},3e3))},j=()=>{clearTimeout(x.current)},b=d?s:n,v=p?o.jsx(u.Box,{color:"error",children:p.message}):d&&e||t,k=d?i:r;return o.jsx(u.Tooltip,{title:v,disableInteractive:!0,placement:a,onClose:g,onOpen:j,children:o.jsx("span",{children:o.jsx(ue,{startIcon:b&&(typeof b=="string"?o.jsx(D.Icon,{icon:b}):b),loadingPosition:b?"start":void 0,...l,onClick:async S=>{if(l.onClick)try{await l.onClick(S),m(!0)}catch(N){h(N)}},children:k})})})}const pe=ht.default.lazy(()=>import("react-syntax-highlighter").then(t=>({default:t.Prism}))),xe=u.styled(t=>o.jsx(Xt.default,{...t,remarkPlugins:[Kt.default],components:{pre:he,code:({node:e,inline:r,className:i,children:n,...s})=>{if(!n)return null;const c=/language-(\w+)/.exec(i||"");return r?o.jsx(u.Box,{component:"code",className:i,...s,children:n}):o.jsx(u.Box,{component:pe,language:c==null?void 0:c[1],...s,sx:{borderRadius:1},children:String(n).replace(/\n$/,"")})},table:({className:e,children:r})=>o.jsx(u.Box,{sx:{overflow:"auto",my:1},children:o.jsx("table",{className:e,children:r})})}}))`
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:t})=>t.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:t})=>t.palette.secondary.main};
69
+ }
70
+ }
71
+ }
72
+ }
73
+ `;function he({children:t}){const e=t==null?void 0:t.props;if(!(e!=null&&e.children))return null;const r=/language-(\w+)/.exec(e.className||""),i=r==null?void 0:r[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(me,{autoReset:!0,title:o.jsx(D.Icon,{icon:"tabler:copy"}),titleSucceed:o.jsx(D.Icon,{icon:"tabler:copy-check"}),sx:{minWidth:32,minHeight:32,p:0,fontSize:18},onClick:()=>{window.navigator.clipboard.writeText(e.children)}})]}),t]})}function R({actions:t,center:e,className:r,align:i}){return t&&(t!=null&&t.length)?o.jsx(u.Box,{className:y.cx("flex gap-4 flex-wrap","lg:flex-row lg:gap-8",(e||i==="center")&&"justify-center",!e&&i==="right"&&"justify-end",!e&&i==="left"&&"justify-start",r),sx:{alignItems:"center"},children:t}):null}const fe="section",ge=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:t})=>t.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:t})=>t.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:t})=>t.palette.primary.main};
116
+ }
117
+ p {
118
+ margin-top: 0;
119
+ margin-bottom: 0.5rem;
120
+ }
121
+ }
122
+ @media (min-width: ${({theme:t})=>t.breakpoints.values[fe]}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 z({title:t,description:e,descriptionMarkdown:r,actions:i,className:n="",classes:s={},prepend:c,append:a,level:l=2,tag:d,badge:m,center:p,logo:h,titleAppearance:x,descriptionAppearance:g,...j}){const b=pt.useColorConvert();if(!t&&!e&&!i&&!m&&!d&&!c&&!a&&!h)return null;const v=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"},S=l===0?"big":`h${v}`,N=l===0;return o.jsxs(ge,{className:y.cx("base-info","lg:text-left",p&&"!text-center",n),...j,children:[c&&o.jsx("div",{children:c}),(d||m)&&o.jsx("div",{className:y.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"}),t&&o.jsx(u.Typography,{sx:{whiteSpace:"pre-wrap",mb:e?"2vw":0,...(x==null?void 0:x.color)&&{color:`${b(x.color)} !important`}},className:y.cx("section__title","text-gray-800","dark:text-gray-50",s.title,"page-kit-section__title",N?"":"section__title_non_big"),component:`h${Math.max(l,1)}`,variant:S,children:t}),e&&(r?o.jsx(u.Box,{sx:{...(g==null?void 0:g.color)&&{color:`${b(g.color)} !important`}},component:xe,className:y.cx("section__description","text-gray-800","dark:text-gray-100",k[v],s.description,"page-kit-section__description"),children:e}):o.jsx(u.Typography,{sx:{whiteSpace:"pre-wrap",...(g==null?void 0:g.color)&&{color:`${b(g.color)} !important`}},className:y.cx("section__description","text-gray-800","dark:text-gray-100",k[v],s.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:e})),o.jsx(R,{actions:i,center:p,className:"mt-8"}),a&&o.jsx("div",{children:a})]})}const q=["actions","append","badge","tag","center","description","descriptionMarkdown","level","logo","prepend","title","titleAppearance","descriptionAppearance"];function yt(t){if(t.type===f.Fragment){const r=(t.props.children||[]).filter(i=>f.isValidElement(i));return r.length===1?yt(r[0]):r.length>1}return Array.isArray(t)}const I="&>*";function K({children:t,col:e,gap:r,className:i,align:n,sx:s,type:c,...a}={children:null,className:"",col:3,gap:void 0,sx:{},align:"center",type:"default"}){const l=_.useTheme(),d=Number(Math.floor(100/e*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"},p=m[n]||m.center;let x=r??({2:6,3:4,4:4,5:3,6:3}[e]||0);yt(t)||(x=0);const j=(e-1)*x/e;let b={...s,gap:`${x}rem`};const v={[I]:{width:"100%"}},k={},S={},N={};switch(v.gap="1rem",k.gap=`${x/2}rem`,e){case 3:case 4:k[I]={width:`calc(50% - ${x/2}rem)`};break;case 5:case 6:v[I]={width:`calc(50% - ${x/2/2}rem)`},k[I]={width:`calc(50% - ${x/2/2}rem)`},S[I]={width:`calc(33.33% - ${x*2/3}rem)`};break}return b[I]={width:`calc(${d}% - ${j}rem)`},b[`@media (max-width: ${l.breakpoints.values.xl}px)`]=N,b[`@media (max-width: ${l.breakpoints.values.lg}px)`]=S,b[`@media (max-width: ${l.breakpoints.values.md}px)`]=k,b[`@media (max-width: ${l.breakpoints.values.sm}px)`]=v,c==="wall"&&(b={...s,gap:`${x}rem`},b[I]={width:`calc(${d}% - ${j}rem)`},v[I]={width:`calc(45% - ${x/2/2}rem)`},b[`@media (max-width: ${l.breakpoints.values.sm}px)`]=v),o.jsx(u.Box,{className:y.cx("flex flex-wrap flex-row h-full",p,i),sx:b,...a,children:t})}function be(){const t=navigator.userAgent.toLowerCase();return t.includes("safari")&&!t.includes("chrome")}function ye(t=""){if(t.startsWith("data:image/svg+xml,"))return!0;const e=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,r=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return e.test(t)||r.test(t)}function H(t){return(t==null?void 0:t.endsWith(".mp4"))||(t==null?void 0:t.endsWith(".m4v"))||(t==null?void 0:t.endsWith(".webm"))}function we(t){return t!=null&&t.endsWith(".mp4")||t!=null&&t.endsWith(".m4v")?"video/mp4":t!=null&&t.endsWith(".webm")?"video/webm":void 0}function je(t){let e={};return typeof t=="string"?rt.isGradient(t)?e.image=t:(e.image=w.getImageAbsoluteUrl(t),rt.isColorString(t)&&(e.color=t,e.image="")):e=t,e}function ke(){const[t,e]=f.useState(Date.now());return f.useEffect(()=>{const r=()=>{e(Date.now())};return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]),t}function at(t,e,r,i,n){let s=null;const{color:c="",image:a}=je(e);return a&&ye(a)?(delete r.backgroundColor,!(t.mobile.apple.device||be())&&H(a)?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:H(a)?a:w.autoResizeImage(a,1200,"quality"),sx:{position:"absolute",zIndex:-9999,right:0,left:0,top:0,width:"100%",height:"100%",objectFit:"cover"}},a):s=o.jsx(G.ResponsiveImage,{src:a,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"}},n||a)):a?r.backgroundImage=`${a} !important`:c&&(r.backgroundColor=`${c} !important`),s}function ve({autoWidth:t,children:e,...r}){return t?o.jsx(u.Box,{display:"flex",...r,children:e}):o.jsx(u.Container,{...r,children:e})}function E({dark:t=!1,children:e,className:r,sx:i={},boxed:n={show:!1},padding:s="normal",boxProps:c,type:a,...l}){const d={...i},m=ft.default(x=>x.breakpoints.down("md"));t&&(d.color=st.default.common.white,d.backgroundColor=`${st.default.grey[900]} !important`),n.show&&(d.display="flex");const p=f.useMemo(()=>!Number(l.boxMaxWidth)||m?{width:"100%"}:a==="wall"&&l.boxMaxWidth?{maxWidth:`${l.boxMaxWidth}px !important`,width:"100%"}:{width:"100%"},[l.boxMaxWidth,m,a]),h=gt({type:"paddingY",value:s||"normal",defaultValue:""});return o.jsx(_e,{component:"section",styles:{...d,...h},className:y.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",r,{dark:t}),...C.default(l,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:o.jsx(ve,{autoWidth:l==null?void 0:l.autoWidth,className:y.cx("section-content h-full"),sx:p,children:n.show?o.jsx(wt,{...c,boxed:n,children:e}):e})})}function wt({background:t="",backgroundVideoPoster:e,children:r,sx:i={},boxed:n={show:!1},className:s="",styles:c={},...a}){const l={...c,...i},d=pt.useColorConvert();let m=null;const p=ft.default(g=>g.breakpoints.up("sm")),h=Qt.default(),x=ke();return t&&(m=at(h,typeof t=="string"?d(t):t,l,e,x)),n.show&&(l.borderRadius="10px",l.padding===void 0&&(l.padding=p?"50px":"20px"),n!=null&&n.border&&(l.border="1px solid #c0c0c0"),n!=null&&n.background&&(m=at(h,typeof(n==null?void 0:n.background)=="string"?d(n==null?void 0:n.background):n==null?void 0:n.background,l,n==null?void 0:n.backgroundVideoPoster,x))),o.jsxs(u.Box,{...a,sx:{...l,...m?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:y.cx(s,(n==null?void 0:n.boxShadow)&&"shadow-xl"),children:[m,r]})}const _e=_.styled(wt)`
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 Q({icon:t,...e}){return o.jsx(xt.Icon,{icon:t,...e,ref:null})}function B(t,e){const r=X.default(t,e),i=C.default(t,e);return[r,i]}const jt=["title","description","actions","badge","tag","prepend","append","logo"];function $e({image:t,imageBorder:e,imageShadow:r,className:i,reverse:n=!1,fullSizeImage:s,...c}){const[a,l]=B(c,q),d=Object.keys(a).length>0&&Object.values(X.default(a,jt)).filter(Boolean).length>0&&o.jsx(z,{...a}),m=f.isValidElement(t)?t:o.jsx(u.Box,{component:"img",src:t,alt:"",className:"block"}),p=["phone","macbook"].includes(e),h=t&&o.jsx(u.Box,{className:y.cx("section__image","m-auto, leading-[1] text-center",r&&"shadow-xl",a!=null&&a.center?"flex justify-center items-center":""),sx:{border:e===!0?"1px solid #c0c0c0":void 0,borderRadius:2,overflow:"hidden","> div":p?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:p?o.jsx(Zt.default,{type:e,sx:{width:"100%"},children:m}):m});return o.jsx(E,{className:y.cx("section--block",i,s&&!n&&y.css`
150
+ .section-bg {
151
+ height: 80%;
152
+ }
153
+ `),...l,boxProps:s?{sx:{padding:0,overflow:"hidden"}}:void 0,children:o.jsx(K,{col:t?2:1,className:s?y.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:n?o.jsxs(o.Fragment,{children:[h,d]}):o.jsxs(o.Fragment,{children:[d,h]})})})}const L=["editing","height","locale","dev","sx"];function Be(t){const{className:e,...r}=t;return o.jsx(Se,{...r,className:y.cx("BlockBase-root",e)})}const Se=_.styled(u.Box)`
167
+ position: relative;
168
+ `;function Ce({widget:t,reverse:e,projectId:r,assistantId:i,working:n,submitTitle:s,submitIcon:c,submitColor:a,placeholder:l,loadingIndicator:d,section:m,...p}){const[{editing:h},x]=B(p,L),[g,j]=B(x,q),b=r&&i?{projectId:r,gitRef:"main",assistantId:i,working:!0}:void 0,v={children:s,endIcon:c?o.jsx(Q,{icon:c}):void 0,sx:{background:a||void 0,":hover":{background:a||void 0,opacity:.8}}},k=[],S=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(g).length>0&&Object.values(X.default(g,jt)).filter(Boolean).length>0&&k.push(o.jsx(z,{...g},"base-info")),b&&(t==="form"?k.push(o.jsx(U.AIForm,{identifier:b,SubmitProps:v},"form")):t==="result"?k.push(o.jsx(U.AIFormResult,{identifier:b,placeholder:S,loadingIndicator:N},"result")):k.push(o.jsxs(u.Stack,{width:"100%",gap:2,direction:"row",children:[o.jsx(U.AIForm,{identifier:b,BoxProps:{flex:1},SubmitProps:v}),o.jsx(U.AIFormResult,{identifier:b,BoxProps:{flex:1},placeholder:S,loadingIndicator:N})]},"form-result"))),e&&k.reverse();const et=u.useTheme(),_t=f.useMemo(()=>u.createTheme(Rt.deepmerge(et,{palette:{primary:a?{main:a}:void 0}})),[a,et]);return o.jsx(Wt.ErrorBoundary,{fallbackRender:w.ErrorView,children:o.jsx(u.ThemeProvider,{theme:_t,children:o.jsx(E,{...j,sx:h?{pointerEvents:"none"}:{},children:o.jsx(K,{col:k.length,children:k})})})})}const kt=f.createContext({pages:[],project:void 0}),{Provider:Ne,Consumer:So}=kt;function vt(){return f.useContext(kt)}function Ie({icon:t,className:e="",size:r="1rem",...i}){return o.jsx(Pe,{component:Q,className:y.cx("css-icon",e),size:r,...i,icon:t})}const Pe=_.styled(u.Box)`
169
+ &.css-icon {
170
+ display: inline-block;
171
+ width: ${({size:t})=>t};
172
+ height: ${({size:t})=>t};
173
+ }
174
+ `;function Re({icon:t,className:e="",size:r="1rem",imageMeta:i,...n}){const s=w.autoResizeImage(w.getImageAbsoluteUrl(t),540),[c,a]=f.useState(!1),l=_.useTheme();return c?o.jsx(Ie,{icon:"i-mdi:image",color:l.palette.grey[500],size:r,className:e,...n}):o.jsx(Te,{className:y.cx("image-icon",e),size:r,...n,children:o.jsx("img",{className:"image-icon__image",src:s,onError:()=>a(!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 Te=_.styled(u.Box)`
175
+ display: inline-block;
176
+ width: ${({size:t})=>t};
177
+ height: ${({size:t})=>t};
178
+ .image-icon__image {
179
+ object-fit: contain;
180
+ height: 100%;
181
+ width: 100%;
182
+ }
183
+ `,Z=t=>typeof t=="string"&&/^[\w-_]+:[\w-_]+$/.test(t);function V({icon:t,size:e="1rem",imageMeta:r,...i}){const n=window.isNaN(e)?e:`${e}px`;return Z(t)?o.jsx(xt.Icon,{icon:t}):o.jsx(We,{component:Re,imageMeta:r,className:"base-icon",icon:t,size:n,...i})}const We=_.styled(u.Box)`
184
+ flex-shrink: 0;
185
+ `;function W({text:t,children:e,icon:r="",endIcon:i,color:n="primary",link:s="",href:c="",...a}){const l=r?o.jsx(V,{icon:r}):null,d=i?o.jsx(V,{icon:i}):null,m=s||c,p={...a};return m&&(p.href=m,M.default(m)&&(p.target=p.target||"_blank")),o.jsx(te.default,{startIcon:l,endIcon:d,color:n,...p,children:t||e})}function tt({editing:t,text:e,...r}){const{pages:i=[]}=vt(),n=i.find(s=>s.id===(r.link||r.linkId));if(t)return o.jsx(W,{...C.default(r,["link","linkId"]),children:e});if(n){const s=n.path||"/";return o.jsx(J.Link,{to:s,children:o.jsx(W,{...C.default(r,["link","linkId"]),children:e})})}return o.jsx(W,{...C.default(r,"linkId"),children:e})}function P({type:t="",icon:e="",size:r="3rem",className:i="",...n}){return o.jsx(V,{icon:e||t,size:r,className:y.cx("content-icon",i),...n})}P.propTypes={};P.defaultProps={type:"",icon:"",size:"3rem",color:"inherit",className:""};function ze({to:t,base:e,children:r,className:i,activeClassName:n="active",target:s="auto",autoExternalMark:c=!1,useRouterLink:a,...l}){const{pages:d=[],locale:m=""}={},p=e?O.join("/",e):e||"";let h=s==="auto"?"_self":s,x=O.join(p,t);const g=c?M.default(x):!1;if(e)return x=O.join(p,m,t),o.jsx("a",{className:`no-underline ${i}`,href:T.withoutTrailingSlash(x),rel:"noreferrer noopener",target:h,...l,children:r});if(M.default(t))s==="auto"&&(h="_blank"),x=t;else{T.isRelative(x)&&(x=O.join(window.location.pathname,x));const j=T.parseURL(`${window.location.origin}${x}`),b=d.some(v=>v.pathname===j.pathname);if(a||b)return o.jsx(J.NavLink,{end:!0,to:T.withoutTrailingSlash(x),className:({isActive:v})=>y.cx(i,v?n:""),...l,children:r})}return o.jsxs("a",{className:`no-underline ${i}`,href:T.withoutTrailingSlash(x),rel:"noreferrer noopener",target:h,...l,children:[r,g&&o.jsx(P,{icon:"i-mdi:arrow-top-right",size:"0.9em",className:"smart-link__mark",style:{marginLeft:5}})]})}function A({prepend:t,append:e,children:r,className:i="",dark:n=!1,border:s=!0,...c}){let a={};const{pages:l=[]}=vt(),d=l.find(h=>h.id===c.link),m=!r||ht.default.Children.toArray(r).every(h=>h===null);c.link&&(a={component:ze,to:(d==null?void 0:d.path)||c.link,useRouterLink:!0});const p=n&&s;return o.jsxs(qe,{className:y.cx("base-card card",{"border-gray-200":s},{"dark:border-gray-500":p},{dark:n,"border-transparent":!s},i),...a,...C.default(c,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[t,!m&&o.jsx("div",{className:"card__body",children:r}),e]})}const qe=_.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 F({align:t="left",title:e,titleProps:r={},description:i,descriptionProps:n={}}){return o.jsxs(o.Fragment,{children:[e&&o.jsx(u.Typography,{className:y.cx("card__title text-gray-800","dark:text-gray-50"),component:"h5",variant:"h5",gutterBottom:!0,align:t,...r,children:e}),i&&o.jsx(u.Typography,{className:y.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:t,...n,children:i})]})}function Ee({image:t,title:e,description:r,imageProps:i={},imageMeta:n,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...m}){const p=Z(t),h=w.autoResizeImage(w.getImageAbsoluteUrl(t),540);return o.jsxs(Le,{className:"card-article",...m,prepend:o.jsx("div",{className:"card__image__wrap",children:p&&t?o.jsx(u.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(P,{icon:t,color:"primary.main"})}):h&&o.jsx("img",{className:"card__image",src:h,...i,alt:i.alt||(n==null?void 0:n.filename)||"card-image",width:n==null?void 0:n.naturalWidth,height:n==null?void 0:n.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"cover",objectPosition:"center"},loading:"lazy"})}),children:[e||r?o.jsx(F,{align:d,title:e,titleProps:c,description:r,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:d,actions:l,className:"mt-4"}):null]})}const Le=_.styled(A)`
201
+ ${t=>t.hoverStyle==="none"?"":t.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
+ `,lt="section";function ct({title:t,image:e,imageMeta:r,description:i,actions:n,align:s,listType:c="",className:a="",...l}){return o.jsxs(Ae,{className:y.cx("card",`list-type-${c}`,a),align:s,...l,children:[e&&o.jsx(P,{icon:e,color:"primary.main",size:c==="icon-title"?"1.2rem":"3rem",imageMeta:r}),t||i?o.jsx(F,{align:s,title:t,description:i}):null,n!=null&&n.length?o.jsx(R,{align:s,actions:n,className:"mt-4"}):null]})}const Ae=_.styled(A)`
222
+ padding: 5vw 4vw;
223
+ box-sizing: border-box;
224
+ /* min-height: 320px; */
225
+ color: inherit !important;
226
+ border-radius: 0.5rem;
227
+ /* ${({dark:t,theme:e})=>`background-color:${t?e.palette.grey[900]:e.palette.common.white};`} */
228
+ @media (max-width: ${({theme:t})=>t.breakpoints.values[lt]}px) {
229
+ padding: 1.5rem 2rem;
230
+ }
231
+ @media (max-width: ${({theme:t})=>t.breakpoints.values.sm}px) {
232
+ height: auto;
233
+ min-height: unset;
234
+ }
235
+
236
+ ${t=>t.hoverStyle==="none"?"":t.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:t})=>t.palette.primary.main};
247
+ }
248
+ }
249
+ .card__description {
250
+ a {
251
+ color: ${({theme:t})=>t.palette.primary.main};
252
+ }
253
+ }
254
+ .card__body {
255
+ padding: 0;
256
+ ${({align:t})=>`text-align:${t||"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:t})=>t.breakpoints.values[lt]}px) {
274
+ padding: 2rem 2rem;
275
+ text-align: left;
276
+ box-sizing: border-box;
277
+ }
278
+ `;function Fe({image:t,title:e,description:r,imageProps:i={},imageMeta:n,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...m}){const p=Z(t),h=w.autoResizeImage(w.getImageAbsoluteUrl(t),540);return o.jsxs(Ue,{className:"card-article",...m,prepend:o.jsx("div",{className:"card__image__wrap",children:p&&t?o.jsx(u.Box,{sx:{position:"absolute",left:0,top:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},children:o.jsx(P,{icon:t,color:"primary.main"})}):h&&o.jsx(u.Box,{component:"img",className:"card__image",src:h,...i,alt:i.alt||(n==null?void 0:n.filename)||"card-image",width:n==null?void 0:n.naturalWidth,height:n==null?void 0:n.naturalHeight,style:{width:"100%",height:"100%",objectFit:s||"contain",objectPosition:"center"},loading:"lazy"})}),children:[e||r?o.jsx(F,{align:d,title:e,titleProps:c,description:r,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:d,actions:l,className:"mt-4"}):null]})}const Ue=_.styled(A)`
279
+ ${t=>t.hoverStyle==="none"?"":t.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:t})=>`text-align:${t||"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
+ `,dt="section";function Oe({title:t,image:e,imageMeta:r,iconSize:i=100,description:n,actions:s,align:c,className:a="",...l}){return o.jsx(De,{className:y.cx("card",a),...l,children:o.jsxs(u.Box,{className:"flex items-center",children:[e&&o.jsx(P,{icon:e,color:"primary.main",size:i,imageMeta:r}),o.jsxs(u.Box,{className:"flex-1 ml-4",children:[o.jsx(F,{align:c,title:t,description:n}),o.jsx(R,{align:c,actions:s,className:"mt-4"})]})]})})}const De=_.styled(A)`
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:t,theme:e})=>`background-color:${t?e.palette.grey[900]:e.palette.common.white};`} */
310
+ @media (max-width: ${({theme:t})=>t.breakpoints.values[dt]}px) {
311
+ padding: 1.5rem 2rem;
312
+ }
313
+ @media (max-width: ${({theme:t})=>t.breakpoints.values.sm}px) {
314
+ height: auto;
315
+ min-height: unset;
316
+ }
317
+
318
+ ${t=>t.hoverStyle==="none"?"":t.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:t})=>t.palette.primary.main};
328
+ }
329
+ }
330
+ .card__description {
331
+ a {
332
+ color: ${({theme:t})=>t.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:t})=>t.breakpoints.values[dt]}px) {
354
+ padding: 2rem 2rem;
355
+ text-align: left;
356
+ box-sizing: border-box;
357
+ }
358
+ `;function Me({title:t,titleProps:e={},description:r,descriptionProps:i={},image:n,imageMeta:s,className:c="",align:a,hoverStyle:l,...d}){return o.jsxs(He,{className:y.cx("card-simple",c,`hover-style__${l}`),align:a,...d,children:[n&&o.jsx(P,{icon:n,color:"primary.main",imageMeta:s}),t||r?o.jsx(F,{align:a,title:t,titleProps:e,description:r,descriptionProps:i}):null]})}const He=_.styled(A)`
359
+ ${({dark:t,theme:e})=>`background-color:${t?e.palette.grey[900]:e.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:t})=>`text-align:${t||"left"};`}
387
+ }
388
+
389
+ ${t=>t.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:t})=>t?'""':""};
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 Ve({type:t="default",...e}){const i={article:Ee,simple:Me,news:Oe,default:ct,wall:Fe}[t]||ct;return o.jsx(i,{...t==="news"?e:C.default(e,"iconSize")})}function Ge({list:t=[],align:e="top",cards:r,listBorder:i=!0,listType:n="",col:s=3,gap:c,iconColor:a,className:l="",type:d="default",dark:m=!1,textAlign:p="left",hoverStyle:h,...x}){return o.jsx(K,{type:d,className:y.cx("card-list py-1",l,"items-stretch"),col:s,gap:c,align:e,...x,children:r||t.map(g=>o.jsx(Ve,{borderColor:i,iconColor:a,type:d,listType:n,dark:m,...g,align:p,sx:{bgcolor:d==="wall"?void 0:m?"grey.900":"common.white"},style:c===0&&t.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},g.id))})}const Je=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"],Ye=_.styled(E)`
444
+ a .card {
445
+ color: #404040;
446
+ cursor: pointer;
447
+ }
448
+ a:not(.MuiButton-root) {
449
+ color: ${({theme:t})=>t.palette.primary.main};
450
+ &:hover,
451
+ &:active {
452
+ color: ${({theme:t})=>t.palette.primary.main};
453
+ }
454
+ }
455
+ a:hover .card {
456
+ color: #404040;
457
+ }
458
+ `;function Xe({className:t,...e}){const[r,i]=B(e,q),[n,s]=B(i,Je);return o.jsxs(Ye,{className:y.cx("section--card-list",t),type:e.type,...s,children:[Object.keys(r).length>0&&o.jsx(z,{center:!0,...r,className:"mb-[2.5vw]"}),o.jsx(Ge,{...n,dark:!!e.dark})]})}const Ke=_.styled(Xe)`
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 Qe({section:t,...e}){const[{editing:r},i]=B(e,L),n=f.useMemo(()=>{var s;return{...C.default(i,["listBorder","list","iconSize","imageSize"]),list:(s=i.list)==null?void 0:s.map(c=>{var a,l;return{...C.default(c,"icon","iconColor"),image:["news","simple","default"].includes(i.type)&&c.icon?c.icon:c.image,actions:(l=(a=c.actions)==null?void 0:a.map)==null?void 0:l.call(a,d=>o.jsx(tt,{...d,editing:r},d.id)),border:i.listBorder,iconSize:i.iconSize,imageSize:i.imageSize,hoverStyle:i.hoverStyle}})}},[i]);return o.jsx(Ke,{style:r?{pointerEvents:"none"}:{},...n})}function Ze({properties:t,section:e,locale:r,dev:i}){var n;return(n=e==null?void 0:e.config)!=null&&n.componentId?o.jsx(G.CustomComponentRenderer,{instanceId:e.id,componentId:e.config.componentId,blockletId:e.config.blockletId,blockletTitle:e.config.blockletTitle,componentName:e.config.componentName,locale:r,properties:t,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 to({src:t,dataId:e,isEdit:r=!1,height:i="100%",onLoad:n=()=>{}}){return o.jsx(Jt.EmbedIframe,{isEdit:r,embedId:e,src:t,height:i,onLoad:()=>{n()}})}function eo({dataId:t,src:e,actions:r,center:i,onLoad:n,...s}){const[c,a]=B(s,q);return o.jsxs(E,{...a,children:[Object.keys(c).length>0&&o.jsx(z,{center:i,...c}),o.jsx(to,{dataId:t,src:e,onLoad:n,height:s.iframeHeight?`${s.iframeHeight}px`:"100%"}),o.jsx(R,{actions:r,center:i})]})}const oo={src:"",embedUrl:"",title:"",description:"",dark:!1,background:"",center:!0,config:{},id:""};function no({section:t,id:e,src:r,...i}){const n=`${e}-${i.locale}`,[{editing:s},c]=B(i,L),a=f.useRef({}),l=JSON.parse(JSON.stringify(c)),{message:d}=Ht.useMessage(n,"server"),m=Vt.useLatest(JSON.parse(JSON.stringify(c.config)||"{}"));return f.useEffect(()=>{d&&d.onInit(()=>m.current)},[d]),f.useEffect(()=>{const p=JSON.parse(JSON.stringify(c.config)||"{}");ee.default(a.current,p)||(a.current=p,d==null||d.send("config-set",p))},[d,c.config]),r?o.jsx(eo,{...l,dataId:n,src:r,style:s?{pointerEvents:"none"}:{}}):o.jsx(ro,{children:'Please set the "src" attribute for this block'})}const ro=_.styled("div")`
474
+ user-select: none;
475
+ color: #999;
476
+ padding: 8px;
477
+ height: 200px;
478
+ `,io=[/youtu\.be\/([^#&?]{11})/,/\?v=([^#&?]{11})/,/&v=([^#&?]{11})/,/embed\/([^#&?]{11})/,/\/v\/([^#&?]{11})/];function so(t){var e;if(/youtu\.?be/.test(t))for(const r of io){const i=(e=r.exec(t))==null?void 0:e[1];if(i)return i}}function ao(t){const e=so(t);if(e)return`https://youtube.com/embed/${e}`}function lo({src:t}){return f.useEffect(()=>{import("@lottiefiles/lottie-player")},[]),o.jsx("lottie-player",{autoplay:!0,loop:!0,mode:"normal",src:t})}function co(t){return o.jsx(u.Box,{maxHeight:400,overflow:"hidden auto",children:o.jsx(Yt.TwitterTimelineEmbed,{...t})})}function uo({url:t}){const e=f.useRef(null),r=495,[i,n]=f.useState(e.current?e.current.offsetWidth*.5625:r),s=f.useCallback(()=>{const c=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,a=e.current?e.current.offsetWidth*.5625:r;return n(Math.floor(a*c))},[]);return f.useEffect(()=>{window.addEventListener("resize",s);const c=window.innerWidth>990?1:window.innerWidth>522?1.2:window.innerWidth>400?1.45:1.85,a=e.current?e.current.offsetWidth*.5625:r;return n(Math.floor(a*c)),function(){window.removeEventListener("resize",s)}},[i,s]),o.jsx(u.Box,{component:"iframe",ref:e,title:"youtube",width:"100%",height:`${i}px`,src:t,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,sx:{display:"block"}})}const mo={image:"https://www.arcblock.io/static/ead0cabde7f2b7ff34db8f3e8ceca271/afc4b/builder.png",badge:"Develop · Deploy · Run",title:"The Future is Here: Blockchain and Decentralized Application Development",description:"ArcBlock, your exclusive new decentralized development platform, makes developing decentralized applications, blockchain, and distributed ledger technology straightforward.",reverse:!1,dark:!1,background:"",actions:void 0,hasImage:!0,center:!1},po=_.styled($e)`
479
+ .section__description {
480
+ }
481
+ `;function xo({hasImage:t,fullSizeImage:e,boxed:r,videoPoster:i,imageMeta:n,imageOptimization:s,imageSize:c,section:a,...l}){var x,g;const[{editing:d},m]=B({...l,boxed:e?void 0:r},L);let p=ho(m.image,i,e,n,s,c);t||(p=null);let h=null;return m.actions&&(h=(g=(x=m.actions)==null?void 0:x.map)==null?void 0:g.call(x,(j,b)=>o.jsx(tt,{...j,editing:d},b))),o.jsx(po,{...m,style:d?{pointerEvents:"none"}:{},image:p,fullSizeImage:t&&e,actions:h})}function ho(t,e,r,i,n,s){if(t){if(t.endsWith(".json"))return o.jsx(lo,{src:t});if(t.indexOf("twitter.com")!==-1)return o.jsx(co,{sourceType:"url",url:t});const c=ao(t);if(c)return o.jsx(uo,{url:c});const{naturalWidth:a,naturalHeight:l,filename:d}=i||{};if(H(t))return o.jsx("video",{width:a&&`${a}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(e),r?1200:540,n),children:o.jsx("source",{src:w.getImageAbsoluteUrl(t),type:we(t)})},t);const m=n==="quality"?1:.6;return o.jsx(G.ResponsiveImage,{src:w.getImageAbsoluteUrl(t),sizesAttr:{sm:600*m,md:450*m,lg:540*m,...r&&{md:900*m,lg:1200*m}},width:a&&`${a}px`,height:l&&`${l}px`,alt:d??t,style:{objectFit:s||"contain",display:"block",width:"100%",height:"100%"},loading:"lazy"})}return null}const fo=["production","draft"];function go({mode:t,version:e}={}){const r=e&&typeof e=="number"?{mode:t,version:e}:{mode:t};return w.api.get(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages`,{params:r}).then(i=>i.data)}function bo({mode:t,pages:e}){return w.api.post(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages/publish`,{mode:t,pages:e}).then(r=>r.data)}function yo({locale:t,sort:e,page:r,limit:i,mode:n}={}){return w.api.get(`/api/${w.getProjectIdFromPathnameOrWindow()}/pages/toc`,{params:{locale:t,sort:e,page:r,limit:i,mode:n}}).then(s=>s.data)}const wo={style:"list",sort:"-updatedAt"},ut=20;function jo({style:t,sort:e,section:r,...i}){const[{editing:n,locale:s},c]=B(i,L),[a,l]=B(c,q),[d,m]=f.useState(),p=f.useRef(!1),h=it.useUpdate(),x=J.useNavigate(),g=f.useCallback(async()=>{if(!p.current){p.current=!0,h();try{const j=d?Math.floor(d.list.length/ut)+1:1,{list:b,total:v}=await yo({locale:s,sort:e,page:j,limit:ut});m(k=>({list:((k==null?void 0:k.list)??[]).concat(b),total:v}))}finally{p.current=!1,h()}}},[d,s,e,h]);return it.useMount(()=>{g()}),o.jsxs(E,{...l,sx:n?{pointerEvents:"none"}:{},children:[Object.keys(a).length>0&&o.jsx(z,{...a}),d?o.jsxs(o.Fragment,{children:[o.jsx(u.Grid,{container:!0,spacing:2,justifyContent:"center",children:d==null?void 0:d.list.map(j=>o.jsx(u.Grid,{item:!0,xs:12,sm:t==="card"?6:12,md:t==="card"?3:12,children:o.jsxs(ko,{elevation:0,className:y.cx(t==="card"&&"style-card"),onClick:n?void 0:()=>x(j.slug),children:[!!j.image&&o.jsx(u.CardMedia,{component:"img",alt:"",image:w.autoResizeImage(w.getImageAbsoluteUrl(j.image),540),loading:"lazy"}),o.jsxs(u.CardContent,{children:[o.jsx(u.Typography,{variant:"h6",component:"div",className:mt,children:j.title||j.id}),o.jsx(u.Typography,{variant:"body2",className:mt,children:j.description})]})]})},j.id))}),o.jsx(u.Box,{textAlign:"center",mt:2,children:d.total>d.list.length?o.jsx(W,{variant:"outlined",color:"secondary",onClick:g,loading:p.current,children:"More"}):o.jsx(W,{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 mt=y.css`
482
+ display: -webkit-box;
483
+ -webkit-box-orient: vertical;
484
+ -webkit-line-clamp: 2;
485
+ overflow: hidden;
486
+ text-overflow: ellipsis;
487
+ `,ko=_.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
+ `,vo={iframe:no,section:xo,"section-card-list":Qe,toc:jo,"ai-runtime":Ce,"custom-component":Ze};function _o({id:t,type:e,mode:r,config:i,section:n,...s}){const c=vo[e],{getPageMetaStyle:a}=ce(),l=f.useMemo(()=>{const{height:p,...h}=i;return h},[i]),d=f.useMemo(()=>{const p={};return e!=="custom-component"&&(p.height=i.height),p.sx=a("sx"),p},[i.height,e,a]),m=c&&o.jsx(c,{mode:r,...l,id:t,section:n});return o.jsx(Be,{...s,...d,children:m})}function $o(t){return t!=null}exports.Action=tt;exports.BlockRenderer=_o;exports.IFrameBlockDefaultProps=oo;exports.Icon=Q;exports.PageProvider=de;exports.Provider=Ne;exports.STATE_MODES=fo;exports.SectionBlockDefaultProps=mo;exports.TocDefaultProps=wo;exports.getPages=go;exports.nonNullable=$o;exports.publishPages=bo;
@@ -0,0 +1,21 @@
1
+ "use strict";var M=Object.create;var T=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var R=(i,l,n,c)=>{if(l&&typeof l=="object"||typeof l=="function")for(let o of F(l))!V.call(i,o)&&o!==n&&T(i,o,{get:()=>l[o],enumerable:!(c=_(l,o))||c.enumerable});return i};var G=(i,l,n)=>(n=i!=null?M(A(i)):{},R(l||!i||!i.__esModule?T(n,"default",{value:i,enumerable:!0}):n,i));const e=require("react/jsx-runtime"),W=require("@arcblock/ux/lib/Empty"),E=require("@arcblock/ux/lib/Locale/context"),H=require("@arcblock/ux/lib/Theme"),L=require("@blocklet/pages-kit/contexts/color"),B=require("@blocklet/pages-kit/utils/style");require("@emotion/css");const t=require("@mui/material"),w=require("ahooks");require("lodash/without");const m=require("react"),P=require("tinycolor2"),a=require("@mui/material/colors"),k=require("../uploader.js"),U=require("@iconify-icon/react"),X=require("react-use"),q=require("./state-BoXTl4DM.js"),D=i=>i&&i.__esModule?i:{default:i},N=D(W),O=D(P);a.red[300],a.pink[300],a.purple[300],a.indigo[300],a.blue[300],a.cyan[300],a.teal[300],a.green[300],a.lime[300],a.yellow[300],a.amber[300],a.orange[300],a.brown[300],a.grey[300],a.blueGrey[300];const Y=m.forwardRef(function({showMarkdown:l,markdown:n,onMarkdownChange:c,showUploader:o,value:u,meta:K,onChange:x,...f},y){const[d,b]=m.useState("");m.useEffect(()=>{b(u||"")},[u,b]);const I=async()=>{if(d!==u){const r=q.getImageAbsoluteUrl(d);if(!r){x(d,void 0);return}const h=await k.getImageSize(r).catch(()=>k.getVideoSize(r)).catch(()=>{});x(d,{...h,filename:d})}};X.useDebounce(()=>{d!==u&&x(d)},300,[d]),m.useImperativeHandle(y,()=>({submit:I}));const p={};return o&&(p.InputProps={sx:{pr:0},endAdornment:e.jsx(t.InputAdornment,{position:"end",sx:{mx:.5},children:e.jsx(k.UploaderButton,{onChange:async({response:r})=>{var C;const h=(C=r==null?void 0:r.data)==null?void 0:C.filename,v=q.getImageAbsoluteUrl(h)||"";let s={};v&&(s=await k.getImageSize(v).catch(()=>k.getVideoSize(v)).catch(()=>{})),x(h,{...s,filename:h})}})})}),e.jsx(t.TextField,{size:"small",fullWidth:!0,...f,label:e.jsxs(t.Stack,{direction:"row",spacing:1,alignItems:"center",children:[f.label,l&&e.jsxs(e.Fragment,{children:[" (",e.jsx(t.FormControlLabel,{checked:n,label:e.jsx(t.Box,{component:U.Icon,icon:"tabler:markdown",sx:{verticalAlign:"middle"}}),labelPlacement:"start",control:e.jsx(t.Switch,{size:"small"}),sx:{ml:.25,pr:1},onChange:(r,h)=>c==null?void 0:c(h)}),")"]})]}),InputLabelProps:{shrink:!0,...f.InputLabelProps},value:d,onChange:r=>b(r.target.value),...p,onKeyDown:r=>{r.keyCode!==229&&r.key==="Enter"&&I()}})}),$=m.lazy(()=>import("react-best-gradient-color-picker")),z=400,S=270;function J({color:i,sx:l={},...n}){B.isColorString(i);const c={};return B.isGradient(i)?c.backgroundImage=i:c.backgroundColor=i,e.jsx(t.Box,{sx:{...l,width:"100%",paddingBottom:"100%",cursor:"pointer",transition:"opacity 0.2s",border:"1px solid #ccc",borderRadius:.5,"&:hover":{opacity:.75},...c},...n})}const Q=m.forwardRef(function({onSave:l,enableMuiPalette:n=!0},c){const o=w.useReactive({value:"",originalMuiKey:null}),{t:u}=E.useLocaleContext(),[K,x]=w.useLocalStorageState("pages-kit:color-picker-active-tab",{defaultValue:0}),f=L.useMuiColorPalette(),y={};o.value?B.isGradient(o.value)?y.backgroundImage=o.value:y.backgroundColor=o.value:y.border="1px solid #ccc";const[d,{setFalse:b,setTrue:I}]=w.useBoolean(!1),p=m.useCallback(()=>{b()},[b]),r=n&&K===0;m.useImperativeHandle(c,()=>({open({value:s}={value:""}){if(n&&f.isMuiColorKey(s)){o.originalMuiKey=s;const C=f.getColorByMuiKey(s);o.value=B.getSafeGradient(C||s),x(0)}else o.originalMuiKey=null,o.value=B.getSafeGradient(s),n||x(1);I()},close(){p()}}));const h=()=>{if(n&&f)if(r){const s=f.getMuiKeyByColor(o.value);l({value:s||o.value},p)}else l({value:o.value},p);else l({value:o.value},p)},{groupedMuiColors:v}=f;return e.jsxs(t.Dialog,{disableEnforceFocus:!0,open:d,onClose:p,hideBackdrop:!0,children:[e.jsxs(t.DialogTitle,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(t.Typography,{variant:"inherit",component:"div",children:u("maker.configColor")}),n&&e.jsxs(t.ButtonGroup,{size:"small","aria-label":"color mode selector",children:[e.jsx(t.Button,{variant:r?"contained":"outlined",onClick:()=>x(0),sx:{fontWeight:500,textTransform:"none",minWidth:"unset"},children:u("maker.configColorMuiTheme")||"Theme Color"}),e.jsx(t.Button,{variant:K===1?"contained":"outlined",onClick:()=>x(1),sx:{fontWeight:500,textTransform:"none",minWidth:"unset"},children:u("maker.configColorCustomColor")||"Custom Color"})]})]}),e.jsxs(t.DialogContent,{sx:{width:600,display:"flex",flexDirection:"row",gap:2,overflowX:"hidden"},children:[e.jsxs(t.Box,{sx:{...y,flex:"0 0 270px",borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",position:"sticky",top:0},children:[!o.value&&e.jsx(N.default,{children:u("error.notConfig")}),o.originalMuiKey&&r&&e.jsx(t.Typography,{variant:"body2",sx:{bgcolor:"rgba(255,255,255,0.7)",px:2,py:1,borderRadius:1,color:"#000",maxWidth:"90%",textAlign:"center"},children:o.originalMuiKey})]},"color-preview"),e.jsx(t.Box,{sx:{flex:1},children:r?e.jsx(t.Box,{sx:{height:z},children:Object.entries(v).map(([s,C])=>e.jsxs(t.Box,{sx:{pb:1.5},children:[e.jsx(t.Typography,{variant:"subtitle2",gutterBottom:!0,sx:{textTransform:"capitalize",mb:.5,lineHeight:1},children:s}),e.jsx(t.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:C.map(g=>{let j="";return o.originalMuiKey===g.colorKey&&(g.colorValue==="transparent"?j="rgba(0,0,0,0.7)":O.default(g.colorValue).isDark()?j="rgba(255,255,255,0.8)":j="rgba(0,0,0,0.7)"),e.jsx(t.Tooltip,{title:g.colorKey,children:e.jsx(t.Box,{onClick:()=>{o.value=g.colorValue,o.originalMuiKey=g.colorKey},sx:{width:28,height:28,bgcolor:g.colorValue,border:o.originalMuiKey===g.colorKey?`2px solid ${j}`:"1px solid #ccc",borderRadius:.5,cursor:"pointer","&:hover":{opacity:.8},display:"flex",alignItems:"center",justifyContent:"center",...g.colorValue==="transparent"?{background:"repeating-conic-gradient(#CCCCCC 0% 25%, #FFFFFF 0% 50%) 50% / 10px 10px"}:{}},children:o.originalMuiKey===g.colorKey&&e.jsx("i",{className:"i-mdi:check",style:{color:j,fontSize:"1.2rem"}})})},g.colorKey)})})]},s))}):e.jsx(t.Box,{sx:{overflowY:"auto",overflowX:"hidden"},children:e.jsx(m.Suspense,{fallback:e.jsx(t.Skeleton,{variant:"rectangular",width:S,height:z}),children:e.jsx($,{disableDarkMode:!0,width:S,height:S,value:o.value,onChange:s=>{o.value=s,o.originalMuiKey=null},hidePresets:!0,hideAdvancedSliders:!0,hideColorGuide:!0,hideInputType:!0})})})})]}),e.jsxs(t.DialogActions,{children:[e.jsx(t.Button,{variant:"outlined",size:"small",onClick:p,children:u("common.cancel")}),e.jsx(t.Button,{variant:"contained",size:"small",onClick:h,children:u("maker.save")})]})]})});H.styled(t.Box)`
2
+ .color-item {
3
+ position: relative;
4
+ }
5
+ .color-item__checked {
6
+ position: absolute;
7
+ top: 0;
8
+ bottom: 0;
9
+ left: 0;
10
+ right: 0;
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ color: rgba(255, 255, 255, 0.85);
15
+ }
16
+ .color-item__delete {
17
+ position: absolute;
18
+ top: 0;
19
+ right: 0;
20
+ }
21
+ `;exports.ColorItem=J;exports.ConfigColorDialog=Q;exports.ConfigString=Y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-eTpgUKhB.js");function n({children:e}){const r=t.useProjectId();return s.jsx(t.StoreProvider,{url:t.getWssURL(r??""),name:"root",waitingSynced:!0,children:s.jsx(o,{children:e})})}function o({children:e}){const{state:r}=t.useStore();return e({state:r})}exports.default=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-BoXTl4DM.js");function n({children:e}){const r=t.useProjectId();return s.jsx(t.StoreProvider,{url:t.getWssURL(r??""),name:"root",waitingSynced:!0,children:s.jsx(o,{children:e})})}function o({children:e}){const{state:r}=t.useStore();return e({state:r})}exports.default=n;