@blocklet/pages-kit-inner-components 0.4.109 → 0.4.111
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.
- package/lib/cjs/add-component.js +1 -1
- package/lib/cjs/chunks/{array-DHXwpDtd.js → array-CnXbKOG_.js} +23 -23
- package/lib/cjs/chunks/config-color-BBSht7j-.js +21 -0
- package/lib/cjs/chunks/{draft-data-UP_7unuZ.js → draft-data-DPTVTTlh.js} +1 -1
- package/lib/cjs/chunks/{home-Bouu7xjV.js → home-BXkUy2B8.js} +3 -3
- package/lib/cjs/chunks/{publish-button-BSxaxRDn.js → publish-button-B7nhzpwi.js} +1 -1
- package/lib/cjs/chunks/state-DDwYX2mu.js +1 -0
- package/lib/cjs/home.js +1 -1
- package/lib/cjs/locales.js +1 -1
- package/lib/cjs/setting.js +2 -2
- package/lib/cjs/uploader.js +1 -1
- package/lib/es/add-component.js +3 -3
- package/lib/es/chunks/{array-CVceCpS9.js → array-nAv4MiIp.js} +369 -344
- package/lib/es/chunks/config-color-JrBPRsTv.js +121 -0
- package/lib/es/chunks/{draft-data-0n1CKRWr.js → draft-data-BFlmvWXx.js} +3 -3
- package/lib/es/chunks/{home-2Nd5wxm6.js → home-Cjs79tsI.js} +4 -4
- package/lib/es/chunks/{publish-button-ChN-Liyi.js → publish-button-DhOdksVJ.js} +3 -3
- package/lib/es/chunks/{site-state-Bn8mEgOx.js → site-state-BVZLaWr2.js} +3 -3
- package/lib/es/chunks/{state-DsXKwImw.js → state-BgKqNapt.js} +12 -12
- package/lib/es/components.js +1 -1
- package/lib/es/home.js +3 -3
- package/lib/es/locales.js +4 -0
- package/lib/es/project-html.js +12 -12
- package/lib/es/resources.js +1 -1
- package/lib/es/setting.js +152 -151
- package/lib/es/site-state.js +6 -6
- package/lib/es/uploader.js +6 -64
- package/package.json +12 -12
- package/lib/cjs/chunks/config-color-Da8lKUL0.js +0 -21
- package/lib/cjs/chunks/state-BoXTl4DM.js +0 -1
- package/lib/es/chunks/config-color-B-ax03qd.js +0 -328
package/lib/cjs/add-component.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var XI=Object.create;var II=Object.defineProperty;var TI=Object.getOwnPropertyDescriptor;var WI=Object.getOwnPropertyNames;var xI=Object.getPrototypeOf,YI=Object.prototype.hasOwnProperty;var rI=(C,s,w,A)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of WI(s))!YI.call(C,o)&&o!==w&&II(C,o,{get:()=>s[o],enumerable:!(A=TI(s,o))||A.enumerable});return C};var hI=(C,s,w)=>(w=C!=null?XI(xI(C)):{},rI(s||!C||!C.__esModule?II(w,"default",{value:C,enumerable:!0}):w,C));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("react/jsx-runtime"),H=require("./chunks/state-
|
|
1
|
+
"use strict";var XI=Object.create;var II=Object.defineProperty;var TI=Object.getOwnPropertyDescriptor;var WI=Object.getOwnPropertyNames;var xI=Object.getPrototypeOf,YI=Object.prototype.hasOwnProperty;var rI=(C,s,w,A)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of WI(s))!YI.call(C,o)&&o!==w&&II(C,o,{get:()=>s[o],enumerable:!(A=TI(s,o))||A.enumerable});return C};var hI=(C,s,w)=>(w=C!=null?XI(xI(C)):{},rI(s||!C||!C.__esModule?II(w,"default",{value:C,enumerable:!0}):w,C));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("react/jsx-runtime"),H=require("./chunks/state-DDwYX2mu.js"),ZI=require("@arcblock/ux/lib/Empty"),X=require("@arcblock/ux/lib/Locale/context"),R=require("@iconify-icon/react"),QI=require("@mui/icons-material/Check"),i=require("@mui/material"),u=require("ahooks"),m=require("react"),r=require("./chunks/array-CnXbKOG_.js"),U=require("./chunks/config-color-BBSht7j-.js"),kI=require("lodash/cloneDeep"),Y=require("@mui/icons-material"),CI=require("react-dnd");require("@arcblock/ux/lib/Tabs");require("@blocklet/pages-kit/utils/style");require("lodash/pick");const f=require("@arcblock/ux/lib/Theme"),RI=require("@mui/lab"),a=require("immer"),pI=require("./theme.js"),v=require("react-use"),JI=require("@arcblock/ux/lib/Toast"),UI=require("@mui/material/Tooltip"),fI=require("@mui/icons-material/KeyboardArrowLeft"),GI=require("@mui/material/Box"),VI=require("@mui/material/DialogTitle"),vI=require("@mui/material/IconButton"),PI=require("@mui/material/Dialog"),_I=require("@mui/material/useMediaQuery"),OI=require("@emotion/react"),qI=require("@mui/material/Alert"),$I=require("@mui/material/AlertTitle"),IC=require("react-error-boundary"),CC=require("ufo"),gC=require("@emotion/styled"),AC=require("@mui/material/Typography"),iC=require("joi"),mI=require("@blocklet/ai-kit/api"),sC=require("@blocklet/js-sdk"),SI=require("@mui/x-date-pickers"),oC=require("@mui/x-date-pickers/AdapterDayjs"),wC=require("@mui/x-date-pickers/LocalizationProvider"),gI=require("circular-natal-horoscope-js/dist"),MC=require("dayjs"),LC=require("dayjs/plugin/timezone"),jC=require("dayjs/plugin/utc"),JC=require("fast-deep-equal"),OC=require("lodash/isNil"),mC=require("tz-lookup"),SC=require("@mui/icons-material/CheckCircleOutline"),BC=require("lodash/uniq"),yC=require("@emotion/css"),DC=require("lodash/get"),eC=require("lodash/set"),bC=require("@blocklet/pages-kit/components"),F=C=>C&&C.__esModule?C:{default:C},BI=F(ZI),NC=F(QI),yI=F(m),KC=F(kI),DI=F(JI),dC=F(UI),P=F(fI),x=F(GI),_=F(VI),q=F(vI),cC=F(PI),zC=F(_I),FC=F(qI),aC=F($I),Z=F(gC),AI=F(AC),E=F(iC),h=F(MC),lC=F(LC),tC=F(jC),HC=F(JC),EC=F(OC),eI=F(mC),uC=F(SC),iI=F(BC),nC=F(DC),XC=F(eC);function TC({htmlId:C,dragType:s,dropType:w=s,index:A,id:o,title:g,move:M,actions:j,...O}){const[{isDragging:L},e,y]=CI.useDrag(()=>({type:s,item:{id:o,index:A},options:{dropEffect:"move"},collect:b=>({isDragging:b.isDragging()}),end:(b,N)=>{const{id:S,index:B}=b;N.didDrop()||M(S,B)}}),[s,o,A,M]),[,J]=CI.useDrop(()=>({accept:w,hover(b){b.id!==o&&M(b.id,A)}}),[w,o,A,M]),D=L?.3:1;return I.jsxs(WC,{...O,id:C,ref:b=>J(y(b)),sx:{...O.sx,opacity:D},children:[I.jsx("div",{className:"drag",ref:b=>e(b),children:I.jsx(Y.DragIndicator,{})}),I.jsx("div",{className:"name",children:g}),I.jsx("div",{className:"actions",onClick:b=>b.stopPropagation(),children:j})]})}const WC=i.styled(i.Box)`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
padding: 8px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Bt=Object.create;var nt=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var Rt=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Nt(e))!Pt.call(t,r)&&r!==n&&nt(t,r,{get:()=>e[r],enumerable:!(i=Ct(e,r))||i.enumerable});return t};var rt=(t,e,n)=>(n=t!=null?Bt(It(t)):{},Rt(e||!t||!t.__esModule?nt(n,"default",{value:t,enumerable:!0}):n,t));const o=require("react/jsx-runtime");require("@mui/icons-material");const m=require("@mui/material"),f=require("react"),Tt=require("lodash/keyBy"),j=require("./state-DDwYX2mu.js"),U=require("@blocklet/ai-runtime/components"),Wt=require("@mui/utils"),zt=require("lodash/pick"),qt=require("react-error-boundary"),pt=require("@blocklet/pages-kit/contexts/color"),b=require("@emotion/css"),V=require("@iconify/react"),Et=require("react-markdown"),Lt=require("remark-gfm"),At=require("@mui/lab"),_=require("@arcblock/ux/lib/Theme"),Ot=require("@arcblock/react-hooks/lib/useBrowser"),Ut=require("@arcblock/ux/lib/Colors"),G=require("@blocklet/pages-kit/components"),it=require("@blocklet/pages-kit/utils/style"),Ft=require("@mui/material/useMediaQuery"),Mt=require("lodash/omit"),ht=require("@iconify-icon/react"),Dt=require("@arcblock/ux/lib/Screenshot"),K=require("react-router-dom"),Vt=require("@arcblock/ux/lib/Button"),Ht=require("is-uri"),F=require("pathe"),T=require("ufo"),Yt=require("@blocklet/embed/message"),Jt=require("ahooks"),Gt=require("lodash/isEqual"),Kt=require("@blocklet/embed/react"),Xt=require("react-twitter-embed"),st=require("react-use"),$=t=>t&&t.__esModule?t:{default:t},ft=$(f),D=$(Tt),X=$(zt),Qt=$(Et),Zt=$(Lt),te=$(Ot),at=$(Ut),gt=$(Ft),C=$(Mt),ee=$(Dt),oe=$(Vt),H=$(Ht),ne=$(Gt),yt="{{CUSTOM_VALUE}}",re=[{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}}}],ie=[{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,lg:7,xl:9}}},{title:"Large",value:"large",sx:{py:{xs:6,md:9,lg:9,xl:11}}}],se=[{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}}}],M=(t,e,n)=>{const i=t.breakpoints.values[n];return`${e}${i?` (${i}px)`:""}`},ae=[{title:"100%",value:"full",sx:{maxWidth:"100%"}},{title:t=>M(t,"Small","sm"),value:"sm",sx:{maxWidth:t=>t.breakpoints.values.sm,width:"100%",mx:"auto"}},{title:t=>M(t,"Normal","md"),value:"md",sx:{maxWidth:t=>t.breakpoints.values.md,width:"100%",mx:"auto"}},{title:t=>M(t,"Large","lg"),value:"lg",sx:{maxWidth:t=>t.breakpoints.values.lg,width:"100%",mx:"auto"}},{title:t=>M(t,"Extra Large","xl"),value:"xl",sx:{maxWidth:t=>t.breakpoints.values.xl,width:"100%",mx:"auto"}},{title:"Custom",value:"custom",sx:{maxWidth:yt,width:"100%",mx:"auto"}}],le=D.default(re,"value"),ce=D.default(ie,"value"),de=D.default(se,"value"),ue=D.default(ae,"value"),me=new Map([["baseSectionPaddingY",le],["maxWidth",ue],["paddingY",ce],["paddingX",de]]);function bt(t){var l;const{type:e,value:n,format:i="sx",defaultValue:r=null}=t,s=me.get(e);if(!s)return r;const c=n.startsWith("custom:"),a=c?"custom":n;if(s!=null&&s[a]&&((l=s==null?void 0:s[a])!=null&&l[i])){const d=s[a][i];if(c){const u=n.replace("custom:","");try{return JSON.parse(JSON.stringify(d||{}).replaceAll(yt,u))}catch{}}return d}return r}const wt=f.createContext({page:null,getPageMeta:()=>({}),getPageMetaStyle:()=>({})});function xe(){return f.useContext(wt)}function pe({page:t,children:e,defaultLocale:n="en",currentLocale:i}){const r=f.useMemo(()=>t?JSON.parse(JSON.stringify(t)):null,[JSON.stringify(t)]),s=f.useCallback(()=>{var d;if(!r)return{};const l=i||n;return((d=r.locales)==null?void 0:d[l])??{}},[r,n,i]),c=f.useCallback((l="sx")=>{const d=s();return!d||!d.style?{}:Object.entries(d.style||{}).reduce((x,[h,p])=>{if(!p)return x;const y=`${h}Custom`;d.style[y];const w=bt({type:h,value:p,format:l});return w?{...x,...w}:x},{})},[s]),a=f.useMemo(()=>({page:r,getPageMeta:s,getPageMetaStyle:c}),[r,s,c]);return o.jsx(wt.Provider,{value:a,children:e})}const he=f.forwardRef(({onClick:t,...e},n)=>{const[i,r]=f.useState(!1),s=f.useCallback(async c=>{try{r(!0),await(t==null?void 0:t(c))}finally{r(!1)}},[t]);return o.jsx(At.LoadingButton,{ref:n,...e,loading:e.loading||i,onClick:s})});function fe({tip:t,tipSucceed:e,title:n,titleSucceed:i,icon:r,iconSucceed:s,autoReset:c,placement:a="top",...l}){const[d,u]=f.useState(!1),[x,h]=f.useState(),p=f.useRef(),y=()=>{h(void 0),c&&(p.current=window.setTimeout(()=>{u(!1)},3e3))},w=()=>{clearTimeout(p.current)},g=d?s:r,k=x?o.jsx(m.Box,{color:"error",children:x.message}):d&&e||t,v=d?i:n;return o.jsx(m.Tooltip,{title:k,disableInteractive:!0,placement:a,onClose:y,onOpen:w,children:o.jsx("span",{children:o.jsx(he,{startIcon:g&&(typeof g=="string"?o.jsx(V.Icon,{icon:g}):g),loadingPosition:g?"start":void 0,...l,onClick:async B=>{if(l.onClick)try{await l.onClick(B),u(!0)}catch(N){h(N)}},children:v})})})}const ge=ft.default.lazy(()=>import("react-syntax-highlighter").then(t=>({default:t.Prism}))),ye=m.styled(t=>o.jsx(Qt.default,{...t,remarkPlugins:[Zt.default],components:{pre:be,code:({node:e,inline:n,className:i,children:r,...s})=>{if(!r)return null;const c=/language-(\w+)/.exec(i||"");return n?o.jsx(m.Box,{component:"code",className:i,...s,children:r}):o.jsx(m.Box,{component:ge,language:c==null?void 0:c[1],...s,sx:{borderRadius:1},children:String(r).replace(/\n$/,"")})},table:({className:e,children:n})=>o.jsx(m.Box,{sx:{overflow:"auto",my:1},children:o.jsx("table",{className:e,children:n})})}}))`
|
|
2
2
|
width: 100%;
|
|
3
3
|
overflow: hidden;
|
|
4
4
|
word-break: break-word;
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
`;function be({children:t}){const e=t==null?void 0:t.props;if(!(e!=null&&e.children))return null;const n=/language-(\w+)/.exec(e.className||""),i=n==null?void 0:n[1];return o.jsxs(
|
|
73
|
+
`;function be({children:t}){const e=t==null?void 0:t.props;if(!(e!=null&&e.children))return null;const n=/language-(\w+)/.exec(e.className||""),i=n==null?void 0:n[1];return o.jsxs(m.Box,{component:"div",sx:{fontSize:14,borderRadius:1,bgcolor:"rgb(245, 242, 240)","> pre":{mt:"0 !important"}},children:[o.jsxs(m.Stack,{direction:"row",alignItems:"center",p:.5,pl:1.5,borderBottom:1,borderColor:"grey.200",children:[o.jsx(m.Box,{children:i}),o.jsx(m.Box,{flex:1}),o.jsx(fe,{autoReset:!0,title:o.jsx(V.Icon,{icon:"tabler:copy"}),titleSucceed:o.jsx(V.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:n,align:i}){return t&&(t!=null&&t.length)?o.jsx(m.Box,{className:b.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",n),sx:{alignItems:"center"},children:t}):null}const we="section",je=m.styled(m.Box)`
|
|
74
74
|
overflow: hidden;
|
|
75
75
|
|
|
76
76
|
.section__title {
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
margin-bottom: 0.5rem;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
@media (min-width: ${({theme:t})=>t.breakpoints.values[
|
|
122
|
+
@media (min-width: ${({theme:t})=>t.breakpoints.values[we]}px) {
|
|
123
123
|
.section__tag {
|
|
124
124
|
margin-bottom: 32px;
|
|
125
125
|
}
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
margin-bottom: 40px;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
`;function z({title:t,description:e,descriptionMarkdown:n,actions:i,className:r="",classes:s={},prepend:c,append:a,level:l=2,tag:d,badge:
|
|
133
|
+
`;function z({title:t,description:e,descriptionMarkdown:n,actions:i,className:r="",classes:s={},prepend:c,append:a,level:l=2,tag:d,badge:u,center:x,logo:h,titleAppearance:p,descriptionAppearance:y,...w}){const g=pt.useColorConvert();if(!t&&!e&&!i&&!u&&!d&&!c&&!a&&!h)return null;const k=Math.max(Math.min(5,l+1),1),v={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"},B=l===0?"big":`h${k}`,N=l===0;return o.jsxs(je,{className:b.cx("base-info","lg:text-left",x&&"!text-center",r),...w,children:[c&&o.jsx("div",{children:c}),(d||u)&&o.jsx("div",{className:b.cx("section__tag",(s==null?void 0:s.tag)||(s==null?void 0:s.badge)),children:d||u}),h&&o.jsx("img",{className:"w-[120px] m-auto mb-8",src:h,alt:"info",loading:"lazy"}),t&&o.jsx(m.Typography,{sx:{whiteSpace:"pre-wrap",mb:e?"2vw":0,...(p==null?void 0:p.color)&&{color:`${g(p.color)} !important`}},className:b.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:B,children:t}),e&&(n?o.jsx(m.Box,{sx:{...(y==null?void 0:y.color)&&{color:`${g(y.color)} !important`}},component:ye,className:b.cx("section__description","text-gray-800","dark:text-gray-100",v[k],s.description,"page-kit-section__description"),children:e}):o.jsx(m.Typography,{sx:{whiteSpace:"pre-wrap",...(y==null?void 0:y.color)&&{color:`${g(y.color)} !important`}},className:b.cx("section__description","text-gray-800","dark:text-gray-100",v[k],s.description,"page-kit-section__description"),component:"div",variant:"body1",gutterBottom:!0,children:e})),o.jsx(R,{actions:i,center:x,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 jt(t){if(t.type===f.Fragment){const n=(t.props.children||[]).filter(i=>f.isValidElement(i));return n.length===1?jt(n[0]):n.length>1}return Array.isArray(t)}const I="&>*";function Q({children:t,col:e,gap:n,className:i,align:r,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),u={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=u[r]||u.center;let p=n??({2:6,3:4,4:4,5:3,6:3}[e]||0);jt(t)||(p=0);const w=(e-1)*p/e;let g={...s,gap:`${p}rem`};const k={[I]:{width:"100%"}},v={},B={},N={};switch(k.gap="1rem",v.gap=`${p/2}rem`,e){case 3:case 4:v[I]={width:`calc(50% - ${p/2}rem)`};break;case 5:case 6:k[I]={width:`calc(50% - ${p/2/2}rem)`},v[I]={width:`calc(50% - ${p/2/2}rem)`},B[I]={width:`calc(33.33% - ${p*2/3}rem)`};break}return g[I]={width:`calc(${d}% - ${w}rem)`},g[`@media (max-width: ${l.breakpoints.values.xl}px)`]=N,g[`@media (max-width: ${l.breakpoints.values.lg}px)`]=B,g[`@media (max-width: ${l.breakpoints.values.md}px)`]=v,g[`@media (max-width: ${l.breakpoints.values.sm}px)`]=k,c==="wall"&&(g={...s,gap:`${p}rem`},g[I]={width:`calc(${d}% - ${w}rem)`},k[I]={width:`calc(45% - ${p/2/2}rem)`},g[`@media (max-width: ${l.breakpoints.values.sm}px)`]=k),o.jsx(m.Box,{className:b.cx("flex flex-wrap flex-row h-full",x,i),sx:g,...a,children:t})}function ve(){const t=navigator.userAgent.toLowerCase();return t.includes("safari")&&!t.includes("chrome")}function ke(t=""){if(t.startsWith("data:image/svg+xml,"))return!0;const e=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,n=/^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;return e.test(t)||n.test(t)}function Y(t){return(t==null?void 0:t.endsWith(".mp4"))||(t==null?void 0:t.endsWith(".m4v"))||(t==null?void 0:t.endsWith(".webm"))}function _e(t){return t!=null&&t.endsWith(".mp4")||t!=null&&t.endsWith(".m4v")?"video/mp4":t!=null&&t.endsWith(".webm")?"video/webm":void 0}function $e(t){let e={};return typeof t=="string"?it.isGradient(t)?e.image=t:(e.image=j.getImageAbsoluteUrl(t),it.isColorString(t)&&(e.color=t,e.image="")):e=t,e}function Se(){const[t,e]=f.useState(Date.now());return f.useEffect(()=>{const n=()=>{e(Date.now())};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n)}},[]),t}function lt(t,e,n,i,r){let s=null;const{color:c="",image:a}=$e(e);return a&&ke(a)?(delete n.backgroundColor,!(t.mobile.apple.device||ve())&&Y(a)?s=o.jsx(m.Box,{component:"video",className:"section-bg",width:"100%",autoPlay:!0,loop:!0,muted:!0,controls:!1,playsInline:!0,poster:j.autoResizeImage(j.getImageAbsoluteUrl(i),1200,"quality"),src:Y(a)?a:j.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"}},r||a)):a?n.backgroundImage=`${a} !important`:c&&(n.backgroundColor=`${c} !important`),s}function Be({autoWidth:t,children:e,...n}){return t?o.jsx(m.Box,{display:"flex",...n,children:e}):o.jsx(m.Container,{...n,children:e})}function E({dark:t=!1,children:e,className:n,sx:i={},boxed:r={show:!1},padding:s="normal",boxProps:c,type:a,...l}){const d={...i},u=gt.default(p=>p.breakpoints.down("md"));t&&(d.color=at.default.common.white,d.backgroundColor=`${at.default.grey[900]} !important`),r.show&&(d.display="flex");const x=f.useMemo(()=>!Number(l.boxMaxWidth)||u?{width:"100%"}:a==="wall"&&l.boxMaxWidth?{maxWidth:`${l.boxMaxWidth}px !important`,width:"100%"}:{width:"100%"},[l.boxMaxWidth,u,a]),h=bt({type:"baseSectionPaddingY",value:s||"normal",defaultValue:""});return o.jsx(Ce,{component:"section",styles:{...d,...h},className:b.cx("base-section","px-2 md:px-5 lg:px-5 xl:px-10",n,{dark:t}),...C.default(l,"hoverStyle","boxMaxWidth","embedUrl","autoWidth","paddingXY","iframeHeight","titleAppearance","descriptionAppearance"),children:o.jsx(Be,{autoWidth:l==null?void 0:l.autoWidth,className:b.cx("section-content h-full"),sx:x,children:r.show?o.jsx(vt,{...c,boxed:r,children:e}):e})})}function vt({background:t="",backgroundVideoPoster:e,children:n,sx:i={},boxed:r={show:!1},className:s="",styles:c={},...a}){const l={...c,...i},d=pt.useColorConvert();let u=null;const x=gt.default(y=>y.breakpoints.up("sm")),h=te.default(),p=Se();return t&&(u=lt(h,typeof t=="string"?d(t):t,l,e,p)),r.show&&(l.borderRadius="10px",l.padding===void 0&&(l.padding=x?"50px":"20px"),r!=null&&r.border&&(l.border="1px solid #c0c0c0"),r!=null&&r.background&&(u=lt(h,typeof(r==null?void 0:r.background)=="string"?d(r==null?void 0:r.background):r==null?void 0:r.background,l,r==null?void 0:r.backgroundVideoPoster,p))),o.jsxs(m.Box,{...a,sx:{...l,...u?{position:"relative",overflow:"hidden",zIndex:0}:{}},className:b.cx(s,(r==null?void 0:r.boxShadow)&&"shadow-xl"),children:[u,n]})}const Ce=_.styled(vt)`
|
|
134
134
|
&:nth-of-type(even) {
|
|
135
135
|
background: #f8f8f8;
|
|
136
136
|
}
|
|
@@ -146,11 +146,11 @@
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
`;function Z({icon:t,...e}){return o.jsx(ht.Icon,{icon:t,...e,ref:null})}function S(t,e){const n=
|
|
149
|
+
`;function Z({icon:t,...e}){return o.jsx(ht.Icon,{icon:t,...e,ref:null})}function S(t,e){const n=X.default(t,e),i=C.default(t,e);return[n,i]}const kt=["title","description","actions","badge","tag","prepend","append","logo"];function Ne({image:t,imageBorder:e,imageShadow:n,className:i,reverse:r=!1,fullSizeImage:s,...c}){const[a,l]=S(c,q),d=Object.keys(a).length>0&&Object.values(X.default(a,kt)).filter(Boolean).length>0&&o.jsx(z,{...a}),u=f.isValidElement(t)?t:o.jsx(m.Box,{component:"img",src:t,alt:"",className:"block"}),x=["phone","macbook"].includes(e),h=t&&o.jsx(m.Box,{className:b.cx("section__image","m-auto, leading-[1] text-center",n&&"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":x?{width:"100%",video:{borderRadius:"0 !important"}}:void 0},children:x?o.jsx(ee.default,{type:e,sx:{width:"100%"},children:u}):u});return o.jsx(E,{className:b.cx("section--block",i,s&&!r&&b.css`
|
|
150
150
|
.section-bg {
|
|
151
151
|
height: 80%;
|
|
152
152
|
}
|
|
153
|
-
`),...l,boxProps:s?{sx:{padding:0,overflow:"hidden"}}:void 0,children:o.jsx(Q,{col:t?2:1,className:s?
|
|
153
|
+
`),...l,boxProps:s?{sx:{padding:0,overflow:"hidden"}}:void 0,children:o.jsx(Q,{col:t?2:1,className:s?b.css`
|
|
154
154
|
display: flex;
|
|
155
155
|
flex-direction: column;
|
|
156
156
|
|
|
@@ -163,15 +163,15 @@
|
|
|
163
163
|
width: 100%;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
`:void 0,children:r?o.jsxs(o.Fragment,{children:[h,d]}):o.jsxs(o.Fragment,{children:[d,h]})})})}const L=["editing","height","locale","dev","sx"];function
|
|
166
|
+
`:void 0,children:r?o.jsxs(o.Fragment,{children:[h,d]}):o.jsxs(o.Fragment,{children:[d,h]})})})}const L=["editing","height","locale","dev","sx"];function Ie(t){const{className:e,...n}=t;return o.jsx(Pe,{...n,className:b.cx("BlockBase-root",e)})}const Pe=_.styled(m.Box)`
|
|
167
167
|
position: relative;
|
|
168
|
-
`;function
|
|
168
|
+
`;function Re({widget:t,reverse:e,projectId:n,assistantId:i,working:r,submitTitle:s,submitIcon:c,submitColor:a,placeholder:l,loadingIndicator:d,section:u,...x}){const[{editing:h},p]=S(x,L),[y,w]=S(p,q),g=n&&i?{projectId:n,gitRef:"main",assistantId:i,working:!0}:void 0,k={children:s,endIcon:c?o.jsx(Z,{icon:c}):void 0,sx:{background:a||void 0,":hover":{background:a||void 0,opacity:.8}}},v=[],B=l&&o.jsx(m.Typography,{variant:"caption",color:"text.disabled",children:l}),N=d&&o.jsx(m.Typography,{variant:"caption",color:"text.disabled",children:d});Object.keys(y).length>0&&Object.values(X.default(y,kt)).filter(Boolean).length>0&&v.push(o.jsx(z,{...y},"base-info")),g&&(t==="form"?v.push(o.jsx(U.AIForm,{identifier:g,SubmitProps:k},"form")):t==="result"?v.push(o.jsx(U.AIFormResult,{identifier:g,placeholder:B,loadingIndicator:N},"result")):v.push(o.jsxs(m.Stack,{width:"100%",gap:2,direction:"row",children:[o.jsx(U.AIForm,{identifier:g,BoxProps:{flex:1},SubmitProps:k}),o.jsx(U.AIFormResult,{identifier:g,BoxProps:{flex:1},placeholder:B,loadingIndicator:N})]},"form-result"))),e&&v.reverse();const ot=m.useTheme(),St=f.useMemo(()=>m.createTheme(Wt.deepmerge(ot,{palette:{primary:a?{main:a}:void 0}})),[a,ot]);return o.jsx(qt.ErrorBoundary,{fallbackRender:j.ErrorView,children:o.jsx(m.ThemeProvider,{theme:St,children:o.jsx(E,{...w,sx:h?{pointerEvents:"none"}:{},children:o.jsx(Q,{col:v.length,children:v})})})})}const _t=f.createContext({pages:[],project:void 0}),{Provider:Te,Consumer:Po}=_t;function $t(){return f.useContext(_t)}function We({icon:t,className:e="",size:n="1rem",...i}){return o.jsx(ze,{component:Z,className:b.cx("css-icon",e),size:n,...i,icon:t})}const ze=_.styled(m.Box)`
|
|
169
169
|
&.css-icon {
|
|
170
170
|
display: inline-block;
|
|
171
171
|
width: ${({size:t})=>t};
|
|
172
172
|
height: ${({size:t})=>t};
|
|
173
173
|
}
|
|
174
|
-
`;function
|
|
174
|
+
`;function qe({icon:t,className:e="",size:n="1rem",imageMeta:i,...r}){const s=j.autoResizeImage(j.getImageAbsoluteUrl(t),540),[c,a]=f.useState(!1),l=_.useTheme();return c?o.jsx(We,{icon:"i-mdi:image",color:l.palette.grey[500],size:n,className:e,...r}):o.jsx(Ee,{className:b.cx("image-icon",e),size:n,...r,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 Ee=_.styled(m.Box)`
|
|
175
175
|
display: inline-block;
|
|
176
176
|
width: ${({size:t})=>t};
|
|
177
177
|
height: ${({size:t})=>t};
|
|
@@ -180,9 +180,9 @@
|
|
|
180
180
|
height: 100%;
|
|
181
181
|
width: 100%;
|
|
182
182
|
}
|
|
183
|
-
`,tt=t=>typeof t=="string"&&/^[\w-_]+:[\w-_]+$/.test(t);function
|
|
183
|
+
`,tt=t=>typeof t=="string"&&/^[\w-_]+:[\w-_]+$/.test(t);function J({icon:t,size:e="1rem",imageMeta:n,...i}){const r=window.isNaN(e)?e:`${e}px`;return tt(t)?o.jsx(ht.Icon,{icon:t}):o.jsx(Le,{component:qe,imageMeta:n,className:"base-icon",icon:t,size:r,...i})}const Le=_.styled(m.Box)`
|
|
184
184
|
flex-shrink: 0;
|
|
185
|
-
`;function W({text:t,children:e,icon:n="",endIcon:i,color:r="primary",link:s="",href:c="",...a}){const l=n?o.jsx(
|
|
185
|
+
`;function W({text:t,children:e,icon:n="",endIcon:i,color:r="primary",link:s="",href:c="",...a}){const l=n?o.jsx(J,{icon:n}):null,d=i?o.jsx(J,{icon:i}):null,u=s||c,x={...a};return u&&(x.href=u,H.default(u)&&(x.target=x.target||"_blank")),o.jsx(oe.default,{startIcon:l,endIcon:d,color:r,...x,children:t||e})}function et({editing:t,text:e,...n}){const{pages:i=[]}=$t(),r=i.find(s=>s.id===(n.link||n.linkId));if(t)return o.jsx(W,{...C.default(n,["link","linkId"]),children:e});if(r){const s=r.path||"/";return o.jsx(K.Link,{to:s,children:o.jsx(W,{...C.default(n,["link","linkId"]),children:e})})}return o.jsx(W,{...C.default(n,"linkId"),children:e})}function P({type:t="",icon:e="",size:n="3rem",className:i="",...r}){return o.jsx(J,{icon:e||t,size:n,className:b.cx("content-icon",i),...r})}P.propTypes={};P.defaultProps={type:"",icon:"",size:"3rem",color:"inherit",className:""};function Ae({to:t,base:e,children:n,className:i,activeClassName:r="active",target:s="auto",autoExternalMark:c=!1,useRouterLink:a,...l}){const{pages:d=[],locale:u=""}={},x=e?F.join("/",e):e||"";let h=s==="auto"?"_self":s,p=F.join(x,t);const y=c?H.default(p):!1;if(e)return p=F.join(x,u,t),o.jsx("a",{className:`no-underline ${i}`,href:T.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:n});if(H.default(t))s==="auto"&&(h="_blank"),p=t;else{T.isRelative(p)&&(p=F.join(window.location.pathname,p));const w=T.parseURL(`${window.location.origin}${p}`),g=d.some(k=>k.pathname===w.pathname);if(a||g)return o.jsx(K.NavLink,{end:!0,to:T.withoutTrailingSlash(p),className:({isActive:k})=>b.cx(i,k?r:""),...l,children:n})}return o.jsxs("a",{className:`no-underline ${i}`,href:T.withoutTrailingSlash(p),rel:"noreferrer noopener",target:h,...l,children:[n,y&&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:n,className:i="",dark:r=!1,border:s=!0,...c}){let a={};const{pages:l=[]}=$t(),d=l.find(h=>h.id===c.link),u=!n||ft.default.Children.toArray(n).every(h=>h===null);c.link&&(a={component:Ae,to:(d==null?void 0:d.path)||c.link,useRouterLink:!0});const x=r&&s;return o.jsxs(Oe,{className:b.cx("base-card card",{"border-gray-200":s},{"dark:border-gray-500":x},{dark:r,"border-transparent":!s},i),...a,...C.default(c,["listType","dark","iconColor","link","hoverStyle","imageSize"]),children:[t,!u&&o.jsx("div",{className:"card__body",children:n}),e]})}const Oe=_.styled(m.Box)`
|
|
186
186
|
&.base-card {
|
|
187
187
|
text-align: left;
|
|
188
188
|
border-width: 1px;
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
.card__body {
|
|
198
198
|
padding: 15px 15px;
|
|
199
199
|
}
|
|
200
|
-
`;function
|
|
200
|
+
`;function O({align:t="left",title:e,titleProps:n={},description:i,descriptionProps:r={}}){return o.jsxs(o.Fragment,{children:[e&&o.jsx(m.Typography,{className:b.cx("card__title text-gray-800","dark:text-gray-50"),component:"h5",variant:"h5",gutterBottom:!0,align:t,...n,children:e}),i&&o.jsx(m.Typography,{className:b.cx("card__description","text-gray-500","dark:text-gray-400"),component:"div",variant:"body1",gutterBottom:!0,align:t,...r,children:i})]})}function Ue({image:t,title:e,description:n,imageProps:i={},imageMeta:r,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...u}){const x=tt(t),h=j.autoResizeImage(j.getImageAbsoluteUrl(t),540);return o.jsxs(Fe,{className:"card-article",...u,prepend:o.jsx("div",{className:"card__image__wrap",children:x&&t?o.jsx(m.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||(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:[e||n?o.jsx(O,{align:d,title:e,titleProps:c,description:n,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:d,actions:l,className:"mt-4"}):null]})}const Fe=_.styled(A)`
|
|
201
201
|
${t=>t.hoverStyle==="none"?"":t.link?`transition: box-shadow ease .3s;
|
|
202
202
|
&:hover {
|
|
203
203
|
box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
height: 100%;
|
|
219
219
|
object-position: top center;
|
|
220
220
|
}
|
|
221
|
-
`,ct="section";function dt({title:t,image:e,imageMeta:n,description:i,actions:r,align:s,listType:c="",className:a="",...l}){return o.jsxs(
|
|
221
|
+
`,ct="section";function dt({title:t,image:e,imageMeta:n,description:i,actions:r,align:s,listType:c="",className:a="",...l}){return o.jsxs(Me,{className:b.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:n}),t||i?o.jsx(O,{align:s,title:t,description:i}):null,r!=null&&r.length?o.jsx(R,{align:s,actions:r,className:"mt-4"}):null]})}const Me=_.styled(A)`
|
|
222
222
|
padding: 5vw 4vw;
|
|
223
223
|
box-sizing: border-box;
|
|
224
224
|
/* min-height: 320px; */
|
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
text-align: left;
|
|
276
276
|
box-sizing: border-box;
|
|
277
277
|
}
|
|
278
|
-
`;function De({image:t,title:e,description:n,imageProps:i={},imageMeta:r,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...
|
|
278
|
+
`;function De({image:t,title:e,description:n,imageProps:i={},imageMeta:r,imageSize:s,titleProps:c={},descriptionProps:a={},actions:l,align:d,...u}){const x=tt(t),h=j.autoResizeImage(j.getImageAbsoluteUrl(t),540);return o.jsxs(Ve,{className:"card-article",...u,prepend:o.jsx("div",{className:"card__image__wrap",children:x&&t?o.jsx(m.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(m.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:[e||n?o.jsx(O,{align:d,title:e,titleProps:c,description:n,descriptionProps:a}):null,l!=null&&l.length?o.jsx(R,{align:d,actions:l,className:"mt-4"}):null]})}const Ve=_.styled(A)`
|
|
279
279
|
${t=>t.hoverStyle==="none"?"":t.link?`transition: box-shadow ease .3s;
|
|
280
280
|
&:hover {
|
|
281
281
|
box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
|
|
@@ -299,7 +299,7 @@
|
|
|
299
299
|
.card__image {
|
|
300
300
|
max-height: 60px;
|
|
301
301
|
}
|
|
302
|
-
`,ut="section";function He({title:t,image:e,imageMeta:n,iconSize:i=100,description:r,actions:s,align:c,className:a="",...l}){return o.jsx(
|
|
302
|
+
`,ut="section";function He({title:t,image:e,imageMeta:n,iconSize:i=100,description:r,actions:s,align:c,className:a="",...l}){return o.jsx(Ye,{className:b.cx("card",a),...l,children:o.jsxs(m.Box,{className:"flex items-center",children:[e&&o.jsx(P,{icon:e,color:"primary.main",size:i,imageMeta:n}),o.jsxs(m.Box,{className:"flex-1 ml-4",children:[o.jsx(O,{align:c,title:t,description:r}),o.jsx(R,{align:c,actions:s,className:"mt-4"})]})]})})}const Ye=_.styled(A)`
|
|
303
303
|
padding: 5vw 4vw;
|
|
304
304
|
text-align: left;
|
|
305
305
|
box-sizing: border-box;
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
text-align: left;
|
|
356
356
|
box-sizing: border-box;
|
|
357
357
|
}
|
|
358
|
-
`;function
|
|
358
|
+
`;function Je({title:t,titleProps:e={},description:n,descriptionProps:i={},image:r,imageMeta:s,className:c="",align:a,hoverStyle:l,...d}){return o.jsxs(Ge,{className:b.cx("card-simple",c,`hover-style__${l}`),align:a,...d,children:[r&&o.jsx(P,{icon:r,color:"primary.main",imageMeta:s}),t||n?o.jsx(O,{align:a,title:t,titleProps:e,description:n,descriptionProps:i}):null]})}const Ge=_.styled(A)`
|
|
359
359
|
${({dark:t,theme:e})=>`background-color:${t?e.palette.grey[900]:e.palette.common.white};`}
|
|
360
360
|
|
|
361
361
|
&.hover-style__default {
|
|
@@ -440,7 +440,7 @@
|
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
`;function
|
|
443
|
+
`;function Ke({type:t="default",...e}){const i={article:Ue,simple:Je,news:He,default:dt,wall:De}[t]||dt;return o.jsx(i,{...t==="news"?e:C.default(e,"iconSize")})}function Xe({list:t=[],align:e="top",cards:n,listBorder:i=!0,listType:r="",col:s=3,gap:c,iconColor:a,className:l="",type:d="default",dark:u=!1,textAlign:x="left",hoverStyle:h,...p}){return o.jsx(Q,{type:d,className:b.cx("card-list py-1",l,"items-stretch"),col:s,gap:c,align:e,...p,children:n||t.map(y=>o.jsx(Ke,{borderColor:i,iconColor:a,type:d,listType:r,dark:u,...y,align:x,sx:{bgcolor:d==="wall"?void 0:u?"grey.900":"common.white"},style:c===0&&t.length>1?{borderRadius:0,marginRight:"-1px",marginBottom:"-1px"}:{}},y.id))})}const Qe=["align","cards","list","listBorder","listType","col","gap","iconColor","type","textAlign"],Ze=_.styled(E)`
|
|
444
444
|
a .card {
|
|
445
445
|
color: #404040;
|
|
446
446
|
cursor: pointer;
|
|
@@ -455,7 +455,7 @@
|
|
|
455
455
|
a:hover .card {
|
|
456
456
|
color: #404040;
|
|
457
457
|
}
|
|
458
|
-
`;function
|
|
458
|
+
`;function to({className:t,...e}){const[n,i]=S(e,q),[r,s]=S(i,Qe);return o.jsxs(Ze,{className:b.cx("section--card-list",t),type:e.type,...s,children:[Object.keys(n).length>0&&o.jsx(z,{center:!0,...n,className:"mb-[2.5vw]"}),o.jsx(Xe,{...r,dark:!!e.dark})]})}const eo=_.styled(to)`
|
|
459
459
|
.card__description {
|
|
460
460
|
white-space: pre-wrap;
|
|
461
461
|
}
|
|
@@ -470,21 +470,21 @@
|
|
|
470
470
|
.card-simple .card__body::after {
|
|
471
471
|
background: inherit !important;
|
|
472
472
|
}
|
|
473
|
-
`;function
|
|
473
|
+
`;function oo({section:t,...e}){const[{editing:n},i]=S(e,L),r=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(et,{...d,editing:n},d.id)),border:i.listBorder,iconSize:i.iconSize,imageSize:i.imageSize,hoverStyle:i.hoverStyle}})}},[i]);return o.jsx(eo,{style:n?{pointerEvents:"none"}:{},...r})}function no({properties:t,section:e,locale:n,dev:i}){var r;return(r=e==null?void 0:e.config)!=null&&r.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:n,properties:t,dev:i}):o.jsx(m.Box,{textAlign:"center",py:2,children:o.jsx(m.Typography,{variant:"caption",color:"text.secondary",children:"Please select component to render"})})}function ro({src:t,dataId:e,isEdit:n=!1,height:i="100%",onLoad:r=()=>{}}){return o.jsx(Kt.EmbedIframe,{isEdit:n,embedId:e,src:t,height:i,onLoad:()=>{r()}})}function io({dataId:t,src:e,actions:n,center:i,onLoad:r,...s}){const[c,a]=S(s,q);return o.jsxs(E,{...a,children:[Object.keys(c).length>0&&o.jsx(z,{center:i,...c}),o.jsx(ro,{dataId:t,src:e,onLoad:r,height:s.iframeHeight?`${s.iframeHeight}px`:"100%"}),o.jsx(R,{actions:n,center:i})]})}const so={src:"",embedUrl:"",title:"",description:"",dark:!1,background:"",center:!0,config:{},id:""};function ao({section:t,id:e,src:n,...i}){const r=`${e}-${i.locale}`,[{editing:s},c]=S(i,L),a=f.useRef({}),l=JSON.parse(JSON.stringify(c)),{message:d}=Yt.useMessage(r,"server"),u=Jt.useLatest(JSON.parse(JSON.stringify(c.config)||"{}"));return f.useEffect(()=>{d&&d.onInit(()=>u.current)},[d]),f.useEffect(()=>{const x=JSON.parse(JSON.stringify(c.config)||"{}");ne.default(a.current,x)||(a.current=x,d==null||d.send("config-set",x))},[d,c.config]),n?o.jsx(io,{...l,dataId:r,src:n,style:s?{pointerEvents:"none"}:{}}):o.jsx(lo,{children:'Please set the "src" attribute for this block'})}const lo=_.styled("div")`
|
|
474
474
|
user-select: none;
|
|
475
475
|
color: #999;
|
|
476
476
|
padding: 8px;
|
|
477
477
|
height: 200px;
|
|
478
|
-
`,
|
|
478
|
+
`,co=[/youtu\.be\/([^#&?]{11})/,/\?v=([^#&?]{11})/,/&v=([^#&?]{11})/,/embed\/([^#&?]{11})/,/\/v\/([^#&?]{11})/];function uo(t){var e;if(/youtu\.?be/.test(t))for(const n of co){const i=(e=n.exec(t))==null?void 0:e[1];if(i)return i}}function mo(t){const e=uo(t);if(e)return`https://youtube.com/embed/${e}`}function xo({src:t}){return f.useEffect(()=>{import("@lottiefiles/lottie-player")},[]),o.jsx("lottie-player",{autoplay:!0,loop:!0,mode:"normal",src:t})}function po(t){return o.jsx(m.Box,{maxHeight:400,overflow:"hidden auto",children:o.jsx(Xt.TwitterTimelineEmbed,{...t})})}function ho({url:t}){const e=f.useRef(null),n=495,[i,r]=f.useState(e.current?e.current.offsetWidth*.5625:n),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:n;return r(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:n;return r(Math.floor(a*c)),function(){window.removeEventListener("resize",s)}},[i,s]),o.jsx(m.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 fo={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},go=_.styled(Ne)`
|
|
479
479
|
.section__description {
|
|
480
480
|
}
|
|
481
|
-
`;function
|
|
481
|
+
`;function yo({hasImage:t,fullSizeImage:e,boxed:n,videoPoster:i,imageMeta:r,imageOptimization:s,imageSize:c,section:a,...l}){var p,y;const[{editing:d},u]=S({...l,boxed:e?void 0:n},L);let x=bo(u.image,i,e,r,s,c);t||(x=null);let h=null;return u.actions&&(h=(y=(p=u.actions)==null?void 0:p.map)==null?void 0:y.call(p,(w,g)=>o.jsx(et,{...w,editing:d},g))),o.jsx(go,{...u,style:d?{pointerEvents:"none"}:{},image:x,fullSizeImage:t&&e,actions:h})}function bo(t,e,n,i,r,s){if(t){if(t.endsWith(".json"))return o.jsx(xo,{src:t});if(t.indexOf("twitter.com")!==-1)return o.jsx(po,{sourceType:"url",url:t});const c=mo(t);if(c)return o.jsx(ho,{url:c});const{naturalWidth:a,naturalHeight:l,filename:d}=i||{};if(Y(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:j.autoResizeImage(j.getImageAbsoluteUrl(e),n?1200:540,r),children:o.jsx("source",{src:j.getImageAbsoluteUrl(t),type:_e(t)})},t);const u=r==="quality"?1:.6;return o.jsx(G.ResponsiveImage,{src:j.getImageAbsoluteUrl(t),sizesAttr:{sm:600*u,md:450*u,lg:540*u,...n&&{md:900*u,lg:1200*u}},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 wo=["production","draft"];function jo({mode:t,version:e}={}){const n=e&&typeof e=="number"?{mode:t,version:e}:{mode:t};return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages`,{params:n}).then(i=>i.data)}function vo({mode:t,pages:e}){return j.api.post(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/publish`,{mode:t,pages:e}).then(n=>n.data)}function ko({locale:t,sort:e,page:n,limit:i,mode:r}={}){return j.api.get(`/api/${j.getProjectIdFromPathnameOrWindow()}/pages/toc`,{params:{locale:t,sort:e,page:n,limit:i,mode:r}}).then(s=>s.data)}const _o={style:"list",sort:"-updatedAt"},mt=20;function $o({style:t,sort:e,section:n,...i}){const[{editing:r,locale:s},c]=S(i,L),[a,l]=S(c,q),[d,u]=f.useState(),x=f.useRef(!1),h=st.useUpdate(),p=K.useNavigate(),y=f.useCallback(async()=>{if(!x.current){x.current=!0,h();try{const w=d?Math.floor(d.list.length/mt)+1:1,{list:g,total:k}=await ko({locale:s,sort:e,page:w,limit:mt});u(v=>({list:((v==null?void 0:v.list)??[]).concat(g),total:k}))}finally{x.current=!1,h()}}},[d,s,e,h]);return st.useMount(()=>{y()}),o.jsxs(E,{...l,sx:r?{pointerEvents:"none"}:{},children:[Object.keys(a).length>0&&o.jsx(z,{...a}),d?o.jsxs(o.Fragment,{children:[o.jsx(m.Grid,{container:!0,spacing:2,justifyContent:"center",children:d==null?void 0:d.list.map(w=>o.jsx(m.Grid,{item:!0,xs:12,sm:t==="card"?6:12,md:t==="card"?3:12,children:o.jsxs(So,{elevation:0,className:b.cx(t==="card"&&"style-card"),onClick:r?void 0:()=>p(w.slug),children:[!!w.image&&o.jsx(m.CardMedia,{component:"img",alt:"",image:j.autoResizeImage(j.getImageAbsoluteUrl(w.image),540),loading:"lazy"}),o.jsxs(m.CardContent,{children:[o.jsx(m.Typography,{variant:"h6",component:"div",className:xt,children:w.title||w.id}),o.jsx(m.Typography,{variant:"body2",className:xt,children:w.description})]})]})},w.id))}),o.jsx(m.Box,{textAlign:"center",mt:2,children:d.total>d.list.length?o.jsx(W,{variant:"outlined",color:"secondary",onClick:y,loading:x.current,children:"More"}):o.jsx(W,{variant:"outlined",color:"secondary",disabled:!0,children:"No More"})})]}):o.jsx(m.Box,{p:2,textAlign:"center",children:o.jsx(m.CircularProgress,{size:24})})]})}const xt=b.css`
|
|
482
482
|
display: -webkit-box;
|
|
483
483
|
-webkit-box-orient: vertical;
|
|
484
484
|
-webkit-line-clamp: 2;
|
|
485
485
|
overflow: hidden;
|
|
486
486
|
text-overflow: ellipsis;
|
|
487
|
-
|
|
487
|
+
`,So=_.styled(m.Card)`
|
|
488
488
|
border: 1px solid #e0e0e0;
|
|
489
489
|
background-color: transparent;
|
|
490
490
|
cursor: pointer;
|
|
@@ -504,4 +504,4 @@
|
|
|
504
504
|
max-height: 50vw;
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
`,
|
|
507
|
+
`,Bo={iframe:ao,section:yo,"section-card-list":oo,toc:$o,"ai-runtime":Re,"custom-component":no};function Co({id:t,type:e,mode:n,config:i,section:r,...s}){const c=Bo[e],{getPageMetaStyle:a}=xe(),l=f.useMemo(()=>{const{height:x,...h}=i;return h},[i]),d=f.useMemo(()=>{const x={};return e!=="custom-component"&&(x.height=i.height),x.sx=a("sx"),x},[i.height,e,a]),u=c&&o.jsx(c,{mode:n,...l,id:t,section:r});return o.jsx(Ie,{...s,...d,children:u})}function No(t){return t!=null}exports.Action=et;exports.BlockRenderer=Co;exports.IFrameBlockDefaultProps=so;exports.Icon=Z;exports.PageProvider=pe;exports.Provider=Te;exports.STATE_MODES=wo;exports.SectionBlockDefaultProps=fo;exports.TocDefaultProps=_o;exports.getPages=jo;exports.nonNullable=No;exports.publishPages=vo;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime");require("@arcblock/ux/lib/Locale/context");const S=require("@arcblock/ux/lib/Theme");require("@blocklet/pages-kit/builtin/color-picker");require("@emotion/css");const n=require("@mui/material");require("ahooks");require("lodash/without");const a=require("react"),e=require("@mui/material/colors"),l=require("@blocklet/pages-kit/builtin/uploader"),z=require("@iconify-icon/react"),v=require("react-use"),q=require("./state-DDwYX2mu.js");e.red[300],e.pink[300],e.purple[300],e.indigo[300],e.blue[300],e.cyan[300],e.teal[300],e.green[300],e.lime[300],e.yellow[300],e.amber[300],e.orange[300],e.brown[300],e.grey[300],e.blueGrey[300];const w=a.forwardRef(function({showMarkdown:y,markdown:h,onMarkdownChange:u,showUploader:I,value:c,meta:P,onChange:s,...m},j){const[i,d]=a.useState("");a.useEffect(()=>{d(c||"")},[c,d]);const f=async()=>{if(i!==c){const t=q.getImageAbsoluteUrl(i);if(!t){s(i,void 0);return}const o=await l.getImageSize(t).catch(()=>l.getVideoSize(t)).catch(()=>{});s(i,{...o,filename:i})}};v.useDebounce(()=>{i!==c&&s(i)},300,[i]),a.useImperativeHandle(j,()=>({submit:f}));const b={};return I&&(b.InputProps={sx:{pr:0},endAdornment:r.jsx(n.InputAdornment,{position:"end",sx:{mx:.5},children:r.jsx(l.UploaderButton,{onChange:async({response:t})=>{var p;const o=(p=t==null?void 0:t.data)==null?void 0:p.filename,g=q.getImageAbsoluteUrl(o)||"";let x={};g&&(x=await l.getImageSize(g).catch(()=>l.getVideoSize(g)).catch(()=>{})),s(o,{...x,filename:o})}})})}),r.jsx(n.TextField,{size:"small",fullWidth:!0,...m,label:r.jsxs(n.Stack,{direction:"row",spacing:1,alignItems:"center",children:[m.label,y&&r.jsxs(r.Fragment,{children:[" (",r.jsx(n.FormControlLabel,{checked:h,label:r.jsx(n.Box,{component:z.Icon,icon:"tabler:markdown",sx:{verticalAlign:"middle"}}),labelPlacement:"start",control:r.jsx(n.Switch,{size:"small"}),sx:{ml:.25,pr:1},onChange:(t,o)=>u==null?void 0:u(o)}),")"]})]}),InputLabelProps:{shrink:!0,...m.InputLabelProps},value:i,onChange:t=>d(t.target.value),...b,onKeyDown:t=>{t.keyCode!==229&&t.key==="Enter"&&f()}})});S.styled(n.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.ConfigString=w;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),t=require("./state-DDwYX2mu.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,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),k=require("./state-
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),k=require("./state-DDwYX2mu.js"),C=require("lodash"),X=require("@arcblock/ux/lib/Locale/context"),re=require("@arcblock/ux/lib/Result"),ie=require("@blocklet/pages-kit/builtin/page/header"),ce=require("@blocklet/pages-kit/contexts/color"),le=require("@blocklet/ui-react/lib/Header"),Y=require("@emotion/css"),T=require("@emotion/react"),ae=require("@emotion/styled"),y=require("@mui/material"),ue=require("ahooks"),de=require("isomorphic-dompurify"),fe=require("lodash/cloneDeep"),me=require("lodash/isEmpty"),ge=require("lodash/isEqual"),x=require("react"),pe=require("react-helmet"),w=require("react-router-dom"),H=require("react-use"),E=require("ufo"),P=require("./array-CnXbKOG_.js"),N=require("@arcblock/ux/lib/Theme"),he=require("@blocklet/ui-react/lib/Footer"),xe=require("webfontloader"),je=require("@arcblock/did-connect/lib/Session"),v=e=>e&&e.__esModule?e:{default:e},F=v(re),be=v(le),Z=v(ae),ye=v(de),J=v(fe),ve=v(me),we=v(ge),Se=v(he),ke=v(xe);function Pe(e,s,o,r){e.locales||(e.locales={}),e.locales[o]=C.cloneDeep(e.locales[o]||{}),e.locales[o].title=r.title??e.locales[o].title,e.locales[o].image=r.image??e.locales[o].image,e.locales[o].description=r.description??e.locales[o].description,Object.entries(r.sectionsData).forEach(([c,n])=>{var l,m,j,d;const i=Object.values(e.sections).find(a=>a.id===c||a.name===c);if(i&&i.isTemplateSection)if(i.locales=C.cloneDeep(i.locales||{}),i.locales[o]=C.cloneDeep(i.locales[o]||{}),i.component==="custom-component"){const a=(l=i.config)==null?void 0:l.componentId;if(!a)return;const g=((m=s.components[a])==null?void 0:m.data)||((d=(j=s.resources.components)==null?void 0:j[a])==null?void 0:d.component);if(!g)return;i.locales[o].properties=C.cloneDeep(i.locales[o].properties||{}),Object.entries(n||{}).forEach(([p,u])=>{var h,_;const f=((h=g==null?void 0:g.properties)==null?void 0:h[p])||Object.values((g==null?void 0:g.properties)||{}).find(M=>{var q;return((q=M.data)==null?void 0:q.key)===p});f&&(i.locales[o].properties[(_=f.data)==null?void 0:_.id]={value:u})})}else i.locales[o]={...C.cloneDeep(i.locales[o]),...n||{}}})}const _e=N.styled(Se.default,{shouldForwardProp:e=>!!e})`
|
|
2
2
|
& > div > .MuiContainer-root {
|
|
3
3
|
max-width: unset;
|
|
4
4
|
}
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
font-family: ${JSON.stringify(s??r)}, ${O};
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
`})}const{SessionProvider:De,SessionContext:Ie,SessionConsumer:$e,withSession:Ve}=je.createAuthServiceSessionContext();function A(){return x.useContext(Ie)}function Te(...e){var o;const{session:s}=A();return e.includes((o=s.user)==null?void 0:o.role)}function Be(...e){var r;const{session:s}=A(),o=Te(...e);return((r=window.blocklet)==null?void 0:r.tenantMode)==="multiple"?!!s.user:o}function Oe(){const[e]=w.useSearchParams(),{session:s}=A(),o=Be("owner","admin","pagesEditor","member"),r=x.useMemo(()=>{const n=e.get("mode");return P.STATE_MODES.includes(n)?n:"production"},[e]),c=r==="production"?r:s.user?o?r:"production":null;return c?t.jsx(ee,{mode:c}):null}function ee({mode:e}){if(e!=="draft"){const s=window.__PAGE_STATE__;return s?t.jsx(I,{mode:e,state:s}):t.jsx(Ne,{mode:e,children:({state:o})=>t.jsx(I,{mode:e,state:o})})}return t.jsx(He,{children:({state:s})=>t.jsx(I,{mode:e,state:s})})}const He=x.lazy(()=>Promise.resolve().then(()=>require("./draft-data-
|
|
29
|
+
`})}const{SessionProvider:De,SessionContext:Ie,SessionConsumer:$e,withSession:Ve}=je.createAuthServiceSessionContext();function A(){return x.useContext(Ie)}function Te(...e){var o;const{session:s}=A();return e.includes((o=s.user)==null?void 0:o.role)}function Be(...e){var r;const{session:s}=A(),o=Te(...e);return((r=window.blocklet)==null?void 0:r.tenantMode)==="multiple"?!!s.user:o}function Oe(){const[e]=w.useSearchParams(),{session:s}=A(),o=Be("owner","admin","pagesEditor","member"),r=x.useMemo(()=>{const n=e.get("mode");return P.STATE_MODES.includes(n)?n:"production"},[e]),c=r==="production"?r:s.user?o?r:"production":null;return c?t.jsx(ee,{mode:c}):null}function ee({mode:e}){if(e!=="draft"){const s=window.__PAGE_STATE__;return s?t.jsx(I,{mode:e,state:s}):t.jsx(Ne,{mode:e,children:({state:o})=>t.jsx(I,{mode:e,state:o})})}return t.jsx(He,{children:({state:s})=>t.jsx(I,{mode:e,state:s})})}const He=x.lazy(()=>Promise.resolve().then(()=>require("./draft-data-DPTVTTlh.js")));function Ne({mode:e,children:s}){const o=document.querySelector('meta[property="pages:version"]'),r=o==null?void 0:o.content,c=k.useProjectId(),n=x.useMemo(()=>{if(r==="{{pagesPublishedAt}}"){const m=localStorage.getItem(k.getProjectPageVersionKey(c??""));return Number(m)?Number(m):new Date().getTime()}return Number(r)},[r]),{loading:i,value:l}=H.useAsync(()=>P.getPages({mode:e,version:n}),[e,n]);return i?t.jsx(K,{}):l?s({state:l}):null}function I({mode:e,state:s}){const{t:o,locale:r}=X.useLocaleContext(),{pageIds:c,pages:n,supportedLocales:i,config:{defaultLocale:l},resources:m}=s,j=k.getAllComponents(s),d=x.useMemo(()=>i!=null&&i.some(u=>u.locale===r)?r:void 0,[r,i]),a=Object.values(n).find(u=>(u==null?void 0:u.slug)==="/")?void 0:Object.values(n)[0],g=x.useMemo(()=>c.map(u=>{const f=n[u];return f&&{id:f.id,path:E.joinURL("/",d||"",f.slug,e!=="production"?`?mode=${e}`:"")}}).filter(P.nonNullable),[c,n,d,e]),p=([...u])=>(e!=="production"&&u.unshift(t.jsx(x.Suspense,{fallback:t.jsx("div",{}),children:t.jsx(Le,{mode:"production",state:s})})),u);return t.jsxs(P.Provider,{value:{pages:g},children:[t.jsxs(w.Routes,{children:[a&&t.jsx(w.Route,{index:!0,element:t.jsx(w.Navigate,{to:E.joinURL("/",d||"",a.slug)})}),c.map(u=>{const f=n[u];return f?t.jsx(w.Route,{path:E.joinURL(":projectIdOrSlug?",f.slug),element:t.jsx(B,{mode:e,components:j,page:f,locale:d,defaultLocale:l,headerAddons:p})},f.id):null}),m.pages&&Object.values(m.pages).map(({blockletId:u,page:f})=>t.jsx(w.Route,{path:E.joinURL("/",`@${u}`,f.slug),element:t.jsx(B,{mode:e,components:j,page:f,locale:d,defaultLocale:l,headerAddons:p})},f.id)),t.jsx(w.Route,{path:"*",element:t.jsx(y.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:t.jsx(F.default,{status:404,extra:t.jsx(ne,{href:"/",children:o("common.back")})})})})]}),e!=="production"&&t.jsx(Re,{sx:{bgcolor:"info.light"},children:e}),t.jsx(Ee,{})]})}function Ae({mode:e,state:s,path:o,pageData:r}){const{t:c,locale:n}=X.useLocaleContext(),{pages:i,supportedLocales:l,config:{defaultLocale:m},resources:j}=s,d=Object.values(i).find(h=>(h==null?void 0:h.slug)===o),a=Object.values(j.pages||{}).find(h=>h.page.slug===o),g=x.useMemo(()=>l!=null&&l.some(h=>h.locale===n)?n:void 0,[n,l]),p=ue.useReactive({page:null});x.useEffect(()=>{const h=d||(a==null?void 0:a.page)||null;h?p.page=J.default(h):p.page=null},[d,a]);const u=x.useRef();if(x.useEffect(()=>{we.default(r,u.current)||r&&p.page&&(Pe(p.page,s,g,r),u.current=J.default(r))},[{}]),!d&&!(a!=null&&a.page))return t.jsx(y.Box,{width:"100vw",height:"100vh",display:"flex",justifyContent:"center",alignItems:"center",children:t.jsx(F.default,{style:{background:"inherit"},status:404,extra:t.jsx(ne,{href:"/",children:c("common.back")})})});const f=k.getAllComponents(s);return p.page?t.jsx(B,{mode:e,components:f,page:p.page,locale:g,defaultLocale:m}):null}function B({mode:e,components:s,page:o,locale:r,defaultLocale:c,headerAddons:n}){var _,M,q,L,U,D,$,V,z;const i=ce.useColorConvert(),l=((_=o.locales)==null?void 0:_[r])??((M=o.locales)==null?void 0:M[c])??{},m=l.title||((q=window.blocklet)==null?void 0:q.appName),j=l.description||((L=window.blocklet)==null?void 0:L.appDescription),d=k.autoResizeImage(k.getImageAbsoluteUrl(l.image),540),{logo:a,brand:g,description:p,...u}=ie.useHeaderState(),f=x.useMemo(()=>S=>{var R;let b=(n==null?void 0:n(S))??S;return b=((R=u.addons)==null?void 0:R.call(u,b))??b,b},[u.addons,n]),h=(U=l.header)!=null&&U.translucent?oe:te;return t.jsxs(P.PageProvider,{page:o,defaultLocale:c,currentLocale:r,children:[!!l.backgroundColor&&t.jsx(T.Global,{styles:T.css`
|
|
30
30
|
body {
|
|
31
31
|
background-color: ${i(l.backgroundColor)} !important;
|
|
32
32
|
}
|
|
33
|
-
`}),t.jsx(h,{hideNavMenu:!!((D=l.header)!=null&&D.hideNavMenus),translucentTextColor:($=l.header)==null?void 0:$.translucentTextColor,...a?{logo:a}:{},...g?{brand:g}:{},...p?{description:p}:{},className:Y.cx(((V=l.header)==null?void 0:V.sticky)&&"sticky","page-header"),maxWidth:!1,addons:f}),t.jsx(w.ScrollRestoration,{}),t.jsxs(pe.Helmet,{children:[t.jsx("title",{children:m}),t.jsx("meta",{name:"og:title",content:m}),t.jsx("meta",{name:"og:description",content:j}),t.jsx("meta",{name:"og:image",content:d}),t.jsx("meta",{name:"twitter:image:src",content:d}),t.jsx("meta",{name:"twitter:image",content:d}),t.jsx("meta",{property:"twitter:description",content:j}),t.jsx("meta",{property:"twitter:title",content:m}),t.jsx("meta",{name:"description",content:j})]}),t.jsx(y.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:o.sectionIds.map(S=>{var G,W;const b=o.sections[S];if(!b||b.visibility==="hidden")return null;const R=(G=b.locales)==null?void 0:G[r],se=((W=b.locales)==null?void 0:W[c])??{};return t.jsx(P.BlockRenderer,{id:S,type:b.component,mode:e,section:b,config:{...ve.default(R)?se:R,locale:r,dev:e==="draft"?{mode:e,components:s,defaultLocale:c}:{mode:e}}},S)})}),!((z=l.footer)!=null&&z.hidden)&&t.jsx(qe,{})]})}const Le=x.lazy(()=>Promise.resolve().then(()=>require("./publish-button-
|
|
33
|
+
`}),t.jsx(h,{hideNavMenu:!!((D=l.header)!=null&&D.hideNavMenus),translucentTextColor:($=l.header)==null?void 0:$.translucentTextColor,...a?{logo:a}:{},...g?{brand:g}:{},...p?{description:p}:{},className:Y.cx(((V=l.header)==null?void 0:V.sticky)&&"sticky","page-header"),maxWidth:!1,addons:f}),t.jsx(w.ScrollRestoration,{}),t.jsxs(pe.Helmet,{children:[t.jsx("title",{children:m}),t.jsx("meta",{name:"og:title",content:m}),t.jsx("meta",{name:"og:description",content:j}),t.jsx("meta",{name:"og:image",content:d}),t.jsx("meta",{name:"twitter:image:src",content:d}),t.jsx("meta",{name:"twitter:image",content:d}),t.jsx("meta",{property:"twitter:description",content:j}),t.jsx("meta",{property:"twitter:title",content:m}),t.jsx("meta",{name:"description",content:j})]}),t.jsx(y.Stack,{flexGrow:1,className:"PageView-root",sx:{"& .BlockBase-root:first-child":{pt:"0 !important"}},children:o.sectionIds.map(S=>{var G,W;const b=o.sections[S];if(!b||b.visibility==="hidden")return null;const R=(G=b.locales)==null?void 0:G[r],se=((W=b.locales)==null?void 0:W[c])??{};return t.jsx(P.BlockRenderer,{id:S,type:b.component,mode:e,section:b,config:{...ve.default(R)?se:R,locale:r,dev:e==="draft"?{mode:e,components:s,defaultLocale:c}:{mode:e}}},S)})}),!((z=l.footer)!=null&&z.hidden)&&t.jsx(qe,{})]})}const Le=x.lazy(()=>Promise.resolve().then(()=>require("./publish-button-B7nhzpwi.js"))),te=Z.default(be.default)`
|
|
34
34
|
&.sticky {
|
|
35
35
|
position: sticky;
|
|
36
36
|
top: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("./state-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("./state-DDwYX2mu.js"),D=require("@arcblock/ux/lib/Locale/context"),O=require("@arcblock/ux/lib/Toast"),S=require("@mui/icons-material"),q=require("@mui/lab"),s=require("@mui/material"),W=require("immer"),z=require("lodash/difference"),c=require("react"),_=require("react-use"),N=require("./home-BXkUy2B8.js"),E=require("./array-CnXbKOG_.js"),M=t=>t&&t.__esModule?t:{default:t},A=M(O),C=M(z);function R(t){const[d,b]=c.useState(!1);return e.jsx(q.LoadingButton,{...t,loading:t.loading||d,onClick:i=>{var h;const m=(h=t.onClick)==null?void 0:h.call(t,i);m instanceof Promise&&(b(!0),m.finally(()=>{b(!1)}))}})}const F=s.createSvgIcon(e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M7.75732 16.2426L16.2426 7.75736",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M16.2426 16.2426L7.75732 7.75735",stroke:"#4B5563",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Close");function H(){const[t,d]=c.useState(),b=c.useMemo(()=>t?e.jsx(s.Dialog,{...t}):null,[t]),i=c.useCallback(()=>{d(void 0)},[]),m=c.useCallback(({title:h,content:g,cancelText:T="Cancel",okText:p="Ok",onOk:f,onClose:k,okIcon:L,okColor:n="primary",cancelColor:y="primary",DialogContentProps:u,form:x,...I})=>{d({...I,open:!0,children:e.jsxs("form",{onSubmit:P=>P.preventDefault(),children:[h&&e.jsxs(s.DialogTitle,{className:"between",zIndex:"appBar",bgcolor:"background.paper",sx:{borderBottom:"1px solid #E5E7EB"},children:[e.jsx(s.Box,{children:h}),e.jsx(s.IconButton,{size:"small",onClick:async()=>{i(),k==null||k()},children:e.jsx(F,{})})]}),g&&e.jsx(s.DialogContent,{...u,sx:{mt:-3,...u==null?void 0:u.sx},children:e.jsx(s.Box,{pt:3,children:g})}),e.jsxs(s.DialogActions,{children:[e.jsx(s.Button,{variant:"outlined",color:y||"primary",onClick:k??i,children:T}),e.jsx(R,{variant:"contained",color:n||"primary",startIcon:L,loadingPosition:L?"start":"center",onClick:async()=>{await(f==null?void 0:f()),i()},type:"submit",children:p})]})]}),onClose:k??i})},[i]);return{dialog:b,showDialog:m,closeDialog:i}}const J=c.forwardRef(({mode:t,state:d},b)=>{const{t:i}=D.useLocaleContext(),[m,h]=c.useState(!1),{dialog:g,showDialog:T}=H(),p=v.useProjectId(),f=c.useCallback(L=>{let n=[];T({title:i("maker.publishToProduction"),content:e.jsxs(s.Box,{sx:{minWidth:300},children:[e.jsx(s.Alert,{color:"warning",icon:e.jsx(S.Warning,{}),children:i("maker.publishToProductionTip")}),e.jsx(s.Box,{maxHeight:"50vh",overflow:"auto",mt:2,children:e.jsx(V,{state:d,toMode:t,onChange:y=>n=y,defaultPageIds:L})})]}),okText:i("maker.publish"),cancelText:i("common.cancel"),onOk:async()=>{var y,u;if((n==null?void 0:n.length)===0){const x=i("maker.publishSelectPagesMessage");throw A.default.error(x),new Error(x)}for(const x of n??d.pageIds){const I=d.pages[x];if(I){const P=(u=(y=v.checkPage(i,I,d))==null?void 0:y[0])==null?void 0:u.message;if(P)throw A.default.error(P),new Error(P)}}localStorage.setItem(v.getProjectPageVersionKey(p??""),String(new Date().getTime())),h(!0);try{await E.publishPages({mode:t,pages:n}),A.default.success(i("maker.publishSuccessMessage"))}catch(x){throw A.default.error(x.message),x}finally{h(!1)}}})},[t,d,i,p,T]);c.useImperativeHandle(b,()=>({openPublishDialog:f}));const k=c.useCallback(()=>{f()},[f]);return e.jsxs(e.Fragment,{children:[e.jsx(q.LoadingButton,{color:"primary",variant:"contained",size:"small",sx:{mr:1},onClick:k,loading:m,disabled:m,children:i("maker.publishToProduction")}),g]})});function V({state:t,toMode:d,onChange:b,defaultPageIds:i}){const{t:m,locale:h}=D.useLocaleContext(),[g,T]=c.useState(!1),[p,f]=c.useState(()=>i?Object.fromEntries(i.map(r=>[r,!0])):{}),{loading:k,error:L,value:n}=_.useAsync(()=>E.getPages({mode:d}),[d]);if(L)throw L;const y=c.useMemo(()=>JSON.parse(JSON.stringify(t.pageIds)).sort((a,j)=>{const o=t.pages[a],l=t.pages[j];return o!=null&&o.publishedAt&&new Date(o.publishedAt).getTime()<new Date(o.updatedAt).getTime()?-1:l!=null&&l.publishedAt&&new Date(l.publishedAt).getTime()<new Date(l.updatedAt).getTime()?1:new Date((o==null?void 0:o.updatedAt)??"").getTime()-new Date((l==null?void 0:l.updatedAt)??"").getTime()}),[t]),u=c.useMemo(()=>n?C.default(n.pageIds,t.pageIds):[],[t,n]),x=c.useMemo(()=>[...t.pageIds].concat(u),[t,u]),I=c.useCallback(r=>{f(a=>{const j=W.produce(a,o=>{g?(Object.assign(o,Object.fromEntries(x.map(l=>[l,!0]))),delete o[r]):o[r]?(delete o[r],u.includes(r)&&t.pageIds.filter(l=>{var w,B;return((w=t.pages[l])==null?void 0:w.slug)===((B=n==null?void 0:n.pages[r])==null?void 0:B.slug)}).forEach(l=>{delete o[l]})):(o[r]=!0,t.pageIds.includes(r)&&u.filter(l=>{var w,B;return((w=n==null?void 0:n.pages[l])==null?void 0:w.slug)===((B=t.pages[r])==null?void 0:B.slug)}).forEach(l=>{o[l]=!0}))});return T(C.default(x,Object.keys(j)).length===0),j})},[g,x,u,t,n]),P=c.useCallback(()=>{T(r=>(r&&f({}),!r))},[p]);return c.useEffect(()=>{b(g?null:Object.keys(p))},[g,p,b]),k?e.jsx(N.Loading,{sx:{my:4}}):e.jsxs(s.List,{disablePadding:!0,sx:{maxWidth:500},children:[e.jsx(s.ListItem,{sx:{position:"sticky",top:0,bgcolor:"background.paper",zIndex:1},disablePadding:!0,children:e.jsxs(s.ListItemButton,{onClick:P,dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g,tabIndex:-1})}),e.jsx(s.ListItemText,{primary:m("common.all")})]})}),y.map(r=>{var l,w;const a=t.pages[r];if(!a)return null;const j=v.checkPage(m,a,t),o=!a.publishedAt||a.updatedAt&&new Date(a.updatedAt).getTime()>new Date(a.publishedAt).getTime();return e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsxs(e.Fragment,{children:[o&&e.jsx(s.Tooltip,{title:m("maker.pages.needPublish"),children:e.jsx(S.Sync,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),!a.isPublic&&e.jsx(s.Tooltip,{title:m("maker.pages.notPublic"),children:e.jsx(S.VisibilityOff,{fontSize:"small",sx:{color:"warning.main",fontSize:16,mr:.35}})}),j&&e.jsx(v.PageErrorTip,{errors:j,children:e.jsx(S.Warning,{sx:{color:"error.dark",mr:.35}})})]}),children:e.jsxs(s.ListItemButton,{onClick:()=>I(r),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g||!!p[r],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:a.slug,secondary:(w=(l=a.locales)==null?void 0:l[h])==null?void 0:w.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},r)}),u.map(r=>{var j,o;const a=n==null?void 0:n.pages[r];return a?e.jsx(s.ListItem,{disablePadding:!0,secondaryAction:e.jsx(s.Chip,{color:"warning",label:"deleted",size:"small"}),children:e.jsxs(s.ListItemButton,{onClick:()=>I(r),dense:!0,children:[e.jsx(s.ListItemIcon,{children:e.jsx(s.Checkbox,{edge:"start",checked:g||!!p[r],tabIndex:-1})}),e.jsx(s.ListItemText,{primary:a.slug,secondary:(o=(j=a.locales)==null?void 0:j[h])==null?void 0:o.title,primaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"},secondaryTypographyProps:{noWrap:!0,textOverflow:"ellipsis"}})]})},r):null})]})}exports.default=J;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const C=require("react/jsx-runtime"),v=require("@mui/material"),y=require("ufo"),Z=require("@blocklet/js-sdk"),H=require("lodash/isEmpty"),ee=require("yaml"),te=require("@arcblock/ux/lib/Locale/context"),F=require("@syncedstore/core"),oe=require("@syncedstore/react"),ne=require("ahooks"),b=require("immer"),re=require("js-cookie"),se=require("lodash/debounce"),ce=require("nanoid"),l=require("react"),V=require("react-router-dom"),ie=require("y-indexeddb"),ae=require("y-websocket"),ue=require("yjs");require("@blocklet/pages-kit/types");const E=e=>e&&e.__esModule?e:{default:e};function le(e){if(e&&e.__esModule)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const c in e)if(c!=="default"){const a=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(o,c,a.get?a:{enumerable:!0,get:()=>e[c]})}}return o.default=e,Object.freeze(o)}const de=E(H),fe=le(ee),me=E(F),pe=E(re),z=E(se),Se=e=>{const o=blocklet==null?void 0:blocklet.componentMountPoints.find(c=>c.name===e);return o?o.mountPoint:"/"};function B(){const{pathname:e}=window.location,o=e.match(/\/admin\/(maker|previewer)\/([^/]+)/),c=o==null?void 0:o[2],a=window.__PROJECT_ID__;if(!c&&!a)throw new Error("Unable to get projectId from pathname");return c||a}function we(e){return`${e}:pages:version`}function Pe(e,o){return o==="yaml"?de.default(e)?"":fe.stringify(e,{indent:2}):o==="json"?JSON.parse(JSON.stringify(e||{})):o==="array"?JSON.parse(JSON.stringify(e||[])):e}function he({error:e}){return C.jsx(v.Box,{children:C.jsx(v.Alert,{severity:"error",children:e.message})})}var W;const O=((W=window.blocklet)==null?void 0:W.prefix)||"/",L=Z.createAxios({timeout:200*1e3}),ge=window.location.protocol==="https:"?"wss":"ws",je=e=>y.joinURL(`${ge}://${window.location.hostname}`,O,`api/${e}/ws/pages`),Ce="z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9";var N;(N=blocklet==null?void 0:blocklet.componentMountPoints.find(e=>e.did===Ce))!=null&&N.mountPoint||y.joinURL(O,"/image-bin");function ye(e){return e&&!/^(https?:\/\/|\/)/.test(e)?window.location.origin+y.joinURL(O,"uploads",e):e}const Ie=window.innerWidth<=750;function ke(e,o,c){if(!e||/\.gif/.test(e))return e;const a=(Ie?o/1.5:o)*(c==="quality"?1.5:1);return ve(e,{imageFilter:"resize",w:a,f:"webp"})}function ve(e,o){return!e||!o?e:y.withQuery(e,o)}async function xe(e){return L.get(`/api/projects/${e}`).then(o=>o.data)}async function Ee(e){return L.post(`/api/projects/${e.id}/update`,e).then(o=>o.data)}const be=500,_=ce.customAlphabet("abcdefghijklmnopqrstuvwxyz0123456789",16),J=l.createContext(null);function _e({url:e,name:o,children:c,waitingSynced:a}){const[f,d]=l.useState(!1),{locale:j}=te.useLocaleContext(),P=A(),t=`${P}:MakerLocalState`,s=`${P}:${o}`,[r,n]=ne.useLocalStorageState(t,{defaultValue:{},listenStorageChange:!0}),i=l.useRef(r);i.current=r;const u=l.useMemo(()=>me.default({pages:{},pageIds:[],components:{},supportedLocales:[],config:{},resources:{}}),[]),m=l.useMemo(()=>F.getYjsDoc(u),[u]);l.useMemo(()=>new ie.IndexeddbPersistence(s,m),[s,m]);const h=l.useMemo(()=>new ae.WebsocketProvider(e,s,m,{params:{token:pe.default.get("login_token")},resyncInterval:5*60*1e3}),[e,s,m]),q=l.useCallback(()=>{h&&(h.disconnect(),h.connect())},[h]),I=l.useMemo(()=>new ue.UndoManager([m.getArray("pageIds"),m.getMap("pages"),m.getArray("supportedLocales"),m.getMap("config")],{doc:m}),[m]),[k,x]=l.useState(null),[M,R]=l.useState(!1),[T,U]=l.useState(void 0),$=l.useCallback(async()=>{if(P){R(!0);try{const p=await xe(P);x(p)}catch(p){console.error("Failed to fetch project:",p)}finally{R(!1)}}},[P]),D=l.useCallback(async(p,S)=>{var g;if(U(void 0),!!P){S!=null&&S.optimisticUpdate&&k&&x(w=>({...w,...p}));try{const w=await Ee({...p});x(w)}catch(w){console.error("Failed to update project:",w),S!=null&&S.optimisticUpdate&&x(k),U((g=w==null?void 0:w.response)==null?void 0:g.data)}}},[P,k]);l.useEffect(()=>{P&&$()},[P,$]);const Y=l.useMemo(()=>({doc:m,state:u,localState:{...r,currentLocale:j},setLocalState:p=>n(typeof p=="function"?S=>p(S??{}):p),undoManager:I,projectState:{project:k,isLoadingProject:M,error:T},updateProject:D,forceSync:q}),[m,u,JSON.stringify(r),n,I,k,M,D,T,j,q]);return l.useEffect(()=>{I.on("stack-item-added",({stackItem:p})=>{const{currentPageId:S,currentLocale:g,pages:w}=i.current;p.meta.set("localState",{currentPageId:S,currentLocale:g,pages:w})}),I.on("stack-item-popped",({stackItem:p})=>{const S=p.meta.get("localState");S&&n(g=>({...g,...S}))})},[I,n]),l.useEffect(()=>{h.awareness.setLocalState(r)},[h,r]),l.useEffect(()=>{h.once("synced",()=>d(!0));const p=()=>{n(w=>({...w,networkStatus:void 0}))},S=()=>{n(w=>({...w,networkStatus:"offline"}))},g=z.default(({status:w})=>{w==="connected"?p():w==="disconnected"&&S()},be);return h.on("status",g),window.addEventListener("online",p),window.addEventListener("offline",S),()=>{h.off("status",g),window.removeEventListener("online",p),window.removeEventListener("offline",S)}},[h,n]),a&&!f?null:C.jsx(J.Provider,{value:Y,children:c})}const G=()=>{const e=l.useContext(J);if(!e)throw new Error("Context is null");const o=oe.useSyncedStore(e.state),{setLocalState:c,localState:a}=e,f=V.useNavigate(),d=A(),j=l.useMemo(()=>({setCurrentSectionId:(t,s)=>{var r,n;t===a.currentPageId&&s===((n=(r=a.pages)==null?void 0:r[t])==null?void 0:n.currentSectionId)||(f(y.joinURL("/admin/maker",d??"","pages",t)),c(i=>b.produce(i,u=>{var m;u.currentPageId=t,u.currentComponentId=void 0,u.customComponentPreviewerProperties={},s!==void 0&&(u.pages??(u.pages={}),(m=u.pages)[t]??(m[t]={}),u.pages[t].currentSectionId=s??void 0),s?window.sessionStorage.setItem("iframe_show_id",`"${s}"`):window.sessionStorage.removeItem("iframe_show_id")})))},setCurrentComponentId:t=>{t!==a.currentComponentId&&(f(y.joinURL("/admin/maker",d??"","components",t)),c(s=>b.produce(s,r=>{r.currentComponentId=t,r.customComponentPreviewerProperties={}})))},setCustomComponentPreviewerProperties:(()=>{const t={},s=z.default(()=>{c(r=>b.produce(r,n=>{n.customComponentPreviewerProperties={...n==null?void 0:n.customComponentPreviewerProperties,...t},Object.keys(t).forEach(i=>delete t[i])}))},5);return r=>{Object.assign(t,r),s()}})()}),[c,f,d]),P=l.useMemo(()=>({addPage:(t,s)=>{var i,u,m,h;const r=(t==null?void 0:t.id)??_(),n={...t,id:r,createdAt:(t==null?void 0:t.createdAt)??new Date().toISOString(),updatedAt:(t==null?void 0:t.updatedAt)??new Date().toISOString(),publishedAt:new Date(0).toISOString(),slug:(t==null?void 0:t.slug)??`/${r}`,sections:(t==null?void 0:t.sections)??{},sectionIds:(t==null?void 0:t.sectionIds)??[],isPublic:(t==null?void 0:t.isPublic)??!0,templateConfig:(t==null?void 0:t.templateConfig)??{isTemplate:((i=t==null?void 0:t.templateConfig)==null?void 0:i.isTemplate)??!0,displayTemplateId:((u=t==null?void 0:t.templateConfig)==null?void 0:u.displayTemplateId)??void 0,dataSourceId:((m=t==null?void 0:t.templateConfig)==null?void 0:m.dataSourceId)??void 0,dataSourceParameters:((h=t==null?void 0:t.templateConfig)==null?void 0:h.dataSourceParameters)??{}}};return e.doc.transact(()=>{o.pages[n.id]=n,o.pageIds.splice(s??o.pageIds.length,0,n.id)}),n},deletePage:t=>{const s=o.pageIds.indexOf(t);s!==-1&&e.doc.transact(()=>{o.pageIds.splice(s,1),delete o.pages[t]})},movePage:(t,s)=>{const{pageIds:r}=o,n=r.indexOf(t);n>=0&&r.splice(s,0,...r.splice(n,1))},addSection:(t,s,r)=>{const n=o.pages[t];if(!n)throw new Error(`Page ${t} is not exists`);const i={...s,id:s.id??_(),isTemplateSection:s.isTemplateSection??!0,llmConfig:s.llmConfig??{}};return e.doc.transact(()=>{n.sections[i.id]=i,n.sectionIds.splice(r??n.sectionIds.length,0,i.id)}),i},deleteSection:(t,s)=>{const r=o.pages[t];if(!r)throw new Error(`Page ${t} is not exists`);const n=r.sectionIds.indexOf(s);n!==-1&&e.doc.transact(()=>{r.sectionIds.splice(n,1),delete r.sections[s]})},toggleSectionVisibility:(t,s,r)=>{const n=o.pages[t];if(!n)throw new Error(`Page ${t} is not exists`);const i=n.sections[s];i&&(i.visibility=r)},moveSection:(t,s,r)=>{const n=o.pages[t];if(!n)throw new Error(`Page ${t} is not exists`);const{sectionIds:i}=n,u=i.indexOf(s);u>=0&&i.splice(r,0,...i.splice(u,1))}}),[o,e.doc]);return{...e,state:o,actions:P,localActions:j,get currentPage(){const{localState:{currentPageId:t}}=e;return t?o.pages[t]:void 0},get currentSection(){var n,i,u;const{localState:{currentPageId:t,...s}}=e;if(!t)return;const r=(i=(n=s.pages)==null?void 0:n[t])==null?void 0:i.currentSectionId;if(r)return(u=o.pages[t])==null?void 0:u.sections[r]}}},A=()=>{const{projectId:e}=V.useParams();return e??B()??""};function K(e){var a,f;const{resources:o}=e;if(!o.components)return{};const c={};return(f=(a=window==null?void 0:window.blocklet)==null?void 0:a.componentMountPoints)==null||f.forEach(d=>{c[d.did]=d}),Object.fromEntries(Object.entries(o.components).map(([d,{blockletId:j,component:P}])=>{var t;return[d,{data:P,blockletId:j,blockletTitle:((t=c[j])==null?void 0:t.title)||j}]}))}function Q(e){const{components:o}=e;return o||{}}function X(e){return{...K(e),...Q(e)}}const Oe=()=>X(G().state),Le=[/\.\./,/<[^>]*>/,/%[0-9a-f]{2}/i,/[<>'"%;{}()\\]/,/\x00/,/\n|\r|\t|\v|\f/,/[^a-zA-Z0-9-_@/]/];function Ae(e,o,c){const a=[];{let f;o.slug?o.slug.startsWith("/")?o.slug!=="/"&&o.slug.endsWith("/")?f=e("maker.properties.pathCheckEndWithoutSlash"):/\/{2,}/.test(o.slug)?f=e("maker.properties.pathCheckConsecutiveSlash"):/\s/.test(o.slug)?f=e("maker.properties.pathCheckWhitespace"):Le.some(d=>d.test(o.slug))?f=e("maker.properties.pathCheckInvalid"):Object.values(c.pages).some(d=>(d==null?void 0:d.id)!==o.id&&(d==null?void 0:d.slug)===o.slug)&&(f=e("maker.properties.pathCheckAlreadyExist")):f=e("maker.properties.pathCheckStartWithSlash"):f=e("maker.properties.pathCheckRequired"),f&&a.push({path:["path"],message:f})}return a.length>0?a:null}function qe({errors:e,...o}){return e!=null&&e.length?C.jsx(v.Tooltip,{...o,title:C.jsx(v.Box,{children:e.map((c,a)=>C.jsx(v.Box,{children:c.message},a))})}):null}exports.ErrorView=he;exports.PageErrorTip=qe;exports.StoreProvider=_e;exports.api=L;exports.autoResizeImage=ke;exports.checkPage=Ae;exports.getAllComponents=X;exports.getCustomComponents=Q;exports.getImageAbsoluteUrl=ye;exports.getMountPoint=Se;exports.getProjectIdFromPathnameOrWindow=B;exports.getProjectPageVersionKey=we;exports.getResourceComponents=K;exports.getWssURL=je;exports.nextId=_;exports.transformValue=Pe;exports.useAllComponents=Oe;exports.useProjectId=A;exports.useStore=G;
|
package/lib/cjs/home.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react/jsx-runtime");require("./chunks/state-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("react/jsx-runtime");require("./chunks/state-DDwYX2mu.js");const e=require("./chunks/home-BXkUy2B8.js");require("@arcblock/ux/lib/Locale/context");require("@arcblock/ux/lib/Result");require("@blocklet/pages-kit/builtin/page/header");require("@blocklet/pages-kit/contexts/color");require("@blocklet/ui-react/lib/Header");require("@emotion/css");require("@emotion/react");require("@emotion/styled");require("@mui/material");require("ahooks");require("isomorphic-dompurify");require("lodash/cloneDeep");require("lodash/isEmpty");require("lodash/isEqual");require("react");require("react-helmet");require("react-router-dom");require("react-use");require("ufo");require("./chunks/array-CnXbKOG_.js");exports.HomeView=e.HomeView;exports.PageRoutes=e.PageRoutes;exports.PageView=e.PageView;exports.PageViewByPath=e.PageViewByPath;exports.TranslucentHeader=e.TranslucentHeader;exports.default=e.Home;
|