cd ..
root@paste:~/cofbkCCQ4$cat paste
paste://cofbkCCQ4PUBLIC
public paste

cofbkCCQ4

—26 views92,254 chars92.7 KB

stdout

Paste content

>_javascriptauto-detected
// ==UserScript==
// @name         图集连续看图与广告跳转拦截
// @namespace    local.gallery.reader
// @version      1.0.4
// @downloadURL  https://paste.brianrianrehan.com/raw/cofbkCCQ4
// @updateURL    https://paste.brianrianrehan.com/raw/cofbkCCQ4
// @description  整套分页识别并核对总数、悬浮看图和原位返回、ZIP打包及下载诊断。
// @match        *://*/*
// @run-at       document-start
// @grant        GM_download
// @grant        GM.download
// @grant        unsafeWindow
// @grant        GM_xmlhttpRequest
// @grant        GM.xmlHttpRequest
// @connect      *
// ==/UserScript==

(function () {
  'use strict';
  if (window.top !== window.self) return;
  /* 1.0.4 · 2026-11-03: all-site matching; visible startup diagnostics;
     site-scoped protection; confirmed mobile ad-loader guard; tolerant image detection.
     1.0.4: known-site homepage preview cards are not treated as a full album. */
  /* 1.0.4 · 2026-11-03:界面Shadow/顶层隔离,整套分页目录和标注总数核对,原位返回,fflate ZIP,下载回调诊断。 */
  var origin = location.origin;

  var albumPath = location.pathname;
  var albumPage = false;
  var cache = new Map(), current = null, index = 0, overlay = null, picture = null, info = null;
  var prevButton = null, nextButton = null, entry = null, active = false, loading = false, controller = null, generation = 0, imageFolder = '', basePage = 0;
  var pageWindow=typeof unsafeWindow!=='undefined' && unsafeWindow ? unsafeWindow : window;
  var singleton=pageWindow.__bmGalleryAssistantV1;
  if(singleton && singleton.document===document)return;
  pageWindow.__bmGalleryAssistantV1={document:document,version:'1.0.4'};
  var knownSite=/(^|\.)gcliuchu\d+\.cyou$/i.test(location.hostname), protection=knownSite, blocked=0, tools=null, diagnostic=null, lastScan='正在识别图片';
  var protectionKey='bm-gallery-protection-v1';
  try{var storedProtection=localStorage.getItem(protectionKey);if(storedProtection==='1'||storedProtection==='0')protection=storedProtection==='1';}catch(_){}
  function block(){blocked++;updateDiagnostic();}
  var sdkInstalled=false,sdkValue;
  function guardSdk(){
    if(!protection || sdkInstalled)return;
    try{var descriptor=Object.getOwnPropertyDescriptor(pageWindow,'idia');if(descriptor&&!descriptor.configurable)return;sdkValue=pageWindow.idia;
      Object.defineProperty(pageWindow,'idia',{configurable:true,get:function(){return protection?function(){block();}:sdkValue;},set:function(value){sdkValue=value;}});sdkInstalled=true;
    }catch(_){}
  }
  guardSdk();
  var downloadButton=null,stopButton=null,downloadStatus=null,downloading=false,downloadGeneration=0,downloadController=null,downloadHandle=null,preloadedImage=null;

  function siteUrl(raw, base) {
    try { var url = new URL(raw, base || location.href);return /^https?:$/.test(url.protocol) && url.origin === origin && !url.username && !url.password ? url : null; }
    catch (_) { return null; }
  }
  function outbound(raw) {
    if (!raw || /^\s*(?:#|mailto:|tel:)/i.test(raw) || /^\s*javascript:\s*(?:void\s*\(\s*0\s*\)\s*;?|;)\s*$/i.test(raw)) return false;
    if (/^\s*javascript:/i.test(raw)) return true;
    try {var u = new URL(raw, location.href);return /^(?:https?:)$/.test(u.protocol) && (u.origin !== origin || /^\/link\/go\/?$/.test(u.pathname));}
    catch (_) {return true;}
  }
  function mediaUrl(raw, base) {
    try {
      var u = new URL(raw, base);
      if (!/^https?:$/.test(u.protocol) || u.username || u.password || !/\.(?:jpe?g|png|webp|gif|avif)(?:$)/i.test(u.pathname)) return null;
      return u.href;
    } catch (_) { return null; }
  }
  function pageNumber(url) {
    var text = url.searchParams.get('page');if (text === null) return 1;
    return /^[1-9]\d{0,4}$/.test(text) ? Number(text) : 0;
  }
  function parsePage(doc,url){
    if(!siteUrl(url.href)||url.pathname!==albumPath)throw new Error('图集地址不匹配');if(doc.querySelector('input[name="GOEDGE_WAF_CAPTCHA_CODE"]'))throw new Error('下一页需要验证或登录');
    var images=collectImages(doc,url.href);if(!images.length){if(doc.querySelector('#loginForm,input[type="password"]')||/登录|验证|captcha|sign in/i.test(doc.title||''))throw new Error('下一页需要验证或登录');throw new Error('未识别到图集大图,请打开具体图集');}
    var number=pageNumber(url)||1,previous=null,next=null,links=[],max=number;
    doc.querySelectorAll('.pagination a[href],.pager a[href],a[rel="next"],a[rel="prev"]').forEach(function(a){var u=siteUrl(a.getAttribute('href'),url.href);if(!u||u.pathname!==albumPath)return;var n=pageNumber(u);if(!n)return;links.push(u.href);max=Math.max(max,n);if(n===number-1)previous=u.href;if(n===number+1)next=u.href;});
    return {url:url.href,number:number,images:images,previous:previous,next:next,links:links,max:max,expected:expectedCount(doc)};
  }
  function createStyle() {
    var existingStyle=document.getElementById('bm-gallery-style');if(existingStyle)existingStyle.remove();
    if (!document.head && !document.documentElement) {document.addEventListener('DOMContentLoaded',createStyle,{once:true});return;}
    var style=document.createElement('style');style.id='bm-gallery-style';
    style.textContent=(protection&&(knownSite||document.querySelector('.links-grid a[href*="/link/go"]'))?'a[href^="/link/go"],a[href^="'+origin+'/link/go"],.links-grid{display:none!important}':'') +
      '#bm-gallery-entry{position:fixed;z-index:2147482000;left:12px;top:calc(100vh - 72px);top:calc(100dvh - 72px);border:0;border-radius:25px;padding:12px 18px;background:#266d5d;color:#fff;font:600 15px sans-serif;box-shadow:0 3px 12px #0005;touch-action:manipulation}' +
      '#bm-gallery{position:fixed;top:0;left:0;width:100vw;max-width:100vw;height:100vh;height:100dvh;z-index:2147483647;background:#111;color:#fff;display:flex;flex-direction:column;align-items:center;justify-content:space-between;box-sizing:border-box;font:15px/1.4 sans-serif;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}' +
      '#bm-gallery[hidden]{display:none!important}#bm-gallery *{box-sizing:border-box}' +
      '#bm-gallery .bm-top{width:100%;display:flex;align-items:center;justify-content:space-between;padding:8px 12px;gap:8px;min-height:52px}' +
      '#bm-gallery .bm-stage{flex:1;min-height:0;width:100%;display:flex;align-items:center;justify-content:center;overflow:auto;touch-action:pan-y}' +
      '#bm-gallery img{display:block;max-width:100%;max-height:100%;object-fit:contain}' +
      '#bm-gallery .bm-controls{width:100%;max-width:100%;min-width:0;display:flex;align-items:center;justify-content:center;gap:8px;padding:10px 8px 16px;flex-wrap:wrap}' +
      '#bm-gallery button{min-height:44px;min-width:72px;border:1px solid #ffffff66;border-radius:10px;background:#2b2b2b;color:#fff;padding:8px 14px;font:15px sans-serif;touch-action:manipulation}' +
      '#bm-gallery button:disabled{opacity:.35}#bm-gallery [data-bm-gallery-status]{font-size:13px;color:#ddd;text-align:center;overflow-wrap:anywhere}';
    (document.head || document.documentElement).appendChild(style);
  }
  createStyle();

  // Block confirmed outbound ad links and the site's own redirect endpoint.
  // Browser-level rules are still needed for redirects not caused by a click or window.open.
  var originalOpen=pageWindow.open;
  try {pageWindow.open=function(url){if(!protection)return originalOpen.apply(pageWindow,arguments);var destination=url && siteUrl(String(url));if(!destination || /^\/link\/go\/?$/.test(destination.pathname)){block();return null;}return originalOpen.apply(pageWindow,arguments);};} catch (_) {}
  function intercept(event){
    if(ownEvent(event))return;var target=event.target;if(!target||!target.closest)return;
    var src=clickedImage(target);if(src){if(event.type==='click'||event.type==='auxclick')event.preventDefault();event.stopImmediatePropagation();if(event.type==='click')openPicture(src);return;}
    var a=target.closest('a[href]');if(!a)return;
    if(protection&&outbound(a.getAttribute('href'))){if(event.type==='click'||event.type==='auxclick')event.preventDefault();event.stopImmediatePropagation();block();}
  }
  window.addEventListener('click',intercept,true);
  window.addEventListener('auxclick',intercept,true);

  function button(text,label,action){
    var b=document.createElement('button');b.type='button';b.textContent=text;b.setAttribute('aria-label',label);buttonActions.set(b,action);
    important(b,{'min-height':'44px','min-width':'60px',border:'1px solid #888','border-radius':'9px',padding:'8px 12px',background:'#294f47',color:'#fff',font:'15px sans-serif','pointer-events':'auto','touch-action':'manipulation',display:'inline-block'});
    b.addEventListener('click',action);return b;
  }
  function installViewer(){ensureUiRoot();if(overlay)return;
    overlay=document.createElement('div');overlay.id='bm-gallery';overlay.hidden=true;overlay.setAttribute('role','dialog');overlay.setAttribute('aria-label','连续看图');important(overlay,{display:'none','flex-direction':'column',background:'#111',color:'#fff','z-index':'2147483647','box-sizing':'border-box',font:'15px/1.4 sans-serif',margin:'0',padding:'0'});
    var top=document.createElement('div');important(top,{display:'flex','align-items':'center','justify-content':'space-between',padding:'8px',width:'100%','flex-shrink':'0'});info=document.createElement('span');info.setAttribute('data-bm-gallery-status','');top.appendChild(info);top.appendChild(button('关闭','关闭看图',closeViewer));overlay.appendChild(top);
    var stage=document.createElement('div');stage.className='bm-stage';important(stage,{position:'relative',display:'flex',flex:'1','min-height':'0',width:'100%','align-items':'center','justify-content':'center',overflow:'hidden'});picture=document.createElement('img');picture.alt='图集图片';important(picture,{'max-width':'100%','max-height':'100%',width:'auto',height:'auto','object-fit':'contain','pointer-events':'auto'});stage.appendChild(picture);
    var left=button('◀','上一张箭头',function(){step(-1);}),right=button('▶','下一张箭头',function(){step(1);});important(left,{position:'absolute',left:'6px',top:'45%',opacity:'.72'});important(right,{position:'absolute',right:'6px',top:'45%',opacity:'.72'});stage.appendChild(left);stage.appendChild(right);overlay.appendChild(stage);
    var row=document.createElement('div');important(row,{display:'flex','flex-wrap':'wrap',gap:'5px',padding:'8px',width:'100%','justify-content':'center','flex-shrink':'0'});prevButton=button('上一张','上一张',function(){step(-1);});nextButton=button('下一张','下一张',function(){step(1);});row.appendChild(prevButton);row.appendChild(nextButton);downloadButton=button('整套 ZIP','保存整套ZIP',startZip);row.appendChild(downloadButton);row.appendChild(button('保存本图','保存当前图片',saveCurrent));var continueView=button('继续下一包','继续生成下一包',continueZip);important(continueView,{display:'none'});zipContinueButtons.push(continueView);row.appendChild(continueView);stopButton=button('停止','停止保存图片',stopDownload);stopButton.disabled=true;row.appendChild(stopButton);overlay.appendChild(row);
    downloadStatus=document.createElement('p');downloadStatus.setAttribute('data-bm-gallery-download-status','');important(downloadStatus,{margin:'0',padding:'0 8px 8px','font-size':'12px','flex-shrink':'0'});overlay.appendChild(downloadStatus);uiRoot.appendChild(overlay);
    picture.addEventListener('error',function(){if(active)info.textContent='图片加载失败,可重试或检查网络';});positionUi();
  }
  function paint(){if(!active||!current)return;if(picture.getAttribute('src')!==current.images[index])picture.src=current.images[index];info.textContent='网页 '+current.number+' · 本页 '+(index+1)+' / '+current.images.length+' · 整套已识别 '+catalog.items.length+(catalog.expected?' / '+catalog.expected:'')+' 张';
    prevButton.disabled=loading||(index===0&&!current.previous);nextButton.disabled=loading||(index===current.images.length-1&&!current.next);if(index+1<current.images.length){preloadedImage=new Image();preloadedImage.src=current.images[index+1];}
    if(current.next&&index>=current.images.length-2&&!cache.has(current.number+1)&&!prefetchPages.has(current.next)){var nextUrl=current.next;prefetchPages.add(nextUrl);fetchAlbumPage(nextUrl).then(function(p){refreshCatalogStatus();if(active&&current&&current.next===nextUrl&&p.images[0]){preloadedImage=new Image();preloadedImage.src=p.images[0];}},function(){});}}
  var oldOverflow='';
  function openViewer(start){if(!current)return;installViewer();if(!active){returnPosition={x:scrollX,y:scrollY};oldOverflow=document.body.style.overflow;try{history.pushState({bmGallery:historyToken},'',location.href);historyOwned=true;}catch(_){} }
    active=true;index=Math.max(0,Math.min(start,current.images.length-1));overlay.hidden=false;important(overlay,{display:'flex','pointer-events':'auto'});if(tools){tools.hidden=true;tools.style.setProperty('display','none','important');}document.body.style.overflow='hidden';positionUi();paint();}
  function closeViewer(){if(!active)return;if(historyOwned&&history.state&&history.state.bmGallery===historyToken){history.back();return;}historyOwned=false;closeVisible();}
  function openFromAnchor(anchor) {
    var url=mediaUrl(anchor.getAttribute('href'),location.href);if(!url || !current)return;
    var at=current.images.indexOf(url);if(at>=0)openViewer(at);
  }
  async function loadPage(raw,from,token){var p=await fetchAlbumPage(raw);if(!active||token!==generation)throw new Error('已关闭');return p;}
  async function step(direction) {
    if (!active || loading || !current) return;
    var n=index+direction;if(n>=0 && n<current.images.length){index=n;paint();return;}
    var url=direction>0?current.next:current.previous;if(!url){info.textContent=direction>0?'已经是最后一张。':'已经是第一张。';return;}
    var previous=current,token=generation;loading=true;prevButton.disabled=nextButton.disabled=true;info.textContent='正在加载'+(direction>0?'下一':'上一')+'网页…';
    try {var page=await loadPage(url,previous,token);if(!active || generation!==token)return;current=page;index=direction>0?0:page.images.length-1;}
    catch(error){if(active && generation===token)info.textContent=error.name==='AbortError'?'网页加载超时,请重试。':(error.message || '网页加载失败,请重试。');return;}
    finally {if(active && generation===token){loading=false;prevButton.disabled=index===0&&!current.previous;nextButton.disabled=index===current.images.length-1&&!current.next;}}
    paint();
  }
  function downloadApi(){if(downloadMode==='browser')return null;if(downloadMode==='modern')return typeof GM!=='undefined'&&GM&&typeof GM.download==='function'?function(o){return GM.download(o);}:null;return typeof GM_download==='function'?function(o){return GM_download(o);}:typeof GM!=='undefined'&&GM&&typeof GM.download==='function'?function(o){return GM.download(o);}:null;}
  function updateDownload(message){downloadMessage=message;if(downloadStatus)downloadStatus.textContent=message;if(singleStatus)singleStatus.textContent=message;
    if(downloadButton)downloadButton.disabled=downloading||zipBusy;if(stopButton)stopButton.disabled=!downloading&&!zipBusy;if(entry)entry.textContent=downloading||zipBusy?'保存中 · 图集':'图集 1.0.4';}
  function stopDownload(){downloadGeneration++;zipGeneration++;downloading=false;zipBusy=false;if(zipGate){zipGate.reject(new Error('已停止'));zipGate=null;}zipContinueButtons.forEach(function(b){important(b,{display:'none'});});if(downloadHandle&&downloadHandle.abort)try{downloadHandle.abort();}catch(_){}abortImageReads();updateDownload('已停止后续保存;已保存文件保留,未完成ZIP不导出。');}
  async function downloadPage(raw,from,token){var p=await fetchAlbumPage(raw);if(!downloading||token!==downloadGeneration)throw new Error('已停止');return p;}
  function downloadOne(api,src,name,tag,token){return new Promise(function(resolve,reject){var settled=false;updateDownload('调用下载接口:'+name+';尚未收到完成回调');var waiting=setTimeout(function(){if(!settled)updateDownload('下载接口已调用3秒,仍无回调;尚未确认是否保存。可停止,重试前检查下载列表。');},3000);var timer=setTimeout(function(){finish(new Error('下载器15秒未回调,结果未知,已暂停,未自动换接口重发'));},15000);
    function finish(error){if(settled)return;settled=true;clearTimeout(waiting);clearTimeout(timer);if(token===downloadGeneration)downloadHandle=null;error?reject(error):resolve();}
    try{downloadHandle=api({url:src,name:name,tag:tag,headers:{Referer:origin+'/'},onload:function(){if(token===downloadGeneration&&downloading){updateDownload('收到下载完成回调:'+name);finish();}else finish(new Error('已停止'));},onerror:function(){finish(new Error('下载接口返回错误,请检查下载权限或更换下载方式'));}});if(downloadHandle&&typeof downloadHandle.then==='function')downloadHandle.catch(function(){finish(new Error('下载接口Promise返回错误'));});}catch(_){finish(new Error('下载接口调用失败'));}
  });}
  async function startDownload(){if(downloading||zipBusy||!current)return;var api=downloadApi();if(!api){updateDownload('未检测到所选下载接口;可点保存本图,或选择其他下载方式。');return;}downloading=true;var token=++downloadGeneration;updateDownload('开始收齐整套目录…');try{if(!await ensureCatalog(true))throw new Error('整套识别未完成:'+catalog.error);var items=catalog.items.slice();for(var i=0;i<items.length;i++){if(!downloading||token!==downloadGeneration)return;await downloadOne(api,items[i].url,String(i+1).padStart(5,'0')+'.jpg','图集',token);}if(token===downloadGeneration){downloading=false;updateDownload('全部 '+items.length+' 张收到完成回调,请检查下载目录。');}}catch(e){if(token===downloadGeneration){downloading=false;updateDownload(e.message);}}}
  function collectImages(doc,base){
    var images=[],items=Array.from(doc.querySelectorAll('.thumb-item'));
    items.forEach(function(item){var a=item.querySelector('a[href]'),img=item.querySelector('img'),src=a&&mediaUrl(a.getAttribute('href'),base);if(!src&&img)try{var u=new URL(img.getAttribute('data-full')||img.getAttribute('data-original')||img.getAttribute('data-url')||img.getAttribute('data-src')||img.getAttribute('src'),base);if(/^https?:$/.test(u.protocol)&&!u.username&&!u.password)src=u.href;}catch(_){}if(src)images.push(src);});
    if(knownSite&&!images.length)return [];
    if(!images.length)doc.querySelectorAll('img').forEach(function(img){if(img.closest('#bm-gallery-ui-root,.links-grid'))return;var a=img.closest('a[href]'),w=img.naturalWidth||Number(img.getAttribute('width')),h=img.naturalHeight||Number(img.getAttribute('height'));var src=a&&mediaUrl(a.getAttribute('href'),base);if(!src&&(w>=300&&h>=200))try{var u=new URL(img.getAttribute('data-full')||img.getAttribute('data-original')||img.getAttribute('data-src')||img.getAttribute('src'),base);if(/^https?:$/.test(u.protocol)&&!u.username&&!u.password)src=u.href;}catch(_){}if(src)images.push(src);});
    return Array.from(new Set(images));
  }
  function updateDiagnostic(){if(diagnostic)diagnostic.textContent='v1.0.4 · '+location.hostname+' · '+(protection?'本站保护已开':'本站保护未开')+' · 拦截 '+blocked+' 次 · 下载接口 '+(downloadApi()?'函数存在,等待实际回调确认':'未检测到')+' · '+lastScan;}
  function scan(){bindInteractionEvents();if(active||downloading||zipBusy)return;
    try{var p=parsePage(document,new URL(location.href));current=p;basePage=p.number;cache.set(basePage,p);albumPage=true;lastScan='本页 '+p.images.length+' 张';if(!catalog.started){catalog.expected=p.expected||0;catalog.max=p.max||p.number;}}
    catch(e){current=null;albumPage=false;lastScan=e.message;}updateDiagnostic();refreshCatalogStatus();}
  function installTools(){bindInteractionEvents();ensureUiRoot();if(entry&&entry.isConnected)return;createStyle();
    entry=button('图集 1.0.4','图集脚本状态与工具',function(){tools.hidden=!tools.hidden;tools.style.setProperty('display',tools.hidden?'none':'block','important');scan();});entry.id='bm-gallery-entry';uiRoot.appendChild(entry);
    tools=document.createElement('section');tools.id='bm-gallery-tools';tools.hidden=true;important(tools,{display:'none',background:'#fff',color:'#222',border:'1px solid #888','border-radius':'12px',padding:'12px',font:'14px/1.5 sans-serif','z-index':'2147483646','pointer-events':'auto'});
    diagnostic=document.createElement('p');diagnostic.id='bm-gallery-diagnostics';tools.appendChild(diagnostic);catalogStatus=document.createElement('p');catalogStatus.id='bm-gallery-catalog-status';tools.appendChild(catalogStatus);
    function add(t,l,a){var b=button(t,l,a);b.style.setProperty('margin','3px','important');tools.appendChild(b);}
    add('查看图片','查看图片',function(){scan();if(!current)return;tools.hidden=true;tools.style.setProperty('display','none','important');openViewer(0);});
    add('整套 ZIP','保存整套ZIP',function(){scan();if(!current)return;openViewer(0);startZip();});
    add('逐张保存','保存整套图片',function(){scan();if(!current)return;openViewer(0);startDownload();});
    var continueTool=button('继续下一包','继续生成下一包',continueZip);important(continueTool,{display:'none'});zipContinueButtons.push(continueTool);tools.appendChild(continueTool);
    add('识别整套','重新识别图片',function(){if(!current)scan();if(current)ensureCatalog(true);});
    add('保护开/关','切换本站广告保护',function(){protection=!protection;try{localStorage.setItem(protectionKey,protection?'1':'0');}catch(_){}guardSdk();createStyle();updateDiagnostic();});
    add('关闭','关闭工具',function(){tools.hidden=true;tools.style.setProperty('display','none','important');});
    downloadSelect=document.createElement('select');downloadSelect.setAttribute('aria-label','下载方式');[['auto','默认下载器'],['modern','现代GM接口']].forEach(function(x){var o=document.createElement('option');o.value=x[0];o.textContent=x[1];downloadSelect.appendChild(o);});downloadSelect.addEventListener('change',function(){downloadMode=downloadSelect.value;});tools.appendChild(downloadSelect);
    var partSelect=document.createElement('select');partSelect.setAttribute('aria-label','ZIP每包大小');[50,100,200].forEach(function(n){var o=document.createElement('option');o.value=String(n);o.textContent=n+'MB/包';o.selected=n===100;partSelect.appendChild(o);});partSelect.addEventListener('change',function(){if(!zipBusy)zipPartLimit=Number(partSelect.value)*1024*1024;});tools.appendChild(partSelect);
    singleStatus=document.createElement('p');singleStatus.setAttribute('data-bm-gallery-download-status','');tools.appendChild(singleStatus);var note=document.createElement('small');note.textContent='ZIP按所选大小分成独立压缩包。每包生成后先保存,再继续下一包;需保持网页打开,读取失败不冒充整套完成。';tools.appendChild(note);uiRoot.appendChild(tools);positionUi();updateDiagnostic();refreshCatalogStatus();updateDownload(downloadMessage);
  }
  function start(){createStyle();installTools();scan();}
  var scanTimer=null,observer=new MutationObserver(function(records){
    if(records.every(function(r){var t=r.target.nodeType===1?r.target:r.target.parentElement;return t&&t.closest('#bm-gallery,#bm-gallery-tools,#bm-gallery-entry,#bm-gallery-style');}))return;
    if(entry&&entry.isConnected&&!records.some(function(r){return Array.from(r.addedNodes).some(function(n){return n.nodeType===1&&(n.matches('img,.thumb-item,body')||n.querySelector('img,.thumb-item'));});}))return;
    if(scanTimer)return;scanTimer=setTimeout(function(){scanTimer=null;if(!entry||!entry.isConnected)installTools();scan();},150);
  });
  observer.observe(document,{childList:true,subtree:true});
  document.addEventListener('load',function(event){var img=event.target;if(!img||img.tagName!=='IMG'||img.closest('#bm-gallery,#bm-gallery-tools'))return;if(scanTimer)return;scanTimer=setTimeout(function(){scanTimer=null;scan();},150);},true);


/* fflate 0.8.2 — MIT License

Copyright (c) 2023 Arjun Barrett

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
var zipLibrary=(function(){var module={exports:{}},exports=module.exports;
!function(f){typeof module!='undefined'&&typeof exports=='object'?module.exports=f():typeof define!='undefined'&&define.amd?define(f):(typeof self!='undefined'?self:this).fflate=f()}(function(){var _e={};"use strict";var t=(typeof module!='undefined'&&typeof exports=='object'?function(_f){"use strict";var e,t=";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global";try{e=require("worker_threads").Worker}catch(e){}exports.default=e?function(r,n,o,a,s){var u=!1,i=new e(r+t,{eval:!0}).on("error",(function(e){return s(e,null)})).on("message",(function(e){return s(null,e)})).on("exit",(function(e){e&&!u&&s(Error("exited with code "+e),null)}));return i.postMessage(o,a),i.terminate=function(){return u=!0,e.prototype.terminate.call(i)},i}:function(e,t,r,n,o){setImmediate((function(){return o(Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"),null)}));var a=function(){};return{terminate:a,postMessage:a}};return _f}:function(_f){"use strict";var e={};_f.default=function(r,t,s,a,n){var o=new Worker(e[t]||(e[t]=URL.createObjectURL(new Blob([r+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return o.onmessage=function(e){var r=e.data,t=r.$e$;if(t){var s=Error(t[0]);s.code=t[1],s.stack=t[2],n(s,null)}else n(null,r)},o.postMessage(s,a),o};return _f})({}),n=Uint8Array,r=Uint16Array,e=Int32Array,i=new n([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),o=new n([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(t,n){for(var i=new r(31),o=0;o<31;++o)i[o]=n+=1<<t[o-1];var s=new e(i[30]);for(o=1;o<30;++o)for(var a=i[o];a<i[o+1];++a)s[a]=a-i[o]<<5|o;return{b:i,r:s}},u=a(i,2),h=u.b,f=u.r;h[28]=258,f[258]=28;for(var l=a(o,0),c=l.b,p=l.r,v=new r(32768),d=0;d<32768;++d){var g=(43690&d)>>1|(21845&d)<<1;v[d]=((65280&(g=(61680&(g=(52428&g)>>2|(13107&g)<<2))>>4|(3855&g)<<4))>>8|(255&g)<<8)>>1}var y=function(t,n,e){for(var i=t.length,o=0,s=new r(n);o<i;++o)t[o]&&++s[t[o]-1];var a,u=new r(n);for(o=1;o<n;++o)u[o]=u[o-1]+s[o-1]<<1;if(e){a=new r(1<<n);var h=15-n;for(o=0;o<i;++o)if(t[o])for(var f=o<<4|t[o],l=n-t[o],c=u[t[o]-1]++<<l,p=c|(1<<l)-1;c<=p;++c)a[v[c]>>h]=f}else for(a=new r(i),o=0;o<i;++o)t[o]&&(a[o]=v[u[t[o]-1]++]>>15-t[o]);return a},m=new n(288);for(d=0;d<144;++d)m[d]=8;for(d=144;d<256;++d)m[d]=9;for(d=256;d<280;++d)m[d]=7;for(d=280;d<288;++d)m[d]=8;var b=new n(32);for(d=0;d<32;++d)b[d]=5;var w=y(m,9,0),x=y(m,9,1),z=y(b,5,0),k=y(b,5,1),M=function(t){for(var n=t[0],r=1;r<t.length;++r)t[r]>n&&(n=t[r]);return n},S=function(t,n,r){var e=n/8|0;return(t[e]|t[e+1]<<8)>>(7&n)&r},A=function(t,n){var r=n/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&n)},T=function(t){return(t+7)/8|0},D=function(t,r,e){return(null==r||r<0)&&(r=0),(null==e||e>t.length)&&(e=t.length),new n(t.subarray(r,e))};_e.FlateErrorCode={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14};var C=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],I=function(t,n,r){var e=Error(n||C[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,I),!r)throw e;return e},U=function(t,r,e,a){var u=t.length,f=a?a.length:0;if(!u||r.f&&!r.l)return e||new n(0);var l=!e,p=l||2!=r.i,v=r.i;l&&(e=new n(3*u));var d=function(t){var r=e.length;if(t>r){var i=new n(Math.max(2*r,t));i.set(e),e=i}},g=r.f||0,m=r.p||0,b=r.b||0,w=r.l,z=r.d,C=r.m,U=r.n,F=8*u;do{if(!w){g=S(t,m,1);var E=S(t,m+1,3);if(m+=3,!E){var Z=t[(J=T(m)+4)-4]|t[J-3]<<8,q=J+Z;if(q>u){v&&I(0);break}p&&d(b+Z),e.set(t.subarray(J,q),b),r.b=b+=Z,r.p=m=8*q,r.f=g;continue}if(1==E)w=x,z=k,C=9,U=5;else if(2==E){var O=S(t,m,31)+257,G=S(t,m+10,15)+4,L=O+S(t,m+5,31)+1;m+=14;for(var H=new n(L),j=new n(19),N=0;N<G;++N)j[s[N]]=S(t,m+3*N,7);m+=3*G;var P=M(j),B=(1<<P)-1,Y=y(j,P,1);for(N=0;N<L;){var J,K=Y[S(t,m,B)];if(m+=15&K,(J=K>>4)<16)H[N++]=J;else{var Q=0,R=0;for(16==J?(R=3+S(t,m,3),m+=2,Q=H[N-1]):17==J?(R=3+S(t,m,7),m+=3):18==J&&(R=11+S(t,m,127),m+=7);R--;)H[N++]=Q}}var V=H.subarray(0,O),W=H.subarray(O);C=M(V),U=M(W),w=y(V,C,1),z=y(W,U,1)}else I(1);if(m>F){v&&I(0);break}}p&&d(b+131072);for(var X=(1<<C)-1,$=(1<<U)-1,_=m;;_=m){var tt=(Q=w[A(t,m)&X])>>4;if((m+=15&Q)>F){v&&I(0);break}if(Q||I(2),tt<256)e[b++]=tt;else{if(256==tt){_=m,w=null;break}var nt=tt-254;tt>264&&(nt=S(t,m,(1<<(it=i[N=tt-257]))-1)+h[N],m+=it);var rt=z[A(t,m)&$],et=rt>>4;if(rt||I(3),m+=15&rt,W=c[et],et>3){var it=o[et];W+=A(t,m)&(1<<it)-1,m+=it}if(m>F){v&&I(0);break}p&&d(b+131072);var ot=b+nt;if(b<W){var st=f-W,at=Math.min(W,ot);for(st+b<0&&I(3);b<at;++b)e[b]=a[st+b]}for(;b<ot;++b)e[b]=e[b-W]}}r.l=w,r.p=_,r.b=b,r.f=g,w&&(g=1,r.m=C,r.d=z,r.n=U)}while(!g);return b!=e.length&&l?D(e,0,b):e.subarray(0,b)},F=function(t,n,r){var e=n/8|0;t[e]|=r<<=7&n,t[e+1]|=r>>8},E=function(t,n,r){var e=n/8|0;t[e]|=r<<=7&n,t[e+1]|=r>>8,t[e+2]|=r>>16},Z=function(t,e){for(var i=[],o=0;o<t.length;++o)t[o]&&i.push({s:o,f:t[o]});var s=i.length,a=i.slice();if(!s)return{t:N,l:0};if(1==s){var u=new n(i[0].s+1);return u[i[0].s]=1,{t:u,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var h=i[0],f=i[1],l=0,c=1,p=2;for(i[0]={s:-1,f:h.f+f.f,l:h,r:f};c!=s-1;)h=i[i[l].f<i[p].f?l++:p++],f=i[l!=c&&i[l].f<i[p].f?l++:p++],i[c++]={s:-1,f:h.f+f.f,l:h,r:f};var v=a[0].s;for(o=1;o<s;++o)a[o].s>v&&(v=a[o].s);var d=new r(v+1),g=q(i[c-1],d,0);if(g>e){o=0;var y=0,m=g-e,b=1<<m;for(a.sort((function(t,n){return d[n.s]-d[t.s]||t.f-n.f}));o<s;++o){var w=a[o].s;if(!(d[w]>e))break;y+=b-(1<<g-d[w]),d[w]=e}for(y>>=m;y>0;){var x=a[o].s;d[x]<e?y-=1<<e-d[x]++-1:++o}for(;o>=0&&y;--o){var z=a[o].s;d[z]==e&&(--d[z],++y)}g=e}return{t:new n(d),l:g}},q=function(t,n,r){return-1==t.s?Math.max(q(t.l,n,r+1),q(t.r,n,r+1)):n[t.s]=r},O=function(t){for(var n=t.length;n&&!t[--n];);for(var e=new r(++n),i=0,o=t[0],s=1,a=function(t){e[i++]=t},u=1;u<=n;++u)if(t[u]==o&&u!=n)++s;else{if(!o&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(o),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(o);s=1,o=t[u]}return{c:e.subarray(0,i),n:n}},G=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},L=function(t,n,r){var e=r.length,i=T(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var o=0;o<e;++o)t[i+o+4]=r[o];return 8*(i+4+e)},H=function(t,n,e,a,u,h,f,l,c,p,v){F(n,v++,e),++u[256];for(var d=Z(u,15),g=d.t,x=d.l,k=Z(h,15),M=k.t,S=k.l,A=O(g),T=A.c,D=A.n,C=O(M),I=C.c,U=C.n,q=new r(19),H=0;H<T.length;++H)++q[31&T[H]];for(H=0;H<I.length;++H)++q[31&I[H]];for(var j=Z(q,7),N=j.t,P=j.l,B=19;B>4&&!N[s[B-1]];--B);var Y,J,K,Q,R=p+5<<3,V=G(u,m)+G(h,b)+f,W=G(u,g)+G(h,M)+f+14+3*B+G(q,N)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&R<=V&&R<=W)return L(n,v,t.subarray(c,c+p));if(F(n,v,1+(W<V)),v+=2,W<V){Y=y(g,x,0),J=g,K=y(M,S,0),Q=M;var X=y(N,P,0);for(F(n,v,D-257),F(n,v+5,U-1),F(n,v+10,B-4),v+=14,H=0;H<B;++H)F(n,v+3*H,N[s[H]]);v+=3*B;for(var $=[T,I],_=0;_<2;++_){var tt=$[_];for(H=0;H<tt.length;++H)F(n,v,X[rt=31&tt[H]]),v+=N[rt],rt>15&&(F(n,v,tt[H]>>5&127),v+=tt[H]>>12)}}else Y=w,J=m,K=z,Q=b;for(H=0;H<l;++H){var nt=a[H];if(nt>255){var rt;E(n,v,Y[257+(rt=nt>>18&31)]),v+=J[rt+257],rt>7&&(F(n,v,nt>>23&31),v+=i[rt]);var et=31&nt;E(n,v,K[et]),v+=Q[et],et>3&&(E(n,v,nt>>5&8191),v+=o[et])}else E(n,v,Y[nt]),v+=J[nt]}return E(n,v,Y[256]),v+J[256]},j=new e([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),N=new n(0),P=function(t,s,a,u,h,l){var c=l.z||t.length,v=new n(u+c+5*(1+Math.ceil(c/7e3))+h),d=v.subarray(u,v.length-h),g=l.l,y=7&(l.r||0);if(s){y&&(d[0]=l.r>>3);for(var m=j[s-1],b=m>>13,w=8191&m,x=(1<<a)-1,z=l.p||new r(32768),k=l.h||new r(x+1),M=Math.ceil(a/3),S=2*M,A=function(n){return(t[n]^t[n+1]<<M^t[n+2]<<S)&x},C=new e(25e3),I=new r(288),U=new r(32),F=0,E=0,Z=l.i||0,q=0,O=l.w||0,G=0;Z+2<c;++Z){var N=A(Z),P=32767&Z,B=k[N];if(z[P]=B,k[N]=P,O<=Z){var Y=c-Z;if((F>7e3||q>24576)&&(Y>423||!g)){y=H(t,d,0,C,I,U,E,q,G,Z-G,y),q=F=E=0,G=Z;for(var J=0;J<286;++J)I[J]=0;for(J=0;J<30;++J)U[J]=0}var K=2,Q=0,R=w,V=P-B&32767;if(Y>2&&N==A(Z-V))for(var W=Math.min(b,Y)-1,X=Math.min(32767,Z),$=Math.min(258,Y);V<=X&&--R&&P!=B;){if(t[Z+K]==t[Z+K-V]){for(var _=0;_<$&&t[Z+_]==t[Z+_-V];++_);if(_>K){if(K=_,Q=V,_>W)break;var tt=Math.min(V,_-2),nt=0;for(J=0;J<tt;++J){var rt=Z-V+J&32767,et=rt-z[rt]&32767;et>nt&&(nt=et,B=rt)}}}V+=(P=B)-(B=z[P])&32767}if(Q){C[q++]=268435456|f[K]<<18|p[Q];var it=31&f[K],ot=31&p[Q];E+=i[it]+o[ot],++I[257+it],++U[ot],O=Z+K,++F}else C[q++]=t[Z],++I[t[Z]]}}for(Z=Math.max(Z,O);Z<c;++Z)C[q++]=t[Z],++I[t[Z]];y=H(t,d,g,C,I,U,E,q,G,Z-G,y),g||(l.r=7&y|d[y/8|0]<<3,y-=7,l.h=k,l.p=z,l.i=Z,l.w=O)}else{for(Z=l.w||0;Z<c+g;Z+=65535){var st=Z+65535;st>=c&&(d[y/8|0]=g,st=c),y=L(d,y+1,t.subarray(Z,st))}l.i=c}return D(v,0,u+T(y)+h)},B=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),Y=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=B[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}},J=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,o=0|r.length,s=0;s!=o;){for(var a=Math.min(s+2655,o);s<a;++s)i+=e+=r[s];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},K=function(t,r,e,i,o){if(!o&&(o={l:1},r.dictionary)){var s=r.dictionary.subarray(-32768),a=new n(s.length+t.length);a.set(s),a.set(t,s.length),t=a,o.w=s.length}return P(t,null==r.level?6:r.level,null==r.mem?o.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+r.mem,e,i,o)},Q=function(t,n){var r={};for(var e in t)r[e]=t[e];for(var e in n)r[e]=n[e];return r},R=function(t,n,r){for(var e=t(),i=""+t,o=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s<e.length;++s){var a=e[s],u=o[s];if("function"==typeof a){n+=";"+u+"=";var h=""+a;if(a.prototype)if(-1!=h.indexOf("[native code]")){var f=h.indexOf(" ",8)+1;n+=h.slice(f,h.indexOf("(",f))}else for(var l in n+=h,a.prototype)n+=";"+u+".prototype."+l+"="+a.prototype[l];else n+=h}else r[u]=a}return n},V=[],W=function(t){var n=[];for(var r in t)t[r].buffer&&n.push((t[r]=new t[r].constructor(t[r])).buffer);return n},X=function(n,r,e,i){if(!V[e]){for(var o="",s={},a=n.length-1,u=0;u<a;++u)o=R(n[u],o,s);V[e]={c:R(n[a],o,s),e:s}}var h=Q({},V[e].e);return(0,t.default)(V[e].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+r+"}",e,h,W(h),i)},$=function(){return[n,r,e,i,o,s,h,c,x,k,v,C,y,M,S,A,T,D,I,U,Tt,it,ot]},_=function(){return[n,r,e,i,o,s,f,p,w,m,z,b,v,j,N,y,F,E,Z,q,O,G,L,H,T,D,P,K,kt,it]},tt=function(){return[pt,gt,ct,Y,B]},nt=function(){return[vt,dt]},rt=function(){return[yt,ct,J]},et=function(){return[mt]},it=function(t){return postMessage(t,[t.buffer])},ot=function(t){return t&&{out:t.size&&new n(t.size),dictionary:t.dictionary}},st=function(t,n,r,e,i,o){var s=X(r,e,i,(function(t,n){s.terminate(),o(t,n)}));return s.postMessage([t,n],n.consume?[t.buffer]:[]),function(){s.terminate()}},at=function(t){return t.ondata=function(t,n){return postMessage([t,n],[t.buffer])},function(n){n.data.length?(t.push(n.data[0],n.data[1]),postMessage([n.data[0].length])):t.flush()}},ut=function(t,n,r,e,i,o,s){var a,u=X(t,e,i,(function(t,r){t?(u.terminate(),n.ondata.call(n,t)):Array.isArray(r)?1==r.length?(n.queuedSize-=r[0],n.ondrain&&n.ondrain(r[0])):(r[1]&&u.terminate(),n.ondata.call(n,t,r[0],r[1])):s(r)}));u.postMessage(r),n.queuedSize=0,n.push=function(t,r){n.ondata||I(5),a&&n.ondata(I(4,0,1),null,!!r),n.queuedSize+=t.length,u.postMessage([t,a=r],[t.buffer])},n.terminate=function(){u.terminate()},o&&(n.flush=function(){u.postMessage([])})},ht=function(t,n){return t[n]|t[n+1]<<8},ft=function(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24)>>>0},lt=function(t,n){return ft(t,n)+4294967296*ft(t,n+4)},ct=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},pt=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&ct(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},vt=function(t){31==t[0]&&139==t[1]&&8==t[2]||I(6,"invalid gzip data");var n=t[3],r=10;4&n&&(r+=2+(t[10]|t[11]<<8));for(var e=(n>>3&1)+(n>>4&1);e>0;e-=!t[r++]);return r+(2&n)},dt=function(t){var n=t.length;return(t[n-4]|t[n-3]<<8|t[n-2]<<16|t[n-1]<<24)>>>0},gt=function(t){return 10+(t.filename?t.filename.length+1:0)},yt=function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=J();i.p(n.dictionary),ct(t,2,i.d())}},mt=function(t,n){return(8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31)&&I(6,"invalid zlib data"),(t[1]>>5&1)==+!n&&I(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)};function bt(t,n){return"function"==typeof t&&(n=t,t={}),this.ondata=n,t}var wt=function(){function t(t,r){if("function"==typeof t&&(r=t,t={}),this.ondata=r,this.o=t||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new n(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return t.prototype.p=function(t,n){this.ondata(K(t,this.o,0,0,this.s),n)},t.prototype.push=function(t,r){this.ondata||I(5),this.s.l&&I(4);var e=t.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new n(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var o=this.b.length-this.s.z;this.b.set(t.subarray(0,o),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(t.subarray(o),32768),this.s.z=t.length-o+32768,this.s.i=32766,this.s.w=32768}else this.b.set(t,this.s.z),this.s.z+=t.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},t.prototype.flush=function(){this.ondata||I(5),this.s.l&&I(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},t}();_e.Deflate=wt;var xt=function(){return function(t,n){ut([_,function(){return[at,wt]}],this,bt.call(this,t,n),(function(t){var n=new wt(t.data);onmessage=at(n)}),6,1)}}();function zt(t,n,r){return r||(r=n,n={}),"function"!=typeof r&&I(7),st(t,n,[_],(function(t){return it(kt(t.data[0],t.data[1]))}),0,r)}function kt(t,n){return K(t,n||{},0,0)}_e.AsyncDeflate=xt,_e.deflate=zt,_e.deflateSync=kt;var Mt=function(){function t(t,r){"function"==typeof t&&(r=t,t={}),this.ondata=r;var e=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:e?e.length:0},this.o=new n(32768),this.p=new n(0),e&&this.o.set(e)}return t.prototype.e=function(t){if(this.ondata||I(5),this.d&&I(4),this.p.length){if(t.length){var r=new n(this.p.length+t.length);r.set(this.p),r.set(t,this.p.length),this.p=r}}else this.p=t},t.prototype.c=function(t){this.s.i=+(this.d=t||!1);var n=this.s.b,r=U(this.p,this.s,this.o);this.ondata(D(r,n,this.s.b),this.d),this.o=D(r,this.s.b-32768),this.s.b=this.o.length,this.p=D(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,n){this.e(t),this.c(n)},t}();_e.Inflate=Mt;var St=function(){return function(t,n){ut([$,function(){return[at,Mt]}],this,bt.call(this,t,n),(function(t){var n=new Mt(t.data);onmessage=at(n)}),7,0)}}();function At(t,n,r){return r||(r=n,n={}),"function"!=typeof r&&I(7),st(t,n,[$],(function(t){return it(Tt(t.data[0],ot(t.data[1])))}),1,r)}function Tt(t,n){return U(t,{i:2},n&&n.out,n&&n.dictionary)}_e.AsyncInflate=St,_e.inflate=At,_e.inflateSync=Tt;var Dt=function(){function t(t,n){this.c=Y(),this.l=0,this.v=1,wt.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),this.l+=t.length,wt.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=K(t,this.o,this.v&&gt(this.o),n&&8,this.s);this.v&&(pt(r,this.o),this.v=0),n&&(ct(r,r.length-8,this.c.d()),ct(r,r.length-4,this.l)),this.ondata(r,n)},t.prototype.flush=function(){wt.prototype.flush.call(this)},t}();_e.Gzip=Dt,_e.Compress=Dt;var Ct=function(){return function(t,n){ut([_,tt,function(){return[at,wt,Dt]}],this,bt.call(this,t,n),(function(t){var n=new Dt(t.data);onmessage=at(n)}),8,1)}}();function It(t,n,r){return r||(r=n,n={}),"function"!=typeof r&&I(7),st(t,n,[_,tt,function(){return[Ut]}],(function(t){return it(Ut(t.data[0],t.data[1]))}),2,r)}function Ut(t,n){n||(n={});var r=Y(),e=t.length;r.p(t);var i=K(t,n,gt(n),8),o=i.length;return pt(i,n),ct(i,o-8,r.d()),ct(i,o-4,e),i}_e.AsyncGzip=Ct,_e.AsyncCompress=Ct,_e.gzip=It,_e.compress=It,_e.gzipSync=Ut,_e.compressSync=Ut;var Ft=function(){function t(t,n){this.v=1,this.r=0,Mt.call(this,t,n)}return t.prototype.push=function(t,r){if(Mt.prototype.e.call(this,t),this.r+=t.length,this.v){var e=this.p.subarray(this.v-1),i=e.length>3?vt(e):4;if(i>e.length){if(!r)return}else this.v>1&&this.onmember&&this.onmember(this.r-e.length);this.p=e.subarray(i),this.v=0}Mt.prototype.c.call(this,r),!this.s.f||this.s.l||r||(this.v=T(this.s.p)+9,this.s={i:0},this.o=new n(0),this.push(new n(0),r))},t}();_e.Gunzip=Ft;var Et=function(){return function(t,n){var r=this;ut([$,nt,function(){return[at,Mt,Ft]}],this,bt.call(this,t,n),(function(t){var n=new Ft(t.data);n.onmember=function(t){return postMessage(t)},onmessage=at(n)}),9,0,(function(t){return r.onmember&&r.onmember(t)}))}}();function Zt(t,n,r){return r||(r=n,n={}),"function"!=typeof r&&I(7),st(t,n,[$,nt,function(){return[qt]}],(function(t){return it(qt(t.data[0],t.data[1]))}),3,r)}function qt(t,r){var e=vt(t);return e+8>t.length&&I(6,"invalid gzip data"),U(t.subarray(e,-8),{i:2},r&&r.out||new n(dt(t)),r&&r.dictionary)}_e.AsyncGunzip=Et,_e.gunzip=Zt,_e.gunzipSync=qt;var Ot=function(){function t(t,n){this.c=J(),this.v=1,wt.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),wt.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=K(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(yt(r,this.o),this.v=0),n&&ct(r,r.length-4,this.c.d()),this.ondata(r,n)},t.prototype.flush=function(){wt.prototype.flush.call(this)},t}();_e.Zlib=Ot;var Gt=function(){return function(t,n){ut([_,rt,function(){return[at,wt,Ot]}],this,bt.call(this,t,n),(function(t){var n=new Ot(t.data);onmessage=at(n)}),10,1)}}();function Lt(t,n,r){return r||(r=n,n={}),"function"!=typeof r&&I(7),st(t,n,[_,rt,function(){return[Ht]}],(function(t){return it(Ht(t.data[0],t.data[1]))}),4,r)}function Ht(t,n){n||(n={});var r=J();r.p(t);var e=K(t,n,n.dictionary?6:2,4);return yt(e,n),ct(e,e.length-4,r.d()),e}_e.AsyncZlib=Gt,_e.zlib=Lt,_e.zlibSync=Ht;var jt=function(){function t(t,n){Mt.call(this,t,n),this.v=t&&t.dictionary?2:1}return t.prototype.push=function(t,n){if(Mt.prototype.e.call(this,t),this.v){if(this.p.length<6&&!n)return;this.p=this.p.subarray(mt(this.p,this.v-1)),this.v=0}n&&(this.p.length<4&&I(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Mt.prototype.c.call(this,n)},t}();_e.Unzlib=jt;var Nt=function(){return function(t,n){ut([$,et,function(){return[at,Mt,jt]}],this,bt.call(this,t,n),(function(t){var n=new jt(t.data);onmessage=at(n)}),11,0)}}();function Pt(t,n,r){return r||(r=n,n={}),"function"!=typeof r&&I(7),st(t,n,[$,et,function(){return[Bt]}],(function(t){return it(Bt(t.data[0],ot(t.data[1])))}),5,r)}function Bt(t,n){return U(t.subarray(mt(t,n&&n.dictionary),-4),{i:2},n&&n.out,n&&n.dictionary)}_e.AsyncUnzlib=Nt,_e.unzlib=Pt,_e.unzlibSync=Bt;var Yt=function(){function t(t,n){this.o=bt.call(this,t,n)||{},this.G=Ft,this.I=Mt,this.Z=jt}return t.prototype.i=function(){var t=this;this.s.ondata=function(n,r){t.ondata(n,r)}},t.prototype.push=function(t,r){if(this.ondata||I(5),this.s)this.s.push(t,r);else{if(this.p&&this.p.length){var e=new n(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length)}else this.p=t;this.p.length>2&&(this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,r),this.p=null)}},t}();_e.Decompress=Yt;var Jt=function(){function t(t,n){Yt.call(this,t,n),this.queuedSize=0,this.G=Et,this.I=St,this.Z=Nt}return t.prototype.i=function(){var t=this;this.s.ondata=function(n,r,e){t.ondata(n,r,e)},this.s.ondrain=function(n){t.queuedSize-=n,t.ondrain&&t.ondrain(n)}},t.prototype.push=function(t,n){this.queuedSize+=t.length,Yt.prototype.push.call(this,t,n)},t}();function Kt(t,n,r){return r||(r=n,n={}),"function"!=typeof r&&I(7),31==t[0]&&139==t[1]&&8==t[2]?Zt(t,n,r):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?At(t,n,r):Pt(t,n,r)}function Qt(t,n){return 31==t[0]&&139==t[1]&&8==t[2]?qt(t,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?Tt(t,n):Bt(t,n)}_e.AsyncDecompress=Jt,_e.decompress=Kt,_e.decompressSync=Qt;var Rt=function(t,r,e,i){for(var o in t){var s=t[o],a=r+o,u=i;Array.isArray(s)&&(u=Q(i,s[1]),s=s[0]),s instanceof n?e[a]=[s,u]:(e[a+="/"]=[new n(0),u],Rt(s,a,e,i))}},Vt="undefined"!=typeof TextEncoder&&new TextEncoder,Wt="undefined"!=typeof TextDecoder&&new TextDecoder,Xt=0;try{Wt.decode(N,{stream:!0}),Xt=1}catch(t){}var $t=function(t){for(var n="",r=0;;){var e=t[r++],i=(e>127)+(e>223)+(e>239);if(r+i>t.length)return{s:n,r:D(t,r-1)};i?3==i?(e=((15&e)<<18|(63&t[r++])<<12|(63&t[r++])<<6|63&t[r++])-65536,n+=String.fromCharCode(55296|e>>10,56320|1023&e)):n+=String.fromCharCode(1&i?(31&e)<<6|63&t[r++]:(15&e)<<12|(63&t[r++])<<6|63&t[r++]):n+=String.fromCharCode(e)}},_t=function(){function t(t){this.ondata=t,Xt?this.t=new TextDecoder:this.p=N}return t.prototype.push=function(t,r){if(this.ondata||I(5),r=!!r,this.t)return this.ondata(this.t.decode(t,{stream:!0}),r),void(r&&(this.t.decode().length&&I(8),this.t=null));this.p||I(4);var e=new n(this.p.length+t.length);e.set(this.p),e.set(t,this.p.length);var i=$t(e),o=i.s,s=i.r;r?(s.length&&I(8),this.p=null):this.p=s,this.ondata(o,r)},t}();_e.DecodeUTF8=_t;var tn=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||I(5),this.d&&I(4),this.ondata(nn(t),this.d=n||!1)},t}();function nn(t,r){if(r){for(var e=new n(t.length),i=0;i<t.length;++i)e[i]=t.charCodeAt(i);return e}if(Vt)return Vt.encode(t);var o=t.length,s=new n(t.length+(t.length>>1)),a=0,u=function(t){s[a++]=t};for(i=0;i<o;++i){if(a+5>s.length){var h=new n(a+8+(o-i<<1));h.set(s),s=h}var f=t.charCodeAt(i);f<128||r?u(f):f<2048?(u(192|f>>6),u(128|63&f)):f>55295&&f<57344?(u(240|(f=65536+(1047552&f)|1023&t.charCodeAt(++i))>>18),u(128|f>>12&63),u(128|f>>6&63),u(128|63&f)):(u(224|f>>12),u(128|f>>6&63),u(128|63&f))}return D(s,0,a)}function rn(t,n){if(n){for(var r="",e=0;e<t.length;e+=16384)r+=String.fromCharCode.apply(null,t.subarray(e,e+16384));return r}if(Wt)return Wt.decode(t);var i=$t(t),o=i.s;return(r=i.r).length&&I(8),o}_e.EncodeUTF8=tn,_e.strToU8=nn,_e.strFromU8=rn;var en=function(t){return 1==t?3:t<6?2:9==t?1:0},on=function(t,n){return n+30+ht(t,n+26)+ht(t,n+28)},sn=function(t,n,r){var e=ht(t,n+28),i=rn(t.subarray(n+46,n+46+e),!(2048&ht(t,n+8))),o=n+46+e,s=ft(t,n+20),a=r&&4294967295==s?an(t,o):[s,ft(t,n+24),ft(t,n+42)],u=a[0],h=a[1],f=a[2];return[ht(t,n+10),u,h,i,o+ht(t,n+30)+ht(t,n+32),f]},an=function(t,n){for(;1!=ht(t,n);n+=4+ht(t,n+2));return[lt(t,n+12),lt(t,n+4),lt(t,n+20)]},un=function(t){var n=0;if(t)for(var r in t){var e=t[r].length;e>65535&&I(9),n+=e+4}return n},hn=function(t,n,r,e,i,o,s,a){var u=e.length,h=r.extra,f=a&&a.length,l=un(h);ct(t,n,null!=s?33639248:67324752),n+=4,null!=s&&(t[n++]=20,t[n++]=r.os),t[n]=20,n+=2,t[n++]=r.flag<<1|(o<0&&8),t[n++]=i&&8,t[n++]=255&r.compression,t[n++]=r.compression>>8;var c=new Date(null==r.mtime?Date.now():r.mtime),p=c.getFullYear()-1980;if((p<0||p>119)&&I(10),ct(t,n,p<<25|c.getMonth()+1<<21|c.getDate()<<16|c.getHours()<<11|c.getMinutes()<<5|c.getSeconds()>>1),n+=4,-1!=o&&(ct(t,n,r.crc),ct(t,n+4,o<0?-o-2:o),ct(t,n+8,r.size)),ct(t,n+12,u),ct(t,n+14,l),n+=16,null!=s&&(ct(t,n,f),ct(t,n+6,r.attrs),ct(t,n+10,s),n+=14),t.set(e,n),n+=u,l)for(var v in h){var d=h[v],g=d.length;ct(t,n,+v),ct(t,n+2,g),t.set(d,n+4),n+=4+g}return f&&(t.set(a,n),n+=f),n},fn=function(t,n,r,e,i){ct(t,n,101010256),ct(t,n+8,r),ct(t,n+10,r),ct(t,n+12,e),ct(t,n+16,i)},ln=function(){function t(t){this.filename=t,this.c=Y(),this.size=0,this.compression=0}return t.prototype.process=function(t,n){this.ondata(null,t,n)},t.prototype.push=function(t,n){this.ondata||I(5),this.c.p(t),this.size+=t.length,n&&(this.crc=this.c.d()),this.process(t,n||!1)},t}();_e.ZipPassThrough=ln;var cn=function(){function t(t,n){var r=this;n||(n={}),ln.call(this,t),this.d=new wt(n,(function(t,n){r.ondata(null,t,n)})),this.compression=8,this.flag=en(n.level)}return t.prototype.process=function(t,n){try{this.d.push(t,n)}catch(t){this.ondata(t,null,n)}},t.prototype.push=function(t,n){ln.prototype.push.call(this,t,n)},t}();_e.ZipDeflate=cn;var pn=function(){function t(t,n){var r=this;n||(n={}),ln.call(this,t),this.d=new xt(n,(function(t,n,e){r.ondata(t,n,e)})),this.compression=8,this.flag=en(n.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,n){this.d.push(t,n)},t.prototype.push=function(t,n){ln.prototype.push.call(this,t,n)},t}();_e.AsyncZipDeflate=pn;var vn=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var r=this;if(this.ondata||I(5),2&this.d)this.ondata(I(4+8*(1&this.d),0,1),null,!1);else{var e=nn(t.filename),i=e.length,o=t.comment,s=o&&nn(o),a=i!=t.filename.length||s&&o.length!=s.length,u=i+un(t.extra)+30;i>65535&&this.ondata(I(11,0,1),null,!1);var h=new n(u);hn(h,0,t,e,a,-1);var f=[h],l=function(){for(var t=0,n=f;t<n.length;t++)r.ondata(null,n[t],!1);f=[]},c=this.d;this.d=0;var p=this.u.length,v=Q(t,{f:e,u:a,o:s,t:function(){t.terminate&&t.terminate()},r:function(){if(l(),c){var t=r.u[p+1];t?t.r():r.d=1}c=1}}),d=0;t.ondata=function(e,i,o){if(e)r.ondata(e,i,o),r.terminate();else if(d+=i.length,f.push(i),o){var s=new n(16);ct(s,0,134695760),ct(s,4,t.crc),ct(s,8,d),ct(s,12,t.size),f.push(s),v.c=d,v.b=u+d+16,v.crc=t.crc,v.size=t.size,c&&v.r(),c=1}else c&&l()},this.u.push(v)}},t.prototype.end=function(){var t=this;2&this.d?this.ondata(I(4+8*(1&this.d),0,1),null,!0):(this.d?this.e():this.u.push({r:function(){1&t.d&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3)},t.prototype.e=function(){for(var t=0,r=0,e=0,i=0,o=this.u;i<o.length;i++)e+=46+(h=o[i]).f.length+un(h.extra)+(h.o?h.o.length:0);for(var s=new n(e+22),a=0,u=this.u;a<u.length;a++){var h;hn(s,t,h=u[a],h.f,h.u,-h.c-2,r,h.o),t+=46+h.f.length+un(h.extra)+(h.o?h.o.length:0),r+=h.b}fn(s,t,this.u.length,e,r),this.ondata(null,s,!0),this.d=2},t.prototype.terminate=function(){for(var t=0,n=this.u;t<n.length;t++)n[t].t();this.d=2},t}();function dn(t,r,e){e||(e=r,r={}),"function"!=typeof e&&I(7);var i={};Rt(t,"",i,r);var o=Object.keys(i),s=o.length,a=0,u=0,h=s,f=Array(s),l=[],c=function(){for(var t=0;t<l.length;++t)l[t]()},p=function(t,n){xn((function(){e(t,n)}))};xn((function(){p=e}));var v=function(){var t=new n(u+22),r=a,e=u-a;u=0;for(var i=0;i<h;++i){var o=f[i];try{var s=o.c.length;hn(t,u,o,o.f,o.u,s);var l=30+o.f.length+un(o.extra),c=u+l;t.set(o.c,c),hn(t,a,o,o.f,o.u,s,u,o.m),a+=16+l+(o.m?o.m.length:0),u=c+s}catch(t){return p(t,null)}}fn(t,a,f.length,e,r),p(null,t)};s||v();for(var d=function(t){var n=o[t],r=i[n],e=r[0],h=r[1],d=Y(),g=e.length;d.p(e);var y=nn(n),m=y.length,b=h.comment,w=b&&nn(b),x=w&&w.length,z=un(h.extra),k=0==h.level?0:8,M=function(r,e){if(r)c(),p(r,null);else{var i=e.length;f[t]=Q(h,{size:g,crc:d.d(),c:e,f:y,m:w,u:m!=n.length||w&&b.length!=x,compression:k}),a+=30+m+z+i,u+=76+2*(m+z)+(x||0)+i,--s||v()}};if(m>65535&&M(I(11,0,1),null),k)if(g<16e4)try{M(null,kt(e,h))}catch(t){M(t,null)}else l.push(zt(e,h,M));else M(null,e)},g=0;g<h;++g)d(g);return c}function gn(t,r){r||(r={});var e={},i=[];Rt(t,"",e,r);var o=0,s=0;for(var a in e){var u=e[a],h=u[0],f=u[1],l=0==f.level?0:8,c=(M=nn(a)).length,p=f.comment,v=p&&nn(p),d=v&&v.length,g=un(f.extra);c>65535&&I(11);var y=l?kt(h,f):h,m=y.length,b=Y();b.p(h),i.push(Q(f,{size:h.length,crc:b.d(),c:y,f:M,m:v,u:c!=a.length||v&&p.length!=d,o:o,compression:l})),o+=30+c+g+m,s+=76+2*(c+g)+(d||0)+m}for(var w=new n(s+22),x=o,z=s-o,k=0;k<i.length;++k){var M;hn(w,(M=i[k]).o,M,M.f,M.u,M.c.length);var S=30+M.f.length+un(M.extra);w.set(M.c,M.o+S),hn(w,o,M,M.f,M.u,M.c.length,M.o,M.m),o+=16+S+(M.m?M.m.length:0)}return fn(w,o,i.length,z,x),w}_e.Zip=vn,_e.zip=dn,_e.zipSync=gn;var yn=function(){function t(){}return t.prototype.push=function(t,n){this.ondata(null,t,n)},t.compression=0,t}();_e.UnzipPassThrough=yn;var mn=function(){function t(){var t=this;this.i=new Mt((function(n,r){t.ondata(null,n,r)}))}return t.prototype.push=function(t,n){try{this.i.push(t,n)}catch(t){this.ondata(t,null,n)}},t.compression=8,t}();_e.UnzipInflate=mn;var bn=function(){function t(t,n){var r=this;n<32e4?this.i=new Mt((function(t,n){r.ondata(null,t,n)})):(this.i=new St((function(t,n,e){r.ondata(t,n,e)})),this.terminate=this.i.terminate)}return t.prototype.push=function(t,n){this.i.terminate&&(t=D(t,0)),this.i.push(t,n)},t.compression=8,t}();_e.AsyncUnzipInflate=bn;var wn=function(){function t(t){this.onfile=t,this.k=[],this.o={0:yn},this.p=N}return t.prototype.push=function(t,r){var e=this;if(this.onfile||I(5),this.p||I(4),this.c>0){var i=Math.min(this.c,t.length),o=t.subarray(0,i);if(this.c-=i,this.d?this.d.push(o,!this.c):this.k[0].push(o),(t=t.subarray(i)).length)return this.push(t,r)}else{var s=0,a=0,u=void 0,h=void 0;this.p.length?t.length?((h=new n(this.p.length+t.length)).set(this.p),h.set(t,this.p.length)):h=this.p:h=t;for(var f=h.length,l=this.c,c=l&&this.d,p=function(){var t,n=ft(h,a);if(67324752==n){s=1,u=a,v.d=null,v.c=0;var r=ht(h,a+6),i=ht(h,a+8),o=2048&r,c=8&r,p=ht(h,a+26),d=ht(h,a+28);if(f>a+30+p+d){var g=[];v.k.unshift(g),s=2;var y,m=ft(h,a+18),b=ft(h,a+22),w=rn(h.subarray(a+30,a+=30+p),!o);4294967295==m?(t=c?[-2]:an(h,a),m=t[0],b=t[1]):c&&(m=-1),a+=d,v.c=m;var x={name:w,compression:i,start:function(){if(x.ondata||I(5),m){var t=e.o[i];t||x.ondata(I(14,"unknown compression type "+i,1),null,!1),(y=m<0?new t(w):new t(w,m,b)).ondata=function(t,n,r){x.ondata(t,n,r)};for(var n=0,r=g;n<r.length;n++)y.push(r[n],!1);e.k[0]==g&&e.c?e.d=y:y.push(N,!0)}else x.ondata(null,N,!0)},terminate:function(){y&&y.terminate&&y.terminate()}};m>=0&&(x.size=m,x.originalSize=b),v.onfile(x)}return"break"}if(l){if(134695760==n)return u=a+=12+(-2==l&&8),s=3,v.c=0,"break";if(33639248==n)return u=a-=4,s=3,v.c=0,"break"}},v=this;a<f-4&&"break"!==p();++a);if(this.p=N,l<0){var d=h.subarray(0,s?u-12-(-2==l&&8)-(134695760==ft(h,u-16)&&4):a);c?c.push(d,!!s):this.k[+(2==s)].push(d)}if(2&s)return this.push(h.subarray(a),r);this.p=h.subarray(a)}r&&(this.c&&I(13),this.p=null)},t.prototype.register=function(t){this.o[t.compression]=t},t}();_e.Unzip=wn;var xn="function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout?setTimeout:function(t){t()};function zn(t,r,e){e||(e=r,r={}),"function"!=typeof e&&I(7);var i=[],o=function(){for(var t=0;t<i.length;++t)i[t]()},s={},a=function(t,n){xn((function(){e(t,n)}))};xn((function(){a=e}));for(var u=t.length-22;101010256!=ft(t,u);--u)if(!u||t.length-u>65558)return a(I(13,0,1),null),o;var h=ht(t,u+8);if(h){var f=h,l=ft(t,u+16),c=4294967295==l||65535==f;if(c){var p=ft(t,u-12);(c=101075792==ft(t,p))&&(f=h=ft(t,p+32),l=ft(t,p+48))}for(var v=r&&r.filter,d=function(r){var e=sn(t,l,c),u=e[0],f=e[1],p=e[2],d=e[3],g=e[4],y=on(t,e[5]);l=g;var m=function(t,n){t?(o(),a(t,null)):(n&&(s[d]=n),--h||a(null,s))};if(!v||v({name:d,size:f,originalSize:p,compression:u}))if(u)if(8==u){var b=t.subarray(y,y+f);if(p<524288||f>.8*p)try{m(null,Tt(b,{out:new n(p)}))}catch(t){m(t,null)}else i.push(At(b,{size:p},m))}else m(I(14,"unknown compression type "+u,1),null);else m(null,D(t,y,y+f));else m(null,null)},g=0;g<f;++g)d()}else a(null,{});return o}function kn(t,r){for(var e={},i=t.length-22;101010256!=ft(t,i);--i)(!i||t.length-i>65558)&&I(13);var o=ht(t,i+8);if(!o)return{};var s=ft(t,i+16),a=4294967295==s||65535==o;if(a){var u=ft(t,i-12);(a=101075792==ft(t,u))&&(o=ft(t,u+32),s=ft(t,u+48))}for(var h=r&&r.filter,f=0;f<o;++f){var l=sn(t,s,a),c=l[0],p=l[1],v=l[2],d=l[3],g=l[4],y=on(t,l[5]);s=g,h&&!h({name:d,size:p,originalSize:v,compression:c})||(c?8==c?e[d]=Tt(t.subarray(y,y+p),{out:new n(v)}):I(14,"unknown compression type "+c):e[d]=D(t,y,y+p))}return e}_e.unzip=zn,_e.unzipSync=kn;return _e});
return module.exports;})();
  var uiHost=null,uiRoot=null,buttonActions=new WeakMap(),returnPosition=null,historyOwned=false,historyToken='gallery-'+Math.random().toString(36).slice(2),positionFrame=null;
  var catalog={started:false,running:false,complete:false,error:'',promise:null,items:[],expected:0,max:1},catalogStatus=null,pageRequests=new Map(),pageControllers=new Set();
  var downloadMessage='',downloadMode='auto',downloadSelect=null,singleStatus=null,zipReady=null,zipBusy=false,zipGeneration=0,zipController=null;
  var zipPartLimit=100*1024*1024,zipGate=null,zipContinueButtons=[];
  var resourceCache=new Map(),imageControllers=new Set(),prefetchPages=new Set(),zipCompleted=false;
  function important(node,values){node.style.setProperty('box-sizing','border-box','important');Object.keys(values).forEach(function(k){node.style.setProperty(k,values[k],'important');});}
  function ensureUiRoot(){
    if(uiHost&&uiHost.isConnected)return;
    if(uiHost&&!uiHost.isConnected){overlay=null;picture=null;info=null;entry=null;tools=null;diagnostic=null;singleStatus=null;catalogStatus=null;active=false;historyOwned=false;zipContinueButtons=[];}
    uiHost=document.createElement('div');uiHost.id='bm-gallery-ui-root';
    important(uiHost,{position:'fixed',left:'0',top:'0',width:'0',height:'0',padding:'0',margin:'0',border:'0',overflow:'visible','pointer-events':'none','z-index':'2147483647',transform:'none',display:'block'});
    document.documentElement.appendChild(uiHost);uiRoot=uiHost.attachShadow({mode:'open'});
    var sheet=document.createElement('style');sheet.textContent=(document.getElementById('bm-gallery-style')||{}).textContent||'';uiRoot.appendChild(sheet);
    if(typeof uiHost.showPopover==='function'){try{uiHost.setAttribute('popover','manual');uiHost.showPopover();}catch(_){uiHost.removeAttribute('popover');}}
  }
  function positionUi(){
    positionFrame=null;var v=window.visualViewport,x=v?v.offsetLeft:0,y=v?v.offsetTop:0,w=Math.min(v?v.width:innerWidth,document.documentElement.clientWidth||innerWidth),h=Math.min(v?v.height:innerHeight,document.documentElement.clientHeight||innerHeight);
    if(entry)important(entry,{position:'fixed',left:(x+12)+'px',top:(y+Math.max(8,h-66))+'px',bottom:'auto',right:'auto',display:'block','z-index':'2147483647','pointer-events':'auto',background:'#266d5d',color:'#fff'});
    if(tools)important(tools,{position:'fixed',left:(x+8)+'px',top:(y+48)+'px',width:Math.max(200,Math.min(440,w-16))+'px','max-height':Math.max(140,h-126)+'px',overflow:'auto','pointer-events':'auto'});
    if(overlay)important(overlay,{position:'fixed',left:x+'px',top:y+'px',width:w+'px',height:h+'px','max-width':w+'px','pointer-events':active?'auto':'none'});
  }
  function requestPosition(){if(positionFrame!==null)return;positionFrame=requestAnimationFrame(positionUi);}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
  function ownEvent(event){
    var path=event.composedPath?event.composedPath():[],owned=path.indexOf(uiHost)>=0;if(!owned)return false;
    if(event.type==='click'){var b=path.find(function(n){return n&&n.tagName==='BUTTON';});if(b){event.preventDefault();if(!b.disabled){var action=buttonActions.get(b);if(action)action();}}}
    event.stopImmediatePropagation();return true;
  }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  function safeImageSource(raw){if(typeof raw!=='string'||!raw.trim())return null;try{var u=new URL(raw,location.href);return /^https?:$/.test(u.protocol)&&!u.username&&!u.password?u.href:null;}catch(_){return null;}}
  function clickedImage(target){
    var item=target.closest('.thumb-item'),a=target.closest('a[href]'),img=target.tagName==='IMG'?target:(item&&item.querySelector('img'));
    if(!img&&a)img=a.querySelector('img');if(!img)return null;
    var nativeView=img.matches('#lightboxImg')||!!img.closest('#imgLightbox,.img-lightbox');
    var link=a&&mediaUrl(a.getAttribute('href'),location.href),explicit=img.getAttribute('data-full')||img.getAttribute('data-original')||img.getAttribute('data-url');
    if(a&&!link&&!explicit&&!item&&!nativeView)return null;
    var src=link||safeImageSource(explicit)||safeImageSource(img.currentSrc||img.getAttribute('src')||img.getAttribute('data-src'));
    if(!src)return null;if(item||nativeView||explicit)return src;
    var w=img.naturalWidth||Number(img.getAttribute('width')),h=img.naturalHeight||Number(img.getAttribute('height'));
    return w>=300&&h>=200?src:null;
  }
  function openPicture(src){
    if(!current)scan();var model=null;var base=cache.get(basePage);if(base&&base.images.indexOf(src)>=0)model=base;
    if(!model)Array.from(cache.values()).some(function(p){if(p.images.indexOf(src)>=0){model=p;return true;}return false;});
    if(!model){try{model=parsePage(document,new URL(location.href));}catch(_){model={url:location.href,number:pageNumber(new URL(location.href))||1,images:[],previous:null,next:null,links:[],max:1,expected:0};}if(model.images.indexOf(src)<0)model.images.unshift(src);cache.set(model.number,model);basePage=model.number;albumPage=true;}
    var native=document.querySelector('#imgLightbox');if(native&&native.classList.contains('show')){native.classList.remove('show');native.style.setProperty('display','none','important');document.body.style.overflow='';}
    current=model;openViewer(model.images.indexOf(src));
  }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
  function cleanText(node,decodeScripts){
    if(!node)return '';var clone=node.cloneNode(true);
    clone.querySelectorAll('[hidden],[aria-hidden="true"]').forEach(function(n){n.remove();});
    clone.querySelectorAll('[style]').forEach(function(n){if(/display\s*:\s*none|font-size\s*:\s*1px/i.test(n.getAttribute('style')))n.remove();});
    clone.querySelectorAll('script').forEach(function(n){var text='';if(decodeScripts){var m=n.textContent.match(/document\.write\(\s*e\(\s*d\(\s*['"]([A-Za-z0-9+/=]+)['"]/);if(m)try{text=new TextDecoder().decode(Uint8Array.from(atob(m[1]),function(c){return c.charCodeAt(0);}));}catch(_){}}n.replaceWith(clone.ownerDocument.createTextNode(text));});
    return clone.textContent.replace(/\s+/g,' ');
  }
  function expectedCount(doc){var node=doc.querySelector('.cover-meta')||doc.querySelector('[data-total-images]');if(!node)return 0;
    var text=cleanText(node,false),m=text.match(/共\s*([\d,]+)\s*张/);if(!m)m=cleanText(node,true).match(/共\s*([\d,]+)\s*张/);var n=m?Number(m[1].replace(/,/g,'')):0;return n>0&&n<=30000?n:0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  function decodeHtml64(value){if(value.length>10000000)throw new Error('编码页面过大');return new TextDecoder('utf-8',{fatal:true}).decode(Uint8Array.from(atob(value),function(c){return c.charCodeAt(0);}));}
  async function unpackAlbumHtml(html,base,signal){
    for(var layer=0;layer<8;layer++){
      if(html.length>7000000)throw new Error('页面数据过大');
      var reverse=html.match(/['"]([A-Za-z0-9+/=]{200,})['"]\.split\(\s*['"]{2}\s*\)\.reverse\(\)\.join\(\s*['"]{2}\s*\)/);
      if(reverse){html=decodeHtml64(reverse[1].split('').reverse().join(''));continue;}
      var loader=html.match(/loadScript\(\s*['"](\/obfuscate\/js\/t\/[a-f0-9]{32})['"]\s*,\s*['"]h['"]/i);
      if(loader){var u=siteUrl(loader[1],base);if(!u)throw new Error('页面数据入口不属于本站');html=await encodedResource(u,signal);continue;}
      return new DOMParser().parseFromString(html,'text/html');
    }
    throw new Error('页面包装超过8层,已停止');
  }
  function encodedResource(u,signal){if(resourceCache.has(u.href))return resourceCache.get(u.href);var promise=(async function(){var r=await fetch(u.href,{credentials:'same-origin',redirect:'manual',signal:signal});if(!r.ok||r.type==='opaqueredirect')throw new Error('图集数据入口访问失败');var final=siteUrl(r.url||u.href);if(!final||final.pathname!==u.pathname)throw new Error('图集数据入口异常跳转');var text=await r.text(),data=text.match(/^\s*var\s+h\s*=\s*['"]([A-Za-z0-9+/=]+)['"]\s*;?\s*$/);if(!data)throw new Error('图集数据格式变化,未执行未知脚本');return decodeHtml64(data[1]);})().catch(function(e){resourceCache.delete(u.href);throw e;});resourceCache.set(u.href,promise);if(resourceCache.size>96)resourceCache.delete(resourceCache.keys().next().value);return promise;}
  function refreshCatalogStatus(){
    var items=[],seen=new Set();Array.from(cache.values()).sort(function(a,b){return a.number-b.number;}).forEach(function(p){p.images.forEach(function(src,i){if(!seen.has(src)){seen.add(src);items.push({url:src,page:p.number,index:i});}});});catalog.items=items;
    var count=items.length,got=cache.size,wanted=catalog.expected,text='';
    if(catalog.running)text='正在识别整套:'+count+(wanted?' / '+wanted:'')+' 张,已读取 '+got+' / '+catalog.max+' 页';
    else if(catalog.complete)text='整套识别完成:'+count+' 张,'+got+' 页'+(wanted?',与网站标注 '+wanted+' 张一致':'(网站未标注总张数)');
    else if(catalog.error)text='部分识别:'+count+(wanted?' / '+wanted:'')+' 张,'+got+' 页;'+catalog.error;
    else text='本页 '+(current?current.images.length:0)+' 张'+(wanted?' / 标注 '+wanted+' 张':'')+';按需看图,完整目录可点识别整套';
    if(catalogStatus){catalogStatus.textContent=text;catalogStatus.dataset.state=catalog.running?'scanning':catalog.complete?'complete':catalog.error?'partial':'idle';}
    if(info&&active)paint();updateDiagnostic();
  }
  async function fetchAlbumPage(raw){
    var u=siteUrl(raw),n=u&&pageNumber(u);if(!u||u.pathname!==albumPath||!n)throw new Error('分页地址异常');if(cache.has(n))return cache.get(n);if(pageRequests.has(n))return pageRequests.get(n);
    var own=new AbortController();pageControllers.add(own);var timer=setTimeout(function(){own.abort();},15000);
    var promise=(async function(){var response=await fetch(u.href,{credentials:'same-origin',redirect:'manual',signal:own.signal});if(!response.ok||response.type==='opaqueredirect')throw new Error('第 '+n+' 页访问失败,可能需要登录或验证');
      var final=siteUrl(response.url||u.href);if(!final||final.pathname!==albumPath||pageNumber(final)!==n)throw new Error('第 '+n+' 页地址不匹配');var type=response.headers.get('content-type')||'';if(type&&!/html/i.test(type))throw new Error('第 '+n+' 页不是图集网页');
      var html=await response.text();if(html.length>5000000)throw new Error('网页过大');var p=parsePage(await unpackAlbumHtml(html,final.href,own.signal),final);
      [n-1,n+1].forEach(function(i){var adjacent=cache.get(i);if(adjacent&&p.images.length===adjacent.images.length&&p.images.every(function(v,j){return v===adjacent.images[j];}))throw new Error('第 '+n+' 页图片重复,已停止');});cache.set(n,p);return p;
    })().finally(function(){clearTimeout(timer);pageControllers.delete(own);pageRequests.delete(n);});pageRequests.set(n,promise);return promise;
  }
  function ensureCatalog(retry){
    if(catalog.running)return catalog.promise;if(catalog.complete)return Promise.resolve(true);if(catalog.started&&!retry)return Promise.resolve(false);if(!current)return Promise.resolve(false);
    catalog.started=true;catalog.running=true;catalog.error='';catalog.max=Math.max(current.max||current.number,1);catalog.expected=current.expected||0;var seed=new URL(current.url||location.href);
    catalog.promise=(async function(){try{for(var n=1;n<=catalog.max;n+=3){
      if(catalog.max>500)throw new Error('超过500页,本次只保留已识别部分');var jobs=[];
      for(var j=n;j<Math.min(n+3,catalog.max+1);j++)(function(page){jobs.push((async function(){var u=new URL(seed.href);if(page===1)u.searchParams.delete('page');else u.searchParams.set('page',String(page));var p=cache.get(page)||await fetchAlbumPage(u.href);catalog.max=Math.max(catalog.max,p.max||page);catalog.expected=Math.max(catalog.expected,p.expected||0);refreshCatalogStatus();return p;})());})(j);
      var settled=await Promise.allSettled(jobs),failure=settled.find(function(r){return r.status==='rejected';});if(failure)throw failure.reason;
    }
    refreshCatalogStatus();if(catalog.expected&&catalog.items.length!==catalog.expected)throw new Error('已读完分页但总数不符,仍缺 '+Math.max(0,catalog.expected-catalog.items.length)+' 张,请核对网站或重新识别');catalog.complete=true;return true;
    }catch(e){catalog.error=e.name==='AbortError'?'分页请求超时或已停止':e.message;return false;}finally{catalog.running=false;refreshCatalogStatus();}})();return catalog.promise;
  }
                                                                                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  function closeVisible(){generation++;active=false;loading=false;if(overlay){overlay.hidden=true;important(overlay,{display:'none','pointer-events':'none'});}if(picture)picture.removeAttribute('src');document.body.style.overflow=oldOverflow;if(cache.has(basePage))current=cache.get(basePage);var p=returnPosition;if(p){window.scrollTo(p.x,p.y);requestAnimationFrame(function(){window.scrollTo(p.x,p.y);});}}
                                                                                                                                                                             
                                                                                                                                          
                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
  async function saveCurrent(){if(!current)return;updateDownload('正在读取当前图片供浏览器另存…');try{var bytes=await imageBytes(current.images[index]);if(!isImage(bytes))throw new Error('网站返回的不是有效图片,未生成文件');var kind=bytes[0]===255?'jpeg':bytes[0]===137?'png':bytes[0]===71?'gif':bytes[0]===82?'webp':'avif';offerBlob(new Blob([bytes],{type:'image/'+kind}),'图片-'+current.number+'-'+(index+1)+'.'+(kind==='jpeg'?'jpg':kind));updateDownload('已生成当前图片文件,请点击下载文件或允许浏览器保存。');}catch(e){updateDownload(e.message+';也可长按原图使用浏览器保存。');}}
  function offerBlob(blob,name){if(!/\.zip$/i.test(name))zipCompleted=false;if(zipReady)URL.revokeObjectURL(zipReady.url);var url=URL.createObjectURL(blob);zipReady={url:url,name:name};var a=document.createElement('a');a.href=url;a.download=name;a.textContent='点击下载文件:'+name;a.setAttribute('data-bm-gallery-file','');important(a,{display:'block',color:'#428cff',padding:'10px','pointer-events':'auto'});a.addEventListener('click',function(e){e.stopPropagation();});
    [tools,overlay].forEach(function(n){if(n){var old=n.querySelector('[data-bm-gallery-file]');if(old)old.remove();n.appendChild(a.cloneNode(true));}});uiRoot.appendChild(a);a.click();a.remove();}
  async function imageBytes(src){
    var first=new AbortController(),firstTimer=setTimeout(function(){first.abort();},20000);zipController=first;imageControllers.add(first);
    try{var firstResponse=await fetch(src,{mode:'cors',credentials:'omit',signal:first.signal});if(!firstResponse.ok)throw new Error('IMAGE_HTTP_'+firstResponse.status);return new Uint8Array(await firstResponse.arrayBuffer());}
    catch(firstError){if(first.signal.aborted)throw new Error('图片读取已中止或超时,未继续重发');if(/^IMAGE_HTTP_/.test(firstError.message||''))throw new Error('图片HTTP '+firstError.message.slice(11)+',未打包');}
    finally{clearTimeout(firstTimer);imageControllers.delete(first);}
    var request=typeof GM_xmlhttpRequest==='function'?GM_xmlhttpRequest:typeof GM!=='undefined'&&GM&&typeof GM.xmlHttpRequest==='function'?function(o){return GM.xmlHttpRequest(o);}:null;
    if(request)return new Promise(function(resolve,reject){var done=false,h=null,timer=setTimeout(function(){finish(new Error('图片读取接口超时,无有效回调'));},20000);function finish(error,value){if(done)return;done=true;clearTimeout(timer);if(h)imageControllers.delete(h);error?reject(error):resolve(value);}
      try{h=request({method:'GET',url:src,responseType:'arraybuffer',headers:{Referer:origin+'/'},onload:function(r){if(r.status!==200){finish(new Error('图片HTTP '+r.status+',未打包'));return;}var b=r.response;if(b instanceof ArrayBuffer)finish(null,new Uint8Array(b));else if(ArrayBuffer.isView(b))finish(null,new Uint8Array(b.buffer,b.byteOffset,b.byteLength));else if(b&&typeof b.arrayBuffer==='function')b.arrayBuffer().then(function(x){finish(null,new Uint8Array(x));},function(){finish(new Error('图片正文读取失败'));});else finish(new Error('浏览器未返回二进制图片,请检查脚本权限'));},onerror:function(){finish(new Error('图片读取接口错误'));},onabort:function(){finish(new Error('图片读取已停止'));}});zipController=h;if(h&&h.abort&&!done)imageControllers.add(h);}catch(_){finish(new Error('图片读取接口调用失败'));}
    });
    throw new Error('网页无法跨域读取图片,需浏览器提供GM图片读取接口');
  }
  function isImage(bytes){return bytes.length>=4&&((bytes[0]===255&&bytes[1]===216)||(bytes[0]===137&&bytes[1]===80&&bytes[2]===78)||(bytes[0]===71&&bytes[1]===73&&bytes[2]===70)||(bytes[0]===82&&bytes[1]===73&&bytes[2]===70)||String.fromCharCode.apply(null,bytes.slice(4,12)).indexOf('ftyp')>=0);}
  function continueZip(){if(!zipGate)return;var gate=zipGate;zipGate=null;zipContinueButtons.forEach(function(b){important(b,{display:'none'});});gate.resolve();}
  function abortImageReads(){imageControllers.forEach(function(c){try{c.abort();}catch(_){}});imageControllers.clear();}
  async function startZip(){if(zipBusy||downloading||!current)return;if(zipCompleted&&zipReady&&/\.zip$/i.test(zipReady.name)){updateDownload('复用已生成的压缩包,不重新读取图片;多包图集的前几包请在下载目录查看。');var readyLink=uiRoot.querySelector('[data-bm-gallery-file]');if(readyLink)readyLink.click();return;}zipBusy=true;zipCompleted=false;var token=++zipGeneration,count=0,size=0,partNumber=1,partSize=0,partCount=0,parts=[],zipError=null,zip=null,pending=new Map(),nextRead=0,bytesRead=0;updateDownload('ZIP:正在收齐整套目录…');
    function create(){parts=[];zipError=null;partSize=0;partCount=0;zip=new zipLibrary.Zip(function(error,data){if(error)zipError=error;else parts.push(data);});}
    function exportPart(){zip.end();if(zipError)throw zipError;offerBlob(new Blob(parts,{type:'application/zip'}),'图集-'+(albumPath.match(/\d+/)||['图片'])[0]+'-第'+String(partNumber).padStart(2,'0')+'包.zip');parts=[];}
    try{if(!await ensureCatalog(true))throw new Error('整套识别未完成:'+catalog.error);var items=catalog.items.slice(),limit=zipPartLimit;create();
      function fill(){while(pending.size<3&&nextRead<items.length&&zipBusy&&token===zipGeneration&&!zipGate){var n=nextRead++;pending.set(n,imageBytes(items[n].url).then(function(bytes){bytesRead+=bytes.length;return {bytes:bytes};},function(error){return {error:error};}));}}
      fill();
      for(var i=0;i<items.length;i++){if(!zipBusy||token!==zipGeneration)return;fill();updateDownload('ZIP第'+partNumber+'包:下载原图 '+(i+1)+' / '+items.length+' 张(最多3路,已传输'+(bytesRead/1048576).toFixed(1)+'MB)');var result=await pending.get(i);pending.delete(i);if(result.error)throw result.error;var bytes=result.bytes;if(!zipBusy||token!==zipGeneration)return;if(!isImage(bytes))throw new Error('第 '+(i+1)+' 张不是有效图片,未生成完整ZIP');if(bytes.length>300*1024*1024)throw new Error('单张图片超过300MB,无法在手机安全打包');
        if(partCount&&partSize+bytes.length>limit){exportPart();updateDownload('第'+partNumber+'包已生成('+partCount+'张);请先保存文件,再点继续下一包。');zipContinueButtons.forEach(function(b){important(b,{display:'inline-block'});});await new Promise(function(resolve,reject){zipGate={resolve:resolve,reject:reject};});if(!zipBusy||token!==zipGeneration)return;partNumber++;create();}
        var ext=(new URL(items[i].url).pathname.match(/\.(jpg|jpeg|png|webp|gif|avif)$/i)||[])[1]||'jpg',file=new zipLibrary.ZipPassThrough(String(i+1).padStart(5,'0')+'.'+ext);zip.add(file);file.push(bytes,true);if(zipError)throw zipError;count++;size+=bytes.length;partCount++;partSize+=bytes.length;fill();
      }
      exportPart();zipCompleted=true;updateDownload('ZIP已生成:'+count+' 张,共'+partNumber+'包,图片总计'+(size/1048576).toFixed(1)+'MB;每包可独立解压。');
    }catch(e){abortImageReads();if(token===zipGeneration)updateDownload('ZIP未全部完成:'+e.message+'(已读取 '+count+' 张)');}finally{if(token===zipGeneration){zipBusy=false;zipGate=null;zipContinueButtons.forEach(function(b){important(b,{display:'none'});});updateDownload(downloadMessage);}}
  }
                                                                                                                                                                                                                                                                                                                                                                                
  function viewerPopstate(e){if(active&&historyOwned){e.stopImmediatePropagation();historyOwned=false;closeVisible();}}
  function viewerKey(e){if(!active)return;if(e.key==='Escape'){e.preventDefault();e.stopImmediatePropagation();closeViewer();}else if(e.key==='ArrowRight'||e.key==='ArrowLeft'){e.preventDefault();e.stopImmediatePropagation();step(e.key==='ArrowRight'?1:-1);}}
  function endPage(){pageControllers.forEach(function(c){c.abort();});if(zipBusy||downloading)stopDownload();if(zipReady)URL.revokeObjectURL(zipReady.url);}
  function imageLoaded(e){if(e.target&&e.target.tagName==='IMG'&&!e.target.closest('#bm-gallery-ui-root')){if(scanTimer)return;scanTimer=setTimeout(function(){scanTimer=null;scan();},100);}}
  function bindInteractionEvents(){
    ['click','auxclick','pointerdown','mousedown','touchstart','touchend'].forEach(function(type){window.removeEventListener(type,intercept,true);window.addEventListener(type,intercept,{capture:true,passive:false});});
    [[window,'popstate',viewerPopstate,true],[window,'keydown',viewerKey,true],[window,'pagehide',endPage,false],[window,'resize',requestPosition,false],[window,'scroll',requestPosition,false],[document,'load',imageLoaded,true]].forEach(function(v){v[0].removeEventListener(v[1],v[2],v[3]);v[0].addEventListener(v[1],v[2],v[3]);});
    if(window.visualViewport){visualViewport.removeEventListener('resize',requestPosition);visualViewport.removeEventListener('scroll',requestPosition);visualViewport.addEventListener('resize',requestPosition);visualViewport.addEventListener('scroll',requestPosition);}
  }
  bindInteractionEvents();

  document.addEventListener('keydown',function(e){if(!active)return;if(e.key==='Escape'){e.preventDefault();closeViewer();}else if(e.key==='ArrowRight'){e.preventDefault();step(1);}else if(e.key==='ArrowLeft'){e.preventDefault();step(-1);}},true);

  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start,{once:true});else start();
})();

$ tail -f comments.log

Comments [0]

// no comments yet