1import{R as x,bq as _e,bg as Ae,L as we,t as Me,n as G,j as e,g as Y,l as B,ad as ce,cE as Ve,a6 as de,U as $,c as n,H as Pe,bB as ue,C as le,fX as Ee,x as oe,I as he,aq as fe,d as Q,M as De,aE as P,dL as ae,e$ as Be,aD as Ie,F as j,aK as Fe,fY as Re,c9 as Ne,bU as He,ae as Ue,cx as ke,o as D,ar as Ze,cr as Ge,a3 as Ye,P as $e,X as Oe,fZ as K,aN as Ke,m as We,at as qe,S as ne,cd as ze,V as Qe,bI as Xe,f_ as W,bQ as Je,cb as e1,co as t1,f$ as s1,h as l1}from"./app-DkDOFxbL.js";import{D as o1,v as ge,d as a1}from"./validateUrlYouTube-Bg66zJqY.js";import{p as n1}from"./purify.es-BlZidd4c.js";import{M as i1}from"./MediaCard-D8NdhYFO.js";import{u as r1,I as c1}from"./LoyaltyFaqs-B_nUghIP.js";/* empty css */import"./index-Co4Q-C8N.js";var pe=function(t){return x.createElement("svg",Object.assign({viewBox:"0 0 20 20"},t),x.createElement("path",{fillRule:"evenodd",d:"M15.375 8.485c1.167.674 1.167 2.358 0 3.031l-7.5 4.33c-1.167.674-2.625-.168-2.625-1.515v-8.66c0-1.348 1.458-2.19 2.625-1.516l7.5 4.33Zm-.75 1.732a.25.25 0 0 0 0-.433l-7.5-4.33a.25.25 0 0 0-.375.217v8.66a.25.25 0 0 0 .375.216l7.5-4.33Z"}))};pe.displayName="PlayIcon";const q=60,z=q*60;function ie(s){return s>9?String(s):`0${s}`}function X(s){return{hours:Math.floor(s/z),minutes:Math.floor(s%z/q),seconds:s%q}}function d1(s){const{hours:t,minutes:i,seconds:a}=X(s),o=s>z,T=o?`${t}:`:"",g=`${o?ie(i):i}:`,h=`${ie(a)}`;return`${T}${g}${h}`}function u1(s){const{hours:t,minutes:i,seconds:a}=X(s);let o="Polaris.VideoThumbnail.playButtonA11yLabel.duration";return t?(o+=`.hours.${t>1?"other":"one"}`,a?i>1?o+=`${a>1?".minutesAndSeconds":".minutesAndSecond"}`:i===1?o+=`${a>1?".minuteAndSeconds":".minuteAndSecond"}`:o+=`${a>1?".andSeconds":".andSecond"}`:i?o+=`${i>1?".andMinutes":".andMinute"}`:o+=".only"):i?(o+=`.minutes.${i>1?"other":"one"}`,a?o+=`${a>1?".andSeconds":".andSecond"}`:o+=".only"):a&&(o+=a>1?".seconds.other":".seconds.one"),o}var _={Thumbnail:"Polaris-VideoThumbnail__Thumbnail",ThumbnailContainer:"Polaris-VideoThumbnail__ThumbnailContainer",PlayButton:"Polaris-VideoThumbnail__PlayButton",Timestamp:"Polaris-VideoThumbnail__Timestamp",PlayIcon:"Polaris-VideoThumbnail__PlayIcon",Progress:"Polaris-VideoThumbnail__Progress",Indicator:"Polaris-VideoThumbnail__Indicator",ProgressBar:"Polaris-VideoThumbnail__ProgressBar",Label:"Polaris-VideoThumbnail__Label"};function h1({thumbnailUrl:s,videoLength:t=0,videoProgress:i=0,showVideoProgress:a=!1,accessibilityLabel:o,onClick:T,onBeforeStartPlaying:g}){const h=_e(),{isNavigationCollapsed:p}=Ae();let y;if(o)y=o;else if(t){const{hours:r,minutes:L,seconds:f}=X(t);y=h.translate("Polaris.VideoThumbnail.playButtonA11yLabel.defaultWithDuration",{duration:h.translate(u1(t),{hourCount:r,minuteCount:L,secondCount:f})})}else y=h.translate("Polaris.VideoThumbnail.playButtonA11yLabel.default");const A=t?x.createElement("div",{className:_.Timestamp},x.createElement(we,{alignment:"center",spacing:"extraTight"},x.createElement("span",{className:_.PlayIcon},x.createElement(Me,{source:pe})),x.createElement(G,{variant:p?"bodyLg":"bodyMd",as:"p",fontWeight:"semibold"},d1(t)))):null;let v=null;if(a){const r=f1(t,i),L=Math.round(r*100);v=x.createElement("div",{className:_.Progress},x.createElement("progress",{className:_.ProgressBar,value:L,max:"100"}),x.createElement("div",{className:_.Indicator,style:{transform:`scaleX(${r})`}},x.createElement("span",{className:_.Label},L,"%")))}return x.createElement("div",{className:_.ThumbnailContainer},x.createElement("div",{className:_.Thumbnail,style:{backgroundImage:`url(${s})`}}),x.createElement("button",{type:"button",className:_.PlayButton,"aria-label":y,onClick:T,onMouseEnter:g,onFocus:g,onTouchStart:g},A),v)}function f1(s,t){if(t>0&&s>0){const i=parseFloat((t/s).toFixed(2));return i>1?1:i}return 0}const g1=()=>e.jsxs("svg",{width:"488",height:"271",viewBox:"0 0 488 271",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxs("g",{clipPath:"url(#clip0_10864_3076)",children:[e.jsx("path",{d:"M148.299 170.752C148.375 170.499 148.543 170.284 148.77 170.149C148.997 170.013 149.267 169.968 149.525 170.022C150.065 170.128 150.424 170.625 150.372 171.175C150.149 173.174 149.547 183.55 158.706 191.493C165.624 197.501 173.969 198.675 178.125 198.844L178.231 189.336C178.236 189.133 178.298 188.936 178.41 188.768C178.523 188.599 178.681 188.466 178.866 188.384C179.049 188.3 179.252 188.272 179.451 188.302C179.65 188.332 179.837 188.419 179.987 188.553L197.418 203.731C197.64 203.932 197.777 204.228 197.777 204.535C197.777 204.841 197.64 205.127 197.418 205.328L179.987 220.506C179.838 220.641 179.651 220.73 179.452 220.76C179.252 220.79 179.049 220.761 178.866 220.675C178.485 220.506 178.242 220.136 178.231 219.723L178.125 211.632C173.63 211.177 165.983 209.601 159.161 204.355C151.874 198.749 149.547 192.054 148.679 189.537C146.024 181.889 147.008 175.099 148.299 170.752ZM150.678 188.849C151.493 191.197 153.661 197.459 160.451 202.684C167.358 207.983 175.196 209.294 179.247 209.612C179.51 209.63 179.758 209.747 179.94 209.939C180.122 210.13 180.226 210.384 180.23 210.648L180.325 217.417L195.112 204.535L180.325 191.652L180.23 199.944C180.22 200.526 179.765 200.981 179.162 200.991C175.291 200.96 165.423 200.
1124 157.321 193.09C152.572 188.976 150.245 184.238 149.123 180.176C149.176 182.841 149.61 185.771 150.678 188.849Z",fill:"#913DF7"}),e.jsx("path",{d:"M149.123 180.177C149.176 182.842 149.609 185.772 150.678 188.85C151.492 191.198 153.66 197.459 160.451 202.684C167.357 207.983 175.195 209.295 179.246 209.612C179.51 209.631 179.757 209.747 179.939 209.939C180.121 210.131 180.225 210.384 180.23 210.649L180.325 217.418L195.111 204.535L180.325 191.653L180.23 199.945C180.219 200.527 179.764 200.982 179.161 200.992C175.29 200.96 165.422 200.125 157.32 193.091C152.571 188.977 150.244 184.238 149.123 180.177Z",fill:"#913DF7"}),e.jsxs("g",{filter:"url(#filter0_d_10864_3076)",children:[e.jsx("path",{d:"M51 19.6703C51 15.9864 53.9864 13 57.6703 13H246.095C249.779 13 252.766 15.9864 252.766 19.6703V149.73C252.766 153.414 249.779 156.401 246.095 156.401H57.6703C53.9864 156.401 51 153.414 51 149.73V19.6703Z",fill:"white"}),e.jsxs("g",{clipPath:"url(#clip1_10864_3076)",children:[e.jsx("rect",{x:"61",y:"22.9999",width:"181.766",height:"123.401",fill:"#7FBEC6"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M243.658 78.5908V115.939L233.308 120.112V120.122L231.43 120.875L221.266 96.7364V49.0332C227.593 51.1569 233.827 55.3193 237.175 63.2364L243.658 78.5908Z",fill:"#F0F1F2"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M243.332 114.717V147.479L231.803
1147.922L232.955 132.481C233.664 127.99 233.656 123.415 232.93 118.926V118.914L243.332 114.717ZM149.015 130.984V147.319H136.291C135.67 139.946 136.198 140.197 137.979 133.019C138.148 132.337 138.327 131.658 138.518 130.984H149.015Z",fill:"#6D493C"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M222.732 49.5183L221.777 149.133H150.909V132.633L135.879 85.1861C138.084 67.1946 149.985 58.5046 163.744 53.9902C165.47 53.4239 167.215 52.9161 168.976 52.4678H168.996C180.928 49.4465 193.469 48.9625 201.872 47.8815L202.786 47.7554C202.786 47.7554 203.027 47.7129 203.479 47.6718C205.202 47.4813 206.935 47.3903 208.668 47.399C212.468 47.399 217.626 47.8082 222.732 49.5183Z",fill:"white"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M135.879 132.797H150.806L135.879 85.3535V132.797Z",fill:"#F0F1F2"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M202.38 23V23.1599C202.38 24.9257 201.731 26.6285 200.57 27.884L197.198 31.5448L196.952 31.8102V23H202.38ZM202.79 47.2982L202.16 47.8614L170.029 52.6764L168.184 53.4787V31.8L174.979 39.2946C175.943 40.3566 177.118 41.2058 178.43 41.7877C179.742 42.3696 181.16 42.6714 182.595 42.6738H185.19C186.81 42.6753 188.407 42.2933 189.85 41.5591C191.294 40.8248 192.542 39.7593 193.494 38.4498C195.604 48.2471 202.79 47.2982 202.79 47.2982Z",fill:"#50372E"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M203.053 47.3994C198.029 54.7855 189.727 59.5991 180.342 59.5991C174.101 59.5991 168.337 57.4666 163.697 53.882C165.406 53.3012 167.134 52.7802 168.879 52.32H168.9L182.467 50.2799L201.462 47.6135L202.368 47.4845C202.368 47.4845 202.606 47.4419 203.053 47.3994ZM198.983 23C198.91 25.8574 198.319 28.678 197.239 31.3248C196.96 32.039 196.64 32.7445 196.276 33.428L194.349 37.1093C194.094 37.6001 193.793 38.0652 193.449 38.4982V38.5085C191.514 41.0898 188.398 42.6547 185.025 42.6547H182.392C180.946 42.6569 179.514 42.3637 178.185 41.7932C176.856 41.2227 175.658 40.3869 174.664 39.3372L167.77 31.9774V23H198.983Z",fill:"#6D493C"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M162.309 22.9999H168.182V33.2666L163.376 25.2293C162.953 24.5202 162.596 23.774 162.309 22.9999Z",fill:"#50372E"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M177.949 31.7185C177.949 31.7185 181.108 28.7031 184.118 30.1888C187.326 29.2883 188.181 31.0894 188.806 32.1688C185.654 35.6257 178.645 32.8361 177.949 31.7185Z",fill:"#DE6A5A"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M167.77 75.317L203.054 70.4433V111.661L167.77 116.533V75.317Z",fill:"#E8E9EB"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M203.055 70.4433V91.7583L191.772 105.01L182.067 93.6195L185.753 88.6944H178.047C175.049 84.5299 172.937 79.7959 171.842 74.7846L203.055 70.4433Z",fill:"#F0F1F2"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M193.554 112.712L180.421 114.495C179.901 114.068 179.399 113.62 178.916 113.152L175.079 109.397L178.475 106.071H171.672L170.339 104.78L172.705 102.472H167.985L167.77 102.262V94.1631C170.468 94.2144 173.822 94.7087 177.669 96.124C181.407 97.4978 184.781 99.7064 187.534 102.581C190.287 105.456 192.346 108.921 193.554 112.712Z",fill:"#D2D5D9"}),e.jsx("rect",{x:"111.305",y:"55.8525",width:"82.8229",height:"58.7099",rx:"10.7856",fill:"#ED412A"}),e.jsx("path",{d:"M169.287 83.6745C170.732 84.5174 170.732 86.6054 169.287 87.4484L143.398 102.55C141.941 103.4 140.113 102.349 140.113 100.663L140.113 70.4595C140.113 68.7735 141.941 67.7231 143.398 68.5726L169.287 83.6745Z",fill:"white"})]})]}),e.jsxs("g",{filter:"url(#filter1_d_10864_3076)",children:[e.jsx("path",{d:"M214 100.789C214 97.592 216.592 95 219.789 95H366.211C369.408 95 372 97.592 372 100.789V256.474C372 259.671 369.408 262.263 366.211 262.263H219.789C216.592 262.263 214 259.671 214 256.474V100.789Z",fill:"white"}),e.jsx("rect",{x:"224",y:"105.132",width:"100",height:"6",rx:"3",fill:"#694897"}),e.jsx("rect",{width:"58",height:"4",rx:"2",transform:"matrix(-1 0 0 1 282 117.132)",fill:"#BD9EE9"}),e.jsx("rect",{x:"224",y:"127.132",width:"138",height:"55",rx:"4",fill:"#D9D9D9"}),e.jsx("path",{d:"M360 188.132H226C224.895 188.132 224 189.027 224 190.132C224 191.236 224.895 192.132 226 192.132H360C361.105 192.132 362 191.236 362 190.132C362 189.027 361.105 188.132 360 188.132Z",fill:"#D9D9D9"}),e.jsx("path",{d:"M360 198.132H226C224.895 198.132 224 199.027 224 200.132C224 201.236 224.895 202.132 226 202.132H360C361.105 202.132 362 201.236 362 200.132C362 199.027 361.105 198.132 360 198.132Z",fill:"#D9D9D9"}),e.jsx("path",{d:"M352 208.132H226C224.895 208.132 224 209.027 224 210.132C224 211.236 224.895 212.132 226 212.132H352C353.105 212.132 354 211.236 354 210.132C354 209.027 353.105 208.132 352 208.132Z",fill:"#D9D9D9"}),e.jsx("rect",{x:"224",y:"218.132",width:"52",height:"34",rx:"4",fill:"#D9D9D9"}),e.jsx("rect",{width:"41",height:"4",rx:"2",transform:"matrix(-1 0 0 1 327 218.132)",fill:"#BD9EE9"}),e.jsx("rect",{width:"76",height:"4",rx:"2",transform:"matrix(-1 0 0 1 362 228.132)",fill:"#D9D9D9"}),e.jsx("rect",{width:"76",height:"4",rx:"2",transform:"matrix(-1 0 0 1 362 238.132)",fill:"#D9D9D9"}),e.jsx("rect",{width:"53",height:"4",rx:"2",transform:"matrix(-1 0 0 1 339 248.132)",fill:"#D9D9D9"})]}),e.jsx("path",{d:"M289.82 34L286.49 47.2092L273 50.4701L286.49 53.731L289.82 66.9402L293.15 53.731L306.641 50.4701L293.15 47.2092L289.82 34Z",fill:"#913DF7"}),e.jsx("path",{d:"M306.88 55L305.145 62.0262L298.119 63.7607L305.145 65.4952L306.88 72.5214L308.614 65.4952L315.641 63.7607L308.614 62.0262L306.88 55Z",fill:"#913DF7"})]}),e.jsxs("defs",{children:[e.jsxs("filter",{id:"filter0_d_10864_3076",x:"45.4414",y:"8.55313",width:"212.883",height:"154.518",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[e.jsx("feFlood",{floodOpacity:"0",result:"Backgroun
1dImageFix"}),e.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),e.jsx("feOffset",{dy:"1.11172"}),e.jsx("feGaussianBlur",{stdDeviation:"2.77929"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0"}),e.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_10864_3076"}),e.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_10864_3076",result:"shape"})]}),e.jsxs("filter",{id:"filter1_d_10864_3076",x:"204",y:"87",width:"178",height:"187.263",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[e.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),e.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),e.jsx("feOffset",{dy:"2"}),e.jsx("feGaussianBlur",{stdDeviation:"5"}),e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0"}),e.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_10864_3076"}),e.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_10864_3076",result:"shape"})]}),e.jsx("clipPath",{id:"clip0_10864_3076",children:e.jsx("rect",{width:"488",height:"271",fill:"white"})}),e.jsx("clipPath",{id:"clip1_10864_3076",children:e.jsx("rect",{x:"61",y:"23",width:"181.766",height:"123.401",rx:"6.6703",fill:"white"})})]})]}),p1=()=>e.jsx(Y,{sectioned:!0,children:e.jsxs(B,{gap:"500",children:[e.jsx(me,{}),e.jsx(ce,{}),e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx("svg",{width:"354",height:"32",viewBox:"0 0 354 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("rect",{width:"354",height:"32",rx:"8",fill:"black",fillOpacity:"0.17"})})})]})}),me=()=>e.jsxs("svg",{width:"918",height:"121",viewBox:"0 0 918 121",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxs("g",{clipPath:"url(#clip0_10690_20523)",children:[e.jsx("rect",{width:"248",height:"121",fill:"#F7F7F7"}),e.jsx("path",{d:"M135.738 56.2936C138.754 57.9091 138.754 62.0909 135.738 63.7064L117.532 73.4603C114.601 75.0304 111 72.9868 111 69.754L111 50.2461C111 47.0132 114.601 44.9696 117.532 46.5397L135.738 56.2936Z",fill:"#8A8A8A"}),e.jsx("path",{d:"M248 0H910C914.418 0 918 3.58172 918 8V113C918 117.418 914.418 121 910 121H248V0Z",fill:"white"}),e.jsx("rect",{x:"264",y:"16",width:"638",height:"20",rx:"8",fill:"#F1F1F1"}),e.jsx("rect",{x:"264",y:"44",width:"467",height:"20",rx:"8",fill:"#F1F1F1"}),e.jsx("rect",{x:"264",y:"72",width:"313",height:"20",rx:"8",fill:"#F1F1F1"})]}),e.jsx("path",{d:"M0.5 12C0.5 5.64873 5.64873 0.5 12 0.5H906C912.351 0.5 917.5 5.64873 917.5 12V109C917.5 115.351 912.351 120.5 906 120.5H12C5.64873 120.5 0.5 115.351 0.5 109V12Z",stroke:"#E3E3E3"})]}),re="GenAiYouTube",m1={urlVideo:"",topic:"",mainKeyWord:"",tone:"",language:Ve,audience:""},x1={title:"",description:"",thumbnail:"https://cdnapps.avada.io/seo/avada-placeholder.webp",urlVideo:""},C1={urlVideo:"",topic:"",mainKeyWord:""},xe=({loadingGenAi:s,dataGenAiContent:t,urlThumbnail:i,setting:a,i18n:o})=>{const{sidebarAds:T}=a,[g,h]=n.useState(!1),[p,y]=n.useState(!1),[A,v]=n.useState(!1),r=Pe(),[L,f]=n.useState("");if(n.useEffect(()=>{if(!(t!=null&&t.content))return;const C=n1.sanitize(t.content,o1);let c=0;v(!0);const m=setInterval(()=>{c<C.length?(f(C.slice(0,c+1)),c++):(clearInterval(m),v(!1))},5);return()=>{clearInterval(m),v(!1)}},[t==null?void 0:t.content]),s)return e.jsx(Y,{sectioned:!0,children:e.jsx(ce,{})});if(ue.isEmpty(t))return e.jsx(le,{padding:"2000",children:e.jsx(G,{tone:"subdued",variant:"bodyLg",as:"p",alignment:"center",children:o.translate("Toolpage.yourGeneratedContentWillBeRightHere")})});const w=async()=>{try{const c=await(await fetch(i)).blob(),m="/shopify/upload-file?"+Ie.stringify({fileName:`${(t.title||Date.now().toString()).replace(/\s+/g,"_")}.jpg`,mimeType:"image/jpeg".replace("image/",""),size:c.size}),S=new FormData;S.append("file",c);const{data:M}=await P(m,{method:"POST",body:S});return M.url||""}catch(C){throw console.error("Error handling YouTube thumbnail:",C),C}},I=async()=>{var C,c,m,S,M,E,F,R;try{y(!0);const[N,{data:d}]=await Promise.all([w(),P("/options")]);await P("/article/create",{method:"POST",body:{data:{...ae,image:{...ae.image,url:N},title:t.title,body:t.content,isPublished:!1,blog:{id:d.blogs[0].id.toString(),title:d.blogs[0].title,handle:d.blogs[0].handle},templateSuffix:T!=null&&T.enabled?"avada-sidebar-ads":null,author:{name:((c=(C=d==null?void 0:d.authors)==null?void 0:C.find(V=>V.isDefault))==null?void 0:c.originName)||((S=(m=d==null?void 0:d.authors)==null?void 0:m[0])==null?void 0:S.fullName)||"Anonymous"},authorMetafield:{value:((E=(M=d==null?void 0:d.authors)==null?void 0:M.find(V=>V.isDefault))==null?void 0:E.originName)||((R=(F=d==null?void 0:d.authors)==null?void 0:F[0])==null?void 0:R.originName)||"anonymous"},titleMetafield:{value:t.title},seoAnalysisPage:{metaTitle:t.title},handle:t.title.toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"-").slice(0,215)}}}).then(V=>{console.log(V);const O=`/articles/edit/${V.data}`;return r.push(O)})}catch(N){console.error("Error creating blog post: ",N.message)}finally{y(!1)}};return e.jsxs(le,{roundedAbove:"sm",children:[e.jsx("div",{className:"Avada-GenAi-Preview",dangerouslySetInnerHTML:{__html:L}}),e.jsx(Ee,{marginBlockEnd:"400",marginInline:"400",children:e.jsx(oe,{background:"bg-surface-secondary",padding:"400",children:e.jsxs(he,{columns:"1fr auto",children:[e.jsxs(G,{as:"p",children:[o.translate("Toolpage.pleaseVerifyAllGeneratedContentMeets")," "," ",e.jsx(fe,{url:"https://developers.google.com/search/blog/2023/02/google-search-and-ai-content",external:!0,removeUnderline:!0,children:o.translate("Toolpage.googleSearchGuidelinesForAIContent")})," ",o.translate("Toolpage.beforePublishing")]}),e.jsx(Q,{variant:"primary",onClick:()=>h(!0),disabled:A,children:o.translate("Toolpage.editAndPublish")})]})})}),e.jsx(De,{open:g,onClose:()=>{p||h(!1)},title:o.translate("Toolpage.redirectToContentManager"),primaryAction:{content:o.translate("Toolpage.continue"),loading:p,onAction:()=>{p||I().then()}},secondaryActions:[{content:o.translate("Toolpage.cancel"),onAction:()=>{p||h(!1)}}],children:e.jsx(oe,{padding:"300",children:o.translate("Toolpage.youWillBeRedirectedToContentManagerToEditAndPublishThisBlogPost")})})]})},b1=s=>({shop:s.shop,setting:s.settings.data});xe.propTypes={loadingGenAi:j.bool,dataGenAiContent:j.object,setting:j.object,urlThumbn
1ail:j.string,i18n:j.object};const j1=de(b1)($()(x.memo(xe)));function Ce({i18n:s,checkRules:t}){return t?null:e.jsxs(G,{as:"p",children:[s.translate("Toolpage.freeUsageLimitReached")," ",e.jsx(fe,{onClick:()=>{Fe("I want to get more access to the âVideo to blogâ feature")},removeUnderline:!0,children:s.translate("Toolpage.getYourUnlimitedAccess")})," ",s.translate("Toolpage.forFreeForever")]})}Ce.propTypes={i18n:j.object,checkRules:j.bool};const T1=$()(Ce),y1="increment",be=({shop:s,data:t,setInfoVideoYouTube:i,i18n:a})=>{var se;const[o,T]=n.useState(!1),[g,h]=n.useState(!1),[p,y]=n.useState(Re),[A,v]=n.useState({}),[r,L]=n.useState(m1),[f,w]=n.useState(C1),[I,C]=n.useState(!1),{message:c,success:m}=ge(t==null?void 0:t.urlVideo,a),S=n.useRef(!1),[M,E]=n.useState(""),[F,R]=n.useState(!1),[N,d]=n.useState(a.translate("Toolpage.generateBlogPost")),V=Ne(),{showUpgradeModal:O}=n.useContext(He),J=()=>C(l=>!l),ee=()=>C(!1),Te=(l,b)=>{i(u=>({...u,[l]:b})),S.current=!0,f.urlVideo!==""&&w(u=>({...u,urlVideo:""}))},ye=n.useCallback(a1(async l=>{if(m)try{T(!0);const{data:b,success:u,...Z}=await P(`/tools/contents?urlVideo=${encodeURIComponent(l)}`);if(u){i(U=>({...U,...b}));return}i(U=>({...U,...b,urlVideo:l})),w(U=>({...U,urlVideo:Z.message}))}catch(b){console.error("Error updating settings: ",b.message)}finally{T(!1)}},800),[m]);n.useEffect(()=>{S.current&&ye(t==null?void 0:t.urlVideo),R(!1),E("")},[t==null?void 0:t.urlVideo,S]);const k=s!=null&&s.unLimitToolYoutube?!0:((s==null?void 0:s.isYoutubeSlotActive)||0)<5,ve=Ue("videoToBlogAccess"),te=l=>l!=null&&l.trim()?"":a.translate("ContentManager.element.thisFieldIsRequired"),Le=async()=>{if(e1(s,V,p)){O();return}const l={topic:te(r==null?void 0:r.topic),mainKeyWord:te(r==null?void 0:r.mainKeyWord)};if(w(u=>({...u,...l})),!l.topic&&!l.mainKeyWord&&m&&!g&&!o&&k)try{h(!0),v({});const u=await P("/tools/subtitles",{method:"POST",body:{dataGenAi:{...r,urlVideo:t==null?void 0:t.urlVideo}}});if(!u.success){E(u.message),R(!0);return}const Z=await P("/tools/genAi",{method:"POST",body:{dataGenAi:{...r,urlVideo:t==null?void 0:t.urlVideo},subtitles:u.data.subtitles,model:p}});if(Z.success)await Se(),v(Z.data),d(a.translate("Toolpage.generateAgain"));else throw new Error("GenAi request failed")}catch(u){t1(a.translate("ContentManager.element.sometimesGenAiEncountersAnErrorPleaseTryAgain"),!0),console.error("Error genAi: ",u.message)}finally{h(!1)}},Se=n.useCallback(async()=>{if(s.unLimitToolYoutube)return;const l=await P("/shop/field-number",{body:{field:"isYoutubeSlotActive",action:y1},method:"POST"});ke(l.data)},[]),H=n.useCallback((l,b)=>{L(u=>({...u,[l]:b})),w(u=>({...u,[l]:""}))},[]);return e.jsx("div",{className:"Avada-GenAI-Main",children:e.jsxs(B,{gap:"300",children:[e.jsx(Y,{sectioned:!0,children:e.jsxs(B,{gap:"300",children:[e.jsx(D,{label:"Youtube URL",value:t==null?void 0:t.urlVideo,onChange:l=>{Te("urlVideo",l)},error:c||(f==null?void 0:f.urlVideo),autoComplete:"off",disabled:o||g}),o?e.jsx(me,{}):e.jsx(i1,{title:t==null?void 0:t.title,description:Ze(t==null?void 0:t.description,550),children:e.jsx(h1,{thumbnailUrl:t==null?void 0:t.thumbnail,onClick:()=>{}})}),e.jsx(Ge,{noValidate:!0,onSubmit:Le,children:e.jsxs(Ye,{children:[e.jsx($e,{active:I,activator:e.jsx("div",{className:"Avada-GenAIModel-Select",onClick:J,children:e.jsx(ne,{options:K,label:a.translate("Toolpage.aiModel"),value:((se=K.find(l=>l.value===p))==null?void 0:se.value)||"",onChange:()=>{},readOnly:!0,autoComplete:"off",onFocus:J})}),preferredAlignment:"left",onClose:ee,children:e.jsx(Oe,{options:K.map(l=>{const b=l.isPro&&!Ke(s);return{value:l.value,disabled:b,label:e.jsxs(We,{gap:"200",blockAlign:"center",children:[e.jsx("span",{children:l.label}),b?e.jsx(qe,{tone:"attention",children:"Pro"}):null]})}}),selected:p?[p]:[],onChange:l=>{const b=l[0]||"";y(b),ee()}})}),e.jsx(D,{value:r.topic,onChange:l=>H("topic",l),label:a.translate("Toolpage.topic"),autoComplete:"off",error:f==null?void 0:f.topic,placeholder:a.translate("Toolpage.topicPlaceholder")}),e.jsxs(he,{gap:"300",columns:{xs:1,sm:2},children:[e.jsx(D,{value:r.mainKeyWord,onChange:l=>H("mainKeyWord",l),label:a.translate("Toolpage.mainKeyword"),autoComplete:"off",placeholder:a.translate("Toolpage.mainKeywordPlaceholder"),error:f==null?void 0:f.mainKeyWord}),e.jsx(ne,{label:a.translate("Toolpage.language"),options:ze,onChange:l=>H("language",l),value:r.language}),e.jsx(D,{value:r.tone,onChange:l=>H("tone",l),label:a.translate("Toolpage.tone"),autoComplete:"off",placeholder:a.translate("Toolpage.tonePlaceholder")}),e.jsx(D,{value:r.audience,onChange:l=>H("audience",l),label:a.translate("Toolpage.audience"),autoComplete:"off",placeholder:a.translate("Toolpage.audiencePlaceholder")})]}),e.jsxs(B,{inlineAlign:"center",gap:"200",children:[g?e.jsxs("div",{className:"Avada-GenAi-Tool_Loading",children:[e.jsx(Qe,{size:"small"}),""," ",a.translate("Toolpage.generating")]}):e.jsx("div",{className:(F||!k)&&!W(s)?"Avada-GenAi-Tool_Button-disLabel":"Avada-GenAi-Tool_Button",children:e.jsxs(Q,{variant:"primary",loading:!1,disabled:(F||!k)&&!W(s),icon:Xe,submit:!0,
1children:[N," ",s!=null&&s.unLimitToolYoutube||W(s)?"":`(${Math.max(5-((s==null?void 0:s.isYoutubeSlotActive)||0),0)} ${a.translate("Toolpage.usesLeft")})`]})}),e.jsx(Je,{message:M,fieldID:"myFieldID"}),ve&&e.jsx(T1,{checkRules:k})]})]})})]})}),e.jsx(j1,{loadingGenAi:g,dataGenAiContent:A,urlThumbnail:t==null?void 0:t.thumbnail})]})})},v1=$()(be);be.propTypes={data:j.object,shop:j.object,setInfoVideoYouTube:j.func,i18n:j.object};const je=({shop:s,i18n:t})=>{const[i,a]=n.useState(""),[o,T]=n.useState(""),[g,h]=n.useState(""),[p,y]=n.useState(!1),[A,v]=n.useState(x1),{widgets:r}=s,L=r.find(c=>c.id==="7LhV0oNNpwBP2YOSBfVy"),{displayBanner:f,closeBanner:w}=r1({storageKey:s1}),I=async()=>{const c=ge(o,t);if(!c.success){h(c.message);return}try{y(!0);const{data:m,success:S,message:M}=await P(`/tools/contents?urlVideo=${encodeURIComponent(o)}`);S?(v(E=>({...E,...m})),a(re)):h(M)}catch(m){console.error("Error updating settings: ",m.message)}finally{y(!1)}},C=n.useMemo(()=>{if(p)return e.jsx(p1,{});switch(i){case re:return e.jsx(v1,{shop:s,data:A,setInfoVideoYouTube:v});default:return e.jsx(Y,{sectioned:!0,children:e.jsxs(B,{inlineAlign:"center",gap:"300",children:[e.jsx("div",{className:"wrapper-svg-ytb",children:e.jsx(g1,{})}),e.jsx("div",{className:"Avada-InputUrlVideo",children:e.jsx(D,{value:o,onChange:c=>{T(c),h("")},placeholder:t.translate("Toolpage.videoToBlog.placeholder"),autoComplete:"off",label:"",error:g,suffix:e.jsx(Q,{variant:"primary",onClick:I,children:t.translate("Toolpage.videoToBlog.startButton")})})})]})})}},[i,o,g,p,A,s]);return e.jsx(l1,{title:t.translate("Toolpage.videoToBlog.title"),subtitle:t.translate("Toolpage.videoToBlog.subTitle"),compactTitle:!0,children:e.jsxs(B,{gap:"300",children:[C,!ue.isEmpty(L)&&f&&e.jsx(c1,{shop:s,inlineBanner:L,handleDismiss:()=>{w()}})]})})},L1=s=>({shop:s.shop,settings:s.settings.data}),E1=de(L1)($()(n.memo(je)));je.propTypes={shop:j.object,i18n:j.object};export{E1 as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.