👁 查看:658.js
路径:/home/forge/kingkrunch.com/wp/wp-content/plugins/simple-history/build/658.js
大小:2.77 KB · 修改:2026-09-25 00:42:29 · 权限:0644 · 可写
"use strict";(globalThis.webpackChunksimple_history||=[]).push([[658],{455(e,t,i){i.d(t,{a:()=>a});var n=i(887);function r(e){let t=function(e){let t=[],i="",n=0;for(let r=0;r<e.length;r++){let l=e[r];"("===l&&n++,")"===l&&(n=Math.max(0,n-1)),";"===l&&0===n?(t.push(i),i=""):i+=l}return i.trim()&&t.push(i),t.map((e=>e.trim())).filter(Boolean)}(e),i=null,n=null,r=null,l=[];for(let e of t){let t=e.indexOf(":");if(t<0)continue;let a=e.slice(0,t).trim().toLowerCase(),o=e.slice(t+1).trim();"box-shadow"===a?r=o:"filter"===a?i=o:"-webkit-filter"===a?n=o:l.push([a,o])}if(r){let e=function(e){let t=[],i="",n=0;for(let r=0;r<e.length;r++){let l=e[r];"("===l&&n++,")"===l&&(n=Math.max(0,n-1)),","===l&&0===n?(t.push(i.trim()),i=""):i+=l}i.trim()&&t.push(i.trim());let r=[];for(let e of t){if(/\binset\b/i.test(e))continue;let t=e.match(/-?\d+(?:\.\d+)?px/gi)||[],[i="0px",n="0px",l="0px"]=t,a=e.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/gi,"").trim().replace(/\s{2,}/g," "),o=!!a&&","!==a;r.push(`drop-shadow(${i} ${n} ${l}${o?` ${a}`:""})`)}return r.join(" ")}(r);e&&(i=i?`${i} ${e}`:e,n=n?`${n} ${e}`:e)}let a=[...l];return i&&a.push(["filter",i]),n&&a.push(["-webkit-filter",n]),a.map((([e,t])=>`${e}:${t}`)).join(";")}function l(e){if(!(0,n.b)()||!function(e){return"string"==typeof e&&/^data:image\/svg\+xml/i.test(e)}(e))return e;try{let t=function(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}(e);return function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}(function(e){return(e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,((e,t)=>e.replace(t,function(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,((e,t,i)=>`${t}{${r(i)}}`))}(t))))).replace(/style=(['"])([\s\S]*?)\1/gi,((e,t,i)=>`style=${t}${r(i)}${t}`))}(t))}catch{return e}}async function a(e,t){let{width:i,height:n,scale:r=1,dpr:a=1,meta:o={},backgroundColor:s}=t;e=l(e);let u=new Image;u.loading="eager",u.decoding="sync",u.crossOrigin="anonymous",u.src=e,await u.decode();let c,m,h=u.naturalWidth,p=u.naturalHeight,d=Number.isFinite(o.w0)?o.w0:h,f=Number.isFinite(o.h0)?o.h0:p,g=Number.isFinite(i),x=Number.isFinite(n);g&&x?(c=Math.max(1,i),m=Math.max(1,n)):g?(c=i,m=f*(i/Math.max(1,d))):x?(m=n,c=d*(n/Math.max(1,f))):(c=h,m=p),c*=r,m*=r;let $=document.createElement("canvas");$.width=c*a,$.height=m*a,$.style.width=`${c}px`,$.style.height=`${m}px`;let b=$.getContext("2d");return 1!==a&&b.scale(a,a),s&&(b.save(),b.fillStyle=s,b.fillRect(0,0,c,m),b.restore()),b.drawImage(u,0,0,c,m),$}},276(e,t,i){i.d(t,{a:()=>r});var n=i(455);async function r(e,t){let i=t.type;if("svg"===i){let t=decodeURIComponent(e.split(",")[1]);return new Blob([t],{type:"image/svg+xml"})}let r=await(0,n.a)(e,t);return new Promise((e=>r.toBlob((t=>e(t)),`image/${i}`,t.quality)))}},658(e,t,i){i.d(t,{toBlob:()=>n.a});var n=i(276)}}]);