@tensorix/metahub 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1195 -267
- package/dist/cli.js.map +19 -15
- package/dist/core/databases.d.ts +5 -1
- package/dist/core/databases.d.ts.map +1 -1
- package/dist/core/documents.d.ts +19 -0
- package/dist/core/documents.d.ts.map +1 -1
- package/dist/core/md/grammar.d.ts +40 -0
- package/dist/core/md/grammar.d.ts.map +1 -0
- package/dist/core/md/heal.d.ts +2 -0
- package/dist/core/md/heal.d.ts.map +1 -0
- package/dist/core/md/inline.d.ts +20 -0
- package/dist/core/md/inline.d.ts.map +1 -0
- package/dist/core/schema-init.d.ts +13 -0
- package/dist/core/schema-init.d.ts.map +1 -1
- package/dist/core/schema.d.ts +1 -1
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/sync/auth.d.ts +3 -1
- package/dist/core/sync/auth.d.ts.map +1 -1
- package/dist/core/sync/share-render.d.ts +3 -1
- package/dist/core/sync/share-render.d.ts.map +1 -1
- package/dist/db-worker.js +51 -41
- package/dist/index.js +1094 -254
- package/dist/index.js.map +15 -11
- package/dist/mh-runtime.js +1 -1
- package/dist/sw.js +1 -1
- package/dist/webui/fmt/manifest.d.ts +17 -0
- package/dist/webui/fmt/manifest.d.ts.map +1 -0
- package/dist/webui/server/assets.d.ts +5 -0
- package/dist/webui/server/assets.d.ts.map +1 -1
- package/dist/webui-fmt-clang.js +1 -0
- package/dist/webui-fmt-clang.wasm +0 -0
- package/dist/webui-fmt-gofmt.js +1 -0
- package/dist/webui-fmt-gofmt.wasm +0 -0
- package/dist/webui-fmt-lua.js +2 -0
- package/dist/webui-fmt-lua.wasm +0 -0
- package/dist/webui-fmt-ruff.js +2 -0
- package/dist/webui-fmt-ruff.wasm +0 -0
- package/dist/webui-fmt-sh.js +8 -0
- package/dist/webui-fmt-taplo.js +2 -0
- package/dist/webui-fmt-taplo.wasm +0 -0
- package/dist/webui-fmt.js +425 -0
- package/dist/webui.js +148 -75
- package/package.json +15 -1
package/dist/mh-runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class M extends Error{code;constructor(x,z){super(x);this.code=z;this.name="BusError"}}class Z{ch=null;worker=null;started=!1;leader=!1;nextLocal=0;localPending=new Map;remotePending=new Map;listeners=new Set;start(){if(this.started)return;this.started=!0,this.ch=new BroadcastChannel("mh-replica-bus"),this.ch.onmessage=(z)=>this.onChannel(z.data);let x=navigator.locks;if(x)x.request("mh-replica-leader",()=>{return this.becomeLeader(),new Promise(()=>{})}).catch(()=>{});else this.becomeLeader()}onEvent(x){return this.listeners.add(x),()=>this.listeners.delete(x)}call(x,...z){if(!this.started)this.start();if(this.leader)return this.workerCall(x,z);return this.remoteCall(x,z)}becomeLeader(){if(this.leader)return;this.leader=!0,this.spawnWorker();for(let[x,z]of[...this.remotePending])this.remotePending.delete(x),clearTimeout(z.timer),this.workerCall(z.op,z.args).then(z.resolve,z.reject)}spawnWorker(){if(this.worker)return;this.worker=new Worker("/db-worker.js",{type:"module"}),this.worker.onmessage=(x)=>{let z=x.data;if("id"in z){let C=this.localPending.get(z.id);if(!C)return;if(this.localPending.delete(z.id),z.ok)C.resolve(z.result);else C.reject(new M(z.error.message,z.error.code));return}this.emit(z),this.ch?.postMessage({kind:"event",event:z})},this.worker.onerror=()=>{let x={event:"status",status:{state:"error",paired:!1,node:null,error:"worker crashed"}};this.emit(x),this.ch?.postMessage({kind:"event",event:x})}}workerCall(x,z){if(!this.worker)this.spawnWorker();let C=++this.nextLocal;return new Promise((D,F)=>{this.localPending.set(C,{resolve:D,reject:F}),this.worker.postMessage({id:C,op:x,args:z})})}remoteCall(x,z){let C=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;return new Promise((D,F)=>{let G=setTimeout(()=>{if(this.remotePending.delete(C),this.leader){this.workerCall(x,z).then(D,F);return}F(new M("replica leader unavailable","network"))},1e4);this.remotePending.set(C,{resolve:D,reject:F,timer:G,op:x,args:z}),this.ch?.postMessage({kind:"req",id:C,op:x,args:z})})}onChannel(x){if(x.kind==="req"){if(!this.leader)return;this.workerCall(x.op,x.args).then((z)=>this.ch?.postMessage({kind:"res",id:x.id,ok:!0,result:z}),(z)=>this.ch?.postMessage({kind:"res",id:x.id,ok:!1,error:{message:z.message,code:z.code}}));return}if(x.kind==="res"){let z=this.remotePending.get(x.id);if(!z)return;if(this.remotePending.delete(x.id),clearTimeout(z.timer),x.ok)z.resolve(x.result);else z.reject(new M(x.error?.message??"replica error",x.error?.code));return}if(x.kind==="event"&&!this.leader)this.emit(x.event)}emit(x){for(let z of this.listeners)z(x)}stopWorker(){this.worker?.terminate(),this.worker=null,this.localPending.forEach((x)=>x.reject(new M("replica stopped",void 0))),this.localPending.clear()}}function S(){let x=globalThis;return x.__mhReplicaBus??=new Z}var V="mh_token",y="/auth/token",Q=globalThis;function A(x){try{localStorage.setItem(V,x)}catch{}document.cookie=`${V}=${encodeURIComponent(x)}; path=/; SameSite=Strict; Max-Age=31536000`}if(!Q.__mhFetchShim){Q.__mhFetchShim=!0;let x=window.fetch.bind(window),z=function(C,D){D=D??{};let F=null;try{F=localStorage.getItem(V)}catch{}let G=null;try{G=new URL(typeof C==="string"||C instanceof URL?String(C):C.url,location.href)}catch{G=null}let L=G!=null&&G.origin===location.origin;if(L&&F){let I=new Headers(D.headers??(typeof C!=="string"&&!(C instanceof URL)?C.headers:void 0));if(!I.has("authorization"))I.set("authorization",`Bearer ${F}`);D.headers=I}return x(C,D).then((I)=>{let q=D.__mhRetried;if(I.status!==401||!L||!F||q)return I;return x(y,{headers:{authorization:`Bearer ${F}`}}).then((J)=>J.ok?J.json():null).then((J)=>{if(!J?.token)return I;A(J.token);let X=new Headers(D.headers);return X.set("authorization",`Bearer ${J.token}`),D.headers=X,D.__mhRetried=!0,x(C,D)}).catch(()=>I)})};window.fetch=z}if("serviceWorker"in navigator&&window.isSecureContext)navigator.serviceWorker.register("/sw.js").catch((x)=>{console.warn("[mh-runtime] service worker registration failed —",x)});function $(){try{return localStorage.getItem("mh_replica")==="1"&&localStorage.getItem("mh_replica_hydrated")==="1"}catch{return!1}}globalThis.__mhOfflineBootstrap=(x,z)=>{let C=(D)=>{document.body.innerHTML=`<p style="font:14px system-ui;color:#888;margin:2em">${D}</p>`};if(!$()||typeof Worker>"u"){C("当前离线,且此浏览器尚未启用本地副本。请先在线打开 Metahub,在设置中开启「离线副本」。");return}(async()=>{try{let D=S();D.start();let F=await D.call("siteFile",x,z);if(!F){C("离线副本中没有这个页面。");return}if(!F.content_type.includes("text/html")){C("此资源不是页面,无法离线打开。");return}let G=F.encoding==="utf8"?F.content??"":atob(F.content??""),L='<script src="/mh-runtime.js"></script>',I=G.toLowerCase().indexOf("<head>");G=I>=0?G.slice(0,I+6)+L+G.slice(I+6):L+G,document.open(),document.write(G),document.close()}catch(D){C(`离线加载失败:${D.message}`)}})()};if(!Q.__mhSwBridge&&"serviceWorker"in navigator)Q.__mhSwBridge=!0,navigator.serviceWorker.addEventListener("message",(x)=>{let z=x.data,C=x.ports?.[0];if(!z||z.kind!=="mh-rpc"||!C||!z.op)return;if(!$()||typeof Worker>"u"){C.postMessage({ok:!1,error:{message:"replica unavailable",code:"unavailable"}});return}let D=S();D.start(),D.call(z.op,...z.args??[]).then((F)=>C.postMessage({ok:!0,result:F}),(F)=>C.postMessage({ok:!1,error:{message:F.message,code:F.code}}))});
|
|
1
|
+
class M extends Error{code;constructor(x,z){super(x);this.code=z;this.name="BusError"}}class Z{ch=null;worker=null;started=!1;leader=!1;nextLocal=0;localPending=new Map;remotePending=new Map;listeners=new Set;start(){if(this.started)return;this.started=!0,this.ch=new BroadcastChannel("mh-replica-bus"),this.ch.onmessage=(z)=>this.onChannel(z.data);let x=navigator.locks;if(x)x.request("mh-replica-leader",()=>{return this.becomeLeader(),new Promise(()=>{})}).catch(()=>{});else this.becomeLeader()}onEvent(x){return this.listeners.add(x),()=>this.listeners.delete(x)}call(x,...z){if(!this.started)this.start();if(this.leader)return this.workerCall(x,z);return this.remoteCall(x,z)}becomeLeader(){if(this.leader)return;this.leader=!0,this.spawnWorker();for(let[x,z]of[...this.remotePending])this.remotePending.delete(x),clearTimeout(z.timer),this.workerCall(z.op,z.args).then(z.resolve,z.reject)}spawnWorker(){if(this.worker)return;this.worker=new Worker("/db-worker.js",{type:"module"}),this.worker.onmessage=(x)=>{let z=x.data;if("id"in z){let C=this.localPending.get(z.id);if(!C)return;if(this.localPending.delete(z.id),z.ok)C.resolve(z.result);else C.reject(new M(z.error.message,z.error.code));return}this.emit(z),this.ch?.postMessage({kind:"event",event:z})},this.worker.onerror=()=>{let x={event:"status",status:{state:"error",paired:!1,node:null,error:"worker crashed"}};this.emit(x),this.ch?.postMessage({kind:"event",event:x})}}workerCall(x,z){if(!this.worker)this.spawnWorker();let C=++this.nextLocal;return new Promise((D,F)=>{this.localPending.set(C,{resolve:D,reject:F}),this.worker.postMessage({id:C,op:x,args:z})})}remoteCall(x,z){let C=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;return new Promise((D,F)=>{let G=setTimeout(()=>{if(this.remotePending.delete(C),this.leader){this.workerCall(x,z).then(D,F);return}F(new M("replica leader unavailable","network"))},1e4);this.remotePending.set(C,{resolve:D,reject:F,timer:G,op:x,args:z}),this.ch?.postMessage({kind:"req",id:C,op:x,args:z})})}onChannel(x){if(x.kind==="req"){if(!this.leader)return;this.workerCall(x.op,x.args).then((z)=>this.ch?.postMessage({kind:"res",id:x.id,ok:!0,result:z}),(z)=>this.ch?.postMessage({kind:"res",id:x.id,ok:!1,error:{message:z.message,code:z.code}}));return}if(x.kind==="res"){let z=this.remotePending.get(x.id);if(!z)return;if(this.remotePending.delete(x.id),clearTimeout(z.timer),x.ok)z.resolve(x.result);else z.reject(new M(x.error?.message??"replica error",x.error?.code));return}if(x.kind==="event"&&!this.leader)this.emit(x.event)}emit(x){for(let z of this.listeners)z(x)}stopWorker(){this.worker?.terminate(),this.worker=null,this.localPending.forEach((x)=>x.reject(new M("replica stopped",void 0))),this.localPending.clear()}}function S(){let x=globalThis;return x.__mhReplicaBus??=new Z}var V="mh_token",y="/auth/token",Q=globalThis;function A(x){try{localStorage.setItem(V,x)}catch{}document.cookie=`${V}=${encodeURIComponent(x)}; path=/; SameSite=Strict; Max-Age=31536000`}if(!Q.__mhFetchShim){Q.__mhFetchShim=!0;let x=window.fetch.bind(window),z=function(C,D){D=D??{};let F=null;try{F=localStorage.getItem(V)}catch{}let G=null;try{G=new URL(typeof C==="string"||C instanceof URL?String(C):C.url,location.href)}catch{G=null}let L=G!=null&&G.origin===location.origin;if(L&&F){let I=new Headers(D.headers??(typeof C!=="string"&&!(C instanceof URL)?C.headers:void 0));if(!I.has("authorization"))I.set("authorization",`Bearer ${F}`);D.headers=I}return x(C,D).then((I)=>{let q=D.__mhRetried;if(I.status!==401||!L||!F||q)return I;return x(y,{headers:{authorization:`Bearer ${F}`}}).then((J)=>J.ok?J.json():null).then((J)=>{if(!J?.token)return I;A(J.token);let X=new Headers(D.headers);return X.set("authorization",`Bearer ${J.token}`),D.headers=X,D.__mhRetried=!0,x(C,D)}).catch(()=>I)})};window.fetch=z}if("serviceWorker"in navigator&&window.isSecureContext&&!window.metahubDesktop)navigator.serviceWorker.register("/sw.js").catch((x)=>{console.warn("[mh-runtime] service worker registration failed —",x)});function $(){try{return localStorage.getItem("mh_replica")==="1"&&localStorage.getItem("mh_replica_hydrated")==="1"}catch{return!1}}globalThis.__mhOfflineBootstrap=(x,z)=>{let C=(D)=>{document.body.innerHTML=`<p style="font:14px system-ui;color:#888;margin:2em">${D}</p>`};if(!$()||typeof Worker>"u"){C("当前离线,且此浏览器尚未启用本地副本。请先在线打开 Metahub,在设置中开启「离线副本」。");return}(async()=>{try{let D=S();D.start();let F=await D.call("siteFile",x,z);if(!F){C("离线副本中没有这个页面。");return}if(!F.content_type.includes("text/html")){C("此资源不是页面,无法离线打开。");return}let G=F.encoding==="utf8"?F.content??"":atob(F.content??""),L='<script src="/mh-runtime.js"></script>',I=G.toLowerCase().indexOf("<head>");G=I>=0?G.slice(0,I+6)+L+G.slice(I+6):L+G,document.open(),document.write(G),document.close()}catch(D){C(`离线加载失败:${D.message}`)}})()};if(!Q.__mhSwBridge&&"serviceWorker"in navigator)Q.__mhSwBridge=!0,navigator.serviceWorker.addEventListener("message",(x)=>{let z=x.data,C=x.ports?.[0];if(!z||z.kind!=="mh-rpc"||!C||!z.op)return;if(!$()||typeof Worker>"u"){C.postMessage({ok:!1,error:{message:"replica unavailable",code:"unavailable"}});return}let D=S();D.start(),D.call(z.op,...z.args??[]).then((F)=>C.postMessage({ok:!0,result:F}),(F)=>C.postMessage({ok:!1,error:{message:F.message,code:F.code}}))});
|
package/dist/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function H(J,Y,Z,z){let Q=Z.get("id"),$=Z.get("db"),G=z??{},D=(V)=>V!=null?Number(V):void 0;switch(`${J} ${Y}`){case"GET /api/databases":return{op:"listDatabases",args:[]};case"POST /api/databases":return{op:"createDatabase",args:[G]};case"PATCH /api/database":return Q?{op:"updateDatabase",args:[Q,G]}:null;case"POST /api/database/duplicate":return Q?{op:"duplicateDatabase",args:[Q,G]}:null;case"DELETE /api/database":return Q?{op:"deleteDatabase",args:[Q]}:null;case"GET /api/database/activity":return $?{op:"listDatabaseActivity",args:[$,D(Z.get("limit"))]}:null;case"GET /api/properties":return $?{op:"listProperties",args:[$]}:null;case"POST /api/properties":{let{db:V,...X}=G;return V?{op:"addProperty",args:[V,X]}:null}case"PATCH /api/property":return Q?{op:"updateProperty",args:[Q,G]}:null;case"PATCH /api/property/width":return Q?{op:"setPropertyWidth",args:[Q,G.width]}:null;case"DELETE /api/property":return Q?{op:"removeProperty",args:[Q]}:null;case"GET /api/property/history":return Q?{op:"listPropertyRevisions",args:[Q]}:null;case"POST /api/property/revert":return Q?{op:"revertProperty",args:[Q,G.to]}:null;case"GET /api/records":return $?{op:"listRecords",args:[$,{sort:Z.get("sort")??void 0,limit:D(Z.get("limit"))}]}:null;case"POST /api/records":return $?{op:"createRecord",args:[$,G]}:null;case"GET /api/record":return Q?{op:"getRecord",args:[Q]}:null;case"PATCH /api/record":return Q?{op:"updateRecord",args:[Q,G]}:null;case"PATCH /api/record/order":{let{target:V,where:X}=G;return Q&&V?{op:"moveRecord",args:[Q,V,X]}:null}case"GET /api/record/history":return Q?{op:"listRecordRevisions",args:[Q]}:null;case"GET /api/record/at":return Q?{op:"recordAtVersion",args:[Q,Z.get("version")]}:null;case"GET /api/record/field-history":return Q?{op:"recordFieldHistory",args:[Q,Z.get("prop")]}:null;case"POST /api/record/revert":return Q?{op:"revertRecord",args:[Q,G.to]}:null;case"DELETE /api/record":return Q?{op:"deleteRecord",args:[Q]}:null;case"GET /api/documents":return{op:"listDocuments",args:[{database_id:Z.get("db")??void 0,parent_id:Z.get("parent")??void 0}]};case"POST /api/documents":return{op:"createDocument",args:[G]};case"GET /api/document":return Q?{op:"getDocument",args:[Q]}:null;case"PATCH /api/document":{let{if_match:V,...X}=G;return Q?{op:"updateDocument",args:[Q,X,V]}:null}case"POST /api/document/duplicate":return Q?{op:"duplicateDocument",args:[Q,G]}:null;case"PATCH /api/document/move":{let{target:V,where:X}=G;return Q&&V?{op:"moveDocument",args:[Q,V,X]}:null}case"GET /api/document/history":return Q?{op:"listDocumentRevisions",args:[Q]}:null;case"GET /api/document/at":return Q?{op:"documentAtVersion",args:[Q,Z.get("version")]}:null;case"POST /api/document/revert":{let{to:V,if_match:X}=G;return Q&&V?{op:"revertDocument",args:[Q,V,X]}:null}case"DELETE /api/document":return Q?{op:"deleteDocument",args:[Q]}:null;case"GET /api/nodes":return{op:"nodes",args:[]};case"GET /api/search":{let V=Z.get("q");return V?{op:"search",args:[V,D(Z.get("limit"))]}:null}default:return null}}function w(J,Y){if(J===null)return"unknown";if(J.status>=500)return"unknown";if(J.ok)return Y?.ok===!0?"server":"none";return"none"}async function g(){let J=null,Y=null;try{J=await fetch("/health",{cache:"no-store"}),Y=J.ok?await J.json().catch(()=>null):null}catch{J=null}return w(J,Y)}var q=Math.floor(167772160);function u(J){if(J instanceof ArrayBuffer)return J;let Y=new Uint8Array(J.byteLength);return Y.set(J),Y.buffer}async function v(J){let Y=await crypto.subtle.digest("SHA-256",u(J));return[...new Uint8Array(Y)].map((Z)=>Z.toString(16).padStart(2,"0")).join("")}async function M(J,Y){return(await v(J)).slice(0,Y.length)===Y}var m={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",svg:"image/svg+xml",pdf:"application/pdf"};function O(J){let Y=J.lastIndexOf("."),Z=Y>=0?J.slice(Y+1).toLowerCase():"";return m[Z]??"application/octet-stream"}var N=null;function y(){if(N)return N;return N=new Promise((J,Y)=>{let Z=indexedDB.open("mh-blobs",1);Z.onupgradeneeded=()=>{let z=Z.result;if(!z.objectStoreNames.contains("spool"))z.createObjectStore("spool",{keyPath:"hash"});if(!z.objectStoreNames.contains("meta"))z.createObjectStore("meta",{keyPath:"hash"})},Z.onsuccess=()=>J(Z.result),Z.onerror=()=>Y(Z.error)}),N}function k(J,Y,Z){return y().then((z)=>new Promise((Q,$)=>{let G=Z(z.transaction(J,Y).objectStore(J));G.onsuccess=()=>Q(G.result),G.onerror=()=>$(G.error)}))}var W=(J)=>`/blob/${J}`;async function b(J,Y,Z){let z=await k("meta","readonly",($)=>$.get(J)),Q={hash:J,size:Y,accessed:Date.now(),pinned:z?.pinned??0,content_type:Z??z?.content_type};await k("meta","readwrite",($)=>$.put(Q))}async function p(J){let Y=await k("meta","readonly",(Z)=>Z.get(J));if(!Y)return;Y.accessed=Date.now(),await k("meta","readwrite",(Z)=>Z.put(Y))}function l(J){return J.trim().toLowerCase().startsWith("text/html")}async function x(J){let Y=await caches.open("mh-blob-v1"),Z=await Y.match(W(J));if(!Z)return;if(l(Z.headers.get("content-type")??"")){await Y.delete(W(J)),await k("meta","readwrite",(z)=>z.delete(J)).catch(()=>{});return}return p(J),Z}async function P(J,Y,Z){await(await caches.open("mh-blob-v1")).put(W(J),new Response(Y,{headers:{"content-type":Z,"cache-control":"public, max-age=31536000, immutable"}})),await b(J,Y.byteLength,Z),await d()}async function d(){let J=await k("meta","readonly",(Q)=>Q.getAll())??[],Y=J.reduce((Q,$)=>Q+$.size,0);if(Y<=209715200)return;let Z=await caches.open("mh-blob-v1"),z=J.filter((Q)=>!Q.pinned).sort((Q,$)=>Q.accessed-$.accessed);for(let Q of z){if(Y<=q)break;await Z.delete(W(Q.hash)),await k("meta","readwrite",($)=>$.delete(Q.hash)),Y-=Q.size}}var F=globalThis,U=F.caches,c="__MH_SW_VERSION__",K=`mh-shell-${c}`,_="mh-api-v1",o="mh-wasm-v1",T=["/","/webui.js","/webui.css","/manifest.webmanifest","/db-worker.js","/mh-runtime.js"],I=3500,i=12000;function B(J){return J.ok&&J.headers.get("x-mh-unlock")==null}var R=null;async function S(){if(R==null){let J=await g();if(J==="unknown")return!1;R=J}return R==="none"}F.addEventListener("install",(J)=>{J.waitUntil((async()=>{try{let Y=await U.open(K);await Promise.allSettled(T.map(async(Z)=>{let z=await fetch(Z);if(B(z))await Y.put(Z,z)})),await F.skipWaiting()}catch(Y){try{await(await U.open("mh-debug")).put("/__mh-sw-install-error",new Response(String(Y?.stack??Y)))}catch{}throw Y}})())});F.addEventListener("activate",(J)=>{J.waitUntil((async()=>{for(let Y of await U.keys())if(Y.startsWith("mh-shell-")&&Y!==K)await U.delete(Y);await F.clients.claim()})())});function A(J,Y){return new Promise((Z,z)=>{let Q=setTimeout(()=>z(Error("sw: network timeout")),Y);fetch(J).then(($)=>{clearTimeout(Q),Z($)},($)=>{clearTimeout(Q),z($)})})}async function C(J,Y,Z,z){let Q=await U.open(Y),$=z??J;try{let G=await A(J,Z);if(B(G))await Q.put($,G.clone());return G}catch(G){let D=await Q.match($);if(D)return D;throw G}}function h(J,Y,Z){return new Promise((z,Q)=>{let $=new MessageChannel,G=setTimeout(()=>Q(Error("sw: rpc timeout")),i);$.port1.onmessage=(D)=>{clearTimeout(G),z(D.data)},J.postMessage({kind:"mh-rpc",op:Y,args:Z},[$.port2])})}async function L(J,Y,Z){let z=new Set,Q=[];if(J.clientId){let $=await F.clients.get(J.clientId);if($)Q.push($)}for(let $ of await F.clients.matchAll({type:"window",includeUncontrolled:!0}))if(!Q.some((G)=>G.id===$.id))Q.push($);for(let $ of Q){if(z.has($.id))continue;z.add($.id);try{let G=await h($,Y,Z);if(!G.ok&&G.error?.code==="unavailable")continue;return G}catch{continue}}return null}var n={invalid_input:400,not_found:404,ambiguous:400,stale:409,conflict:409,auth:401,network:502};function E(J){if(J.ok)return new Response(JSON.stringify(J.result??null),{headers:{"content-type":"application/json","x-mh-source":"replica"}});let Y=J.error?.code;return new Response(JSON.stringify({error:J.error?.message??"replica error",code:Y}),{status:Y?n[Y]??400:502,headers:{"content-type":"application/json","x-mh-source":"replica"}})}async function a(J){let Y=J.request,Z=new URL(Y.url),z=null;if(Y.method!=="GET"&&(Y.headers.get("content-type")??"").includes("json"))z=await Y.clone().json().catch(()=>null);if(await S()){let Q=H(Y.method,Z.pathname,Z.searchParams,z);if(Q){let $=await L(J,Q.op,Q.args);if($)return E($)}return new Response(JSON.stringify({error:"no metahub server (bucket-only mode)",code:"network"}),{status:502,headers:{"content-type":"application/json","x-mh-source":"replica"}})}try{let Q=Y.method==="GET"?await A(Y,I*2):await fetch(Y);if(Y.method==="GET"&&B(Q))await(await U.open(_)).put(Y,Q.clone());return Q}catch(Q){let $=H(Y.method,Z.pathname,Z.searchParams,z);if($){let G=await L(J,$.op,$.args);if(G)return E(G)}if(Y.method==="GET"){let G=await(await U.open(_)).match(Y);if(G)return G}throw Q}}function r(J){let Z=J.toLowerCase().indexOf("<head>");if(Z>=0)return J.slice(0,Z+6)+'<script src="/mh-runtime.js"></script>'+J.slice(Z+6);return'<script src="/mh-runtime.js"></script>'+J}function s(J){let Y=J.content_type.includes("text/html"),Z=J.content??"",z;if(J.encoding==="utf8")z=Y?r(Z):Z;else{let Q=atob(Z),$=new Uint8Array(Q.length);for(let G=0;G<Q.length;G++)$[G]=Q.charCodeAt(G);z=$}return new Response(z,{headers:{"content-type":J.content_type,"x-mh-source":"replica"}})}function t(J,Y){let Z=`${JSON.stringify(J)},${JSON.stringify(Y)}`;return new Response(`<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script src="/mh-runtime.js"></script></head><body><p style="font:14px system-ui;color:#888;margin:2em">正在从本地副本加载…</p><script>__mhOfflineBootstrap(${Z})</script></body></html>`,{headers:{"content-type":"text/html; charset=utf-8","x-mh-source":"bootstrap"}})}async function f(J,Y){let Z=Y.pathname.slice(7);if(Z==="")return null;let z=Z.indexOf("/");if(z===-1)return Response.redirect(`${Y.origin}/sites/${Z}/`,301);let Q=decodeURIComponent(Z.slice(0,z)),$=decodeURIComponent(Z.slice(z+1)),G=await L(J,"siteFile",[Q,$]);if(G?.ok&&G.result)return s(G.result);if(G?.ok&&G.result==null)return new Response("not found (offline replica)",{status:404});if(J.request.mode==="navigate")return t(Q,$);return null}async function e(J){let Y=J.request,Z=new URL(Y.url);if(await S())return await f(J,Z)??new Response("not found",{status:404});try{return await A(Y,I)}catch(z){let Q=await f(J,Z);if(Q)return Q;throw z}}async function JJ(J){let Y=J.request,Z=new URL(Y.url),z=decodeURIComponent(Z.pathname.slice(6)),Q=z.indexOf("."),$=(Q>=0?z.slice(0,Q):z).toLowerCase();if(!/^[0-9a-f]{16,64}$/.test($))return fetch(Y);let G=O(z),D=await x($);if(D)return D;if(!await S())try{let V=await A(new Request(Y,{cache:"no-store"}),I*2);if(V.ok){let X=await V.clone().arrayBuffer();if(await M(X,$))return await P($,X,V.headers.get("content-type")??G),V}}catch{}let j=await L(J,"blobBytes",[$]);if(j?.ok&&j.result){let V=j.result;if(await M(V,$))return await P($,V,G),new Response(V,{headers:{"content-type":G,"x-mh-source":"replica"}})}return new Response("blob unavailable offline",{status:404})}F.addEventListener("fetch",(J)=>{let Y=J.request,Z=new URL(Y.url);if(Z.origin!==F.location.origin)return;if(Z.pathname.startsWith("/api/")){J.respondWith(a(J));return}if(Y.method!=="GET")return;if(Z.pathname.startsWith("/sites/")){J.respondWith(e(J));return}if(Z.pathname.startsWith("/blob/")){J.respondWith(JJ(J));return}if(Y.mode==="navigate"){if(Z.pathname!=="/")return;J.respondWith(C(Y,K,I,"/"));return}if(T.includes(Z.pathname)||Z.pathname.startsWith("/icons/")){J.respondWith(C(Y,K,I));return}if(Z.pathname==="/sqlite3.wasm"){J.respondWith((async()=>{let z=await U.open(o),Q=await z.match(Y);if(Q)return Q;let $=await fetch(Y);if(B($))await z.put(Y,$.clone());return $})());return}});
|
|
1
|
+
function A(J,Y,Z,z){let Q=Z.get("id"),$=Z.get("db"),G=z??{},D=(V)=>V!=null?Number(V):void 0;switch(`${J} ${Y}`){case"GET /api/databases":return{op:"listDatabases",args:[]};case"POST /api/databases":return{op:"createDatabase",args:[G]};case"PATCH /api/database":return Q?{op:"updateDatabase",args:[Q,G]}:null;case"POST /api/database/duplicate":return Q?{op:"duplicateDatabase",args:[Q,G]}:null;case"DELETE /api/database":return Q?{op:"deleteDatabase",args:[Q]}:null;case"GET /api/database/activity":return $?{op:"listDatabaseActivity",args:[$,D(Z.get("limit"))]}:null;case"GET /api/properties":return $?{op:"listProperties",args:[$]}:null;case"POST /api/properties":{let{db:V,...X}=G;return V?{op:"addProperty",args:[V,X]}:null}case"PATCH /api/property":return Q?{op:"updateProperty",args:[Q,G]}:null;case"PATCH /api/property/width":return Q?{op:"setPropertyWidth",args:[Q,G.width]}:null;case"DELETE /api/property":return Q?{op:"removeProperty",args:[Q]}:null;case"GET /api/property/history":return Q?{op:"listPropertyRevisions",args:[Q]}:null;case"POST /api/property/revert":return Q?{op:"revertProperty",args:[Q,G.to]}:null;case"GET /api/records":return $?{op:"listRecords",args:[$,{sort:Z.get("sort")??void 0,limit:D(Z.get("limit"))}]}:null;case"POST /api/records":return $?{op:"createRecord",args:[$,G]}:null;case"GET /api/record":return Q?{op:"getRecord",args:[Q]}:null;case"PATCH /api/record":return Q?{op:"updateRecord",args:[Q,G]}:null;case"PATCH /api/record/order":{let{target:V,where:X}=G;return Q&&V?{op:"moveRecord",args:[Q,V,X]}:null}case"GET /api/record/history":return Q?{op:"listRecordRevisions",args:[Q]}:null;case"GET /api/record/at":return Q?{op:"recordAtVersion",args:[Q,Z.get("version")]}:null;case"GET /api/record/field-history":return Q?{op:"recordFieldHistory",args:[Q,Z.get("prop")]}:null;case"POST /api/record/revert":return Q?{op:"revertRecord",args:[Q,G.to]}:null;case"DELETE /api/record":return Q?{op:"deleteRecord",args:[Q]}:null;case"GET /api/documents":return{op:"listDocuments",args:[{database_id:Z.get("db")??void 0,parent_id:Z.get("parent")??void 0}]};case"POST /api/documents":return{op:"createDocument",args:[G]};case"GET /api/document":return Q?{op:"getDocument",args:[Q]}:null;case"PATCH /api/document":{let{if_match:V,...X}=G;return Q?{op:"updateDocument",args:[Q,X,V]}:null}case"POST /api/document/duplicate":return Q?{op:"duplicateDocument",args:[Q,G]}:null;case"PATCH /api/document/move":{let{target:V,where:X}=G;return Q&&V?{op:"moveDocument",args:[Q,V,X]}:null}case"GET /api/document/history":return Q?{op:"listDocumentRevisions",args:[Q]}:null;case"GET /api/document/at":return Q?{op:"documentAtVersion",args:[Q,Z.get("version")]}:null;case"POST /api/document/revert":{let{to:V,if_match:X}=G;return Q&&V?{op:"revertDocument",args:[Q,V,X]}:null}case"DELETE /api/document":return Q?{op:"deleteDocument",args:[Q]}:null;case"GET /api/nodes":return{op:"nodes",args:[]};case"GET /api/search":{let V=Z.get("q");return V?{op:"search",args:[V,D(Z.get("limit"))]}:null}default:return null}}function w(J,Y){if(J===null)return"unknown";if(J.status>=500)return"unknown";if(J.ok)return Y?.ok===!0?"server":"none";return"none"}async function g(){let J=null,Y=null;try{J=await fetch("/health",{cache:"no-store"}),Y=J.ok?await J.json().catch(()=>null):null}catch{J=null}return w(J,Y)}var q=Math.floor(167772160);function u(J){if(J instanceof ArrayBuffer)return J;let Y=new Uint8Array(J.byteLength);return Y.set(J),Y.buffer}async function v(J){let Y=await crypto.subtle.digest("SHA-256",u(J));return[...new Uint8Array(Y)].map((Z)=>Z.toString(16).padStart(2,"0")).join("")}async function M(J,Y){return(await v(J)).slice(0,Y.length)===Y}var m={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",svg:"image/svg+xml",pdf:"application/pdf"};function O(J){let Y=J.lastIndexOf("."),Z=Y>=0?J.slice(Y+1).toLowerCase():"";return m[Z]??"application/octet-stream"}var K=null;function y(){if(K)return K;return K=new Promise((J,Y)=>{let Z=indexedDB.open("mh-blobs",1);Z.onupgradeneeded=()=>{let z=Z.result;if(!z.objectStoreNames.contains("spool"))z.createObjectStore("spool",{keyPath:"hash"});if(!z.objectStoreNames.contains("meta"))z.createObjectStore("meta",{keyPath:"hash"})},Z.onsuccess=()=>J(Z.result),Z.onerror=()=>Y(Z.error)}),K}function k(J,Y,Z){return y().then((z)=>new Promise((Q,$)=>{let G=Z(z.transaction(J,Y).objectStore(J));G.onsuccess=()=>Q(G.result),G.onerror=()=>$(G.error)}))}var B=(J)=>`/blob/${J}`;async function b(J,Y,Z){let z=await k("meta","readonly",($)=>$.get(J)),Q={hash:J,size:Y,accessed:Date.now(),pinned:z?.pinned??0,content_type:Z??z?.content_type};await k("meta","readwrite",($)=>$.put(Q))}async function p(J){let Y=await k("meta","readonly",(Z)=>Z.get(J));if(!Y)return;Y.accessed=Date.now(),await k("meta","readwrite",(Z)=>Z.put(Y))}function l(J){return J.trim().toLowerCase().startsWith("text/html")}async function x(J){let Y=await caches.open("mh-blob-v1"),Z=await Y.match(B(J));if(!Z)return;if(l(Z.headers.get("content-type")??"")){await Y.delete(B(J)),await k("meta","readwrite",(z)=>z.delete(J)).catch(()=>{});return}return p(J),Z}async function R(J,Y,Z){await(await caches.open("mh-blob-v1")).put(B(J),new Response(Y,{headers:{"content-type":Z,"cache-control":"public, max-age=31536000, immutable"}})),await b(J,Y.byteLength,Z),await d()}async function d(){let J=await k("meta","readonly",(Q)=>Q.getAll())??[],Y=J.reduce((Q,$)=>Q+$.size,0);if(Y<=209715200)return;let Z=await caches.open("mh-blob-v1"),z=J.filter((Q)=>!Q.pinned).sort((Q,$)=>Q.accessed-$.accessed);for(let Q of z){if(Y<=q)break;await Z.delete(B(Q.hash)),await k("meta","readwrite",($)=>$.delete(Q.hash)),Y-=Q.size}}var F=globalThis,U=F.caches,c="__MH_SW_VERSION__",I=`mh-shell-${c}`,_="mh-api-v1",o="mh-wasm-v1",T=["/","/webui.js","/webui.css","/manifest.webmanifest","/db-worker.js","/mh-runtime.js"],j=3500,i=12000;function N(J){return J.ok&&J.headers.get("x-mh-unlock")==null}var H=null;async function S(){if(H==null){let J=await g();if(J==="unknown")return!1;H=J}return H==="none"}F.addEventListener("install",(J)=>{J.waitUntil((async()=>{try{let Y=await U.open(I);await Promise.allSettled(T.map(async(Z)=>{let z=await fetch(Z);if(N(z))await Y.put(Z,z)})),await F.skipWaiting()}catch(Y){try{await(await U.open("mh-debug")).put("/__mh-sw-install-error",new Response(String(Y?.stack??Y)))}catch{}throw Y}})())});F.addEventListener("activate",(J)=>{J.waitUntil((async()=>{for(let Y of await U.keys())if(Y.startsWith("mh-shell-")&&Y!==I)await U.delete(Y);await F.clients.claim()})())});function P(J,Y){return new Promise((Z,z)=>{let Q=setTimeout(()=>z(Error("sw: network timeout")),Y);fetch(J).then(($)=>{clearTimeout(Q),Z($)},($)=>{clearTimeout(Q),z($)})})}async function f(J,Y,Z,z){let Q=await U.open(Y),$=z??J;try{let G=await P(J,Z);if(N(G))await Q.put($,G.clone());return G}catch(G){let D=await Q.match($);if(D)return D;throw G}}function n(J,Y,Z){return new Promise((z,Q)=>{let $=new MessageChannel,G=setTimeout(()=>Q(Error("sw: rpc timeout")),i);$.port1.onmessage=(D)=>{clearTimeout(G),z(D.data)},J.postMessage({kind:"mh-rpc",op:Y,args:Z},[$.port2])})}async function L(J,Y,Z){let z=new Set,Q=[];if(J.clientId){let $=await F.clients.get(J.clientId);if($)Q.push($)}for(let $ of await F.clients.matchAll({type:"window",includeUncontrolled:!0}))if(!Q.some((G)=>G.id===$.id))Q.push($);for(let $ of Q){if(z.has($.id))continue;z.add($.id);try{let G=await n($,Y,Z);if(!G.ok&&G.error?.code==="unavailable")continue;return G}catch{continue}}return null}var h={invalid_input:400,not_found:404,ambiguous:400,stale:409,conflict:409,auth:401,network:502};function E(J){if(J.ok)return new Response(JSON.stringify(J.result??null),{headers:{"content-type":"application/json","x-mh-source":"replica"}});let Y=J.error?.code;return new Response(JSON.stringify({error:J.error?.message??"replica error",code:Y}),{status:Y?h[Y]??400:502,headers:{"content-type":"application/json","x-mh-source":"replica"}})}async function a(J){let Y=J.request,Z=new URL(Y.url),z=null;if(Y.method!=="GET"&&(Y.headers.get("content-type")??"").includes("json"))z=await Y.clone().json().catch(()=>null);if(await S()){let Q=A(Y.method,Z.pathname,Z.searchParams,z);if(Q){let $=await L(J,Q.op,Q.args);if($)return E($)}return new Response(JSON.stringify({error:"no metahub server (bucket-only mode)",code:"network"}),{status:502,headers:{"content-type":"application/json","x-mh-source":"replica"}})}try{let Q=Y.method==="GET"?await P(Y,j*2):await fetch(Y);if(Y.method==="GET"&&N(Q))await(await U.open(_)).put(Y,Q.clone());return Q}catch(Q){let $=A(Y.method,Z.pathname,Z.searchParams,z);if($){let G=await L(J,$.op,$.args);if(G)return E(G)}if(Y.method==="GET"){let G=await(await U.open(_)).match(Y);if(G)return G}throw Q}}function r(J){let Z=J.toLowerCase().indexOf("<head>");if(Z>=0)return J.slice(0,Z+6)+'<script src="/mh-runtime.js"></script>'+J.slice(Z+6);return'<script src="/mh-runtime.js"></script>'+J}function s(J){let Y=J.content_type.includes("text/html"),Z=J.content??"",z;if(J.encoding==="utf8")z=Y?r(Z):Z;else{let Q=atob(Z),$=new Uint8Array(Q.length);for(let G=0;G<Q.length;G++)$[G]=Q.charCodeAt(G);z=$}return new Response(z,{headers:{"content-type":J.content_type,"x-mh-source":"replica"}})}function t(J,Y){let Z=`${JSON.stringify(J)},${JSON.stringify(Y)}`;return new Response(`<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script src="/mh-runtime.js"></script></head><body><p style="font:14px system-ui;color:#888;margin:2em">正在从本地副本加载…</p><script>__mhOfflineBootstrap(${Z})</script></body></html>`,{headers:{"content-type":"text/html; charset=utf-8","x-mh-source":"bootstrap"}})}async function C(J,Y){let Z=Y.pathname.slice(7);if(Z==="")return null;let z=Z.indexOf("/");if(z===-1)return Response.redirect(`${Y.origin}/sites/${Z}/`,301);let Q=decodeURIComponent(Z.slice(0,z)),$=decodeURIComponent(Z.slice(z+1)),G=await L(J,"siteFile",[Q,$]);if(G?.ok&&G.result)return s(G.result);if(G?.ok&&G.result==null)return new Response("not found (offline replica)",{status:404});if(J.request.mode==="navigate")return t(Q,$);return null}async function e(J){let Y=J.request,Z=new URL(Y.url);if(await S())return await C(J,Z)??new Response("not found",{status:404});try{return await P(Y,j)}catch(z){let Q=await C(J,Z);if(Q)return Q;throw z}}async function JJ(J){let Y=J.request,Z=new URL(Y.url),z=decodeURIComponent(Z.pathname.slice(6)),Q=z.indexOf("."),$=(Q>=0?z.slice(0,Q):z).toLowerCase();if(!/^[0-9a-f]{16,64}$/.test($))return fetch(Y);let G=O(z),D=await x($);if(D)return D;if(!await S())try{let V=await P(new Request(Y,{cache:"no-store"}),j*2);if(V.ok){let X=await V.clone().arrayBuffer();if(await M(X,$))return await R($,X,V.headers.get("content-type")??G),V}}catch{}let W=await L(J,"blobBytes",[$]);if(W?.ok&&W.result){let V=W.result;if(await M(V,$))return await R($,V,G),new Response(V,{headers:{"content-type":G,"x-mh-source":"replica"}})}return new Response("blob unavailable offline",{status:404})}F.addEventListener("fetch",(J)=>{let Y=J.request,Z=new URL(Y.url);if(Z.origin!==F.location.origin)return;if(Z.pathname.startsWith("/api/")){J.respondWith(a(J));return}if(Y.method!=="GET")return;if(Z.pathname.startsWith("/sites/")){J.respondWith(e(J));return}if(Z.pathname.startsWith("/blob/")){J.respondWith(JJ(J));return}if(Y.mode==="navigate"){if(Z.pathname!=="/")return;J.respondWith(f(Y,I,j,"/"));return}if(T.includes(Z.pathname)||Z.pathname.startsWith("/icons/")){J.respondWith(f(Y,I,j));return}if(Z.pathname.startsWith("/webui-fmt")){J.respondWith((async()=>{let z=await U.open(I),Q=await z.match(Y);if(Q)return Q;let $=await fetch(Y);if(N($))await z.put(Y,$.clone());return $})());return}if(Z.pathname==="/sqlite3.wasm"){J.respondWith((async()=>{let z=await U.open(o),Q=await z.match(Y);if(Q)return Q;let $=await fetch(Y);if(N($))await z.put(Y,$.clone());return $})());return}});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface FmtProvider {
|
|
2
|
+
/** Registry id, referenced by lang-map.ts. */
|
|
3
|
+
id: string;
|
|
4
|
+
/** Serve route of the provider bundle (also its dist/ artifact name). */
|
|
5
|
+
js: string;
|
|
6
|
+
/** Bundle entrypoint, relative to src/webui/. */
|
|
7
|
+
entry: string;
|
|
8
|
+
/** Sidecar wasm: serve route + the npm package/file it is copied from. */
|
|
9
|
+
wasm?: {
|
|
10
|
+
route: string;
|
|
11
|
+
pkg: string;
|
|
12
|
+
file: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const FMT_PROVIDERS: FmtProvider[];
|
|
16
|
+
export declare function fmtProvider(id: string): FmtProvider | undefined;
|
|
17
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/webui/fmt/manifest.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,yEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC;IACX,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACrD;AAED,eAAO,MAAM,aAAa,EAAE,WAAW,EAyBtC,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAE/D"}
|
|
@@ -5,6 +5,11 @@ export declare function setWebuiBundle(bundle: {
|
|
|
5
5
|
runtime: string;
|
|
6
6
|
sdk: string;
|
|
7
7
|
wasm: Uint8Array;
|
|
8
|
+
/** Lazy 格式化 provider assets keyed by serve route (fmt/manifest.ts).
|
|
9
|
+
* Optional so embedders built before a provider existed keep working — a
|
|
10
|
+
* missing asset 500s only when that language's 格式化 is actually used. */
|
|
11
|
+
fmt?: Record<string, string>;
|
|
12
|
+
fmtWasm?: Record<string, Uint8Array>;
|
|
8
13
|
}): void;
|
|
9
14
|
/** Pre-build & cache the JS bundle ahead of the first request. In dev the first
|
|
10
15
|
* `/webui.js` hit otherwise pays for a `Bun.build` (1–3s) that blocks the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/webui/server/assets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/webui/server/assets.ts"],"names":[],"mappings":"AAiFA,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB;;6EAEyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACtC,GAAG,IAAI,CAaP;AAsKD;;;;2EAI2E;AAC3E,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/C;AAUD;0CAC0C;AAC1C,wBAAsB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA6DvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function B0(G){WL=()=>G.wasm;var F=[],b="./this.program",v=(K,L)=>{throw L},TL="";function S0(K){if(G.locateFile)return G.locateFile(K,TL);return TL+K}var yQ,WL,gL=console.log.bind(console),HL=console.error.bind(console),UL,r=!1,a;function lQ(K,L){if(!K)uL(L)}var P,S,g,h,$,D,hL,cL,t,yL,I0=!1;function lL(){var K=GL.buffer;P=new Int8Array(K),g=new Int16Array(K),S=new Uint8Array(K),h=new Uint16Array(K),$=new Int32Array(K),D=new Uint32Array(K),hL=new Float32Array(K),cL=new Float64Array(K),t=new BigInt64Array(K),yL=new BigUint64Array(K)}function N0(){if(G.preRun){if(typeof G.preRun=="function")G.preRun=[G.preRun];while(G.preRun.length)h0(G.preRun.shift())}pL(iL)}function P0(){I0=!0,ML.aa()}function f0(){if(G.postRun){if(typeof G.postRun=="function")G.postRun=[G.postRun];while(G.postRun.length)g0(G.postRun.shift())}pL(mL)}function uL(K){G.onAbort?.(K),K="Aborted("+K+")",HL(K),r=!0,K+=". Build with -sASSERTIONS for more info.";var L=new WebAssembly.RuntimeError(K);throw L}var DL;function x0(){return S0("clang-format-esm.wasm")}function C0(K){if(K==DL&&UL)return new Uint8Array(UL);if(WL)return WL(K);throw'sync fetching of the wasm failed: you can preload it to Module["wasmBinary"] manually, or emcc.py will do that for you when generating HTML (but not JS)'}function w0(K,L){var Q,J=C0(K);if(Q=J,!(Q instanceof WebAssembly.Module))Q=new WebAssembly.Module(Q);var Y=new WebAssembly.Instance(Q,L);return[Y,Q]}function v0(){var K={a:wQ};return K}function T0(){function K(J,Y){return ML=J.exports,CQ(ML),lL(),ML}var L=v0();if(G.instantiateWasm)return new Promise((J,Y)=>{G.instantiateWasm(L,(Z,X)=>{J(K(Z,X))})});DL??=x0();var Q=w0(DL,L);return K(Q[0])}class $L{name="ExitStatus";constructor(K){this.message=`Program terminated with exit(${K})`,this.status=K}}var pL=(K)=>{while(K.length>0)K.shift()(G)},mL=[],g0=(K)=>mL.push(K),iL=[],h0=(K)=>iL.push(K),OL=!0,dL=(K)=>F0.get(K),c0=(K,L)=>dL(K)(L);class oL{constructor(K){this.excPtr=K,this.ptr=K-24}set_type(K){D[this.ptr+4>>2]=K}get_type(){return D[this.ptr+4>>2]}set_destructor(K){D[this.ptr+8>>2]=K}get_destructor(){return D[this.ptr+8>>2]}set_caught(K){K=K?1:0,P[this.ptr+12]=K}get_caught(){return P[this.ptr+12]!=0}set_rethrown(K){K=K?1:0,P[this.ptr+13]=K}get_rethrown(){return P[this.ptr+13]!=0}init(K,L){this.set_adjusted_ptr(0),this.set_type(K),this.set_destructor(L)}set_adjusted_ptr(K){D[this.ptr+16>>2]=K}get_adjusted_ptr(){return D[this.ptr+16>>2]}}var nL=0,y0=0,l0=(K,L,Q)=>{var J=new oL(K);throw J.init(L,Q),nL=K,y0++,nL},u0=(K)=>{},p0=(K,L,Q,J)=>{},m0=(K,L)=>{},i0=(K,L)=>{},d0=(K,L,Q)=>{},o0=(K,L)=>{},n0=(K,L,Q,J)=>{},sL=globalThis.TextDecoder&&new TextDecoder,rL=(K,L,Q,J)=>{var Y=L+Q;if(J)return Y;while(K[L]&&!(L>=Y))++L;return L},aL=(K,L=0,Q,J)=>{var Y=rL(K,L,Q,J);if(Y-L>16&&K.buffer&&sL)return sL.decode(K.subarray(L,Y));var Z="";while(L<Y){var X=K[L++];if(!(X&128)){Z+=String.fromCharCode(X);continue}var q=K[L++]&63;if((X&224)==192){Z+=String.fromCharCode((X&31)<<6|q);continue}var M=K[L++]&63;if((X&240)==224)X=(X&15)<<12|q<<6|M;else X=(X&7)<<18|q<<12|M<<6|K[L++]&63;if(X<65536)Z+=String.fromCharCode(X);else{var j=X-65536;Z+=String.fromCharCode(55296|j>>10,56320|j&1023)}}return Z},tL=(K,L,Q)=>K?aL(S,K,L,Q):"",s0={varargs:void 0,getStr(K){var L=tL(K);return L}};function r0(K,L,Q,J){s0.varargs=J}var a0=(K,L,Q,J)=>{},t0=(K,L)=>{},e0=(K,L,Q)=>{},LK=(K,L,Q)=>{},KK=()=>uL(""),e={},eL=(K)=>{while(K.length){var L=K.pop(),Q=K.pop();Q(L)}};function i(K){return this.fromWireType(D[K>>2])}var c={},T={},LL={},QK=class extends Error{constructor(L){super(L);this.name="InternalError"}},KL=(K)=>{throw new QK(K)},C=(K,L,Q)=>{K.forEach((q)=>LL[q]=L);function J(q){var M=Q(q);if(M.length!==K.length)KL("Mismatched type converter count");for(var j=0;j<K.length;++j)A(K[j],M[j])}var Y=Array(L.length),Z=[],X=0;for(let[q,M]of L.entries())if(T.hasOwnProperty(M))Y[q]=T[M];else{if(Z.push(M),!c.hasOwnProperty(M))c[M]=[];c[M].push(()=>{if(Y[q]=T[M],++X,X===Z.length)J(Y)})}if(Z.length===0)J(Y)},JK=(K)=>{var L=e[K];delete e[K];var{rawConstructor:Q,rawDestructor:J,fields:Y}=L,Z=Y.map((X)=>X.getterReturnType).concat(Y.map((X)=>X.setterArgumentType));C([K],Z,(X)=>{var q={};for(var[M,j]of Y.entries()){let V=X[M],_=j.getter,W=j.getterContext,U=X[M+Y.length],R=j.setter,z=j.setterContext;q[j.fieldName]={read:(B)=>V.fromWireType(_(W,B)),write:(B,O)=>{var w=[];R(z,B,U.toWireType(w,O)),eL(w)},optional:V.optional}}return[{name:L.name,fromWireType:(V)=>{var _={};for(var W in q)_[W]=q[W].read(V);return J(V),_},toWireType:(V,_)=>{for(var W in q)if(!(W in _)&&!q[W].optional)throw TypeError(`Missing field: "${W}"`);var U=Q();for(W in q)q[W].write(U,_[W]);if(V!==null)V.push(J,U);return U},readValueFromPointer:i,destructorFunction:J}]})},k=(K)=>{var L="";while(!0){var Q=S[K++];if(!Q)return L;L+=String.fromCharCode(Q)}},d=class extends Error{constructor(L){super(L);this.name="BindingError"}},H=(K)=>{throw new d(K)};function YK(K,L,Q={}){var J=L.name;if(!K)H(`type "${J}" must have a positive integer typeid pointer`);if(T.hasOwnProperty(K))if(Q.ignoreDuplicateRegistrations)return;else H(`Cannot register type '${J}' twice`);if(T[K]=L,delete LL[K],c.hasOwnProperty(K)){var Y=c[K];delete c[K],Y.forEach((Z)=>Z())}}function A(K,L,Q={}){return YK(K,L,Q)}var L0=(K,L,Q)=>{switch(L){case 1:return Q?(J)=>P[J]:(J)=>S[J];case 2:return Q?(J)=>g[J>>1]:(J)=>h[J>>1];case 4:return Q?(J)=>$[J>>2]:(J)=>D[J>>2];case 8:return Q?(J)=>t[J>>3]:(J)=>yL[J>>3];default:throw TypeError(`invalid integer width (${L}): ${K}`)}},ZK=(K,L,Q,J,Y)=>{L=k(L);let Z=J===0n,X=(q)=>q;if(Z){let q=Q*8;X=(M)=>BigInt.asUintN(q,M),Y=X(Y)}A(K,{name:L,fromWireType:X,toWireType:(q,M)=>{if(typeof M=="number")M=BigInt(M);return M},readValueFromPointer:L0(L,Q,!Z),destructorFunction:null})},XK=(K,L,Q,J)=>{L=k(L),A(K,{name:L,fromWireType:function(Y){return!!Y},toWireType:function(Y,Z){return Z?Q:J},readValueFromPointer:function(Y){return this.fromWireType(S[Y])},destructorFunction:null})},qK=(K)=>({count:K.count,deleteScheduled:K.deleteScheduled,preservePointerOnDelete:K.preservePointerOnDelete,ptr:K.ptr,ptrType:K.ptrType,smartPtr:K.smartPtr,smartPtrType:K.smartPtrType}),EL=(K)=>{function L(Q){return Q.$$.ptrType.registeredClass.name}H(L(K)+" instance already deleted")},FL=!1,K0=(K)=>{},GK=(K)=>{if(K.smartPtr)K.smartPtrType.rawDestructor(K.smartPtr);else K.ptrType.registeredClass.rawDestructor(K.ptr)},Q0=(K)=>{K.count.value-=1;var L=K.count.value===0;if(L)GK(K)},o=(K)=>{if(!globalThis.FinalizationRegistry)return o=(L)=>L,K;return FL=new FinalizationRegistry((L)=>{Q0(L.$$)}),o=(L)=>{var Q=L.$$,J=!!Q.smartPtr;if(J){var Y={$$:Q};FL.register(L,Y,L)}return L},K0=(L)=>FL.unregister(L),o(K)},QL=[],MK=()=>{while(QL.length){var K=QL.pop();K.$$.deleteScheduled=!1,K.delete()}},J0,jK=()=>{let K=JL.prototype;Object.assign(K,{isAliasOf(Q){if(!(this instanceof JL))return!1;if(!(Q instanceof JL))return!1;var J=this.$$.ptrType.registeredClass,Y=this.$$.ptr;Q.$$=Q.$$;var Z=Q.$$.ptrType.registeredClass,X=Q.$$.ptr;while(J.baseClass)Y=J.upcast(Y),J=J.baseClass;while(Z.baseClass)X=Z.upcast(X),Z=Z.baseClass;return J===Z&&Y===X},clone(){if(!this.$$.ptr)EL(this);if(this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;else{var Q=o(Object.create(Object.getPrototypeOf(this),{$$:{value:qK(this.$$)}}));return Q.$$.count.value+=1,Q.$$.deleteScheduled=!1,Q}},delete(){if(!this.$$.ptr)EL(this);if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete)H("Object already scheduled for deletion");if(K0(this),Q0(this.$$),!this.$$.preservePointerOnDelete)this.$$.smartPtr=void 0,this.$$.ptr=void 0},isDeleted(){return!this.$$.ptr},deleteLater(){if(!this.$$.ptr)EL(this);if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete)H("Object already scheduled for deletion");if(QL.push(this),QL.length===1&&J0)J0(MK);return this.$$.deleteScheduled=!0,this}});let L=Symbol.dispose;if(L)K[L]=K.delete};function JL(){}var RL=(K,L)=>Object.defineProperty(L,"name",{value:K}),Y0={},BL=(K,L,Q)=>{if(K[L].overloadTable===void 0){var J=K[L];K[L]=function(...Y){if(!K[L].overloadTable.hasOwnProperty(Y.length))H(`Function '${Q}' called with an invalid number of arguments (${Y.length}) - expects one of (${K[L].overloadTable})!`);return K[L].overloadTable[Y.length].apply(this,Y)},K[L].overloadTable=[],K[L].overloadTable[J.argCount]=J}},YL=(K,L,Q)=>{if(G.hasOwnProperty(K)){if(Q===void 0||G[K].overloadTable!==void 0&&G[K].overloadTable[Q]!==void 0)H(`Cannot register public name '${K}' twice`);if(BL(G,K,K),G[K].overloadTable.hasOwnProperty(Q))H(`Cannot register multiple overloads of a function with the same number of arguments (${Q})!`);G[K].overloadTable[Q]=L}else G[K]=L,G[K].argCount=Q},VK=48,_K=57,WK=(K)=>{K=K.replace(/[^a-zA-Z0-9_]/g,"$");var L=K.charCodeAt(0);if(L>=VK&&L<=_K)return`_${K}`;return K};function HK(K,L,Q,J,Y,Z,X,q){this.name=K,this.constructor=L,this.instancePrototype=Q,this.rawDestructor=J,this.baseClass=Y,this.getActualType=Z,this.upcast=X,this.downcast=q,this.pureVirtualFunctions=[]}var kL=(K,L,Q)=>{while(L!==Q){if(!L.upcast)H(`Expected null or instance of ${Q.name}, got an instance of ${L.name}`);K=L.upcast(K),L=L.baseClass}return K},zL=(K)=>{if(K===null)return"null";var L=typeof K;if(L==="object"||L==="array"||L==="function")return K.toString();else return""+K};function UK(K,L){if(L===null){if(this.isReference)H(`null is not a valid ${this.name}`);return 0}if(!L.$$)H(`Cannot pass "${zL(L)}" as a ${this.name}`);if(!L.$$.ptr)H(`Cannot pass deleted object as a pointer of type ${this.name}`);var Q=L.$$.ptrType.registeredClass,J=kL(L.$$.ptr,Q,this.registeredClass);return J}function DK(K,L){var Q;if(L===null){if(this.isReference)H(`null is not a valid ${this.name}`);if(this.isSmartPointer){if(Q=this.rawConstructor(),K!==null)K.push(this.rawDestructor,Q);return Q}else return 0}if(!L||!L.$$)H(`Cannot pass "${zL(L)}" as a ${this.name}`);if(!L.$$.ptr)H(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.isConst&&L.$$.ptrType.isConst)H(`Cannot convert argument of type ${L.$$.smartPtrType?L.$$.smartPtrType.name:L.$$.ptrType.name} to parameter type ${this.name}`);var J=L.$$.ptrType.registeredClass;if(Q=kL(L.$$.ptr,J,this.registeredClass),this.isSmartPointer){if(L.$$.smartPtr===void 0)H("Passing raw pointer to smart pointer is illegal");switch(this.sharingPolicy){case 0:if(L.$$.smartPtrType===this)Q=L.$$.smartPtr;else H(`Cannot convert argument of type ${L.$$.smartPtrType?L.$$.smartPtrType.name:L.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:Q=L.$$.smartPtr;break;case 2:if(L.$$.smartPtrType===this)Q=L.$$.smartPtr;else{var Y=L.clone();if(Q=this.rawShare(Q,SL.toHandle(()=>Y.delete())),K!==null)K.push(this.rawDestructor,Q)}break;default:H("Unsupported sharing policy")}}return Q}function $K(K,L){if(L===null){if(this.isReference)H(`null is not a valid ${this.name}`);return 0}if(!L.$$)H(`Cannot pass "${zL(L)}" as a ${this.name}`);if(!L.$$.ptr)H(`Cannot pass deleted object as a pointer of type ${this.name}`);if(L.$$.ptrType.isConst)H(`Cannot convert argument of type ${L.$$.ptrType.name} to parameter type ${this.name}`);var Q=L.$$.ptrType.registeredClass,J=kL(L.$$.ptr,Q,this.registeredClass);return J}var Z0=(K,L,Q)=>{if(L===Q)return K;if(Q.baseClass===void 0)return null;var J=Z0(K,L,Q.baseClass);if(J===null)return null;return Q.downcast(J)},OK={},EK=(K,L)=>{if(L===void 0)H("ptr should not be undefined");while(K.baseClass)L=K.upcast(L),K=K.baseClass;return L},FK=(K,L)=>{return L=EK(K,L),OK[L]},ZL=(K,L)=>{if(!L.ptrType||!L.ptr)KL("makeClassHandle requires ptr and ptrType");var Q=!!L.smartPtrType,J=!!L.smartPtr;if(Q!==J)KL("Both smartPtrType and smartPtr must be specified");return L.count={value:1},o(Object.create(K,{$$:{value:L,writable:!0}}))};function RK(K){var L=this.getPointee(K);if(!L)return this.destructor(K),null;var Q=FK(this.registeredClass,L);if(Q!==void 0)if(Q.$$.count.value===0)return Q.$$.ptr=L,Q.$$.smartPtr=K,Q.clone();else{var J=Q.clone();return this.destructor(K),J}function Y(){if(this.isSmartPointer)return ZL(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:L,smartPtrType:this,smartPtr:K});else return ZL(this.registeredClass.instancePrototype,{ptrType:this,ptr:K})}var Z=this.registeredClass.getActualType(L),X=Y0[Z];if(!X)return Y.call(this);var q;if(this.isConst)q=X.constPointerType;else q=X.pointerType;var M=Z0(L,this.registeredClass,q.registeredClass);if(M===null)return Y.call(this);if(this.isSmartPointer)return ZL(q.registeredClass.instancePrototype,{ptrType:q,ptr:M,smartPtrType:this,smartPtr:K});else return ZL(q.registeredClass.instancePrototype,{ptrType:q,ptr:M})}var BK=()=>{Object.assign(XL.prototype,{getPointee(K){if(this.rawGetPointee)K=this.rawGetPointee(K);return K},destructor(K){this.rawDestructor?.(K)},readValueFromPointer:i,fromWireType:RK})};function XL(K,L,Q,J,Y,Z,X,q,M,j,V){if(this.name=K,this.registeredClass=L,this.isReference=Q,this.isConst=J,this.isSmartPointer=Y,this.pointeeType=Z,this.sharingPolicy=X,this.rawGetPointee=q,this.rawConstructor=M,this.rawShare=j,this.rawDestructor=V,!Y&&L.baseClass===void 0)if(J)this.toWireType=UK,this.destructorFunction=null;else this.toWireType=$K,this.destructorFunction=null;else this.toWireType=DK}var kK=(K,L,Q)=>{if(!G.hasOwnProperty(K))KL("Replacing nonexistent public symbol");if(G[K].overloadTable!==void 0&&Q!==void 0)G[K].overloadTable[Q]=L;else G[K]=L,G[K].argCount=Q},N=(K,L,Q=!1)=>{K=k(K);function J(){var Z=dL(L);return Z}var Y=J();if(typeof Y!="function")H(`unknown function pointer with signature ${K}: ${L}`);return Y};class X0 extends Error{}var q0=(K)=>{var L=O0(K),Q=k(L);return f(L),Q},qL=(K,L)=>{var Q=[],J={};function Y(Z){if(J[Z])return;if(T[Z])return;if(LL[Z]){LL[Z].forEach(Y);return}Q.push(Z),J[Z]=!0}throw L.forEach(Y),new X0(`${K}: `+Q.map(q0).join([", "]))},zK=(K,L,Q,J,Y,Z,X,q,M,j,V,_,W)=>{V=k(V),Z=N(Y,Z),q&&=N(X,q),j&&=N(M,j),W=N(_,W);var U=WK(V);YL(U,function(){qL(`Cannot construct ${V} due to unbound types`,[J])}),C([K,L,Q],J?[J]:[],(R)=>{R=R[0];var z,B;if(J)z=R.registeredClass,B=z.instancePrototype;else B=JL.prototype;var O=RL(V,function(...xL){if(Object.getPrototypeOf(this)!==w)throw new d(`Use 'new' to construct ${V}`);if(I.constructor_body===void 0)throw new d(`${V} has no accessible constructor`);var R0=I.constructor_body[xL.length];if(R0===void 0)throw new d(`Tried to invoke ctor of ${V} with invalid number of parameters (${xL.length}) - expected (${Object.keys(I.constructor_body).toString()}) parameters instead!`);return R0.apply(this,xL)}),w=Object.create(B,{constructor:{value:O}});O.prototype=w;var I=new HK(V,O,w,W,z,Z,q,j);if(I.baseClass)I.baseClass.__derivedClasses??=[],I.baseClass.__derivedClasses.push(I);var fL=new XL(V,I,!0,!1,!1),x=new XL(V+"*",I,!1,!1,!1),jL=new XL(V+" const*",I,!1,!0,!1);return Y0[K]={pointerType:x,constPointerType:jL},kK(U,O),[fL,x,jL]})};function bK(K){for(var L=1;L<K.length;++L)if(K[L]!==null&&K[L].destructorFunction===void 0)return!0;return!1}function bL(K,L,Q,J,Y,Z){var X=L.length;if(X<2)H("argTypes array size mismatch! Must at least get return value and 'this' types!");var q=L[1]!==null&&Q!==null,M=bK(L),j=!L[0].isVoid,V=X-2,_=Array(V),W=[],U=[],R=function(...z){U.length=0;var B;if(W.length=q?2:1,W[0]=Y,q)B=L[1].toWireType(U,this),W[1]=B;for(var O=0;O<V;++O)_[O]=L[O+2].toWireType(U,z[O]),W.push(_[O]);var w=J(...W);function I(fL){if(M)eL(U);else for(var x=q?1:2;x<L.length;x++){var jL=x===1?B:_[x-2];if(L[x].destructorFunction!==null)L[x].destructorFunction(jL)}if(j)return L[0].fromWireType(fL)}return I(w)};return RL(K,R)}var AL=(K,L)=>{var Q=[];for(var J=0;J<K;J++)Q.push(D[L+J*4>>2]);return Q},G0=(K)=>{K=K.trim();let L=K.indexOf("(");if(L===-1)return K;return K.slice(0,L)},AK=(K,L,Q,J,Y,Z,X,q,M)=>{var j=AL(Q,J);L=k(L),L=G0(L),Z=N(Y,Z,q),C([],[K],(V)=>{V=V[0];var _=`${V.name}.${L}`;function W(){qL(`Cannot call ${_} due to unbound types`,j)}if(L.startsWith("@@"))L=Symbol[L.substring(2)];var U=V.registeredClass.constructor;if(U[L]===void 0)W.argCount=Q-1,U[L]=W;else BL(U,L,_),U[L].overloadTable[Q-1]=W;return C([],j,(R)=>{var z=[R[0],null].concat(R.slice(1)),B=bL(_,z,null,Z,X,q);if(U[L].overloadTable===void 0)B.argCount=Q-1,U[L]=B;else U[L].overloadTable[Q-1]=B;if(V.registeredClass.__derivedClasses){for(let O of V.registeredClass.__derivedClasses)if(!O.constructor.hasOwnProperty(L))O.constructor[L]=B}return[]}),[]})},SK=(K,L,Q,J,Y,Z)=>{var X=AL(L,Q);Y=N(J,Y),C([],[K],(q)=>{q=q[0];var M=`constructor ${q.name}`;if(q.registeredClass.constructor_body===void 0)q.registeredClass.constructor_body=[];if(q.registeredClass.constructor_body[L-1]!==void 0)throw new d(`Cannot register multiple constructors with identical number of parameters (${L-1}) for class '${q.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return q.registeredClass.constructor_body[L-1]=()=>{qL(`Cannot construct ${q.name} due to unbound types`,X)},C([],X,(j)=>{return j.splice(1,0,null),q.registeredClass.constructor_body[L-1]=bL(M,j,null,Y,Z),[]}),[]})},IK=(K,L,Q,J,Y,Z,X,q,M,j)=>{var V=AL(Q,J);L=k(L),L=G0(L),Z=N(Y,Z,M),C([],[K],(_)=>{_=_[0];var W=`${_.name}.${L}`;if(L.startsWith("@@"))L=Symbol[L.substring(2)];if(q)_.registeredClass.pureVirtualFunctions.push(L);function U(){qL(`Cannot call ${W} due to unbound types`,V)}var R=_.registeredClass.instancePrototype,z=R[L];if(z===void 0||z.overloadTable===void 0&&z.className!==_.name&&z.argCount===Q-2)U.argCount=Q-2,U.className=_.name,R[L]=U;else BL(R,L,W),R[L].overloadTable[Q-2]=U;return C([],V,(B)=>{var O=bL(W,B,_,Z,X,M);if(R[L].overloadTable===void 0)O.argCount=Q-2,R[L]=O;else R[L].overloadTable[Q-2]=O;return[]}),[]})},M0=[],y=[0,1,,1,null,1,!0,1,!1,1],NK=(K)=>{if(K>9&&--y[K+1]===0)y[K]=void 0,M0.push(K)},SL={toValue:(K)=>{if(!K)H(`Cannot use deleted val. handle = ${K}`);return y[K]},toHandle:(K)=>{switch(K){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let L=M0.pop()||y.length;return y[L]=K,y[L+1]=1,L}}}},PK={name:"emscripten::val",fromWireType:(K)=>{var L=SL.toValue(K);return NK(K),L},toWireType:(K,L)=>SL.toHandle(L),readValueFromPointer:i,destructorFunction:null},fK=(K)=>A(K,PK),IL=(K,L,Q)=>{switch(L){case 1:return Q?function(J){return this.fromWireType(P[J])}:function(J){return this.fromWireType(S[J])};case 2:return Q?function(J){return this.fromWireType(g[J>>1])}:function(J){return this.fromWireType(h[J>>1])};case 4:return Q?function(J){return this.fromWireType($[J>>2])}:function(J){return this.fromWireType(D[J>>2])};default:throw TypeError(`invalid integer width (${L}): ${K}`)}};function xK(K){return K===0?"object":K===1?"number":"string"}var CK=(K,L,Q,J,Y)=>{L=k(L);let Z=xK(Y);switch(Z){case"object":{let j=function(){};j.values={},A(K,{name:L,constructor:j,valueType:Z,fromWireType:function(V){return this.constructor.values[V]},toWireType:(V,_)=>_.value,readValueFromPointer:IL(L,Q,J),destructorFunction:null}),YL(L,j);break}case"number":{var X={};A(K,{name:L,keysMap:X,valueType:Z,fromWireType:(j)=>j,toWireType:(j,V)=>V,readValueFromPointer:IL(L,Q,J),destructorFunction:null}),YL(L,X),delete G[L].argCount;break}case"string":{var q={},M={},X={};A(K,{name:L,valuesMap:q,reverseMap:M,keysMap:X,valueType:Z,fromWireType:function(V){return this.reverseMap[V]},toWireType:function(V,_){return this.valuesMap[_]},readValueFromPointer:IL(L,Q,J),destructorFunction:null}),YL(L,X),delete G[L].argCount;break}}},wK=(K,L)=>{var Q=T[K];if(Q===void 0)H(`${L} has unknown type ${q0(K)}`);return Q},vK=(K,L,Q)=>{var J=wK(K,"enum");switch(L=k(L),J.valueType){case"object":{var Y=J.constructor,Z=Object.create(J.constructor.prototype,{value:{value:Q},constructor:{value:RL(`${J.name}_${L}`,function(){})}});Y.values[Q]=Z,Y[L]=Z;break}case"number":{J.keysMap[L]=Q;break}case"string":{J.valuesMap[L]=Q,J.reverseMap[Q]=L,J.keysMap[L]=L;break}}},TK=(K,L)=>{switch(L){case 4:return function(Q){return this.fromWireType(hL[Q>>2])};case 8:return function(Q){return this.fromWireType(cL[Q>>3])};default:throw TypeError(`invalid float width (${L}): ${K}`)}},gK=(K,L,Q)=>{L=k(L),A(K,{name:L,fromWireType:(J)=>J,toWireType:(J,Y)=>Y,readValueFromPointer:TK(L,Q),destructorFunction:null})},hK=(K,L,Q,J,Y)=>{L=k(L);let Z=J===0,X=(M)=>M;if(Z){var q=32-8*Q;X=(M)=>M<<q>>>q,Y=X(Y)}A(K,{name:L,fromWireType:X,toWireType:(M,j)=>j,readValueFromPointer:L0(L,Q,J!==0),destructorFunction:null})},cK=(K,L,Q)=>{var J=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],Y=J[L];function Z(X){var q=D[X>>2],M=D[X+4>>2];return new Y(P.buffer,M,q)}Q=k(Q),A(K,{name:Q,fromWireType:Z,readValueFromPointer:Z},{ignoreDuplicateRegistrations:!0})},yK=(K,L,Q,J)=>{if(!(J>0))return 0;var Y=Q,Z=Q+J-1;for(var X=0;X<K.length;++X){var q=K.codePointAt(X);if(q<=127){if(Q>=Z)break;L[Q++]=q}else if(q<=2047){if(Q+1>=Z)break;L[Q++]=192|q>>6,L[Q++]=128|q&63}else if(q<=65535){if(Q+2>=Z)break;L[Q++]=224|q>>12,L[Q++]=128|q>>6&63,L[Q++]=128|q&63}else{if(Q+3>=Z)break;L[Q++]=240|q>>18,L[Q++]=128|q>>12&63,L[Q++]=128|q>>6&63,L[Q++]=128|q&63,X++}}return L[Q]=0,Q-Y},l=(K,L,Q)=>yK(K,S,L,Q),j0=(K)=>{var L=0;for(var Q=0;Q<K.length;++Q){var J=K.charCodeAt(Q);if(J<=127)L++;else if(J<=2047)L+=2;else if(J>=55296&&J<=57343)L+=4,++Q;else L+=3}return L},lK=(K,L)=>{L=k(L);var Q=!0;A(K,{name:L,fromWireType(J){var Y=D[J>>2],Z=J+4,X;if(Q)X=tL(Z,Y,!0);else{X="";for(var q=0;q<Y;++q)X+=String.fromCharCode(S[Z+q])}return f(J),X},toWireType(J,Y){if(Y instanceof ArrayBuffer)Y=new Uint8Array(Y);var Z,X=typeof Y=="string";if(!(X||ArrayBuffer.isView(Y)&&Y.BYTES_PER_ELEMENT==1))H("Cannot pass non-string to std::string");if(Q&&X)Z=j0(Y);else Z=Y.length;var q=PL(4+Z+1),M=q+4;if(D[q>>2]=Z,X)if(Q)l(Y,M,Z+1);else for(var j=0;j<Z;++j){var V=Y.charCodeAt(j);if(V>255)f(q),H("String has UTF-16 code units that do not fit in 8 bits");S[M+j]=V}else S.set(Y,M);if(J!==null)J.push(f,q);return q},readValueFromPointer:i,destructorFunction(J){f(J)}})},V0=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,uK=(K,L,Q)=>{var J=K>>1,Y=rL(h,J,L/2,Q);if(Y-J>16&&V0)return V0.decode(h.subarray(J,Y));var Z="";for(var X=J;X<Y;++X){var q=h[X];Z+=String.fromCharCode(q)}return Z},pK=(K,L,Q)=>{if(Q??=2147483647,Q<2)return 0;Q-=2;var J=L,Y=Q<K.length*2?Q/2:K.length;for(var Z=0;Z<Y;++Z){var X=K.charCodeAt(Z);g[L>>1]=X,L+=2}return g[L>>1]=0,L-J},mK=(K)=>K.length*2,iK=(K,L,Q)=>{var J="",Y=K>>2;for(var Z=0;!(Z>=L/4);Z++){var X=D[Y+Z];if(!X&&!Q)break;J+=String.fromCodePoint(X)}return J},dK=(K,L,Q)=>{if(Q??=2147483647,Q<4)return 0;var J=L,Y=J+Q-4;for(var Z=0;Z<K.length;++Z){var X=K.codePointAt(Z);if(X>65535)Z++;if($[L>>2]=X,L+=4,L+4>Y)break}return $[L>>2]=0,L-J},oK=(K)=>{var L=0;for(var Q=0;Q<K.length;++Q){var J=K.codePointAt(Q);if(J>65535)Q++;L+=4}return L},nK=(K,L,Q)=>{Q=k(Q);var J,Y,Z;if(L===2)J=uK,Y=pK,Z=mK;else J=iK,Y=dK,Z=oK;A(K,{name:Q,fromWireType:(X)=>{var q=D[X>>2],M=J(X+4,q*L,!0);return f(X),M},toWireType:(X,q)=>{if(typeof q!="string")H(`Cannot pass non-string to C++ string type ${Q}`);var M=Z(q),j=PL(4+M+L);if(D[j>>2]=M/L,Y(q,j+4,M+L),X!==null)X.push(f,j);return j},readValueFromPointer:i,destructorFunction(X){f(X)}})},sK=(K,L,Q,J,Y,Z)=>{e[K]={name:k(L),rawConstructor:N(Q,J),rawDestructor:N(Y,Z),fields:[]}},rK=(K,L,Q,J,Y,Z,X,q,M,j)=>{e[K].fields.push({fieldName:k(L),getterReturnType:Q,getter:N(J,Y),getterContext:Z,setterArgumentType:X,setter:N(q,M),setterContext:j})},aK=(K,L)=>{L=k(L),A(K,{isVoid:!0,name:L,fromWireType:()=>{return},toWireType:(Q,J)=>{return}})},_0=0,tK=()=>{OL=!1,_0=0},eK=9007199254740992,LQ=-9007199254740992,u=(K)=>K<LQ||K>eK?NaN:Number(K);function KQ(K,L){K=u(K);var Q=new Date(K*1000);$[L>>2]=Q.getUTCSeconds(),$[L+4>>2]=Q.getUTCMinutes(),$[L+8>>2]=Q.getUTCHours(),$[L+12>>2]=Q.getUTCDate(),$[L+16>>2]=Q.getUTCMonth(),$[L+20>>2]=Q.getUTCFullYear()-1900,$[L+24>>2]=Q.getUTCDay();var J=Date.UTC(Q.getUTCFullYear(),0,1,0,0,0,0),Y=(Q.getTime()-J)/86400000|0;$[L+28>>2]=Y}var QQ=(K)=>K%4===0&&(K%100!==0||K%400===0),JQ=[0,31,60,91,121,152,182,213,244,274,305,335],YQ=[0,31,59,90,120,151,181,212,243,273,304,334],ZQ=(K)=>{var L=QQ(K.getFullYear()),Q=L?JQ:YQ,J=Q[K.getMonth()]+K.getDate()-1;return J};function XQ(K,L){K=u(K);var Q=new Date(K*1000);$[L>>2]=Q.getSeconds(),$[L+4>>2]=Q.getMinutes(),$[L+8>>2]=Q.getHours(),$[L+12>>2]=Q.getDate(),$[L+16>>2]=Q.getMonth(),$[L+20>>2]=Q.getFullYear()-1900,$[L+24>>2]=Q.getDay();var J=ZQ(Q)|0;$[L+28>>2]=J,$[L+36>>2]=-(Q.getTimezoneOffset()*60);var Y=new Date(Q.getFullYear(),0,1),Z=new Date(Q.getFullYear(),6,1).getTimezoneOffset(),X=Y.getTimezoneOffset(),q=(Z!=X&&Q.getTimezoneOffset()==Math.min(X,Z))|0;$[L+32>>2]=q}function qQ(K,L,Q,J,Y,Z,X){return Y=u(Y),-52}function GQ(K,L,Q,J,Y,Z){Z=u(Z)}var n={},W0=(K)=>{if(K instanceof $L||K=="unwind")return a;v(1,K)},H0=()=>OL||_0>0,U0=(K)=>{if(a=K,!H0())G.onExit?.(K),r=!0;v(K,new $L(K))},MQ=(K,L)=>{a=K,U0(K)},D0=MQ,jQ=()=>{if(!H0())try{D0(a)}catch(K){W0(K)}},VQ=(K)=>{if(r)return;try{K(),jQ()}catch(L){W0(L)}},_Q=()=>performance.now(),WQ=(K,L)=>{if(n[K])clearTimeout(n[K].id),delete n[K];if(!L)return 0;var Q=setTimeout(()=>{delete n[K],VQ(()=>E0(K,_Q()))},L);return n[K]={id:Q,timeout_ms:L},0},HQ=(K,L,Q,J)=>{var Y=new Date().getFullYear(),Z=new Date(Y,0,1),X=new Date(Y,6,1),q=Z.getTimezoneOffset(),M=X.getTimezoneOffset(),j=Math.max(q,M);D[K>>2]=j*60,$[L>>2]=Number(q!=M);var V=(U)=>{var R=U>=0?"-":"+",z=Math.abs(U),B=String(Math.floor(z/60)).padStart(2,"0"),O=String(z%60).padStart(2,"0");return`UTC${R}${B}${O}`},_=V(q),W=V(M);if(M<q)l(_,Q,17),l(W,J,17);else l(_,J,17),l(W,Q,17)},UQ=()=>Date.now(),$0=()=>2147483648,DQ=()=>$0(),$Q=(K,L)=>Math.ceil(K/L)*L,OQ=(K)=>{var L=GL.buffer.byteLength,Q=(K-L+65535)/65536|0;try{return GL.grow(Q),lL(),1}catch(J){}},EQ=(K)=>{var L=S.length;K>>>=0;var Q=$0();if(K>Q)return!1;for(var J=1;J<=4;J*=2){var Y=L*(1+0.2/J);Y=Math.min(Y,K+100663296);var Z=Math.min(Q,$Q(Math.max(K,Y),65536)),X=OQ(Z);if(X)return!0}return!1},NL={},FQ=()=>b||"./this.program",s=()=>{if(!s.strings){var K=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",L={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:K,_:FQ()};for(var Q in NL)if(NL[Q]===void 0)delete L[Q];else L[Q]=NL[Q];var J=[];for(var Q in L)J.push(`${Q}=${L[Q]}`);s.strings=J}return s.strings},RQ=(K,L)=>{var Q=0,J=0;for(var Y of s()){var Z=L+Q;D[K+J>>2]=Z,Q+=l(Y,Z,1/0)+1,J+=4}return 0},BQ=(K,L)=>{var Q=s();D[K>>2]=Q.length;var J=0;for(var Y of Q)J+=j0(Y)+1;return D[L>>2]=J,0},kQ=(K)=>52,zQ=(K,L)=>{var Q=0,J=0,Y=0;{var Z=2;if(K==0)Q=2;else if(K==1||K==2)Q=64;Y=1}return P[L]=Z,g[L+2>>1]=Y,t[L+8>>3]=BigInt(Q),t[L+16>>3]=BigInt(J),0};function bQ(K,L,Q,J,Y){return J=u(J),52}var AQ=(K,L,Q,J)=>52;function SQ(K,L,Q,J){return L=u(L),70}var IQ=[null,[],[]],NQ=(K,L)=>{var Q=IQ[K];if(L===0||L===10)(K===1?gL:HL)(aL(Q)),Q.length=0;else Q.push(L)},PQ=(K,L,Q,J)=>{var Y=0;for(var Z=0;Z<Q;Z++){var X=D[L>>2],q=D[L+4>>2];L+=8;for(var M=0;M<q;M++)NQ(K,S[X+M]);Y+=q}return D[J>>2]=Y,0};jK(),BK();{if(G.noExitRuntime)OL=G.noExitRuntime;if(G.print)gL=G.print;if(G.printErr)HL=G.printErr;if(G.wasmBinary)UL=G.wasmBinary;if(G.arguments)F=G.arguments;if(G.thisProgram)b=G.thisProgram;if(G.preInit){if(typeof G.preInit=="function")G.preInit=[G.preInit];while(G.preInit.length>0)G.preInit.shift()()}}var PL,f,O0,E0,fQ,xQ,GL,F0;function CQ(K){PL=K.ca,f=K.da,O0=K.ea,E0=K.fa,fQ=GL=K.$,xQ=F0=K.ba}var wQ={w:c0,k:l0,P:u0,Q:p0,N:m0,I:i0,u:d0,J:o0,K:n0,z:r0,t:a0,M:t0,q:e0,s:LK,R:KK,A:JK,j:ZK,Y:XK,p:zK,g:AK,l:SK,c:IK,W:fK,_:CK,d:vK,i:gK,b:hK,a:cK,X:lK,e:nK,L:sK,f:rK,Z:aK,x:tK,D:KQ,E:XQ,B:qQ,C:GQ,r:WQ,F:HQ,O:UQ,n:DQ,m:EQ,T:RQ,U:BQ,V:D0,h:kQ,H:zQ,y:bQ,v:AQ,G:SQ,o:PQ,S:U0};function vQ(){N0();function K(){if(G.calledRun=!0,r)return;P0(),G.onRuntimeInitialized?.(),f0()}if(G.setStatus)G.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>G.setStatus(""),1),K()},1);else K()}var ML=T0();return vQ(),G}var p;function z0(G){p=G,_L=()=>{}}var k0=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((G)=>{G.delete()});class CL{constructor(){_L(),this._impl=new p.ClangFormat,k0.register(this,this._impl,this)}with_style(G){return this._impl.with_style(G),this}with_fallback_style(G){return this._impl.with_fallback_style(G),this}format(G,E="<stdin>"){let F=this._impl.format(G,E);return VL(F)??G}format_range(G,E,F,b="<stdin>"){let v=this._impl.format_range(G,b,E,F);return VL(v)??G}format_line(G,E,F,b="<stdin>"){let v=this._impl.format_line(G,b,E,F);return VL(v)??G}static version(){return _L(),p.ClangFormat.version()}static dump_config({style:G="file",filename:E="<stdin>",code:F=""}={}){_L();let b=p.ClangFormat.dump_config(G,E,F);return VL(b)}[Symbol.dispose](){if(this._impl)k0.unregister(this),this._impl.delete(),this._impl=null}}function _L(){throw Error("uninit")}function VL(G){let{status:E,content:F}=G;if(E===p.ResultStatus.Error)throw Error(F);if(E===p.ResultStatus.Unchanged)return null;return F}function wL(G,E="<stdin>",F="LLVM"){let b=new CL;try{return b.with_style(F).format(G,E)}finally{b[Symbol.dispose]()}}var m;async function TQ(G){if(typeof Response==="function"&&G instanceof Response){if(typeof WebAssembly.compileStreaming==="function")try{return await WebAssembly.compileStreaming(G)}catch(b){if(G.ok&&E(G.type)&&G.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.compileStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",b);else throw b}let F=await G.arrayBuffer();return await WebAssembly.compile(F)}else return await WebAssembly.compile(G);function E(F){switch(F){case"basic":case"cors":case"default":return!0}return!1}}async function vL(G){if(m!==void 0)return m;if(G===void 0)G=new URL("clang-format.wasm",import.meta.url);if(typeof G==="string"||typeof Request==="function"&&G instanceof Request||typeof URL==="function"&&G instanceof URL)G=fetch(G);let E=await TQ(await G);return m=gQ(E)}function gQ(G){return m=B0({wasm:G}),z0(m),m}var hQ=[{id:"core",js:"/webui-fmt.js",entry:"fmt/fmt-core.ts"},{id:"ruff",js:"/webui-fmt-ruff.js",entry:"fmt/fmt-ruff.ts",wasm:{route:"/webui-fmt-ruff.wasm",pkg:"@wasm-fmt/ruff_fmt",file:"ruff_fmt_bg.wasm"}},{id:"gofmt",js:"/webui-fmt-gofmt.js",entry:"fmt/fmt-gofmt.ts",wasm:{route:"/webui-fmt-gofmt.wasm",pkg:"@wasm-fmt/gofmt",file:"gofmt.wasm"}},{id:"clang",js:"/webui-fmt-clang.js",entry:"fmt/fmt-clang.ts",wasm:{route:"/webui-fmt-clang.wasm",pkg:"@wasm-fmt/clang-format",file:"clang-format.wasm"}},{id:"lua",js:"/webui-fmt-lua.js",entry:"fmt/fmt-lua.ts",wasm:{route:"/webui-fmt-lua.wasm",pkg:"@wasm-fmt/lua_fmt",file:"lua_fmt_bg.wasm"}},{id:"taplo",js:"/webui-fmt-taplo.js",entry:"fmt/fmt-taplo.ts",wasm:{route:"/webui-fmt-taplo.wasm",pkg:"@wasm-fmt/taplo_fmt",file:"taplo_fmt_bg.wasm"}},{id:"sh",js:"/webui-fmt-sh.js",entry:"fmt/fmt-sh.ts"}];function b0(G){return hQ.find((E)=>E.id===G)}var K8="mh-fmt-clang",cQ={c:"block.c",h:"block.h",cpp:"block.cc","c++":"block.cc",cc:"block.cc",hpp:"block.hpp",csharp:"block.cs",cs:"block.cs",java:"Block.java",objectivec:"block.m",objc:"block.m","objective-c":"block.m",protobuf:"block.proto",proto:"block.proto"},A0=null;async function Q8(G,E,F){return A0??=vL(b0("clang").wasm.route),await A0,{text:wL(G,cQ[E]??"block.cc"),cursor:F}}export{Q8 as format,K8 as MARKER};
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(e,n){try{A(e,n);let t=e.format();if(t===0)return n;let a=e.output_ptr(),s=e.output_len(),c=R(e,a,s);if(t===1)return c;throw Error(c)}finally{e.dispose()}}function A(e,n){let t=W.encode(n),a=e.alloc(t.length);new Uint8Array(e.memory.buffer,a,t.length).set(t)}function R(e,n,t){let a=new Uint8Array(e.memory.buffer,n,t);return p.decode(a)}var W=new TextEncoder,p=new TextDecoder;var i,r;async function v(e,n){if(typeof Response==="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(e,n)}catch(s){if(e.ok&&t(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",s);else throw s}let a=await e.arrayBuffer();return await WebAssembly.instantiate(a,n)}else{let a=await WebAssembly.instantiate(e,n);if(a instanceof WebAssembly.Instance)return{instance:a,module:e};else return a}function t(a){switch(a){case"basic":case"cors":case"default":return!0}return!1}}function x(e,n){return i=e.exports,r=n,i._initialize(),i}async function f(e){if(i!==void 0)return i;if(e===void 0)e=new URL("gofmt.wasm",import.meta.url);if(typeof e==="string"||typeof Request==="function"&&e instanceof Request||typeof URL==="function"&&e instanceof URL)e=fetch(e);let{instance:n,module:t}=await v(await e);return x(n,t)}function y(e){return o(i,e)}var L=[{id:"core",js:"/webui-fmt.js",entry:"fmt/fmt-core.ts"},{id:"ruff",js:"/webui-fmt-ruff.js",entry:"fmt/fmt-ruff.ts",wasm:{route:"/webui-fmt-ruff.wasm",pkg:"@wasm-fmt/ruff_fmt",file:"ruff_fmt_bg.wasm"}},{id:"gofmt",js:"/webui-fmt-gofmt.js",entry:"fmt/fmt-gofmt.ts",wasm:{route:"/webui-fmt-gofmt.wasm",pkg:"@wasm-fmt/gofmt",file:"gofmt.wasm"}},{id:"clang",js:"/webui-fmt-clang.js",entry:"fmt/fmt-clang.ts",wasm:{route:"/webui-fmt-clang.wasm",pkg:"@wasm-fmt/clang-format",file:"clang-format.wasm"}},{id:"lua",js:"/webui-fmt-lua.js",entry:"fmt/fmt-lua.ts",wasm:{route:"/webui-fmt-lua.wasm",pkg:"@wasm-fmt/lua_fmt",file:"lua_fmt_bg.wasm"}},{id:"taplo",js:"/webui-fmt-taplo.js",entry:"fmt/fmt-taplo.ts",wasm:{route:"/webui-fmt-taplo.wasm",pkg:"@wasm-fmt/taplo_fmt",file:"taplo_fmt_bg.wasm"}},{id:"sh",js:"/webui-fmt-sh.js",entry:"fmt/fmt-sh.ts"}];function l(e){return L.find((n)=>n.id===e)}var u="mh-fmt-gofmt",b=null;async function C(e,n,t){return b??=f(l("gofmt").wasm.route),await b,{text:y(e),cursor:t}}export{C as format,u as MARKER};
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var b=Object.defineProperty;var p=(q)=>q;function s(q,K){this[q]=p.bind(null,K)}var m=(q,K)=>{for(var Q in K)b(q,Q,{get:K[Q],enumerable:!0,configurable:!0,set:s.bind(K,Q)})};var w={};m(w,{format_range:()=>c,format:()=>l,__wbindgen_object_drop_ref:()=>wq,__wbindgen_object_clone_ref:()=>yq,__wbindgen_cast_0000000000000003:()=>Mq,__wbindgen_cast_0000000000000002:()=>vq,__wbindgen_cast_0000000000000001:()=>hq,__wbg_value_f017d41717e63401:()=>Dq,__wbg_set_wasm:()=>Oq,__wbg_set_56932478ade4233a:()=>xq,__wbg_next_f8c5c9ef1a0c3a83:()=>Vq,__wbg_next_51a522db1cbd73f7:()=>Sq,__wbg_new_746224465aff110b:()=>Tq,__wbg_length_aaef0acc19894897:()=>Eq,__wbg_length_9976bfb53d4f3dd5:()=>Hq,__wbg_iterator_01ceec8f57cd5840:()=>Aq,__wbg_isSafeInteger_e09bd138f6fa8b9c:()=>Wq,__wbg_isArray_68cf2f9754760297:()=>Nq,__wbg_instanceof_Uint8Array_0d898f7981fe0a2d:()=>Lq,__wbg_instanceof_Map_52afb7722e323e8b:()=>Rq,__wbg_instanceof_ArrayBuffer_36214dbc6ea8dd3d:()=>kq,__wbg_get_with_ref_key_6412cf3094599694:()=>Iq,__wbg_get_b2c629d87c5d5082:()=>Uq,__wbg_get_6616f33e20253e61:()=>Fq,__wbg_entries_f8e6e46803dc3e24:()=>Cq,__wbg_done_7d0141397a870db4:()=>Bq,__wbg_call_dc5ed6ea146744db:()=>zq,__wbg_buffer_c2036aebc9b81e68:()=>Pq,__wbg___wbindgen_throw_6ddd609b62940d55:()=>Jq,__wbg___wbindgen_string_get_395e606bd0ee4427:()=>Yq,__wbg___wbindgen_number_get_34bb9d9dcfa21373:()=>Xq,__wbg___wbindgen_memory_edb3f01e3930bbf6:()=>Gq,__wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b:()=>$q,__wbg___wbindgen_jsval_eq_ee31bfad3e536463:()=>Zq,__wbg___wbindgen_is_undefined_52709e72fb9f179c:()=>Qq,__wbg___wbindgen_is_string_7ef6b97b02428fae:()=>Kq,__wbg___wbindgen_is_object_781bc9f159099513:()=>qq,__wbg___wbindgen_is_function_3c846841762788c1:()=>e,__wbg___wbindgen_is_bigint_e2141d4f045b7eda:()=>a,__wbg___wbindgen_in_41dbb8413020e076:()=>r,__wbg___wbindgen_debug_string_5398f5bb970e0daa:()=>t,__wbg___wbindgen_boolean_get_c0f3f60bac5a78d1:()=>g,__wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda:()=>i,__wbg_String_8564e559799eccda:()=>o,__wbg_Number_a5a435bd7bbec835:()=>n,__wbg_Error_83742b46f01ce22d:()=>d});function l(q,K){let Q,Z;try{let F=X.__wbindgen_add_to_stack_pointer(-16),R=E(q,X.__wbindgen_export,X.__wbindgen_export2),D=L;X.format(F,R,D,I(K)?0:Y(K));var G=P().getInt32(F+0,!0),z=P().getInt32(F+4,!0),J=P().getInt32(F+8,!0),B=P().getInt32(F+12,!0),C=G,k=z;if(B)throw C=0,k=0,y(J);return Q=C,Z=k,H(C,k)}finally{X.__wbindgen_add_to_stack_pointer(16),X.__wbindgen_export4(Q,Z,1)}}function c(q,K,Q){let Z,G;try{let R=X.__wbindgen_add_to_stack_pointer(-16),D=E(q,X.__wbindgen_export,X.__wbindgen_export2),u=L;X.format_range(R,D,u,Y(K),I(Q)?0:Y(Q));var z=P().getInt32(R+0,!0),J=P().getInt32(R+4,!0),B=P().getInt32(R+8,!0),C=P().getInt32(R+12,!0),k=z,F=J;if(C)throw k=0,F=0,y(B);return Z=k,G=F,H(k,F)}finally{X.__wbindgen_add_to_stack_pointer(16),X.__wbindgen_export4(Z,G,1)}}function d(q,K){let Q=Error(H(q,K));return Y(Q)}function n(q){return Number($(q))}function o(q,K){let Q=String($(K)),Z=E(Q,X.__wbindgen_export,X.__wbindgen_export2),G=L;P().setInt32(q+4,G,!0),P().setInt32(q+0,Z,!0)}function i(q,K){let Q=$(K),Z=typeof Q==="bigint"?Q:void 0;P().setBigInt64(q+8,I(Z)?BigInt(0):Z,!0),P().setInt32(q+0,!I(Z),!0)}function g(q){let K=$(q),Q=typeof K==="boolean"?K:void 0;return I(Q)?16777215:Q?1:0}function t(q,K){let Q=v($(K)),Z=E(Q,X.__wbindgen_export,X.__wbindgen_export2),G=L;P().setInt32(q+4,G,!0),P().setInt32(q+0,Z,!0)}function r(q,K){return $(q)in $(K)}function a(q){return typeof $(q)==="bigint"}function e(q){return typeof $(q)==="function"}function qq(q){let K=$(q);return typeof K==="object"&&K!==null}function Kq(q){return typeof $(q)==="string"}function Qq(q){return $(q)===void 0}function Zq(q,K){return $(q)===$(K)}function $q(q,K){return $(q)==$(K)}function Gq(){let q=X.memory;return Y(q)}function Xq(q,K){let Q=$(K),Z=typeof Q==="number"?Q:void 0;P().setFloat64(q+8,I(Z)?0:Z,!0),P().setInt32(q+0,!I(Z),!0)}function Yq(q,K){let Q=$(K),Z=typeof Q==="string"?Q:void 0;var G=I(Z)?0:E(Z,X.__wbindgen_export,X.__wbindgen_export2),z=L;P().setInt32(q+4,z,!0),P().setInt32(q+0,G,!0)}function Jq(q,K){throw Error(H(q,K))}function Pq(q){let K=$(q).buffer;return Y(K)}function zq(){return M(function(q,K){let Q=$(q).call($(K));return Y(Q)},arguments)}function Bq(q){return $(q).done}function Cq(q){let K=Object.entries($(q));return Y(K)}function Fq(){return M(function(q,K){let Q=Reflect.get($(q),$(K));return Y(Q)},arguments)}function Uq(q,K){let Q=$(q)[K>>>0];return Y(Q)}function Iq(q,K){let Q=$(q)[$(K)];return Y(Q)}function kq(q){let K;try{K=$(q)instanceof ArrayBuffer}catch(Z){K=!1}return K}function Rq(q){let K;try{K=$(q)instanceof Map}catch(Z){K=!1}return K}function Lq(q){let K;try{K=$(q)instanceof Uint8Array}catch(Z){K=!1}return K}function Nq(q){return Array.isArray($(q))}function Wq(q){return Number.isSafeInteger($(q))}function Aq(){return Y(Symbol.iterator)}function Hq(q){return $(q).length}function Eq(q){return $(q).length}function Tq(q){let K=new Uint8Array($(q));return Y(K)}function Sq(q){let K=$(q).next;return Y(K)}function Vq(){return M(function(q){let K=$(q).next();return Y(K)},arguments)}function xq(q,K,Q){$(q).set($(K),Q>>>0)}function Dq(q){let K=$(q).value;return Y(K)}function hq(q){return Y(q)}function vq(q,K){let Q=H(q,K);return Y(Q)}function Mq(q){let K=BigInt.asUintN(64,q);return Y(K)}function yq(q){let K=$(q);return Y(K)}function wq(q){y(q)}function Y(q){if(W===U.length)U.push(U.length+1);let K=W;return W=U[K],U[K]=q,K}function v(q){let K=typeof q;if(K=="number"||K=="boolean"||q==null)return`${q}`;if(K=="string")return`"${q}"`;if(K=="symbol"){let G=q.description;if(G==null)return"Symbol";else return`Symbol(${G})`}if(K=="function"){let G=q.name;if(typeof G=="string"&&G.length>0)return`Function(${G})`;else return"Function"}if(Array.isArray(q)){let G=q.length,z="[";if(G>0)z+=v(q[0]);for(let J=1;J<G;J++)z+=", "+v(q[J]);return z+="]",z}let Q=/\[object ([^\]]+)\]/.exec(toString.call(q)),Z;if(Q&&Q.length>1)Z=Q[1];else return toString.call(q);if(Z=="Object")try{return"Object("+JSON.stringify(q)+")"}catch(G){return"Object"}if(q instanceof Error)return`${q.name}: ${q.message}
|
|
2
|
+
${q.stack}`;return Z}function jq(q){if(q<1028)return;U[q]=W,W=q}var N=null;function P(){if(N===null||N.buffer.detached===!0||N.buffer.detached===void 0&&N.buffer!==X.memory.buffer)N=new DataView(X.memory.buffer);return N}function H(q,K){return q=q>>>0,fq(q,K)}var S=null;function V(){if(S===null||S.byteLength===0)S=new Uint8Array(X.memory.buffer);return S}function $(q){return U[q]}function M(q,K){try{return q.apply(this,K)}catch(Q){X.__wbindgen_export3(Y(Q))}}var U=Array(1024).fill(void 0);U.push(void 0,null,!0,!1);var W=U.length;function I(q){return q===void 0||q===null}function E(q,K,Q){if(Q===void 0){let B=A.encode(q),C=K(B.length,1)>>>0;return V().subarray(C,C+B.length).set(B),L=B.length,C}let Z=q.length,G=K(Z,1)>>>0,z=V(),J=0;for(;J<Z;J++){let B=q.charCodeAt(J);if(B>127)break;z[G+J]=B}if(J!==Z){if(J!==0)q=q.slice(J);G=Q(G,Z,Z=J+q.length*3,1)>>>0;let B=V().subarray(G+J,G+Z),C=A.encodeInto(q,B);J+=C.written,G=Q(G,Z,J,1)>>>0}return L=J,G}function y(q){let K=$(q);return jq(q),K}var x=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});x.decode();var _q=2146435072,h=0;function fq(q,K){if(h+=K,h>=_q)x=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),x.decode(),h=K;return x.decode(V().subarray(q,q+K))}var A=new TextEncoder;if(!("encodeInto"in A))A.encodeInto=function(q,K){let Q=A.encode(q);return K.set(Q),{read:q.length,written:Q.length}};var L=0,X;function Oq(q){X=q}var{__wbg_set_wasm:uq,format:_,format_range:nq,...bq}=w;function pq(){return{__proto__:null,"./lua_fmt_bg.js":bq}}var T,sq;async function mq(q,K){if(typeof Response==="function"&&q instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(q,K)}catch(G){if(q.ok&&Q(q.type)&&q.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",G);else throw G}let Z=await q.arrayBuffer();return await WebAssembly.instantiate(Z,K)}else{let Z=await WebAssembly.instantiate(q,K);if(Z instanceof WebAssembly.Instance)return{instance:Z,module:q};else return Z}function Q(Z){switch(Z){case"basic":case"cors":case"default":return!0}return!1}}function lq(q,K){return T=q.exports,sq=K,uq(T),T}async function j(q){if(T!==void 0)return T;if(q===void 0)q=new URL("lua_fmt_bg.wasm",import.meta.url);if(typeof q==="string"||typeof Request==="function"&&q instanceof Request||typeof URL==="function"&&q instanceof URL)q=fetch(q);let{instance:K,module:Q}=await mq(await q,pq());return lq(K,Q)}var cq=[{id:"core",js:"/webui-fmt.js",entry:"fmt/fmt-core.ts"},{id:"ruff",js:"/webui-fmt-ruff.js",entry:"fmt/fmt-ruff.ts",wasm:{route:"/webui-fmt-ruff.wasm",pkg:"@wasm-fmt/ruff_fmt",file:"ruff_fmt_bg.wasm"}},{id:"gofmt",js:"/webui-fmt-gofmt.js",entry:"fmt/fmt-gofmt.ts",wasm:{route:"/webui-fmt-gofmt.wasm",pkg:"@wasm-fmt/gofmt",file:"gofmt.wasm"}},{id:"clang",js:"/webui-fmt-clang.js",entry:"fmt/fmt-clang.ts",wasm:{route:"/webui-fmt-clang.wasm",pkg:"@wasm-fmt/clang-format",file:"clang-format.wasm"}},{id:"lua",js:"/webui-fmt-lua.js",entry:"fmt/fmt-lua.ts",wasm:{route:"/webui-fmt-lua.wasm",pkg:"@wasm-fmt/lua_fmt",file:"lua_fmt_bg.wasm"}},{id:"taplo",js:"/webui-fmt-taplo.js",entry:"fmt/fmt-taplo.ts",wasm:{route:"/webui-fmt-taplo.wasm",pkg:"@wasm-fmt/taplo_fmt",file:"taplo_fmt_bg.wasm"}},{id:"sh",js:"/webui-fmt-sh.js",entry:"fmt/fmt-sh.ts"}];function f(q){return cq.find((K)=>K.id===q)}var rq="mh-fmt-lua",O=null;async function aq(q,K,Q){return O??=j(f("lua").wasm.route),await O,{text:_(q),cursor:Q}}export{aq as format,rq as MARKER};
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var j=Object.defineProperty;var O=(q)=>q;function o(q,z){this[q]=O.bind(null,z)}var m=(q,z)=>{for(var I in z)j(q,I,{get:z[I],enumerable:!0,configurable:!0,set:o.bind(z,I)})};var V={};m(V,{format_range:()=>p,format:()=>l,__wbindgen_object_drop_ref:()=>v0,__wbindgen_object_clone_ref:()=>D0,__wbindgen_cast_0000000000000004:()=>V0,__wbindgen_cast_0000000000000003:()=>w0,__wbindgen_cast_0000000000000002:()=>_0,__wbindgen_cast_0000000000000001:()=>E0,__wbg_value_f852716acdeb3e82:()=>x0,__wbg_set_wasm:()=>j0,__wbg_set_6be42768c690e380:()=>T0,__wbg_prototypesetcall_fd4050e806e1d519:()=>S0,__wbg_next_aacee310bcfe6461:()=>s0,__wbg_next_261c3c48c6e309a5:()=>y0,__wbg_new_8454eee672b2ba6e:()=>N0,__wbg_new_2fad8ca02fd00684:()=>H0,__wbg_length_ba3c032602efe310:()=>u0,__wbg_length_0a6ce016dc1460b0:()=>L0,__wbg_iterator_9d68985a1d096fc2:()=>k0,__wbg_isSafeInteger_3c56c421a5b4cce4:()=>A0,__wbg_isArray_c6c6ef8308995bcf:()=>n0,__wbg_instanceof_Uint8Array_57d77acd50e4c44d:()=>W0,__wbg_instanceof_Map_10d4edf60fcf9327:()=>C0,__wbg_instanceof_ArrayBuffer_eab9f28fbec23477:()=>U0,__wbg_get_with_ref_key_6412cf3094599694:()=>F0,__wbg_get_unchecked_be562b1421656321:()=>f0,__wbg_get_9cfea9b7bbf12a15:()=>B0,__wbg_get_652f640b3b0b6e3e:()=>R0,__wbg_entries_bb9843ba73dc70d6:()=>P0,__wbg_done_b1afd6201ac045e0:()=>J0,__wbg_call_add9e5a76382e668:()=>Y0,__wbg___wbindgen_throw_9c75d47bf9e7731e:()=>X0,__wbg___wbindgen_string_get_965592073e5d848c:()=>G0,__wbg___wbindgen_number_get_dd6d69a6079f26f1:()=>$0,__wbg___wbindgen_jsval_loose_eq_1978f1e77b4bce62:()=>Z0,__wbg___wbindgen_jsval_eq_403eaa3610500a25:()=>Q0,__wbg___wbindgen_is_undefined_244a92c34d3b6ec0:()=>K0,__wbg___wbindgen_is_object_5b22ff2418063a9c:()=>I0,__wbg___wbindgen_is_function_2f0fd7ceb86e64c5:()=>z0,__wbg___wbindgen_is_bigint_d6a8167cac401b95:()=>q0,__wbg___wbindgen_in_2617fa76397620d3:()=>e,__wbg___wbindgen_debug_string_07cb72cfcc952e2b:()=>a,__wbg___wbindgen_boolean_get_c3dd5c39f1b5a12b:()=>r,__wbg___wbindgen_bigint_get_as_i64_3af6d4ca77193a4b:()=>t,__wbg_String_8564e559799eccda:()=>g,__wbg_Number_a3d737fd183f7dca:()=>d,__wbg_Error_3639a60ed15f87e7:()=>c});function l(q,z,I){let K,Z;try{let k=$.__wbindgen_add_to_stack_pointer(-16),h=U(q,$.__wbindgen_export,$.__wbindgen_export2),b=F;var J=R(z)?0:U(z,$.__wbindgen_export,$.__wbindgen_export2),X=F;$.format(k,h,b,J,X,R(I)?0:G(I));var P=Y().getInt32(k+0,!0),B=Y().getInt32(k+4,!0),C=Y().getInt32(k+8,!0),T=Y().getInt32(k+12,!0),A=P,x=B;if(T)throw A=0,x=0,n(C);return K=A,Z=x,S(A,x)}finally{$.__wbindgen_add_to_stack_pointer(16),$.__wbindgen_export4(K,Z,1)}}function p(q,z,I,K){try{let C=$.__wbindgen_add_to_stack_pointer(-16),T=U(q,$.__wbindgen_export,$.__wbindgen_export2),A=F;var Z=R(I)?0:U(I,$.__wbindgen_export,$.__wbindgen_export2),J=F;$.format_range(C,T,A,G(z),Z,J,R(K)?0:G(K));var X=Y().getInt32(C+0,!0),P=Y().getInt32(C+4,!0),B=Y().getInt32(C+8,!0);if(B)throw n(P);return n(X)}finally{$.__wbindgen_add_to_stack_pointer(16)}}function c(q,z){let I=Error(S(q,z));return G(I)}function d(q){return Number(Q(q))}function g(q,z){let I=String(Q(z)),K=U(I,$.__wbindgen_export,$.__wbindgen_export2),Z=F;Y().setInt32(q+4,Z,!0),Y().setInt32(q+0,K,!0)}function t(q,z){let I=Q(z),K=typeof I==="bigint"?I:void 0;Y().setBigInt64(q+8,R(K)?BigInt(0):K,!0),Y().setInt32(q+0,!R(K),!0)}function r(q){let z=Q(q),I=typeof z==="boolean"?z:void 0;return R(I)?16777215:I?1:0}function a(q,z){let I=_(Q(z)),K=U(I,$.__wbindgen_export,$.__wbindgen_export2),Z=F;Y().setInt32(q+4,Z,!0),Y().setInt32(q+0,K,!0)}function e(q,z){return Q(q)in Q(z)}function q0(q){return typeof Q(q)==="bigint"}function z0(q){return typeof Q(q)==="function"}function I0(q){let z=Q(q);return typeof z==="object"&&z!==null}function K0(q){return Q(q)===void 0}function Q0(q,z){return Q(q)===Q(z)}function Z0(q,z){return Q(q)==Q(z)}function $0(q,z){let I=Q(z),K=typeof I==="number"?I:void 0;Y().setFloat64(q+8,R(K)?0:K,!0),Y().setInt32(q+0,!R(K),!0)}function G0(q,z){let I=Q(z),K=typeof I==="string"?I:void 0;var Z=R(K)?0:U(K,$.__wbindgen_export,$.__wbindgen_export2),J=F;Y().setInt32(q+4,J,!0),Y().setInt32(q+0,Z,!0)}function X0(q,z){throw Error(S(q,z))}function Y0(){return w(function(q,z){let I=Q(q).call(Q(z));return G(I)},arguments)}function J0(q){return Q(q).done}function P0(q){let z=Object.entries(Q(q));return G(z)}function R0(q,z){let I=Q(q)[z>>>0];return G(I)}function B0(){return w(function(q,z){let I=Reflect.get(Q(q),Q(z));return G(I)},arguments)}function f0(q,z){let I=Q(q)[z>>>0];return G(I)}function F0(q,z){let I=Q(q)[Q(z)];return G(I)}function U0(q){let z;try{z=Q(q)instanceof ArrayBuffer}catch(K){z=!1}return z}function C0(q){let z;try{z=Q(q)instanceof Map}catch(K){z=!1}return z}function W0(q){let z;try{z=Q(q)instanceof Uint8Array}catch(K){z=!1}return z}function n0(q){return Array.isArray(Q(q))}function A0(q){return Number.isSafeInteger(Q(q))}function k0(){return G(Symbol.iterator)}function L0(q){return Q(q).length}function u0(q){return Q(q).length}function H0(){return G({})}function N0(q){let z=new Uint8Array(Q(q));return G(z)}function y0(q){let z=Q(q).next;return G(z)}function s0(){return w(function(q){let z=Q(q).next();return G(z)},arguments)}function S0(q,z,I){Uint8Array.prototype.set.call(i0(q,z),Q(I))}function T0(q,z,I){Q(q)[n(z)]=n(I)}function x0(q){let z=Q(q).value;return G(z)}function E0(q){return G(q)}function _0(q){return G(q)}function w0(q,z){let I=S(q,z);return G(I)}function V0(q){let z=BigInt.asUintN(64,q);return G(z)}function D0(q){let z=Q(q);return G(z)}function v0(q){n(q)}function G(q){if(u===f.length)f.push(f.length+1);let z=u;return u=f[z],f[z]=q,z}function _(q){let z=typeof q;if(z=="number"||z=="boolean"||q==null)return`${q}`;if(z=="string")return`"${q}"`;if(z=="symbol"){let Z=q.description;if(Z==null)return"Symbol";else return`Symbol(${Z})`}if(z=="function"){let Z=q.name;if(typeof Z=="string"&&Z.length>0)return`Function(${Z})`;else return"Function"}if(Array.isArray(q)){let Z=q.length,J="[";if(Z>0)J+=_(q[0]);for(let X=1;X<Z;X++)J+=", "+_(q[X]);return J+="]",J}let I=/\[object ([^\]]+)\]/.exec(toString.call(q)),K;if(I&&I.length>1)K=I[1];else return toString.call(q);if(K=="Object")try{return"Object("+JSON.stringify(q)+")"}catch(Z){return"Object"}if(q instanceof Error)return`${q.name}: ${q.message}
|
|
2
|
+
${q.stack}`;return K}function M0(q){if(q<1028)return;f[q]=u,u=q}function i0(q,z){return q=q>>>0,L().subarray(q/1,q/1+z)}var W=null;function Y(){if(W===null||W.buffer.detached===!0||W.buffer.detached===void 0&&W.buffer!==$.memory.buffer)W=new DataView($.memory.buffer);return W}function S(q,z){return b0(q>>>0,z)}var y=null;function L(){if(y===null||y.byteLength===0)y=new Uint8Array($.memory.buffer);return y}function Q(q){return f[q]}function w(q,z){try{return q.apply(this,z)}catch(I){$.__wbindgen_export3(G(I))}}var f=Array(1024).fill(void 0);f.push(void 0,null,!0,!1);var u=f.length;function R(q){return q===void 0||q===null}function U(q,z,I){if(I===void 0){let P=H.encode(q),B=z(P.length,1)>>>0;return L().subarray(B,B+P.length).set(P),F=P.length,B}let K=q.length,Z=z(K,1)>>>0,J=L(),X=0;for(;X<K;X++){let P=q.charCodeAt(X);if(P>127)break;J[Z+X]=P}if(X!==K){if(X!==0)q=q.slice(X);Z=I(Z,K,K=X+q.length*3,1)>>>0;let P=L().subarray(Z+X,Z+K),B=H.encodeInto(q,P);X+=B.written,Z=I(Z,K,X,1)>>>0}return F=X,Z}function n(q){let z=Q(q);return M0(q),z}var s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});s.decode();var h0=2146435072,E=0;function b0(q,z){if(E+=z,E>=h0)s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),s.decode(),E=z;return s.decode(L().subarray(q,q+z))}var H=new TextEncoder;if(!("encodeInto"in H))H.encodeInto=function(q,z){let I=H.encode(q);return z.set(I),{read:q.length,written:I.length}};var F=0,$;function j0(q){$=q}var{__wbg_set_wasm:O0,format:v,format_range:t0,...o0}=V;function m0(){return{__proto__:null,"./ruff_fmt_bg.js":o0}}var N,l0;async function p0(q,z){if(typeof Response==="function"&&q instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(q,z)}catch(Z){if(q.ok&&I(q.type)&&q.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",Z);else throw Z}let K=await q.arrayBuffer();return await WebAssembly.instantiate(K,z)}else{let K=await WebAssembly.instantiate(q,z);if(K instanceof WebAssembly.Instance)return{instance:K,module:q};else return K}function I(K){switch(K){case"basic":case"cors":case"default":return!0}return!1}}function c0(q,z){return N=q.exports,l0=z,O0(N),N}async function D(q){if(N!==void 0)return N;if(q===void 0)q=new URL("ruff_fmt_bg.wasm",import.meta.url);if(typeof q==="string"||typeof Request==="function"&&q instanceof Request||typeof URL==="function"&&q instanceof URL)q=fetch(q);let{instance:z,module:I}=await p0(await q,m0());return c0(z,I)}var d0=[{id:"core",js:"/webui-fmt.js",entry:"fmt/fmt-core.ts"},{id:"ruff",js:"/webui-fmt-ruff.js",entry:"fmt/fmt-ruff.ts",wasm:{route:"/webui-fmt-ruff.wasm",pkg:"@wasm-fmt/ruff_fmt",file:"ruff_fmt_bg.wasm"}},{id:"gofmt",js:"/webui-fmt-gofmt.js",entry:"fmt/fmt-gofmt.ts",wasm:{route:"/webui-fmt-gofmt.wasm",pkg:"@wasm-fmt/gofmt",file:"gofmt.wasm"}},{id:"clang",js:"/webui-fmt-clang.js",entry:"fmt/fmt-clang.ts",wasm:{route:"/webui-fmt-clang.wasm",pkg:"@wasm-fmt/clang-format",file:"clang-format.wasm"}},{id:"lua",js:"/webui-fmt-lua.js",entry:"fmt/fmt-lua.ts",wasm:{route:"/webui-fmt-lua.wasm",pkg:"@wasm-fmt/lua_fmt",file:"lua_fmt_bg.wasm"}},{id:"taplo",js:"/webui-fmt-taplo.js",entry:"fmt/fmt-taplo.ts",wasm:{route:"/webui-fmt-taplo.wasm",pkg:"@wasm-fmt/taplo_fmt",file:"taplo_fmt_bg.wasm"}},{id:"sh",js:"/webui-fmt-sh.js",entry:"fmt/fmt-sh.ts"}];function M(q){return d0.find((z)=>z.id===q)}var zq="mh-fmt-ruff",i=null;async function Iq(q,z,I){return i??=D(M("ruff").wasm.route),await i,{text:v(q,"block.py"),cursor:I}}export{Iq as format,zq as MARKER};
|
|
Binary file
|