From a9c9481ea80a676a13343e0b5918f41afd4650c9 Mon Sep 17 00:00:00 2001 From: tbradsha Date: Mon, 3 Jun 2024 18:43:30 +0000 Subject: [PATCH] AI Featured Image: support backend prompts (#37668) * Export generic image generation method by parameters * Change generation call to a generic one so the backend can decide which one to use * Introduce activeModel cost and use it to infer the model name * changelog Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/9355495915 Upstream-Ref: Automattic/jetpack@7ad86f9ae381a0a27699a4cf8946494c90b7fd2c --- CHANGELOG.md | 7 ++ _inc/blocks/editor-beta.asset.php | 2 +- _inc/blocks/editor-beta.js | 8 +- _inc/blocks/editor-experimental.asset.php | 2 +- _inc/blocks/editor-experimental.js | 8 +- _inc/blocks/editor-no-post-editor.asset.php | 2 +- _inc/blocks/editor-no-post-editor.js | 8 +- _inc/blocks/editor.asset.php | 2 +- _inc/blocks/editor.js | 8 +- .../components/featured-image/index.tsx | 84 ++++++++++--------- 10 files changed, 71 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d24da2bfb5..dd4316f799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ### This is a list detailing changes for all Jetpack releases. +## 13.6-a.0 - unreleased + +This is an alpha version! The changes listed here are not final. + +### Other changes +- AI Featured Image: let the backend decide the model for the image generation. + ## 13.5-beta - 2024-06-03 ### Enhancements - AI Assistant: Fallback to transformation when multiple blocks are selected. [#37632] diff --git a/_inc/blocks/editor-beta.asset.php b/_inc/blocks/editor-beta.asset.php index 6937805722..ffcbbbc89e 100644 --- a/_inc/blocks/editor-beta.asset.php +++ b/_inc/blocks/editor-beta.asset.php @@ -1 +1 @@ - array('lodash', 'moment', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '1b8c2e0b520ff701a1f5'); + array('lodash', 'moment', 'react', 'react-dom', 'wp-a11y', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-block-serialization-default-parser', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-rich-text', 'wp-token-list', 'wp-url', 'wp-viewport', 'wp-widgets', 'wp-wordcount'), 'version' => '44ae0b0597d90ceb0e30'); diff --git a/_inc/blocks/editor-beta.js b/_inc/blocks/editor-beta.js index 46a1e0b988..a67bcf13b4 100644 --- a/_inc/blocks/editor-beta.js +++ b/_inc/blocks/editor-beta.js @@ -3,7 +3,7 @@ // translators: %1$d: number of requests remaining __("You have %1$d requests remaining.","jetpack"),e)),React.createElement(r.Button,{variant:"link",onClick:n,href:s,target:s?"_blank":null},__("Upgrade now","jetpack")))}function C({error:e,code:t,onTryAgainClick:n,onUpgradeClick:s,upgradeUrl:o}){const i=e||__("Something went wrong","jetpack");return React.createElement(E,{severity:m},React.createElement("span",null,(0,a.sprintf)( // translators: %1$d: A dynamic error message -__("Error: %1$s","jetpack"),i)),t===d.$L?React.createElement(r.Button,{variant:"link",onClick:s,href:o,target:o?"_blank":null},__("Upgrade now","jetpack")):React.createElement(r.Button,{variant:"link",onClick:n},__("Try again","jetpack")))}},62282:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,u:()=>s});var r=n(99196),a=n.n(r);const s=(0,r.createContext)({}),o=({value:e,children:t})=>a().createElement(s.Provider,{value:e,children:t})},20281:(e,t,n)=>{"use strict";n.d(t,{X_:()=>s.Z,hE:()=>r.h,oN:()=>a.Z,uE:()=>r.u});var r=n(62282),a=n(3669),s=n(79466)},79466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(99196),a=n(16700),s=n(20281);function o({onDone:e,onSuggestion:t,onError:n}={}){const o=(0,r.useContext)(s.uE),{eventSource:i}=o,l=(0,r.useCallback)((t=>e?.(t?.detail)),[e]),c=(0,r.useCallback)((e=>t?.(e?.detail)),[t]),u=(0,r.useCallback)((e=>{n?.(e?.detail)}),[]);return(0,r.useEffect)((()=>{if(i)return e&&i.addEventListener("done",l),t&&i.addEventListener("suggestion",c),n&&i.addEventListener(a.vF,u),()=>{i.removeEventListener("done",l),i.removeEventListener("suggestion",c),i.removeEventListener(a.vF,u)}}),[i]),o}},3669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(94333),a=n(69307),s=n(99196),o=n.n(s),i=n(42194),l=n(20281);const c=(0,r.createHigherOrderComponent)((e=>t=>{const{suggestion:n,error:r,requestingState:s,request:c,stopSuggestion:u,eventSource:d}=(0,i.Z)(),p=(0,a.useMemo)((()=>({suggestion:n,requestingError:r,requestingState:s,eventSource:d,requestSuggestion:c,stopSuggestion:u})),[n,r,s,d,c,u]);return o().createElement(l.hE,{value:p},o().createElement(e,t))}),"withAiDataProvider")},42194:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Z:()=>l});var r=n(69307),a=n(65736),s=n(67742),o=n(16700);const __=a.__;function i(e){switch(e){case o.$L:return{code:o.$L,message:__("You have reached the limit of requests for this site.","jetpack"),severity:"info"};case o.bC:return{code:o.bC,message:__("Your request was unclear. Mind trying again?","jetpack"),severity:"info"};case o.$u:return{code:o.$u,message:__("Jetpack AI services are currently unavailable. Sorry for the inconvenience.","jetpack"),severity:"info"};case o.q4:return{code:o.q4,message:__("This request has been flagged by our moderation system. Please try to rephrase it and try again.","jetpack"),severity:"info"};case o.cv:return{code:o.cv,message:__("The content is too large to be processed all at once. Please try to shorten it or divide it into smaller parts.","jetpack"),severity:"info"};case o.co:default:return{code:o.co,message:__("It was not possible to process your request. Mind trying again?","jetpack"),severity:"info"}}}function l({prompt:e,autoRequest:t=!1,askQuestionOptions:n={},initialRequestingState:a="init",onSuggestion:l,onDone:c,onStop:u,onError:d,onAllErrors:p}={}){const[m,g]=(0,r.useState)(a),[A,h]=(0,r.useState)(""),[E,f]=(0,r.useState)(),b=(0,r.useRef)(void 0),C=(0,r.useCallback)((e=>{h(e?.detail),l?.(e?.detail)}),[l]),v=(0,r.useCallback)((e=>{Q(),c?.(e?.detail),g("done")}),[c]),k=(0,r.useCallback)((e=>{p?.(e?.detail)}),[p]),B=(0,r.useCallback)((e=>{b?.current?.close(),g("error"),f(i(e)),d?.(i(e))}),[d]),y=(0,r.useCallback)((()=>B(o.$L)),[]),w=(0,r.useCallback)((()=>B(o.bC)),[]),_=(0,r.useCallback)((()=>B(o.$u)),[]),I=(0,r.useCallback)((()=>B(o.q4)),[]),j=(0,r.useCallback)((()=>B(o.co)),[]),x=(0,r.useCallback)((async(e,t={...n})=>{if(f(void 0),g("requesting"),b.current=await(0,s.Z)(e,t),!b?.current)return;const r=b.current;g("suggesting"),r.addEventListener("suggestion",C),r.addEventListener(o.$L,y),r.addEventListener(o.bC,w),r.addEventListener(o.$u,_),r.addEventListener(o.q4,I),r.addEventListener(o.co,j),r.addEventListener(o.vF,k),r.addEventListener("done",v)}),[v,y,w,_,I,j,C]),S=(0,r.useCallback)((()=>{g("init"),h(""),f(void 0)}),[]),Q=(0,r.useCallback)((()=>{if(!b?.current)return;const e=b?.current;e.close(),e.removeEventListener("suggestion",C),e.removeEventListener(o.$L,y),e.removeEventListener(o.bC,w),e.removeEventListener(o.$u,_),e.removeEventListener(o.q4,I),e.removeEventListener(o.co,j),e.removeEventListener("done",v)}),[b,C,y,w,_,I,j,v]),N=(0,r.useCallback)((()=>{Q(),u?.(),g("done")}),[u]);return(0,r.useEffect)((()=>{if(e?.length)return t&&x(e,n),()=>{N()}}),[t,e,x,N]),{suggestion:A,error:E,requestingState:m,request:x,stopSuggestion:N,reset:S,handleErrorQuotaExceededError:y,eventSource:b.current}}},93509:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(69307),a=n(65736),s=n(51128),o=n.n(s),i=n(46961);const __=a.__,l=o()("jetpack-ai-client:use-audio-transcription"),c=e=>{if("string"==typeof e)return e;if("code"in e)switch(e.code){case"error_quota_exceeded":return __("You exceeded your current quota, please check your plan details.","jetpack");case"jetpack_ai_missing_audio_param":return __("The audio_file is required to perform a transcription.","jetpack");case"jetpack_ai_service_unavailable":return __("The Jetpack AI service is temporarily unavailable.","jetpack");case"file_size_not_supported":return __("The provided audio file is too big.","jetpack");case"file_type_not_supported":return __("The provided audio file type is not supported.","jetpack");case"jetpack_ai_error":return __("There was an error processing the transcription request.","jetpack");default:return e.message}return"message"in e?e.message:__("There was an error processing the transcription request.","jetpack")};function u({feature:e,onReady:t,onError:n}){const[a,s]=(0,r.useState)(""),[o,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useRef)(null);return{transcriptionResult:a,isTranscribingAudio:d,transcriptionError:o,transcribeAudio:(0,r.useCallback)((r=>{l("Transcribing audio"),s(""),u(""),p(!0);const a=new AbortController;m.current=a,(0,i.Z)(r,e,a.signal).then((e=>{s(e),t?.(e)})).catch((e=>{a.signal.aborted||(u(e.message),n?.(c(e)))})).finally((()=>p(!1)))}),[i.Z,s,u,p]),cancelTranscription:(0,r.useCallback)((()=>{m.current?.abort(),s(""),u(""),p(!1)}),[m,s,u,p])}}},92718:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(69307),a=n(65736);const __=a.__,s=25e6,o=1500,i=["audio/mpeg","audio/mp3","audio/ogg","audio/flac","audio/x-flac","audio/m4a","audio/x-m4a","audio/mp4","audio/wav","audio/wave","audio/x-wav","audio/webm"];function l(){const[e,t]=(0,r.useState)(!1);return{isValidatingAudio:e,validateAudio:(0,r.useCallback)(((e,n,r)=>{if(t(!0),e?.size>s)return t(!1),r(__("The audio file is too large. The maximum file size is 25MB.","jetpack"));const a=e instanceof File;if(a&&!i.includes(e.type))return t(!1),r(__("The audio file type is not supported. Please use a supported audio file type.","jetpack"));const l=new AudioContext;e.arrayBuffer().then((s=>{l.decodeAudioData(s,(function(s){const i=Math.ceil(s.duration);return i>o?(t(!1),r(__("The audio file is too long. The maximum recording time is 25 minutes.","jetpack"))):(t(!1),n({duration:i,isFile:a,size:e?.size}))}))}))}),[t])}}},70286:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51128),a=n.n(r),s=n(78982),o=n(2890);const i=a()("ai-client:use-image-generator"),l=(e,t)=>{const n=4e3-t;return e.length>n?e.substring(0,n-6)+" [...]":e},c=async(e,t,n)=>{const r=((e,t)=>{if(t){const n=`I need a Stable Diffusion prompt to generate a featured image for a blog post based on this user-provided image description:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nThe image should be a photo. Make sure you highlight the main suject of the image description, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}return"I need a Stable Diffusion prompt to generate a featured image for a blog post with the following content.\nThe image should be a photo. Make sure you highlight the main suject of the content, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments. The content is:\n\n"+l(e,412)})(e,t),a=await(0,s.Z)(r,{feature:n});return a.choices?.[0]?.message?.content},u=()=>{const e=async function(e){let t="";try{t=(await(0,o.Z)()).token}catch(e){return i("Error getting token: %o",e),Promise.reject(e)}try{const n="https://public-api.wordpress.com/wpcom/v2/jetpack-ai-image",r={Authorization:`Bearer ${t}`,"Content-Type":"application/json"},a=await fetch(n,{method:"POST",headers:r,body:JSON.stringify(e)}).then((e=>e.json()));return a?.data?.status&&a?.data?.status>200?(i("Error generating image: %o",a),Promise.reject(a)):a}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}};return{generateImage:async function({feature:t,postContent:n,responseFormat:r="url",userPrompt:a}){try{i("Generating image");const s=((e,t)=>{if(t){const n=`I need a cover image for a blog post based on this user prompt:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nBefore creating the image, identify the main topic of the user prompt and relate it to the post content.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}const n="I need a cover image for a blog post.\nBefore creating the image, identify the main topic of the content and only represent it.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nThis is the post content:\n\n";return n+l(e,838)})(n,a),o={prompt:s,response_format:r,feature:t,size:"1792x1024"};return await e(o)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithStableDiffusion:async function({feature:t,postContent:n,userPrompt:r}){try{i("Generating image with Stable Diffusion");const a={prompt:await c(n,r,t),feature:t,model:"stable-diffusion",style:"photographic"};return await e(a)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}}}}},13109:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(69307);const a="audio/mp4;codecs=mp4a",s="audio/mp4",o="audio/webm";function i({onDone:e}={}){const t=(0,r.useRef)(null),[n,i]=(0,r.useState)("inactive"),l=(0,r.useRef)(!1),c=(0,r.useRef)(0),[u,d]=(0,r.useState)(0),p=(0,r.useRef)(null),[m,g]=(0,r.useState)(null),A=(0,r.useRef)([]).current,[h,E]=(0,r.useState)(null),f=(0,r.useRef)(null);function b(){return MediaRecorder.isTypeSupported(a)?new Blob(A,{type:s}):new Blob(A,{type:o})}const C=(0,r.useCallback)((e=>{if(y(),!e)return t?.current?.start();e<100&&(e=100),c.current=Date.now(),t?.current?.start(e)}),[]),v=(0,r.useCallback)((()=>{l.current=!0,t?.current?.pause(),d((e=>e+Date.now()-c.current))}),[]),k=(0,r.useCallback)((()=>{l.current=!1,t?.current?.resume(),c.current=Date.now()}),[]),B=(0,r.useCallback)((()=>{t?.current?.stop(),"recording"===n&&d((e=>e+Date.now()-c.current))}),[]),y=(0,r.useCallback)((()=>{A.length=0,g(null),E(null),d(0),l.current=!1,c.current=0}),[]),w=(0,r.useCallback)((()=>{t?.current&&(t.current.removeEventListener("start",j),t.current.removeEventListener("stop",x),t.current.removeEventListener("pause",S),t.current.removeEventListener("resume",Q),t.current.removeEventListener("dataavailable",N),t.current=null)}),[]),_=(0,r.useCallback)((()=>{if(i("inactive"),y(),w(),!navigator.mediaDevices?.getUserMedia)return;const e=new AudioContext;f.current=e.createAnalyser();navigator.mediaDevices.getUserMedia({audio:!0}).then((n=>{p.current=n;e.createMediaStreamSource(n).connect(f.current),MediaRecorder.isTypeSupported(a)?t.current=new MediaRecorder(n,{mimeType:a}):t.current=new MediaRecorder(n,{mimeType:o}),t.current.addEventListener("start",j),t.current.addEventListener("stop",x),t.current.addEventListener("pause",S),t.current.addEventListener("resume",Q),t.current.addEventListener("dataavailable",N)})).catch((e=>{throw e}))}),[]),I=(0,r.useCallback)((e=>{B(),E("string"==typeof e?e:e.message),i("error")}),[]);function j(){i("recording")}function x(){const t=b();e?.(t),A.length=0}function S(){i("paused")}function Q(){i("recording")}function N(e){const{data:t}=e;t?.size&&(A.push(t),g(b()),l.current||d((e=>{const t=Date.now(),n=t-c.current;return c.current=t,e+n})))}return(0,r.useEffect)((()=>(_(),()=>{p.current&&p.current.getTracks().forEach((e=>e.stop())),w()})),[]),{state:n,blob:m,error:h,duration:u,analyser:f.current,onError:I,controls:{start:C,pause:v,resume:k,stop:B,reset:_}}}},44696:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>c});var r=n(69307),a=n(51128),s=n.n(a),o=n(42194);const i=s()("jetpack-ai-client:use-transcription-post-processing"),l="voice-to-content-simple-draft";function c({feature:e,onReady:t,onError:n,onUpdate:a}){const[s,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useCallback)((e=>{l(e),a?.(e)}),[l,a]),g=(0,r.useCallback)((e=>{l(e),a?.(e),t?.(e)}),[l,a,t]),A=(0,r.useCallback)((e=>{u(e.message),n?.(e.message)}),[u,n]),{request:h,stopSuggestion:E}=(0,o.Z)({onSuggestion:m,onDone:g,onError:A});return{postProcessingResult:s,isProcessingTranscription:d,postProcessingError:c,processTranscription:(0,r.useCallback)(((t,n)=>{i("Post-processing transcription"),l(""),u(""),p(!0);h([{role:"jetpack-ai",context:{type:t,content:n}}],{feature:e})}),[l,u,p,h,e]),cancelTranscriptionProcessing:(0,r.useCallback)((()=>{E(),p(!1)}),[E,p])}}},61317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"ai-assistant-icon"},s().createElement(r.Path,{className:"spark-first",d:"M9.33301 5.33325L10.4644 8.20188L13.333 9.33325L10.4644 10.4646L9.33301 13.3333L8.20164 10.4646L5.33301 9.33325L8.20164 8.20188L9.33301 5.33325Z"}),s().createElement(r.Path,{className:"spark-second",d:"M21.3333 5.33333L22.8418 9.15817L26.6667 10.6667L22.8418 12.1752L21.3333 16L19.8248 12.1752L16 10.6667L19.8248 9.15817L21.3333 5.33333Z"}),s().createElement(r.Path,{className:"spark-third",d:"M14.6667 13.3333L16.5523 18.1144L21.3333 20L16.5523 21.8856L14.6667 26.6667L12.781 21.8856L8 20L12.781 18.1144L14.6667 13.3333Z"}))},83585:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(55609);const a=React.createElement(r.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.95833C6.66328 3.95833 3.95833 6.66327 3.95833 9.99999C3.95833 13.3367 6.66328 16.0417 10 16.0417C13.3367 16.0417 16.0417 13.3367 16.0417 9.99999C16.0417 6.66327 13.3367 3.95833 10 3.95833ZM2.70833 9.99999C2.70833 5.97292 5.97292 2.70833 10 2.70833C14.0271 2.70833 17.2917 5.97292 17.2917 9.99999C17.2917 14.0271 14.0271 17.2917 10 17.2917C5.97292 17.2917 2.70833 14.0271 2.70833 9.99999Z"}),React.createElement(r.Path,{d:"M10.8333 5.83333H9.16667V10.8333H10.8333V5.83333Z"}),React.createElement(r.Path,{d:"M10.8333 12.5H9.16667V14.1667H10.8333V12.5Z"}))},59822:(e,t,n)=>{"use strict";n.d(t,{Qf:()=>a.Z,Qr:()=>s.Z,u_:()=>r.Z,v_:()=>o.Z});var r=n(61317),a=n(81204),s=(n(4454),n(71893),n(52887),n(96083)),o=n(50500)},81204:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"10.5",y:"8.25",width:"3",height:"4.875",rx:"1.5",fill:"#008710"}),s().createElement(r.Path,{d:"M15 11.25C15 11.644 14.9224 12.0341 14.7716 12.3981C14.6209 12.762 14.3999 13.0927 14.1213 13.3713C13.8427 13.6499 13.512 13.8709 13.1481 14.0216C12.7841 14.1724 12.394 14.25 12 14.25C11.606 14.25 11.2159 14.1724 10.8519 14.0216C10.488 13.8709 10.1573 13.6499 9.87868 13.3713C9.6001 13.0927 9.37913 12.762 9.22836 12.3981C9.0776 12.0341 9 11.644 9 11.25",stroke:"#008710",strokeWidth:"1.125",strokeLinecap:"round"}),s().createElement(r.Path,{d:"M11.4375 15.75C11.4375 16.0607 11.6893 16.3125 12 16.3125C12.3107 16.3125 12.5625 16.0607 12.5625 15.75L11.4375 15.75ZM11.4375 14.25L11.4375 15.75L12.5625 15.75L12.5625 14.25L11.4375 14.25Z",fill:"#008710"}))},4454:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},96083:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"12.75",y:"9",width:"2.25",height:"6",fill:"#008710"}),s().createElement(r.Rect,{x:"9",y:"9",width:"2.25",height:"6",fill:"#008710"}))},71893:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},52887:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Rect},50500:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5 10C12.5 11.3807 11.3807 12.5 10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10ZM14 10C14 12.2091 12.2091 14 10 14C7.79086 14 6 12.2091 6 10C6 7.79086 7.79086 6 10 6C12.2091 6 14 7.79086 14 10ZM16.75 21V19C16.75 17.4812 15.5188 16.25 14 16.25L6 16.25C4.48122 16.25 3.25 17.4812 3.25 19V21H4.75L4.75 19C4.75 18.3096 5.30964 17.75 6 17.75L14 17.75C14.6904 17.75 15.25 18.3096 15.25 19V21H16.75Z",fill:"currentColor"}),s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M19.976 16.3599C21.2507 14.5642 22.0001 12.3695 22.0001 9.99969C22.0001 7.63128 21.2515 5.43769 19.9782 3.64258L18.754 4.50967C19.8537 6.05996 20.5001 7.95434 20.5001 9.99969C20.5001 12.0464 19.8528 13.9419 18.7519 15.4928L19.976 16.3599ZM17.3357 14.4897C18.2357 13.222 18.7648 11.6727 18.7648 9.99969C18.7648 8.32808 18.2365 6.77984 17.3379 5.51279L16.1137 6.37988C16.8387 7.4021 17.2648 8.65114 17.2648 9.99969C17.2648 11.3496 16.8378 12.5998 16.1116 13.6226L17.3357 14.4897Z",fill:"currentColor"}))},42290:(e,t,n)=>{"use strict";n.d(t,{$L:()=>p.$L,$u:()=>p.$u,C3:()=>u.C3,Eo:()=>u.Eo,JP:()=>m.JP,L$:()=>i.Z,LB:()=>m.LB,MW:()=>u.MW,OS:()=>o.Z,Qf:()=>c.Qf,Qr:()=>c.Qr,Rc:()=>l.Z,X_:()=>d.X_,Y:()=>p.Y,ZK:()=>u.ZK,_T:()=>a.Z,bC:()=>p.bC,cH:()=>s.Z,co:()=>p.co,cv:()=>p.cv,g:()=>m.g,oN:()=>d.oN,pw:()=>r.Z,q4:()=>p.q4,rp:()=>u.rp,u_:()=>c.u_,v_:()=>c.v_,xi:()=>u.xi});n(2890),n(56694),n(67742),n(46961);var r=n(42194),a=n(13109),s=n(93509),o=n(44696),i=n(92718),l=n(70286),c=n(59822),u=n(58890),d=n(20281),p=n(16700),m=n(35613)},2890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(51128),s=n.n(a),o=n(87309);const i=s()("jetpack-ai-client:jwt"),l="jetpack-ai-jwt",c=12e4;async function u({apiNonce:e,siteId:t,expirationTime:n}={}){e=e||window.JP_CONNECTION_INITIAL_STATE.apiNonce,t=t||window.JP_CONNECTION_INITIAL_STATE.siteSuffix,n=n||c;const a=(0,r.Wp)(),s=localStorage.getItem(l);let u,d=null;if(s)try{d=JSON.parse(s)}catch(e){i("Error parsing token",e)}if(d&&d?.expire>Date.now())return i("Using cached token"),d;u=a?await(0,o.Z)({path:"/wpcom/v2/sites/"+t+"/jetpack-openai-query/jwt",method:"POST"}):await(0,o.Z)({path:"/jetpack/v4/jetpack-ai-jwt?_cacheBuster="+Date.now(),credentials:"same-origin",headers:{"X-WP-Nonce":e},method:"POST"});const p={token:u.token,blogId:a?t:u.blog_id,expire:Date.now()+n};return i("Storing new token"),localStorage.setItem(l,JSON.stringify(p)),p}},35613:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.JP,LB:()=>r.LB,g:()=>r.g});var r=n(71197)},22999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(92213);const a={paragraph:e=>e.replaceAll("\n","
")},s={emDelimiter:"_",headingStyle:"atx"},o={strikethrough:{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}}};class i{constructor({options:e={},rules:t={},keep:n=[],remove:a=[],fixes:i=[]}={}){this.fixes=i,this.turndownService=new r.Z({...s,...e}),this.turndownService.keep(n),this.turndownService.remove(a);const l={...o,...t};for(const e in l)this.turndownService.addRule(e,l[e])}render({content:e}){const t=this.turndownService.turndown(e);return this.fixes.reduce(((e,t)=>a[t](e)),t)}}},71197:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.Z,LB:()=>o,g:()=>i});var r=n(22999);const a=new(n(28603).Z),s=new r.Z,o=({content:e,rules:t,extension:n})=>a.render({content:e,rules:t,extension:n}),i=({content:e})=>s.render({content:e})},28603:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(95601);const a=e=>e.replaceAll("\x3c!-- wp:list-item --\x3e","").replaceAll("\x3c!-- /wp:list-item --\x3e","").replaceAll("\x3c!-- wp:list --\x3e","").replaceAll("\x3c!-- /wp:list --\x3e","").replaceAll("
  • ","\x3c!-- wp:list-item --\x3e
  • ").replaceAll("
  • ","\x3c!-- /wp:list-item --\x3e").replaceAll("
      ",'\x3c!-- wp:list {"ordered":true} --\x3e
        ').replaceAll("
      ","
    \x3c!-- /wp:list --\x3e").replaceAll("\x3c!-- /wp:list --\x3e"),s={list:(e,t=!1)=>{const n=e.replace(/
  • \s+

    /g,"

  • ").replace(/<\/p>\s+<\/li>/g,"
  • ");return t?a(n):n},listItem:(e,t=!1)=>t?a(e.replace(/^<[ou]l>\s*/g,"").replace(/\s*<\/[ou]l>\s*$/g,"")):e,paragraph:(e,t=!1)=>t?e.replaceAll(/\s*<br \/>\s*/g,"
    "):e},o={breaks:!0},i=["list"];class l{constructor(e=o){this.markdownConverter=new r.Z(e)}render({content:e,rules:t=i,extension:n=!1}){const r=this.markdownConverter.render(e);return t.reduce(((e,t)=>s[t](e,n)),r)}}},56694:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(60400),a=n(51128),s=n.n(a),o=n(42194),i=n(2890),l=n(16700);const c=s()("jetpack-ai-client:suggestions-event-source");class u extends EventTarget{constructor(e){super(),this.fullMessage="",this.fullFunctionCall={name:"",arguments:""},this.isPromptClear=!1,this.controller=new AbortController,this.initEventSource(e)}async initEventSource({url:e,question:t,token:n,options:a={}}){if(!n)try{c("Token was not provided, requesting one..."),n=(await(0,i.Z)()).token}catch(e){return void this.processErrorEvent(e)}const s={};if(Number.isInteger(parseInt(a.postId))&&(s.post_id=+a.postId),!e){const t=new URL("https://public-api.wordpress.com/wpcom/v2/jetpack-ai-query");a?.fromCache&&t.searchParams.append("stream_cache","true"),e=t.toString(),c("URL not provided, using default: %o",e)}Array.isArray(t)?s.messages=t:s.question=t,a?.feature?.length&&(c("Feature: %o",a.feature),s.feature=a.feature),a?.functions?.length&&(c("Functions: %o",a.functions),s.functions=a.functions),a?.model?.length&&(c("Model: %o",a.model),s.model=a.model),this.errorUnclearPromptTriggered=!1,await(0,r.L)(e,{openWhenHidden:!0,method:"POST",headers:{"Content-type":"application/json",Authorization:"Bearer "+n},body:JSON.stringify(s),onclose:()=>{c("Stream closed")},onerror:e=>{throw this.processErrorEvent(e),e},onmessage:e=>{this.processEvent(e)},onopen:async e=>{if(e.ok)return;let t;throw e.status>=400&&e.status<=500&&![413,422,429].includes(e.status)&&(c("Connection error: %o",e),t=l.co,this.dispatchEvent(new CustomEvent(l.co,{detail:e}))),503===e.status&&(t=l.$u,this.dispatchEvent(new CustomEvent(l.$u))),413===e.status&&(t=l.cv,this.dispatchEvent(new CustomEvent(l.cv))),422===e.status&&(t=l.q4,this.dispatchEvent(new CustomEvent(l.q4))),429===e.status&&(t=l.$L,this.dispatchEvent(new CustomEvent(l.$L))),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(t)})),new Error},signal:this.controller.signal})}checkForUnclearPrompt(){if(this.isPromptClear)return;const e=this.fullMessage.replace(/__|(\*\*)/g,"");if(e.startsWith("JETPACK_AI_ERROR")){if(this.errorUnclearPromptTriggered)return;this.errorUnclearPromptTriggered=!0,this.dispatchEvent(new CustomEvent(l.bC)),c("Unclear error prompt dispatched"),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.bC)}))}else"JETPACK_AI_ERROR".startsWith(e)?c(this.fullMessage):this.isPromptClear=!0}close(){this.controller.abort()}processEvent(e){if("[DONE]"===e.data){if(this.errorUnclearPromptTriggered)return;if(this.fullMessage.length)return this.dispatchEvent(new CustomEvent("done",{detail:this.fullMessage})),void c("Done: %o",this.fullMessage);if(this.fullFunctionCall.name.length)return this.dispatchEvent(new CustomEvent("function_done",{detail:this.fullFunctionCall})),void c("Done: %o",this.fullFunctionCall)}let t;try{t=JSON.parse(e.data)}catch(t){return void c("Error parsing JSON",e,t)}const{delta:n}=t?.choices?.[0]??{delta:{content:null,function_call:null}},r=n.content,a=n.function_call;r&&(this.fullMessage+=r,this.checkForUnclearPrompt(),this.isPromptClear&&(this.dispatchEvent(new CustomEvent("chunk",{detail:r})),c("suggestion: %o",this.fullMessage),this.dispatchEvent(new CustomEvent("suggestion",{detail:this.fullMessage})))),a&&(null!=a.name&&(this.fullFunctionCall.name+=a.name),null!=a.arguments&&(this.fullFunctionCall.arguments+=a.arguments),this.dispatchEvent(new CustomEvent("functionCallChunk",{detail:this.fullFunctionCall})))}processErrorEvent(e){c("onerror: %o",e),this.dispatchEvent(new CustomEvent(l.co,{detail:e})),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.co)}))}}},16700:(e,t,n)=>{"use strict";n.d(t,{$L:()=>s,$u:()=>a,Y:()=>r.Y,bC:()=>c,co:()=>l,cv:()=>i,q4:()=>o,vF:()=>u});var r=n(44696);const a="error_service_unavailable",s="error_quota_exceeded",o="error_moderation",i="error_context_too_large",l="error_network",c="error_unclear_prompt",u="error_response"},6975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51128);const a=n.n(r)()("dops:analytics");let s,o;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const i={initialize:function(e,t,n){i.setUser(e,t),i.setSuperProps(n),i.identifyUser()},setGoogleAnalyticsEnabled:function(e,t=null){this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){o={ID:e,username:t}},setSuperProps:function(e){s=e},assignSuperProps:function(e){s=Object.assign(s||{},e)},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Built stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){i.tracks.recordPageView(e),i.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,a,s,o){i.ga.recordPurchase(e,t,n,r,a,s,o)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(s&&(a("- Super Props: %o",s),t=Object.assign(t,s)),a('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):a('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};i.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){i.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){a("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};i.ga.initialized||(o&&(e={userId:"u-"+o.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),i.ga.initialized=!0)},recordPageView:function(e,t){i.ga.initialize(),a("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){i.ga.initialize();let s="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(s+=" [Option Label: "+n+"]"),void 0!==r&&(s+=" [Option Value: "+r+"]"),a(s),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,a,s,o){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:o}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:a,quantity:s}),window.ga("ecommerce:send")}},identifyUser:function(){o&&window._tkq.push(["identifyUser",o.ID,o.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}},l=i},64743:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(61132),a=n(96483);function s(e){class t extends Error{constructor(...t){super(...t),this.name=e}}return t}const o=s("JsonParseError"),i=s("JsonParseAfterRedirectError"),l=s("Api404Error"),c=s("Api404AfterRedirectError"),u=s("FetchNetworkError");const d=new function(e,t){let n=e,s=e,o={"X-WP-Nonce":t},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})},c=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setWpcomOriginApiUrl(e){s=e},setApiNonce(e){o={"X-WP-Nonce":e},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{c=e},registerSite:(e,t,a)=>{const s={registration_nonce:e,no_iframe:!0};return(0,r.jetpackConfigHas)("consumer_slug")&&(s.plugin_slug=(0,r.jetpackConfigGet)("consumer_slug")),null!==t&&(s.redirect_uri=t),a&&(s.from=a),g(`${n}jetpack/v4/connection/register`,l,{body:JSON.stringify(s)}).then(p).then(m)},fetchAuthorizationUrl:e=>d((0,a.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),i).then(p).then(m),fetchSiteConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchSiteConnectionStatus:()=>d(`${n}jetpack/v4/connection`,i).then(m),fetchSiteConnectionTest:()=>d(`${n}jetpack/v4/connection/test`,i).then(p).then(m),fetchUserConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchUserTrackingSettings:()=>d(`${n}jetpack/v4/tracking/settings`,i).then(p).then(m),updateUserTrackingSettings:e=>g(`${n}jetpack/v4/tracking/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),disconnectSite:()=>g(`${n}jetpack/v4/connection`,l,{body:JSON.stringify({isActive:!1})}).then(p).then(m),fetchConnectUrl:()=>d(`${n}jetpack/v4/connection/url`,i).then(p).then(m),unlinkUser:()=>g(`${n}jetpack/v4/connection/user`,l,{body:JSON.stringify({linked:!1})}).then(p).then(m),reconnect:()=>g(`${n}jetpack/v4/connection/reconnect`,l).then(p).then(m),fetchConnectedPlugins:()=>d(`${n}jetpack/v4/connection/plugins`,i).then(p).then(m),setHasSeenWCConnectionModal:()=>g(`${n}jetpack/v4/seen-wc-connection-modal`,l).then(p).then(m),fetchModules:()=>d(`${n}jetpack/v4/module/all`,i).then(p).then(m),fetchModule:e=>d(`${n}jetpack/v4/module/${e}`,i).then(p).then(m),activateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!0})}).then(p).then(m),deactivateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>g(`${n}jetpack/v4/module/${e}`,l,{body:JSON.stringify(t)}).then(p).then(m),updateSettings:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),getProtectCount:()=>d(`${n}jetpack/v4/module/protect/data`,i).then(p).then(m),resetOptions:e=>g(`${n}jetpack/v4/options/${e}`,l,{body:JSON.stringify({reset:!0})}).then(p).then(m),activateVaultPress:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(p).then(m),getVaultPressData:()=>d(`${n}jetpack/v4/module/vaultpress/data`,i).then(p).then(m),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify(r)}).then(p).then(m)},activateAkismet:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(p).then(m),getAkismetData:()=>d(`${n}jetpack/v4/module/akismet/data`,i).then(p).then(m),checkAkismetKey:()=>d(`${n}jetpack/v4/module/akismet/key/check`,i).then(p).then(m),checkAkismetKeyTyped:e=>g(`${n}jetpack/v4/module/akismet/key/check`,l,{body:JSON.stringify({api_key:e})}).then(p).then(m),fetchStatsData:e=>d(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),i).then(p).then(m).then(h),getPluginUpdates:()=>d(`${n}jetpack/v4/updates/plugins`,i).then(p).then(m),getPlans:()=>d(`${n}jetpack/v4/plans`,i).then(p).then(m),fetchSettings:()=>d(`${n}jetpack/v4/settings`,i).then(p).then(m),updateSetting:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSiteData:()=>d(`${n}jetpack/v4/site`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>d(`${n}jetpack/v4/site/features`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>d(`${n}jetpack/v4/site/products`,i).then(p).then(m),fetchSitePurchases:()=>d(`${n}jetpack/v4/site/purchases`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>d(`${n}jetpack/v4/site/benefits`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteDiscount:()=>d(`${n}jetpack/v4/site/discount`,i).then(p).then(m).then((e=>e.data)),fetchSetupQuestionnaire:()=>d(`${n}jetpack/v4/setup/questionnaire`,i).then(p).then(m),fetchRecommendationsData:()=>d(`${n}jetpack/v4/recommendations/data`,i).then(p).then(m),fetchRecommendationsProductSuggestions:()=>d(`${n}jetpack/v4/recommendations/product-suggestions`,i).then(p).then(m),fetchRecommendationsUpsell:()=>d(`${n}jetpack/v4/recommendations/upsell`,i).then(p).then(m),fetchRecommendationsConditional:()=>d(`${n}jetpack/v4/recommendations/conditional`,i).then(p).then(m),saveRecommendationsData:e=>g(`${n}jetpack/v4/recommendations/data`,l,{body:JSON.stringify({data:e})}).then(p),fetchProducts:()=>d(`${n}jetpack/v4/products`,i).then(p).then(m),fetchRewindStatus:()=>d(`${n}jetpack/v4/rewind`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>d(`${n}jetpack/v4/scan`,i).then(p).then(m).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>g(`${n}jetpack/v4/notice/${e}`,l,{body:JSON.stringify({dismissed:!0})}).then(p).then(m),fetchPluginsData:()=>d(`${n}jetpack/v4/plugins`,i).then(p).then(m),fetchIntroOffers:()=>d(`${n}jetpack/v4/intro-offers`,i).then(p).then(m),fetchVerifySiteGoogleStatus:e=>d(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,i).then(p).then(m),verifySiteGoogle:e=>g(`${n}jetpack/v4/verify-site/google`,l,{body:JSON.stringify({keyring_id:e})}).then(p).then(m),submitSurvey:e=>g(`${n}jetpack/v4/marketing/survey`,l,{body:JSON.stringify(e)}).then(p).then(m),saveSetupQuestionnaire:e=>g(`${n}jetpack/v4/setup/questionnaire`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicensingError:e=>g(`${n}jetpack/v4/licensing/error`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicenseKey:e=>g(`${n}jetpack/v4/licensing/set-license`,l,{body:JSON.stringify({license:e})}).then(p).then(m),getUserLicensesCounts:()=>d(`${n}jetpack/v4/licensing/user/counts`,i).then(p).then(m),getUserLicenses:()=>d(`${n}jetpack/v4/licensing/user/licenses`,i).then(p).then(m),updateLicensingActivationNoticeDismiss:e=>g(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,l,{body:JSON.stringify({last_detached_count:e})}).then(p).then(m),updateRecommendationsStep:e=>g(`${n}jetpack/v4/recommendations/step`,l,{body:JSON.stringify({step:e})}).then(p),confirmIDCSafeMode:()=>g(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,l).then(p),startIDCFresh:e=>g(`${n}jetpack/v4/identity-crisis/start-fresh`,l,{body:JSON.stringify({redirect_uri:e})}).then(p).then(m),migrateIDC:()=>g(`${n}jetpack/v4/identity-crisis/migrate`,l).then(p),attachLicenses:e=>g(`${n}jetpack/v4/licensing/attach-licenses`,l,{body:JSON.stringify({licenses:e})}).then(p).then(m),fetchSearchPlanInfo:()=>d(`${s}jetpack/v4/search/plan`,i).then(p).then(m),fetchSearchSettings:()=>d(`${s}jetpack/v4/search/settings`,i).then(p).then(m),updateSearchSettings:e=>g(`${s}jetpack/v4/search/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSearchStats:()=>d(`${s}jetpack/v4/search/stats`,i).then(p).then(m),fetchWafSettings:()=>d(`${n}jetpack/v4/waf`,i).then(p).then(m),updateWafSettings:e=>g(`${n}jetpack/v4/waf`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchWordAdsSettings:()=>d(`${n}jetpack/v4/wordads/settings`,i).then(p).then(m),updateWordAdsSettings:e=>g(`${n}jetpack/v4/wordads/settings`,l,{body:JSON.stringify(e)}),fetchSearchPricing:()=>d(`${s}jetpack/v4/search/pricing`,i).then(p).then(m),fetchMigrationStatus:()=>d(`${n}jetpack/v4/migration/status`,i).then(p).then(m),fetchBackupUndoEvent:()=>d(`${n}jetpack/v4/site/backup/undo-event`,i).then(p).then(m),fetchBackupPreflightStatus:()=>d(`${n}jetpack/v4/site/backup/preflight`,i).then(p).then(m)};function d(e,t){return fetch(c(e),t)}function g(e,t,n){return fetch(e,Object.assign({},t,n)).catch(A)}function h(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}Object.assign(this,u)};function p(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new c(e.redirected):new l})):e.json().catch((e=>g(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function m(e){return e.json().catch((t=>g(t,e.redirected,e.url)))}function g(e,t,n){throw t?new i(n):new o}function A(){throw new u}},90526:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(82674),a=n.n(r),s=n(55609),o=n(65736),i=n(61074),l=n(15381),c=n(65235),u=n.n(c),d=n(99196),p=n.n(d),m=n(62103);const __=o.__,g=(0,d.forwardRef)(((e,t)=>{const{children:n,variant:r="primary",size:o="normal",weight:c="bold",icon:d,iconSize:g,disabled:A,isDestructive:h,isLoading:E,isExternalLink:f,className:b,text:C,fullWidth:v,...k}=e,B=u()(m.Z.button,b,{[m.Z.normal]:"normal"===o,[m.Z.small]:"small"===o,[m.Z.icon]:Boolean(d),[m.Z.loading]:E,[m.Z.regular]:"regular"===c,[m.Z["full-width"]]:v,[m.Z["is-icon-button"]]:Boolean(d)&&!n});k.ref=t;const y="normal"===o?20:16,w=f&&p().createElement(p().Fragment,null,p().createElement(i.Z,{size:y,icon:l.Z,className:m.Z["external-icon"]}),p().createElement(s.VisuallyHidden,{as:"span"},/* translators: accessibility text */ +__("Error: %1$s","jetpack"),i)),t===d.$L?React.createElement(r.Button,{variant:"link",onClick:s,href:o,target:o?"_blank":null},__("Upgrade now","jetpack")):React.createElement(r.Button,{variant:"link",onClick:n},__("Try again","jetpack")))}},62282:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,u:()=>s});var r=n(99196),a=n.n(r);const s=(0,r.createContext)({}),o=({value:e,children:t})=>a().createElement(s.Provider,{value:e,children:t})},20281:(e,t,n)=>{"use strict";n.d(t,{X_:()=>s.Z,hE:()=>r.h,oN:()=>a.Z,uE:()=>r.u});var r=n(62282),a=n(3669),s=n(79466)},79466:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(99196),a=n(16700),s=n(20281);function o({onDone:e,onSuggestion:t,onError:n}={}){const o=(0,r.useContext)(s.uE),{eventSource:i}=o,l=(0,r.useCallback)((t=>e?.(t?.detail)),[e]),c=(0,r.useCallback)((e=>t?.(e?.detail)),[t]),u=(0,r.useCallback)((e=>{n?.(e?.detail)}),[]);return(0,r.useEffect)((()=>{if(i)return e&&i.addEventListener("done",l),t&&i.addEventListener("suggestion",c),n&&i.addEventListener(a.vF,u),()=>{i.removeEventListener("done",l),i.removeEventListener("suggestion",c),i.removeEventListener(a.vF,u)}}),[i]),o}},3669:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(94333),a=n(69307),s=n(99196),o=n.n(s),i=n(42194),l=n(20281);const c=(0,r.createHigherOrderComponent)((e=>t=>{const{suggestion:n,error:r,requestingState:s,request:c,stopSuggestion:u,eventSource:d}=(0,i.Z)(),p=(0,a.useMemo)((()=>({suggestion:n,requestingError:r,requestingState:s,eventSource:d,requestSuggestion:c,stopSuggestion:u})),[n,r,s,d,c,u]);return o().createElement(l.hE,{value:p},o().createElement(e,t))}),"withAiDataProvider")},42194:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Z:()=>l});var r=n(69307),a=n(65736),s=n(67742),o=n(16700);const __=a.__;function i(e){switch(e){case o.$L:return{code:o.$L,message:__("You have reached the limit of requests for this site.","jetpack"),severity:"info"};case o.bC:return{code:o.bC,message:__("Your request was unclear. Mind trying again?","jetpack"),severity:"info"};case o.$u:return{code:o.$u,message:__("Jetpack AI services are currently unavailable. Sorry for the inconvenience.","jetpack"),severity:"info"};case o.q4:return{code:o.q4,message:__("This request has been flagged by our moderation system. Please try to rephrase it and try again.","jetpack"),severity:"info"};case o.cv:return{code:o.cv,message:__("The content is too large to be processed all at once. Please try to shorten it or divide it into smaller parts.","jetpack"),severity:"info"};case o.co:default:return{code:o.co,message:__("It was not possible to process your request. Mind trying again?","jetpack"),severity:"info"}}}function l({prompt:e,autoRequest:t=!1,askQuestionOptions:n={},initialRequestingState:a="init",onSuggestion:l,onDone:c,onStop:u,onError:d,onAllErrors:p}={}){const[m,g]=(0,r.useState)(a),[A,h]=(0,r.useState)(""),[E,f]=(0,r.useState)(),b=(0,r.useRef)(void 0),C=(0,r.useCallback)((e=>{h(e?.detail),l?.(e?.detail)}),[l]),v=(0,r.useCallback)((e=>{Q(),c?.(e?.detail),g("done")}),[c]),k=(0,r.useCallback)((e=>{p?.(e?.detail)}),[p]),B=(0,r.useCallback)((e=>{b?.current?.close(),g("error"),f(i(e)),d?.(i(e))}),[d]),y=(0,r.useCallback)((()=>B(o.$L)),[]),w=(0,r.useCallback)((()=>B(o.bC)),[]),_=(0,r.useCallback)((()=>B(o.$u)),[]),I=(0,r.useCallback)((()=>B(o.q4)),[]),j=(0,r.useCallback)((()=>B(o.co)),[]),x=(0,r.useCallback)((async(e,t={...n})=>{if(f(void 0),g("requesting"),b.current=await(0,s.Z)(e,t),!b?.current)return;const r=b.current;g("suggesting"),r.addEventListener("suggestion",C),r.addEventListener(o.$L,y),r.addEventListener(o.bC,w),r.addEventListener(o.$u,_),r.addEventListener(o.q4,I),r.addEventListener(o.co,j),r.addEventListener(o.vF,k),r.addEventListener("done",v)}),[v,y,w,_,I,j,C]),S=(0,r.useCallback)((()=>{g("init"),h(""),f(void 0)}),[]),Q=(0,r.useCallback)((()=>{if(!b?.current)return;const e=b?.current;e.close(),e.removeEventListener("suggestion",C),e.removeEventListener(o.$L,y),e.removeEventListener(o.bC,w),e.removeEventListener(o.$u,_),e.removeEventListener(o.q4,I),e.removeEventListener(o.co,j),e.removeEventListener("done",v)}),[b,C,y,w,_,I,j,v]),N=(0,r.useCallback)((()=>{Q(),u?.(),g("done")}),[u]);return(0,r.useEffect)((()=>{if(e?.length)return t&&x(e,n),()=>{N()}}),[t,e,x,N]),{suggestion:A,error:E,requestingState:m,request:x,stopSuggestion:N,reset:S,handleErrorQuotaExceededError:y,eventSource:b.current}}},93509:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(69307),a=n(65736),s=n(51128),o=n.n(s),i=n(46961);const __=a.__,l=o()("jetpack-ai-client:use-audio-transcription"),c=e=>{if("string"==typeof e)return e;if("code"in e)switch(e.code){case"error_quota_exceeded":return __("You exceeded your current quota, please check your plan details.","jetpack");case"jetpack_ai_missing_audio_param":return __("The audio_file is required to perform a transcription.","jetpack");case"jetpack_ai_service_unavailable":return __("The Jetpack AI service is temporarily unavailable.","jetpack");case"file_size_not_supported":return __("The provided audio file is too big.","jetpack");case"file_type_not_supported":return __("The provided audio file type is not supported.","jetpack");case"jetpack_ai_error":return __("There was an error processing the transcription request.","jetpack");default:return e.message}return"message"in e?e.message:__("There was an error processing the transcription request.","jetpack")};function u({feature:e,onReady:t,onError:n}){const[a,s]=(0,r.useState)(""),[o,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useRef)(null);return{transcriptionResult:a,isTranscribingAudio:d,transcriptionError:o,transcribeAudio:(0,r.useCallback)((r=>{l("Transcribing audio"),s(""),u(""),p(!0);const a=new AbortController;m.current=a,(0,i.Z)(r,e,a.signal).then((e=>{s(e),t?.(e)})).catch((e=>{a.signal.aborted||(u(e.message),n?.(c(e)))})).finally((()=>p(!1)))}),[i.Z,s,u,p]),cancelTranscription:(0,r.useCallback)((()=>{m.current?.abort(),s(""),u(""),p(!1)}),[m,s,u,p])}}},92718:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(69307),a=n(65736);const __=a.__,s=25e6,o=1500,i=["audio/mpeg","audio/mp3","audio/ogg","audio/flac","audio/x-flac","audio/m4a","audio/x-m4a","audio/mp4","audio/wav","audio/wave","audio/x-wav","audio/webm"];function l(){const[e,t]=(0,r.useState)(!1);return{isValidatingAudio:e,validateAudio:(0,r.useCallback)(((e,n,r)=>{if(t(!0),e?.size>s)return t(!1),r(__("The audio file is too large. The maximum file size is 25MB.","jetpack"));const a=e instanceof File;if(a&&!i.includes(e.type))return t(!1),r(__("The audio file type is not supported. Please use a supported audio file type.","jetpack"));const l=new AudioContext;e.arrayBuffer().then((s=>{l.decodeAudioData(s,(function(s){const i=Math.ceil(s.duration);return i>o?(t(!1),r(__("The audio file is too long. The maximum recording time is 25 minutes.","jetpack"))):(t(!1),n({duration:i,isFile:a,size:e?.size}))}))}))}),[t])}}},70286:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(51128),a=n.n(r),s=n(78982),o=n(2890);const i=a()("ai-client:use-image-generator"),l=(e,t)=>{const n=4e3-t;return e.length>n?e.substring(0,n-6)+" [...]":e},c=async(e,t,n)=>{const r=((e,t)=>{if(t){const n=`I need a Stable Diffusion prompt to generate a featured image for a blog post based on this user-provided image description:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nThe image should be a photo. Make sure you highlight the main suject of the image description, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}return"I need a Stable Diffusion prompt to generate a featured image for a blog post with the following content.\nThe image should be a photo. Make sure you highlight the main suject of the content, and include brief details about the light and style of the image.\nInclude a request to use high resolution and produce a highly detailed image, with sharp focus.\nReturn just the prompt, without comments. The content is:\n\n"+l(e,412)})(e,t),a=await(0,s.Z)(r,{feature:n});return a.choices?.[0]?.message?.content},u=()=>{const e=async function(e){let t="";try{t=(await(0,o.Z)()).token}catch(e){return i("Error getting token: %o",e),Promise.reject(e)}try{const n="https://public-api.wordpress.com/wpcom/v2/jetpack-ai-image",r={Authorization:`Bearer ${t}`,"Content-Type":"application/json"},a=await fetch(n,{method:"POST",headers:r,body:JSON.stringify(e)}).then((e=>e.json()));return a?.data?.status&&a?.data?.status>200?(i("Error generating image: %o",a),Promise.reject(a)):a}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}};return{generateImage:async function({feature:t,postContent:n,responseFormat:r="url",userPrompt:a}){try{i("Generating image");const s=((e,t)=>{if(t){const n=`I need a cover image for a blog post based on this user prompt:\n\n${t.length>1e3?t.substring(0,1e3):t}\n\nBefore creating the image, identify the main topic of the user prompt and relate it to the post content.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nFor additional context, this is the post content:\n\n`;return n+l(e,n.length)}const n="I need a cover image for a blog post.\nBefore creating the image, identify the main topic of the content and only represent it.\nDo not represent the whole content in one image, keep it simple and just represent one single idea.\nDo not add details, detailed explanations or highlights from the content, just represent the main idea as if it was a photograph.\nDo not use collages or compositions with multiple elements or scenes. Stick to one single scene. Do not compose unrealistic scenes.\nIf the content describes facts, objects or concepts from the real world, represent them on a realistic style and do not make unreal compositions.\nIf the content is more abstract, use a more abstract style to represent the main idea.\nMake sure the light and the style are visually appealing.\nDo not add text to the image.\n\nThis is the post content:\n\n";return n+l(e,838)})(n,a),o={prompt:s,response_format:r,feature:t,size:"1792x1024"};return await e(o)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithStableDiffusion:async function({feature:t,postContent:n,userPrompt:r}){try{i("Generating image with Stable Diffusion");const a={prompt:await c(n,r,t),feature:t,model:"stable-diffusion",style:"photographic"};return await e(a)}catch(e){return i("Error generating image: %o",e),Promise.reject(e)}},generateImageWithParameters:e}}},13109:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(69307);const a="audio/mp4;codecs=mp4a",s="audio/mp4",o="audio/webm";function i({onDone:e}={}){const t=(0,r.useRef)(null),[n,i]=(0,r.useState)("inactive"),l=(0,r.useRef)(!1),c=(0,r.useRef)(0),[u,d]=(0,r.useState)(0),p=(0,r.useRef)(null),[m,g]=(0,r.useState)(null),A=(0,r.useRef)([]).current,[h,E]=(0,r.useState)(null),f=(0,r.useRef)(null);function b(){return MediaRecorder.isTypeSupported(a)?new Blob(A,{type:s}):new Blob(A,{type:o})}const C=(0,r.useCallback)((e=>{if(y(),!e)return t?.current?.start();e<100&&(e=100),c.current=Date.now(),t?.current?.start(e)}),[]),v=(0,r.useCallback)((()=>{l.current=!0,t?.current?.pause(),d((e=>e+Date.now()-c.current))}),[]),k=(0,r.useCallback)((()=>{l.current=!1,t?.current?.resume(),c.current=Date.now()}),[]),B=(0,r.useCallback)((()=>{t?.current?.stop(),"recording"===n&&d((e=>e+Date.now()-c.current))}),[]),y=(0,r.useCallback)((()=>{A.length=0,g(null),E(null),d(0),l.current=!1,c.current=0}),[]),w=(0,r.useCallback)((()=>{t?.current&&(t.current.removeEventListener("start",j),t.current.removeEventListener("stop",x),t.current.removeEventListener("pause",S),t.current.removeEventListener("resume",Q),t.current.removeEventListener("dataavailable",N),t.current=null)}),[]),_=(0,r.useCallback)((()=>{if(i("inactive"),y(),w(),!navigator.mediaDevices?.getUserMedia)return;const e=new AudioContext;f.current=e.createAnalyser();navigator.mediaDevices.getUserMedia({audio:!0}).then((n=>{p.current=n;e.createMediaStreamSource(n).connect(f.current),MediaRecorder.isTypeSupported(a)?t.current=new MediaRecorder(n,{mimeType:a}):t.current=new MediaRecorder(n,{mimeType:o}),t.current.addEventListener("start",j),t.current.addEventListener("stop",x),t.current.addEventListener("pause",S),t.current.addEventListener("resume",Q),t.current.addEventListener("dataavailable",N)})).catch((e=>{throw e}))}),[]),I=(0,r.useCallback)((e=>{B(),E("string"==typeof e?e:e.message),i("error")}),[]);function j(){i("recording")}function x(){const t=b();e?.(t),A.length=0}function S(){i("paused")}function Q(){i("recording")}function N(e){const{data:t}=e;t?.size&&(A.push(t),g(b()),l.current||d((e=>{const t=Date.now(),n=t-c.current;return c.current=t,e+n})))}return(0,r.useEffect)((()=>(_(),()=>{p.current&&p.current.getTracks().forEach((e=>e.stop())),w()})),[]),{state:n,blob:m,error:h,duration:u,analyser:f.current,onError:I,controls:{start:C,pause:v,resume:k,stop:B,reset:_}}}},44696:(e,t,n)=>{"use strict";n.d(t,{Y:()=>l,Z:()=>c});var r=n(69307),a=n(51128),s=n.n(a),o=n(42194);const i=s()("jetpack-ai-client:use-transcription-post-processing"),l="voice-to-content-simple-draft";function c({feature:e,onReady:t,onError:n,onUpdate:a}){const[s,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[d,p]=(0,r.useState)(!1),m=(0,r.useCallback)((e=>{l(e),a?.(e)}),[l,a]),g=(0,r.useCallback)((e=>{l(e),a?.(e),t?.(e)}),[l,a,t]),A=(0,r.useCallback)((e=>{u(e.message),n?.(e.message)}),[u,n]),{request:h,stopSuggestion:E}=(0,o.Z)({onSuggestion:m,onDone:g,onError:A});return{postProcessingResult:s,isProcessingTranscription:d,postProcessingError:c,processTranscription:(0,r.useCallback)(((t,n)=>{i("Post-processing transcription"),l(""),u(""),p(!0);h([{role:"jetpack-ai",context:{type:t,content:n}}],{feature:e})}),[l,u,p,h,e]),cancelTranscriptionProcessing:(0,r.useCallback)((()=>{E(),p(!1)}),[E,p])}}},61317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{viewBox:"0 0 32 32",width:"32",height:"32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"ai-assistant-icon"},s().createElement(r.Path,{className:"spark-first",d:"M9.33301 5.33325L10.4644 8.20188L13.333 9.33325L10.4644 10.4646L9.33301 13.3333L8.20164 10.4646L5.33301 9.33325L8.20164 8.20188L9.33301 5.33325Z"}),s().createElement(r.Path,{className:"spark-second",d:"M21.3333 5.33333L22.8418 9.15817L26.6667 10.6667L22.8418 12.1752L21.3333 16L19.8248 12.1752L16 10.6667L19.8248 9.15817L21.3333 5.33333Z"}),s().createElement(r.Path,{className:"spark-third",d:"M14.6667 13.3333L16.5523 18.1144L21.3333 20L16.5523 21.8856L14.6667 26.6667L12.781 21.8856L8 20L12.781 18.1144L14.6667 13.3333Z"}))},83585:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(55609);const a=React.createElement(r.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.95833C6.66328 3.95833 3.95833 6.66327 3.95833 9.99999C3.95833 13.3367 6.66328 16.0417 10 16.0417C13.3367 16.0417 16.0417 13.3367 16.0417 9.99999C16.0417 6.66327 13.3367 3.95833 10 3.95833ZM2.70833 9.99999C2.70833 5.97292 5.97292 2.70833 10 2.70833C14.0271 2.70833 17.2917 5.97292 17.2917 9.99999C17.2917 14.0271 14.0271 17.2917 10 17.2917C5.97292 17.2917 2.70833 14.0271 2.70833 9.99999Z"}),React.createElement(r.Path,{d:"M10.8333 5.83333H9.16667V10.8333H10.8333V5.83333Z"}),React.createElement(r.Path,{d:"M10.8333 12.5H9.16667V14.1667H10.8333V12.5Z"}))},59822:(e,t,n)=>{"use strict";n.d(t,{Qf:()=>a.Z,Qr:()=>s.Z,u_:()=>r.Z,v_:()=>o.Z});var r=n(61317),a=n(81204),s=(n(4454),n(71893),n(52887),n(96083)),o=n(50500)},81204:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"10.5",y:"8.25",width:"3",height:"4.875",rx:"1.5",fill:"#008710"}),s().createElement(r.Path,{d:"M15 11.25C15 11.644 14.9224 12.0341 14.7716 12.3981C14.6209 12.762 14.3999 13.0927 14.1213 13.3713C13.8427 13.6499 13.512 13.8709 13.1481 14.0216C12.7841 14.1724 12.394 14.25 12 14.25C11.606 14.25 11.2159 14.1724 10.8519 14.0216C10.488 13.8709 10.1573 13.6499 9.87868 13.3713C9.6001 13.0927 9.37913 12.762 9.22836 12.3981C9.0776 12.0341 9 11.644 9 11.25",stroke:"#008710",strokeWidth:"1.125",strokeLinecap:"round"}),s().createElement(r.Path,{d:"M11.4375 15.75C11.4375 16.0607 11.6893 16.3125 12 16.3125C12.3107 16.3125 12.5625 16.0607 12.5625 15.75L11.4375 15.75ZM11.4375 14.25L11.4375 15.75L12.5625 15.75L12.5625 14.25L11.4375 14.25Z",fill:"#008710"}))},4454:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},96083:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/SVG"},s().createElement(r.Path,{d:"M12 4.75C11.0479 4.75 10.1052 4.93753 9.22554 5.30187C8.34593 5.66622 7.5467 6.20025 6.87348 6.87348C6.20025 7.5467 5.66622 8.34593 5.30187 9.22554C4.93753 10.1052 4.75 11.0479 4.75 12C4.75 12.9521 4.93753 13.8948 5.30187 14.7745C5.66622 15.6541 6.20025 16.4533 6.87348 17.1265C7.5467 17.7997 8.34593 18.3338 9.22554 18.6981C10.1052 19.0625 11.0479 19.25 12 19.25C13.9228 19.25 15.7669 18.4862 17.1265 17.1265C18.4862 15.7669 19.25 13.9228 19.25 12C19.25 10.0772 18.4862 8.23312 17.1265 6.87348C15.7669 5.51384 13.9228 4.75 12 4.75ZM3.25 12C3.25 9.67936 4.17187 7.45376 5.81282 5.81282C7.45376 4.17187 9.67936 3.25 12 3.25C14.3206 3.25 16.5462 4.17187 18.1872 5.81282C19.8281 7.45376 20.75 9.67936 20.75 12C20.75 14.3206 19.8281 16.5462 18.1872 18.1872C16.5462 19.8281 14.3206 20.75 12 20.75C9.67936 20.75 7.45376 19.8281 5.81282 18.1872C4.17187 16.5462 3.25 14.3206 3.25 12Z",fill:"#008710"}),s().createElement(r.Rect,{x:"12.75",y:"9",width:"2.25",height:"6",fill:"#008710"}),s().createElement(r.Rect,{x:"9",y:"9",width:"2.25",height:"6",fill:"#008710"}))},71893:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Path},52887:(e,t,n)=>{"use strict";var r=n(55609),a=n(99196),s=n.n(a);r.SVG,r.Path,r.Rect},50500:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(55609),a=n(99196),s=n.n(a);const o=s().createElement(r.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.5 10C12.5 11.3807 11.3807 12.5 10 12.5C8.61929 12.5 7.5 11.3807 7.5 10C7.5 8.61929 8.61929 7.5 10 7.5C11.3807 7.5 12.5 8.61929 12.5 10ZM14 10C14 12.2091 12.2091 14 10 14C7.79086 14 6 12.2091 6 10C6 7.79086 7.79086 6 10 6C12.2091 6 14 7.79086 14 10ZM16.75 21V19C16.75 17.4812 15.5188 16.25 14 16.25L6 16.25C4.48122 16.25 3.25 17.4812 3.25 19V21H4.75L4.75 19C4.75 18.3096 5.30964 17.75 6 17.75L14 17.75C14.6904 17.75 15.25 18.3096 15.25 19V21H16.75Z",fill:"currentColor"}),s().createElement(r.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M19.976 16.3599C21.2507 14.5642 22.0001 12.3695 22.0001 9.99969C22.0001 7.63128 21.2515 5.43769 19.9782 3.64258L18.754 4.50967C19.8537 6.05996 20.5001 7.95434 20.5001 9.99969C20.5001 12.0464 19.8528 13.9419 18.7519 15.4928L19.976 16.3599ZM17.3357 14.4897C18.2357 13.222 18.7648 11.6727 18.7648 9.99969C18.7648 8.32808 18.2365 6.77984 17.3379 5.51279L16.1137 6.37988C16.8387 7.4021 17.2648 8.65114 17.2648 9.99969C17.2648 11.3496 16.8378 12.5998 16.1116 13.6226L17.3357 14.4897Z",fill:"currentColor"}))},42290:(e,t,n)=>{"use strict";n.d(t,{$L:()=>p.$L,$u:()=>p.$u,C3:()=>u.C3,Eo:()=>u.Eo,JP:()=>m.JP,L$:()=>i.Z,LB:()=>m.LB,MW:()=>u.MW,OS:()=>o.Z,Qf:()=>c.Qf,Qr:()=>c.Qr,Rc:()=>l.Z,X_:()=>d.X_,Y:()=>p.Y,ZK:()=>u.ZK,_T:()=>a.Z,bC:()=>p.bC,cH:()=>s.Z,co:()=>p.co,cv:()=>p.cv,g:()=>m.g,oN:()=>d.oN,pw:()=>r.Z,q4:()=>p.q4,rp:()=>u.rp,u_:()=>c.u_,v_:()=>c.v_,xi:()=>u.xi});n(2890),n(56694),n(67742),n(46961);var r=n(42194),a=n(13109),s=n(93509),o=n(44696),i=n(92718),l=n(70286),c=n(59822),u=n(58890),d=n(20281),p=n(16700),m=n(35613)},2890:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(13419),a=n(51128),s=n.n(a),o=n(87309);const i=s()("jetpack-ai-client:jwt"),l="jetpack-ai-jwt",c=12e4;async function u({apiNonce:e,siteId:t,expirationTime:n}={}){e=e||window.JP_CONNECTION_INITIAL_STATE.apiNonce,t=t||window.JP_CONNECTION_INITIAL_STATE.siteSuffix,n=n||c;const a=(0,r.Wp)(),s=localStorage.getItem(l);let u,d=null;if(s)try{d=JSON.parse(s)}catch(e){i("Error parsing token",e)}if(d&&d?.expire>Date.now())return i("Using cached token"),d;u=a?await(0,o.Z)({path:"/wpcom/v2/sites/"+t+"/jetpack-openai-query/jwt",method:"POST"}):await(0,o.Z)({path:"/jetpack/v4/jetpack-ai-jwt?_cacheBuster="+Date.now(),credentials:"same-origin",headers:{"X-WP-Nonce":e},method:"POST"});const p={token:u.token,blogId:a?t:u.blog_id,expire:Date.now()+n};return i("Storing new token"),localStorage.setItem(l,JSON.stringify(p)),p}},35613:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.JP,LB:()=>r.LB,g:()=>r.g});var r=n(71197)},22999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(92213);const a={paragraph:e=>e.replaceAll("\n","
    ")},s={emDelimiter:"_",headingStyle:"atx"},o={strikethrough:{filter:["del","s"],replacement:function(e){return"~~"+e+"~~"}}};class i{constructor({options:e={},rules:t={},keep:n=[],remove:a=[],fixes:i=[]}={}){this.fixes=i,this.turndownService=new r.Z({...s,...e}),this.turndownService.keep(n),this.turndownService.remove(a);const l={...o,...t};for(const e in l)this.turndownService.addRule(e,l[e])}render({content:e}){const t=this.turndownService.turndown(e);return this.fixes.reduce(((e,t)=>a[t](e)),t)}}},71197:(e,t,n)=>{"use strict";n.d(t,{JP:()=>r.Z,LB:()=>o,g:()=>i});var r=n(22999);const a=new(n(28603).Z),s=new r.Z,o=({content:e,rules:t,extension:n})=>a.render({content:e,rules:t,extension:n}),i=({content:e})=>s.render({content:e})},28603:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(95601);const a=e=>e.replaceAll("\x3c!-- wp:list-item --\x3e","").replaceAll("\x3c!-- /wp:list-item --\x3e","").replaceAll("\x3c!-- wp:list --\x3e","").replaceAll("\x3c!-- /wp:list --\x3e","").replaceAll("
  • ","\x3c!-- wp:list-item --\x3e
  • ").replaceAll("
  • ","\x3c!-- /wp:list-item --\x3e").replaceAll("
      ",'\x3c!-- wp:list {"ordered":true} --\x3e
        ').replaceAll("
      ","
    \x3c!-- /wp:list --\x3e").replaceAll("\x3c!-- /wp:list --\x3e"),s={list:(e,t=!1)=>{const n=e.replace(/
  • \s+

    /g,"

  • ").replace(/<\/p>\s+<\/li>/g,"
  • ");return t?a(n):n},listItem:(e,t=!1)=>t?a(e.replace(/^<[ou]l>\s*/g,"").replace(/\s*<\/[ou]l>\s*$/g,"")):e,paragraph:(e,t=!1)=>t?e.replaceAll(/\s*<br \/>\s*/g,"
    "):e},o={breaks:!0},i=["list"];class l{constructor(e=o){this.markdownConverter=new r.Z(e)}render({content:e,rules:t=i,extension:n=!1}){const r=this.markdownConverter.render(e);return t.reduce(((e,t)=>s[t](e,n)),r)}}},56694:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(60400),a=n(51128),s=n.n(a),o=n(42194),i=n(2890),l=n(16700);const c=s()("jetpack-ai-client:suggestions-event-source");class u extends EventTarget{constructor(e){super(),this.fullMessage="",this.fullFunctionCall={name:"",arguments:""},this.isPromptClear=!1,this.controller=new AbortController,this.initEventSource(e)}async initEventSource({url:e,question:t,token:n,options:a={}}){if(!n)try{c("Token was not provided, requesting one..."),n=(await(0,i.Z)()).token}catch(e){return void this.processErrorEvent(e)}const s={};if(Number.isInteger(parseInt(a.postId))&&(s.post_id=+a.postId),!e){const t=new URL("https://public-api.wordpress.com/wpcom/v2/jetpack-ai-query");a?.fromCache&&t.searchParams.append("stream_cache","true"),e=t.toString(),c("URL not provided, using default: %o",e)}Array.isArray(t)?s.messages=t:s.question=t,a?.feature?.length&&(c("Feature: %o",a.feature),s.feature=a.feature),a?.functions?.length&&(c("Functions: %o",a.functions),s.functions=a.functions),a?.model?.length&&(c("Model: %o",a.model),s.model=a.model),this.errorUnclearPromptTriggered=!1,await(0,r.L)(e,{openWhenHidden:!0,method:"POST",headers:{"Content-type":"application/json",Authorization:"Bearer "+n},body:JSON.stringify(s),onclose:()=>{c("Stream closed")},onerror:e=>{throw this.processErrorEvent(e),e},onmessage:e=>{this.processEvent(e)},onopen:async e=>{if(e.ok)return;let t;throw e.status>=400&&e.status<=500&&![413,422,429].includes(e.status)&&(c("Connection error: %o",e),t=l.co,this.dispatchEvent(new CustomEvent(l.co,{detail:e}))),503===e.status&&(t=l.$u,this.dispatchEvent(new CustomEvent(l.$u))),413===e.status&&(t=l.cv,this.dispatchEvent(new CustomEvent(l.cv))),422===e.status&&(t=l.q4,this.dispatchEvent(new CustomEvent(l.q4))),429===e.status&&(t=l.$L,this.dispatchEvent(new CustomEvent(l.$L))),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(t)})),new Error},signal:this.controller.signal})}checkForUnclearPrompt(){if(this.isPromptClear)return;const e=this.fullMessage.replace(/__|(\*\*)/g,"");if(e.startsWith("JETPACK_AI_ERROR")){if(this.errorUnclearPromptTriggered)return;this.errorUnclearPromptTriggered=!0,this.dispatchEvent(new CustomEvent(l.bC)),c("Unclear error prompt dispatched"),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.bC)}))}else"JETPACK_AI_ERROR".startsWith(e)?c(this.fullMessage):this.isPromptClear=!0}close(){this.controller.abort()}processEvent(e){if("[DONE]"===e.data){if(this.errorUnclearPromptTriggered)return;if(this.fullMessage.length)return this.dispatchEvent(new CustomEvent("done",{detail:this.fullMessage})),void c("Done: %o",this.fullMessage);if(this.fullFunctionCall.name.length)return this.dispatchEvent(new CustomEvent("function_done",{detail:this.fullFunctionCall})),void c("Done: %o",this.fullFunctionCall)}let t;try{t=JSON.parse(e.data)}catch(t){return void c("Error parsing JSON",e,t)}const{delta:n}=t?.choices?.[0]??{delta:{content:null,function_call:null}},r=n.content,a=n.function_call;r&&(this.fullMessage+=r,this.checkForUnclearPrompt(),this.isPromptClear&&(this.dispatchEvent(new CustomEvent("chunk",{detail:r})),c("suggestion: %o",this.fullMessage),this.dispatchEvent(new CustomEvent("suggestion",{detail:this.fullMessage})))),a&&(null!=a.name&&(this.fullFunctionCall.name+=a.name),null!=a.arguments&&(this.fullFunctionCall.arguments+=a.arguments),this.dispatchEvent(new CustomEvent("functionCallChunk",{detail:this.fullFunctionCall})))}processErrorEvent(e){c("onerror: %o",e),this.dispatchEvent(new CustomEvent(l.co,{detail:e})),this.dispatchEvent(new CustomEvent(l.vF,{detail:(0,o.A)(l.co)}))}}},16700:(e,t,n)=>{"use strict";n.d(t,{$L:()=>s,$u:()=>a,Y:()=>r.Y,bC:()=>c,co:()=>l,cv:()=>i,q4:()=>o,vF:()=>u});var r=n(44696);const a="error_service_unavailable",s="error_quota_exceeded",o="error_moderation",i="error_context_too_large",l="error_network",c="error_unclear_prompt",u="error_response"},6975:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51128);const a=n.n(r)()("dops:analytics");let s,o;window._tkq=window._tkq||[],window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;const i={initialize:function(e,t,n){i.setUser(e,t),i.setSuperProps(n),i.identifyUser()},setGoogleAnalyticsEnabled:function(e,t=null){this.googleAnalyticsEnabled=e,this.googleAnalyticsKey=t},setMcAnalyticsEnabled:function(e){this.mcAnalyticsEnabled=e},setUser:function(e,t){o={ID:e,username:t}},setSuperProps:function(e){s=e},assignSuperProps:function(e){s=Object.assign(s||{},e)},mc:{bumpStat:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&x_"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Bumping stats %o",e)}else n="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Bumping stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+n+"&t="+Math.random())},bumpStatWithPageView:function(e,t){const n=function(e,t){let n="";if("object"==typeof e){for(const t in e)n+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t]);a("Built stats %o",e)}else n="&"+encodeURIComponent(e)+"="+encodeURIComponent(t),a('Built stat "%s" in group "%s"',t,e);return n}(e,t);i.mcAnalyticsEnabled&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom"+n+"&t="+Math.random())}},pageView:{record:function(e,t){i.tracks.recordPageView(e),i.ga.recordPageView(e,t)}},purchase:{record:function(e,t,n,r,a,s,o){i.ga.recordPurchase(e,t,n,r,a,s,o)}},tracks:{recordEvent:function(e,t){t=t||{},0===e.indexOf("akismet_")||0===e.indexOf("jetpack_")?(s&&(a("- Super Props: %o",s),t=Object.assign(t,s)),a('Record event "%s" called with props %s',e,JSON.stringify(t)),window._tkq.push(["recordEvent",e,t])):a('- Event name must be prefixed by "akismet_" or "jetpack_"')},recordJetpackClick:function(e){const t="object"==typeof e?e:{target:e};i.tracks.recordEvent("jetpack_wpa_click",t)},recordPageView:function(e){i.tracks.recordEvent("akismet_page_view",{path:e})},setOptOut:function(e){a("Pushing setOptOut: %o",e),window._tkq.push(["setOptOut",e])}},ga:{initialized:!1,initialize:function(){let e={};i.ga.initialized||(o&&(e={userId:"u-"+o.ID}),window.ga("create",this.googleAnalyticsKey,"auto",e),i.ga.initialized=!0)},recordPageView:function(e,t){i.ga.initialize(),a("Recording Page View ~ [URL: "+e+"] [Title: "+t+"]"),this.googleAnalyticsEnabled&&(window.ga("set","page",e),window.ga("send",{hitType:"pageview",page:e,title:t}))},recordEvent:function(e,t,n,r){i.ga.initialize();let s="Recording Event ~ [Category: "+e+"] [Action: "+t+"]";void 0!==n&&(s+=" [Option Label: "+n+"]"),void 0!==r&&(s+=" [Option Value: "+r+"]"),a(s),this.googleAnalyticsEnabled&&window.ga("send","event",e,t,n,r)},recordPurchase:function(e,t,n,r,a,s,o){window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",{id:e,revenue:r,currency:o}),window.ga("ecommerce:addItem",{id:e,name:t,sku:n,price:a,quantity:s}),window.ga("ecommerce:send")}},identifyUser:function(){o&&window._tkq.push(["identifyUser",o.ID,o.username])},setProperties:function(e){window._tkq.push(["setProperties",e])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}},l=i},64743:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>d});var r=n(61132),a=n(96483);function s(e){class t extends Error{constructor(...t){super(...t),this.name=e}}return t}const o=s("JsonParseError"),i=s("JsonParseAfterRedirectError"),l=s("Api404Error"),c=s("Api404AfterRedirectError"),u=s("FetchNetworkError");const d=new function(e,t){let n=e,s=e,o={"X-WP-Nonce":t},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})},c=function(e){const t=e.split("?"),n=t.length>1?t[1]:"",r=n.length?n.split("&"):[];return r.push("_cacheBuster="+(new Date).getTime()),t[0]+"?"+r.join("&")};const u={setApiRoot(e){n=e},setWpcomOriginApiUrl(e){s=e},setApiNonce(e){o={"X-WP-Nonce":e},i={credentials:"same-origin",headers:o},l={method:"post",credentials:"same-origin",headers:Object.assign({},o,{"Content-type":"application/json"})}},setCacheBusterCallback:e=>{c=e},registerSite:(e,t,a)=>{const s={registration_nonce:e,no_iframe:!0};return(0,r.jetpackConfigHas)("consumer_slug")&&(s.plugin_slug=(0,r.jetpackConfigGet)("consumer_slug")),null!==t&&(s.redirect_uri=t),a&&(s.from=a),g(`${n}jetpack/v4/connection/register`,l,{body:JSON.stringify(s)}).then(p).then(m)},fetchAuthorizationUrl:e=>d((0,a.addQueryArgs)(`${n}jetpack/v4/connection/authorize_url`,{no_iframe:"1",redirect_uri:e}),i).then(p).then(m),fetchSiteConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchSiteConnectionStatus:()=>d(`${n}jetpack/v4/connection`,i).then(m),fetchSiteConnectionTest:()=>d(`${n}jetpack/v4/connection/test`,i).then(p).then(m),fetchUserConnectionData:()=>d(`${n}jetpack/v4/connection/data`,i).then(m),fetchUserTrackingSettings:()=>d(`${n}jetpack/v4/tracking/settings`,i).then(p).then(m),updateUserTrackingSettings:e=>g(`${n}jetpack/v4/tracking/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),disconnectSite:()=>g(`${n}jetpack/v4/connection`,l,{body:JSON.stringify({isActive:!1})}).then(p).then(m),fetchConnectUrl:()=>d(`${n}jetpack/v4/connection/url`,i).then(p).then(m),unlinkUser:()=>g(`${n}jetpack/v4/connection/user`,l,{body:JSON.stringify({linked:!1})}).then(p).then(m),reconnect:()=>g(`${n}jetpack/v4/connection/reconnect`,l).then(p).then(m),fetchConnectedPlugins:()=>d(`${n}jetpack/v4/connection/plugins`,i).then(p).then(m),setHasSeenWCConnectionModal:()=>g(`${n}jetpack/v4/seen-wc-connection-modal`,l).then(p).then(m),fetchModules:()=>d(`${n}jetpack/v4/module/all`,i).then(p).then(m),fetchModule:e=>d(`${n}jetpack/v4/module/${e}`,i).then(p).then(m),activateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!0})}).then(p).then(m),deactivateModule:e=>g(`${n}jetpack/v4/module/${e}/active`,l,{body:JSON.stringify({active:!1})}),updateModuleOptions:(e,t)=>g(`${n}jetpack/v4/module/${e}`,l,{body:JSON.stringify(t)}).then(p).then(m),updateSettings:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),getProtectCount:()=>d(`${n}jetpack/v4/module/protect/data`,i).then(p).then(m),resetOptions:e=>g(`${n}jetpack/v4/options/${e}`,l,{body:JSON.stringify({reset:!0})}).then(p).then(m),activateVaultPress:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"vaultpress",status:"active"})}).then(p).then(m),getVaultPressData:()=>d(`${n}jetpack/v4/module/vaultpress/data`,i).then(p).then(m),installPlugin:(e,t)=>{const r={slug:e,status:"active"};return t&&(r.source=t),g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify(r)}).then(p).then(m)},activateAkismet:()=>g(`${n}jetpack/v4/plugins`,l,{body:JSON.stringify({slug:"akismet",status:"active"})}).then(p).then(m),getAkismetData:()=>d(`${n}jetpack/v4/module/akismet/data`,i).then(p).then(m),checkAkismetKey:()=>d(`${n}jetpack/v4/module/akismet/key/check`,i).then(p).then(m),checkAkismetKeyTyped:e=>g(`${n}jetpack/v4/module/akismet/key/check`,l,{body:JSON.stringify({api_key:e})}).then(p).then(m),fetchStatsData:e=>d(function(e){let t=`${n}jetpack/v4/module/stats/data`;-1!==t.indexOf("?")?t+=`&range=${encodeURIComponent(e)}`:t+=`?range=${encodeURIComponent(e)}`;return t}(e),i).then(p).then(m).then(h),getPluginUpdates:()=>d(`${n}jetpack/v4/updates/plugins`,i).then(p).then(m),getPlans:()=>d(`${n}jetpack/v4/plans`,i).then(p).then(m),fetchSettings:()=>d(`${n}jetpack/v4/settings`,i).then(p).then(m),updateSetting:e=>g(`${n}jetpack/v4/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSiteData:()=>d(`${n}jetpack/v4/site`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteFeatures:()=>d(`${n}jetpack/v4/site/features`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteProducts:()=>d(`${n}jetpack/v4/site/products`,i).then(p).then(m),fetchSitePurchases:()=>d(`${n}jetpack/v4/site/purchases`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteBenefits:()=>d(`${n}jetpack/v4/site/benefits`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchSiteDiscount:()=>d(`${n}jetpack/v4/site/discount`,i).then(p).then(m).then((e=>e.data)),fetchSetupQuestionnaire:()=>d(`${n}jetpack/v4/setup/questionnaire`,i).then(p).then(m),fetchRecommendationsData:()=>d(`${n}jetpack/v4/recommendations/data`,i).then(p).then(m),fetchRecommendationsProductSuggestions:()=>d(`${n}jetpack/v4/recommendations/product-suggestions`,i).then(p).then(m),fetchRecommendationsUpsell:()=>d(`${n}jetpack/v4/recommendations/upsell`,i).then(p).then(m),fetchRecommendationsConditional:()=>d(`${n}jetpack/v4/recommendations/conditional`,i).then(p).then(m),saveRecommendationsData:e=>g(`${n}jetpack/v4/recommendations/data`,l,{body:JSON.stringify({data:e})}).then(p),fetchProducts:()=>d(`${n}jetpack/v4/products`,i).then(p).then(m),fetchRewindStatus:()=>d(`${n}jetpack/v4/rewind`,i).then(p).then(m).then((e=>JSON.parse(e.data))),fetchScanStatus:()=>d(`${n}jetpack/v4/scan`,i).then(p).then(m).then((e=>JSON.parse(e.data))),dismissJetpackNotice:e=>g(`${n}jetpack/v4/notice/${e}`,l,{body:JSON.stringify({dismissed:!0})}).then(p).then(m),fetchPluginsData:()=>d(`${n}jetpack/v4/plugins`,i).then(p).then(m),fetchIntroOffers:()=>d(`${n}jetpack/v4/intro-offers`,i).then(p).then(m),fetchVerifySiteGoogleStatus:e=>d(null!==e?`${n}jetpack/v4/verify-site/google/${e}`:`${n}jetpack/v4/verify-site/google`,i).then(p).then(m),verifySiteGoogle:e=>g(`${n}jetpack/v4/verify-site/google`,l,{body:JSON.stringify({keyring_id:e})}).then(p).then(m),submitSurvey:e=>g(`${n}jetpack/v4/marketing/survey`,l,{body:JSON.stringify(e)}).then(p).then(m),saveSetupQuestionnaire:e=>g(`${n}jetpack/v4/setup/questionnaire`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicensingError:e=>g(`${n}jetpack/v4/licensing/error`,l,{body:JSON.stringify(e)}).then(p).then(m),updateLicenseKey:e=>g(`${n}jetpack/v4/licensing/set-license`,l,{body:JSON.stringify({license:e})}).then(p).then(m),getUserLicensesCounts:()=>d(`${n}jetpack/v4/licensing/user/counts`,i).then(p).then(m),getUserLicenses:()=>d(`${n}jetpack/v4/licensing/user/licenses`,i).then(p).then(m),updateLicensingActivationNoticeDismiss:e=>g(`${n}jetpack/v4/licensing/user/activation-notice-dismiss`,l,{body:JSON.stringify({last_detached_count:e})}).then(p).then(m),updateRecommendationsStep:e=>g(`${n}jetpack/v4/recommendations/step`,l,{body:JSON.stringify({step:e})}).then(p),confirmIDCSafeMode:()=>g(`${n}jetpack/v4/identity-crisis/confirm-safe-mode`,l).then(p),startIDCFresh:e=>g(`${n}jetpack/v4/identity-crisis/start-fresh`,l,{body:JSON.stringify({redirect_uri:e})}).then(p).then(m),migrateIDC:()=>g(`${n}jetpack/v4/identity-crisis/migrate`,l).then(p),attachLicenses:e=>g(`${n}jetpack/v4/licensing/attach-licenses`,l,{body:JSON.stringify({licenses:e})}).then(p).then(m),fetchSearchPlanInfo:()=>d(`${s}jetpack/v4/search/plan`,i).then(p).then(m),fetchSearchSettings:()=>d(`${s}jetpack/v4/search/settings`,i).then(p).then(m),updateSearchSettings:e=>g(`${s}jetpack/v4/search/settings`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchSearchStats:()=>d(`${s}jetpack/v4/search/stats`,i).then(p).then(m),fetchWafSettings:()=>d(`${n}jetpack/v4/waf`,i).then(p).then(m),updateWafSettings:e=>g(`${n}jetpack/v4/waf`,l,{body:JSON.stringify(e)}).then(p).then(m),fetchWordAdsSettings:()=>d(`${n}jetpack/v4/wordads/settings`,i).then(p).then(m),updateWordAdsSettings:e=>g(`${n}jetpack/v4/wordads/settings`,l,{body:JSON.stringify(e)}),fetchSearchPricing:()=>d(`${s}jetpack/v4/search/pricing`,i).then(p).then(m),fetchMigrationStatus:()=>d(`${n}jetpack/v4/migration/status`,i).then(p).then(m),fetchBackupUndoEvent:()=>d(`${n}jetpack/v4/site/backup/undo-event`,i).then(p).then(m),fetchBackupPreflightStatus:()=>d(`${n}jetpack/v4/site/backup/preflight`,i).then(p).then(m)};function d(e,t){return fetch(c(e),t)}function g(e,t,n){return fetch(e,Object.assign({},t,n)).catch(A)}function h(e){return e.general&&void 0===e.general.response||e.week&&void 0===e.week.response||e.month&&void 0===e.month.response?e:{}}Object.assign(this,u)};function p(e){return e.status>=200&&e.status<300?e:404===e.status?new Promise((()=>{throw e.redirected?new c(e.redirected):new l})):e.json().catch((e=>g(e))).then((t=>{const n=new Error(`${t.message} (Status ${e.status})`);throw n.response=t,n.name="ApiError",n}))}function m(e){return e.json().catch((t=>g(t,e.redirected,e.url)))}function g(e,t,n){throw t?new i(n):new o}function A(){throw new u}},90526:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(82674),a=n.n(r),s=n(55609),o=n(65736),i=n(61074),l=n(15381),c=n(65235),u=n.n(c),d=n(99196),p=n.n(d),m=n(62103);const __=o.__,g=(0,d.forwardRef)(((e,t)=>{const{children:n,variant:r="primary",size:o="normal",weight:c="bold",icon:d,iconSize:g,disabled:A,isDestructive:h,isLoading:E,isExternalLink:f,className:b,text:C,fullWidth:v,...k}=e,B=u()(m.Z.button,b,{[m.Z.normal]:"normal"===o,[m.Z.small]:"small"===o,[m.Z.icon]:Boolean(d),[m.Z.loading]:E,[m.Z.regular]:"regular"===c,[m.Z["full-width"]]:v,[m.Z["is-icon-button"]]:Boolean(d)&&!n});k.ref=t;const y="normal"===o?20:16,w=f&&p().createElement(p().Fragment,null,p().createElement(i.Z,{size:y,icon:l.Z,className:m.Z["external-icon"]}),p().createElement(s.VisuallyHidden,{as:"span"},/* translators: accessibility text */ __("(opens in a new tab)","jetpack"))),_=f?"_blank":void 0,I=n?.[0]&&null!==n[0]&&"components-tooltip"!==n?.[0]?.props?.className;return p().createElement(s.Button,a()({target:_,variant:r,className:u()(B,{"has-text":!!d&&I}),icon:f?void 0:d,iconSize:g,disabled:A,"aria-disabled":A,isDestructive:h,text:C},k),E&&p().createElement(s.Spinner,null),p().createElement("span",null,n),w)}));g.displayName="Button";const A=g},14203:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(82674),a=n.n(r),s=n(94333),o=n(69307),i=n(65736),l=n(90526),c=n(3396);const __=i.__,u=({buttonStyle:e="icon",textToCopy:t,onCopy:n,...r})=>{const[i,u]=(0,o.useState)(!1),d=(0,o.useRef)(),p=(0,s.useCopyToClipboard)(t,(()=>{d.current&&clearTimeout(d.current),u(!0),n?.(),d.current=setTimeout((()=>{u(!1),d.current=void 0}),3e3)}));(0,o.useEffect)((()=>()=>{d.current&&clearTimeout(d.current)}),[]);let m=null,g=null;"text"!==e&&(m=i?React.createElement(c.KM,null):React.createElement(c.Km,null));const A=__("Copy to clipboard","jetpack");return"icon"!==e&&(g=i?__("Copied!","jetpack"):A),React.createElement(l.Z,a()({"aria-label":A,icon:m,children:g,ref:p},r))}},60068:(e,t,n)=>{"use strict";n.d(t,{_:()=>s});var r=n(9818),a=n(53961);function s(){const e=(0,r.useDispatch)(a.store),t=(0,r.useSelect)((e=>e(a.store).getNotices()),[]);return{...e,createNotice:(t,n,r)=>e.createNotice(t,n,{type:"snackbar",...r}),createErrorNotice:(t,n)=>e.createErrorNotice(t,{type:"snackbar",...n}),createInfoNotice:(t,n)=>e.createInfoNotice(t,{type:"snackbar",...n}),createSuccessNotice:(t,n)=>e.createSuccessNotice(t,{type:"snackbar",...n}),createWarningNotice:(t,n)=>e.createWarningNotice(t,{type:"snackbar",...n}),getNotices:()=>t}}},67172:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(65736),a=n(65235),s=n.n(a),o=n(99196);n(53351);const __=r.__;class i extends o.Component{static defaultProps={"aria-hidden":"false",focusable:"true"};needsOffset(e,t){return["gridicons-arrow-left","gridicons-arrow-right","gridicons-calendar","gridicons-cart","gridicons-folder","gridicons-info","gridicons-info-outline","gridicons-posts","gridicons-star-outline","gridicons-star"].indexOf(e)>=0&&t%18==0}getSVGDescription(e){if("description"in this.props)return this.props.description;switch(e){default:return"";case"gridicons-audio":return __("Has audio.","jetpack");case"gridicons-arrow-left":return __("Arrow left","jetpack");case"gridicons-arrow-right":return __("Arrow right","jetpack");case"gridicons-calendar":return __("Is an event.","jetpack");case"gridicons-cart":return __("Is a product.","jetpack");case"chevron-down":return __("Show filters","jetpack");case"gridicons-comment":return __("Matching comment.","jetpack");case"gridicons-cross":return __("Close.","jetpack");case"gridicons-filter":return __("Toggle search filters.","jetpack");case"gridicons-folder":return __("Category","jetpack");case"gridicons-info":case"gridicons-info-outline":return __("Information.","jetpack");case"gridicons-image-multiple":return __("Has multiple images.","jetpack");case"gridicons-image":return __("Has an image.","jetpack");case"gridicons-page":return __("Page","jetpack");case"gridicons-post":return __("Post","jetpack");case"gridicons-jetpack-search":case"gridicons-search":return __("Magnifying Glass","jetpack");case"gridicons-tag":return __("Tag","jetpack");case"gridicons-video":return __("Has a video.","jetpack")}}renderIcon(e){switch(e){default:return null;case"gridicons-audio":return React.createElement("g",null,React.createElement("path",{d:"M8 4v10.184C7.686 14.072 7.353 14 7 14c-1.657 0-3 1.343-3 3s1.343 3 3 3 3-1.343 3-3V7h7v4.184c-.314-.112-.647-.184-1-.184-1.657 0-3 1.343-3 3s1.343 3 3 3 3-1.343 3-3V4H8z"}));case"gridicons-arrow-left":return React.createElement("g",null,React.createElement("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"}));case"gridicons-arrow-right":return React.createElement("g",null,React.createElement("path",{d:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z"}));case"gridicons-block":return React.createElement("g",null,React.createElement("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12c0-4.418 3.582-8 8-8 1.848 0 3.545.633 4.9 1.686L5.686 16.9C4.633 15.545 4 13.848 4 12zm8 8c-1.848 0-3.546-.633-4.9-1.686L18.314 7.1C19.367 8.455 20 10.152 20 12c0 4.418-3.582 8-8 8z"}));case"gridicons-calendar":return React.createElement("g",null,React.createElement("path",{d:"M19 4h-1V2h-2v2H8V2H6v2H5c-1.105 0-2 .896-2 2v13c0 1.104.895 2 2 2h14c1.104 0 2-.896 2-2V6c0-1.104-.896-2-2-2zm0 15H5V8h14v11z"}));case"gridicons-cart":return React.createElement("g",null,React.createElement("path",{d:"M9 20c0 1.1-.9 2-2 2s-1.99-.9-1.99-2S5.9 18 7 18s2 .9 2 2zm8-2c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm.396-5c.937 0 1.75-.65 1.952-1.566L21 5H7V4c0-1.105-.895-2-2-2H3v2h2v11c0 1.105.895 2 2 2h12c0-1.105-.895-2-2-2H7v-2h10.396z"}));case"gridicons-checkmark":return React.createElement("g",null,React.createElement("path",{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658C17.823 3.39 15.075 2 12 2 6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-1.528-.353-2.97-.966-4.266L11 17.768z"}));case"gridicons-chevron-left":return React.createElement("g",null,React.createElement("path",{d:"M16.443 7.41L15.0399 6L9.06934 12L15.0399 18L16.443 16.59L11.8855 12L16.443 7.41Z"}));case"gridicons-chevron-right":return React.createElement("g",null,React.createElement("path",{d:"M10.2366 6L8.8335 7.41L13.391 12L8.8335 16.59L10.2366 18L16.2072 12L10.2366 6Z"}));case"gridicons-chevron-down":return React.createElement("g",null,React.createElement("path",{d:"M20 9l-8 8-8-8 1.414-1.414L12 14.172l6.586-6.586"}));case"gridicons-comment":return React.createElement("g",null,React.createElement("path",{d:"M3 6v9c0 1.105.895 2 2 2h9v5l5.325-3.804c1.05-.75 1.675-1.963 1.675-3.254V6c0-1.105-.895-2-2-2H5c-1.105 0-2 .895-2 2z"}));case"gridicons-computer":return React.createElement("g",null,React.createElement("path",{d:"M20 2H4c-1.104 0-2 .896-2 2v12c0 1.104.896 2 2 2h6v2H7v2h10v-2h-3v-2h6c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm0 14H4V4h16v12z"}));case"gridicons-cross":return React.createElement("g",null,React.createElement("path",{d:"M18.36 19.78L12 13.41l-6.36 6.37-1.42-1.42L10.59 12 4.22 5.64l1.42-1.42L12 10.59l6.36-6.36 1.41 1.41L13.41 12l6.36 6.36z"}));case"gridicons-filter":return React.createElement("g",null,React.createElement("path",{d:"M10 19h4v-2h-4v2zm-4-6h12v-2H6v2zM3 5v2h18V5H3z"}));case"gridicons-folder":return React.createElement("g",null,React.createElement("path",{d:"M18 19H6c-1.1 0-2-.9-2-2V7c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2h7c1.1 0 2 .9 2 2v8c0 1.1-.9 2-2 2z"}));case"gridicons-image":return React.createElement("g",null,React.createElement("path",{d:"M13 9.5c0-.828.672-1.5 1.5-1.5s1.5.672 1.5 1.5-.672 1.5-1.5 1.5-1.5-.672-1.5-1.5zM22 6v12c0 1.105-.895 2-2 2H4c-1.105 0-2-.895-2-2V6c0-1.105.895-2 2-2h16c1.105 0 2 .895 2 2zm-2 0H4v7.444L8 9l5.895 6.55 1.587-1.85c.798-.932 2.24-.932 3.037 0L20 15.426V6z"}));case"gridicons-image-multiple":return React.createElement("g",null,React.createElement("path",{d:"M15 7.5c0-.828.672-1.5 1.5-1.5s1.5.672 1.5 1.5S17.328 9 16.5 9 15 8.328 15 7.5zM4 20h14c0 1.105-.895 2-2 2H4c-1.1 0-2-.9-2-2V8c0-1.105.895-2 2-2v14zM22 4v12c0 1.105-.895 2-2 2H8c-1.105 0-2-.895-2-2V4c0-1.105.895-2 2-2h12c1.105 0 2 .895 2 2zM8 4v6.333L11 7l4.855 5.395.656-.73c.796-.886 2.183-.886 2.977 0l.513.57V4H8z"}));case"gridicons-info":return React.createElement("g",null,React.createElement("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"}));case"gridicons-info-outline":return React.createElement("g",null,React.createElement("path",{d:"M13 9h-2V7h2v2zm0 2h-2v6h2v-6zm-1-7c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8m0-2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2z"}));case"gridicons-jetpack-search":return React.createElement("g",null,React.createElement("path",{d:"M0 9.257C0 4.15 4.151 0 9.257 0c5.105 0 9.256 4.151 9.256 9.257a9.218 9.218 0 01-2.251 6.045l.034.033h1.053L24 22.01l-1.986 1.989-6.664-6.662v-1.055l-.033-.033a9.218 9.218 0 01-6.06 2.264C4.15 18.513 0 14.362 0 9.257zm4.169 1.537h4.61V1.82l-4.61 8.973zm5.547-3.092v8.974l4.61-8.974h-4.61z"}));case"gridicons-phone":return React.createElement("g",null,React.createElement("path",{d:"M16 2H8c-1.104 0-2 .896-2 2v16c0 1.104.896 2 2 2h8c1.104 0 2-.896 2-2V4c0-1.104-.896-2-2-2zm-3 19h-2v-1h2v1zm3-2H8V5h8v14z"}));case"gridicons-pages":return React.createElement("g",null,React.createElement("path",{d:"M16 8H8V6h8v2zm0 2H8v2h8v-2zm4-6v12l-6 6H6c-1.105 0-2-.895-2-2V4c0-1.105.895-2 2-2h12c1.105 0 2 .895 2 2zm-2 10V4H6v16h6v-4c0-1.105.895-2 2-2h4z"}));case"gridicons-posts":return React.createElement("g",null,React.createElement("path",{d:"M16 19H3v-2h13v2zm5-10H3v2h18V9zM3 5v2h11V5H3zm14 0v2h4V5h-4zm-6 8v2h10v-2H11zm-8 0v2h5v-2H3z"}));case"gridicons-search":return React.createElement("g",null,React.createElement("path",{d:"M21 19l-5.154-5.154C16.574 12.742 17 11.42 17 10c0-3.866-3.134-7-7-7s-7 3.134-7 7 3.134 7 7 7c1.42 0 2.742-.426 3.846-1.154L19 21l2-2zM5 10c0-2.757 2.243-5 5-5s5 2.243 5 5-2.243 5-5 5-5-2.243-5-5z"}));case"gridicons-star-outline":return React.createElement("g",null,React.createElement("path",{d:"M12 6.308l1.176 3.167.347.936.997.042 3.374.14-2.647 2.09-.784.62.27.963.91 3.25-2.813-1.872-.83-.553-.83.552-2.814 1.87.91-3.248.27-.962-.783-.62-2.648-2.092 3.374-.14.996-.04.347-.936L12 6.308M12 2L9.418 8.953 2 9.257l5.822 4.602L5.82 21 12 16.89 18.18 21l-2.002-7.14L22 9.256l-7.418-.305L12 2z"}));case"gridicons-star":return React.createElement("g",null,React.createElement("path",{d:"M12 2l2.582 6.953L22 9.257l-5.822 4.602L18.18 21 12 16.89 5.82 21l2.002-7.14L2 9.256l7.418-.304"}));case"gridicons-tag":return React.createElement("g",null,React.createElement("path",{d:"M20 2.007h-7.087c-.53 0-1.04.21-1.414.586L2.592 11.5c-.78.78-.78 2.046 0 2.827l7.086 7.086c.78.78 2.046.78 2.827 0l8.906-8.906c.376-.374.587-.883.587-1.413V4.007c0-1.105-.895-2-2-2zM17.007 9c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2z"}));case"gridicons-video":return React.createElement("g",null,React.createElement("path",{d:"M20 4v2h-2V4H6v2H4V4c-1.105 0-2 .895-2 2v12c0 1.105.895 2 2 2v-2h2v2h12v-2h2v2c1.105 0 2-.895 2-2V6c0-1.105-.895-2-2-2zM6 16H4v-3h2v3zm0-5H4V8h2v3zm4 4V9l4.5 3-4.5 3zm10 1h-2v-3h2v3zm0-5h-2V8h2v3z"}));case"gridicons-lock":return React.createElement(React.Fragment,null,React.createElement("g",{id:"lock"},React.createElement("path",{d:"M18,8h-1V7c0-2.757-2.243-5-5-5S7,4.243,7,7v1H6c-1.105,0-2,0.895-2,2v10c0,1.105,0.895,2,2,2h12c1.105,0,2-0.895,2-2V10 C20,8.895,19.105,8,18,8z M9,7c0-1.654,1.346-3,3-3s3,1.346,3,3v1H9V7z M13,15.723V18h-2v-2.277c-0.595-0.346-1-0.984-1-1.723 c0-1.105,0.895-2,2-2s2,0.895,2,2C14,14.738,13.595,15.376,13,15.723z"})),React.createElement("g",{id:"Layer_1"}));case"gridicons-external":return React.createElement("g",null,React.createElement("path",{d:"M19 13v6c0 1.105-.895 2-2 2H5c-1.105 0-2-.895-2-2V7c0-1.105.895-2 2-2h6v2H5v12h12v-6h2zM13 3v2h4.586l-7.793 7.793 1.414 1.414L19 6.414V11h2V3h-8z"}))}}render(){const{size:e=24,className:t=""}=this.props,n=this.props.height||e,r=this.props.width||e,a=this.props.style||{height:n,width:r},o="gridicons-"+this.props.icon,i=s()("gridicon",o,t,{"needs-offset":this.needsOffset(o,e)}),l=this.getSVGDescription(o);return React.createElement("svg",{className:i,focusable:this.props.focusable,height:n,onClick:this.props.onClick,style:a,viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg","aria-hidden":this.props["aria-hidden"]},l?React.createElement("desc",null,l):null,this.renderIcon(o))}}const l=i},69665:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(55609),a=n(65235),s=n.n(a),o=n(99196),i=n.n(o),l=n(90526),c=n(67172);n(72098);const u=e=>({"top-end":"top left",top:"top center","top-start":"top right","bottom-end":"bottom left",bottom:"bottom center","bottom-start":"bottom right"}[e]),d=({className:e="",iconClassName:t="",placement:n="bottom-end",animate:a=!0,iconCode:d="info-outline",iconSize:p=18,offset:m=10,title:g,children:A,popoverAnchorStyle:h="icon",forceShow:E=!1,wide:f=!1,inline:b=!0,shift:C=!1})=>{const[v,k]=(0,o.useState)(!1),B=(0,o.useCallback)((()=>k(!1)),[k]),y=(0,o.useCallback)((e=>{e.preventDefault(),k(!v)}),[v,k]),w={position:u(n),placement:n,animate:a,noArrow:!1,resize:!1,flip:!1,offset:m,focusOnMount:"container",onClose:B,className:"icon-tooltip-container",inline:b,shift:C},_="wrapper"===h,I=s()("icon-tooltip-wrapper",e),j={left:_?0:-(62-p/2)+"px"},x=_&&E;return i().createElement("div",{className:I,"data-testid":"icon-tooltip_wrapper"},!_&&i().createElement(l.Z,{variant:"link",onMouseDown:y},i().createElement(c.Z,{className:t,icon:d,size:p})),i().createElement("div",{className:s()("icon-tooltip-helper",{"is-wide":f}),style:j},(x||v)&&i().createElement(r.Popover,w,i().createElement("div",null,g&&i().createElement("div",{className:"icon-tooltip-title"},g),i().createElement("div",{className:"icon-tooltip-content"},A)))))}},3396:(e,t,n)=>{"use strict";n.d(t,{KM:()=>d,Km:()=>p,av:()=>m});var r=n(82674),a=n.n(r),s=n(55609),o=n(65235),i=n.n(o),l=n(56286),c=n(45460);const u=({className:e,size:t=24,viewBox:n="0 0 24 24",opacity:r=1,color:o="#2C3338",children:l})=>{const u={className:i()(c.Z.iconWrapper,e),width:t,height:t,viewBox:n,opacity:r,fill:void 0};return o&&(u.fill=o),React.createElement(s.SVG,a()({},u,{fillRule:"evenodd",clipRule:"evenodd",xmlns:"http://www.w3.org/2000/svg"}),React.createElement(s.G,{opacity:r},l))},d=({size:e,className:t=c.Z["checkmark-icon"],color:n})=>React.createElement(u,{className:t,size:e,color:n},React.createElement(s.Path,{d:"M11 17.768l-4.884-4.884 1.768-1.768L11 14.232l8.658-8.658C17.823 3.39 15.075 2 12 2 6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-1.528-.353-2.97-.966-4.266L11 17.768z"})),p=({size:e,className:t=c.Z["clipboard-icon"],color:n})=>React.createElement(u,{className:t,size:e,color:n},React.createElement(s.Path,{d:"M5.625 5.5H15.375C15.444 5.5 15.5 5.55596 15.5 5.625V15.375C15.5 15.444 15.444 15.5 15.375 15.5H5.625C5.55596 15.5 5.5 15.444 5.5 15.375V5.625C5.5 5.55596 5.55596 5.5 5.625 5.5ZM4 5.625C4 4.72754 4.72754 4 5.625 4H15.375C16.2725 4 17 4.72754 17 5.625V10V15.375C17 16.2725 16.2725 17 15.375 17C15.375 17 6.52246 17 5.625 17C4.72754 17 4 16.2725 4 15.375V5.625ZM18.5 17.2812V8.28125H20V17.2812C20 18.7995 18.7704 20 17.2511 20H6.25V18.5H17.2511C17.9409 18.5 18.5 17.9721 18.5 17.2812Z"}));const m=({serviceName:e,className:t,iconSize:n})=>React.createElement(l.ZP,{className:i()(c.Z.socialIcon,c.Z[e],t),icon:e,size:n||24})},78868:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(82674),a=n.n(r),s=n(65736),o=n(65235),i=n.n(o),l=n(99196),c=n.n(l);const __=s.__,u=({logoColor:e="#069e08",showText:t=!0,className:n,height:r=32,...s})=>{const o=t?"0 0 118 32":"0 0 32 32";return c().createElement("svg",a()({xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:o,className:i()("jetpack-logo",n),"aria-labelledby":"jetpack-logo-title",height:r},s,{role:"img"}),c().createElement("title",{id:"jetpack-logo-title"},__("Jetpack Logo","jetpack")),c().createElement("path",{fill:e,d:"M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"}),t&&c().createElement(c().Fragment,null,c().createElement("path",{d:"M41.3,26.6c-0.5-0.7-0.9-1.4-1.3-2.1c2.3-1.4,3-2.5,3-4.6V8h-3V6h6v13.4C46,22.8,45,24.8,41.3,26.6z"}),c().createElement("path",{d:"M65,18.4c0,1.1,0.8,1.3,1.4,1.3c0.5,0,2-0.2,2.6-0.4v2.1c-0.9,0.3-2.5,0.5-3.7,0.5c-1.5,0-3.2-0.5-3.2-3.1V12H60v-2h2.1V7.1 H65V10h4v2h-4V18.4z"}),c().createElement("path",{d:"M71,10h3v1.3c1.1-0.8,1.9-1.3,3.3-1.3c2.5,0,4.5,1.8,4.5,5.6s-2.2,6.3-5.8,6.3c-0.9,0-1.3-0.1-2-0.3V28h-3V10z M76.5,12.3 c-0.8,0-1.6,0.4-2.5,1.2v5.9c0.6,0.1,0.9,0.2,1.8,0.2c2,0,3.2-1.3,3.2-3.9C79,13.4,78.1,12.3,76.5,12.3z"}),c().createElement("path",{d:"M93,22h-3v-1.5c-0.9,0.7-1.9,1.5-3.5,1.5c-1.5,0-3.1-1.1-3.1-3.2c0-2.9,2.5-3.4,4.2-3.7l2.4-0.3v-0.3c0-1.5-0.5-2.3-2-2.3 c-0.7,0-2.3,0.5-3.7,1.1L84,11c1.2-0.4,3-1,4.4-1c2.7,0,4.6,1.4,4.6,4.7L93,22z M90,16.4l-2.2,0.4c-0.7,0.1-1.4,0.5-1.4,1.6 c0,0.9,0.5,1.4,1.3,1.4s1.5-0.5,2.3-1V16.4z"}),c().createElement("path",{d:"M104.5,21.3c-1.1,0.4-2.2,0.6-3.5,0.6c-4.2,0-5.9-2.4-5.9-5.9c0-3.7,2.3-6,6.1-6c1.4,0,2.3,0.2,3.2,0.5V13 c-0.8-0.3-2-0.6-3.2-0.6c-1.7,0-3.2,0.9-3.2,3.6c0,2.9,1.5,3.8,3.3,3.8c0.9,0,1.9-0.2,3.2-0.7V21.3z"}),c().createElement("path",{d:"M110,15.2c0.2-0.3,0.2-0.8,3.8-5.2h3.7l-4.6,5.7l5,6.3h-3.7l-4.2-5.8V22h-3V6h3V15.2z"}),c().createElement("path",{d:"M58.5,21.3c-1.5,0.5-2.7,0.6-4.2,0.6c-3.6,0-5.8-1.8-5.8-6c0-3.1,1.9-5.9,5.5-5.9s4.9,2.5,4.9,4.9c0,0.8,0,1.5-0.1,2h-7.3 c0.1,2.5,1.5,2.8,3.6,2.8c1.1,0,2.2-0.3,3.4-0.7C58.5,19,58.5,21.3,58.5,21.3z M56,15c0-1.4-0.5-2.9-2-2.9c-1.4,0-2.3,1.3-2.4,2.9 C51.6,15,56,15,56,15z"})))}},32054:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(94333),a=n(49710);const s=["sm","md","lg"],o=(e,t)=>{const n=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t],[i,l,c]=s,u={sm:(0,r.useMediaQuery)(a.Z[i]),md:(0,r.useMediaQuery)(a.Z[l]),lg:(0,r.useMediaQuery)(a.Z[c])};return n.map(((e,t)=>{const n=o[t];return n?((e,t,n)=>{const r=s.indexOf(e),a=r+1,o=t.includes("=");let i=[];return t.startsWith("<")&&(i=s.slice(0,o?a:r)),t.startsWith(">")&&(i=s.slice(o?r:a)),i?.length?i.some((e=>n[e])):n[e]})(e,n,u):u[e]}))}},22636:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(65235),a=n.n(r),s=n(99196),o=n.n(s),i=n(46409);const l=({children:e=null,width:t=null,height:n=null,className:r=""})=>o().createElement("div",{className:a()(i.Z.placeholder,r),style:{width:t,height:n}},e)},52947:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(98709);const a=(e,t={})=>{const n=(0,r.X)();return new Intl.NumberFormat(n,t).format(e)}},49777:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(28918);const a=({value:e="https://jetpack.com",bgColor:t,fgColor:n,level:a,includeMargin:s,imageSettings:o,renderAs:i="canvas",size:l=248})=>React.createElement(r.ZP,{value:e,size:l,bgColor:t,fgColor:n,level:a,includeMargin:s,imageSettings:o,renderAs:i})},43521:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(65736),a=n(65235),s=n.n(a),o=n(99196),i=n.n(o),l=n(52947);n(34086);const __=r.__,c=({totalCount:e,items:t=[],showLegendLabelBeforeCount:n=!1,sortByCount:r,className:a,tableCaption:c,legendTitle:u,recordTypeLabel:d,recordCountLabel:p})=>{const m=(0,o.useMemo)((()=>e||t.reduce(((e,{count:t})=>e+t),0)),[t,e]),g=(0,o.useMemo)((()=>r?[...t].sort(((e,t)=>"ascending"===r?e.count-t.count:t.count-e.count)):t),[t,r]);return i().createElement("div",{className:s()("record-meter-bar",a)},i().createElement("div",{className:"record-meter-bar__items","aria-hidden":"true"},g.map((({count:e,label:t,backgroundColor:n})=>{const r=(e/m*100).toPrecision(2);return i().createElement("div",{key:t,style:{backgroundColor:n,flexBasis:`${r}%`}})}))),i().createElement("div",{className:"record-meter-bar__legend","aria-hidden":"true"},u&&i().createElement("div",{className:"record-meter-bar__legend--title"},u),i().createElement("ul",{className:"record-meter-bar__legend--items"},g.map((({count:e,label:t,backgroundColor:r})=>{const a=(0,l.Z)(e);return i().createElement("li",{key:t,className:"record-meter-bar__legend--item"},i().createElement("div",{className:"record-meter-bar__legend--item-circle",style:{backgroundColor:r}}),!n&&i().createElement("span",null,i().createElement("span",{className:"record-meter-bar__legend--item-count"},a),i().createElement("span",{className:"record-meter-bar__legend--item-label"},t)),n&&i().createElement("span",null,i().createElement("span",{className:"record-meter-bar__legend--item-label record-meter-bar__legend--item-label-first"},t),i().createElement("span",{className:"record-meter-bar__legend--item-count"},"(",a,")")))})))),i().createElement("table",{className:"screen-reader-text"},i().createElement("caption",null,c||__("Summary of the records","jetpack")),i().createElement("tbody",null,i().createElement("tr",null,i().createElement("th",{scope:"col"},d||__("Record type","jetpack")),i().createElement("th",{scope:"col"},p||__("Record count","jetpack"))),g.map((({label:e,count:t})=>i().createElement("tr",{key:e},i().createElement("td",null,e),i().createElement("td",null,t)))))))}},45033:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(25162),a=n.n(r),s=n(99196),o=n.n(s);n(48026);const i=({color:e="#FFFFFF",className:t="",size:n=20})=>{const r=t+" jp-components-spinner",a={width:n,height:n,fontSize:n,borderTopColor:e},s={borderTopColor:e,borderRightColor:e};return o().createElement("div",{className:r},o().createElement("div",{className:"jp-components-spinner__outer",style:a},o().createElement("div",{className:"jp-components-spinner__inner",style:s})))};i.propTypes={color:a().string,className:a().string,size:a().number};const l=i},66017:(e,t,n)=>{"use strict";n.d(t,{h:()=>r,s:()=>a});const r={"headline-medium":"h1","headline-small":"h2","headline-small-regular":"h2","title-medium":"h3","title-medium-semi-bold":"h3","title-small":"h4",body:"p","body-small":"p","body-extra-small":"p","body-extra-small-bold":"p",label:"p"},a=["mt","mr","mb","ml","mx","my","m","pt","pr","pb","pl","px","py","p"]},45106:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>p});var r=n(82674),a=n.n(r),s=n(65235),o=n.n(s),i=n(99196),l=n.n(i),c=n(66017),u=n(85837);const d=(0,i.forwardRef)((({variant:e="body",children:t,component:n,className:r,...s},d)=>{const p=n||c.h[e]||"span",m=(0,i.useMemo)((()=>c.s.reduce(((e,t)=>(void 0!==s[t]&&(e+=u.Z[`${t}-${s[t]}`]+" ",delete s[t]),e)),"")),[s]);return s.ref=d,l().createElement(p,a()({className:o()(u.Z.reset,u.Z[e],r,m)},s),t)}));d.displayName="Text";const p=d},88275:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>p});var r=n(99196),a=n.n(r),s=n(93468);const o={"--font-headline-medium":"48px","--font-headline-small":"36px","--font-title-medium":"24px","--font-title-small":"20px","--font-body":"16px","--font-body-small":"14px","--font-body-extra-small":"12px","--font-title-large":"var(--font-headline-small)","--font-label":"var(--font-body-extra-small)"},i={"--jp-black":"#000000","--jp-black-80":"#2c3338","--jp-white":"#ffffff","--jp-white-off":"#f9f9f6","--jp-gray":"#dcdcde","--jp-gray-0":"#F6F7F7","--jp-gray-5":"var(--jp-gray)","--jp-gray-10":"#C3C4C7","--jp-gray-20":"#A7AAAD","--jp-gray-40":"#787C82","--jp-gray-50":"#646970","--jp-gray-60":"#50575E","--jp-gray-70":"#3C434A","--jp-gray-80":"#2C3338","--jp-gray-90":"#1d2327","--jp-gray-off":"#e2e2df","--jp-red-0":"#F7EBEC","--jp-red-5":"#FACFD2","--jp-red-40":"#E65054","--jp-red-50":"#D63638","--jp-red-60":"#B32D2E","--jp-red-70":"#8A2424","--jp-red-80":"#691C1C","--jp-red":"#d63639","--jp-yellow-5":"#F5E6B3","--jp-yellow-10":"#F2CF75","--jp-yellow-20":"#F0C930","--jp-yellow-30":"#DEB100","--jp-yellow-40":"#C08C00","--jp-yellow-50":"#9D6E00","--jp-yellow-60":"#7D5600","--jp-blue-20":"#68B3E8","--jp-blue-40":"#1689DB","--jp-pink":"#C9356E","--jp-green-0":"#f0f2eb","--jp-green-5":"#d0e6b8","--jp-green-10":"#9dd977","--jp-green-20":"#64ca43","--jp-green-30":"#2fb41f","--jp-green-40":"#069e08","--jp-green-50":"#008710","--jp-green-60":"#007117","--jp-green-70":"#005b18","--jp-green-80":"#004515","--jp-green-90":"#003010","--jp-green-100":"#001c09","--jp-green":"#069e08","--jp-green-primary":"var( --jp-green-40 )","--jp-green-secondary":"var( --jp-green-30 )"},l={"--jp-border-radius":"4px","--jp-menu-border-height":"1px","--jp-underline-thickness":"2px"},c={"--spacing-base":"8px"},u={},d=(e,t,n)=>{const r={...o,...i,...l,...c};for(const t in r)e.style.setProperty(t,r[t]);n&&e.classList.add(s.Z.global),t&&(u[t]={provided:!0,root:e})},p=({children:e=null,targetDom:t,id:n,withGlobalStyles:s=!0})=>{const o=(0,r.useRef)(),i=u?.[n]?.provided;return(0,r.useLayoutEffect)((()=>{if(!i)return t?d(t,n,s):void(o?.current&&d(o.current,n,s))}),[t,o,i,n,s]),t?a().createElement(a().Fragment,null,e):a().createElement("div",{ref:o},e)}},98709:(e,t,n)=>{"use strict";n.d(t,{X:()=>a});var r=n(69771);const a=()=>{const{l10n:{locale:e}}=(0,r.getSettings)();if(e)return(e=>{const t=e.match(/^([a-z]{2,3})(_[a-z]{2}|_[a-z][a-z0-9]{4,7})?(?:_.*)?$/i);return t?`${t[1]}${t[2]?t[2]:""}`.replace("_","-"):"en-US"})(e);return window?.window?.navigator?.language??"en-US"}},6895:(e,t,n)=>{"use strict";function r(e,t={}){const n={};let r;if("undefined"!=typeof window&&(r=window?.JP_CONNECTION_INITIAL_STATE?.calypsoEnv),0===e.search("https://")){const t=new URL(e);e=`https://${t.host}${t.pathname}`,n.url=encodeURIComponent(e)}else n.source=encodeURIComponent(e);for(const e in t)n[e]=encodeURIComponent(t[e]);!Object.keys(n).includes("site")&&"undefined"!=typeof jetpack_redirects&&jetpack_redirects.hasOwnProperty("currentSiteRawUrl")&&(n.site=jetpack_redirects.currentBlogID??jetpack_redirects.currentSiteRawUrl),r&&(n.calypso_env=r);return"https://jetpack.com/redirect/?"+Object.keys(n).map((e=>e+"="+n[e])).join("&")}n.d(t,{Z:()=>r})},61132:(e,t,n)=>{let r={};try{r=n(92787)}catch{console.error("jetpackConfig is missing in your webpack config file. See @automattic/jetpack-config"),r={missingConfig:!0}}const a=e=>r.hasOwnProperty(e);e.exports={jetpackConfigHas:a,jetpackConfigGet:e=>{if(!a(e))throw'This app requires the "'+e+'" Jetpack Config to be defined in your webpack configuration file. See details in @automattic/jetpack-config package docs.';return r[e]}}},31294:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(64743),a=n(9818),s=n(99196),o=n(80428);const i=window?.JP_CONNECTION_INITIAL_STATE?window.JP_CONNECTION_INITIAL_STATE:{},l=({registrationNonce:e=i.registrationNonce,apiRoot:t=i.apiRoot,apiNonce:n=i.apiNonce,redirectUri:l,autoTrigger:c,from:u,skipUserConnection:d}={})=>{const{registerSite:p,connectUser:m,refreshConnectedPlugins:g}=(0,a.useDispatch)(o.t),A=(0,a.useSelect)((e=>e(o.t).getRegistrationError())),{siteIsRegistering:h,userIsConnecting:E,userConnectionData:f,connectedPlugins:b,connectionErrors:C,isRegistered:v,isUserConnected:k,hasConnectedOwner:B,isOfflineMode:y}=(0,a.useSelect)((e=>({siteIsRegistering:e(o.t).getSiteIsRegistering(),userIsConnecting:e(o.t).getUserIsConnecting(),userConnectionData:e(o.t).getUserConnectionData(),connectedPlugins:e(o.t).getConnectedPlugins(),connectionErrors:e(o.t).getConnectionErrors(),isOfflineMode:e(o.t).getIsOfflineMode(),...e(o.t).getConnectionStatus()}))),w=()=>d?l?(window.location=l,Promise.resolve(l)):Promise.resolve():m({from:u,redirectUri:l}),_=t=>(t&&t.preventDefault(),v?w():p({registrationNonce:e,redirectUri:l,from:u}).then((()=>w())));return(0,s.useEffect)((()=>{r.ZP.setApiRoot(t),r.ZP.setApiNonce(n)}),[t,n]),(0,s.useEffect)((()=>{!c||h||E||_()}),[]),{handleRegisterSite:_,handleConnectUser:w,refreshConnectedPlugins:g,isRegistered:v,isUserConnected:k,siteIsRegistering:h,userIsConnecting:E,registrationError:A,userConnectionData:f,hasConnectedOwner:B,connectedPlugins:b,connectionErrors:C,isOfflineMode:y}}},27523:(e,t,n)=>{"use strict";n.d(t,{LI:()=>s,N4:()=>i,Qo:()=>d,T1:()=>c,TS:()=>u,ZP:()=>k,b5:()=>m,i6:()=>a,qJ:()=>g,qV:()=>l,r7:()=>o,wQ:()=>p});var r=n(64743);const a="SET_CONNECTION_STATUS",s="SET_CONNECTION_STATUS_IS_FETCHING",o="SET_SITE_IS_REGISTERING",i="SET_USER_IS_CONNECTING",l="SET_REGISTRATION_ERROR",c="CLEAR_REGISTRATION_ERROR",u="SET_AUTHORIZATION_URL",d="DISCONNECT_USER_SUCCESS",p="SET_CONNECTED_PLUGINS",m="SET_CONNECTION_ERRORS",g="SET_IS_OFFLINE_MODE",A=e=>({type:a,connectionStatus:e}),h=e=>({type:o,isRegistering:e}),E=e=>({type:i,isConnecting:e}),f=e=>({type:l,registrationError:e}),b=()=>({type:c}),C=e=>({type:u,authorizationUrl:e}),v=e=>({type:p,connectedPlugins:e});const k={setConnectionStatus:A,setConnectionStatusIsFetching:e=>({type:s,isFetching:e}),fetchConnectionStatus:()=>({type:"FETCH_CONNECTION_STATUS"}),fetchAuthorizationUrl:e=>({type:"FETCH_AUTHORIZATION_URL",redirectUri:e}),setSiteIsRegistering:h,setUserIsConnecting:E,setRegistrationError:f,clearRegistrationError:b,setAuthorizationUrl:C,registerSite:function*({registrationNonce:e,redirectUri:t,from:n=""}){yield b(),yield h(!0);try{const r=yield{type:"REGISTER_SITE",registrationNonce:e,redirectUri:t,from:n};return yield A({isRegistered:!0}),yield C(r.authorizeUrl),yield h(!1),Promise.resolve(r)}catch(e){return yield f(e),yield h(!1),Promise.reject(e)}},connectUser:function*({from:e,redirectFunc:t,redirectUri:n}={}){yield E(!0),yield{type:"CONNECT_USER",from:e,redirectFunc:t,redirectUri:n}},disconnectUserSuccess:()=>({type:d}),setConnectedPlugins:v,refreshConnectedPlugins:()=>async({dispatch:e})=>await new Promise((t=>r.ZP.fetchConnectedPlugins().then((n=>{e(v(n)),t(n)})))),setConnectionErrors:e=>({type:m,connectionErrors:e}),setIsOfflineMode:e=>({type:g,isOfflineMode:e})}},31432:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(64743),a=n(9818),s=n(27057);const o={FETCH_AUTHORIZATION_URL:({redirectUri:e})=>r.ZP.fetchAuthorizationUrl(e),REGISTER_SITE:({registrationNonce:e,redirectUri:t,from:n})=>r.ZP.registerSite(e,t,n),CONNECT_USER:(0,a.createRegistryControl)((({resolveSelect:e})=>({from:t,redirectFunc:n,redirectUri:r}={})=>new Promise(((a,o)=>{e(s.Z).getAuthorizationUrl(r).then((e=>{const r=n||(e=>window.location.assign(e)),s=new URL(e);t&&s.searchParams.set("from",encodeURIComponent(t));const o=s.toString();r(o),a(o)})).catch((e=>{o(e)}))}))))}},41479:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818),a=n(27523);const s=(0,r.combineReducers)({connectionStatus:(e={},t)=>{switch(t.type){case a.i6:return{...e,...t.connectionStatus};case a.Qo:return{...e,isUserConnected:!1}}return e},connectionStatusIsFetching:(e=!1,t)=>t.type===a.LI?t.isFetching:e,siteIsRegistering:(e=!1,t)=>t.type===a.r7?t.isRegistering:e,userIsConnecting:(e=!1,t)=>t.type===a.N4?t.isConnecting:e,registrationError:(e,t)=>{switch(t.type){case a.T1:return!1;case a.qV:return t.registrationError;default:return e}},authorizationUrl:(e,t)=>t.type===a.TS?t.authorizationUrl:e,userConnectionData:(e,t)=>(t.type,e),connectedPlugins:(e={},t)=>t.type===a.wQ?t.connectedPlugins:e,connectionErrors:(e={},t)=>t.type===a.b5?t.connectionErrors:e,isOfflineMode:(e=!1,t)=>t.type===a.qJ?t.isConnecting:e})},77728:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9818),a=n(27523),s=n(27057);const o={...{getAuthorizationUrl:{isFulfilled:(e,...t)=>{const n=Boolean(e.authorizationUrl),a=(0,r.select)(s.Z).hasFinishedResolution("getAuthorizationUrl",t);return n&&!a&&(0,r.dispatch)(s.Z).finishResolution("getAuthorizationUrl",t),n},*fulfill(e){const t=yield a.ZP.fetchAuthorizationUrl(e);yield a.ZP.setAuthorizationUrl(t.authorizeUrl)}}}}},82725:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r={...{getConnectionStatus:e=>e.connectionStatus||{},getConnectionStatusIsFetching:()=>!1,getSiteIsRegistering:e=>e.siteIsRegistering||!1,getUserIsConnecting:e=>e.userIsConnecting||!1,getRegistrationError:e=>e.registrationError||!1,getAuthorizationUrl:e=>e.authorizationUrl||!1,getUserConnectionData:e=>e.userConnectionData||!1,getConnectedPlugins:e=>e.connectedPlugins||[],getConnectionErrors:e=>e.connectionErrors||[],getIsOfflineMode:e=>e.isOfflineMode||!1,getWpcomUser:e=>e?.userConnectionData?.currentUser?.wpcomUser,getBlogId:e=>e?.userConnectionData?.currentUser?.blogId}}},13535:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(9818);class a{static store=null;static mayBeInit(e,t){null===a.store&&(a.store=(0,r.createReduxStore)(e,t),(0,r.register)(a.store))}}const s=a},27057:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r="jetpack-connection"},80428:(e,t,n)=>{"use strict";n.d(t,{t:()=>c.Z});var r=n(27523),a=n(31432),s=n(41479),o=n(77728),i=n(82725),l=n(13535),c=n(27057);const u=window.JP_CONNECTION_INITIAL_STATE;u||console.error("Jetpack Connection package: Initial state is missing. Check documentation to see how to use the Connection composer package to set up the initial state."),l.Z.mayBeInit(c.Z,{__experimentalUseThunks:!0,reducer:s.Z,actions:r.ZP,selectors:i.Z,resolvers:o.Z,controls:a.Z,initialState:u||{}})},81050:(e,t,n)=>{"use strict";n.d(t,{PostPublishManualSharing:()=>l.Z,PostPublishReviewPrompt:()=>i.Z,PublicizePanel:()=>o.Z,SocialImageGeneratorPanel:()=>s.Z,SocialPreviewsModal:()=>r.Z,SocialPreviewsPanel:()=>a.Z,usePublicizeConfig:()=>u.Z,useSocialMediaConnections:()=>c.Z,useSyncPostDataToStore:()=>p.N});n(23177),n(4277),n(49021),n(84703);var r=n(8454),a=n(74140),s=n(54005),o=(n(8350),n(76848),n(92116),n(79631),n(8714)),i=(n(19649),n(52403)),l=n(91750),c=(n(77106),n(75674),n(37568)),u=(n(48751),n(14085)),d=(n(45579),n(75323),n(42032));n.o(d,"useSyncPostDataToStore")&&n.d(t,{useSyncPostDataToStore:function(){return d.useSyncPostDataToStore}});n(91474);var p=n(19890);n(32637),n(86419),n(34431),n(71806),n(22917),n(95766)},92116:(e,t,n)=>{"use strict";n(9818),n(69307),n(99196),n(23177)},85761:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(3396),a=n(69307),s=n(65235),o=n.n(s),i=n(25162),l=n.n(i);const c=e=>{const{checked:t,serviceName:n,label:s,onClick:i,profilePicture:l}=e,[c,u]=(0,a.useState)(!!l),d=(0,a.useCallback)((()=>u(!1)),[]),p=(0,a.useCallback)((e=>{13===e.keyCode&&i()}),[i]);return React.createElement("div",{onClick:i,onKeyDown:p,role:"switch","aria-checked":t,tabIndex:"0",className:o()("components-connection-icon",{"components-connection-icon__picture":c})},c&&React.createElement("img",{src:l,alt:s,onError:d}),React.createElement(r.av,{alt:s,serviceName:"instagram-business"===n?"instagram":"twitter"===n?"x":n,className:"jetpack-publicize-gutenberg-social-icon"}))};c.propTypes={serviceName:l().string,label:l().string,profilePicture:l().string};const u=c},60676:(e,t,n)=>{"use strict";n(55609),n(65736),n(99196),n(85761),n(62878),n(25893),n(20841),n(43876),n(75124)},62878:(e,t,n)=>{"use strict";n.d(t,{d:()=>o});var r=n(55609),a=n(65736),s=n(75124);const __=a.__;function o({connection:e}){return e.display_name?React.createElement("div",{className:s.Z["connection-name"]},e.profile_link?React.createElement(r.ExternalLink,{className:s.Z["profile-link"],href:e.profile_link},e.display_name):React.createElement("span",{className:s.Z["profile-link"]},e.display_name)):React.createElement(r.Spinner,{color:"black","aria-label":__("Loading account details","jetpack")})}},25893:(e,t,n)=>{"use strict";n.d(t,{Q:()=>s});var r=n(65736),a=n(67660);const __=r.__;function s({connection:e,service:t,onConfirmReconnect:n}){return"broken"!==e.status?null:React.createElement("div",null,React.createElement("span",{className:"description"},__("There is an issue with this connection.","jetpack"))," ",React.createElement(a.w,{connection:e,service:t,onConfirmReconnect:n}))}},20841:(e,t,n)=>{"use strict";n.d(t,{c:()=>u});var r=n(90526),a=n(55609),s=n(9818),o=n(69307),i=n(65736),l=n(23177),c=n(75124);const __=i.__,_x=i._x;function u({connection:e,variant:t="secondary",isDestructive:n=!0,buttonClassName:u}){const[d,p]=(0,o.useReducer)((e=>!e),!1),{deleteConnectionById:m}=(0,s.useDispatch)(l.h),{isDisconnecting:g}=(0,s.useSelect)((t=>{const{getDeletingConnections:n}=t(l.h);return{isDisconnecting:n().includes(e.connection_id)}}),[e.connection_id]),A=(0,o.useCallback)((async()=>{p(),await m({connectionId:e.connection_id})}),[e.connection_id,m]);return e.can_disconnect?React.createElement(React.Fragment,null,React.createElement(a.__experimentalConfirmDialog,{className:c.Z.confirmDialog,isOpen:d,onConfirm:A,onCancel:p,cancelButtonText:__("Cancel","jetpack"),confirmButtonText:__("Yes","jetpack")},(0,o.createInterpolateElement)((0,i.sprintf)( // translators: %s: The name of the connection the user is disconnecting. __("Are you sure you want to disconnect %s?","jetpack"),e.display_name),{strong:React.createElement("strong",null)})),React.createElement(r.Z,{size:"small",onClick:p,disabled:g,variant:t,isDestructive:n,className:u},g?__("Disconnecting…","jetpack"):_x("Disconnect","Disconnect a social media account","jetpack"))):null}},75674:(e,t,n)=>{"use strict";n(55609),n(9818),n(69307),n(65736),n(65235),n(37568),n(23177),n(95766),n(66475),n(60676),n(75124)},43876:(e,t,n)=>{"use strict";n.d(t,{l:()=>l});var r=n(55609),a=n(9818),s=n(69307),o=n(65736),i=n(23177);const __=o.__;function l({connection:e}){const{updateConnectionById:t}=(0,a.useDispatch)(i.h),{isUpdating:n}=(0,a.useSelect)((t=>{const{getUpdatingConnections:n}=t(i.h);return{isUpdating:n().includes(e.connection_id)}}),[e.connection_id]),o=(0,s.useCallback)((n=>{t(e.connection_id,{shared:n})}),[e.connection_id,t]);return React.createElement(r.CheckboxControl,{checked:e.shared??!1,onChange:o,disabled:n||"broken"===e.status,label:__("Mark the connection as shared","jetpack")})}},67660:(e,t,n)=>{"use strict";n.d(t,{w:()=>c});var r=n(90526),a=n(9818),s=n(69307),o=n(65736),i=n(23177),l=n(58300);const __=o.__,_x=o._x;function c({connection:e,service:t,variant:n="link",onConfirmReconnect:o}){const{deleteConnectionById:c,setKeyringResult:u}=(0,a.useDispatch)(i.h),{isDisconnecting:d}=(0,a.useSelect)((t=>{const{getDeletingConnections:n}=t(i.h);return{isDisconnecting:n().includes(e.connection_id)}}),[e.connection_id]),p=(0,s.useCallback)((e=>{u(e),e?.ID&&o?.()}),[o,u]),m=(0,l.N)({service:t,onConfirm:p}),g=(0,s.useCallback)((async()=>{if(!await c({connectionId:e.connection_id,showSuccessNotice:!1}))return;const n=new FormData;"mastodon"===t.ID&&n.set("instance",e.external_display),m(n)}),[e,c,m,t.ID]);return e.can_disconnect?React.createElement(React.Fragment,null,React.createElement(r.Z,{size:"small",onClick:g,disabled:d,variant:n},d?__("Disconnecting…","jetpack"):_x("Reconnect","Reconnect a social media account","jetpack"))):null}},24479:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(65235),a=n.n(r),s=n(25162),o=n.n(s),i=n(85761);const l=e=>{const{checked:t,disabled:n,onChange:r,serviceName:s,label:o,profilePicture:l}=e,c=a()("components-connection-toggle",{"is-not-checked":!t,"is-disabled":n});return React.createElement("div",{className:c,title:o},React.createElement(i.Z,{checked:t,label:o,onClick:r,serviceName:s,profilePicture:l}))};l.propTypes={className:o().string,checked:o().bool,id:o().string.isRequired,disabled:o().bool,onChange:o().func,serviceName:o().string,label:o().string,profilePicture:o().string};const c=l},49021:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(94333),a=n(9818),s=n(69307),o=n(23177);class i extends s.Component{componentDidMount(){this.props.refreshConnections()}render(){return null}}const l=(0,r.compose)([(0,a.withSelect)((e=>({failedConnections:e(o.Eg).getFailedConnections()}))),(0,a.withDispatch)((e=>({refreshConnections:e(o.Eg).refreshConnectionTestResults})))])(i)},4277:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var r=n(13419),a=n(55609),s=n(9818),o=n(69307),i=n(65736),l=n(23177),c=n(24479),u=n(28161),d=n(91853);const __=i.__;class p extends o.Component{maybeDisplayLinkedInNotice=()=>this.connectionNeedsReauth()&&React.createElement(a.Notice,{className:u.Z["publicize-notice"],isDismissible:!1,status:"error"},React.createElement("p",null,__("Your LinkedIn connection needs to be reauthenticated to continue working – head to Sharing to take care of it.","jetpack")),React.createElement(a.ExternalLink,{href:`https://wordpress.com/marketing/connections/${(0,r.lQ)()}`},__("Go to Sharing settings","jetpack")));connectionNeedsReauth=()=>this.props.mustReauthConnections.includes(this.props.name);onConnectionChange=()=>{const{id:e}=this.props;this.isDisabled()||this.props.toggleConnection(e)};connectionIsFailing(){const{failedConnections:e,name:t}=this.props;return e.some((e=>e.service_name===t))}isDisabled(){return this.props.disabled||this.connectionIsFailing()||this.connectionNeedsReauth()}render(){const{enabled:e,id:t,label:n,name:r,profilePicture:a}=this.props,s="connection-"+r+"-"+t,o=r.replace("_","-"),i=React.createElement(c.Z,{id:s,className:d.Z["connection-toggle"],checked:e,onChange:this.onConnectionChange,disabled:this.isDisabled(),serviceName:o,label:n,profilePicture:a});return React.createElement("li",null,this.maybeDisplayLinkedInNotice(),React.createElement("div",{className:d.Z["connection-container"]},i))}}const m=(0,s.withSelect)((e=>({failedConnections:e(l.Eg).getFailedConnections(),mustReauthConnections:e(l.Eg).getMustReauthConnections()})))(p)},1922:(e,t,n)=>{"use strict";n.d(t,{F:()=>d});var r=n(6895),a=n(13419),s=n(55609),o=n(69307),i=n(65736),l=n(81050),c=n(75323),u=n(62578);const __=i.__,d=()=>{const{shouldShowAdvancedPlanNudge:e}=(0,l.usePublicizeConfig)(),{dismissNotice:t,shouldShowNotice:n,NOTICES:i}=(0,c.Z)(),d=(0,o.useCallback)((()=>t(i.advancedUpgradeEditor,7776e3)),[t,i]);return e&&n(i.advancedUpgradeEditor)&&React.createElement(u.Z,{onDismiss:d,type:"highlight"},(0,o.createInterpolateElement)(__("Need more reach? Unlock custom media sharing with the Advanced Plan","jetpack"),{upgradeLink:React.createElement(s.ExternalLink,{href:(0,r.Z)("jetpack-social-advanced-site-checkout",{site:(0,a.lQ)(),query:"redirect_to="+encodeURIComponent(window.location.href)})})}))}},87029:(e,t,n)=>{"use strict";n.d(t,{w:()=>d});var r=n(13419),a=n(55609),s=n(69307),o=n(65736),i=n(81050),l=n(75323),c=n(62578),u=n(75631);const __=o.__,d=()=>{const{dismissNotice:e,shouldShowNotice:t,NOTICES:n}=(0,l.Z)(),o=(0,s.useCallback)((()=>e(n.autoConversion)),[e,n]),{adminUrl:d,jetpackSharingSettingsUrl:p}=(0,i.usePublicizeConfig)();return!(0,r.Wp)()&&t(n.autoConversion)&&React.createElement(c.Z,{type:"warning",actions:[React.createElement(a.Button,{onClick:o,key:"dismiss",variant:"primary"},__("Got it","jetpack")),React.createElement(a.Button,{className:u.Z["change-settings-button"],key:"change-settings",href:d||p,target:"_blank",rel:"noreferrer noopener"},__("Change settings","jetpack"))]},__("When your post is published, the selected image will be converted for maximum compatibility across your connected social networks.","jetpack"))}},63503:(e,t,n)=>{"use strict";n.d(t,{Z:()=>u});var r=n(55609),a=n(69307),s=n(65736),o=n(81050),i=n(37568),l=n(62578),c=n(49285);const _n=s._n,u=()=>{const{connections:e}=(0,i.Z)(),t=e.filter((e=>(0,c.A)(e,"broken"))),{connectionsAdminUrl:n}=(0,o.usePublicizeConfig)();return t.length>0&&React.createElement(l.Z,{type:"error"},(0,a.createInterpolateElement)(_n("One of your social connections is broken. Reconnect them on the connection management page.","Some of your social connections are broken. Reconnect them on the connection management page.",t.length,"jetpack"),{fixLink:React.createElement(r.ExternalLink,{href:n})}))}},75457:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(14085),a=n(37568),s=n(4277),o=n(69709),i=n(75631),l=n(28155);const c=()=>{const{connections:e,toggleById:t}=(0,a.Z)(),{canBeTurnedOn:n,shouldBeDisabled:c}=(0,l.z)(),{needsUserConnection:u}=(0,r.Z)();return React.createElement("ul",{className:i.Z["connections-list"]},e.map((e=>{const{display_name:r,id:a,service_name:o,profile_picture:i,connection_id:l}=e,u=l||a;return React.createElement(s.Z,{disabled:c(e),enabled:n(e)&&e.enabled,key:u,id:u,label:r,name:o,toggleConnection:t,profilePicture:i})})),u?null:React.createElement("li",null,React.createElement(o.Z,null)))}},82356:(e,t,n)=>{"use strict";n.d(t,{H:()=>c});var r=n(55609),a=n(65736),s=n(14085),o=n(37568),i=n(75631),l=n(28155);const _n=a._n;function c(){const{enabledConnections:e}=(0,o.Z)(),{isPublicizeEnabled:t}=(0,s.Z)(),{canBeTurnedOn:n,shouldBeDisabled:c}=(0,l.z)(),u=e.filter((e=>n(e)&&!c(e)));return u.length&&t?React.createElement(r.PanelRow,null,React.createElement("p",{className:i.Z["enabled-connections-notice"]},(0,a.sprintf)(/* translators: %d: number of connections */ @@ -124,11 +124,11 @@ __("Delete %s","jetpack"),o.label),disabled:a===l},a===l?__("Deleting","jetpack" __("Kind","jetpack"),onChange:t=>{n({...e,kind:t})},disabled:f}),(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-buttons-container"},f?(0,r.createElement)(i.Spinner,null):(0,r.createElement)(i.Button,{variant:"secondary",disabled:!e.tmpFile,onClick:()=>{h(null),""===C&&(e.label=__("English","jetpack")),""===v&&(e.srcLang="en"),void 0===e.kind&&(e.kind=p),d(e)?h(__("A track already exists for that language and kind.","jetpack")):(b(!0),E(e,t).then((()=>{n(e),h(null),a()})).catch((e=>{e.message&&h(e.message)})).finally((()=>{b(!1)})))}},__("Save","jetpack")),(0,r.createElement)(i.Button,{variant:"link",onClick:s},__("Close","jetpack"))),A&&(0,r.createElement)("div",{className:"videopress-block-tracks-editor__single-track-editor-error"},/* translators: %s: An error message returned after a failed video track file upload." */ /* translators: %s: An error message returned after a failed video track file upload." */ (0,u.sprintf)(__("Error: %s","jetpack"),A))))}function v({tracks:e=[],onChange:t,guid:n}){const[a,s]=(0,c.useState)(null);return(0,r.createElement)(i.Dropdown,{contentClassName:"videopress-block-tracks-editor",renderToggle:({isOpen:e,onToggle:t})=>(0,r.createElement)(i.ToolbarButton,{label:__("Text tracks","jetpack"),showTooltip:!0,"aria-expanded":e,"aria-haspopup":"true",onClick:t,icon:A}),renderContent:()=>null!==a?(0,r.createElement)(C,{track:e[a],guid:n,onChange:n=>{const r=[...e];r[a]=n,t(r)},onClose:()=>s(null),onCancel:()=>{t(e.filter(((e,t)=>t!==a))),s(null)},trackExists:t=>-1!==e.filter(((e,t)=>t!==a)).findIndex((e=>e.kind===t.kind&&e.srcLang===t.srcLang))}):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.NavigableMenu,null,(0,r.createElement)(b,{tracks:e,onChange:t,guid:n}),(0,r.createElement)(i.MenuGroup,{className:"videopress-block-tracks-editor__add-tracks-container",label:__("Add tracks","jetpack")},(0,r.createElement)(i.MenuItem,{icon:d.Z,onClick:()=>{(()=>{const n=e.length,r=[...e];r[n]||(r[n]={}),r[n]={...e[n]},t(r),s(n)})()}},__("Upload track","jetpack")))))})}},32478:(e,t,n)=>{"use strict";n.d(t,{$:()=>A});var r=n(51806),a=n(52175),s=n(55609),o=n(69307),i=n(65736),l=n(61074),c=n(65235),u=n.n(c),d=n(81427);const __=i.__,p=["image"],m=e=>{const{videoPosterImageUrl:t}=e;return(0,r.createElement)("div",{className:"resumable-upload__editor-thumb-placeholder"},t?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("img",{src:t,alt:"Poster"}),(0,r.createElement)(l.Z,{className:"uploading-editor__play-icon",icon:d.o1})):(0,r.createElement)("span",null,"No Poster Selected"))},g=e=>{const{onSelectPoster:t,onRemovePoster:n}=e;return(0,r.createElement)(s.BaseControl,{className:u()(e.className,"editor-video-poster-control")},(0,r.createElement)(m,e),(0,r.createElement)(a.MediaUpload,{title:__("Select Poster Image","jetpack"),onSelect:t,allowedTypes:p,render:({open:e})=>(0,r.createElement)("div",{className:"poster-selector__buttons"},(0,r.createElement)(s.Button,{onClick:n,variant:"link",isDestructive:!0},__("Remove Poster Image","jetpack")),(0,r.createElement)(s.Button,{variant:"secondary",onClick:e},__("Select Poster Image","jetpack")))}))},A=e=>{const{file:t,onSelectPoster:n,onRemovePoster:i,videoPosterImageData:c,title:u,onChangeTitle:m,onVideoFrameSelected:A}=e,[h,E]=(0,o.useState)(0),[f,b]=(0,o.useState)(!0),C=(0,o.useRef)(null),v=(0,o.useRef)(null),k=()=>{b(!1)};(0,o.useEffect)((()=>{null!==t&&C&&(C.current.src=URL.createObjectURL(t))}),[t,C]);const B={};return c&&(B.display="none"),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"uploading-editor"},(0,r.createElement)("div",{className:"uploading-editor__summary"}),(0,r.createElement)("div",{className:"uploading-editor__fields"},(0,r.createElement)(s.TextControl,{label:__("Video title","jetpack"),className:"uploading-editor__title",onChange:m,value:u}),(0,r.createElement)("div",{className:"uploading-editor__content"},(0,r.createElement)(s.BaseControl,{label:__("Video poster (optional)","jetpack")},f?(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"uploading-editor__video-container"},(0,r.createElement)("div",{className:"uploading-editor__video-poster-wrapper"},c&&(0,r.createElement)(g,{onSelectPoster:n,onRemovePoster:i,videoPosterImageUrl:c.url}),(0,r.createElement)("video",{ref:C,muted:!0,className:"uploading-editor__video",onDurationChange:e=>{const t=e.target.duration;E(t),C.current&&(C.current.currentTime=t/2)},onError:k,onLoadedMetadata:e=>{e.target.videoHeight||k()},style:B})),!c&&(0,r.createElement)(l.Z,{className:"uploading-editor__play-icon",icon:d.o1})),(0,r.createElement)("span",{style:B},(0,r.createElement)(s.RangeControl,{className:"uploading-editor__range",min:"0",step:"0.1",max:h,showTooltip:!1,withInputField:!1,onChange:e=>{A(1e3*e),C.current&&(C.current.currentTime=e)}})),(0,r.createElement)("span",{className:"uploading-editor__scrubber-help",style:B},(0,o.createInterpolateElement)(__("This is how the video will look. Use the slider to choose a poster or select a custom one.","jetpack"),{a:(0,r.createElement)(a.MediaUpload,{title:__("Select Poster Image","jetpack"),onSelect:n,allowedTypes:p,render:({open:e})=>(0,r.createElement)("a",{className:"uploading-editor__upload-link",onClick:e,onKeyDown:e,ref:v,role:"button",tabIndex:0},__("select a custom one","jetpack"))})}))):(0,r.createElement)(g,{onSelectPoster:n,videoPosterImageUrl:c?c.url:null}))))))}},90953:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(96483);const a=(e,{autoplay:t,controls:n,loop:a,muted:s,playsinline:o,poster:i,preload:l,seekbarColor:c,seekbarPlayedColor:u,seekbarLoadingColor:d,useAverageColor:p})=>{if(!e)return null;const m={resizeToParent:!0,cover:!0,...t&&{autoPlay:!0},...!n&&{controls:!1},...a&&{loop:!0},...s&&{muted:!0,persistVolume:!1},...o&&{playsinline:!0},...i&&{posterUrl:i},...""!==l&&{preloadContent:l},...""!==c&&{sbc:c},...""!==u&&{sbpc:u},...""!==d&&{sblc:d},...p&&{useAverageColor:!0}};return(0,r.addQueryArgs)(`https://videopress.com/v/${e}`,m)}},77290:(e,t,n)=>{"use strict";n.d(t,{K8:()=>l,Kp:()=>u,Zx:()=>c,f6:()=>i});n(4981);var r=n(65235),a=n.n(r),s=n(90879);const o=e=>{const t=s.sl.reduce(((e,{className:t})=>(e[t]=!1,e)),{"wp-has-aspect-ratio":!1});return a()(e,t)};function i(e,t="",n=!0){if(!n)return o(t);const r=document.implementation.createHTMLDocument("");r.body.innerHTML=e;const i=r.body.querySelector("iframe");if(i&&i.height&&i.width){const e=(i.width/i.height).toFixed(2);for(let n=0;n=r.ratio)return a()(o(t),r.className,"wp-has-aspect-ratio")}}return t}const l=e=>e.replace(/\.[^/.]+$/,""),c=e=>{if(!e||"string"!=typeof e)return null;const t=e.match(/^https?:\/\/(?video(?:\.word|s\.files\.word)?press\.com)(?:\/v|\/embed)?\/(?[a-zA-Z\d]{8})/);return t?.groups?.guid?t.groups.guid:null},u=e=>{const{guid:t,videoPressTracks:n,isVideoPressExample:r}=e;if(!t?.length)return!1;if(!Array.isArray(n))return!1;return!(!Object.keys(e).includes("isVideoPressExample")||"boolean"!=typeof r)}},65192:(e,t,n)=>{"use strict";n.d(t,{Z:()=>A});var r=n(51806),a=n(13419),s=n(52175),o=n(4981),i=n(55609),l=n(9818),c=n(12238),u=(n(69307),n(65736)),d=n(77290),p=n(5743);const __=u.__,m={instances:[]},g=(e=[],t=!1,n=0)=>{if(t&&(m.instances=[]),e.forEach((e=>{if(e.innerBlocks.length)return void g(e.innerBlocks,!1,n+1);const{clientId:t,name:r,attributes:a}=e;"core/video"===r&&(0,d.Kp)(a)&&m.instances.push({clientId:t,name:r,attributes:a})})),0===n)return m.instances};function A({clientId:e,attributes:t}){const n=(0,l.useSelect)((e=>e(c.store).getCurrentPostId())),{getBlocks:u}=(0,l.useSelect)(s.store),{replaceBlock:m}=(0,l.useDispatch)(s.store),{tracks:A}=(0,a.z$)();return(0,r.createElement)("div",{className:p.Z.wrapper},(0,r.createElement)(i.Notice,{status:"info",isDismissible:!1,className:p.Z["conversion-notice"]},__("You can transform this post's video blocks to the new VideoPress block to take advantage of new features, such as adding chapters directly in the description or hiding the video's share menu.","jetpack")),(0,r.createElement)(i.Button,{variant:"primary",onClick:()=>{const r=g(u(),!0);r?.length&&(r.find((t=>t.clientId===e))||r.push({clientId:e,name:"core/video",currentBlockAttributes:t}),r.forEach((e=>{const{clientId:t,name:r,attributes:a}=e;"core/video"===r&&(0,d.Kp)(a)&&(m(t,(0,o.createBlock)("videopress/video",a)),A.recordEvent("jetpack_editor_videopress_block_manual_conversion_click",{post_id:n}))})))}},__("Transform blocks to VideoPress","jetpack")))}},68938:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var r=n(51806),a=n(52175),s=n(94333),o=n(77290),i=n(65192);const l=(0,s.createHigherOrderComponent)((e=>t=>(0,o.Kp)(t.attributes)?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(i.Z,{clientId:t.clientId,attributes:t.attributes})),(0,r.createElement)(e,t)):(0,r.createElement)(e,t)))},23062:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(13419),a=n(68938);const s="videopress/video";function o(e,t){if("core/video"!==t)return e;const{available:n}=(0,r.OZ)(s);return n?{...e,edit:(0,a.Z)(e.edit)}:e}},73859:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(51806),a=n(55609),s=n(65736),o=n(78680),i=n(75255);const __=s.__,l="videopress/video-chapters",c=!!window?.Jetpack_Editor_Initial_State?.available_blocks[l],u=31;function d({isRequestingVideoItem:e}){const{attributes:t,setAttributes:n}=(0,i.Z)(),{title:s,description:d}=t,p=(0,o.L)(l),m=d?.length?d.split("\n").map((e=>Math.ceil(e.length/u)||1)).reduce(((e,t)=>e+t),0):4,g=Math.min(12,Math.max(m,4));if(!c)return null;return(0,r.createElement)(a.PanelBody,{title:__("Details","jetpack"),className:p?"is-beta":""},(0,r.createElement)(a.TextControl,{label:__("Title","jetpack"),value:s,placeholder:__("Video title","jetpack"),onChange:e=>{n({title:e})},disabled:e}),(0,r.createElement)(a.TextareaControl,{label:__("Description","jetpack"),value:d,placeholder:__("Video description","jetpack"),onChange:e=>{n({description:e})},disabled:e,rows:g}))}},24288:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(51806),a=n(52175),s=n(94333),o=n(69307),i=n(73859),l=n(67203),c=n(49664),u=n(84676);const d=(0,s.createHigherOrderComponent)((e=>t=>{const{attributes:n,setAttributes:s}=t,[d,p]=(0,l.Z)(n?.id),[m]=(0,c.v)(n);return(0,o.useEffect)((()=>{if(!d)return;const e={};d?.title&&(e.title=d.title),d?.description&&(e.description=d.description),Object.keys(e).length&&(s(e),m(e))}),[d,s,m]),u.d&&"core/video"!==!t.name&&t.attributes?.guid?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(i.Z,{isRequestingVideoItem:p})),(0,r.createElement)(e,t)):(0,r.createElement)(e,t)}))},75255:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(52175),a=n(9818);function s(){const{clientId:e,attributes:t}=(0,a.useSelect)((e=>{const t=e(r.store).getSelectedBlockClientId();return{clientId:t,attributes:t?e("core/block-editor").getBlockAttributes(t):void 0}})),{updateBlockAttributes:n}=(0,a.useDispatch)(r.store);return{clientId:e,attributes:t,setAttributes:t=>n(e,t)}}},49664:(e,t,n)=>{"use strict";n.d(t,{v:()=>A});var r=n(86989),a=n.n(r),s=n(94333),o=n(37798),i=n(9818),l=n(12238),c=n(69307),u=n(65736),d=n(22081),p=n(90953),m=n(84321),g=n(38871);const __=u.__;function A(e){const{id:t,title:n,description:r,guid:u}=e,A=(0,i.useSelect)((e=>e(l.store).isSavingPost()),[]),h=(0,s.usePrevious)(A),E=(0,i.useDispatch)(o.store).invalidateResolution,[f,b]=(0,c.useState)(),C=(0,c.useCallback)((e=>{b((t=>({...t,...e})))}),[]);(0,c.useEffect)((()=>{b({title:n,description:r})}),[]);const v=function(e){return t=>new Promise(((n,r)=>{a()({path:"/wpcom/v2/videopress/meta",method:"POST",data:{id:e,...t}}).then((e=>{if(200!==e?.data)return r(e);n(e)})).catch(r)}))}(t);return(0,c.useEffect)((()=>{if(!A||h)return;if(!t)return;const a={};if(f?.title!==n&&(a.title=n),f?.description!==r&&(a.description=r),!Object.keys(a).length)return;if(v(a).then((()=>C({title:n,description:r}))),!a?.description?.length)return;const s=(0,m.ZP)(a.description);if(!s?.length)return;const o={label:__("English","jetpack"),srcLang:"en",kind:"chapters",tmpFile:(0,g.ZP)(a.description)};(0,d.n)(o,u).then((()=>{const t=(0,p.p)(u,e);E("getEmbedPreview",[t])}))}),[A,h,n,f?.title,f?.description,r,v,C,e,E,t,u]),[C]}},67203:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(86989),a=n.n(r),s=n(69307);function o(e){const[t,n]=(0,s.useState)({}),[r,o]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{e&&(o(!0),async function(){try{const t=await a()({path:`/wp/v2/media/${e}`});n(t?.jetpack_videopress||{}),o(!1)}catch(e){throw o(!1),new Error(e)}}())}),[e]),[t,r]}},84676:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s,d:()=>a});var r=n(24288);const a=!!window?.Jetpack_Editor_Initial_State?.available_blocks["videopress/video-chapters"];function s(e,t){if(!a)return e;if("core/video"!==t)return e;const n={...e.attributes,title:{type:"string"},description:{type:"string"}};return{...e,attributes:n,edit:(0,r.Z)(e.edit)}}},84321:(e,t,n)=>{"use strict";function r(e){return e.split("\n").map((e=>function(e){const t=/(?\(?(?