import{o as p,c as S,a as w,h as se,r as H,D as ie,m as oe,L as ae,n as D,b as $,w as V,d as y,v as ce,Z as le,x as ue}from"./entry.3193a679.js";function lt(e,t){return p(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},[w("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})])}function ut(e,t){return p(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},[w("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})])}function fe(e,t){return p(),S("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},[w("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.217 10.907a2.25 2.25 0 100 2.186m0-2.186c.18.324.283.696.283 1.093s-.103.77-.283 1.093m0-2.186l9.566-5.314m-9.566 7.5l9.566 5.314m0 0a2.25 2.25 0 103.935 2.186 2.25 2.25 0 00-3.935-2.186zm0-12.814a2.25 2.25 0 103.933-2.185 2.25 2.25 0 00-3.933 2.185z"})])}function he(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),n=r.createElement("base"),s=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(s),t&&(n.href=t),s.href=e,s.href}const ge=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function m(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}function v(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function de(e){const t=v(e,"border-left-width"),r=v(e,"border-right-width");return e.clientWidth+t+r}function me(e){const t=v(e,"border-top-width"),r=v(e,"border-bottom-width");return e.clientHeight+t+r}function q(e,t={}){const r=t.width||de(e),n=t.height||me(e);return{width:r,height:n}}function we(){let e,t;try{t=process}catch{}const r=t&&t.env?t.env.devicePixelRatio:null;return r&&(e=parseInt(r,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const g=16384;function ye(e){(e.width>g||e.height>g)&&(e.width>g&&e.height>g?e.width>e.height?(e.height*=g/e.width,e.width=g):(e.width*=g/e.height,e.height=g):e.width>g?(e.height*=g/e.width,e.width=g):(e.width*=g/e.height,e.height=g))}function R(e){return new Promise((t,r)=>{const n=new Image;n.decode=()=>t(n),n.onload=()=>t(n),n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=e})}async function pe(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function xe(e,t,r){const n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),i=document.createElementNS(n,"foreignObject");return s.setAttribute("width",`${t}`),s.setAttribute("height",`${r}`),s.setAttribute("viewBox",`0 0 ${t} ${r}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),s.appendChild(i),i.appendChild(e),pe(s)}const f=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||f(r,t)};function Se(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function be(e){return m(e).map(t=>{const r=e.getPropertyValue(t),n=e.getPropertyPriority(t);return`${t}: ${r}${n?" !important":""};`}).join(" ")}function Ee(e,t,r){const n=`.${e}:${t}`,s=r.cssText?Se(r):be(r);return document.createTextNode(`${n}{${s}}`)}function M(e,t,r){const n=window.getComputedStyle(e,r),s=n.getPropertyValue("content");if(s===""||s==="none")return;const i=ge();try{t.className=`${t.className} ${i}`}catch{return}const o=document.createElement("style");o.appendChild(Ee(i,r,n)),t.appendChild(o)}function Ce(e,t){M(e,t,":before"),M(e,t,":after")}const O="application/font-woff",U="image/jpeg",ve={woff:O,woff2:O,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:U,jpeg:U,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Re(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function I(e){const t=Re(e).toLowerCase();return ve[t]||""}function _e(e){return e.split(/,/)[1]}function T(e){return e.search(/^(data:)/)!==-1}function G(e,t){return`data:${t};base64,${e}`}async function X(e,t,r){const n=await fetch(e,t);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const s=await n.blob();return new Promise((i,o)=>{const a=new FileReader;a.onerror=o,a.onloadend=()=>{try{i(r({res:n,result:a.result}))}catch(c){o(c)}},a.readAsDataURL(s)})}const L={};function Pe(e,t,r){let n=e.replace(/\?.*/,"");return r&&(n=e),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),t?`[${t}]${n}`:n}async function A(e,t,r){const n=Pe(e,t,r.includeQueryParams);if(L[n]!=null)return L[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let s;try{const i=await X(e,r.fetchRequestInit,({res:o,result:a})=>(t||(t=o.headers.get("Content-Type")||""),_e(a)));s=G(i,t)}catch(i){s=r.imagePlaceholder||"";let o=`Failed to fetch resource: ${e}`;i&&(o=typeof i=="string"?i:i.message),o&&console.warn(o)}return L[n]=s,s}async function $e(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):R(t)}async function Le(e,t){if(e.currentSrc){const i=document.createElement("canvas"),o=i.getContext("2d");i.width=e.clientWidth,i.height=e.clientHeight,o==null||o.drawImage(e,0,0,i.width,i.height);const a=i.toDataURL();return R(a)}const r=e.poster,n=I(r),s=await A(r,n,t);return R(s)}async function ke(e){var t;try{if(!((t=e==null?void 0:e.contentDocument)===null||t===void 0)&&t.body)return await _(e.contentDocument.body,{},!0)}catch{}return e.cloneNode(!1)}async function Te(e,t){return f(e,HTMLCanvasElement)?$e(e):f(e,HTMLVideoElement)?Le(e,t):f(e,HTMLIFrameElement)?ke(e):e.cloneNode(!1)}const Ie=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT";async function Ae(e,t,r){var n,s;let i=[];return Ie(e)&&e.assignedNodes?i=m(e.assignedNodes()):f(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?i=m(e.contentDocument.body.childNodes):i=m(((s=e.shadowRoot)!==null&&s!==void 0?s:e).childNodes),i.length===0||f(e,HTMLVideoElement)||await i.reduce((o,a)=>o.then(()=>_(a,r)).then(c=>{c&&t.appendChild(c)}),Promise.resolve()),t}function Fe(e,t){const r=t.style;if(!r)return;const n=window.getComputedStyle(e);n.cssText?(r.cssText=n.cssText,r.transformOrigin=n.transformOrigin):m(n).forEach(s=>{let i=n.getPropertyValue(s);s==="font-size"&&i.endsWith("px")&&(i=`${Math.floor(parseFloat(i.substring(0,i.length-2)))-.1}px`),f(e,HTMLIFrameElement)&&s==="display"&&i==="inline"&&(i="block"),s==="d"&&t.getAttribute("d")&&(i=`path(${t.getAttribute("d")})`),r.setProperty(s,i,n.getPropertyPriority(s))})}function He(e,t){f(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),f(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function De(e,t){if(f(e,HTMLSelectElement)){const r=t,n=Array.from(r.children).find(s=>e.value===s.getAttribute("value"));n&&n.setAttribute("selected","")}}function Ve(e,t){return f(t,Element)&&(Fe(e,t),Ce(e,t),He(e,t),De(e,t)),t}async function Me(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const n={};for(let i=0;i<r.length;i++){const a=r[i].getAttribute("xlink:href");if(a){const c=e.querySelector(a),l=document.querySelector(a);!c&&l&&!n[a]&&(n[a]=await _(l,t,!0))}}const s=Object.values(n);if(s.length){const i="http://www.w3.org/1999/xhtml",o=document.createElementNS(i,"svg");o.setAttribute("xmlns",i),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const a=document.createElementNS(i,"defs");o.appendChild(a);for(let c=0;c<s.length;c++)a.appendChild(s[c]);e.appendChild(o)}return e}async function _(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>Te(n,t)).then(n=>Ae(e,n,t)).then(n=>Ve(e,n)).then(n=>Me(n,t))}const J=/url\((['"]?)([^'"]+?)\1\)/g,Oe=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Ue=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function je(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function Be(e){const t=[];return e.replace(J,(r,n,s)=>(t.push(s),r)),t.filter(r=>!T(r))}async function We(e,t,r,n,s){try{const i=r?he(t,r):t,o=I(t);let a;if(s){const c=await s(i);a=G(c,o)}else a=await A(i,o,n);return e.replace(je(t),`$1${a}$3`)}catch{}return e}function ze(e,{preferredFontFormat:t}){return t?e.replace(Ue,r=>{for(;;){const[n,,s]=Oe.exec(r)||[];if(!s)return"";if(s===t)return`src: ${n};`}}):e}function K(e){return e.search(J)!==-1}async function Q(e,t,r){if(!K(e))return e;const n=ze(e,r);return Be(n).reduce((i,o)=>i.then(a=>We(a,o,t,r)),Promise.resolve(n))}async function C(e,t,r){var n;const s=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(s){const i=await Q(s,null,r);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function qe(e,t){await C("background",e,t)||await C("background-image",e,t),await C("mask",e,t)||await C("mask-image",e,t)}async function Ge(e,t){const r=f(e,HTMLImageElement);if(!(r&&!T(e.src))&&!(f(e,SVGImageElement)&&!T(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,s=await A(n,I(n),t);await new Promise((i,o)=>{e.onload=i,e.onerror=o;const a=e;a.decode&&(a.decode=i),a.loading==="lazy"&&(a.loading="eager"),r?(e.srcset="",e.src=s):e.href.baseVal=s})}async function Xe(e,t){const n=m(e.childNodes).map(s=>Z(s,t));await Promise.all(n).then(()=>e)}async function Z(e,t){f(e,Element)&&(await qe(e,t),await Ge(e,t),await Xe(e,t))}function Je(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const n=t.style;return n!=null&&Object.keys(n).forEach(s=>{r[s]=n[s]}),e}const j={};async function B(e){let t=j[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},j[e]=t,t}async function W(e,t){let r=e.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,i=(r.match(/url\([^)]+\)/g)||[]).map(async o=>{let a=o.replace(n,"$1");return a.startsWith("https://")||(a=new URL(a,e.url).href),X(a,t.fetchRequestInit,({result:c})=>(r=r.replace(o,`url(${c})`),[o,c]))});return Promise.all(i).then(()=>r)}function z(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=e.replace(r,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const c=s.exec(n);if(c===null)break;t.push(c[0])}n=n.replace(s,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(o,"gi");for(;;){let c=i.exec(n);if(c===null){if(c=a.exec(n),c===null)break;i.lastIndex=a.lastIndex}else a.lastIndex=i.lastIndex;t.push(c[0])}return t}async function Ke(e,t){const r=[],n=[];return e.forEach(s=>{if("cssRules"in s)try{m(s.cssRules||[]).forEach((i,o)=>{if(i.type===CSSRule.IMPORT_RULE){let a=o+1;const c=i.href,l=B(c).then(h=>W(h,t)).then(h=>z(h).forEach(u=>{try{s.insertRule(u,u.startsWith("@import")?a+=1:s.cssRules.length)}catch(d){console.error("Error inserting rule from remote css",{rule:u,error:d})}})).catch(h=>{console.error("Error loading remote css",h.toString())});n.push(l)}})}catch(i){const o=e.find(a=>a.href==null)||document.styleSheets[0];s.href!=null&&n.push(B(s.href).then(a=>W(a,t)).then(a=>z(a).forEach(c=>{o.insertRule(c,s.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",i)}}),Promise.all(n).then(()=>(e.forEach(s=>{if("cssRules"in s)try{m(s.cssRules||[]).forEach(i=>{r.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${s.href}`,i)}}),r))}function Qe(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>K(t.style.getPropertyValue("src")))}async function Ze(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=m(e.ownerDocument.styleSheets),n=await Ke(r,t);return Qe(n)}async function Ye(e,t){const r=await Ze(e,t);return(await Promise.all(r.map(s=>{const i=s.parentStyleSheet?s.parentStyleSheet.href:null;return Q(s.cssText,i,t)}))).join(`
`)}async function Ne(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Ye(e,t);if(r){const n=document.createElement("style"),s=document.createTextNode(r);n.appendChild(s),e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}}async function et(e,t={}){const{width:r,height:n}=q(e,t),s=await _(e,t,!0);return await Ne(s,t),await Z(s,t),Je(s,t),await xe(s,r,n)}async function k(e,t={}){const{width:r,height:n}=q(e,t),s=await et(e,t),i=await R(s),o=document.createElement("canvas"),a=o.getContext("2d"),c=t.pixelRatio||we(),l=t.canvasWidth||r,h=t.canvasHeight||n;return o.width=l*c,o.height=h*c,t.skipAutoScale||ye(o),o.style.width=`${l}`,o.style.height=`${h}`,t.backgroundColor&&(a.fillStyle=t.backgroundColor,a.fillRect(0,0,o.width,o.height)),a.drawImage(i,0,0,o.width,o.height),o}const tt={key:0,class:"w800:hidden z-20 fixed bottom-4 right-4"},nt=w("div",{class:"w-16 h-16 flex justify-center items-center text-sm rounded-full shadow-lg bg-white cursor-pointer"}," 分享 ",-1),rt={class:"flex items-center gap-1 border rounded-lg mb-1 px-2 py-1 text-xs cursor-pointer"},st=w("span",null,"分享",-1),it={key:0},ot=w("div",{class:"fixed z-[10000] left-0 right-0 bottom-0 h-10 flex justify-center items-center bg-[rgba(0,0,0,0.2)] text-white"},[w("span",null,"长按图片保存到手机，即可分享")],-1),at={__name:"Share",props:{idStr:String,isFix:Boolean},setup(e){const{idStr:t,isFix:r}=e;se();let n=H(""),s=H(!1);const i=ie(()=>navigator?navigator.canShare&&typeof navigator.share=="function":!1);async function o(){try{s.value=!0;const l=await a();if(s.value=!1,!l)throw new Error("failed to get screenshot canvas");l.toBlob(async h=>{const u=new File([h],`screenshot-${Date.now()}.jpg`,{type:"image/jpeg"}),d={title:"分享截图",files:[u]};if(i.value)await navigator.share(d);else throw n.value=URL.createObjectURL(u),new Error("cannot share such content")},"image/jpeg",.9),gtag("event","share",{screenshot:JSON.stringify({status:"success",ua:navigator.userAgent})})}catch{alert("分享截图失败"),gtag("event","share",{screenshot:JSON.stringify({status:"success",ua:navigator.userAgent})})}}async function a(l=16,h="#f3f4f6"){try{const u=t.split(","),d=document.querySelector(u[0]),x=document.getElementById(u[1]),b=document.getElementById(u[2]);if(!d||!x||!b)return null;const Y={height:d.offsetHeight},N={height:x.offsetHeight},ee={height:b.offsetHeight},te=await k(d,Y),ne=await k(x,N),re=await k(b,ee),P=document.createElement("canvas"),E=screen.width*window.devicePixelRatio,F=(d.offsetHeight+x.offsetHeight+b.offsetHeight+l*3)*window.devicePixelRatio;return P.width=E,P.height=F,destCtx.fillStyle=h,destCtx.fillRect(0,0,E,F),destCtx.drawImage(te,0,0),destCtx.drawImage(ne,(E-x.offsetWidth*window.devicePixelRatio)/2,(d.offsetHeight+l)*window.devicePixelRatio),destCtx.drawImage(re,(E-b.offsetWidth*window.devicePixelRatio)/2,(d.offsetHeight+x.offsetHeight+l*2)*window.devicePixelRatio),P}catch{return null}}const c=oe(ae,{style:{fontSize:"24px"},spin:!0});return(l,h)=>{const u=D("a-spin"),d=D("a-image");return p(),S("div",null,[w("div",{onClick:o},[e.isFix?(p(),S("div",tt,[$(u,{spinning:y(s),indicator:y(c)},{default:V(()=>[nt]),_:1},8,["spinning","indicator"])])):(p(),ce(u,{key:1,spinning:y(s),indicator:y(c)},{default:V(()=>[w("div",rt,[st,$(y(fe),{class:"w-4"})])]),_:1},8,["spinning","indicator"]))]),y(n)?(p(),S("div",it,[$(d,{preview:{visible:!!y(n),onVisibleChange:()=>le(n)?n.value="":n=""},src:y(n)},null,8,["preview","src"]),ot])):ue("",!0)])}}},ft=at;export{ft as S,ut as a,lt as r};
