From 00111b557879892568cea402be39c76ad256ec56 Mon Sep 17 00:00:00 2001 From: Rizky Date: Tue, 6 Aug 2024 07:15:55 +0700 Subject: [PATCH] fix --- app/srv/core/main.js | 4 ++-- app/web/src/base/load/api/api-proxy-def.tsx | 4 ++-- app/web/src/nova/prod/base/route.tsx | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/srv/core/main.js b/app/srv/core/main.js index 37bacade..a7082a91 100644 --- a/app/srv/core/main.js +++ b/app/srv/core/main.js @@ -11,10 +11,10 @@ Error generating stack: `+i.message+` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){let r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){let r=(this[Hv]=this[Hv]={accessors:{}}).accessors,o=this.prototype;function i(a){let l=zl(a);r[l]||(zN(o,a),r[l]=!0)}return $.isArray(t)?t.forEach(i):i(t),this}};ia.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);$.reduceDescriptors(ia.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});$.freezeMethods(ia);var Ot=ia;function Hl(e,t){let n=this||oa,r=t||n,o=Ot.from(r.headers),i=r.data;return $.forEach(e,function(l){i=l.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}h();g();m();function Wl(e){return!!(e&&e.__CANCEL__)}h();g();m();function Wv(e,t,n){Te.call(this,e??"canceled",Te.ERR_CANCELED,t,n),this.name="CanceledError"}$.inherits(Wv,Te,{__CANCEL__:!0});var Mr=Wv;h();g();m();h();g();m();h();g();m();function ql(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Te("Request failed with status code "+n.status,[Te.ERR_BAD_REQUEST,Te.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}h();g();m();function Km(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}h();g();m();h();g();m();function HN(e,t){e=e||10;let n=new Array(e),r=new Array(e),o=0,i=0,a;return t=t!==void 0?t:1e3,function(u){let c=Date.now(),f=r[i];a||(a=c),n[o]=u,r[o]=c;let y=i,d=0;for(;y!==o;)d+=n[y++],y=y%e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-ar)return o&&(clearTimeout(o),o=null),n=l,e.apply(null,arguments);o||(o=setTimeout(()=>(o=null,n=Date.now(),e.apply(null,arguments)),r-(l-n)))}}var Vv=WN;var sa=(e,t,n=3)=>{let r=0,o=qv(50,250);return Vv(i=>{let a=i.loaded,l=i.lengthComputable?i.total:void 0,u=a-r,c=o(u),f=a<=l;r=a;let y={loaded:a,total:l,progress:l?a/l:void 0,bytes:u,rate:c||void 0,estimated:c&&l&&f?(l-a)/c:void 0,event:i,lengthComputable:l!=null};y[t?"download":"upload"]=!0,e(y)},n)};h();g();m();h();g();m();var Gv=jt.hasStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),r;function o(i){let a=i;return t&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(a){let l=$.isString(a)?o(a):a;return l.protocol===r.protocol&&l.host===r.host}}():function(){return function(){return!0}}();h();g();m();var Yv=jt.hasStandardBrowserEnv?{write(e,t,n,r,o,i){let a=[e+"="+encodeURIComponent(t)];$.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),$.isString(r)&&a.push("path="+r),$.isString(o)&&a.push("domain="+o),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};h();g();m();h();g();m();function Qm(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}h();g();m();function Jm(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Vl(e,t){return e&&!Qm(t)?Jm(e,t):t}h();g();m();var Xv=e=>e instanceof Ot?{...e}:e;function Sr(e,t){t=t||{};let n={};function r(c,f,y){return $.isPlainObject(c)&&$.isPlainObject(f)?$.merge.call({caseless:y},c,f):$.isPlainObject(f)?$.merge({},f):$.isArray(f)?f.slice():f}function o(c,f,y){if($.isUndefined(f)){if(!$.isUndefined(c))return r(void 0,c,y)}else return r(c,f,y)}function i(c,f){if(!$.isUndefined(f))return r(void 0,f)}function a(c,f){if($.isUndefined(f)){if(!$.isUndefined(c))return r(void 0,c)}else return r(void 0,f)}function l(c,f,y){if(y in t)return r(c,f);if(y in e)return r(void 0,c)}let u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(c,f)=>o(Xv(c),Xv(f),!0)};return $.forEach(Object.keys(Object.assign({},e,t)),function(f){let y=u[f]||o,d=y(e[f],t[f],f);$.isUndefined(d)&&y!==l||(n[f]=d)}),n}var Qf=e=>{let t=Sr({},e),{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:l}=t;t.headers=a=Ot.from(a),t.url=$l(Vl(t.baseURL,t.url),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let u;if($.isFormData(n)){if(jt.hasStandardBrowserEnv||jt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((u=a.getContentType())!==!1){let[c,...f]=u?u.split(";").map(y=>y.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...f].join("; "))}}if(jt.hasStandardBrowserEnv&&(r&&$.isFunction(r)&&(r=r(t)),r||r!==!1&&Gv(t.url))){let c=o&&i&&Yv.read(i);c&&a.set(o,c)}return t};var qN=typeof XMLHttpRequest<"u",Zv=qN&&function(e){return new Promise(function(n,r){let o=Qf(e),i=o.data,a=Ot.from(o.headers).normalize(),{responseType:l}=o,u;function c(){o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let f=new XMLHttpRequest;f.open(o.method.toUpperCase(),o.url,!0),f.timeout=o.timeout;function y(){if(!f)return;let x=Ot.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),T={data:!l||l==="text"||l==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:x,config:e,request:f};ql(function(_){n(_),c()},function(_){r(_),c()},T),f=null}"onloadend"in f?f.onloadend=y:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(y)},f.onabort=function(){f&&(r(new Te("Request aborted",Te.ECONNABORTED,o,f)),f=null)},f.onerror=function(){r(new Te("Network Error",Te.ERR_NETWORK,o,f)),f=null},f.ontimeout=function(){let w=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",T=o.transitional||Xf;o.timeoutErrorMessage&&(w=o.timeoutErrorMessage),r(new Te(w,T.clarifyTimeoutError?Te.ETIMEDOUT:Te.ECONNABORTED,o,f)),f=null},i===void 0&&a.setContentType(null),"setRequestHeader"in f&&$.forEach(a.toJSON(),function(w,T){f.setRequestHeader(T,w)}),$.isUndefined(o.withCredentials)||(f.withCredentials=!!o.withCredentials),l&&l!=="json"&&(f.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&f.addEventListener("progress",sa(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",sa(o.onUploadProgress)),(o.cancelToken||o.signal)&&(u=x=>{f&&(r(!x||x.type?new Mr(null,e,f):x),f.abort(),f=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));let d=Km(o.url);if(d&&jt.protocols.indexOf(d)===-1){r(new Te("Unsupported protocol "+d+":",Te.ERR_BAD_REQUEST,e));return}f.send(i||null)})};h();g();m();h();g();m();var VN=(e,t)=>{let n=new AbortController,r,o=function(u){if(!r){r=!0,a();let c=u instanceof Error?u:this.reason;n.abort(c instanceof Te?c:new Mr(c instanceof Error?c.message:c))}},i=t&&setTimeout(()=>{o(new Te(`timeout ${t} of ms exceeded`,Te.ETIMEDOUT))},t),a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u&&(u.removeEventListener?u.removeEventListener("abort",o):u.unsubscribe(o))}),e=null)};e.forEach(u=>u&&u.addEventListener&&u.addEventListener("abort",o));let{signal:l}=n;return l.unsubscribe=a,[l,()=>{i&&clearTimeout(i),i=null}]},Kv=VN;h();g();m();var GN=function*(e,t){let n=e.byteLength;if(!t||n{let i=YN(e,t,o),a=0;return new ReadableStream({type:"bytes",async pull(l){let{done:u,value:c}=await i.next();if(u){l.close(),r();return}let f=c.byteLength;n&&n(a+=f),l.enqueue(new Uint8Array(c))},cancel(l){return r(l),i.return()}},{highWaterMark:2})};var Qv=(e,t)=>{let n=e!=null;return r=>setTimeout(()=>t({lengthComputable:n,total:e,loaded:r}))},e1=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",eb=e1&&typeof ReadableStream=="function",t0=e1&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),XN=eb&&(()=>{let e=!1,t=new Request(jt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),Jv=64*1024,n0=eb&&!!(()=>{try{return $.isReadableStream(new Response("").body)}catch{}})(),Jf={stream:n0&&(e=>e.body)};e1&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Jf[t]&&(Jf[t]=$.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Te(`Response type '${t}' is not supported`,Te.ERR_NOT_SUPPORT,r)})})})(new Response);var ZN=async e=>{if(e==null)return 0;if($.isBlob(e))return e.size;if($.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if($.isArrayBufferView(e))return e.byteLength;if($.isURLSearchParams(e)&&(e=e+""),$.isString(e))return(await t0(e)).byteLength},KN=async(e,t)=>{let n=$.toFiniteNumber(e.getContentLength());return n??ZN(t)},tb=e1&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:i,timeout:a,onDownloadProgress:l,onUploadProgress:u,responseType:c,headers:f,withCredentials:y="same-origin",fetchOptions:d}=Qf(e);c=c?(c+"").toLowerCase():"text";let[x,w]=o||i||a?Kv([o,i],a):[],T,S,_=()=>{!T&&setTimeout(()=>{x&&x.unsubscribe()}),T=!0},k;try{if(u&&XN&&n!=="get"&&n!=="head"&&(k=await KN(f,r))!==0){let W=new Request(t,{method:"POST",body:r,duplex:"half"}),D;$.isFormData(r)&&(D=W.headers.get("content-type"))&&f.setContentType(D),W.body&&(r=e0(W.body,Jv,Qv(k,sa(u)),null,t0))}$.isString(y)||(y=y?"cors":"omit"),S=new Request(t,{...d,signal:x,method:n.toUpperCase(),headers:f.normalize().toJSON(),body:r,duplex:"half",withCredentials:y});let v=await fetch(S),E=n0&&(c==="stream"||c==="response");if(n0&&(l||E)){let W={};["status","statusText","headers"].forEach(Y=>{W[Y]=v[Y]});let D=$.toFiniteNumber(v.headers.get("content-length"));v=new Response(e0(v.body,Jv,l&&Qv(D,sa(l,!0)),E&&_,t0),W)}c=c||"text";let P=await Jf[$.findKey(Jf,c)||"text"](v,e);return!E&&_(),w&&w(),await new Promise((W,D)=>{ql(W,D,{data:P,headers:Ot.from(v.headers),status:v.status,statusText:v.statusText,config:e,request:S})})}catch(v){throw _(),v&&v.name==="TypeError"&&/fetch/i.test(v.message)?Object.assign(new Te("Network Error",Te.ERR_NETWORK,e,S),{cause:v.cause||v}):Te.from(v,v&&v.code,e,S)}});var r0={http:Gf,xhr:Zv,fetch:tb};$.forEach(r0,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var nb=e=>`- ${e}`,QN=e=>$.isFunction(e)||e===null||e===!1,t1={getAdapter:e=>{e=$.isArray(e)?e:[e];let{length:t}=e,n,r,o={};for(let i=0;i`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build")),a=t?i.length>1?`since : `+i.map(nb).join(` `):" "+nb(i[0]):"as no adapter specified";throw new Te("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:r0};function o0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Mr(null,e)}function n1(e){return o0(e),e.headers=Ot.from(e.headers),e.data=Hl.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),t1.getAdapter(e.adapter||oa.adapter)(e).then(function(r){return o0(e),r.data=Hl.call(e,e.transformResponse,r),r.headers=Ot.from(r.headers),r},function(r){return Wl(r)||(o0(e),r&&r.response&&(r.response.data=Hl.call(e,e.transformResponse,r.response),r.response.headers=Ot.from(r.response.headers))),Promise.reject(r)})}h();g();m();h();g();m();var r1="1.7.2";var i0={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{i0[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});var rb={};i0.transitional=function(t,n,r){function o(i,a){return"[Axios v"+r1+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(t===!1)throw new Te(o(a," has been removed"+(n?" in "+n:"")),Te.ERR_DEPRECATED);return n&&!rb[a]&&(rb[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,a,l):!0}};function JN(e,t,n){if(typeof e!="object")throw new Te("options must be an object",Te.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),o=r.length;for(;o-- >0;){let i=r[o],a=t[i];if(a){let l=e[i],u=l===void 0||a(l,i,e);if(u!==!0)throw new Te("option "+i+" must be "+u,Te.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Te("Unknown option "+i,Te.ERR_BAD_OPTION)}}var o1={assertOptions:JN,validators:i0};var ii=o1.validators,aa=class{constructor(t){this.defaults=t,this.interceptors={request:new qm,response:new qm}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;let i=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Sr(this.defaults,n);let{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&o1.assertOptions(r,{silentJSONParsing:ii.transitional(ii.boolean),forcedJSONParsing:ii.transitional(ii.boolean),clarifyTimeoutError:ii.transitional(ii.boolean)},!1),o!=null&&($.isFunction(o)?n.paramsSerializer={serialize:o}:o1.assertOptions(o,{encode:ii.function,serialize:ii.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&$.merge(i.common,i[n.method]);i&&$.forEach(["delete","get","head","post","put","patch","common"],w=>{delete i[w]}),n.headers=Ot.concat(a,i);let l=[],u=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(n)===!1||(u=u&&T.synchronous,l.unshift(T.fulfilled,T.rejected))});let c=[];this.interceptors.response.forEach(function(T){c.push(T.fulfilled,T.rejected)});let f,y=0,d;if(!u){let w=[n1.bind(this),void 0];for(w.unshift.apply(w,l),w.push.apply(w,c),d=w.length,f=Promise.resolve(n);y{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i,a=new Promise(l=>{r.subscribe(l),i=l}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,l){r.reason||(r.reason=new Mr(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new e(function(o){t=o}),cancel:t}}},ob=s0;h();g();m();function a0(e){return function(n){return e.apply(null,n)}}h();g();m();function l0(e){return $.isObject(e)&&e.isAxiosError===!0}h();g();m();var u0={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(u0).forEach(([e,t])=>{u0[t]=e});var ib=u0;function sb(e){let t=new Gl(e),n=jl(Gl.prototype.request,t);return $.extend(n,Gl.prototype,t,{allOwnKeys:!0}),$.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return sb(Sr(e,o))},n}var It=sb(oa);It.Axios=Gl;It.CanceledError=Mr;It.CancelToken=ob;It.isCancel=Wl;It.VERSION=r1;It.toFormData=oi;It.AxiosError=Te;It.Cancel=It.CanceledError;It.all=function(t){return Promise.all(t)};It.spread=a0;It.isAxiosError=l0;It.mergeConfig=Sr;It.AxiosHeaders=Ot;It.formToJSON=e=>Zf($.isHTMLForm(e)?new FormData(e):e);It.getAdapter=t1.getAdapter;It.HttpStatusCode=ib;It.default=It;var i1=It;var{Axios:VY,AxiosError:GY,CanceledError:YY,isCancel:XY,CancelToken:ZY,VERSION:KY,all:QY,Cancel:JY,isAxiosError:eX,spread:tX,toFormData:nX,AxiosHeaders:rX,HttpStatusCode:oX,formToJSON:iX,getAdapter:sX,mergeConfig:aX}=i1;BigInt.prototype.toJSON=function(){return"BigInt::"+this.toString()};var e3=typeof window<"u"?window:null,ab=typeof global<"u"?global:void 0,s1=async(e,t,n,r)=>{let o={...n},i=null,a=!1,l=null,u=[];if(Array.isArray(t))for(let d of t)d instanceof File&&(u.push(d),a=!0),typeof d=="function"&&(l=d);else t instanceof File&&(a=!0,u.push(t));if(!a)i=JSON.stringify(t),o["content-type"]="aplication/json";else{let d=new FormData;for(let x of u)d.append(x.name,x);i=d,delete o["content-type"],o.enctype="multipart/form-data;"}let c=new URL(e);if(e3!==null){let d=new URL(location.href),x="";if(c.host===d.host||ab&&typeof ab.server_hook=="function"?x=c.toString():x=`${d.protocol}//${d.host}/_proxy/${encodeURIComponent(c.toString())}`,x){if(l)return(await i1({method:t?"post":void 0,url:x,data:i,onUploadProgress:l})).data;{let T=await(await fetch(x,t?{method:"POST",body:i,headers:o}:void 0)).text();if(r===!1)return T;try{return JSON.parse(T,lb)}catch{return T}}}}let y=await(await fetch(c,t?{method:"POST",body:i,headers:o}:void 0)).text();try{return JSON.parse(y,lb)}catch{return y}},lb=(e,t)=>typeof t=="string"&&t.startsWith("BigInt::")?BigInt(t.substring(8)):t;h();g();m();var Tb=ye(Eb()),Ib=async(e,t)=>{let n=(0,Tb.default)(e,"/");await new Promise(r=>{let o=document,i=o.createElement("script");i.onload=async()=>{r()},localStorage.getItem("api-ts-"+n)||localStorage.setItem("api-ts-"+n,Date.now().toString());let a=localStorage.getItem("api-ts-"+n),l=new URL(n),u=new URL(location.href),c="";l.host!==u.host&&(c="&remote=1"),u.pathname="";let f=u.toString();t?i.src=`${f.endsWith("/")?f:`${f}/`}_prasi/load.js?url=${n}&v3&dev=1&ts=${a}${c}`:i.src=`${f.endsWith("/")?f:`${f}/`}_prasi/load.js?url=${n}&v3&ts=${a}${c}`,i.onerror=()=>{r()},document.querySelector(`script[src="${i.src}"]`)?r():o.body.appendChild(i)})};var Yl={},Ab=e=>{fn.prasiApi||(fn.prasiApi={});try{let t=new URL(e),n=`${t.protocol}//${t.host}`;return fn.prasiApi[n]||Yl[n]||(Yl[n]=Ib(n,location.hostname.includes("prasi"))),new Proxy({},{get:(r,o)=>{if(o==="_url")return(a,l)=>{let u=new URL(n);u.pathname=a.split("/").filter(y=>y).join("/");let c=new URL(location.href),f="";return u.host===c.host||l===!1?f=u.toString():f=`${c.protocol}//${c.host}/_proxy/${encodeURIComponent(u.toString())}`,f};let i=a=>function(...l){return new Promise(async(u,c)=>{try{let f=fn.prasiApi[n];if(!f&&Yl&&typeof Yl[n]=="object"&&(await Yl[n],f=fn.prasiApi[n]),f){if(a==="_raw"){let x=l[0],w=`${n}${x}`,T=await Cb(w,l.slice(1));u(T);return}if(f.apiEntry||(f.apiEntry={}),f.apiEntry&&!f.apiEntry[a]){c(`API ${a.toString()} not found, existing API: +`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Sr(this.defaults,n);let{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&o1.assertOptions(r,{silentJSONParsing:ii.transitional(ii.boolean),forcedJSONParsing:ii.transitional(ii.boolean),clarifyTimeoutError:ii.transitional(ii.boolean)},!1),o!=null&&($.isFunction(o)?n.paramsSerializer={serialize:o}:o1.assertOptions(o,{encode:ii.function,serialize:ii.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&$.merge(i.common,i[n.method]);i&&$.forEach(["delete","get","head","post","put","patch","common"],w=>{delete i[w]}),n.headers=Ot.concat(a,i);let l=[],u=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(n)===!1||(u=u&&T.synchronous,l.unshift(T.fulfilled,T.rejected))});let c=[];this.interceptors.response.forEach(function(T){c.push(T.fulfilled,T.rejected)});let f,y=0,d;if(!u){let w=[n1.bind(this),void 0];for(w.unshift.apply(w,l),w.push.apply(w,c),d=w.length,f=Promise.resolve(n);y{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](o);r._listeners=null}),this.promise.then=o=>{let i,a=new Promise(l=>{r.subscribe(l),i=l}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,l){r.reason||(r.reason=new Mr(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new e(function(o){t=o}),cancel:t}}},ob=s0;h();g();m();function a0(e){return function(n){return e.apply(null,n)}}h();g();m();function l0(e){return $.isObject(e)&&e.isAxiosError===!0}h();g();m();var u0={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(u0).forEach(([e,t])=>{u0[t]=e});var ib=u0;function sb(e){let t=new Gl(e),n=jl(Gl.prototype.request,t);return $.extend(n,Gl.prototype,t,{allOwnKeys:!0}),$.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return sb(Sr(e,o))},n}var It=sb(oa);It.Axios=Gl;It.CanceledError=Mr;It.CancelToken=ob;It.isCancel=Wl;It.VERSION=r1;It.toFormData=oi;It.AxiosError=Te;It.Cancel=It.CanceledError;It.all=function(t){return Promise.all(t)};It.spread=a0;It.isAxiosError=l0;It.mergeConfig=Sr;It.AxiosHeaders=Ot;It.formToJSON=e=>Zf($.isHTMLForm(e)?new FormData(e):e);It.getAdapter=t1.getAdapter;It.HttpStatusCode=ib;It.default=It;var i1=It;var{Axios:VY,AxiosError:GY,CanceledError:YY,isCancel:XY,CancelToken:ZY,VERSION:KY,all:QY,Cancel:JY,isAxiosError:eX,spread:tX,toFormData:nX,AxiosHeaders:rX,HttpStatusCode:oX,formToJSON:iX,getAdapter:sX,mergeConfig:aX}=i1;BigInt.prototype.toJSON=function(){return"BigInt::"+this.toString()};var e3=typeof window<"u"?window:null,ab=typeof global<"u"?global:void 0,s1=async(e,t,n,r)=>{let o={...n},i=null,a=!1,l=null,u=[];if(Array.isArray(t))for(let d of t)d instanceof File&&(u.push(d),a=!0),typeof d=="function"&&(l=d);else t instanceof File&&(a=!0,u.push(t));if(!a)i=JSON.stringify(t),o["content-type"]="aplication/json";else{let d=new FormData;for(let x of u)d.append(x.name,x);i=d,delete o["content-type"],o.enctype="multipart/form-data;"}let c=new URL(e);if(e3!==null){let d=new URL(location.href),x="";if(c.host===d.host||ab&&typeof ab.server_hook=="function"?x=c.toString():x=`${d.protocol}//${d.host}/_proxy/${encodeURIComponent(c.toString())}`,x){if(l)return(await i1({method:t?"post":void 0,url:x,data:i,onUploadProgress:l})).data;{let T=await(await fetch(x,t?{method:"POST",body:i,headers:o}:void 0)).text();if(r===!1)return T;try{return JSON.parse(T,lb)}catch{return T}}}}let y=await(await fetch(c,t?{method:"POST",body:i,headers:o}:void 0)).text();try{return JSON.parse(y,lb)}catch{return y}},lb=(e,t)=>typeof t=="string"&&t.startsWith("BigInt::")?BigInt(t.substring(8)):t;h();g();m();var Tb=ye(Eb()),Ib=async(e,t)=>{let n=(0,Tb.default)(e,"/");await new Promise(r=>{let o=document,i=o.createElement("script");i.onload=async()=>{r()},localStorage.getItem("api-ts-"+n)||localStorage.setItem("api-ts-"+n,Date.now().toString());let a=localStorage.getItem("api-ts-"+n),l=new URL(n),u=new URL(location.href),c="";l.host!==u.host&&(c="&remote=1"),u.pathname="";let f=u.toString();t?i.src=`${f.endsWith("/")?f:`${f}/`}_prasi/load.js?url=${n}&v3&dev=1${c}`:i.src=`${f.endsWith("/")?f:`${f}/`}_prasi/load.js?url=${n}&v3${c}`,i.onerror=()=>{r()},document.querySelector(`script[src="${i.src}"]`)?r():o.body.appendChild(i)})};var Yl={},Ab=e=>{fn.prasiApi||(fn.prasiApi={});try{let t=new URL(e),n=`${t.protocol}//${t.host}`;return fn.prasiApi[n]||Yl[n]||(Yl[n]=Ib(n,location.hostname.includes("prasi"))),new Proxy({},{get:(r,o)=>{if(o==="_url")return(a,l)=>{let u=new URL(n);u.pathname=a.split("/").filter(y=>y).join("/");let c=new URL(location.href),f="";return u.host===c.host||l===!1?f=u.toString():f=`${c.protocol}//${c.host}/_proxy/${encodeURIComponent(u.toString())}`,f};let i=a=>function(...l){return new Promise(async(u,c)=>{try{let f=fn.prasiApi[n];if(!f&&Yl&&typeof Yl[n]=="object"&&(await Yl[n],f=fn.prasiApi[n]),f){if(a==="_raw"){let x=l[0],w=`${n}${x}`,T=await Cb(w,l.slice(1));u(T);return}if(f.apiEntry||(f.apiEntry={}),f.apiEntry&&!f.apiEntry[a]){c(`API ${a.toString()} not found, existing API: - ${Object.keys(f.apiEntry||{}).join(` - `)}`);return}let y=f.apiEntry[a].url,d=f.apiEntry[a].args;if(y&&d){if(l.length>0&&d.length>0)for(let[T,S]of Object.entries(l)){let _=d[parseInt(T)];d&&d.includes(_)&&S&&typeof S!="string"&&typeof S!="number"||(y=y.replace(`:${_}?`,S+""),y=y.replace(`:${_}`,S+""))}let x=`${n}${y}`,w=await Cb(x,l);u(w)}else console.error(`API Not Found: ${a.toString()}`)}else c("Failed to load API [Proxy]: "+n)}catch(f){c(f)}})};return o==="then"?new Proxy({},{get:(a,l)=>i(l)}):i(o)}})}catch{return null}},Cb=async(e,t)=>await s1(e,t,{"content-type":"application/json"});h();g();m();var JS=ye(Ob());h();g();m();function da(e){let t=e.length;for(;--t>=0;)e[t]=0}var N3=0,yS=1,D3=2,L3=3,M3=258,M0=29,uu=256,tu=uu+1+M0,ca=30,F0=19,xS=2*tu+1,Gi=15,d0=16,F3=7,j0=256,_S=16,wS=17,kS=18,I0=new Uint8Array([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]),p1=new Uint8Array([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]),j3=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),vS=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),B3=512,po=new Array((tu+2)*2);da(po);var Ql=new Array(ca*2);da(Ql);var nu=new Array(B3);da(nu);var ru=new Array(M3-L3+1);da(ru);var B0=new Array(M0);da(B0);var d1=new Array(ca);da(d1);function h0(e,t,n,r,o){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=o,this.has_stree=e&&e.length}var bS,SS,ES;function m0(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var TS=e=>e<256?nu[e]:nu[256+(e>>>7)],ou=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},Sn=(e,t,n)=>{e.bi_valid>d0-n?(e.bi_buf|=t<>d0-e.bi_valid,e.bi_valid+=n-d0):(e.bi_buf|=t<{Sn(e,n[t*2],n[t*2+1])},IS=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},U3=e=>{e.bi_valid===16?(ou(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},$3=(e,t)=>{let n=t.dyn_tree,r=t.max_code,o=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,l=t.stat_desc.extra_base,u=t.stat_desc.max_length,c,f,y,d,x,w,T=0;for(d=0;d<=Gi;d++)e.bl_count[d]=0;for(n[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;cu&&(d=u,T++),n[f*2+1]=d,!(f>r)&&(e.bl_count[d]++,x=0,f>=l&&(x=a[f-l]),w=n[f*2],e.opt_len+=w*(d+x),i&&(e.static_len+=w*(o[f*2+1]+x)));if(T!==0){do{for(d=u-1;e.bl_count[d]===0;)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[u]--,T-=2}while(T>0);for(d=u;d!==0;d--)for(f=e.bl_count[d];f!==0;)y=e.heap[--c],!(y>r)&&(n[y*2+1]!==d&&(e.opt_len+=(d-n[y*2+1])*n[y*2],n[y*2+1]=d),f--)}},CS=(e,t,n)=>{let r=new Array(Gi+1),o=0,i,a;for(i=1;i<=Gi;i++)o=o+n[i-1]<<1,r[i]=o;for(a=0;a<=t;a++){let l=e[a*2+1];l!==0&&(e[a*2]=IS(r[l]++,l))}},z3=()=>{let e,t,n,r,o,i=new Array(Gi+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?ou(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Nb=(e,t,n,r)=>{let o=t*2,i=n*2;return e[o]{let r=e.heap[n],o=n<<1;for(;o<=e.heap_len&&(o{let r,o,i=0,a,l;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+i++]&255,r+=(e.pending_buf[e.sym_buf+i++]&255)<<8,o=e.pending_buf[e.sym_buf+i++],r===0?jr(e,o,t):(a=ru[o],jr(e,a+uu+1,t),l=I0[a],l!==0&&(o-=B0[a],Sn(e,o,l)),r--,a=TS(r),jr(e,a,n),l=p1[a],l!==0&&(r-=d1[a],Sn(e,r,l)));while(i{let n=t.dyn_tree,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,i=t.stat_desc.elems,a,l,u=-1,c;for(e.heap_len=0,e.heap_max=xS,a=0;a>1;a>=1;a--)g0(e,n,a);c=i;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],g0(e,n,1),l=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=l,n[c*2]=n[a*2]+n[l*2],e.depth[c]=(e.depth[a]>=e.depth[l]?e.depth[a]:e.depth[l])+1,n[a*2+1]=n[l*2+1]=c,e.heap[1]=c++,g0(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],$3(e,t),CS(n,u,e.bl_count)},Lb=(e,t,n)=>{let r,o=-1,i,a=t[0*2+1],l=0,u=7,c=4;for(a===0&&(u=138,c=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)i=a,a=t[(r+1)*2+1],!(++l{let r,o=-1,i,a=t[0*2+1],l=0,u=7,c=4;for(a===0&&(u=138,c=3),r=0;r<=n;r++)if(i=a,a=t[(r+1)*2+1],!(++l{let t;for(Lb(e,e.dyn_ltree,e.l_desc.max_code),Lb(e,e.dyn_dtree,e.d_desc.max_code),C0(e,e.bl_desc),t=F0-1;t>=3&&e.bl_tree[vS[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},W3=(e,t,n,r)=>{let o;for(Sn(e,t-257,5),Sn(e,n-1,5),Sn(e,r-4,4),o=0;o{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return 0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return 1;for(n=32;n{Fb||(z3(),Fb=!0),e.l_desc=new m0(e.dyn_ltree,bS),e.d_desc=new m0(e.dyn_dtree,SS),e.bl_desc=new m0(e.bl_tree,ES),e.bi_buf=0,e.bi_valid=0,AS(e)},PS=(e,t,n,r)=>{Sn(e,(N3<<1)+(r?1:0),3),RS(e),ou(e,n),ou(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},G3=e=>{Sn(e,yS<<1,3),jr(e,j0,po),U3(e)},Y3=(e,t,n,r)=>{let o,i,a=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=q3(e)),C0(e,e.l_desc),C0(e,e.d_desc),a=H3(e),o=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=o&&(o=i)):o=i=n+5,n+4<=o&&t!==-1?PS(e,t,n,r):e.strategy===4||i===o?(Sn(e,(yS<<1)+(r?1:0),3),Db(e,po,Ql)):(Sn(e,(D3<<1)+(r?1:0),3),W3(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Db(e,e.dyn_ltree,e.dyn_dtree)),AS(e),r&&RS(e)},X3=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(ru[n]+uu+1)*2]++,e.dyn_dtree[TS(t)*2]++),e.sym_next===e.sym_end),Z3=V3,K3=PS,Q3=Y3,J3=X3,eD=G3,tD={_tr_init:Z3,_tr_stored_block:K3,_tr_flush_block:Q3,_tr_tally:J3,_tr_align:eD},nD=(e,t,n,r)=>{let o=e&65535|0,i=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do o=o+t[r++]|0,i=i+o|0;while(--a);o%=65521,i%=65521}return o|i<<16|0},iu=nD,rD=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},oD=new Uint32Array(rD()),iD=(e,t,n,r)=>{let o=oD,i=r+n;e^=-1;for(let a=r;a>>8^o[(e^t[a])&255];return e^-1},Bt=iD,Zi={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ji={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:sD,_tr_stored_block:A0,_tr_flush_block:aD,_tr_tally:li,_tr_align:lD}=tD,{Z_NO_FLUSH:ui,Z_PARTIAL_FLUSH:uD,Z_FULL_FLUSH:cD,Z_FINISH:nr,Z_BLOCK:jb,Z_OK:qt,Z_STREAM_END:Bb,Z_STREAM_ERROR:Br,Z_DATA_ERROR:fD,Z_BUF_ERROR:y0,Z_DEFAULT_COMPRESSION:pD,Z_FILTERED:dD,Z_HUFFMAN_ONLY:a1,Z_RLE:hD,Z_FIXED:mD,Z_DEFAULT_STRATEGY:gD,Z_UNKNOWN:yD,Z_DEFLATED:g1}=Ji,xD=9,_D=15,wD=8,kD=29,vD=256,R0=vD+1+kD,bD=30,SD=19,ED=2*R0+1,TD=15,Le=3,ai=258,Ur=ai+Le+1,ID=32,fa=42,U0=57,P0=69,O0=73,N0=91,D0=103,Yi=113,Zl=666,pn=1,ha=2,Ki=3,ma=4,CD=3,Xi=(e,t)=>(e.msg=Zi[t],t),Ub=e=>e*2-(e>4?9:0),si=e=>{let t=e.length;for(;--t>=0;)e[t]=0},AD=e=>{let t,n,r,o=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=o?n-o:0;while(--t);t=o,r=t;do n=e.prev[--r],e.prev[r]=n>=o?n-o:0;while(--t)},RD=(e,t,n)=>(t<{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},Bn=(e,t)=>{aD(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,jn(e.strm)},He=(e,t)=>{e.pending_buf[e.pending++]=t},Xl=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},L0=(e,t,n,r)=>{let o=e.avail_in;return o>r&&(o=r),o===0?0:(e.avail_in-=o,t.set(e.input.subarray(e.next_in,e.next_in+o),n),e.state.wrap===1?e.adler=iu(e.adler,t,o,n):e.state.wrap===2&&(e.adler=Bt(e.adler,t,o,n)),e.next_in+=o,e.total_in+=o,o)},OS=(e,t)=>{let n=e.max_chain_length,r=e.strstart,o,i,a=e.prev_length,l=e.nice_match,u=e.strstart>e.w_size-Ur?e.strstart-(e.w_size-Ur):0,c=e.window,f=e.w_mask,y=e.prev,d=e.strstart+ai,x=c[r+a-1],w=c[r+a];e.prev_length>=e.good_match&&(n>>=2),l>e.lookahead&&(l=e.lookahead);do if(o=t,!(c[o+a]!==w||c[o+a-1]!==x||c[o]!==c[r]||c[++o]!==c[r+1])){r+=2,o++;do;while(c[++r]===c[++o]&&c[++r]===c[++o]&&c[++r]===c[++o]&&c[++r]===c[++o]&&c[++r]===c[++o]&&c[++r]===c[++o]&&c[++r]===c[++o]&&c[++r]===c[++o]&&ra){if(e.match_start=t,a=i,i>=l)break;x=c[r+a-1],w=c[r+a]}}while((t=y[t&f])>u&&--n!==0);return a<=e.lookahead?a:e.lookahead},pa=e=>{let t=e.w_size,n,r,o;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ur)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),AD(e),r+=t),e.strm.avail_in===0)break;if(n=L0(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=Le)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=ci(e,e.ins_h,e.window[o+1]);e.insert&&(e.ins_h=ci(e,e.ins_h,e.window[o+Le-1]),e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,o,i,a=0,l=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_outo+e.strm.avail_in&&(r=o+e.strm.avail_in),r>i&&(r=i),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,jn(e.strm),o&&(o>r&&(o=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+o),e.strm.next_out),e.strm.next_out+=o,e.strm.avail_out-=o,e.strm.total_out+=o,e.block_start+=o,r-=o),r&&(L0(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return l-=e.strm.avail_in,l&&(l>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=l&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-l,e.strm.next_in),e.strstart),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.block_start=e.strstart),e.high_wateri&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(L0(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,n=i>e.w_size?e.w_size:i,o=e.strstart-e.block_start,(o>=n||(o||t===nr)&&t!==ui&&e.strm.avail_in===0&&o<=i)&&(r=o>i?i:o,a=t===nr&&e.strm.avail_in===0&&r===o?1:0,A0(e,e.block_start,r,a),e.block_start+=r,jn(e.strm)),a?Ki:pn)},x0=(e,t)=>{let n,r;for(;;){if(e.lookahead=Le&&(e.ins_h=ci(e,e.ins_h,e.window[e.strstart+Le-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-Ur&&(e.match_length=OS(e,n)),e.match_length>=Le)if(r=li(e,e.strstart-e.match_start,e.match_length-Le),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Le){e.match_length--;do e.strstart++,e.ins_h=ci(e,e.ins_h,e.window[e.strstart+Le-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=ci(e,e.ins_h,e.window[e.strstart+1]);else r=li(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Bn(e,!1),e.strm.avail_out===0))return pn}return e.insert=e.strstart{let n,r,o;for(;;){if(e.lookahead=Le&&(e.ins_h=ci(e,e.ins_h,e.window[e.strstart+Le-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=Le-1,n!==0&&e.prev_length4096)&&(e.match_length=Le-1)),e.prev_length>=Le&&e.match_length<=e.prev_length){o=e.strstart+e.lookahead-Le,r=li(e,e.strstart-1-e.prev_match,e.prev_length-Le),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=o&&(e.ins_h=ci(e,e.ins_h,e.window[e.strstart+Le-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=Le-1,e.strstart++,r&&(Bn(e,!1),e.strm.avail_out===0))return pn}else if(e.match_available){if(r=li(e,0,e.window[e.strstart-1]),r&&Bn(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return pn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=li(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,o,i,a=e.window;for(;;){if(e.lookahead<=ai){if(pa(e),e.lookahead<=ai&&t===ui)return pn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=Le&&e.strstart>0&&(o=e.strstart-1,r=a[o],r===a[++o]&&r===a[++o]&&r===a[++o])){i=e.strstart+ai;do;while(r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&oe.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Le?(n=li(e,1,e.match_length-Le),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=li(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Bn(e,!1),e.strm.avail_out===0))return pn}return e.insert=0,t===nr?(Bn(e,!0),e.strm.avail_out===0?Ki:ma):e.sym_next&&(Bn(e,!1),e.strm.avail_out===0)?pn:ha},OD=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(pa(e),e.lookahead===0)){if(t===ui)return pn;break}if(e.match_length=0,n=li(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Bn(e,!1),e.strm.avail_out===0))return pn}return e.insert=0,t===nr?(Bn(e,!0),e.strm.avail_out===0?Ki:ma):e.sym_next&&(Bn(e,!1),e.strm.avail_out===0)?pn:ha};function Fr(e,t,n,r,o){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=o}var Kl=[new Fr(0,0,0,0,NS),new Fr(4,4,8,4,x0),new Fr(4,5,16,8,x0),new Fr(4,6,32,32,x0),new Fr(4,4,16,16,la),new Fr(8,16,32,32,la),new Fr(8,16,128,128,la),new Fr(8,32,128,256,la),new Fr(32,128,258,1024,la),new Fr(32,258,258,4096,la)],ND=e=>{e.window_size=2*e.w_size,si(e.head),e.max_lazy_match=Kl[e.level].max_lazy,e.good_match=Kl[e.level].good_length,e.nice_match=Kl[e.level].nice_length,e.max_chain_length=Kl[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Le-1,e.match_available=0,e.ins_h=0};function DD(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g1,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(ED*2),this.dyn_dtree=new Uint16Array((2*bD+1)*2),this.bl_tree=new Uint16Array((2*SD+1)*2),si(this.dyn_ltree),si(this.dyn_dtree),si(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(TD+1),this.heap=new Uint16Array(2*R0+1),si(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*R0+1),si(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var cu=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.status!==fa&&t.status!==U0&&t.status!==P0&&t.status!==O0&&t.status!==N0&&t.status!==D0&&t.status!==Yi&&t.status!==Zl?1:0},DS=e=>{if(cu(e))return Xi(e,Br);e.total_in=e.total_out=0,e.data_type=yD;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?U0:t.wrap?fa:Yi,e.adler=t.wrap===2?0:1,t.last_flush=-2,sD(t),qt},LS=e=>{let t=DS(e);return t===qt&&ND(e.state),t},LD=(e,t)=>cu(e)||e.state.wrap!==2?Br:(e.state.gzhead=t,qt),MS=(e,t,n,r,o,i)=>{if(!e)return Br;let a=1;if(t===pD&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),o<1||o>xD||n!==g1||r<8||r>15||t<0||t>9||i<0||i>mD||r===8&&a!==1)return Xi(e,Br);r===8&&(r=9);let l=new DD;return e.state=l,l.strm=e,l.status=fa,l.wrap=a,l.gzhead=null,l.w_bits=r,l.w_size=1<MS(e,t,g1,_D,wD,gD),FD=(e,t)=>{if(cu(e)||t>jb||t<0)return e?Xi(e,Br):Br;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Zl&&t!==nr)return Xi(e,e.avail_out===0?y0:Br);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(jn(e),e.avail_out===0)return n.last_flush=-1,qt}else if(e.avail_in===0&&Ub(t)<=Ub(r)&&t!==nr)return Xi(e,y0);if(n.status===Zl&&e.avail_in!==0)return Xi(e,y0);if(n.status===fa&&n.wrap===0&&(n.status=Yi),n.status===fa){let o=g1+(n.w_bits-8<<4)<<8,i=-1;if(n.strategy>=a1||n.level<2?i=0:n.level<6?i=1:n.level===6?i=2:i=3,o|=i<<6,n.strstart!==0&&(o|=ID),o+=31-o%31,Xl(n,o),n.strstart!==0&&(Xl(n,e.adler>>>16),Xl(n,e.adler&65535)),e.adler=1,n.status=Yi,jn(e),n.pending!==0)return n.last_flush=-1,qt}if(n.status===U0){if(e.adler=0,He(n,31),He(n,139),He(n,8),n.gzhead)He(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),He(n,n.gzhead.time&255),He(n,n.gzhead.time>>8&255),He(n,n.gzhead.time>>16&255),He(n,n.gzhead.time>>24&255),He(n,n.level===9?2:n.strategy>=a1||n.level<2?4:0),He(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(He(n,n.gzhead.extra.length&255),He(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Bt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=P0;else if(He(n,0),He(n,0),He(n,0),He(n,0),He(n,0),He(n,n.level===9?2:n.strategy>=a1||n.level<2?4:0),He(n,CD),n.status=Yi,jn(e),n.pending!==0)return n.last_flush=-1,qt}if(n.status===P0){if(n.gzhead.extra){let o=n.pending,i=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let l=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>o&&(e.adler=Bt(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex+=l,jn(e),n.pending!==0)return n.last_flush=-1,qt;o=0,i-=l}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>o&&(e.adler=Bt(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex=0}n.status=O0}if(n.status===O0){if(n.gzhead.name){let o=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>o&&(e.adler=Bt(e.adler,n.pending_buf,n.pending-o,o)),jn(e),n.pending!==0)return n.last_flush=-1,qt;o=0}n.gzindexo&&(e.adler=Bt(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex=0}n.status=N0}if(n.status===N0){if(n.gzhead.comment){let o=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>o&&(e.adler=Bt(e.adler,n.pending_buf,n.pending-o,o)),jn(e),n.pending!==0)return n.last_flush=-1,qt;o=0}n.gzindexo&&(e.adler=Bt(e.adler,n.pending_buf,n.pending-o,o))}n.status=D0}if(n.status===D0){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(jn(e),n.pending!==0))return n.last_flush=-1,qt;He(n,e.adler&255),He(n,e.adler>>8&255),e.adler=0}if(n.status=Yi,jn(e),n.pending!==0)return n.last_flush=-1,qt}if(e.avail_in!==0||n.lookahead!==0||t!==ui&&n.status!==Zl){let o=n.level===0?NS(n,t):n.strategy===a1?OD(n,t):n.strategy===hD?PD(n,t):Kl[n.level].func(n,t);if((o===Ki||o===ma)&&(n.status=Zl),o===pn||o===Ki)return e.avail_out===0&&(n.last_flush=-1),qt;if(o===ha&&(t===uD?lD(n):t!==jb&&(A0(n,0,0,!1),t===cD&&(si(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),jn(e),e.avail_out===0))return n.last_flush=-1,qt}return t!==nr?qt:n.wrap<=0?Bb:(n.wrap===2?(He(n,e.adler&255),He(n,e.adler>>8&255),He(n,e.adler>>16&255),He(n,e.adler>>24&255),He(n,e.total_in&255),He(n,e.total_in>>8&255),He(n,e.total_in>>16&255),He(n,e.total_in>>24&255)):(Xl(n,e.adler>>>16),Xl(n,e.adler&65535)),jn(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?qt:Bb)},jD=e=>{if(cu(e))return Br;let t=e.state.status;return e.state=null,t===Yi?Xi(e,fD):qt},BD=(e,t)=>{let n=t.length;if(cu(e))return Br;let r=e.state,o=r.wrap;if(o===2||o===1&&r.status!==fa||r.lookahead)return Br;if(o===1&&(e.adler=iu(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){o===0&&(si(r.head),r.strstart=0,r.block_start=0,r.insert=0);let u=new Uint8Array(r.w_size);u.set(t.subarray(n-r.w_size,n),0),t=u,n=r.w_size}let i=e.avail_in,a=e.next_in,l=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,pa(r);r.lookahead>=Le;){let u=r.strstart,c=r.lookahead-(Le-1);do r.ins_h=ci(r,r.ins_h,r.window[u+Le-1]),r.prev[u&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=u,u++;while(--c);r.strstart=u,r.lookahead=Le-1,pa(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Le-1,r.match_available=0,e.next_in=a,e.input=l,e.avail_in=i,r.wrap=o,qt},UD=MD,$D=MS,zD=LS,HD=DS,WD=LD,qD=FD,VD=jD,GD=BD,YD="pako deflate (from Nodeca project)",Jl={deflateInit:UD,deflateInit2:$D,deflateReset:zD,deflateResetKeep:HD,deflateSetHeader:WD,deflate:qD,deflateEnd:VD,deflateSetDictionary:GD,deflateInfo:YD},XD=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ZD=function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(let r in n)XD(n,r)&&(e[r]=n[r])}}return e},KD=e=>{let t=0;for(let r=0,o=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;su[254]=su[254]=1;var QD=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,o,i,a=e.length,l=0;for(o=0;o>>6,t[i++]=128|n&63):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|n&63):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|n&63);return t},JD=(e,t)=>{if(t<65534&&e.subarray&&FS)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{let n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,o,i=new Array(n*2);for(o=0,r=0;r4){i[o++]=65533,r+=l-1;continue}for(a&=l===2?31:l===3?15:7;l>1&&r1){i[o++]=65533;continue}a<65536?i[o++]=a:(a-=65536,i[o++]=55296|a>>10&1023,i[o++]=56320|a&1023)}return JD(i,o)},tL=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+su[e[n]]>t?n:t},au={string2buf:QD,buf2string:eL,utf8border:tL};function nL(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var jS=nL,BS=Object.prototype.toString,{Z_NO_FLUSH:rL,Z_SYNC_FLUSH:oL,Z_FULL_FLUSH:iL,Z_FINISH:sL,Z_OK:h1,Z_STREAM_END:aL,Z_DEFAULT_COMPRESSION:lL,Z_DEFAULT_STRATEGY:uL,Z_DEFLATED:cL}=Ji;function fu(e){this.options=y1.assign({level:lL,method:cL,chunkSize:16384,windowBits:15,memLevel:8,strategy:uL},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new jS,this.strm.avail_out=0;let n=Jl.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==h1)throw new Error(Zi[n]);if(t.header&&Jl.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=au.string2buf(t.dictionary):BS.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=Jl.deflateSetDictionary(this.strm,r),n!==h1)throw new Error(Zi[n]);this._dict_set=!0}}fu.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,o,i;if(this.ended)return!1;for(t===~~t?i=t:i=t===!0?sL:rL,typeof e=="string"?n.input=au.string2buf(e):BS.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(i===oL||i===iL)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(o=Jl.deflate(n,i),o===aL)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),o=Jl.deflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===h1;if(n.avail_out===0){this.onData(n.output);continue}if(i>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};fu.prototype.onData=function(e){this.chunks.push(e)};fu.prototype.onEnd=function(e){e===h1&&(this.result=y1.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function $0(e,t){let n=new fu(t);if(n.push(e,!0),n.err)throw n.msg||Zi[n.err];return n.result}function fL(e,t){return t=t||{},t.raw=!0,$0(e,t)}function pL(e,t){return t=t||{},t.gzip=!0,$0(e,t)}var dL=fu,hL=$0,mL=fL,gL=pL,yL=Ji,xL={Deflate:dL,deflate:hL,deflateRaw:mL,gzip:gL,constants:yL},l1=16209,_L=16191,wL=function(t,n){let r,o,i,a,l,u,c,f,y,d,x,w,T,S,_,k,v,E,P,W,D,Y,J,Z,ce=t.state;r=t.next_in,J=t.input,o=r+(t.avail_in-5),i=t.next_out,Z=t.output,a=i-(n-t.avail_out),l=i+(t.avail_out-257),u=ce.dmax,c=ce.wsize,f=ce.whave,y=ce.wnext,d=ce.window,x=ce.hold,w=ce.bits,T=ce.lencode,S=ce.distcode,_=(1<>>24,x>>>=E,w-=E,E=v>>>16&255,E===0)Z[i++]=v&65535;else if(E&16){P=v&65535,E&=15,E&&(w>>=E,w-=E),w<15&&(x+=J[r++]<>>24,x>>>=E,w-=E,E=v>>>16&255,E&16){if(W=v&65535,E&=15,wu){t.msg="invalid distance too far back",ce.mode=l1;break e}if(x>>>=E,w-=E,E=i-a,W>E){if(E=W-E,E>f&&ce.sane){t.msg="invalid distance too far back",ce.mode=l1;break e}if(D=0,Y=d,y===0){if(D+=c-E,E2;)Z[i++]=Y[D++],Z[i++]=Y[D++],Z[i++]=Y[D++],P-=3;P&&(Z[i++]=Y[D++],P>1&&(Z[i++]=Y[D++]))}else{D=i-W;do Z[i++]=Z[D++],Z[i++]=Z[D++],Z[i++]=Z[D++],P-=3;while(P>2);P&&(Z[i++]=Z[D++],P>1&&(Z[i++]=Z[D++]))}}else if(E&64){t.msg="invalid distance code",ce.mode=l1;break e}else{v=S[(v&65535)+(x&(1<>3,r-=P,w-=P<<3,x&=(1<{let u=l.bits,c=0,f=0,y=0,d=0,x=0,w=0,T=0,S=0,_=0,k=0,v,E,P,W,D,Y=null,J,Z=new Uint16Array(ua+1),ce=new Uint16Array(ua+1),Ue=null,Ct,M,B;for(c=0;c<=ua;c++)Z[c]=0;for(f=0;f=1&&Z[d]===0;d--);if(x>d&&(x=d),d===0)return o[i++]=1<<24|64<<16|0,o[i++]=1<<24|64<<16|0,l.bits=1,0;for(y=1;y0&&(e===Hb||d!==1))return-1;for(ce[1]=0,c=1;c$b||e===Wb&&_>zb)return 1;for(;;){Ct=c-T,a[f]+1=J?(M=Ue[a[f]-J],B=Y[a[f]-J]):(M=96,B=0),v=1<>T)+E]=Ct<<24|M<<16|B|0;while(E!==0);for(v=1<>=1;if(v!==0?(k&=v-1,k+=v):k=0,f++,--Z[c]===0){if(c===d)break;c=t[n+a[f]]}if(c>x&&(k&W)!==P){for(T===0&&(T=x),D+=y,w=c-T,S=1<$b||e===Wb&&_>zb)return 1;P=k&W,o[P]=x<<24|w<<16|D-i|0}}return k!==0&&(o[D+k]=c-T<<24|64<<16|0),l.bits=x,0},eu=EL,TL=0,US=1,$S=2,{Z_FINISH:qb,Z_BLOCK:IL,Z_TREES:u1,Z_OK:Qi,Z_STREAM_END:CL,Z_NEED_DICT:AL,Z_STREAM_ERROR:rr,Z_DATA_ERROR:zS,Z_MEM_ERROR:HS,Z_BUF_ERROR:RL,Z_DEFLATED:Vb}=Ji,x1=16180,Gb=16181,Yb=16182,Xb=16183,Zb=16184,Kb=16185,Qb=16186,Jb=16187,eS=16188,tS=16189,m1=16190,fo=16191,w0=16192,nS=16193,k0=16194,rS=16195,oS=16196,iS=16197,sS=16198,c1=16199,f1=16200,aS=16201,lS=16202,uS=16203,cS=16204,fS=16205,v0=16206,pS=16207,dS=16208,ft=16209,WS=16210,qS=16211,PL=852,OL=592,NL=15,DL=NL,hS=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function LL(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var es=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.modeqS?1:0},VS=e=>{if(es(e))return rr;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=x1,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(PL),t.distcode=t.distdyn=new Int32Array(OL),t.sane=1,t.back=-1,Qi},GS=e=>{if(es(e))return rr;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,VS(e)},YS=(e,t)=>{let n;if(es(e))return rr;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?rr:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,GS(e))},XS=(e,t)=>{if(!e)return rr;let n=new LL;e.state=n,n.strm=e,n.window=null,n.mode=x1;let r=YS(e,t);return r!==Qi&&(e.state=null),r},ML=e=>XS(e,DL),mS=!0,b0,S0,FL=e=>{if(mS){b0=new Int32Array(512),S0=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(eu(US,e.lens,0,288,b0,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;eu($S,e.lens,0,32,S0,0,e.work,{bits:5}),mS=!1}e.lencode=b0,e.lenbits=9,e.distcode=S0,e.distbits=5},ZS=(e,t,n,r)=>{let o,i=e.state;return i.window===null&&(i.wsize=1<=i.wsize?(i.window.set(t.subarray(n-i.wsize,n),0),i.wnext=0,i.whave=i.wsize):(o=i.wsize-i.wnext,o>r&&(o=r),i.window.set(t.subarray(n-r,n-r+o),i.wnext),r-=o,r?(i.window.set(t.subarray(n-r,n),0),i.wnext=r,i.whave=i.wsize):(i.wnext+=o,i.wnext===i.wsize&&(i.wnext=0),i.whave{let n,r,o,i,a,l,u,c,f,y,d,x,w,T,S=0,_,k,v,E,P,W,D,Y,J=new Uint8Array(4),Z,ce,Ue=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(es(e)||!e.output||!e.input&&e.avail_in!==0)return rr;n=e.state,n.mode===fo&&(n.mode=w0),a=e.next_out,o=e.output,u=e.avail_out,i=e.next_in,r=e.input,l=e.avail_in,c=n.hold,f=n.bits,y=l,d=u,Y=Qi;e:for(;;)switch(n.mode){case x1:if(n.wrap===0){n.mode=w0;break}for(;f<16;){if(l===0)break e;l--,c+=r[i++]<>>8&255,n.check=Bt(n.check,J,2,0),c=0,f=0,n.mode=Gb;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=ft;break}if((c&15)!==Vb){e.msg="unknown compression method",n.mode=ft;break}if(c>>>=4,f-=4,D=(c&15)+8,n.wbits===0&&(n.wbits=D),D>15||D>n.wbits){e.msg="invalid window size",n.mode=ft;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(J[0]=c&255,J[1]=c>>>8&255,n.check=Bt(n.check,J,2,0)),c=0,f=0,n.mode=Yb;case Yb:for(;f<32;){if(l===0)break e;l--,c+=r[i++]<>>8&255,J[2]=c>>>16&255,J[3]=c>>>24&255,n.check=Bt(n.check,J,4,0)),c=0,f=0,n.mode=Xb;case Xb:for(;f<16;){if(l===0)break e;l--,c+=r[i++]<>8),n.flags&512&&n.wrap&4&&(J[0]=c&255,J[1]=c>>>8&255,n.check=Bt(n.check,J,2,0)),c=0,f=0,n.mode=Zb;case Zb:if(n.flags&1024){for(;f<16;){if(l===0)break e;l--,c+=r[i++]<>>8&255,n.check=Bt(n.check,J,2,0)),c=0,f=0}else n.head&&(n.head.extra=null);n.mode=Kb;case Kb:if(n.flags&1024&&(x=n.length,x>l&&(x=l),x&&(n.head&&(D=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(i,i+x),D)),n.flags&512&&n.wrap&4&&(n.check=Bt(n.check,r,x,i)),l-=x,i+=x,n.length-=x),n.length))break e;n.length=0,n.mode=Qb;case Qb:if(n.flags&2048){if(l===0)break e;x=0;do D=r[i+x++],n.head&&D&&n.length<65536&&(n.head.name+=String.fromCharCode(D));while(D&&x>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=fo;break;case tS:for(;f<32;){if(l===0)break e;l--,c+=r[i++]<>>=f&7,f-=f&7,n.mode=v0;break}for(;f<3;){if(l===0)break e;l--,c+=r[i++]<>>=1,f-=1,c&3){case 0:n.mode=nS;break;case 1:if(FL(n),n.mode=c1,t===u1){c>>>=2,f-=2;break e}break;case 2:n.mode=oS;break;case 3:e.msg="invalid block type",n.mode=ft}c>>>=2,f-=2;break;case nS:for(c>>>=f&7,f-=f&7;f<32;){if(l===0)break e;l--,c+=r[i++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=ft;break}if(n.length=c&65535,c=0,f=0,n.mode=k0,t===u1)break e;case k0:n.mode=rS;case rS:if(x=n.length,x){if(x>l&&(x=l),x>u&&(x=u),x===0)break e;o.set(r.subarray(i,i+x),a),l-=x,i+=x,u-=x,a+=x,n.length-=x;break}n.mode=fo;break;case oS:for(;f<14;){if(l===0)break e;l--,c+=r[i++]<>>=5,f-=5,n.ndist=(c&31)+1,c>>>=5,f-=5,n.ncode=(c&15)+4,c>>>=4,f-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=ft;break}n.have=0,n.mode=iS;case iS:for(;n.have>>=3,f-=3}for(;n.have<19;)n.lens[Ue[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,Z={bits:n.lenbits},Y=eu(TL,n.lens,0,19,n.lencode,0,n.work,Z),n.lenbits=Z.bits,Y){e.msg="invalid code lengths set",n.mode=ft;break}n.have=0,n.mode=sS;case sS:for(;n.have>>24,k=S>>>16&255,v=S&65535,!(_<=f);){if(l===0)break e;l--,c+=r[i++]<>>=_,f-=_,n.lens[n.have++]=v;else{if(v===16){for(ce=_+2;f>>=_,f-=_,n.have===0){e.msg="invalid bit length repeat",n.mode=ft;break}D=n.lens[n.have-1],x=3+(c&3),c>>>=2,f-=2}else if(v===17){for(ce=_+3;f>>=_,f-=_,D=0,x=3+(c&7),c>>>=3,f-=3}else{for(ce=_+7;f>>=_,f-=_,D=0,x=11+(c&127),c>>>=7,f-=7}if(n.have+x>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=ft;break}for(;x--;)n.lens[n.have++]=D}}if(n.mode===ft)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=ft;break}if(n.lenbits=9,Z={bits:n.lenbits},Y=eu(US,n.lens,0,n.nlen,n.lencode,0,n.work,Z),n.lenbits=Z.bits,Y){e.msg="invalid literal/lengths set",n.mode=ft;break}if(n.distbits=6,n.distcode=n.distdyn,Z={bits:n.distbits},Y=eu($S,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,Z),n.distbits=Z.bits,Y){e.msg="invalid distances set",n.mode=ft;break}if(n.mode=c1,t===u1)break e;case c1:n.mode=f1;case f1:if(l>=6&&u>=258){e.next_out=a,e.avail_out=u,e.next_in=i,e.avail_in=l,n.hold=c,n.bits=f,wL(e,d),a=e.next_out,o=e.output,u=e.avail_out,i=e.next_in,r=e.input,l=e.avail_in,c=n.hold,f=n.bits,n.mode===fo&&(n.back=-1);break}for(n.back=0;S=n.lencode[c&(1<>>24,k=S>>>16&255,v=S&65535,!(_<=f);){if(l===0)break e;l--,c+=r[i++]<>E)],_=S>>>24,k=S>>>16&255,v=S&65535,!(E+_<=f);){if(l===0)break e;l--,c+=r[i++]<>>=E,f-=E,n.back+=E}if(c>>>=_,f-=_,n.back+=_,n.length=v,k===0){n.mode=fS;break}if(k&32){n.back=-1,n.mode=fo;break}if(k&64){e.msg="invalid literal/length code",n.mode=ft;break}n.extra=k&15,n.mode=aS;case aS:if(n.extra){for(ce=n.extra;f>>=n.extra,f-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=lS;case lS:for(;S=n.distcode[c&(1<>>24,k=S>>>16&255,v=S&65535,!(_<=f);){if(l===0)break e;l--,c+=r[i++]<>E)],_=S>>>24,k=S>>>16&255,v=S&65535,!(E+_<=f);){if(l===0)break e;l--,c+=r[i++]<>>=E,f-=E,n.back+=E}if(c>>>=_,f-=_,n.back+=_,k&64){e.msg="invalid distance code",n.mode=ft;break}n.offset=v,n.extra=k&15,n.mode=uS;case uS:if(n.extra){for(ce=n.extra;f>>=n.extra,f-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=ft;break}n.mode=cS;case cS:if(u===0)break e;if(x=d-u,n.offset>x){if(x=n.offset-x,x>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=ft;break}x>n.wnext?(x-=n.wnext,w=n.wsize-x):w=n.wnext-x,x>n.length&&(x=n.length),T=n.window}else T=o,w=a-n.offset,x=n.length;x>u&&(x=u),u-=x,n.length-=x;do o[a++]=T[w++];while(--x);n.length===0&&(n.mode=f1);break;case fS:if(u===0)break e;o[a++]=n.length,u--,n.mode=f1;break;case v0:if(n.wrap){for(;f<32;){if(l===0)break e;l--,c|=r[i++]<{if(es(e))return rr;let t=e.state;return t.window&&(t.window=null),e.state=null,Qi},UL=(e,t)=>{if(es(e))return rr;let n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Qi):rr},$L=(e,t)=>{let n=t.length,r,o,i;return es(e)||(r=e.state,r.wrap!==0&&r.mode!==m1)?rr:r.mode===m1&&(o=1,o=iu(o,t,n,0),o!==r.check)?zS:(i=ZS(e,t,n,n),i?(r.mode=WS,HS):(r.havedict=1,Qi))},zL=GS,HL=YS,WL=VS,qL=ML,VL=XS,GL=jL,YL=BL,XL=UL,ZL=$L,KL="pako inflate (from Nodeca project)",ho={inflateReset:zL,inflateReset2:HL,inflateResetKeep:WL,inflateInit:qL,inflateInit2:VL,inflate:GL,inflateEnd:YL,inflateGetHeader:XL,inflateSetDictionary:ZL,inflateInfo:KL};function QL(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var JL=QL,KS=Object.prototype.toString,{Z_NO_FLUSH:e4,Z_FINISH:t4,Z_OK:lu,Z_STREAM_END:E0,Z_NEED_DICT:T0,Z_STREAM_ERROR:n4,Z_DATA_ERROR:gS,Z_MEM_ERROR:r4}=Ji;function pu(e){this.options=y1.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new jS,this.strm.avail_out=0;let n=ho.inflateInit2(this.strm,t.windowBits);if(n!==lu)throw new Error(Zi[n]);if(this.header=new JL,ho.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=au.string2buf(t.dictionary):KS.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=ho.inflateSetDictionary(this.strm,t.dictionary),n!==lu)))throw new Error(Zi[n])}pu.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,o=this.options.dictionary,i,a,l;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?t4:e4,KS.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),i=ho.inflate(n,a),i===T0&&o&&(i=ho.inflateSetDictionary(n,o),i===lu?i=ho.inflate(n,a):i===gS&&(i=T0));n.avail_in>0&&i===E0&&n.state.wrap>0&&e[n.next_in]!==0;)ho.inflateReset(n),i=ho.inflate(n,a);switch(i){case n4:case gS:case T0:case r4:return this.onEnd(i),this.ended=!0,!1}if(l=n.avail_out,n.next_out&&(n.avail_out===0||i===E0))if(this.options.to==="string"){let u=au.utf8border(n.output,n.next_out),c=n.next_out-u,f=au.buf2string(n.output,u);n.next_out=c,n.avail_out=r-c,c&&n.output.set(n.output.subarray(u,u+c),0),this.onData(f)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(i===lu&&l===0)){if(i===E0)return i=ho.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};pu.prototype.onData=function(e){this.chunks.push(e)};pu.prototype.onEnd=function(e){e===lu&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=y1.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function z0(e,t){let n=new pu(t);if(n.push(e),n.err)throw n.msg||Zi[n.err];return n.result}function o4(e,t){return t=t||{},t.raw=!0,z0(e,t)}var i4=pu,s4=z0,a4=o4,l4=z0,u4=Ji,c4={Inflate:i4,inflate:s4,inflateRaw:a4,ungzip:l4,constants:u4},{Deflate:f4,deflate:p4,deflateRaw:d4,gzip:h4}=xL,{Inflate:m4,inflate:g4,inflateRaw:y4,ungzip:x4}=c4,_4=f4,w4=p4,k4=d4,v4=h4,b4=m4,S4=g4,E4=y4,T4=x4,I4=Ji,QS={Deflate:_4,deflate:w4,deflateRaw:k4,gzip:v4,Inflate:b4,inflate:S4,inflateRaw:E4,ungzip:T4,constants:I4};var mo={tables:{},columns:{},rels:{}},eE=e=>{let t="";return new Proxy({},{get(n,r){return r==="_batch"?{update:async o=>ts({name:t,action:"batch_update",table:"",params:{batch:o}},e),upsert:async o=>ts({name:t,action:"batch_upsert",table:"",params:{arg:o}},e)}:r==="_schema"?{tables:async()=>(mo.tables[e]||(mo.tables[e]=ts({name:t,action:"schema_tables",table:"",params:[]},e)),await mo.tables[e]),columns:async o=>(mo.columns[e+"_"+o]||(mo.columns[e+"_"+o]=ts({name:t,action:"schema_columns",table:o,params:[]},e)),await mo.columns[e+"_"+o]),rels:async o=>(mo.rels[e+"_"+o]||(mo.rels[e+"_"+o]=ts({name:t,action:"schema_rels",table:o,params:[]},e)),await mo.rels[e+"_"+o])}:r.startsWith("$")?(...o)=>{let i=QS.gzip(JSON.stringify(o));return ts({name:t,action:"query",table:r,params:btoa(i.reduce((a,l)=>a+String.fromCharCode(l),""))},e)}:new Proxy({},{get(o,i){return async(...a)=>(r==="query"&&(r=i,i="query"),await ts({name:t,action:i,table:r,params:a},e))}})}})},ga={},ts=async(e,t)=>{let n=new URL(t);n.pathname="/_dbs",e.table&&(n.pathname+=`/${e.table}`);let r=n.toString();typeof localStorage<"u"&&localStorage.mlsid&&(e.mlsid=localStorage.mlsid);let o=(0,JS.default)(e),i=ga[o];if(!i||i&&Date.now()-i.timestamp>1e3){ga[o]={timestamp:Date.now(),promise:s1(r,e,{"content-type":"application/json"},!1),result:null};let l=await ga[o].promise;i=ga[o];try{return typeof l=="string"?(l=JSON.parse(l),ga[o].result=l,l):(ga[o].result=l,l)}catch{if(l)throw new Error(`DBQuery failed: -`+l);return null}}if(i.result)return i.result;let a=await i.promise;if(a)try{return typeof a=="string"&&(a=JSON.parse(a)),a}catch{console.error("DBQuery failed:",a)}return null};h();g();m();h();g();m();h();g();m();var YE=ye(b1());var XE=e=>{let{item:t,item_comp:n,ids:r}=e,o=Ks(n);if(ZE(o,r),t.id&&(o.id=t.id),o.hidden=t.hidden,o.component){if(o.component.props&&t.component&&t.component.props)for(let i of Object.keys(o.component.props)){let a=t.component.props[i],l=o.component.props[i];a&&(l.value=a.value,l.valueBuilt=a.valueBuilt,l.jsxCalledBy=a.jsxCalledBy,l.content=a.content)}o.component.instances=t.component?.instances,o.component.style=t.component?.style}for(let i of Object.keys(t))delete t[i];for(let[i,a]of Object.entries(o))t[i]=a},ZE=(e,t)=>{if(e.originalId=e.id,t[e.id]||(t[e.id]=(0,YE.createId)()),e.id=t[e.id],e.childs)for(let n of e.childs)ZE(n,t)};h();g();m();var KE=e=>{let t=Object.entries(e.item_comp.component?.props||{}).sort((n,r)=>n[1].idx-r[1].idx);for(let[n,r]of t){let o=Ks(r),i=e.item.component?.props;i&&i[n]&&(o.value=i[n].value,o.valueBuilt=i[n].valueBuilt,i[n].content&&(o.content=i[n].content)),o&&e.each(n,o)}};h();g();m();var S1=e=>{let t={};for(let[n,r]of Object.entries(e))if(n==="childs"){if(t.childs=[],r&&Array.isArray(r))for(let o of r)o.type==="item"&&o.component?t.childs.push(o):t.childs.push({name:o.name,id:o.id,originalId:o.originalId})}else t[n]=r;return t};var QE=(e,t)=>{let{item:n}=t;if(n.type==="item"&&n.component?.id&&t.parent?.item.id){let r=e.comps[n.component.id];if(e.on?.visit_component&&e.on.visit_component(n,t.root||t.item),!r)return;if(r){let o;if(e.mode==="page"?(n.component.instances||(n.component.instances={}),o=n.component.instances):o=t.parent?.root_instances,o){let a=o[n.id];o[n.id]||(o[n.id]={},a=o[n.id]),XE({item:n,item_comp:r,ids:a})}let i={item:S1(n),jsx_prop:t.jsx_prop,parent:{id:t.parent.item.id,comp_id:t.parent?.comp?.component?.id,instance_id:t.parent?.instance_id},instances:o};if(e.on?.visit&&e.on.visit(i,n,t.root||t.item),n.id&&e.set_meta!==!1&&(e.meta[n.id]=i),KE({item:n,item_comp:r,instance:o?o[n.id]:{},each(a,l){let u=n.component?.id;l.meta?.type==="content-element"&&u&&l.content&&(l.content.name=a,xa({...e},{item:l.content,root:t.root||l.content,is_root:!1,jsx_prop:{is_root:!0,comp_id:u,name:a},parent:{item:i.item,instance_id:n.id,comp:r,root_instances:o}}))}}),n.childs)for(let a of Object.values(n.childs))a?.name?.startsWith("jsx:")||a&&Object.keys(a).length>3&&xa({...e,mode:"comp"},{item:a,is_root:!1,root:t.root||t.item,parent:{item:n,instance_id:n.id,root_instances:o,comp:r}})}}};var xa=(e,t)=>{let n=t.item;if(n.type==="item"&&n.component?.id&&t.ignore_first_component!==!0){QE(e,t);return}let r={item:S1(n),parent:{id:t.parent?.item.id||"root",instance_id:t.parent?.instance_id,comp_id:t.parent?.comp?.component?.id}};if(t.jsx_prop&&(r.jsx_prop=t.jsx_prop),e.on?.visit&&e.on.visit(r,n,t.root||t.item),n.id&&e.set_meta!==!1&&(e.meta[r.item.id]=r),n.childs){for(let[o,i]of Object.entries(n.childs))if(i.id){let a={item:i,is_root:!1,root:t.root||t.item,parent:{item:r.item,instance_id:t.parent?.instance_id,comp:t.parent?.comp,root_instances:t.parent?.root_instances}};t.jsx_prop&&(a.jsx_prop={...t.jsx_prop,is_root:!1}),xa(e,a)}}};var ns={route:null,promise:null},pM=()=>{if(ns.promise)return ns.promise;ns.promise=new Promise(async e=>{ns.route&&e(ns.route);let t=await fetch(re.url`_prasi/route`);t.headers.get("content-encoding")||fetch(re.url`_prasi/compress/only-gz`),ns.route=await t.json(),e(ns.route)})},JE=async()=>{let e=zf(),t=[];try{let n=await pM();if(n&&n.site&&n.urls){n.layout&&(re.layout.id=n.layout.id,re.layout.root=n.layout.root,re.layout.meta={},re.layout.root&&(await uo(re.layout.root.childs),rs(re.layout.meta,re.layout.root))),re.site=n.site,re.site.code={mode:"vsc"},await dM(),re.site.api=Ab(re.site.api_url),re.site.db=eE(re.site.api_url);let r=window;r.serverurl=re.site.api_url,r.db=re.site.db,r.api=re.site.api;for(let o of n.urls)e.insert(o.url,o),t.push(o)}}catch{}return{router:e,pages:t}},dM=()=>new Promise(e=>{let t=document,n=t.createElement("script");n.onload=async()=>{e()};let r=re.site.api_url;r==="*"&&(r=`${location.protocol}//${location.host}`,re.site.api_url=r),localStorage.getItem("api-ts-"+r)||localStorage.setItem("api-ts-"+r,Date.now().toString());let o=localStorage.getItem("api-ts-"+r),i=new URL(location.href);if(i.pathname="",!r||!["prasi.avolut.com"].includes(i.hostname)&&i.host!=="localhost:4550"){let a=i.toString();n.src=`${a.endsWith("/")?a:`${a}/`}_prasi/load.js?url=${a}&v3&ts=${o}`,re.site.api_url=`${i.protocol}//${i.host}`}else n.src=`${r}/_prasi/load.js?url=${r}&v3&ts=${o}`;n.onerror=()=>{e()},document.querySelector(`script[src="${n.src}"]`)?e():t.body.appendChild(n)}),rs=(e,t)=>{for(let n of t.childs)xa({set_meta:!0,comps:re.comp.list,meta:e,mode:"page"},{item:n})};var eT=new Vi({structuredClone:!0}),di={debug:!!localStorage.getItem("prasi-ws-debug"),reconnectTimeout:1e3,id_client:"",id_site:"",ws:null},tT=()=>{if(location.host==="localhost:4550"||location.host==="prasi.avolut.com"){let t=location.pathname.split("/")[2],n=()=>{let r=new URL(fn.basehost||location.href);r.pathname="/sync",r.protocol=r.protocol==="http:"?"ws:":"wss:";let o=new WebSocket(`${r.protocol}//${r.host}${r.pathname}`),i=setTimeout(()=>{clearTimeout(i),o.close(),n()},2e3);di.ws=o,di.id_site=t,o.onopen=()=>{clearTimeout(i),fn.offline=!1,fn.editorRender?.()},o.onmessage=async a=>{let l=a.data,u=eT.unpack(C.from(await l.arrayBuffer()));if(di.debug&&console.log("%c\u2B07","color:red",rT(l.size,0),u),u.type===0)di.id_client=u.client_id,nT(o,{type:"preview",mode:"init",data:{site_id:t,client_id:u.client_id}});else if(u.type===2){if(fn.pointer_active)return;if(console.clear(),u.event==="page_changed"){let c=u.data.map.id,f=re.page.cache[c],y=u.data.map.root;f.root=y;let d={id:f.id,url:f.url,root:y,meta:{}};await uo(y.childs,!0),rs(d.meta,y),re.page.cache[d.id]=d,console.log(`${Hi(Date.now(),"HH:mm:ss")} \u{1F6A7} Page [${f.id}] updated `),fn.prasiContext.render()}else if(u.event==="comp_changed"){let c=u.data.map.id;re.comp.list[c]=u.data.map.root;let f=re.page.cache[re.page.id];await uo([re.comp.list[c]]),rs(f.meta,f.root),console.log(`${Hi(Date.now(),"HH:mm:ss")} \u{1F6A7} Component [${u.data.map.root.name}] updated `),fn.prasiContext.render()}else if(u.event==="code_changes"){let{mode:c,ts:f,status:y}=u.data;if(c==="frontend")if(y==="ok"){console.clear(),console.log(`${Hi(Date.now(),"HH:mm:ss")} \u{1F6A7} Code updated from vscode `);let d=`/prod/${t}/_prasi/code/index.js?ts=${f}`,x=new Function("callback",` +`+l);return null}}if(i.result)return i.result;let a=await i.promise;if(a)try{return typeof a=="string"&&(a=JSON.parse(a)),a}catch{console.error("DBQuery failed:",a)}return null};h();g();m();h();g();m();h();g();m();var YE=ye(b1());var XE=e=>{let{item:t,item_comp:n,ids:r}=e,o=Ks(n);if(ZE(o,r),t.id&&(o.id=t.id),o.hidden=t.hidden,o.component){if(o.component.props&&t.component&&t.component.props)for(let i of Object.keys(o.component.props)){let a=t.component.props[i],l=o.component.props[i];a&&(l.value=a.value,l.valueBuilt=a.valueBuilt,l.jsxCalledBy=a.jsxCalledBy,l.content=a.content)}o.component.instances=t.component?.instances,o.component.style=t.component?.style}for(let i of Object.keys(t))delete t[i];for(let[i,a]of Object.entries(o))t[i]=a},ZE=(e,t)=>{if(e.originalId=e.id,t[e.id]||(t[e.id]=(0,YE.createId)()),e.id=t[e.id],e.childs)for(let n of e.childs)ZE(n,t)};h();g();m();var KE=e=>{let t=Object.entries(e.item_comp.component?.props||{}).sort((n,r)=>n[1].idx-r[1].idx);for(let[n,r]of t){let o=Ks(r),i=e.item.component?.props;i&&i[n]&&(o.value=i[n].value,o.valueBuilt=i[n].valueBuilt,i[n].content&&(o.content=i[n].content)),o&&e.each(n,o)}};h();g();m();var S1=e=>{let t={};for(let[n,r]of Object.entries(e))if(n==="childs"){if(t.childs=[],r&&Array.isArray(r))for(let o of r)o.type==="item"&&o.component?t.childs.push(o):t.childs.push({name:o.name,id:o.id,originalId:o.originalId})}else t[n]=r;return t};var QE=(e,t)=>{let{item:n}=t;if(n.type==="item"&&n.component?.id&&t.parent?.item.id){let r=e.comps[n.component.id];if(e.on?.visit_component&&e.on.visit_component(n,t.root||t.item),!r)return;if(r){let o;if(e.mode==="page"?(n.component.instances||(n.component.instances={}),o=n.component.instances):o=t.parent?.root_instances,o){let a=o[n.id];o[n.id]||(o[n.id]={},a=o[n.id]),XE({item:n,item_comp:r,ids:a})}let i={item:S1(n),jsx_prop:t.jsx_prop,parent:{id:t.parent.item.id,comp_id:t.parent?.comp?.component?.id,instance_id:t.parent?.instance_id},instances:o};if(e.on?.visit&&e.on.visit(i,n,t.root||t.item),n.id&&e.set_meta!==!1&&(e.meta[n.id]=i),KE({item:n,item_comp:r,instance:o?o[n.id]:{},each(a,l){let u=n.component?.id;l.meta?.type==="content-element"&&u&&l.content&&(l.content.name=a,xa({...e},{item:l.content,root:t.root||l.content,is_root:!1,jsx_prop:{is_root:!0,comp_id:u,name:a},parent:{item:i.item,instance_id:n.id,comp:r,root_instances:o}}))}}),n.childs)for(let a of Object.values(n.childs))a?.name?.startsWith("jsx:")||a&&Object.keys(a).length>3&&xa({...e,mode:"comp"},{item:a,is_root:!1,root:t.root||t.item,parent:{item:n,instance_id:n.id,root_instances:o,comp:r}})}}};var xa=(e,t)=>{let n=t.item;if(n.type==="item"&&n.component?.id&&t.ignore_first_component!==!0){QE(e,t);return}let r={item:S1(n),parent:{id:t.parent?.item.id||"root",instance_id:t.parent?.instance_id,comp_id:t.parent?.comp?.component?.id}};if(t.jsx_prop&&(r.jsx_prop=t.jsx_prop),e.on?.visit&&e.on.visit(r,n,t.root||t.item),n.id&&e.set_meta!==!1&&(e.meta[r.item.id]=r),n.childs){for(let[o,i]of Object.entries(n.childs))if(i.id){let a={item:i,is_root:!1,root:t.root||t.item,parent:{item:r.item,instance_id:t.parent?.instance_id,comp:t.parent?.comp,root_instances:t.parent?.root_instances}};t.jsx_prop&&(a.jsx_prop={...t.jsx_prop,is_root:!1}),xa(e,a)}}};var ns={route:null,promise:null},pM=()=>{if(ns.promise)return ns.promise;ns.promise=new Promise(async e=>{ns.route&&e(ns.route);let t=await fetch(re.url`_prasi/route`);t.headers.get("content-encoding")||fetch(re.url`_prasi/compress/only-gz`),ns.route=await t.json(),e(ns.route)})},JE=async()=>{let e=zf(),t=[];try{let n=await pM();if(n&&n.site&&n.urls){n.layout&&(re.layout.id=n.layout.id,re.layout.root=n.layout.root,re.layout.meta={},re.layout.root&&(await uo(re.layout.root.childs),rs(re.layout.meta,re.layout.root))),re.site=n.site,re.site.code={mode:"vsc"},await dM(),re.site.api=Ab(re.site.api_url),re.site.db=eE(re.site.api_url);let r=window;r.serverurl=re.site.api_url,r.db=re.site.db,r.api=re.site.api;for(let o of n.urls)e.insert(o.url,o),t.push(o)}}catch{}return{router:e,pages:t}},dM=()=>new Promise(e=>{let t=document,n=t.createElement("script");n.onload=async()=>{e()};let r=re.site.api_url;r==="*"&&(r=`${location.protocol}//${location.host}`,re.site.api_url=r),r=r.trim(),localStorage.getItem("api-ts-"+r)||localStorage.setItem("api-ts-"+r,Date.now().toString());let o=new URL(location.href);if(o.pathname="",!r||!["prasi.avolut.com"].includes(o.hostname)&&o.host!=="localhost:4550"){let i=o.toString();n.src=`${i.endsWith("/")?i:`${i}/`}_prasi/load.js?url=${i}&v3`,re.site.api_url=`${o.protocol}//${o.host}`}else n.src=`${r}/_prasi/load.js?url=${r}&v3`;n.onerror=()=>{e()},document.querySelector(`script[src="${n.src}"]`)?e():t.body.appendChild(n)}),rs=(e,t)=>{for(let n of t.childs)xa({set_meta:!0,comps:re.comp.list,meta:e,mode:"page"},{item:n})};var eT=new Vi({structuredClone:!0}),di={debug:!!localStorage.getItem("prasi-ws-debug"),reconnectTimeout:1e3,id_client:"",id_site:"",ws:null},tT=()=>{if(location.host==="localhost:4550"||location.host==="prasi.avolut.com"){let t=location.pathname.split("/")[2],n=()=>{let r=new URL(fn.basehost||location.href);r.pathname="/sync",r.protocol=r.protocol==="http:"?"ws:":"wss:";let o=new WebSocket(`${r.protocol}//${r.host}${r.pathname}`),i=setTimeout(()=>{clearTimeout(i),o.close(),n()},2e3);di.ws=o,di.id_site=t,o.onopen=()=>{clearTimeout(i),fn.offline=!1,fn.editorRender?.()},o.onmessage=async a=>{let l=a.data,u=eT.unpack(C.from(await l.arrayBuffer()));if(di.debug&&console.log("%c\u2B07","color:red",rT(l.size,0),u),u.type===0)di.id_client=u.client_id,nT(o,{type:"preview",mode:"init",data:{site_id:t,client_id:u.client_id}});else if(u.type===2){if(fn.pointer_active)return;if(console.clear(),u.event==="page_changed"){let c=u.data.map.id,f=re.page.cache[c],y=u.data.map.root;f.root=y;let d={id:f.id,url:f.url,root:y,meta:{}};await uo(y.childs,!0),rs(d.meta,y),re.page.cache[d.id]=d,console.log(`${Hi(Date.now(),"HH:mm:ss")} \u{1F6A7} Page [${f.id}] updated `),fn.prasiContext.render()}else if(u.event==="comp_changed"){let c=u.data.map.id;re.comp.list[c]=u.data.map.root;let f=re.page.cache[re.page.id];await uo([re.comp.list[c]]),rs(f.meta,f.root),console.log(`${Hi(Date.now(),"HH:mm:ss")} \u{1F6A7} Component [${u.data.map.root.name}] updated `),fn.prasiContext.render()}else if(u.event==="code_changes"){let{mode:c,ts:f,status:y}=u.data;if(c==="frontend")if(y==="ok"){console.clear(),console.log(`${Hi(Date.now(),"HH:mm:ss")} \u{1F6A7} Code updated from vscode `);let d=`/prod/${t}/_prasi/code/index.js?ts=${f}`,x=new Function("callback",` import("${d}") .catch((e) => console.error("Failed to load site code\\n\\n", e)) .then(callback)`);try{await new Promise(w=>{try{x(T=>{let S=window;for(let[_,k]of Object.entries(T))S[_]=k;w(T),S.prasiContext.render()})}catch(T){console.log("Failed to load site code",T)}})}catch{}}else y==="building"&&console.log(`${Hi(Date.now(),"HH:mm:ss")} \u23F3 Code changed from vscode, rebuilding...`)}}}};n()}},$f=e=>{di.ws&&nT(di.ws,{type:"preview",mode:"listen",data:{...e,client_id:di.id_client}})},nT=(e,t)=>{let n=eT.pack(t);di.debug&&console.log("%c\u2B06","color:blue",rT(n.length,0),t),e.send(n)};function rT(e,t){if(e==0)return"0 Bytes";var n=1024,r=t||2,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],i=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,i)).toFixed(r))+" "+o[i]}h();g();m();var EC=ye($t());h();g();m();h();g();m();h();g();m();var oT=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function hM(e){return typeof e=="string"&&oT.test(e)}var K0=hM;h();g();m();var xu=ye(Ze()),Q0=({children:e,back:t})=>(0,xu.jsxs)("div",{className:"flex items-center justify-center w-full h-full fixed inset-0 flex-col",children:[(0,xu.jsx)("div",{children:e}),(0,xu.jsxs)("div",{className:"border mt-2 rounded-md p-2 cursor-pointer",onClick:t||(()=>{history.back()}),children:[" ","Go Back"]})]});h();g();m();var sT=ye($t());var nn=ye(Ze()),iT=window,_u=({children:e,className:t,show:n,backdrop:r,note:o,alt:i,pointer:a})=>{let l=Ko({icon:(0,nn.jsx)("div",{className:"px-4 py-1",children:"Loading..."}),value:.111,ival:null},()=>{});return(0,sT.useEffect)(()=>(l.ival=setInterval(()=>{l.value+=.1333,l.value>=1.3&&(l.value=0),l.render()},200),iT.loadingIcon&&(l.icon=(0,nn.jsx)("img",{alt:"loading",src:iT.loadingIcon,className:css` diff --git a/app/web/src/base/load/api/api-proxy-def.tsx b/app/web/src/base/load/api/api-proxy-def.tsx index 8cf2d989..96bb3abe 100644 --- a/app/web/src/base/load/api/api-proxy-def.tsx +++ b/app/web/src/base/load/api/api-proxy-def.tsx @@ -29,11 +29,11 @@ export const loadApiProxyDef = async (_url: string, with_types: boolean) => { if (with_types) { script.src = `${ cur_url.endsWith("/") ? cur_url : `${cur_url}/` - }_prasi/load.js?url=${url}&v3&dev=1&ts=${ts}${is_remote}`; + }_prasi/load.js?url=${url}&v3&dev=1${is_remote}`; } else { script.src = `${ cur_url.endsWith("/") ? cur_url : `${cur_url}/` - }_prasi/load.js?url=${url}&v3&ts=${ts}${is_remote}`; + }_prasi/load.js?url=${url}&v3${is_remote}`; } script.onerror = () => { done(); diff --git a/app/web/src/nova/prod/base/route.tsx b/app/web/src/nova/prod/base/route.tsx index b952374d..d80a4b14 100644 --- a/app/web/src/nova/prod/base/route.tsx +++ b/app/web/src/nova/prod/base/route.tsx @@ -81,13 +81,12 @@ const injectSiteScript = () => { base_url = `${location.protocol}//${location.host}`; base.site.api_url = base_url; } + base_url = base_url.trim(); if (!localStorage.getItem("api-ts-" + base_url)) { localStorage.setItem("api-ts-" + base_url, Date.now().toString()); } - const ts = localStorage.getItem("api-ts-" + base_url); - const cur = new URL(location.href); cur.pathname = ""; if ( @@ -98,11 +97,11 @@ const injectSiteScript = () => { const cur_url = cur.toString(); script.src = `${ cur_url.endsWith("/") ? cur_url : `${cur_url}/` - }_prasi/load.js?url=${cur_url}&v3&ts=${ts}`; + }_prasi/load.js?url=${cur_url}&v3`; base.site.api_url = `${cur.protocol}//${cur.host}`; } else { - script.src = `${base_url}/_prasi/load.js?url=${base_url}&v3&ts=${ts}`; + script.src = `${base_url}/_prasi/load.js?url=${base_url}&v3`; } script.onerror = () => {