"use strict";(globalThis.webpackChunkweb_stories_wp=globalThis.webpackChunkweb_stories_wp||[]).push([[3182],{10183:(t,e,n)=>{n.r(e),n.d(e,{getFontEmbedCSS:()=>_,toBlob:()=>B,toCanvas:()=>F,toJpeg:()=>O,toPixelData:()=>j,toPng:()=>q,toSvg:()=>U});const r="application/font-woff",o="image/jpeg",i={woff:r,woff2:r,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:o,jpeg:o,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"};function a(t){const e=function(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return i[e]||""}function s(t){return-1!==t.search(/^(data:)/)}function c(t,e){return`data:${e};base64,${t}`}async function l(t,e,n){const r=await fetch(t,e);if(404===r.status)throw new Error(`Resource "${r.url}" not found`);const o=await r.blob();return new Promise(((t,e)=>{const i=new FileReader;i.onerror=e,i.onloadend=()=>{try{t(n({res:r,result:i.result}))}catch(t){e(t)}},i.readAsDataURL(o)}))}const u={};async function h(t,e,n){const r=function(t,e,n){let r=t.replace(/\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),e?`[${e}]${r}`:r}(t,e,n.includeQueryParams);if(null!=u[r])return u[r];let o;n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+(new Date).getTime());try{const r=await l(t,n.fetchRequestInit,(({res:t,result:n})=>(e||(e=t.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n))));o=c(r,e)}catch(e){o=n.imagePlaceholder||"";let r=`Failed to fetch resource: ${t}`;e&&(r="string"==typeof e?e:e.message),r&&console.warn(r)}return u[r]=o,o}const f=(()=>{let t=0;return()=>(t+=1,`u${`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4)}${t}`)})();function d(t){const e=[];for(let n=0,r=t.length;n{const r=new Image;r.onerror=n,r.crossOrigin="anonymous",r.decoding="sync",r.src=t,r.decode().then((()=>e(r))).catch(n)}))}async function y(t,e,n){const r="http://www.w3.org/2000/svg",o=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return o.setAttribute("width",`${e}`),o.setAttribute("height",`${n}`),o.setAttribute("viewBox",`0 0 ${e} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),o.appendChild(i),i.appendChild(t),async function(t){return Promise.resolve().then((()=>(new XMLSerializer).serializeToString(t))).then(encodeURIComponent).then((t=>`data:image/svg+xml;charset=utf-8,${t}`))}(o)}function b(t,e,n){const r=`.${t}:${e}`,o=n.cssText?function(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}(n):function(t){return d(t).map((e=>`${e}: ${t.getPropertyValue(e)}${t.getPropertyPriority(e)?" !important":""};`)).join(" ")}(n);return document.createTextNode(`${r}{${o}}`)}function S(t,e,n){const r=window.getComputedStyle(t,n),o=r.getPropertyValue("content");if(""===o||"none"===o)return;const i=f();try{e.className=`${e.className} ${i}`}catch(t){return}const a=document.createElement("style");a.appendChild(b(i,n,r)),e.appendChild(a)}async function E(t,e){return t instanceof HTMLCanvasElement?async function(t){const e=t.toDataURL();return"data:,"===e?t.cloneNode(!1):m(e)}(t):t instanceof HTMLVideoElement&&t.poster?async function(t,e){const n=t.poster,r=a(n);return m(await h(n,r,e))}(t,e):t.cloneNode(!1)}const $=t=>null!=t.tagName&&"SLOT"===t.tagName.toUpperCase();function x(t,e){return e instanceof Element&&(function(t,e){const n=e.style;if(!n)return;const r=window.getComputedStyle(t);r.cssText?(n.cssText=r.cssText,n.transformOrigin=r.transformOrigin):d(r).forEach((t=>{let e=r.getPropertyValue(t);if("font-size"===t&&e.endsWith("px")){const t=Math.floor(parseFloat(e.substring(0,e.length-2)))-.1;e=`${t}px`}n.setProperty(t,e,r.getPropertyPriority(t))}))}(t,e),function(t,e){S(t,e,":before"),S(t,e,":after")}(t,e),function(t,e){t instanceof HTMLTextAreaElement&&(e.innerHTML=t.value),t instanceof HTMLInputElement&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(t instanceof HTMLSelectElement){const n=e,r=Array.from(n.children).find((e=>t.value===e.getAttribute("value")));r&&r.setAttribute("selected","")}}(t,e)),e}async function C(t,e,n){return n||!e.filter||e.filter(t)?Promise.resolve(t).then((t=>E(t,e))).then((n=>async function(t,e,n){var r;const o=$(t)&&t.assignedNodes?d(t.assignedNodes()):d((null!==(r=t.shadowRoot)&&void 0!==r?r:t).childNodes);return 0===o.length||t instanceof HTMLVideoElement||await o.reduce(((t,r)=>t.then((()=>C(r,n))).then((t=>{t&&e.appendChild(t)}))),Promise.resolve()),e}(t,n,e))).then((e=>x(t,e))):null}const P=/url\((['"]?)([^'"]+?)\1\)/g,v=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,R=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;async function T(t,e,n,r,o){try{const i=n?function(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),e&&(r.href=e),o.href=t,o.href}(e,n):e,s=a(e);let l;if(o){l=c(await o(i),s)}else l=await h(i,s,r);return t.replace(function(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}(e),`$1${l}$3`)}catch(t){}return t}function L(t){return-1!==t.search(P)}async function k(t,e,n){if(!L(t))return t;const r=function(t,{preferredFontFormat:e}){return e?t.replace(R,(t=>{for(;;){const[n,,r]=v.exec(t)||[];if(!r)return"";if(r===e)return`src: ${n};`}})):t}(t,n),o=function(t){const e=[];return t.replace(P,((t,n,r)=>(e.push(r),t))),e.filter((t=>!s(t)))}(r);return o.reduce(((t,r)=>t.then((t=>T(t,r,e,n)))),Promise.resolve(r))}async function A(t,e){t instanceof Element&&(await async function(t,e){var n;const r=null===(n=t.style)||void 0===n?void 0:n.getPropertyValue("background");if(r){const n=await k(r,null,e);t.style.setProperty("background",n,t.style.getPropertyPriority("background"))}}(t,e),await async function(t,e){if((!(t instanceof HTMLImageElement)||s(t.src))&&(!(t instanceof SVGImageElement)||s(t.href.baseVal)))return;const n=t instanceof HTMLImageElement?t.src:t.href.baseVal,r=await h(n,a(n),e);await new Promise(((e,n)=>{t.onload=e,t.onerror=n,t instanceof HTMLImageElement?(t.srcset="",t.src=r):t.href.baseVal=r}))}(t,e),await async function(t,e){const n=d(t.childNodes).map((t=>A(t,e)));await Promise.all(n).then((()=>t))}(t,e))}const N={};async function I(t){let e=N[t];if(null!=e)return e;const n=await fetch(t);return e={url:t,cssText:await n.text()},N[t]=e,e}async function M(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map((async o=>{let i=o.replace(r,"$1");return i.startsWith("https://")||(i=new URL(i,t.url).href),l(i,e.fetchRequestInit,(({result:t})=>(n=n.replace(o,`url(${t})`),[o,t])))}));return Promise.all(o).then((()=>n))}function V(t){if(null==t)return[];const e=[];let n=t.replace(/(\/\*[\s\S]*?\*\/)/gi,"");const r=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const t=r.exec(n);if(null===t)break;e.push(t[0])}n=n.replace(r,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let t=o.exec(n);if(null===t){if(t=i.exec(n),null===t)break;o.lastIndex=i.lastIndex}else i.lastIndex=o.lastIndex;e.push(t[0])}return e}async function D(t,e){if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");const n=d(t.ownerDocument.styleSheets),r=await async function(t,e){const n=[],r=[];return t.forEach((n=>{if("cssRules"in n)try{d(n.cssRules||[]).forEach(((t,o)=>{if(t.type===CSSRule.IMPORT_RULE){let i=o+1;const a=I(t.href).then((t=>M(t,e))).then((t=>V(t).forEach((t=>{try{n.insertRule(t,t.startsWith("@import")?i+=1:n.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}})))).catch((t=>{console.error("Error loading remote css",t.toString())}));r.push(a)}}))}catch(o){const i=t.find((t=>null==t.href))||document.styleSheets[0];null!=n.href&&r.push(I(n.href).then((t=>M(t,e))).then((t=>V(t).forEach((t=>{i.insertRule(t,n.cssRules.length)})))).catch((t=>{console.error("Error loading remote stylesheet",t.toString())}))),console.error("Error inlining remote css file",o.toString())}})),Promise.all(r).then((()=>(t.forEach((t=>{if("cssRules"in t)try{d(t.cssRules||[]).forEach((t=>{n.push(t)}))}catch(e){console.error(`Error while reading CSS rules from ${t.href}`,e.toString())}})),n)))}(n,e);return function(t){return t.filter((t=>t.type===CSSRule.FONT_FACE_RULE)).filter((t=>L(t.style.getPropertyValue("src"))))}(r)}async function H(t,e){const n=await D(t,e);return(await Promise.all(n.map((t=>{const n=t.parentStyleSheet?t.parentStyleSheet.href:null;return k(t.cssText,n,e)})))).join("\n")}async function U(t,e={}){const{width:n,height:r}=p(t,e),o=await C(t,e,!0);await async function(t,e){const n=null!=e.fontEmbedCSS?e.fontEmbedCSS:e.skipFonts?null:await H(t,e);if(n){const e=document.createElement("style"),r=document.createTextNode(n);e.appendChild(r),t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}}(o,e),await A(o,e),function(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const r=e.style;null!=r&&Object.keys(r).forEach((t=>{n[t]=r[t]}))}(o,e);return await y(o,n,r)}async function F(t,e={}){const{width:n,height:r}=p(t,e),o=await U(t,e),i=await m(o),a=document.createElement("canvas"),s=a.getContext("2d"),c=e.pixelRatio||function(){let t,e;try{e=process}catch(t){}const n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),l=e.canvasWidth||n,u=e.canvasHeight||r;return a.width=l*c,a.height=u*c,e.skipAutoScale||function(t){(t.width>w||t.height>w)&&(t.width>w&&t.height>w?t.width>t.height?(t.height*=w/t.width,t.width=w):(t.width*=w/t.height,t.height=w):t.width>w?(t.height*=w/t.width,t.width=w):(t.width*=w/t.height,t.height=w))}(a),a.style.width=`${l}`,a.style.height=`${u}`,e.backgroundColor&&(s.fillStyle=e.backgroundColor,s.fillRect(0,0,a.width,a.height)),s.drawImage(i,0,0,a.width,a.height),a}async function j(t,e={}){const{width:n,height:r}=p(t,e);return(await F(t,e)).getContext("2d").getImageData(0,0,n,r).data}async function q(t,e={}){return(await F(t,e)).toDataURL()}async function O(t,e={}){return(await F(t,e)).toDataURL("image/jpeg",e.quality||1)}async function B(t,e={}){const n=await F(t,e),r=await function(t,e={}){return t.toBlob?new Promise((n=>{t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((n=>{const r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),o=r.length,i=new Uint8Array(o);for(let t=0;t