useblocks 1.1.85-dev.6 → 1.1.85-dev.7

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,7 +1,7 @@
1
1
  __useblocks__.define("static/core/a73da823.js",["require","exports","module"],function(d,a,u){function s(c,l="application/octet-stream"){let t=c.trim(),i=l?.trim()||"application/octet-stream";const o=t.indexOf(",");if(t.startsWith("data:")&&o>=0){const e=t.slice(5,o).split(";")[0]?.trim();e&&(i=e),t=t.slice(o+1)}const m=t.replace(/\s/g,""),r=atob(m),n=new Uint8Array(r.length);for(let e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return new Blob([n],{type:i})}Object.defineProperty(a,"base64ToBlob",{enumerable:!0,get:function(){return s}})});
2
2
 
3
3
  (function(){try{if(typeof document<"u"){var t=".blocks-app .image-preview{text-align:center;min-height:100px;position:relative}.blocks-app .image-preview .image-editor-modal{border:1px solid red}.blocks-app .image-preview__edit-button{position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-preview img{border:1px solid var(--ub-colorBorder);border-radius:6px;max-width:100%;max-height:500px}.blocks-app .serach-results .ant-row{align-items:center}.blocks-app .serach-results .blocks-search__divider-wrapper{margin-top:12px;position:relative}.blocks-app .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{border-top:1px solid var(--ub-colorBorderSecondary);background:0 0;width:100%;height:1px;min-height:0;margin:0;position:static}.blocks-app .slideshow-container{width:524px;height:350px;margin:auto;position:relative;overflow:hidden}.blocks-app .slideshow-image{opacity:0;width:100%;height:100%;position:absolute;top:0;left:0}.blocks-app .image-ai .slideshow-image{width:auto;height:auto}.blocks-app .image-ai__image-item{text-align:center;border-radius:6px;justify-content:center;align-items:center;min-height:100px;display:flex;position:relative}.blocks-app .image-ai__image-item .buttons{justify-content:space-between;display:flex;position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-ai .text-area-input-hybrid{border:none;outline:none;min-height:0;padding:0 0 0 1px}.blocks-app .image-ai .text-area-input-hybrid textarea{height:32px;min-height:32px;padding:3px 11px;line-height:26px}.blocks-app .image-ai__loading{justify-content:center;align-items:center;min-height:150px;display:flex}.blocks-app .image-ai__loading .spin{flex-direction:column;justify-content:center;align-items:center;height:150px;display:flex}.blocks-app .image-ai__loading .status{margin:3px 0 0}.blocks-app .image-ai__preview{border-radius:6px;margin-top:24px;overflow:hidden}.blocks-app .image-ai__preview .image-ai__image-item img{border-radius:calc(var(--ub-borderRadius) * 1px);object-fit:contain;max-height:100%;transition:height 1s;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}.blocks-app .image-ai .small{width:302px;height:202px}.blocks-app .image-ai .large{width:524px;height:350px}.blocks-app .image-ai .image-ai__row{padding:0 2px}.blocks-app .image-ai .image-ai__input-affix-wrapper{border-style:solid;border-width:calc(var(--ub-borderWidth) * 1px);border-color:var(--ub-colorFillSecondaryDarken);border-radius:calc(var(--ub-borderRadius) * 1px);width:100%;padding-left:0;display:inline-flex}.blocks-app .image-ai .image-ai__input-affix-wrapper:hover{border-color:var(--ub-borderColorHover)}.blocks-app .image-ai .image-ai__input-affix-wrapper.ant-input-affix-wrapper-focused{border-color:var(--ub-colorPrimaryBorder)}.blocks-app .image-ai .image-ai__textarea{font-size:16px}.blocks-app .image-ai .image-ai__input-icon{font-size:16px;top:0;right:0}.dark .blocks-app .image-ai .image-ai__preview .image-ai__image-item img{background:#2b2b2b;border:1px solid #434343}.dark .blocks-app .image-ai .ant-btn{background:#1f1f1f}.dark .blocks-app .image-ai .ant-btn:hover{color:var(--ub-colorPrimary)}.blocks-app .stock-tab img{border-radius:0;max-width:none;max-height:none}.blocks-app .stock-tab .stock-search-input{padding:0 2px}.blocks-app .stock-tab .my-masonry-grid{text-align:center;width:auto;display:flex}.blocks-app .stock-tab .my-masonry-grid_column{background-clip:padding-box}.blocks-app .stock-tab .list-item{cursor:pointer;background:#f0f2f5;border:1px solid #f0f2f5;border-radius:6px;min-height:100px;max-height:100px;margin-bottom:20px;transition:all .3s;display:inline-block;position:relative;overflow:hidden}.blocks-app .stock-tab .list-item .overlay-image{opacity:0;background-size:cover;width:110px;height:40px;transition:opacity .5s;position:absolute;bottom:10px;right:10px}.blocks-app .stock-tab .list-item .ant-spin{color:#f0f2f5;font-size:20px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.blocks-app .stock-tab .list-item img{object-fit:cover;opacity:0;border-radius:6px;height:auto;transition:opacity .5s ease-in-out;display:block}.blocks-app .stock-tab .list-item.loaded{border:1px solid #d9d9d9;max-height:1000px}.blocks-app .stock-tab .list-item.loaded img{opacity:1;height:100%}.blocks-app .stock-tab .list-item.loaded .loaded-image{opacity:.5}.blocks-app .stock-tab .list-item:hover{box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #00000017}.blocks-app .stock-tab .list-item:hover p.creator-info,.blocks-app .stock-tab .list-item:hover .overlay-image{opacity:1}.blocks-app .stock-tab .list-item p.creator-info{color:#fff;opacity:0;background-color:#00000080;border-radius:0 0 6px;margin:0;padding:5px;font-size:10px;line-height:1.2;position:absolute;bottom:0;right:0}.blocks-app .stock-tab .list-item p.creator-info:hover a{color:#fff;text-decoration:underline}.blocks-app .stock-tab .list-item p.creator-info a{color:#fff;text-decoration:none}.blocks-app .stock-color-filter{display:flex}.blocks-app .stock-color-filter label{border-width:1px;width:24px;height:24px;margin:4px;padding:0;font-size:0;border-radius:6px!important}.blocks-app .stock-color-filter label.all-colors{background-image:linear-gradient(135deg,red,#ff7f00,#ff0,#0f0,#00f,#8b00ff)}.blocks-app .stock-color-filter label.black-color{background:#222}.blocks-app .stock-color-filter label.bw-color{background-image:linear-gradient(135deg,#222 50%,#fff 50%)}.blocks-app .stock-color-filter label.white-color{background:#fff}.blocks-app .stock-color-filter label.orange-color{background:#fa8c16}.blocks-app .stock-color-filter label.red-color{background:#f5222d}.blocks-app .stock-color-filter label.purple-color{background:#722ed1}.blocks-app .stock-color-filter label.magenta-color{background:#eb2f96}.blocks-app .stock-color-filter label.green-color{background:#52c41a}.blocks-app .stock-color-filter label.teal-color{background:#43c3c3}.blocks-app .stock-color-filter label.blue-color{background:#1677ff}.blocks-app .stock-color-filter .ant-radio-button-wrapper:not(:first-child):before{display:none}.blocks-app .serach-results{padding-top:6px}.blocks-app .serach-results .stock-search-input{width:322px;padding:0 2px}.blocks-app .serach-results .blocks-search__divider-wrapper{width:calc(100% + 48px);margin-top:12px;margin-left:-24px;margin-right:-24px;position:relative}.blocks-app .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{pointer-events:none;border-top:1px solid var(--ub-colorBorderSecondary);background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);border-bottom:none;width:100%;height:20px;min-height:20px;margin:0;position:relative;bottom:auto;left:auto;right:auto}.dark .blocks-app .image-center .stock-tab .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{background:linear-gradient(180deg, var(--ub-colorBgBase), transparent 40%)}.dark .blocks-app .stock-tab .list-item{background:#2b2b2b;border:1px solid #2b2b2b}.dark .blocks-app .stock-tab .list-item.loaded{border:1px solid #434343}.blocks-app .image-center .image-center-image-preview{justify-content:center;align-items:center;display:flex}.blocks-app .image-center .ant-divider-horizontal{pointer-events:none;z-index:1;background:linear-gradient(180deg, var(--ub-colorBgContainerDisabled), transparent 40%);width:calc(100% + 48px);height:20px;margin:24px -24px 0;position:absolute;bottom:-19px}.dark .blocks-app .image-center .ant-divider-horizontal{background:linear-gradient(180deg, var(--ub-colorBgBase), transparent 40%)}.blocks-app .image-center .ant-divider-horizontal.ant-divider-with-text{background:0 0;width:calc(100% + 38px);margin:0 -24px 20px;position:relative;top:0}.blocks-app .image-center img{border-radius:4px;max-width:524px;max-height:352px}.blocks-app .image-center .image-size{justify-content:center;margin-top:6px;font-size:14px;line-height:22px;display:flex}.blocks-app .image-center .ant-upload.ant-upload-drag{border-radius:6px}.blocks-app .image-center .ant-modal-body .stock-search-input{margin-bottom:0}.blocks-app .image-center .ant-modal-body .serach-results .stock-search-input{margin-bottom:10px}.blocks-app .image-center .ant-modal-body .ant-form:not(.serach-results) .ant-form-item:last-child{margin-bottom:0}.blocks-app .image-center .ant-modal-body .ant-tabs{transition:all .7s cubic-bezier(.075,.82,.165,1)}.blocks-app .image-center .ant-modal-body .ant-tabs .ant-tabs-content-holder{overflow-y:clip}.blocks-app .ant-modal{transition:width .7s ease-in-out}",a=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),e=t;if(!a.sheets[e]){var i=!1;try{if(typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&document.adoptedStyleSheets){var r=new CSSStyleSheet;r.replaceSync(t),document.adoptedStyleSheets=document.adoptedStyleSheets.concat([r]),a.sheets[e]=r,a.order.push(e),i=!0}}catch{i=!1}if(!i){var o=document.createElement("style");o.setAttribute("data-useblocks","true"),o.appendChild(document.createTextNode(t)),document.head.appendChild(o),a.sheets[e]=o,a.order.push(e)}}}}catch(p){console.error("vite-plugin-css-injected-by-js",p)}})();
4
- __useblocks__.define("static/core/d0eece8b.js",["require","exports","module","static/core/2ff39ddf.js","static/core/8782e9bb.js","static/core/10c6144f.js","static/core/52b6b918.js","static/core/6741eb70.js","static/core/a73da823.js","react","react/jsx-runtime","__delivery__/libs","vite/preload-helper"],function(oe,yt,mn){const Ye=oe("./2ff39ddf.js"),Ae=oe("./8782e9bb.js"),a=oe("./10c6144f.js"),Ze=oe("./52b6b918.js"),se=oe("./6741eb70.js"),Ct=oe("./a73da823.js");let t=oe("react");t=Ye.__toESM(t);let n=oe("react/jsx-runtime"),f=oe("__delivery__/libs"),At=oe("vite/preload-helper");var bt=Ye.__toESM(a.require_prop_types()),wt=[10,50,150];function It(e,s){for(const o of s)if(o>e)return o;return"infinity"}function kt(e){return e<=10?"ai_10_50":e<=50?"ai_30_150":"ai_150_inf"}function _t(e){return{presetId:kt(e),previousLimit:e,nextLimit:It(e,wt)}}var xt=a.lazyRoute(()=>(0,At.__vitePreload)(()=>Promise.resolve().then(()=>oe("./3a252a3c.js")),void 0,{}.url));function Et(e){return a.useSelector(a.selectSecondModal)?(0,n.jsx)(t.Suspense,{fallback:null,children:(0,n.jsx)(xt,{...e})}):null}var St=({currentImageLink:e,newLink:s,previewDisplayUrl:o,resolvedPreviewObjectUrl:l,resolvedPreviewBlob:i,resolveImageBlob:c,onSave:I,uploadImageResultIsLoading:m})=>{const p=o||l;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"image-preview",children:[m&&(0,n.jsx)("div",{style:{position:"absolute",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:a.emCssVar("colorBgLayout"),zIndex:10,opacity:.7},children:(0,n.jsx)(f.ui_kit$Spin,{size:"large"})}),p&&(0,n.jsx)("img",{alt:"uploadedImage",src:p})]})}),(0,n.jsx)(Et,{currentImageLink:e,prefetchedBlob:i,resolveImageBlob:c,newLink:s,onSave:I,uploadImageResultIsLoading:m})]})},ke={Pixel:"Pixel",Percent:"Percent"},Je={unit:ke.Percent,value:80};function jt(e){return typeof e=="number"?{unit:ke.Percent,value:e*100}:typeof e=="string"?/^(\d*(\.\d+)?)px$/.exec(e)?{unit:ke.Pixel,value:parseFloat(e)}:/^(\d*(\.\d+)?)%$/.exec(e)?{unit:ke.Percent,value:parseFloat(e)}:Je:Je}function Rt(e,s){const o=jt(e);let l;return o.unit===ke.Pixel?l=`${o.value}px`:l=`${100-o.value}%`,s?`${l} 0px 0px 0px`:`0px 0px ${l} 0px`}function Xe({next:e,hasMore:s,children:o,loader:l,scrollThreshold:i=.8,endMessage:c,style:I,height:m,scrollableTarget:p,hasChildren:k,inverse:h=!1,pullDownToRefresh:v=!1,pullDownToRefreshContent:w,releaseToRefreshContent:x,pullDownToRefreshThreshold:A=100,refreshFunction:S,onScroll:y,dataLength:U,initialScrollY:R,className:B="",role:$,tabIndex:D,id:G,...X}){const[W,V]=(0,t.useState)(!1),[F,Y]=(0,t.useState)(!1),[H,te]=(0,t.useState)(0),_=(0,t.useRef)(null),Z=(0,t.useRef)(null),Q=(0,t.useRef)(null),P=(0,t.useRef)(e);P.current=e;const q=(0,t.useRef)(S);q.current=S;const M=(0,t.useRef)(A);M.current=A;const r=(0,t.useRef)(!1),C=(0,t.useRef)(!1),j=(0,t.useRef)(0),L=(0,t.useRef)(0),le=(0,t.useRef)(0),E=(0,t.useCallback)(()=>p instanceof HTMLElement?p:typeof p=="string"?document.getElementById(p):null,[p]);(0,t.useEffect)(()=>{if(typeof U>"u")throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');if(v&&typeof S!="function")throw new Error(`Mandatory prop "refreshFunction" missing.
4
+ __useblocks__.define("static/core/77d63e01.js",["require","exports","module","static/core/2ff39ddf.js","static/core/8782e9bb.js","static/core/10c6144f.js","static/core/52b6b918.js","static/core/53bcd609.js","static/core/a73da823.js","react","react/jsx-runtime","__delivery__/libs","vite/preload-helper"],function(oe,yt,mn){const Ye=oe("./2ff39ddf.js"),Ae=oe("./8782e9bb.js"),a=oe("./10c6144f.js"),Ze=oe("./52b6b918.js"),se=oe("./53bcd609.js"),Ct=oe("./a73da823.js");let t=oe("react");t=Ye.__toESM(t);let n=oe("react/jsx-runtime"),f=oe("__delivery__/libs"),At=oe("vite/preload-helper");var bt=Ye.__toESM(a.require_prop_types()),wt=[10,50,150];function It(e,s){for(const o of s)if(o>e)return o;return"infinity"}function kt(e){return e<=10?"ai_10_50":e<=50?"ai_30_150":"ai_150_inf"}function _t(e){return{presetId:kt(e),previousLimit:e,nextLimit:It(e,wt)}}var xt=a.lazyRoute(()=>(0,At.__vitePreload)(()=>Promise.resolve().then(()=>oe("./78b1e678.js")),void 0,{}.url));function Et(e){return a.useSelector(a.selectSecondModal)?(0,n.jsx)(t.Suspense,{fallback:null,children:(0,n.jsx)(xt,{...e})}):null}var St=({currentImageLink:e,newLink:s,previewDisplayUrl:o,resolvedPreviewObjectUrl:l,resolvedPreviewBlob:i,resolveImageBlob:c,onSave:I,uploadImageResultIsLoading:m})=>{const p=o||l;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{children:(0,n.jsxs)("div",{className:"image-preview",children:[m&&(0,n.jsx)("div",{style:{position:"absolute",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:a.emCssVar("colorBgLayout"),zIndex:10,opacity:.7},children:(0,n.jsx)(f.ui_kit$Spin,{size:"large"})}),p&&(0,n.jsx)("img",{alt:"uploadedImage",src:p})]})}),(0,n.jsx)(Et,{currentImageLink:e,prefetchedBlob:i,resolveImageBlob:c,newLink:s,onSave:I,uploadImageResultIsLoading:m})]})},ke={Pixel:"Pixel",Percent:"Percent"},Je={unit:ke.Percent,value:80};function jt(e){return typeof e=="number"?{unit:ke.Percent,value:e*100}:typeof e=="string"?/^(\d*(\.\d+)?)px$/.exec(e)?{unit:ke.Pixel,value:parseFloat(e)}:/^(\d*(\.\d+)?)%$/.exec(e)?{unit:ke.Percent,value:parseFloat(e)}:Je:Je}function Rt(e,s){const o=jt(e);let l;return o.unit===ke.Pixel?l=`${o.value}px`:l=`${100-o.value}%`,s?`${l} 0px 0px 0px`:`0px 0px ${l} 0px`}function Xe({next:e,hasMore:s,children:o,loader:l,scrollThreshold:i=.8,endMessage:c,style:I,height:m,scrollableTarget:p,hasChildren:k,inverse:h=!1,pullDownToRefresh:v=!1,pullDownToRefreshContent:w,releaseToRefreshContent:x,pullDownToRefreshThreshold:A=100,refreshFunction:S,onScroll:y,dataLength:U,initialScrollY:R,className:B="",role:$,tabIndex:D,id:G,...X}){const[W,V]=(0,t.useState)(!1),[F,Y]=(0,t.useState)(!1),[H,te]=(0,t.useState)(0),_=(0,t.useRef)(null),Z=(0,t.useRef)(null),Q=(0,t.useRef)(null),P=(0,t.useRef)(e);P.current=e;const q=(0,t.useRef)(S);q.current=S;const M=(0,t.useRef)(A);M.current=A;const r=(0,t.useRef)(!1),C=(0,t.useRef)(!1),j=(0,t.useRef)(0),L=(0,t.useRef)(0),le=(0,t.useRef)(0),E=(0,t.useCallback)(()=>p instanceof HTMLElement?p:typeof p=="string"?document.getElementById(p):null,[p]);(0,t.useEffect)(()=>{if(typeof U>"u")throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');if(v&&typeof S!="function")throw new Error(`Mandatory prop "refreshFunction" missing.
5
5
  Pull Down To Refresh functionality will not work
6
6
  as expected. Check README.md for usage'`);if(typeof R=="number"){const K=m?_.current:E();K&&K.scrollHeight>R&&K.scrollTo(0,R)}},[]),(0,t.useEffect)(()=>{r.current=!1,V(!1)},[U]),(0,t.useEffect)(()=>{if(!s||typeof IntersectionObserver>"u")return;const K=Z.current;if(!K)return;const J=m?_.current:E(),O=new IntersectionObserver(([ne])=>{!ne.isIntersecting||r.current||(r.current=!0,V(!0),P.current())},{root:J,rootMargin:Rt(i,h),threshold:0});return O.observe(K),()=>O.disconnect()},[s,i,h,m,E]),(0,t.useEffect)(()=>{var K;if(!y)return;const J=(K=m?_.current:E())!==null&&K!==void 0?K:typeof window<"u"?window:null;if(!J)return;const O=ne=>{setTimeout(()=>y(ne),0)};return J.addEventListener("scroll",O),()=>J.removeEventListener("scroll",O)},[y,m,E]),(0,t.useEffect)(()=>{var K,J;if(!v)return;const O=(K=m?_.current:E())!==null&&K!==void 0?K:typeof window<"u"?window:null;if(!O)return;if(!((J=Q.current)===null||J===void 0)&&J.firstChild){const z=Q.current.firstChild.getBoundingClientRect().height;le.current=z,te(z)}const ne=z=>{(O instanceof HTMLElement?O.scrollTop:document.documentElement.scrollTop)>0||(C.current=!0,z instanceof MouseEvent?j.current=z.pageY:z instanceof TouchEvent&&(j.current=z.touches[0].pageY),L.current=j.current,_.current&&(_.current.style.willChange="transform",_.current.style.transition="transform 0.2s cubic-bezier(0,0,0.31,1)"))},g=z=>{if(!C.current||(z instanceof MouseEvent?L.current=z.pageY:z instanceof TouchEvent&&(L.current=z.touches[0].pageY),L.current<j.current))return;const de=L.current-j.current;de>=M.current&&Y(!0),!(de>le.current*1.5)&&_.current&&(_.current.style.overflow="visible",_.current.style.transform=`translate3d(0px, ${de}px, 0px)`)},N=()=>{j.current=0,L.current=0,C.current=!1,Y(z=>{var de;return z&&((de=q.current)===null||de===void 0||de.call(q)),!1}),requestAnimationFrame(()=>{_.current&&(_.current.style.overflow="auto",_.current.style.transform="none",_.current.style.willChange="unset")})};return O.addEventListener("touchstart",ne),O.addEventListener("touchmove",g),O.addEventListener("touchend",N),O.addEventListener("mousedown",ne),O.addEventListener("mousemove",g),O.addEventListener("mouseup",N),()=>{O.removeEventListener("touchstart",ne),O.removeEventListener("touchmove",g),O.removeEventListener("touchend",N),O.removeEventListener("mousedown",ne),O.removeEventListener("mousemove",g),O.removeEventListener("mouseup",N)}},[v,m,E]);const pe={height:m??"auto",overflow:"auto",WebkitOverflowScrolling:"touch",...I},he=k||!!(o&&o instanceof Array&&o.length),ae=v&&m?{overflow:"auto"}:{},ge=s?(0,n.jsx)("div",{ref:Z,style:{height:1}}):null;return(0,n.jsx)("div",{style:ae,className:"infinite-scroll-component__outerdiv",children:(0,n.jsxs)("div",{...X,role:$,tabIndex:D,id:G,className:["infinite-scroll-component",B].filter(Boolean).join(" "),ref:_,style:pe,children:[v&&(0,n.jsx)("div",{style:{position:"relative"},ref:Q,children:(0,n.jsx)("div",{style:{position:"absolute",left:0,right:0,top:-1*H},children:F?x:w})}),o,!W&&!he&&s&&l,W&&s&&l,ge,!s&&c]})})}function Ot(e,s){if(e==null)return{};var o=Lt(e,s),l,i;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(i=0;i<c.length;i++)l=c[i],!(s.indexOf(l)>=0)&&Object.prototype.propertyIsEnumerable.call(e,l)&&(o[l]=e[l])}return o}function Lt(e,s){if(e==null)return{};for(var o={},l=Object.keys(e),i,c=0;c<l.length;c++)i=l[c],!(s.indexOf(i)>=0)&&(o[i]=e[i]);return o}function Le(){return Le=Object.assign||function(e){for(var s=1;s<arguments.length;s++){var o=arguments[s];for(var l in o)Object.prototype.hasOwnProperty.call(o,l)&&(e[l]=o[l])}return e},Le.apply(this,arguments)}function et(e,s){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);s&&(l=l.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),o.push.apply(o,l)}return o}function _e(e){for(var s=1;s<arguments.length;s++){var o=arguments[s]!=null?arguments[s]:{};s%2?et(Object(o),!0).forEach(function(l){Ut(e,l,o[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):et(Object(o)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(o,l))})}return e}function Ut(e,s,o){return s in e?Object.defineProperty(e,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[s]=o,e}var Dt={breakpointCols:void 0,className:void 0,columnClassName:void 0,children:void 0,columnAttrs:void 0,column:void 0},Me=2,Ge=class extends t.default.Component{constructor(e){super(e),this.reCalculateColumnCount=this.reCalculateColumnCount.bind(this),this.reCalculateColumnCountDebounce=this.reCalculateColumnCountDebounce.bind(this);let s;this.props.breakpointCols&&this.props.breakpointCols.default?s=this.props.breakpointCols.default:s=parseInt(this.props.breakpointCols)||Me,this.state={columnCount:s}}componentDidMount(){this.reCalculateColumnCount(),window&&window.addEventListener("resize",this.reCalculateColumnCountDebounce)}componentDidUpdate(){this.reCalculateColumnCount()}componentWillUnmount(){window&&window.removeEventListener("resize",this.reCalculateColumnCountDebounce)}reCalculateColumnCountDebounce(){if(!window||!window.requestAnimationFrame){this.reCalculateColumnCount();return}window.cancelAnimationFrame&&window.cancelAnimationFrame(this._lastRecalculateAnimationFrame),this._lastRecalculateAnimationFrame=window.requestAnimationFrame(()=>{this.reCalculateColumnCount()})}reCalculateColumnCount(){const e=window&&window.innerWidth||1/0;let s=this.props.breakpointCols;typeof s!="object"&&(s={default:parseInt(s)||Me});let o=1/0,l=s.default||Me;for(let i in s){const c=parseInt(i);c>0&&e<=c&&c<o&&(o=c,l=s[i])}l=Math.max(1,parseInt(l)||1),this.state.columnCount!==l&&this.setState({columnCount:l})}itemsInColumns(){const e=this.state.columnCount,s=new Array(e),o=t.default.Children.toArray(this.props.children);for(let l=0;l<o.length;l++){const i=l%e;s[i]||(s[i]=[]),s[i].push(o[l])}return s}renderColumns(){const{column:e,columnAttrs:s={},columnClassName:o}=this.props,l=this.itemsInColumns(),i=`${100/l.length}%`;let c=o;c&&typeof c!="string"&&(this.logDeprecated('The property "columnClassName" requires a string'),typeof c>"u"&&(c="my-masonry-grid_column"));const I=_e(_e(_e({},e),s),{},{style:_e(_e({},s.style),{},{width:i}),className:c});return l.map((m,p)=>t.default.createElement("div",Le({},I,{key:p}),m))}logDeprecated(e){}render(){const e=this.props,{children:s,breakpointCols:o,columnClassName:l,columnAttrs:i,column:c,className:I}=e,m=Ot(e,["children","breakpointCols","columnClassName","columnAttrs","column","className"]);let p=I;return typeof I!="string"&&(this.logDeprecated('The property "className" requires a string'),typeof I>"u"&&(p="my-masonry-grid")),t.default.createElement("div",Le({},m,{className:p}),this.renderColumns())}};Ge.defaultProps=Dt;function Te(e,s){return e?e.exhausted?{...e,src:null}:{...e,src:e.src||s||null}:null}function tt({items:e,getItemId:s,getRequestUrl:o,createController:l}){const[i,c]=(0,t.useState)({}),I=(0,t.useRef)(new Map),m=(0,t.useCallback)(p=>{const k=s(p),h=o(p),v=`${k}:${h}`;if(I.current.has(v))return{itemId:k,requestUrl:h,cacheKey:v,controller:I.current.get(v)};const w=l(h);return I.current.set(v,w),{itemId:k,requestUrl:h,cacheKey:v,controller:w}},[l,s,o]);return(0,t.useEffect)(()=>{const p=new Set,k={},h=e.map(v=>{const{itemId:w,cacheKey:x,controller:A}=m(v);p.add(x),k[w]=A.src;const S=Te(A.handleChangeSrc?.(),A.src);return S?.changed&&S.src&&(k[w]=S.src),A.subscribeToSrcChange?.(y=>{const U=Te(y,A.src);!U?.changed||!U.src||c(R=>R[w]===U.src?R:{...R,[w]:U.src})})}).filter(Boolean);return I.current.forEach((v,w)=>{p.has(w)||I.current.delete(w)}),c(k),()=>{h.forEach(v=>v?.())}},[m,e]),{getDisplaySrc:(0,t.useCallback)(p=>{const{itemId:k,requestUrl:h,controller:v}=m(p);return i[k]||v.src||h},[i,m]),handleLoad:(0,t.useCallback)(p=>{m(p).controller.handleSuccess()},[m]),handleError:(0,t.useCallback)(p=>{const{itemId:k,controller:h}=m(p),v=Te(h.handleError(),h.src);v?.changed&&v.src&&c(w=>({...w,[k]:v.src}))},[m])}}var nt="blocks",Pt=({setCurrentImageLink:e,setModalHeight:s,setModalWidth:o,setImageStockList:l,imageStockList:i,currentReq:c,setCurrentReq:I,inputRef:m,setStockLink:p,customRequest:k})=>{const h=a.useAppConfig(),v=a.useIsStandalone(),[w,x]=(0,t.useState)(!1),[A,S]=(0,t.useState)(2),{__:y}=a.useI18n(),U=a.useNotification(),[R]=a.useLazyGetUnsplashImageQuery(),[B]=a.useLazyGetSearchImageQuery(),$=(0,t.useCallback)(r=>r instanceof Error||typeof r?.message=="string"&&r.message?r.message:typeof r?.error?.message=="string"&&r.error.message?r.error.message:y("Failed to load stock images through the configured proxy chain."),[y]),D=(0,t.useCallback)(r=>{U.error({id:"STOCK_IMAGES_SEARCH_FAILED",title:y("Failed to load stock images"),description:$(r)})},[y,$,U]),G=async()=>{w||(x(!0),B({query:c,page:A}).then(r=>{if(r?.error){D(r.error),x(!1);return}const C=r?.data?.results||[];l(j=>[...j,...C]),x(!1),S(j=>j+1)}).catch(()=>{x(!1)}))};(0,t.useEffect)(()=>{c.keywords!==""&&X()},[c.color,c.orientation]);const X=async()=>{const r=await B({query:c,page:1});if(r?.error){D(r.error),l([]);return}const C=r?.data?.results||[];C.length>0?(l(C),setTimeout(()=>{o(1060),s("84vh")},0)):l([])},[W,V]=(0,t.useState)(null),F=(0,t.useCallback)((r,C,j)=>`${r}${r.includes("?")?"&":"?"}w=${C}&q=${j}`,[]),Y=(0,t.useCallback)(r=>Ae.getProxiedUrl(r,{config:h,standalone:v,resourceType:"stockImages",intent:"display"}),[h,v]),H=(0,t.useCallback)(r=>r.id,[]),te=(0,t.useCallback)(r=>F(r.urls.raw,644,96),[F]),{getDisplaySrc:_,handleLoad:Z,handleError:Q}=tt({items:i,getItemId:H,getRequestUrl:te,createController:Y}),P=r=>C=>{Z(r),C.target.parentNode.classList.add("loaded")},q=r=>()=>{Q(r)},M=(r,C,j)=>{R(C.download_location),V(j),setTimeout(()=>V(null),2e3),p(`${r.raw}&w=1200&q=96`),e(`${r.raw}&w=1200&q=96`),k(`${r.raw}&w=1200&q=96`)};return(0,n.jsxs)("div",{className:"stock-tab",children:[(0,n.jsxs)(f.ui_kit$Form,{onValuesChange:X,className:i.length>0?"serach-results":"",children:[(0,n.jsxs)(f.ui_kit$Row,{gutter:24,children:[(0,n.jsx)(f.ui_kit$Col,{span:i.length>0?"":24,children:(0,n.jsx)(f.ui_kit$Form.Item,{className:"stock-search-input",children:(0,n.jsx)(f.ui_kit$SearchInput,{onSearch:X,allowClear:!0,size:i.length>0?"medium":"large",placeholder:y("Search image"),value:c.keywords,onChange:r=>I(C=>({...C,keywords:r.target.value})),ref:m,spellCheck:"false",enterButton:!1})})}),i.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(f.ui_kit$Col,{children:(0,n.jsxs)(f.ui_kit$Radio.Group,{defaultValue:"",onChange:r=>I(C=>({...C,orientation:r.target.value})),children:[(0,n.jsx)(f.ui_kit$Tooltip,{title:y("All"),placement:"top",children:(0,n.jsx)(f.ui_kit$Radio.Button,{value:"",children:(0,n.jsx)(a.EmIcons,{icon:"MixedView",component:f.icons$MixedView})})}),(0,n.jsx)(f.ui_kit$Tooltip,{title:y("Landscape"),placement:"top",children:(0,n.jsx)(f.ui_kit$Radio.Button,{value:"landscape",children:(0,n.jsx)(a.EmIcons,{icon:"LandscapeView",component:f.icons$LandscapeView})})}),(0,n.jsx)(f.ui_kit$Tooltip,{title:y("Portrait"),placement:"top",children:(0,n.jsx)(f.ui_kit$Radio.Button,{value:"portrait",children:(0,n.jsx)(a.EmIcons,{icon:"PortraitView",component:f.icons$PortraitView})})}),(0,n.jsx)(f.ui_kit$Tooltip,{title:y("Squarish"),placement:"top",children:(0,n.jsx)(f.ui_kit$Radio.Button,{value:"squarish",children:(0,n.jsx)(a.EmIcons,{icon:"SquareView",component:f.icons$SquareView})})})]})}),(0,n.jsx)(f.ui_kit$Col,{children:(0,n.jsx)(f.ui_kit$RadioColorFilter,{defaultValue:"",onChange:r=>I(C=>({...C,color:r.target.value})),options:[{value:"",colorClass:"all-colors",label:y("All")},{value:"black",colorClass:"black-color",label:y("Black")},{value:"black_and_white",colorClass:"bw-color",label:y("Black and White")},{value:"white",colorClass:"white-color",label:y("White")},{value:"orange",colorClass:"orange-color",label:y("Orange")},{value:"red",colorClass:"red-color",label:y("Red")},{value:"purple",colorClass:"purple-color",label:y("Purple")},{value:"magenta",colorClass:"magenta-color",label:y("Magenta")},{value:"green",colorClass:"green-color",label:y("Green")},{value:"teal",colorClass:"teal-color",label:y("Teal")},{value:"blue",colorClass:"blue-color",label:y("Blue")}],tooltipPlacement:"top"})})]})]}),i.length>0&&(0,n.jsx)("div",{className:"blocks-search__divider-wrapper",children:(0,n.jsx)("div",{className:"ant-divider ant-divider-horizontal",role:"separator"})})]}),(0,n.jsx)("div",{className:"serach-output-wrapper",style:{marginRight:-10},children:i.length>0&&(0,n.jsx)("div",{id:"scrollableDiv",style:{width:"100%",height:"calc(84vh - 148px)",overflow:"auto",paddingTop:24,paddingRight:14,paddingLeft:24,marginLeft:-24,lineHeight:"0",boxSizing:"unset"},children:(0,n.jsx)(Xe,{dataLength:i&&i.length,next:G,hasMore:i,endMessage:(0,n.jsxs)(f.ui_kit$Divider,{plain:!0,children:[y("That`s all we could find.")," 🤐"]}),scrollableTarget:"scrollableDiv",style:{overflow:"visible"},loader:null,children:(0,n.jsx)(Ge,{breakpointCols:{default:3},className:"my-masonry-grid",columnClassName:"my-masonry-grid_column",children:i.map(r=>(0,n.jsxs)("div",{className:"list-item",onClick:()=>M(r.urls,r.links,r.id),children:[(0,n.jsx)("img",{className:W===r.id?"loaded-image":"",width:"322px",src:_(r),alt:r.description,onLoad:P(r),onError:q(r)}),(0,n.jsxs)("p",{className:"creator-info",onClick:C=>C.stopPropagation(),children:["Photo by"," ",(0,n.jsx)("a",{target:"_blank",href:`${r.user.links.html}?utm_source=${nt}&utm_medium=referral`,rel:"noreferrer",children:r.user.name})," ","on"," ",(0,n.jsx)("a",{target:"_blank",href:`https://unsplash.com/?utm_source=${nt}&utm_medium=referral`,rel:"noreferrer",children:"Unsplash"})]}),W===r.id&&(0,n.jsx)(f.ui_kit$Spin,{className:"ant-spin",size:"small"})]},r.id))})})})})]})};function rt(e){return/^(https?:)?\/\//i.test(e.trim())}function Mt(e){const s=e.trim();return rt(s)||/^data:/i.test(s)?s:`data:image/jpeg;base64, ${e}`}var Gt=({images:e,transitionDuration:s=1e3})=>{const[o,l]=(0,t.useState)([]);return(0,t.useEffect)(()=>{if(e.length>0){const i=e[e.length-1];l(c=>[...c,{src:i,opacity:0}]),setTimeout(()=>{l(c=>c.map((I,m)=>m===c.length-1?{...I,opacity:1}:I))},1e3)}},[e]),(0,n.jsx)("div",{className:"slideshow-container",children:o.map((i,c)=>(0,n.jsx)("img",{src:Mt(i.src),alt:`Slide ${c+1}`,className:"slideshow-image",style:{opacity:i.opacity,transition:`opacity ${s}ms linear`}},c))})};function Tt({setModalHeight:e,customRequest:s,aiTabRef:o,isImageUploaded:l,setIsImageUploaded:i,aiImageRequest:c,imageAiList:I,setImageAiList:m,isLoadingAi:p,setIsLoadingAi:k,onPluginAiImageLimitExceeded:h,onImageGenerateLimitExceeded:v}){const{__:w}=a.useI18n(),x=a.useAppConfig(),A=a.useNotification(),S=a.usePushToDataLayer(),{blockId:y}=a.useRouteParams(),U=a.useEditorProjectId(),R=a.useRouteEmailId(),[B]=a.useLazySendAiImageRequestQuery(),[$,{data:D=[]}]=a.useLazyGetAiImageSSEQuery(),G=a.useProjectPlanLimitPreflight(),X=x?.sendAIImageRequest||B,W=x?.trigger||$,V=x?.handleLimitUsageEmitter||a.useEventEmitter(Ae.events.ON_LIMIT_ID),[F,Y]=(0,t.useState)(0),[H,te]=(0,t.useState)(null),[_,Z]=(0,t.useState)(!1),[Q,P]=(0,t.useState)(w("Evaluating the task")),[q,M]=(0,t.useState)(!1),r=R||y,{limits:C}=x?.limits?x:{limits:{ai_img_limit:0}},{ai_img_limit:j}=C,L=!!(x.limits&&x.counters)&&!0,le=a.useEventEmitter(Ae.events.AI_IMAGE_REQUEST_ID).hasListeners(),E=se.shouldCountAiUsage({limitsInPlugin:L,hostedAiActive:le}),pe=!le&&j>0&&F>=j,he=(0,t.useCallback)(()=>{V.fire({name:"AiImgCount",count:F+1})},[V,F]),ae=(0,t.useMemo)(()=>!pe&&(!E||j===0||F<j),[pe,E,F,j]),ge=(0,t.useCallback)(async()=>{P(w("Evaluating the task")),c!==""&&!p&&(k(!0),M(!0),m([]),S({event:"submit_form",action:"ai_image_generation",entity_id:R,project_id:U}),X({body:{project_id:U,request:"create-image",connection:"midjourney",message:c}}).then(({data:g,error:N})=>{if(N)throw N;if(g.data.status===401)throw new Error(a.ERROR);if(g?.data?._eventResult){m(g.data.task.images),k(!1),M(!1),P(w("Evaluating the task"));return}g?.data.status===200?(g?.data.task.id&&(P(g.data.task.message),te(g.data.task.id)),g.message&&A.success({id:"AI_IMAGE_SEND_SUCCESS",title:g.message,placement:"bottomRight",data:c}),W({task_id:g?.data.task.id,entity_id:r})):(k(!1),M(!1),A.error({id:"AI_IMAGE_SEND_ERROR",title:g?.message||w("Something went wrong, please try again"),placement:"bottomRight",data:c,innerException:g}))}).catch(g=>{k(!1),M(!1),(g?.error||g?.data)&&A.fromError("AI_IMAGE_SEND_ERROR",c,g.error||g)}))},[c,p,k,M,m,S,R,U,X,A,W,r,w]),K=(0,t.useCallback)(async()=>{ae?(E&&(Y(g=>g+1),he()),ge()):L&&(h?h():A.error({title:w("The usage limit has been exceeded"),description:w(`The maximum number of requests for the current subscription period has been reached.
7
7
  Select the appropriate plan to fulfil more requests`),placement:"bottomRight"}))},[ae,L,le,E,G,v,Y,he,ge,A,w,h]);(0,t.useEffect)(()=>{L&&Y(x?.counters?.ai_img_counter||0)},[x,L]);const J=a.useEventEmitter(Ae.events.AI_IMAGE_PROGRESS_ID);(0,t.useEffect)(()=>{const g=J.event(({progress:N,status:z})=>{P(z||`${Math.round(N)}%`)});return()=>g.dispose()},[J]);const O=(0,t.useCallback)(async g=>{if(!l){i(!0);try{const N=rt(g)?await(await fetch(g)).blob():Ct.base64ToBlob(g);s({file:new File([N],"image.jpeg",{type:N.type||"image/jpeg"})})}catch{i(!1)}}},[l,i,s]),ne=(0,t.useCallback)(g=>{g.status!=="error"&&g.status!=="Canceled"?g.images?(P(g.status),g.progress===100&&(m(g.images),P(w("Evaluating the task")),te(null),M(!1))):(m([g.data]),k(!1)):(k(!1),M(!1),A.error({id:"AI_IMAGE_GET_ERROR",title:w("Something went wrong, please try again"),placement:"bottomRight",data:H}))},[m,P,w,k,e,H,A,M]);return(0,t.useEffect)(()=>{D.length>1&&ne(D[D.length-1])},[D,ne]),(0,t.useEffect)(()=>{(p||I.length>0)&&setTimeout(()=>{let g=550;o.current&&(g=o.current.offsetHeight+68),e(g)},0)},[o,D,I.length,p,e]),{aiImageCounter:F,setAiImageCounter:Y,currentAiImgLimits:j,isFieldsDisabled:pe,canGenerateImage:ae,aiImageRequest:c,imageAiList:I,setImageAiList:m,isLoadingAi:p,setIsLoadingAi:k,loadingDuringGeneration:q,setLoadingDuringGeneration:M,requestStatus:Q,setRequestStatus:P,handleGenerate:K,handleLimitAiImgCount:he,convertBase64ToFile:O,isShiftPressed:_,setIsShiftPressed:Z,currentReqId:H,setCurrentReqId:te,limitsInPlugin:L}}var Nt=({setModalHeight:e,customRequest:s,aiTabRef:o,inputAiRef:l,isImageUploaded:i,setIsImageUploaded:c,aiImageRequest:I,setAiImageRequest:m,imageAiList:p,setImageAiList:k,isLoadingAi:h,setIsLoadingAi:v})=>{const w=a.useAppNavigate();a.useDispatch();const x=a.useOpenPlanCatalog(),{__:A,_n:S}=a.useI18n(),y=a.useAppConfig(),[U,R]=(0,t.useState)(!1),[B,$]=(0,t.useState)(null),{aiImageCounter:D,currentAiImgLimits:G,loadingDuringGeneration:X,requestStatus:W,handleGenerate:V,convertBase64ToFile:F,isShiftPressed:Y,setIsShiftPressed:H,limitsInPlugin:te}=Tt({setModalHeight:e,customRequest:s,aiTabRef:o,isImageUploaded:i,setIsImageUploaded:c,aiImageRequest:I,imageAiList:p,setImageAiList:k,isLoadingAi:h,setIsLoadingAi:v,onPluginAiImageLimitExceeded:()=>R(!0),onImageGenerateLimitExceeded:$}),_=U&&G>0?_t(G):null,Z=_?a.getLimitUpgradePresetDefinition(_.presetId):null,Q=B?a.getLimitUpgradePresetDefinition(B.presetId):null,[P,q]=(0,t.useState)(!1),M=(0,t.useCallback)(()=>q(!0),[]),r=(0,t.useCallback)(()=>q(!1),[]),C=(0,t.useCallback)(E=>m(E.target.value),[m]),j=(0,t.useCallback)(E=>{E.key==="Shift"?H(!0):E.key==="Enter"&&!Y&&(E.preventDefault(),V())},[Y,V,H]),L=(0,t.useCallback)(E=>{E.key==="Shift"&&H(!1)},[H]),le=p[p.length-1];return(0,n.jsxs)("div",{className:"image-ai",children:[Z&&_?(0,n.jsx)(Ze.LimitUpgradeModal,{open:!0,onClose:()=>R(!1),title:A(Z.titleKey),subtitle:A(Z.subtitleKey),usageResource:Z.usageResource,previousDisplay:a.presetLimitDisplay(_.previousLimit),nextDisplay:a.presetLimitDisplay(_.nextLimit),onChangePlan:()=>{R(!1),x()}}):null,Q&&B?(0,n.jsx)(Ze.LimitUpgradeModal,{open:!0,onClose:()=>$(null),title:A(Q.titleKey),subtitle:A(Q.subtitleKey),usageResource:Q.usageResource,previousDisplay:a.presetLimitDisplay(B.previousLimit),nextDisplay:a.presetLimitDisplay(B.nextLimit),onChangePlan:()=>{$(null),x()}}):null,te&&(0,n.jsx)(f.ui_kit$LimitsCounter,{text:`${D} ${A("of")} ${G>0?G:"∞"} images ${S("was used","were used",D)}`,exceeded:G>0&&D>=G,style:{marginTop:-25},extra:(0,n.jsx)("span",{style:{textDecoration:"underline",cursor:"pointer"},onClick:()=>w(y.billingPageUrl||a.APP_ROUTES.billing),children:A("Need more?")})}),(0,n.jsx)(f.ui_kit$Row,{gutter:24,className:"image-ai__row",children:(0,n.jsx)(f.ui_kit$Col,{span:24,children:(0,n.jsx)(f.ui_kit$Form.Item,{style:{margin:0},children:(0,n.jsxs)("span",{className:`ant-input-affix-wrapper ant-input-affix-wrapper-lg image-ai__input-affix-wrapper${P?" ant-input-affix-wrapper-focused":""}`,children:[(0,n.jsx)(f.ui_kit$TextArea,{ref:l,onKeyDown:j,onKeyUp:L,onFocus:M,onBlur:r,autoSize:!0,allowClear:!0,className:"text-area-input-hybrid image-ai__textarea",placeholder:A("Generate image"),value:I,onChange:C,spellCheck:"false"}),(0,n.jsx)("span",{className:"ant-input-suffix image-ai__input-suffix",children:h||X?(0,n.jsx)(a.EmIcons,{icon:"LoadingOutlined",component:f.icons$LoadingOutlined,className:"input-icon image-ai__input-icon",spin:!0}):(0,n.jsx)(a.EmIcons,{icon:"AI",component:f.icons$AI,className:"input-icon image-ai__input-icon",onClick:V})})]})})})}),(h||p.length>0)&&(0,n.jsxs)("div",{className:"image-ai__preview",children:[h&&p.length===0&&(0,n.jsx)("div",{className:"image-ai__loading",children:(0,n.jsxs)("div",{className:"spin",children:[(0,n.jsx)(a.EmIcons,{icon:"LoadingOutlined",component:f.icons$LoadingOutlined,style:{fontSize:48},spin:!0}),(0,n.jsx)("p",{className:"status",children:W})]})}),p.length>0&&(0,n.jsxs)("div",{className:"image-ai__image-item",children:[(0,n.jsx)(Gt,{images:p}),(0,n.jsx)("div",{className:"buttons",children:(0,n.jsx)(f.ui_kit$Button,{onClick:()=>F(le),icon:(0,n.jsx)(a.EmIcons,{icon:"CheckOutlined",component:f.icons$CheckOutlined}),children:A("Use this one")})})]})]})]})},pn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAkCAYAAAB/up84AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABSBJREFUeNrsWjFv2zoQVoMW8BZ18xaN3qLRW9QtW9OtW92to98vaPoP3K1b1S1b3c2jvWlUNm3lw1s8Mpu3PAo4Iocr70jKlp0COuCQlpKPx/t43x1pv3h8fEwGeT5yNoTgeclLZvza6NgxXoNaGRktjE6MpjC2NVqh92bwt4HxBI1ro0s0dgN2tvD5a8a/9vkq0M+xYKdG81A7Gp6pyBjZddrnO6N36Hkbqyn8u4L3vYC0hjLHeAbPVhC4TwAK/ewNvLsEhyxgFXLK2l/D4tvnOVrUiPEh1k/JjvLYyWENdeTcKazBBr6AdY4AqBTmbkIzhO4gvMumYLxAYKzgPTvhBBajYNwCksHYhOyYiow1KONaKYlfO8bPEWyGEfi5Iu+Vjizg7EzB3xvwWTMxWkHG4mDnMF6BnSnYncLzHWGG4BqiwZkKQMC7I0cOVTCJhvRUKNgNCmCOxhNmrBEWzwGi0Y6rIihbsnOH/JgE2hshKrLZv4Px9yhj1twafRlid/UIGWvlFdlVLirIkIM12nETGLeO2tTPECBUZuT/a7JBMpSxUybYLjulUCN2iEpHQoyuGWZJUCa8R/VGSZvGB0iOdjAO9n8EtC2zUxICSIoW0ICTmA53DCDKQzWZg89XAXZ2B2iMavBnjDKpBX6B1tnAM5aqQgGhnU2D6GmHuqw7AkaOPmP/bsHpFC1kTLqVhglS6fFNgX1MCXUHO1zR1h5AFOoSc1jjmKx/An/1PoBQasBSoZZ3hpyaOrg0IW2sRkG8JsU8CaCaLckAhfi6AG0cmeuzkyMQMtL+SiySkY3oA/EgGeICK0UOZYQKVsQpDAjm2BpsaAGQLMKnMdok3yLtpKS70yT7OUBcm7UTHb5grk5y1Csrj40MqUbUpgW7NXo+RunckODkQvdXM37iwm7b1VA7lAaVB4jUUZOUIzNxfOougAwy3GUN0qWG2IJJ09V2NcvIFE8c54nQelEHFM6C6chUhI+WZjjffDQkrenPhqmlrAC9Naof/aLhXZeNNfMZOk+MtPOVRjNmTpfcCut0+biGZ3PBj1ywWTOfqV3v+yjLFuDPRs8Ddu05vLtmsuHQ0s73wehvR0t7aGkPevfCM5fcGr0MbOW9NSSFwF52cP5KcLIv+X4EUGbCemcOqpoz73/haE4CZNkRjAR20vwENXHRc2bWEMyQuUuGVe4hc6K6rBmg7pKN0XdGX7dts9E3Rr8afUATFl1PqgLAG6T3AoX1nSVtMP9l5r5FVyiu+D14/YssRHOheGVQYNMeinrhsMcV2WVPRR1rIRT4QmiA5r4G6oxp0y6ZzFh4LvhmB84MHz1xta9vWQMrcFR/3iF+7DmEu2YoyTshRbuMvGE9hnwGPQR1tdR04aCueKrqAIgiu/AqcCf1JXPhfuoYosGHn4Hgqa6AnCK4IfSkCa1eCJRxLGnn+mX0rfDOJok4AsQAUpwQlND2++HIgNiOVO1LVRIgtXDPs0bpunEU08vktHLMpoJS1/d9qEo6h6gAzq7RRaPV+QmBeICzUUh2fIHzk0s3HedXwkEy2ReQmjn4XDzDjqkN4D/J04/y/np5KbSrrtbwAyx+kTxdf9tfpvSZIW9O3FScHJAF8PEFc5F2lQzSi5wJheoG3U/t0xYOcgBAcOHuAkr7mY9ditoAiCz2q8uvEcD8gJpSDuGNl5hfnaTJ0/fpheMUr4CitHCO6fqdesj359xh1tWiqggfdUCmcz9ZivZ7+BnQM5P/BRgABx8sJWqTxoYAAAAASUVORK5CYII=",Bt=({setNewLink:e,setCurrentImageLink:s,setModalHeight:o,setModalWidth:l,setImageGifList:i,imageGifList:c,currentReqGif:I,setCurrentReqGif:m,inputRef:p,setStockLink:k,customRequest:h})=>{const{__:v}=a.useI18n(),w=a.useAppConfig(),x=a.useIsStandalone(),A=a.useNotification(),[S,y]=(0,t.useState)(null),[U,R]=(0,t.useState)(!1),[B,$]=(0,t.useState)(25),[D]=a.useLazyGetSearchGifQuery(),G=(0,t.useCallback)(r=>r instanceof Error||typeof r?.message=="string"&&r.message?r.message:typeof r?.error?.message=="string"&&r.error.message?r.error.message:v("Failed to load GIFs through the configured proxy chain."),[v]),X=(0,t.useCallback)(r=>{A.error({id:"STOCK_GIFS_SEARCH_FAILED",title:v("Failed to load GIFs"),description:G(r)})},[v,G,A]),W=async()=>{U||(R(!0),D({query:I,page:B}).then(r=>{if(r?.error){X(r.error),R(!1);return}i(C=>[...C,...r.data.data]),R(!1),$(C=>C+25)}).catch(()=>{R(!1)}))},V=async()=>{const r=await D({query:I,page:0});if(r?.error){X(r.error),i([]);return}r?.data?.data?.length>0&&(i(r.data.data),setTimeout(()=>{o("84vh"),l(1060)},0))},F=(r,C)=>{y(C),setTimeout(()=>{y(null)},2e3),k(`${r}`),s(`${r}`),h(`${r}`)},Y={default:3},H=(0,t.useCallback)(r=>Ae.getProxiedUrl(r,{config:w,standalone:x,resourceType:"generic",intent:"display"}),[w,x]),te=(0,t.useCallback)(r=>r.id,[]),_=(0,t.useCallback)(r=>r.images.downsized.url,[]),{getDisplaySrc:Z,handleLoad:Q,handleError:P}=tt({items:c,getItemId:te,getRequestUrl:_,createController:H}),q=r=>C=>{Q(r),C.target.parentNode.classList.add("loaded")},M=r=>()=>{P(r)};return(0,n.jsxs)("div",{className:"stock-tab",children:[(0,n.jsxs)(f.ui_kit$Form,{onValuesChange:V,className:c.length>0?"serach-results":"",children:[(0,n.jsx)(f.ui_kit$Row,{gutter:24,children:(0,n.jsx)(f.ui_kit$Col,{span:c.length>0?"":24,children:(0,n.jsx)(f.ui_kit$Form.Item,{className:"stock-search-input",children:(0,n.jsx)(f.ui_kit$SearchInput,{onSearch:V,allowClear:!0,size:c.length>0?"medium":"large",placeholder:v("Search GIFs"),value:I.keywords,onChange:r=>m(C=>({...C,keywords:r.target.value})),ref:p,spellCheck:"false",enterButton:!1})})})}),c.length>0&&(0,n.jsx)("div",{className:"blocks-search__divider-wrapper",children:(0,n.jsx)("div",{className:"ant-divider ant-divider-horizontal",role:"separator"})})]}),(0,n.jsx)("div",{className:"serach-output-wrapper",style:{marginRight:-10},children:c.length>0&&(0,n.jsx)("div",{id:"scrollableDiv",style:{width:"100%",height:"calc(84vh - 148px)",overflow:"auto",paddingTop:24,paddingRight:14,paddingLeft:24,marginLeft:-24,lineHeight:"0",boxSizing:"unset"},children:(0,n.jsx)(Xe,{dataLength:c&&c.length,next:W,hasMore:c,endMessage:(0,n.jsxs)(f.ui_kit$Divider,{plain:!0,children:[v("That`s all we could find.")," 🤐"]}),scrollableTarget:"scrollableDiv",style:{overflow:"visible"},loader:(0,n.jsx)(f.ui_kit$Spin,{size:"small"}),children:(0,n.jsx)(Ge,{breakpointCols:Y,className:"my-masonry-grid",columnClassName:"my-masonry-grid_column",children:c.map((r,C)=>(0,n.jsxs)("div",{className:"list-item",onClick:()=>F(r.images.downsized.url,r.id),children:[(0,n.jsx)("img",{className:S===r.id?"loaded-image":"",width:"322px",src:Z(r),alt:r.title,onLoad:q(r),onError:M(r)}),(0,n.jsx)("a",{rel:"noreferrer",href:"https://giphy.com/",target:"_blank",onClick:j=>j.stopPropagation(),children:(0,n.jsx)("div",{className:"overlay-image",style:{backgroundImage:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAkCAYAAAB/up84AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABSBJREFUeNrsWjFv2zoQVoMW8BZ18xaN3qLRW9QtW9OtW92to98vaPoP3K1b1S1b3c2jvWlUNm3lw1s8Mpu3PAo4Iocr70jKlp0COuCQlpKPx/t43x1pv3h8fEwGeT5yNoTgeclLZvza6NgxXoNaGRktjE6MpjC2NVqh92bwt4HxBI1ro0s0dgN2tvD5a8a/9vkq0M+xYKdG81A7Gp6pyBjZddrnO6N36Hkbqyn8u4L3vYC0hjLHeAbPVhC4TwAK/ewNvLsEhyxgFXLK2l/D4tvnOVrUiPEh1k/JjvLYyWENdeTcKazBBr6AdY4AqBTmbkIzhO4gvMumYLxAYKzgPTvhBBajYNwCksHYhOyYiow1KONaKYlfO8bPEWyGEfi5Iu+Vjizg7EzB3xvwWTMxWkHG4mDnMF6BnSnYncLzHWGG4BqiwZkKQMC7I0cOVTCJhvRUKNgNCmCOxhNmrBEWzwGi0Y6rIihbsnOH/JgE2hshKrLZv4Px9yhj1twafRlid/UIGWvlFdlVLirIkIM12nETGLeO2tTPECBUZuT/a7JBMpSxUybYLjulUCN2iEpHQoyuGWZJUCa8R/VGSZvGB0iOdjAO9n8EtC2zUxICSIoW0ICTmA53DCDKQzWZg89XAXZ2B2iMavBnjDKpBX6B1tnAM5aqQgGhnU2D6GmHuqw7AkaOPmP/bsHpFC1kTLqVhglS6fFNgX1MCXUHO1zR1h5AFOoSc1jjmKx/An/1PoBQasBSoZZ3hpyaOrg0IW2sRkG8JsU8CaCaLckAhfi6AG0cmeuzkyMQMtL+SiySkY3oA/EgGeICK0UOZYQKVsQpDAjm2BpsaAGQLMKnMdok3yLtpKS70yT7OUBcm7UTHb5grk5y1Csrj40MqUbUpgW7NXo+RunckODkQvdXM37iwm7b1VA7lAaVB4jUUZOUIzNxfOougAwy3GUN0qWG2IJJ09V2NcvIFE8c54nQelEHFM6C6chUhI+WZjjffDQkrenPhqmlrAC9Naof/aLhXZeNNfMZOk+MtPOVRjNmTpfcCut0+biGZ3PBj1ywWTOfqV3v+yjLFuDPRs8Ddu05vLtmsuHQ0s73wehvR0t7aGkPevfCM5fcGr0MbOW9NSSFwF52cP5KcLIv+X4EUGbCemcOqpoz73/haE4CZNkRjAR20vwENXHRc2bWEMyQuUuGVe4hc6K6rBmg7pKN0XdGX7dts9E3Rr8afUATFl1PqgLAG6T3AoX1nSVtMP9l5r5FVyiu+D14/YssRHOheGVQYNMeinrhsMcV2WVPRR1rIRT4QmiA5r4G6oxp0y6ZzFh4LvhmB84MHz1xta9vWQMrcFR/3iF+7DmEu2YoyTshRbuMvGE9hnwGPQR1tdR04aCueKrqAIgiu/AqcCf1JXPhfuoYosGHn4Hgqa6AnCK4IfSkCa1eCJRxLGnn+mX0rfDOJok4AsQAUpwQlND2++HIgNiOVO1LVRIgtXDPs0bpunEU08vktHLMpoJS1/d9qEo6h6gAzq7RRaPV+QmBeICzUUh2fIHzk0s3HedXwkEy2ReQmjn4XDzDjqkN4D/J04/y/np5KbSrrtbwAyx+kTxdf9tfpvSZIW9O3FScHJAF8PEFc5F2lQzSi5wJheoG3U/t0xYOcgBAcOHuAkr7mY9ditoAiCz2q8uvEcD8gJpSDuGNl5hfnaTJ0/fpheMUr4CitHCO6fqdesj359xh1tWiqggfdUCmcz9ZivZ7+BnQM5P/BRgABx8sJWqTxoYAAAAASUVORK5CYII=)"}})}),S===r.id&&(0,n.jsx)(f.ui_kit$Spin,{className:"ant-spin",size:"small"})]},r.id+C))})})})})]})};function Ft(e){if(!(e==null||e===""))return e}async function zt(e,s){if(e){if(e.url)return e.url;if(typeof s.getFileById=="function"&&e.id){const o=await s.getFileById(e.id);if(o?.url)return o.url;if(o?.thumbnailUrl)return o.thumbnailUrl;if(o?.thumbnail)return o.thumbnail}if(typeof s.getFileUrl=="function"&&e.folderId!==void 0&&e.name){const o=await s.getFileUrl(e.folderId||"",e.name);if(o)return o}if(typeof s.getUrl=="function"&&e.name){const o=await s.getUrl(e);if(o)return o}return e.thumbnail||e.thumbnailUrl}}function Kt(e){if(!(!e?.success||!Array.isArray(e.detailed)))return e.detailed.find(s=>s?.success&&s.data)?.data}function $t(e,s,o){if(e)return{id:e.id,name:e.name||s.name,size:e.size??s.size,type:e.type||s.type,folderId:e.folderId??o??"",url:e.url,thumbnail:e.thumbnail,thumbnailUrl:e.thumbnailUrl,date:e.date,dimensions:e.dimensions,aspectRatio:e.aspectRatio,extension:e.extension,selected:e.selected,isFolder:e.isFolder,lastEdited:e.lastEdited,childrenCount:e.childrenCount}}async function Wt(e,s,o){if(!s)return;const l=Ft(o??s.rootId);let i;typeof s.uploadFiles=="function"?i=Kt(await s.uploadFiles({folderId:l,items:[{name:e.name,size:e.size,type:e.type,folderId:l,data:e}]})):typeof s.uploadFile=="function"&&(i=$t(await s.uploadFile({name:e.name,size:e.size,type:e.type,folderId:l,data:e}),e,l));const c=await zt(i,s);return c?{item:i,url:c}:void 0}var st="IMG",at="BACKGROUND",Vt="GALLERY",be="EDITOR",ue="UPLOAD",Ne="STOCK",Be="GIF",Fe="AI",Ht={mode:"select"},Qt={mode:"save"},{Dragger:qt}=f.ui_kit$Upload,Yt=(e,s="image")=>a.decodeFileNameFromUrl(e)??s,xe=se.normalizeImageFormatForDisplay,Zt=(e,s)=>{const o=xe(s);return!o||e.includes(".")?e:`${e}.${o}`},Jt=(e,s)=>new File([e],Zt(Yt(s),e.type),{type:e.type||"application/octet-stream"}),ot=({dataProvider:e,usesBuiltInStorage:s})=>{const o=a.useAppConfig(),l=a.useIsStandalone(),{__:i}=a.useI18n(),c=a.useDispatch(),I=a.useEditorProjectId(),[m]=a.useLazyGetImageInfoQuery(),{modal:p}=f.ui_kit$App.useApp(),k=a.useNotification(),h=a.useSelector(a.selectActiveModal$1),{request:v,resolveImagePicker:w}=a.useImagePicker(),[x,A]=(0,t.useState)(""),[S,y]=(0,t.useState)(""),[U,R]=(0,t.useState)(""),[B,$]=(0,t.useState)(""),[D,G]=(0,t.useState)(ue),[X,W]=(0,t.useState)({width:"",height:"",size:"",format:""}),[V,F]=(0,t.useState)("success"),[Y,H]=(0,t.useState)(!1),te=t.default.useRef(null),_=t.default.useRef(null),Z=t.default.useRef(null),Q=t.default.useRef(null),P=t.default.useRef(null),q=t.default.useRef(null),M=t.default.useRef(null),r=t.default.useRef(null),C=t.default.useRef(null),[j,L]=(0,t.useState)("auto"),[le,E]=(0,t.useState)(572),[pe,he]=(0,t.useState)(!1),[ae,ge]=(0,t.useState)({keywords:"",color:"",orientation:""}),[K,J]=(0,t.useState)({keywords:""}),[O,ne]=(0,t.useState)([]),[g,N]=(0,t.useState)([]),[z,de]=(0,t.useState)([]),[it,lt]=(0,t.useState)(!1),[ct,ze]=(0,t.useState)(""),[Xt,Ee]=(0,t.useState)(!1),[en,Ue]=(0,t.useState)(0),ut=a.useProjectData(),dt=ut?.id!==void 0?String(ut.id):I||"",ft=a.useEventEmitter(Ae.events.UPLOAD_EVENT_ID),fe=se.useImageBlobResolver(),Se=t.default.useRef(""),ye=t.default.useRef(0),we=t.default.useRef(""),[tn,mt]=(0,t.useState)(""),[nn,pt]=(0,t.useState)(null),[rn,Ke]=(0,t.useState)(""),De=(0,t.useCallback)(u=>{if(!(u instanceof Blob))return;we.current&&URL.revokeObjectURL(we.current);const d=URL.createObjectURL(u);we.current=d,mt(d),pt(u)},[]),me=(0,t.useCallback)(()=>{we.current&&(URL.revokeObjectURL(we.current),we.current=""),mt(""),pt(null)},[]),ie=(0,t.useCallback)(()=>{Ke("")},[]),$e=a.usePlanFeatureGate("element_ai_image"),We=a.usePlanFeatureGate("stock_photo"),Ve=a.usePlanFeatureGate("stock_gif"),ht=a.usePlanFeatureGate("image_editor"),sn=u=>{y(u.target.value)},je=(0,t.useCallback)((u,d,b=i("The image could not be uploaded."))=>{const T=d instanceof Error?d.message:b;k.error({id:"IMAGE_UPLOAD_ERROR",data:u,title:i("Upload failed"),description:T})},[i,k]),an=(0,t.useCallback)(u=>a.fireUploadImageEvent(ft,{file:u,project:dt}),[dt,ft]),Ce=se.useImageBlobFetch(),on=(0,t.useCallback)(u=>fe.resolve(se.canonicalImageUrlKey(u),void 0,Ce),[Ce,fe]),Pe=async u=>{if(u)try{const d=await ln(u);d&&Qe(d)?await Re({file:d}):d||je({url:u},null,i("Failed to download image from URL."))}catch(d){je({url:u},d,i("Failed to process image URL."))}},gt=t.default.useRef(Pe);gt.current=Pe,t.default.useEffect(()=>{if(D!==ue||!B)return;const u=S.trim();if(!u||!u.toLowerCase().startsWith("http"))return;const d=setTimeout(()=>{gt.current(u)},1e3);return()=>{clearTimeout(d)}},[S,D,B]);const ln=async u=>{try{const d=se.canonicalImageUrlKey(u),b=await fe.resolve(d,void 0,Ce);return Jt(b,d)}catch{}};document.onpaste=function(u){const d=u.clipboardData?.items?.[0];if(D===ue&&B){if(d?.type?.indexOf("image")===0&&o.imageCenterLocalUploadEnabled!==!1){const T=d.getAsFile();Qe(T);const re={file:T};y(""),Re(re);return}const b=u.clipboardData?.getData("text/plain");if(b&&b.trim().toLowerCase().startsWith("http")){u.preventDefault(),u.stopPropagation(),y(b.trim());return}d?.type?.indexOf("text")===0&&d.getAsString(T=>{if(T.trim().toLowerCase().startsWith("http"))y(T.trim());else if(T.toString().slice(1,5)==="meta"){const re=T.toString().split('"')[1];re&&y(re)}})}},(0,t.useEffect)(()=>{const u=d=>{let b=null;v?.kind==="background"?(b=at,$(at)):v?.kind==="img"&&($(st),b=st),v?.currentUrl&&b&&(A(v.currentUrl),G(d))};h===a.MODALS.UPLOAD_IMAGE_MODAL||h===a.MODALS.UPLOAD_BACKGROUND_MODAL?u(be):h===a.MODALS.UPLOAD_IMAGE_MODAL_AI||h===a.MODALS.UPLOAD_BACKGROUND_MODAL_AI?($e.isLocked?(Ee(!0),Ue(a.FEATURE_UPSELL_SLIDE.element_ai_image)):u(Fe),setTimeout(()=>C.current?.focus({cursor:"start"}),100)):h===a.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD||h===a.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD?(u(ue),setTimeout(()=>q.current?.focus({cursor:"start"}),100)):h===a.MODALS.UPLOAD_IMAGE_MODAL_STOCK||h===a.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK?(We.isLocked?(Ee(!0),Ue(a.FEATURE_UPSELL_SLIDE.stock_photo)):u(Ne),setTimeout(()=>r.current?.focus({cursor:"start"}),100)):h===a.MODALS.UPLOAD_IMAGE_MODAL_GIF||h===a.MODALS.UPLOAD_BACKGROUND_MODAL_GIF?(Ve.isLocked?(Ee(!0),Ue(a.FEATURE_UPSELL_SLIDE.stock_gif)):u(Be),setTimeout(()=>M.current?.focus({cursor:"start"}),100)):h===a.MODALS.UPLOAD_IMAGE_MODAL_EDIT||h===a.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT?(ht.isLocked?(Ee(!0),Ue(a.FEATURE_UPSELL_SLIDE.image_editor)):u(be),c(a.openSecondModal(a.MODALS.IMAGE_EDITOR_MODAL))):$("")},[h,c,$e.isLocked,We.isLocked,Ve.isLocked,ht.isLocked,v]);const He=(0,t.useCallback)(({url:u=x||"",meta:d=Ht})=>{A(u),w({url:u,meta:d}),setTimeout(()=>{ie(),me(),ge({keywords:"",color:"",orientation:""}),J({keywords:""}),N([]),ne([]),$(""),ze(""),lt(!1),R(""),y(""),G(ue)},200),c(a.closeModal$1()),c(a.closeSecondModal())},[x,ie,c,w,me]),vt=(0,t.useCallback)((u,d)=>(L("auto"),H(!1),He({url:u,meta:Qt}),k.success({id:"IMAGE_UPLOAD_SUCCESS",data:d,title:i("The image was successfully uploaded.")}),u),[i,He,k]);(0,t.useEffect)(()=>{const u=S||U,d=se.canonicalImageUrlKey(u);if(!u||!d){F(""),Se.current&&fe.abandonKey(Se.current),Se.current="",ie(),me();return}const b=Se.current;b&&b!==d&&(fe.abandonKey(b),ie(),me()),Se.current=d;const T=new AbortController,re=S?800:0,ee=++ye.current,qe=setTimeout(async()=>{try{const Ie=async()=>{const ce=await fe.resolve(d,T.signal,Ce);if(ee!==ye.current)return;const{width:ve,height:fn}=await se.getImageDimensionsFromBlob(ce);ee===ye.current&&(W({width:ve,height:fn,size:(ce.size/1024).toFixed(2),format:xe(ce.type)}),ie(),De(ce))};if(l)await Ie();else{const ce=await se.resolveDataProviderPreview(e,d);if(ce?.previewUrl&&ee===ye.current){Ke(ce.previewUrl),me();try{const{data:ve}=await m(d);if(ee!==ye.current)return;ve?W({width:ve?.width,height:ve?.height,size:ve?.fileSize!=null?(ve.fileSize/1024).toFixed(2):"",format:xe(ve?.format)}):await Ie()}catch{await Ie()}}else await Ie()}if(ee!==ye.current)return;F("success"),A(u),E(572),setTimeout(()=>{let ce=0;_.current&&(ce=_.current.offsetHeight+62),L(ce)},0)}catch(Ie){if(Ie?.name==="AbortError"||T.signal.aborted||ee!==ye.current)return;ie(),me(),F("error")}},re);return()=>{clearTimeout(qe),T.abort()}},[S,U,l,ie,Ce,m,fe,me,e,De]),(0,t.useEffect)(()=>{if(!x||S||U||!h)return;const u=se.canonicalImageUrlKey(x),d=new AbortController;let b=!1;const T=async()=>{const re=await fe.resolve(u,d.signal,Ce);if(b)return;const{width:ee,height:qe}=await se.getImageDimensionsFromBlob(re);b||(ie(),De(re),W({width:ee,height:qe,size:(re.size/1024).toFixed(2),format:xe(re.type)}))};return(async()=>{try{if(!l){const re=await se.resolveDataProviderPreview(e,u);if(re?.previewUrl&&!b){Ke(re.previewUrl),me();try{const{data:ee}=await m(u);if(b)return;ee?W({width:ee?.width,height:ee?.height,size:ee?.fileSize!=null?(ee.fileSize/1024).toFixed(2):"",format:xe(ee?.format)}):await T();return}catch{await T()}}}await T()}catch{b||ie()}})(),()=>{b=!0,d.abort()}},[l,h,ie,x,Ce,m,fe,e,S,U,De]);const cn=()=>{c(a.closeModal$1()),setTimeout(()=>{ie(),me(),A(""),y(""),N([]),N([]),ge({keywords:"",color:"",orientation:""}),J({keywords:""}),L("auto"),!it&&ze(""),E(572),G(ue)},200)},un=u=>{u===Vt?p.success({mask:{closable:!0},centered:!0,title:i("Coming soon"),content:i("The feature is under development."),okText:i("Ok. I'll be waiting"),onOk:()=>{}}):u===be&&x===""?p.warning({mask:{closable:!0},centered:!0,title:i(""),content:i("To preview and edit the uploaded image"),okText:i("Upload Image"),onOk:()=>{G(ue)}}):(setTimeout(()=>{let d=0,b=0;u===ue&&te.current?(ae.keywords===""&&q.current?.focus({cursor:"start"}),d=300,b=572):u===be&&_.current?(d=_.current.offsetHeight+62,b=572):u===Ne&&Z.current?(ae.keywords===""&&r.current?.focus({cursor:"start"}),d=130,b=572,g.length>0&&(b=1060,d="84vh")):u===Be&&Q.current?(ae.keywords===""&&M.current?.focus({cursor:"start"}),d=130,b=572,O.length>0&&(b=1060,d="84vh")):u===Fe&&P.current&&(ct===""&&z.length===0?(C.current?.focus({cursor:"start"}),d=130):d=P.current.offsetHeight+82,b=572),L(d),E(b)},0),G(u))};(0,t.useEffect)(()=>{ae.keywords===""&&(q?.current?.focus({cursor:"start"}),N([]),setTimeout(()=>{L("auto"),E(572)},0))},[ae,N,L,E]);const Qe=u=>{const d=u.type==="image/jpeg"||u.type==="image/png"||u.type==="image/jpg"||u.type==="image/webp"||u.type==="image/gif"||u.type==="image/svg+xml";return d||k.error({id:"IMAGE_UPLOAD_WRONG_FORMAT",data:u,title:"Upload",description:"You can only upload JPG/JPEG/PNG/WEBP/GIF/SVG file!"}),d},Re=async({file:u})=>{try{he(!0);const d=await a.prepareImageForEditorUpload(u,o),b=await an(d);if(b.url)return vt(b.url,d),b.url;if(!a.shouldFallbackToBuiltInUpload(b,{isStandalone:l,targetIsOurBackend:!!s})){je(d,a.toUploadImageError(b));return}const T=await Wt(d,e);if(T?.url)return vt(T.url,d),T.url;je(d,null);return}catch(d){je(u,d);return}finally{he(!1)}},dn=u=>Re({file:u});let Oe=[{label:i("Upload"),key:ue,children:(0,n.jsxs)("div",{ref:te,style:{paddingBottom:24},children:[o.imageCenterLocalUploadEnabled!==!1&&(0,n.jsxs)(qt,{showUploadList:!1,name:"Image",beforeUpload:Qe,customRequest:Re,style:{marginBottom:10},multiple:!1,accept:"image/png, image/jpeg, image/jpg, image/webp, image/gif, image/svg+xml",children:[(0,n.jsx)("p",{className:"ant-upload-drag-icon",children:(0,n.jsx)(a.EmIcons,{icon:"InboxOutlined",component:f.icons$InboxOutlined})}),(0,n.jsx)("p",{className:"ant-upload-text",children:i("Click to select, paste from the clipboard, or drag and drop")}),(0,n.jsx)("p",{className:"ant-upload-hint",children:i("Accepted formats: PNG, JPG, WEBP, SVG or GIF.")})]}),(0,n.jsx)(f.ui_kit$Form,{style:{padding:"0 2px 0 2px"},children:(0,n.jsx)(f.ui_kit$Form.Item,{validateStatus:V,children:(0,n.jsx)(f.ui_kit$Input,{ref:q,allowClear:!0,size:"large",placeholder:i("Paste image URL here"),value:S,onChange:sn,spellCheck:"false"})})})]})}];return o.imageCenterStockEnabled&&!We.isLocked&&Oe.push({label:i("Stock"),key:Ne,children:(0,n.jsx)("div",{ref:Z,style:{paddingBottom:24},children:(0,n.jsx)(Pt,{currentReq:ae,setCurrentReq:ge,imageStockList:g,setImageStockList:N,setModalWidth:E,setModalHeight:L,setStockLink:R,setCurrentImageLink:A,inputRef:r,customRequest:Pe})})}),o.imageCenterGifEnabled&&!Ve.isLocked&&Oe.push({label:i("GIF"),key:Be,children:(0,n.jsx)("div",{ref:Q,style:{paddingBottom:24},children:(0,n.jsx)(Bt,{currentReqGif:K,setCurrentReqGif:J,imageGifList:O,setImageGifList:ne,setModalWidth:E,setModalHeight:L,setStockLink:R,setCurrentImageLink:A,inputRef:M,customRequest:Pe})})}),o.elementAIimageEnabled&&!$e.isLocked&&Oe.push({label:i("AI"),key:Fe,children:(0,n.jsx)("div",{ref:P,style:{paddingBottom:24},children:(0,n.jsx)(Nt,{setModalHeight:L,customRequest:Re,aiImageRequest:ct,setAiImageRequest:ze,imageAiList:z,setImageAiList:de,isLoadingAi:it,setIsLoadingAi:lt,aiTabRef:P,inputAiRef:C,isImageUploaded:Y,setIsImageUploaded:H})})}),o.imageCenterEditorEnabled&&Oe.push({label:"",key:be,children:(0,n.jsx)("div",{ref:_,children:(0,n.jsx)(St,{currentImageLink:x,newLink:S,previewDisplayUrl:rn,resolvedPreviewObjectUrl:tn,resolvedPreviewBlob:nn,resolveImageBlob:on,imageSize:X,onSave:dn,uploadImageResultIsLoading:pe||!1})})}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(f.ui_kit$Modal,{width:le,className:"image-center",title:i("Image Center"),style:{minHeight:390},open:!!B,onOk:He,onCancel:cn,footer:D===be?(0,n.jsx)(n.Fragment,{}):null,children:(0,n.jsx)(f.ui_kit$Spin,{spinning:pe,children:(0,n.jsx)(f.ui_kit$Tabs,{activeKey:D,onChange:un,items:Oe,className:"modal-tabs",style:{height:j,minHeight:130}})})}),(0,n.jsx)(a.PlanUpgradePrompt,{open:Xt,onCancel:()=>Ee(!1),initialSlide:en})]})};ot.propTypes={dataProvider:bt.default.object},yt.default=ot});
@@ -1,2 +1,2 @@
1
1
  (function(){try{if(typeof document<"u"){var a=".blocks-app .image-editor-modal .ant-modal-container{flex-direction:column;min-height:100vh;display:flex;border-radius:0!important}.blocks-app .image-editor-modal .ant-modal-body{border-bottom:1px solid #d9d9d9;flex-grow:1;display:flex}.blocks-app .image-editor-modal .ant-modal-body #filerobot-editor{flex-grow:1;height:calc(100vh - 70px);min-height:calc(100vh - 70px);overflow:hidden}.blocks-app .image-editor-modal .pi .text-on-primary{background:var(--ub-colorPrimary);border-color:var(--ub-colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary:hover{background:var(--ub-colorPrimaryHover);border-color:var(--ub-colorPrimaryHover)}.blocks-app .image-editor-modal .pi .text-on-primary.rounded-full{border-radius:calc(var(--ub-borderRadius) * 1px)}.blocks-app .image-editor-modal .pi .shadow-xl{box-shadow:none}.blocks-app .image-editor-modal .w-\\[4ch\\].text-sm.text-center{width:5ch}.blocks-app .image-editor-modal .pi .border-white{border-color:var(--ub-colorPrimary)}.blocks-app .image-editor-modal .pi .bg-white\\/50{background-color:var(--ub-colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary{color:var(--ub-colorWhite)}",o=window.__useblocks_styles__||(window.__useblocks_styles__={sheets:{},order:[]}),e=a;if(!o.sheets[e]){var t=!1;try{if(typeof CSSStyleSheet=="function"&&"replaceSync"in CSSStyleSheet.prototype&&document.adoptedStyleSheets){var d=new CSSStyleSheet;d.replaceSync(a),document.adoptedStyleSheets=document.adoptedStyleSheets.concat([d]),o.sheets[e]=d,o.order.push(e),t=!0}}catch{t=!1}if(!t){var r=document.createElement("style");r.setAttribute("data-useblocks","true"),r.appendChild(document.createTextNode(a)),document.head.appendChild(r),o.sheets[e]=r,o.order.push(e)}}}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
- __useblocks__.define("static/core/3a252a3c.js",["require","exports","module","static/core/2ff39ddf.js","static/core/8782e9bb.js","static/core/10c6144f.js","static/core/d2bb1c0d.js","static/core/5db1f013.js","static/core/9600caf9.js","static/core/a73da823.js","react","react/jsx-runtime","__delivery__/libs"],function(r,B,W){const R=r("./2ff39ddf.js"),j=r("./8782e9bb.js"),e=r("./10c6144f.js"),u=r("./d2bb1c0d.js"),M=r("./5db1f013.js");r("./9600caf9.js");const U=r("./a73da823.js");let o=r("react");o=R.__toESM(o);let c=r("react/jsx-runtime"),_=r("__delivery__/libs");var N={width:"100%",height:"100%"},$=[u.TABS_IDS.ADJUST,u.TABS_IDS.ANNOTATE,u.TABS_IDS.RESIZE];function F(n,l){if(n==="json")return new Blob([l],{type:"application/json"});if(n==="svg")return new Blob([l],{type:"image/svg+xml"});const f=`image/${n}`,m=l.replace(/data:image\/([a-z]*)?;base64,/,"");return U.base64ToBlob(m,f)}var z=({currentImageLink:n,prefetchedBlob:l,resolveImageBlob:f,onSave:m,uploadImageResultIsLoading:L})=>{const b=e.useCookieManager(),[v,E]=(0,o.useState)(),[I,S]=(0,o.useState)(),{__:C}=e.useI18n();let p=e.useDispatch();const D=e.useStore(),h=e.useAppConfig(),T=e.useCurrentUser(),P=e.useSelector(e.selectSecondModal),w=e.useProjectData();(0,o.useMemo)(()=>{if(!h?.icons)return;const s={};for(const[i,t]of Object.entries(h.icons))typeof t=="string"&&(s[i]=e.sanitizeHtml(t));return Object.keys(s).length>0?s:void 0},[h?.icons]);const[J,k]=(0,o.useState)(!1),y=(0,o.useRef)(),x=e.useEventEmitter(j.events.FILE_PROXY_EVENT_ID);(0,o.useEffect)(()=>{let s=!1;return(async()=>{const t=n;if(!t&&!l)return;let a=l;if(!a&&t)try{typeof f=="function"?a=await f(t):a=await(await fetch(t)).blob()}catch{if(s)return;if(a=await x.fire({url:t,project:w}).filter(d=>d instanceof Blob)[0],!a){const d=b.get(e.APP_COOKIES.em_token)||await e.di.getContainer(D)?.getInstance(j.TOKEN_ID);a=await(await fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(t)}`,{headers:{authorization:`Bearer ${d}`}})).blob()}}if(s||!a)return;const g=new FileReader;g.onload=()=>{if(s)return;const d=g.result;typeof d=="string"&&(E(d),S(a.type))},g.onerror=()=>{},g.readAsDataURL(a)})().catch(t=>{}),()=>{s=!0}},[n,l,f,b,x,w,D]);const H=(0,o.useCallback)(()=>{E(null),S(null),k(!1),p(e.closeSecondModal()),p(e.closeModal$1(e.MODALS.UPLOAD_IMAGE_MODAL))},[p]),A=(0,o.useRef)();A.current=async function(s,i,t){try{const a=F(t,s);m&&await m(new File([a],i,{lastModified:Date.now(),type:a.type}))}catch(a){throw a}};const K=(0,o.useCallback)(s=>{k(!!s)},[]),V=(0,o.useCallback)(()=>{if(!y.current)return;const s=n?.split("/").pop().split(".")[0]||"image",i=I?.split("/")[1]||"png";try{const{imageData:t}=y.current({name:s,extension:i},void 0,!1),a=t.imageBase64??(t.imageCanvas?t.imageCanvas.toDataURL(`image/${i}`):void 0);if(!a)throw new Error("FIE не вернул ни imageBase64, ни imageCanvas");A.current(a,s,i)}catch{}},[n,I]),O=T.locale?T.locale.replace("_","-"):"en-US";return(0,c.jsxs)(_.ui_kit$Modal,{afterOpenChange:K,width:"100%",style:{maxWidth:"100%",minHeight:"100vh"},className:"image-editor-modal",centered:!0,closable:!1,zIndex:1100,mask:!1,open:P,footer:[(0,c.jsx)(_.ui_kit$Button,{className:"em-analytics__profile-cancel",onClick:H,children:C("Cancel")},"Cancel"),(0,c.jsx)(_.ui_kit$Button,{className:"em-analytics__profile-updafilerobotte",id:"save",type:"primary",onClick:V,children:C("Update")},"Ok")],children:[L&&(0,c.jsx)("div",{style:{position:"absolute",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:e.emCssVar("colorBgLayout"),zIndex:10,opacity:.7},children:(0,c.jsx)(_.ui_kit$Spin,{size:"large"})}),(0,c.jsx)("div",{id:"filerobot-editor",style:N,children:J&&v&&(0,c.jsx)(u.AssemblyPoint_default,{source:v,useBackendTranslations:!1,language:O.split("-")[0],translations:M.d(O),tabsIds:$,defaultTabId:u.TABS_IDS.ADJUST,avoidChangesNotSavedAlertOnLeave:!0,removeSaveButton:!0,getCurrentImgDataFnRef:y})})]})};B.default=z});
2
+ __useblocks__.define("static/core/78b1e678.js",["require","exports","module","static/core/2ff39ddf.js","static/core/8782e9bb.js","static/core/10c6144f.js","static/core/d2bb1c0d.js","static/core/5db1f013.js","static/core/b49f995f.js","static/core/a73da823.js","react","react/jsx-runtime","__delivery__/libs"],function(r,B,W){const R=r("./2ff39ddf.js"),j=r("./8782e9bb.js"),e=r("./10c6144f.js"),u=r("./d2bb1c0d.js"),M=r("./5db1f013.js");r("./b49f995f.js");const U=r("./a73da823.js");let o=r("react");o=R.__toESM(o);let c=r("react/jsx-runtime"),_=r("__delivery__/libs");var N={width:"100%",height:"100%"},$=[u.TABS_IDS.ADJUST,u.TABS_IDS.ANNOTATE,u.TABS_IDS.RESIZE];function F(n,l){if(n==="json")return new Blob([l],{type:"application/json"});if(n==="svg")return new Blob([l],{type:"image/svg+xml"});const f=`image/${n}`,m=l.replace(/data:image\/([a-z]*)?;base64,/,"");return U.base64ToBlob(m,f)}var z=({currentImageLink:n,prefetchedBlob:l,resolveImageBlob:f,onSave:m,uploadImageResultIsLoading:L})=>{const b=e.useCookieManager(),[v,E]=(0,o.useState)(),[I,S]=(0,o.useState)(),{__:C}=e.useI18n();let p=e.useDispatch();const D=e.useStore(),h=e.useAppConfig(),T=e.useCurrentUser(),P=e.useSelector(e.selectSecondModal),w=e.useProjectData();(0,o.useMemo)(()=>{if(!h?.icons)return;const s={};for(const[i,t]of Object.entries(h.icons))typeof t=="string"&&(s[i]=e.sanitizeHtml(t));return Object.keys(s).length>0?s:void 0},[h?.icons]);const[J,k]=(0,o.useState)(!1),y=(0,o.useRef)(),x=e.useEventEmitter(j.events.FILE_PROXY_EVENT_ID);(0,o.useEffect)(()=>{let s=!1;return(async()=>{const t=n;if(!t&&!l)return;let a=l;if(!a&&t)try{typeof f=="function"?a=await f(t):a=await(await fetch(t)).blob()}catch{if(s)return;if(a=await x.fire({url:t,project:w}).filter(d=>d instanceof Blob)[0],!a){const d=b.get(e.APP_COOKIES.em_token)||await e.di.getContainer(D)?.getInstance(j.TOKEN_ID);a=await(await fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(t)}`,{headers:{authorization:`Bearer ${d}`}})).blob()}}if(s||!a)return;const g=new FileReader;g.onload=()=>{if(s)return;const d=g.result;typeof d=="string"&&(E(d),S(a.type))},g.onerror=()=>{},g.readAsDataURL(a)})().catch(t=>{}),()=>{s=!0}},[n,l,f,b,x,w,D]);const H=(0,o.useCallback)(()=>{E(null),S(null),k(!1),p(e.closeSecondModal()),p(e.closeModal$1(e.MODALS.UPLOAD_IMAGE_MODAL))},[p]),A=(0,o.useRef)();A.current=async function(s,i,t){try{const a=F(t,s);m&&await m(new File([a],i,{lastModified:Date.now(),type:a.type}))}catch(a){throw a}};const K=(0,o.useCallback)(s=>{k(!!s)},[]),V=(0,o.useCallback)(()=>{if(!y.current)return;const s=n?.split("/").pop().split(".")[0]||"image",i=I?.split("/")[1]||"png";try{const{imageData:t}=y.current({name:s,extension:i},void 0,!1),a=t.imageBase64??(t.imageCanvas?t.imageCanvas.toDataURL(`image/${i}`):void 0);if(!a)throw new Error("FIE не вернул ни imageBase64, ни imageCanvas");A.current(a,s,i)}catch{}},[n,I]),O=T.locale?T.locale.replace("_","-"):"en-US";return(0,c.jsxs)(_.ui_kit$Modal,{afterOpenChange:K,width:"100%",style:{maxWidth:"100%",minHeight:"100vh"},className:"image-editor-modal",centered:!0,closable:!1,zIndex:1100,mask:!1,open:P,footer:[(0,c.jsx)(_.ui_kit$Button,{className:"em-analytics__profile-cancel",onClick:H,children:C("Cancel")},"Cancel"),(0,c.jsx)(_.ui_kit$Button,{className:"em-analytics__profile-updafilerobotte",id:"save",type:"primary",onClick:V,children:C("Update")},"Ok")],children:[L&&(0,c.jsx)("div",{style:{position:"absolute",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:e.emCssVar("colorBgLayout"),zIndex:10,opacity:.7},children:(0,c.jsx)(_.ui_kit$Spin,{size:"large"})}),(0,c.jsx)("div",{id:"filerobot-editor",style:N,children:J&&v&&(0,c.jsx)(u.AssemblyPoint_default,{source:v,useBackendTranslations:!1,language:O.split("-")[0],translations:M.d(O),tabsIds:$,defaultTabId:u.TABS_IDS.ADJUST,avoidChangesNotSavedAlertOnLeave:!0,removeSaveButton:!0,getCurrentImgDataFnRef:y})})]})};B.default=z});