@adaptive-ai/sdk 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,28 @@
1
- import {useMutation}from'@tanstack/react-query';import {identity}from'lodash';import {nanoid}from'nanoid';import {useState,useEffect,useRef,useCallback}from'react';import _ from'superjson';function b(e){return new Promise(r=>{let n=new FileReader;n.onload=()=>{r(n.result);},n.readAsDataURL(e);})}function M({appId:e,rootUrl:r,baseUrl:n,versionId:i,isTesting:t,realtimeDomain:o}){window.__APP_ID__=e,window.__ROOT_URL__=r,window.__BASE_URL__=n,i&&(window.__VERSION_ID__=i),window.__IS_TESTING__=t,window.__REALTIME_DOMAIN__=o;}var l=e=>{let{email:r,phoneNumber:n}=e??{},i=r??n,t=new URLSearchParams;e&&"redirectUri"in e&&e.redirectUri?t.set("returnTo",e.redirectUri):t.set("returnTo",window.location.pathname+window.location.search),e?.provider&&"scope"in e&&(t.set("provider",e.provider),e.scope&&e.scope.length>0&&t.set("scope",e.scope.join(","))),e?.provider=="AC1"&&i&&t.set("identity",i),t.set("stripped","true");let o=window.__APP_ID__;window.__OPEN_AUTH_DRAWER__(`${window.__ROOT_URL__}/setup/${o}?${t.toString()}`);};function P(){return {redirectToLogin:e=>e?.email?l({email:e.email,provider:"AC1"}):l()}}function $(e={}){let[r,n]=useState({userId:void 0,status:"loading",signIn:l,providers:[]});return useEffect(()=>{(async()=>{try{let o=await(await fetch("/api/session",{method:"POST",headers:{"Content-Type":"application/json","x-guest-api-internal":"session",...window.__VERSION_ID__?{"x-version-id":window.__VERSION_ID__}:{},...window.__IS_TESTING__?{"x-is-testing":"true"}:{}}})).json()??{};n({userId:o.userId??null,status:"authenticated",signIn:l,providers:o?.providers??[]});}catch{if(e.required){let o=encodeURIComponent(window.location.pathname+window.location.search),d=window.__APP_ID__;window.top?window.top.location.href=`${window.__ROOT_URL__}/setup/${d}?returnTo=${o}`:window.location.href=`${window.__ROOT_URL__}/setup/${d}?returnTo=${o}`;}else n({userId:null,status:"unauthenticated",signIn:l,providers:[]});}})();},[e.required]),r}function C(){return window.__BASE_URL__}async function U({channelId:e,initialData:r,broadcastOnly:n,onUpdate:i}){let t=r,o=0,d=window.__REALTIME_DOMAIN__;if(n)return {getData(){return t},setData(u){t=u,fetch(`https://${d}/${e}`,{method:"POST",body:_.stringify(t)}).catch(console.error),i?.(u);},destroy(){}};let s=new WebSocket(`wss://${d}/${e}`);return new Promise((u,w)=>{function T(a){try{let c=JSON.parse(a.data.toString());c?.id&&c.id>o?(t=_.parse(c.payload),i?.(t),o=c.id):console.error("Invalid message:",a.data);}catch{console.error("Error parsing message:",a.data);}}function R(a){m(),w(a);}function h(){u({getData(){return t},setData(a){t=a,i?.(a),s.send(_.stringify(a));},destroy:m});}function m(){s.removeEventListener("message",T),s.removeEventListener("error",R),s.removeEventListener("open",h),s.close();}s.addEventListener("message",T),s.addEventListener("error",R),s.addEventListener("open",h);})}function v(e,r){let n=useRef(null),[i,t]=useState(0);return useEffect(()=>((async()=>e&&(n.current=await U({channelId:e,initialData:r,onUpdate:()=>{t(o=>o+1);}})))(),n.current?.destroy),[e,t]),[n.current?.getData(),n.current?.setData??identity]}function N(e,r){let[n,i]=useState(null),[t]=v(n,void 0),o=useCallback(async s=>{let u=nanoid(32);return i(u),await e?.({...s,__channelId:u})},[e]);return {...useMutation(o,r),data:t}}
2
- export{U as connectToRealtimeStore,b as encodeFileAsBase64DataURL,C as getBaseUrl,M as initializeClientEnvironment,$ as useAuth,N as useRealtimeMutation,v as useRealtimeStore,P as useRedirectToLogin};
1
+ import {useMutation}from'@tanstack/react-query';import {identity}from'lodash';import {nanoid}from'nanoid';import {useState,useEffect,useRef,useCallback}from'react';import yt from'superjson';var un=Object.create;var Et=Object.defineProperty;var cn=Object.getOwnPropertyDescriptor;var dn=Object.getOwnPropertyNames;var hn=Object.getPrototypeOf,pn=Object.prototype.hasOwnProperty;var je=(a,o)=>()=>(o||a((o={exports:{}}).exports,o),o.exports);var gn=(a,o,C,u)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of dn(o))!pn.call(a,e)&&e!==C&&Et(a,e,{get:()=>o[e],enumerable:!(u=cn(o,e))||u.enumerable});return a};var bt=(a,o,C)=>(C=a!=null?un(hn(a)):{},gn(Et(C,"default",{value:a,enumerable:true}),a));var Dt=je((rt,ot)=>{(a=>{let o=(()=>{let R=0;return {escape:function(s){return s.replace(/([.*+?^${}()|[\]/\\])/g,"\\$1")},isDataUrl:function(s){return s.search(/^(data:)/)!==-1},canvasToBlob:function(s){return s.toBlob?new Promise(function(y){s.toBlob(y);}):(y=>new Promise(function(b){var A=i(y.toDataURL().split(",")[1]),S=A.length,g=new Uint8Array(S);for(let d=0;d<S;d++)g[d]=A.charCodeAt(d);b(new Blob([g],{type:"image/png"}));}))(s)},resolveUrl:function(s,y){var b=document.implementation.createHTMLDocument(),A=b.createElement("base"),S=(b.head.appendChild(A),b.createElement("a"));return b.body.appendChild(S),A.href=y,S.href=s,S.href},getAndEncode:function(s){let y=v.impl.urlCache.find(function(b){return b.url===s});return y||(y={url:s,promise:null},v.impl.urlCache.push(y)),y.promise===null&&(v.impl.options.cacheBust&&(s+=(/\?/.test(s)?"&":"?")+new Date().getTime()),y.promise=new Promise(function(b){let A=new XMLHttpRequest;function S(P){console.error(P),b("");}function g(){var P=v.impl.options.imagePlaceholder;P?b(P):S("Status:"+A.status+" while fetching resource: "+s);}if(A.timeout=v.impl.options.httpTimeout,A.onerror=g,A.ontimeout=g,A.onloadend=function(){if(A.readyState===XMLHttpRequest.DONE){var P=A.status;if(P===0&&s.toLowerCase().startsWith("file://")||200<=P&&P<=300&&A.response!==null){P=A.response,P instanceof Blob||S("Expected response to be a Blob, but got: "+typeof P);let U=new FileReader;U.onloadend=function(){var O=U.result;b(O);};try{U.readAsDataURL(P);}catch(O){S("Failed to read the response as Data URL: "+O.toString());}}else g();}},0<v.impl.options.useCredentialsFilters.length&&(v.impl.options.useCredentials=0<v.impl.options.useCredentialsFilters.filter(P=>0<=s.search(P)).length),v.impl.options.useCredentials&&(A.withCredentials=true),v.impl.options.corsImg&&s.indexOf("http")===0&&s.indexOf(window.location.origin)===-1){var d=(v.impl.options.corsImg.method||"GET").toUpperCase()==="POST"?"POST":"GET";A.open(d,(v.impl.options.corsImg.url||"").replace("#{cors}",s),true);let P=false,U=v.impl.options.corsImg.headers||{},O=(Object.keys(U).forEach(function(N){U[N].indexOf("application/json")!==-1&&(P=true),A.setRequestHeader(N,U[N]);}),(N=>{try{return JSON.parse(JSON.stringify(N))}catch(D){S("corsImg.data is missing or invalid:"+D.toString());}})(v.impl.options.corsImg.data||""));Object.keys(O).forEach(function(N){typeof O[N]=="string"&&(O[N]=O[N].replace("#{cors}",s));}),A.responseType="blob",A.send(P?JSON.stringify(O):O);}else A.open("GET",s,true),A.responseType="blob",A.send();})),y.promise},uid:function(){return "u"+("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)+R++},asArray:function(s){var y=[],b=s.length;for(let A=0;A<b;A++)y.push(s[A]);return y},escapeXhtml:function(s){return s.replace(/%/g,"%25").replace(/#/g,"%23").replace(/\n/g,"%0A")},makeImage:function(s){return s!=="data:,"?new Promise(function(y,b){let A=document.createElementNS("http://www.w3.org/2000/svg","svg"),S=new Image;v.impl.options.useCredentials&&(S.crossOrigin="use-credentials"),S.onload=function(){document.body.removeChild(A),window&&window.requestAnimationFrame?window.requestAnimationFrame(function(){y(S);}):y(S);},S.onerror=g=>{document.body.removeChild(A),b(g);},A.appendChild(S),S.src=s,document.body.appendChild(A);}):Promise.resolve()},width:function(s){var y=E(s,"width");if(!isNaN(y))return y;var y=E(s,"border-left-width"),b=E(s,"border-right-width");return s.scrollWidth+y+b},height:function(s){var y=E(s,"height");if(!isNaN(y))return y;var y=E(s,"border-top-width"),b=E(s,"border-bottom-width");return s.scrollHeight+y+b},getWindow:p,isElement:l,isElementHostForOpenShadowRoot:function(s){return l(s)&&s.shadowRoot!==null},isShadowRoot:M,isInShadowRoot:c,isHTMLElement:function(s){return s instanceof p(s).HTMLElement},isHTMLCanvasElement:function(s){return s instanceof p(s).HTMLCanvasElement},isHTMLInputElement:function(s){return s instanceof p(s).HTMLInputElement},isHTMLImageElement:function(s){return s instanceof p(s).HTMLImageElement},isHTMLLinkElement:function(s){return s instanceof p(s).HTMLLinkElement},isHTMLScriptElement:function(s){return s instanceof p(s).HTMLScriptElement},isHTMLStyleElement:function(s){return s instanceof p(s).HTMLStyleElement},isHTMLTextAreaElement:function(s){return s instanceof p(s).HTMLTextAreaElement},isShadowSlotElement:function(s){return c(s)&&s instanceof p(s).HTMLSlotElement},isSVGElement:function(s){return s instanceof p(s).SVGElement},isSVGRectElement:function(s){return s instanceof p(s).SVGRectElement},isDimensionMissing:function(s){return isNaN(s)||s<=0}};function p(s){return s=s?s.ownerDocument:void 0,(s?s.defaultView:void 0)||window||a}function M(s){return s instanceof p(s).ShadowRoot}function c(s){return s!=null&&s.getRootNode!==void 0&&M(s.getRootNode())}function l(s){return s instanceof p(s).Element}function E(s,y){if(s.nodeType===T){let b=r(s).getPropertyValue(y);if(b.slice(-2)==="px")return b=b.slice(0,-2),parseFloat(b)}return NaN}})(),C=(()=>{let R=/url\(\s*(["']?)((?:\\.|[^\\)])+)\1\s*\)/gm;return {inlineAll:function(E,s,y){return p(E)?Promise.resolve(E).then(M).then(function(b){let A=Promise.resolve(E);return b.forEach(function(S){A=A.then(function(g){return l(g,S,s,y)});}),A}):Promise.resolve(E)},shouldProcess:p,impl:{readUrls:M,inline:l,urlAsRegex:c}};function p(E){return E.search(R)!==-1}function M(E){for(var s,y=[];(s=R.exec(E))!==null;)y.push(s[2]);return y.filter(function(b){return !o.isDataUrl(b)})}function c(E){return new RegExp(`url\\((["']?)(${o.escape(E)})\\1\\)`,"gm")}function l(E,s,y,b){return Promise.resolve(s).then(function(A){return y?o.resolveUrl(A,y):A}).then(b||o.getAndEncode).then(function(A){var S=c(s);return E.replace(S,`url($1${A}$1)`)})}})(),u={resolveAll:function(){return e().then(function(R){return Promise.all(R.map(function(p){return p.resolve()}))}).then(function(R){return R.join(`
2
+ `)})},impl:{readAll:e}};function e(){return Promise.resolve(o.asArray(document.styleSheets)).then(function(p){let M=[];return p.forEach(function(c){var l=Object.getPrototypeOf(c);if(Object.prototype.hasOwnProperty.call(l,"cssRules"))try{o.asArray(c.cssRules||[]).forEach(M.push.bind(M));}catch(E){console.error("domtoimage: Error while reading CSS rules from: "+c.href,E.toString());}}),M}).then(function(p){return p.filter(function(M){return M.type===CSSRule.FONT_FACE_RULE}).filter(function(M){return C.shouldProcess(M.style.getPropertyValue("src"))})}).then(function(p){return p.map(R)});function R(p){return {resolve:function(){var M=(p.parentStyleSheet||{}).href;return C.inlineAll(p.cssText,M)},src:function(){return p.style.getPropertyValue("src")}}}}let t={inlineAll:function R(p){if(!o.isElement(p))return Promise.resolve(p);return M(p).then(function(){return o.isHTMLImageElement(p)?m(p).inline():Promise.all(o.asArray(p.childNodes).map(function(c){return R(c)}))});function M(c){let l=["background","background-image"],E=l.map(function(s){let y=c.style.getPropertyValue(s),b=c.style.getPropertyPriority(s);return y?C.inlineAll(y).then(function(A){c.style.setProperty(s,A,b);}):Promise.resolve()});return Promise.all(E).then(function(){return c})}},impl:{newImage:m}};function m(R){return {inline:function(p){return o.isDataUrl(R.src)?Promise.resolve():Promise.resolve(R.src).then(p||o.getAndEncode).then(function(M){return new Promise(function(c){R.onload=c,R.onerror=c,R.src=M;})})}}}let f={copyDefaultStyles:true,imagePlaceholder:void 0,cacheBust:false,useCredentials:false,useCredentialsFilters:[],httpTimeout:3e4,styleCaching:"strict",corsImg:void 0},v={toSvg:n,toPng:function(R,p){return h(R,p).then(function(M){return M.toDataURL()})},toJpeg:function(R,p){return h(R,p).then(function(M){return M.toDataURL("image/jpeg",(p?p.quality:void 0)||1)})},toBlob:function(R,p){return h(R,p).then(o.canvasToBlob)},toPixelData:function(R,p){return h(R,p).then(function(M){return M.getContext("2d").getImageData(0,0,o.width(R),o.height(R)).data})},toCanvas:h,impl:{fontFaces:u,images:t,util:o,inliner:C,urlCache:[],options:{},copyOptions:function(R){R.copyDefaultStyles===void 0?v.impl.options.copyDefaultStyles=f.copyDefaultStyles:v.impl.options.copyDefaultStyles=R.copyDefaultStyles,v.impl.options.imagePlaceholder=(R.imagePlaceholder===void 0?f:R).imagePlaceholder,v.impl.options.cacheBust=(R.cacheBust===void 0?f:R).cacheBust,v.impl.options.corsImg=(R.corsImg===void 0?f:R).corsImg,v.impl.options.useCredentials=(R.useCredentials===void 0?f:R).useCredentials,v.impl.options.useCredentialsFilters=(R.useCredentialsFilters===void 0?f:R).useCredentialsFilters,v.impl.options.httpTimeout=(R.httpTimeout===void 0?f:R).httpTimeout,v.impl.options.styleCaching=(R.styleCaching===void 0?f:R).styleCaching;}}},T=(typeof rt=="object"&&typeof ot=="object"?ot.exports=v:a.domtoimage=v,(Node===void 0?void 0:Node.ELEMENT_NODE)||1),r=(a===void 0?void 0:a.getComputedStyle)||(window===void 0?void 0:window.getComputedStyle)||globalThis.getComputedStyle,i=(a===void 0?void 0:a.atob)||(window===void 0?void 0:window.atob)||globalThis.atob;function n(R,p){v.impl.util.getWindow(R);let c=(p=p||{},v.impl.copyOptions(p),[]);return Promise.resolve(R).then(function(l){if(l.nodeType===T)return l;var E=l,s=document.createElement("span");return E.replaceWith(s),s.append(l),c.push({child:E,wrapper:s}),s}).then(function(l){return function E(s,y,b,A){let S=y.filter;if(s===w||o.isHTMLScriptElement(s)||o.isHTMLStyleElement(s)||o.isHTMLLinkElement(s)||b!==null&&S&&!S(s))return Promise.resolve();return Promise.resolve(s).then(g).then(d).then(function(D){return O(D,U(s))}).then(P).then(function(D){return N(D,s)});function g(D){return o.isHTMLCanvasElement(D)?o.makeImage(D.toDataURL()):D.cloneNode(false)}function d(D){return y.adjustClonedNode&&y.adjustClonedNode(s,D,false),Promise.resolve(D)}function P(D){return y.adjustClonedNode&&y.adjustClonedNode(s,D,true),Promise.resolve(D)}function U(D){return o.isElementHostForOpenShadowRoot(D)?D.shadowRoot:D}function O(D,Q){let k=K(Q),x=Promise.resolve();if(k.length!==0){let q=r($(Q));o.asArray(k).forEach(function(V){x=x.then(function(){return E(V,y,q).then(function(G){G&&D.appendChild(G);})});});}return x.then(function(){return D});function $(q){return o.isShadowRoot(q)?q.host:q}function K(q){if(o.isShadowSlotElement(q)){let V=q.assignedNodes();if(V&&0<V.length)return V}return q.childNodes}}function N(D,Q){return !o.isElement(D)||o.isShadowSlotElement(Q)?Promise.resolve(D):Promise.resolve().then(x).then($).then(K).then(q).then(k).then(function(){return D});function k(){o.isHTMLImageElement(D)&&(D.removeAttribute("loading"),Q.srcset||Q.sizes)&&(D.removeAttribute("srcset"),D.removeAttribute("sizes"),D.src=Q.currentSrc||Q.src);}function x(){function V(z,W){W.font=z.font,W.fontFamily=z.fontFamily,W.fontFeatureSettings=z.fontFeatureSettings,W.fontKerning=z.fontKerning,W.fontSize=z.fontSize,W.fontStretch=z.fontStretch,W.fontStyle=z.fontStyle,W.fontVariant=z.fontVariant,W.fontVariantCaps=z.fontVariantCaps,W.fontVariantEastAsian=z.fontVariantEastAsian,W.fontVariantLigatures=z.fontVariantLigatures,W.fontVariantNumeric=z.fontVariantNumeric,W.fontVariationSettings=z.fontVariationSettings,W.fontWeight=z.fontWeight;}function G(z,W){let ie=r(z);ie.cssText?(W.style.cssText=ie.cssText,V(ie,W.style)):(_(y,z,ie,b,W),b===null&&(["inset-block","inset-block-start","inset-block-end"].forEach(ae=>W.style.removeProperty(ae)),["left","right","top","bottom"].forEach(ae=>{W.style.getPropertyValue(ae)&&W.style.setProperty(ae,"0px");})));}G(Q,D);}function $(){let V=o.uid();function G(z){let W=r(Q,z),ie=W.getPropertyValue("content");if(ie!==""&&ie!=="none"){let Y=function(){let Z=`.${V}:`+z,ne=(W.cssText?oe:j)();return document.createTextNode(Z+`{${ne}}`);function oe(){return `${W.cssText} content: ${ie};`}function j(){return o.asArray(W).map(ee).join("; ")+";";function ee(X){let le=W.getPropertyValue(X),ge=W.getPropertyPriority(X)?" !important":"";return X+": "+le+ge}}};let J=D.getAttribute("class")||"",te=(D.setAttribute("class",J+" "+V),document.createElement("style"));te.appendChild(Y()),D.appendChild(te);}}[":before",":after"].forEach(function(z){G(z);});}function K(){o.isHTMLTextAreaElement(Q)&&(D.innerHTML=Q.value),o.isHTMLInputElement(Q)&&D.setAttribute("value",Q.value);}function q(){o.isSVGElement(D)&&(D.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.isSVGRectElement(D))&&["width","height"].forEach(function(V){let G=D.getAttribute(V);G&&D.style.setProperty(V,G);});}}}(l,p,null)}).then(p.disableEmbedFonts?Promise.resolve(R):I).then(p.disableInlineImages?Promise.resolve(R):L).then(function(l){p.bgcolor&&(l.style.backgroundColor=p.bgcolor),p.width&&(l.style.width=p.width+"px"),p.height&&(l.style.height=p.height+"px"),p.style&&Object.keys(p.style).forEach(function(s){l.style[s]=p.style[s];});let E=null;return typeof p.onclone=="function"&&(E=p.onclone(l)),Promise.resolve(E).then(function(){return l})}).then(function(l){let E=p.width||o.width(R),s=p.height||o.height(R);return Promise.resolve(l).then(function(y){return y.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(y)}).then(o.escapeXhtml).then(function(y){var b=(o.isDimensionMissing(E)?' width="100%"':` width="${E}"`)+(o.isDimensionMissing(s)?' height="100%"':` height="${s}"`);return `<svg xmlns="http://www.w3.org/2000/svg"${(o.isDimensionMissing(E)?"":` width="${E}"`)+(o.isDimensionMissing(s)?"":` height="${s}"`)}><foreignObject${b}>${y}</foreignObject></svg>`}).then(function(y){return "data:image/svg+xml;charset=utf-8,"+y})}).then(function(l){for(;0<c.length;){var E=c.pop();E.wrapper.replaceWith(E.child);}return l}).then(function(l){return v.impl.urlCache=[],w&&(document.body.removeChild(w),w=null),H&&clearTimeout(H),H=setTimeout(()=>{H=null,B={};},2e4),l})}function h(R,p){return n(R,p=p||{}).then(o.makeImage).then(function(M){var c=typeof p.scale!="number"?1:p.scale,l=((s,y)=>{let b=p.width||o.width(s),A=p.height||o.height(s);return o.isDimensionMissing(b)&&(b=o.isDimensionMissing(A)?300:2*A),o.isDimensionMissing(A)&&(A=b/2),(s=document.createElement("canvas")).width=b*y,s.height=A*y,p.bgcolor&&((y=s.getContext("2d")).fillStyle=p.bgcolor,y.fillRect(0,0,s.width,s.height)),s})(R,c),E=l.getContext("2d");return E.msImageSmoothingEnabled=false,E.imageSmoothingEnabled=false,M&&(E.scale(c,c),E.drawImage(M,0,0)),l})}let w=null;function I(R){return u.resolveAll().then(function(p){var M;return p!==""&&(M=document.createElement("style"),R.appendChild(M),M.appendChild(document.createTextNode(p))),R})}function L(R){return t.inlineAll(R).then(function(){return R})}function _(R,p,M,c,l){let E=v.impl.options.copyDefaultStyles?((y,b)=>{var A,S=(P=>(y.styleCaching!=="relaxed"?P:P.filter((U,O,N)=>O===0||O===N.length-1)).join(">"))(b=(P=>{var U=[];do if(P.nodeType===T){var O=P.tagName;if(U.push(O),F.includes(O))break}while(P=P.parentNode);return U})(b));{if(B[S])return B[S];b=((P,U)=>{let O=P.body;do{var N=U.pop(),N=P.createElement(N);O.appendChild(N),O=N;}while(0<U.length);return O.textContent="\u200B",O})((A=(()=>{if(w)return w.contentWindow;U=document.characterSet||"UTF-8",P=(P=document.doctype)?(`<!DOCTYPE ${x(P.name)} ${x(P.publicId)} `+x(P.systemId)).trim()+">":"",(w=document.createElement("iframe")).id="domtoimage-sandbox-"+o.uid(),w.style.top="-9999px",w.style.visibility="hidden",w.style.position="fixed",document.body.appendChild(w);var P,U,O=w,N="domtoimage-sandbox";try{return O.contentWindow.document.write(P+`<html><head><meta charset='${U}'><title>${N}</title></head><body></body></html>`),O.contentWindow}catch{}var D=document.createElement("meta");D.setAttribute("charset",U);try{var Q=document.implementation.createHTMLDocument(N),k=(Q.head.appendChild(D),P+Q.documentElement.outerHTML);return O.setAttribute("srcdoc",k),O.contentWindow}catch{}return O.contentDocument.head.appendChild(D),O.contentDocument.title=N,O.contentWindow;function x($){var K;return $?((K=document.createElement("div")).innerText=$,K.innerHTML):""}})()).document,b),A=((P,U)=>{let O={},N=P.getComputedStyle(U);return o.asArray(N).forEach(function(D){O[D]=D==="width"||D==="height"?"auto":N.getPropertyValue(D);}),O})(A,b);var g=b;do{var d=g.parentElement;d!==null&&d.removeChild(g),g=d;}while(g&&g.tagName!=="BODY");return B[S]=A}})(R,p):{},s=l.style;o.asArray(M).forEach(function(y){var b,A,S,g;R.filterStyles&&!R.filterStyles(p,y)||(A=M.getPropertyValue(y),S=E[y],b=c?c.getPropertyValue(y):void 0,s.getPropertyValue(y))||(A!==S||c&&A!==b)&&(S=M.getPropertyPriority(y),b=s,A=A,S=S,g=0<=["background-clip"].indexOf(y=y),S?(b.setProperty(y,A,S),g&&b.setProperty("-webkit-"+y,A,S)):(b.setProperty(y,A),g&&b.setProperty("-webkit-"+y,A)));});}let H=null,B={},F=["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DETAILS","DIALOG","DD","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","SVG","TABLE","UL","math","svg","BODY","HEAD","HTML"];})(rt);});var xt=je(()=>{});var rn=je((cr,nn)=>{var pt=typeof Map=="function"&&Map.prototype,it=Object.getOwnPropertyDescriptor&&pt?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Xe=pt&&it&&typeof it.get=="function"?it.get:null,Bt=pt&&Map.prototype.forEach,gt=typeof Set=="function"&&Set.prototype,at=Object.getOwnPropertyDescriptor&&gt?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ye=gt&&at&&typeof at.get=="function"?at.get:null,Ht=gt&&Set.prototype.forEach,Tn=typeof WeakMap=="function"&&WeakMap.prototype,Be=Tn?WeakMap.prototype.has:null,_n=typeof WeakSet=="function"&&WeakSet.prototype,He=_n?WeakSet.prototype.has:null,Rn=typeof WeakRef=="function"&&WeakRef.prototype,kt=Rn?WeakRef.prototype.deref:null,Cn=Boolean.prototype.valueOf,In=Object.prototype.toString,Un=Function.prototype.toString,Mn=String.prototype.match,mt=String.prototype.slice,Se=String.prototype.replace,On=String.prototype.toUpperCase,Nt=String.prototype.toLowerCase,Xt=RegExp.prototype.test,Qt=Array.prototype.concat,Ae=Array.prototype.join,Pn=Array.prototype.slice,$t=Math.floor,ft=typeof BigInt=="function"?BigInt.prototype.valueOf:null,st=Object.getOwnPropertySymbols,ut=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Le=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ke=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Le||true)?Symbol.toStringTag:null,Yt=Object.prototype.propertyIsEnumerable,Wt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(a){return a.__proto__}:null);function Vt(a,o){if(a===1/0||a===-1/0||a!==a||a&&a>-1e3&&a<1e3||Xt.call(/e/,o))return o;var C=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof a=="number"){var u=a<0?-$t(-a):$t(a);if(u!==a){var e=String(u),t=mt.call(o,e.length+1);return Se.call(e,C,"$&_")+"."+Se.call(Se.call(t,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Se.call(o,C,"$&_")}var ct=xt(),zt=ct.custom,qt=jt(zt)?zt:null,Zt={__proto__:null,double:'"',single:"'"},Ln={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};nn.exports=function a(o,C,u,e){var t=C||{};if(we(t,"quoteStyle")&&!we(Zt,t.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(we(t,"maxStringLength")&&(typeof t.maxStringLength=="number"?t.maxStringLength<0&&t.maxStringLength!==1/0:t.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var m=we(t,"customInspect")?t.customInspect:true;if(typeof m!="boolean"&&m!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(we(t,"indent")&&t.indent!==null&&t.indent!==" "&&!(parseInt(t.indent,10)===t.indent&&t.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(we(t,"numericSeparator")&&typeof t.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var f=t.numericSeparator;if(typeof o>"u")return "undefined";if(o===null)return "null";if(typeof o=="boolean")return o?"true":"false";if(typeof o=="string")return tn(o,t);if(typeof o=="number"){if(o===0)return 1/0/o>0?"0":"-0";var v=String(o);return f?Vt(o,v):v}if(typeof o=="bigint"){var T=String(o)+"n";return f?Vt(o,T):T}var r=typeof t.depth>"u"?5:t.depth;if(typeof u>"u"&&(u=0),u>=r&&r>0&&typeof o=="object")return dt(o)?"[Array]":"[Object]";var i=Zn(t,u);if(typeof e>"u")e=[];else if(en(e,o)>=0)return "[Circular]";function n(b,A,S){if(A&&(e=Pn.call(e),e.push(A)),S){var g={depth:t.depth};return we(t,"quoteStyle")&&(g.quoteStyle=t.quoteStyle),a(b,g,u+1,e)}return a(b,t,u+1,e)}if(typeof o=="function"&&!Gt(o)){var h=$n(o),w=Ke(o,n);return "[Function"+(h?": "+h:" (anonymous)")+"]"+(w.length>0?" { "+Ae.call(w,", ")+" }":"")}if(jt(o)){var I=Le?Se.call(String(o),/^(Symbol\(.*\))_[^)]*$/,"$1"):ut.call(o);return typeof o=="object"&&!Le?xe(I):I}if(Kn(o)){for(var L="<"+Nt.call(String(o.nodeName)),_=o.attributes||[],H=0;H<_.length;H++)L+=" "+_[H].name+"="+Jt(Fn(_[H].value),"double",t);return L+=">",o.childNodes&&o.childNodes.length&&(L+="..."),L+="</"+Nt.call(String(o.nodeName))+">",L}if(dt(o)){if(o.length===0)return "[]";var B=Ke(o,n);return i&&!Yn(B)?"["+ht(B,i)+"]":"[ "+Ae.call(B,", ")+" ]"}if(xn(o)){var F=Ke(o,n);return !("cause"in Error.prototype)&&"cause"in o&&!Yt.call(o,"cause")?"{ ["+String(o)+"] "+Ae.call(Qt.call("[cause]: "+n(o.cause),F),", ")+" }":F.length===0?"["+String(o)+"]":"{ ["+String(o)+"] "+Ae.call(F,", ")+" }"}if(typeof o=="object"&&m){if(qt&&typeof o[qt]=="function"&&ct)return ct(o,{depth:r-u});if(m!=="symbol"&&typeof o.inspect=="function")return o.inspect()}if(Wn(o)){var R=[];return Bt&&Bt.call(o,function(b,A){R.push(n(A,o,true)+" => "+n(b,o));}),Kt("Map",Xe.call(o),R,i)}if(qn(o)){var p=[];return Ht&&Ht.call(o,function(b){p.push(n(b,o));}),Kt("Set",Ye.call(o),p,i)}if(Vn(o))return lt("WeakMap");if(Gn(o))return lt("WeakSet");if(zn(o))return lt("WeakRef");if(Hn(o))return xe(n(Number(o)));if(Nn(o))return xe(n(ft.call(o)));if(kn(o))return xe(Cn.call(o));if(Bn(o))return xe(n(String(o)));if(typeof window<"u"&&o===window)return "{ [object Window] }";if(typeof globalThis<"u"&&o===globalThis||typeof global<"u"&&o===global)return "{ [object globalThis] }";if(!Dn(o)&&!Gt(o)){var M=Ke(o,n),c=Wt?Wt(o)===Object.prototype:o instanceof Object||o.constructor===Object,l=o instanceof Object?"":"null prototype",E=!c&&ke&&Object(o)===o&&ke in o?mt.call(Te(o),8,-1):l?"Object":"",s=c||typeof o.constructor!="function"?"":o.constructor.name?o.constructor.name+" ":"",y=s+(E||l?"["+Ae.call(Qt.call([],E||[],l||[]),": ")+"] ":"");return M.length===0?y+"{}":i?y+"{"+ht(M,i)+"}":y+"{ "+Ae.call(M,", ")+" }"}return String(o)};function Jt(a,o,C){var u=C.quoteStyle||o,e=Zt[u];return e+a+e}function Fn(a){return Se.call(String(a),/"/g,"&quot;")}function Me(a){return !ke||!(typeof a=="object"&&(ke in a||typeof a[ke]<"u"))}function dt(a){return Te(a)==="[object Array]"&&Me(a)}function Dn(a){return Te(a)==="[object Date]"&&Me(a)}function Gt(a){return Te(a)==="[object RegExp]"&&Me(a)}function xn(a){return Te(a)==="[object Error]"&&Me(a)}function Bn(a){return Te(a)==="[object String]"&&Me(a)}function Hn(a){return Te(a)==="[object Number]"&&Me(a)}function kn(a){return Te(a)==="[object Boolean]"&&Me(a)}function jt(a){if(Le)return a&&typeof a=="object"&&a instanceof Symbol;if(typeof a=="symbol")return true;if(!a||typeof a!="object"||!ut)return false;try{return ut.call(a),!0}catch{}return false}function Nn(a){if(!a||typeof a!="object"||!ft)return false;try{return ft.call(a),!0}catch{}return false}var Qn=Object.prototype.hasOwnProperty||function(a){return a in this};function we(a,o){return Qn.call(a,o)}function Te(a){return In.call(a)}function $n(a){if(a.name)return a.name;var o=Mn.call(Un.call(a),/^function\s*([\w$]+)/);return o?o[1]:null}function en(a,o){if(a.indexOf)return a.indexOf(o);for(var C=0,u=a.length;C<u;C++)if(a[C]===o)return C;return -1}function Wn(a){if(!Xe||!a||typeof a!="object")return false;try{Xe.call(a);try{Ye.call(a);}catch{return !0}return a instanceof Map}catch{}return false}function Vn(a){if(!Be||!a||typeof a!="object")return false;try{Be.call(a,Be);try{He.call(a,He);}catch{return !0}return a instanceof WeakMap}catch{}return false}function zn(a){if(!kt||!a||typeof a!="object")return false;try{return kt.call(a),!0}catch{}return false}function qn(a){if(!Ye||!a||typeof a!="object")return false;try{Ye.call(a);try{Xe.call(a);}catch{return !0}return a instanceof Set}catch{}return false}function Gn(a){if(!He||!a||typeof a!="object")return false;try{He.call(a,He);try{Be.call(a,Be);}catch{return !0}return a instanceof WeakSet}catch{}return false}function Kn(a){return !a||typeof a!="object"?false:typeof HTMLElement<"u"&&a instanceof HTMLElement?true:typeof a.nodeName=="string"&&typeof a.getAttribute=="function"}function tn(a,o){if(a.length>o.maxStringLength){var C=a.length-o.maxStringLength,u="... "+C+" more character"+(C>1?"s":"");return tn(mt.call(a,0,o.maxStringLength),o)+u}var e=Ln[o.quoteStyle||"single"];e.lastIndex=0;var t=Se.call(Se.call(a,e,"\\$1"),/[\x00-\x1f]/g,Xn);return Jt(t,"single",o)}function Xn(a){var o=a.charCodeAt(0),C={8:"b",9:"t",10:"n",12:"f",13:"r"}[o];return C?"\\"+C:"\\x"+(o<16?"0":"")+On.call(o.toString(16))}function xe(a){return "Object("+a+")"}function lt(a){return a+" { ? }"}function Kt(a,o,C,u){var e=u?ht(C,u):Ae.call(C,", ");return a+" ("+o+") {"+e+"}"}function Yn(a){for(var o=0;o<a.length;o++)if(en(a[o],`
3
+ `)>=0)return false;return true}function Zn(a,o){var C;if(a.indent===" ")C=" ";else if(typeof a.indent=="number"&&a.indent>0)C=Ae.call(Array(a.indent+1)," ");else return null;return {base:C,prev:Ae.call(Array(o+1),C)}}function ht(a,o){if(a.length===0)return "";var C=`
4
+ `+o.prev+o.base;return C+Ae.call(a,","+C)+`
5
+ `+o.prev}function Ke(a,o){var C=dt(a),u=[];if(C){u.length=a.length;for(var e=0;e<a.length;e++)u[e]=we(a,e)?o(a[e],a):"";}var t=typeof st=="function"?st(a):[],m;if(Le){m={};for(var f=0;f<t.length;f++)m["$"+t[f]]=t[f];}for(var v in a)we(a,v)&&(C&&String(Number(v))===v&&v<a.length||Le&&m["$"+v]instanceof Symbol||(Xt.call(/[^\w$]/,v)?u.push(o(v,a)+": "+o(a[v],a)):u.push(v+": "+o(a[v],a))));if(typeof st=="function")for(var T=0;T<t.length;T++)Yt.call(a,t[T])&&u.push("["+o(t[T])+"]: "+o(a[t[T]],a));return u}});function mn(a,o){return o.forEach(function(C){C&&typeof C!="string"&&!Array.isArray(C)&&Object.keys(C).forEach(function(u){if(u!=="default"&&!(u in a)){var e=Object.getOwnPropertyDescriptor(C,u);Object.defineProperty(a,u,e.get?e:{enumerable:true,get:function(){return C[u]}});}});}),Object.freeze(a)}function Tt(a,o){return new Promise(function(C,u){let e;return yn(a).then(function(t){try{return e=t,C(new Blob([o.slice(0,2),e,o.slice(2)],{type:"image/jpeg"}))}catch(m){return u(m)}},u)})}var yn=a=>new Promise((o,C)=>{let u=new FileReader;u.addEventListener("load",({target:{result:e}})=>{let t=new DataView(e),m=0;if(t.getUint16(m)!==65496)return C("not a valid JPEG");for(m+=2;;){let f=t.getUint16(m);if(f===65498)break;let v=t.getUint16(m+2);if(f===65505&&t.getUint32(m+4)===1165519206){let T=m+10,r;switch(t.getUint16(T)){case 18761:r=true;break;case 19789:r=false;break;default:return C("TIFF header contains invalid endian")}if(t.getUint16(T+2,r)!==42)return C("TIFF header contains invalid version");let i=t.getUint32(T+4,r),n=T+i+2+12*t.getUint16(T+i,r);for(let h=T+i+2;h<n;h+=12)if(t.getUint16(h,r)==274){if(t.getUint16(h+2,r)!==3)return C("Orientation data type is invalid");if(t.getUint32(h+4,r)!==1)return C("Orientation data count is invalid");t.setUint16(h+8,1,r);break}return o(e.slice(m,m+2+v))}m+=2+v;}return o(new Blob)}),u.readAsArrayBuffer(a);}),We={},An={get exports(){return We},set exports(a){We=a;}};(function(a){var o,C,u={};An.exports=u,u.parse=function(e,t){for(var m=u.bin.readUshort,f=u.bin.readUint,v=0,T={},r=new Uint8Array(e),i=r.length-4;f(r,i)!=101010256;)i--;v=i,v+=4;var n=m(r,v+=4);m(r,v+=2);var h=f(r,v+=2),w=f(r,v+=4);v+=4,v=w;for(var I=0;I<n;I++){f(r,v),v+=4,v+=4,v+=4,f(r,v+=4),h=f(r,v+=4);var L=f(r,v+=4),_=m(r,v+=4),H=m(r,v+2),B=m(r,v+4);v+=6;var F=f(r,v+=8);v+=4,v+=_+H+B,u._readLocal(r,F,T,h,L,t);}return T},u._readLocal=function(e,t,m,f,v,T){var r=u.bin.readUshort,i=u.bin.readUint;i(e,t),r(e,t+=4),r(e,t+=2);var n=r(e,t+=2);i(e,t+=2),i(e,t+=4),t+=4;var h=r(e,t+=8),w=r(e,t+=2);t+=2;var I=u.bin.readUTF8(e,t,h);if(t+=h,t+=w,T)m[I]={size:v,csize:f};else {var L=new Uint8Array(e.buffer,t);if(n==0)m[I]=new Uint8Array(L.buffer.slice(t,t+f));else {if(n!=8)throw "unknown compression method: "+n;var _=new Uint8Array(v);u.inflateRaw(L,_),m[I]=_;}}},u.inflateRaw=function(e,t){return u.F.inflate(e,t)},u.inflate=function(e,t){return e[0],e[1],u.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),t)},u.deflate=function(e,t){t==null&&(t={level:6});var m=0,f=new Uint8Array(50+Math.floor(1.1*e.length));f[m]=120,f[m+1]=156,m+=2,m=u.F.deflateRaw(e,f,m,t.level);var v=u.adler(e,0,e.length);return f[m+0]=v>>>24&255,f[m+1]=v>>>16&255,f[m+2]=v>>>8&255,f[m+3]=v>>>0&255,new Uint8Array(f.buffer,0,m+4)},u.deflateRaw=function(e,t){t==null&&(t={level:6});var m=new Uint8Array(50+Math.floor(1.1*e.length)),f=u.F.deflateRaw(e,m,f,t.level);return new Uint8Array(m.buffer,0,f)},u.encode=function(e,t){t==null&&(t=false);var m=0,f=u.bin.writeUint,v=u.bin.writeUshort,T={};for(var r in e){var i=!u._noNeed(r)&&!t,n=e[r],h=u.crc.crc(n,0,n.length);T[r]={cpr:i,usize:n.length,crc:h,file:i?u.deflateRaw(n):n};}for(var r in T)m+=T[r].file.length+30+46+2*u.bin.sizeUTF8(r);m+=22;var w=new Uint8Array(m),I=0,L=[];for(var r in T){var _=T[r];L.push(I),I=u._writeHeader(w,I,r,_,0);}var H=0,B=I;for(var r in T)_=T[r],L.push(I),I=u._writeHeader(w,I,r,_,1,L[H++]);var F=I-B;return f(w,I,101010256),I+=4,v(w,I+=4,H),v(w,I+=2,H),f(w,I+=2,F),f(w,I+=4,B),I+=4,I+=2,w.buffer},u._noNeed=function(e){var t=e.split(".").pop().toLowerCase();return "png,jpg,jpeg,zip".indexOf(t)!=-1},u._writeHeader=function(e,t,m,f,v,T){var r=u.bin.writeUint,i=u.bin.writeUshort,n=f.file;return r(e,t,v==0?67324752:33639248),t+=4,v==1&&(t+=2),i(e,t,20),i(e,t+=2,0),i(e,t+=2,f.cpr?8:0),r(e,t+=2,0),r(e,t+=4,f.crc),r(e,t+=4,n.length),r(e,t+=4,f.usize),i(e,t+=4,u.bin.sizeUTF8(m)),i(e,t+=2,0),t+=2,v==1&&(t+=2,t+=2,r(e,t+=6,T),t+=4),t+=u.bin.writeUTF8(e,t,m),v==0&&(e.set(n,t),t+=n.length),t},u.crc={table:function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var m=t,f=0;f<8;f++)1&m?m=3988292384^m>>>1:m>>>=1;e[t]=m;}return e}(),update:function(e,t,m,f){for(var v=0;v<f;v++)e=u.crc.table[255&(e^t[m+v])]^e>>>8;return e},crc:function(e,t,m){return 4294967295^u.crc.update(4294967295,e,t,m)}},u.adler=function(e,t,m){for(var f=1,v=0,T=t,r=t+m;T<r;){for(var i=Math.min(T+5552,r);T<i;)v+=f+=e[T++];f%=65521,v%=65521;}return v<<16|f},u.bin={readUshort:function(e,t){return e[t]|e[t+1]<<8},writeUshort:function(e,t,m){e[t]=255&m,e[t+1]=m>>8&255;},readUint:function(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])},writeUint:function(e,t,m){e[t]=255&m,e[t+1]=m>>8&255,e[t+2]=m>>16&255,e[t+3]=m>>24&255;},readASCII:function(e,t,m){for(var f="",v=0;v<m;v++)f+=String.fromCharCode(e[t+v]);return f},writeASCII:function(e,t,m){for(var f=0;f<m.length;f++)e[t+f]=m.charCodeAt(f);},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,m){for(var f,v="",T=0;T<m;T++)v+="%"+u.bin.pad(e[t+T].toString(16));try{f=decodeURIComponent(v);}catch{return u.bin.readASCII(e,t,m)}return f},writeUTF8:function(e,t,m){for(var f=m.length,v=0,T=0;T<f;T++){var r=m.charCodeAt(T);if((4294967168&r)==0)e[t+v]=r,v++;else if((4294965248&r)==0)e[t+v]=192|r>>6,e[t+v+1]=128|r>>0&63,v+=2;else if((4294901760&r)==0)e[t+v]=224|r>>12,e[t+v+1]=128|r>>6&63,e[t+v+2]=128|r>>0&63,v+=3;else {if((4292870144&r)!=0)throw "e";e[t+v]=240|r>>18,e[t+v+1]=128|r>>12&63,e[t+v+2]=128|r>>6&63,e[t+v+3]=128|r>>0&63,v+=4;}}return v},sizeUTF8:function(e){for(var t=e.length,m=0,f=0;f<t;f++){var v=e.charCodeAt(f);if((4294967168&v)==0)m++;else if((4294965248&v)==0)m+=2;else if((4294901760&v)==0)m+=3;else {if((4292870144&v)!=0)throw "e";m+=4;}}return m}},u.F={},u.F.deflateRaw=function(e,t,m,f){var v=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][f],T=u.F.U,r=u.F._goodIndex;u.F._hash;var i=u.F._putsE,n=0,h=m<<3,w=0,I=e.length;if(f==0){for(;n<I;)i(t,h,n+(s=Math.min(65535,I-n))==I?1:0),h=u.F._copyExact(e,n,s,t,h+8),n+=s;return h>>>3}var L=T.lits,_=T.strt,H=T.prev,B=0,F=0,R=0,p=0,M=0,c=0;for(I>2&&(_[c=u.F._hash(e,0)]=0),n=0;n<I;n++){if(M=c,n+1<I-2){c=u.F._hash(e,n+1);var l=n+1&32767;H[l]=_[c],_[c]=l;}if(w<=n){(B>14e3||F>26697)&&I-n>100&&(w<n&&(L[B]=n-w,B+=2,w=n),h=u.F._writeBlock(n==I-1||w==I?1:0,L,B,p,e,R,n-R,t,h),B=F=p=0,R=n);var E=0;n<I-2&&(E=u.F._bestMatch(e,n,H,M,Math.min(v[2],I-n),v[3]));var s=E>>>16,y=65535&E;if(E!=0){y=65535&E;var b=r(s=E>>>16,T.of0);T.lhst[257+b]++;var A=r(y,T.df0);T.dhst[A]++,p+=T.exb[b]+T.dxb[A],L[B]=s<<23|n-w,L[B+1]=y<<16|b<<8|A,B+=2,w=n+s;}else T.lhst[e[n]]++;F++;}}for(R==n&&e.length!=0||(w<n&&(L[B]=n-w,B+=2,w=n),h=u.F._writeBlock(1,L,B,p,e,R,n-R,t,h),B=0,F=0,B=F=p=0,R=n);(7&h)!=0;)h++;return h>>>3},u.F._bestMatch=function(e,t,m,f,v,T){var r=32767&t,i=m[r],n=r-i+32768&32767;if(i==r||f!=u.F._hash(e,t-n))return 0;for(var h=0,w=0,I=Math.min(32767,t);n<=I&&--T!=0&&i!=r;){if(h==0||e[t+h]==e[t+h-n]){var L=u.F._howLong(e,t,n);if(L>h){if(w=n,(h=L)>=v)break;n+2<L&&(L=n+2);for(var _=0,H=0;H<L-2;H++){var B=t-n+H+32768&32767,F=B-m[B]+32768&32767;F>_&&(_=F,i=B);}}}n+=(r=i)-(i=m[r])+32768&32767;}return h<<16|w},u.F._howLong=function(e,t,m){if(e[t]!=e[t-m]||e[t+1]!=e[t+1-m]||e[t+2]!=e[t+2-m])return 0;var f=t,v=Math.min(e.length,t+258);for(t+=3;t<v&&e[t]==e[t-m];)t++;return t-f},u.F._hash=function(e,t){return (e[t]<<8|e[t+1])+(e[t+2]<<4)&65535},u.saved=0,u.F._writeBlock=function(e,t,m,f,v,T,r,i,n){var h,w,I,L,_,H,B,F,R,p=u.F.U,M=u.F._putsF,c=u.F._putsE;p.lhst[256]++,w=(h=u.F.getTrees())[0],I=h[1],L=h[2],_=h[3],H=h[4],B=h[5],F=h[6],R=h[7];var l=32+((n+3&7)==0?0:8-(n+3&7))+(r<<3),E=f+u.F.contSize(p.fltree,p.lhst)+u.F.contSize(p.fdtree,p.dhst),s=f+u.F.contSize(p.ltree,p.lhst)+u.F.contSize(p.dtree,p.dhst);s+=14+3*B+u.F.contSize(p.itree,p.ihst)+(2*p.ihst[16]+3*p.ihst[17]+7*p.ihst[18]);for(var y=0;y<286;y++)p.lhst[y]=0;for(y=0;y<30;y++)p.dhst[y]=0;for(y=0;y<19;y++)p.ihst[y]=0;var b=l<E&&l<s?0:E<s?1:2;if(M(i,n,e),M(i,n+1,b),n+=3,b==0){for(;(7&n)!=0;)n++;n=u.F._copyExact(v,T,r,i,n);}else {var A,S;if(b==1&&(A=p.fltree,S=p.fdtree),b==2){u.F.makeCodes(p.ltree,w),u.F.revCodes(p.ltree,w),u.F.makeCodes(p.dtree,I),u.F.revCodes(p.dtree,I),u.F.makeCodes(p.itree,L),u.F.revCodes(p.itree,L),A=p.ltree,S=p.dtree,c(i,n,_-257),c(i,n+=5,H-1),c(i,n+=5,B-4),n+=4;for(var g=0;g<B;g++)c(i,n+3*g,p.itree[1+(p.ordr[g]<<1)]);n+=3*B,n=u.F._codeTiny(F,p.itree,i,n),n=u.F._codeTiny(R,p.itree,i,n);}for(var d=T,P=0;P<m;P+=2){for(var U=t[P],O=U>>>23,N=d+(8388607&U);d<N;)n=u.F._writeLit(v[d++],A,i,n);if(O!=0){var D=t[P+1],Q=D>>16,k=D>>8&255,x=255&D;c(i,n=u.F._writeLit(257+k,A,i,n),O-p.of0[k]),n+=p.exb[k],M(i,n=u.F._writeLit(x,S,i,n),Q-p.df0[x]),n+=p.dxb[x],d+=O;}}n=u.F._writeLit(256,A,i,n);}return n},u.F._copyExact=function(e,t,m,f,v){var T=v>>>3;return f[T]=m,f[T+1]=m>>>8,f[T+2]=255-f[T],f[T+3]=255-f[T+1],T+=4,f.set(new Uint8Array(e.buffer,t,m),T),v+(m+4<<3)},u.F.getTrees=function(){for(var e=u.F.U,t=u.F._hufTree(e.lhst,e.ltree,15),m=u.F._hufTree(e.dhst,e.dtree,15),f=[],v=u.F._lenCodes(e.ltree,f),T=[],r=u.F._lenCodes(e.dtree,T),i=0;i<f.length;i+=2)e.ihst[f[i]]++;for(i=0;i<T.length;i+=2)e.ihst[T[i]]++;for(var n=u.F._hufTree(e.ihst,e.itree,7),h=19;h>4&&e.itree[1+(e.ordr[h-1]<<1)]==0;)h--;return [t,m,n,v,r,h,f,T]},u.F.getSecond=function(e){for(var t=[],m=0;m<e.length;m+=2)t.push(e[m+1]);return t},u.F.nonZero=function(e){for(var t="",m=0;m<e.length;m+=2)e[m+1]!=0&&(t+=(m>>1)+",");return t},u.F.contSize=function(e,t){for(var m=0,f=0;f<t.length;f++)m+=t[f]*e[1+(f<<1)];return m},u.F._codeTiny=function(e,t,m,f){for(var v=0;v<e.length;v+=2){var T=e[v],r=e[v+1];f=u.F._writeLit(T,t,m,f);var i=T==16?2:T==17?3:7;T>15&&(u.F._putsE(m,f,r,i),f+=i);}return f},u.F._lenCodes=function(e,t){for(var m=e.length;m!=2&&e[m-1]==0;)m-=2;for(var f=0;f<m;f+=2){var v=e[f+1],T=f+3<m?e[f+3]:-1,r=f+5<m?e[f+5]:-1,i=f==0?-1:e[f-1];if(v==0&&T==v&&r==v){for(var n=f+5;n+2<m&&e[n+2]==v;)n+=2;(h=Math.min(n+1-f>>>1,138))<11?t.push(17,h-3):t.push(18,h-11),f+=2*h-2;}else if(v==i&&T==v&&r==v){for(n=f+5;n+2<m&&e[n+2]==v;)n+=2;var h=Math.min(n+1-f>>>1,6);t.push(16,h-3),f+=2*h-2;}else t.push(v,0);}return m>>>1},u.F._hufTree=function(e,t,m){var f=[],v=e.length,T=t.length,r=0;for(r=0;r<T;r+=2)t[r]=0,t[r+1]=0;for(r=0;r<v;r++)e[r]!=0&&f.push({lit:r,f:e[r]});var i=f.length,n=f.slice(0);if(i==0)return 0;if(i==1){var h=f[0].lit;return n=h==0?1:0,t[1+(h<<1)]=1,t[1+(n<<1)]=1,1}f.sort(function(F,R){return F.f-R.f});var w=f[0],I=f[1],L=0,_=1,H=2;for(f[0]={lit:-1,f:w.f+I.f,l:w,r:I,d:0};_!=i-1;)w=L!=_&&(H==i||f[L].f<f[H].f)?f[L++]:f[H++],I=L!=_&&(H==i||f[L].f<f[H].f)?f[L++]:f[H++],f[_++]={lit:-1,f:w.f+I.f,l:w,r:I};var B=u.F.setDepth(f[_-1],0);for(B>m&&(u.F.restrictDepth(n,m,B),B=m),r=0;r<i;r++)t[1+(n[r].lit<<1)]=n[r].d;return B},u.F.setDepth=function(e,t){return e.lit!=-1?(e.d=t,t):Math.max(u.F.setDepth(e.l,t+1),u.F.setDepth(e.r,t+1))},u.F.restrictDepth=function(e,t,m){var f=0,v=1<<m-t,T=0;for(e.sort(function(i,n){return n.d==i.d?i.f-n.f:n.d-i.d}),f=0;f<e.length&&e[f].d>t;f++){var r=e[f].d;e[f].d=t,T+=v-(1<<m-r);}for(T>>>=m-t;T>0;)(r=e[f].d)<t?(e[f].d++,T-=1<<t-r-1):f++;for(;f>=0;f--)e[f].d==t&&T<0&&(e[f].d--,T++);T!=0&&console.log("debt left");},u.F._goodIndex=function(e,t){var m=0;return t[16|m]<=e&&(m|=16),t[8|m]<=e&&(m|=8),t[4|m]<=e&&(m|=4),t[2|m]<=e&&(m|=2),t[1|m]<=e&&(m|=1),m},u.F._writeLit=function(e,t,m,f){return u.F._putsF(m,f,t[e<<1]),f+t[1+(e<<1)]},u.F.inflate=function(e,t){var m=Uint8Array;if(e[0]==3&&e[1]==0)return t||new m(0);var f=u.F,v=f._bitsF,T=f._bitsE,r=f._decodeTiny,i=f.makeCodes,n=f.codes2map,h=f._get17,w=f.U,I=t==null;I&&(t=new m(e.length>>>2<<3));for(var L,_,H=0,B=0,F=0,R=0,p=0,M=0,c=0,l=0,E=0;H==0;)if(H=v(e,E,1),B=v(e,E+1,2),E+=3,B!=0){if(I&&(t=u.F._check(t,l+(1<<17))),B==1&&(L=w.flmap,_=w.fdmap,M=511,c=31),B==2){F=T(e,E,5)+257,R=T(e,E+5,5)+1,p=T(e,E+10,4)+4,E+=14;for(var s=0;s<38;s+=2)w.itree[s]=0,w.itree[s+1]=0;var y=1;for(s=0;s<p;s++){var b=T(e,E+3*s,3);w.itree[1+(w.ordr[s]<<1)]=b,b>y&&(y=b);}E+=3*p,i(w.itree,y),n(w.itree,y,w.imap),L=w.lmap,_=w.dmap,E=r(w.imap,(1<<y)-1,F+R,e,E,w.ttree);var A=f._copyOut(w.ttree,0,F,w.ltree);M=(1<<A)-1;var S=f._copyOut(w.ttree,F,R,w.dtree);c=(1<<S)-1,i(w.ltree,A),n(w.ltree,A,L),i(w.dtree,S),n(w.dtree,S,_);}for(;;){var g=L[h(e,E)&M];E+=15&g;var d=g>>>4;if(!(d>>>8))t[l++]=d;else {if(d==256)break;var P=l+d-254;if(d>264){var U=w.ldef[d-257];P=l+(U>>>3)+T(e,E,7&U),E+=7&U;}var O=_[h(e,E)&c];E+=15&O;var N=O>>>4,D=w.ddef[N],Q=(D>>>4)+v(e,E,15&D);for(E+=15&D,I&&(t=u.F._check(t,l+(1<<17)));l<P;)t[l]=t[l++-Q],t[l]=t[l++-Q],t[l]=t[l++-Q],t[l]=t[l++-Q];l=P;}}}else {(7&E)!=0&&(E+=8-(7&E));var k=4+(E>>>3),x=e[k-4]|e[k-3]<<8;I&&(t=u.F._check(t,l+x)),t.set(new m(e.buffer,e.byteOffset+k,x),l),E=k+x<<3,l+=x;}return t.length==l?t:t.slice(0,l)},u.F._check=function(e,t){var m=e.length;if(t<=m)return e;var f=new Uint8Array(Math.max(m<<1,t));return f.set(e,0),f},u.F._decodeTiny=function(e,t,m,f,v,T){for(var r=u.F._bitsE,i=u.F._get17,n=0;n<m;){var h=e[i(f,v)&t];v+=15&h;var w=h>>>4;if(w<=15)T[n]=w,n++;else {var I=0,L=0;w==16?(L=3+r(f,v,2),v+=2,I=T[n-1]):w==17?(L=3+r(f,v,3),v+=3):w==18&&(L=11+r(f,v,7),v+=7);for(var _=n+L;n<_;)T[n]=I,n++;}}return v},u.F._copyOut=function(e,t,m,f){for(var v=0,T=0,r=f.length>>>1;T<m;){var i=e[T+t];f[T<<1]=0,f[1+(T<<1)]=i,i>v&&(v=i),T++;}for(;T<r;)f[T<<1]=0,f[1+(T<<1)]=0,T++;return v},u.F.makeCodes=function(e,t){for(var m,f,v,T,r=u.F.U,i=e.length,n=r.bl_count,h=0;h<=t;h++)n[h]=0;for(h=1;h<i;h+=2)n[e[h]]++;var w=r.next_code;for(m=0,n[0]=0,f=1;f<=t;f++)m=m+n[f-1]<<1,w[f]=m;for(v=0;v<i;v+=2)(T=e[v+1])!=0&&(e[v]=w[T],w[T]++);},u.F.codes2map=function(e,t,m){for(var f=e.length,v=u.F.U.rev15,T=0;T<f;T+=2)if(e[T+1]!=0)for(var r=T>>1,i=e[T+1],n=r<<4|i,h=t-i,w=e[T]<<h,I=w+(1<<h);w!=I;)m[v[w]>>>15-t]=n,w++;},u.F.revCodes=function(e,t){for(var m=u.F.U.rev15,f=15-t,v=0;v<e.length;v+=2){var T=e[v]<<t-e[v+1];e[v]=m[T]>>>f;}},u.F._putsE=function(e,t,m){m<<=7&t;var f=t>>>3;e[f]|=m,e[f+1]|=m>>>8;},u.F._putsF=function(e,t,m){m<<=7&t;var f=t>>>3;e[f]|=m,e[f+1]|=m>>>8,e[f+2]|=m>>>16;},u.F._bitsE=function(e,t,m){return (e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<m)-1},u.F._bitsF=function(e,t,m){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<m)-1},u.F._get17=function(e,t){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},u.F._get25=function(e,t){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},u.F.U=(o=Uint16Array,C=Uint32Array,{next_code:new o(16),bl_count:new o(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[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],ldef:new o(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[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],ddef:new C(32),flmap:new o(512),fltree:[],fdmap:new o(32),fdtree:[],lmap:new o(32768),ltree:[],ttree:[],dmap:new o(32768),dtree:[],imap:new o(512),itree:[],rev15:new o(32768),lhst:new C(286),dhst:new C(30),ihst:new C(19),lits:new C(15e3),strt:new o(65536),prev:new o(32768)}),function(){for(var e=u.F.U,t=0;t<32768;t++){var m=t;m=(4278255360&(m=(4042322160&(m=(3435973836&(m=(2863311530&m)>>>1|(1431655765&m)<<1))>>>2|(858993459&m)<<2))>>>4|(252645135&m)<<4))>>>8|(16711935&m)<<8,e.rev15[t]=(m>>>16|m<<16)>>>17;}function f(v,T,r){for(;T--!=0;)v.push(0,r);}for(t=0;t<32;t++)e.ldef[t]=e.of0[t]<<3|e.exb[t],e.ddef[t]=e.df0[t]<<4|e.dxb[t];f(e.fltree,144,8),f(e.fltree,112,9),f(e.fltree,24,7),f(e.fltree,8,8),u.F.makeCodes(e.fltree,9),u.F.codes2map(e.fltree,9,e.flmap),u.F.revCodes(e.fltree,9),f(e.fdtree,32,5),u.F.makeCodes(e.fdtree,5),u.F.codes2map(e.fdtree,5,e.fdmap),u.F.revCodes(e.fdtree,5),f(e.itree,19,0),f(e.ltree,286,0),f(e.dtree,30,0),f(e.ttree,320,0);}();})();var vn=mn({__proto__:null,default:We},[We]),pe=function(){var a={nextZero(r,i){for(;r[i]!=0;)i++;return i},readUshort:(r,i)=>r[i]<<8|r[i+1],writeUshort(r,i,n){r[i]=n>>8&255,r[i+1]=255&n;},readUint:(r,i)=>16777216*r[i]+(r[i+1]<<16|r[i+2]<<8|r[i+3]),writeUint(r,i,n){r[i]=n>>24&255,r[i+1]=n>>16&255,r[i+2]=n>>8&255,r[i+3]=255&n;},readASCII(r,i,n){let h="";for(let w=0;w<n;w++)h+=String.fromCharCode(r[i+w]);return h},writeASCII(r,i,n){for(let h=0;h<n.length;h++)r[i+h]=n.charCodeAt(h);},readBytes(r,i,n){let h=[];for(let w=0;w<n;w++)h.push(r[i+w]);return h},pad:r=>r.length<2?`0${r}`:r,readUTF8(r,i,n){let h,w="";for(let I=0;I<n;I++)w+=`%${a.pad(r[i+I].toString(16))}`;try{h=decodeURIComponent(w);}catch{return a.readASCII(r,i,n)}return h}};function o(r,i,n,h){let w=i*n,I=t(h),L=Math.ceil(i*I/8),_=new Uint8Array(4*w),H=new Uint32Array(_.buffer),{ctype:B}=h,{depth:F}=h,R=a.readUshort;if(B==6){let U=w<<2;if(F==8)for(var p=0;p<U;p+=4)_[p]=r[p],_[p+1]=r[p+1],_[p+2]=r[p+2],_[p+3]=r[p+3];if(F==16)for(p=0;p<U;p++)_[p]=r[p<<1];}else if(B==2){let U=h.tabs.tRNS;if(U==null){if(F==8)for(p=0;p<w;p++){var M=3*p;H[p]=255<<24|r[M+2]<<16|r[M+1]<<8|r[M];}if(F==16)for(p=0;p<w;p++)M=6*p,H[p]=255<<24|r[M+4]<<16|r[M+2]<<8|r[M];}else {var c=U[0];let O=U[1],N=U[2];if(F==8)for(p=0;p<w;p++){var l=p<<2;M=3*p,H[p]=255<<24|r[M+2]<<16|r[M+1]<<8|r[M],r[M]==c&&r[M+1]==O&&r[M+2]==N&&(_[l+3]=0);}if(F==16)for(p=0;p<w;p++)l=p<<2,M=6*p,H[p]=255<<24|r[M+4]<<16|r[M+2]<<8|r[M],R(r,M)==c&&R(r,M+2)==O&&R(r,M+4)==N&&(_[l+3]=0);}}else if(B==3){let U=h.tabs.PLTE,O=h.tabs.tRNS,N=O?O.length:0;if(F==1)for(var E=0;E<n;E++){var s=E*L,y=E*i;for(p=0;p<i;p++){l=y+p<<2;var b=3*(A=r[s+(p>>3)]>>7-((7&p)<<0)&1);_[l]=U[b],_[l+1]=U[b+1],_[l+2]=U[b+2],_[l+3]=A<N?O[A]:255;}}if(F==2)for(E=0;E<n;E++)for(s=E*L,y=E*i,p=0;p<i;p++)l=y+p<<2,b=3*(A=r[s+(p>>2)]>>6-((3&p)<<1)&3),_[l]=U[b],_[l+1]=U[b+1],_[l+2]=U[b+2],_[l+3]=A<N?O[A]:255;if(F==4)for(E=0;E<n;E++)for(s=E*L,y=E*i,p=0;p<i;p++)l=y+p<<2,b=3*(A=r[s+(p>>1)]>>4-((1&p)<<2)&15),_[l]=U[b],_[l+1]=U[b+1],_[l+2]=U[b+2],_[l+3]=A<N?O[A]:255;if(F==8)for(p=0;p<w;p++){var A;l=p<<2,b=3*(A=r[p]),_[l]=U[b],_[l+1]=U[b+1],_[l+2]=U[b+2],_[l+3]=A<N?O[A]:255;}}else if(B==4){if(F==8)for(p=0;p<w;p++){l=p<<2;var S=r[g=p<<1];_[l]=S,_[l+1]=S,_[l+2]=S,_[l+3]=r[g+1];}if(F==16)for(p=0;p<w;p++){var g;l=p<<2,S=r[g=p<<2],_[l]=S,_[l+1]=S,_[l+2]=S,_[l+3]=r[g+2];}}else if(B==0)for(c=h.tabs.tRNS?h.tabs.tRNS:-1,E=0;E<n;E++){let U=E*L,O=E*i;if(F==1)for(var d=0;d<i;d++){var P=(S=255*(r[U+(d>>>3)]>>>7-(7&d)&1))==255*c?0:255;H[O+d]=P<<24|S<<16|S<<8|S;}else if(F==2)for(d=0;d<i;d++)P=(S=85*(r[U+(d>>>2)]>>>6-((3&d)<<1)&3))==85*c?0:255,H[O+d]=P<<24|S<<16|S<<8|S;else if(F==4)for(d=0;d<i;d++)P=(S=17*(r[U+(d>>>1)]>>>4-((1&d)<<2)&15))==17*c?0:255,H[O+d]=P<<24|S<<16|S<<8|S;else if(F==8)for(d=0;d<i;d++)P=(S=r[U+d])==c?0:255,H[O+d]=P<<24|S<<16|S<<8|S;else if(F==16)for(d=0;d<i;d++)S=r[U+(d<<1)],P=R(r,U+(d<<1))==c?0:255,H[O+d]=P<<24|S<<16|S<<8|S;}return _}function C(r,i,n,h){let w=t(r),I=Math.ceil(n*w/8),L=new Uint8Array((I+1+r.interlace)*h);return i=r.tabs.CgBI?e(i,L):u(i,L),r.interlace==0?i=m(i,r,0,n,h):r.interlace==1&&(i=function(H,B){let F=B.width,R=B.height,p=t(B),M=p>>3,c=Math.ceil(F*p/8),l=new Uint8Array(R*c),E=0,s=[0,0,4,0,2,0,1],y=[0,4,0,2,0,1,0],b=[8,8,8,4,4,2,2],A=[8,8,4,4,2,2,1],S=0;for(;S<7;){let d=b[S],P=A[S],U=0,O=0,N=s[S];for(;N<R;)N+=d,O++;let D=y[S];for(;D<F;)D+=P,U++;let Q=Math.ceil(U*p/8);m(H,B,E,U,O);let k=0,x=s[S];for(;x<R;){let $=y[S],K=E+k*Q<<3;for(;$<F;){var g;if(p==1&&(g=(g=H[K>>3])>>7-(7&K)&1,l[x*c+($>>3)]|=g<<7-((7&$)<<0)),p==2&&(g=(g=H[K>>3])>>6-(7&K)&3,l[x*c+($>>2)]|=g<<6-((3&$)<<1)),p==4&&(g=(g=H[K>>3])>>4-(7&K)&15,l[x*c+($>>1)]|=g<<4-((1&$)<<2)),p>=8){let q=x*c+$*M;for(let V=0;V<M;V++)l[q+V]=H[(K>>3)+V];}K+=p,$+=P;}k++,x+=d;}U*O!=0&&(E+=O*(1+Q)),S+=1;}return l}(i,r)),i}function u(r,i){return e(new Uint8Array(r.buffer,2,r.length-6),i)}var e=function(){let r={H:{}};return r.H.N=function(i,n){let h=Uint8Array,w,I,L=0,_=0,H=0,B=0,F=0,R=0,p=0,M=0,c=0;if(i[0]==3&&i[1]==0)return n||new h(0);let l=r.H,E=l.b,s=l.e,y=l.R,b=l.n,A=l.A,S=l.Z,g=l.m,d=n==null;for(d&&(n=new h(i.length>>>2<<5));L==0;)if(L=E(i,c,1),_=E(i,c+1,2),c+=3,_!=0){if(d&&(n=r.H.W(n,M+(1<<17))),_==1&&(w=g.J,I=g.h,R=511,p=31),_==2){H=s(i,c,5)+257,B=s(i,c+5,5)+1,F=s(i,c+10,4)+4,c+=14;let U=1;for(var P=0;P<38;P+=2)g.Q[P]=0,g.Q[P+1]=0;for(P=0;P<F;P++){let D=s(i,c+3*P,3);g.Q[1+(g.X[P]<<1)]=D,D>U&&(U=D);}c+=3*F,b(g.Q,U),A(g.Q,U,g.u),w=g.w,I=g.d,c=y(g.u,(1<<U)-1,H+B,i,c,g.v);let O=l.V(g.v,0,H,g.C);R=(1<<O)-1;let N=l.V(g.v,H,B,g.D);p=(1<<N)-1,b(g.C,O),A(g.C,O,w),b(g.D,N),A(g.D,N,I);}for(;;){let U=w[S(i,c)&R];c+=15&U;let O=U>>>4;if(!(O>>>8))n[M++]=O;else {if(O==256)break;{let N=M+O-254;if(O>264){let $=g.q[O-257];N=M+($>>>3)+s(i,c,7&$),c+=7&$;}let D=I[S(i,c)&p];c+=15&D;let Q=D>>>4,k=g.c[Q],x=(k>>>4)+E(i,c,15&k);for(c+=15&k;M<N;)n[M]=n[M++-x],n[M]=n[M++-x],n[M]=n[M++-x],n[M]=n[M++-x];M=N;}}}}else {(7&c)!=0&&(c+=8-(7&c));let U=4+(c>>>3),O=i[U-4]|i[U-3]<<8;d&&(n=r.H.W(n,M+O)),n.set(new h(i.buffer,i.byteOffset+U,O),M),c=U+O<<3,M+=O;}return n.length==M?n:n.slice(0,M)},r.H.W=function(i,n){let h=i.length;if(n<=h)return i;let w=new Uint8Array(h<<1);return w.set(i,0),w},r.H.R=function(i,n,h,w,I,L){let _=r.H.e,H=r.H.Z,B=0;for(;B<h;){let F=i[H(w,I)&n];I+=15&F;let R=F>>>4;if(R<=15)L[B]=R,B++;else {let p=0,M=0;R==16?(M=3+_(w,I,2),I+=2,p=L[B-1]):R==17?(M=3+_(w,I,3),I+=3):R==18&&(M=11+_(w,I,7),I+=7);let c=B+M;for(;B<c;)L[B]=p,B++;}}return I},r.H.V=function(i,n,h,w){let I=0,L=0,_=w.length>>>1;for(;L<h;){let H=i[L+n];w[L<<1]=0,w[1+(L<<1)]=H,H>I&&(I=H),L++;}for(;L<_;)w[L<<1]=0,w[1+(L<<1)]=0,L++;return I},r.H.n=function(i,n){let h=r.H.m,w=i.length,I,L,_,H,B=h.j;for(var F=0;F<=n;F++)B[F]=0;for(F=1;F<w;F+=2)B[i[F]]++;let R=h.K;for(I=0,B[0]=0,L=1;L<=n;L++)I=I+B[L-1]<<1,R[L]=I;for(_=0;_<w;_+=2)H=i[_+1],H!=0&&(i[_]=R[H],R[H]++);},r.H.A=function(i,n,h){let w=i.length,I=r.H.m.r;for(let L=0;L<w;L+=2)if(i[L+1]!=0){let _=L>>1,H=i[L+1],B=_<<4|H,F=n-H,R=i[L]<<F,p=R+(1<<F);for(;R!=p;)h[I[R]>>>15-n]=B,R++;}},r.H.l=function(i,n){let h=r.H.m.r,w=15-n;for(let I=0;I<i.length;I+=2){let L=i[I]<<n-i[I+1];i[I]=h[L]>>>w;}},r.H.M=function(i,n,h){h<<=7&n;let w=n>>>3;i[w]|=h,i[w+1]|=h>>>8;},r.H.I=function(i,n,h){h<<=7&n;let w=n>>>3;i[w]|=h,i[w+1]|=h>>>8,i[w+2]|=h>>>16;},r.H.e=function(i,n,h){return (i[n>>>3]|i[1+(n>>>3)]<<8)>>>(7&n)&(1<<h)-1},r.H.b=function(i,n,h){return (i[n>>>3]|i[1+(n>>>3)]<<8|i[2+(n>>>3)]<<16)>>>(7&n)&(1<<h)-1},r.H.Z=function(i,n){return (i[n>>>3]|i[1+(n>>>3)]<<8|i[2+(n>>>3)]<<16)>>>(7&n)},r.H.i=function(i,n){return (i[n>>>3]|i[1+(n>>>3)]<<8|i[2+(n>>>3)]<<16|i[3+(n>>>3)]<<24)>>>(7&n)},r.H.m=function(){let i=Uint16Array,n=Uint32Array;return {K:new i(16),j:new i(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[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],q:new i(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[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],c:new n(32),J:new i(512),_:[],h:new i(32),$:[],w:new i(32768),C:[],v:[],d:new i(32768),D:[],u:new i(512),Q:[],r:new i(32768),s:new n(286),Y:new n(30),a:new n(19),t:new n(15e3),k:new i(65536),g:new i(32768)}}(),function(){let i=r.H.m;for(var n=0;n<32768;n++){let w=n;w=(2863311530&w)>>>1|(1431655765&w)<<1,w=(3435973836&w)>>>2|(858993459&w)<<2,w=(4042322160&w)>>>4|(252645135&w)<<4,w=(4278255360&w)>>>8|(16711935&w)<<8,i.r[n]=(w>>>16|w<<16)>>>17;}function h(w,I,L){for(;I--!=0;)w.push(0,L);}for(n=0;n<32;n++)i.q[n]=i.S[n]<<3|i.T[n],i.c[n]=i.p[n]<<4|i.z[n];h(i._,144,8),h(i._,112,9),h(i._,24,7),h(i._,8,8),r.H.n(i._,9),r.H.A(i._,9,i.J),r.H.l(i._,9),h(i.$,32,5),r.H.n(i.$,5),r.H.A(i.$,5,i.h),r.H.l(i.$,5),h(i.Q,19,0),h(i.C,286,0),h(i.D,30,0),h(i.v,320,0);}(),r.H.N}();function t(r){return [1,null,3,1,2,null,4][r.ctype]*r.depth}function m(r,i,n,h,w){let I=t(i),L=Math.ceil(h*I/8),_,H;I=Math.ceil(I/8);let B=r[n],F=0;if(B>1&&(r[n]=[0,0,1][B-2]),B==3)for(F=I;F<L;F++)r[F+1]=r[F+1]+(r[F+1-I]>>>1)&255;for(let R=0;R<w;R++)if(_=n+R*L,H=_+R+1,B=r[H-1],F=0,B==0)for(;F<L;F++)r[_+F]=r[H+F];else if(B==1){for(;F<I;F++)r[_+F]=r[H+F];for(;F<L;F++)r[_+F]=r[H+F]+r[_+F-I];}else if(B==2)for(;F<L;F++)r[_+F]=r[H+F]+r[_+F-L];else if(B==3){for(;F<I;F++)r[_+F]=r[H+F]+(r[_+F-L]>>>1);for(;F<L;F++)r[_+F]=r[H+F]+(r[_+F-L]+r[_+F-I]>>>1);}else {for(;F<I;F++)r[_+F]=r[H+F]+f(0,r[_+F-L],0);for(;F<L;F++)r[_+F]=r[H+F]+f(r[_+F-I],r[_+F-L],r[_+F-I-L]);}return r}function f(r,i,n){let h=r+i-n,w=h-r,I=h-i,L=h-n;return w*w<=I*I&&w*w<=L*L?r:I*I<=L*L?i:n}function v(r,i,n){n.width=a.readUint(r,i),i+=4,n.height=a.readUint(r,i),i+=4,n.depth=r[i],i++,n.ctype=r[i],i++,n.compress=r[i],i++,n.filter=r[i],i++,n.interlace=r[i],i++;}function T(r,i,n,h,w,I,L,_,H){let B=Math.min(i,w),F=Math.min(n,I),R=0,p=0;for(let S=0;S<F;S++)for(let g=0;g<B;g++)if(L>=0&&_>=0?(R=S*i+g<<2,p=(_+S)*w+L+g<<2):(R=(-_+S)*i-L+g<<2,p=S*w+g<<2),H==0)h[p]=r[R],h[p+1]=r[R+1],h[p+2]=r[R+2],h[p+3]=r[R+3];else if(H==1){var M=r[R+3]*.00392156862745098,c=r[R]*M,l=r[R+1]*M,E=r[R+2]*M,s=h[p+3]*(1/255),y=h[p]*s,b=h[p+1]*s,A=h[p+2]*s;let d=1-M,P=M+s*d,U=P==0?0:1/P;h[p+3]=255*P,h[p+0]=(c+y*d)*U,h[p+1]=(l+b*d)*U,h[p+2]=(E+A*d)*U;}else if(H==2)M=r[R+3],c=r[R],l=r[R+1],E=r[R+2],s=h[p+3],y=h[p],b=h[p+1],A=h[p+2],M==s&&c==y&&l==b&&E==A?(h[p]=0,h[p+1]=0,h[p+2]=0,h[p+3]=0):(h[p]=c,h[p+1]=l,h[p+2]=E,h[p+3]=M);else if(H==3){if(M=r[R+3],c=r[R],l=r[R+1],E=r[R+2],s=h[p+3],y=h[p],b=h[p+1],A=h[p+2],M==s&&c==y&&l==b&&E==A)continue;if(M<220&&s>20)return false}return true}return {decode:function(i){let n=new Uint8Array(i),h=8,w=a,I=w.readUshort,L=w.readUint,_={tabs:{},frames:[]},H=new Uint8Array(n.length),B,F=0,R=0,p=[137,80,78,71,13,10,26,10];for(var M=0;M<8;M++)if(n[M]!=p[M])throw "The input is not a PNG file!";for(;h<n.length;){let S=w.readUint(n,h);h+=4;let g=w.readASCII(n,h,4);if(h+=4,g=="IHDR")v(n,h,_);else if(g=="iCCP"){for(var c=h;n[c]!=0;)c++;w.readASCII(n,h,c-h),n[c+1];let d=n.slice(c+2,h+S),P=null;try{P=u(d);}catch{P=e(d);}_.tabs[g]=P;}else if(g=="CgBI")_.tabs[g]=n.slice(h,h+4);else if(g=="IDAT"){for(M=0;M<S;M++)H[F+M]=n[h+M];F+=S;}else if(g=="acTL")_.tabs[g]={num_frames:L(n,h),num_plays:L(n,h+4)},B=new Uint8Array(n.length);else if(g=="fcTL"){R!=0&&((A=_.frames[_.frames.length-1]).data=C(_,B.slice(0,R),A.rect.width,A.rect.height),R=0);let d={x:L(n,h+12),y:L(n,h+16),width:L(n,h+4),height:L(n,h+8)},P=I(n,h+22);P=I(n,h+20)/(P==0?100:P);let U={rect:d,delay:Math.round(1e3*P),dispose:n[h+24],blend:n[h+25]};_.frames.push(U);}else if(g=="fdAT"){for(M=0;M<S-4;M++)B[R+M]=n[h+M+4];R+=S-4;}else if(g=="pHYs")_.tabs[g]=[w.readUint(n,h),w.readUint(n,h+4),n[h+8]];else if(g=="cHRM")for(_.tabs[g]=[],M=0;M<8;M++)_.tabs[g].push(w.readUint(n,h+4*M));else if(g=="tEXt"||g=="zTXt"){_.tabs[g]==null&&(_.tabs[g]={});var l=w.nextZero(n,h),E=w.readASCII(n,h,l-h),s=h+S-l-1;if(g=="tEXt")b=w.readASCII(n,l+1,s);else {var y=u(n.slice(l+2,l+2+s));b=w.readUTF8(y,0,y.length);}_.tabs[g][E]=b;}else if(g=="iTXt"){_.tabs[g]==null&&(_.tabs[g]={}),l=0,c=h,l=w.nextZero(n,c),E=w.readASCII(n,c,l-c);let d=n[c=l+1];var b;n[c+1],c+=2,l=w.nextZero(n,c),w.readASCII(n,c,l-c),c=l+1,l=w.nextZero(n,c),w.readUTF8(n,c,l-c),s=S-((c=l+1)-h),d==0?b=w.readUTF8(n,c,s):(y=u(n.slice(c,c+s)),b=w.readUTF8(y,0,y.length)),_.tabs[g][E]=b;}else if(g=="PLTE")_.tabs[g]=w.readBytes(n,h,S);else if(g=="hIST"){let d=_.tabs.PLTE.length/3;for(_.tabs[g]=[],M=0;M<d;M++)_.tabs[g].push(I(n,h+2*M));}else if(g=="tRNS")_.ctype==3?_.tabs[g]=w.readBytes(n,h,S):_.ctype==0?_.tabs[g]=I(n,h):_.ctype==2&&(_.tabs[g]=[I(n,h),I(n,h+2),I(n,h+4)]);else if(g=="gAMA")_.tabs[g]=w.readUint(n,h)/1e5;else if(g=="sRGB")_.tabs[g]=n[h];else if(g=="bKGD")_.ctype==0||_.ctype==4?_.tabs[g]=[I(n,h)]:_.ctype==2||_.ctype==6?_.tabs[g]=[I(n,h),I(n,h+2),I(n,h+4)]:_.ctype==3&&(_.tabs[g]=n[h]);else if(g=="IEND")break;h+=S,w.readUint(n,h),h+=4;}var A;return R!=0&&((A=_.frames[_.frames.length-1]).data=C(_,B.slice(0,R),A.rect.width,A.rect.height)),_.data=C(_,H,_.width,_.height),delete _.compress,delete _.interlace,delete _.filter,_},toRGBA8:function(i){let n=i.width,h=i.height;if(i.tabs.acTL==null)return [o(i.data,n,h,i).buffer];let w=[];i.frames[0].data==null&&(i.frames[0].data=i.data);let I=n*h*4,L=new Uint8Array(I),_=new Uint8Array(I),H=new Uint8Array(I);for(let F=0;F<i.frames.length;F++){let R=i.frames[F],p=R.rect.x,M=R.rect.y,c=R.rect.width,l=R.rect.height,E=o(R.data,c,l,i);if(F!=0)for(var B=0;B<I;B++)H[B]=L[B];if(R.blend==0?T(E,c,l,L,n,h,p,M,0):R.blend==1&&T(E,c,l,L,n,h,p,M,1),w.push(L.buffer.slice(0)),R.dispose!=0){if(R.dispose==1)T(_,c,l,L,n,h,p,M,0);else if(R.dispose==2)for(B=0;B<I;B++)L[B]=H[B];}}return w},_paeth:f,_copyTile:T,_bin:a}}();(function(){let{_copyTile:a}=pe,{_bin:o}=pe,C=pe._paeth;var u={table:function(){let c=new Uint32Array(256);for(let l=0;l<256;l++){let E=l;for(let s=0;s<8;s++)1&E?E=3988292384^E>>>1:E>>>=1;c[l]=E;}return c}(),update(c,l,E,s){for(let y=0;y<s;y++)c=u.table[255&(c^l[E+y])]^c>>>8;return c},crc:(c,l,E)=>4294967295^u.update(4294967295,c,l,E)};function e(c,l,E,s){l[E]+=c[0]*s>>4,l[E+1]+=c[1]*s>>4,l[E+2]+=c[2]*s>>4,l[E+3]+=c[3]*s>>4;}function t(c){return Math.max(0,Math.min(255,c))}function m(c,l){let E=c[0]-l[0],s=c[1]-l[1],y=c[2]-l[2],b=c[3]-l[3];return E*E+s*s+y*y+b*b}function f(c,l,E,s,y,b,A){A==null&&(A=1);let S=s.length,g=[];for(var d=0;d<S;d++){let x=s[d];g.push([x>>>0&255,x>>>8&255,x>>>16&255,x>>>24&255]);}for(d=0;d<S;d++){let x=4294967295;for(var P=0,U=0;U<S;U++){var O=m(g[d],g[U]);U!=d&&O<x&&(x=O,P=U);}}let N=new Uint32Array(y.buffer),D=new Int16Array(l*E*4),Q=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(d=0;d<Q.length;d++)Q[d]=255*((Q[d]+.5)/16-.5);for(let x=0;x<E;x++)for(let $=0;$<l;$++){var k;d=4*(x*l+$),A!=2?k=[t(c[d]+D[d]),t(c[d+1]+D[d+1]),t(c[d+2]+D[d+2]),t(c[d+3]+D[d+3])]:(O=Q[4*(3&x)+(3&$)],k=[t(c[d]+O),t(c[d+1]+O),t(c[d+2]+O),t(c[d+3]+O)]),P=0;let K=16777215;for(U=0;U<S;U++){let G=m(k,g[U]);G<K&&(K=G,P=U);}let q=g[P],V=[k[0]-q[0],k[1]-q[1],k[2]-q[2],k[3]-q[3]];A==1&&($!=l-1&&e(V,D,d+4,7),x!=E-1&&($!=0&&e(V,D,d+4*l-4,3),e(V,D,d+4*l,5),$!=l-1&&e(V,D,d+4*l+4,1))),b[d>>2]=P,N[d>>2]=s[P];}}function v(c,l,E,s,y){y==null&&(y={});let{crc:b}=u,A=o.writeUint,S=o.writeUshort,g=o.writeASCII,d=8,P=c.frames.length>1,U,O=false,N=33+(P?20:0);if(y.sRGB!=null&&(N+=13),y.pHYs!=null&&(N+=21),y.iCCP!=null&&(U=pako.deflate(y.iCCP),N+=21+U.length+4),c.ctype==3){for(var D=c.plte.length,Q=0;Q<D;Q++)c.plte[Q]>>>24!=255&&(O=true);N+=8+3*D+4+(O?8+1*D+4:0);}for(var k=0;k<c.frames.length;k++)P&&(N+=38),N+=(q=c.frames[k]).cimg.length+12,k!=0&&(N+=4);N+=12;let x=new Uint8Array(N),$=[137,80,78,71,13,10,26,10];for(Q=0;Q<8;Q++)x[Q]=$[Q];if(A(x,d,13),d+=4,g(x,d,"IHDR"),d+=4,A(x,d,l),d+=4,A(x,d,E),d+=4,x[d]=c.depth,d++,x[d]=c.ctype,d++,x[d]=0,d++,x[d]=0,d++,x[d]=0,d++,A(x,d,b(x,d-17,17)),d+=4,y.sRGB!=null&&(A(x,d,1),d+=4,g(x,d,"sRGB"),d+=4,x[d]=y.sRGB,d++,A(x,d,b(x,d-5,5)),d+=4),y.iCCP!=null){let V=13+U.length;A(x,d,V),d+=4,g(x,d,"iCCP"),d+=4,g(x,d,"ICC profile"),d+=11,d+=2,x.set(U,d),d+=U.length,A(x,d,b(x,d-(V+4),V+4)),d+=4;}if(y.pHYs!=null&&(A(x,d,9),d+=4,g(x,d,"pHYs"),d+=4,A(x,d,y.pHYs[0]),d+=4,A(x,d,y.pHYs[1]),d+=4,x[d]=y.pHYs[2],d++,A(x,d,b(x,d-13,13)),d+=4),P&&(A(x,d,8),d+=4,g(x,d,"acTL"),d+=4,A(x,d,c.frames.length),d+=4,A(x,d,y.loop!=null?y.loop:0),d+=4,A(x,d,b(x,d-12,12)),d+=4),c.ctype==3){for(A(x,d,3*(D=c.plte.length)),d+=4,g(x,d,"PLTE"),d+=4,Q=0;Q<D;Q++){let V=3*Q,G=c.plte[Q],z=255&G,W=G>>>8&255,ie=G>>>16&255;x[d+V+0]=z,x[d+V+1]=W,x[d+V+2]=ie;}if(d+=3*D,A(x,d,b(x,d-3*D-4,3*D+4)),d+=4,O){for(A(x,d,D),d+=4,g(x,d,"tRNS"),d+=4,Q=0;Q<D;Q++)x[d+Q]=c.plte[Q]>>>24&255;d+=D,A(x,d,b(x,d-D-4,D+4)),d+=4;}}let K=0;for(k=0;k<c.frames.length;k++){var q=c.frames[k];P&&(A(x,d,26),d+=4,g(x,d,"fcTL"),d+=4,A(x,d,K++),d+=4,A(x,d,q.rect.width),d+=4,A(x,d,q.rect.height),d+=4,A(x,d,q.rect.x),d+=4,A(x,d,q.rect.y),d+=4,S(x,d,s[k]),d+=2,S(x,d,1e3),d+=2,x[d]=q.dispose,d++,x[d]=q.blend,d++,A(x,d,b(x,d-30,30)),d+=4);let V=q.cimg;A(x,d,(D=V.length)+(k==0?0:4)),d+=4;let G=d;g(x,d,k==0?"IDAT":"fdAT"),d+=4,k!=0&&(A(x,d,K++),d+=4),x.set(V,d),d+=D,A(x,d,b(x,G,d-G)),d+=4;}return A(x,d,0),d+=4,g(x,d,"IEND"),d+=4,A(x,d,b(x,d-4,4)),d+=4,x.buffer}function T(c,l,E){for(let s=0;s<c.frames.length;s++){let y=c.frames[s];y.rect.width;let b=y.rect.height,A=new Uint8Array(b*y.bpl+b);y.cimg=h(y.img,b,y.bpp,y.bpl,A,l,E);}}function r(c,l,E,s,y){let b=y[0],A=y[1],S=y[2],g=y[3],d=y[4],P=y[5],U=6,O=8,N=255;for(var D=0;D<c.length;D++){let te=new Uint8Array(c[D]);for(var Q=te.length,k=0;k<Q;k+=4)N&=te[k+3];}let x=N!=255,$=function(Y,Z,ne,oe,j,ue){let ee=[];for(var X=0;X<Y.length;X++){let fe=new Uint8Array(Y[X]),he=new Uint32Array(fe.buffer);var le;let de=0,ve=0,me=Z,Re=ne,Ze=oe?1:0;if(X!=0){let ln=ue||oe||X==1||ee[X-2].dispose!=0?1:2,Je=0,vt=1e9;for(let Fe=0;Fe<ln;Fe++){var ge=new Uint8Array(Y[X-1-Fe]);let fn=new Uint32Array(Y[X-1-Fe]),Ee=Z,be=ne,Oe=-1,De=-1;for(let Ce=0;Ce<ne;Ce++)for(let Ie=0;Ie<Z;Ie++)he[se=Ce*Z+Ie]!=fn[se]&&(Ie<Ee&&(Ee=Ie),Ie>Oe&&(Oe=Ie),Ce<be&&(be=Ce),Ce>De&&(De=Ce));Oe==-1&&(Ee=be=Oe=De=0),j&&((1&Ee)==1&&Ee--,(1&be)==1&&be--);let wt=(Oe-Ee+1)*(De-be+1);wt<vt&&(vt=wt,Je=Fe,de=Ee,ve=be,me=Oe-Ee+1,Re=De-be+1);}ge=new Uint8Array(Y[X-1-Je]),Je==1&&(ee[X-1].dispose=2),le=new Uint8Array(me*Re*4),a(ge,Z,ne,le,me,Re,-de,-ve,0),Ze=a(fe,Z,ne,le,me,Re,-de,-ve,3)?1:0,Ze==1?n(fe,Z,ne,le,{x:de,y:ve,width:me,height:Re}):a(fe,Z,ne,le,me,Re,-de,-ve,0);}else le=fe.slice(0);ee.push({rect:{x:de,y:ve,width:me,height:Re},img:le,blend:Ze,dispose:0});}if(oe)for(X=0;X<ee.length;X++){if((_e=ee[X]).blend==1)continue;let fe=_e.rect,he=ee[X-1].rect,de=Math.min(fe.x,he.x),ve=Math.min(fe.y,he.y),me={x:de,y:ve,width:Math.max(fe.x+fe.width,he.x+he.width)-de,height:Math.max(fe.y+fe.height,he.y+he.height)-ve};ee[X-1].dispose=1,X-1!=0&&i(Y,Z,ne,ee,X-1,me,j),i(Y,Z,ne,ee,X,me,j);}let Qe=0;if(Y.length!=1)for(var se=0;se<ee.length;se++){var _e;Qe+=(_e=ee[se]).rect.width*_e.rect.height;}return ee}(c,l,E,b,A,S),K={},q=[],V=[];if(s!=0){let te=[];for(k=0;k<$.length;k++)te.push($[k].img.buffer);let Y=function(j){let ue=0;for(var ee=0;ee<j.length;ee++)ue+=j[ee].byteLength;let X=new Uint8Array(ue),le=0;for(ee=0;ee<j.length;ee++){let ge=new Uint8Array(j[ee]),Qe=ge.length;for(let se=0;se<Qe;se+=4){let _e=ge[se],fe=ge[se+1],he=ge[se+2],de=ge[se+3];de==0&&(_e=fe=he=0),X[le+se]=_e,X[le+se+1]=fe,X[le+se+2]=he,X[le+se+3]=de;}le+=Qe;}return X.buffer}(te),Z=I(Y,s);for(k=0;k<Z.plte.length;k++)q.push(Z.plte[k].est.rgba);let ne=0;for(k=0;k<$.length;k++){let oe=(z=$[k]).img.length;var G=new Uint8Array(Z.inds.buffer,ne>>2,oe>>2);V.push(G);let j=new Uint8Array(Z.abuf,ne,oe);P&&f(z.img,z.rect.width,z.rect.height,q,j,G),z.img.set(j),ne+=oe;}}else for(D=0;D<$.length;D++){var z=$[D];let te=new Uint32Array(z.img.buffer);var W=z.rect.width;for(Q=te.length,G=new Uint8Array(Q),V.push(G),k=0;k<Q;k++){let Y=te[k];if(k!=0&&Y==te[k-1])G[k]=G[k-1];else if(k>W&&Y==te[k-W])G[k]=G[k-W];else {let Z=K[Y];if(Z==null&&(K[Y]=Z=q.length,q.push(Y),q.length>=300))break;G[k]=Z;}}}let ie=q.length;for(ie<=256&&d==0&&(O=ie<=2?1:ie<=4?2:ie<=16?4:8,O=Math.max(O,g)),D=0;D<$.length;D++){(z=$[D]).rect.x,z.rect.y,W=z.rect.width;let te=z.rect.height,Y=z.img;new Uint32Array(Y.buffer);let Z=4*W,ne=4;if(ie<=256&&d==0){Z=Math.ceil(O*W/8);var ae=new Uint8Array(Z*te);let oe=V[D];for(let j=0;j<te;j++){k=j*Z;let ue=j*W;if(O==8)for(var J=0;J<W;J++)ae[k+J]=oe[ue+J];else if(O==4)for(J=0;J<W;J++)ae[k+(J>>1)]|=oe[ue+J]<<4-4*(1&J);else if(O==2)for(J=0;J<W;J++)ae[k+(J>>2)]|=oe[ue+J]<<6-2*(3&J);else if(O==1)for(J=0;J<W;J++)ae[k+(J>>3)]|=oe[ue+J]<<7-1*(7&J);}Y=ae,U=3,ne=1;}else if(x==0&&$.length==1){ae=new Uint8Array(W*te*3);let oe=W*te;for(k=0;k<oe;k++){let j=3*k,ue=4*k;ae[j]=Y[ue],ae[j+1]=Y[ue+1],ae[j+2]=Y[ue+2];}Y=ae,U=2,ne=3,Z=3*W;}z.img=Y,z.bpl=Z,z.bpp=ne;}return {ctype:U,depth:O,plte:q,frames:$}}function i(c,l,E,s,y,b,A){let S=Uint8Array,g=Uint32Array,d=new S(c[y-1]),P=new g(c[y-1]),U=y+1<c.length?new S(c[y+1]):null,O=new S(c[y]),N=new g(O.buffer),D=l,Q=E,k=-1,x=-1;for(let K=0;K<b.height;K++)for(let q=0;q<b.width;q++){let V=b.x+q,G=b.y+K,z=G*l+V,W=N[z];W==0||s[y-1].dispose==0&&P[z]==W&&(U==null||U[4*z+3]!=0)||(V<D&&(D=V),V>k&&(k=V),G<Q&&(Q=G),G>x&&(x=G));}k==-1&&(D=Q=k=x=0),A&&((1&D)==1&&D--,(1&Q)==1&&Q--),b={x:D,y:Q,width:k-D+1,height:x-Q+1};let $=s[y];$.rect=b,$.blend=1,$.img=new Uint8Array(b.width*b.height*4),s[y-1].dispose==0?(a(d,l,E,$.img,b.width,b.height,-b.x,-b.y,0),n(O,l,E,$.img,b)):a(O,l,E,$.img,b.width,b.height,-b.x,-b.y,0);}function n(c,l,E,s,y){a(c,l,E,s,y.width,y.height,-y.x,-y.y,2);}function h(c,l,E,s,y,b,A){let S=[],g,d=[0,1,2,3,4];b!=-1?d=[b]:(l*s>5e5||E==1)&&(d=[0]),A&&(g={level:0});let P=vn;for(var U=0;U<d.length;U++){for(let D=0;D<l;D++)w(y,c,D,s,E,d[U]);S.push(P.deflate(y,g));}let O,N=1e9;for(U=0;U<S.length;U++)S[U].length<N&&(O=U,N=S[U].length);return S[O]}function w(c,l,E,s,y,b){let A=E*s,S=A+E;if(c[S]=b,S++,b==0)if(s<500)for(var g=0;g<s;g++)c[S+g]=l[A+g];else c.set(new Uint8Array(l.buffer,A,s),S);else if(b==1){for(g=0;g<y;g++)c[S+g]=l[A+g];for(g=y;g<s;g++)c[S+g]=l[A+g]-l[A+g-y]+256&255;}else if(E==0){for(g=0;g<y;g++)c[S+g]=l[A+g];if(b==2)for(g=y;g<s;g++)c[S+g]=l[A+g];if(b==3)for(g=y;g<s;g++)c[S+g]=l[A+g]-(l[A+g-y]>>1)+256&255;if(b==4)for(g=y;g<s;g++)c[S+g]=l[A+g]-C(l[A+g-y],0,0)+256&255;}else {if(b==2)for(g=0;g<s;g++)c[S+g]=l[A+g]+256-l[A+g-s]&255;if(b==3){for(g=0;g<y;g++)c[S+g]=l[A+g]+256-(l[A+g-s]>>1)&255;for(g=y;g<s;g++)c[S+g]=l[A+g]+256-(l[A+g-s]+l[A+g-y]>>1)&255;}if(b==4){for(g=0;g<y;g++)c[S+g]=l[A+g]+256-C(0,l[A+g-s],0)&255;for(g=y;g<s;g++)c[S+g]=l[A+g]+256-C(l[A+g-y],l[A+g-s],l[A+g-y-s])&255;}}}function I(c,l){let E=new Uint8Array(c),s=E.slice(0),y=new Uint32Array(s.buffer),b=L(s,l),A=b[0],S=b[1],g=E.length,d=new Uint8Array(g>>2),P;if(E.length<2e7)for(var U=0;U<g;U+=4)P=_(A,O=E[U]*(1/255),N=E[U+1]*(1/255),D=E[U+2]*(1/255),Q=E[U+3]*(1/255)),d[U>>2]=P.ind,y[U>>2]=P.est.rgba;else for(U=0;U<g;U+=4){var O=E[U]*.00392156862745098,N=E[U+1]*(1/255),D=E[U+2]*(1/255),Q=E[U+3]*(1/255);for(P=A;P.left;)P=H(P.est,O,N,D,Q)<=0?P.left:P.right;d[U>>2]=P.ind,y[U>>2]=P.est.rgba;}return {abuf:s.buffer,inds:d,plte:S}}function L(c,l,E){E==null&&(E=1e-4);let s=new Uint32Array(c.buffer),y={i0:0,i1:c.length,bst:null,est:null,tdst:0,left:null,right:null};y.bst=R(c,y.i0,y.i1),y.est=p(y.bst);let b=[y];for(;b.length<l;){let S=0,g=0;for(var A=0;A<b.length;A++)b[A].est.L>S&&(S=b[A].est.L,g=A);if(S<E)break;let d=b[g],P=B(c,s,d.i0,d.i1,d.est.e,d.est.eMq255);if(d.i0>=P||d.i1<=P){d.est.L=0;continue}let U={i0:d.i0,i1:P,bst:null,est:null,tdst:0,left:null,right:null};U.bst=R(c,U.i0,U.i1),U.est=p(U.bst);let O={i0:P,i1:d.i1,bst:null,est:null,tdst:0,left:null,right:null};for(O.bst={R:[],m:[],N:d.bst.N-U.bst.N},A=0;A<16;A++)O.bst.R[A]=d.bst.R[A]-U.bst.R[A];for(A=0;A<4;A++)O.bst.m[A]=d.bst.m[A]-U.bst.m[A];O.est=p(O.bst),d.left=U,d.right=O,b[g]=U,b.push(O);}for(b.sort((S,g)=>g.bst.N-S.bst.N),A=0;A<b.length;A++)b[A].ind=A;return [y,b]}function _(c,l,E,s,y){if(c.left==null)return c.tdst=function(U,O,N,D,Q){let k=O-U[0],x=N-U[1],$=D-U[2],K=Q-U[3];return k*k+x*x+$*$+K*K}(c.est.q,l,E,s,y),c;let b=H(c.est,l,E,s,y),A=c.left,S=c.right;b>0&&(A=c.right,S=c.left);let g=_(A,l,E,s,y);if(g.tdst<=b*b)return g;let d=_(S,l,E,s,y);return d.tdst<g.tdst?d:g}function H(c,l,E,s,y){let{e:b}=c;return b[0]*l+b[1]*E+b[2]*s+b[3]*y-c.eMq}function B(c,l,E,s,y,b){for(s-=4;E<s;){for(;F(c,E,y)<=b;)E+=4;for(;F(c,s,y)>b;)s-=4;if(E>=s)break;let A=l[E>>2];l[E>>2]=l[s>>2],l[s>>2]=A,E+=4,s-=4;}for(;F(c,E,y)>b;)E-=4;return E+4}function F(c,l,E){return c[l]*E[0]+c[l+1]*E[1]+c[l+2]*E[2]+c[l+3]*E[3]}function R(c,l,E){let s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],y=[0,0,0,0],b=E-l>>2;for(let A=l;A<E;A+=4){let S=c[A]*.00392156862745098,g=c[A+1]*(1/255),d=c[A+2]*(1/255),P=c[A+3]*(1/255);y[0]+=S,y[1]+=g,y[2]+=d,y[3]+=P,s[0]+=S*S,s[1]+=S*g,s[2]+=S*d,s[3]+=S*P,s[5]+=g*g,s[6]+=g*d,s[7]+=g*P,s[10]+=d*d,s[11]+=d*P,s[15]+=P*P;}return s[4]=s[1],s[8]=s[2],s[9]=s[6],s[12]=s[3],s[13]=s[7],s[14]=s[11],{R:s,m:y,N:b}}function p(c){let{R:l}=c,{m:E}=c,{N:s}=c,y=E[0],b=E[1],A=E[2],S=E[3],g=s==0?0:1/s,d=[l[0]-y*y*g,l[1]-y*b*g,l[2]-y*A*g,l[3]-y*S*g,l[4]-b*y*g,l[5]-b*b*g,l[6]-b*A*g,l[7]-b*S*g,l[8]-A*y*g,l[9]-A*b*g,l[10]-A*A*g,l[11]-A*S*g,l[12]-S*y*g,l[13]-S*b*g,l[14]-S*A*g,l[15]-S*S*g],P=d,U=M,O=[Math.random(),Math.random(),Math.random(),Math.random()],N=0,D=0;if(s!=0)for(let k=0;k<16&&(O=U.multVec(P,O),D=Math.sqrt(U.dot(O,O)),O=U.sml(1/D,O),!(k!=0&&Math.abs(D-N)<1e-9));k++)N=D;let Q=[y*g,b*g,A*g,S*g];return {Cov:d,q:Q,e:O,L:N,eMq255:U.dot(U.sml(255,Q),O),eMq:U.dot(O,Q),rgba:(Math.round(255*Q[3])<<24|Math.round(255*Q[2])<<16|Math.round(255*Q[1])<<8|Math.round(255*Q[0])<<0)>>>0}}var M={multVec:(c,l)=>[c[0]*l[0]+c[1]*l[1]+c[2]*l[2]+c[3]*l[3],c[4]*l[0]+c[5]*l[1]+c[6]*l[2]+c[7]*l[3],c[8]*l[0]+c[9]*l[1]+c[10]*l[2]+c[11]*l[3],c[12]*l[0]+c[13]*l[1]+c[14]*l[2]+c[15]*l[3]],dot:(c,l)=>c[0]*l[0]+c[1]*l[1]+c[2]*l[2]+c[3]*l[3],sml:(c,l)=>[c*l[0],c*l[1],c*l[2],c*l[3]]};pe.encode=function(l,E,s,y,b,A,S){y==null&&(y=0),S==null&&(S=false);let g=r(l,E,s,y,[false,false,false,0,S,false]);return T(g,-1),v(g,E,s,b,A)},pe.encodeLL=function(l,E,s,y,b,A,S,g){let d={ctype:0+(y==1?0:2)+(b==0?0:4),depth:A,frames:[]},P=(y+b)*A,U=P*E;for(let O=0;O<l.length;O++)d.frames.push({rect:{x:0,y:0,width:E,height:s},img:new Uint8Array(l[O]),blend:0,dispose:1,bpp:Math.ceil(P/8),bpl:Math.ceil(U/8)});return T(d,0,true),v(d,E,s,S,g)},pe.encode.compress=r,pe.encode.dither=f,pe.quantize=I,pe.quantize.getKDtree=L,pe.quantize.getNearest=_;})();var _t={toArrayBuffer(a,o){let C=a.width,u=a.height,e=C<<2,t=a.getContext("2d").getImageData(0,0,C,u),m=new Uint32Array(t.data.buffer),f=(32*C+31)/32<<2,v=f*u,T=122+v,r=new ArrayBuffer(T),i=new DataView(r),n=1<<20,h,w,I,L,_=n,H=0,B=0,F=0;function R(c){i.setUint16(B,c,true),B+=2;}function p(c){i.setUint32(B,c,true),B+=4;}function M(c){B+=c;}R(19778),p(T),M(4),p(122),p(108),p(C),p(-u>>>0),R(1),R(32),p(3),p(v),p(2835),p(2835),M(8),p(16711680),p(65280),p(255),p(4278190080),p(1466527264),function c(){for(;H<u&&_>0;){for(L=122+H*f,h=0;h<e;)_--,w=m[F++],I=w>>>24,i.setUint32(L+h,w<<8|I),h+=4;H++;}F<m.length?(_=n,setTimeout(c,_t._dly)):o(r);}();},toBlob(a,o){this.toArrayBuffer(a,C=>{o(new Blob([C],{type:"image/bmp"}));});},_dly:9},ce={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},wn={[ce.CHROME]:16384,[ce.FIREFOX]:11180,[ce.DESKTOP_SAFARI]:16384,[ce.IE]:8192,[ce.IOS]:4096,[ce.ETC]:8192},tt=typeof window<"u",Rt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Ve=tt&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),En=(tt||Rt)&&(Ve&&Ve.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Ct=(tt||Rt)&&(Ve&&Ve.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function nt(a,o,C=Date.now()){return new Promise(u=>{let e=a.split(","),t=e[0].match(/:(.*?);/)[1],m=globalThis.atob(e[1]),f=m.length,v=new Uint8Array(f);for(;f--;)v[f]=m.charCodeAt(f);let T=new Blob([v],{type:t});T.name=o,T.lastModified=C,u(T);})}function It(a){return new Promise((o,C)=>{let u=new Ct;u.onload=()=>o(u.result),u.onerror=e=>C(e),u.readAsDataURL(a);})}function Ut(a){return new Promise((o,C)=>{let u=new Image;u.onload=()=>o(u),u.onerror=e=>C(e),u.src=a;})}function Ue(){if(Ue.cachedResult!==void 0)return Ue.cachedResult;let a=ce.ETC,{userAgent:o}=navigator;return /Chrom(e|ium)/i.test(o)?a=ce.CHROME:/iP(ad|od|hone)/i.test(o)&&/WebKit/i.test(o)?a=ce.IOS:/Safari/i.test(o)?a=ce.DESKTOP_SAFARI:/Firefox/i.test(o)?a=ce.FIREFOX:(/MSIE/i.test(o)||document.documentMode)&&(a=ce.IE),Ue.cachedResult=a,Ue.cachedResult}function Mt(a,o){let C=Ue(),u=wn[C],e=a,t=o,m=e*t,f=e>t?t/e:e/t;for(;m>u*u;){let v=(u+e)/2,T=(u+t)/2;v<T?(t=T,e=T*f):(t=v*f,e=v),m=e*t;}return {width:e,height:t}}function Ge(a,o){let C,u;try{if(C=new OffscreenCanvas(a,o),u=C.getContext("2d"),u===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{C=document.createElement("canvas"),u=C.getContext("2d");}return C.width=a,C.height=o,[C,u]}function Ot(a,o){let{width:C,height:u}=Mt(a.width,a.height),[e,t]=Ge(C,u);return o&&/jpe?g/.test(o)&&(t.fillStyle="white",t.fillRect(0,0,e.width,e.height)),t.drawImage(a,0,0,e.width,e.height),e}function $e(){return $e.cachedResult!==void 0||($e.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),$e.cachedResult}function ze(a,o={}){return new Promise(function(C,u){let e,t;var m=function(){try{return t=Ot(e,o.fileType||a.type),C([e,t])}catch(v){return u(v)}},f=function(v){try{var T=function(r){try{throw r}catch(i){return u(i)}};try{let r;return It(a).then(function(i){try{return r=i,Ut(r).then(function(n){try{return e=n,function(){try{return m()}catch(h){return u(h)}}()}catch(h){return T(h)}},T)}catch(n){return T(n)}},T)}catch(r){T(r);}}catch(r){return u(r)}};try{if($e()||[ce.DESKTOP_SAFARI,ce.MOBILE_SAFARI].includes(Ue()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(a).then(function(v){try{return e=v,m()}catch{return f()}},f)}catch{f();}})}function qe(a,o,C,u,e=1){return new Promise(function(t,m){let f;if(o==="image/png"){let i,n,h;return i=a.getContext("2d"),{data:n}=i.getImageData(0,0,a.width,a.height),h=pe.encode([n.buffer],a.width,a.height,4096*e),f=new Blob([h],{type:o}),f.name=C,f.lastModified=u,v.call(this)}{let i=function(){return v.call(this)};if(o==="image/bmp")return new Promise(n=>_t.toBlob(a,n)).then(function(n){try{return f=n,f.name=C,f.lastModified=u,i.call(this)}catch(h){return m(h)}}.bind(this),m);{let n=function(){return i.call(this)};if(typeof OffscreenCanvas=="function"&&a instanceof OffscreenCanvas)return a.convertToBlob({type:o,quality:e}).then(function(h){try{return f=h,f.name=C,f.lastModified=u,n.call(this)}catch(w){return m(w)}}.bind(this),m);{let h;return h=a.toDataURL(o,e),nt(h,C,u).then(function(w){try{return f=w,n.call(this)}catch(I){return m(I)}}.bind(this),m)}}}function v(){return t(f)}})}function ye(a){a.width=0,a.height=0;}function Pe(){return new Promise(function(a,o){let u,e,t,m;return Pe.cachedResult!==void 0?a(Pe.cachedResult):(nt("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(f){try{return u=f,ze(u).then(function(v){try{return e=v[1],qe(e,u.type,u.name,u.lastModified).then(function(T){try{return t=T,ye(e),ze(t).then(function(r){try{return m=r[0],Pe.cachedResult=m.width===1&&m.height===2,a(Pe.cachedResult)}catch(i){return o(i)}},o)}catch(r){return o(r)}},o)}catch(T){return o(T)}},o)}catch(v){return o(v)}},o))})}function Pt(a){return new Promise((o,C)=>{let u=new Ct;u.onload=e=>{let t=new DataView(e.target.result);if(t.getUint16(0,false)!=65496)return o(-2);let m=t.byteLength,f=2;for(;f<m;){if(t.getUint16(f+2,false)<=8)return o(-1);let v=t.getUint16(f,false);if(f+=2,v==65505){if(t.getUint32(f+=2,false)!=1165519206)return o(-1);let T=t.getUint16(f+=6,false)==18761;f+=t.getUint32(f+4,T);let r=t.getUint16(f,T);f+=2;for(let i=0;i<r;i++)if(t.getUint16(f+12*i,T)==274)return o(t.getUint16(f+12*i+8,T))}else {if((65280&v)!=65280)break;f+=t.getUint16(f,false);}}return o(-1)},u.onerror=e=>C(e),u.readAsArrayBuffer(a);})}function Lt(a,o){let{width:C}=a,{height:u}=a,{maxWidthOrHeight:e}=o,t,m=a;return isFinite(e)&&(C>e||u>e)&&([m,t]=Ge(C,u),C>u?(m.width=e,m.height=u/C*e):(m.width=C/u*e,m.height=e),t.drawImage(a,0,0,m.width,m.height),ye(a)),m}function Ft(a,o){let{width:C}=a,{height:u}=a,[e,t]=Ge(C,u);switch(o>4&&o<9?(e.width=u,e.height=C):(e.width=C,e.height=u),o){case 2:t.transform(-1,0,0,1,C,0);break;case 3:t.transform(-1,0,0,-1,C,u);break;case 4:t.transform(1,0,0,-1,0,u);break;case 5:t.transform(0,1,1,0,0,0);break;case 6:t.transform(0,1,-1,0,u,0);break;case 7:t.transform(0,-1,-1,0,u,C);break;case 8:t.transform(0,-1,1,0,0,C);}return t.drawImage(a,0,0,C,u),ye(a),e}function St(a,o,C=0){return new Promise(function(u,e){let t,m,f,v,T,r,i,n,h,w,I,L,_,H,B,F,R,p,M,c;function l(s=5){if(o.signal&&o.signal.aborted)throw o.signal.reason;t+=s,o.onProgress(Math.min(t,100));}function E(s){if(o.signal&&o.signal.aborted)throw o.signal.reason;t=Math.min(Math.max(s,t),100),o.onProgress(t);}return t=C,m=o.maxIteration||10,f=1024*o.maxSizeMB*1024,l(),ze(a,o).then(function(s){try{return [,v]=s,l(),T=Lt(v,o),l(),new Promise(function(y,b){var A;if(!(A=o.exifOrientation))return Pt(a).then(function(g){try{return A=g,S.call(this)}catch(d){return b(d)}}.bind(this),b);function S(){return y(A)}return S.call(this)}).then(function(y){try{return r=y,l(),Pe().then(function(b){try{return i=b?T:Ft(T,r),l(),n=o.initialQuality||1,h=o.fileType||a.type,qe(i,h,a.name,a.lastModified,n).then(function(A){try{{let P=function(){if(m--&&(B>f||B>_)){let O,N;return O=c?.95*M.width:M.width,N=c?.95*M.height:M.height,[R,p]=Ge(O,N),p.drawImage(M,0,0,O,N),n*=h==="image/png"?.85:.95,qe(R,h,a.name,a.lastModified,n).then(function(D){try{return F=D,ye(M),M=R,B=F.size,E(Math.min(99,Math.floor((H-B)/(H-f)*100))),P}catch(Q){return e(Q)}},e)}return [1]},U=function(){return ye(M),ye(R),ye(T),ye(i),ye(v),E(100),u(F)};var g=P,d=U;if(w=A,l(),I=w.size>f,L=w.size>a.size,!I&&!L)return E(100),u(w);var S;return _=a.size,H=w.size,B=H,M=i,c=!o.alwaysKeepResolution&&I,(S=function(O){for(;O;){if(O.then)return void O.then(S,e);try{if(O.pop){if(O.length)return O.pop()?U.call(this):O;O=P;}else O=O.call(this);}catch(N){return e(N)}}}.bind(this))(P)}}catch(P){return e(P)}}.bind(this),e)}catch(A){return e(A)}}.bind(this),e)}catch(b){return e(b)}}.bind(this),e)}catch(y){return e(y)}}.bind(this),e)})}var bn=`
6
+ let scriptImported = false
7
+ self.addEventListener('message', async (e) => {
8
+ const { file, id, imageCompressionLibUrl, options } = e.data
9
+ options.onProgress = (progress) => self.postMessage({ progress, id })
10
+ try {
11
+ if (!scriptImported) {
12
+ // console.log('[worker] importScripts', imageCompressionLibUrl)
13
+ self.importScripts(imageCompressionLibUrl)
14
+ scriptImported = true
15
+ }
16
+ // console.log('[worker] self', self)
17
+ const compressedFile = await imageCompression(file, options)
18
+ self.postMessage({ file: compressedFile, id })
19
+ } catch (e) {
20
+ // console.error('[worker] error', e)
21
+ self.postMessage({ error: e.message + '\\n' + e.stack, id })
22
+ }
23
+ })
24
+ `,et;function Sn(a,o){return new Promise((C,u)=>{et||(et=function(m){let f=[];return f.push(m),URL.createObjectURL(new Blob(f))}(bn));let e=new Worker(et);e.addEventListener("message",function(m){if(o.signal&&o.signal.aborted)e.terminate();else if(m.data.progress===void 0){if(m.data.error)return u(new Error(m.data.error)),void e.terminate();C(m.data.file),e.terminate();}else o.onProgress(m.data.progress);}),e.addEventListener("error",u),o.signal&&o.signal.addEventListener("abort",()=>{u(o.signal.reason),e.terminate();}),e.postMessage({file:a,imageCompressionLibUrl:o.libURL,options:{...o,onProgress:void 0,signal:void 0}});})}function re(a,o){return new Promise(function(C,u){let e,t,m,f,v,T;if(e={...o},m=0,{onProgress:f}=e,e.maxSizeMB=e.maxSizeMB||Number.POSITIVE_INFINITY,v=typeof e.useWebWorker!="boolean"||e.useWebWorker,delete e.useWebWorker,e.onProgress=h=>{m=h,typeof f=="function"&&f(m);},!(a instanceof Blob||a instanceof En))return u(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(a.type))return u(new Error("The file given is not an image"));if(T=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!v||typeof Worker!="function"||T)return St(a,e).then(function(h){try{return t=h,n.call(this)}catch(w){return u(w)}}.bind(this),u);var r=function(){try{return n.call(this)}catch(h){return u(h)}}.bind(this),i=function(h){try{return St(a,e).then(function(w){try{return t=w,r()}catch(I){return u(I)}},u)}catch(w){return u(w)}};try{return e.libURL=e.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Sn(a,e).then(function(h){try{return t=h,r()}catch{return i()}},i)}catch{i();}function n(){try{t.name=a.name,t.lastModified=a.lastModified;}catch{}try{e.preserveExif&&a.type==="image/jpeg"&&(!e.fileType||e.fileType&&e.fileType===a.type)&&(t=Tt(a,t));}catch{}return C(t)}})}re.getDataUrlFromFile=It,re.getFilefromDataUrl=nt,re.loadImage=Ut,re.drawImageInCanvas=Ot,re.drawFileInCanvas=ze,re.canvasToFile=qe,re.getExifOrientation=Pt,re.handleMaxWidthOrHeight=Lt,re.followExifOrientation=Ft,re.cleanupCanvasMemory=ye,re.isAutoOrientationInBrowser=Pe,re.approximateBelowMaximumCanvasSizeOfBrowser=Mt,re.copyExifWithoutOrientation=Tt,re.getBrowserName=Ue,re.version="2.0.2";var on=bt(Dt()),an=bt(rn());function Ar(a){return new Promise(o=>{let C=new FileReader;C.onload=()=>{o(C.result);},C.readAsDataURL(a);})}function rr(){let a={...window.console};function o(C,u){let e=(0, an.default)(u,{depth:5,maxStringLength:512,indent:2});fetch("/_logger",{method:"POST",body:`[console.${C.toLowerCase()}] ${e}`}).catch(()=>{});}window.console.log=(...C)=>{o("LOG",C),a.log(...C);},window.console.error=(...C)=>{o("ERROR",C),a.error(...C);},window.console.info=(...C)=>{o("INFO",C),a.info(...C);},window.console.warn=(...C)=>{o("WARN",C),a.warn(...C);};}function or(){function a(o,C=window.parent,u="*"){C?.postMessage({...o,source:"iframe"},{targetOrigin:u});}window.addEventListener("message",async o=>{let{origin:C,source:u,data:e}=o,{type:t}=e;if(t==="screenshot"){let m=window.getComputedStyle(document.body).backgroundColor,f=await on.default.toPng(document.body,{bgcolor:m,style:{transform:"translateY("+-window.scrollY+"px)"},width:window.innerWidth,height:window.innerHeight,copyDefaultStyles:false}),v=await fetch(f).then(n=>n.blob()),T=await re(v,{maxSizeMB:4,maxWidthOrHeight:1920,useWebWorker:false}),i={type:"screenshot",payload:{screenshot:await re.getDataUrlFromFile(T)}};a(i,u,C);}});}function vr({appId:a,rootUrl:o,baseUrl:C,versionId:u,isTesting:e,realtimeDomain:t}){typeof window>"u"||window.__APP_ID__||(window.__APP_ID__=a,window.__ROOT_URL__=o,window.__BASE_URL__=C,u&&(window.__VERSION_ID__=u),window.__IS_TESTING__=e,window.__REALTIME_DOMAIN__=t,or(),rr());}var Ne=a=>{let{email:o,phoneNumber:C}=a??{},u=o??C,e=new URLSearchParams;a&&"redirectUri"in a&&a.redirectUri?e.set("returnTo",a.redirectUri):e.set("returnTo",window.location.pathname+window.location.search),a?.provider&&"scope"in a&&(e.set("provider",a.provider),a.scope&&a.scope.length>0&&e.set("scope",a.scope.join(","))),a?.provider=="AC1"&&u&&e.set("identity",u),e.set("stripped","true");let t=window.__APP_ID__;window.__OPEN_AUTH_DRAWER__(`${window.__ROOT_URL__}/setup/${t}?${e.toString()}`);};function wr(){return {redirectToLogin:a=>a?.email?Ne({email:a.email,provider:"AC1"}):Ne()}}function Er(a={}){let[o,C]=useState({userId:void 0,status:"loading",signIn:Ne,providers:[]});return useEffect(()=>{(async()=>{try{let t=await(await fetch("/api/session",{method:"POST",headers:{"Content-Type":"application/json","x-guest-api-internal":"session",...window.__VERSION_ID__?{"x-version-id":window.__VERSION_ID__}:{},...window.__IS_TESTING__?{"x-is-testing":"true"}:{}}})).json()??{};C({userId:t.userId??null,status:"authenticated",signIn:Ne,providers:t?.providers??[]});}catch{if(a.required){let t=encodeURIComponent(window.location.pathname+window.location.search),m=window.__APP_ID__;window.top?window.top.location.href=`${window.__ROOT_URL__}/setup/${m}?returnTo=${t}`:window.location.href=`${window.__ROOT_URL__}/setup/${m}?returnTo=${t}`;}else C({userId:null,status:"unauthenticated",signIn:Ne,providers:[]});}})();},[a.required]),o}function br(){return window.__BASE_URL__}async function ir({channelId:a,initialData:o,broadcastOnly:C,onUpdate:u}){let e=o,t=0,m=window.__REALTIME_DOMAIN__;if(C)return {getData(){return e},setData(v){e=v,fetch(`https://${m}/${a}`,{method:"POST",body:yt.stringify(e)}).catch(console.error),u?.(v);},destroy(){}};let f=new WebSocket(`wss://${m}/${a}`);return new Promise((v,T)=>{function r(w){try{let I=JSON.parse(w.data.toString());I?.id&&I.id>t?(e=yt.parse(I.payload),u?.(e),t=I.id):console.error("Invalid message:",w.data);}catch{console.error("Error parsing message:",w.data);}}function i(w){h(),T(w);}function n(){v({getData(){return e},setData(w){e=w,u?.(w),f.send(yt.stringify(w));},destroy:h});}function h(){f.removeEventListener("message",r),f.removeEventListener("error",i),f.removeEventListener("open",n),f.close();}f.addEventListener("message",r),f.addEventListener("error",i),f.addEventListener("open",n);})}function ar(a,o){let C=useRef(null),[u,e]=useState(0);return useEffect(()=>((async()=>a&&(C.current=await ir({channelId:a,initialData:o,onUpdate:()=>{e(t=>t+1);}})))(),C.current?.destroy),[a,e]),[C.current?.getData(),C.current?.setData??identity]}function Sr(a,o){let[C,u]=useState(null),[e]=ar(C,void 0),t=useCallback(async f=>{let v=nanoid(32);return u(v),await a?.({...f,__channelId:v})},[a]);return {...useMutation(t,o),data:e}}/*! Bundled license information:
25
+
26
+ dom-to-image-more/dist/dom-to-image-more.min.js:
27
+ (*! dom-to-image-more 23-10-2025 *)
28
+ */export{ir as connectToRealtimeStore,Ar as encodeFileAsBase64DataURL,br as getBaseUrl,vr as initializeClientEnvironment,Er as useAuth,Sr as useRealtimeMutation,ar as useRealtimeStore,wr as useRedirectToLogin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptive-ai/sdk",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -46,10 +46,13 @@
46
46
  "@types/eslint": "^8.44.2",
47
47
  "@types/lodash": "^4.14.200",
48
48
  "@types/node": "^20.14.8",
49
+ "@types/object-inspect": "^1.13.0",
49
50
  "@types/react": "19.0.10",
50
51
  "@types/ws": "^8.5.10",
51
52
  "@typescript-eslint/eslint-plugin": "^7.0.0",
52
53
  "@typescript-eslint/parser": "^7.0.0",
54
+ "browser-image-compression": "^2.0.2",
55
+ "dom-to-image-more": "^3.7.2",
53
56
  "eslint": "^8.47.0",
54
57
  "eslint-config-next": "15.2.1",
55
58
  "eslint-config-prettier": "^9.0.0",
@@ -57,13 +60,14 @@
57
60
  "eslint-plugin-prettier": "^5.0.1",
58
61
  "eslint-plugin-simple-import-sort": "^12.1.0",
59
62
  "npm-run-all": "^4.1.5",
63
+ "object-inspect": "^1.13.4",
60
64
  "prettier": "^3.0.3",
61
65
  "rimraf": "^6.0.1",
62
66
  "tsup": "^8.2.4",
63
67
  "tsx": "^4.7.1",
64
68
  "typescript": "^5.8.2",
65
- "@ac1/core": "0.1.1",
66
- "@ac1/iso": "0.1.1"
69
+ "@ac1/iso": "0.1.1",
70
+ "@ac1/core": "0.1.1"
67
71
  },
68
72
  "publishConfig": {
69
73
  "access": "public"