react-bricks 3.6.0-beta.0 → 3.7.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +0,0 @@
1
- import*as e from"react";import t,{useContext as n,useState as r,useEffect as a}from"react";import o from"classnames";import{QueryClient as i,QueryClientProvider as l,useQuery as c}from"react-query";import{FiEdit as s}from"react-icons/fi";import u from"axios";var d=function(e,t){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},d(e,t)};function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var m,f=function(){return f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},f.apply(this,arguments)};function g(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}function h(e,t,n,r){return new(n||(n=Promise))((function(a,o){function i(e){try{c(r.next(e))}catch(e){o(e)}}function l(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}c((r=r.apply(e,t||[])).next())}))}function v(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(a=2&o[0]?r.return:o[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function y(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i}function E(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){var t,n,r,a,o,i,l,c,s,u,d;(t=e.SideEditPropType||(e.SideEditPropType={})).Text="TEXT",t.Textarea="TEXTAREA",t.Number="NUMBER",t.Date="DATE",t.Range="RANGE",t.Boolean="BOOLEAN",t.Select="SELECT",t.Image="IMAGE",t.Custom="CUSTOM",t.Relationship="RELATIONSHIP",(n=e.OptionsDisplay||(e.OptionsDisplay={})).Select="SELECT",n.Radio="RADIO",n.Color="COLOR",(r=e.RichTextFeatures||(e.RichTextFeatures={})).Bold="BOLD",r.Italic="ITALIC",r.Code="CODE",r.Highlight="HIGHLIGHT",r.Link="LINK",r.UnorderedList="UL",r.OrderedList="OL",r.Heading1="H1",r.Heading2="H2",r.Heading3="H3",r.Heading4="H4",r.Heading5="H5",r.Heading6="H6",r.Quote="QUOTE",(a=e.SortDirection||(e.SortDirection={})).Up="UP",a.Down="DOWN",(o=e.PageStatus||(e.PageStatus={})).Draft="DRAFT",o.Published="PUBLISHED",(i=e.DeployEnvironment||(e.DeployEnvironment={})).Staging="STAGING",i.Production="PRODUCTION",(l=e.PlaygroundSelectedItemType||(e.PlaygroundSelectedItemType={})).Block="BLOCK",l.Page="PAGE",(c=e.DeviceType||(e.DeviceType={})).Desktop="DESKTOP",c.Tablet="TABLET",c.Phone="PHONE",(s=e.Tab||(e.Tab={})).Block="BLOCK",s.Item="ITEM",s.PageSettings="PAGE-SETTINGS",s.Document="DOCUMENT",s.Stories="STORIES",s.CollaborationLocked="COLLABORATION-LOCKED",(u=e.ClickToEditSide||(e.ClickToEditSide={})).BottomRight="BOTTOM-RIGHT",u.BottomLeft="BOTTOM-LEFT",u.TopRight="TOP-RIGHT",u.TopLeft="TOP-LEFT",(d=e.BlockIconsPosition||(e.BlockIconsPosition={})).InsideBlock="INSIDE-BLOCK",d.OutsideBlock="OUTSIDE-BLOCK"}(m||(m={}));var k=e.createContext({focused:{blockId:""},setFocused:function(){},triggerTextRefreshBlockId:"",setTriggerTextRefreshBlockId:function(){},setAddAfterBlockId:function(){},pageValues:{id:"",type:"",name:"",slug:"",meta:{},authorId:"",author:{id:"",email:"",firstName:"",lastName:""},invalidBlocksTypes:[],status:m.PageStatus.Draft,isLocked:!1,tags:[],createdAt:"",publishedAt:"",language:"",translations:[]},handleChangePageValue:function(){}}),P=e.createContext({pageValues:{id:"",type:"",name:"",slug:"",meta:{},authorId:"",author:{id:"",email:"",firstName:"",lastName:""},invalidBlocksTypes:[],status:m.PageStatus.Draft,isLocked:!1,tags:[],createdAt:"",publishedAt:"",language:"",translations:[]}}),T=function(){var e=n(k),t=e.pageValues,r=e.handleChangePageValue,a=n(P).pageValues;return[t.id?t:a,r]},x=e.createContext({values:{},onChange:function(){},blockId:"",blockType:"",parents:[],handleChange:function(e){return function(){}}}),w=function(e){return function(e){var t,n;if(!1===S(e))return!1;if("function"!=typeof(t=e.constructor))return!1;if(!1===S(n=t.prototype))return!1;if(!1===n.hasOwnProperty("isPrototypeOf"))return!1;return!0}(e)&&"string"==typeof e.text};function I(e){return w(e)?e.text:e.children&&Array.isArray(e.children)?e.children.map(I).join(""):""}function S(e){return!0==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var L,A={serialize:function(e){return Array.isArray(e)&&e.length>0?e.map(I).join("\n"):""},deserialize:function(e){return e.split("\n").map((function(e){return{type:"paragraph",children:[{text:e}]}}))},isText:w},N=function(t,n,r){if(A.isText(t)){var a=C(t.text);return n.filter((function(e){return"Mark"===e.type})).reduce((function(e,n){return t[n.name]?n.renderLeaf({children:e}):e}),a)}var o=n.filter((function(e){return"List"===e.type})).find((function(e){return t.type===e.name}));if(o){var i=B(t,n);return o.renderElement({children:i.map((function(t,n){return e.createElement(e.Fragment,{key:n},o.renderItemElement({children:t}))})),element:{url:t.url}})}var l=B(t,n,r),c=n.filter((function(e){return"Block"===e.type})).find((function(e){return t.type===e.name}));return c?c.renderElement({children:l,element:{url:t.url}}):r?r({children:l,element:{type:"",children:[]},attributes:{ref:null}}):l},B=function(t,n,r){var a;return null===(a=t.children)||void 0===a?void 0:a.map((function(t,a){return e.createElement(e.Fragment,{key:a},N(t,n,r))}))},C=function(t){var n=null==t?void 0:t.replace(/\n/g,"<|BR|>\n<|BR|>").split("<|BR|>");if(n)return 1===n.length?t:e.createElement(e.Fragment,null,n.map((function(t,n,r){return"\n"===t&&r.length===n+1||"\n"===t&&r.length===n+2&&""===r[r.length-1]?e.createElement(e.Fragment,{key:n},e.createElement("br",null)," "):"\n"===t?e.createElement("br",null):e.createElement(e.Fragment,{key:n},t)})))},R=function(t){var r,a,o=t.renderBlock,i=t.placeholder,l=t.renderPlaceholder,c=t.propName,s=t.multiline,u=void 0!==s&&s,d=t.softLineBreak,p=void 0!==d&&d,m=t.metaFieldName,f=t.customFieldName,g=n(x).values,h=b(T(),1)[0],v=c?g[c]:m?h.meta[m]||"":f&&h.customValues&&h.customValues[f]||"";if(null===(r=R.prototype)||void 0===r?void 0:r.renderAdmin)return null===(a=R.prototype)||void 0===a?void 0:a.renderAdmin({renderBlock:o,placeholder:i,renderPlaceholder:l,propName:c,multiline:u,softLineBreak:p,metaFieldName:m,customFieldName:f});var y=v;return v?("string"==typeof v&&(y=A.deserialize(v)),e.createElement(e.Fragment,null,y.map((function(t,n){return e.createElement(e.Fragment,{key:n},N(t,[],o))})))):null},O=function(t){var r,a,o=t.renderBlock,i=t.placeholder,l=t.renderPlaceholder,c=t.propName,s=t.plugins,u=void 0===s?[]:s,d=t.multiline,p=void 0===d||d,m=t.softLineBreak,f=void 0===m||m,g=t.metaFieldName,h=t.customFieldName,v=n(x).values,y=b(T(),1)[0],E=c?v[c]:g?y.meta[g]:h&&y.customValues?y.customValues[h]:"";if(null===(r=O.prototype)||void 0===r?void 0:r.renderAdmin)return null===(a=O.prototype)||void 0===a?void 0:a.renderAdmin({renderBlock:o,placeholder:i,renderPlaceholder:l,propName:c,plugins:u,multiline:p,softLineBreak:f,metaFieldName:g,customFieldName:h});var k=E;return E?("string"==typeof E&&(k=A.deserialize(E)),e.createElement(e.Fragment,null,k.map((function(t,n){return e.createElement(e.Fragment,{key:n},N(t,u,o))})))):null},D=e.createContext({appId:"",apiKey:"",bricks:{},pageTypes:[],logo:"",loginUI:{},contentClassName:"",renderLocalLink:function(t){var n=t.href,r=t.children;return e.createElement("a",{href:n},r)},navigate:function(){},loginPath:"",editorPath:"",playgroundPath:"",appSettingsPath:"",previewPath:"",getAdminMenu:function(e){return e.isAdmin,[]},useCssInJs:!1,appRootElement:"",clickToEditSide:m.ClickToEditSide.BottomRight,responsiveBreakpoints:[],enableAutoSave:!0,disableSaveIfInvalidProps:!1,enablePreview:!0,browserSupport:{webP:!0,lazyLoading:!0},blockIconsPosition:m.BlockIconsPosition.InsideBlock,enableUnsplash:!0,unsplashApiKey:"",enablePreviewImage:!1,enablePreviewIcon:!1}),F=function(e){var t,n;return(null===(t=F.prototype)||void 0===t?void 0:t.adminConstructor)?null===(n=F.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:"Mark",name:e.name,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderLeaf:e.render,toggle:function(e){}}},z=F({name:"bold",hotKey:"mod+b",render:function(t){return e.createElement("strong",null,t.children)}}),H=F({name:"italic",hotKey:"mod+i",render:function(t){return e.createElement("em",null,t.children)}}),K=F({name:"code",hotKey:"mod+`",render:function(t){return e.createElement("code",{style:{margin:"0 1px",display:"inline-block",padding:"3px 6px",fontSize:"0.875rem",lineHeight:1.25,maxWidth:"100%",fontFamily:'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',borderRadius:"3px",backgroundColor:"#F5F7F9"}},t.children)}}),U=F({name:"highlight",hotKey:"mod+h",render:function(t){return e.createElement("mark",{style:{paddingLeft:4,paddingRight:4,borderRadius:2,backgroundColor:"#ff0",color:"#0f0f05"}},t.children)}}),j=function(t){var r,a,o=t.href,i=t.children,l=t.target,c=t.className,s=g(t,["href","children","target","className"]),u=n(D).renderLocalLink;if(null===(r=j.prototype)||void 0===r?void 0:r.renderAdmin)return null===(a=j.prototype)||void 0===a?void 0:a.renderAdmin(f({href:o,children:i,target:l,className:c},s));var d={href:o};return/^\/(?!\/)/.test(o)?u?u(f({href:o,target:l,children:i,className:c},s)):(u||console.warn("Local path found in Link, but no renderLocalLink function was provided. Rendering <a> as fallback"),e.createElement("a",f({},d,{target:l,className:c},s),i)):e.createElement("a",f({},d,{target:l,className:c},s),i)},M={type:"Block",name:"link",label:"Link",isInline:!0,renderElement:function(t){var n=t.attributes,r=t.children,a=t.element;return e.createElement(j,f({},n,{href:a.url}),r)},toggle:function(e){}},W=function(e){var t,n;return(null===(t=W.prototype)||void 0===t?void 0:t.adminConstructor)?null===(n=W.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,t){}}},_=W({name:"h1",hotKey:"mod+shift+1",render:function(t){return e.createElement("h1",null,t.children)}}),V=W({name:"h2",hotKey:"mod+shift+2",render:function(t){return e.createElement("h2",null,t.children)}}),G=W({name:"h3",hotKey:"mod+shift+3",render:function(t){return e.createElement("h3",null,t.children)}}),J=W({name:"h4",hotKey:"mod+shift+4",render:function(t){return e.createElement("h4",null,t.children)}}),Q=W({name:"h5",hotKey:"mod+shift+5",render:function(t){return e.createElement("h5",null,t.children)}}),q=W({name:"h6",hotKey:"mod+shift+6",render:function(t){return e.createElement("h6",null,t.children)}}),X=W({name:"quote",render:function(t){return e.createElement("blockquote",null,t.children)}}),Y=W({name:"ol",label:"Number list",itemName:"li",render:function(t){return e.createElement("ol",{className:"list-decimal"},t.children)},renderItem:function(t){return e.createElement("li",null,t.children)}}),Z=W({name:"ul",label:"Bullet list",itemName:"li",render:function(t){return e.createElement("ul",{className:"list-disc"},t.children)},renderItem:function(t){return e.createElement("li",null,t.children)}}),$=Object.freeze({__proto__:null,bold:z,italic:H,code:K,highlight:U,link:M,heading1:_,heading2:V,heading3:G,heading4:J,heading5:Q,heading6:q,quote:X,orderedList:Y,unorderedList:Z}),ee=((L={})[m.RichTextFeatures.Bold]={newPlugin:z,renderLeaf:"renderBold"},L[m.RichTextFeatures.Italic]={newPlugin:H,renderLeaf:"renderItalic"},L[m.RichTextFeatures.Highlight]={newPlugin:U,renderLeaf:"renderHighlight"},L[m.RichTextFeatures.Code]={newPlugin:K,renderLeaf:"renderCode"},L[m.RichTextFeatures.Link]={newPlugin:M,renderLink:"renderLink"},L[m.RichTextFeatures.UnorderedList]={newPlugin:Z,renderElement:"renderUL",renderItemElement:"renderLI"},L[m.RichTextFeatures.OrderedList]={newPlugin:Y,renderElement:"renderOL",renderItemElement:"renderLI"},L[m.RichTextFeatures.Heading1]={newPlugin:_,renderElement:"renderH1"},L[m.RichTextFeatures.Heading2]={newPlugin:V,renderElement:"renderH2"},L[m.RichTextFeatures.Heading3]={newPlugin:G,renderElement:"renderH3"},L[m.RichTextFeatures.Heading4]={newPlugin:J,renderElement:"renderH4"},L[m.RichTextFeatures.Heading5]={newPlugin:Q,renderElement:"renderH5"},L[m.RichTextFeatures.Heading6]={newPlugin:q,renderElement:"renderH6"},L[m.RichTextFeatures.Quote]={newPlugin:X,renderElement:"renderQuote"},L),te=function(e){var n,r;if(null===(n=te.prototype)||void 0===n?void 0:n.renderAdmin)return null===(r=te.prototype)||void 0===r?void 0:r.renderAdmin(e);var a=[];return e.allowedFeatures&&e.allowedFeatures.length>0&&(a=e.allowedFeatures.map((function(t){var n=ee[t],r=n.newPlugin,a=n.renderLeaf,o=n.renderElement,i=n.renderItemElement,l=n.renderLink,c={},s=e[a],u=e[o],d=e[i],p=e[l];return a&&s&&(c.renderLeaf=s),o&&u&&(c.renderElement=u),i&&d&&(c.renderItemElement=d),l&&p&&(c.renderElement=function(e){var t=e.attributes,n=e.children,r=e.element;return p({attributes:t,children:n,element:r,href:r.url})}),f(f({},r),c)}))),t.createElement(O,{renderBlock:e.renderBlock,placeholder:e.placeholder,propName:e.propName,plugins:a,multiline:e.multiline,softLineBreak:e.softLineBreak,renderPlaceholder:e.renderPlaceholder,metaFieldName:e.metaFieldName,customFieldName:e.customFieldName})},ne="https://api.reactbricks.com/v2",re="rb_t",ae="https://ws.reactbricks.com",oe="/ws/",ie=function(e,t){if(!t)return e;var n=e.lastIndexOf(".");return e.substring(0,n)+"/"+t+e.substring(n)},le=function(e,t){return e?t?e.split(",").map((function(e){var n=b(e.trim().split(" "),2),r=n[0],a=n[1];return r&&a?"".concat(ie(r,t)," ").concat(a):ie(e,t)})).join(", "):e:""},ce=require("react-progressive-graceful-image").default,se=function(t){t.propName;var n=t.source,r=t.alt,a=t.wrapper,o=t.noLazyLoad,i=void 0!==o&&o;t.containerClassName,t.containerStyle;var l=t.imageClassName,c=t.imageStyle,s=void 0===c?{}:c;t.noWrapper;var u=t.sizes,d=void 0===u?"100vw":u,p=t.loading,m=void 0===p?"lazy":p;t.renderWrapper;var h=t.useNativeLazyLoading,v=void 0===h||h;t.useWebP;var y=g(t,["propName","source","alt","wrapper","noLazyLoad","containerClassName","containerStyle","imageClassName","imageStyle","noWrapper","sizes","loading","renderWrapper","useNativeLazyLoading","useWebP"]);if(!n)return null;var b=e.useContext(D).browserSupport,E=(null==n?void 0:n.alt)||r,k=ie(n.src,n.seoName),P=n.fallbackSrc?ie(n.fallbackSrc,n.seoName):"",T=ie(n.placeholderSrc||"",n.seoName),x=le(n.srcSet,n.seoName),w=n.fallbackSrc?le(n.fallbackSrc,n.seoName):"",I=m,S=P&&!b.webP?P:k,L=P&&!b.webP?w:x,A=f({src:S,srcSet:L,sizes:d,alt:E,width:n.width,height:n.height,loading:I,decoding:"async",className:"rb-lazy ".concat(l),style:s},y),N=f(f({},A),{className:l});return a({width:n.width,height:n.height,children:e.createElement(e.Fragment,null,b.lazyLoading&&v?e.createElement("img",f({},A)):e.createElement(ce,{src:S,srcSetData:{srcSet:L,sizes:d},placeholder:T,delay:300,noLazyLoad:i},(function(t,n,r){var a=f({},s);a.transition||(a.transition="filter 300ms ease-in-out"),n&&(a.filter="blur(2px)");var o=f(f({},A),{src:t,srcSet:r.srcSet,sizes:r.sizes});return e.createElement("img",f({},o))})),e.createElement("noscript",null,e.createElement("style",{type:"text/css"},".rb-lazy { display: none; }"),e.createElement("img",f({},N))))})},ue=function(t){var r,a,o=n(x).values,i=b(T(),2),l=i[0];i[1];var c=t.propName?o[t.propName]:t.metaFieldName?l.meta[t.metaFieldName]:t.customFieldName&&l.customValues?l.customValues[t.customFieldName]:null,s=function(t){var n=t.children;return e.createElement(e.Fragment,null,n)};if(!t.containerClassName&&!t.containerStyle||t.noWrapper||(s=function(n){var r=n.children;return e.createElement("div",{className:t.containerClassName,style:t.containerStyle},r)}),t.renderWrapper&&(s=t.renderWrapper),null===(r=ue.prototype)||void 0===r?void 0:r.renderAdmin)return null===(a=ue.prototype)||void 0===a?void 0:a.renderAdmin(t);t.maxWidth,t.aspectRatio;var u=g(t,["maxWidth","aspectRatio"]);return e.createElement(se,f({},u,{source:c,wrapper:s}))},de=function(e){var t,r=e.allowedExtensions,a=void 0===r?[]:r,o=e.propName,i=e.renderBlock,l=n(x).values[o];return(null===(t=de.prototype)||void 0===t?void 0:t.renderAdmin)?de.prototype.renderAdmin({propName:o,renderBlock:i,allowedExtensions:a}):l?i(l):null},pe=function(t){var r,a,o=t.propName,i=t.itemProps,l=void 0===i?{}:i,c=t.renderWrapper,s=t.renderItemWrapper,u=n(D).bricks,d=n(x),p=d.values,m=d.blockId,g=d.blockType,h=d.parents,v=d.handleChange;d.handleAddItem;var y=p[o];if(null===(r=pe.prototype)||void 0===r?void 0:r.renderAdmin)return null===(a=pe.prototype)||void 0===a?void 0:a.renderAdmin({propName:o,itemProps:l,renderWrapper:c,renderItemWrapper:s});if(!y||0===y.length)return null;var k=E(E([],b(h),!1),[{blockId:m,typeName:g,propName:o}],!1),P=e.createElement(e.Fragment,null,y.map((function(t,n){var r=u[t.type];if(r){var a=f(f(f({},t.props),l),{key:t.id,index:n,onChange:function(){}}),o=e.createElement(x.Provider,{key:t.id,value:{onChange:v(t.id,k),values:t.props,blockId:t.id,blockType:t.type,parents:k,handleChange:v}},e.createElement(r,f({},a)));return s?s(o,n,y.length):o}})));return c?c(P):P},me=function(){var e,t;return(null===(e=me.prototype)||void 0===e?void 0:e.useAdmin)?null===(t=me.prototype)||void 0===t?void 0:t.useAdmin():{isAdmin:!1,previewMode:!1,currentPage:{pageId:""}}},fe=function(e){var t,r,a=n(x),o=a.values,i=a.onChange;if(null===(t=fe.prototype)||void 0===t?void 0:t.useAdmin)return null===(r=fe.prototype)||void 0===r?void 0:r.useAdmin(e);return[o[e],function(t){return i(e,t)},!0]},ge=function(){return e.createElement("div",{className:o("max-w-xl mx-auto py-6")})};ge.schema={name:"paragraph",label:"Paragraph",getDefaultProps:function(){return{text:"Lorem ipsum dolor sit amet"}}};var he={paragraph:ge},ve=[{type:m.DeviceType.Phone,width:375,label:"Phone (375px)"},{type:m.DeviceType.Tablet,width:768,label:"Tablet (768px)"},{type:m.DeviceType.Desktop,width:"100%",label:"Desktop (100%)"}],ye=new i,be=new Promise((function(e){var t=new Image;t.onerror=function(){return e(!1)},t.onload=function(){return e(1===t.width)},t.src="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA="})).catch((function(){return!1})),Ee=[{name:"page",pluralName:"pages",defaultLocked:!1,defaultStatus:m.PageStatus.Draft,defaultLanguage:"en",getDefaultContent:function(){return[]}}],ke={logoHeight:80,welcomeText:"Welcome",sideImage:"https://images.unsplash.com/photo-1461418559055-6f020c5a91e7?ixlib=rb-1.2.1&auto=format&fit=crop&w=1601&q=80"},Pe=function(t){var n=t.appId,r=t.apiKey,a=t.bricks,o=t.pageTypes,i=t.customFields,c=t.logo,s=void 0===c?"":c,u=t.loginUI,d=t.contentClassName,p=void 0===d?"":d,g=t.renderLocalLink,y=t.navigate,E=t.loginPath,k=void 0===E?"/admin":E,P=t.editorPath,T=void 0===P?"/admin/editor":P,x=t.playgroundPath,w=void 0===x?"/admin/playground":x,I=t.appSettingsPath,S=void 0===I?"/admin/app-settings":I,L=t.previewPath,A=void 0===L?"/preview":L,N=t.getAdminMenu,B=t.isDarkColorMode,C=void 0!==B&&B,R=t.toggleColorMode,O=t.useCssInJs,F=void 0!==O&&O,z=t.appRootElement,H=t.clickToEditSide,K=void 0===H?m.ClickToEditSide.BottomRight:H,U=t.responsiveBreakpoints,j=t.enableAutoSave,M=void 0===j||j,W=t.disableSaveIfInvalidProps,_=void 0!==W&&W,V=t.enablePreview,G=void 0===V||V,J=t.blockIconsPosition,Q=void 0===J?m.BlockIconsPosition.InsideBlock:J,q=t.enableUnsplash,X=void 0===q||q,Y=t.unsplashApiKey,Z=t.enablePreviewImage,$=void 0!==Z&&Z,ee=t.enablePreviewIcon,te=void 0!==ee&&ee,ne=t.children,re=b(e.useState({webP:!0,lazyLoading:!0}),2),ae=re[0],oe=re[1];e.useEffect((function(){h(void 0,void 0,Promise,(function(){var e,t;return v(this,(function(n){switch(n.label){case 0:return e=!1,"loading"in HTMLImageElement.prototype&&(e=!0),[4,be];case 1:return t=n.sent(),oe({webP:t,lazyLoading:e}),[2]}}))}))}),[]);var ie=!1;if(a&&0!==a.length||console.warn("No bricks provided. Using default paragraph."),o||console.warn("No Page type schema provided. Using default page."),Array.isArray(a)||(console.error('"bricks" should be an array of Bricks'),ie=!0),null==o||o.forEach((function(e){e.getDefaultContent&&e.getDefaultContent().length>0&&"string"!=typeof e.getDefaultContent()[0]&&console.error("A page type getDefaultContent() must return an array of bricks' names: please check the ".concat(e.name," page type."))})),a&&a.forEach((function(e){e.schema?(e.schema.render&&console.warn('The "render" method is depreacted on React Bricks v2 bricks. Please check the '.concat(name," brick.")),e.schema.superType&&console.warn('The "superType" property is depreacted on React Bricks v2 bricks. Please check the '.concat(name," brick.")),e.schema.textEditProps&&console.warn('The "textEditProps" property is depreacted on React Bricks v2 bricks. Please check the '.concat(name," brick."))):(console.error('Each brick component must have a "schema" property. Please check the '.concat(name," brick.")),ie=!0)})),ie)return e.createElement("div",{style:{padding:"8px 16px",backgroundColor:"#fff5f5",border:"1px solid #fed7d7",borderRadius:4,color:"#c53030",margin:"50px auto",width:300}},"At least a blocking error found in schema. Check the console.");var le=null==a?void 0:a.reduce((function(e,t){var n;return f(f({},e),((n={})[t.schema.name]=t,n))}),{}),ce=U&&U.length?U:ve,se=ke;return u&&(se=u,void 0===u.sideImage&&(se.sideImage=ke.sideImage),void 0===u.welcomeText&&(se.welcomeText=ke.welcomeText),void 0===u.logoHeight&&(se.logoHeight=ke.logoHeight)),e.createElement(D.Provider,{value:{appId:n,apiKey:r,bricks:le||he,pageTypes:o||Ee,customFields:i,logo:s,loginUI:se,contentClassName:p,renderLocalLink:g,navigate:y,loginPath:k,editorPath:T,playgroundPath:w,appSettingsPath:S,previewPath:A,getAdminMenu:N,isDarkColorMode:C,toggleColorMode:R,useCssInJs:F,appRootElement:z,clickToEditSide:K,responsiveBreakpoints:ce,enableAutoSave:!!M,disableSaveIfInvalidProps:!!_,enablePreview:!!G,browserSupport:ae,blockIconsPosition:Q,enableUnsplash:X,unsplashApiKey:Y,enablePreviewImage:$,enablePreviewIcon:te}},e.createElement(l,{client:ye},ne))},Te=function(t){var n=t.bricks,r=t.block;return e.createElement(e.Fragment,null,function(t){var r=n[t.type],a=b(T(),1)[0];if(r){var o=t.props;return r.schema.mapExternalDataToProps&&"function"==typeof r.schema.mapExternalDataToProps&&a.externalData&&"object"==typeof a.externalData&&(o=r.schema.mapExternalDataToProps(a.externalData,t.props)),e.createElement(x.Provider,{value:{values:o,onChange:function(){},blockId:t.id,blockType:t.type,parents:[],handleChange:function(e){return function(){}},handleAddItem:function(e){return function(){}}}},e.createElement(r,f({},o)))}}(r))},xe=function(t){var n=t.bricks,r=t.content;return e.createElement("div",null,r.map((function(t){return e.createElement(Te,{key:t.id,bricks:n,block:t})})))},we=function(e){var o=e.pageId,i=e.language,l=n(D),c=l.navigate,u=l.editorPath,d=l.clickToEditSide,p=b(r(!1),2),f=p[0],g=p[1];if(a((function(){g(!0)}),[]),!f)return null;var h,v=localStorage.getItem("rb_t");if(v&&v.length>10&&v.startsWith("ey")){var y={};return d===m.ClickToEditSide.BottomRight&&(y.bottom=50,y.right=0,y.borderTopLeftRadius=999,y.borderBottomLeftRadius=999,y.transform="translate(8px,0)"),d===m.ClickToEditSide.BottomLeft&&(y.bottom=50,y.left=0,y.borderTopRightRadius=999,y.borderBottomRightRadius=999,y.transform="translate(-8px,0)"),d===m.ClickToEditSide.TopRight&&(y.top=50,y.right=0,y.borderTopLeftRadius=999,y.borderBottomLeftRadius=999,y.transform="translate(8px,0)"),d===m.ClickToEditSide.TopLeft&&(y.top=50,y.left=0,y.borderTopRightRadius=999,y.borderBottomRightRadius=999,y.transform="translate(-8px,0)"),t.createElement(t.Fragment,null,t.createElement("style",null,"\n.rb-click-to-edit {\n position: fixed;\n width: 61px;\n height: 38px;\n background-color: #f65a8e;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n transition: all 150ms ease;\n border: 2px solid #fff;\n}\n.rb-click-to-edit-left:hover {\n transform: translate(-2px,0)!important;\n}\n.rb-click-to-edit-right:hover {\n transform: translate(2px,0)!important;\n}\n "),t.createElement("div",{className:"rb-click-to-edit ".concat((h=d,h===m.ClickToEditSide.TopLeft||h===m.ClickToEditSide.BottomLeft?"rb-click-to-edit-left":"rb-click-to-edit-right")),style:y,onClick:function(){return c("".concat(u,"?p=").concat(encodeURIComponent(o),"&l=").concat(i))}},t.createElement(s,null)))}return null},Ie=function(t){var r=t.page;if(!r)return null;var a=n(D).bricks;r.content;var o=g(r,["content"]),i=f({},o);return e.createElement("div",null,r&&r.content&&r.content.length>0&&e.createElement(P.Provider,{value:{pageValues:i}},e.createElement(xe,{bricks:a,content:r.content}),e.createElement(we,{pageId:r.id,language:r.language})))},Se=function(e,t,n){return!(n&&n.find((function(t){return t===e}))||t&&!t.find((function(t){return t===e})))},Le={id:"",type:"",slug:"",name:"",meta:{},author:{id:"",firstName:"",lastName:"",email:""},status:m.PageStatus.Draft,isLocked:!1,content:[],tags:[],createdAt:"",language:"en",translations:[]},Ae=function(e,t,n){if(!e||!e.type||!e.content)return Le;var r=t.find((function(t){return t.name===e.type}));if(!r)return Le;var a=Ne(n,e.content,r.allowedBlockTypes,r.excludedBlockTypes);return f(f({},e),{content:a.blocks,invalidBlocksTypes:a.invalidBlocksTypes})},Ne=function(e,t,n,r){return t.reduce((function(t,a){var o=e[a.type];if(!o||!Se(a.type,n,r))return f(f({},t),{invalidBlocksTypes:E(E([],b(t.invalidBlocksTypes),!1),[a.type],!1)});var i=o.schema.sideEditProps?o.schema.sideEditProps.reduce((function(e,t){if(t.groupName||"BOOLEAN"!==t.type||e.push(t),t.groupName){var n=t.props.filter((function(e){return"BOOLEAN"===e.type}));e=E(E([],b(e),!1),b(n),!1)}return e}),[]):[],l=i.reduce((function(e,t){var n,r=a.props[t.name];return f(f({},e),((n={})[t.name]=!!r,n))}),{}),c=f(f({},a),{props:f(f({},a.props),l)});return Object.keys(c.props).forEach((function(t){var n,r,a,i,l,s,u;c.props[t]&&(null===(r=null===(n=c.props[t])||void 0===n?void 0:n.document)||void 0===r?void 0:r.data)&&(null===(i=null===(a=c.props[t])||void 0===a?void 0:a.document)||void 0===i?void 0:i.nodes)&&"document"===(null===(s=null===(l=c.props[t])||void 0===l?void 0:l.document)||void 0===s?void 0:s.object)||(null===(u=o.schema.repeaterItems)||void 0===u?void 0:u.find((function(e){return e.name===t})))&&(c.props[t]=Ne(e,c.props[t]).blocks)})),f(f({},t),{blocks:E(E([],b(t.blocks),!1),[c],!1)})}),{blocks:[],invalidBlocksTypes:[]})},Be=function(){var t=b(r(),2),o=t[0],i=t[1],l=n(D),c=l.bricks,s=l.pageTypes;if(a((function(){h(void 0,void 0,void 0,(function(){var e,t,n,r,a,o;return v(this,(function(l){switch(l.label){case 0:return(e=new URLSearchParams(window.location.search)).has("p")?(t=encodeURIComponent(e.get("p")||""),[4,u.get("".concat(ne,"/app/preview/").concat(t))]):[3,4];case 1:return n=l.sent().data,r=null,(null==(a=null==s?void 0:s.find((function(e){return e.name===n.type})))?void 0:a.getExternalData)&&"function"==typeof a.getExternalData?[4,a.getExternalData(n)]:[3,3];case 2:(r=l.sent())&&"object"==typeof r&&(n.externalData=r),l.label=3;case 3:o=Ae(n,s,c),i(o),l.label=4;case 4:return[2]}}))}))}),[]),!o)return null;o.content;var d=g(o,["content"]),p=f({},d);return e.createElement("div",null,o&&o.content&&o.content.length>0&&e.createElement(P.Provider,{value:{pageValues:p}},e.createElement(xe,{bricks:c,content:o.content})))},Ce=function(e){if("undefined"==typeof window)return null;e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(window.location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},Re=function(e,t){var r=n(D).pageTypes,a=localStorage.getItem("rb_t"),o=Ce("t");return c(["page",{pageId:e,language:t}],(function(){return h(void 0,void 0,Promise,(function(){var n,i,l;return v(this,(function(c){switch(c.label){case 0:return[4,u.get(t?"".concat(ne,"/admin/pages/").concat(e,"/translations/").concat(t):"".concat(ne,"/admin/pages/").concat(e),{headers:{Authorization:"Bearer ".concat(a||o)}})];case 1:return n=c.sent().data,i=null,(null==(l=null==r?void 0:r.find((function(e){return e.name===n.type})))?void 0:l.getExternalData)&&"function"==typeof l.getExternalData?[4,l.getExternalData(n)]:[3,3];case 2:(i=c.sent())&&"object"==typeof i&&(n.externalData=i),c.label=3;case 3:return[2,n]}}))}))}),{enabled:!(!e||!a&&!o),refetchOnWindowFocus:!1})},Oe=function(e,t){var r=n(D),a=r.apiKey,o=r.pageTypes;return c(["pagePublic",{slug:e,language:t}],(function(){return h(void 0,void 0,Promise,(function(){var n,r,i;return v(this,(function(l){switch(l.label){case 0:return[4,u.get(t?"".concat(ne,"/app/pages/").concat(e,"/translations/").concat(t):"".concat(ne,"/app/pages/").concat(e),{headers:{Authorization:"Bearer ".concat(a)}})];case 1:return n=l.sent().data,r=null,(null==(i=null==o?void 0:o.find((function(e){return e.name===n.type})))?void 0:i.getExternalData)&&"function"==typeof i.getExternalData?[4,i.getExternalData(n)]:[3,3];case 2:(r=l.sent())&&"object"==typeof r&&(n.externalData=r),l.label=3;case 3:return[2,n]}}))}))}),{enabled:!!e})},De=function(e){var t=void 0===e?{}:e,n=t.type,r=void 0===n?"":n,a=t.types,o=void 0===a?[]:a,i=t.tag,l=void 0===i?"":i,s=t.language,d=void 0===s?"":s,p=t.page,m=void 0===p?1:p,f=t.pageSize,g=void 0===f?1e3:f,y=t.sort,b=void 0===y?"":y,E=t.usePagination,k=void 0!==E&&E,P=t.filterBy,T=void 0===P?{}:P;g<=0&&(g=1e3);var x=localStorage.getItem("rb_t"),w=Ce("t"),I="type=".concat(r,"&types=").concat(null==o?void 0:o.join(","),"&tag=").concat(l,"&language=").concat(d,"&page=").concat(m,"&pageSize=").concat(g,"&sort=").concat(b,"&filterBy=").concat(JSON.stringify(T));return c(["pages",{pageType:r,pageTypes:o,tag:l,language:d,page:m,pageSize:g,sort:b}],(function(){return h(void 0,void 0,void 0,(function(){var e,t,n,r;return v(this,(function(a){switch(a.label){case 0:return[4,u.get("".concat(ne,"/admin/pages?").concat(I))];case 1:return e=a.sent(),t=e.data,n=e.headers,k?(r=n["x-total-count"]?parseInt(n["x-total-count"],10):0,[2,{items:t,pagination:{page:m,pageSize:g,totalItems:r,totalPages:Math.ceil(r/g)}}]):[2,t]}}))}))}),{enabled:!!x||!!w})},Fe=function(e){var t=void 0===e?{}:e,r=t.type,a=void 0===r?"":r,o=t.types,i=void 0===o?[]:o,l=t.tag,s=void 0===l?"":l,d=t.language,p=void 0===d?"":d,m=t.page,f=void 0===m?1:m,g=t.pageSize,y=void 0===g?100:g,b=t.sort,E=void 0===b?"":b,k=t.usePagination,P=void 0!==k&&k,T=t.filterBy,x=void 0===T?{}:T,w=n(D).apiKey;y<=0&&(y=100);var I="type=".concat(a,"&types=").concat(null==i?void 0:i.join(","),"&tag=").concat(s,"&language=").concat(p,"&page=").concat(f,"&pageSize=").concat(y,"&sort=").concat(E,"&filterBy=").concat(JSON.stringify(x));return c(["pagesPublic",{pageType:a,pageTypes:i,tag:s,page:f,pageSize:y,sort:E}],(function(){return h(void 0,void 0,void 0,(function(){var e,t,n,r;return v(this,(function(a){switch(a.label){case 0:return[4,u.get("".concat(ne,"/app/pages?").concat(I),{headers:{Authorization:"Bearer ".concat(w)}})];case 1:return e=a.sent(),t=e.data,n=e.headers,P?(r=n["x-total-count"]?parseInt(n["x-total-count"],10):0,[2,{items:t,pagination:{page:f,pageSize:y,totalItems:r,totalPages:Math.ceil(r/y)}}]):[2,t]}}))}))}))},ze=function(e,t){void 0===e&&(e=1),void 0===t&&(t=100);var r=n(D).apiKey;return c(["tagsPublic"],(function(){return h(void 0,void 0,void 0,(function(){var n,a,o,i;return v(this,(function(l){switch(l.label){case 0:return[4,u.get("".concat(ne,"/app/tags?pageSize=").concat(t,"&page=").concat(e),{headers:{Authorization:"Bearer ".concat(r)}})];case 1:return n=l.sent(),a=n.data,o=n.headers,i=o["x-total-count"]?parseInt(o["x-total-count"],10):0,[2,{items:a,pagination:{page:e,pageSize:t,totalItems:i,totalPages:Math.ceil(i/t)}}]}}))}))}),{staleTime:3e5})},He=function(){return n(D)},Ke=function(e,t,n,r){return h(void 0,void 0,Promise,(function(){var a,o,i,l;return v(this,(function(c){switch(c.label){case 0:return a=n?"/translations/".concat(n):"",[4,u.get("".concat(ne,"/app/pages/").concat(e).concat(a),{headers:{Authorization:"Bearer ".concat(t)}})];case 1:return o=c.sent().data,i=null,(null==(l=null==r?void 0:r.find((function(e){return e.name===o.type})))?void 0:l.getExternalData)&&"function"==typeof l.getExternalData?[4,l.getExternalData(o)]:[3,3];case 2:(i=c.sent())&&"object"==typeof i&&(o.externalData=i),c.label=3;case 3:return[2,o]}}))}))},Ue=function(e,t){var n=void 0===t?{}:t,r=n.type,a=void 0===r?"":r,o=n.types,i=void 0===o?[]:o,l=n.tag,c=void 0===l?"":l,s=n.language,d=void 0===s?"":s,p=n.page,m=void 0===p?1:p,f=n.pageSize,g=void 0===f?100:f,y=n.sort,b=void 0===y?"":y,E=n.filterBy,k=void 0===E?{}:E,P=n.usePagination,T=void 0!==P&&P;return h(void 0,void 0,void 0,(function(){var t,n,r,o,l;return v(this,(function(s){switch(s.label){case 0:return g<=0&&(g=100),t="type=".concat(a,"&types=").concat(null==i?void 0:i.join(","),"&tag=").concat(c,"&language=").concat(d,"&page=").concat(m,"&pageSize=").concat(g,"&sort=").concat(b,"&filterBy=").concat(JSON.stringify(k)),[4,u.get("".concat(ne,"/app/pages?").concat(t),{headers:{Authorization:"Bearer ".concat(e)}})];case 1:return n=s.sent(),r=n.data,o=n.headers,T?(l=o["x-total-count"]?parseInt(o["x-total-count"],10):0,[2,{items:r,pagination:{page:m,pageSize:g,totalItems:l,totalPages:Math.ceil(l/g)}}]):[2,r]}}))}))},je=function(e,t,n){return void 0===t&&(t=1),void 0===n&&(n=100),h(void 0,void 0,Promise,(function(){var r,a,o,i;return v(this,(function(l){switch(l.label){case 0:return[4,u.get("".concat(ne,"/app/tags?pageSize=").concat(n,"&page=").concat(t),{headers:{Authorization:"Bearer ".concat(e)}})];case 1:return r=l.sent(),a=r.data,o=r.headers,i=o["x-total-count"]?parseInt(o["x-total-count"],10):0,[2,{items:a,pagination:{page:t,pageSize:n,totalItems:i,totalPages:Math.ceil(i/n)}}]}}))}))},Me=function(e){return e.reduce((function(e,t){var n=[];for(var r in t.props)Array.isArray(t.props[r])&&t.props[r].length>0&&t.props[r][0].props?n.push.apply(n,E([],b(Me(t.props[r])),!1)):n.push(A.serialize(t.props[r]));return E(E([],b(e),!1),b(n),!1)}),[])};export{ne as A,x as B,k as C,pe as D,Le as E,de as F,me as G,fe as H,se as I,Pe as J,Ie as K,j as L,Be as M,Oe as N,ze as O,A as P,Ke as Q,D as R,ae as S,R as T,Ue as U,je as V,Me as W,b as _,E as a,f as b,g as c,y as d,h as e,v as f,p as g,He as h,De as i,re as j,Ce as k,oe as l,Se as m,Fe as n,Re as o,Ae as p,Ne as q,ye as r,W as s,m as t,T as u,F as v,$ as w,te as x,O as y,ue as z};
2
- //# sourceMappingURL=react-bricks-5ec71325.esm.js.map
@@ -1,2 +0,0 @@
1
- "use strict";var e=require("react"),t=require("classnames"),n=require("react-query"),r=require("react-icons/fi"),a=require("axios");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function i(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var l,s,c,u,d,p,m,g,f,h,v,y,x=i(e),b=o(e),E=o(t),k=o(a),P=function(e,t){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},P(e,t)};function T(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n}function w(e,t,n,r){return new(n||(n=Promise))((function(a,o){function i(e){try{s(r.next(e))}catch(e){o(e)}}function l(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}s((r=r.apply(e,t||[])).next())}))}function I(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(a=2&o[0]?r.return:o[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function _(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i}function C(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}exports.__assign=function(){return exports.__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},exports.__assign.apply(this,arguments)},exports.types=void 0,l=exports.types||(exports.types={}),(s=l.SideEditPropType||(l.SideEditPropType={})).Text="TEXT",s.Textarea="TEXTAREA",s.Number="NUMBER",s.Date="DATE",s.Range="RANGE",s.Boolean="BOOLEAN",s.Select="SELECT",s.Image="IMAGE",s.Custom="CUSTOM",s.Relationship="RELATIONSHIP",(c=l.OptionsDisplay||(l.OptionsDisplay={})).Select="SELECT",c.Radio="RADIO",c.Color="COLOR",(u=l.RichTextFeatures||(l.RichTextFeatures={})).Bold="BOLD",u.Italic="ITALIC",u.Code="CODE",u.Highlight="HIGHLIGHT",u.Link="LINK",u.UnorderedList="UL",u.OrderedList="OL",u.Heading1="H1",u.Heading2="H2",u.Heading3="H3",u.Heading4="H4",u.Heading5="H5",u.Heading6="H6",u.Quote="QUOTE",(d=l.SortDirection||(l.SortDirection={})).Up="UP",d.Down="DOWN",(p=l.PageStatus||(l.PageStatus={})).Draft="DRAFT",p.Published="PUBLISHED",(m=l.DeployEnvironment||(l.DeployEnvironment={})).Staging="STAGING",m.Production="PRODUCTION",(g=l.PlaygroundSelectedItemType||(l.PlaygroundSelectedItemType={})).Block="BLOCK",g.Page="PAGE",(f=l.DeviceType||(l.DeviceType={})).Desktop="DESKTOP",f.Tablet="TABLET",f.Phone="PHONE",(h=l.Tab||(l.Tab={})).Block="BLOCK",h.Item="ITEM",h.PageSettings="PAGE-SETTINGS",h.Document="DOCUMENT",h.Stories="STORIES",h.CollaborationLocked="COLLABORATION-LOCKED",(v=l.ClickToEditSide||(l.ClickToEditSide={})).BottomRight="BOTTOM-RIGHT",v.BottomLeft="BOTTOM-LEFT",v.TopRight="TOP-RIGHT",v.TopLeft="TOP-LEFT",(y=l.BlockIconsPosition||(l.BlockIconsPosition={})).InsideBlock="INSIDE-BLOCK",y.OutsideBlock="OUTSIDE-BLOCK";var S=x.createContext({focused:{blockId:""},setFocused:function(){},triggerTextRefreshBlockId:"",setTriggerTextRefreshBlockId:function(){},setAddAfterBlockId:function(){},pageValues:{id:"",type:"",name:"",slug:"",meta:{},authorId:"",author:{id:"",email:"",firstName:"",lastName:""},invalidBlocksTypes:[],status:exports.types.PageStatus.Draft,isLocked:!1,tags:[],createdAt:"",publishedAt:"",language:"",translations:[]},handleChangePageValue:function(){}}),A=x.createContext({pageValues:{id:"",type:"",name:"",slug:"",meta:{},authorId:"",author:{id:"",email:"",firstName:"",lastName:""},invalidBlocksTypes:[],status:exports.types.PageStatus.Draft,isLocked:!1,tags:[],createdAt:"",publishedAt:"",language:"",translations:[]}}),L=function(){var t=e.useContext(S),n=t.pageValues,r=t.handleChangePageValue,a=e.useContext(A).pageValues;return[n.id?n:a,r]},B=x.createContext({values:{},onChange:function(){},blockId:"",blockType:"",parents:[],handleChange:function(e){return function(){}}}),N=function(e){return function(e){var t,n;if(!1===O(e))return!1;if("function"!=typeof(t=e.constructor))return!1;if(!1===O(n=t.prototype))return!1;if(!1===n.hasOwnProperty("isPrototypeOf"))return!1;return!0}(e)&&"string"==typeof e.text};function R(e){return N(e)?e.text:e.children&&Array.isArray(e.children)?e.children.map(R).join(""):""}function O(e){return!0==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var D,F={serialize:function(e){return Array.isArray(e)&&e.length>0?e.map(R).join("\n"):""},deserialize:function(e){return e.split("\n").map((function(e){return{type:"paragraph",children:[{text:e}]}}))},isText:N},z=function(e,t,n){if(F.isText(e)){var r=j(e.text);return t.filter((function(e){return"Mark"===e.type})).reduce((function(t,n){return e[n.name]?n.renderLeaf({children:t}):t}),r)}var a=t.filter((function(e){return"List"===e.type})).find((function(t){return e.type===t.name}));if(a){var o=H(e,t);return a.renderElement({children:o.map((function(e,t){return x.createElement(x.Fragment,{key:t},a.renderItemElement({children:e}))})),element:{url:e.url}})}var i=H(e,t,n),l=t.filter((function(e){return"Block"===e.type})).find((function(t){return e.type===t.name}));return l?l.renderElement({children:i,element:{url:e.url}}):n?n({children:i,element:{type:"",children:[]},attributes:{ref:null}}):i},H=function(e,t,n){var r;return null===(r=e.children)||void 0===r?void 0:r.map((function(e,r){return x.createElement(x.Fragment,{key:r},z(e,t,n))}))},j=function(e){var t=null==e?void 0:e.replace(/\n/g,"<|BR|>\n<|BR|>").split("<|BR|>");if(t)return 1===t.length?e:x.createElement(x.Fragment,null,t.map((function(e,t,n){return"\n"===e&&n.length===t+1||"\n"===e&&n.length===t+2&&""===n[n.length-1]?x.createElement(x.Fragment,{key:t},x.createElement("br",null)," "):"\n"===e?x.createElement("br",null):x.createElement(x.Fragment,{key:t},e)})))},K=function(t){var n,r,a=t.renderBlock,o=t.placeholder,i=t.renderPlaceholder,l=t.propName,s=t.multiline,c=void 0!==s&&s,u=t.softLineBreak,d=void 0!==u&&u,p=t.metaFieldName,m=t.customFieldName,g=e.useContext(B).values,f=_(L(),1)[0],h=l?g[l]:p?f.meta[p]||"":m&&f.customValues&&f.customValues[m]||"";if(null===(n=K.prototype)||void 0===n?void 0:n.renderAdmin)return null===(r=K.prototype)||void 0===r?void 0:r.renderAdmin({renderBlock:a,placeholder:o,renderPlaceholder:i,propName:l,multiline:c,softLineBreak:d,metaFieldName:p,customFieldName:m});var v=h;return h?("string"==typeof h&&(v=F.deserialize(h)),x.createElement(x.Fragment,null,v.map((function(e,t){return x.createElement(x.Fragment,{key:t},z(e,[],a))})))):null},U=function(t){var n,r,a=t.renderBlock,o=t.placeholder,i=t.renderPlaceholder,l=t.propName,s=t.plugins,c=void 0===s?[]:s,u=t.multiline,d=void 0===u||u,p=t.softLineBreak,m=void 0===p||p,g=t.metaFieldName,f=t.customFieldName,h=e.useContext(B).values,v=_(L(),1)[0],y=l?h[l]:g?v.meta[g]:f&&v.customValues?v.customValues[f]:"";if(null===(n=U.prototype)||void 0===n?void 0:n.renderAdmin)return null===(r=U.prototype)||void 0===r?void 0:r.renderAdmin({renderBlock:a,placeholder:o,renderPlaceholder:i,propName:l,plugins:c,multiline:d,softLineBreak:m,metaFieldName:g,customFieldName:f});var b=y;return y?("string"==typeof y&&(b=F.deserialize(y)),x.createElement(x.Fragment,null,b.map((function(e,t){return x.createElement(x.Fragment,{key:t},z(e,c,a))})))):null},M=x.createContext({appId:"",apiKey:"",bricks:{},pageTypes:[],logo:"",loginUI:{},contentClassName:"",renderLocalLink:function(e){var t=e.href,n=e.children;return x.createElement("a",{href:t},n)},navigate:function(){},loginPath:"",editorPath:"",playgroundPath:"",appSettingsPath:"",previewPath:"",getAdminMenu:function(e){return e.isAdmin,[]},useCssInJs:!1,appRootElement:"",clickToEditSide:exports.types.ClickToEditSide.BottomRight,responsiveBreakpoints:[],enableAutoSave:!0,disableSaveIfInvalidProps:!1,enablePreview:!0,browserSupport:{webP:!0,lazyLoading:!0},blockIconsPosition:exports.types.BlockIconsPosition.InsideBlock,enableUnsplash:!0,unsplashApiKey:"",enablePreviewImage:!1,enablePreviewIcon:!1}),W=function(e){var t,n;return(null===(t=W.prototype)||void 0===t?void 0:t.adminConstructor)?null===(n=W.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:"Mark",name:e.name,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderLeaf:e.render,toggle:function(e){}}},V=W({name:"bold",hotKey:"mod+b",render:function(e){return x.createElement("strong",null,e.children)}}),Q=W({name:"italic",hotKey:"mod+i",render:function(e){return x.createElement("em",null,e.children)}}),G=W({name:"code",hotKey:"mod+`",render:function(e){return x.createElement("code",{style:{margin:"0 1px",display:"inline-block",padding:"3px 6px",fontSize:"0.875rem",lineHeight:1.25,maxWidth:"100%",fontFamily:'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',borderRadius:"3px",backgroundColor:"#F5F7F9"}},e.children)}}),q=W({name:"highlight",hotKey:"mod+h",render:function(e){return x.createElement("mark",{style:{paddingLeft:4,paddingRight:4,borderRadius:2,backgroundColor:"#ff0",color:"#0f0f05"}},e.children)}}),J=function(t){var n,r,a=t.href,o=t.children,i=t.target,l=t.className,s=T(t,["href","children","target","className"]),c=e.useContext(M).renderLocalLink;if(null===(n=J.prototype)||void 0===n?void 0:n.renderAdmin)return null===(r=J.prototype)||void 0===r?void 0:r.renderAdmin(exports.__assign({href:a,children:o,target:i,className:l},s));var u={href:a};return/^\/(?!\/)/.test(a)?c?c(exports.__assign({href:a,target:i,children:o,className:l},s)):(c||console.warn("Local path found in Link, but no renderLocalLink function was provided. Rendering <a> as fallback"),x.createElement("a",exports.__assign({},u,{target:i,className:l},s),o)):x.createElement("a",exports.__assign({},u,{target:i,className:l},s),o)},X={type:"Block",name:"link",label:"Link",isInline:!0,renderElement:function(e){var t=e.attributes,n=e.children,r=e.element;return x.createElement(J,exports.__assign({},t,{href:r.url}),n)},toggle:function(e){}},Y=function(e){var t,n;return(null===(t=Y.prototype)||void 0===t?void 0:t.adminConstructor)?null===(n=Y.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,t){}}},$=Y({name:"h1",hotKey:"mod+shift+1",render:function(e){return x.createElement("h1",null,e.children)}}),Z=Y({name:"h2",hotKey:"mod+shift+2",render:function(e){return x.createElement("h2",null,e.children)}}),ee=Y({name:"h3",hotKey:"mod+shift+3",render:function(e){return x.createElement("h3",null,e.children)}}),te=Y({name:"h4",hotKey:"mod+shift+4",render:function(e){return x.createElement("h4",null,e.children)}}),ne=Y({name:"h5",hotKey:"mod+shift+5",render:function(e){return x.createElement("h5",null,e.children)}}),re=Y({name:"h6",hotKey:"mod+shift+6",render:function(e){return x.createElement("h6",null,e.children)}}),ae=Y({name:"quote",render:function(e){return x.createElement("blockquote",null,e.children)}}),oe=Y({name:"ol",label:"Number list",itemName:"li",render:function(e){return x.createElement("ol",{className:"list-decimal"},e.children)},renderItem:function(e){return x.createElement("li",null,e.children)}}),ie=Y({name:"ul",label:"Bullet list",itemName:"li",render:function(e){return x.createElement("ul",{className:"list-disc"},e.children)},renderItem:function(e){return x.createElement("li",null,e.children)}}),le=Object.freeze({__proto__:null,bold:V,italic:Q,code:G,highlight:q,link:X,heading1:$,heading2:Z,heading3:ee,heading4:te,heading5:ne,heading6:re,quote:ae,orderedList:oe,unorderedList:ie}),se=((D={})[exports.types.RichTextFeatures.Bold]={newPlugin:V,renderLeaf:"renderBold"},D[exports.types.RichTextFeatures.Italic]={newPlugin:Q,renderLeaf:"renderItalic"},D[exports.types.RichTextFeatures.Highlight]={newPlugin:q,renderLeaf:"renderHighlight"},D[exports.types.RichTextFeatures.Code]={newPlugin:G,renderLeaf:"renderCode"},D[exports.types.RichTextFeatures.Link]={newPlugin:X,renderLink:"renderLink"},D[exports.types.RichTextFeatures.UnorderedList]={newPlugin:ie,renderElement:"renderUL",renderItemElement:"renderLI"},D[exports.types.RichTextFeatures.OrderedList]={newPlugin:oe,renderElement:"renderOL",renderItemElement:"renderLI"},D[exports.types.RichTextFeatures.Heading1]={newPlugin:$,renderElement:"renderH1"},D[exports.types.RichTextFeatures.Heading2]={newPlugin:Z,renderElement:"renderH2"},D[exports.types.RichTextFeatures.Heading3]={newPlugin:ee,renderElement:"renderH3"},D[exports.types.RichTextFeatures.Heading4]={newPlugin:te,renderElement:"renderH4"},D[exports.types.RichTextFeatures.Heading5]={newPlugin:ne,renderElement:"renderH5"},D[exports.types.RichTextFeatures.Heading6]={newPlugin:re,renderElement:"renderH6"},D[exports.types.RichTextFeatures.Quote]={newPlugin:ae,renderElement:"renderQuote"},D),ce=function(e){var t,n;if(null===(t=ce.prototype)||void 0===t?void 0:t.renderAdmin)return null===(n=ce.prototype)||void 0===n?void 0:n.renderAdmin(e);var r=[];return e.allowedFeatures&&e.allowedFeatures.length>0&&(r=e.allowedFeatures.map((function(t){var n=se[t],r=n.newPlugin,a=n.renderLeaf,o=n.renderElement,i=n.renderItemElement,l=n.renderLink,s={},c=e[a],u=e[o],d=e[i],p=e[l];return a&&c&&(s.renderLeaf=c),o&&u&&(s.renderElement=u),i&&d&&(s.renderItemElement=d),l&&p&&(s.renderElement=function(e){var t=e.attributes,n=e.children,r=e.element;return p({attributes:t,children:n,element:r,href:r.url})}),exports.__assign(exports.__assign({},r),s)}))),b.default.createElement(U,{renderBlock:e.renderBlock,placeholder:e.placeholder,propName:e.propName,plugins:r,multiline:e.multiline,softLineBreak:e.softLineBreak,renderPlaceholder:e.renderPlaceholder,metaFieldName:e.metaFieldName,customFieldName:e.customFieldName})},ue="https://api.reactbricks.com/v2",de=function(e,t){if(!t)return e;var n=e.lastIndexOf(".");return e.substring(0,n)+"/"+t+e.substring(n)},pe=function(e,t){return e?t?e.split(",").map((function(e){var n=_(e.trim().split(" "),2),r=n[0],a=n[1];return r&&a?"".concat(de(r,t)," ").concat(a):de(e,t)})).join(", "):e:""},me=require("react-progressive-graceful-image").default,ge=function(e){e.propName;var t=e.source,n=e.alt,r=e.wrapper,a=e.noLazyLoad,o=void 0!==a&&a;e.containerClassName,e.containerStyle;var i=e.imageClassName,l=e.imageStyle,s=void 0===l?{}:l;e.noWrapper;var c=e.sizes,u=void 0===c?"100vw":c,d=e.loading,p=void 0===d?"lazy":d;e.renderWrapper;var m=e.useNativeLazyLoading,g=void 0===m||m;e.useWebP;var f=T(e,["propName","source","alt","wrapper","noLazyLoad","containerClassName","containerStyle","imageClassName","imageStyle","noWrapper","sizes","loading","renderWrapper","useNativeLazyLoading","useWebP"]);if(!t)return null;var h=x.useContext(M).browserSupport,v=(null==t?void 0:t.alt)||n,y=de(t.src,t.seoName),b=t.fallbackSrc?de(t.fallbackSrc,t.seoName):"",E=de(t.placeholderSrc||"",t.seoName),k=pe(t.srcSet,t.seoName),P=t.fallbackSrc?pe(t.fallbackSrc,t.seoName):"",w=p,I=b&&!h.webP?b:y,_=b&&!h.webP?P:k,C=exports.__assign({src:I,srcSet:_,sizes:u,alt:v,width:t.width,height:t.height,loading:w,decoding:"async",className:"rb-lazy ".concat(i),style:s},f),S=exports.__assign(exports.__assign({},C),{className:i});return r({width:t.width,height:t.height,children:x.createElement(x.Fragment,null,h.lazyLoading&&g?x.createElement("img",exports.__assign({},C)):x.createElement(me,{src:I,srcSetData:{srcSet:_,sizes:u},placeholder:E,delay:300,noLazyLoad:o},(function(e,t,n){var r=exports.__assign({},s);r.transition||(r.transition="filter 300ms ease-in-out"),t&&(r.filter="blur(2px)");var a=exports.__assign(exports.__assign({},C),{src:e,srcSet:n.srcSet,sizes:n.sizes});return x.createElement("img",exports.__assign({},a))})),x.createElement("noscript",null,x.createElement("style",{type:"text/css"},".rb-lazy { display: none; }"),x.createElement("img",exports.__assign({},S))))})},fe=function(t){var n,r,a=e.useContext(B).values,o=_(L(),2),i=o[0];o[1];var l=t.propName?a[t.propName]:t.metaFieldName?i.meta[t.metaFieldName]:t.customFieldName&&i.customValues?i.customValues[t.customFieldName]:null,s=function(e){var t=e.children;return x.createElement(x.Fragment,null,t)};if(!t.containerClassName&&!t.containerStyle||t.noWrapper||(s=function(e){var n=e.children;return x.createElement("div",{className:t.containerClassName,style:t.containerStyle},n)}),t.renderWrapper&&(s=t.renderWrapper),null===(n=fe.prototype)||void 0===n?void 0:n.renderAdmin)return null===(r=fe.prototype)||void 0===r?void 0:r.renderAdmin(t);t.maxWidth,t.aspectRatio;var c=T(t,["maxWidth","aspectRatio"]);return x.createElement(ge,exports.__assign({},c,{source:l,wrapper:s}))},he=function(t){var n,r=t.allowedExtensions,a=void 0===r?[]:r,o=t.propName,i=t.renderBlock,l=e.useContext(B).values[o];return(null===(n=he.prototype)||void 0===n?void 0:n.renderAdmin)?he.prototype.renderAdmin({propName:o,renderBlock:i,allowedExtensions:a}):l?i(l):null},ve=function(t){var n,r,a=t.propName,o=t.itemProps,i=void 0===o?{}:o,l=t.renderWrapper,s=t.renderItemWrapper,c=e.useContext(M).bricks,u=e.useContext(B),d=u.values,p=u.blockId,m=u.blockType,g=u.parents,f=u.handleChange;u.handleAddItem;var h=d[a];if(null===(n=ve.prototype)||void 0===n?void 0:n.renderAdmin)return null===(r=ve.prototype)||void 0===r?void 0:r.renderAdmin({propName:a,itemProps:i,renderWrapper:l,renderItemWrapper:s});if(!h||0===h.length)return null;var v=C(C([],_(g),!1),[{blockId:p,typeName:m,propName:a}],!1),y=x.createElement(x.Fragment,null,h.map((function(e,t){var n=c[e.type];if(n){var r=exports.__assign(exports.__assign(exports.__assign({},e.props),i),{key:e.id,index:t,onChange:function(){}}),a=x.createElement(B.Provider,{key:e.id,value:{onChange:f(e.id,v),values:e.props,blockId:e.id,blockType:e.type,parents:v,handleChange:f}},x.createElement(n,exports.__assign({},r)));return s?s(a,t,h.length):a}})));return l?l(y):y},ye=function(){var e,t;return(null===(e=ye.prototype)||void 0===e?void 0:e.useAdmin)?null===(t=ye.prototype)||void 0===t?void 0:t.useAdmin():{isAdmin:!1,previewMode:!1,currentPage:{pageId:""}}},xe=function(t){var n,r,a=e.useContext(B),o=a.values,i=a.onChange;if(null===(n=xe.prototype)||void 0===n?void 0:n.useAdmin)return null===(r=xe.prototype)||void 0===r?void 0:r.useAdmin(t);return[o[t],function(e){return i(t,e)},!0]},be=function(){return x.createElement("div",{className:E.default("max-w-xl mx-auto py-6")})};be.schema={name:"paragraph",label:"Paragraph",getDefaultProps:function(){return{text:"Lorem ipsum dolor sit amet"}}};var Ee={paragraph:be},ke=[{type:exports.types.DeviceType.Phone,width:375,label:"Phone (375px)"},{type:exports.types.DeviceType.Tablet,width:768,label:"Tablet (768px)"},{type:exports.types.DeviceType.Desktop,width:"100%",label:"Desktop (100%)"}],Pe=new n.QueryClient,Te=new Promise((function(e){var t=new Image;t.onerror=function(){return e(!1)},t.onload=function(){return e(1===t.width)},t.src="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA="})).catch((function(){return!1})),we=[{name:"page",pluralName:"pages",defaultLocked:!1,defaultStatus:exports.types.PageStatus.Draft,defaultLanguage:"en",getDefaultContent:function(){return[]}}],Ie={logoHeight:80,welcomeText:"Welcome",sideImage:"https://images.unsplash.com/photo-1461418559055-6f020c5a91e7?ixlib=rb-1.2.1&auto=format&fit=crop&w=1601&q=80"},_e=function(e){var t=e.bricks,n=e.block;return x.createElement(x.Fragment,null,function(e){var n=t[e.type],r=_(L(),1)[0];if(n){var a=e.props;return n.schema.mapExternalDataToProps&&"function"==typeof n.schema.mapExternalDataToProps&&r.externalData&&"object"==typeof r.externalData&&(a=n.schema.mapExternalDataToProps(r.externalData,e.props)),x.createElement(B.Provider,{value:{values:a,onChange:function(){},blockId:e.id,blockType:e.type,parents:[],handleChange:function(e){return function(){}},handleAddItem:function(e){return function(){}}}},x.createElement(n,exports.__assign({},a)))}}(n))},Ce=function(e){var t=e.bricks,n=e.content;return x.createElement("div",null,n.map((function(e){return x.createElement(_e,{key:e.id,bricks:t,block:e})})))},Se=function(t){var n=t.pageId,a=t.language,o=e.useContext(M),i=o.navigate,l=o.editorPath,s=o.clickToEditSide,c=_(e.useState(!1),2),u=c[0],d=c[1];if(e.useEffect((function(){d(!0)}),[]),!u)return null;var p,m=localStorage.getItem("rb_t");if(m&&m.length>10&&m.startsWith("ey")){var g={};return s===exports.types.ClickToEditSide.BottomRight&&(g.bottom=50,g.right=0,g.borderTopLeftRadius=999,g.borderBottomLeftRadius=999,g.transform="translate(8px,0)"),s===exports.types.ClickToEditSide.BottomLeft&&(g.bottom=50,g.left=0,g.borderTopRightRadius=999,g.borderBottomRightRadius=999,g.transform="translate(-8px,0)"),s===exports.types.ClickToEditSide.TopRight&&(g.top=50,g.right=0,g.borderTopLeftRadius=999,g.borderBottomLeftRadius=999,g.transform="translate(8px,0)"),s===exports.types.ClickToEditSide.TopLeft&&(g.top=50,g.left=0,g.borderTopRightRadius=999,g.borderBottomRightRadius=999,g.transform="translate(-8px,0)"),b.default.createElement(b.default.Fragment,null,b.default.createElement("style",null,"\n.rb-click-to-edit {\n position: fixed;\n width: 61px;\n height: 38px;\n background-color: #f65a8e;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n transition: all 150ms ease;\n border: 2px solid #fff;\n}\n.rb-click-to-edit-left:hover {\n transform: translate(-2px,0)!important;\n}\n.rb-click-to-edit-right:hover {\n transform: translate(2px,0)!important;\n}\n "),b.default.createElement("div",{className:"rb-click-to-edit ".concat((p=s,p===exports.types.ClickToEditSide.TopLeft||p===exports.types.ClickToEditSide.BottomLeft?"rb-click-to-edit-left":"rb-click-to-edit-right")),style:g,onClick:function(){return i("".concat(l,"?p=").concat(encodeURIComponent(n),"&l=").concat(a))}},b.default.createElement(r.FiEdit,null)))}return null},Ae=function(e,t,n){return!(n&&n.find((function(t){return t===e}))||t&&!t.find((function(t){return t===e})))},Le={id:"",type:"",slug:"",name:"",meta:{},author:{id:"",firstName:"",lastName:"",email:""},status:exports.types.PageStatus.Draft,isLocked:!1,content:[],tags:[],createdAt:"",language:"en",translations:[]},Be=function(e,t,n){if(!e||!e.type||!e.content)return Le;var r=t.find((function(t){return t.name===e.type}));if(!r)return Le;var a=Ne(n,e.content,r.allowedBlockTypes,r.excludedBlockTypes);return exports.__assign(exports.__assign({},e),{content:a.blocks,invalidBlocksTypes:a.invalidBlocksTypes})},Ne=function(e,t,n,r){return t.reduce((function(t,a){var o=e[a.type];if(!o||!Ae(a.type,n,r))return exports.__assign(exports.__assign({},t),{invalidBlocksTypes:C(C([],_(t.invalidBlocksTypes),!1),[a.type],!1)});var i=o.schema.sideEditProps?o.schema.sideEditProps.reduce((function(e,t){if(t.groupName||"BOOLEAN"!==t.type||e.push(t),t.groupName){var n=t.props.filter((function(e){return"BOOLEAN"===e.type}));e=C(C([],_(e),!1),_(n),!1)}return e}),[]):[],l=i.reduce((function(e,t){var n,r=a.props[t.name];return exports.__assign(exports.__assign({},e),((n={})[t.name]=!!r,n))}),{}),s=exports.__assign(exports.__assign({},a),{props:exports.__assign(exports.__assign({},a.props),l)});return Object.keys(s.props).forEach((function(t){var n,r,a,i,l,c,u;s.props[t]&&(null===(r=null===(n=s.props[t])||void 0===n?void 0:n.document)||void 0===r?void 0:r.data)&&(null===(i=null===(a=s.props[t])||void 0===a?void 0:a.document)||void 0===i?void 0:i.nodes)&&"document"===(null===(c=null===(l=s.props[t])||void 0===l?void 0:l.document)||void 0===c?void 0:c.object)||(null===(u=o.schema.repeaterItems)||void 0===u?void 0:u.find((function(e){return e.name===t})))&&(s.props[t]=Ne(e,s.props[t]).blocks)})),exports.__assign(exports.__assign({},t),{blocks:C(C([],_(t.blocks),!1),[s],!1)})}),{blocks:[],invalidBlocksTypes:[]})},Re=function(e){if("undefined"==typeof window)return null;e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(window.location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},Oe=function(e){return e.reduce((function(e,t){var n=[];for(var r in t.props)Array.isArray(t.props[r])&&t.props[r].length>0&&t.props[r][0].props?n.push.apply(n,C([],_(Oe(t.props[r])),!1)):n.push(F.serialize(t.props[r]));return C(C([],_(e),!1),_(n),!1)}),[])};exports.API_URI=ue,exports.AUTH_TOKEN_LS_KEY="rb_t",exports.BlockContext=B,exports.CompatibleRichText=ce,exports.ContentEditorContext=S,exports.EMPTY_PAGE=Le,exports.File=he,exports.Image=fe,exports.ImageViewer=ge,exports.Link=J,exports.PageViewer=function(t){var n=t.page;if(!n)return null;var r=e.useContext(M).bricks;n.content;var a=T(n,["content"]),o=exports.__assign({},a);return x.createElement("div",null,n&&n.content&&n.content.length>0&&x.createElement(A.Provider,{value:{pageValues:o}},x.createElement(Ce,{bricks:r,content:n.content}),x.createElement(Se,{pageId:n.id,language:n.language})))},exports.Plain=F,exports.Preview=function(){var t=_(e.useState(),2),n=t[0],r=t[1],a=e.useContext(M),o=a.bricks,i=a.pageTypes;if(e.useEffect((function(){w(void 0,void 0,void 0,(function(){var e,t,n,a,l,s;return I(this,(function(c){switch(c.label){case 0:return(e=new URLSearchParams(window.location.search)).has("p")?(t=encodeURIComponent(e.get("p")||""),[4,k.default.get("".concat(ue,"/app/preview/").concat(t))]):[3,4];case 1:return n=c.sent().data,a=null,(null==(l=null==i?void 0:i.find((function(e){return e.name===n.type})))?void 0:l.getExternalData)&&"function"==typeof l.getExternalData?[4,l.getExternalData(n)]:[3,3];case 2:(a=c.sent())&&"object"==typeof a&&(n.externalData=a),c.label=3;case 3:s=Be(n,i,o),r(s),c.label=4;case 4:return[2]}}))}))}),[]),!n)return null;n.content;var l=T(n,["content"]),s=exports.__assign({},l);return x.createElement("div",null,n&&n.content&&n.content.length>0&&x.createElement(A.Provider,{value:{pageValues:s}},x.createElement(Ce,{bricks:o,content:n.content})))},exports.ReactBricks=function(e){var t=e.appId,r=e.apiKey,a=e.bricks,o=e.pageTypes,i=e.customFields,l=e.logo,s=void 0===l?"":l,c=e.loginUI,u=e.contentClassName,d=void 0===u?"":u,p=e.renderLocalLink,m=e.navigate,g=e.loginPath,f=void 0===g?"/admin":g,h=e.editorPath,v=void 0===h?"/admin/editor":h,y=e.playgroundPath,b=void 0===y?"/admin/playground":y,E=e.appSettingsPath,k=void 0===E?"/admin/app-settings":E,P=e.previewPath,T=void 0===P?"/preview":P,C=e.getAdminMenu,S=e.isDarkColorMode,A=void 0!==S&&S,L=e.toggleColorMode,B=e.useCssInJs,N=void 0!==B&&B,R=e.appRootElement,O=e.clickToEditSide,D=void 0===O?exports.types.ClickToEditSide.BottomRight:O,F=e.responsiveBreakpoints,z=e.enableAutoSave,H=void 0===z||z,j=e.disableSaveIfInvalidProps,K=void 0!==j&&j,U=e.enablePreview,W=void 0===U||U,V=e.blockIconsPosition,Q=void 0===V?exports.types.BlockIconsPosition.InsideBlock:V,G=e.enableUnsplash,q=void 0===G||G,J=e.unsplashApiKey,X=e.enablePreviewImage,Y=void 0!==X&&X,$=e.enablePreviewIcon,Z=void 0!==$&&$,ee=e.children,te=_(x.useState({webP:!0,lazyLoading:!0}),2),ne=te[0],re=te[1];x.useEffect((function(){w(void 0,void 0,Promise,(function(){var e,t;return I(this,(function(n){switch(n.label){case 0:return e=!1,"loading"in HTMLImageElement.prototype&&(e=!0),[4,Te];case 1:return t=n.sent(),re({webP:t,lazyLoading:e}),[2]}}))}))}),[]);var ae=!1;if(a&&0!==a.length||console.warn("No bricks provided. Using default paragraph."),o||console.warn("No Page type schema provided. Using default page."),Array.isArray(a)||(console.error('"bricks" should be an array of Bricks'),ae=!0),null==o||o.forEach((function(e){e.getDefaultContent&&e.getDefaultContent().length>0&&"string"!=typeof e.getDefaultContent()[0]&&console.error("A page type getDefaultContent() must return an array of bricks' names: please check the ".concat(e.name," page type."))})),a&&a.forEach((function(e){e.schema?(e.schema.render&&console.warn('The "render" method is depreacted on React Bricks v2 bricks. Please check the '.concat(name," brick.")),e.schema.superType&&console.warn('The "superType" property is depreacted on React Bricks v2 bricks. Please check the '.concat(name," brick.")),e.schema.textEditProps&&console.warn('The "textEditProps" property is depreacted on React Bricks v2 bricks. Please check the '.concat(name," brick."))):(console.error('Each brick component must have a "schema" property. Please check the '.concat(name," brick.")),ae=!0)})),ae)return x.createElement("div",{style:{padding:"8px 16px",backgroundColor:"#fff5f5",border:"1px solid #fed7d7",borderRadius:4,color:"#c53030",margin:"50px auto",width:300}},"At least a blocking error found in schema. Check the console.");var oe=null==a?void 0:a.reduce((function(e,t){var n;return exports.__assign(exports.__assign({},e),((n={})[t.schema.name]=t,n))}),{}),ie=F&&F.length?F:ke,le=Ie;return c&&(le=c,void 0===c.sideImage&&(le.sideImage=Ie.sideImage),void 0===c.welcomeText&&(le.welcomeText=Ie.welcomeText),void 0===c.logoHeight&&(le.logoHeight=Ie.logoHeight)),x.createElement(M.Provider,{value:{appId:t,apiKey:r,bricks:oe||Ee,pageTypes:o||we,customFields:i,logo:s,loginUI:le,contentClassName:d,renderLocalLink:p,navigate:m,loginPath:f,editorPath:v,playgroundPath:b,appSettingsPath:k,previewPath:T,getAdminMenu:C,isDarkColorMode:A,toggleColorMode:L,useCssInJs:N,appRootElement:R,clickToEditSide:D,responsiveBreakpoints:ie,enableAutoSave:!!H,disableSaveIfInvalidProps:!!K,enablePreview:!!W,browserSupport:ne,blockIconsPosition:Q,enableUnsplash:q,unsplashApiKey:J,enablePreviewImage:Y,enablePreviewIcon:Z}},x.createElement(n.QueryClientProvider,{client:Pe},ee))},exports.ReactBricksContext=M,exports.Repeater=ve,exports.RichText=U,exports.SOCKET_PATH="/ws/",exports.SOCKET_URI="https://ws.reactbricks.com",exports.Text=K,exports.__awaiter=w,exports.__extends=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}P(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},exports.__generator=I,exports.__read=_,exports.__rest=T,exports.__spreadArray=C,exports.__values=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},exports.blockAllowed=Ae,exports.blockPluginConstructor=Y,exports.cleanBlocks=Ne,exports.cleanPage=Be,exports.fetchPage=function(e,t,n,r){return w(void 0,void 0,Promise,(function(){var a,o,i,l;return I(this,(function(s){switch(s.label){case 0:return a=n?"/translations/".concat(n):"",[4,k.default.get("".concat(ue,"/app/pages/").concat(e).concat(a),{headers:{Authorization:"Bearer ".concat(t)}})];case 1:return o=s.sent().data,i=null,(null==(l=null==r?void 0:r.find((function(e){return e.name===o.type})))?void 0:l.getExternalData)&&"function"==typeof l.getExternalData?[4,l.getExternalData(o)]:[3,3];case 2:(i=s.sent())&&"object"==typeof i&&(o.externalData=i),s.label=3;case 3:return[2,o]}}))}))},exports.fetchPages=function(e,t){var n=void 0===t?{}:t,r=n.type,a=void 0===r?"":r,o=n.types,i=void 0===o?[]:o,l=n.tag,s=void 0===l?"":l,c=n.language,u=void 0===c?"":c,d=n.page,p=void 0===d?1:d,m=n.pageSize,g=void 0===m?100:m,f=n.sort,h=void 0===f?"":f,v=n.filterBy,y=void 0===v?{}:v,x=n.usePagination,b=void 0!==x&&x;return w(void 0,void 0,void 0,(function(){var t,n,r,o,l;return I(this,(function(c){switch(c.label){case 0:return g<=0&&(g=100),t="type=".concat(a,"&types=").concat(null==i?void 0:i.join(","),"&tag=").concat(s,"&language=").concat(u,"&page=").concat(p,"&pageSize=").concat(g,"&sort=").concat(h,"&filterBy=").concat(JSON.stringify(y)),[4,k.default.get("".concat(ue,"/app/pages?").concat(t),{headers:{Authorization:"Bearer ".concat(e)}})];case 1:return n=c.sent(),r=n.data,o=n.headers,b?(l=o["x-total-count"]?parseInt(o["x-total-count"],10):0,[2,{items:r,pagination:{page:p,pageSize:g,totalItems:l,totalPages:Math.ceil(l/g)}}]):[2,r]}}))}))},exports.fetchTags=function(e,t,n){return void 0===t&&(t=1),void 0===n&&(n=100),w(void 0,void 0,Promise,(function(){var r,a,o,i;return I(this,(function(l){switch(l.label){case 0:return[4,k.default.get("".concat(ue,"/app/tags?pageSize=").concat(n,"&page=").concat(t),{headers:{Authorization:"Bearer ".concat(e)}})];case 1:return r=l.sent(),a=r.data,o=r.headers,i=o["x-total-count"]?parseInt(o["x-total-count"],10):0,[2,{items:a,pagination:{page:t,pageSize:n,totalItems:i,totalPages:Math.ceil(i/n)}}]}}))}))},exports.getPagePlainText=Oe,exports.getUrlParameter=Re,exports.markPluginConstructor=W,exports.plugins=le,exports.queryClient=Pe,exports.useAdminContext=ye,exports.usePage=function(t,r){var a=e.useContext(M).pageTypes,o=localStorage.getItem("rb_t"),i=Re("t");return n.useQuery(["page",{pageId:t,language:r}],(function(){return w(void 0,void 0,Promise,(function(){var e,n,l;return I(this,(function(s){switch(s.label){case 0:return[4,k.default.get(r?"".concat(ue,"/admin/pages/").concat(t,"/translations/").concat(r):"".concat(ue,"/admin/pages/").concat(t),{headers:{Authorization:"Bearer ".concat(o||i)}})];case 1:return e=s.sent().data,n=null,(null==(l=null==a?void 0:a.find((function(t){return t.name===e.type})))?void 0:l.getExternalData)&&"function"==typeof l.getExternalData?[4,l.getExternalData(e)]:[3,3];case 2:(n=s.sent())&&"object"==typeof n&&(e.externalData=n),s.label=3;case 3:return[2,e]}}))}))}),{enabled:!(!t||!o&&!i),refetchOnWindowFocus:!1})},exports.usePage$1=function(t,r){var a=e.useContext(M),o=a.apiKey,i=a.pageTypes;return n.useQuery(["pagePublic",{slug:t,language:r}],(function(){return w(void 0,void 0,Promise,(function(){var e,n,a;return I(this,(function(l){switch(l.label){case 0:return[4,k.default.get(r?"".concat(ue,"/app/pages/").concat(t,"/translations/").concat(r):"".concat(ue,"/app/pages/").concat(t),{headers:{Authorization:"Bearer ".concat(o)}})];case 1:return e=l.sent().data,n=null,(null==(a=null==i?void 0:i.find((function(t){return t.name===e.type})))?void 0:a.getExternalData)&&"function"==typeof a.getExternalData?[4,a.getExternalData(e)]:[3,3];case 2:(n=l.sent())&&"object"==typeof n&&(e.externalData=n),l.label=3;case 3:return[2,e]}}))}))}),{enabled:!!t})},exports.usePageValues=L,exports.usePages=function(e){var t=void 0===e?{}:e,r=t.type,a=void 0===r?"":r,o=t.types,i=void 0===o?[]:o,l=t.tag,s=void 0===l?"":l,c=t.language,u=void 0===c?"":c,d=t.page,p=void 0===d?1:d,m=t.pageSize,g=void 0===m?1e3:m,f=t.sort,h=void 0===f?"":f,v=t.usePagination,y=void 0!==v&&v,x=t.filterBy,b=void 0===x?{}:x;g<=0&&(g=1e3);var E=localStorage.getItem("rb_t"),P=Re("t"),T="type=".concat(a,"&types=").concat(null==i?void 0:i.join(","),"&tag=").concat(s,"&language=").concat(u,"&page=").concat(p,"&pageSize=").concat(g,"&sort=").concat(h,"&filterBy=").concat(JSON.stringify(b));return n.useQuery(["pages",{pageType:a,pageTypes:i,tag:s,language:u,page:p,pageSize:g,sort:h}],(function(){return w(void 0,void 0,void 0,(function(){var e,t,n,r;return I(this,(function(a){switch(a.label){case 0:return[4,k.default.get("".concat(ue,"/admin/pages?").concat(T))];case 1:return e=a.sent(),t=e.data,n=e.headers,y?(r=n["x-total-count"]?parseInt(n["x-total-count"],10):0,[2,{items:t,pagination:{page:p,pageSize:g,totalItems:r,totalPages:Math.ceil(r/g)}}]):[2,t]}}))}))}),{enabled:!!E||!!P})},exports.usePagesPublic=function(t){var r=void 0===t?{}:t,a=r.type,o=void 0===a?"":a,i=r.types,l=void 0===i?[]:i,s=r.tag,c=void 0===s?"":s,u=r.language,d=void 0===u?"":u,p=r.page,m=void 0===p?1:p,g=r.pageSize,f=void 0===g?100:g,h=r.sort,v=void 0===h?"":h,y=r.usePagination,x=void 0!==y&&y,b=r.filterBy,E=void 0===b?{}:b,P=e.useContext(M).apiKey;f<=0&&(f=100);var T="type=".concat(o,"&types=").concat(null==l?void 0:l.join(","),"&tag=").concat(c,"&language=").concat(d,"&page=").concat(m,"&pageSize=").concat(f,"&sort=").concat(v,"&filterBy=").concat(JSON.stringify(E));return n.useQuery(["pagesPublic",{pageType:o,pageTypes:l,tag:c,page:m,pageSize:f,sort:v}],(function(){return w(void 0,void 0,void 0,(function(){var e,t,n,r;return I(this,(function(a){switch(a.label){case 0:return[4,k.default.get("".concat(ue,"/app/pages?").concat(T),{headers:{Authorization:"Bearer ".concat(P)}})];case 1:return e=a.sent(),t=e.data,n=e.headers,x?(r=n["x-total-count"]?parseInt(n["x-total-count"],10):0,[2,{items:t,pagination:{page:m,pageSize:f,totalItems:r,totalPages:Math.ceil(r/f)}}]):[2,t]}}))}))}))},exports.useReactBricksContext=function(){return e.useContext(M)},exports.useTagsPublic=function(t,r){void 0===t&&(t=1),void 0===r&&(r=100);var a=e.useContext(M).apiKey;return n.useQuery(["tagsPublic"],(function(){return w(void 0,void 0,void 0,(function(){var e,n,o,i;return I(this,(function(l){switch(l.label){case 0:return[4,k.default.get("".concat(ue,"/app/tags?pageSize=").concat(r,"&page=").concat(t),{headers:{Authorization:"Bearer ".concat(a)}})];case 1:return e=l.sent(),n=e.data,o=e.headers,i=o["x-total-count"]?parseInt(o["x-total-count"],10):0,[2,{items:n,pagination:{page:t,pageSize:r,totalItems:i,totalPages:Math.ceil(i/r)}}]}}))}))}),{staleTime:3e5})},exports.useVisualEdit=xe;
2
- //# sourceMappingURL=react-bricks-ffbaea46.js.map