1"use strict";(self.webpackChunk_automattic_jetpack_comments=self.webpackChunk_automattic_jetpack_comments||[]).push([[8],{9292(e,t,r){r.r(t),r.d(t,{mountEditor:()=>te});var n=r(913);window.jetpackCommentsEditorLocale&&(0,n.fh)(window.jetpackCommentsEditorLocale);var s=r(792),a=r(4171),l={};r.r(l),r.d(l,{init:()=>a.init,metadata:()=>a.metadata,name:()=>a.name,settings:()=>a.settings});var o=r(6269),c={};r.r(c),r.d(c,{init:()=>o.init,metadata:()=>o.metadata,name:()=>o.name,settings:()=>o.settings});var i=r(7609),d={};r.r(d),r.d(d,{init:()=>i.init,metadata:()=>i.metadata,name:()=>i.name,settings:()=>i.settings});var u=r(9950),m={};r.r(m),r.d(m,{init:()=>u.init,metadata:()=>u.metadata,name:()=>u.name,settings:()=>u.settings});var p=r(6043),h={};r.r(h),r.d(h,{init:()=>p.init,metadata:()=>p.metadata,name:()=>p.name,settings:()=>p.settings});var b=r(3150),x=r(4749),f=r(9562),g=r(9027),j=r(5897),k=r(2376),y=r(8950),v=(r(7782),r(7319)),w=r(9040),C=r(9749),_=r(3192),A=r(3040),E=r(453),S=r(9217),M=r(8787),R=r(2990),B=r(621),L=r(3236);const __=n.__,_x=n._x,N="core/embed";let H,U=!0;const K=_x("Embed","button label","default"),P=_x("Try again","button label","default"),D=e=>{try{return new URL(e).host}catch{return e}},$=e=>(0,b.Wv)("core/paragraph",{content:(0,B.Ay)((0,L.jsx)("a",{href:e,children:e}))}),I=({attributes:{url:e},setAttributes:t,isSelected:r,onReplace:a})=>{const[l,o]=(0,k.useState)(e??""),[c,i]=(0,k.useState)(!e),[d,u]=(0,k.useState)(null),[m,p]=(0,k.useState)(!1),[h,b]=(0,k.useState)(0),[x,f]=(0,k.useState)(!1),g=(0,k.useRef)(a);g.current=a;const j=(0,s.Z0)();(0,k.useEffect)(()=>{if(!e||!U)return;let t=!1;u(null),p(!1);const r=new URL(H.embedUrl,window.location.href);return r.searchParams.set("url",e),fetch(r.toString(),{credentials:"omit"}).then(e=>e.status>=400&&e.status<500&&429!==e.status?"unsupported":e.ok?e.json():null).catch(()=>null).then(r=>{t||("unsupported"===r?g.current($(e)):r?.html?u(r):p(!0))}),()=>{t=!0}},[e,h]),(0,k.useEffect)(()=>{r||f(!1)},[r]);const y=(0,k.useCallback)(e=>o(e.target.value),[]),v=(0,k.useCallback)(e=>{e.preventDefault();const r=l.trim();r&&(i(!1),b(e=>e+1),t({url:r}))},[l,t]),B=(0,k.useCallback)(()=>i(!0),[]),N=(0,k.useCallback)(()=>f(!0),[]);if(c||m||!e)return(0,L.jsx)("div",{...j,children:(0,L.jsxs)(C.A,{icon:(0,L.jsx)(s.th,{icon:w.oQ,showColors:!0}),label:_x("Embed","block title","default"),children:[m&&(0,L.jsx)("p",{className:"components-placeholder__error",children:__("Sorry, this content could not be embedded.","default")}),(0,L.jsxs)("form",{onSubmit:v,children:[(0,L.jsx)("input",{type:"url","aria-label":_x("Embed","block title","default"),placeholder:__("Enter URL to embed hereâ¦","default"),value:l,onChange:y}),(0,L.jsx)(_.A,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",children:m?P:K})]})]})});const I=(0,L.jsx)(s.mC,{children:(0,L.jsx)(A.A,{children:(0,L.jsx)(E.A,{onClick:B,children:__("Edit URL","default")})})});return U?d?(0,L.jsxs)(L.Fragment,{children:[I,(0,L.jsx)("figure",{...j,children:(0,L.jsxs)("div",{className:"wp-block-embed__wrapper",children:[(0,L.jsx)(R.Ay,{allowSameOrigin:!0,html:d.html,title:(0,n.nv)(/* translators: %s: host providing embed content e.g: www.youtube.com */ 2__("Embedded content from %s","default"),D(e)),onFocus:N}),!x&&(0,L.jsx)("div",{className:"jetpack-comments__embed-overlay",onMouseUp:N})]})})]}):(0,L.jsxs)("div",{...j,"aria-busy":"true",children:[(0,L.jsx)(S.Ay,{}),(0,L.jsx)(M.A,{children:__("Loadingâ¦","default")})]}):(0,L.jsxs)(L.Fragment,{children:[I,(0,L.jsx)("figure",{...j,children:(0,L.jsx)("div",{className:"wp-block-embed__wrapper",children:e})})]})},T=e=>e.map(e=>`${e.clientId}(${T(e.innerBlocks)})`).join(),V=(e,t)=>{const{past:r,present:n,future:s,editedAt:a}=e;if("undo"===t.type)return r.length?{past:r.slice(0,-1),present:r.at(-1),future:[n,...s],editedAt:0}:e;if("redo"===t.type)return s.length?{past:[...r,n],present:s[0],future:s.slice(1),editedAt:0}:e;const l=(0,b.lK)(t.blocks);if(l===n.markup)return e;return{past:t.at-a<1e3&&T(t.blocks)===T(n.blocks)?r:[...r,n].slice(-100),present:{blocks:t.blocks,markup:l},future:[],editedAt:t.at}};var F=r(5850),q=r(3802),W=r(3991);const z=["core/paragraph","core/list","core/quote","core/code"],O=(0,L.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",children:(0,L.jsx)("path",{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),X=(e,t)=>{const{title:r,icon:n}=(0,b.E7)(e);return{title:r,icon:n.src,onClick:t}},Y=({labels:e})=>{const{root:t,index:r}=(0,j.A)(e=>{const{getSelectedBlockClientIds:t,getBlock:r,getBlockHierarchyRootClientId:n,getBlockIndex:a}=e(s.M_),l=t(),o=l.length?n(l[0]):null;return{root:o?r(o):null,index:o?a(o):-1}},[]),{replaceBlocks:n,insertBlock:a}=(0,g.A)(s.M_);if(!t)return null;const l=z.map(e=>X(e,()=>
2a((0,b.Wv)(e),r+1))),o=(0,b.E7)(t.name),c=z.flatMap(e=>{const r=e===t.name?null:(0,b.bh)(t,e);return r?[X(e,()=>n(t.clientId,r))]:[]});return(0,L.jsxs)(F.A,{label:e.blockTools,variant:"unstyled",className:"jetpack-comments__block-tools",children:[(0,L.jsx)(A.A,{children:(0,L.jsx)(q.A,{children:t=>(0,L.jsx)(W.A,{toggleProps:t,icon:O,label:e.addBlock,controls:l})})}),(0,L.jsx)(A.A,{children:(0,L.jsx)(q.A,{children:e=>(0,L.jsx)(W.A,{toggleProps:e,icon:o.icon.src,label:o.title,controls:c})})}),(0,L.jsx)(s.mC.Slot,{group:"parent"}),(0,L.jsx)(s.mC.Slot,{group:"block"}),(0,L.jsx)(s.mC.Slot,{group:"inline"}),(0,L.jsx)(s.mC.Slot,{}),(0,L.jsx)(s.mC.Slot,{group:"other"})]})};[m,c,d,h,l].forEach(e=>e.init()),(0,b.uz)(u.name),["core/image","core/underline","core/text-color","core/subscript","core/superscript","core/keyboard","core/language","core/math"].forEach(e=>(0,v.MX)(e));const Z={isRTL:"rtl"===document.documentElement.dir,hasFixedToolbar:!0,supportsLayout:!1};class Q extends k.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){this.props.onError(e)}render(){return this.state.failed?null:this.props.children}}const J=({offset:e})=>{const{selectBlock:t,selectionChange:r}=(0,g.A)(s.M_),n=(0,j.A)(e=>e(s.M_).getBlockOrder().at(-1),[]),a=(0,k.useRef)(!1);return(0,k.useEffect)(()=>{if(n&&!a.current){a.current=!0;const s=e();s<0?t(n,-1):r(n,"content",s,s)}},[n,e,t,r]),null},G=({undo:e,redo:t,children:r})=>{const n=(0,k.useCallback)(r=>{(r.metaKey||r.ctrlKey)&&"z"===r.key.toLowerCase()&&(r.preventDefault(),r.shiftKey?t():e())},[e,t]);return(0,L.jsx)("div",{onKeyDownCapture:n,children:r})},ee=({initialContent:e,labels:t,focus:r,placeholder:n,onChange:a})=>{const[{present:l},o]=(0,k.useReducer)(V,null,()=>{const t=((e,t)=>e.includes("\x3c!-- wp:")?(0,b.qg)(e):[(0,b.Wv)("core/paragraph",{placeholder:t,content:e.trim().replace(/&/g,"&").replace(/</g,"<").replace(/\n/g,"<br>")})])(e,n);return{past:[],present:{blocks:t,markup:(0,b.lK)(t)},future:[],editedAt:0}}),{blocks:c,markup:i}=l,d=c.every(({name:e,attributes:t})=>"core/paragraph"===e&&!String(t.content??"").trim());(0,k.useEffect)(()=>{a(d?"":i)},[d,i,a]);const u=(0,k.useCallback)(e=>{d&&!e.target.closest("[data-block]")&&[...e.currentTarget.querySelectorAll('[contenteditable="true"]')].at(-1)?.focus()},[d]),m=(0,k.useCallback)(e=>o({type:"edit",blocks:e,at:Date.now()}),[]),p=(0,k.useCallback)(()=>o({type:"undo"}),[]),h=(0,k.useCallback)(()=>o({type:"redo"}),[]),g=(0,k.useMemo)(()=>({...Z,__experimentalUndo:p}),[p]),j=(0,k.useCallback)(()=>{const t=r?.()??-1;if(t<0||e.includes("\x3c!-- wp:"))return-1;const n=e.trim(),s=e.indexOf(n);return Math.min(Math.max(t-s,0),n.length)},[r,e]);return(0,L.jsx)(x.Kq,{children:(0,L.jsxs)(s.oS,{value:c,onInput:m,onChange:m,settings:g,useSubRegistry:!0,children:[r&&(0,L.jsx)(J,{offset:j}),(0,L.jsxs)(G,{undo:p,redo:h,children:[(0,L.jsx)("div",{className:"jetpack-comments__toolbar",children:(0,L.jsx)(Y,{labels:t})}),(0,L.jsx)(s.LJ,{children:(0,L.jsx)(s.Pe,{className:"editor-styles-wrapper",onClick:u,children:(0,L.jsx)(s.us,{children:(0,L.jsx)(s.m9,{})})})})]}),(0,L.jsx)(f.Ay.Slot,{})]})})},te=(e,t)=>{((e,t=!0)=>{H=e,U=t,H.embedUrl&&!(0,b.E7)(N)&&(0,b.xU)(N,{title:_x("Embed","block title","default"),category:"embed",icon:w.oQ,attributes:{url:{type:"string"}},edit:I,save:({attributes:{url:e}})=>e?(0,L.jsx)("figure",{...s.Z0.save(),children:(0,L.jsx)("div",{className:"wp-block-embed__wrapper",children:`\n${e}\n`})}):null,transforms:{from:[{type:"raw",isMatch:e=>"P"===e.nodeName&&/^https?:\/\/\S+$/i.test(e.textContent?.trim()??""),transform:e=>(0,b.Wv)(N,{url:e.textContent.trim()})}],to:[{type:"block",blocks:["core/paragraph"],transform:({url:e})=>$(e??"")}]}})})(t.labels,t.previewEmbeds??!0),(0,y.H)(e).render((0,L.jsx)(Q,{onError:t.onError,children:(0,L.jsx)(ee,{...t})}))}},6068(e){function t(){return null}e.exports=new Proxy(t,{get:(e,r)=>"then"===r||"symbol"==typeof r?void 0:t})},6579(e,t,r){var n=r(2376);const s=e=>"number"==typeof e?`${e}px`:e,a=new Map,l=new Proxy({},{get:(e,t)=>(a.has(t)||a.set(t,(e=>(0,n.forwardRef)(({initial:t,animate:r,exit:a,variants:l,transition:o,layout:c,whileHover:i,whileTap:d,onAnimationComplete:u,style:{x:m,y:p,originX:h,originY:b,...x}={},...f},g)=>((0,n.useEffect)(()=>u?.(),[]),void 0===m&&void 0===p||(x.transform=`translateX(${s(m??0)}) translateY(${s(p??0)})`),(0,n.createElement)(e,{...f,style:x,ref:g}))))(t)),a.get(t))});r.d(t,["AK",0,()=>e=>e,"Ny",0,({children:e})=>e,"PY",0,l])}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.