@adaptive-ai/sdk 0.0.9 → 0.1.2

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,102 +1,36 @@
1
- import { MutationFunction, UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
1
+ // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- declare const AuthProvider: {
4
- readonly GITHUB_USER: "GITHUB_USER";
5
- readonly GITHUB_BOT: "GITHUB_BOT";
6
- readonly GOOGLE: "GOOGLE";
7
- readonly AC1: "AC1";
8
- readonly SLACK: "SLACK";
9
- readonly SLACK_BOT: "SLACK_BOT";
10
- readonly DISCORD: "DISCORD";
11
- readonly NOTION: "NOTION";
12
- readonly TWITTER: "TWITTER";
13
- readonly LINKEDIN: "LINKEDIN";
14
- readonly YAHOO: "YAHOO";
15
- readonly FIGMA: "FIGMA";
16
- };
17
- type AuthProvider = (typeof AuthProvider)[keyof typeof AuthProvider];
18
- type ProviderInput = {
19
- provider: AuthProvider;
20
- scope?: string[];
21
- redirectUri?: string;
22
- };
23
- type RedirectInput = {
24
- email: string;
25
- provider: 'AC1';
26
- phoneNumber: null | undefined;
27
- } | {
28
- phoneNumber: string;
29
- provider: 'AC1';
30
- email: null | undefined;
31
- } | ProviderInput;
32
- type AuthenticatedResult = {
33
- userId: string;
34
- signIn: (i?: RedirectInput) => void;
35
- status: 'authenticated';
36
- providers: AuthProvider[];
37
- };
38
- type UnauthenticatedResult = {
39
- userId: null;
40
- signIn: (i?: RedirectInput) => void;
41
- status: 'unauthenticated';
42
- providers: [];
43
- };
44
- type LoadingAuthResult = {
45
- userId: undefined;
46
- signIn: (i?: RedirectInput) => void;
47
- status: 'loading';
48
- providers: [];
49
- };
50
- declare global {
51
- interface EmailHandlerInput {
52
- subject: string;
53
- body: string;
54
- fromUserId: string;
55
- }
56
- interface Window {
57
- __VERSION_ID__?: string;
58
- __APP_ID__: string;
59
- __IS_TESTING__: boolean;
60
- __ROOT_URL__: string;
61
- __BASE_URL__: string;
62
- __REALTIME_DOMAIN__: string;
63
- __OPEN_AUTH_DRAWER__: (url: string) => void;
64
- }
65
- }
3
+ import { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
66
4
 
67
- declare function encodeFileAsBase64DataURL(file: File): Promise<string>;
68
- declare function initializeClientEnvironment({ appId, rootUrl, baseUrl, versionId, isTesting, realtimeDomain, }: {
69
- appId: string;
70
- rootUrl: string;
71
- baseUrl: string;
72
- versionId?: string;
73
- isTesting: boolean;
74
- realtimeDomain: string;
75
- }): void;
76
- declare function useRedirectToLogin(): {
77
- redirectToLogin: (input?: {
78
- email?: string;
79
- }) => void;
80
- };
81
- declare function useAuth(input: {
82
- required: true;
83
- }): AuthenticatedResult | LoadingAuthResult;
84
- declare function useAuth(input: {
85
- required: false;
86
- }): AuthenticatedResult | UnauthenticatedResult | LoadingAuthResult;
87
- declare function useAuth(): AuthenticatedResult | UnauthenticatedResult | LoadingAuthResult;
88
- declare function getBaseUrl(): string;
89
- declare function connectToRealtimeStore<T extends object>({ channelId, initialData, broadcastOnly, onUpdate, }: {
90
- channelId: string;
91
- initialData: T;
92
- broadcastOnly?: boolean;
93
- onUpdate?: (data: T) => void;
5
+ export declare function connectToRealtimeStore<T extends object>({ channelId, initialData, broadcastOnly, onUpdate, }: {
6
+ channelId: string;
7
+ initialData: T;
8
+ broadcastOnly?: boolean;
9
+ onUpdate?: (data: T) => void;
94
10
  }): Promise<{
95
- getData(): T;
96
- setData(data: T): void;
97
- destroy(): void;
11
+ getData(): T;
12
+ setData(data: T): void;
13
+ destroy(): void;
98
14
  }>;
99
- declare function useRealtimeStore<T extends object>(channelId: string | null, initialData: T): readonly [T | undefined, (data: T) => void];
100
- declare function useRealtimeMutation<TData extends object, TError = unknown, TVariables = void, TContext = unknown>(fn: MutationFunction<TData, TVariables>, opts?: Omit<UseMutationOptions<TData, TError, TVariables, TContext>, 'mutationFn'>): UseMutationResult<TData, TError, TVariables, TContext>;
15
+ export declare function useRealtimeStore<T extends object>(channelId: string | null, initialData: T): readonly [
16
+ T | undefined,
17
+ (data: T) => void
18
+ ];
19
+ export declare function useRealtimeMutation<TData extends object, TError = unknown, TVariables = void, TContext = unknown>(opts: UseMutationOptions<TData, TError, TVariables, TContext>): UseMutationResult<TData, TError, TVariables, TContext>;
20
+ export declare function apiClient<T extends object>(): {
21
+ $abort: (promise: Promise<any>) => void;
22
+ } & {
23
+ [K in keyof T]: T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends (...args: any[]) => Promise<any> ? T_1 : T_1 extends (...args: infer A) => infer R ? (...args: A) => Promise<R> : T_1 : never : never;
24
+ };
25
+ export declare function encodeFileAsBase64DataURL(file: File): Promise<string>;
26
+ export declare function initializeClientEnvironment({ appId, rootUrl, baseUrl, isTesting, realtimeDomain, boxId, }: {
27
+ appId: string;
28
+ rootUrl: string;
29
+ baseUrl: string;
30
+ isTesting: boolean;
31
+ realtimeDomain: string;
32
+ boxId: string;
33
+ }): void;
34
+ export declare function getBaseUrl(): string;
101
35
 
102
- export { connectToRealtimeStore, encodeFileAsBase64DataURL, getBaseUrl, initializeClientEnvironment, useAuth, useRealtimeMutation, useRealtimeStore, useRedirectToLogin };
36
+ export {};
@@ -1,8 +1,8 @@
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=globalThis.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 globalThis.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(globalThis.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=globalThis.document.createElementNS("http://www.w3.org/2000/svg","svg"),S=new globalThis.Image;v.impl.options.useCredentials&&(S.crossOrigin="use-credentials"),S.onload=function(){globalThis.document.body.removeChild(A),globalThis.window&&globalThis.window.requestAnimationFrame?globalThis.window.requestAnimationFrame(function(){y(S);}):y(S);},S.onerror=g=>{globalThis.document.body.removeChild(A),b(g);},A.appendChild(S),S.src=s,globalThis.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)||globalThis.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(globalThis.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,(globalThis.Node===void 0?void 0:globalThis.Node.ELEMENT_NODE)||1),r=(a===void 0?void 0:a.getComputedStyle)||(globalThis.window===void 0?void 0:globalThis.window.getComputedStyle)||globalThis.getComputedStyle,i=(a===void 0?void 0:a.atob)||(globalThis.window===void 0?void 0:globalThis.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=globalThis.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 globalThis.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),globalThis.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&&(globalThis.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=globalThis.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=globalThis.document.createElement("style"),R.appendChild(M),M.appendChild(globalThis.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=globalThis.document.characterSet||"UTF-8",P=(P=globalThis.document.doctype)?(`<!DOCTYPE ${x(P.name)} ${x(P.publicId)} `+x(P.systemId)).trim()+">":"",(w=globalThis.document.createElement("iframe")).id="domtoimage-sandbox-"+o.uid(),w.style.top="-9999px",w.style.visibility="hidden",w.style.position="fixed",globalThis.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=globalThis.document.createElement("meta");D.setAttribute("charset",U);try{var Q=globalThis.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=globalThis.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 globalThis.window<"u"&&o===globalThis.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 globalThis.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 globalThis.window<"u",Rt=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Ve=tt&&globalThis.window.cordova&&globalThis.window.cordova.require&&globalThis.window.cordova.require("cordova/modulemapper"),En=(tt||Rt)&&(Ve&&Ve.getOriginalSymbol(globalThis.window,"File")||typeof File<"u"&&File),Ct=(tt||Rt)&&(Ve&&Ve.getOriginalSymbol(globalThis.window,"FileReader")||typeof globalThis.FileReader<"u"&&globalThis.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 globalThis.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)||globalThis.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=globalThis.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 globalThis.document<"u"&&"ontouchend"in globalThis.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=`
1
+ import {useRef,useState,useEffect,useCallback}from'react';import {useMutation}from'@tanstack/react-query';import {identity}from'lodash';import {nanoid}from'nanoid';import mt from'superjson';import {rpcClient,RpcError}from'typed-rpc';var An=Object.create;var bt=Object.defineProperty;var vn=Object.getOwnPropertyDescriptor;var wn=Object.getOwnPropertyNames;var bn=Object.getPrototypeOf,_n=Object.prototype.hasOwnProperty;var Je=(a,o)=>()=>(o||a((o={exports:{}}).exports,o),o.exports);var En=(a,o,I,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of wn(o))!_n.call(a,e)&&e!==I&&bt(a,e,{get:()=>o[e],enumerable:!(c=vn(o,e))||c.enumerable});return a};var _t=(a,o,I)=>(I=a!=null?An(bn(a)):{},En(bt(I,"default",{value:a,enumerable:true}),a));var Dt=Je((nt,rt)=>{(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(_){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);_(new Blob([g],{type:"image/png"}));}))(s)},resolveUrl:function(s,y){var _=globalThis.document.implementation.createHTMLDocument(),A=_.createElement("base"),S=(_.head.appendChild(A),_.createElement("a"));return _.body.appendChild(S),A.href=y,S.href=s,S.href},getAndEncode:function(s){let y=v.impl.urlCache.find(function(_){return _.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(_){let A=new XMLHttpRequest;function S(M){console.error(M),_("");}function g(){var M=v.impl.options.imagePlaceholder;M?_(M):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 M=A.status;if(M===0&&s.toLowerCase().startsWith("file://")||200<=M&&M<=300&&A.response!==null){M=A.response,M instanceof Blob||S("Expected response to be a Blob, but got: "+typeof M);let U=new globalThis.FileReader;U.onloadend=function(){var x=U.result;_(x);};try{U.readAsDataURL(M);}catch(x){S("Failed to read the response as Data URL: "+x.toString());}}else g();}},0<v.impl.options.useCredentialsFilters.length&&(v.impl.options.useCredentials=0<v.impl.options.useCredentialsFilters.filter(M=>0<=s.search(M)).length),v.impl.options.useCredentials&&(A.withCredentials=true),v.impl.options.corsImg&&s.indexOf("http")===0&&s.indexOf(globalThis.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 M=false,U=v.impl.options.corsImg.headers||{},x=(Object.keys(U).forEach(function(N){U[N].indexOf("application/json")!==-1&&(M=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(x).forEach(function(N){typeof x[N]=="string"&&(x[N]=x[N].replace("#{cors}",s));}),A.responseType="blob",A.send(M?JSON.stringify(x):x);}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=[],_=s.length;for(let A=0;A<_;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,_){let A=globalThis.document.createElementNS("http://www.w3.org/2000/svg","svg"),S=new globalThis.Image;v.impl.options.useCredentials&&(S.crossOrigin="use-credentials"),S.onload=function(){globalThis.document.body.removeChild(A),globalThis.window&&globalThis.window.requestAnimationFrame?globalThis.window.requestAnimationFrame(function(){y(S);}):y(S);},S.onerror=g=>{globalThis.document.body.removeChild(A),_(g);},A.appendChild(S),S.src=s,globalThis.document.body.appendChild(A);}):Promise.resolve()},width:function(s){var y=b(s,"width");if(!isNaN(y))return y;var y=b(s,"border-left-width"),_=b(s,"border-right-width");return s.scrollWidth+y+_},height:function(s){var y=b(s,"height");if(!isNaN(y))return y;var y=b(s,"border-top-width"),_=b(s,"border-bottom-width");return s.scrollHeight+y+_},getWindow:p,isElement:u,isElementHostForOpenShadowRoot:function(s){return u(s)&&s.shadowRoot!==null},isShadowRoot:O,isInShadowRoot:f,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 f(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)||globalThis.window||a}function O(s){return s instanceof p(s).ShadowRoot}function f(s){return s!=null&&s.getRootNode!==void 0&&O(s.getRootNode())}function u(s){return s instanceof p(s).Element}function b(s,y){if(s.nodeType===E){let _=r(s).getPropertyValue(y);if(_.slice(-2)==="px")return _=_.slice(0,-2),parseFloat(_)}return NaN}})(),I=(()=>{let R=/url\(\s*(["']?)((?:\\.|[^\\)])+)\1\s*\)/gm;return {inlineAll:function(b,s,y){return p(b)?Promise.resolve(b).then(O).then(function(_){let A=Promise.resolve(b);return _.forEach(function(S){A=A.then(function(g){return u(g,S,s,y)});}),A}):Promise.resolve(b)},shouldProcess:p,impl:{readUrls:O,inline:u,urlAsRegex:f}};function p(b){return b.search(R)!==-1}function O(b){for(var s,y=[];(s=R.exec(b))!==null;)y.push(s[2]);return y.filter(function(_){return !o.isDataUrl(_)})}function f(b){return new RegExp(`url\\((["']?)(${o.escape(b)})\\1\\)`,"gm")}function u(b,s,y,_){return Promise.resolve(s).then(function(A){return y?o.resolveUrl(A,y):A}).then(_||o.getAndEncode).then(function(A){var S=f(s);return b.replace(S,`url($1${A}$1)`)})}})(),c={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(globalThis.document.styleSheets)).then(function(p){let O=[];return p.forEach(function(f){var u=Object.getPrototypeOf(f);if(Object.prototype.hasOwnProperty.call(u,"cssRules"))try{o.asArray(f.cssRules||[]).forEach(O.push.bind(O));}catch(b){console.error("domtoimage: Error while reading CSS rules from: "+f.href,b.toString());}}),O}).then(function(p){return p.filter(function(O){return O.type===CSSRule.FONT_FACE_RULE}).filter(function(O){return I.shouldProcess(O.style.getPropertyValue("src"))})}).then(function(p){return p.map(R)});function R(p){return {resolve:function(){var O=(p.parentStyleSheet||{}).href;return I.inlineAll(p.cssText,O)},src:function(){return p.style.getPropertyValue("src")}}}}let t={inlineAll:function R(p){if(!o.isElement(p))return Promise.resolve(p);return O(p).then(function(){return o.isHTMLImageElement(p)?m(p).inline():Promise.all(o.asArray(p.childNodes).map(function(f){return R(f)}))});function O(f){let u=["background","background-image"],b=u.map(function(s){let y=f.style.getPropertyValue(s),_=f.style.getPropertyPriority(s);return y?I.inlineAll(y).then(function(A){f.style.setProperty(s,A,_);}):Promise.resolve()});return Promise.all(b).then(function(){return f})}},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(O){return new Promise(function(f){R.onload=f,R.onerror=f,R.src=O;})})}}}let l={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(O){return O.toDataURL()})},toJpeg:function(R,p){return h(R,p).then(function(O){return O.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(O){return O.getContext("2d").getImageData(0,0,o.width(R),o.height(R)).data})},toCanvas:h,impl:{fontFaces:c,images:t,util:o,inliner:I,urlCache:[],options:{},copyOptions:function(R){R.copyDefaultStyles===void 0?v.impl.options.copyDefaultStyles=l.copyDefaultStyles:v.impl.options.copyDefaultStyles=R.copyDefaultStyles,v.impl.options.imagePlaceholder=(R.imagePlaceholder===void 0?l:R).imagePlaceholder,v.impl.options.cacheBust=(R.cacheBust===void 0?l:R).cacheBust,v.impl.options.corsImg=(R.corsImg===void 0?l:R).corsImg,v.impl.options.useCredentials=(R.useCredentials===void 0?l:R).useCredentials,v.impl.options.useCredentialsFilters=(R.useCredentialsFilters===void 0?l:R).useCredentialsFilters,v.impl.options.httpTimeout=(R.httpTimeout===void 0?l:R).httpTimeout,v.impl.options.styleCaching=(R.styleCaching===void 0?l:R).styleCaching;}}},E=(typeof nt=="object"&&typeof rt=="object"?rt.exports=v:a.domtoimage=v,(globalThis.Node===void 0?void 0:globalThis.Node.ELEMENT_NODE)||1),r=(a===void 0?void 0:a.getComputedStyle)||(globalThis.window===void 0?void 0:globalThis.window.getComputedStyle)||globalThis.getComputedStyle,i=(a===void 0?void 0:a.atob)||(globalThis.window===void 0?void 0:globalThis.window.atob)||globalThis.atob;function n(R,p){v.impl.util.getWindow(R);let f=(p=p||{},v.impl.copyOptions(p),[]);return Promise.resolve(R).then(function(u){if(u.nodeType===E)return u;var b=u,s=globalThis.document.createElement("span");return b.replaceWith(s),s.append(u),f.push({child:b,wrapper:s}),s}).then(function(u){return function b(s,y,_,A){let S=y.filter;if(s===w||o.isHTMLScriptElement(s)||o.isHTMLStyleElement(s)||o.isHTMLLinkElement(s)||_!==null&&S&&!S(s))return Promise.resolve();return Promise.resolve(s).then(g).then(d).then(function(D){return x(D,U(s))}).then(M).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 M(D){return y.adjustClonedNode&&y.adjustClonedNode(s,D,true),Promise.resolve(D)}function U(D){return o.isElementHostForOpenShadowRoot(D)?D.shadowRoot:D}function x(D,Q){let k=K(Q),F=Promise.resolve();if(k.length!==0){let G=r($(Q));o.asArray(k).forEach(function(z){F=F.then(function(){return b(z,y,G).then(function(q){q&&D.appendChild(q);})});});}return F.then(function(){return D});function $(G){return o.isShadowRoot(G)?G.host:G}function K(G){if(o.isShadowSlotElement(G)){let z=G.assignedNodes();if(z&&0<z.length)return z}return G.childNodes}}function N(D,Q){return !o.isElement(D)||o.isShadowSlotElement(Q)?Promise.resolve(D):Promise.resolve().then(F).then($).then(K).then(G).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 F(){function z(V,W){W.font=V.font,W.fontFamily=V.fontFamily,W.fontFeatureSettings=V.fontFeatureSettings,W.fontKerning=V.fontKerning,W.fontSize=V.fontSize,W.fontStretch=V.fontStretch,W.fontStyle=V.fontStyle,W.fontVariant=V.fontVariant,W.fontVariantCaps=V.fontVariantCaps,W.fontVariantEastAsian=V.fontVariantEastAsian,W.fontVariantLigatures=V.fontVariantLigatures,W.fontVariantNumeric=V.fontVariantNumeric,W.fontVariationSettings=V.fontVariationSettings,W.fontWeight=V.fontWeight;}function q(V,W){let ie=r(V);ie.cssText?(W.style.cssText=ie.cssText,z(ie,W.style)):(T(y,V,ie,_,W),_===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");})));}q(Q,D);}function $(){let z=o.uid();function q(V){let W=r(Q,V),ie=W.getPropertyValue("content");if(ie!==""&&ie!=="none"){let Y=function(){let Z=`.${z}:`+V,ne=(W.cssText?oe:j)();return globalThis.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+" "+z),globalThis.document.createElement("style"));te.appendChild(Y()),D.appendChild(te);}}[":before",":after"].forEach(function(V){q(V);});}function K(){o.isHTMLTextAreaElement(Q)&&(D.innerHTML=Q.value),o.isHTMLInputElement(Q)&&D.setAttribute("value",Q.value);}function G(){o.isSVGElement(D)&&(D.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.isSVGRectElement(D))&&["width","height"].forEach(function(z){let q=D.getAttribute(z);q&&D.style.setProperty(z,q);});}}}(u,p,null)}).then(p.disableEmbedFonts?Promise.resolve(R):C).then(p.disableInlineImages?Promise.resolve(R):P).then(function(u){p.bgcolor&&(u.style.backgroundColor=p.bgcolor),p.width&&(u.style.width=p.width+"px"),p.height&&(u.style.height=p.height+"px"),p.style&&Object.keys(p.style).forEach(function(s){u.style[s]=p.style[s];});let b=null;return typeof p.onclone=="function"&&(b=p.onclone(u)),Promise.resolve(b).then(function(){return u})}).then(function(u){let b=p.width||o.width(R),s=p.height||o.height(R);return Promise.resolve(u).then(function(y){return y.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(y)}).then(o.escapeXhtml).then(function(y){var _=(o.isDimensionMissing(b)?' width="100%"':` width="${b}"`)+(o.isDimensionMissing(s)?' height="100%"':` height="${s}"`);return `<svg xmlns="http://www.w3.org/2000/svg"${(o.isDimensionMissing(b)?"":` width="${b}"`)+(o.isDimensionMissing(s)?"":` height="${s}"`)}><foreignObject${_}>${y}</foreignObject></svg>`}).then(function(y){return "data:image/svg+xml;charset=utf-8,"+y})}).then(function(u){for(;0<f.length;){var b=f.pop();b.wrapper.replaceWith(b.child);}return u}).then(function(u){return v.impl.urlCache=[],w&&(globalThis.document.body.removeChild(w),w=null),H&&clearTimeout(H),H=setTimeout(()=>{H=null,B={};},2e4),u})}function h(R,p){return n(R,p=p||{}).then(o.makeImage).then(function(O){var f=typeof p.scale!="number"?1:p.scale,u=((s,y)=>{let _=p.width||o.width(s),A=p.height||o.height(s);return o.isDimensionMissing(_)&&(_=o.isDimensionMissing(A)?300:2*A),o.isDimensionMissing(A)&&(A=_/2),(s=globalThis.document.createElement("canvas")).width=_*y,s.height=A*y,p.bgcolor&&((y=s.getContext("2d")).fillStyle=p.bgcolor,y.fillRect(0,0,s.width,s.height)),s})(R,f),b=u.getContext("2d");return b.msImageSmoothingEnabled=false,b.imageSmoothingEnabled=false,O&&(b.scale(f,f),b.drawImage(O,0,0)),u})}let w=null;function C(R){return c.resolveAll().then(function(p){var O;return p!==""&&(O=globalThis.document.createElement("style"),R.appendChild(O),O.appendChild(globalThis.document.createTextNode(p))),R})}function P(R){return t.inlineAll(R).then(function(){return R})}function T(R,p,O,f,u){let b=v.impl.options.copyDefaultStyles?((y,_)=>{var A,S=(M=>(y.styleCaching!=="relaxed"?M:M.filter((U,x,N)=>x===0||x===N.length-1)).join(">"))(_=(M=>{var U=[];do if(M.nodeType===E){var x=M.tagName;if(U.push(x),L.includes(x))break}while(M=M.parentNode);return U})(_));{if(B[S])return B[S];_=((M,U)=>{let x=M.body;do{var N=U.pop(),N=M.createElement(N);x.appendChild(N),x=N;}while(0<U.length);return x.textContent="\u200B",x})((A=(()=>{if(w)return w.contentWindow;U=globalThis.document.characterSet||"UTF-8",M=(M=globalThis.document.doctype)?(`<!DOCTYPE ${F(M.name)} ${F(M.publicId)} `+F(M.systemId)).trim()+">":"",(w=globalThis.document.createElement("iframe")).id="domtoimage-sandbox-"+o.uid(),w.style.top="-9999px",w.style.visibility="hidden",w.style.position="fixed",globalThis.document.body.appendChild(w);var M,U,x=w,N="domtoimage-sandbox";try{return x.contentWindow.document.write(M+`<html><head><meta charset='${U}'><title>${N}</title></head><body></body></html>`),x.contentWindow}catch{}var D=globalThis.document.createElement("meta");D.setAttribute("charset",U);try{var Q=globalThis.document.implementation.createHTMLDocument(N),k=(Q.head.appendChild(D),M+Q.documentElement.outerHTML);return x.setAttribute("srcdoc",k),x.contentWindow}catch{}return x.contentDocument.head.appendChild(D),x.contentDocument.title=N,x.contentWindow;function F($){var K;return $?((K=globalThis.document.createElement("div")).innerText=$,K.innerHTML):""}})()).document,_),A=((M,U)=>{let x={},N=M.getComputedStyle(U);return o.asArray(N).forEach(function(D){x[D]=D==="width"||D==="height"?"auto":N.getPropertyValue(D);}),x})(A,_);var g=_;do{var d=g.parentElement;d!==null&&d.removeChild(g),g=d;}while(g&&g.tagName!=="BODY");return B[S]=A}})(R,p):{},s=u.style;o.asArray(O).forEach(function(y){var _,A,S,g;R.filterStyles&&!R.filterStyles(p,y)||(A=O.getPropertyValue(y),S=b[y],_=f?f.getPropertyValue(y):void 0,s.getPropertyValue(y))||(A!==S||f&&A!==_)&&(S=O.getPropertyPriority(y),_=s,A=A,S=S,g=0<=["background-clip"].indexOf(y=y),S?(_.setProperty(y,A,S),g&&_.setProperty("-webkit-"+y,A,S)):(_.setProperty(y,A),g&&_.setProperty("-webkit-"+y,A)));});}let H=null,B={},L=["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"];})(nt);});var Ft=Je(()=>{});var rn=Je((Sr,nn)=>{var ht=typeof Map=="function"&&Map.prototype,ot=Object.getOwnPropertyDescriptor&&ht?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ke=ht&&ot&&typeof ot.get=="function"?ot.get:null,Bt=ht&&Map.prototype.forEach,pt=typeof Set=="function"&&Set.prototype,it=Object.getOwnPropertyDescriptor&&pt?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Xe=pt&&it&&typeof it.get=="function"?it.get:null,Ht=pt&&Set.prototype.forEach,Mn=typeof WeakMap=="function"&&WeakMap.prototype,Be=Mn?WeakMap.prototype.has:null,Pn=typeof WeakSet=="function"&&WeakSet.prototype,He=Pn?WeakSet.prototype.has:null,Ln=typeof WeakRef=="function"&&WeakRef.prototype,kt=Ln?WeakRef.prototype.deref:null,Dn=Boolean.prototype.valueOf,Fn=Object.prototype.toString,Bn=Function.prototype.toString,Hn=String.prototype.match,gt=String.prototype.slice,Ee=String.prototype.replace,kn=String.prototype.toUpperCase,Nt=String.prototype.toLowerCase,Xt=RegExp.prototype.test,Qt=Array.prototype.concat,Ae=Array.prototype.join,Nn=Array.prototype.slice,$t=Math.floor,lt=typeof BigInt=="function"?BigInt.prototype.valueOf:null,at=Object.getOwnPropertySymbols,ct=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ke=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Pe||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 zt(a,o){if(a===1/0||a===-1/0||a!==a||a&&a>-1e3&&a<1e3||Xt.call(/e/,o))return o;var I=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof a=="number"){var c=a<0?-$t(-a):$t(a);if(c!==a){var e=String(c),t=gt.call(o,e.length+1);return Ee.call(e,I,"$&_")+"."+Ee.call(Ee.call(t,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Ee.call(o,I,"$&_")}var ut=Ft(),Vt=ut.custom,Gt=jt(Vt)?Vt:null,Zt={__proto__:null,double:'"',single:"'"},Qn={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};nn.exports=function a(o,I,c,e){var t=I||{};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 l=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 l?zt(o,v):v}if(typeof o=="bigint"){var E=String(o)+"n";return l?zt(o,E):E}var r=typeof t.depth>"u"?5:t.depth;if(typeof c>"u"&&(c=0),c>=r&&r>0&&typeof o=="object")return ft(o)?"[Array]":"[Object]";var i=ir(t,c);if(typeof e>"u")e=[];else if(en(e,o)>=0)return "[Circular]";function n(_,A,S){if(A&&(e=Nn.call(e),e.push(A)),S){var g={depth:t.depth};return we(t,"quoteStyle")&&(g.quoteStyle=t.quoteStyle),a(_,g,c+1,e)}return a(_,t,c+1,e)}if(typeof o=="function"&&!qt(o)){var h=Yn(o),w=qe(o,n);return "[Function"+(h?": "+h:" (anonymous)")+"]"+(w.length>0?" { "+Ae.call(w,", ")+" }":"")}if(jt(o)){var C=Pe?Ee.call(String(o),/^(Symbol\(.*\))_[^)]*$/,"$1"):ct.call(o);return typeof o=="object"&&!Pe?Fe(C):C}if(nr(o)){for(var P="<"+Nt.call(String(o.nodeName)),T=o.attributes||[],H=0;H<T.length;H++)P+=" "+T[H].name+"="+Jt($n(T[H].value),"double",t);return P+=">",o.childNodes&&o.childNodes.length&&(P+="..."),P+="</"+Nt.call(String(o.nodeName))+">",P}if(ft(o)){if(o.length===0)return "[]";var B=qe(o,n);return i&&!or(B)?"["+dt(B,i)+"]":"[ "+Ae.call(B,", ")+" ]"}if(zn(o)){var L=qe(o,n);return !("cause"in Error.prototype)&&"cause"in o&&!Yt.call(o,"cause")?"{ ["+String(o)+"] "+Ae.call(Qt.call("[cause]: "+n(o.cause),L),", ")+" }":L.length===0?"["+String(o)+"]":"{ ["+String(o)+"] "+Ae.call(L,", ")+" }"}if(typeof o=="object"&&m){if(Gt&&typeof o[Gt]=="function"&&ut)return ut(o,{depth:r-c});if(m!=="symbol"&&typeof o.inspect=="function")return o.inspect()}if(Zn(o)){var R=[];return Bt&&Bt.call(o,function(_,A){R.push(n(A,o,true)+" => "+n(_,o));}),Kt("Map",Ke.call(o),R,i)}if(er(o)){var p=[];return Ht&&Ht.call(o,function(_){p.push(n(_,o));}),Kt("Set",Xe.call(o),p,i)}if(Jn(o))return st("WeakMap");if(tr(o))return st("WeakSet");if(jn(o))return st("WeakRef");if(Gn(o))return Fe(n(Number(o)));if(Kn(o))return Fe(n(lt.call(o)));if(qn(o))return Fe(Dn.call(o));if(Vn(o))return Fe(n(String(o)));if(typeof globalThis.window<"u"&&o===globalThis.window)return "{ [object Window] }";if(typeof globalThis<"u"&&o===globalThis||typeof global<"u"&&o===global)return "{ [object globalThis] }";if(!Wn(o)&&!qt(o)){var O=qe(o,n),f=Wt?Wt(o)===Object.prototype:o instanceof Object||o.constructor===Object,u=o instanceof Object?"":"null prototype",b=!f&&ke&&Object(o)===o&&ke in o?gt.call(Se(o),8,-1):u?"Object":"",s=f||typeof o.constructor!="function"?"":o.constructor.name?o.constructor.name+" ":"",y=s+(b||u?"["+Ae.call(Qt.call([],b||[],u||[]),": ")+"] ":"");return O.length===0?y+"{}":i?y+"{"+dt(O,i)+"}":y+"{ "+Ae.call(O,", ")+" }"}return String(o)};function Jt(a,o,I){var c=I.quoteStyle||o,e=Zt[c];return e+a+e}function $n(a){return Ee.call(String(a),/"/g,"&quot;")}function Oe(a){return !ke||!(typeof a=="object"&&(ke in a||typeof a[ke]<"u"))}function ft(a){return Se(a)==="[object Array]"&&Oe(a)}function Wn(a){return Se(a)==="[object Date]"&&Oe(a)}function qt(a){return Se(a)==="[object RegExp]"&&Oe(a)}function zn(a){return Se(a)==="[object Error]"&&Oe(a)}function Vn(a){return Se(a)==="[object String]"&&Oe(a)}function Gn(a){return Se(a)==="[object Number]"&&Oe(a)}function qn(a){return Se(a)==="[object Boolean]"&&Oe(a)}function jt(a){if(Pe)return a&&typeof a=="object"&&a instanceof Symbol;if(typeof a=="symbol")return true;if(!a||typeof a!="object"||!ct)return false;try{return ct.call(a),!0}catch{}return false}function Kn(a){if(!a||typeof a!="object"||!lt)return false;try{return lt.call(a),!0}catch{}return false}var Xn=Object.prototype.hasOwnProperty||function(a){return a in this};function we(a,o){return Xn.call(a,o)}function Se(a){return Fn.call(a)}function Yn(a){if(a.name)return a.name;var o=Hn.call(Bn.call(a),/^function\s*([\w$]+)/);return o?o[1]:null}function en(a,o){if(a.indexOf)return a.indexOf(o);for(var I=0,c=a.length;I<c;I++)if(a[I]===o)return I;return -1}function Zn(a){if(!Ke||!a||typeof a!="object")return false;try{Ke.call(a);try{Xe.call(a);}catch{return !0}return a instanceof Map}catch{}return false}function Jn(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 jn(a){if(!kt||!a||typeof a!="object")return false;try{return kt.call(a),!0}catch{}return false}function er(a){if(!Xe||!a||typeof a!="object")return false;try{Xe.call(a);try{Ke.call(a);}catch{return !0}return a instanceof Set}catch{}return false}function tr(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 nr(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 I=a.length-o.maxStringLength,c="... "+I+" more character"+(I>1?"s":"");return tn(gt.call(a,0,o.maxStringLength),o)+c}var e=Qn[o.quoteStyle||"single"];e.lastIndex=0;var t=Ee.call(Ee.call(a,e,"\\$1"),/[\x00-\x1f]/g,rr);return Jt(t,"single",o)}function rr(a){var o=a.charCodeAt(0),I={8:"b",9:"t",10:"n",12:"f",13:"r"}[o];return I?"\\"+I:"\\x"+(o<16?"0":"")+kn.call(o.toString(16))}function Fe(a){return "Object("+a+")"}function st(a){return a+" { ? }"}function Kt(a,o,I,c){var e=c?dt(I,c):Ae.call(I,", ");return a+" ("+o+") {"+e+"}"}function or(a){for(var o=0;o<a.length;o++)if(en(a[o],`
3
+ `)>=0)return false;return true}function ir(a,o){var I;if(a.indent===" ")I=" ";else if(typeof a.indent=="number"&&a.indent>0)I=Ae.call(Array(a.indent+1)," ");else return null;return {base:I,prev:Ae.call(Array(o+1),I)}}function dt(a,o){if(a.length===0)return "";var I=`
4
+ `+o.prev+o.base;return I+Ae.call(a,","+I)+`
5
+ `+o.prev}function qe(a,o){var I=ft(a),c=[];if(I){c.length=a.length;for(var e=0;e<a.length;e++)c[e]=we(a,e)?o(a[e],a):"";}var t=typeof at=="function"?at(a):[],m;if(Pe){m={};for(var l=0;l<t.length;l++)m["$"+t[l]]=t[l];}for(var v in a)we(a,v)&&(I&&String(Number(v))===v&&v<a.length||Pe&&m["$"+v]instanceof Symbol||(Xt.call(/[^\w$]/,v)?c.push(o(v,a)+": "+o(a[v],a)):c.push(v+": "+o(a[v],a))));if(typeof at=="function")for(var E=0;E<t.length;E++)Yt.call(a,t[E])&&c.push("["+o(t[E])+"]: "+o(a[t[E]],a));return c}});function Sn(a,o){return o.forEach(function(I){I&&typeof I!="string"&&!Array.isArray(I)&&Object.keys(I).forEach(function(c){if(c!=="default"&&!(c in a)){var e=Object.getOwnPropertyDescriptor(I,c);Object.defineProperty(a,c,e.get?e:{enumerable:true,get:function(){return I[c]}});}});}),Object.freeze(a)}function St(a,o){return new Promise(function(I,c){let e;return Tn(a).then(function(t){try{return e=t,I(new Blob([o.slice(0,2),e,o.slice(2)],{type:"image/jpeg"}))}catch(m){return c(m)}},c)})}var Tn=a=>new Promise((o,I)=>{let c=new globalThis.FileReader;c.addEventListener("load",({target:{result:e}})=>{let t=new DataView(e),m=0;if(t.getUint16(m)!==65496)return I("not a valid JPEG");for(m+=2;;){let l=t.getUint16(m);if(l===65498)break;let v=t.getUint16(m+2);if(l===65505&&t.getUint32(m+4)===1165519206){let E=m+10,r;switch(t.getUint16(E)){case 18761:r=true;break;case 19789:r=false;break;default:return I("TIFF header contains invalid endian")}if(t.getUint16(E+2,r)!==42)return I("TIFF header contains invalid version");let i=t.getUint32(E+4,r),n=E+i+2+12*t.getUint16(E+i,r);for(let h=E+i+2;h<n;h+=12)if(t.getUint16(h,r)==274){if(t.getUint16(h+2,r)!==3)return I("Orientation data type is invalid");if(t.getUint32(h+4,r)!==1)return I("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)}),c.readAsArrayBuffer(a);}),$e={},In={get exports(){return $e},set exports(a){$e=a;}};(function(a){var o,I,c={};In.exports=c,c.parse=function(e,t){for(var m=c.bin.readUshort,l=c.bin.readUint,v=0,E={},r=new Uint8Array(e),i=r.length-4;l(r,i)!=101010256;)i--;v=i,v+=4;var n=m(r,v+=4);m(r,v+=2);var h=l(r,v+=2),w=l(r,v+=4);v+=4,v=w;for(var C=0;C<n;C++){l(r,v),v+=4,v+=4,v+=4,l(r,v+=4),h=l(r,v+=4);var P=l(r,v+=4),T=m(r,v+=4),H=m(r,v+2),B=m(r,v+4);v+=6;var L=l(r,v+=8);v+=4,v+=T+H+B,c._readLocal(r,L,E,h,P,t);}return E},c._readLocal=function(e,t,m,l,v,E){var r=c.bin.readUshort,i=c.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 C=c.bin.readUTF8(e,t,h);if(t+=h,t+=w,E)m[C]={size:v,csize:l};else {var P=new Uint8Array(e.buffer,t);if(n==0)m[C]=new Uint8Array(P.buffer.slice(t,t+l));else {if(n!=8)throw "unknown compression method: "+n;var T=new Uint8Array(v);c.inflateRaw(P,T),m[C]=T;}}},c.inflateRaw=function(e,t){return c.F.inflate(e,t)},c.inflate=function(e,t){return e[0],e[1],c.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),t)},c.deflate=function(e,t){t==null&&(t={level:6});var m=0,l=new Uint8Array(50+Math.floor(1.1*e.length));l[m]=120,l[m+1]=156,m+=2,m=c.F.deflateRaw(e,l,m,t.level);var v=c.adler(e,0,e.length);return l[m+0]=v>>>24&255,l[m+1]=v>>>16&255,l[m+2]=v>>>8&255,l[m+3]=v>>>0&255,new Uint8Array(l.buffer,0,m+4)},c.deflateRaw=function(e,t){t==null&&(t={level:6});var m=new Uint8Array(50+Math.floor(1.1*e.length)),l=c.F.deflateRaw(e,m,l,t.level);return new Uint8Array(m.buffer,0,l)},c.encode=function(e,t){t==null&&(t=false);var m=0,l=c.bin.writeUint,v=c.bin.writeUshort,E={};for(var r in e){var i=!c._noNeed(r)&&!t,n=e[r],h=c.crc.crc(n,0,n.length);E[r]={cpr:i,usize:n.length,crc:h,file:i?c.deflateRaw(n):n};}for(var r in E)m+=E[r].file.length+30+46+2*c.bin.sizeUTF8(r);m+=22;var w=new Uint8Array(m),C=0,P=[];for(var r in E){var T=E[r];P.push(C),C=c._writeHeader(w,C,r,T,0);}var H=0,B=C;for(var r in E)T=E[r],P.push(C),C=c._writeHeader(w,C,r,T,1,P[H++]);var L=C-B;return l(w,C,101010256),C+=4,v(w,C+=4,H),v(w,C+=2,H),l(w,C+=2,L),l(w,C+=4,B),C+=4,C+=2,w.buffer},c._noNeed=function(e){var t=e.split(".").pop().toLowerCase();return "png,jpg,jpeg,zip".indexOf(t)!=-1},c._writeHeader=function(e,t,m,l,v,E){var r=c.bin.writeUint,i=c.bin.writeUshort,n=l.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,l.cpr?8:0),r(e,t+=2,0),r(e,t+=4,l.crc),r(e,t+=4,n.length),r(e,t+=4,l.usize),i(e,t+=4,c.bin.sizeUTF8(m)),i(e,t+=2,0),t+=2,v==1&&(t+=2,t+=2,r(e,t+=6,E),t+=4),t+=c.bin.writeUTF8(e,t,m),v==0&&(e.set(n,t),t+=n.length),t},c.crc={table:function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var m=t,l=0;l<8;l++)1&m?m=3988292384^m>>>1:m>>>=1;e[t]=m;}return e}(),update:function(e,t,m,l){for(var v=0;v<l;v++)e=c.crc.table[255&(e^t[m+v])]^e>>>8;return e},crc:function(e,t,m){return 4294967295^c.crc.update(4294967295,e,t,m)}},c.adler=function(e,t,m){for(var l=1,v=0,E=t,r=t+m;E<r;){for(var i=Math.min(E+5552,r);E<i;)v+=l+=e[E++];l%=65521,v%=65521;}return v<<16|l},c.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 l="",v=0;v<m;v++)l+=String.fromCharCode(e[t+v]);return l},writeASCII:function(e,t,m){for(var l=0;l<m.length;l++)e[t+l]=m.charCodeAt(l);},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,m){for(var l,v="",E=0;E<m;E++)v+="%"+c.bin.pad(e[t+E].toString(16));try{l=decodeURIComponent(v);}catch{return c.bin.readASCII(e,t,m)}return l},writeUTF8:function(e,t,m){for(var l=m.length,v=0,E=0;E<l;E++){var r=m.charCodeAt(E);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,l=0;l<t;l++){var v=e.charCodeAt(l);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}},c.F={},c.F.deflateRaw=function(e,t,m,l){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]][l],E=c.F.U,r=c.F._goodIndex;c.F._hash;var i=c.F._putsE,n=0,h=m<<3,w=0,C=e.length;if(l==0){for(;n<C;)i(t,h,n+(s=Math.min(65535,C-n))==C?1:0),h=c.F._copyExact(e,n,s,t,h+8),n+=s;return h>>>3}var P=E.lits,T=E.strt,H=E.prev,B=0,L=0,R=0,p=0,O=0,f=0;for(C>2&&(T[f=c.F._hash(e,0)]=0),n=0;n<C;n++){if(O=f,n+1<C-2){f=c.F._hash(e,n+1);var u=n+1&32767;H[u]=T[f],T[f]=u;}if(w<=n){(B>14e3||L>26697)&&C-n>100&&(w<n&&(P[B]=n-w,B+=2,w=n),h=c.F._writeBlock(n==C-1||w==C?1:0,P,B,p,e,R,n-R,t,h),B=L=p=0,R=n);var b=0;n<C-2&&(b=c.F._bestMatch(e,n,H,O,Math.min(v[2],C-n),v[3]));var s=b>>>16,y=65535&b;if(b!=0){y=65535&b;var _=r(s=b>>>16,E.of0);E.lhst[257+_]++;var A=r(y,E.df0);E.dhst[A]++,p+=E.exb[_]+E.dxb[A],P[B]=s<<23|n-w,P[B+1]=y<<16|_<<8|A,B+=2,w=n+s;}else E.lhst[e[n]]++;L++;}}for(R==n&&e.length!=0||(w<n&&(P[B]=n-w,B+=2,w=n),h=c.F._writeBlock(1,P,B,p,e,R,n-R,t,h),B=0,L=0,B=L=p=0,R=n);(7&h)!=0;)h++;return h>>>3},c.F._bestMatch=function(e,t,m,l,v,E){var r=32767&t,i=m[r],n=r-i+32768&32767;if(i==r||l!=c.F._hash(e,t-n))return 0;for(var h=0,w=0,C=Math.min(32767,t);n<=C&&--E!=0&&i!=r;){if(h==0||e[t+h]==e[t+h-n]){var P=c.F._howLong(e,t,n);if(P>h){if(w=n,(h=P)>=v)break;n+2<P&&(P=n+2);for(var T=0,H=0;H<P-2;H++){var B=t-n+H+32768&32767,L=B-m[B]+32768&32767;L>T&&(T=L,i=B);}}}n+=(r=i)-(i=m[r])+32768&32767;}return h<<16|w},c.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 l=t,v=Math.min(e.length,t+258);for(t+=3;t<v&&e[t]==e[t-m];)t++;return t-l},c.F._hash=function(e,t){return (e[t]<<8|e[t+1])+(e[t+2]<<4)&65535},c.saved=0,c.F._writeBlock=function(e,t,m,l,v,E,r,i,n){var h,w,C,P,T,H,B,L,R,p=c.F.U,O=c.F._putsF,f=c.F._putsE;p.lhst[256]++,w=(h=c.F.getTrees())[0],C=h[1],P=h[2],T=h[3],H=h[4],B=h[5],L=h[6],R=h[7];var u=32+((n+3&7)==0?0:8-(n+3&7))+(r<<3),b=l+c.F.contSize(p.fltree,p.lhst)+c.F.contSize(p.fdtree,p.dhst),s=l+c.F.contSize(p.ltree,p.lhst)+c.F.contSize(p.dtree,p.dhst);s+=14+3*B+c.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 _=u<b&&u<s?0:b<s?1:2;if(O(i,n,e),O(i,n+1,_),n+=3,_==0){for(;(7&n)!=0;)n++;n=c.F._copyExact(v,E,r,i,n);}else {var A,S;if(_==1&&(A=p.fltree,S=p.fdtree),_==2){c.F.makeCodes(p.ltree,w),c.F.revCodes(p.ltree,w),c.F.makeCodes(p.dtree,C),c.F.revCodes(p.dtree,C),c.F.makeCodes(p.itree,P),c.F.revCodes(p.itree,P),A=p.ltree,S=p.dtree,f(i,n,T-257),f(i,n+=5,H-1),f(i,n+=5,B-4),n+=4;for(var g=0;g<B;g++)f(i,n+3*g,p.itree[1+(p.ordr[g]<<1)]);n+=3*B,n=c.F._codeTiny(L,p.itree,i,n),n=c.F._codeTiny(R,p.itree,i,n);}for(var d=E,M=0;M<m;M+=2){for(var U=t[M],x=U>>>23,N=d+(8388607&U);d<N;)n=c.F._writeLit(v[d++],A,i,n);if(x!=0){var D=t[M+1],Q=D>>16,k=D>>8&255,F=255&D;f(i,n=c.F._writeLit(257+k,A,i,n),x-p.of0[k]),n+=p.exb[k],O(i,n=c.F._writeLit(F,S,i,n),Q-p.df0[F]),n+=p.dxb[F],d+=x;}}n=c.F._writeLit(256,A,i,n);}return n},c.F._copyExact=function(e,t,m,l,v){var E=v>>>3;return l[E]=m,l[E+1]=m>>>8,l[E+2]=255-l[E],l[E+3]=255-l[E+1],E+=4,l.set(new Uint8Array(e.buffer,t,m),E),v+(m+4<<3)},c.F.getTrees=function(){for(var e=c.F.U,t=c.F._hufTree(e.lhst,e.ltree,15),m=c.F._hufTree(e.dhst,e.dtree,15),l=[],v=c.F._lenCodes(e.ltree,l),E=[],r=c.F._lenCodes(e.dtree,E),i=0;i<l.length;i+=2)e.ihst[l[i]]++;for(i=0;i<E.length;i+=2)e.ihst[E[i]]++;for(var n=c.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,l,E]},c.F.getSecond=function(e){for(var t=[],m=0;m<e.length;m+=2)t.push(e[m+1]);return t},c.F.nonZero=function(e){for(var t="",m=0;m<e.length;m+=2)e[m+1]!=0&&(t+=(m>>1)+",");return t},c.F.contSize=function(e,t){for(var m=0,l=0;l<t.length;l++)m+=t[l]*e[1+(l<<1)];return m},c.F._codeTiny=function(e,t,m,l){for(var v=0;v<e.length;v+=2){var E=e[v],r=e[v+1];l=c.F._writeLit(E,t,m,l);var i=E==16?2:E==17?3:7;E>15&&(c.F._putsE(m,l,r,i),l+=i);}return l},c.F._lenCodes=function(e,t){for(var m=e.length;m!=2&&e[m-1]==0;)m-=2;for(var l=0;l<m;l+=2){var v=e[l+1],E=l+3<m?e[l+3]:-1,r=l+5<m?e[l+5]:-1,i=l==0?-1:e[l-1];if(v==0&&E==v&&r==v){for(var n=l+5;n+2<m&&e[n+2]==v;)n+=2;(h=Math.min(n+1-l>>>1,138))<11?t.push(17,h-3):t.push(18,h-11),l+=2*h-2;}else if(v==i&&E==v&&r==v){for(n=l+5;n+2<m&&e[n+2]==v;)n+=2;var h=Math.min(n+1-l>>>1,6);t.push(16,h-3),l+=2*h-2;}else t.push(v,0);}return m>>>1},c.F._hufTree=function(e,t,m){var l=[],v=e.length,E=t.length,r=0;for(r=0;r<E;r+=2)t[r]=0,t[r+1]=0;for(r=0;r<v;r++)e[r]!=0&&l.push({lit:r,f:e[r]});var i=l.length,n=l.slice(0);if(i==0)return 0;if(i==1){var h=l[0].lit;return n=h==0?1:0,t[1+(h<<1)]=1,t[1+(n<<1)]=1,1}l.sort(function(L,R){return L.f-R.f});var w=l[0],C=l[1],P=0,T=1,H=2;for(l[0]={lit:-1,f:w.f+C.f,l:w,r:C,d:0};T!=i-1;)w=P!=T&&(H==i||l[P].f<l[H].f)?l[P++]:l[H++],C=P!=T&&(H==i||l[P].f<l[H].f)?l[P++]:l[H++],l[T++]={lit:-1,f:w.f+C.f,l:w,r:C};var B=c.F.setDepth(l[T-1],0);for(B>m&&(c.F.restrictDepth(n,m,B),B=m),r=0;r<i;r++)t[1+(n[r].lit<<1)]=n[r].d;return B},c.F.setDepth=function(e,t){return e.lit!=-1?(e.d=t,t):Math.max(c.F.setDepth(e.l,t+1),c.F.setDepth(e.r,t+1))},c.F.restrictDepth=function(e,t,m){var l=0,v=1<<m-t,E=0;for(e.sort(function(i,n){return n.d==i.d?i.f-n.f:n.d-i.d}),l=0;l<e.length&&e[l].d>t;l++){var r=e[l].d;e[l].d=t,E+=v-(1<<m-r);}for(E>>>=m-t;E>0;)(r=e[l].d)<t?(e[l].d++,E-=1<<t-r-1):l++;for(;l>=0;l--)e[l].d==t&&E<0&&(e[l].d--,E++);E!=0&&console.log("debt left");},c.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},c.F._writeLit=function(e,t,m,l){return c.F._putsF(m,l,t[e<<1]),l+t[1+(e<<1)]},c.F.inflate=function(e,t){var m=Uint8Array;if(e[0]==3&&e[1]==0)return t||new m(0);var l=c.F,v=l._bitsF,E=l._bitsE,r=l._decodeTiny,i=l.makeCodes,n=l.codes2map,h=l._get17,w=l.U,C=t==null;C&&(t=new m(e.length>>>2<<3));for(var P,T,H=0,B=0,L=0,R=0,p=0,O=0,f=0,u=0,b=0;H==0;)if(H=v(e,b,1),B=v(e,b+1,2),b+=3,B!=0){if(C&&(t=c.F._check(t,u+(1<<17))),B==1&&(P=w.flmap,T=w.fdmap,O=511,f=31),B==2){L=E(e,b,5)+257,R=E(e,b+5,5)+1,p=E(e,b+10,4)+4,b+=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 _=E(e,b+3*s,3);w.itree[1+(w.ordr[s]<<1)]=_,_>y&&(y=_);}b+=3*p,i(w.itree,y),n(w.itree,y,w.imap),P=w.lmap,T=w.dmap,b=r(w.imap,(1<<y)-1,L+R,e,b,w.ttree);var A=l._copyOut(w.ttree,0,L,w.ltree);O=(1<<A)-1;var S=l._copyOut(w.ttree,L,R,w.dtree);f=(1<<S)-1,i(w.ltree,A),n(w.ltree,A,P),i(w.dtree,S),n(w.dtree,S,T);}for(;;){var g=P[h(e,b)&O];b+=15&g;var d=g>>>4;if(!(d>>>8))t[u++]=d;else {if(d==256)break;var M=u+d-254;if(d>264){var U=w.ldef[d-257];M=u+(U>>>3)+E(e,b,7&U),b+=7&U;}var x=T[h(e,b)&f];b+=15&x;var N=x>>>4,D=w.ddef[N],Q=(D>>>4)+v(e,b,15&D);for(b+=15&D,C&&(t=c.F._check(t,u+(1<<17)));u<M;)t[u]=t[u++-Q],t[u]=t[u++-Q],t[u]=t[u++-Q],t[u]=t[u++-Q];u=M;}}}else {(7&b)!=0&&(b+=8-(7&b));var k=4+(b>>>3),F=e[k-4]|e[k-3]<<8;C&&(t=c.F._check(t,u+F)),t.set(new m(e.buffer,e.byteOffset+k,F),u),b=k+F<<3,u+=F;}return t.length==u?t:t.slice(0,u)},c.F._check=function(e,t){var m=e.length;if(t<=m)return e;var l=new Uint8Array(Math.max(m<<1,t));return l.set(e,0),l},c.F._decodeTiny=function(e,t,m,l,v,E){for(var r=c.F._bitsE,i=c.F._get17,n=0;n<m;){var h=e[i(l,v)&t];v+=15&h;var w=h>>>4;if(w<=15)E[n]=w,n++;else {var C=0,P=0;w==16?(P=3+r(l,v,2),v+=2,C=E[n-1]):w==17?(P=3+r(l,v,3),v+=3):w==18&&(P=11+r(l,v,7),v+=7);for(var T=n+P;n<T;)E[n]=C,n++;}}return v},c.F._copyOut=function(e,t,m,l){for(var v=0,E=0,r=l.length>>>1;E<m;){var i=e[E+t];l[E<<1]=0,l[1+(E<<1)]=i,i>v&&(v=i),E++;}for(;E<r;)l[E<<1]=0,l[1+(E<<1)]=0,E++;return v},c.F.makeCodes=function(e,t){for(var m,l,v,E,r=c.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,l=1;l<=t;l++)m=m+n[l-1]<<1,w[l]=m;for(v=0;v<i;v+=2)(E=e[v+1])!=0&&(e[v]=w[E],w[E]++);},c.F.codes2map=function(e,t,m){for(var l=e.length,v=c.F.U.rev15,E=0;E<l;E+=2)if(e[E+1]!=0)for(var r=E>>1,i=e[E+1],n=r<<4|i,h=t-i,w=e[E]<<h,C=w+(1<<h);w!=C;)m[v[w]>>>15-t]=n,w++;},c.F.revCodes=function(e,t){for(var m=c.F.U.rev15,l=15-t,v=0;v<e.length;v+=2){var E=e[v]<<t-e[v+1];e[v]=m[E]>>>l;}},c.F._putsE=function(e,t,m){m<<=7&t;var l=t>>>3;e[l]|=m,e[l+1]|=m>>>8;},c.F._putsF=function(e,t,m){m<<=7&t;var l=t>>>3;e[l]|=m,e[l+1]|=m>>>8,e[l+2]|=m>>>16;},c.F._bitsE=function(e,t,m){return (e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<m)-1},c.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},c.F._get17=function(e,t){return (e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},c.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)},c.F.U=(o=Uint16Array,I=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 I(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 I(286),dhst:new I(30),ihst:new I(19),lits:new I(15e3),strt:new o(65536),prev:new o(32768)}),function(){for(var e=c.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 l(v,E,r){for(;E--!=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];l(e.fltree,144,8),l(e.fltree,112,9),l(e.fltree,24,7),l(e.fltree,8,8),c.F.makeCodes(e.fltree,9),c.F.codes2map(e.fltree,9,e.flmap),c.F.revCodes(e.fltree,9),l(e.fdtree,32,5),c.F.makeCodes(e.fdtree,5),c.F.codes2map(e.fdtree,5,e.fdmap),c.F.revCodes(e.fdtree,5),l(e.itree,19,0),l(e.ltree,286,0),l(e.dtree,30,0),l(e.ttree,320,0);}();})();var Rn=Sn({__proto__:null,default:$e},[$e]),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 C=0;C<n;C++)w+=`%${a.pad(r[i+C].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,C=t(h),P=Math.ceil(i*C/8),T=new Uint8Array(4*w),H=new Uint32Array(T.buffer),{ctype:B}=h,{depth:L}=h,R=a.readUshort;if(B==6){let U=w<<2;if(L==8)for(var p=0;p<U;p+=4)T[p]=r[p],T[p+1]=r[p+1],T[p+2]=r[p+2],T[p+3]=r[p+3];if(L==16)for(p=0;p<U;p++)T[p]=r[p<<1];}else if(B==2){let U=h.tabs.tRNS;if(U==null){if(L==8)for(p=0;p<w;p++){var O=3*p;H[p]=255<<24|r[O+2]<<16|r[O+1]<<8|r[O];}if(L==16)for(p=0;p<w;p++)O=6*p,H[p]=255<<24|r[O+4]<<16|r[O+2]<<8|r[O];}else {var f=U[0];let x=U[1],N=U[2];if(L==8)for(p=0;p<w;p++){var u=p<<2;O=3*p,H[p]=255<<24|r[O+2]<<16|r[O+1]<<8|r[O],r[O]==f&&r[O+1]==x&&r[O+2]==N&&(T[u+3]=0);}if(L==16)for(p=0;p<w;p++)u=p<<2,O=6*p,H[p]=255<<24|r[O+4]<<16|r[O+2]<<8|r[O],R(r,O)==f&&R(r,O+2)==x&&R(r,O+4)==N&&(T[u+3]=0);}}else if(B==3){let U=h.tabs.PLTE,x=h.tabs.tRNS,N=x?x.length:0;if(L==1)for(var b=0;b<n;b++){var s=b*P,y=b*i;for(p=0;p<i;p++){u=y+p<<2;var _=3*(A=r[s+(p>>3)]>>7-((7&p)<<0)&1);T[u]=U[_],T[u+1]=U[_+1],T[u+2]=U[_+2],T[u+3]=A<N?x[A]:255;}}if(L==2)for(b=0;b<n;b++)for(s=b*P,y=b*i,p=0;p<i;p++)u=y+p<<2,_=3*(A=r[s+(p>>2)]>>6-((3&p)<<1)&3),T[u]=U[_],T[u+1]=U[_+1],T[u+2]=U[_+2],T[u+3]=A<N?x[A]:255;if(L==4)for(b=0;b<n;b++)for(s=b*P,y=b*i,p=0;p<i;p++)u=y+p<<2,_=3*(A=r[s+(p>>1)]>>4-((1&p)<<2)&15),T[u]=U[_],T[u+1]=U[_+1],T[u+2]=U[_+2],T[u+3]=A<N?x[A]:255;if(L==8)for(p=0;p<w;p++){var A;u=p<<2,_=3*(A=r[p]),T[u]=U[_],T[u+1]=U[_+1],T[u+2]=U[_+2],T[u+3]=A<N?x[A]:255;}}else if(B==4){if(L==8)for(p=0;p<w;p++){u=p<<2;var S=r[g=p<<1];T[u]=S,T[u+1]=S,T[u+2]=S,T[u+3]=r[g+1];}if(L==16)for(p=0;p<w;p++){var g;u=p<<2,S=r[g=p<<2],T[u]=S,T[u+1]=S,T[u+2]=S,T[u+3]=r[g+2];}}else if(B==0)for(f=h.tabs.tRNS?h.tabs.tRNS:-1,b=0;b<n;b++){let U=b*P,x=b*i;if(L==1)for(var d=0;d<i;d++){var M=(S=255*(r[U+(d>>>3)]>>>7-(7&d)&1))==255*f?0:255;H[x+d]=M<<24|S<<16|S<<8|S;}else if(L==2)for(d=0;d<i;d++)M=(S=85*(r[U+(d>>>2)]>>>6-((3&d)<<1)&3))==85*f?0:255,H[x+d]=M<<24|S<<16|S<<8|S;else if(L==4)for(d=0;d<i;d++)M=(S=17*(r[U+(d>>>1)]>>>4-((1&d)<<2)&15))==17*f?0:255,H[x+d]=M<<24|S<<16|S<<8|S;else if(L==8)for(d=0;d<i;d++)M=(S=r[U+d])==f?0:255,H[x+d]=M<<24|S<<16|S<<8|S;else if(L==16)for(d=0;d<i;d++)S=r[U+(d<<1)],M=R(r,U+(d<<1))==f?0:255,H[x+d]=M<<24|S<<16|S<<8|S;}return T}function I(r,i,n,h){let w=t(r),C=Math.ceil(n*w/8),P=new Uint8Array((C+1+r.interlace)*h);return i=r.tabs.CgBI?e(i,P):c(i,P),r.interlace==0?i=m(i,r,0,n,h):r.interlace==1&&(i=function(H,B){let L=B.width,R=B.height,p=t(B),O=p>>3,f=Math.ceil(L*p/8),u=new Uint8Array(R*f),b=0,s=[0,0,4,0,2,0,1],y=[0,4,0,2,0,1,0],_=[8,8,8,4,4,2,2],A=[8,8,4,4,2,2,1],S=0;for(;S<7;){let d=_[S],M=A[S],U=0,x=0,N=s[S];for(;N<R;)N+=d,x++;let D=y[S];for(;D<L;)D+=M,U++;let Q=Math.ceil(U*p/8);m(H,B,b,U,x);let k=0,F=s[S];for(;F<R;){let $=y[S],K=b+k*Q<<3;for(;$<L;){var g;if(p==1&&(g=(g=H[K>>3])>>7-(7&K)&1,u[F*f+($>>3)]|=g<<7-((7&$)<<0)),p==2&&(g=(g=H[K>>3])>>6-(7&K)&3,u[F*f+($>>2)]|=g<<6-((3&$)<<1)),p==4&&(g=(g=H[K>>3])>>4-(7&K)&15,u[F*f+($>>1)]|=g<<4-((1&$)<<2)),p>=8){let G=F*f+$*O;for(let z=0;z<O;z++)u[G+z]=H[(K>>3)+z];}K+=p,$+=M;}k++,F+=d;}U*x!=0&&(b+=x*(1+Q)),S+=1;}return u}(i,r)),i}function c(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,C,P=0,T=0,H=0,B=0,L=0,R=0,p=0,O=0,f=0;if(i[0]==3&&i[1]==0)return n||new h(0);let u=r.H,b=u.b,s=u.e,y=u.R,_=u.n,A=u.A,S=u.Z,g=u.m,d=n==null;for(d&&(n=new h(i.length>>>2<<5));P==0;)if(P=b(i,f,1),T=b(i,f+1,2),f+=3,T!=0){if(d&&(n=r.H.W(n,O+(1<<17))),T==1&&(w=g.J,C=g.h,R=511,p=31),T==2){H=s(i,f,5)+257,B=s(i,f+5,5)+1,L=s(i,f+10,4)+4,f+=14;let U=1;for(var M=0;M<38;M+=2)g.Q[M]=0,g.Q[M+1]=0;for(M=0;M<L;M++){let D=s(i,f+3*M,3);g.Q[1+(g.X[M]<<1)]=D,D>U&&(U=D);}f+=3*L,_(g.Q,U),A(g.Q,U,g.u),w=g.w,C=g.d,f=y(g.u,(1<<U)-1,H+B,i,f,g.v);let x=u.V(g.v,0,H,g.C);R=(1<<x)-1;let N=u.V(g.v,H,B,g.D);p=(1<<N)-1,_(g.C,x),A(g.C,x,w),_(g.D,N),A(g.D,N,C);}for(;;){let U=w[S(i,f)&R];f+=15&U;let x=U>>>4;if(!(x>>>8))n[O++]=x;else {if(x==256)break;{let N=O+x-254;if(x>264){let $=g.q[x-257];N=O+($>>>3)+s(i,f,7&$),f+=7&$;}let D=C[S(i,f)&p];f+=15&D;let Q=D>>>4,k=g.c[Q],F=(k>>>4)+b(i,f,15&k);for(f+=15&k;O<N;)n[O]=n[O++-F],n[O]=n[O++-F],n[O]=n[O++-F],n[O]=n[O++-F];O=N;}}}}else {(7&f)!=0&&(f+=8-(7&f));let U=4+(f>>>3),x=i[U-4]|i[U-3]<<8;d&&(n=r.H.W(n,O+x)),n.set(new h(i.buffer,i.byteOffset+U,x),O),f=U+x<<3,O+=x;}return n.length==O?n:n.slice(0,O)},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,C,P){let T=r.H.e,H=r.H.Z,B=0;for(;B<h;){let L=i[H(w,C)&n];C+=15&L;let R=L>>>4;if(R<=15)P[B]=R,B++;else {let p=0,O=0;R==16?(O=3+T(w,C,2),C+=2,p=P[B-1]):R==17?(O=3+T(w,C,3),C+=3):R==18&&(O=11+T(w,C,7),C+=7);let f=B+O;for(;B<f;)P[B]=p,B++;}}return C},r.H.V=function(i,n,h,w){let C=0,P=0,T=w.length>>>1;for(;P<h;){let H=i[P+n];w[P<<1]=0,w[1+(P<<1)]=H,H>C&&(C=H),P++;}for(;P<T;)w[P<<1]=0,w[1+(P<<1)]=0,P++;return C},r.H.n=function(i,n){let h=r.H.m,w=i.length,C,P,T,H,B=h.j;for(var L=0;L<=n;L++)B[L]=0;for(L=1;L<w;L+=2)B[i[L]]++;let R=h.K;for(C=0,B[0]=0,P=1;P<=n;P++)C=C+B[P-1]<<1,R[P]=C;for(T=0;T<w;T+=2)H=i[T+1],H!=0&&(i[T]=R[H],R[H]++);},r.H.A=function(i,n,h){let w=i.length,C=r.H.m.r;for(let P=0;P<w;P+=2)if(i[P+1]!=0){let T=P>>1,H=i[P+1],B=T<<4|H,L=n-H,R=i[P]<<L,p=R+(1<<L);for(;R!=p;)h[C[R]>>>15-n]=B,R++;}},r.H.l=function(i,n){let h=r.H.m.r,w=15-n;for(let C=0;C<i.length;C+=2){let P=i[C]<<n-i[C+1];i[C]=h[P]>>>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,C,P){for(;C--!=0;)w.push(0,P);}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 C=t(i),P=Math.ceil(h*C/8),T,H;C=Math.ceil(C/8);let B=r[n],L=0;if(B>1&&(r[n]=[0,0,1][B-2]),B==3)for(L=C;L<P;L++)r[L+1]=r[L+1]+(r[L+1-C]>>>1)&255;for(let R=0;R<w;R++)if(T=n+R*P,H=T+R+1,B=r[H-1],L=0,B==0)for(;L<P;L++)r[T+L]=r[H+L];else if(B==1){for(;L<C;L++)r[T+L]=r[H+L];for(;L<P;L++)r[T+L]=r[H+L]+r[T+L-C];}else if(B==2)for(;L<P;L++)r[T+L]=r[H+L]+r[T+L-P];else if(B==3){for(;L<C;L++)r[T+L]=r[H+L]+(r[T+L-P]>>>1);for(;L<P;L++)r[T+L]=r[H+L]+(r[T+L-P]+r[T+L-C]>>>1);}else {for(;L<C;L++)r[T+L]=r[H+L]+l(0,r[T+L-P],0);for(;L<P;L++)r[T+L]=r[H+L]+l(r[T+L-C],r[T+L-P],r[T+L-C-P]);}return r}function l(r,i,n){let h=r+i-n,w=h-r,C=h-i,P=h-n;return w*w<=C*C&&w*w<=P*P?r:C*C<=P*P?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 E(r,i,n,h,w,C,P,T,H){let B=Math.min(i,w),L=Math.min(n,C),R=0,p=0;for(let S=0;S<L;S++)for(let g=0;g<B;g++)if(P>=0&&T>=0?(R=S*i+g<<2,p=(T+S)*w+P+g<<2):(R=(-T+S)*i-P+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 O=r[R+3]*.00392156862745098,f=r[R]*O,u=r[R+1]*O,b=r[R+2]*O,s=h[p+3]*(1/255),y=h[p]*s,_=h[p+1]*s,A=h[p+2]*s;let d=1-O,M=O+s*d,U=M==0?0:1/M;h[p+3]=255*M,h[p+0]=(f+y*d)*U,h[p+1]=(u+_*d)*U,h[p+2]=(b+A*d)*U;}else if(H==2)O=r[R+3],f=r[R],u=r[R+1],b=r[R+2],s=h[p+3],y=h[p],_=h[p+1],A=h[p+2],O==s&&f==y&&u==_&&b==A?(h[p]=0,h[p+1]=0,h[p+2]=0,h[p+3]=0):(h[p]=f,h[p+1]=u,h[p+2]=b,h[p+3]=O);else if(H==3){if(O=r[R+3],f=r[R],u=r[R+1],b=r[R+2],s=h[p+3],y=h[p],_=h[p+1],A=h[p+2],O==s&&f==y&&u==_&&b==A)continue;if(O<220&&s>20)return false}return true}return {decode:function(i){let n=new Uint8Array(i),h=8,w=a,C=w.readUshort,P=w.readUint,T={tabs:{},frames:[]},H=new Uint8Array(n.length),B,L=0,R=0,p=[137,80,78,71,13,10,26,10];for(var O=0;O<8;O++)if(n[O]!=p[O])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,T);else if(g=="iCCP"){for(var f=h;n[f]!=0;)f++;w.readASCII(n,h,f-h),n[f+1];let d=n.slice(f+2,h+S),M=null;try{M=c(d);}catch{M=e(d);}T.tabs[g]=M;}else if(g=="CgBI")T.tabs[g]=n.slice(h,h+4);else if(g=="IDAT"){for(O=0;O<S;O++)H[L+O]=n[h+O];L+=S;}else if(g=="acTL")T.tabs[g]={num_frames:P(n,h),num_plays:P(n,h+4)},B=new Uint8Array(n.length);else if(g=="fcTL"){R!=0&&((A=T.frames[T.frames.length-1]).data=I(T,B.slice(0,R),A.rect.width,A.rect.height),R=0);let d={x:P(n,h+12),y:P(n,h+16),width:P(n,h+4),height:P(n,h+8)},M=C(n,h+22);M=C(n,h+20)/(M==0?100:M);let U={rect:d,delay:Math.round(1e3*M),dispose:n[h+24],blend:n[h+25]};T.frames.push(U);}else if(g=="fdAT"){for(O=0;O<S-4;O++)B[R+O]=n[h+O+4];R+=S-4;}else if(g=="pHYs")T.tabs[g]=[w.readUint(n,h),w.readUint(n,h+4),n[h+8]];else if(g=="cHRM")for(T.tabs[g]=[],O=0;O<8;O++)T.tabs[g].push(w.readUint(n,h+4*O));else if(g=="tEXt"||g=="zTXt"){T.tabs[g]==null&&(T.tabs[g]={});var u=w.nextZero(n,h),b=w.readASCII(n,h,u-h),s=h+S-u-1;if(g=="tEXt")_=w.readASCII(n,u+1,s);else {var y=c(n.slice(u+2,u+2+s));_=w.readUTF8(y,0,y.length);}T.tabs[g][b]=_;}else if(g=="iTXt"){T.tabs[g]==null&&(T.tabs[g]={}),u=0,f=h,u=w.nextZero(n,f),b=w.readASCII(n,f,u-f);let d=n[f=u+1];var _;n[f+1],f+=2,u=w.nextZero(n,f),w.readASCII(n,f,u-f),f=u+1,u=w.nextZero(n,f),w.readUTF8(n,f,u-f),s=S-((f=u+1)-h),d==0?_=w.readUTF8(n,f,s):(y=c(n.slice(f,f+s)),_=w.readUTF8(y,0,y.length)),T.tabs[g][b]=_;}else if(g=="PLTE")T.tabs[g]=w.readBytes(n,h,S);else if(g=="hIST"){let d=T.tabs.PLTE.length/3;for(T.tabs[g]=[],O=0;O<d;O++)T.tabs[g].push(C(n,h+2*O));}else if(g=="tRNS")T.ctype==3?T.tabs[g]=w.readBytes(n,h,S):T.ctype==0?T.tabs[g]=C(n,h):T.ctype==2&&(T.tabs[g]=[C(n,h),C(n,h+2),C(n,h+4)]);else if(g=="gAMA")T.tabs[g]=w.readUint(n,h)/1e5;else if(g=="sRGB")T.tabs[g]=n[h];else if(g=="bKGD")T.ctype==0||T.ctype==4?T.tabs[g]=[C(n,h)]:T.ctype==2||T.ctype==6?T.tabs[g]=[C(n,h),C(n,h+2),C(n,h+4)]:T.ctype==3&&(T.tabs[g]=n[h]);else if(g=="IEND")break;h+=S,w.readUint(n,h),h+=4;}var A;return R!=0&&((A=T.frames[T.frames.length-1]).data=I(T,B.slice(0,R),A.rect.width,A.rect.height)),T.data=I(T,H,T.width,T.height),delete T.compress,delete T.interlace,delete T.filter,T},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 C=n*h*4,P=new Uint8Array(C),T=new Uint8Array(C),H=new Uint8Array(C);for(let L=0;L<i.frames.length;L++){let R=i.frames[L],p=R.rect.x,O=R.rect.y,f=R.rect.width,u=R.rect.height,b=o(R.data,f,u,i);if(L!=0)for(var B=0;B<C;B++)H[B]=P[B];if(R.blend==0?E(b,f,u,P,n,h,p,O,0):R.blend==1&&E(b,f,u,P,n,h,p,O,1),w.push(P.buffer.slice(0)),R.dispose!=0){if(R.dispose==1)E(T,f,u,P,n,h,p,O,0);else if(R.dispose==2)for(B=0;B<C;B++)P[B]=H[B];}}return w},_paeth:l,_copyTile:E,_bin:a}}();(function(){let{_copyTile:a}=pe,{_bin:o}=pe,I=pe._paeth;var c={table:function(){let f=new Uint32Array(256);for(let u=0;u<256;u++){let b=u;for(let s=0;s<8;s++)1&b?b=3988292384^b>>>1:b>>>=1;f[u]=b;}return f}(),update(f,u,b,s){for(let y=0;y<s;y++)f=c.table[255&(f^u[b+y])]^f>>>8;return f},crc:(f,u,b)=>4294967295^c.update(4294967295,f,u,b)};function e(f,u,b,s){u[b]+=f[0]*s>>4,u[b+1]+=f[1]*s>>4,u[b+2]+=f[2]*s>>4,u[b+3]+=f[3]*s>>4;}function t(f){return Math.max(0,Math.min(255,f))}function m(f,u){let b=f[0]-u[0],s=f[1]-u[1],y=f[2]-u[2],_=f[3]-u[3];return b*b+s*s+y*y+_*_}function l(f,u,b,s,y,_,A){A==null&&(A=1);let S=s.length,g=[];for(var d=0;d<S;d++){let F=s[d];g.push([F>>>0&255,F>>>8&255,F>>>16&255,F>>>24&255]);}for(d=0;d<S;d++){let F=4294967295;for(var M=0,U=0;U<S;U++){var x=m(g[d],g[U]);U!=d&&x<F&&(F=x,M=U);}}let N=new Uint32Array(y.buffer),D=new Int16Array(u*b*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 F=0;F<b;F++)for(let $=0;$<u;$++){var k;d=4*(F*u+$),A!=2?k=[t(f[d]+D[d]),t(f[d+1]+D[d+1]),t(f[d+2]+D[d+2]),t(f[d+3]+D[d+3])]:(x=Q[4*(3&F)+(3&$)],k=[t(f[d]+x),t(f[d+1]+x),t(f[d+2]+x),t(f[d+3]+x)]),M=0;let K=16777215;for(U=0;U<S;U++){let q=m(k,g[U]);q<K&&(K=q,M=U);}let G=g[M],z=[k[0]-G[0],k[1]-G[1],k[2]-G[2],k[3]-G[3]];A==1&&($!=u-1&&e(z,D,d+4,7),F!=b-1&&($!=0&&e(z,D,d+4*u-4,3),e(z,D,d+4*u,5),$!=u-1&&e(z,D,d+4*u+4,1))),_[d>>2]=M,N[d>>2]=s[M];}}function v(f,u,b,s,y){y==null&&(y={});let{crc:_}=c,A=o.writeUint,S=o.writeUshort,g=o.writeASCII,d=8,M=f.frames.length>1,U,x=false,N=33+(M?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),f.ctype==3){for(var D=f.plte.length,Q=0;Q<D;Q++)f.plte[Q]>>>24!=255&&(x=true);N+=8+3*D+4+(x?8+1*D+4:0);}for(var k=0;k<f.frames.length;k++)M&&(N+=38),N+=(G=f.frames[k]).cimg.length+12,k!=0&&(N+=4);N+=12;let F=new Uint8Array(N),$=[137,80,78,71,13,10,26,10];for(Q=0;Q<8;Q++)F[Q]=$[Q];if(A(F,d,13),d+=4,g(F,d,"IHDR"),d+=4,A(F,d,u),d+=4,A(F,d,b),d+=4,F[d]=f.depth,d++,F[d]=f.ctype,d++,F[d]=0,d++,F[d]=0,d++,F[d]=0,d++,A(F,d,_(F,d-17,17)),d+=4,y.sRGB!=null&&(A(F,d,1),d+=4,g(F,d,"sRGB"),d+=4,F[d]=y.sRGB,d++,A(F,d,_(F,d-5,5)),d+=4),y.iCCP!=null){let z=13+U.length;A(F,d,z),d+=4,g(F,d,"iCCP"),d+=4,g(F,d,"ICC profile"),d+=11,d+=2,F.set(U,d),d+=U.length,A(F,d,_(F,d-(z+4),z+4)),d+=4;}if(y.pHYs!=null&&(A(F,d,9),d+=4,g(F,d,"pHYs"),d+=4,A(F,d,y.pHYs[0]),d+=4,A(F,d,y.pHYs[1]),d+=4,F[d]=y.pHYs[2],d++,A(F,d,_(F,d-13,13)),d+=4),M&&(A(F,d,8),d+=4,g(F,d,"acTL"),d+=4,A(F,d,f.frames.length),d+=4,A(F,d,y.loop!=null?y.loop:0),d+=4,A(F,d,_(F,d-12,12)),d+=4),f.ctype==3){for(A(F,d,3*(D=f.plte.length)),d+=4,g(F,d,"PLTE"),d+=4,Q=0;Q<D;Q++){let z=3*Q,q=f.plte[Q],V=255&q,W=q>>>8&255,ie=q>>>16&255;F[d+z+0]=V,F[d+z+1]=W,F[d+z+2]=ie;}if(d+=3*D,A(F,d,_(F,d-3*D-4,3*D+4)),d+=4,x){for(A(F,d,D),d+=4,g(F,d,"tRNS"),d+=4,Q=0;Q<D;Q++)F[d+Q]=f.plte[Q]>>>24&255;d+=D,A(F,d,_(F,d-D-4,D+4)),d+=4;}}let K=0;for(k=0;k<f.frames.length;k++){var G=f.frames[k];M&&(A(F,d,26),d+=4,g(F,d,"fcTL"),d+=4,A(F,d,K++),d+=4,A(F,d,G.rect.width),d+=4,A(F,d,G.rect.height),d+=4,A(F,d,G.rect.x),d+=4,A(F,d,G.rect.y),d+=4,S(F,d,s[k]),d+=2,S(F,d,1e3),d+=2,F[d]=G.dispose,d++,F[d]=G.blend,d++,A(F,d,_(F,d-30,30)),d+=4);let z=G.cimg;A(F,d,(D=z.length)+(k==0?0:4)),d+=4;let q=d;g(F,d,k==0?"IDAT":"fdAT"),d+=4,k!=0&&(A(F,d,K++),d+=4),F.set(z,d),d+=D,A(F,d,_(F,q,d-q)),d+=4;}return A(F,d,0),d+=4,g(F,d,"IEND"),d+=4,A(F,d,_(F,d-4,4)),d+=4,F.buffer}function E(f,u,b){for(let s=0;s<f.frames.length;s++){let y=f.frames[s];y.rect.width;let _=y.rect.height,A=new Uint8Array(_*y.bpl+_);y.cimg=h(y.img,_,y.bpp,y.bpl,A,u,b);}}function r(f,u,b,s,y){let _=y[0],A=y[1],S=y[2],g=y[3],d=y[4],M=y[5],U=6,x=8,N=255;for(var D=0;D<f.length;D++){let te=new Uint8Array(f[D]);for(var Q=te.length,k=0;k<Q;k+=4)N&=te[k+3];}let F=N!=255,$=function(Y,Z,ne,oe,j,ue){let ee=[];for(var X=0;X<Y.length;X++){let ce=new Uint8Array(Y[X]),he=new Uint32Array(ce.buffer);var le;let de=0,ve=0,me=Z,Ie=ne,Ye=oe?1:0;if(X!=0){let mn=ue||oe||X==1||ee[X-2].dispose!=0?1:2,Ze=0,vt=1e9;for(let Le=0;Le<mn;Le++){var ge=new Uint8Array(Y[X-1-Le]);let yn=new Uint32Array(Y[X-1-Le]),be=Z,_e=ne,xe=-1,De=-1;for(let Re=0;Re<ne;Re++)for(let Ce=0;Ce<Z;Ce++)he[se=Re*Z+Ce]!=yn[se]&&(Ce<be&&(be=Ce),Ce>xe&&(xe=Ce),Re<_e&&(_e=Re),Re>De&&(De=Re));xe==-1&&(be=_e=xe=De=0),j&&((1&be)==1&&be--,(1&_e)==1&&_e--);let wt=(xe-be+1)*(De-_e+1);wt<vt&&(vt=wt,Ze=Le,de=be,ve=_e,me=xe-be+1,Ie=De-_e+1);}ge=new Uint8Array(Y[X-1-Ze]),Ze==1&&(ee[X-1].dispose=2),le=new Uint8Array(me*Ie*4),a(ge,Z,ne,le,me,Ie,-de,-ve,0),Ye=a(ce,Z,ne,le,me,Ie,-de,-ve,3)?1:0,Ye==1?n(ce,Z,ne,le,{x:de,y:ve,width:me,height:Ie}):a(ce,Z,ne,le,me,Ie,-de,-ve,0);}else le=ce.slice(0);ee.push({rect:{x:de,y:ve,width:me,height:Ie},img:le,blend:Ye,dispose:0});}if(oe)for(X=0;X<ee.length;X++){if((Te=ee[X]).blend==1)continue;let ce=Te.rect,he=ee[X-1].rect,de=Math.min(ce.x,he.x),ve=Math.min(ce.y,he.y),me={x:de,y:ve,width:Math.max(ce.x+ce.width,he.x+he.width)-de,height:Math.max(ce.y+ce.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 Ne=0;if(Y.length!=1)for(var se=0;se<ee.length;se++){var Te;Ne+=(Te=ee[se]).rect.width*Te.rect.height;}return ee}(f,u,b,_,A,S),K={},G=[],z=[];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]),Ne=ge.length;for(let se=0;se<Ne;se+=4){let Te=ge[se],ce=ge[se+1],he=ge[se+2],de=ge[se+3];de==0&&(Te=ce=he=0),X[le+se]=Te,X[le+se+1]=ce,X[le+se+2]=he,X[le+se+3]=de;}le+=Ne;}return X.buffer}(te),Z=C(Y,s);for(k=0;k<Z.plte.length;k++)G.push(Z.plte[k].est.rgba);let ne=0;for(k=0;k<$.length;k++){let oe=(V=$[k]).img.length;var q=new Uint8Array(Z.inds.buffer,ne>>2,oe>>2);z.push(q);let j=new Uint8Array(Z.abuf,ne,oe);M&&l(V.img,V.rect.width,V.rect.height,G,j,q),V.img.set(j),ne+=oe;}}else for(D=0;D<$.length;D++){var V=$[D];let te=new Uint32Array(V.img.buffer);var W=V.rect.width;for(Q=te.length,q=new Uint8Array(Q),z.push(q),k=0;k<Q;k++){let Y=te[k];if(k!=0&&Y==te[k-1])q[k]=q[k-1];else if(k>W&&Y==te[k-W])q[k]=q[k-W];else {let Z=K[Y];if(Z==null&&(K[Y]=Z=G.length,G.push(Y),G.length>=300))break;q[k]=Z;}}}let ie=G.length;for(ie<=256&&d==0&&(x=ie<=2?1:ie<=4?2:ie<=16?4:8,x=Math.max(x,g)),D=0;D<$.length;D++){(V=$[D]).rect.x,V.rect.y,W=V.rect.width;let te=V.rect.height,Y=V.img;new Uint32Array(Y.buffer);let Z=4*W,ne=4;if(ie<=256&&d==0){Z=Math.ceil(x*W/8);var ae=new Uint8Array(Z*te);let oe=z[D];for(let j=0;j<te;j++){k=j*Z;let ue=j*W;if(x==8)for(var J=0;J<W;J++)ae[k+J]=oe[ue+J];else if(x==4)for(J=0;J<W;J++)ae[k+(J>>1)]|=oe[ue+J]<<4-4*(1&J);else if(x==2)for(J=0;J<W;J++)ae[k+(J>>2)]|=oe[ue+J]<<6-2*(3&J);else if(x==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(F==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;}V.img=Y,V.bpl=Z,V.bpp=ne;}return {ctype:U,depth:x,plte:G,frames:$}}function i(f,u,b,s,y,_,A){let S=Uint8Array,g=Uint32Array,d=new S(f[y-1]),M=new g(f[y-1]),U=y+1<f.length?new S(f[y+1]):null,x=new S(f[y]),N=new g(x.buffer),D=u,Q=b,k=-1,F=-1;for(let K=0;K<_.height;K++)for(let G=0;G<_.width;G++){let z=_.x+G,q=_.y+K,V=q*u+z,W=N[V];W==0||s[y-1].dispose==0&&M[V]==W&&(U==null||U[4*V+3]!=0)||(z<D&&(D=z),z>k&&(k=z),q<Q&&(Q=q),q>F&&(F=q));}k==-1&&(D=Q=k=F=0),A&&((1&D)==1&&D--,(1&Q)==1&&Q--),_={x:D,y:Q,width:k-D+1,height:F-Q+1};let $=s[y];$.rect=_,$.blend=1,$.img=new Uint8Array(_.width*_.height*4),s[y-1].dispose==0?(a(d,u,b,$.img,_.width,_.height,-_.x,-_.y,0),n(x,u,b,$.img,_)):a(x,u,b,$.img,_.width,_.height,-_.x,-_.y,0);}function n(f,u,b,s,y){a(f,u,b,s,y.width,y.height,-y.x,-y.y,2);}function h(f,u,b,s,y,_,A){let S=[],g,d=[0,1,2,3,4];_!=-1?d=[_]:(u*s>5e5||b==1)&&(d=[0]),A&&(g={level:0});let M=Rn;for(var U=0;U<d.length;U++){for(let D=0;D<u;D++)w(y,f,D,s,b,d[U]);S.push(M.deflate(y,g));}let x,N=1e9;for(U=0;U<S.length;U++)S[U].length<N&&(x=U,N=S[U].length);return S[x]}function w(f,u,b,s,y,_){let A=b*s,S=A+b;if(f[S]=_,S++,_==0)if(s<500)for(var g=0;g<s;g++)f[S+g]=u[A+g];else f.set(new Uint8Array(u.buffer,A,s),S);else if(_==1){for(g=0;g<y;g++)f[S+g]=u[A+g];for(g=y;g<s;g++)f[S+g]=u[A+g]-u[A+g-y]+256&255;}else if(b==0){for(g=0;g<y;g++)f[S+g]=u[A+g];if(_==2)for(g=y;g<s;g++)f[S+g]=u[A+g];if(_==3)for(g=y;g<s;g++)f[S+g]=u[A+g]-(u[A+g-y]>>1)+256&255;if(_==4)for(g=y;g<s;g++)f[S+g]=u[A+g]-I(u[A+g-y],0,0)+256&255;}else {if(_==2)for(g=0;g<s;g++)f[S+g]=u[A+g]+256-u[A+g-s]&255;if(_==3){for(g=0;g<y;g++)f[S+g]=u[A+g]+256-(u[A+g-s]>>1)&255;for(g=y;g<s;g++)f[S+g]=u[A+g]+256-(u[A+g-s]+u[A+g-y]>>1)&255;}if(_==4){for(g=0;g<y;g++)f[S+g]=u[A+g]+256-I(0,u[A+g-s],0)&255;for(g=y;g<s;g++)f[S+g]=u[A+g]+256-I(u[A+g-y],u[A+g-s],u[A+g-y-s])&255;}}}function C(f,u){let b=new Uint8Array(f),s=b.slice(0),y=new Uint32Array(s.buffer),_=P(s,u),A=_[0],S=_[1],g=b.length,d=new Uint8Array(g>>2),M;if(b.length<2e7)for(var U=0;U<g;U+=4)M=T(A,x=b[U]*(1/255),N=b[U+1]*(1/255),D=b[U+2]*(1/255),Q=b[U+3]*(1/255)),d[U>>2]=M.ind,y[U>>2]=M.est.rgba;else for(U=0;U<g;U+=4){var x=b[U]*.00392156862745098,N=b[U+1]*(1/255),D=b[U+2]*(1/255),Q=b[U+3]*(1/255);for(M=A;M.left;)M=H(M.est,x,N,D,Q)<=0?M.left:M.right;d[U>>2]=M.ind,y[U>>2]=M.est.rgba;}return {abuf:s.buffer,inds:d,plte:S}}function P(f,u,b){b==null&&(b=1e-4);let s=new Uint32Array(f.buffer),y={i0:0,i1:f.length,bst:null,est:null,tdst:0,left:null,right:null};y.bst=R(f,y.i0,y.i1),y.est=p(y.bst);let _=[y];for(;_.length<u;){let S=0,g=0;for(var A=0;A<_.length;A++)_[A].est.L>S&&(S=_[A].est.L,g=A);if(S<b)break;let d=_[g],M=B(f,s,d.i0,d.i1,d.est.e,d.est.eMq255);if(d.i0>=M||d.i1<=M){d.est.L=0;continue}let U={i0:d.i0,i1:M,bst:null,est:null,tdst:0,left:null,right:null};U.bst=R(f,U.i0,U.i1),U.est=p(U.bst);let x={i0:M,i1:d.i1,bst:null,est:null,tdst:0,left:null,right:null};for(x.bst={R:[],m:[],N:d.bst.N-U.bst.N},A=0;A<16;A++)x.bst.R[A]=d.bst.R[A]-U.bst.R[A];for(A=0;A<4;A++)x.bst.m[A]=d.bst.m[A]-U.bst.m[A];x.est=p(x.bst),d.left=U,d.right=x,_[g]=U,_.push(x);}for(_.sort((S,g)=>g.bst.N-S.bst.N),A=0;A<_.length;A++)_[A].ind=A;return [y,_]}function T(f,u,b,s,y){if(f.left==null)return f.tdst=function(U,x,N,D,Q){let k=x-U[0],F=N-U[1],$=D-U[2],K=Q-U[3];return k*k+F*F+$*$+K*K}(f.est.q,u,b,s,y),f;let _=H(f.est,u,b,s,y),A=f.left,S=f.right;_>0&&(A=f.right,S=f.left);let g=T(A,u,b,s,y);if(g.tdst<=_*_)return g;let d=T(S,u,b,s,y);return d.tdst<g.tdst?d:g}function H(f,u,b,s,y){let{e:_}=f;return _[0]*u+_[1]*b+_[2]*s+_[3]*y-f.eMq}function B(f,u,b,s,y,_){for(s-=4;b<s;){for(;L(f,b,y)<=_;)b+=4;for(;L(f,s,y)>_;)s-=4;if(b>=s)break;let A=u[b>>2];u[b>>2]=u[s>>2],u[s>>2]=A,b+=4,s-=4;}for(;L(f,b,y)>_;)b-=4;return b+4}function L(f,u,b){return f[u]*b[0]+f[u+1]*b[1]+f[u+2]*b[2]+f[u+3]*b[3]}function R(f,u,b){let s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],y=[0,0,0,0],_=b-u>>2;for(let A=u;A<b;A+=4){let S=f[A]*.00392156862745098,g=f[A+1]*(1/255),d=f[A+2]*(1/255),M=f[A+3]*(1/255);y[0]+=S,y[1]+=g,y[2]+=d,y[3]+=M,s[0]+=S*S,s[1]+=S*g,s[2]+=S*d,s[3]+=S*M,s[5]+=g*g,s[6]+=g*d,s[7]+=g*M,s[10]+=d*d,s[11]+=d*M,s[15]+=M*M;}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:_}}function p(f){let{R:u}=f,{m:b}=f,{N:s}=f,y=b[0],_=b[1],A=b[2],S=b[3],g=s==0?0:1/s,d=[u[0]-y*y*g,u[1]-y*_*g,u[2]-y*A*g,u[3]-y*S*g,u[4]-_*y*g,u[5]-_*_*g,u[6]-_*A*g,u[7]-_*S*g,u[8]-A*y*g,u[9]-A*_*g,u[10]-A*A*g,u[11]-A*S*g,u[12]-S*y*g,u[13]-S*_*g,u[14]-S*A*g,u[15]-S*S*g],M=d,U=O,x=[Math.random(),Math.random(),Math.random(),Math.random()],N=0,D=0;if(s!=0)for(let k=0;k<16&&(x=U.multVec(M,x),D=Math.sqrt(U.dot(x,x)),x=U.sml(1/D,x),!(k!=0&&Math.abs(D-N)<1e-9));k++)N=D;let Q=[y*g,_*g,A*g,S*g];return {Cov:d,q:Q,e:x,L:N,eMq255:U.dot(U.sml(255,Q),x),eMq:U.dot(x,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 O={multVec:(f,u)=>[f[0]*u[0]+f[1]*u[1]+f[2]*u[2]+f[3]*u[3],f[4]*u[0]+f[5]*u[1]+f[6]*u[2]+f[7]*u[3],f[8]*u[0]+f[9]*u[1]+f[10]*u[2]+f[11]*u[3],f[12]*u[0]+f[13]*u[1]+f[14]*u[2]+f[15]*u[3]],dot:(f,u)=>f[0]*u[0]+f[1]*u[1]+f[2]*u[2]+f[3]*u[3],sml:(f,u)=>[f*u[0],f*u[1],f*u[2],f*u[3]]};pe.encode=function(u,b,s,y,_,A,S){y==null&&(y=0),S==null&&(S=false);let g=r(u,b,s,y,[false,false,false,0,S,false]);return E(g,-1),v(g,b,s,_,A)},pe.encodeLL=function(u,b,s,y,_,A,S,g){let d={ctype:0+(y==1?0:2)+(_==0?0:4),depth:A,frames:[]},M=(y+_)*A,U=M*b;for(let x=0;x<u.length;x++)d.frames.push({rect:{x:0,y:0,width:b,height:s},img:new Uint8Array(u[x]),blend:0,dispose:1,bpp:Math.ceil(M/8),bpl:Math.ceil(U/8)});return E(d,0,true),v(d,b,s,S,g)},pe.encode.compress=r,pe.encode.dither=l,pe.quantize=C,pe.quantize.getKDtree=P,pe.quantize.getNearest=T;})();var Tt={toArrayBuffer(a,o){let I=a.width,c=a.height,e=I<<2,t=a.getContext("2d").getImageData(0,0,I,c),m=new Uint32Array(t.data.buffer),l=(32*I+31)/32<<2,v=l*c,E=122+v,r=new ArrayBuffer(E),i=new DataView(r),n=1<<20,h,w,C,P,T=n,H=0,B=0,L=0;function R(f){i.setUint16(B,f,true),B+=2;}function p(f){i.setUint32(B,f,true),B+=4;}function O(f){B+=f;}R(19778),p(E),O(4),p(122),p(108),p(I),p(-c>>>0),R(1),R(32),p(3),p(v),p(2835),p(2835),O(8),p(16711680),p(65280),p(255),p(4278190080),p(1466527264),function f(){for(;H<c&&T>0;){for(P=122+H*l,h=0;h<e;)T--,w=m[L++],C=w>>>24,i.setUint32(P+h,w<<8|C),h+=4;H++;}L<m.length?(T=n,setTimeout(f,Tt._dly)):o(r);}();},toBlob(a,o){this.toArrayBuffer(a,I=>{o(new Blob([I],{type:"image/bmp"}));});},_dly:9},fe={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Cn={[fe.CHROME]:16384,[fe.FIREFOX]:11180,[fe.DESKTOP_SAFARI]:16384,[fe.IE]:8192,[fe.IOS]:4096,[fe.ETC]:8192},et=typeof globalThis.window<"u",It=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,We=et&&globalThis.window.cordova&&globalThis.window.cordova.require&&globalThis.window.cordova.require("cordova/modulemapper"),Un=(et||It)&&(We&&We.getOriginalSymbol(globalThis.window,"File")||typeof File<"u"&&File),Rt=(et||It)&&(We&&We.getOriginalSymbol(globalThis.window,"FileReader")||typeof globalThis.FileReader<"u"&&globalThis.FileReader);function tt(a,o,I=Date.now()){return new Promise(c=>{let e=a.split(","),t=e[0].match(/:(.*?);/)[1],m=globalThis.atob(e[1]),l=m.length,v=new Uint8Array(l);for(;l--;)v[l]=m.charCodeAt(l);let E=new Blob([v],{type:t});E.name=o,E.lastModified=I,c(E);})}function Ct(a){return new Promise((o,I)=>{let c=new Rt;c.onload=()=>o(c.result),c.onerror=e=>I(e),c.readAsDataURL(a);})}function Ut(a){return new Promise((o,I)=>{let c=new globalThis.Image;c.onload=()=>o(c),c.onerror=e=>I(e),c.src=a;})}function Ue(){if(Ue.cachedResult!==void 0)return Ue.cachedResult;let a=fe.ETC,{userAgent:o}=navigator;return /Chrom(e|ium)/i.test(o)?a=fe.CHROME:/iP(ad|od|hone)/i.test(o)&&/WebKit/i.test(o)?a=fe.IOS:/Safari/i.test(o)?a=fe.DESKTOP_SAFARI:/Firefox/i.test(o)?a=fe.FIREFOX:(/MSIE/i.test(o)||globalThis.document.documentMode)&&(a=fe.IE),Ue.cachedResult=a,Ue.cachedResult}function Ot(a,o){let I=Ue(),c=Cn[I],e=a,t=o,m=e*t,l=e>t?t/e:e/t;for(;m>c*c;){let v=(c+e)/2,E=(c+t)/2;v<E?(t=E,e=E*l):(t=v*l,e=v),m=e*t;}return {width:e,height:t}}function Ge(a,o){let I,c;try{if(I=new OffscreenCanvas(a,o),c=I.getContext("2d"),c===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{I=globalThis.document.createElement("canvas"),c=I.getContext("2d");}return I.width=a,I.height=o,[I,c]}function xt(a,o){let{width:I,height:c}=Ot(a.width,a.height),[e,t]=Ge(I,c);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 Qe(){return Qe.cachedResult!==void 0||(Qe.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof globalThis.document<"u"&&"ontouchend"in globalThis.document),Qe.cachedResult}function ze(a,o={}){return new Promise(function(I,c){let e,t;var m=function(){try{return t=xt(e,o.fileType||a.type),I([e,t])}catch(v){return c(v)}},l=function(v){try{var E=function(r){try{throw r}catch(i){return c(i)}};try{let r;return Ct(a).then(function(i){try{return r=i,Ut(r).then(function(n){try{return e=n,function(){try{return m()}catch(h){return c(h)}}()}catch(h){return E(h)}},E)}catch(n){return E(n)}},E)}catch(r){E(r);}}catch(r){return c(r)}};try{if(Qe()||[fe.DESKTOP_SAFARI,fe.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 l()}},l)}catch{l();}})}function Ve(a,o,I,c,e=1){return new Promise(function(t,m){let l;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),l=new Blob([h],{type:o}),l.name=I,l.lastModified=c,v.call(this)}{let i=function(){return v.call(this)};if(o==="image/bmp")return new Promise(n=>Tt.toBlob(a,n)).then(function(n){try{return l=n,l.name=I,l.lastModified=c,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 l=h,l.name=I,l.lastModified=c,n.call(this)}catch(w){return m(w)}}.bind(this),m);{let h;return h=a.toDataURL(o,e),tt(h,I,c).then(function(w){try{return l=w,n.call(this)}catch(C){return m(C)}}.bind(this),m)}}}function v(){return t(l)}})}function ye(a){a.width=0,a.height=0;}function Me(){return new Promise(function(a,o){let c,e,t,m;return Me.cachedResult!==void 0?a(Me.cachedResult):(tt("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(l){try{return c=l,ze(c).then(function(v){try{return e=v[1],Ve(e,c.type,c.name,c.lastModified).then(function(E){try{return t=E,ye(e),ze(t).then(function(r){try{return m=r[0],Me.cachedResult=m.width===1&&m.height===2,a(Me.cachedResult)}catch(i){return o(i)}},o)}catch(r){return o(r)}},o)}catch(E){return o(E)}},o)}catch(v){return o(v)}},o))})}function Mt(a){return new Promise((o,I)=>{let c=new Rt;c.onload=e=>{let t=new DataView(e.target.result);if(t.getUint16(0,false)!=65496)return o(-2);let m=t.byteLength,l=2;for(;l<m;){if(t.getUint16(l+2,false)<=8)return o(-1);let v=t.getUint16(l,false);if(l+=2,v==65505){if(t.getUint32(l+=2,false)!=1165519206)return o(-1);let E=t.getUint16(l+=6,false)==18761;l+=t.getUint32(l+4,E);let r=t.getUint16(l,E);l+=2;for(let i=0;i<r;i++)if(t.getUint16(l+12*i,E)==274)return o(t.getUint16(l+12*i+8,E))}else {if((65280&v)!=65280)break;l+=t.getUint16(l,false);}}return o(-1)},c.onerror=e=>I(e),c.readAsArrayBuffer(a);})}function Pt(a,o){let{width:I}=a,{height:c}=a,{maxWidthOrHeight:e}=o,t,m=a;return isFinite(e)&&(I>e||c>e)&&([m,t]=Ge(I,c),I>c?(m.width=e,m.height=c/I*e):(m.width=I/c*e,m.height=e),t.drawImage(a,0,0,m.width,m.height),ye(a)),m}function Lt(a,o){let{width:I}=a,{height:c}=a,[e,t]=Ge(I,c);switch(o>4&&o<9?(e.width=c,e.height=I):(e.width=I,e.height=c),o){case 2:t.transform(-1,0,0,1,I,0);break;case 3:t.transform(-1,0,0,-1,I,c);break;case 4:t.transform(1,0,0,-1,0,c);break;case 5:t.transform(0,1,1,0,0,0);break;case 6:t.transform(0,1,-1,0,c,0);break;case 7:t.transform(0,-1,-1,0,c,I);break;case 8:t.transform(0,-1,1,0,0,I);}return t.drawImage(a,0,0,I,c),ye(a),e}function Et(a,o,I=0){return new Promise(function(c,e){let t,m,l,v,E,r,i,n,h,w,C,P,T,H,B,L,R,p,O,f;function u(s=5){if(o.signal&&o.signal.aborted)throw o.signal.reason;t+=s,o.onProgress(Math.min(t,100));}function b(s){if(o.signal&&o.signal.aborted)throw o.signal.reason;t=Math.min(Math.max(s,t),100),o.onProgress(t);}return t=I,m=o.maxIteration||10,l=1024*o.maxSizeMB*1024,u(),ze(a,o).then(function(s){try{return [,v]=s,u(),E=Pt(v,o),u(),new Promise(function(y,_){var A;if(!(A=o.exifOrientation))return Mt(a).then(function(g){try{return A=g,S.call(this)}catch(d){return _(d)}}.bind(this),_);function S(){return y(A)}return S.call(this)}).then(function(y){try{return r=y,u(),Me().then(function(_){try{return i=_?E:Lt(E,r),u(),n=o.initialQuality||1,h=o.fileType||a.type,Ve(i,h,a.name,a.lastModified,n).then(function(A){try{{let M=function(){if(m--&&(B>l||B>T)){let x,N;return x=f?.95*O.width:O.width,N=f?.95*O.height:O.height,[R,p]=Ge(x,N),p.drawImage(O,0,0,x,N),n*=h==="image/png"?.85:.95,Ve(R,h,a.name,a.lastModified,n).then(function(D){try{return L=D,ye(O),O=R,B=L.size,b(Math.min(99,Math.floor((H-B)/(H-l)*100))),M}catch(Q){return e(Q)}},e)}return [1]},U=function(){return ye(O),ye(R),ye(E),ye(i),ye(v),b(100),c(L)};var g=M,d=U;if(w=A,u(),C=w.size>l,P=w.size>a.size,!C&&!P)return b(100),c(w);var S;return T=a.size,H=w.size,B=H,O=i,f=!o.alwaysKeepResolution&&C,(S=function(x){for(;x;){if(x.then)return void x.then(S,e);try{if(x.pop){if(x.length)return x.pop()?U.call(this):x;x=M;}else x=x.call(this);}catch(N){return e(N)}}}.bind(this))(M)}}catch(M){return e(M)}}.bind(this),e)}catch(A){return e(A)}}.bind(this),e)}catch(_){return e(_)}}.bind(this),e)}catch(y){return e(y)}}.bind(this),e)})}var On=`
6
6
  let scriptImported = false
7
7
  self.addEventListener('message', async (e) => {
8
8
  const { file, id, imageCompressionLibUrl, options } = e.data
@@ -21,8 +21,127 @@ self.addEventListener('message', async (e) => {
21
21
  self.postMessage({ error: e.message + '\\n' + e.stack, id })
22
22
  }
23
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 globalThis.FileReader;C.onload=()=>{o(C.result);},C.readAsDataURL(a);})}function rr(){let a={...globalThis.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(()=>{});}globalThis.window.console.log=(...C)=>{o("LOG",C),a.log(...C);},globalThis.window.console.error=(...C)=>{o("ERROR",C),a.error(...C);},globalThis.window.console.info=(...C)=>{o("INFO",C),a.info(...C);},globalThis.window.console.warn=(...C)=>{o("WARN",C),a.warn(...C);};}function or(){function a(o,C=globalThis.window.parent,u="*"){C?.postMessage({...o,source:"iframe"},{targetOrigin:u});}globalThis.window.addEventListener("message",async o=>{let{origin:C,source:u,data:e}=o,{type:t}=e;if(t==="screenshot"){let m=globalThis.window.getComputedStyle(globalThis.document.body).backgroundColor,f=await on.default.toPng(globalThis.document.body,{bgcolor:m,style:{transform:"translateY("+-globalThis.window.scrollY+"px)"},width:globalThis.window.innerWidth,height:globalThis.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 globalThis.window>"u"||globalThis.window.__APP_ID__||(globalThis.window.__APP_ID__=a,globalThis.window.__ROOT_URL__=o,globalThis.window.__BASE_URL__=C,u&&(globalThis.window.__VERSION_ID__=u),globalThis.window.__IS_TESTING__=e,globalThis.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",globalThis.window.location.pathname+globalThis.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=globalThis.window.__APP_ID__;globalThis.window.__OPEN_AUTH_DRAWER__(`${globalThis.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",...globalThis.window.__VERSION_ID__?{"x-version-id":globalThis.window.__VERSION_ID__}:{},...globalThis.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(globalThis.window.location.pathname+globalThis.window.location.search),m=globalThis.window.__APP_ID__;globalThis.window.top?globalThis.window.top.location.href=`${globalThis.window.__ROOT_URL__}/setup/${m}?returnTo=${t}`:globalThis.window.location.href=`${globalThis.window.__ROOT_URL__}/setup/${m}?returnTo=${t}`;}else C({userId:null,status:"unauthenticated",signIn:Ne,providers:[]});}})();},[a.required]),o}function br(){return globalThis.window.__BASE_URL__}async function ir({channelId:a,initialData:o,broadcastOnly:C,onUpdate:u}){let e=o,t=0,m=globalThis.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:
24
+ `,je;function xn(a,o){return new Promise((I,c)=>{je||(je=function(m){let l=[];return l.push(m),URL.createObjectURL(new Blob(l))}(On));let e=new Worker(je);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 c(new Error(m.data.error)),void e.terminate();I(m.data.file),e.terminate();}else o.onProgress(m.data.progress);}),e.addEventListener("error",c),o.signal&&o.signal.addEventListener("abort",()=>{c(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(I,c){let e,t,m,l,v,E;if(e={...o},m=0,{onProgress:l}=e,e.maxSizeMB=e.maxSizeMB||Number.POSITIVE_INFINITY,v=typeof e.useWebWorker!="boolean"||e.useWebWorker,delete e.useWebWorker,e.onProgress=h=>{m=h,typeof l=="function"&&l(m);},!(a instanceof Blob||a instanceof Un))return c(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(a.type))return c(new Error("The file given is not an image"));if(E=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!v||typeof Worker!="function"||E)return Et(a,e).then(function(h){try{return t=h,n.call(this)}catch(w){return c(w)}}.bind(this),c);var r=function(){try{return n.call(this)}catch(h){return c(h)}}.bind(this),i=function(h){try{return Et(a,e).then(function(w){try{return t=w,r()}catch(C){return c(C)}},c)}catch(w){return c(w)}};try{return e.libURL=e.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",xn(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=St(a,t));}catch{}return I(t)}})}re.getDataUrlFromFile=Ct,re.getFilefromDataUrl=tt,re.loadImage=Ut,re.drawImageInCanvas=xt,re.drawFileInCanvas=ze,re.canvasToFile=Ve,re.getExifOrientation=Mt,re.handleMaxWidthOrHeight=Pt,re.followExifOrientation=Lt,re.cleanupCanvasMemory=ye,re.isAutoOrientationInBrowser=Me,re.approximateBelowMaximumCanvasSizeOfBrowser=Ot,re.copyExifWithoutOrientation=St,re.getBrowserName=Ue,re.version="2.0.2";var pn=_t(Dt()),gn=_t(rn());function on(){if(globalThis.document.getElementById("__AUTH_DRAWER"))return;let a=globalThis.document.createElement("style");a.innerHTML=`
25
+ .__button_container * {
26
+ font-family: -apple-system,
27
+ BlinkMacSystemFont,
28
+ "Segoe UI",
29
+ Roboto,
30
+ Oxygen,
31
+ Ubuntu,
32
+ Cantarell,
33
+ "Helvetica Neue",
34
+ Arial,
35
+ sans-serif !important;
36
+ }
37
+
38
+ .__button_container {
39
+ position: fixed;
40
+ bottom: 15px;
41
+ left: 50%;
42
+ z-index: 9999;
43
+ -webkit-user-select: none;
44
+ user-select: none;
45
+ transition: all 0.3s ease;
46
+ opacity: 1;
47
+ transform-origin: center bottom;
48
+ }
49
+
50
+ .__button_container.dismissing {
51
+ opacity: 0;
52
+ transform: translateY(20px);
53
+ }
54
+
55
+ .__button_button {
56
+ position: relative;
57
+ left: -50%;
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ text-decoration: none;
62
+ border: 1px solid rgb(226, 232, 240);
63
+ background-image: linear-gradient(to top, rgb(255, 255, 255), rgb(241, 245, 249));
64
+ color: rgba(2, 8, 23, 0.5);
65
+ padding: 8px 8px;
66
+ border-radius: 12px;
67
+ transition: all 0.3s ease;
68
+ height: 36px;
69
+ -webkit-user-select: none;
70
+ user-select: none;
71
+ }
72
+
73
+ .__close_button {
74
+ opacity: 0; /* Hidden by default on desktop */
75
+ position: absolute;
76
+ left: 0;
77
+ top: 0;
78
+ transform: translate(-40%, -40%);
79
+ width: 24px;
80
+ height: 24px;
81
+ border-radius: 50%;
82
+ background: rgb(255, 255, 255);
83
+ border: none;
84
+ cursor: pointer;
85
+ display: flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ transition: all 0.3s ease;
89
+ color: rgb(100, 116, 139);
90
+ font-size: 16px;
91
+ padding: 0;
92
+ box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
93
+ }
94
+
95
+ .__button_container:hover .__close_button {
96
+ opacity: 1;
97
+ }
98
+
99
+ @media (max-width: 768px) {
100
+ .__close_button {
101
+ opacity: 1;
102
+ }
103
+ }
104
+
105
+ .__button_span {
106
+ display: flex;
107
+ align-items: center;
108
+ font-size: 12px;
109
+ font-weight: 500;
110
+ line-height: 20px;
111
+ word-spacing: 0px;
112
+ gap: 3px;
113
+ -webkit-user-select: none;
114
+ user-select: none;
115
+ }
116
+
117
+ .__button_span img {
118
+ display: inline-block;
119
+ -webkit-user-select: none;
120
+ user-select: none;
121
+ }
122
+
123
+ @media (prefers-color-scheme: dark) {
124
+ .__button_button {
125
+ border: 1px solid rgb(30, 41, 59);
126
+ background-image: linear-gradient(to top, rgb(2, 8, 23), rgb(30, 41, 59));
127
+ color: rgba(255, 255, 255, 0.7);
128
+ }
129
+
130
+ .__button_button:hover {
131
+ color: rgba(255, 255, 255, 0.9);
132
+ }
133
+
134
+ .__close_button {
135
+ background: hsl(217.2, 32.6%, 17.5%);
136
+ color: rgb(226, 232, 240);
137
+ }
138
+
139
+ .__close_button:hover {
140
+ background: hsl(217.2, 32.6%, 21.5%);
141
+ color: rgb(248, 250, 252);
142
+ }
143
+ }`,globalThis.document.head.appendChild(a);let o=globalThis.document.createElement("div");o.className="__drawer_container __hidden";let I=globalThis.document.createElement("iframe");I.className="__drawer_frame __hidden",I.id="__AUTH_DRAWER",I.setAttribute("allow","fullscreen; camera; microphone; gyroscope; accelerometer; clipboard-write; clipboard-read; autoplay; geolocation; display-capture; picture-in-picture; payment; midi; bluetooth; web-share; screen-wake-lock; xr-spatial-tracking; encrypted-media; idle-detection; hid; serial; window-management"),I.loading="eager",I.referrerPolicy="unsafe-url",I.title="Login";let c=globalThis.document.createElement("div");c.setAttribute("alt","Close"),c.className="__auth_close_button",o.appendChild(I),o.appendChild(c),globalThis.document.body.appendChild(o);let e=globalThis.document.querySelector(".__auth_close_button");function t(){o.classList.add("__hidden"),I.classList.add("__hidden");}e?.addEventListener("click",t),o.addEventListener("click",t);}async function sn({channelId:a,initialData:o,broadcastOnly:I,onUpdate:c}){let e=o,t=0,m=globalThis.window.__REALTIME_DOMAIN__;if(I)return {getData(){return e},setData(v){e=v,fetch(`https://${m}/${a}`,{method:"POST",body:mt.stringify(e)}).catch(console.error),c?.(v);},destroy(){}};let l=new WebSocket(`wss://${m}/${a}`);return new Promise((v,E)=>{function r(w){try{let C=JSON.parse(w.data.toString());C?.id&&C.id>t?(e=mt.parse(C.payload),c?.(e),t=C.id):console.error("Invalid message:",w.data);}catch{console.error("Error parsing message:",w.data);}}function i(w){h(),E(w);}function n(){v({getData(){return e},setData(w){e=w,c?.(w),l.send(mt.stringify(w));},destroy:h});}function h(){l.removeEventListener("message",r),l.removeEventListener("error",i),l.removeEventListener("open",n),l.close();}l.addEventListener("message",r),l.addEventListener("error",i),l.addEventListener("open",n);})}function ln(a,o){let I=useRef(null),[c,e]=useState(0);return useEffect(()=>((async()=>a&&(I.current=await sn({channelId:a,initialData:o,onUpdate:()=>{e(t=>t+1);}})))(),I.current?.destroy),[a,e]),[I.current?.getData(),I.current?.setData??identity]}function dr(a){let[o,I]=useState(null),[c]=ln(o,void 0),e=a.mutationFn;if(!e)throw new Error("useRealtimeMutation requires a mutationFn option.");let t=useCallback(async l=>{let v=nanoid(32);return I(v),await e({...l,__channelId:v})},[a?.mutationFn]);return {...useMutation({...a,mutationFn:t}),data:c}}function cn(a){return a?.message?.startsWith("__MISSING AUTH FOR SCOPE")}function dn(a){return a[0]}function pr(a){let I=a?.message?.slice("__MISSING AUTH FOR SCOPE:".length+1).trim()??"",c=JSON.parse(atob(I.split(" ")?.[0])),e=c?.provider,t=c?.scope;return {provider:e,scope:t,isPopup:a?.message?.endsWith("--popup"),accountId:c?.accountId}}var gr=60,mr=30*1e3,yt=0,hn=Date.now(),At=false;function yr(){return rpcClient({transport:async(a,o)=>{let I=Date.now();if(I-hn>=mr)hn=I,yt=0,At=false;else if(yt>=gr)throw At||(globalThis.window.dispatchEvent(new Event("rate-limit-exceeded")),At=true),new RpcError("Rate limit exceeded",-32e3,{status:429});yt++;let c="/api/"+a.method,e=a.params&&dn(a.params)?.__channelId;e&&delete dn(a.params)?.__channelId;let t=await fetch(c,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...e?{"x-channel-id":e}:{},...globalThis.window.__IS_TESTING__?{"x-is-testing":"true"}:{},"x-boxman-box-id":globalThis.window.__BOX_ID__},body:mt.stringify(a),signal:o});if(!t.ok){let l=t.statusText,v=-32e3;try{let{message:E,code:r}=await t.json();E&&(l=E),r&&(v=r);}catch{}throw l.trim()===""&&(l=`Request failed with status: ${t.status}`),new RpcError(l,v,{status:t.status})}let m=mt.deserialize(await t.json());if(cn(m.error)){let l=encodeURIComponent(globalThis.window.location.pathname+globalThis.window.location.search),v=pr(m.error),E=[`returnTo=${l}`,v.provider?`&provider=${v.provider}`:"",v.scope?`&scope=${v.scope.join(",")}`:"",v.accountId?`&accountId=${v.accountId}`:""].filter(Boolean).join("&");if(v.isPopup){globalThis.window.__OPEN_AUTH_DRAWER__(`${globalThis.window.__ROOT_URL__}/setup/${globalThis.window.__APP_ID__}?${E}&stripped=true`);return}let r=globalThis.window.top??globalThis.window;return r.location.href=`${globalThis.window.__ROOT_URL__}/setup/${globalThis.window.__APP_ID__}?${E}`,null}return m}})}function $r(a){return new Promise(o=>{let I=new globalThis.FileReader;I.onload=()=>{o(I.result);},I.readAsDataURL(a);})}function Ar(){let a={...globalThis.window.console};function o(I,c){let e=(0, gn.default)(c,{depth:5,maxStringLength:512,indent:2});fetch("/_logger",{method:"POST",body:`[console.${I.toLowerCase()}] ${e}`}).catch(()=>{});}globalThis.window.console.log=(...I)=>{o("LOG",I),a.log(...I);},globalThis.window.console.error=(...I)=>{o("ERROR",I),a.error(...I);},globalThis.window.console.info=(...I)=>{o("INFO",I),a.info(...I);},globalThis.window.console.warn=(...I)=>{o("WARN",I),a.warn(...I);};}function vr(){function a(o,I=globalThis.window.parent,c="*"){I?.postMessage({...o,source:"iframe"},{targetOrigin:c});}globalThis.window.addEventListener("message",async o=>{let{origin:I,source:c,data:e}=o,{type:t}=e;if(t==="screenshot"){let m=globalThis.window.getComputedStyle(globalThis.document.body).backgroundColor,l=await pn.default.toPng(globalThis.document.body,{bgcolor:m,style:{transform:"translateY("+-globalThis.window.scrollY+"px)"},width:globalThis.window.innerWidth,height:globalThis.window.innerHeight,copyDefaultStyles:false}),v=await fetch(l).then(n=>n.blob()),E=await re(v,{maxSizeMB:4,maxWidthOrHeight:1920,useWebWorker:false}),i={type:"screenshot",payload:{screenshot:await re.getDataUrlFromFile(E)}};a(i,c,I);}});}function Wr({appId:a,rootUrl:o,baseUrl:I,isTesting:c,realtimeDomain:e,boxId:t}){typeof globalThis.window>"u"||globalThis.window.__APP_ID__||(globalThis.window.__APP_ID__=a,globalThis.window.__ROOT_URL__=o,globalThis.window.__BASE_URL__=I,globalThis.window.__IS_TESTING__=c,globalThis.window.__REALTIME_DOMAIN__=e,globalThis.window.__BOX_ID__=t,vr(),Ar(),on());}function zr(){return globalThis.window.__BASE_URL__}/*! Bundled license information:
25
144
 
26
145
  dom-to-image-more/dist/dom-to-image-more.min.js:
27
146
  (*! 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};
147
+ */export{yr as apiClient,sn as connectToRealtimeStore,$r as encodeFileAsBase64DataURL,zr as getBaseUrl,Wr as initializeClientEnvironment,dr as useRealtimeMutation,ln as useRealtimeStore};
@@ -1,382 +1,98 @@
1
- import * as z from 'zod';
2
- import { ChatCompletionMessageParam, ChatCompletionContentPart, ChatCompletionMessageFunctionToolCall } from 'openai/resources';
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { createTRPCProxyClient } from '@trpc/client';
3
4
 
4
- declare const ProductKind: {
5
- readonly SUBSCRIPTION: "SUBSCRIPTION";
6
- readonly IN_APP_PURCHASE: "IN_APP_PURCHASE";
7
- };
8
- type ProductKind = (typeof ProductKind)[keyof typeof ProductKind];
9
5
  declare const AuthProvider: {
10
- readonly GITHUB_USER: "GITHUB_USER";
11
- readonly GITHUB_BOT: "GITHUB_BOT";
12
- readonly GOOGLE: "GOOGLE";
13
- readonly AC1: "AC1";
14
- readonly SLACK: "SLACK";
15
- readonly SLACK_BOT: "SLACK_BOT";
16
- readonly DISCORD: "DISCORD";
17
- readonly NOTION: "NOTION";
18
- readonly TWITTER: "TWITTER";
19
- readonly LINKEDIN: "LINKEDIN";
20
- readonly YAHOO: "YAHOO";
21
- readonly FIGMA: "FIGMA";
22
- };
23
- type AuthProvider = (typeof AuthProvider)[keyof typeof AuthProvider];
24
- type CatalogVoice = {
25
- id: string;
26
- name: string;
27
- description?: string;
28
- previewUrl: string;
29
- tier: 'FREE' | 'ONE' | 'TWO';
6
+ readonly GITHUB_USER: "GITHUB_USER";
7
+ readonly GITHUB_BOT: "GITHUB_BOT";
8
+ readonly GOOGLE: "GOOGLE";
9
+ readonly AC1: "AC1";
10
+ readonly SLACK: "SLACK";
11
+ readonly SLACK_BOT: "SLACK_BOT";
12
+ readonly DISCORD: "DISCORD";
13
+ readonly NOTION: "NOTION";
14
+ readonly TWITTER: "TWITTER";
15
+ readonly LINKEDIN: "LINKEDIN";
16
+ readonly YAHOO: "YAHOO";
17
+ readonly FIGMA: "FIGMA";
30
18
  };
31
- type CatalogImageModel = {
32
- id: string;
33
- name: string;
34
- description?: string;
35
- tier: 'FREE' | 'ONE' | 'TWO';
19
+ export type AuthProvider = (typeof AuthProvider)[keyof typeof AuthProvider];
20
+ export type ProviderInput = {
21
+ provider: AuthProvider;
22
+ scope?: string[];
23
+ redirectUri?: string;
36
24
  };
37
- declare const AgentDefinitions: {
38
- readonly ProductManagerAgent: "ProductManagerAgent";
39
- readonly AppDeveloperAgent: "AppDeveloperAgent";
25
+ export type RedirectInput = {
26
+ email: string;
27
+ provider: "AC1";
28
+ phoneNumber: null | undefined;
29
+ } | {
30
+ phoneNumber: string;
31
+ provider: "AC1";
32
+ email: null | undefined;
33
+ } | ProviderInput;
34
+ export type RequestContext = {
35
+ requestId: string;
36
+ channelId?: string;
37
+ hasTasks?: boolean;
40
38
  };
41
- interface ChatCompletionContentPartThinking {
42
- thought: string;
43
- signature?: string;
44
- provider: string;
45
- }
46
- interface ChatCompletionContentPartPDF {
47
- pdf_url: ChatCompletionContentPartPDF.PDFURL;
48
- /**
49
- * The type of the content part.
50
- */
51
- type: 'pdf_url';
52
- }
53
- declare namespace ChatCompletionContentPartPDF {
54
- interface PDFURL {
55
- /**
56
- * The URL of the PDF file.
57
- */
58
- url: string;
59
- }
60
- }
61
- interface ChatCompletionContentPartVideo {
62
- video_url: ChatCompletionContentPartVideo.VideoURL;
63
- /**
64
- * The type of the content part.
65
- */
66
- type: 'video_url';
67
- }
68
- declare namespace ChatCompletionContentPartVideo {
69
- interface VideoURL {
70
- /**
71
- * The URL of the video file.
72
- */
73
- url: string;
74
- }
75
- }
76
- interface ChatCompletionContentPartAudio {
77
- audio_url: ChatCompletionContentPartAudio.AudioURL;
78
- /**
79
- * The type of the content part.
80
- */
81
- type: 'audio_url';
39
+ export interface EmailHandlerInput {
40
+ subject: string;
41
+ body: string;
42
+ fromUserId: string;
82
43
  }
83
- declare namespace ChatCompletionContentPartAudio {
84
- interface AudioURL {
85
- /**
86
- * The URL of the audio file.
87
- */
88
- url: string;
89
- }
90
- }
91
- type ExternalApiMessage = {
92
- role: Exclude<ChatCompletionMessageParam['role'], 'function'>;
93
- content?: string | Array<(ChatCompletionContentPart & {
94
- cache_control?: {
95
- type: 'ephemeral';
96
- };
97
- }) | (ChatCompletionContentPartPDF & {
98
- cache_control?: {
99
- type: 'ephemeral';
100
- };
101
- }) | (ChatCompletionContentPartVideo & {
102
- cache_control?: {
103
- type: 'ephemeral';
104
- };
105
- }) | (ChatCompletionContentPartAudio & {
106
- cache_control?: {
107
- type: 'ephemeral';
108
- };
109
- })>;
110
- id?: string;
111
- tool_call_id?: string | null;
112
- tool_calls?: Array<ChatCompletionMessageFunctionToolCall> | null;
113
- thinking?: ChatCompletionContentPartThinking;
114
- name?: 'client' | 'attachments' | keyof typeof AgentDefinitions | null;
44
+ declare let client: ReturnType<typeof createTRPCProxyClient<GuestServicesRouter>>;
45
+ export declare function initializeServerEnvironment({ baseUrl, realtimeDomain, guestServicesUrl, }: {
46
+ baseUrl: string;
47
+ realtimeDomain: string;
48
+ guestServicesUrl: string;
49
+ }): void;
50
+ export type MutationProxy<TClient> = {
51
+ [K in keyof TClient as TClient[K] extends {
52
+ mutate: (...args: any) => any;
53
+ } ? K : never]: TClient[K] extends {
54
+ mutate: (...args: infer TArgs) => infer TReturn;
55
+ } ? (args: TArgs[0]) => TReturn : never;
115
56
  };
116
- declare global {
117
- interface EmailHandlerInput {
118
- subject: string;
119
- body: string;
120
- fromUserId: string;
121
- }
122
- interface Window {
123
- __VERSION_ID__?: string;
124
- __APP_ID__: string;
125
- __IS_TESTING__: boolean;
126
- __ROOT_URL__: string;
127
- __BASE_URL__: string;
128
- __REALTIME_DOMAIN__: string;
129
- __OPEN_AUTH_DRAWER__: (url: string) => void;
130
- }
131
- }
132
-
133
- interface RequestContext {
134
- requestId: string;
135
- channelId?: string;
136
- hasTasks?: boolean;
137
- }
138
- declare function getRequestContext(): RequestContext | undefined;
139
- declare function setRequestContext(context: Partial<RequestContext>): void;
140
- declare function runWithContext<T>(context: RequestContext, fn: () => Promise<T>): Promise<T>;
141
- type RedirectInput = {
142
- email: string;
143
- provider: typeof AuthProvider.AC1;
144
- phoneNumber: null | undefined;
145
- } | {
146
- phoneNumber: string;
147
- provider: typeof AuthProvider.AC1;
148
- email: null | undefined;
149
- } | {
150
- provider: (typeof AuthProvider)[keyof typeof AuthProvider];
57
+ export type MCP = MutationProxy<typeof client>;
58
+ export declare const mcp: MCP;
59
+ export declare function getRequestContext(): RequestContext | undefined;
60
+ export declare function setRequestContext(context: Partial<RequestContext>): void;
61
+ export declare function runWithContext<T>(context: RequestContext, fn: () => Promise<T>): Promise<T>;
62
+ export declare function getBaseUrl(): string;
63
+ export declare function getLastStreamTime(): number | null;
64
+ export declare function getRealtimeStore<T extends object>({ channelId, onUpdate, }: {
65
+ channelId: string;
66
+ onUpdate?: (data: T) => void;
67
+ }): {
68
+ destroy(): void;
151
69
  };
70
+ export declare function setRealtimeStore<T extends object>({ channelId, data, }: {
71
+ channelId: string;
72
+ data: T;
73
+ }): Promise<void>;
74
+ export declare function startRealtimeResponse<T extends object>(): Promise<{
75
+ next(data: T): void;
76
+ end(): T;
77
+ }>;
152
78
  declare function signIn(input?: RedirectInput): void;
153
- declare function getUserId(input?: {
154
- throwIfNotLoggedIn?: boolean;
155
- }): Promise<string | null>;
156
- type AuthStatus = {
157
- status: 'authenticated';
158
- userId: string;
159
- signIn: typeof signIn;
160
- providers: AuthProvider[];
79
+ export type AuthStatus = {
80
+ status: "authenticated";
81
+ userId: string;
82
+ signIn: typeof signIn;
83
+ providers: AuthProvider[];
161
84
  } | {
162
- status: 'unauthenticated';
163
- userId: null;
164
- signIn: typeof signIn;
165
- providers: [];
85
+ status: "unauthenticated";
86
+ userId: null;
87
+ signIn: typeof signIn;
88
+ providers: [
89
+ ];
166
90
  };
167
- declare function getAuth(input: {
168
- required: true;
91
+ export declare function getAuth(input: {
92
+ required: true;
169
93
  }): Promise<AuthStatus>;
170
- declare function getAuth(input?: {
171
- required?: boolean;
94
+ export declare function getAuth(input?: {
95
+ required?: boolean;
172
96
  }): Promise<AuthStatus>;
173
- type TaskStatus = {
174
- id: string;
175
- status: 'RUNNING' | 'COMPLETED' | 'FAILED';
176
- error?: any;
177
- } | {
178
- id: string;
179
- status: 'UNKNOWN';
180
- };
181
- declare function queueTask(runner: () => Promise<void>): Promise<TaskStatus>;
182
- declare function getTaskStatus(taskId: string): Promise<TaskStatus>;
183
- declare function getStructuredDataFromContent<T>(input: {
184
- url: string;
185
- base64?: never;
186
- schema: z.ZodSchema<T>;
187
- } | {
188
- url?: never;
189
- base64: string;
190
- schema: z.ZodSchema<T>;
191
- }): Promise<T>;
192
- declare function extractTextFromContent(input: {
193
- url: string;
194
- base64?: never;
195
- outputFormat: 'raw' | 'formatted-markdown';
196
- } | {
197
- url?: never;
198
- base64: string;
199
- outputFormat: 'raw' | 'formatted-markdown';
200
- }): Promise<string>;
201
- declare function requestMultimodalModel<T>(input: {
202
- messages: ExternalApiMessage[];
203
- system?: string;
204
- returnType: z.ZodSchema<T>;
205
- model?: 'small' | 'medium' | 'large';
206
- temperature?: number;
207
- stream?: (data: Partial<T>) => void;
208
- onProgress?: (data: Array<{
209
- toolName: string;
210
- inProgressMessage: string;
211
- status: 'in_progress' | 'done';
212
- thinking: string;
213
- }>) => void;
214
- customTools?: Array<{
215
- name: string;
216
- displayName: string;
217
- description: string;
218
- inputSchema: z.ZodSchema<any>;
219
- inProgressMessage: string;
220
- }>;
221
- }): Promise<T>;
222
- declare function textToImage(input: {
223
- text: string;
224
- size?: 'square_hd' | 'square' | 'portrait_4_3' | 'portrait_16_9' | 'landscape_4_3' | 'landscape_16_9';
225
- }): Promise<string | null>;
226
- declare function textToSpeech(input: {
227
- text: string;
228
- voice?: 'Will' | 'Brian' | 'George' | 'Jessica' | 'Liam' | 'Alice' | 'Sarah' | 'Charlotte' | 'Matilda' | 'Eric' | 'Alloy' | 'Ash' | 'Ballad' | 'Coral' | 'Echo' | 'Fable' | 'Nova' | 'Onyx' | 'Sage' | 'Shimmer';
229
- }): Promise<{
230
- url: string;
231
- duration: number | undefined;
232
- } | null>;
233
- declare function generateSoundEffect(input: {
234
- text: string;
235
- durationInSeconds?: number;
236
- promptInfluence?: number;
237
- loop?: boolean;
238
- }): Promise<any>;
239
- declare function generateDialogue(input: {
240
- inputs: {
241
- character: string;
242
- text: string;
243
- }[];
244
- }): Promise<{
245
- url: string;
246
- duration: number | undefined;
247
- }>;
248
- declare function generateMusic(input: {
249
- text: string;
250
- }): Promise<string>;
251
- declare function upload(input: {
252
- bufferOrBase64: Buffer | string;
253
- fileName: string;
254
- }): Promise<string>;
255
- declare function getOAuthToken(input: {
256
- connectionId: string;
257
- }): Promise<{
258
- connectionId: string;
259
- userId: string | null;
260
- accessToken: string | null;
261
- expiresAt: Date | null;
262
- scope: string[];
263
- }>;
264
- declare function getOAuthConnectionForCurrentUser(input: {
265
- provider: Exclude<AuthProvider, 'AC1'>;
266
- scope?: string[];
267
- required?: boolean;
268
- }): Promise<{
269
- id: string;
270
- provider: string;
271
- userId: string | undefined;
272
- scope: string[];
273
- } | null>;
274
- declare function getOAuthConnection(input: {
275
- connectionId: string;
276
- }): Promise<{
277
- id: string;
278
- provider: string;
279
- userId: string | undefined;
280
- scope: string[];
281
- }>;
282
- declare function queryOAuthConnections(input: {
283
- userId?: string;
284
- provider?: Exclude<AuthProvider, 'AC1'>;
285
- scope?: string[];
286
- }): Promise<{
287
- id: string;
288
- provider: string;
289
- userId: string | undefined;
290
- scope: string[];
291
- }[]>;
292
- declare function deleteOAuthConnection(input: {
293
- connectionId: string;
294
- }): Promise<{
295
- readonly ok: true;
296
- }>;
297
- declare function sendEmail(input: {
298
- markdown: string;
299
- subject: string;
300
- toUserId: string;
301
- }): Promise<void>;
302
- declare function inviteUser(input: {
303
- email: string;
304
- subject?: string;
305
- markdown: string;
306
- unauthenticatedLinks?: boolean;
307
- }): Promise<{
308
- id: string;
309
- }>;
310
- declare function searchWithGoogle(input: {
311
- query: string;
312
- }): Promise<{
313
- answer: string | undefined;
314
- sources: {
315
- title: string;
316
- url: string;
317
- }[];
318
- }>;
319
- declare function isAppOwner(): Promise<boolean>;
320
- declare function generateCrossAppToken(input: {
321
- appId: string;
322
- }): Promise<string>;
323
- declare function createProduct(input: {
324
- name: string;
325
- description: string;
326
- price: number;
327
- kind: ProductKind;
328
- }): Promise<{
329
- purchaseLink: string;
330
- id: string;
331
- description: string;
332
- name: string;
333
- kind: ProductKind;
334
- price: number;
335
- }>;
336
- declare function listProducts(): Promise<{
337
- id: string;
338
- name: string;
339
- description: string;
340
- kind: ProductKind;
341
- price: number;
342
- purchaseLink: string;
343
- }[]>;
344
- declare function listUserPurchases(input?: {
345
- userId: string;
346
- }): Promise<{
347
- id: string;
348
- kind: ProductKind;
349
- description: string;
350
- name: string;
351
- price: number;
352
- }[]>;
353
- declare function discontinueProduct(input: {
354
- productId: string;
355
- }): Promise<void>;
356
- declare function getRealtimeStore<T extends object>({ channelId, onUpdate, }: {
357
- channelId: string;
358
- onUpdate?: (data: T) => void;
359
- }): {
360
- destroy(): void;
361
- };
362
- declare function setRealtimeStore<T extends object>({ channelId, data, }: {
363
- channelId: string;
364
- data: T;
365
- }): Promise<void>;
366
- declare function startRealtimeResponse<T extends object>(): Promise<{
367
- next(data: T): void;
368
- end(): T;
369
- }>;
370
- declare function getTTSVoicesCatalog(input: {
371
- limit: number;
372
- }): Promise<CatalogVoice[]>;
373
- declare function getDialogueVoicesCatalog(input: {
374
- limit: number;
375
- }): Promise<CatalogVoice[]>;
376
- declare function getImageModelsCatalog(input: {
377
- limit: number;
378
- }): Promise<CatalogImageModel[]>;
379
- declare function getBaseUrl(): string;
380
- declare function getLastStreamTime(): number | null;
381
97
 
382
- export { createProduct, deleteOAuthConnection, discontinueProduct, extractTextFromContent, generateCrossAppToken, generateDialogue, generateMusic, generateSoundEffect, getAuth, getBaseUrl, getDialogueVoicesCatalog, getImageModelsCatalog, getLastStreamTime, getOAuthConnection, getOAuthConnectionForCurrentUser, getOAuthToken, getRealtimeStore, getRequestContext, getStructuredDataFromContent, getTTSVoicesCatalog, getTaskStatus, getUserId, inviteUser, isAppOwner, listProducts, listUserPurchases, queryOAuthConnections, queueTask, requestMultimodalModel, runWithContext, searchWithGoogle, sendEmail, setRealtimeStore, setRequestContext, startRealtimeResponse, textToImage, textToSpeech, upload };
98
+ export {};
@@ -1,2 +1,2 @@
1
- import {createTRPCProxyClient,httpLink}from'@trpc/client';import {AsyncLocalStorage}from'async_hooks';import {nanoid}from'nanoid';import S from'superjson';import*as I from'zod';import {z}from'zod';function C(e){let t=Object.create(null);for(let r in e){let n=e[r];t[n]=r;}return t}var E={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};C(E);C(E);typeof window>"u"||"Deno"in window||globalThis.process?.env?.NODE_ENV==="test"||!!globalThis.process?.env?.JEST_WORKER_ID||!!globalThis.process?.env?.VITEST_WORKER_ID;var h=class e extends Error{static prefix="__MISSING AUTH FOR SCOPE";static jsonRpcCode=-32001;constructor({provider:t,scope:r,accountId:n,popup:o=false}){let s=btoa(JSON.stringify({provider:t,scope:r,accountId:n}));super(`${e.prefix}: ${s}${o?" --popup":" end"}`);}jsonRpcError(){return {code:e.jsonRpcCode,message:this.message}}static check(t){return t?.message?.startsWith(e.prefix)}};var we=z.object({GUEST_SERVICES_URL:z.string().url().default("http://localhost:3000/trpc"),VITE_REALTIME_DOMAIN:z.string().default("localhost:3002"),VITE_BASE_URL:z.string().url().default("http://localhost:3001"),NODE_ENV:z.enum(["development","production","test"]).default("development")}),F=we.safeParse({GUEST_SERVICES_URL:process.env.GUEST_SERVICES_URL,VITE_REALTIME_DOMAIN:process.env.VITE_REALTIME_DOMAIN,VITE_BASE_URL:process.env.VITE_BASE_URL,NODE_ENV:process.env.NODE_ENV});if(!F.success)throw console.error("Invalid environment variables:",F.error.format()),new Error("Invalid environment variables");var _=F.data;var ee=new AsyncLocalStorage,U=null,Q=new Set,v=null;function u(){return U||(U=createTRPCProxyClient({transformer:S,links:[httpLink({url:_.GUEST_SERVICES_URL,transformer:S,headers:()=>{let e=q();if(!e)throw new Error("Missing request context");return {"x-request-id":e.requestId}}})]})),U}function q(){return ee.getStore()}function _e(e){let t=q();t&&Object.assign(t,e);}async function Xe(e,t){return ee.run(e,t)}function Z(e){throw new h({provider:e?.provider??"AC1",popup:true})}async function et(e){let r=await u().getCurrentUser.mutate(e);if(r?.error==="SEED")throw new Error('Call to "getUserId" in seed function is not allowed. Seed functions should not depend on user data.');if(!r?.userId){if(e?.throwIfNotLoggedIn??true)throw new h({provider:"AC1"});return null}return r.userId}async function tt(e){let r=await u().getCurrentUser.mutate({throwIfNotLoggedIn:e?.required});if(r?.error==="SEED")throw new Error('Call to "getAuth" in seed function is not allowed. Seed functions should not depend on user data.');if(r.userId)return {userId:r.userId,status:"authenticated",signIn:Z,providers:r.providers};if(e?.required)throw new h({provider:"AC1"});return {userId:null,status:"unauthenticated",signIn:Z,providers:[]}}async function rt(e){let t=u(),r=await t.upsertTaskStatus.mutate({status:"RUNNING"});return Q.add(r.id),_e({hasTasks:true}),(async()=>{let n=r.id;try{await e(),await t.upsertTaskStatus.mutate({id:n,status:"COMPLETED"});}catch(o){console.error(`Task ${n} failed:`,o.message),await t.upsertTaskStatus.mutate({id:n,status:"FAILED",error:o});}finally{Q.delete(r.id);}})(),r}async function nt(e){return await u().getTaskStatus.mutate({id:e})}async function ot(e){let t=u(),r={...e,schema:I.toJSONSchema(e.schema)};return await t.extractStructuredDataFromContent.mutate(r)}async function st(e){return await u().extractTextFromContent.mutate(e)}async function it(e){let t=u(),{stream:r,onProgress:n,...o}=e,s={...o,returnType:I.toJSONSchema(e.returnType),customTools:e.customTools?.map(d=>({...d,inputSchema:I.toJSONSchema(d.inputSchema)}))};if(r??n){let d=nanoid(32),a=new WebSocket(`wss://${_.VITE_REALTIME_DOMAIN}/${d}`),l=-1,c=p=>{v=Date.now();try{let g=JSON.parse(p.data.toString());if(g?.id&&g.id>l){let te=S.parse(g.payload);g.requestAgentToolCalls instanceof Array?n?.(g.requestAgentToolCalls):r?.(te),l=g.id;}}catch{}};a.addEventListener("message",c);let m=await t.requestMultimodalModel.mutate({...s,realtimeChannelId:d});return r&&r(m),a.close(),a.removeEventListener("message",c),m}return await t.requestMultimodalModel.mutate(s)}async function at(e){return await u().textToImage.mutate(e)}async function ut(e){return await u().textToSpeech.mutate(e)}async function ct(e){return await u().generateSoundEffect.mutate(e)}async function dt(e){return await u().generateDialogue.mutate(e)}async function lt(e){return await u().generateMusic.mutate(e)}async function ft(e){let t=u(),r;return typeof e.bufferOrBase64=="string"?r=e.bufferOrBase64:r=e.bufferOrBase64.toString("base64"),await t.uploadToBucket.mutate({base64:r,fileName:e.fileName})}async function pt(e){return await u().getOAuthToken.mutate({connectionId:e.connectionId})}async function mt(e){let r=await u().getOAuthConnectionForCurrentUser.mutate({...e,scope:e.scope??[]});if(!r&&e.required)throw new h({provider:e.provider,scope:e.scope,popup:true});return r}async function gt(e){return await u().getOAuthConnection.mutate(e)}async function wt(e){return await u().queryOAuthConnections.mutate(e)}async function ht(e){return await u().deleteOAuthConnection.mutate(e)}async function Et(e){await u().sendEmail.mutate(e);}async function yt(e){let t=u();if(!e.email)throw new Error("Email is required");if(!e.markdown)throw new Error("`markdown` content is required when inviting by email");return await t.inviteUser.mutate(e)}async function Tt(e){return await u().searchWithGoogle.mutate(e)}async function _t(){return await u().isAppOwner.mutate()}async function Rt(e){return await u().generateCrossAppToken.mutate(e)}async function St(e){return await u().createProduct.mutate(e)}async function Pt(){return await u().listProducts.mutate()}async function It(e){return await u().listUserPurchases.mutate(e)}async function vt(e){await u().discontinueProduct.mutate(e);}function xt({channelId:e,onUpdate:t}){let r=new WebSocket(`wss://${_.VITE_REALTIME_DOMAIN}/${e}`),n=-1;function o(s){t&&(v=Date.now());try{let i=JSON.parse(s.data.toString());if(i?.id&&i.id>n){let d=S.parse(i.payload);t?.(d),n=i.id;}}catch{}}return r.addEventListener("message",o),{destroy(){r.close(),r.removeEventListener("message",o);}}}async function X({channelId:e,data:t}){v=Date.now(),await fetch(`https://${_.VITE_REALTIME_DOMAIN}/${e}`,{method:"POST",body:S.stringify(t)}).catch(console.error);}async function Ot(){let e,t=q()?.channelId;if(!t)throw new Error("API's using `startRealtimeResponse` must be called via `useRealtimeMutation`.");return {next(r){e=r,X({channelId:t,data:r});},end(){return X({channelId:t,data:e}),e}}}async function Ct(e){return await u().getTTSVoicesCatalog.mutate(e)}async function bt(e){return await u().getDialogueVoicesCatalog.mutate(e)}async function At(e){return await u().getImageModelsCatalog.mutate(e)}function Nt(){return _.VITE_BASE_URL}function Dt(){return v}
2
- export{St as createProduct,ht as deleteOAuthConnection,vt as discontinueProduct,st as extractTextFromContent,Rt as generateCrossAppToken,dt as generateDialogue,lt as generateMusic,ct as generateSoundEffect,tt as getAuth,Nt as getBaseUrl,bt as getDialogueVoicesCatalog,At as getImageModelsCatalog,Dt as getLastStreamTime,gt as getOAuthConnection,mt as getOAuthConnectionForCurrentUser,pt as getOAuthToken,xt as getRealtimeStore,q as getRequestContext,ot as getStructuredDataFromContent,Ct as getTTSVoicesCatalog,nt as getTaskStatus,et as getUserId,yt as inviteUser,_t as isAppOwner,Pt as listProducts,It as listUserPurchases,wt as queryOAuthConnections,rt as queueTask,it as requestMultimodalModel,Xe as runWithContext,Tt as searchWithGoogle,Et as sendEmail,X as setRealtimeStore,_e as setRequestContext,Ot as startRealtimeResponse,at as textToImage,ut as textToSpeech,ft as upload};
1
+ import {createTRPCProxyClient,httpLink}from'@trpc/client';import {AsyncLocalStorage}from'async_hooks';import g from'superjson';function S(e){let r=Object.create(null);for(let t in e){let n=e[t];r[n]=t;}return r}var w={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};S(w);S(w);typeof window>"u"||"Deno"in window||globalThis.process?.env?.NODE_ENV==="test"||!!globalThis.process?.env?.JEST_WORKER_ID||!!globalThis.process?.env?.VITEST_WORKER_ID;var y=class e extends Error{static prefix="__MISSING AUTH FOR SCOPE";static jsonRpcCode=-32001;constructor({provider:r,scope:t,accountId:n,popup:o=false}){let s=btoa(JSON.stringify({provider:r,scope:t,accountId:n}));super(`${e.prefix}: ${s}${o?" --popup":" end"}`);}jsonRpcError(){return {code:e.jsonRpcCode,message:this.message}}static check(r){return r?.message?.startsWith(e.prefix)}};var C=null;function je({baseUrl:e,realtimeDomain:r,guestServicesUrl:t}){globalThis.env||(globalThis.env={},globalThis.env.BASE_URL=e,globalThis.env.REALTIME_DOMAIN=r,globalThis.env.GUEST_SERVICES_URL=t,C=createTRPCProxyClient({transformer:g,links:[httpLink({url:t,transformer:g,headers:()=>{let n=A();if(!n)throw new Error("Missing request context");return {"x-request-id":n.requestId}}})]}),console.log("Adaptive SDK server environment initialized"));}var z=new AsyncLocalStorage,fe=new Proxy({},{get(e,r){return async t=>{if(!C)throw new Error("Adaptive SDK server environment is not initialized. Please call initializeServerEnvironment first.");let o=C[r];if(!o||typeof o.mutate!="function")throw new Error(`Property "${String(r)}" is not a mutation procedure`);return o.mutate(t)}}});function A(){return z.getStore()}function Le(e){let r=A();r&&Object.assign(r,e);}async function $e(e,r){return z.run(e,r)}function Be(){return globalThis.env.BASE_URL}var N=null;function Ve(){return N}function Ye({channelId:e,onUpdate:r}){let t=new WebSocket(`wss://${globalThis.env.REALTIME_DOMAIN}/${e}`),n=-1;function o(s){r&&(N=Date.now());try{let i=JSON.parse(s.data.toString());if(i?.id&&i.id>n){let d=g.parse(i.payload);r?.(d),n=i.id;}}catch{}}return t.addEventListener("message",o),{destroy(){t.close(),t.removeEventListener("message",o);}}}async function K({channelId:e,data:r}){N=Date.now(),await fetch(`https://${globalThis.env.REALTIME_DOMAIN}/${e}`,{method:"POST",body:g.stringify(r)}).catch(console.error);}async function Ke(){let e,r=A()?.channelId;if(!r)throw new Error("API's using `startRealtimeResponse` must be called via `useRealtimeMutation`.");return {next(t){e=t,K({channelId:r,data:t});},end(){return K({channelId:r,data:e}),e}}}function H(e){throw new y({provider:e?.provider??"AC1",popup:true})}async function He(e){let r=await fe.getCurrentUser();if(r?.error==="SEED")throw new Error('Call to "getAuth" in seed function is not allowed. Seed functions should not depend on user data.');if(r.userId)return {userId:r.userId,status:"authenticated",signIn:H,providers:r.providers};if(e?.required)throw new y({provider:"AC1"});return {userId:null,status:"unauthenticated",signIn:H,providers:[]}}
2
+ export{He as getAuth,Be as getBaseUrl,Ve as getLastStreamTime,Ye as getRealtimeStore,A as getRequestContext,je as initializeServerEnvironment,fe as mcp,$e as runWithContext,K as setRealtimeStore,Le as setRequestContext,Ke as startRealtimeResponse};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptive-ai/sdk",
3
- "version": "0.0.9",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,14 +19,16 @@
19
19
  "LICENSE"
20
20
  ],
21
21
  "peerDependencies": {
22
- "@tanstack/react-query": ">=4",
22
+ "@tanstack/react-query": ">=5",
23
23
  "@trpc/client": ">=10",
24
+ "@trpc/server": ">=10",
25
+ "typed-rpc": ">=5",
24
26
  "lodash": ">=4",
25
27
  "nanoid": ">=4",
26
28
  "openai": ">=4",
27
29
  "react": ">=18",
28
30
  "superjson": ">=1",
29
- "zod": ">=4"
31
+ "zod": ">=3"
30
32
  },
31
33
  "peerDependenciesMeta": {
32
34
  "@tanstack/react-query": {
@@ -54,7 +56,7 @@
54
56
  "browser-image-compression": "^2.0.2",
55
57
  "dom-to-image-more": "^3.7.2",
56
58
  "eslint": "^8.47.0",
57
- "eslint-config-next": "15.2.1",
59
+ "eslint-config-next": "15.5.6",
58
60
  "eslint-config-prettier": "^9.0.0",
59
61
  "eslint-formatter-codeframe": "^7.32.1",
60
62
  "eslint-plugin-prettier": "^5.0.1",
@@ -66,8 +68,8 @@
66
68
  "tsup": "^8.2.4",
67
69
  "tsx": "^4.7.1",
68
70
  "typescript": "^5.8.2",
69
- "@ac1/core": "0.1.1",
70
- "@ac1/iso": "0.1.1"
71
+ "@ac1/iso": "0.1.1",
72
+ "@ac1/core": "0.1.1"
71
73
  },
72
74
  "publishConfig": {
73
75
  "access": "public"
@@ -79,6 +81,7 @@
79
81
  "lint": "NODE_OPTIONS='--max-old-space-size=8192' eslint --cache .",
80
82
  "lint:fix": "eslint --cache --fix .",
81
83
  "check": "NODE_OPTIONS='--max-old-space-size=8192' tsc --noEmit",
84
+ "bundle": "./bundle.sh",
82
85
  "build": "tsup",
83
86
  "clean": "rimraf dist"
84
87
  }