From 5984086a3494055f0e2a8e51b3416ce4506af566 Mon Sep 17 00:00:00 2001 From: Rizky Date: Fri, 26 Jul 2024 05:06:28 +0700 Subject: [PATCH] fix --- app/srv/core/main.js | 2 +- app/srv/ws/sync/code/parts/init/frontend.ts | 126 +------------------- 2 files changed, 5 insertions(+), 123 deletions(-) diff --git a/app/srv/core/main.js b/app/srv/core/main.js index 52dc90c4..5e05c119 100644 --- a/app/srv/core/main.js +++ b/app/srv/core/main.js @@ -13,7 +13,7 @@ Error generating stack: `+i.message+` `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ln(this.defaults,n);let{transitional:r,paramsSerializer:o,headers:i}=n;r!==void 0&&gu.assertOptions(r,{silentJSONParsing:Tr.transitional(Tr.boolean),forcedJSONParsing:Tr.transitional(Tr.boolean),clarifyTimeoutError:Tr.transitional(Tr.boolean)},!1),o!=null&&(I.isFunction(o)?n.paramsSerializer={serialize:o}:gu.assertOptions(o,{encode:Tr.function,serialize:Tr.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&I.merge(i.common,i[n.method]);i&&I.forEach(["delete","get","head","post","put","patch","common"],v=>{delete i[v]}),n.headers=$e.concat(a,i);let s=[],u=!0;this.interceptors.request.forEach(function(S){typeof S.runWhen=="function"&&S.runWhen(n)===!1||(u=u&&S.synchronous,s.unshift(S.fulfilled,S.rejected))});let c=[];this.interceptors.response.forEach(function(S){c.push(S.fulfilled,S.rejected)});let l,d=0,f;if(!u){let v=[mu.bind(this),void 0];for(v.unshift.apply(v,s),v.push.apply(v,c),f=v.length,l=Promise.resolve(n);d{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(s=>{r.subscribe(s),i=s}).then(o);return a.cancel=function(){r.unsubscribe(i)},a},t(function(i,a,s){r.reason||(r.reason=new vn(i,a,s),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}}},rw=hp;m();g();h();function gp(e){return function(n){return e.apply(null,n)}}m();g();h();function yp(e){return I.isObject(e)&&e.isAxiosError===!0}m();g();h();var vp={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(vp).forEach(([e,t])=>{vp[t]=e});var ow=vp;function iw(e){let t=new za(e),n=Pa(za.prototype.request,t);return I.extend(n,za.prototype,t,{allOwnKeys:!0}),I.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return iw(ln(e,o))},n}var Fe=iw(li);Fe.Axios=za;Fe.CanceledError=vn;Fe.CancelToken=rw;Fe.isCancel=Ua;Fe.VERSION=hu;Fe.toFormData=Cr;Fe.AxiosError=Q;Fe.Cancel=Fe.CanceledError;Fe.all=function(t){return Promise.all(t)};Fe.spread=gp;Fe.isAxiosError=yp;Fe.mergeConfig=ln;Fe.AxiosHeaders=$e;Fe.formToJSON=e=>lu(I.isHTMLForm(e)?new FormData(e):e);Fe.getAdapter=pu.getAdapter;Fe.HttpStatusCode=ow;Fe.default=Fe;var yu=Fe;var{Axios:Dz,AxiosError:Mz,CanceledError:Lz,isCancel:Uz,CancelToken:Fz,VERSION:jz,all:zz,Cancel:Bz,isAxiosError:$z,spread:Hz,toFormData:Wz,AxiosHeaders:Vz,HttpStatusCode:Yz,formToJSON:Gz,getAdapter:Zz,mergeConfig:qz}=yu;BigInt.prototype.toJSON=function(){return"BigInt::"+this.toString()};var yO=typeof window<"u"?window:null,aw=typeof global<"u"?global:void 0,vu=async(e,t,n,r)=>{let o={...n},i=null,a=!1,s=null,u=[];if(Array.isArray(t))for(let f of t)f instanceof File&&(u.push(f),a=!0),typeof f=="function"&&(s=f);else t instanceof File&&(a=!0,u.push(t));if(!a)i=JSON.stringify(t),o["content-type"]="aplication/json";else{let f=new FormData;for(let p of u)f.append(p.name,p);i=f,delete o["content-type"],o.enctype="multipart/form-data;"}let c=new URL(e);if(yO!==null){let f=new URL(location.href),p="";if(c.host===f.host||aw&&typeof aw.server_hook=="function"?p=c.toString():p=`${f.protocol}//${f.host}/_proxy/${encodeURIComponent(c.toString())}`,p){if(s)return(await yu({method:t?"post":void 0,url:p,data:i,onUploadProgress:s})).data;{let S=await(await fetch(p,t?{method:"POST",body:i,headers:o}:void 0)).text();if(r===!1)return S;try{return JSON.parse(S,sw)}catch{return S}}}}let d=await(await fetch(c,t?{method:"POST",body:i,headers:o}:void 0)).text();try{return JSON.parse(d,sw)}catch{return d}},sw=(e,t)=>typeof t=="string"&&t.startsWith("BigInt::")?BigInt(t.substring(8)):t;m();g();h();var Ew=G(bw()),Ow=async(e,t)=>{let n=(0,Ew.default)(e,"/"),r=YO(n);await new Promise(o=>{let i=document,a=i.createElement("script");a.onload=async()=>{o()},localStorage.getItem("api-ts-"+n)||localStorage.setItem("api-ts-"+n,Date.now().toString());let s=localStorage.getItem("api-ts-"+n),u=new URL(n),c=new URL(location.href),l="";u.host!==c.host&&(l="&remote=1"),t?a.src=`/_prasi/load.js?url=${n}&v3&dev=1&ts=${s}${l}`:a.src=`/_prasi/load.js?url=${n}&v3&ts=${s}${l}`,a.onerror=()=>{o()},document.querySelector(`script[src="${a.src}"]`)?o():i.body.appendChild(a)})},YO=e=>{let t=new URL(e);return`${t.protocol}//${t.host}`};var Ba={},Tw=e=>{bt.prasiApi||(bt.prasiApi={});try{let t=new URL(e),n=`${t.protocol}//${t.host}`;return bt.prasiApi[n]||Ba[n]||(Ba[n]=Ow(n,location.hostname.includes("prasi"))),new Proxy({},{get:(r,o)=>{if(o==="_url")return(a,s)=>{let u=new URL(n);u.pathname=a.split("/").filter(d=>d).join("/");let c=new URL(location.href),l="";return u.host===c.host||s===!1?l=u.toString():l=`${c.protocol}//${c.host}/_proxy/${encodeURIComponent(u.toString())}`,l};let i=a=>function(...s){return new Promise(async(u,c)=>{try{let l=bt.prasiApi[n];if(!l&&Ba&&typeof Ba[n]=="object"&&(await Ba[n],l=bt.prasiApi[n]),l){if(a==="_raw"){let p=s[0],v=`${n}${p}`,S=await Cw(v,s.slice(1));u(S);return}if(l.apiEntry||(l.apiEntry={}),l.apiEntry&&!l.apiEntry[a]){c(`API ${a.toString()} not found, existing API: - ${Object.keys(l.apiEntry||{}).join(` - `)}`);return}let d=l.apiEntry[a].url,f=l.apiEntry[a].args;if(d&&f){if(s.length>0&&f.length>0)for(let[S,b]of Object.entries(s)){let y=f[parseInt(S)];f&&f.includes(y)&&b&&typeof b!="string"&&typeof b!="number"||(d=d.replace(`:${y}?`,b+""),d=d.replace(`:${y}`,b+""))}let p=`${n}${d}`,v=await Cw(p,s);u(v)}else console.error(`API Not Found: ${a.toString()}`)}else c("Failed to load API [Proxy]: "+n)}catch(l){c(l)}})};return o==="then"?new Proxy({},{get:(a,s)=>i(s)}):i(o)}})}catch{return null}},Cw=async(e,t)=>await vu(e,t,{"content-type":"application/json"});m();g();h();var X_=G(Pw());m();g();h();function yi(e){let t=e.length;for(;--t>=0;)e[t]=0}var KO=0,g_=1,XO=2,JO=3,eC=258,Vp=29,ns=256,Za=ns+1+Vp,mi=30,Yp=19,y_=2*Za+1,so=15,Sp=16,tC=7,Gp=256,v_=16,w_=17,__=18,Lp=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]),bu=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]),nC=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),x_=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),rC=512,Wn=new Array((Za+2)*2);yi(Wn);var Va=new Array(mi*2);yi(Va);var qa=new Array(rC);yi(qa);var Qa=new Array(eC-JO+1);yi(Qa);var Zp=new Array(Vp);yi(Zp);var Eu=new Array(mi);yi(Eu);function kp(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 S_,k_,b_;function bp(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var E_=e=>e<256?qa[e]:qa[256+(e>>>7)],Ka=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},Et=(e,t,n)=>{e.bi_valid>Sp-n?(e.bi_buf|=t<>Sp-e.bi_valid,e.bi_valid+=n-Sp):(e.bi_buf|=t<{Et(e,n[t*2],n[t*2+1])},O_=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},oC=e=>{e.bi_valid===16?(Ka(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)},iC=(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,s=t.stat_desc.extra_base,u=t.stat_desc.max_length,c,l,d,f,p,v,S=0;for(f=0;f<=so;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,c=e.heap_max+1;cu&&(f=u,S++),n[l*2+1]=f,!(l>r)&&(e.bl_count[f]++,p=0,l>=s&&(p=a[l-s]),v=n[l*2],e.opt_len+=v*(f+p),i&&(e.static_len+=v*(o[l*2+1]+p)));if(S!==0){do{for(f=u-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[u]--,S-=2}while(S>0);for(f=u;f!==0;f--)for(l=e.bl_count[f];l!==0;)d=e.heap[--c],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),l--)}},C_=(e,t,n)=>{let r=new Array(so+1),o=0,i,a;for(i=1;i<=so;i++)o=o+n[i-1]<<1,r[i]=o;for(a=0;a<=t;a++){let s=e[a*2+1];s!==0&&(e[a*2]=O_(r[s]++,s))}},aC=()=>{let e,t,n,r,o,i=new Array(so+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?Ka(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Nw=(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,s;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?_n(e,o,t):(a=Qa[o],_n(e,a+ns+1,t),s=Lp[a],s!==0&&(o-=Zp[a],Et(e,o,s)),r--,a=E_(r),_n(e,a,n),s=bu[a],s!==0&&(r-=Eu[a],Et(e,r,s)));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,s,u=-1,c;for(e.heap_len=0,e.heap_max=y_,a=0;a>1;a>=1;a--)Ep(e,n,a);c=i;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ep(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[c*2]=n[a*2]+n[s*2],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=c,e.heap[1]=c++,Ep(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],iC(e,t),C_(n,u,e.bl_count)},Dw=(e,t,n)=>{let r,o=-1,i,a=t[0*2+1],s=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],!(++s{let r,o=-1,i,a=t[0*2+1],s=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],!(++s{let t;for(Dw(e,e.dyn_ltree,e.l_desc.max_code),Dw(e,e.dyn_dtree,e.d_desc.max_code),Up(e,e.bl_desc),t=Yp-1;t>=3&&e.bl_tree[x_[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},lC=(e,t,n,r)=>{let o;for(Et(e,t-257,5),Et(e,n-1,5),Et(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{Lw||(aC(),Lw=!0),e.l_desc=new bp(e.dyn_ltree,S_),e.d_desc=new bp(e.dyn_dtree,k_),e.bl_desc=new bp(e.bl_tree,b_),e.bi_buf=0,e.bi_valid=0,T_(e)},I_=(e,t,n,r)=>{Et(e,(KO<<1)+(r?1:0),3),R_(e),Ka(e,n),Ka(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},fC=e=>{Et(e,g_<<1,3),_n(e,Gp,Wn),oC(e)},dC=(e,t,n,r)=>{let o,i,a=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=uC(e)),Up(e,e.l_desc),Up(e,e.d_desc),a=sC(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?I_(e,t,n,r):e.strategy===4||i===o?(Et(e,(g_<<1)+(r?1:0),3),Aw(e,Wn,Va)):(Et(e,(XO<<1)+(r?1:0),3),lC(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Aw(e,e.dyn_ltree,e.dyn_dtree)),T_(e),r&&R_(e)},pC=(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[(Qa[n]+ns+1)*2]++,e.dyn_dtree[E_(t)*2]++),e.sym_next===e.sym_end),mC=cC,hC=I_,gC=dC,yC=pC,vC=fC,wC={_tr_init:mC,_tr_stored_block:hC,_tr_flush_block:gC,_tr_tally:yC,_tr_align:vC},_C=(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},Xa=_C,xC=()=>{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},SC=new Uint32Array(xC()),kC=(e,t,n,r)=>{let o=SC,i=r+n;e^=-1;for(let a=r;a>>8^o[(e^t[a])&255];return e^-1},qe=kC,co={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"},mo={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:bC,_tr_stored_block:Fp,_tr_flush_block:EC,_tr_tally:Pr,_tr_align:OC}=wC,{Z_NO_FLUSH:Nr,Z_PARTIAL_FLUSH:CC,Z_FULL_FLUSH:TC,Z_FINISH:Zt,Z_BLOCK:Uw,Z_OK:et,Z_STREAM_END:Fw,Z_STREAM_ERROR:xn,Z_DATA_ERROR:RC,Z_BUF_ERROR:Op,Z_DEFAULT_COMPRESSION:IC,Z_FILTERED:PC,Z_HUFFMAN_ONLY:wu,Z_RLE:NC,Z_FIXED:AC,Z_DEFAULT_STRATEGY:DC,Z_UNKNOWN:MC,Z_DEFLATED:Tu}=mo,LC=9,UC=15,FC=8,jC=29,zC=256,jp=zC+1+jC,BC=30,$C=19,HC=2*jp+1,WC=15,ae=3,Ir=258,Sn=Ir+ae+1,VC=32,hi=42,qp=57,zp=69,Bp=73,$p=91,Hp=103,lo=113,Ha=666,ht=1,vi=2,fo=3,wi=4,YC=3,uo=(e,t)=>(e.msg=co[t],t),jw=e=>e*2-(e>4?9:0),Rr=e=>{let t=e.length;for(;--t>=0;)e[t]=0},GC=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)},ZC=(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))},Mt=(e,t)=>{EC(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Dt(e.strm)},de=(e,t)=>{e.pending_buf[e.pending++]=t},$a=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Wp=(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=Xa(e.adler,t,o,n):e.state.wrap===2&&(e.adler=qe(e.adler,t,o,n)),e.next_in+=o,e.total_in+=o,o)},P_=(e,t)=>{let n=e.max_chain_length,r=e.strstart,o,i,a=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-Sn?e.strstart-(e.w_size-Sn):0,c=e.window,l=e.w_mask,d=e.prev,f=e.strstart+Ir,p=c[r+a-1],v=c[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(o=t,!(c[o+a]!==v||c[o+a-1]!==p||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>=s)break;p=c[r+a-1],v=c[r+a]}}while((t=d[t&l])>u&&--n!==0);return a<=e.lookahead?a:e.lookahead},gi=e=>{let t=e.w_size,n,r,o;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Sn)&&(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),GC(e),r+=t),e.strm.avail_in===0)break;if(n=Wp(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=ae)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=Ar(e,e.ins_h,e.window[o+1]);e.insert&&(e.ins_h=Ar(e,e.ins_h,e.window[o+ae-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,s=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,Dt(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&&(Wp(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 s-=e.strm.avail_in,s&&(s>=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<=s&&(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-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),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&&(Wp(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===Zt)&&t!==Nr&&e.strm.avail_in===0&&o<=i)&&(r=o>i?i:o,a=t===Zt&&e.strm.avail_in===0&&r===o?1:0,Fp(e,e.block_start,r,a),e.block_start+=r,Dt(e.strm)),a?fo:ht)},Cp=(e,t)=>{let n,r;for(;;){if(e.lookahead=ae&&(e.ins_h=Ar(e,e.ins_h,e.window[e.strstart+ae-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-Sn&&(e.match_length=P_(e,n)),e.match_length>=ae)if(r=Pr(e,e.strstart-e.match_start,e.match_length-ae),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ae){e.match_length--;do e.strstart++,e.ins_h=Ar(e,e.ins_h,e.window[e.strstart+ae-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=Ar(e,e.ins_h,e.window[e.strstart+1]);else r=Pr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(Mt(e,!1),e.strm.avail_out===0))return ht}return e.insert=e.strstart{let n,r,o;for(;;){if(e.lookahead=ae&&(e.ins_h=Ar(e,e.ins_h,e.window[e.strstart+ae-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=ae-1,n!==0&&e.prev_length4096)&&(e.match_length=ae-1)),e.prev_length>=ae&&e.match_length<=e.prev_length){o=e.strstart+e.lookahead-ae,r=Pr(e,e.strstart-1-e.prev_match,e.prev_length-ae),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=o&&(e.ins_h=Ar(e,e.ins_h,e.window[e.strstart+ae-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=ae-1,e.strstart++,r&&(Mt(e,!1),e.strm.avail_out===0))return ht}else if(e.match_available){if(r=Pr(e,0,e.window[e.strstart-1]),r&&Mt(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return ht}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Pr(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<=Ir){if(gi(e),e.lookahead<=Ir&&t===Nr)return ht;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=ae&&e.strstart>0&&(o=e.strstart-1,r=a[o],r===a[++o]&&r===a[++o]&&r===a[++o])){i=e.strstart+Ir;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>=ae?(n=Pr(e,1,e.match_length-ae),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Pr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Mt(e,!1),e.strm.avail_out===0))return ht}return e.insert=0,t===Zt?(Mt(e,!0),e.strm.avail_out===0?fo:wi):e.sym_next&&(Mt(e,!1),e.strm.avail_out===0)?ht:vi},QC=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(gi(e),e.lookahead===0)){if(t===Nr)return ht;break}if(e.match_length=0,n=Pr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Mt(e,!1),e.strm.avail_out===0))return ht}return e.insert=0,t===Zt?(Mt(e,!0),e.strm.avail_out===0?fo:wi):e.sym_next&&(Mt(e,!1),e.strm.avail_out===0)?ht:vi};function wn(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 Wa=[new wn(0,0,0,0,N_),new wn(4,4,8,4,Cp),new wn(4,5,16,8,Cp),new wn(4,6,32,32,Cp),new wn(4,4,16,16,di),new wn(8,16,32,32,di),new wn(8,16,128,128,di),new wn(8,32,128,256,di),new wn(32,128,258,1024,di),new wn(32,258,258,4096,di)],KC=e=>{e.window_size=2*e.w_size,Rr(e.head),e.max_lazy_match=Wa[e.level].max_lazy,e.good_match=Wa[e.level].good_length,e.nice_match=Wa[e.level].nice_length,e.max_chain_length=Wa[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ae-1,e.match_available=0,e.ins_h=0};function XC(){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=Tu,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(HC*2),this.dyn_dtree=new Uint16Array((2*BC+1)*2),this.bl_tree=new Uint16Array((2*$C+1)*2),Rr(this.dyn_ltree),Rr(this.dyn_dtree),Rr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(WC+1),this.heap=new Uint16Array(2*jp+1),Rr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*jp+1),Rr(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 rs=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.status!==hi&&t.status!==qp&&t.status!==zp&&t.status!==Bp&&t.status!==$p&&t.status!==Hp&&t.status!==lo&&t.status!==Ha?1:0},A_=e=>{if(rs(e))return uo(e,xn);e.total_in=e.total_out=0,e.data_type=MC;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?qp:t.wrap?hi:lo,e.adler=t.wrap===2?0:1,t.last_flush=-2,bC(t),et},D_=e=>{let t=A_(e);return t===et&&KC(e.state),t},JC=(e,t)=>rs(e)||e.state.wrap!==2?xn:(e.state.gzhead=t,et),M_=(e,t,n,r,o,i)=>{if(!e)return xn;let a=1;if(t===IC&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),o<1||o>LC||n!==Tu||r<8||r>15||t<0||t>9||i<0||i>AC||r===8&&a!==1)return uo(e,xn);r===8&&(r=9);let s=new XC;return e.state=s,s.strm=e,s.status=hi,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<M_(e,t,Tu,UC,FC,DC),tT=(e,t)=>{if(rs(e)||t>Uw||t<0)return e?uo(e,xn):xn;let n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Ha&&t!==Zt)return uo(e,e.avail_out===0?Op:xn);let r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Dt(e),e.avail_out===0)return n.last_flush=-1,et}else if(e.avail_in===0&&jw(t)<=jw(r)&&t!==Zt)return uo(e,Op);if(n.status===Ha&&e.avail_in!==0)return uo(e,Op);if(n.status===hi&&n.wrap===0&&(n.status=lo),n.status===hi){let o=Tu+(n.w_bits-8<<4)<<8,i=-1;if(n.strategy>=wu||n.level<2?i=0:n.level<6?i=1:n.level===6?i=2:i=3,o|=i<<6,n.strstart!==0&&(o|=VC),o+=31-o%31,$a(n,o),n.strstart!==0&&($a(n,e.adler>>>16),$a(n,e.adler&65535)),e.adler=1,n.status=lo,Dt(e),n.pending!==0)return n.last_flush=-1,et}if(n.status===qp){if(e.adler=0,de(n,31),de(n,139),de(n,8),n.gzhead)de(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)),de(n,n.gzhead.time&255),de(n,n.gzhead.time>>8&255),de(n,n.gzhead.time>>16&255),de(n,n.gzhead.time>>24&255),de(n,n.level===9?2:n.strategy>=wu||n.level<2?4:0),de(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(de(n,n.gzhead.extra.length&255),de(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=qe(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=zp;else if(de(n,0),de(n,0),de(n,0),de(n,0),de(n,0),de(n,n.level===9?2:n.strategy>=wu||n.level<2?4:0),de(n,YC),n.status=lo,Dt(e),n.pending!==0)return n.last_flush=-1,et}if(n.status===zp){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 s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>o&&(e.adler=qe(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex+=s,Dt(e),n.pending!==0)return n.last_flush=-1,et;o=0,i-=s}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=qe(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex=0}n.status=Bp}if(n.status===Bp){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=qe(e.adler,n.pending_buf,n.pending-o,o)),Dt(e),n.pending!==0)return n.last_flush=-1,et;o=0}n.gzindexo&&(e.adler=qe(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex=0}n.status=$p}if(n.status===$p){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=qe(e.adler,n.pending_buf,n.pending-o,o)),Dt(e),n.pending!==0)return n.last_flush=-1,et;o=0}n.gzindexo&&(e.adler=qe(e.adler,n.pending_buf,n.pending-o,o))}n.status=Hp}if(n.status===Hp){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Dt(e),n.pending!==0))return n.last_flush=-1,et;de(n,e.adler&255),de(n,e.adler>>8&255),e.adler=0}if(n.status=lo,Dt(e),n.pending!==0)return n.last_flush=-1,et}if(e.avail_in!==0||n.lookahead!==0||t!==Nr&&n.status!==Ha){let o=n.level===0?N_(n,t):n.strategy===wu?QC(n,t):n.strategy===NC?qC(n,t):Wa[n.level].func(n,t);if((o===fo||o===wi)&&(n.status=Ha),o===ht||o===fo)return e.avail_out===0&&(n.last_flush=-1),et;if(o===vi&&(t===CC?OC(n):t!==Uw&&(Fp(n,0,0,!1),t===TC&&(Rr(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Dt(e),e.avail_out===0))return n.last_flush=-1,et}return t!==Zt?et:n.wrap<=0?Fw:(n.wrap===2?(de(n,e.adler&255),de(n,e.adler>>8&255),de(n,e.adler>>16&255),de(n,e.adler>>24&255),de(n,e.total_in&255),de(n,e.total_in>>8&255),de(n,e.total_in>>16&255),de(n,e.total_in>>24&255)):($a(n,e.adler>>>16),$a(n,e.adler&65535)),Dt(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?et:Fw)},nT=e=>{if(rs(e))return xn;let t=e.state.status;return e.state=null,t===lo?uo(e,RC):et},rT=(e,t)=>{let n=t.length;if(rs(e))return xn;let r=e.state,o=r.wrap;if(o===2||o===1&&r.status!==hi||r.lookahead)return xn;if(o===1&&(e.adler=Xa(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){o===0&&(Rr(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,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,gi(r);r.lookahead>=ae;){let u=r.strstart,c=r.lookahead-(ae-1);do r.ins_h=Ar(r,r.ins_h,r.window[u+ae-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=ae-1,gi(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=ae-1,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=i,r.wrap=o,et},oT=eT,iT=M_,aT=D_,sT=A_,lT=JC,uT=tT,cT=nT,fT=rT,dT="pako deflate (from Nodeca project)",Ya={deflateInit:oT,deflateInit2:iT,deflateReset:aT,deflateResetKeep:sT,deflateSetHeader:lT,deflate:uT,deflateEnd:cT,deflateSetDictionary:fT,deflateInfo:dT},pT=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),mT=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)pT(n,r)&&(e[r]=n[r])}}return e},hT=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;Ja[254]=Ja[254]=1;var gT=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,o,i,a=e.length,s=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},yT=(e,t)=>{if(t<65534&&e.subarray&&L_)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+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>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 yT(i,o)},wT=(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+Ja[e[n]]>t?n:t},es={string2buf:gT,buf2string:vT,utf8border:wT};function _T(){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 U_=_T,F_=Object.prototype.toString,{Z_NO_FLUSH:xT,Z_SYNC_FLUSH:ST,Z_FULL_FLUSH:kT,Z_FINISH:bT,Z_OK:Ou,Z_STREAM_END:ET,Z_DEFAULT_COMPRESSION:OT,Z_DEFAULT_STRATEGY:CT,Z_DEFLATED:TT}=mo;function os(e){this.options=Ru.assign({level:OT,method:TT,chunkSize:16384,windowBits:15,memLevel:8,strategy:CT},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 U_,this.strm.avail_out=0;let n=Ya.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==Ou)throw new Error(co[n]);if(t.header&&Ya.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=es.string2buf(t.dictionary):F_.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=Ya.deflateSetDictionary(this.strm,r),n!==Ou)throw new Error(co[n]);this._dict_set=!0}}os.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?bT:xT,typeof e=="string"?n.input=es.string2buf(e):F_.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===ST||i===kT)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(o=Ya.deflate(n,i),o===ET)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),o=Ya.deflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===Ou;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};os.prototype.onData=function(e){this.chunks.push(e)};os.prototype.onEnd=function(e){e===Ou&&(this.result=Ru.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Qp(e,t){let n=new os(t);if(n.push(e,!0),n.err)throw n.msg||co[n.err];return n.result}function RT(e,t){return t=t||{},t.raw=!0,Qp(e,t)}function IT(e,t){return t=t||{},t.gzip=!0,Qp(e,t)}var PT=os,NT=Qp,AT=RT,DT=IT,MT=mo,LT={Deflate:PT,deflate:NT,deflateRaw:AT,gzip:DT,constants:MT},_u=16209,UT=16191,FT=function(t,n){let r,o,i,a,s,u,c,l,d,f,p,v,S,b,y,w,_,x,N,D,A,M,W,U,Y=t.state;r=t.next_in,W=t.input,o=r+(t.avail_in-5),i=t.next_out,U=t.output,a=i-(n-t.avail_out),s=i+(t.avail_out-257),u=Y.dmax,c=Y.wsize,l=Y.whave,d=Y.wnext,f=Y.window,p=Y.hold,v=Y.bits,S=Y.lencode,b=Y.distcode,y=(1<>>24,p>>>=x,v-=x,x=_>>>16&255,x===0)U[i++]=_&65535;else if(x&16){N=_&65535,x&=15,x&&(v>>=x,v-=x),v<15&&(p+=W[r++]<>>24,p>>>=x,v-=x,x=_>>>16&255,x&16){if(D=_&65535,x&=15,vu){t.msg="invalid distance too far back",Y.mode=_u;break e}if(p>>>=x,v-=x,x=i-a,D>x){if(x=D-x,x>l&&Y.sane){t.msg="invalid distance too far back",Y.mode=_u;break e}if(A=0,M=f,d===0){if(A+=c-x,x2;)U[i++]=M[A++],U[i++]=M[A++],U[i++]=M[A++],N-=3;N&&(U[i++]=M[A++],N>1&&(U[i++]=M[A++]))}else{A=i-D;do U[i++]=U[A++],U[i++]=U[A++],U[i++]=U[A++],N-=3;while(N>2);N&&(U[i++]=U[A++],N>1&&(U[i++]=U[A++]))}}else if(x&64){t.msg="invalid distance code",Y.mode=_u;break e}else{_=b[(_&65535)+(p&(1<>3,r-=N,v-=N<<3,p&=(1<{let u=s.bits,c=0,l=0,d=0,f=0,p=0,v=0,S=0,b=0,y=0,w=0,_,x,N,D,A,M=null,W,U=new Uint16Array(pi+1),Y=new Uint16Array(pi+1),je=null,Kn,P,j;for(c=0;c<=pi;c++)U[c]=0;for(l=0;l=1&&U[f]===0;f--);if(p>f&&(p=f),f===0)return o[i++]=1<<24|64<<16|0,o[i++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d0&&(e===$w||f!==1))return-1;for(Y[1]=0,c=1;czw||e===Hw&&y>Bw)return 1;for(;;){Kn=c-S,a[l]+1=W?(P=je[a[l]-W],j=M[a[l]-W]):(P=96,j=0),_=1<>S)+x]=Kn<<24|P<<16|j|0;while(x!==0);for(_=1<>=1;if(_!==0?(w&=_-1,w+=_):w=0,l++,--U[c]===0){if(c===f)break;c=t[n+a[l]]}if(c>p&&(w&D)!==N){for(S===0&&(S=p),A+=d,v=c-S,b=1<zw||e===Hw&&y>Bw)return 1;N=w&D,o[N]=p<<24|v<<16|A-i|0}}return w!==0&&(o[A+w]=c-S<<24|64<<16|0),s.bits=p,0},Ga=HT,WT=0,j_=1,z_=2,{Z_FINISH:Ww,Z_BLOCK:VT,Z_TREES:xu,Z_OK:po,Z_STREAM_END:YT,Z_NEED_DICT:GT,Z_STREAM_ERROR:qt,Z_DATA_ERROR:B_,Z_MEM_ERROR:$_,Z_BUF_ERROR:ZT,Z_DEFLATED:Vw}=mo,Iu=16180,Yw=16181,Gw=16182,Zw=16183,qw=16184,Qw=16185,Kw=16186,Xw=16187,Jw=16188,e_=16189,Cu=16190,Hn=16191,Rp=16192,t_=16193,Ip=16194,n_=16195,r_=16196,o_=16197,i_=16198,Su=16199,ku=16200,a_=16201,s_=16202,l_=16203,u_=16204,c_=16205,Pp=16206,f_=16207,d_=16208,Oe=16209,H_=16210,W_=16211,qT=852,QT=592,KT=15,XT=KT,p_=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function JT(){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 ho=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.modeW_?1:0},V_=e=>{if(ho(e))return qt;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=Iu,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(qT),t.distcode=t.distdyn=new Int32Array(QT),t.sane=1,t.back=-1,po},Y_=e=>{if(ho(e))return qt;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,V_(e)},G_=(e,t)=>{let n;if(ho(e))return qt;let r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?qt:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Y_(e))},Z_=(e,t)=>{if(!e)return qt;let n=new JT;e.state=n,n.strm=e,n.window=null,n.mode=Iu;let r=G_(e,t);return r!==po&&(e.state=null),r},eR=e=>Z_(e,XT),m_=!0,Np,Ap,tR=e=>{if(m_){Np=new Int32Array(512),Ap=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(Ga(j_,e.lens,0,288,Np,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Ga(z_,e.lens,0,32,Ap,0,e.work,{bits:5}),m_=!1}e.lencode=Np,e.lenbits=9,e.distcode=Ap,e.distbits=5},q_=(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,s,u,c,l,d,f,p,v,S,b=0,y,w,_,x,N,D,A,M,W=new Uint8Array(4),U,Y,je=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ho(e)||!e.output||!e.input&&e.avail_in!==0)return qt;n=e.state,n.mode===Hn&&(n.mode=Rp),a=e.next_out,o=e.output,u=e.avail_out,i=e.next_in,r=e.input,s=e.avail_in,c=n.hold,l=n.bits,d=s,f=u,M=po;e:for(;;)switch(n.mode){case Iu:if(n.wrap===0){n.mode=Rp;break}for(;l<16;){if(s===0)break e;s--,c+=r[i++]<>>8&255,n.check=qe(n.check,W,2,0),c=0,l=0,n.mode=Yw;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=Oe;break}if((c&15)!==Vw){e.msg="unknown compression method",n.mode=Oe;break}if(c>>>=4,l-=4,A=(c&15)+8,n.wbits===0&&(n.wbits=A),A>15||A>n.wbits){e.msg="invalid window size",n.mode=Oe;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(W[0]=c&255,W[1]=c>>>8&255,n.check=qe(n.check,W,2,0)),c=0,l=0,n.mode=Gw;case Gw:for(;l<32;){if(s===0)break e;s--,c+=r[i++]<>>8&255,W[2]=c>>>16&255,W[3]=c>>>24&255,n.check=qe(n.check,W,4,0)),c=0,l=0,n.mode=Zw;case Zw:for(;l<16;){if(s===0)break e;s--,c+=r[i++]<>8),n.flags&512&&n.wrap&4&&(W[0]=c&255,W[1]=c>>>8&255,n.check=qe(n.check,W,2,0)),c=0,l=0,n.mode=qw;case qw:if(n.flags&1024){for(;l<16;){if(s===0)break e;s--,c+=r[i++]<>>8&255,n.check=qe(n.check,W,2,0)),c=0,l=0}else n.head&&(n.head.extra=null);n.mode=Qw;case Qw:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(A=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+p),A)),n.flags&512&&n.wrap&4&&(n.check=qe(n.check,r,p,i)),s-=p,i+=p,n.length-=p),n.length))break e;n.length=0,n.mode=Kw;case Kw:if(n.flags&2048){if(s===0)break e;p=0;do A=r[i+p++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&p>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Hn;break;case e_:for(;l<32;){if(s===0)break e;s--,c+=r[i++]<>>=l&7,l-=l&7,n.mode=Pp;break}for(;l<3;){if(s===0)break e;s--,c+=r[i++]<>>=1,l-=1,c&3){case 0:n.mode=t_;break;case 1:if(tR(n),n.mode=Su,t===xu){c>>>=2,l-=2;break e}break;case 2:n.mode=r_;break;case 3:e.msg="invalid block type",n.mode=Oe}c>>>=2,l-=2;break;case t_:for(c>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,c+=r[i++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Oe;break}if(n.length=c&65535,c=0,l=0,n.mode=Ip,t===xu)break e;case Ip:n.mode=n_;case n_:if(p=n.length,p){if(p>s&&(p=s),p>u&&(p=u),p===0)break e;o.set(r.subarray(i,i+p),a),s-=p,i+=p,u-=p,a+=p,n.length-=p;break}n.mode=Hn;break;case r_:for(;l<14;){if(s===0)break e;s--,c+=r[i++]<>>=5,l-=5,n.ndist=(c&31)+1,c>>>=5,l-=5,n.ncode=(c&15)+4,c>>>=4,l-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Oe;break}n.have=0,n.mode=o_;case o_:for(;n.have>>=3,l-=3}for(;n.have<19;)n.lens[je[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,U={bits:n.lenbits},M=Ga(WT,n.lens,0,19,n.lencode,0,n.work,U),n.lenbits=U.bits,M){e.msg="invalid code lengths set",n.mode=Oe;break}n.have=0,n.mode=i_;case i_:for(;n.have>>24,w=b>>>16&255,_=b&65535,!(y<=l);){if(s===0)break e;s--,c+=r[i++]<>>=y,l-=y,n.lens[n.have++]=_;else{if(_===16){for(Y=y+2;l>>=y,l-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=Oe;break}A=n.lens[n.have-1],p=3+(c&3),c>>>=2,l-=2}else if(_===17){for(Y=y+3;l>>=y,l-=y,A=0,p=3+(c&7),c>>>=3,l-=3}else{for(Y=y+7;l>>=y,l-=y,A=0,p=11+(c&127),c>>>=7,l-=7}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Oe;break}for(;p--;)n.lens[n.have++]=A}}if(n.mode===Oe)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Oe;break}if(n.lenbits=9,U={bits:n.lenbits},M=Ga(j_,n.lens,0,n.nlen,n.lencode,0,n.work,U),n.lenbits=U.bits,M){e.msg="invalid literal/lengths set",n.mode=Oe;break}if(n.distbits=6,n.distcode=n.distdyn,U={bits:n.distbits},M=Ga(z_,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,U),n.distbits=U.bits,M){e.msg="invalid distances set",n.mode=Oe;break}if(n.mode=Su,t===xu)break e;case Su:n.mode=ku;case ku:if(s>=6&&u>=258){e.next_out=a,e.avail_out=u,e.next_in=i,e.avail_in=s,n.hold=c,n.bits=l,FT(e,f),a=e.next_out,o=e.output,u=e.avail_out,i=e.next_in,r=e.input,s=e.avail_in,c=n.hold,l=n.bits,n.mode===Hn&&(n.back=-1);break}for(n.back=0;b=n.lencode[c&(1<>>24,w=b>>>16&255,_=b&65535,!(y<=l);){if(s===0)break e;s--,c+=r[i++]<>x)],y=b>>>24,w=b>>>16&255,_=b&65535,!(x+y<=l);){if(s===0)break e;s--,c+=r[i++]<>>=x,l-=x,n.back+=x}if(c>>>=y,l-=y,n.back+=y,n.length=_,w===0){n.mode=c_;break}if(w&32){n.back=-1,n.mode=Hn;break}if(w&64){e.msg="invalid literal/length code",n.mode=Oe;break}n.extra=w&15,n.mode=a_;case a_:if(n.extra){for(Y=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=s_;case s_:for(;b=n.distcode[c&(1<>>24,w=b>>>16&255,_=b&65535,!(y<=l);){if(s===0)break e;s--,c+=r[i++]<>x)],y=b>>>24,w=b>>>16&255,_=b&65535,!(x+y<=l);){if(s===0)break e;s--,c+=r[i++]<>>=x,l-=x,n.back+=x}if(c>>>=y,l-=y,n.back+=y,w&64){e.msg="invalid distance code",n.mode=Oe;break}n.offset=_,n.extra=w&15,n.mode=l_;case l_:if(n.extra){for(Y=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Oe;break}n.mode=u_;case u_:if(u===0)break e;if(p=f-u,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Oe;break}p>n.wnext?(p-=n.wnext,v=n.wsize-p):v=n.wnext-p,p>n.length&&(p=n.length),S=n.window}else S=o,v=a-n.offset,p=n.length;p>u&&(p=u),u-=p,n.length-=p;do o[a++]=S[v++];while(--p);n.length===0&&(n.mode=ku);break;case c_:if(u===0)break e;o[a++]=n.length,u--,n.mode=ku;break;case Pp:if(n.wrap){for(;l<32;){if(s===0)break e;s--,c|=r[i++]<{if(ho(e))return qt;let t=e.state;return t.window&&(t.window=null),e.state=null,po},oR=(e,t)=>{if(ho(e))return qt;let n=e.state;return n.wrap&2?(n.head=t,t.done=!1,po):qt},iR=(e,t)=>{let n=t.length,r,o,i;return ho(e)||(r=e.state,r.wrap!==0&&r.mode!==Cu)?qt:r.mode===Cu&&(o=1,o=Xa(o,t,n,0),o!==r.check)?B_:(i=q_(e,t,n,n),i?(r.mode=H_,$_):(r.havedict=1,po))},aR=Y_,sR=G_,lR=V_,uR=eR,cR=Z_,fR=nR,dR=rR,pR=oR,mR=iR,hR="pako inflate (from Nodeca project)",Vn={inflateReset:aR,inflateReset2:sR,inflateResetKeep:lR,inflateInit:uR,inflateInit2:cR,inflate:fR,inflateEnd:dR,inflateGetHeader:pR,inflateSetDictionary:mR,inflateInfo:hR};function gR(){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 yR=gR,Q_=Object.prototype.toString,{Z_NO_FLUSH:vR,Z_FINISH:wR,Z_OK:ts,Z_STREAM_END:Dp,Z_NEED_DICT:Mp,Z_STREAM_ERROR:_R,Z_DATA_ERROR:h_,Z_MEM_ERROR:xR}=mo;function is(e){this.options=Ru.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 U_,this.strm.avail_out=0;let n=Vn.inflateInit2(this.strm,t.windowBits);if(n!==ts)throw new Error(co[n]);if(this.header=new yR,Vn.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=es.string2buf(t.dictionary):Q_.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Vn.inflateSetDictionary(this.strm,t.dictionary),n!==ts)))throw new Error(co[n])}is.prototype.push=function(e,t){let n=this.strm,r=this.options.chunkSize,o=this.options.dictionary,i,a,s;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?wR:vR,Q_.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=Vn.inflate(n,a),i===Mp&&o&&(i=Vn.inflateSetDictionary(n,o),i===ts?i=Vn.inflate(n,a):i===h_&&(i=Mp));n.avail_in>0&&i===Dp&&n.state.wrap>0&&e[n.next_in]!==0;)Vn.inflateReset(n),i=Vn.inflate(n,a);switch(i){case _R:case h_:case Mp:case xR:return this.onEnd(i),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||i===Dp))if(this.options.to==="string"){let u=es.utf8border(n.output,n.next_out),c=n.next_out-u,l=es.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(l)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(i===ts&&s===0)){if(i===Dp)return i=Vn.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};is.prototype.onData=function(e){this.chunks.push(e)};is.prototype.onEnd=function(e){e===ts&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ru.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Kp(e,t){let n=new is(t);if(n.push(e),n.err)throw n.msg||co[n.err];return n.result}function SR(e,t){return t=t||{},t.raw=!0,Kp(e,t)}var kR=is,bR=Kp,ER=SR,OR=Kp,CR=mo,TR={Inflate:kR,inflate:bR,inflateRaw:ER,ungzip:OR,constants:CR},{Deflate:RR,deflate:IR,deflateRaw:PR,gzip:NR}=LT,{Inflate:AR,inflate:DR,inflateRaw:MR,ungzip:LR}=TR,UR=RR,FR=IR,jR=PR,zR=NR,BR=AR,$R=DR,HR=MR,WR=LR,VR=mo,K_={Deflate:UR,deflate:FR,deflateRaw:jR,gzip:zR,Inflate:BR,inflate:$R,inflateRaw:HR,ungzip:WR,constants:VR};var Yn={tables:{},columns:{},rels:{}},J_=e=>{let t="";return new Proxy({},{get(n,r){return r==="_batch"?{update:async o=>go({name:t,action:"batch_update",table:"",params:{batch:o}},e),upsert:async o=>go({name:t,action:"batch_upsert",table:"",params:{arg:o}},e)}:r==="_schema"?{tables:async()=>(Yn.tables[e]||(Yn.tables[e]=go({name:t,action:"schema_tables",table:"",params:[]},e)),await Yn.tables[e]),columns:async o=>(Yn.columns[e+"_"+o]||(Yn.columns[e+"_"+o]=go({name:t,action:"schema_columns",table:o,params:[]},e)),await Yn.columns[e+"_"+o]),rels:async o=>(Yn.rels[e+"_"+o]||(Yn.rels[e+"_"+o]=go({name:t,action:"schema_rels",table:o,params:[]},e)),await Yn.rels[e+"_"+o])}:r.startsWith("$")?(...o)=>{let i=K_.gzip(JSON.stringify(o));return go({name:t,action:"query",table:r,params:btoa(i.reduce((a,s)=>a+String.fromCharCode(s),""))},e)}:new Proxy({},{get(o,i){return async(...a)=>(r==="query"&&(r=i,i="query"),await go({name:t,action:i,table:r,params:a},e))}})}})},_i={},go=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,X_.default)(e),i=_i[o];if(!i||i&&Date.now()-i.timestamp>1e3){_i[o]={timestamp:Date.now(),promise:vu(r,e,{"content-type":"application/json"},!1),result:null};let s=await _i[o].promise;i=_i[o];try{return typeof s=="string"?(s=JSON.parse(s),_i[o].result=s,s):(_i[o].result=s,s)}catch{if(s)throw new Error(`DBQuery failed: -`+s);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};m();g();h();m();g();h();m();g();h();var G1=G(Mu());var Z1=e=>{let{item:t,item_comp:n,ids:r}=e,o=ti(n);if(q1(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],s=o.component.props[i];a&&(s.value=a.value,s.valueBuilt=a.valueBuilt,s.jsxCalledBy=a.jsxCalledBy,s.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},q1=(e,t)=>{if(e.originalId=e.id,t[e.id]||(t[e.id]=(0,G1.createId)()),e.id=t[e.id],e.childs)for(let n of e.childs)q1(n,t)};m();g();h();var Q1=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=ti(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)}};m();g();h();var Lu=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 K1=(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]),Z1({item:n,item_comp:r,ids:a})}let i={item:Lu(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),Q1({item:n,item_comp:r,instance:o?o[n.id]:{},each(a,s){let u=n.component?.id;s.meta?.type==="content-element"&&u&&s.content&&(s.content.name=a,Si({...e},{item:s.content,root:t.root||s.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&&Si({...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 Si=(e,t)=>{let n=t.item;if(n.type==="item"&&n.component?.id&&t.ignore_first_component!==!0){K1(e,t);return}let r={item:Lu(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}),Si(e,a)}}};var II=()=>new Promise(async e=>{let t=!1,n=await fetch(z.url`_prasi/route`);t||(n.headers.get("content-encoding")||fetch(z.url`_prasi/compress/only-gz`),e(await n.json()))}),X1=async()=>{let e=eu(),t=[];try{let n=await II();if(n&&n.site&&n.urls){n.layout&&(z.layout.id=n.layout.id,z.layout.root=n.layout.root,z.layout.meta={},z.layout.root&&(await Bn(z.layout.root.childs),yo(z.layout.meta,z.layout.root))),z.site=n.site,z.site.code={mode:"vsc"},await PI(),z.site.api=Tw(z.site.api_url),z.site.db=J_(z.site.api_url);let r=window;r.serverurl=z.site.api_url,r.db=z.site.db,r.api=z.site.api;for(let o of n.urls)e.insert(o.url,o),t.push(o)}}catch{}return{router:e,pages:t}},PI=()=>new Promise(e=>{let t=document,n=t.createElement("script");n.onload=async()=>{e()};let r=z.site.api_url;r==="*"&&(r=`${location.protocol}//${location.host}`,z.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="",!["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}`,z.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)}),yo=(e,t)=>{for(let n of t.childs)Si({set_meta:!0,comps:z.comp.list,meta:e,mode:"page"},{item:n})};var J1=new ao({structuredClone:!0}),Lr={debug:!!localStorage.getItem("prasi-ws-debug"),reconnectTimeout:1e3,id_client:"",id_site:"",ws:null},ex=()=>{if(location.host==="localhost:4550"||location.host==="prasi.avolut.com"){let t=location.pathname.split("/")[2],n=()=>{let r=new URL(bt.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);Lr.ws=o,Lr.id_site=t,o.onopen=()=>{clearTimeout(i),bt.offline=!1,bt.editorRender?.()},o.onmessage=async a=>{let s=a.data,u=J1.unpack(k.from(await s.arrayBuffer()));if(Lr.debug&&console.log("%c\u2B07","color:red",nx(s.size,0),u),u.type===0)Lr.id_client=u.client_id,tx(o,{type:"preview",mode:"init",data:{site_id:t,client_id:u.client_id}});else if(u.type===2){if(u.event==="page_changed"){let c=u.data.map.id,l=z.page.cache[c],d=u.data.map.root;l.root=d;let f={id:l.id,url:l.url,root:d,meta:{}};await Bn(d.childs,!0),yo(f.meta,d),z.page.cache[f.id]=f,console.log(`${ro(Date.now(),"HH:mm:ss")} \u{1F6A7} Page [${u.data.map.root.name}] updated `),bt.prasiContext.render()}else if(u.event==="comp_changed"){let c=u.data.map.id;z.comp.list[c]=u.data.map.root;let l=z.page.cache[z.page.id];await Bn([z.comp.list[c]]),yo(l.meta,l.root),console.log(`${ro(Date.now(),"HH:mm:ss")} \u{1F6A7} Component [${u.data.map.root.name}] updated `),bt.prasiContext.render()}else if(u.event==="code_changes"){let{mode:c,ts:l,status:d}=u.data;if(c==="frontend")if(d==="ok"){console.clear(),console.log(`${ro(Date.now(),"HH:mm:ss")} \u{1F6A7} Code updated from vscode `);let f=`/prod/${t}/_prasi/code/index.js?ts=${l}`,p=new Function("callback",` +`+s);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};m();g();h();m();g();h();m();g();h();var G1=G(Mu());var Z1=e=>{let{item:t,item_comp:n,ids:r}=e,o=ti(n);if(q1(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],s=o.component.props[i];a&&(s.value=a.value,s.valueBuilt=a.valueBuilt,s.jsxCalledBy=a.jsxCalledBy,s.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},q1=(e,t)=>{if(e.originalId=e.id,t[e.id]||(t[e.id]=(0,G1.createId)()),e.id=t[e.id],e.childs)for(let n of e.childs)q1(n,t)};m();g();h();var Q1=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=ti(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)}};m();g();h();var Lu=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 K1=(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]),Z1({item:n,item_comp:r,ids:a})}let i={item:Lu(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),Q1({item:n,item_comp:r,instance:o?o[n.id]:{},each(a,s){let u=n.component?.id;s.meta?.type==="content-element"&&u&&s.content&&(s.content.name=a,Si({...e},{item:s.content,root:t.root||s.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&&Si({...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 Si=(e,t)=>{let n=t.item;if(n.type==="item"&&n.component?.id&&t.ignore_first_component!==!0){K1(e,t);return}let r={item:Lu(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}),Si(e,a)}}};var II=()=>new Promise(async e=>{let t=!1,n=await fetch(z.url`_prasi/route`);t||(n.headers.get("content-encoding")||fetch(z.url`_prasi/compress/only-gz`),e(await n.json()))}),X1=async()=>{let e=eu(),t=[];try{let n=await II();if(n&&n.site&&n.urls){n.layout&&(z.layout.id=n.layout.id,z.layout.root=n.layout.root,z.layout.meta={},z.layout.root&&(await Bn(z.layout.root.childs),yo(z.layout.meta,z.layout.root))),z.site=n.site,z.site.code={mode:"vsc"},await PI(),z.site.api=Tw(z.site.api_url),z.site.db=J_(z.site.api_url);let r=window;r.serverurl=z.site.api_url,r.db=z.site.db,r.api=z.site.api;for(let o of n.urls)e.insert(o.url,o),t.push(o)}}catch{}return{router:e,pages:t}},PI=()=>new Promise(e=>{let t=document,n=t.createElement("script");n.onload=async()=>{e()};let r=z.site.api_url;r==="*"&&(r=`${location.protocol}//${location.host}`,z.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="",!["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}`,z.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)}),yo=(e,t)=>{for(let n of t.childs)Si({set_meta:!0,comps:z.comp.list,meta:e,mode:"page"},{item:n})};var J1=new ao({structuredClone:!0}),Lr={debug:!!localStorage.getItem("prasi-ws-debug"),reconnectTimeout:1e3,id_client:"",id_site:"",ws:null},ex=()=>{if(location.host==="localhost:4550"||location.host==="prasi.avolut.com"){let t=location.pathname.split("/")[2],n=()=>{let r=new URL(bt.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);Lr.ws=o,Lr.id_site=t,o.onopen=()=>{clearTimeout(i),bt.offline=!1,bt.editorRender?.()},o.onmessage=async a=>{let s=a.data,u=J1.unpack(k.from(await s.arrayBuffer()));if(Lr.debug&&console.log("%c\u2B07","color:red",nx(s.size,0),u),u.type===0)Lr.id_client=u.client_id,tx(o,{type:"preview",mode:"init",data:{site_id:t,client_id:u.client_id}});else if(u.type===2){if(u.event==="page_changed"){let c=u.data.map.id,l=z.page.cache[c],d=u.data.map.root;l.root=d;let f={id:l.id,url:l.url,root:d,meta:{}};await Bn(d.childs,!0),yo(f.meta,d),z.page.cache[f.id]=f,console.log(`${ro(Date.now(),"HH:mm:ss")} \u{1F6A7} Page [${l.id}] updated `),bt.prasiContext.render()}else if(u.event==="comp_changed"){let c=u.data.map.id;z.comp.list[c]=u.data.map.root;let l=z.page.cache[z.page.id];await Bn([z.comp.list[c]]),yo(l.meta,l.root),console.log(`${ro(Date.now(),"HH:mm:ss")} \u{1F6A7} Component [${c}] updated `),bt.prasiContext.render()}else if(u.event==="code_changes"){let{mode:c,ts:l,status:d}=u.data;if(c==="frontend")if(d==="ok"){console.clear(),console.log(`${ro(Date.now(),"HH:mm:ss")} \u{1F6A7} Code updated from vscode `);let f=`/prod/${t}/_prasi/code/index.js?ts=${l}`,p=new Function("callback",` import("${f}") .catch((e) => console.error("Failed to load site code\\n\\n", e)) .then(callback)`);try{await new Promise(v=>{try{p(S=>{let b=window;for(let[y,w]of Object.entries(S))b[y]=w;v(S),b.prasiContext.render()})}catch(S){console.log("Failed to load site code",S)}})}catch{}}else d==="building"&&console.log(`${ro(Date.now(),"HH:mm:ss")} \u23F3 Code changed from vscode, rebuilding...`)}}}};n()}},Jl=e=>{Lr.ws&&tx(Lr.ws,{type:"preview",mode:"listen",data:{...e,client_id:Lr.id_client}})},tx=(e,t)=>{let n=J1.pack(t);Lr.debug&&console.log("%c\u2B06","color:blue",nx(n.length,0),t),e.send(n)};function nx(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]}m();g();h();var tS=G(Qe());m();g();h();m();g();h();m();g();h();var rx=/^(?:[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 NI(e){return typeof e=="string"&&rx.test(e)}var am=NI;m();g();h();var fs=G(ge()),sm=({children:e,back:t})=>(0,fs.jsxs)("div",{className:"flex items-center justify-center w-full h-full fixed inset-0 flex-col",children:[(0,fs.jsx)("div",{children:e}),(0,fs.jsxs)("div",{className:"border mt-2 rounded-md p-2 cursor-pointer",onClick:t||(()=>{history.back()}),children:[" ","Go Back"]})]});m();g();h();var ix=G(Qe());var lt=G(ge()),ox=window,ds=({children:e,className:t,show:n,backdrop:r,note:o,alt:i,pointer:a})=>{let s=_r({icon:(0,lt.jsx)("div",{className:"px-4 py-1",children:"Loading..."}),value:.111,ival:null},()=>{});return(0,ix.useEffect)(()=>(s.ival=setInterval(()=>{s.value+=.1333,s.value>=1.3&&(s.value=0),s.render()},200),ox.loadingIcon&&(s.icon=(0,lt.jsx)("img",{alt:"loading",src:ox.loadingIcon,className:css` diff --git a/app/srv/ws/sync/code/parts/init/frontend.ts b/app/srv/ws/sync/code/parts/init/frontend.ts index a57362ad..43934887 100644 --- a/app/srv/ws/sync/code/parts/init/frontend.ts +++ b/app/srv/ws/sync/code/parts/init/frontend.ts @@ -176,7 +176,9 @@ export const initFrontEnd = async ( try { broadcastLoading(); await fe.ctx.rebuild(); - } catch (e) {} + } catch (e) { + console.error('Fronted failed rebuild', e); + } fe.rebuilding = false; }, 500); } @@ -226,124 +228,4 @@ const isInstalling = async (id_site: string) => { } catch (e) {} return false; -}; - -// const readPackageJSON = async (id_site: string) => { -// const file = Bun.file(code.path(id_site, "site", "src", "package.json")); -// const deps = new Set(); - -// if (await file.exists()) { -// const json = await file.json(); - -// if (json.dependencies) { -// for (const k of Object.keys(json.dependencies)) { -// deps.add(k); -// } -// } - -// if (json.devDependencies) { -// for (const k of Object.keys(json.devDependencies)) { -// deps.add(k); -// } -// } -// } -// return deps; -// }; - -// const installDeps = async ( -// root: string, -// res: BuildResult, -// id_site: string -// ) => { -// const pkgjson = await readPackageJSON(id_site); -// const imports = new Set(); - -// if (res.errors.length > 0) { -// for (const err of res.errors) { -// if (err.notes?.[0].text.startsWith("You can mark the path ")) { -// let im = err.notes?.[0].text.split('"')[1]; - -// if ( -// !im.startsWith(".") && -// !im.startsWith("@/") && -// !im.startsWith("app") && -// !im.startsWith("lib") && -// !im.startsWith("server") -// ) { -// const parts = im.split("/"); -// if (im.startsWith("@")) { -// im = `${parts[0]}/${parts[1]}`; -// } else { -// im = parts[0]; -// } -// imports.add(im); -// } -// } -// } -// } - -// if (res.metafile) { -// for (const [_, file] of Object.entries(res.metafile?.inputs || {})) { -// for (const im of file.imports) { -// if (im.kind === "import-statement" && im.external) { -// if ( -// !im.path.startsWith(".") && -// !im.path.startsWith("@/") && -// !im.path.startsWith("app") && -// !im.path.startsWith("lib") && -// !im.path.startsWith("server") -// ) { -// const parts = im.path.split("/"); -// let src = im.path; -// if (src.startsWith("@")) { -// src = `${parts[0]}/${parts[1]}`; -// } else { -// src = parts[0]; -// } - -// imports.add(src); -// } -// } -// } -// } -// } - -// if (!isEqual(imports, pkgjson)) { -// const pkgjson = Bun.file(code.path(id_site, "site", "src", "package.json")); -// if (!(await pkgjson.exists())) { -// await Bun.write( -// pkgjson, -// JSON.stringify({ -// name: id_site, -// scripts: { -// startup: -// "ulimit -c 0; tailwindcss --watch -i ./app/css/global.css -o ./app/css/build.css --minify", -// }, -// }) -// ); -// } - -// await codeError( -// id_site, -// "Installing dependencies:\n " + [...imports].join("\n ") -// ); -// let proc = Bun.spawn([`npm`, `install`, ...imports], { -// stdio: ["inherit", "pipe", "pipe"], -// cwd: dir.data(root), -// }); - -// async function print(generator: ReadableStream, prefix: any) { -// for await (let value of generator) { -// const str = decoder.decode(value); -// await codeError(id_site, `${prefix} ${str}`, true); -// } -// } - -// print(proc.stdout, "stdout:"); -// print(proc.stderr, "stderr:"); - -// await proc.exited; -// // await codeError(id_site, ""); -// return true; -// } -// }; +}; \ No newline at end of file