Charlie commited on
Commit
58ae063
·
1 Parent(s): c96984d

update files

Browse files
.gitignore CHANGED
@@ -1,9 +1,4 @@
1
- # Node modules
2
  node_modules/
 
 
3
 
4
-
5
- # Log files
6
- *.log
7
-
8
- # Environment files
9
- .env
 
 
1
  node_modules/
2
+ package.json
3
+ tsconfig.json
4
 
 
 
 
 
 
 
README.md DELETED
@@ -1,12 +0,0 @@
1
- ---
2
- title: Apidemo
3
- emoji: ⚡
4
- colorFrom: green
5
- colorTo: green
6
- sdk: static
7
- hf_oauth: true
8
- hf_oauth_scopes:
9
- - read-repos
10
- - email
11
- - write-repos
12
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
dist/assets/index-DH6LWxsk.js DELETED
@@ -1,2 +0,0 @@
1
- (function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))a(e);new MutationObserver(e=>{for(const n of e)if(n.type==="childList")for(const i of n.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function o(e){const n={};return e.integrity&&(n.integrity=e.integrity),e.referrerPolicy&&(n.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?n.credentials="include":e.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function a(e){if(e.ep)return;e.ep=!0;const n=o(e);fetch(e.href,n)}})();var T=Object.defineProperty,A=(t,r,o)=>r in t?T(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,g=(t,r,o)=>(A(t,typeof r!="symbol"?r+"":r,o),o),E="https://huggingface.co";async function w(t,r){var o,a;const e=new q(t.url,t.status,(o=t.headers.get("X-Request-Id"))!=null?o:void 0);e.message=`Api error with status ${e.statusCode}`;const n=[`URL: ${e.url}`,e.requestId?`Request ID: ${e.requestId}`:void 0].filter(Boolean).join(". ");if((a=t.headers.get("Content-Type"))!=null&&a.startsWith("application/json")){const i=await t.json();e.message=i.error||i.message||e.message,i.error_description&&(e.message=e.message?e.message+`: ${i.error_description}`:i.error_description),e.data=i}else e.data={message:await t.text()};throw e.message+=`. ${n}`,e}var q=class extends Error{constructor(t,r,o,a){super(a),g(this,"statusCode"),g(this,"url"),g(this,"requestId"),g(this,"data"),this.statusCode=r,this.requestId=o,this.url=t}};new Promise(t=>{});function $(t){if(globalThis.Buffer)return globalThis.Buffer.from(t).toString("base64");{const r=[];return t.forEach(o=>{r.push(String.fromCharCode(o))}),globalThis.btoa(r.join(""))}}async function S(t){var r,o,a;if(typeof window>"u")throw new Error("oauthHandleRedirect is only available in the browser, unless you provide redirectedUrl");if(typeof localStorage>"u")throw new Error("oauthHandleRedirect requires localStorage to be available, unless you provide nonce and codeVerifier");const e=(r=void 0)!=null?r:window.location.href,n=(()=>{try{return new URL(e).searchParams}catch{throw new Error("Failed to parse redirected URL: "+e)}})(),[i,u]=[n.get("error"),n.get("error_description")];if(i)throw new Error(`${i}: ${u}`);const d=n.get("code"),l=(o=void 0)!=null?o:localStorage.getItem("huggingface.co:oauth:nonce");if(!d)throw new Error("Missing oauth code from query parameters in redirected URL: "+e);if(!l)throw new Error("Missing oauth nonce from localStorage");const f=(a=void 0)!=null?a:localStorage.getItem("huggingface.co:oauth:code_verifier");if(!f)throw new Error("Missing oauth code_verifier from localStorage");const s=n.get("state");if(!s)throw new Error("Missing oauth state from query parameters in redirected URL");let c;try{c=JSON.parse(s)}catch{throw new Error("Invalid oauth state in redirected URL, unable to parse JSON: "+s)}if(c.nonce!==l)throw new Error("Invalid oauth state in redirected URL");const m=E,L=`${new URL(m).origin}/.well-known/openid-configuration`,y=await fetch(L,{headers:{Accept:"application/json"}});if(!y.ok)throw await w(y);const U=await y.json(),v=await fetch(U.token_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:d,redirect_uri:c.redirectUri,code_verifier:f}).toString()});if(localStorage.removeItem("huggingface.co:oauth:code_verifier"),localStorage.removeItem("huggingface.co:oauth:nonce"),!v.ok)throw await w(v);const h=await v.json(),C=new Date(Date.now()+h.expires_in*1e3),b=await fetch(U.userinfo_endpoint,{headers:{Authorization:`Bearer ${h.access_token}`}});if(!b.ok)throw await w(b);const O=await b.json();return{accessToken:h.access_token,accessTokenExpiresAt:C,userInfo:O,state:c.state,scope:h.scope}}async function j(t){var r;if(typeof window>"u")throw new Error("oauthHandleRedirect is only available in the browser, unless you provide redirectedUrl");if(typeof localStorage>"u")throw new Error("oauthHandleRedirect requires localStorage to be available, unless you provide nonce and codeVerifier");const o=new URLSearchParams((r=void 0)!=null?r:window.location.search);return o.has("error")?S():o.has("code")?localStorage.getItem("huggingface.co:oauth:nonce")?S():(console.warn("Missing oauth nonce from localStorage. This can happen when the user refreshes the page after logging in, without changing the URL."),!1):!1}async function H(t){var r,o;if(typeof window>"u")throw new Error("oauthLogin is only available in the browser, unless you provide clientId and redirectUrl");if(typeof localStorage>"u")throw new Error("oauthLogin requires localStorage to be available in the context, unless you provide a localStorage empty object as argument");const a=E,e=`${new URL(a).origin}/.well-known/openid-configuration`,n=await fetch(e,{headers:{Accept:"application/json"}});if(!n.ok)throw await w(n);const i=await n.json(),u=globalThis.crypto.randomUUID(),d=globalThis.crypto.randomUUID()+globalThis.crypto.randomUUID();localStorage.setItem("huggingface.co:oauth:nonce",u),localStorage.setItem("huggingface.co:oauth:code_verifier",d);const l=typeof window<"u"?window.location.href:void 0;if(!l)throw new Error("Missing redirectUrl");const f=JSON.stringify({nonce:u,redirectUri:l,state:void 0}),s=typeof window<"u"&&(o=(r=window.huggingface)==null?void 0:r.variables)!=null?o:null,c=s==null?void 0:s.OAUTH_CLIENT_ID;if(!c)throw s?new Error("Missing clientId, please add hf_oauth: true to the README.md's metadata in your static Space"):new Error("Missing clientId");const m=$(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(d)))).replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/=/g,"");return`${i.authorization_endpoint}?${new URLSearchParams({client_id:c,scope:(s==null?void 0:s.OAUTH_SCOPES)||"openid profile",response_type:"code",redirect_uri:l,state:f,code_challenge:m,code_challenge_method:"S256"}).toString()}`}const I=document.getElementById("signin"),R=document.getElementById("signout"),_=document.querySelector("pre");function p(t){I.style.display=t?"none":"block",R.style.display=t?"block":"none"}async function x(){try{const t=await j();return t?(_.textContent=JSON.stringify(t,null,2),p(!0)):p(!1),t}catch(t){throw console.error("OAuth error:",t),_.textContent="Error: "+t.message,p(!1),t}}I.addEventListener("click",async()=>{const t=await H();window.location.href=t});R.addEventListener("click",()=>{_.textContent="",p(!1)});x().catch(console.error);
2
- //# sourceMappingURL=index-DH6LWxsk.js.map
 
 
 
dist/assets/index-DH6LWxsk.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DH6LWxsk.js","sources":["../../node_modules/@huggingface/hub/dist/browser/chunk-NHABU752.mjs","../../node_modules/@huggingface/hub/dist/browser/index.mjs","../../src/index.ts"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\n\nexport {\n __publicField\n};\n","import {\n __publicField\n} from \"./chunk-NHABU752.mjs\";\n\n// src/consts.ts\nvar HUB_URL = \"https://huggingface.co\";\n\n// src/error.ts\nasync function createApiError(response, opts) {\n var _a, _b;\n const error = new HubApiError(response.url, response.status, (_a = response.headers.get(\"X-Request-Id\")) != null ? _a : opts == null ? void 0 : opts.requestId);\n error.message = `Api error with status ${error.statusCode}${(opts == null ? void 0 : opts.message) ? `. ${opts.message}` : \"\"}`;\n const trailer = [`URL: ${error.url}`, error.requestId ? `Request ID: ${error.requestId}` : void 0].filter(Boolean).join(\". \");\n if ((_b = response.headers.get(\"Content-Type\")) == null ? void 0 : _b.startsWith(\"application/json\")) {\n const json = await response.json();\n error.message = json.error || json.message || error.message;\n if (json.error_description) {\n error.message = error.message ? error.message + `: ${json.error_description}` : json.error_description;\n }\n error.data = json;\n } else {\n error.data = { message: await response.text() };\n }\n error.message += `. ${trailer}`;\n throw error;\n}\nvar HubApiError = class extends Error {\n constructor(url, statusCode, requestId, message) {\n super(message);\n __publicField(this, \"statusCode\");\n __publicField(this, \"url\");\n __publicField(this, \"requestId\");\n __publicField(this, \"data\");\n this.statusCode = statusCode;\n this.requestId = requestId;\n this.url = url;\n }\n};\nvar InvalidApiResponseFormatError = class extends Error {\n};\n\n// src/utils/checkCredentials.ts\nfunction checkAccessToken(accessToken) {\n if (!accessToken.startsWith(\"hf_\")) {\n throw new TypeError(\"Your access token must start with 'hf_'\");\n }\n}\nfunction checkCredentials(params) {\n var _a;\n if (params.accessToken) {\n checkAccessToken(params.accessToken);\n return params.accessToken;\n }\n if ((_a = params.credentials) == null ? void 0 : _a.accessToken) {\n checkAccessToken(params.credentials.accessToken);\n return params.credentials.accessToken;\n }\n}\n\n// src/utils/toRepoId.ts\nfunction toRepoId(repo) {\n if (typeof repo !== \"string\") {\n return repo;\n }\n if (repo.startsWith(\"model/\") || repo.startsWith(\"models/\")) {\n throw new TypeError(\n \"A repo designation for a model should not start with 'models/', directly specify the model namespace / name\"\n );\n }\n if (repo.startsWith(\"space/\")) {\n throw new TypeError(\"Spaces should start with 'spaces/', plural, not 'space/'\");\n }\n if (repo.startsWith(\"dataset/\")) {\n throw new TypeError(\"Datasets should start with 'dataset/', plural, not 'dataset/'\");\n }\n const slashes = repo.split(\"/\").length - 1;\n if (repo.startsWith(\"spaces/\")) {\n if (slashes !== 2) {\n throw new TypeError(\"Space Id must include namespace and name of the space\");\n }\n return {\n type: \"space\",\n name: repo.slice(\"spaces/\".length)\n };\n }\n if (repo.startsWith(\"datasets/\")) {\n if (slashes > 2) {\n throw new TypeError(\"Too many slashes in repo designation: \" + repo);\n }\n return {\n type: \"dataset\",\n name: repo.slice(\"datasets/\".length)\n };\n }\n if (slashes > 1) {\n throw new TypeError(\"Too many slashes in repo designation: \" + repo);\n }\n return {\n type: \"model\",\n name: repo\n };\n}\n\n// src/lib/check-repo-access.ts\nasync function checkRepoAccess(params) {\n const accessToken = params && checkCredentials(params);\n const repoId = toRepoId(params.repo);\n const response = await (params.fetch || fetch)(`${(params == null ? void 0 : params.hubUrl) || HUB_URL}/api/${repoId.type}s/${repoId.name}`, {\n headers: {\n ...accessToken ? { Authorization: `Bearer ${accessToken}` } : {}\n }\n });\n if (!response.ok) {\n throw await createApiError(response);\n }\n}\n\n// src/utils/range.ts\nfunction range(n, b) {\n return b ? Array(b - n).fill(0).map((_, i) => n + i) : Array(n).fill(0).map((_, i) => i);\n}\n\n// src/utils/chunk.ts\nfunction chunk(arr, chunkSize) {\n if (isNaN(chunkSize) || chunkSize < 1) {\n throw new RangeError(\"Invalid chunk size: \" + chunkSize);\n }\n if (!arr.length) {\n return [];\n }\n if (arr.length <= chunkSize) {\n return [arr];\n }\n return range(Math.ceil(arr.length / chunkSize)).map((i) => {\n return arr.slice(i * chunkSize, (i + 1) * chunkSize);\n });\n}\n\n// src/utils/promisesQueue.ts\nasync function promisesQueue(factories, concurrency) {\n const results = [];\n const executing = /* @__PURE__ */ new Set();\n let index = 0;\n for (const factory of factories) {\n const closureIndex = index++;\n const e = factory().then((r) => {\n results[closureIndex] = r;\n executing.delete(e);\n });\n executing.add(e);\n if (executing.size >= concurrency) {\n await Promise.race(executing);\n }\n }\n await Promise.all(executing);\n return results;\n}\n\n// src/utils/promisesQueueStreaming.ts\nasync function promisesQueueStreaming(factories, concurrency) {\n const executing = [];\n for await (const factory of factories) {\n const e = factory().then(() => {\n executing.splice(executing.indexOf(e), 1);\n });\n executing.push(e);\n if (executing.length >= concurrency) {\n await Promise.race(executing);\n }\n }\n await Promise.all(executing);\n}\n\n// src/utils/eventToGenerator.ts\nasync function* eventToGenerator(cb) {\n const promises = [];\n function addPromise() {\n let resolve2;\n let reject;\n const p = new Promise((res, rej) => {\n resolve2 = res;\n reject = rej;\n });\n promises.push({ p, resolve: resolve2, reject });\n }\n addPromise();\n const callbackRes = Promise.resolve().then(\n () => cb(\n (y) => {\n var _a;\n addPromise();\n (_a = promises.at(-2)) == null ? void 0 : _a.resolve({ done: false, value: y });\n },\n (r) => {\n var _a;\n addPromise();\n (_a = promises.at(-2)) == null ? void 0 : _a.resolve({ done: true, value: r });\n },\n (err) => {\n var _a;\n return (_a = promises.shift()) == null ? void 0 : _a.reject(err);\n }\n )\n ).catch((err) => {\n var _a;\n return (_a = promises.shift()) == null ? void 0 : _a.reject(err);\n });\n while (1) {\n const p = promises[0];\n if (!p) {\n throw new Error(\"Logic error in eventGenerator, promises should never be empty\");\n }\n const result = await p.p;\n promises.shift();\n if (result.done) {\n await callbackRes;\n return result.value;\n }\n yield result.value;\n }\n throw new Error(\"Unreachable\");\n}\n\n// src/utils/hexFromBytes.ts\nfunction hexFromBytes(arr) {\n if (globalThis.Buffer) {\n return globalThis.Buffer.from(arr).toString(\"hex\");\n } else {\n const bin = [];\n arr.forEach((byte) => {\n bin.push(byte.toString(16).padStart(2, \"0\"));\n });\n return bin.join(\"\");\n }\n}\n\n// src/utils/isBackend.ts\nvar isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\nvar isWebWorker = typeof self === \"object\" && self.constructor && self.constructor.name === \"DedicatedWorkerGlobalScope\";\nvar isBackend = !isBrowser && !isWebWorker;\n\n// src/utils/isFrontend.ts\nvar isFrontend = !isBackend;\n\n// src/utils/sha256.ts\nasync function getWebWorkerCode() {\n const sha256Module = await import(\"./sha256-wrapper-2GO3XT7J.mjs\");\n return URL.createObjectURL(new Blob([sha256Module.createSHA256WorkerCode()]));\n}\nvar pendingWorkers = [];\nvar runningWorkers = /* @__PURE__ */ new Set();\nvar resolve;\nvar waitPromise = new Promise((r) => {\n resolve = r;\n});\nasync function getWorker(poolSize) {\n {\n const worker2 = pendingWorkers.pop();\n if (worker2) {\n runningWorkers.add(worker2);\n return worker2;\n }\n }\n if (!poolSize) {\n const worker2 = new Worker(await getWebWorkerCode());\n runningWorkers.add(worker2);\n return worker2;\n }\n if (poolSize <= 0) {\n throw new TypeError(\"Invalid webworker pool size: \" + poolSize);\n }\n while (runningWorkers.size >= poolSize) {\n await waitPromise;\n }\n const worker = new Worker(await getWebWorkerCode());\n runningWorkers.add(worker);\n return worker;\n}\nasync function freeWorker(worker, poolSize) {\n if (!poolSize) {\n return destroyWorker(worker);\n }\n runningWorkers.delete(worker);\n pendingWorkers.push(worker);\n const r = resolve;\n waitPromise = new Promise((r2) => {\n resolve = r2;\n });\n r();\n}\nfunction destroyWorker(worker) {\n runningWorkers.delete(worker);\n worker.terminate();\n const r = resolve;\n waitPromise = new Promise((r2) => {\n resolve = r2;\n });\n r();\n}\nasync function* sha256(buffer, opts) {\n var _a, _b;\n yield 0;\n const maxCryptoSize = typeof (opts == null ? void 0 : opts.useWebWorker) === \"object\" && (opts == null ? void 0 : opts.useWebWorker.minSize) !== void 0 ? opts.useWebWorker.minSize : 1e7;\n if (buffer.size < maxCryptoSize && ((_a = globalThis.crypto) == null ? void 0 : _a.subtle)) {\n const res = hexFromBytes(\n new Uint8Array(\n await globalThis.crypto.subtle.digest(\"SHA-256\", buffer instanceof Blob ? await buffer.arrayBuffer() : buffer)\n )\n );\n yield 1;\n return res;\n }\n if (isFrontend) {\n if (opts == null ? void 0 : opts.useWebWorker) {\n try {\n const poolSize = typeof (opts == null ? void 0 : opts.useWebWorker) === \"object\" ? opts.useWebWorker.poolSize : void 0;\n const worker = await getWorker(poolSize);\n return yield* eventToGenerator((yieldCallback, returnCallback, rejectCallack) => {\n worker.addEventListener(\"message\", (event) => {\n var _a2;\n if (event.data.sha256) {\n freeWorker(worker, poolSize);\n returnCallback(event.data.sha256);\n } else if (event.data.progress) {\n yieldCallback(event.data.progress);\n try {\n (_a2 = opts.abortSignal) == null ? void 0 : _a2.throwIfAborted();\n } catch (err) {\n destroyWorker(worker);\n rejectCallack(err);\n }\n } else {\n destroyWorker(worker);\n rejectCallack(event);\n }\n });\n worker.addEventListener(\"error\", (event) => {\n destroyWorker(worker);\n rejectCallack(event.error);\n });\n worker.postMessage({ file: buffer });\n });\n } catch (err) {\n console.warn(\"Failed to use web worker for sha256\", err);\n }\n }\n if (!wasmModule) {\n wasmModule = await import(\"./sha256-wrapper-2GO3XT7J.mjs\");\n }\n const sha2562 = await wasmModule.createSHA256();\n sha2562.init();\n const reader = buffer.stream().getReader();\n const total = buffer.size;\n let bytesDone = 0;\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n sha2562.update(value);\n bytesDone += value.length;\n yield bytesDone / total;\n (_b = opts == null ? void 0 : opts.abortSignal) == null ? void 0 : _b.throwIfAborted();\n }\n return sha2562.digest(\"hex\");\n }\n if (!cryptoModule) {\n cryptoModule = await import(\"./sha256-node-TNZ2WHTI.mjs\");\n }\n return yield* cryptoModule.sha256Node(buffer, { abortSignal: opts == null ? void 0 : opts.abortSignal });\n}\nvar cryptoModule;\nvar wasmModule;\n\n// src/utils/WebBlob.ts\nvar WebBlob = class extends Blob {\n constructor(url, start, end, contentType, full, customFetch) {\n super([]);\n __publicField(this, \"url\");\n __publicField(this, \"start\");\n __publicField(this, \"end\");\n __publicField(this, \"contentType\");\n __publicField(this, \"full\");\n __publicField(this, \"fetch\");\n this.url = url;\n this.start = start;\n this.end = end;\n this.contentType = contentType;\n this.full = full;\n this.fetch = customFetch;\n }\n static async create(url, opts) {\n var _a, _b;\n const customFetch = (_a = opts == null ? void 0 : opts.fetch) != null ? _a : fetch;\n const response = await customFetch(url, { method: \"HEAD\" });\n const size = Number(response.headers.get(\"content-length\"));\n const contentType = response.headers.get(\"content-type\") || \"\";\n const supportRange = response.headers.get(\"accept-ranges\") === \"bytes\";\n if (!supportRange || size < ((_b = opts == null ? void 0 : opts.cacheBelow) != null ? _b : 1e6)) {\n return await (await customFetch(url)).blob();\n }\n return new WebBlob(url, 0, size, contentType, true, customFetch);\n }\n get size() {\n return this.end - this.start;\n }\n get type() {\n return this.contentType;\n }\n slice(start = 0, end = this.size) {\n if (start < 0 || end < 0) {\n new TypeError(\"Unsupported negative start/end on FileBlob.slice\");\n }\n const slice = new WebBlob(\n this.url,\n this.start + start,\n Math.min(this.start + end, this.end),\n this.contentType,\n start === 0 && end === this.size ? this.full : false,\n this.fetch\n );\n return slice;\n }\n async arrayBuffer() {\n const result = await this.fetchRange();\n return result.arrayBuffer();\n }\n async text() {\n const result = await this.fetchRange();\n return result.text();\n }\n stream() {\n const stream = new TransformStream();\n this.fetchRange().then((response) => {\n var _a;\n return (_a = response.body) == null ? void 0 : _a.pipeThrough(stream);\n }).catch((error) => stream.writable.abort(error.message));\n return stream.readable;\n }\n fetchRange() {\n const fetch2 = this.fetch;\n if (this.full) {\n return fetch2(this.url);\n }\n return fetch2(this.url, {\n headers: {\n Range: `bytes=${this.start}-${this.end - 1}`\n }\n });\n }\n};\n\n// src/utils/createBlob.ts\nasync function createBlob(url, opts) {\n if (url.protocol === \"http:\" || url.protocol === \"https:\") {\n return WebBlob.create(url, { fetch: opts == null ? void 0 : opts.fetch });\n }\n if (isFrontend) {\n throw new TypeError(`Unsupported URL protocol \"${url.protocol}\"`);\n }\n if (url.protocol === \"file:\") {\n const { FileBlob } = await import(\"./FileBlob-7MRLQ6TG.mjs\");\n return FileBlob.create(url);\n }\n throw new TypeError(`Unsupported URL protocol \"${url.protocol}\"`);\n}\n\n// src/utils/base64FromBytes.ts\nfunction base64FromBytes(arr) {\n if (globalThis.Buffer) {\n return globalThis.Buffer.from(arr).toString(\"base64\");\n } else {\n const bin = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return globalThis.btoa(bin.join(\"\"));\n }\n}\n\n// src/lib/commit.ts\nvar CONCURRENT_SHAS = 5;\nvar CONCURRENT_LFS_UPLOADS = 5;\nvar MULTIPART_PARALLEL_UPLOAD = 5;\nfunction isFileOperation(op) {\n const ret = op.operation === \"addOrUpdate\";\n if (ret && !(op.content instanceof Blob)) {\n throw new TypeError(\"Precondition failed: op.content should be a Blob\");\n }\n return ret;\n}\nasync function* commitIter(params) {\n var _a, _b, _c, _d, _e, _f, _g;\n const accessToken = checkCredentials(params);\n const repoId = toRepoId(params.repo);\n yield { event: \"phase\", phase: \"preuploading\" };\n const lfsShas = /* @__PURE__ */ new Map();\n const abortController = new AbortController();\n const abortSignal = abortController.signal;\n if (!abortSignal.throwIfAborted) {\n abortSignal.throwIfAborted = () => {\n if (abortSignal.aborted) {\n throw new DOMException(\"Aborted\", \"AbortError\");\n }\n };\n }\n if (params.abortSignal) {\n params.abortSignal.addEventListener(\"abort\", () => abortController.abort());\n }\n try {\n const allOperations = await Promise.all(\n params.operations.map(async (operation) => {\n if (operation.operation !== \"addOrUpdate\") {\n return operation;\n }\n if (!(operation.content instanceof URL)) {\n return { ...operation, content: operation.content };\n }\n const lazyBlob = await createBlob(operation.content, { fetch: params.fetch });\n abortSignal == null ? void 0 : abortSignal.throwIfAborted();\n return {\n ...operation,\n content: lazyBlob\n };\n })\n );\n const gitAttributes = (_a = allOperations.filter(isFileOperation).find((op) => op.path === \".gitattributes\")) == null ? void 0 : _a.content;\n for (const operations of chunk(allOperations.filter(isFileOperation), 100)) {\n const payload = {\n gitAttributes: gitAttributes && await gitAttributes.text(),\n files: await Promise.all(\n operations.map(async (operation) => ({\n path: operation.path,\n size: operation.content.size,\n sample: base64FromBytes(new Uint8Array(await operation.content.slice(0, 512).arrayBuffer()))\n }))\n )\n };\n abortSignal == null ? void 0 : abortSignal.throwIfAborted();\n const res = await ((_b = params.fetch) != null ? _b : fetch)(\n `${(_c = params.hubUrl) != null ? _c : HUB_URL}/api/${repoId.type}s/${repoId.name}/preupload/${encodeURIComponent(\n (_d = params.branch) != null ? _d : \"main\"\n )}` + (params.isPullRequest ? \"?create_pr=1\" : \"\"),\n {\n method: \"POST\",\n headers: {\n ...accessToken && { Authorization: `Bearer ${accessToken}` },\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(payload),\n signal: abortSignal\n }\n );\n if (!res.ok) {\n throw await createApiError(res);\n }\n const json = await res.json();\n for (const file of json.files) {\n if (file.uploadMode === \"lfs\") {\n lfsShas.set(file.path, null);\n }\n }\n }\n yield { event: \"phase\", phase: \"uploadingLargeFiles\" };\n for (const operations of chunk(\n allOperations.filter(isFileOperation).filter((op) => lfsShas.has(op.path)),\n 100\n )) {\n const shas = yield* eventToGenerator((yieldCallback, returnCallback, rejectCallack) => {\n return promisesQueue(\n operations.map((op) => async () => {\n const iterator = sha256(op.content, { useWebWorker: params.useWebWorkers, abortSignal });\n let res2;\n do {\n res2 = await iterator.next();\n if (!res2.done) {\n yieldCallback({ event: \"fileProgress\", path: op.path, progress: res2.value, state: \"hashing\" });\n }\n } while (!res2.done);\n const sha = res2.value;\n lfsShas.set(op.path, res2.value);\n return sha;\n }),\n CONCURRENT_SHAS\n ).then(returnCallback, rejectCallack);\n });\n abortSignal == null ? void 0 : abortSignal.throwIfAborted();\n const payload = {\n operation: \"upload\",\n // multipart is a custom protocol for HF\n transfers: [\"basic\", \"multipart\"],\n hash_algo: \"sha_256\",\n ...!params.isPullRequest && {\n ref: {\n name: (_e = params.branch) != null ? _e : \"main\"\n }\n },\n objects: operations.map((op, i) => ({\n oid: shas[i],\n size: op.content.size\n }))\n };\n const res = await ((_f = params.fetch) != null ? _f : fetch)(\n `${(_g = params.hubUrl) != null ? _g : HUB_URL}/${repoId.type === \"model\" ? \"\" : repoId.type + \"s/\"}${repoId.name}.git/info/lfs/objects/batch`,\n {\n method: \"POST\",\n headers: {\n ...accessToken && { Authorization: `Bearer ${accessToken}` },\n Accept: \"application/vnd.git-lfs+json\",\n \"Content-Type\": \"application/vnd.git-lfs+json\"\n },\n body: JSON.stringify(payload),\n signal: abortSignal\n }\n );\n if (!res.ok) {\n throw await createApiError(res);\n }\n const json = await res.json();\n const batchRequestId = res.headers.get(\"X-Request-Id\") || void 0;\n const shaToOperation = new Map(operations.map((op, i) => [shas[i], op]));\n yield* eventToGenerator((yieldCallback, returnCallback, rejectCallback) => {\n return promisesQueueStreaming(\n json.objects.map((obj) => async () => {\n var _a2, _b2, _c2;\n const op = shaToOperation.get(obj.oid);\n if (!op) {\n throw new InvalidApiResponseFormatError(\"Unrequested object ID in response\");\n }\n abortSignal == null ? void 0 : abortSignal.throwIfAborted();\n if (obj.error) {\n const errorMessage = `Error while doing LFS batch call for ${operations[shas.indexOf(obj.oid)].path}: ${obj.error.message}${batchRequestId ? ` - Request ID: ${batchRequestId}` : \"\"}`;\n throw new HubApiError(res.url, obj.error.code, batchRequestId, errorMessage);\n }\n if (!((_a2 = obj.actions) == null ? void 0 : _a2.upload)) {\n yieldCallback({\n event: \"fileProgress\",\n path: op.path,\n progress: 1,\n state: \"uploading\"\n });\n return;\n }\n yieldCallback({\n event: \"fileProgress\",\n path: op.path,\n progress: 0,\n state: \"uploading\"\n });\n const content = op.content;\n const header = obj.actions.upload.header;\n if (header == null ? void 0 : header.chunk_size) {\n const chunkSize = parseInt(header.chunk_size);\n const completionUrl = obj.actions.upload.href;\n const parts = Object.keys(header).filter((key) => /^[0-9]+$/.test(key));\n if (parts.length !== Math.ceil(content.size / chunkSize)) {\n throw new Error(\"Invalid server response to upload large LFS file, wrong number of parts\");\n }\n const completeReq = {\n oid: obj.oid,\n parts: parts.map((part) => ({\n partNumber: +part,\n etag: \"\"\n }))\n };\n const progressCallback = (progress) => yieldCallback({ event: \"fileProgress\", path: op.path, progress, state: \"uploading\" });\n await promisesQueueStreaming(\n parts.map((part) => async () => {\n var _a3;\n abortSignal == null ? void 0 : abortSignal.throwIfAborted();\n const index = parseInt(part) - 1;\n const slice = content.slice(index * chunkSize, (index + 1) * chunkSize);\n const res3 = await ((_a3 = params.fetch) != null ? _a3 : fetch)(header[part], {\n method: \"PUT\",\n /** Unfortunately, browsers don't support our inherited version of Blob in fetch calls */\n body: slice instanceof WebBlob && isFrontend ? await slice.arrayBuffer() : slice,\n signal: abortSignal,\n ...{\n progressHint: {\n path: op.path,\n part: index,\n numParts: parts.length,\n progressCallback\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n }\n });\n if (!res3.ok) {\n throw await createApiError(res3, {\n requestId: batchRequestId,\n message: `Error while uploading part ${part} of ${operations[shas.indexOf(obj.oid)].path} to LFS storage`\n });\n }\n const eTag = res3.headers.get(\"ETag\");\n if (!eTag) {\n throw new Error(\"Cannot get ETag of part during multipart upload\");\n }\n completeReq.parts[Number(part) - 1].etag = eTag;\n }),\n MULTIPART_PARALLEL_UPLOAD\n );\n abortSignal == null ? void 0 : abortSignal.throwIfAborted();\n const res2 = await ((_b2 = params.fetch) != null ? _b2 : fetch)(completionUrl, {\n method: \"POST\",\n body: JSON.stringify(completeReq),\n headers: {\n Accept: \"application/vnd.git-lfs+json\",\n \"Content-Type\": \"application/vnd.git-lfs+json\"\n },\n signal: abortSignal\n });\n if (!res2.ok) {\n throw await createApiError(res2, {\n requestId: batchRequestId,\n message: `Error completing multipart upload of ${operations[shas.indexOf(obj.oid)].path} to LFS storage`\n });\n }\n yieldCallback({\n event: \"fileProgress\",\n path: op.path,\n progress: 1,\n state: \"uploading\"\n });\n } else {\n const res2 = await ((_c2 = params.fetch) != null ? _c2 : fetch)(obj.actions.upload.href, {\n method: \"PUT\",\n headers: {\n ...batchRequestId ? { \"X-Request-Id\": batchRequestId } : void 0\n },\n /** Unfortunately, browsers don't support our inherited version of Blob in fetch calls */\n body: content instanceof WebBlob && isFrontend ? await content.arrayBuffer() : content,\n signal: abortSignal,\n ...{\n progressHint: {\n path: op.path,\n progressCallback: (progress) => yieldCallback({\n event: \"fileProgress\",\n path: op.path,\n progress,\n state: \"uploading\"\n })\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n }\n });\n if (!res2.ok) {\n throw await createApiError(res2, {\n requestId: batchRequestId,\n message: `Error while uploading ${operations[shas.indexOf(obj.oid)].path} to LFS storage`\n });\n }\n yieldCallback({\n event: \"fileProgress\",\n path: op.path,\n progress: 1,\n state: \"uploading\"\n });\n }\n }),\n CONCURRENT_LFS_UPLOADS\n ).then(returnCallback, rejectCallback);\n });\n }\n abortSignal == null ? void 0 : abortSignal.throwIfAborted();\n yield { event: \"phase\", phase: \"committing\" };\n return yield* eventToGenerator(\n async (yieldCallback, returnCallback, rejectCallback) => {\n var _a2, _b2, _c2;\n return ((_a2 = params.fetch) != null ? _a2 : fetch)(\n `${(_b2 = params.hubUrl) != null ? _b2 : HUB_URL}/api/${repoId.type}s/${repoId.name}/commit/${encodeURIComponent(\n (_c2 = params.branch) != null ? _c2 : \"main\"\n )}` + (params.isPullRequest ? \"?create_pr=1\" : \"\"),\n {\n method: \"POST\",\n headers: {\n ...accessToken && { Authorization: `Bearer ${accessToken}` },\n \"Content-Type\": \"application/x-ndjson\"\n },\n body: [\n {\n key: \"header\",\n value: {\n summary: params.title,\n description: params.description,\n parentCommit: params.parentCommit\n }\n },\n ...await Promise.all(\n allOperations.map((operation) => {\n if (isFileOperation(operation)) {\n const sha = lfsShas.get(operation.path);\n if (sha) {\n return {\n key: \"lfsFile\",\n value: {\n path: operation.path,\n algo: \"sha256\",\n size: operation.content.size,\n oid: sha\n }\n };\n }\n }\n return convertOperationToNdJson(operation);\n })\n )\n ].map((x) => JSON.stringify(x)).join(\"\\n\"),\n signal: abortSignal,\n ...{\n progressHint: {\n progressCallback: (progress) => {\n for (const op of allOperations) {\n if (isFileOperation(op) && !lfsShas.has(op.path)) {\n yieldCallback({\n event: \"fileProgress\",\n path: op.path,\n progress,\n state: \"uploading\"\n });\n }\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n }\n }\n ).then(async (res) => {\n if (!res.ok) {\n throw await createApiError(res);\n }\n const json = await res.json();\n returnCallback({\n pullRequestUrl: json.pullRequestUrl,\n commit: {\n oid: json.commitOid,\n url: json.commitUrl\n },\n hookOutput: json.hookOutput\n });\n }).catch(rejectCallback);\n }\n );\n } catch (err) {\n abortController.abort();\n throw err;\n }\n}\nasync function commit(params) {\n const iterator = commitIter(params);\n let res = await iterator.next();\n while (!res.done) {\n res = await iterator.next();\n }\n return res.value;\n}\nasync function convertOperationToNdJson(operation) {\n switch (operation.operation) {\n case \"addOrUpdate\": {\n return {\n key: \"file\",\n value: {\n content: base64FromBytes(new Uint8Array(await operation.content.arrayBuffer())),\n path: operation.path,\n encoding: \"base64\"\n }\n };\n }\n case \"delete\": {\n return {\n key: \"deletedFile\",\n value: {\n path: operation.path\n }\n };\n }\n default:\n throw new TypeError(\"Unknown operation: \" + operation.operation);\n }\n}\n\n// src/lib/count-commits.ts\nasync function countCommits(params) {\n var _a, _b, _c, _d;\n const accessToken = checkCredentials(params);\n const repoId = toRepoId(params.repo);\n const url = `${(_a = params.hubUrl) != null ? _a : HUB_URL}/api/${repoId.type}s/${repoId.name}/commits/${(_b = params.revision) != null ? _b : \"main\"}?limit=1`;\n const res = await ((_c = params.fetch) != null ? _c : fetch)(url, {\n headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {}\n });\n if (!res.ok) {\n throw await createApiError(res);\n }\n return parseInt((_d = res.headers.get(\"x-total-count\")) != null ? _d : \"0\", 10);\n}\n\n// src/lib/create-repo.ts\nasync function createRepo(params) {\n var _a, _b;\n const accessToken = checkCredentials(params);\n const repoId = toRepoId(params.repo);\n const [namespace, repoName] = repoId.name.split(\"/\");\n if (!namespace || !repoName) {\n throw new TypeError(\n `\"${repoId.name}\" is not a fully qualified repo name. It should be of the form \"{namespace}/{repoName}\".`\n );\n }\n const res = await ((_a = params.fetch) != null ? _a : fetch)(`${(_b = params.hubUrl) != null ? _b : HUB_URL}/api/repos/create`, {\n method: \"POST\",\n body: JSON.stringify({\n name: repoName,\n private: params.private,\n organization: namespace,\n license: params.license,\n ...repoId.type === \"space\" ? {\n type: \"space\",\n sdk: \"static\"\n } : {\n type: repoId.type\n },\n files: params.files ? await Promise.all(\n params.files.map(async (file) => ({\n encoding: \"base64\",\n path: file.path,\n content: base64FromBytes(\n new Uint8Array(file.content instanceof Blob ? await file.content.arrayBuffer() : file.content)\n )\n }))\n ) : void 0\n }),\n headers: {\n Authorization: `Bearer ${accessToken}`,\n \"Content-Type\": \"application/json\"\n }\n });\n if (!res.ok) {\n throw await createApiError(res);\n }\n const output = await res.json();\n return { repoUrl: output.url };\n}\n\n// src/utils/pick.ts\nfunction pick(o, props) {\n return Object.assign(\n {},\n ...props.map((prop) => {\n if (o[prop] !== void 0) {\n return { [prop]: o[prop] };\n }\n })\n );\n}\n\n// src/utils/parseLinkHeader.ts\nfunction parseLinkHeader(header) {\n const regex = /<(https?:[/][/][^>]+)>;\\s+rel=\"([^\"]+)\"/g;\n return Object.fromEntries([...header.matchAll(regex)].map(([, url, rel]) => [rel, url]));\n}\n\n// src/lib/list-datasets.ts\nvar DATASET_EXPAND_KEYS = [\n \"private\",\n \"downloads\",\n \"gated\",\n \"likes\",\n \"lastModified\"\n];\nvar DATASET_EXPANDABLE_KEYS = [\n \"author\",\n \"cardData\",\n \"citation\",\n \"createdAt\",\n \"disabled\",\n \"description\",\n \"downloads\",\n \"downloadsAllTime\",\n \"gated\",\n \"gitalyUid\",\n \"lastModified\",\n \"likes\",\n \"paperswithcode_id\",\n \"private\",\n // \"siblings\",\n \"sha\",\n \"tags\"\n];\nasync function* listDatasets(params) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _i;\n const accessToken = params && checkCredentials(params);\n let totalToFetch = (_a = params == null ? void 0 : params.limit) != null ? _a : Infinity;\n const search = new URLSearchParams([\n ...Object.entries({\n limit: String(Math.min(totalToFetch, 500)),\n ...((_b = params == null ? void 0 : params.search) == null ? void 0 : _b.owner) ? { author: params.search.owner } : void 0,\n ...((_c = params == null ? void 0 : params.search) == null ? void 0 : _c.query) ? { search: params.search.query } : void 0\n }),\n ...(_f = (_e = (_d = params == null ? void 0 : params.search) == null ? void 0 : _d.tags) == null ? void 0 : _e.map((tag) => [\"filter\", tag])) != null ? _f : [],\n ...DATASET_EXPAND_KEYS.map((val) => [\"expand\", val]),\n ...(_h = (_g = params == null ? void 0 : params.additionalFields) == null ? void 0 : _g.map((val) => [\"expand\", val])) != null ? _h : []\n ]).toString();\n let url = `${(params == null ? void 0 : params.hubUrl) || HUB_URL}/api/datasets` + (search ? \"?\" + search : \"\");\n while (url) {\n const res = await ((_i = params == null ? void 0 : params.fetch) != null ? _i : fetch)(url, {\n headers: {\n accept: \"application/json\",\n ...accessToken ? { Authorization: `Bearer ${accessToken}` } : void 0\n }\n });\n if (!res.ok) {\n throw await createApiError(res);\n }\n const items = await res.json();\n for (const item of items) {\n yield {\n ...(params == null ? void 0 : params.additionalFields) && pick(item, params.additionalFields),\n id: item._id,\n name: item.id,\n private: item.private,\n downloads: item.downloads,\n likes: item.likes,\n gated: item.gated,\n updatedAt: new Date(item.lastModified)\n };\n totalToFetch--;\n if (totalToFetch <= 0) {\n return;\n }\n }\n const linkHeader = res.headers.get(\"Link\");\n url = linkHeader ? parseLinkHeader(linkHeader).next : void 0;\n }\n}\n\n// src/lib/dataset-info.ts\nasync function datasetInfo(params) {\n var _a, _b, _c;\n const accessToken = params && checkCredentials(params);\n const search = new URLSearchParams([\n ...DATASET_EXPAND_KEYS.map((val) => [\"expand\", val]),\n ...(_b = (_a = params == null ? void 0 : params.additionalFields) == null ? void 0 : _a.map((val) => [\"expand\", val])) != null ? _b : []\n ]).toString();\n const response = await (params.fetch || fetch)(\n `${(params == null ? void 0 : params.hubUrl) || HUB_URL}/api/datasets/${params.name}/revision/${encodeURIComponent(\n (_c = params.revision) != null ? _c : \"HEAD\"\n )}?${search.toString()}`,\n {\n headers: {\n ...accessToken ? { Authorization: `Bearer ${accessToken}` } : {},\n Accepts: \"application/json\"\n }\n }\n );\n if (!response.ok) {\n throw await createApiError(response);\n }\n const data = await response.json();\n return {\n ...(params == null ? void 0 : params.additionalFields) && pick(data, params.additionalFields),\n id: data._id,\n name: data.id,\n private: data.private,\n downloads: data.downloads,\n likes: data.likes,\n gated: data.gated,\n updatedAt: new Date(data.lastModified)\n };\n}\n\n// src/lib/delete-file.ts\nfunction deleteFile(params) {\n var _a;\n return commit({\n ...params.accessToken ? { accessToken: params.accessToken } : { credentials: params.credentials },\n repo: params.repo,\n operations: [\n {\n operation: \"delete\",\n path: params.path\n }\n ],\n title: (_a = params.commitTitle) != null ? _a : `Delete ${params.path}`,\n description: params.commitDescription,\n hubUrl: params.hubUrl,\n branch: params.branch,\n isPullRequest: params.isPullRequest,\n parentCommit: params.parentCommit,\n fetch: params.fetch\n });\n}\n\n// src/lib/delete-files.ts\nfunction deleteFiles(params) {\n var _a;\n return commit({\n ...params.accessToken ? { accessToken: params.accessToken } : { credentials: params.credentials },\n repo: params.repo,\n operations: params.paths.map((path) => ({\n operation: \"delete\",\n path\n })),\n title: (_a = params.commitTitle) != null ? _a : `Deletes ${params.paths.length} files`,\n description: params.commitDescription,\n hubUrl: params.hubUrl,\n branch: params.branch,\n isPullRequest: params.isPullRequest,\n parentCommit: params.parentCommit,\n fetch: params.fetch\n });\n}\n\n// src/lib/delete-repo.ts\nasync function deleteRepo(params) {\n var _a, _b;\n const accessToken = checkCredentials(params);\n const repoId = toRepoId(params.repo);\n const [namespace, repoName] = repoId.name.split(\"/\");\n const res = await ((_a = params.fetch) != null ? _a : fetch)(`${(_b = params.hubUrl) != null ? _b : HUB_URL}/api/repos/delete`, {\n method: \"DELETE\",\n body: JSON.stringify({\n name: repoName,\n organization: namespace,\n type: repoId.type\n }),\n headers: {\n Authorization: `Bearer ${accessToken}`,\n \"Content-Type\": \"application/json\"\n }\n });\n if (!res.ok) {\n throw await createApiError(res);\n }\n}\n\n// src/lib/download-file.ts\nasync function downloadFile(params) {\n var _a, _b, _c;\n const accessToken = checkCredentials(params);\n const repoId = toRepoId(params.repo);\n const url = `${(_a = params.hubUrl) != null ? _a : HUB_URL}/${repoId.type === \"model\" ? \"\" : `${repoId.type}s/`}${repoId.name}/${params.raw ? \"raw\" : \"resolve\"}/${encodeURIComponent((_b = params.revision) != null ? _b : \"main\")}/${params.path}`;\n const resp = await ((_c = params.fetch) != null ? _c : fetch)(url, {\n headers: {\n ...accessToken ? {\n Authorization: `Bearer ${accessToken}`\n } : {},\n ...params.range ? {\n Range: `bytes=${params.range[0]}-${params.range[1]}`\n } : {}\n }\n });\n if (resp.status === 404 && resp.headers.get(\"X-Error-Code\") === \"EntryNotFound\") {\n return null;\n } else if (!resp.ok) {\n throw await createApiError(resp);\n }\n return resp;\n}\n\n// src/lib/file-download-info.ts\nasync function fileDownloadInfo(params) {\n var _a, _b, _c;\n const accessToken = checkCredentials(params);\n const repoId = toRepoId(params.repo);\n const hubUrl = (_a = params.hubUrl) != null ? _a : HUB_URL;\n const url = `${hubUrl}/${repoId.type === \"model\" ? \"\" : `${repoId.type}s/`}${repoId.name}/${params.raw ? \"raw\" : \"resolve\"}/${encodeURIComponent((_b = params.revision) != null ? _b : \"main\")}/${params.path}` + (params.noContentDisposition ? \"?noContentDisposition=1\" : \"\");\n const resp = await ((_c = params.fetch) != null ? _c : fetch)(url, {\n method: \"GET\",\n headers: {\n ...accessToken && {\n Authorization: `Bearer ${accessToken}`\n },\n Range: \"bytes=0-0\"\n }\n });\n if (resp.status === 404 && resp.headers.get(\"X-Error-Code\") === \"EntryNotFound\") {\n return null;\n }\n if (!resp.ok) {\n throw await createApiError(resp);\n }\n const etag = resp.headers.get(\"ETag\");\n if (!etag) {\n throw new InvalidApiResponseFormatError(\"Expected ETag\");\n }\n const contentRangeHeader = resp.headers.get(\"content-range\");\n if (!contentRangeHeader) {\n throw new InvalidApiResponseFormatError(\"Expected size information\");\n }\n const [, parsedSize] = contentRangeHeader.split(\"/\");\n const size = parseInt(parsedSize);\n if (isNaN(size)) {\n throw new InvalidApiResponseFormatError(\"Invalid file size received\");\n }\n return {\n etag,\n size,\n downloadLink: new URL(resp.url).hostname !== new URL(hubUrl).hostname ? resp.url : null\n };\n}\n\n// src/lib/file-exists.ts\nasync function fileExists(params) {\n var _a, _b, _c;\n const accessToken = checkCredentials(params);\n const repoId = toRepoId(params.repo);\n const hubUrl = (_a = params.hubUrl) != null ? _a : HUB_URL;\n const url = `${hubUrl}/${repoId.type === \"model\" ? \"\" : `${repoId.type}s/`}${repoId.name}/raw/${encodeURIComponent(\n (_b = params.revision) != null ? _b : \"main\"\n )}/${params.path}`;\n const resp = await ((_c = params.fetch) != null ? _c : fetch)(url, {\n method: \"HEAD\",\n headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {}\n });\n if (resp.status === 404) {\n return false;\n }\n if (!resp.ok) {\n throw await createApiError(resp);\n }\n return true;\n}\n\n// src/lib/list-commits.ts\nasync function* listCommits(params) {\n var _a, _b, _c, _d;\n const accessToken = checkCredentials(params);\n const repoId = toRepoId(params.repo);\n let url = `${(_a = params.hubUrl) != null ? _a : HUB_URL}/api/${repoId.type}s/${repoId.name}/commits/${(_b = params.revision) != null ? _b : \"main\"}?limit=${(_c = params.batchSize) != null ? _c : 100}`;\n while (url) {\n const res = await ((_d = params.fetch) != null ? _d : fetch)(url, {\n headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {}\n });\n if (!res.ok) {\n throw await createApiError(res);\n }\n const resJson = await res.json();\n for (const commit2 of resJson) {\n yield {\n oid: commit2.id,\n title: commit2.title,\n message: commit2.message,\n authors: commit2.authors.map((author) => ({\n username: author.user,\n avatarUrl: author.avatar\n })),\n date: new Date(commit2.date)\n };\n }\n const linkHeader = res.headers.get(\"Link\");\n url = linkHeader ? parseLinkHeader(linkHeader).next : void 0;\n }\n}\n\n// src/lib/list-files.ts\nasync function* listFiles(params) {\n var _a;\n const accessToken = checkCredentials(params);\n const repoId = toRepoId(params.repo);\n let url = `${params.hubUrl || HUB_URL}/api/${repoId.type}s/${repoId.name}/tree/${params.revision || \"main\"}${params.path ? \"/\" + params.path : \"\"}?recursive=${!!params.recursive}&expand=${!!params.expand}`;\n while (url) {\n const res = await ((_a = params.fetch) != null ? _a : fetch)(url, {\n headers: {\n accept: \"application/json\",\n ...accessToken ? { Authorization: `Bearer ${accessToken}` } : void 0\n }\n });\n if (!res.ok) {\n throw await createApiError(res);\n }\n const items = await res.json();\n for (const item of items) {\n yield item;\n }\n const linkHeader = res.headers.get(\"Link\");\n url = linkHeader ? parseLinkHeader(linkHeader).next : void 0;\n }\n}\n\n// src/lib/list-models.ts\nvar MODEL_EXPAND_KEYS = [\n \"pipeline_tag\",\n \"private\",\n \"gated\",\n \"downloads\",\n \"likes\",\n \"lastModified\"\n];\nvar MODEL_EXPANDABLE_KEYS = [\n \"author\",\n \"cardData\",\n \"config\",\n \"createdAt\",\n \"disabled\",\n \"downloads\",\n \"downloadsAllTime\",\n \"gated\",\n \"gitalyUid\",\n \"inferenceProviderMapping\",\n \"lastModified\",\n \"library_name\",\n \"likes\",\n \"model-index\",\n \"pipeline_tag\",\n \"private\",\n \"safetensors\",\n \"sha\",\n // \"siblings\",\n \"spaces\",\n \"tags\",\n \"transformersInfo\"\n];\nasync function* listModels(params) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;\n const accessToken = params && checkCredentials(params);\n let totalToFetch = (_a = params == null ? void 0 : params.limit) != null ? _a : Infinity;\n const search = new URLSearchParams([\n ...Object.entries({\n limit: String(Math.min(totalToFetch, 500)),\n ...((_b = params == null ? void 0 : params.search) == null ? void 0 : _b.owner) ? { author: params.search.owner } : void 0,\n ...((_c = params == null ? void 0 : params.search) == null ? void 0 : _c.task) ? { pipeline_tag: params.search.task } : void 0,\n ...((_d = params == null ? void 0 : params.search) == null ? void 0 : _d.query) ? { search: params.search.query } : void 0\n }),\n ...(_g = (_f = (_e = params == null ? void 0 : params.search) == null ? void 0 : _e.tags) == null ? void 0 : _f.map((tag) => [\"filter\", tag])) != null ? _g : [],\n ...MODEL_EXPAND_KEYS.map((val) => [\"expand\", val]),\n ...(_i = (_h = params == null ? void 0 : params.additionalFields) == null ? void 0 : _h.map((val) => [\"expand\", val])) != null ? _i : []\n ]).toString();\n let url = `${(params == null ? void 0 : params.hubUrl) || HUB_URL}/api/models?${search}`;\n while (url) {\n const res = await ((_j = params == null ? void 0 : params.fetch) != null ? _j : fetch)(url, {\n headers: {\n accept: \"application/json\",\n ...accessToken ? { Authorization: `Bearer ${accessToken}` } : void 0\n }\n });\n if (!res.ok) {\n throw await createApiError(res);\n }\n const items = await res.json();\n for (const item of items) {\n yield {\n ...(params == null ? void 0 : params.additionalFields) && pick(item, params.additionalFields),\n id: item._id,\n name: item.id,\n private: item.private,\n task: item.pipeline_tag,\n downloads: item.downloads,\n gated: item.gated,\n likes: item.likes,\n updatedAt: new Date(item.lastModified)\n };\n totalToFetch--;\n if (totalToFetch <= 0) {\n return;\n }\n }\n const linkHeader = res.headers.get(\"Link\");\n url = linkHeader ? parseLinkHeader(linkHeader).next : void 0;\n }\n}\n\n// src/lib/list-spaces.ts\nvar SPACE_EXPAND_KEYS = [\n \"sdk\",\n \"likes\",\n \"private\",\n \"lastModified\"\n];\nvar SPACE_EXPANDABLE_KEYS = [\n \"author\",\n \"cardData\",\n \"datasets\",\n \"disabled\",\n \"gitalyUid\",\n \"lastModified\",\n \"createdAt\",\n \"likes\",\n \"private\",\n \"runtime\",\n \"sdk\",\n // \"siblings\",\n \"sha\",\n \"subdomain\",\n \"tags\",\n \"models\"\n];\nasync function* listSpaces(params) {\n var _a, _b, _c, _d, _e, _f, _g;\n const accessToken = params && checkCredentials(params);\n const search = new URLSearchParams([\n ...Object.entries({\n limit: \"500\",\n ...((_a = params == null ? void 0 : params.search) == null ? void 0 : _a.owner) ? { author: params.search.owner } : void 0,\n ...((_b = params == null ? void 0 : params.search) == null ? void 0 : _b.query) ? { search: params.search.query } : void 0\n }),\n ...(_e = (_d = (_c = params == null ? void 0 : params.search) == null ? void 0 : _c.tags) == null ? void 0 : _d.map((tag) => [\"filter\", tag])) != null ? _e : [],\n ...[...SPACE_EXPAND_KEYS, ...(_f = params == null ? void 0 : params.additionalFields) != null ? _f : []].map(\n (val) => [\"expand\", val]\n )\n ]).toString();\n let url = `${(params == null ? void 0 : params.hubUrl) || HUB_URL}/api/spaces?${search}`;\n while (url) {\n const res = await ((_g = params == null ? void 0 : params.fetch) != null ? _g : fetch)(url, {\n headers: {\n accept: \"application/json\",\n ...accessToken ? { Authorization: `Bearer ${accessToken}` } : void 0\n }\n });\n if (!res.ok) {\n throw await createApiError(res);\n }\n const items = await res.json();\n for (const item of items) {\n yield {\n ...(params == null ? void 0 : params.additionalFields) && pick(item, params.additionalFields),\n id: item._id,\n name: item.id,\n sdk: item.sdk,\n likes: item.likes,\n private: item.private,\n updatedAt: new Date(item.lastModified)\n };\n }\n const linkHeader = res.headers.get(\"Link\");\n url = linkHeader ? parseLinkHeader(linkHeader).next : void 0;\n }\n}\n\n// src/lib/model-info.ts\nasync function modelInfo(params) {\n var _a, _b, _c;\n const accessToken = params && checkCredentials(params);\n const search = new URLSearchParams([\n ...MODEL_EXPAND_KEYS.map((val) => [\"expand\", val]),\n ...(_b = (_a = params == null ? void 0 : params.additionalFields) == null ? void 0 : _a.map((val) => [\"expand\", val])) != null ? _b : []\n ]).toString();\n const response = await (params.fetch || fetch)(\n `${(params == null ? void 0 : params.hubUrl) || HUB_URL}/api/models/${params.name}/revision/${encodeURIComponent(\n (_c = params.revision) != null ? _c : \"HEAD\"\n )}?${search.toString()}`,\n {\n headers: {\n ...accessToken ? { Authorization: `Bearer ${accessToken}` } : {},\n Accepts: \"application/json\"\n }\n }\n );\n if (!response.ok) {\n throw await createApiError(response);\n }\n const data = await response.json();\n return {\n ...(params == null ? void 0 : params.additionalFields) && pick(data, params.additionalFields),\n id: data._id,\n name: data.id,\n private: data.private,\n task: data.pipeline_tag,\n downloads: data.downloads,\n gated: data.gated,\n likes: data.likes,\n updatedAt: new Date(data.lastModified)\n };\n}\n\n// src/lib/oauth-handle-redirect.ts\nasync function oauthHandleRedirect(opts) {\n var _a, _b, _c;\n if (typeof window === \"undefined\" && !(opts == null ? void 0 : opts.redirectedUrl)) {\n throw new Error(\"oauthHandleRedirect is only available in the browser, unless you provide redirectedUrl\");\n }\n if (typeof localStorage === \"undefined\" && (!(opts == null ? void 0 : opts.nonce) || !(opts == null ? void 0 : opts.codeVerifier))) {\n throw new Error(\n \"oauthHandleRedirect requires localStorage to be available, unless you provide nonce and codeVerifier\"\n );\n }\n const redirectedUrl = (_a = opts == null ? void 0 : opts.redirectedUrl) != null ? _a : window.location.href;\n const searchParams = (() => {\n try {\n return new URL(redirectedUrl).searchParams;\n } catch (err) {\n throw new Error(\"Failed to parse redirected URL: \" + redirectedUrl);\n }\n })();\n const [error, errorDescription] = [searchParams.get(\"error\"), searchParams.get(\"error_description\")];\n if (error) {\n throw new Error(`${error}: ${errorDescription}`);\n }\n const code = searchParams.get(\"code\");\n const nonce = (_b = opts == null ? void 0 : opts.nonce) != null ? _b : localStorage.getItem(\"huggingface.co:oauth:nonce\");\n if (!code) {\n throw new Error(\"Missing oauth code from query parameters in redirected URL: \" + redirectedUrl);\n }\n if (!nonce) {\n throw new Error(\"Missing oauth nonce from localStorage\");\n }\n const codeVerifier = (_c = opts == null ? void 0 : opts.codeVerifier) != null ? _c : localStorage.getItem(\"huggingface.co:oauth:code_verifier\");\n if (!codeVerifier) {\n throw new Error(\"Missing oauth code_verifier from localStorage\");\n }\n const state = searchParams.get(\"state\");\n if (!state) {\n throw new Error(\"Missing oauth state from query parameters in redirected URL\");\n }\n let parsedState;\n try {\n parsedState = JSON.parse(state);\n } catch (e) {\n throw new Error(\"Invalid oauth state in redirected URL, unable to parse JSON: \" + state);\n }\n if (parsedState.nonce !== nonce) {\n throw new Error(\"Invalid oauth state in redirected URL\");\n }\n const hubUrl = (opts == null ? void 0 : opts.hubUrl) || HUB_URL;\n const openidConfigUrl = `${new URL(hubUrl).origin}/.well-known/openid-configuration`;\n const openidConfigRes = await fetch(openidConfigUrl, {\n headers: {\n Accept: \"application/json\"\n }\n });\n if (!openidConfigRes.ok) {\n throw await createApiError(openidConfigRes);\n }\n const openidConfig = await openidConfigRes.json();\n const tokenRes = await fetch(openidConfig.token_endpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n },\n body: new URLSearchParams({\n grant_type: \"authorization_code\",\n code,\n redirect_uri: parsedState.redirectUri,\n code_verifier: codeVerifier\n }).toString()\n });\n if (!(opts == null ? void 0 : opts.codeVerifier)) {\n localStorage.removeItem(\"huggingface.co:oauth:code_verifier\");\n }\n if (!(opts == null ? void 0 : opts.nonce)) {\n localStorage.removeItem(\"huggingface.co:oauth:nonce\");\n }\n if (!tokenRes.ok) {\n throw await createApiError(tokenRes);\n }\n const token = await tokenRes.json();\n const accessTokenExpiresAt = new Date(Date.now() + token.expires_in * 1e3);\n const userInfoRes = await fetch(openidConfig.userinfo_endpoint, {\n headers: {\n Authorization: `Bearer ${token.access_token}`\n }\n });\n if (!userInfoRes.ok) {\n throw await createApiError(userInfoRes);\n }\n const userInfo = await userInfoRes.json();\n return {\n accessToken: token.access_token,\n accessTokenExpiresAt,\n userInfo,\n state: parsedState.state,\n scope: token.scope\n };\n}\nasync function oauthHandleRedirectIfPresent(opts) {\n var _a;\n if (typeof window === \"undefined\" && !(opts == null ? void 0 : opts.redirectedUrl)) {\n throw new Error(\"oauthHandleRedirect is only available in the browser, unless you provide redirectedUrl\");\n }\n if (typeof localStorage === \"undefined\" && (!(opts == null ? void 0 : opts.nonce) || !(opts == null ? void 0 : opts.codeVerifier))) {\n throw new Error(\n \"oauthHandleRedirect requires localStorage to be available, unless you provide nonce and codeVerifier\"\n );\n }\n const searchParams = new URLSearchParams((_a = opts == null ? void 0 : opts.redirectedUrl) != null ? _a : window.location.search);\n if (searchParams.has(\"error\")) {\n return oauthHandleRedirect(opts);\n }\n if (searchParams.has(\"code\")) {\n if (!localStorage.getItem(\"huggingface.co:oauth:nonce\")) {\n console.warn(\n \"Missing oauth nonce from localStorage. This can happen when the user refreshes the page after logging in, without changing the URL.\"\n );\n return false;\n }\n return oauthHandleRedirect(opts);\n }\n return false;\n}\n\n// src/lib/oauth-login-url.ts\nasync function oauthLoginUrl(opts) {\n var _a, _b;\n if (typeof window === \"undefined\" && (!(opts == null ? void 0 : opts.redirectUrl) || !(opts == null ? void 0 : opts.clientId))) {\n throw new Error(\"oauthLogin is only available in the browser, unless you provide clientId and redirectUrl\");\n }\n if (typeof localStorage === \"undefined\" && !(opts == null ? void 0 : opts.localStorage)) {\n throw new Error(\n \"oauthLogin requires localStorage to be available in the context, unless you provide a localStorage empty object as argument\"\n );\n }\n const hubUrl = (opts == null ? void 0 : opts.hubUrl) || HUB_URL;\n const openidConfigUrl = `${new URL(hubUrl).origin}/.well-known/openid-configuration`;\n const openidConfigRes = await fetch(openidConfigUrl, {\n headers: {\n Accept: \"application/json\"\n }\n });\n if (!openidConfigRes.ok) {\n throw await createApiError(openidConfigRes);\n }\n const opendidConfig = await openidConfigRes.json();\n const newNonce = globalThis.crypto.randomUUID();\n const newCodeVerifier = globalThis.crypto.randomUUID() + globalThis.crypto.randomUUID();\n if (opts == null ? void 0 : opts.localStorage) {\n if (opts.localStorage.codeVerifier !== void 0 && opts.localStorage.codeVerifier !== null) {\n throw new Error(\n \"localStorage.codeVerifier must be a initially set to null or undefined, and will be filled by oauthLoginUrl\"\n );\n }\n if (opts.localStorage.nonce !== void 0 && opts.localStorage.nonce !== null) {\n throw new Error(\n \"localStorage.nonce must be a initially set to null or undefined, and will be filled by oauthLoginUrl\"\n );\n }\n opts.localStorage.codeVerifier = newCodeVerifier;\n opts.localStorage.nonce = newNonce;\n } else {\n localStorage.setItem(\"huggingface.co:oauth:nonce\", newNonce);\n localStorage.setItem(\"huggingface.co:oauth:code_verifier\", newCodeVerifier);\n }\n const redirectUri = (opts == null ? void 0 : opts.redirectUrl) || (typeof window !== \"undefined\" ? window.location.href : void 0);\n if (!redirectUri) {\n throw new Error(\"Missing redirectUrl\");\n }\n const state = JSON.stringify({\n nonce: newNonce,\n redirectUri,\n state: opts == null ? void 0 : opts.state\n });\n const variables = (\n // @ts-expect-error window.huggingface is defined inside static Spaces.\n typeof window !== \"undefined\" ? (_b = (_a = window.huggingface) == null ? void 0 : _a.variables) != null ? _b : null : null\n );\n const clientId = (opts == null ? void 0 : opts.clientId) || (variables == null ? void 0 : variables.OAUTH_CLIENT_ID);\n if (!clientId) {\n if (variables) {\n throw new Error(\"Missing clientId, please add hf_oauth: true to the README.md's metadata in your static Space\");\n }\n throw new Error(\"Missing clientId\");\n }\n const challenge = base64FromBytes(\n new Uint8Array(await globalThis.crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(newCodeVerifier)))\n ).replace(/[+]/g, \"-\").replace(/[/]/g, \"_\").replace(/=/g, \"\");\n return `${opendidConfig.authorization_endpoint}?${new URLSearchParams({\n client_id: clientId,\n scope: (opts == null ? void 0 : opts.scopes) || (variables == null ? void 0 : variables.OAUTH_SCOPES) || \"openid profile\",\n response_type: \"code\",\n redirect_uri: redirectUri,\n state,\n code_challenge: challenge,\n code_challenge_method: \"S256\"\n }).toString()}`;\n}\n\n// src/utils/typedInclude.ts\nfunction typedInclude(arr, v) {\n return arr.includes(v);\n}\n\n// src/utils/omit.ts\nfunction omit(o, props) {\n const propsArr = Array.isArray(props) ? props : [props];\n const letsKeep = Object.keys(o).filter((prop) => !typedInclude(propsArr, prop));\n return pick(o, letsKeep);\n}\n\n// src/utils/typedEntries.ts\nfunction typedEntries(obj) {\n return Object.entries(obj);\n}\n\n// src/lib/parse-safetensors-metadata.ts\nvar SAFETENSORS_FILE = \"model.safetensors\";\nvar SAFETENSORS_INDEX_FILE = \"model.safetensors.index.json\";\nvar RE_SAFETENSORS_FILE = /\\.safetensors$/;\nvar RE_SAFETENSORS_INDEX_FILE = /\\.safetensors\\.index\\.json$/;\nvar RE_SAFETENSORS_SHARD_FILE = /^(?<prefix>(?<basePrefix>.*?)[_-])(?<shard>\\d{5})-of-(?<total>\\d{5})\\.safetensors$/;\nfunction parseSafetensorsShardFilename(filename) {\n const match = RE_SAFETENSORS_SHARD_FILE.exec(filename);\n if (match && match.groups) {\n return {\n prefix: match.groups[\"prefix\"],\n basePrefix: match.groups[\"basePrefix\"],\n shard: match.groups[\"shard\"],\n total: match.groups[\"total\"]\n };\n }\n return null;\n}\nvar PARALLEL_DOWNLOADS = 20;\nvar MAX_HEADER_LENGTH = 25e6;\nvar SafetensorParseError = class extends Error {\n};\nasync function parseSingleFile(path, params) {\n const firstResp = await downloadFile({\n ...params,\n path,\n range: [0, 7]\n });\n if (!firstResp) {\n throw new SafetensorParseError(`Failed to parse file ${path}: failed to fetch safetensors header length.`);\n }\n const bufLengthOfHeaderLE = await firstResp.arrayBuffer();\n const lengthOfHeader = new DataView(bufLengthOfHeaderLE).getBigUint64(0, true);\n if (lengthOfHeader <= 0) {\n throw new SafetensorParseError(`Failed to parse file ${path}: safetensors header is malformed.`);\n }\n if (lengthOfHeader > MAX_HEADER_LENGTH) {\n throw new SafetensorParseError(\n `Failed to parse file ${path}: safetensor header is too big. Maximum supported size is ${MAX_HEADER_LENGTH} bytes.`\n );\n }\n const secondResp = await downloadFile({ ...params, path, range: [8, 7 + Number(lengthOfHeader)] });\n if (!secondResp) {\n throw new SafetensorParseError(`Failed to parse file ${path}: failed to fetch safetensors header.`);\n }\n try {\n const header = await secondResp.json();\n return header;\n } catch (err) {\n throw new SafetensorParseError(`Failed to parse file ${path}: safetensors header is not valid JSON.`);\n }\n}\nasync function parseShardedIndex(path, params) {\n const indexResp = await downloadFile({\n ...params,\n path,\n range: [0, 1e7]\n });\n if (!indexResp) {\n throw new SafetensorParseError(`Failed to parse file ${path}: failed to fetch safetensors index.`);\n }\n let index;\n try {\n index = await indexResp.json();\n } catch (error) {\n throw new SafetensorParseError(`Failed to parse file ${path}: not a valid JSON.`);\n }\n const pathPrefix = path.slice(0, path.lastIndexOf(\"/\") + 1);\n const filenames = [...new Set(Object.values(index.weight_map))];\n const shardedMap = Object.fromEntries(\n await promisesQueue(\n filenames.map(\n (filename) => async () => [filename, await parseSingleFile(pathPrefix + filename, params)]\n ),\n PARALLEL_DOWNLOADS\n )\n );\n return { index, headers: shardedMap };\n}\nasync function parseSafetensorsMetadata(params) {\n var _a, _b, _c, _d;\n const repoId = toRepoId(params.repo);\n if (repoId.type !== \"model\") {\n throw new TypeError(\"Only model repos should contain safetensors files.\");\n }\n if (RE_SAFETENSORS_FILE.test((_a = params.path) != null ? _a : \"\") || await fileExists({ ...params, path: SAFETENSORS_FILE })) {\n const header = await parseSingleFile((_b = params.path) != null ? _b : SAFETENSORS_FILE, params);\n return {\n sharded: false,\n header,\n ...params.computeParametersCount && {\n parameterCount: computeNumOfParamsByDtypeSingleFile(header)\n }\n };\n } else if (RE_SAFETENSORS_INDEX_FILE.test((_c = params.path) != null ? _c : \"\") || await fileExists({ ...params, path: SAFETENSORS_INDEX_FILE })) {\n const { index, headers } = await parseShardedIndex((_d = params.path) != null ? _d : SAFETENSORS_INDEX_FILE, params);\n return {\n sharded: true,\n index,\n headers,\n ...params.computeParametersCount && {\n parameterCount: computeNumOfParamsByDtypeSharded(headers)\n }\n };\n } else {\n throw new Error(\"model id does not seem to contain safetensors weights\");\n }\n}\nfunction computeNumOfParamsByDtypeSingleFile(header) {\n var _a;\n const counter = {};\n const tensors = omit(header, \"__metadata__\");\n for (const [, v] of typedEntries(tensors)) {\n if (v.shape.length === 0) {\n continue;\n }\n counter[v.dtype] = ((_a = counter[v.dtype]) != null ? _a : 0) + v.shape.reduce((a, b) => a * b);\n }\n return counter;\n}\nfunction computeNumOfParamsByDtypeSharded(shardedMap) {\n var _a;\n const counter = {};\n for (const header of Object.values(shardedMap)) {\n for (const [k, v] of typedEntries(computeNumOfParamsByDtypeSingleFile(header))) {\n counter[k] = ((_a = counter[k]) != null ? _a : 0) + (v != null ? v : 0);\n }\n }\n return counter;\n}\n\n// src/lib/paths-info.ts\nasync function pathsInfo(params) {\n var _a, _b, _c;\n const accessToken = checkCredentials(params);\n const repoId = toRepoId(params.repo);\n const hubUrl = (_a = params.hubUrl) != null ? _a : HUB_URL;\n const url = `${hubUrl}/api/${repoId.type}s/${repoId.name}/paths-info/${encodeURIComponent(\n (_b = params.revision) != null ? _b : \"main\"\n )}`;\n const resp = await ((_c = params.fetch) != null ? _c : fetch)(url, {\n method: \"POST\",\n headers: {\n ...accessToken && {\n Authorization: `Bearer ${accessToken}`\n },\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n paths: params.paths,\n expand: params.expand\n })\n });\n if (!resp.ok) {\n throw await createApiError(resp);\n }\n const json = await resp.json();\n if (!Array.isArray(json))\n throw new Error(\"malformed response: expected array\");\n return json.map((item) => ({\n path: item.path,\n lfs: item.lfs,\n type: item.type,\n oid: item.oid,\n size: item.size,\n // expand fields\n securityFileStatus: item.securityFileStatus,\n lastCommit: item.lastCommit ? {\n date: new Date(item.lastCommit.date),\n title: item.lastCommit.title,\n id: item.lastCommit.id\n } : void 0\n }));\n}\n\n// src/lib/space-info.ts\nasync function spaceInfo(params) {\n var _a, _b, _c;\n const accessToken = params && checkCredentials(params);\n const search = new URLSearchParams([\n ...SPACE_EXPAND_KEYS.map((val) => [\"expand\", val]),\n ...(_b = (_a = params == null ? void 0 : params.additionalFields) == null ? void 0 : _a.map((val) => [\"expand\", val])) != null ? _b : []\n ]).toString();\n const response = await (params.fetch || fetch)(\n `${(params == null ? void 0 : params.hubUrl) || HUB_URL}/api/spaces/${params.name}/revision/${encodeURIComponent(\n (_c = params.revision) != null ? _c : \"HEAD\"\n )}?${search.toString()}`,\n {\n headers: {\n ...accessToken ? { Authorization: `Bearer ${accessToken}` } : {},\n Accepts: \"application/json\"\n }\n }\n );\n if (!response.ok) {\n throw await createApiError(response);\n }\n const data = await response.json();\n return {\n ...(params == null ? void 0 : params.additionalFields) && pick(data, params.additionalFields),\n id: data._id,\n name: data.id,\n sdk: data.sdk,\n likes: data.likes,\n private: data.private,\n updatedAt: new Date(data.lastModified)\n };\n}\n\n// src/lib/upload-file.ts\nfunction uploadFile(params) {\n var _a, _b;\n const path = params.file instanceof URL ? (_a = params.file.pathname.split(\"/\").at(-1)) != null ? _a : \"file\" : \"path\" in params.file ? params.file.path : params.file.name;\n return commit({\n ...params.accessToken ? { accessToken: params.accessToken } : { credentials: params.credentials },\n repo: params.repo,\n operations: [\n {\n operation: \"addOrUpdate\",\n path,\n content: \"content\" in params.file ? params.file.content : params.file\n }\n ],\n title: (_b = params.commitTitle) != null ? _b : `Add ${path}`,\n description: params.commitDescription,\n hubUrl: params.hubUrl,\n branch: params.branch,\n isPullRequest: params.isPullRequest,\n parentCommit: params.parentCommit,\n fetch: params.fetch,\n useWebWorkers: params.useWebWorkers,\n abortSignal: params.abortSignal\n });\n}\n\n// src/lib/upload-files.ts\nfunction uploadFiles(params) {\n var _a;\n return commit({\n ...params.accessToken ? { accessToken: params.accessToken } : { credentials: params.credentials },\n repo: params.repo,\n operations: params.files.map((file) => {\n var _a2;\n return {\n operation: \"addOrUpdate\",\n path: file instanceof URL ? (_a2 = file.pathname.split(\"/\").at(-1)) != null ? _a2 : \"file\" : \"path\" in file ? file.path : file.name,\n content: \"content\" in file ? file.content : file\n };\n }),\n title: (_a = params.commitTitle) != null ? _a : `Add ${params.files.length} files`,\n description: params.commitDescription,\n hubUrl: params.hubUrl,\n branch: params.branch,\n isPullRequest: params.isPullRequest,\n parentCommit: params.parentCommit,\n fetch: params.fetch,\n useWebWorkers: params.useWebWorkers,\n abortSignal: params.abortSignal\n });\n}\n\n// src/lib/upload-files-with-progress.ts\nvar multipartUploadTracking = /* @__PURE__ */ new WeakMap();\nasync function* uploadFilesWithProgress(params) {\n var _a;\n return yield* commitIter({\n ...params.accessToken ? { accessToken: params.accessToken } : { credentials: params.credentials },\n repo: params.repo,\n operations: params.files.map((file) => {\n var _a2;\n return {\n operation: \"addOrUpdate\",\n path: file instanceof URL ? (_a2 = file.pathname.split(\"/\").at(-1)) != null ? _a2 : \"file\" : \"path\" in file ? file.path : file.name,\n content: \"content\" in file ? file.content : file\n };\n }),\n title: (_a = params.commitTitle) != null ? _a : `Add ${params.files.length} files`,\n description: params.commitDescription,\n hubUrl: params.hubUrl,\n branch: params.branch,\n isPullRequest: params.isPullRequest,\n parentCommit: params.parentCommit,\n useWebWorkers: params.useWebWorkers,\n abortSignal: params.abortSignal,\n fetch: async (input, init) => {\n var _a2;\n if (!init) {\n return fetch(input);\n }\n if (!typedInclude([\"PUT\", \"POST\"], init.method) || !(\"progressHint\" in init) || !init.progressHint || typeof XMLHttpRequest === \"undefined\" || typeof input !== \"string\" || !(init.body instanceof ArrayBuffer) && !(init.body instanceof Blob) && !(init.body instanceof File) && typeof init.body !== \"string\") {\n return fetch(input, init);\n }\n const progressHint = init.progressHint;\n const progressCallback = progressHint.progressCallback;\n const xhr = new XMLHttpRequest();\n xhr.upload.addEventListener(\"progress\", (event) => {\n if (event.lengthComputable) {\n if (progressHint.part !== void 0) {\n let tracking = multipartUploadTracking.get(progressCallback);\n if (!tracking) {\n tracking = { numParts: progressHint.numParts, partsProgress: {} };\n multipartUploadTracking.set(progressCallback, tracking);\n }\n tracking.partsProgress[progressHint.part] = event.loaded / event.total;\n let totalProgress = 0;\n for (const partProgress of Object.values(tracking.partsProgress)) {\n totalProgress += partProgress;\n }\n if (totalProgress === tracking.numParts) {\n progressCallback(0.9999999999);\n } else {\n progressCallback(totalProgress / tracking.numParts);\n }\n } else {\n if (event.loaded === event.total) {\n progressCallback(0.9999999999);\n } else {\n progressCallback(event.loaded / event.total);\n }\n }\n }\n });\n xhr.open(init.method, input, true);\n if (init.headers) {\n const headers = new Headers(init.headers);\n headers.forEach((value, key) => {\n xhr.setRequestHeader(key, value);\n });\n }\n (_a2 = init.signal) == null ? void 0 : _a2.throwIfAborted();\n xhr.send(init.body);\n return new Promise((resolve2, reject) => {\n xhr.addEventListener(\"load\", () => {\n resolve2(\n new Response(xhr.responseText, {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: Object.fromEntries(\n xhr.getAllResponseHeaders().trim().split(\"\\n\").map((header) => [header.slice(0, header.indexOf(\":\")), header.slice(header.indexOf(\":\") + 1).trim()])\n )\n })\n );\n });\n xhr.addEventListener(\"error\", () => {\n reject(new Error(xhr.statusText));\n });\n if (init.signal) {\n init.signal.addEventListener(\"abort\", () => {\n var _a3;\n xhr.abort();\n try {\n (_a3 = init.signal) == null ? void 0 : _a3.throwIfAborted();\n } catch (err) {\n reject(err);\n }\n });\n }\n });\n }\n });\n}\n\n// src/lib/who-am-i.ts\nasync function whoAmI(params) {\n var _a, _b, _c;\n const accessToken = checkCredentials(params);\n const res = await ((_a = params.fetch) != null ? _a : fetch)(`${(_b = params.hubUrl) != null ? _b : HUB_URL}/api/whoami-v2`, {\n headers: {\n Authorization: `Bearer ${accessToken}`\n }\n });\n if (!res.ok) {\n throw await createApiError(res);\n }\n const response = await res.json();\n if (typeof ((_c = response.auth.accessToken) == null ? void 0 : _c.createdAt) === \"string\") {\n response.auth.accessToken.createdAt = new Date(response.auth.accessToken.createdAt);\n }\n return response;\n}\nexport {\n DATASET_EXPANDABLE_KEYS,\n DATASET_EXPAND_KEYS,\n HubApiError,\n InvalidApiResponseFormatError,\n MODEL_EXPANDABLE_KEYS,\n MODEL_EXPAND_KEYS,\n RE_SAFETENSORS_FILE,\n RE_SAFETENSORS_INDEX_FILE,\n RE_SAFETENSORS_SHARD_FILE,\n SAFETENSORS_FILE,\n SAFETENSORS_INDEX_FILE,\n SPACE_EXPANDABLE_KEYS,\n SPACE_EXPAND_KEYS,\n sha256 as __internal_sha256,\n checkRepoAccess,\n commit,\n commitIter,\n countCommits,\n createRepo,\n datasetInfo,\n deleteFile,\n deleteFiles,\n deleteRepo,\n downloadFile,\n fileDownloadInfo,\n fileExists,\n listCommits,\n listDatasets,\n listFiles,\n listModels,\n listSpaces,\n modelInfo,\n oauthHandleRedirect,\n oauthHandleRedirectIfPresent,\n oauthLoginUrl,\n parseSafetensorsMetadata,\n parseSafetensorsShardFilename,\n pathsInfo,\n spaceInfo,\n uploadFile,\n uploadFiles,\n uploadFilesWithProgress,\n whoAmI\n};\n","import { oauthLoginUrl, oauthHandleRedirectIfPresent } from \"@huggingface/hub\";\n\n// Get UI elements\nconst signinButton = document.getElementById(\"signin\") as HTMLImageElement;\nconst signoutButton = document.getElementById(\"signout\") as HTMLButtonElement;\nconst preElement = document.querySelector(\"pre\") as HTMLPreElement;\n\n// Show/hide UI elements based on auth state\nfunction updateUI(isLoggedIn: boolean) {\n signinButton.style.display = isLoggedIn ? \"none\" : \"block\";\n signoutButton.style.display = isLoggedIn ? \"block\" : \"none\";\n}\n\nasync function handleOAuth() {\n try {\n const oauthResult = await oauthHandleRedirectIfPresent();\n\n if (oauthResult) {\n // We have OAuth results, display them\n preElement.textContent = JSON.stringify(oauthResult, null, 2);\n updateUI(true);\n } else {\n // No OAuth results, show sign-in button\n updateUI(false);\n }\n\n return oauthResult;\n } catch (error) {\n console.error(\"OAuth error:\", error);\n preElement.textContent = \"Error: \" + (error as Error).message;\n updateUI(false);\n throw error;\n }\n}\n\n// Handle sign-in click\nsigninButton.addEventListener(\"click\", async () => {\n const loginUrl = await oauthLoginUrl();\n window.location.href = loginUrl;\n});\n\n// Handle sign-out click\nsignoutButton.addEventListener(\"click\", () => {\n // Clear the display and reset UI\n preElement.textContent = \"\";\n updateUI(false);\n // You might want to add additional logout logic here\n});\n\n// Initialize OAuth handling\nhandleOAuth().catch(console.error);\n"],"names":["__defProp","__defNormalProp","obj","key","value","__publicField","HUB_URL","createApiError","response","opts","_a","_b","error","HubApiError","trailer","json","url","statusCode","requestId","message","r","base64FromBytes","arr","bin","byte","oauthHandleRedirect","_c","redirectedUrl","searchParams","errorDescription","code","nonce","codeVerifier","state","parsedState","hubUrl","openidConfigUrl","openidConfigRes","openidConfig","tokenRes","token","accessTokenExpiresAt","userInfoRes","userInfo","oauthHandleRedirectIfPresent","oauthLoginUrl","opendidConfig","newNonce","newCodeVerifier","redirectUri","variables","clientId","challenge","signinButton","signoutButton","preElement","updateUI","isLoggedIn","handleOAuth","oauthResult","loginUrl"],"mappings":"ssBAAA,IAAIA,EAAY,OAAO,eACnBC,EAAkB,CAACC,EAAKC,EAAKC,IAAUD,KAAOD,EAAMF,EAAUE,EAAKC,EAAK,CAAE,WAAY,GAAM,aAAc,GAAM,SAAU,GAAM,MAAAC,CAAK,CAAE,EAAIF,EAAIC,CAAG,EAAIC,EACtJC,EAAgB,CAACH,EAAKC,EAAKC,KAC7BH,EAAgBC,EAAK,OAAOC,GAAQ,SAAWA,EAAM,GAAKA,EAAKC,CAAK,EAC7DA,GCCLE,EAAU,yBAGd,eAAeC,EAAeC,EAAUC,EAAM,CAC5C,IAAIC,EAAIC,EACR,MAAMC,EAAQ,IAAIC,EAAYL,EAAS,IAAKA,EAAS,QAASE,EAAKF,EAAS,QAAQ,IAAI,cAAc,IAAM,KAAOE,EAAoB,MAAuB,EAC9JE,EAAM,QAAU,yBAAyBA,EAAM,UAAU,GACzD,MAAME,EAAU,CAAC,QAAQF,EAAM,GAAG,GAAIA,EAAM,UAAY,eAAeA,EAAM,SAAS,GAAK,MAAM,EAAE,OAAO,OAAO,EAAE,KAAK,IAAI,EAC5H,IAAKD,EAAKH,EAAS,QAAQ,IAAI,cAAc,IAAM,MAAgBG,EAAG,WAAW,kBAAkB,EAAG,CACpG,MAAMI,EAAO,MAAMP,EAAS,KAAM,EAClCI,EAAM,QAAUG,EAAK,OAASA,EAAK,SAAWH,EAAM,QAChDG,EAAK,oBACPH,EAAM,QAAUA,EAAM,QAAUA,EAAM,QAAU,KAAKG,EAAK,iBAAiB,GAAKA,EAAK,mBAEvFH,EAAM,KAAOG,CACjB,MACIH,EAAM,KAAO,CAAE,QAAS,MAAMJ,EAAS,KAAI,CAAI,EAEjD,MAAAI,EAAM,SAAW,KAAKE,CAAO,GACvBF,CACR,CACA,IAAIC,EAAc,cAAc,KAAM,CACpC,YAAYG,EAAKC,EAAYC,EAAWC,EAAS,CAC/C,MAAMA,CAAO,EACbd,EAAc,KAAM,YAAY,EAChCA,EAAc,KAAM,KAAK,EACzBA,EAAc,KAAM,WAAW,EAC/BA,EAAc,KAAM,MAAM,EAC1B,KAAK,WAAaY,EAClB,KAAK,UAAYC,EACjB,KAAK,IAAMF,CACf,CACA,EAuNkB,IAAI,QAASI,GAAM,CAErC,CAAC,EAsND,SAASC,EAAgBC,EAAK,CAC5B,GAAI,WAAW,OACb,OAAO,WAAW,OAAO,KAAKA,CAAG,EAAE,SAAS,QAAQ,EAC/C,CACL,MAAMC,EAAM,CAAE,EACd,OAAAD,EAAI,QAASE,GAAS,CACpBD,EAAI,KAAK,OAAO,aAAaC,CAAI,CAAC,CACxC,CAAK,EACM,WAAW,KAAKD,EAAI,KAAK,EAAE,CAAC,CACvC,CACA,CAy9BA,eAAeE,EAAoBhB,EAAM,CACvC,IAAIC,EAAIC,EAAIe,EACZ,GAAI,OAAO,OAAW,IACpB,MAAM,IAAI,MAAM,wFAAwF,EAE1G,GAAI,OAAO,aAAiB,IAC1B,MAAM,IAAI,MACR,sGACD,EAEH,MAAMC,GAAiBjB,EAAoB,SAAgC,KAAOA,EAAK,OAAO,SAAS,KACjGkB,GAAgB,IAAM,CAC1B,GAAI,CACF,OAAO,IAAI,IAAID,CAAa,EAAE,YAC/B,MAAa,CACZ,MAAM,IAAI,MAAM,mCAAqCA,CAAa,CACxE,CACA,GAAM,EACE,CAACf,EAAOiB,CAAgB,EAAI,CAACD,EAAa,IAAI,OAAO,EAAGA,EAAa,IAAI,mBAAmB,CAAC,EACnG,GAAIhB,EACF,MAAM,IAAI,MAAM,GAAGA,CAAK,KAAKiB,CAAgB,EAAE,EAEjD,MAAMC,EAAOF,EAAa,IAAI,MAAM,EAC9BG,GAASpB,EAAoB,SAAwB,KAAOA,EAAK,aAAa,QAAQ,4BAA4B,EACxH,GAAI,CAACmB,EACH,MAAM,IAAI,MAAM,+DAAiEH,CAAa,EAEhG,GAAI,CAACI,EACH,MAAM,IAAI,MAAM,uCAAuC,EAEzD,MAAMC,GAAgBN,EAAoB,SAA+B,KAAOA,EAAK,aAAa,QAAQ,oCAAoC,EAC9I,GAAI,CAACM,EACH,MAAM,IAAI,MAAM,+CAA+C,EAEjE,MAAMC,EAAQL,EAAa,IAAI,OAAO,EACtC,GAAI,CAACK,EACH,MAAM,IAAI,MAAM,6DAA6D,EAE/E,IAAIC,EACJ,GAAI,CACFA,EAAc,KAAK,MAAMD,CAAK,CAC/B,MAAW,CACV,MAAM,IAAI,MAAM,gEAAkEA,CAAK,CAC3F,CACE,GAAIC,EAAY,QAAUH,EACxB,MAAM,IAAI,MAAM,uCAAuC,EAEzD,MAAMI,EAAkD7B,EAClD8B,EAAkB,GAAG,IAAI,IAAID,CAAM,EAAE,MAAM,oCAC3CE,EAAkB,MAAM,MAAMD,EAAiB,CACnD,QAAS,CACP,OAAQ,kBACd,CACA,CAAG,EACD,GAAI,CAACC,EAAgB,GACnB,MAAM,MAAM9B,EAAe8B,CAAe,EAE5C,MAAMC,EAAe,MAAMD,EAAgB,KAAM,EAC3CE,EAAW,MAAM,MAAMD,EAAa,eAAgB,CACxD,OAAQ,OACR,QAAS,CACP,eAAgB,mCACjB,EACD,KAAM,IAAI,gBAAgB,CACxB,WAAY,qBACZ,KAAAR,EACA,aAAcI,EAAY,YAC1B,cAAeF,CAChB,CAAA,EAAE,SAAQ,CACf,CAAG,EAOD,GALE,aAAa,WAAW,oCAAoC,EAG5D,aAAa,WAAW,4BAA4B,EAElD,CAACO,EAAS,GACZ,MAAM,MAAMhC,EAAegC,CAAQ,EAErC,MAAMC,EAAQ,MAAMD,EAAS,KAAM,EAC7BE,EAAuB,IAAI,KAAK,KAAK,IAAG,EAAKD,EAAM,WAAa,GAAG,EACnEE,EAAc,MAAM,MAAMJ,EAAa,kBAAmB,CAC9D,QAAS,CACP,cAAe,UAAUE,EAAM,YAAY,EACjD,CACA,CAAG,EACD,GAAI,CAACE,EAAY,GACf,MAAM,MAAMnC,EAAemC,CAAW,EAExC,MAAMC,EAAW,MAAMD,EAAY,KAAM,EACzC,MAAO,CACL,YAAaF,EAAM,aACnB,qBAAAC,EACA,SAAAE,EACA,MAAOT,EAAY,MACnB,MAAOM,EAAM,KACd,CACH,CACA,eAAeI,EAA6BnC,EAAM,CAChD,IAAIC,EACJ,GAAI,OAAO,OAAW,IACpB,MAAM,IAAI,MAAM,wFAAwF,EAE1G,GAAI,OAAO,aAAiB,IAC1B,MAAM,IAAI,MACR,sGACD,EAEH,MAAMkB,EAAe,IAAI,iBAAiBlB,EAAoB,SAAgC,KAAOA,EAAK,OAAO,SAAS,MAAM,EAChI,OAAIkB,EAAa,IAAI,OAAO,EACnBH,EAAwB,EAE7BG,EAAa,IAAI,MAAM,EACpB,aAAa,QAAQ,4BAA4B,EAM/CH,EAAwB,GAL7B,QAAQ,KACN,qIACD,EACM,IAIJ,EACT,CAGA,eAAeoB,EAAcpC,EAAM,CACjC,IAAIC,EAAIC,EACR,GAAI,OAAO,OAAW,IACpB,MAAM,IAAI,MAAM,0FAA0F,EAE5G,GAAI,OAAO,aAAiB,IAC1B,MAAM,IAAI,MACR,6HACD,EAEH,MAAMwB,EAAkD7B,EAClD8B,EAAkB,GAAG,IAAI,IAAID,CAAM,EAAE,MAAM,oCAC3CE,EAAkB,MAAM,MAAMD,EAAiB,CACnD,QAAS,CACP,OAAQ,kBACd,CACA,CAAG,EACD,GAAI,CAACC,EAAgB,GACnB,MAAM,MAAM9B,EAAe8B,CAAe,EAE5C,MAAMS,EAAgB,MAAMT,EAAgB,KAAM,EAC5CU,EAAW,WAAW,OAAO,WAAY,EACzCC,EAAkB,WAAW,OAAO,WAAU,EAAK,WAAW,OAAO,WAAY,EAerF,aAAa,QAAQ,6BAA8BD,CAAQ,EAC3D,aAAa,QAAQ,qCAAsCC,CAAe,EAE5E,MAAMC,EAA6D,OAAO,OAAW,IAAc,OAAO,SAAS,KAAO,OAC1H,GAAI,CAACA,EACH,MAAM,IAAI,MAAM,qBAAqB,EAEvC,MAAMhB,EAAQ,KAAK,UAAU,CAC3B,MAAOc,EACP,YAAAE,EACA,MAAsB,MAC1B,CAAG,EACKC,EAEJ,OAAO,OAAW,MAAevC,GAAMD,EAAK,OAAO,cAAgB,KAAO,OAASA,EAAG,YAAc,KAAOC,EAAY,KAEnHwC,EAAuDD,GAAa,KAAO,OAASA,EAAU,gBACpG,GAAI,CAACC,EACH,MAAID,EACI,IAAI,MAAM,8FAA8F,EAE1G,IAAI,MAAM,kBAAkB,EAEpC,MAAME,EAAY/B,EAChB,IAAI,WAAW,MAAM,WAAW,OAAO,OAAO,OAAO,UAAW,IAAI,YAAW,EAAG,OAAO2B,CAAe,CAAC,CAAC,CAC3G,EAAC,QAAQ,OAAQ,GAAG,EAAE,QAAQ,OAAQ,GAAG,EAAE,QAAQ,KAAM,EAAE,EAC5D,MAAO,GAAGF,EAAc,sBAAsB,IAAI,IAAI,gBAAgB,CACpE,UAAWK,EACX,OAAiDD,GAAa,KAAO,OAASA,EAAU,eAAiB,iBACzG,cAAe,OACf,aAAcD,EACd,MAAAhB,EACA,eAAgBmB,EAChB,sBAAuB,MAC3B,CAAG,EAAE,SAAQ,CAAE,EACf,CCznDA,MAAMC,EAAe,SAAS,eAAe,QAAQ,EAC/CC,EAAgB,SAAS,eAAe,SAAS,EACjDC,EAAa,SAAS,cAAc,KAAK,EAG/C,SAASC,EAASC,EAAqB,CACxBJ,EAAA,MAAM,QAAUI,EAAa,OAAS,QACrCH,EAAA,MAAM,QAAUG,EAAa,QAAU,MACvD,CAEA,eAAeC,GAAc,CACvB,GAAA,CACI,MAAAC,EAAc,MAAMf,EAA6B,EAEvD,OAAIe,GAEFJ,EAAW,YAAc,KAAK,UAAUI,EAAa,KAAM,CAAC,EAC5DH,EAAS,EAAI,GAGbA,EAAS,EAAK,EAGTG,QACA/C,EAAO,CACN,cAAA,MAAM,eAAgBA,CAAK,EACxB2C,EAAA,YAAc,UAAa3C,EAAgB,QACtD4C,EAAS,EAAK,EACR5C,CAAA,CAEV,CAGAyC,EAAa,iBAAiB,QAAS,SAAY,CAC3C,MAAAO,EAAW,MAAMf,EAAc,EACrC,OAAO,SAAS,KAAOe,CACzB,CAAC,EAGDN,EAAc,iBAAiB,QAAS,IAAM,CAE5CC,EAAW,YAAc,GACzBC,EAAS,EAAK,CAEhB,CAAC,EAGDE,IAAc,MAAM,QAAQ,KAAK","x_google_ignoreList":[0,1]}
 
 
dist/index.html DELETED
@@ -1,21 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <script type="module" crossorigin src="/assets/index-DH6LWxsk.js"></script>
5
-
6
- <body>
7
- <div class="card" style="margin-bottom: 2rem;">
8
- <h1>OAuth in a static Space</h1>
9
- <p>Checkout the <a href="https://huggingface.co/spaces/huggingfacejs/client-side-oauth/blob/main/index.html"
10
- target="_blank">index.html</a> file to see the few lines of code
11
- enabling this space</p>
12
- <p>After clicking "Signin with HF", you will be redirected to this space and the access token + user info will
13
- be displayed.</p>
14
- </div>
15
- <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/sign-in-with-huggingface-xl-dark.svg"
16
- alt="Sign in with Hugging Face" style="cursor: pointer; display: none;" id="signin">
17
- <button id="signout" style="display: none">Sign out</button>
18
- <pre></pre>
19
- </body>
20
-
21
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dist/main.js ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // node_modules/@huggingface/hub/dist/index.mjs
2
+ var HUB_URL = "https://huggingface.co";
3
+ async function createApiError(response, opts) {
4
+ const error = new HubApiError(response.url, response.status, response.headers.get("X-Request-Id") ?? opts?.requestId);
5
+ error.message = `Api error with status ${error.statusCode}${opts?.message ? `. ${opts.message}` : ""}`;
6
+ const trailer = [`URL: ${error.url}`, error.requestId ? `Request ID: ${error.requestId}` : void 0].filter(Boolean).join(". ");
7
+ if (response.headers.get("Content-Type")?.startsWith("application/json")) {
8
+ const json = await response.json();
9
+ error.message = json.error || json.message || error.message;
10
+ if (json.error_description) {
11
+ error.message = error.message ? error.message + `: ${json.error_description}` : json.error_description;
12
+ }
13
+ error.data = json;
14
+ } else {
15
+ error.data = { message: await response.text() };
16
+ }
17
+ error.message += `. ${trailer}`;
18
+ throw error;
19
+ }
20
+ var HubApiError = class extends Error {
21
+ statusCode;
22
+ url;
23
+ requestId;
24
+ data;
25
+ constructor(url, statusCode, requestId, message) {
26
+ super(message);
27
+ this.statusCode = statusCode;
28
+ this.requestId = requestId;
29
+ this.url = url;
30
+ }
31
+ };
32
+ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
33
+ var isWebWorker = typeof self === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope";
34
+ var resolve;
35
+ var waitPromise = new Promise((r) => {
36
+ resolve = r;
37
+ });
38
+ function base64FromBytes(arr) {
39
+ if (globalThis.Buffer) {
40
+ return globalThis.Buffer.from(arr).toString("base64");
41
+ } else {
42
+ const bin = [];
43
+ arr.forEach((byte) => {
44
+ bin.push(String.fromCharCode(byte));
45
+ });
46
+ return globalThis.btoa(bin.join(""));
47
+ }
48
+ }
49
+ var REGEX_COMMIT_HASH = new RegExp("^[0-9a-f]{40}$");
50
+ async function oauthHandleRedirect(opts) {
51
+ if (typeof window === "undefined" && !opts?.redirectedUrl) {
52
+ throw new Error("oauthHandleRedirect is only available in the browser, unless you provide redirectedUrl");
53
+ }
54
+ if (typeof localStorage === "undefined" && (!opts?.nonce || !opts?.codeVerifier)) {
55
+ throw new Error(
56
+ "oauthHandleRedirect requires localStorage to be available, unless you provide nonce and codeVerifier"
57
+ );
58
+ }
59
+ const redirectedUrl = opts?.redirectedUrl ?? window.location.href;
60
+ const searchParams = (() => {
61
+ try {
62
+ return new URL(redirectedUrl).searchParams;
63
+ } catch (err) {
64
+ throw new Error("Failed to parse redirected URL: " + redirectedUrl);
65
+ }
66
+ })();
67
+ const [error, errorDescription] = [searchParams.get("error"), searchParams.get("error_description")];
68
+ if (error) {
69
+ throw new Error(`${error}: ${errorDescription}`);
70
+ }
71
+ const code = searchParams.get("code");
72
+ const nonce = opts?.nonce ?? localStorage.getItem("huggingface.co:oauth:nonce");
73
+ if (!code) {
74
+ throw new Error("Missing oauth code from query parameters in redirected URL: " + redirectedUrl);
75
+ }
76
+ if (!nonce) {
77
+ throw new Error("Missing oauth nonce from localStorage");
78
+ }
79
+ const codeVerifier = opts?.codeVerifier ?? localStorage.getItem("huggingface.co:oauth:code_verifier");
80
+ if (!codeVerifier) {
81
+ throw new Error("Missing oauth code_verifier from localStorage");
82
+ }
83
+ const state = searchParams.get("state");
84
+ if (!state) {
85
+ throw new Error("Missing oauth state from query parameters in redirected URL");
86
+ }
87
+ let parsedState;
88
+ try {
89
+ parsedState = JSON.parse(state);
90
+ } catch {
91
+ throw new Error("Invalid oauth state in redirected URL, unable to parse JSON: " + state);
92
+ }
93
+ if (parsedState.nonce !== nonce) {
94
+ throw new Error("Invalid oauth state in redirected URL");
95
+ }
96
+ const hubUrl = opts?.hubUrl || HUB_URL;
97
+ const openidConfigUrl = `${new URL(hubUrl).origin}/.well-known/openid-configuration`;
98
+ const openidConfigRes = await fetch(openidConfigUrl, {
99
+ headers: {
100
+ Accept: "application/json"
101
+ }
102
+ });
103
+ if (!openidConfigRes.ok) {
104
+ throw await createApiError(openidConfigRes);
105
+ }
106
+ const openidConfig = await openidConfigRes.json();
107
+ const tokenRes = await fetch(openidConfig.token_endpoint, {
108
+ method: "POST",
109
+ headers: {
110
+ "Content-Type": "application/x-www-form-urlencoded"
111
+ },
112
+ body: new URLSearchParams({
113
+ grant_type: "authorization_code",
114
+ code,
115
+ redirect_uri: parsedState.redirectUri,
116
+ code_verifier: codeVerifier
117
+ }).toString()
118
+ });
119
+ if (!opts?.codeVerifier) {
120
+ localStorage.removeItem("huggingface.co:oauth:code_verifier");
121
+ }
122
+ if (!opts?.nonce) {
123
+ localStorage.removeItem("huggingface.co:oauth:nonce");
124
+ }
125
+ if (!tokenRes.ok) {
126
+ throw await createApiError(tokenRes);
127
+ }
128
+ const token = await tokenRes.json();
129
+ const accessTokenExpiresAt = new Date(Date.now() + token.expires_in * 1e3);
130
+ const userInfoRes = await fetch(openidConfig.userinfo_endpoint, {
131
+ headers: {
132
+ Authorization: `Bearer ${token.access_token}`
133
+ }
134
+ });
135
+ if (!userInfoRes.ok) {
136
+ throw await createApiError(userInfoRes);
137
+ }
138
+ const userInfo = await userInfoRes.json();
139
+ return {
140
+ accessToken: token.access_token,
141
+ accessTokenExpiresAt,
142
+ userInfo,
143
+ state: parsedState.state,
144
+ scope: token.scope
145
+ };
146
+ }
147
+ async function oauthHandleRedirectIfPresent(opts) {
148
+ if (typeof window === "undefined" && !opts?.redirectedUrl) {
149
+ throw new Error("oauthHandleRedirect is only available in the browser, unless you provide redirectedUrl");
150
+ }
151
+ if (typeof localStorage === "undefined" && (!opts?.nonce || !opts?.codeVerifier)) {
152
+ throw new Error(
153
+ "oauthHandleRedirect requires localStorage to be available, unless you provide nonce and codeVerifier"
154
+ );
155
+ }
156
+ const searchParams = new URLSearchParams(opts?.redirectedUrl ?? window.location.search);
157
+ if (searchParams.has("error")) {
158
+ return oauthHandleRedirect(opts);
159
+ }
160
+ if (searchParams.has("code")) {
161
+ if (!localStorage.getItem("huggingface.co:oauth:nonce")) {
162
+ console.warn(
163
+ "Missing oauth nonce from localStorage. This can happen when the user refreshes the page after logging in, without changing the URL."
164
+ );
165
+ return false;
166
+ }
167
+ return oauthHandleRedirect(opts);
168
+ }
169
+ return false;
170
+ }
171
+ async function oauthLoginUrl(opts) {
172
+ if (typeof window === "undefined" && (!opts?.redirectUrl || !opts?.clientId)) {
173
+ throw new Error("oauthLogin is only available in the browser, unless you provide clientId and redirectUrl");
174
+ }
175
+ if (typeof localStorage === "undefined" && !opts?.localStorage) {
176
+ throw new Error(
177
+ "oauthLogin requires localStorage to be available in the context, unless you provide a localStorage empty object as argument"
178
+ );
179
+ }
180
+ const hubUrl = opts?.hubUrl || HUB_URL;
181
+ const openidConfigUrl = `${new URL(hubUrl).origin}/.well-known/openid-configuration`;
182
+ const openidConfigRes = await fetch(openidConfigUrl, {
183
+ headers: {
184
+ Accept: "application/json"
185
+ }
186
+ });
187
+ if (!openidConfigRes.ok) {
188
+ throw await createApiError(openidConfigRes);
189
+ }
190
+ const opendidConfig = await openidConfigRes.json();
191
+ const newNonce = globalThis.crypto.randomUUID();
192
+ const newCodeVerifier = globalThis.crypto.randomUUID() + globalThis.crypto.randomUUID();
193
+ if (opts?.localStorage) {
194
+ if (opts.localStorage.codeVerifier !== void 0 && opts.localStorage.codeVerifier !== null) {
195
+ throw new Error(
196
+ "localStorage.codeVerifier must be a initially set to null or undefined, and will be filled by oauthLoginUrl"
197
+ );
198
+ }
199
+ if (opts.localStorage.nonce !== void 0 && opts.localStorage.nonce !== null) {
200
+ throw new Error(
201
+ "localStorage.nonce must be a initially set to null or undefined, and will be filled by oauthLoginUrl"
202
+ );
203
+ }
204
+ opts.localStorage.codeVerifier = newCodeVerifier;
205
+ opts.localStorage.nonce = newNonce;
206
+ } else {
207
+ localStorage.setItem("huggingface.co:oauth:nonce", newNonce);
208
+ localStorage.setItem("huggingface.co:oauth:code_verifier", newCodeVerifier);
209
+ }
210
+ const redirectUri = opts?.redirectUrl || (typeof window !== "undefined" ? window.location.href : void 0);
211
+ if (!redirectUri) {
212
+ throw new Error("Missing redirectUrl");
213
+ }
214
+ const state = JSON.stringify({
215
+ nonce: newNonce,
216
+ redirectUri,
217
+ state: opts?.state
218
+ });
219
+ const variables = (
220
+ // @ts-expect-error window.huggingface is defined inside static Spaces.
221
+ typeof window !== "undefined" ? window.huggingface?.variables ?? null : null
222
+ );
223
+ const clientId = opts?.clientId || variables?.OAUTH_CLIENT_ID;
224
+ if (!clientId) {
225
+ if (variables) {
226
+ throw new Error("Missing clientId, please add hf_oauth: true to the README.md's metadata in your static Space");
227
+ }
228
+ throw new Error("Missing clientId");
229
+ }
230
+ const challenge = base64FromBytes(
231
+ new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(newCodeVerifier)))
232
+ ).replace(/[+]/g, "-").replace(/[/]/g, "_").replace(/=/g, "");
233
+ return `${opendidConfig.authorization_endpoint}?${new URLSearchParams({
234
+ client_id: clientId,
235
+ scope: opts?.scopes || variables?.OAUTH_SCOPES || "openid profile",
236
+ response_type: "code",
237
+ redirect_uri: redirectUri,
238
+ state,
239
+ code_challenge: challenge,
240
+ code_challenge_method: "S256"
241
+ }).toString()}`;
242
+ }
243
+
244
+ // src/main.ts
245
+ console.log("huggingface env", window.huggingface);
246
+ var oauthResult = null;
247
+ var storedOAuth = localStorage.getItem("oauth");
248
+ if (storedOAuth) {
249
+ try {
250
+ oauthResult = JSON.parse(storedOAuth);
251
+ } catch {
252
+ oauthResult = null;
253
+ }
254
+ }
255
+ var init = async () => {
256
+ oauthResult ||= await oauthHandleRedirectIfPresent();
257
+ if (oauthResult !== null && oauthResult !== false) {
258
+ const preElement = document.querySelector("pre");
259
+ if (preElement) {
260
+ preElement.textContent = JSON.stringify(oauthResult, null, 2);
261
+ }
262
+ localStorage.setItem("oauth", JSON.stringify(oauthResult));
263
+ const signoutButton = document.getElementById("signout");
264
+ if (signoutButton) {
265
+ signoutButton.style.removeProperty("display");
266
+ signoutButton.onclick = async function() {
267
+ localStorage.removeItem("oauth");
268
+ window.location.href = window.location.href.replace(/\?.*$/, "");
269
+ window.location.reload();
270
+ };
271
+ }
272
+ } else {
273
+ const signinButton = document.getElementById("signin");
274
+ if (signinButton) {
275
+ signinButton.style.removeProperty("display");
276
+ signinButton.onclick = async function() {
277
+ const loginUrl = await oauthLoginUrl({
278
+ scopes: window.huggingface?.variables?.OAUTH_SCOPES ?? ""
279
+ });
280
+ window.location.href = `${loginUrl}&prompt=consent`;
281
+ };
282
+ }
283
+ }
284
+ };
285
+ init().catch(console.error);
index.html CHANGED
@@ -1,20 +1,26 @@
1
  <!DOCTYPE html>
2
- <html>
 
 
 
 
 
 
 
3
 
4
  <body>
5
- <div class="card" style="margin-bottom: 2rem;">
6
- <h1>OAuth in a static Space</h1>
7
- <p>Checkout the <a href="https://huggingface.co/spaces/huggingfacejs/client-side-oauth/blob/main/index.html"
8
- target="_blank">index.html</a> file to see the few lines of code
9
- enabling this space</p>
10
- <p>After clicking "Signin with HF", you will be redirected to this space and the access token + user info will
11
- be displayed.</p>
 
 
 
12
  </div>
13
- <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/sign-in-with-huggingface-xl-dark.svg"
14
- alt="Sign in with Hugging Face" style="cursor: pointer; display: none;" id="signin">
15
- <button id="signout" style="display: none">Sign out</button>
16
- <pre></pre>
17
- <script type="module" src="./dist/index.ts"></script>
18
  </body>
19
 
20
  </html>
 
1
  <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>HuggingFace OAuth Demo</title>
8
+ <link rel="stylesheet" href="styles/main.css">
9
+ </head>
10
 
11
  <body>
12
+ <div id="app">
13
+ <h1>HuggingFace OAuth Demo</h1>
14
+ <div class="auth-container">
15
+ <button id="signin" style="display: none;" class="auth-button">Sign in with HuggingFace</button>
16
+ <button id="signout" style="display: none;" class="auth-button">Sign out</button>
17
+ </div>
18
+ <div id="content">
19
+ <h2>OAuth Result</h2>
20
+ <pre class="oauth-result"></pre>
21
+ </div>
22
  </div>
23
+ <script type="module" src="dist/main.js"></script>
 
 
 
 
24
  </body>
25
 
26
  </html>
package-lock.json CHANGED
@@ -1,25 +1,26 @@
1
  {
2
- "name": "apidemo",
3
  "version": "1.0.0",
4
  "lockfileVersion": 3,
5
  "requires": true,
6
  "packages": {
7
  "": {
8
- "name": "apidemo",
9
  "version": "1.0.0",
10
  "dependencies": {
11
  "@huggingface/hub": "^1.0.1",
12
- "typescript": "^5.7.3"
13
  },
14
  "devDependencies": {
15
- "@types/node": "^22.13.1",
16
- "vite": "^6.1.0"
 
17
  }
18
  },
19
  "node_modules/@esbuild/aix-ppc64": {
20
- "version": "0.24.2",
21
- "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz",
22
- "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==",
23
  "cpu": [
24
  "ppc64"
25
  ],
@@ -29,13 +30,13 @@
29
  "aix"
30
  ],
31
  "engines": {
32
- "node": ">=18"
33
  }
34
  },
35
  "node_modules/@esbuild/android-arm": {
36
- "version": "0.24.2",
37
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz",
38
- "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==",
39
  "cpu": [
40
  "arm"
41
  ],
@@ -45,13 +46,13 @@
45
  "android"
46
  ],
47
  "engines": {
48
- "node": ">=18"
49
  }
50
  },
51
  "node_modules/@esbuild/android-arm64": {
52
- "version": "0.24.2",
53
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz",
54
- "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==",
55
  "cpu": [
56
  "arm64"
57
  ],
@@ -61,13 +62,13 @@
61
  "android"
62
  ],
63
  "engines": {
64
- "node": ">=18"
65
  }
66
  },
67
  "node_modules/@esbuild/android-x64": {
68
- "version": "0.24.2",
69
- "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz",
70
- "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==",
71
  "cpu": [
72
  "x64"
73
  ],
@@ -77,13 +78,13 @@
77
  "android"
78
  ],
79
  "engines": {
80
- "node": ">=18"
81
  }
82
  },
83
  "node_modules/@esbuild/darwin-arm64": {
84
- "version": "0.24.2",
85
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz",
86
- "integrity": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==",
87
  "cpu": [
88
  "arm64"
89
  ],
@@ -93,13 +94,13 @@
93
  "darwin"
94
  ],
95
  "engines": {
96
- "node": ">=18"
97
  }
98
  },
99
  "node_modules/@esbuild/darwin-x64": {
100
- "version": "0.24.2",
101
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz",
102
- "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==",
103
  "cpu": [
104
  "x64"
105
  ],
@@ -109,13 +110,13 @@
109
  "darwin"
110
  ],
111
  "engines": {
112
- "node": ">=18"
113
  }
114
  },
115
  "node_modules/@esbuild/freebsd-arm64": {
116
- "version": "0.24.2",
117
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz",
118
- "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==",
119
  "cpu": [
120
  "arm64"
121
  ],
@@ -125,13 +126,13 @@
125
  "freebsd"
126
  ],
127
  "engines": {
128
- "node": ">=18"
129
  }
130
  },
131
  "node_modules/@esbuild/freebsd-x64": {
132
- "version": "0.24.2",
133
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz",
134
- "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==",
135
  "cpu": [
136
  "x64"
137
  ],
@@ -141,13 +142,13 @@
141
  "freebsd"
142
  ],
143
  "engines": {
144
- "node": ">=18"
145
  }
146
  },
147
  "node_modules/@esbuild/linux-arm": {
148
- "version": "0.24.2",
149
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz",
150
- "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==",
151
  "cpu": [
152
  "arm"
153
  ],
@@ -157,13 +158,13 @@
157
  "linux"
158
  ],
159
  "engines": {
160
- "node": ">=18"
161
  }
162
  },
163
  "node_modules/@esbuild/linux-arm64": {
164
- "version": "0.24.2",
165
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz",
166
- "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==",
167
  "cpu": [
168
  "arm64"
169
  ],
@@ -173,13 +174,13 @@
173
  "linux"
174
  ],
175
  "engines": {
176
- "node": ">=18"
177
  }
178
  },
179
  "node_modules/@esbuild/linux-ia32": {
180
- "version": "0.24.2",
181
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz",
182
- "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==",
183
  "cpu": [
184
  "ia32"
185
  ],
@@ -189,13 +190,13 @@
189
  "linux"
190
  ],
191
  "engines": {
192
- "node": ">=18"
193
  }
194
  },
195
  "node_modules/@esbuild/linux-loong64": {
196
- "version": "0.24.2",
197
- "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz",
198
- "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==",
199
  "cpu": [
200
  "loong64"
201
  ],
@@ -205,13 +206,13 @@
205
  "linux"
206
  ],
207
  "engines": {
208
- "node": ">=18"
209
  }
210
  },
211
  "node_modules/@esbuild/linux-mips64el": {
212
- "version": "0.24.2",
213
- "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz",
214
- "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==",
215
  "cpu": [
216
  "mips64el"
217
  ],
@@ -221,13 +222,13 @@
221
  "linux"
222
  ],
223
  "engines": {
224
- "node": ">=18"
225
  }
226
  },
227
  "node_modules/@esbuild/linux-ppc64": {
228
- "version": "0.24.2",
229
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz",
230
- "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==",
231
  "cpu": [
232
  "ppc64"
233
  ],
@@ -237,13 +238,13 @@
237
  "linux"
238
  ],
239
  "engines": {
240
- "node": ">=18"
241
  }
242
  },
243
  "node_modules/@esbuild/linux-riscv64": {
244
- "version": "0.24.2",
245
- "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz",
246
- "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==",
247
  "cpu": [
248
  "riscv64"
249
  ],
@@ -253,13 +254,13 @@
253
  "linux"
254
  ],
255
  "engines": {
256
- "node": ">=18"
257
  }
258
  },
259
  "node_modules/@esbuild/linux-s390x": {
260
- "version": "0.24.2",
261
- "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz",
262
- "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==",
263
  "cpu": [
264
  "s390x"
265
  ],
@@ -269,13 +270,13 @@
269
  "linux"
270
  ],
271
  "engines": {
272
- "node": ">=18"
273
  }
274
  },
275
  "node_modules/@esbuild/linux-x64": {
276
- "version": "0.24.2",
277
- "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz",
278
- "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==",
279
  "cpu": [
280
  "x64"
281
  ],
@@ -285,29 +286,13 @@
285
  "linux"
286
  ],
287
  "engines": {
288
- "node": ">=18"
289
- }
290
- },
291
- "node_modules/@esbuild/netbsd-arm64": {
292
- "version": "0.24.2",
293
- "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz",
294
- "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==",
295
- "cpu": [
296
- "arm64"
297
- ],
298
- "dev": true,
299
- "optional": true,
300
- "os": [
301
- "netbsd"
302
- ],
303
- "engines": {
304
- "node": ">=18"
305
  }
306
  },
307
  "node_modules/@esbuild/netbsd-x64": {
308
- "version": "0.24.2",
309
- "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz",
310
- "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==",
311
  "cpu": [
312
  "x64"
313
  ],
@@ -317,29 +302,13 @@
317
  "netbsd"
318
  ],
319
  "engines": {
320
- "node": ">=18"
321
- }
322
- },
323
- "node_modules/@esbuild/openbsd-arm64": {
324
- "version": "0.24.2",
325
- "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz",
326
- "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==",
327
- "cpu": [
328
- "arm64"
329
- ],
330
- "dev": true,
331
- "optional": true,
332
- "os": [
333
- "openbsd"
334
- ],
335
- "engines": {
336
- "node": ">=18"
337
  }
338
  },
339
  "node_modules/@esbuild/openbsd-x64": {
340
- "version": "0.24.2",
341
- "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz",
342
- "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==",
343
  "cpu": [
344
  "x64"
345
  ],
@@ -349,13 +318,13 @@
349
  "openbsd"
350
  ],
351
  "engines": {
352
- "node": ">=18"
353
  }
354
  },
355
  "node_modules/@esbuild/sunos-x64": {
356
- "version": "0.24.2",
357
- "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz",
358
- "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==",
359
  "cpu": [
360
  "x64"
361
  ],
@@ -365,13 +334,13 @@
365
  "sunos"
366
  ],
367
  "engines": {
368
- "node": ">=18"
369
  }
370
  },
371
  "node_modules/@esbuild/win32-arm64": {
372
- "version": "0.24.2",
373
- "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz",
374
- "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==",
375
  "cpu": [
376
  "arm64"
377
  ],
@@ -381,13 +350,13 @@
381
  "win32"
382
  ],
383
  "engines": {
384
- "node": ">=18"
385
  }
386
  },
387
  "node_modules/@esbuild/win32-ia32": {
388
- "version": "0.24.2",
389
- "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz",
390
- "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==",
391
  "cpu": [
392
  "ia32"
393
  ],
@@ -397,13 +366,13 @@
397
  "win32"
398
  ],
399
  "engines": {
400
- "node": ">=18"
401
  }
402
  },
403
  "node_modules/@esbuild/win32-x64": {
404
- "version": "0.24.2",
405
- "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz",
406
- "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==",
407
  "cpu": [
408
  "x64"
409
  ],
@@ -413,7 +382,7 @@
413
  "win32"
414
  ],
415
  "engines": {
416
- "node": ">=18"
417
  }
418
  },
419
  "node_modules/@huggingface/hub": {
@@ -427,430 +396,629 @@
427
  "node": ">=18"
428
  }
429
  },
 
 
 
 
 
 
 
 
 
 
 
430
  "node_modules/@huggingface/tasks": {
431
  "version": "0.15.9",
432
  "resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.15.9.tgz",
433
  "integrity": "sha512-cbnZcpMHKdhURWIplVP4obHxAZcxjyRm0zI7peTPksZN4CtIOMmJC4ZqGEymo0lk+0VNkXD7ULwFJ3JjT/VpkQ=="
434
  },
435
- "node_modules/@rollup/rollup-android-arm-eabi": {
436
- "version": "4.34.6",
437
- "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.6.tgz",
438
- "integrity": "sha512-+GcCXtOQoWuC7hhX1P00LqjjIiS/iOouHXhMdiDSnq/1DGTox4SpUvO52Xm+div6+106r+TcvOeo/cxvyEyTgg==",
439
- "cpu": [
440
- "arm"
441
- ],
442
  "dev": true,
443
- "optional": true,
444
- "os": [
445
- "android"
446
- ]
 
 
 
 
 
447
  },
448
- "node_modules/@rollup/rollup-android-arm64": {
449
- "version": "4.34.6",
450
- "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.6.tgz",
451
- "integrity": "sha512-E8+2qCIjciYUnCa1AiVF1BkRgqIGW9KzJeesQqVfyRITGQN+dFuoivO0hnro1DjT74wXLRZ7QF8MIbz+luGaJA==",
452
- "cpu": [
453
- "arm64"
454
- ],
455
  "dev": true,
456
- "optional": true,
457
- "os": [
458
- "android"
459
- ]
460
  },
461
- "node_modules/@rollup/rollup-darwin-arm64": {
462
- "version": "4.34.6",
463
- "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.6.tgz",
464
- "integrity": "sha512-z9Ib+OzqN3DZEjX7PDQMHEhtF+t6Mi2z/ueChQPLS/qUMKY7Ybn5A2ggFoKRNRh1q1T03YTQfBTQCJZiepESAg==",
465
- "cpu": [
466
- "arm64"
467
- ],
468
  "dev": true,
469
- "optional": true,
470
- "os": [
471
- "darwin"
472
- ]
 
 
473
  },
474
- "node_modules/@rollup/rollup-darwin-x64": {
475
- "version": "4.34.6",
476
- "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.6.tgz",
477
- "integrity": "sha512-PShKVY4u0FDAR7jskyFIYVyHEPCPnIQY8s5OcXkdU8mz3Y7eXDJPdyM/ZWjkYdR2m0izD9HHWA8sGcXn+Qrsyg==",
478
- "cpu": [
479
- "x64"
480
- ],
481
  "dev": true,
482
- "optional": true,
483
- "os": [
484
- "darwin"
485
- ]
 
 
 
486
  },
487
- "node_modules/@rollup/rollup-freebsd-arm64": {
488
- "version": "4.34.6",
489
- "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.6.tgz",
490
- "integrity": "sha512-YSwyOqlDAdKqs0iKuqvRHLN4SrD2TiswfoLfvYXseKbL47ht1grQpq46MSiQAx6rQEN8o8URtpXARCpqabqxGQ==",
491
- "cpu": [
492
- "arm64"
493
- ],
494
  "dev": true,
495
- "optional": true,
496
- "os": [
497
- "freebsd"
498
- ]
 
 
 
 
 
 
499
  },
500
- "node_modules/@rollup/rollup-freebsd-x64": {
501
- "version": "4.34.6",
502
- "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.6.tgz",
503
- "integrity": "sha512-HEP4CgPAY1RxXwwL5sPFv6BBM3tVeLnshF03HMhJYCNc6kvSqBgTMmsEjb72RkZBAWIqiPUyF1JpEBv5XT9wKQ==",
504
- "cpu": [
505
- "x64"
506
- ],
507
  "dev": true,
508
- "optional": true,
509
- "os": [
510
- "freebsd"
511
- ]
 
 
 
 
 
 
512
  },
513
- "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
514
- "version": "4.34.6",
515
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.6.tgz",
516
- "integrity": "sha512-88fSzjC5xeH9S2Vg3rPgXJULkHcLYMkh8faix8DX4h4TIAL65ekwuQMA/g2CXq8W+NJC43V6fUpYZNjaX3+IIg==",
517
- "cpu": [
518
- "arm"
519
- ],
520
  "dev": true,
521
- "optional": true,
522
- "os": [
523
- "linux"
524
- ]
 
 
525
  },
526
- "node_modules/@rollup/rollup-linux-arm-musleabihf": {
527
- "version": "4.34.6",
528
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.6.tgz",
529
- "integrity": "sha512-wM4ztnutBqYFyvNeR7Av+reWI/enK9tDOTKNF+6Kk2Q96k9bwhDDOlnCUNRPvromlVXo04riSliMBs/Z7RteEg==",
530
- "cpu": [
531
- "arm"
532
- ],
 
 
 
533
  "dev": true,
534
- "optional": true,
535
- "os": [
536
- "linux"
537
- ]
538
  },
539
- "node_modules/@rollup/rollup-linux-arm64-gnu": {
540
- "version": "4.34.6",
541
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.6.tgz",
542
- "integrity": "sha512-9RyprECbRa9zEjXLtvvshhw4CMrRa3K+0wcp3KME0zmBe1ILmvcVHnypZ/aIDXpRyfhSYSuN4EPdCCj5Du8FIA==",
543
- "cpu": [
544
- "arm64"
545
- ],
546
  "dev": true,
547
- "optional": true,
548
- "os": [
549
- "linux"
550
- ]
551
  },
552
- "node_modules/@rollup/rollup-linux-arm64-musl": {
553
- "version": "4.34.6",
554
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.6.tgz",
555
- "integrity": "sha512-qTmklhCTyaJSB05S+iSovfo++EwnIEZxHkzv5dep4qoszUMX5Ca4WM4zAVUMbfdviLgCSQOu5oU8YoGk1s6M9Q==",
556
- "cpu": [
557
- "arm64"
558
- ],
559
  "dev": true,
560
- "optional": true,
561
- "os": [
562
- "linux"
563
- ]
 
 
 
 
564
  },
565
- "node_modules/@rollup/rollup-linux-loongarch64-gnu": {
566
- "version": "4.34.6",
567
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.6.tgz",
568
- "integrity": "sha512-4Qmkaps9yqmpjY5pvpkfOerYgKNUGzQpFxV6rnS7c/JfYbDSU0y6WpbbredB5cCpLFGJEqYX40WUmxMkwhWCjw==",
569
- "cpu": [
570
- "loong64"
571
- ],
572
  "dev": true,
573
- "optional": true,
574
- "os": [
575
- "linux"
576
- ]
577
  },
578
- "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
579
- "version": "4.34.6",
580
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.6.tgz",
581
- "integrity": "sha512-Zsrtux3PuaxuBTX/zHdLaFmcofWGzaWW1scwLU3ZbW/X+hSsFbz9wDIp6XvnT7pzYRl9MezWqEqKy7ssmDEnuQ==",
582
- "cpu": [
583
- "ppc64"
584
- ],
585
  "dev": true,
586
- "optional": true,
587
- "os": [
588
- "linux"
589
- ]
590
  },
591
- "node_modules/@rollup/rollup-linux-riscv64-gnu": {
592
- "version": "4.34.6",
593
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.6.tgz",
594
- "integrity": "sha512-aK+Zp+CRM55iPrlyKiU3/zyhgzWBxLVrw2mwiQSYJRobCURb781+XstzvA8Gkjg/hbdQFuDw44aUOxVQFycrAg==",
595
- "cpu": [
596
- "riscv64"
597
- ],
598
  "dev": true,
599
- "optional": true,
600
- "os": [
601
- "linux"
602
- ]
 
 
603
  },
604
- "node_modules/@rollup/rollup-linux-s390x-gnu": {
605
- "version": "4.34.6",
606
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.6.tgz",
607
- "integrity": "sha512-WoKLVrY9ogmaYPXwTH326+ErlCIgMmsoRSx6bO+l68YgJnlOXhygDYSZe/qbUJCSiCiZAQ+tKm88NcWuUXqOzw==",
608
- "cpu": [
609
- "s390x"
610
- ],
611
  "dev": true,
612
- "optional": true,
613
- "os": [
614
- "linux"
615
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
616
  },
617
- "node_modules/@rollup/rollup-linux-x64-gnu": {
618
- "version": "4.34.6",
619
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.6.tgz",
620
- "integrity": "sha512-Sht4aFvmA4ToHd2vFzwMFaQCiYm2lDFho5rPcvPBT5pCdC+GwHG6CMch4GQfmWTQ1SwRKS0dhDYb54khSrjDWw==",
621
- "cpu": [
622
- "x64"
 
 
 
 
 
 
 
 
 
 
623
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
624
  "dev": true,
625
- "optional": true,
626
- "os": [
627
- "linux"
628
- ]
629
  },
630
- "node_modules/@rollup/rollup-linux-x64-musl": {
631
- "version": "4.34.6",
632
- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.6.tgz",
633
- "integrity": "sha512-zmmpOQh8vXc2QITsnCiODCDGXFC8LMi64+/oPpPx5qz3pqv0s6x46ps4xoycfUiVZps5PFn1gksZzo4RGTKT+A==",
634
- "cpu": [
635
- "x64"
636
- ],
637
  "dev": true,
638
- "optional": true,
639
- "os": [
640
- "linux"
641
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
642
  },
643
- "node_modules/@rollup/rollup-win32-arm64-msvc": {
644
- "version": "4.34.6",
645
- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.6.tgz",
646
- "integrity": "sha512-3/q1qUsO/tLqGBaD4uXsB6coVGB3usxw3qyeVb59aArCgedSF66MPdgRStUd7vbZOsko/CgVaY5fo2vkvPLWiA==",
647
- "cpu": [
648
- "arm64"
649
- ],
650
  "dev": true,
651
- "optional": true,
652
- "os": [
653
- "win32"
654
- ]
 
 
 
655
  },
656
- "node_modules/@rollup/rollup-win32-ia32-msvc": {
657
- "version": "4.34.6",
658
- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.6.tgz",
659
- "integrity": "sha512-oLHxuyywc6efdKVTxvc0135zPrRdtYVjtVD5GUm55I3ODxhU/PwkQFD97z16Xzxa1Fz0AEe4W/2hzRtd+IfpOA==",
660
- "cpu": [
661
- "ia32"
662
- ],
663
  "dev": true,
664
- "optional": true,
665
- "os": [
666
- "win32"
667
- ]
 
 
668
  },
669
- "node_modules/@rollup/rollup-win32-x64-msvc": {
670
- "version": "4.34.6",
671
- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.6.tgz",
672
- "integrity": "sha512-0PVwmgzZ8+TZ9oGBmdZoQVXflbvuwzN/HRclujpl4N/q3i+y0lqLw8n1bXA8ru3sApDjlmONaNAuYr38y1Kr9w==",
673
- "cpu": [
674
- "x64"
675
- ],
676
  "dev": true,
677
- "optional": true,
678
- "os": [
679
- "win32"
680
- ]
681
  },
682
- "node_modules/@types/estree": {
683
- "version": "1.0.6",
684
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
685
- "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==",
686
- "dev": true
 
 
 
 
 
 
687
  },
688
- "node_modules/@types/node": {
689
- "version": "22.13.1",
690
- "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.1.tgz",
691
- "integrity": "sha512-jK8uzQlrvXqEU91UxiK5J7pKHyzgnI1Qnl0QDHIgVGuolJhRb9EEl28Cj9b3rGR8B2lhFCtvIm5os8lFnO/1Ew==",
692
  "dev": true,
693
  "dependencies": {
694
- "undici-types": "~6.20.0"
 
 
 
695
  }
696
  },
697
- "node_modules/esbuild": {
698
- "version": "0.24.2",
699
- "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz",
700
- "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==",
701
  "dev": true,
702
- "hasInstallScript": true,
703
  "bin": {
704
- "esbuild": "bin/esbuild"
 
 
 
 
 
 
 
 
 
705
  },
706
  "engines": {
707
- "node": ">=18"
 
 
 
 
 
 
 
 
 
 
 
708
  },
709
- "optionalDependencies": {
710
- "@esbuild/aix-ppc64": "0.24.2",
711
- "@esbuild/android-arm": "0.24.2",
712
- "@esbuild/android-arm64": "0.24.2",
713
- "@esbuild/android-x64": "0.24.2",
714
- "@esbuild/darwin-arm64": "0.24.2",
715
- "@esbuild/darwin-x64": "0.24.2",
716
- "@esbuild/freebsd-arm64": "0.24.2",
717
- "@esbuild/freebsd-x64": "0.24.2",
718
- "@esbuild/linux-arm": "0.24.2",
719
- "@esbuild/linux-arm64": "0.24.2",
720
- "@esbuild/linux-ia32": "0.24.2",
721
- "@esbuild/linux-loong64": "0.24.2",
722
- "@esbuild/linux-mips64el": "0.24.2",
723
- "@esbuild/linux-ppc64": "0.24.2",
724
- "@esbuild/linux-riscv64": "0.24.2",
725
- "@esbuild/linux-s390x": "0.24.2",
726
- "@esbuild/linux-x64": "0.24.2",
727
- "@esbuild/netbsd-arm64": "0.24.2",
728
- "@esbuild/netbsd-x64": "0.24.2",
729
- "@esbuild/openbsd-arm64": "0.24.2",
730
- "@esbuild/openbsd-x64": "0.24.2",
731
- "@esbuild/sunos-x64": "0.24.2",
732
- "@esbuild/win32-arm64": "0.24.2",
733
- "@esbuild/win32-ia32": "0.24.2",
734
- "@esbuild/win32-x64": "0.24.2"
735
- }
736
- },
737
- "node_modules/fsevents": {
738
- "version": "2.3.3",
739
- "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
740
- "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
741
  "dev": true,
742
- "hasInstallScript": true,
743
- "optional": true,
744
- "os": [
745
- "darwin"
746
- ],
 
 
 
 
 
 
 
 
 
 
 
 
 
747
  "engines": {
748
- "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
749
  }
750
  },
751
- "node_modules/nanoid": {
752
- "version": "3.3.8",
753
- "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
754
- "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
755
  "dev": true,
756
- "funding": [
757
- {
758
- "type": "github",
759
- "url": "https://github.com/sponsors/ai"
760
- }
761
- ],
762
  "bin": {
763
- "nanoid": "bin/nanoid.cjs"
764
  },
765
  "engines": {
766
- "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
767
  }
768
  },
769
- "node_modules/picocolors": {
770
- "version": "1.1.1",
771
- "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
772
- "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
773
  "dev": true
774
  },
775
- "node_modules/postcss": {
776
- "version": "8.5.2",
777
- "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.2.tgz",
778
- "integrity": "sha512-MjOadfU3Ys9KYoX0AdkBlFEF1Vx37uCCeN4ZHnmwm9FfpbsGWMZeBLMmmpY+6Ocqod7mkdZ0DT31OlbsFrLlkA==",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
779
  "dev": true,
780
- "funding": [
781
- {
782
- "type": "opencollective",
783
- "url": "https://opencollective.com/postcss/"
784
- },
785
- {
786
- "type": "tidelift",
787
- "url": "https://tidelift.com/funding/github/npm/postcss"
788
- },
789
- {
790
- "type": "github",
791
- "url": "https://github.com/sponsors/ai"
792
- }
793
- ],
794
  "dependencies": {
795
- "nanoid": "^3.3.8",
796
- "picocolors": "^1.1.1",
797
- "source-map-js": "^1.2.1"
798
  },
799
  "engines": {
800
- "node": "^10 || ^12 || >=14"
801
  }
802
  },
803
- "node_modules/rollup": {
804
- "version": "4.34.6",
805
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.6.tgz",
806
- "integrity": "sha512-wc2cBWqJgkU3Iz5oztRkQbfVkbxoz5EhnCGOrnJvnLnQ7O0WhQUYyv18qQI79O8L7DdHrrlJNeCHd4VGpnaXKQ==",
807
  "dev": true,
808
  "dependencies": {
809
- "@types/estree": "1.0.6"
810
  },
811
- "bin": {
812
- "rollup": "dist/bin/rollup"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
813
  },
814
  "engines": {
815
- "node": ">=18.0.0",
816
- "npm": ">=8.0.0"
817
  },
818
- "optionalDependencies": {
819
- "@rollup/rollup-android-arm-eabi": "4.34.6",
820
- "@rollup/rollup-android-arm64": "4.34.6",
821
- "@rollup/rollup-darwin-arm64": "4.34.6",
822
- "@rollup/rollup-darwin-x64": "4.34.6",
823
- "@rollup/rollup-freebsd-arm64": "4.34.6",
824
- "@rollup/rollup-freebsd-x64": "4.34.6",
825
- "@rollup/rollup-linux-arm-gnueabihf": "4.34.6",
826
- "@rollup/rollup-linux-arm-musleabihf": "4.34.6",
827
- "@rollup/rollup-linux-arm64-gnu": "4.34.6",
828
- "@rollup/rollup-linux-arm64-musl": "4.34.6",
829
- "@rollup/rollup-linux-loongarch64-gnu": "4.34.6",
830
- "@rollup/rollup-linux-powerpc64le-gnu": "4.34.6",
831
- "@rollup/rollup-linux-riscv64-gnu": "4.34.6",
832
- "@rollup/rollup-linux-s390x-gnu": "4.34.6",
833
- "@rollup/rollup-linux-x64-gnu": "4.34.6",
834
- "@rollup/rollup-linux-x64-musl": "4.34.6",
835
- "@rollup/rollup-win32-arm64-msvc": "4.34.6",
836
- "@rollup/rollup-win32-ia32-msvc": "4.34.6",
837
- "@rollup/rollup-win32-x64-msvc": "4.34.6",
838
- "fsevents": "~2.3.2"
839
- }
840
- },
841
- "node_modules/source-map-js": {
842
- "version": "1.2.1",
843
- "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
844
- "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
845
  "dev": true,
 
 
 
 
846
  "engines": {
847
- "node": ">=0.10.0"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
848
  }
849
  },
850
  "node_modules/typescript": {
851
  "version": "5.7.3",
852
  "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz",
853
  "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==",
 
854
  "bin": {
855
  "tsc": "bin/tsc",
856
  "tsserver": "bin/tsserver"
@@ -859,81 +1027,34 @@
859
  "node": ">=14.17"
860
  }
861
  },
862
- "node_modules/undici-types": {
863
- "version": "6.20.0",
864
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
865
- "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
 
 
 
 
 
 
 
 
 
 
 
 
866
  "dev": true
867
  },
868
- "node_modules/vite": {
869
- "version": "6.1.0",
870
- "resolved": "https://registry.npmjs.org/vite/-/vite-6.1.0.tgz",
871
- "integrity": "sha512-RjjMipCKVoR4hVfPY6GQTgveinjNuyLw+qruksLDvA5ktI1150VmcMBKmQaEWJhg/j6Uaf6dNCNA0AfdzUb/hQ==",
872
  "dev": true,
873
  "dependencies": {
874
- "esbuild": "^0.24.2",
875
- "postcss": "^8.5.1",
876
- "rollup": "^4.30.1"
877
- },
878
- "bin": {
879
- "vite": "bin/vite.js"
880
  },
881
  "engines": {
882
- "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
883
- },
884
- "funding": {
885
- "url": "https://github.com/vitejs/vite?sponsor=1"
886
- },
887
- "optionalDependencies": {
888
- "fsevents": "~2.3.3"
889
- },
890
- "peerDependencies": {
891
- "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
892
- "jiti": ">=1.21.0",
893
- "less": "*",
894
- "lightningcss": "^1.21.0",
895
- "sass": "*",
896
- "sass-embedded": "*",
897
- "stylus": "*",
898
- "sugarss": "*",
899
- "terser": "^5.16.0",
900
- "tsx": "^4.8.1",
901
- "yaml": "^2.4.2"
902
- },
903
- "peerDependenciesMeta": {
904
- "@types/node": {
905
- "optional": true
906
- },
907
- "jiti": {
908
- "optional": true
909
- },
910
- "less": {
911
- "optional": true
912
- },
913
- "lightningcss": {
914
- "optional": true
915
- },
916
- "sass": {
917
- "optional": true
918
- },
919
- "sass-embedded": {
920
- "optional": true
921
- },
922
- "stylus": {
923
- "optional": true
924
- },
925
- "sugarss": {
926
- "optional": true
927
- },
928
- "terser": {
929
- "optional": true
930
- },
931
- "tsx": {
932
- "optional": true
933
- },
934
- "yaml": {
935
- "optional": true
936
- }
937
  }
938
  }
939
  }
 
1
  {
2
+ "name": "static-ts-site",
3
  "version": "1.0.0",
4
  "lockfileVersion": 3,
5
  "requires": true,
6
  "packages": {
7
  "": {
8
+ "name": "static-ts-site",
9
  "version": "1.0.0",
10
  "dependencies": {
11
  "@huggingface/hub": "^1.0.1",
12
+ "@huggingface/inference": "^3.3.3"
13
  },
14
  "devDependencies": {
15
+ "esbuild": "^0.20.0",
16
+ "http-server": "^14.1.1",
17
+ "typescript": "^5.0.0"
18
  }
19
  },
20
  "node_modules/@esbuild/aix-ppc64": {
21
+ "version": "0.20.2",
22
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz",
23
+ "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==",
24
  "cpu": [
25
  "ppc64"
26
  ],
 
30
  "aix"
31
  ],
32
  "engines": {
33
+ "node": ">=12"
34
  }
35
  },
36
  "node_modules/@esbuild/android-arm": {
37
+ "version": "0.20.2",
38
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz",
39
+ "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==",
40
  "cpu": [
41
  "arm"
42
  ],
 
46
  "android"
47
  ],
48
  "engines": {
49
+ "node": ">=12"
50
  }
51
  },
52
  "node_modules/@esbuild/android-arm64": {
53
+ "version": "0.20.2",
54
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz",
55
+ "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==",
56
  "cpu": [
57
  "arm64"
58
  ],
 
62
  "android"
63
  ],
64
  "engines": {
65
+ "node": ">=12"
66
  }
67
  },
68
  "node_modules/@esbuild/android-x64": {
69
+ "version": "0.20.2",
70
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz",
71
+ "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==",
72
  "cpu": [
73
  "x64"
74
  ],
 
78
  "android"
79
  ],
80
  "engines": {
81
+ "node": ">=12"
82
  }
83
  },
84
  "node_modules/@esbuild/darwin-arm64": {
85
+ "version": "0.20.2",
86
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz",
87
+ "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==",
88
  "cpu": [
89
  "arm64"
90
  ],
 
94
  "darwin"
95
  ],
96
  "engines": {
97
+ "node": ">=12"
98
  }
99
  },
100
  "node_modules/@esbuild/darwin-x64": {
101
+ "version": "0.20.2",
102
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz",
103
+ "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==",
104
  "cpu": [
105
  "x64"
106
  ],
 
110
  "darwin"
111
  ],
112
  "engines": {
113
+ "node": ">=12"
114
  }
115
  },
116
  "node_modules/@esbuild/freebsd-arm64": {
117
+ "version": "0.20.2",
118
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz",
119
+ "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==",
120
  "cpu": [
121
  "arm64"
122
  ],
 
126
  "freebsd"
127
  ],
128
  "engines": {
129
+ "node": ">=12"
130
  }
131
  },
132
  "node_modules/@esbuild/freebsd-x64": {
133
+ "version": "0.20.2",
134
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz",
135
+ "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==",
136
  "cpu": [
137
  "x64"
138
  ],
 
142
  "freebsd"
143
  ],
144
  "engines": {
145
+ "node": ">=12"
146
  }
147
  },
148
  "node_modules/@esbuild/linux-arm": {
149
+ "version": "0.20.2",
150
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz",
151
+ "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==",
152
  "cpu": [
153
  "arm"
154
  ],
 
158
  "linux"
159
  ],
160
  "engines": {
161
+ "node": ">=12"
162
  }
163
  },
164
  "node_modules/@esbuild/linux-arm64": {
165
+ "version": "0.20.2",
166
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz",
167
+ "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==",
168
  "cpu": [
169
  "arm64"
170
  ],
 
174
  "linux"
175
  ],
176
  "engines": {
177
+ "node": ">=12"
178
  }
179
  },
180
  "node_modules/@esbuild/linux-ia32": {
181
+ "version": "0.20.2",
182
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz",
183
+ "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==",
184
  "cpu": [
185
  "ia32"
186
  ],
 
190
  "linux"
191
  ],
192
  "engines": {
193
+ "node": ">=12"
194
  }
195
  },
196
  "node_modules/@esbuild/linux-loong64": {
197
+ "version": "0.20.2",
198
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz",
199
+ "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==",
200
  "cpu": [
201
  "loong64"
202
  ],
 
206
  "linux"
207
  ],
208
  "engines": {
209
+ "node": ">=12"
210
  }
211
  },
212
  "node_modules/@esbuild/linux-mips64el": {
213
+ "version": "0.20.2",
214
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz",
215
+ "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==",
216
  "cpu": [
217
  "mips64el"
218
  ],
 
222
  "linux"
223
  ],
224
  "engines": {
225
+ "node": ">=12"
226
  }
227
  },
228
  "node_modules/@esbuild/linux-ppc64": {
229
+ "version": "0.20.2",
230
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz",
231
+ "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==",
232
  "cpu": [
233
  "ppc64"
234
  ],
 
238
  "linux"
239
  ],
240
  "engines": {
241
+ "node": ">=12"
242
  }
243
  },
244
  "node_modules/@esbuild/linux-riscv64": {
245
+ "version": "0.20.2",
246
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz",
247
+ "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==",
248
  "cpu": [
249
  "riscv64"
250
  ],
 
254
  "linux"
255
  ],
256
  "engines": {
257
+ "node": ">=12"
258
  }
259
  },
260
  "node_modules/@esbuild/linux-s390x": {
261
+ "version": "0.20.2",
262
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz",
263
+ "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==",
264
  "cpu": [
265
  "s390x"
266
  ],
 
270
  "linux"
271
  ],
272
  "engines": {
273
+ "node": ">=12"
274
  }
275
  },
276
  "node_modules/@esbuild/linux-x64": {
277
+ "version": "0.20.2",
278
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz",
279
+ "integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==",
280
  "cpu": [
281
  "x64"
282
  ],
 
286
  "linux"
287
  ],
288
  "engines": {
289
+ "node": ">=12"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  }
291
  },
292
  "node_modules/@esbuild/netbsd-x64": {
293
+ "version": "0.20.2",
294
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz",
295
+ "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==",
296
  "cpu": [
297
  "x64"
298
  ],
 
302
  "netbsd"
303
  ],
304
  "engines": {
305
+ "node": ">=12"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
307
  },
308
  "node_modules/@esbuild/openbsd-x64": {
309
+ "version": "0.20.2",
310
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz",
311
+ "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==",
312
  "cpu": [
313
  "x64"
314
  ],
 
318
  "openbsd"
319
  ],
320
  "engines": {
321
+ "node": ">=12"
322
  }
323
  },
324
  "node_modules/@esbuild/sunos-x64": {
325
+ "version": "0.20.2",
326
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz",
327
+ "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==",
328
  "cpu": [
329
  "x64"
330
  ],
 
334
  "sunos"
335
  ],
336
  "engines": {
337
+ "node": ">=12"
338
  }
339
  },
340
  "node_modules/@esbuild/win32-arm64": {
341
+ "version": "0.20.2",
342
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz",
343
+ "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==",
344
  "cpu": [
345
  "arm64"
346
  ],
 
350
  "win32"
351
  ],
352
  "engines": {
353
+ "node": ">=12"
354
  }
355
  },
356
  "node_modules/@esbuild/win32-ia32": {
357
+ "version": "0.20.2",
358
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz",
359
+ "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==",
360
  "cpu": [
361
  "ia32"
362
  ],
 
366
  "win32"
367
  ],
368
  "engines": {
369
+ "node": ">=12"
370
  }
371
  },
372
  "node_modules/@esbuild/win32-x64": {
373
+ "version": "0.20.2",
374
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz",
375
+ "integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==",
376
  "cpu": [
377
  "x64"
378
  ],
 
382
  "win32"
383
  ],
384
  "engines": {
385
+ "node": ">=12"
386
  }
387
  },
388
  "node_modules/@huggingface/hub": {
 
396
  "node": ">=18"
397
  }
398
  },
399
+ "node_modules/@huggingface/inference": {
400
+ "version": "3.3.3",
401
+ "resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-3.3.3.tgz",
402
+ "integrity": "sha512-8GJituytUDCzUsqTCwaa630RZ5r/YkkDIJxSv3oqNcFpwaM0/368Ss9cYW8wsmlCBBpC4RKiBRE1KCuHBAURTA==",
403
+ "dependencies": {
404
+ "@huggingface/tasks": "^0.15.9"
405
+ },
406
+ "engines": {
407
+ "node": ">=18"
408
+ }
409
+ },
410
  "node_modules/@huggingface/tasks": {
411
  "version": "0.15.9",
412
  "resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.15.9.tgz",
413
  "integrity": "sha512-cbnZcpMHKdhURWIplVP4obHxAZcxjyRm0zI7peTPksZN4CtIOMmJC4ZqGEymo0lk+0VNkXD7ULwFJ3JjT/VpkQ=="
414
  },
415
+ "node_modules/ansi-styles": {
416
+ "version": "4.3.0",
417
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
418
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
 
 
 
419
  "dev": true,
420
+ "dependencies": {
421
+ "color-convert": "^2.0.1"
422
+ },
423
+ "engines": {
424
+ "node": ">=8"
425
+ },
426
+ "funding": {
427
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
428
+ }
429
  },
430
+ "node_modules/async": {
431
+ "version": "2.6.4",
432
+ "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
433
+ "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
 
 
 
434
  "dev": true,
435
+ "dependencies": {
436
+ "lodash": "^4.17.14"
437
+ }
 
438
  },
439
+ "node_modules/basic-auth": {
440
+ "version": "2.0.1",
441
+ "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
442
+ "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
 
 
 
443
  "dev": true,
444
+ "dependencies": {
445
+ "safe-buffer": "5.1.2"
446
+ },
447
+ "engines": {
448
+ "node": ">= 0.8"
449
+ }
450
  },
451
+ "node_modules/call-bind-apply-helpers": {
452
+ "version": "1.0.2",
453
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
454
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
 
 
 
455
  "dev": true,
456
+ "dependencies": {
457
+ "es-errors": "^1.3.0",
458
+ "function-bind": "^1.1.2"
459
+ },
460
+ "engines": {
461
+ "node": ">= 0.4"
462
+ }
463
  },
464
+ "node_modules/call-bound": {
465
+ "version": "1.0.3",
466
+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz",
467
+ "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==",
 
 
 
468
  "dev": true,
469
+ "dependencies": {
470
+ "call-bind-apply-helpers": "^1.0.1",
471
+ "get-intrinsic": "^1.2.6"
472
+ },
473
+ "engines": {
474
+ "node": ">= 0.4"
475
+ },
476
+ "funding": {
477
+ "url": "https://github.com/sponsors/ljharb"
478
+ }
479
  },
480
+ "node_modules/chalk": {
481
+ "version": "4.1.2",
482
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
483
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
 
 
 
484
  "dev": true,
485
+ "dependencies": {
486
+ "ansi-styles": "^4.1.0",
487
+ "supports-color": "^7.1.0"
488
+ },
489
+ "engines": {
490
+ "node": ">=10"
491
+ },
492
+ "funding": {
493
+ "url": "https://github.com/chalk/chalk?sponsor=1"
494
+ }
495
  },
496
+ "node_modules/color-convert": {
497
+ "version": "2.0.1",
498
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
499
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
 
 
 
500
  "dev": true,
501
+ "dependencies": {
502
+ "color-name": "~1.1.4"
503
+ },
504
+ "engines": {
505
+ "node": ">=7.0.0"
506
+ }
507
  },
508
+ "node_modules/color-name": {
509
+ "version": "1.1.4",
510
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
511
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
512
+ "dev": true
513
+ },
514
+ "node_modules/corser": {
515
+ "version": "2.0.1",
516
+ "resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
517
+ "integrity": "sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==",
518
  "dev": true,
519
+ "engines": {
520
+ "node": ">= 0.4.0"
521
+ }
 
522
  },
523
+ "node_modules/debug": {
524
+ "version": "3.2.7",
525
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
526
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
 
 
 
527
  "dev": true,
528
+ "dependencies": {
529
+ "ms": "^2.1.1"
530
+ }
 
531
  },
532
+ "node_modules/dunder-proto": {
533
+ "version": "1.0.1",
534
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
535
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
 
 
 
536
  "dev": true,
537
+ "dependencies": {
538
+ "call-bind-apply-helpers": "^1.0.1",
539
+ "es-errors": "^1.3.0",
540
+ "gopd": "^1.2.0"
541
+ },
542
+ "engines": {
543
+ "node": ">= 0.4"
544
+ }
545
  },
546
+ "node_modules/es-define-property": {
547
+ "version": "1.0.1",
548
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
549
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
 
 
 
550
  "dev": true,
551
+ "engines": {
552
+ "node": ">= 0.4"
553
+ }
 
554
  },
555
+ "node_modules/es-errors": {
556
+ "version": "1.3.0",
557
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
558
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
 
 
 
559
  "dev": true,
560
+ "engines": {
561
+ "node": ">= 0.4"
562
+ }
 
563
  },
564
+ "node_modules/es-object-atoms": {
565
+ "version": "1.1.1",
566
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
567
+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
 
 
 
568
  "dev": true,
569
+ "dependencies": {
570
+ "es-errors": "^1.3.0"
571
+ },
572
+ "engines": {
573
+ "node": ">= 0.4"
574
+ }
575
  },
576
+ "node_modules/esbuild": {
577
+ "version": "0.20.2",
578
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz",
579
+ "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==",
 
 
 
580
  "dev": true,
581
+ "hasInstallScript": true,
582
+ "bin": {
583
+ "esbuild": "bin/esbuild"
584
+ },
585
+ "engines": {
586
+ "node": ">=12"
587
+ },
588
+ "optionalDependencies": {
589
+ "@esbuild/aix-ppc64": "0.20.2",
590
+ "@esbuild/android-arm": "0.20.2",
591
+ "@esbuild/android-arm64": "0.20.2",
592
+ "@esbuild/android-x64": "0.20.2",
593
+ "@esbuild/darwin-arm64": "0.20.2",
594
+ "@esbuild/darwin-x64": "0.20.2",
595
+ "@esbuild/freebsd-arm64": "0.20.2",
596
+ "@esbuild/freebsd-x64": "0.20.2",
597
+ "@esbuild/linux-arm": "0.20.2",
598
+ "@esbuild/linux-arm64": "0.20.2",
599
+ "@esbuild/linux-ia32": "0.20.2",
600
+ "@esbuild/linux-loong64": "0.20.2",
601
+ "@esbuild/linux-mips64el": "0.20.2",
602
+ "@esbuild/linux-ppc64": "0.20.2",
603
+ "@esbuild/linux-riscv64": "0.20.2",
604
+ "@esbuild/linux-s390x": "0.20.2",
605
+ "@esbuild/linux-x64": "0.20.2",
606
+ "@esbuild/netbsd-x64": "0.20.2",
607
+ "@esbuild/openbsd-x64": "0.20.2",
608
+ "@esbuild/sunos-x64": "0.20.2",
609
+ "@esbuild/win32-arm64": "0.20.2",
610
+ "@esbuild/win32-ia32": "0.20.2",
611
+ "@esbuild/win32-x64": "0.20.2"
612
+ }
613
  },
614
+ "node_modules/eventemitter3": {
615
+ "version": "4.0.7",
616
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
617
+ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
618
+ "dev": true
619
+ },
620
+ "node_modules/follow-redirects": {
621
+ "version": "1.15.9",
622
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
623
+ "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
624
+ "dev": true,
625
+ "funding": [
626
+ {
627
+ "type": "individual",
628
+ "url": "https://github.com/sponsors/RubenVerborgh"
629
+ }
630
  ],
631
+ "engines": {
632
+ "node": ">=4.0"
633
+ },
634
+ "peerDependenciesMeta": {
635
+ "debug": {
636
+ "optional": true
637
+ }
638
+ }
639
+ },
640
+ "node_modules/function-bind": {
641
+ "version": "1.1.2",
642
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
643
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
644
  "dev": true,
645
+ "funding": {
646
+ "url": "https://github.com/sponsors/ljharb"
647
+ }
 
648
  },
649
+ "node_modules/get-intrinsic": {
650
+ "version": "1.2.7",
651
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz",
652
+ "integrity": "sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==",
 
 
 
653
  "dev": true,
654
+ "dependencies": {
655
+ "call-bind-apply-helpers": "^1.0.1",
656
+ "es-define-property": "^1.0.1",
657
+ "es-errors": "^1.3.0",
658
+ "es-object-atoms": "^1.0.0",
659
+ "function-bind": "^1.1.2",
660
+ "get-proto": "^1.0.0",
661
+ "gopd": "^1.2.0",
662
+ "has-symbols": "^1.1.0",
663
+ "hasown": "^2.0.2",
664
+ "math-intrinsics": "^1.1.0"
665
+ },
666
+ "engines": {
667
+ "node": ">= 0.4"
668
+ },
669
+ "funding": {
670
+ "url": "https://github.com/sponsors/ljharb"
671
+ }
672
  },
673
+ "node_modules/get-proto": {
674
+ "version": "1.0.1",
675
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
676
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
 
 
 
677
  "dev": true,
678
+ "dependencies": {
679
+ "dunder-proto": "^1.0.1",
680
+ "es-object-atoms": "^1.0.0"
681
+ },
682
+ "engines": {
683
+ "node": ">= 0.4"
684
+ }
685
  },
686
+ "node_modules/gopd": {
687
+ "version": "1.2.0",
688
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
689
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
 
 
 
690
  "dev": true,
691
+ "engines": {
692
+ "node": ">= 0.4"
693
+ },
694
+ "funding": {
695
+ "url": "https://github.com/sponsors/ljharb"
696
+ }
697
  },
698
+ "node_modules/has-flag": {
699
+ "version": "4.0.0",
700
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
701
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
 
 
 
702
  "dev": true,
703
+ "engines": {
704
+ "node": ">=8"
705
+ }
 
706
  },
707
+ "node_modules/has-symbols": {
708
+ "version": "1.1.0",
709
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
710
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
711
+ "dev": true,
712
+ "engines": {
713
+ "node": ">= 0.4"
714
+ },
715
+ "funding": {
716
+ "url": "https://github.com/sponsors/ljharb"
717
+ }
718
  },
719
+ "node_modules/hasown": {
720
+ "version": "2.0.2",
721
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
722
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
723
  "dev": true,
724
  "dependencies": {
725
+ "function-bind": "^1.1.2"
726
+ },
727
+ "engines": {
728
+ "node": ">= 0.4"
729
  }
730
  },
731
+ "node_modules/he": {
732
+ "version": "1.2.0",
733
+ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
734
+ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
735
  "dev": true,
 
736
  "bin": {
737
+ "he": "bin/he"
738
+ }
739
+ },
740
+ "node_modules/html-encoding-sniffer": {
741
+ "version": "3.0.0",
742
+ "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz",
743
+ "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==",
744
+ "dev": true,
745
+ "dependencies": {
746
+ "whatwg-encoding": "^2.0.0"
747
  },
748
  "engines": {
749
+ "node": ">=12"
750
+ }
751
+ },
752
+ "node_modules/http-proxy": {
753
+ "version": "1.18.1",
754
+ "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
755
+ "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
756
+ "dev": true,
757
+ "dependencies": {
758
+ "eventemitter3": "^4.0.0",
759
+ "follow-redirects": "^1.0.0",
760
+ "requires-port": "^1.0.0"
761
  },
762
+ "engines": {
763
+ "node": ">=8.0.0"
764
+ }
765
+ },
766
+ "node_modules/http-server": {
767
+ "version": "14.1.1",
768
+ "resolved": "https://registry.npmjs.org/http-server/-/http-server-14.1.1.tgz",
769
+ "integrity": "sha512-+cbxadF40UXd9T01zUHgA+rlo2Bg1Srer4+B4NwIHdaGxAGGv59nYRnGGDJ9LBk7alpS0US+J+bLLdQOOkJq4A==",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
770
  "dev": true,
771
+ "dependencies": {
772
+ "basic-auth": "^2.0.1",
773
+ "chalk": "^4.1.2",
774
+ "corser": "^2.0.1",
775
+ "he": "^1.2.0",
776
+ "html-encoding-sniffer": "^3.0.0",
777
+ "http-proxy": "^1.18.1",
778
+ "mime": "^1.6.0",
779
+ "minimist": "^1.2.6",
780
+ "opener": "^1.5.1",
781
+ "portfinder": "^1.0.28",
782
+ "secure-compare": "3.0.1",
783
+ "union": "~0.5.0",
784
+ "url-join": "^4.0.1"
785
+ },
786
+ "bin": {
787
+ "http-server": "bin/http-server"
788
+ },
789
  "engines": {
790
+ "node": ">=12"
791
  }
792
  },
793
+ "node_modules/iconv-lite": {
794
+ "version": "0.6.3",
795
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
796
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
797
+ "dev": true,
798
+ "dependencies": {
799
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
800
+ },
801
+ "engines": {
802
+ "node": ">=0.10.0"
803
+ }
804
+ },
805
+ "node_modules/lodash": {
806
+ "version": "4.17.21",
807
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
808
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
809
+ "dev": true
810
+ },
811
+ "node_modules/math-intrinsics": {
812
+ "version": "1.1.0",
813
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
814
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
815
+ "dev": true,
816
+ "engines": {
817
+ "node": ">= 0.4"
818
+ }
819
+ },
820
+ "node_modules/mime": {
821
+ "version": "1.6.0",
822
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
823
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
824
  "dev": true,
 
 
 
 
 
 
825
  "bin": {
826
+ "mime": "cli.js"
827
  },
828
  "engines": {
829
+ "node": ">=4"
830
  }
831
  },
832
+ "node_modules/minimist": {
833
+ "version": "1.2.8",
834
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
835
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
836
+ "dev": true,
837
+ "funding": {
838
+ "url": "https://github.com/sponsors/ljharb"
839
+ }
840
+ },
841
+ "node_modules/mkdirp": {
842
+ "version": "0.5.6",
843
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
844
+ "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
845
+ "dev": true,
846
+ "dependencies": {
847
+ "minimist": "^1.2.6"
848
+ },
849
+ "bin": {
850
+ "mkdirp": "bin/cmd.js"
851
+ }
852
+ },
853
+ "node_modules/ms": {
854
+ "version": "2.1.3",
855
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
856
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
857
  "dev": true
858
  },
859
+ "node_modules/object-inspect": {
860
+ "version": "1.13.4",
861
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
862
+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
863
+ "dev": true,
864
+ "engines": {
865
+ "node": ">= 0.4"
866
+ },
867
+ "funding": {
868
+ "url": "https://github.com/sponsors/ljharb"
869
+ }
870
+ },
871
+ "node_modules/opener": {
872
+ "version": "1.5.2",
873
+ "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
874
+ "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==",
875
+ "dev": true,
876
+ "bin": {
877
+ "opener": "bin/opener-bin.js"
878
+ }
879
+ },
880
+ "node_modules/portfinder": {
881
+ "version": "1.0.32",
882
+ "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz",
883
+ "integrity": "sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg==",
884
  "dev": true,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
885
  "dependencies": {
886
+ "async": "^2.6.4",
887
+ "debug": "^3.2.7",
888
+ "mkdirp": "^0.5.6"
889
  },
890
  "engines": {
891
+ "node": ">= 0.12.0"
892
  }
893
  },
894
+ "node_modules/qs": {
895
+ "version": "6.14.0",
896
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
897
+ "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
898
  "dev": true,
899
  "dependencies": {
900
+ "side-channel": "^1.1.0"
901
  },
902
+ "engines": {
903
+ "node": ">=0.6"
904
+ },
905
+ "funding": {
906
+ "url": "https://github.com/sponsors/ljharb"
907
+ }
908
+ },
909
+ "node_modules/requires-port": {
910
+ "version": "1.0.0",
911
+ "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
912
+ "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
913
+ "dev": true
914
+ },
915
+ "node_modules/safe-buffer": {
916
+ "version": "5.1.2",
917
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
918
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
919
+ "dev": true
920
+ },
921
+ "node_modules/safer-buffer": {
922
+ "version": "2.1.2",
923
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
924
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
925
+ "dev": true
926
+ },
927
+ "node_modules/secure-compare": {
928
+ "version": "3.0.1",
929
+ "resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz",
930
+ "integrity": "sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw==",
931
+ "dev": true
932
+ },
933
+ "node_modules/side-channel": {
934
+ "version": "1.1.0",
935
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
936
+ "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
937
+ "dev": true,
938
+ "dependencies": {
939
+ "es-errors": "^1.3.0",
940
+ "object-inspect": "^1.13.3",
941
+ "side-channel-list": "^1.0.0",
942
+ "side-channel-map": "^1.0.1",
943
+ "side-channel-weakmap": "^1.0.2"
944
  },
945
  "engines": {
946
+ "node": ">= 0.4"
 
947
  },
948
+ "funding": {
949
+ "url": "https://github.com/sponsors/ljharb"
950
+ }
951
+ },
952
+ "node_modules/side-channel-list": {
953
+ "version": "1.0.0",
954
+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
955
+ "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  "dev": true,
957
+ "dependencies": {
958
+ "es-errors": "^1.3.0",
959
+ "object-inspect": "^1.13.3"
960
+ },
961
  "engines": {
962
+ "node": ">= 0.4"
963
+ },
964
+ "funding": {
965
+ "url": "https://github.com/sponsors/ljharb"
966
+ }
967
+ },
968
+ "node_modules/side-channel-map": {
969
+ "version": "1.0.1",
970
+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
971
+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
972
+ "dev": true,
973
+ "dependencies": {
974
+ "call-bound": "^1.0.2",
975
+ "es-errors": "^1.3.0",
976
+ "get-intrinsic": "^1.2.5",
977
+ "object-inspect": "^1.13.3"
978
+ },
979
+ "engines": {
980
+ "node": ">= 0.4"
981
+ },
982
+ "funding": {
983
+ "url": "https://github.com/sponsors/ljharb"
984
+ }
985
+ },
986
+ "node_modules/side-channel-weakmap": {
987
+ "version": "1.0.2",
988
+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
989
+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
990
+ "dev": true,
991
+ "dependencies": {
992
+ "call-bound": "^1.0.2",
993
+ "es-errors": "^1.3.0",
994
+ "get-intrinsic": "^1.2.5",
995
+ "object-inspect": "^1.13.3",
996
+ "side-channel-map": "^1.0.1"
997
+ },
998
+ "engines": {
999
+ "node": ">= 0.4"
1000
+ },
1001
+ "funding": {
1002
+ "url": "https://github.com/sponsors/ljharb"
1003
+ }
1004
+ },
1005
+ "node_modules/supports-color": {
1006
+ "version": "7.2.0",
1007
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
1008
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
1009
+ "dev": true,
1010
+ "dependencies": {
1011
+ "has-flag": "^4.0.0"
1012
+ },
1013
+ "engines": {
1014
+ "node": ">=8"
1015
  }
1016
  },
1017
  "node_modules/typescript": {
1018
  "version": "5.7.3",
1019
  "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz",
1020
  "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==",
1021
+ "dev": true,
1022
  "bin": {
1023
  "tsc": "bin/tsc",
1024
  "tsserver": "bin/tsserver"
 
1027
  "node": ">=14.17"
1028
  }
1029
  },
1030
+ "node_modules/union": {
1031
+ "version": "0.5.0",
1032
+ "resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz",
1033
+ "integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==",
1034
+ "dev": true,
1035
+ "dependencies": {
1036
+ "qs": "^6.4.0"
1037
+ },
1038
+ "engines": {
1039
+ "node": ">= 0.8.0"
1040
+ }
1041
+ },
1042
+ "node_modules/url-join": {
1043
+ "version": "4.0.1",
1044
+ "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
1045
+ "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==",
1046
  "dev": true
1047
  },
1048
+ "node_modules/whatwg-encoding": {
1049
+ "version": "2.0.0",
1050
+ "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz",
1051
+ "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==",
1052
  "dev": true,
1053
  "dependencies": {
1054
+ "iconv-lite": "0.6.3"
 
 
 
 
 
1055
  },
1056
  "engines": {
1057
+ "node": ">=12"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
  }
1059
  }
1060
  }
package.json CHANGED
@@ -1,20 +1,18 @@
1
  {
2
- "name": "apidemo",
3
  "version": "1.0.0",
4
- "type": "module",
5
- "dependencies": {
6
- "@huggingface/hub": "^1.0.1",
7
- "typescript": "^5.7.3"
8
- },
9
  "scripts": {
10
- "typecheck": "tsc --noEmit",
11
- "dev": "vite",
12
- "build": "tsc --noEmit && vite build",
13
- "preview": "vite preview",
14
- "start": "vite preview"
15
  },
16
  "devDependencies": {
17
- "@types/node": "^22.13.1",
18
- "vite": "^5.0.0"
 
 
 
 
 
19
  }
20
  }
 
1
  {
2
+ "name": "static-ts-site",
3
  "version": "1.0.0",
4
+ "description": "Static site with TypeScript",
 
 
 
 
5
  "scripts": {
6
+ "build": "esbuild src/main.ts --bundle --outfile=dist/main.js --format=esm --platform=node",
7
+ "watch": "esbuild src/main.ts --bundle --outfile=dist/main.js --format=esm --platform=node --watch"
 
 
 
8
  },
9
  "devDependencies": {
10
+ "esbuild": "^0.20.0",
11
+ "http-server": "^14.1.1",
12
+ "typescript": "^5.0.0"
13
+ },
14
+ "dependencies": {
15
+ "@huggingface/hub": "^1.0.1",
16
+ "@huggingface/inference": "^3.3.3"
17
  }
18
  }
src/index.ts DELETED
@@ -1,51 +0,0 @@
1
- import { oauthLoginUrl, oauthHandleRedirectIfPresent } from "@huggingface/hub";
2
-
3
- // Get UI elements
4
- const signinButton = document.getElementById("signin") as HTMLImageElement;
5
- const signoutButton = document.getElementById("signout") as HTMLButtonElement;
6
- const preElement = document.querySelector("pre") as HTMLPreElement;
7
-
8
- // Show/hide UI elements based on auth state
9
- function updateUI(isLoggedIn: boolean) {
10
- signinButton.style.display = isLoggedIn ? "none" : "block";
11
- signoutButton.style.display = isLoggedIn ? "block" : "none";
12
- }
13
-
14
- async function handleOAuth() {
15
- try {
16
- const oauthResult = await oauthHandleRedirectIfPresent();
17
-
18
- if (oauthResult) {
19
- // We have OAuth results, display them
20
- preElement.textContent = JSON.stringify(oauthResult, null, 2);
21
- updateUI(true);
22
- } else {
23
- // No OAuth results, show sign-in button
24
- updateUI(false);
25
- }
26
-
27
- return oauthResult;
28
- } catch (error) {
29
- console.error("OAuth error:", error);
30
- preElement.textContent = "Error: " + (error as Error).message;
31
- updateUI(false);
32
- throw error;
33
- }
34
- }
35
-
36
- // Handle sign-in click
37
- signinButton.addEventListener("click", async () => {
38
- const loginUrl = await oauthLoginUrl();
39
- window.location.href = loginUrl;
40
- });
41
-
42
- // Handle sign-out click
43
- signoutButton.addEventListener("click", () => {
44
- // Clear the display and reset UI
45
- preElement.textContent = "";
46
- updateUI(false);
47
- // You might want to add additional logout logic here
48
- });
49
-
50
- // Initialize OAuth handling
51
- handleOAuth().catch(console.error);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/main.ts ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { oauthLoginUrl, oauthHandleRedirectIfPresent } from "@huggingface/hub";
2
+
3
+ interface HuggingFaceWindow extends Window {
4
+ huggingface?: {
5
+ variables: {
6
+ OAUTH_SCOPES: string;
7
+ };
8
+ };
9
+ }
10
+
11
+ declare const window: HuggingFaceWindow;
12
+
13
+ console.log("huggingface env", window.huggingface);
14
+
15
+ type OAuthResult = Record<string, any> | null | false;
16
+
17
+ let oauthResult: OAuthResult = null;
18
+ const storedOAuth = localStorage.getItem("oauth");
19
+
20
+ if (storedOAuth) {
21
+ try {
22
+ oauthResult = JSON.parse(storedOAuth);
23
+ } catch {
24
+ oauthResult = null;
25
+ }
26
+ }
27
+
28
+ const init = async (): Promise<void> => {
29
+ oauthResult ||= await oauthHandleRedirectIfPresent();
30
+
31
+ if (oauthResult !== null && oauthResult !== false) {
32
+ const preElement = document.querySelector("pre");
33
+ if (preElement) {
34
+ preElement.textContent = JSON.stringify(oauthResult, null, 2);
35
+ }
36
+
37
+ localStorage.setItem("oauth", JSON.stringify(oauthResult));
38
+
39
+ const signoutButton = document.getElementById("signout");
40
+ if (signoutButton) {
41
+ signoutButton.style.removeProperty("display");
42
+ signoutButton.onclick = async function () {
43
+ localStorage.removeItem("oauth");
44
+ window.location.href = window.location.href.replace(/\?.*$/, "");
45
+ window.location.reload();
46
+ };
47
+ }
48
+ } else {
49
+ const signinButton = document.getElementById("signin");
50
+ if (signinButton) {
51
+ signinButton.style.removeProperty("display");
52
+ signinButton.onclick = async function () {
53
+ // prompt=consent to re-trigger the consent screen instead of silently redirecting
54
+ const loginUrl = await oauthLoginUrl({
55
+ scopes: window.huggingface?.variables?.OAUTH_SCOPES ?? "",
56
+ });
57
+ window.location.href = `${loginUrl}&prompt=consent`;
58
+ };
59
+ }
60
+ }
61
+ };
62
+
63
+ init().catch(console.error);
styles/main.css ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ body {
8
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
9
+ Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
10
+ line-height: 1.6;
11
+ padding: 2rem;
12
+ max-width: 800px;
13
+ margin: 0 auto;
14
+ background-color: #f8f9fa;
15
+ }
16
+
17
+ #app {
18
+ text-align: center;
19
+ }
20
+
21
+ h1 {
22
+ margin-bottom: 2rem;
23
+ color: #333;
24
+ font-size: 2.5rem;
25
+ }
26
+
27
+ h2 {
28
+ color: #555;
29
+ margin-bottom: 1rem;
30
+ font-size: 1.5rem;
31
+ }
32
+
33
+ .auth-container {
34
+ margin: 2rem 0;
35
+ }
36
+
37
+ .auth-button {
38
+ background-color: #ff9d00;
39
+ color: white;
40
+ border: none;
41
+ padding: 0.8rem 1.5rem;
42
+ border-radius: 6px;
43
+ font-size: 1rem;
44
+ cursor: pointer;
45
+ transition: background-color 0.2s ease;
46
+ }
47
+
48
+ .auth-button:hover {
49
+ background-color: #ff8500;
50
+ }
51
+
52
+ #content {
53
+ padding: 2rem;
54
+ background-color: white;
55
+ border-radius: 12px;
56
+ margin-top: 2rem;
57
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
58
+ }
59
+
60
+ .oauth-result {
61
+ background-color: #f8f9fa;
62
+ padding: 1.5rem;
63
+ border-radius: 8px;
64
+ text-align: left;
65
+ overflow-x: auto;
66
+ font-family: "Monaco", "Menlo", "Ubuntu Mono", "Consolas", monospace;
67
+ font-size: 0.9rem;
68
+ line-height: 1.4;
69
+ color: #333;
70
+ }
tsconfig.json CHANGED
@@ -1,14 +1,15 @@
1
  {
2
  "compilerOptions": {
3
- "outDir": "./dist",
4
- "module": "es6",
5
- "target": "es6",
6
  "moduleResolution": "node",
7
- "allowJs": true,
8
- "esModuleInterop": true,
9
  "strict": true,
10
- "lib": ["es2020", "dom"],
11
- "sourceMap": true
 
 
 
12
  },
13
- "include": ["src/**/*"]
 
14
  }
 
1
  {
2
  "compilerOptions": {
3
+ "target": "ES2015",
4
+ "module": "ES2015",
 
5
  "moduleResolution": "node",
 
 
6
  "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "outDir": "./dist",
11
+ "rootDir": "./src"
12
  },
13
+ "include": ["src/**/*"],
14
+ "exclude": ["node_modules"]
15
  }
vite.config.js DELETED
@@ -1,12 +0,0 @@
1
- import { defineConfig } from "vite";
2
-
3
- export default defineConfig({
4
- build: {
5
- outDir: "dist",
6
- emptyOutDir: true,
7
- sourcemap: true,
8
- },
9
- server: {
10
- open: true,
11
- },
12
- });