diff --git a/JSDOC_index.md b/JSDOC_index.md index dbeb01b..a03a719 100644 --- a/JSDOC_index.md +++ b/JSDOC_index.md @@ -27,7 +27,7 @@ The codebase is organized into several modules within the `scripts/` and `ghosty - **`db.js`**: IndexedDB management wrapper for persisting local state, images, and user preferences. - **`dom.js`**: UI manipulation and DOM interaction utilities, binding event listeners and handling interface state. - **`engine.js`**: Core orchestration layer that connects the rendering loops, models, and UI events. -- **`ghostati-mobile-ui.js`**: Specific user interface interactions tailored for mobile layouts and touch events. +- **`mobile-ui.js`**: Specific user interface interactions tailored for mobile layouts and touch events. - **`ghostyle3d-uv-renderer.js`**: Specialized logic for 3D model processing, UV mapping, and 3D rendering. - **`ghostyles-manager.js`**: Handles the loading, switching, and parsing of "Ghostyles" (camouflage styles). - **`main.js`**: Application entry point; initializes all subsystems and triggers the main application flow. diff --git a/README.md b/README.md index 3cee061..06b6f6a 100644 --- a/README.md +++ b/README.md @@ -13,26 +13,25 @@ The project combines webcam capture, [`face-api.js`](https://github.com/vladmand Primary links: -- Live project root: [https://sindacato.nina.watch/ghostati/](https://sindacato.nina.watch/ghostati/) -- Browser app: [ghostati.html](https://sindacato.nina.watch/ghostati/ghostati.html) -- Source code: [github.com/vecna/ghostati](https://github.com/vecna/ghostati) -- Ghostyle gallery / distribution site: [ghostyles.vecna.eu](https://ghostyles.vecna.eu) -- Generated API docs: [docs/](https://sindacato.nina.watch/ghostati/docs/) -- Legacy docs page: [ghostati-docs.html](https://sindacato.nina.watch/ghostati/ghostati-docs.html) -- Test coverage: [coverage/](https://sindacato.nina.watch/ghostati/coverage/) -- Project context page: [sindacato.nina.watch/it/iniziative/ghostati](https://sindacato.nina.watch/it/iniziative/ghostati/) +- first inception and italian workshop organization area: [https://sindacato.nina.watch/ghostati/](https://sindacato.nina.watch/ghostati/) +- Browser app: [lab.html](https://ghostmaxxing.vecna.eu/lab.html) +- Source code: [github.com/vecna/ghostmaxxing](https://github.com/vecna/ghostmaxxing) +- Ghostyle gallery [ghosmaxxing.vecna.eu/@ghostlyles](https://ghostmaxxing.vecna.eu/@ghostyles), it's on acivitypub, follow it via mastodon! +- Technical docs: [docs/](https://ghostmaxxing.vecna.eu/docs/) +- Test coverage: [coverage/](https://ghstmaxxing.vecna.eu/coverage/) - Sitemap: [sitemap.xml](https://sindacato.nina.watch/ghostati/sitemap.xml) -- Reference dataset: [REFERENCES.json](REFERENCES.json) -- Reference-update prompt: [PROMPT-REFERENCES-UPDATE.txt](PROMPT-REFERENCES-UPDATE.txt) +- Reference dataset: [references/REFERENCES.json](references/REFERENCES.json) +- Live pages: [lab.html](lab.html), [realtime.html](realtime.html), and [ghostyle-transfer.html](ghostyle-transfer.html) **Central field-reporting resource:** if you know of a place where facial recognition is being deployed, tested, procured, or hidden in public-space infrastructure, use the NINA submission node: [Raccontacelo](https://raccontaci.nina.watch/#/submission?context=10c78596-3ea0-4867-b2fb-21fdb8e3f40c). Reports about supplier, technology, data access, deployment context, limits, and abuses are project inputs, not side notes. # What the app does ```text - webcam ──► detector ──► landmarks ──► overlay renderer - │ │ │ - └──── baseline face DB ◄──┴──── compare ◄──┘ + webcam ──► landmarks ──► save your face ──► overlay renderer + ──► or do actual makeup + │ │ + ─ share the sucess ◄──┴──── compare ◄──┘ ``` The app is designed around a simple experimental loop: @@ -40,37 +39,36 @@ The app is designed around a simple experimental loop: 1. Start the webcam in a modern browser. 2. Load face-detection and landmark models. 3. Save a local baseline descriptor for a consenting test face. -4. Apply a Ghostyle overlay to the live video/canvas layer. +4. Apply a Ghostyle overlay, or, paint your own (it's the default!) to the live video/canvas layer. 5. Re-run detection and recognition against the saved descriptor. 6. Observe whether the pipeline still detects the face, extracts landmarks, and matches the baseline. -Core capabilities: +Key runtime files and responsibilities: -- live webcam setup and teardown through [`scripts/camera.js`](scripts/camera.js); +- webcam setup and teardown through [`scripts/camera.js`](scripts/camera.js); - face detection, landmarks, descriptors, and match orchestration through [`scripts/engine.js`](scripts/engine.js); - 3D/MediaPipe loop support through [`scripts/mediapipe-loop.js`](scripts/mediapipe-loop.js) and [`scripts/engine-3d.js`](scripts/engine-3d.js); - bounding-box overlays through [`scripts/bbox-overlay.js`](scripts/bbox-overlay.js); - dynamic Ghostyle loading through [`scripts/ghostyles-manager.js`](scripts/ghostyles-manager.js); - 3D plugin loading through [`scripts/plugins3d-loader.js`](scripts/plugins3d-loader.js); - IndexedDB-backed local state through [`scripts/db.js`](scripts/db.js); -- DOM and UI bindings through [`scripts/dom.js`](scripts/dom.js), [`scripts/main.js`](scripts/main.js), and [`scripts/ghostati-mobile-ui.js`](scripts/ghostati-mobile-ui.js); +- DOM and UI bindings through [`scripts/dom.js`](scripts/dom.js), [`scripts/main.js`](scripts/main.js), and [`scripts/mobile-ui.js`](scripts/mobile-ui.js); - image/makeup export helpers through [`scripts/export-makeup.js`](scripts/export-makeup.js); -- landing-page animation through [`scripts/index-effect.js`](scripts/index-effect.js). +- homepage interaction through [`scripts/home.js`](scripts/home.js). # Runtime architecture ```text - ghostati.html - ├─ @vladmandic/face-api - ├─ @mediapipe/tasks-vision - ├─ scripts/main.js - │ ├─ camera.js - │ ├─ engine.js - │ ├─ db.js - │ ├─ dom.js - │ └─ ghostyles-manager.js - ├─ ghostyles.json - └─ ghostyles/*.js +lab.html + ├─ face-api.js / MediaPipe Tasks Vision + ├─ scripts/main.js + │ ├─ camera.js — webcam stream lifecycle + │ ├─ engine.js — detection, landmarks, descriptors, matching + │ ├─ db.js — local IndexedDB state + │ ├─ dom.js — DOM wiring and UI state + │ └─ ghostyles-manager.js — Ghostyle discovery and dynamic loading + ├─ ghostyles.json — manifest of available Ghostyles + └─ ghostyles/*.js — overlay modules rendered on top of the canvas/video layer ``` The project is a static web app: there is no production build step required to open the interface locally. The browser loads HTML, CSS, JavaScript modules, model assets, and plugin manifests. @@ -80,10 +78,12 @@ Important local entry points: - [`index.html`](index.html) — public landing page with links to code, docs, coverage, Ghostyles, project context, and the reporting node. - [`lab.html`](lab.html) — translated main webcam/AR application. - [`loader.html`](loader.html) — translated internal MP4 loader for repeatable 2D/3D video tests. -- [`ghostati.html`](ghostati.html) — legacy main webcam/AR application entry point. +- [`realtime.html`](realtime.html) — realtime interface entry point. +- [`ghostyle-transfer.html`](ghostyle-transfer.html) — transfer-oriented interface entry point. +- [`ghostati.html`](ghostati.html) — legacy webcam/AR application entry point. - [`ghostyles.json`](ghostyles.json) — Ghostyle manifest. -- [`JSDOC_README.md`](JSDOC_README.md) — concise generated-docs overview. -- [`REFERENCES.json`](REFERENCES.json) — curated technical/cultural reference set. +- [`JSDOC_index.md`](JSDOC_index.md) — concise generated-docs overview. +- [`references/REFERENCES.json`](references/REFERENCES.json) — curated technical/cultural reference set. # Localization coverage @@ -97,8 +97,7 @@ Other static pages such as [`about.html`](about.html), [`report.html`](report.ht Runtime external dependencies visible from the HTML/config layer: -- [Google Fonts](https://fonts.googleapis.com) / [Google Fonts static assets](https://fonts.gstatic.com) -- [Landing-page Google Fonts CSS](https://fonts.googleapis.com/css2?family=League+Script&family=Outfit:wght@400;600;700;800;900&family=JetBrains+Mono:wght@400;700&display=swap) +- Local vendored Google Fonts CSS/assets in `styles/vendor/` (`Inter`, `JetBrains Mono`, `League Script`, `Outfit`) - [jsDelivr CDN](https://cdn.jsdelivr.net) - [`@vladmandic/face-api`](https://cdn.jsdelivr.net/npm/@vladmandic/face-api/dist/face-api.js) - [face-api.js model weights](https://cdn.jsdelivr.net/gh/justadudewhohacks/face-api.js-models@master/) @@ -117,8 +116,8 @@ For workshops or higher-risk demos, prefer self-hosting model and library assets Clone the repository: ```bash -git clone https://github.com/vecna/ghostati.git -cd ghostati +git clone https://github.com/vecna/ghostmaxxing.git +cd ghostmaxxing ``` Install development dependencies: @@ -135,10 +134,10 @@ npx http-server . python3 -m http.server 8000 ``` -Open the app: +Open the main lab app: ```text -http://localhost:8000/ghostati.html +http://localhost:8000/lab.html ``` Open the landing page: @@ -161,15 +160,15 @@ http://localhost:8000/ A **Ghostyle** is a JavaScript module that draws an overlay anchored to a detected face. It can be local or loaded through a manifest. -Start from [`ghostyles/00-template.js`](ghostyles/00-template.js), then add the file to [`ghostylist.json`](ghostylist.json). Existing 2D examples include: +Start from [`ghostyles/00-template.js`](ghostyles/00-template.js), then add the file to [`ghostyles.json`](ghostyles.json). Existing examples include: -- [`ghostyles/graphic-liner.js`](ghostyles/graphic-liner.js) +- [`ghostyles/beauty-2d.js`](ghostyles/beauty-2d.js) +- [`ghostyles/brush.js`](ghostyles/brush.js) +- [`ghostyles/cv-dazzle-1.js`](ghostyles/cv-dazzle-1.js) +- [`ghostyles/maximalism.js`](ghostyles/maximalism.js) - [`ghostyles/smokey-eyes.js`](ghostyles/smokey-eyes.js) -- [`ghostyles/blush-lift.js`](ghostyles/blush-lift.js) -- [`ghostyles/lip-tint.js`](ghostyles/lip-tint.js) - [`ghostyles/soft-contour.js`](ghostyles/soft-contour.js) -- [`ghostyles/stage-mask.js`](ghostyles/stage-mask.js) -- [`ghostyles/splash.js`](ghostyles/splash.js) +- [`ghostyles/uv-stripes.js`](ghostyles/uv-stripes.js) A minimal 2D plugin shape: @@ -193,12 +192,7 @@ export function onClear(ctx) { } ``` -3D/MediaPipe-oriented examples live in: - -- [`ghostyles3d/prove-stripes.js`](ghostyles3d/prove-stripes.js) -- [`ghostyles3d/uv-stripes.js`](ghostyles3d/uv-stripes.js) - -Register them in [`ghostylist3d.json`](ghostylist3d.json). +Plugins that expose MediaPipe/UV hooks are loaded through the same manifest. The current UV-capable example is [`ghostyles/uv-stripes.js`](ghostyles/uv-stripes.js). # Testing and generated docs @@ -312,28 +306,3 @@ Current reference links: - [HyperFace](https://adam.harvey.studio/hyperface/) — Adam Harvey, 2016 · `artistic` · closeness `92` - [Adversarial Manipulation of Deep Representations](https://arxiv.org/abs/1511.05122) — Sara Sabour, Yanshuai Cao, Fartash Faghri et al., 2015 · `research` · closeness `45` - [CV Dazzle](https://adam.harvey.studio/cvdazzle/) — Adam Harvey, 2010 · `artistic` · closeness `100` - -# Contributing - -```text - small patch - - - - - - - - - - - - - - -## Recent changes -- `85f9100` internationalization added, three languages -- `697c972` JSdoc improvements -- `1a49dea` added condition for face not found during composite analysis -- `3b32d40` deleted some dead code and improved UT -- `b09f30a` removal of duplicated code \ No newline at end of file diff --git a/ghostyle-transfer.html b/ghostyle-transfer.html index 5c681af..67c71a8 100644 --- a/ghostyle-transfer.html +++ b/ghostyle-transfer.html @@ -19,7 +19,7 @@ - +
diff --git a/index.html b/index.html index 4baff5a..621b83e 100644 --- a/index.html +++ b/index.html @@ -63,7 +63,7 @@
Every possible reference should be read and transformed into the format of REFERENCES.json,
- check out on github
- (https://github.com/vecna/ghostati/blob/rebranding/ghostmaxxing/references/REFERENCES.json) how detailed
- is.
Once you're sure it might suit us, and potentially we can even program a Ghostyle to retest it, please
open an issue or submit a pull request.
Every possible reference should be read and transformed into the format of REFERENCES.json,
- check out on github
- (https://github.com/vecna/ghostati/blob/rebranding/ghostmaxxing/references/REFERENCES.json) how detailed
- is.
Once you're sure it might suit us, and potentially we can even program a Ghostyle to retest it, please
open an issue or submit a pull request.
=d;)S/=2,M/=2,B>>>=1;return(S+B)/M};return $.int32=function(){return D.g(4)|0},$.quick=function(){return D.g(4)/4294967296},$.double=$,y(v(D.S),a),(N.pass||C||function(S,M,B,U){return U&&(U.S&&g(U,D),S.state=function(){return g(D,{})}),B?(r[l]=S,M):S})($,F,"global"in N?N.global:this==r,N.state)}function f(I){var N,C=I.length,_=this,F=0,D=_.i=_.j=0,$=_.S=[];for(C||(I=[C++]);F{var n=VR(),a=UR(),r=GR(),s=HR(),i=jR(),o=qR(),l=XR();l.alea=n,l.xor128=a,l.xorwow=r,l.xorshift7=s,l.xor4096=i,l.tychei=o,t.exports=l}),QS=Vt(()=>{}),Fv=Vt(()=>{}),eN=Vt(()=>{}),YR=Vt(()=>{}),ZR=Vt(()=>{}),JR=Vt(()=>{}),QR=Vt((e,t)=>{var n=(()=>{var a=typeof document!="undefined"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename!="undefined"&&(a=a||__filename),function(r){r=r||{};function s(){return ue.buffer!=Re&&ut(ue.buffer),gt}function i(){return ue.buffer!=Re&&ut(ue.buffer),jn}function o(){return ue.buffer!=Re&&ut(ue.buffer),Ot}function l(){return ue.buffer!=Re&&ut(ue.buffer),cn}function u(){return ue.buffer!=Re&&ut(ue.buffer),Fn}function p(){return ue.buffer!=Re&&ut(ue.buffer),la}function d(){return ue.buffer!=Re&&ut(ue.buffer),$n}var c=typeof r!="undefined"?r:{},h,m;c.ready=new Promise(function(R,j){h=R,m=j});var f;typeof process!="undefined"&&process.listeners&&(f={uncaughtException:process.listeners("uncaughtException"),unhandledRejection:process.listeners("unhandledRejection")});var g=Object.assign({},c),b=[],y="./this.program",x=(R,j)=>{throw j},v=typeof window=="object",I=typeof importScripts=="function",N=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",C=c.ENVIRONMENT_IS_PTHREAD||!1,_="";function F(R){return c.locateFile?c.locateFile(R,_):_+R}var D,$,S,M;function B(R){R instanceof js||J("exiting due to exception: "+R)}if(N){var U=Fv(),H=eN();I?_=H.dirname(_)+"/":_=__dirname+"/",D=(j,le)=>(j=_l(j)?new URL(j):H.normalize(j),U.readFileSync(j,le?void 0:"utf8")),S=j=>{var le=D(j,!0);return le.buffer||(le=new Uint8Array(le)),le},$=(j,le,Ne)=>{j=_l(j)?new URL(j):H.normalize(j),U.readFile(j,function(Me,Fe){Me?Ne(Me):le(Fe.buffer)})},process.argv.length>1&&(y=process.argv[1].replace(/\\/g,"/")),b=process.argv.slice(2),process.on("uncaughtException",function(j){if(!(j instanceof js))throw j}),process.on("unhandledRejection",function(j){throw j}),x=(j,le)=>{if(Na())throw process.exitCode=j,le;B(le),process.exit(j)},c.inspect=function(){return"[Emscripten Module object]"};let R;try{R=YR()}catch(j){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),j}global.Worker=R.Worker}else(v||I)&&(I?_=self.location.href:typeof document!="undefined"&&document.currentScript&&(_=document.currentScript.src),typeof a!="undefined"&&a&&(_=a),_.indexOf("blob:")!==0?_=_.substr(0,_.replace(/[?#].*/,"").lastIndexOf("/")+1):_="",N||(D=R=>{var j=new XMLHttpRequest;return j.open("GET",R,!1),j.send(null),j.responseText},I&&(S=R=>{var j=new XMLHttpRequest;return j.open("GET",R,!1),j.responseType="arraybuffer",j.send(null),new Uint8Array(j.response)}),$=(R,j,le)=>{var Ne=new XMLHttpRequest;Ne.open("GET",R,!0),Ne.responseType="arraybuffer",Ne.onload=()=>{if(Ne.status==200||Ne.status==0&&Ne.response){j(Ne.response);return}le()},Ne.onerror=le,Ne.send(null)}),M=R=>document.title=R);N&&typeof performance=="undefined"&&(global.performance=ZR().performance);var q=console.log.bind(console),K=console.warn.bind(console);N&&(q=R=>U.writeSync(1,R+`
+`),K=R=>U.writeSync(2,R+`
+`));var Z=c.print||q,J=c.printErr||K;Object.assign(c,g),g=null,c.arguments&&(b=c.arguments),c.thisProgram&&(y=c.thisProgram),c.quit&&(x=c.quit);var ee=4,ae=Atomics.load,te=Atomics.store,se=Atomics.compareExchange,ie;c.wasmBinary&&(ie=c.wasmBinary);var ve=c.noExitRuntime||!0;typeof WebAssembly!="object"&&Hs("no native wasm support detected");var ue,ye,ke=!1,Se;function Le(R,j){R||Hs(j)}var Ge=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;function mt(R,j,le){j>>>=0;for(var Ne=j+le,Me=j;R[Me]&&!(Me>=Ne);)++Me;if(Me-j>16&&R.buffer&&Ge)return Ge.decode(R.buffer instanceof SharedArrayBuffer?R.slice(j,Me):R.subarray(j,Me));for(var Fe="";jl*u)*(a?2:1);for(let l=0;lr*s)*(n?2:1);if(a===0)return[];if(a!==t.length)throw new Error(`[${e}] does not match the input size ${t.length}${n?" for a complex tensor":""}.`);return pN(0,e,t,n)}function mM(e,t){if(Array.isArray(e))return e;if(t==="float32")return e instanceof Float32Array?e:new Float32Array(e);if(t==="int32")return e instanceof Int32Array?e:new Int32Array(e);if(t==="bool"||t==="string")return Uint8Array.from(new Int32Array(e));throw new Error(`Unknown dtype ${t}`)}function Dv(e,t){let n=Dm(e,t);for(let a=0;a`Error in localResponseNormalization: x must be rank 3 or 4 but got
+ rank ${s.rank}.`),A(Hl(t),()=>`Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);let i=s,o=!1;s.rank===3&&(o=!0,i=W(s,[1,s.shape[0],s.shape[1],s.shape[2]]));let l={x:i},u={depthRadius:t,bias:n,alpha:a,beta:r},p=P.runKernel(uo,l,u);return o?W(p,[p.shape[1],p.shape[2],p.shape[3]]):p}var Sw=L({localResponseNormalization_:H3});function j3(e){let t={x:E(e,"x","log","float32")};return P.runKernel(oo,t)}var ta=L({log_:j3});function q3(e){let t={x:E(e,"x","log1p")};return P.runKernel(lo,t)}var gd=L({log1p_:q3});function K3(e){return A(us(e),()=>"The f passed in grad(f) must be a function"),(t,n)=>{let a=E(t,"x","tf.grad","string_or_numeric"),r=n!=null?E(n,"dy","tf.grad"):null;return P.tidy(()=>{let{value:s,grads:i}=P.gradients(()=>e(a),[a],r);return r!=null&&Nn(s.shape,r.shape,"The shape of dy passed in grad(f)(x, dy) must match the shape returned by f(x)"),sf(i),i[0]})}}function X3(e){return A(us(e),()=>"The f passed in grads(f) must be a function"),(t,n)=>{A(Array.isArray(t),()=>"The args passed in grads(f)(args) must be an array of `Tensor`s or `TensorLike`s");let a=Ic(t,"args","tf.grads","string_or_numeric"),r=n!=null?E(n,"dy","tf.grads"):null;return P.tidy(()=>{let{value:s,grads:i}=P.gradients(()=>e(...a),a,r);return r!=null&&Nn(s.shape,r.shape,"The shape of dy passed in grads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),sf(i),i})}}function Y3(e){return A(us(e),()=>"The f passed in valueAndGrad(f) must be a function"),(t,n)=>{A(t instanceof Ce,()=>"The x passed in valueAndGrad(f)(x) must be a tensor"),A(n==null||n instanceof Ce,()=>"The dy passed in valueAndGrad(f)(x, dy) must be a tensor");let{grads:a,value:r}=P.gradients(()=>e(t),[t],n);return sf(a),{grad:a[0],value:r}}}function Z3(e){return A(us(e),()=>"The f passed in valueAndGrads(f) must be a function"),(t,n)=>{A(Array.isArray(t)&&t.every(r=>r instanceof Ce),()=>"The args passed in valueAndGrads(f)(args) must be array of tensors"),A(n==null||n instanceof Ce,()=>"The dy passed in valueAndGrads(f)(args, dy) must be a tensor");let a=P.gradients(()=>e(...t),t,n);return n!=null&&Nn(a.value.shape,n.shape,"The shape of dy passed in valueAndGrads(f)([x1,...], dy) must match the shape returned by f([x1,...])"),sf(a.grads),a}}function rT(e,t){A(us(e),()=>"The f passed in variableGrads(f) must be a function"),A(t==null||Array.isArray(t)&&t.every(u=>u instanceof cs),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");let n=t!=null;if(!n){t=[];for(let u in P.registeredVariables)t.push(P.registeredVariables[u])}let a=n?t.filter(u=>!u.trainable):null,r=t.length;t=t.filter(u=>u.trainable),A(t.length>0,()=>`variableGrads() expects at least one of the input variables to be trainable, but none of the ${r} variables is trainable.`);let s=!0,{value:i,grads:o}=P.gradients(e,t,null,s);A(o.some(u=>u!=null),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),A(i.rank===0,()=>`The f passed in variableGrads(f) must return a scalar, but it returned a rank-${i.rank} tensor`);let l={};return t.forEach((u,p)=>{o[p]!=null&&(l[u.name]=o[p])}),a!=null&&a.forEach(u=>l[u.name]=null),{value:i,grads:l}}function dr(e){return P.customGrad(e)}function sf(e){if(e.filter(t=>t==null).length>0)throw new Error(`Cannot compute gradient of y=f(x) with respect to x. Make sure that
+ the f you passed encloses all operations that lead from x to y.`)}function J3(e){let t={x:E(e,"x","neg")};return P.runKernel(Wu,t)}var yt=L({neg_:J3});function Q3(e){let t={x:E(e,"x","softplus")};return P.runKernel(Lo,t)}var jo=L({softplus_:Q3});function eL(e){let t=E(e,"x","logSigmoid");return dr(n=>({value:yt(jo(yt(n))),gradFunc:a=>z(a,ma(yt(n)))}))(t)}var Nw=L({logSigmoid_:eL});function tL(e,t){let n=E(e,"a","sub"),a=E(t,"b","sub");[n,a]=At(n,a);let r={a:n,b:a};return P.runKernel(Uo,r)}var pe=L({sub_:tL});function nL(e,t=-1){let n=E(e,"logits","logSoftmax");if(t===-1&&(t=n.rank-1),t!==n.rank-1)throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and axis was ${t}`);return dr((a,r)=>{let s=fa(a,t,!0),i=pe(a,s),o=pe(re(i,"float32"),ta(fe(mn(i),t,!0)));return r([o]),{value:o,gradFunc:(l,u)=>{let[p]=u,d=!0,c=mn(p);return pe(l,z(fe(l,t,d),c))}}})(n)}var of=L({logSoftmax_:nL});function aL(e,t=null,n=!1){let a=E(e,"x","logSumExp"),r=$a(t,a.shape),s=fa(a,r,!0),i=pe(a,s),o=mn(i),l=fe(o,r),u=ta(l),p=X(W(s,u.shape),u);if(n){let d=gi(p.shape,r);return W(p,d)}return p}var bd=L({logSumExp_:aL});function rL(e,t){let n=E(e,"a","logicalAnd","bool"),a=E(t,"b","logicalAnd","bool");ct(n.shape,a.shape);let r={a:n,b:a};return P.runKernel(Ru,r)}var Fa=L({logicalAnd_:rL});function sL(e){let t={x:E(e,"x","logicalNot","bool")};return P.runKernel(Mu,t)}var yd=L({logicalNot_:sL});function iL(e,t){let n=E(e,"a","logicalOr","bool"),a=E(t,"b","logicalOr","bool");ct(n.shape,a.shape);let r={a:n,b:a};return P.runKernel(Ou,r)}var lf=L({logicalOr_:iL});function oL(e,t){let n=E(e,"a","logicalXor","bool"),a=E(t,"b","logicalXor","bool");return ct(n.shape,a.shape),Fa(lf(e,t),yd(Fa(e,t)))}var Tw=L({logicalXor_:oL}),Rh=2147483648;function lL(e,t,n="left"){let a=E(e,"sortedSequence","searchSorted"),r=E(t,"values","searchSorted"),s=a.shape[a.shape.length-1],i=r.shape[r.shape.length-1],o=W(a,[-1,s]),l=W(r,[-1,i]);if(o.rank<2)throw new Error("Sorted input argument must be at least 2-dimensional");if(o.shape[0]!==l.shape[0])throw new Error("Leading dimension of 'sortedSequence' and 'values' must match.");if(ot(l.shape)>=Rh)throw new Error(`values tensor size must less than ${Rh}`);if(o.shape[1]>=Rh)throw new Error(`trailing dim_size must less than ${Rh} for int32 output type, was ${o.shape[1]}`);let u={sortedSequence:o,values:l},p={side:n};return P.runKernel(Ju,u,p)}var uf=L({searchSorted_:lL});function sT(e,t){return uf(e,t,"left")}function uL(e,t,n,a,r){let s=E(e,"x","maxPool"),i=1,o=s,l=!1;s.rank===3&&(l=!0,o=W(s,[1,s.shape[0],s.shape[1],s.shape[2]])),A(o.rank===4,()=>`Error in maxPool: input must be rank 4 but got rank ${o.rank}.`),A(mr(n,i),()=>`Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '${i}'`),Tn("maxPool",a,r);let u={x:o},p={filterSize:t,strides:n,pad:a,dimRoundingMode:r},d=P.runKernel(ho,u,p);return l?W(d,[d.shape[1],d.shape[2],d.shape[3]]):d}var Dt=L({maxPool_:uL});function pL(e,t=[1,1,1],n,a,r,s="NDHWC"){let i=E(e,"x","maxPool3d"),o=i,l=!1;i.rank===4&&(l=!0,o=W(i,[1,i.shape[0],i.shape[1],i.shape[2],i.shape[3]])),A(o.rank===5,()=>`Error in maxPool3d: x must be rank 5 but got rank ${o.rank}.`),A(s==="NDHWC",()=>`Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of ${s}`),Tn("maxPool3d",a,r);let u={x:o},p={filterSize:t,strides:n,pad:a,dimRoundingMode:r,dataFormat:s},d=P.runKernel(Lu,u,p);return l?W(d,[d.shape[1],d.shape[2],d.shape[3],d.shape[4]]):d}var Cw=L({maxPool3d_:pL});function cL(e,t,n,a,r=!1){let s={x:E(e,"x","maxPoolWithArgmax")},i={filterSize:t,strides:n,pad:a,includeBatchInIndex:r},o=P.runKernel(Kc,s,i);return{result:o[0],indexes:o[1]}}var iT=L({maxPoolWithArgmax_:cL});function dL(e,t){let n=E(e,"a","maximum"),a=E(t,"b","maximum");[n,a]=At(n,a),n.dtype==="bool"&&(n=re(n,"int32"),a=re(a,"int32")),ct(n.shape,a.shape);let r={a:n,b:a};return P.runKernel(co,r)}var fr=L({maximum_:dL});function hL(e,t=null,n=!1){let a={x:E(e,"x","mean")},r={axis:t,keepDims:n};return P.runKernel(mo,a,r)}var Et=L({mean_:hL});function It(e,t="float32"){if(ra(e),t==="complex64"){let a=It(e,"float32"),r=It(e,"float32");return Fr(a,r)}let n=Dm(ot(e),t);return P.makeTensor(n,e,t)}function Pn(e,t="float32"){if(ra(e),t==="complex64"){let a=Pn(e,"float32"),r=It(e,"float32");return Fr(a,r)}let n=Dv(ot(e),t);return P.makeTensor(n,e,t)}function oT(e,t,{indexing:n="xy"}={}){if(n!=="xy"&&n!=="ij")throw new TypeError(`${n} is not a valid third argument to meshgrid`);if(e===void 0)return[];let a=E(e,"x","meshgrid",e instanceof Ce?e.dtype:"float32");if(t===void 0)return[a];let r=E(t,"y","meshgrid",t instanceof Ce?t.dtype:"float32"),s=ot(a.shape),i=ot(r.shape);return n==="xy"?(a=W(a,[1,-1]),r=W(r,[-1,1]),[$e(Pn([i,1],a.dtype),a),$e(r,Pn([1,s],r.dtype))]):(a=W(a,[-1,1]),r=W(r,[1,-1]),[$e(a,Pn([1,i],a.dtype)),$e(Pn([s,1],r.dtype),r)])}function mL(e,t){let n=E(e,"a","minimum"),a=E(t,"b","minimum");[n,a]=At(n,a),n.dtype==="bool"&&(n=re(n,"int32"),a=re(a,"int32")),ct(n.shape,a.shape);let r={a:n,b:a};return P.runKernel(go,r)}var gs=L({minimum_:mL});function fL(e,t,n){A(n==="reflect"||n==="symmetric",()=>`Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);let a=E(e,"x","mirrorPad");if(a.rank===0)throw new Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");A(t.length===a.rank,()=>`Padding doesn't match input. Must be ${a.rank}. Got ${t.length}.`);let r=n==="reflect"?1:0;for(let o=0;o= 0 but got ${t}`);if(t>r)throw new Error(`'k' passed to topk() must be <= the last dimension (${r}) but got ${t}`);let s={x:a},i={k:t,sorted:n},[o,l]=P.runKernel(ip,s,i);return{values:o,indices:l}}var Bw=L({topk_:Mz});function Oz(e,t=0,n=1,a,r){if(ra(e),a!=null&&a==="bool")throw new Error("Unsupported data type $ { dtype }");let s=new Mw(t,n,a,!0,r),i=Pe(e,a);for(let o=0;oo).reverse()),A(a.rank===t.length,()=>`Error in transpose: rank of input ${a.rank} must match length of perm ${t}.`),t.forEach(i=>{A(i>=0&&is[1]?s[1]:i}}var w4="4.22.0",I2=class{static sgd(e){return new _f(e)}static momentum(e,t,n=!1){return new e0(e,t,n)}static rmsprop(e,t=.9,n=0,a=null,r=!1){return new t0(e,t,n,a,r)}static adam(e=.001,t=.9,n=.999,a=null){return new Jw(e,t,n,a)}static adadelta(e=.001,t=.95,n=null){return new Yw(e,t,n)}static adamax(e=.002,t=.9,n=.999,a=null,r=0){return new Qw(e,t,n,a,r)}static adagrad(e,t=.1){return new Zw(e,t)}},Zs=I2,k4=typeof requestAnimationFrame!="undefined"?requestAnimationFrame:typeof setImmediate!="undefined"?setImmediate:e=>e();function s0(){return new Promise(e=>k4(()=>e()))}var T={};_e(T,{ERF_A1:()=>P4,ERF_A2:()=>L4,ERF_A3:()=>z4,ERF_A4:()=>W4,ERF_A5:()=>B4,ERF_P:()=>O4,PARALLELIZE_THRESHOLD:()=>i0,RowPartitionType:()=>nr,SELU_SCALE:()=>N2,SELU_SCALEALPHA:()=>S2,applyActivation:()=>Cf,assertAndGetBroadcastShape:()=>ct,assertAxesAreInnerMostDims:()=>x3,assertParamsConsistent:()=>I4,assignToTypedArray:()=>q4,axesAreInnerMostDims:()=>bw,calculateShapes:()=>$T,checkEinsumDimSizes:()=>Q4,checkPadOnDimRoundingMode:()=>Tn,combineLocations:()=>QN,combineRaggedTensorToTensorShapes:()=>N4,complexWithEvenIndex:()=>G4,complexWithOddIndex:()=>H4,computeConv2DInfo:()=>cd,computeConv3DInfo:()=>GN,computeDefaultPad:()=>Qv,computeDilation2DInfo:()=>bP,computeOptimalWindowSize:()=>_4,computeOutAndReduceShapes:()=>eT,computeOutShape:()=>S4,computePool2DInfo:()=>UN,computePool3DInfo:()=>yP,convertConv2DDataFormat:()=>HN,decodeEinsumEquation:()=>Z4,eitherStridesOrDilationsAreOne:()=>mr,expandShapeToKeepDim:()=>gi,exponent:()=>X4,exponents:()=>K4,fromStringArrayToUint8:()=>vV,fromUint8ToStringArray:()=>xV,getAxesPermutation:()=>tT,getBroadcastDims:()=>ZN,getComplexWithIndex:()=>j4,getEinsumComputePath:()=>eV,getEinsumPermutation:()=>J4,getFusedBiasGradient:()=>Tf,getFusedDyActivation:()=>Nf,getImageCenter:()=>A4,getInnerMostAxes:()=>v3,getPermuted:()=>$4,getRaggedRank:()=>C4,getReductionAxes:()=>Bt,getReshaped:()=>F4,getReshapedPermuted:()=>D4,getRowPartitionTypesHelper:()=>T4,getSliceBeginCoords:()=>R4,getSliceSize:()=>M4,getSparseFillEmptyRowsIndicesDenseShapeMismatch:()=>rV,getSparseFillEmptyRowsNegativeIndexErrorMessage:()=>sV,getSparseFillEmptyRowsOutOfRangeIndexErrorMessage:()=>iV,getSparseReshapeEmptyTensorZeroOutputDimErrorMessage:()=>uV,getSparseReshapeInputOutputMismatchErrorMessage:()=>cV,getSparseReshapeInputOutputMultipleErrorMessage:()=>pV,getSparseReshapeMultipleNegativeOneOutputDimErrorMessage:()=>oV,getSparseReshapeNegativeOutputDimErrorMessage:()=>lV,getSparseSegmentReductionIndicesOutOfRangeErrorMessage:()=>fV,getSparseSegmentReductionNegativeSegmentIdsErrorMessage:()=>dV,getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage:()=>hV,getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage:()=>mV,getUndoAxesPermutation:()=>yw,isIdentityPermutation:()=>tV,log:()=>CM,mergeRealAndImagArrays:()=>V4,prepareAndValidate:()=>h2,prepareSplitSize:()=>aV,segment_util:()=>T2,shouldFuse:()=>Ef,slice_util:()=>Kt,splitRealAndImagArrays:()=>U4,stridesOrDilationsArePositive:()=>fi,tupleValuesAreOne:()=>ms,upcastType:()=>ga,validateDefaultValueShape:()=>E4,validateInput:()=>wf,validateUpdateShape:()=>Ww,warn:()=>ts});function I4(e,t){let n=e[0].length;e.forEach((r,s)=>{A(r.length===n,()=>`Error in concat${n}D: rank of tensors[${s}] must be the same as the rank of the rest (${n})`)}),A(t>=0&&t=t*2+1||i%2===1?s.push(i):r.push(i);a.push(...r),a.push(0),a.push(...s)}return a}function D4(e,t,n,a=!0){let r=[];a?r.push(e[0]/n):r.push(e[0]*n);for(let s=1;s({x:()=>qe(e)})},SG=[C2,wV,kV,IV,SV,NV,TV,CV,EV,_V,AV,FV,RV,PV,LV,zV,WV,BV,VV,UV,GV,HV,qV,jV,YV,ZV,JV,QV,eU,tU,HU,nU,aU,rU,sU,iU,lU,oU,uU,pU,cU,dU,hU,mU,fU,gU,bU,yU,xU,kU,DI,DI,IU,TU,_U,AU,FU,$U,DU,RU,MU,OU,PU,LU,zU,RI,RI,WU,BU,GU,jU,qU,KU,XU,YU,ZU,JU,QU,eG,tG,nG,aG,rG,sG,iG,oG,lG,uG,MI,MI,OI,OI,pG,dG,cG,hG,mG,fG,gG,bG,yG,xG,vG,wG,IG];for(let e of SG)gN(e);Q().prototype.abs=function(){return this.throwIfDisposed(),Lt(this)};Q().prototype.acos=function(){return this.throwIfDisposed(),Hv(this)};Q().prototype.acosh=function(){return this.throwIfDisposed(),jv(this)};Q().prototype.add=function(e){return this.throwIfDisposed(),X(this,e)};Q().prototype.all=function(e,t){return this.throwIfDisposed(),Jm(this,e,t)};Q().prototype.any=function(e,t){return this.throwIfDisposed(),Sc(this,e,t)};Q().prototype.argMax=function(e){return this.throwIfDisposed(),mi(this,e)};Q().prototype.argMin=function(e){return this.throwIfDisposed(),qv(this,e)};Q().prototype.asScalar=function(){return this.throwIfDisposed(),A(this.size===1,()=>"The array must have only 1 element."),W(this,[])};Q().prototype.asType=function(e){return this.throwIfDisposed(),re(this,e)};Q().prototype.as1D=function(){return this.throwIfDisposed(),W(this,[this.size])};Q().prototype.as2D=function(e,t){return this.throwIfDisposed(),W(this,[e,t])};Q().prototype.as3D=function(e,t,n){return this.throwIfDisposed(),W(this,[e,t,n])};Q().prototype.as4D=function(e,t,n,a){return this.throwIfDisposed(),W(this,[e,t,n,a])};Q().prototype.as5D=function(e,t,n,a,r){return this.throwIfDisposed(),W(this,[e,t,n,a,r])};Q().prototype.asin=function(){return this.throwIfDisposed(),Kv(this)};Q().prototype.asinh=function(){return this.throwIfDisposed(),Xv(this)};Q().prototype.atan=function(){return this.throwIfDisposed(),Yv(this)};Q().prototype.atan2=function(e){return this.throwIfDisposed(),Zv(this,e)};Q().prototype.atanh=function(){return this.throwIfDisposed(),Jv(this)};Q().prototype.avgPool=function(e,t,n,a){return this.throwIfDisposed(),xa(this,e,t,n,a)};Q().prototype.batchToSpaceND=function(e,t){return this.throwIfDisposed(),dd(this,e,t)};Q().prototype.batchNorm=function(e,t,n,a,r){return this.throwIfDisposed(),_s(this,e,t,n,a,r)};Q().prototype.broadcastTo=function(e){return this.throwIfDisposed(),si(this,e)};Q().prototype.cast=function(e){return this.throwIfDisposed(),re(this,e)};Q().prototype.ceil=function(){return this.throwIfDisposed(),sw(this)};Q().prototype.clipByValue=function(e,t){return this.throwIfDisposed(),an(this,e,t)};Q().prototype.concat=function(e,t){return this.throwIfDisposed(),e instanceof Ce&&(e=[e]),et([this,...e],t)};Q().prototype.conv1d=function(e,t,n,a,r,s){return this.throwIfDisposed(),Qm(this,e,t,n,a,r,s)};Q().prototype.conv2dTranspose=function(e,t,n,a,r){return this.throwIfDisposed(),ef(this,e,t,n,a,r)};Q().prototype.conv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),$t(this,e,t,n,a,r,s)};Q().prototype.cos=function(){return this.throwIfDisposed(),hd(this)};Q().prototype.cosh=function(){return this.throwIfDisposed(),tf(this)};Q().prototype.cumprod=function(e,t,n){return this.throwIfDisposed(),Cc(this,e,t,n)};Q().prototype.cumsum=function(e,t,n){return this.throwIfDisposed(),nf(this,e,t,n)};Q().prototype.depthToSpace=function(e,t){return this.throwIfDisposed(),hw(this,e,t)};Q().prototype.depthwiseConv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),As(this,e,t,n,a,r,s)};Q().prototype.dilation2d=function(e,t,n,a,r){return this.throwIfDisposed(),mw(this,e,t,n,a,r)};Q().prototype.divNoNan=function(e){return this.throwIfDisposed(),fw(this,e)};Q().prototype.div=function(e){return this.throwIfDisposed(),he(this,e)};Q().prototype.dot=function(e){return this.throwIfDisposed(),gw(this,e)};Q().prototype.elu=function(){return this.throwIfDisposed(),dp(this)};Q().prototype.equal=function(e){return this.throwIfDisposed(),ea(this,e)};Q().prototype.erf=function(){return this.throwIfDisposed(),af(this)};Q().prototype.euclideanNorm=function(e,t){return this.throwIfDisposed(),xw(this,e,t)};Q().prototype.exp=function(){return this.throwIfDisposed(),mn(this)};Q().prototype.expandDims=function(e){return this.throwIfDisposed(),Gt(this,e)};Q().prototype.expm1=function(){return this.throwIfDisposed(),vw(this)};Q().prototype.fft=function(){return this.throwIfDisposed(),Id(this)};Q().prototype.flatten=function(){return this.throwIfDisposed(),W(this,[this.size])};Q().prototype.floor=function(){return this.throwIfDisposed(),mp(this)};Q().prototype.floorDiv=function(e){return this.throwIfDisposed(),Zm(this,e)};Q().prototype.gather=function(e,t,n){return this.throwIfDisposed(),fp(this,e,t,n)};Q().prototype.greaterEqual=function(e){return this.throwIfDisposed(),Rr(this,e)};Q().prototype.greater=function(e){return this.throwIfDisposed(),Cn(this,e)};Q().prototype.ifft=function(){return this.throwIfDisposed(),eu(this)};Q().prototype.irfft=function(){return this.throwIfDisposed(),yf(this)};Q().prototype.isFinite=function(){return this.throwIfDisposed(),ww(this)};Q().prototype.isInf=function(){return this.throwIfDisposed(),kw(this)};Q().prototype.isNaN=function(){return this.throwIfDisposed(),Iw(this)};Q().prototype.leakyRelu=function(e){return this.throwIfDisposed(),fd(this,e)};Q().prototype.lessEqual=function(e){return this.throwIfDisposed(),Fs(this,e)};Q().prototype.less=function(e){return this.throwIfDisposed(),Yl(this,e)};Q().prototype.localResponseNormalization=function(e,t,n,a){return this.throwIfDisposed(),Sw(this,e,t,n,a)};Q().prototype.logSigmoid=function(){return this.throwIfDisposed(),Nw(this)};Q().prototype.logSoftmax=function(e){return this.throwIfDisposed(),of(this,e)};Q().prototype.logSumExp=function(e,t){return this.throwIfDisposed(),bd(this,e,t)};Q().prototype.log=function(){return this.throwIfDisposed(),ta(this)};Q().prototype.log1p=function(){return this.throwIfDisposed(),gd(this)};Q().prototype.logicalAnd=function(e){return this.throwIfDisposed(),Fa(this,e)};Q().prototype.logicalNot=function(){return this.throwIfDisposed(),yd(this)};Q().prototype.logicalOr=function(e){return this.throwIfDisposed(),lf(this,e)};Q().prototype.logicalXor=function(e){return this.throwIfDisposed(),Tw(this,e)};Q().prototype.matMul=function(e,t,n){return this.throwIfDisposed(),$e(this,e,t,n)};Q().prototype.maxPool=function(e,t,n,a){return this.throwIfDisposed(),Dt(this,e,t,n,a)};Q().prototype.max=function(e,t){return this.throwIfDisposed(),fa(this,e,t)};Q().prototype.maximum=function(e){return this.throwIfDisposed(),fr(this,e)};Q().prototype.mean=function(e,t){return this.throwIfDisposed(),Et(this,e,t)};Q().prototype.min=function(e,t){return this.throwIfDisposed(),Xl(this,e,t)};Q().prototype.minimum=function(e){return this.throwIfDisposed(),gs(this,e)};Q().prototype.mirrorPad=function(e,t){return this.throwIfDisposed(),Ew(this,e,t)};Q().prototype.mod=function(e){return this.throwIfDisposed(),_w(this,e)};Q().prototype.mul=function(e){return this.throwIfDisposed(),z(this,e)};Q().prototype.neg=function(){return this.throwIfDisposed(),yt(this)};Q().prototype.norm=function(e,t,n){return this.throwIfDisposed(),hp(this,e,t,n)};Q().prototype.notEqual=function(e){return this.throwIfDisposed(),bi(this,e)};Q().prototype.oneHot=function(e,t=1,n=0){return this.throwIfDisposed(),Zl(this,e,t,n)};Q().prototype.onesLike=function(){return this.throwIfDisposed(),na(this)};Q().prototype.pad=function(e,t){return this.throwIfDisposed(),va(this,e,t)};Q().prototype.pool=function(e,t,n,a,r,s){return this.throwIfDisposed(),Aw(this,e,t,n,a,r,s)};Q().prototype.pow=function(e){return this.throwIfDisposed(),cr(this,e)};Q().prototype.prelu=function(e){return this.throwIfDisposed(),wd(this,e)};Q().prototype.prod=function(e,t){return this.throwIfDisposed(),Fw(this,e,t)};Q().prototype.reciprocal=function(){return this.throwIfDisposed(),Ow(this)};Q().prototype.relu=function(){return this.throwIfDisposed(),Ke(this)};Q().prototype.relu6=function(){return this.throwIfDisposed(),cf(this)};Q().prototype.reshapeAs=function(e){return this.throwIfDisposed(),W(this,e.shape)};Q().prototype.reshape=function(e){return this.throwIfDisposed(),W(this,e)};Q().prototype.resizeBilinear=function(e,t,n){return this.throwIfDisposed(),XT(this,e,t,n)};Q().prototype.resizeNearestNeighbor=function(e,t,n){return this.throwIfDisposed(),YT(this,e,t,n)};Q().prototype.reverse=function(e){return this.throwIfDisposed(),ya(this,e)};Q().prototype.rfft=function(){return this.throwIfDisposed(),Sd(this)};Q().prototype.round=function(){return this.throwIfDisposed(),df(this)};Q().prototype.rsqrt=function(){return this.throwIfDisposed(),hf(this)};Q().prototype.selu=function(){return this.throwIfDisposed(),mf(this)};Q().prototype.separableConv2d=function(e,t,n,a,r,s){return this.throwIfDisposed(),Ds(this,e,t,n,a,r,s)};Q().prototype.sigmoid=function(){return this.throwIfDisposed(),ma(this)};Q().prototype.sign=function(){return this.throwIfDisposed(),Pw(this)};Q().prototype.sin=function(){return this.throwIfDisposed(),ff(this)};Q().prototype.sinh=function(){return this.throwIfDisposed(),gf(this)};Q().prototype.slice=function(e,t){return this.throwIfDisposed(),Ve(this,e,t)};Q().prototype.softmax=function(e){return this.throwIfDisposed(),qa(this,e)};Q().prototype.softplus=function(){return this.throwIfDisposed(),jo(this)};Q().prototype.spaceToBatchND=function(e,t){return this.throwIfDisposed(),vd(this,e,t)};Q().prototype.split=function(e,t){return this.throwIfDisposed(),Ln(this,e,t)};Q().prototype.sqrt=function(){return this.throwIfDisposed(),rn(this)};Q().prototype.square=function(){return this.throwIfDisposed(),pt(this)};Q().prototype.squaredDifference=function(e){return this.throwIfDisposed(),xf(this,e)};Q().prototype.squeeze=function(e){return this.throwIfDisposed(),Rs(this,e)};Q().prototype.stack=function(e,t){this.throwIfDisposed();let n=e instanceof Ce?[this,e]:[this,...e];return Ft(n,t)};Q().prototype.step=function(e){return this.throwIfDisposed(),Ko(this,e)};Q().prototype.stridedSlice=function(e,t,n,a,r,s,i,o){return this.throwIfDisposed(),Lw(this,e,t,n,a,r,s,i,o)};Q().prototype.sub=function(e){return this.throwIfDisposed(),pe(this,e)};Q().prototype.sum=function(e,t){return this.throwIfDisposed(),fe(this,e,t)};Q().prototype.tan=function(){return this.throwIfDisposed(),zw(this)};Q().prototype.tanh=function(){return this.throwIfDisposed(),fs(this)};Q().prototype.tile=function(e){return this.throwIfDisposed(),On(this,e)};Q().prototype.toBool=function(){return this.throwIfDisposed(),re(this,"bool")};Q().prototype.toFloat=function(){return this.throwIfDisposed(),re(this,"float32")};Q().prototype.toInt=function(){return this.throwIfDisposed(),re(this,"int32")};Q().prototype.topk=function(e,t){return this.throwIfDisposed(),Bw(this,e,t)};Q().prototype.transpose=function(e){return this.throwIfDisposed(),De(this,e)};Q().prototype.unique=function(e){return this.throwIfDisposed(),Vw(this,e)};Q().prototype.unsortedSegmentSum=function(e,t){return this.throwIfDisposed(),If(this,e,t)};Q().prototype.unstack=function(e){return this.throwIfDisposed(),dt(this,e)};Q().prototype.where=function(e,t){return this.throwIfDisposed(),nn(e,this,t)};Q().prototype.zerosLike=function(){return this.throwIfDisposed(),qe(this)};var Qr=class _2 extends Error{constructor(t){super(t),Object.setPrototypeOf(this,_2.prototype)}},sr=class A2 extends Error{constructor(t){super(t),Object.setPrototypeOf(this,A2.prototype)}},V=class F2 extends Error{constructor(t){super(t),Object.setPrototypeOf(this,F2.prototype)}},ze=class $2 extends Error{constructor(t){super(t),Object.setPrototypeOf(this,$2.prototype)}},NG=class D2 extends Error{constructor(t){super(t),Object.setPrototypeOf(this,D2.prototype)}},R2=class{constructor(e){this.maxEntries=e||100,this.cache=new Map}get(e){let t;return this.cache.has(e)&&(t=this.cache.get(e),this.cache.delete(e),this.cache.set(e,t)),t}put(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxEntries){let n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(e,t)}getMaxEntries(){return this.maxEntries}setMaxEntries(e){if(e<0)throw new Error(`The maxEntries of LRU caches must be at least 0, but got ${e}.`);if(this.maxEntries>e)for(let t=0;t