(window.imageEmbeddable_bundle_jsonpfunction=window.imageEmbeddable_bundle_jsonpfunction||[]).push([[0],{19:function(e,t,a){"use strict";a.r(t),a.d(t,"ImageViewer",(function(){return j}));var n=a(30),r=a.n(n),o=a(0),i=a.n(o),l=a(1),s=a(34),h=a(20),c=a.n(h),u=a(17),d=a(2),m=a(21),g=a(41),f=a.n(g),b=a(42),w=a.n(b),p=a(33),M=a(6);function j({imageConfig:e,onChange:t,onClear:a,onError:n,onLoad:r,onClick:i,className:h,containerCSS:m,isScreenshotMode:g}){var f,b,w;const{euiTheme:j}=Object(u.useEuiTheme)(),{getImageDownloadHref:y,validateUrl:x}=Object(M.b)(),v=Object(p.a)(e,{validateUrl:x}),E="url"===e.src.type?e.src.url:y(e.src.fileId),[I,C]=Object(o.useState)(!1);return Object(o.useEffect)((()=>{C(!1)}),[E]),Object(l.jsx)("div",{css:[Object(l.css)("position:relative;width:100%;height:100%;border-radius:",j.border.radius.medium,";.visually-hidden{visibility:hidden;}",""),m,"",""]},(I||!v)&&Object(l.jsx)(O,null),v&&Object(l.jsx)(s.a,{src:E,alt:null!==(f=e.altText)&&void 0!==f?f:"",className:c()(h,{"visually-hidden":I}),title:t?d.i18n.translate("imageEmbeddable.imageViewer.selectDifferentImageTitle",{defaultMessage:"Select a different image"}):void 0,loading:g?"eager":"lazy",style:{width:"100%",height:"100%",objectFit:null!==(b=null==e||null===(w=e.sizing)||void 0===w?void 0:w.objectFit)&&void 0!==b?b:"contain",cursor:t||i?"pointer":"initial",display:"block",backgroundColor:e.backgroundColor},wrapperProps:{style:{display:"block",height:"100%",width:"100%"}},onClick:()=>{t&&t(),i&&i()},onLoad:()=>{r&&r()},onError:()=>{C(!0),n&&n()}}),a&&Object(l.jsx)(u.EuiButtonIcon,{style:{position:"absolute",top:"-4px",right:"-4px"},display:"fill",iconType:"cross","aria-label":"Clear",color:"danger",onClick:()=>{a&&a()}}))}var y={name:"1kzq5ms",styles:"height:100%;width:100%"},x={name:"4dtn9k",styles:"object-fit:contain;height:100%;width:100%"},v={name:"1cx8159",styles:"position:absolute;top:0;left:0;right:0;bottom:0;.euiPanel,.euiEmptyPrompt__main{height:100%;width:100%;max-width:none;}"};function O(){const[e,t]=i.a.useState(null),a=Object(u.useIsWithinBreakpoints)(["l","xl"],!0),n=Object(u.useResizeObserver)(e);let r="none";return r=e?n.height>200&&n.width>320&&a?"image-and-text":"only-image":"none",Object(l.jsx)("div",{ref:e=>t(e),css:v},"only-image"===r&&Object(l.jsx)(E,{css:x,wrapperProps:{css:y}}),"image-and-text"===r&&Object(l.jsx)(u.EuiEmptyPrompt,{color:"transparent",icon:Object(l.jsx)(E,null),title:Object(l.jsx)("p",null,Object(l.jsx)(m.FormattedMessage,{id:"imageEmbeddable.imageViewer.notFoundTitle",defaultMessage:"Image not found"})),layout:"horizontal",body:Object(l.jsx)("p",null,Object(l.jsx)(m.FormattedMessage,{id:"imageEmbeddable.imageViewer.notFoundMessage",defaultMessage:"We can't find the image you're looking for. It might have been removed, renamed, or it didn't exist in the first place."}))}))}const E=i.a.memo((e=>Object(l.jsx)(u.EuiImage,r()({},e,{"data-test-subj":"imageNotFound",srcSet:`${f.a} 1x, ${w.a} 2x`,src:f.a,alt:d.i18n.translate("imageEmbeddable.imageViewer.notFoundImageAltText",{defaultMessage:"An outer space illustration. In the background is a large moon and two planets. In the foreground is an astronaut floating in space and the numbers '404'."})}))))},27:function(e,t,a){"use strict";a.d(t,"a",(function(){return s})),a.d(t,"b",(function(){return l})),a.d(t,"c",(function(){return r})),a.d(t,"d",(function(){return u}));var n=a(40);function r(e){var t;return Boolean(null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))}const o={width:120,height:120};function i(e,t){const a=Math.abs(Math.min(Math.min(o.width/e,o.height/t),1)-1);return{width:Math.floor(e-a*e),height:Math.floor(t-a*t)}}async function l(e){const t=window.URL.createObjectURL(e);try{const e=await(a=t,new Promise(((e,t)=>{const n=new window.Image;n.src=a,n.onload=()=>e(n),n.onerror=t}))),r=document.createElement("canvas"),{width:o,height:l}=i(e.width,e.height);r.width=o,r.height=l;const s=r.getContext("2d");if(!s)throw new Error("Could not get 2d canvas context!");s.drawImage(e,0,0,o,l);const h=s.getImageData(0,0,o,l);return{blurhash:n.encode(h.data,h.width,h.height,4,4),width:e.width,height:e.height}}catch(e){return}finally{window.URL.revokeObjectURL(t)}var a}function s({width:e,height:t,hash:a}){const r=document.createElement("canvas"),{width:o,height:l}=i(e,t);r.width=o,r.height=l;const s=r.getContext("2d"),h=s.createImageData(o,l);h.data.set(n.decode(a,o,l)),s.putImageData(h,0,0);const c=document.createElement("canvas");return c.width=e,c.height=t,c.getContext("2d").drawImage(r,0,0,e,t),c.toDataURL()}var h=a(5),c=a.n(h);function u(e){return c()(e,e.getValue())}},30:function(e,t,a){e.exports=a(11)(1466)},33:function(e,t,a){"use strict";function n(e,{validateUrl:t}){if(!e.src)return!1;if("file"===e.src.type){if(!e.src.fileId)return!1}else if("url"===e.src.type){if(!e.src.url)return!1;if(!t(e.src.url).isValid)return!1}return!0}a.d(t,"a",(function(){return n}))},34:function(e,t,a){"use strict";a.d(t,"a",(function(){return m}));var n=a(30),r=a.n(n),o=a(0),i=a.n(o),l=a(17),s=a(27),h=a(20),c=a.n(h),u=a(1),d={name:"eqfpam",styles:"&.blurhash{animation-name:imageBlurhashFadeIn;animation-duration:1s;@keyframes imageBlurhashFadeIn{0%{opacity:0;}90%{opacity:0;}100%{opacity:1;}}}"};const m=({src:e,url:t,alt:a,onLoad:n,onError:h,meta:m,...g})=>{const f=e||t,[b,w]=Object(o.useState)(!1),{blurhash:p,width:M,height:j}=null!=m?m:{},y=i.a.useMemo((()=>{if(!(p&&M&&j))return null;try{return Object(s.a)({hash:p,width:M,height:j})}catch(e){return console.warn("Failed to generate image src from blurhash",e),null}}),[p,M,j]),x=b||!y?f:y;return Object(u.jsx)(l.EuiImage,r()({alt:null!=a?a:"",loading:"lazy"},g,{className:c()(g.className,{blurhash:x===y}),css:d,src:x,onLoad:e=>{var t;x===f?null==n||n(e):null!==(t=window)&&void 0!==t&&t.__image_stories_simulate_slow_load?setTimeout((()=>{w(!0)}),3e3):w(!0)},onError:e=>{x===f?null==h||h(e):(console.warn("Failed to load blurhash src"),w(!0))}}))}},40:function(e,t,a){var n,r=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,l=Object.prototype.hasOwnProperty,s={};((e,t)=>{for(var a in t)r(e,a,{get:t[a],enumerable:!0})})(s,{ValidationError:()=>f,decode:()=>j,encode:()=>x,isBlurhashValid:()=>w}),e.exports=(n=s,((e,t,a,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of i(t))!l.call(e,a)&&undefined!==a&&r(e,a,{get:()=>t[a],enumerable:!(n=o(t,a))||n.enumerable});return e})(r({},"__esModule",{value:!0}),n));var h=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],c=e=>{let t=0;for(let a=0;a{var a="";for(let n=1;n<=t;n++){let r=Math.floor(e)/Math.pow(83,t-n)%83;a+=h[Math.floor(r)]}return a},d=e=>{let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},m=e=>{let t=Math.max(0,Math.min(1,e));return t<=.0031308?Math.trunc(12.92*t*255+.5):Math.trunc(255*(1.055*Math.pow(t,.4166666666666667)-.055)+.5)},g=(e,t)=>(e=>e<0?-1:1)(e)*Math.pow(Math.abs(e),t),f=class extends Error{constructor(e){super(e),this.name="ValidationError",this.message=e}},b=e=>{if(!e||e.length<6)throw new f("The blurhash string must be at least 6 characters");let t=c(e[0]),a=Math.floor(t/9)+1,n=t%9+1;if(e.length!==4+2*n*a)throw new f(`blurhash length mismatch: length is ${e.length} but it should be ${4+2*n*a}`)},w=e=>{try{b(e)}catch(e){return{result:!1,errorReason:e.message}}return{result:!0}},p=e=>{let t=e>>8&255,a=255&e;return[d(e>>16),d(t),d(a)]},M=(e,t)=>{let a=Math.floor(e/361),n=Math.floor(e/19)%19,r=e%19;return[g((a-9)/9,2)*t,g((n-9)/9,2)*t,g((r-9)/9,2)*t]},j=(e,t,a,n)=>{b(e),n|=1;let r=c(e[0]),o=Math.floor(r/9)+1,i=r%9+1,l=(c(e[1])+1)/166,s=new Array(i*o);for(let t=0;t{let r=0,o=0,i=0,l=4*t;for(let s=0;s{if(n<1||n>9||r<1||r>9)throw new f("BlurHash must have between 1 and 9 components");if(t*a*4!==e.length)throw new f("Width and height must match the pixels array");let o=[];for(let i=0;in*Math.cos(Math.PI*r*e/t)*Math.cos(Math.PI*i*o/a)));o.push(l)}let i,l=o[0],s=o.slice(1),h="";if(h+=u(n-1+9*(r-1),1),s.length>0){let e=Math.max(...s.map((e=>Math.max(...e)))),t=Math.floor(Math.max(0,Math.min(82,Math.floor(166*e-.5))));i=(t+1)/166,h+=u(t,1)}else i=1,h+=u(0,1);return h+=u((e=>(m(e[0])<<16)+(m(e[1])<<8)+m(e[2]))(l),4),s.forEach((e=>{h+=u(((e,t)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*g(e[0]/t,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*g(e[1]/t,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*g(e[2]/t,.5)+9.5)))))(e,i),2)})),h}},41:function(e,t,a){e.exports=a.p+"293fa3d344a52aea7d6f5205879db037.png"},42:function(e,t,a){e.exports=a.p+"716155e9584ea2485733490713ea8187.png"}}]);