(()=>{var e,t,s={"node:fs":e=>{"use strict";e.exports=require("node:fs")},"node:path":e=>{"use strict";e.exports=require("node:path")},"node:url":e=>{"use strict";e.exports=require("node:url")},"onnxruntime-common":e=>{"use strict";e.exports=require("onnxruntime-common")},"onnxruntime-node":e=>{"use strict";e.exports=require("onnxruntime-node")},sharp:e=>{"use strict";e.exports=require("sharp")},"?8b6b":()=>{},"./node_modules/@huggingface/jinja/dist/index.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Environment:()=>ie,Interpreter:()=>de,Template:()=>we,parse:()=>$,tokenize:()=>d});var r=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Comment:"Comment"}),o=class{constructor(e,t){this.value=e,this.type=t}};function n(e){return/\w/.test(e)}function a(e){return/[0-9]/.test(e)}function i(e){return/\s/.test(e)}var l=[["{%",r.OpenStatement],["%}",r.CloseStatement],["{{",r.OpenExpression],["}}",r.CloseExpression],["(",r.OpenParen],[")",r.CloseParen],["{",r.OpenCurlyBracket],["}",r.CloseCurlyBracket],["[",r.OpenSquareBracket],["]",r.CloseSquareBracket],[",",r.Comma],[".",r.Dot],[":",r.Colon],["|",r.Pipe],["<=",r.ComparisonBinaryOperator],[">=",r.ComparisonBinaryOperator],["==",r.ComparisonBinaryOperator],["!=",r.ComparisonBinaryOperator],["<",r.ComparisonBinaryOperator],[">",r.ComparisonBinaryOperator],["+",r.AdditiveBinaryOperator],["-",r.AdditiveBinaryOperator],["~",r.AdditiveBinaryOperator],["*",r.MultiplicativeBinaryOperator],["/",r.MultiplicativeBinaryOperator],["%",r.MultiplicativeBinaryOperator],["=",r.Equals]],c=new Map([["n","\n"],["t","\t"],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function d(e,t={}){const s=[],d=function(e,t={}){return e.endsWith("\n")&&(e=e.slice(0,-1)),t.lstrip_blocks&&(e=e.replace(/^[ \t]*({[#%-])/gm,"$1")),t.trim_blocks&&(e=e.replace(/([#%-]})\n/g,"$1")),e.replace(/{%\s*(end)?generation\s*%}/gs,"")}(e,t);let u=0,_=0;const p=e=>{let t="";for(;e(d[u]);)if("\\"!==d[u]){if(t+=d[u++],u>=d.length)throw new SyntaxError("Unexpected end of input")}else{if(++u,u>=d.length)throw new SyntaxError("Unexpected end of input");const e=d[u++],s=c.get(e);if(void 0===s)throw new SyntaxError(`Unexpected escaped character: ${e}`);t+=s}return t},m=()=>{const e=s.at(-1);e&&e.type===r.Text&&(e.value=e.value.trimEnd(),""===e.value&&s.pop())},h=()=>{for(;u0){s.push(new o(e,r.Text));continue}}if("{"===d[u]&&"#"===d[u+1]){u+=2;const e="-"===d[u];e&&++u;let t="";for(;"#"!==d[u]||"}"!==d[u+1];){if(u+2>=d.length)throw new SyntaxError("Missing end of comment tag");t+=d[u++]}const n=t.endsWith("-");n&&(t=t.slice(0,-1)),e&&m(),s.push(new o(t,r.Comment)),u+=2,n&&h();continue}if("{%-"===d.slice(u,u+3)){m(),s.push(new o("{%",r.OpenStatement)),u+=3;continue}if("{{-"===d.slice(u,u+3)){m(),s.push(new o("{{",r.OpenExpression)),_=0,u+=3;continue}if(p(i),"-%}"===d.slice(u,u+3)){s.push(new o("%}",r.CloseStatement)),u+=3,h();continue}if("-}}"===d.slice(u,u+3)){s.push(new o("}}",r.CloseExpression)),u+=3,h();continue}const t=d[u];if("-"===t||"+"===t){const e=s.at(-1)?.type;if(e===r.Text||void 0===e)throw new SyntaxError(`Unexpected character: ${t}`);switch(e){case r.Identifier:case r.NumericLiteral:case r.StringLiteral:case r.CloseParen:case r.CloseSquareBracket:break;default:{++u;const e=p(a);s.push(new o(`${t}${e}`,e.length>0?r.NumericLiteral:r.UnaryOperator));continue}}}for(const[e,t]of l){if("}}"===e&&_>0)continue;if(d.slice(u,u+e.length)===e){s.push(new o(e,t)),t===r.OpenExpression?_=0:t===r.OpenCurlyBracket?++_:t===r.CloseCurlyBracket&&--_,u+=e.length;continue e}}if("'"!==t&&'"'!==t)if(a(t)){let e=p(a);if("."===d[u]&&a(d[u+1])){++u;e=`${e}.${p(a)}`}s.push(new o(e,r.NumericLiteral))}else{if(!n(t))throw new SyntaxError(`Unexpected character: ${t}`);{const e=p(n);s.push(new o(e,r.Identifier))}}else{++u;const e=p((e=>e!==t));s.push(new o(e,r.StringLiteral)),++u}}return s}var u=class{type="Statement"},_=class extends u{constructor(e){super(),this.body=e}type="Program"},p=class extends u{constructor(e,t,s){super(),this.test=e,this.body=t,this.alternate=s}type="If"},m=class extends u{constructor(e,t,s,r){super(),this.loopvar=e,this.iterable=t,this.body=s,this.defaultBlock=r}type="For"},h=class extends u{type="Break"},f=class extends u{type="Continue"},g=class extends u{constructor(e,t,s){super(),this.assignee=e,this.value=t,this.body=s}type="Set"},w=class extends u{constructor(e,t,s){super(),this.name=e,this.args=t,this.body=s}type="Macro"},M=class extends u{constructor(e){super(),this.value=e}type="Comment"},x=class extends u{type="Expression"},b=class extends x{constructor(e,t,s){super(),this.object=e,this.property=t,this.computed=s}type="MemberExpression"},k=class extends x{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},y=class extends x{constructor(e){super(),this.value=e}type="Identifier"},v=class extends x{constructor(e){super(),this.value=e}type="Literal"},T=class extends v{type="IntegerLiteral"},P=class extends v{type="FloatLiteral"},F=class extends v{type="StringLiteral"},C=class extends v{type="ArrayLiteral"},S=class extends v{type="TupleLiteral"},A=class extends v{type="ObjectLiteral"},E=class extends x{constructor(e,t,s){super(),this.operator=e,this.left=t,this.right=s}type="BinaryExpression"},L=class extends x{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},I=class extends u{constructor(e,t){super(),this.filter=e,this.body=t}type="FilterStatement"},z=class extends x{constructor(e,t){super(),this.lhs=e,this.test=t}type="SelectExpression"},j=class extends x{constructor(e,t,s){super(),this.operand=e,this.negate=t,this.test=s}type="TestExpression"},D=class extends x{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},O=class extends x{constructor(e=void 0,t=void 0,s=void 0){super(),this.start=e,this.stop=t,this.step=s}type="SliceExpression"},N=class extends x{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"},V=class extends x{constructor(e){super(),this.argument=e}type="SpreadExpression"},B=class extends u{constructor(e,t,s){super(),this.call=e,this.callerArgs=t,this.body=s}type="CallStatement"},G=class extends x{constructor(e,t,s){super(),this.condition=e,this.trueExpr=t,this.falseExpr=s}type="Ternary"};function $(e){const t=new _([]);let s=0;function n(t,r){const o=e[s++];if(!o||o.type!==t)throw new Error(`Parser Error: ${r}. ${o.type} !== ${t}.`);return o}function a(e){if(!d(e))throw new SyntaxError(`Expected ${e}`);++s}function i(){switch(e[s].type){case r.Comment:return new M(e[s++].value);case r.Text:return new F(n(r.Text,"Expected text token").value);case r.OpenStatement:return function(){if(n(r.OpenStatement,"Expected opening statement token"),e[s].type!==r.Identifier)throw new SyntaxError(`Unknown statement, got ${e[s].type}`);const t=e[s].value;let o;switch(t){case"set":++s,o=function(){const e=x();let t=null;const o=[];if(l(r.Equals))++s,t=x();else{for(n(r.CloseStatement,"Expected %} token");!c("endset");)o.push(i());n(r.OpenStatement,"Expected {% token"),a("endset")}return n(r.CloseStatement,"Expected closing statement token"),new g(e,t,o)}();break;case"if":++s,o=u(),n(r.OpenStatement,"Expected {% token"),a("endif"),n(r.CloseStatement,"Expected %} token");break;case"macro":++s,o=function(){const e=Z();if("Identifier"!==e.type)throw new SyntaxError("Expected identifier following macro statement");const t=X();n(r.CloseStatement,"Expected closing statement token");const s=[];for(;!c("endmacro");)s.push(i());return new w(e,t,s)}(),n(r.OpenStatement,"Expected {% token"),a("endmacro"),n(r.CloseStatement,"Expected %} token");break;case"for":++s,o=function(){const e=x(!0);if(!(e instanceof y||e instanceof S))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${e.type} instead`);if(!d("in"))throw new SyntaxError("Expected `in` keyword following loop variable");++s;const t=v();n(r.CloseStatement,"Expected closing statement token");const o=[];for(;!c("endfor","else");)o.push(i());const a=[];if(c("else"))for(++s,++s,n(r.CloseStatement,"Expected closing statement token");!c("endfor");)a.push(i());return new m(e,t,o,a)}(),n(r.OpenStatement,"Expected {% token"),a("endfor"),n(r.CloseStatement,"Expected %} token");break;case"call":{++s;let e=null;l(r.OpenParen)&&(e=X());const t=Z();if("Identifier"!==t.type)throw new SyntaxError("Expected identifier following call statement");const d=X();n(r.CloseStatement,"Expected closing statement token");const u=[];for(;!c("endcall");)u.push(i());n(r.OpenStatement,"Expected '{%'"),a("endcall"),n(r.CloseStatement,"Expected closing statement token");const _=new k(t,d);o=new B(_,e,u);break}case"break":++s,n(r.CloseStatement,"Expected closing statement token"),o=new h;break;case"continue":++s,n(r.CloseStatement,"Expected closing statement token"),o=new f;break;case"filter":{++s;let e=Z();e instanceof y&&l(r.OpenParen)&&(e=Q(e)),n(r.CloseStatement,"Expected closing statement token");const t=[];for(;!c("endfilter");)t.push(i());n(r.OpenStatement,"Expected '{%'"),a("endfilter"),n(r.CloseStatement,"Expected '%}'"),o=new I(e,t);break}default:throw new SyntaxError(`Unknown statement type: ${t}`)}return o}();case r.OpenExpression:return function(){n(r.OpenExpression,"Expected opening expression token");const e=v();return n(r.CloseExpression,"Expected closing expression token"),e}();default:throw new SyntaxError(`Unexpected token type: ${e[s].type}`)}}function l(...t){return s+t.length<=e.length&&t.every(((t,r)=>t===e[s+r].type))}function c(...t){return e[s]?.type===r.OpenStatement&&e[s+1]?.type===r.Identifier&&t.includes(e[s+1]?.value)}function d(...t){return s+t.length<=e.length&&t.every(((t,r)=>"Identifier"===e[s+r].type&&t===e[s+r].value))}function u(){const e=v();n(r.CloseStatement,"Expected closing statement token");const t=[],o=[];for(;!c("elif","else","endif");)t.push(i());if(c("elif")){++s,++s;const e=u();o.push(e)}else if(c("else"))for(++s,++s,n(r.CloseStatement,"Expected closing statement token");!c("endif");)o.push(i());return new p(e,t,o)}function x(e=!1){const t=e?Z:v,o=[t()],n=l(r.Comma);for(;n&&(++s,o.push(t()),l(r.Comma)););return n?new S(o):o[0]}function v(){return $()}function $(){const e=R();if(d("if")){++s;const t=R();if(d("else")){++s;const r=$();return new G(t,e,r)}return new z(e,t)}return e}function R(){let t=q();for(;d("or");){const r=e[s];++s;const o=q();t=new E(r,t,o)}return t}function q(){let t=W();for(;d("and");){const r=e[s];++s;const o=W();t=new E(r,t,o)}return t}function W(){let t;for(;d("not");){const r=e[s];++s;const o=W();t=new D(r,o)}return t??function(){let t=U();for(;;){let n;if(d("not","in"))n=new o("not in",r.Identifier),s+=2;else if(d("in"))n=e[s++];else{if(!l(r.ComparisonBinaryOperator))break;n=e[s++]}const a=U();t=new E(n,t,a)}return t}()}function U(){let t=Y();for(;l(r.AdditiveBinaryOperator);){const r=e[s];++s;const o=Y();t=new E(r,t,o)}return t}function Q(e){let t=new k(e,X());return t=J(t),l(r.OpenParen)&&(t=Q(t)),t}function X(){n(r.OpenParen,"Expected opening parenthesis for arguments list");const t=function(){const t=[];for(;!l(r.CloseParen);){let o;if(e[s].type===r.MultiplicativeBinaryOperator&&"*"===e[s].value){++s;const e=v();o=new V(e)}else if(o=v(),l(r.Equals)){if(++s,!(o instanceof y))throw new SyntaxError("Expected identifier for keyword argument");const e=v();o=new N(o,e)}t.push(o),l(r.Comma)&&++s}return t}();return n(r.CloseParen,"Expected closing parenthesis for arguments list"),t}function H(){const e=[];let t=!1;for(;!l(r.CloseSquareBracket);)l(r.Colon)?(e.push(void 0),++s,t=!0):(e.push(v()),l(r.Colon)&&(++s,t=!0));if(0===e.length)throw new SyntaxError("Expected at least one argument for member/slice expression");if(t){if(e.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new O(...e)}return e[0]}function J(t){for(;l(r.Dot)||l(r.OpenSquareBracket);){const o=e[s];let a;++s;const i=o.type===r.OpenSquareBracket;if(i)a=H(),n(r.CloseSquareBracket,"Expected closing square bracket");else if(a=Z(),"Identifier"!==a.type)throw new SyntaxError("Expected identifier following dot operator");t=new b(t,a,i)}return t}function Y(){let t=K();for(;l(r.MultiplicativeBinaryOperator);){const r=e[s++],o=K();t=new E(r,t,o)}return t}function K(){let e=function(){let e=function(){const e=J(Z());return l(r.OpenParen)?Q(e):e}();for(;l(r.Pipe);){++s;let t=Z();if(!(t instanceof y))throw new SyntaxError("Expected identifier for the filter");l(r.OpenParen)&&(t=Q(t)),e=new L(e,t)}return e}();for(;d("is");){++s;const t=d("not");t&&++s;const r=Z();if(!(r instanceof y))throw new SyntaxError("Expected identifier for the test");e=new j(e,t,r)}return e}function Z(){const t=e[s++];switch(t.type){case r.NumericLiteral:{const e=t.value;return e.includes(".")?new P(Number(e)):new T(Number(e))}case r.StringLiteral:{let o=t.value;for(;l(r.StringLiteral);)o+=e[s++].value;return new F(o)}case r.Identifier:return new y(t.value);case r.OpenParen:{const e=x();return n(r.CloseParen,"Expected closing parenthesis, got ${tokens[current].type} instead."),e}case r.OpenSquareBracket:{const e=[];for(;!l(r.CloseSquareBracket);)e.push(v()),l(r.Comma)&&++s;return++s,new C(e)}case r.OpenCurlyBracket:{const e=new Map;for(;!l(r.CloseCurlyBracket);){const t=v();n(r.Colon,"Expected colon between key and value in object literal");const o=v();e.set(t,o),l(r.Comma)&&++s}return++s,new A(e)}default:throw new SyntaxError(`Unexpected token: ${t.type}`)}}for(;s=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),s=(s??=e.length)<0?Math.max(e.length+s,0):Math.min(s,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),s=(s??=-1)<-1?Math.max(e.length+s,-1):Math.min(s,e.length-1));const n=[];for(let a=t;o*ae<10?"0"+e:e.toString();return t.replace(/%[YmdbBHM%]/g,(t=>{switch(t){case"%Y":return e.getFullYear().toString();case"%m":return o(e.getMonth()+1);case"%d":return o(e.getDate());case"%b":return r.format(e);case"%B":return s.format(e);case"%H":return o(e.getHours());case"%M":return o(e.getMinutes());case"%%":return"%";default:return t}}))}(new Date,e)}var U=class extends Error{},Q=class extends Error{},X=class{type="RuntimeValue";value;builtins=new Map;constructor(e=void 0){this.value=e}__bool__(){return new K(!!this.value)}toString(){return String(this.value)}},H=class extends X{type="IntegerValue"},J=class extends X{type="FloatValue";toString(){return this.value%1==0?this.value.toFixed(1):this.value.toString()}},Y=class extends X{type="StringValue";builtins=new Map([["upper",new oe((()=>new Y(this.value.toUpperCase())))],["lower",new oe((()=>new Y(this.value.toLowerCase())))],["strip",new oe((()=>new Y(this.value.trim())))],["title",new oe((()=>new Y(this.value.replace(/\b\w/g,(e=>e.toUpperCase())))))],["capitalize",new oe((()=>new Y(this.value.charAt(0).toUpperCase()+this.value.slice(1))))],["length",new H(this.value.length)],["rstrip",new oe((()=>new Y(this.value.trimEnd())))],["lstrip",new oe((()=>new Y(this.value.trimStart())))],["startswith",new oe((e=>{if(0===e.length)throw new Error("startswith() requires at least one argument");const t=e[0];if(t instanceof Y)return new K(this.value.startsWith(t.value));if(t instanceof se){for(const e of t.value){if(!(e instanceof Y))throw new Error("startswith() tuple elements must be strings");if(this.value.startsWith(e.value))return new K(!0)}return new K(!1)}throw new Error("startswith() argument must be a string or tuple of strings")}))],["endswith",new oe((e=>{if(0===e.length)throw new Error("endswith() requires at least one argument");const t=e[0];if(t instanceof Y)return new K(this.value.endsWith(t.value));if(t instanceof se){for(const e of t.value){if(!(e instanceof Y))throw new Error("endswith() tuple elements must be strings");if(this.value.endsWith(e.value))return new K(!0)}return new K(!1)}throw new Error("endswith() argument must be a string or tuple of strings")}))],["split",new oe((e=>{const t=e[0]??new ne;if(!(t instanceof Y||t instanceof ne))throw new Error("sep argument must be a string or null");const s=e[1]??new H(-1);if(!(s instanceof H))throw new Error("maxsplit argument must be a number");let r=[];if(t instanceof ne){const e=this.value.trimStart();for(const{0:t,index:o}of e.matchAll(/\S+/g)){if(-1!==s.value&&r.length>=s.value&&void 0!==o){r.push(t+e.slice(o+t.length));break}r.push(t)}}else{if(""===t.value)throw new Error("empty separator");r=this.value.split(t.value),-1!==s.value&&r.length>s.value&&r.push(r.splice(s.value).join(t.value))}return new se(r.map((e=>new Y(e))))}))],["replace",new oe((e=>{if(e.length<2)throw new Error("replace() requires at least two arguments");const t=e[0],s=e[1];if(!(t instanceof Y&&s instanceof Y))throw new Error("replace() arguments must be strings");let r;if(r=e.length>2?"KeywordArgumentsValue"===e[2].type?e[2].value.get("count")??new ne:e[2]:new ne,!(r instanceof H||r instanceof ne))throw new Error("replace() count argument must be a number or null");return new Y(function(e,t,s,r){if(0===r)return e;let o=null==r||r<0?1/0:r;const n=0===t.length?new RegExp("(?=)","gu"):new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gu");return e.replaceAll(n,(e=>o>0?(--o,s):e))}(this.value,t.value,s.value,r.value))}))]])},K=class extends X{type="BooleanValue"};function Z(e,t,s,r=!0){const o=s??0;switch(e.type){case"NullValue":return"null";case"UndefinedValue":return r?"null":"undefined";case"IntegerValue":case"FloatValue":case"StringValue":case"BooleanValue":return JSON.stringify(e.value);case"ArrayValue":case"ObjectValue":{const s=t?" ".repeat(t):"",n="\n"+s.repeat(o),a=n+s;if("ArrayValue"===e.type){const s=e.value.map((e=>Z(e,t,o+1,r)));return t?`[${a}${s.join(`,${a}`)}${n}]`:`[${s.join(", ")}]`}{const s=Array.from(e.value.entries()).map((([e,s])=>{const n=`"${e}": ${Z(s,t,o+1,r)}`;return t?`${a}${n}`:n}));return t?`{${s.join(",")}${n}}`:`{${s.join(", ")}}`}}default:throw new Error(`Cannot convert to JSON: ${e.type}`)}}var ee=class extends X{type="ObjectValue";__bool__(){return new K(this.value.size>0)}builtins=new Map([["get",new oe((([e,t])=>{if(!(e instanceof Y))throw new Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??t??new ne}))],["items",new oe((()=>this.items()))],["keys",new oe((()=>this.keys()))],["values",new oe((()=>this.values()))],["dictsort",new oe((e=>{let t=new Map;const s=e.filter((e=>!(e instanceof te)||(t=e.value,!1))),r=s.at(0)??t.get("case_sensitive")??new K(!1);if(!(r instanceof K))throw new Error("case_sensitive must be a boolean");const o=s.at(1)??t.get("by")??new Y("key");if(!(o instanceof Y))throw new Error("by must be a string");if(!["key","value"].includes(o.value))throw new Error("by must be either 'key' or 'value'");const n=s.at(2)??t.get("reverse")??new K(!1);if(!(n instanceof K))throw new Error("reverse must be a boolean");const a=Array.from(this.value.entries()).map((([e,t])=>new se([new Y(e),t]))).sort(((e,t)=>{const s="key"===o.value?0:1,a=ce(e.value[s],t.value[s],r.value);return n.value?-a:a}));return new se(a)}))]]);items(){return new se(Array.from(this.value.entries()).map((([e,t])=>new se([new Y(e),t]))))}keys(){return new se(Array.from(this.value.keys()).map((e=>new Y(e))))}values(){return new se(Array.from(this.value.values()))}toString(){return Z(this,null,0,!1)}},te=class extends ee{type="KeywordArgumentsValue"},se=class extends X{type="ArrayValue";builtins=new Map([["length",new H(this.value.length)]]);__bool__(){return new K(this.value.length>0)}toString(){return Z(this,null,0,!1)}},re=class extends se{type="TupleValue"},oe=class extends X{type="FunctionValue"},ne=class extends X{type="NullValue"},ae=class extends X{type="UndefinedValue"},ie=class{constructor(e){this.parent=e}variables=new Map([["namespace",new oe((e=>{if(0===e.length)return new ee(new Map);if(1!==e.length||!(e[0]instanceof ee))throw new Error("`namespace` expects either zero arguments or a single object argument");return e[0]}))]]);tests=new Map([["boolean",e=>"BooleanValue"===e.type],["callable",e=>e instanceof oe],["odd",e=>{if(!(e instanceof H))throw new Error(`cannot odd on ${e.type}`);return e.value%2!=0}],["even",e=>{if(!(e instanceof H))throw new Error(`cannot even on ${e.type}`);return e.value%2==0}],["false",e=>"BooleanValue"===e.type&&!e.value],["true",e=>"BooleanValue"===e.type&&e.value],["none",e=>"NullValue"===e.type],["string",e=>"StringValue"===e.type],["number",e=>e instanceof H||e instanceof J],["integer",e=>e instanceof H],["iterable",e=>"ArrayValue"===e.type||"StringValue"===e.type],["mapping",e=>"ObjectValue"===e.type],["lower",e=>{const t=e.value;return"StringValue"===e.type&&t===t.toLowerCase()}],["upper",e=>{const t=e.value;return"StringValue"===e.type&&t===t.toUpperCase()}],["none",e=>"NullValue"===e.type],["defined",e=>"UndefinedValue"!==e.type],["undefined",e=>"UndefinedValue"===e.type],["equalto",(e,t)=>e.value===t.value],["eq",(e,t)=>e.value===t.value]]);set(e,t){return this.declareVariable(e,ue(t))}declareVariable(e,t){if(this.variables.has(e))throw new SyntaxError(`Variable already declared: ${e}`);return this.variables.set(e,t),t}setVariable(e,t){return this.variables.set(e,t),t}resolve(e){if(this.variables.has(e))return this;if(this.parent)return this.parent.resolve(e);throw new Error(`Unknown variable: ${e}`)}lookupVariable(e){try{return this.resolve(e).variables.get(e)??new ae}catch{return new ae}}};function le(e,t){const s=t.split(".");let r=e;for(const e of s)if(r instanceof ee)r=r.value.get(e)??new ae;else{if(!(r instanceof se))return new ae;{const t=parseInt(e,10);if(!(!isNaN(t)&&t>=0&&te instanceof H||e instanceof J||e instanceof K,o=e=>e instanceof K?e.value?1:0:e.value;if(r(e)&&r(t)){const s=o(e),r=o(t);return sr?1:0}if(e.type!==t.type)throw new Error(`Cannot compare different types: ${e.type} and ${t.type}`);if("StringValue"===e.type){let r=e.value,o=t.value;return s||(r=r.toLowerCase(),o=o.toLowerCase()),ro?1:0}throw new Error(`Cannot compare type: ${e.type}`)}var de=class{global;constructor(e){this.global=e??new ie}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){const s=this.evaluate(e.left,t);switch(e.operator.value){case"and":return s.__bool__().value?this.evaluate(e.right,t):s;case"or":return s.__bool__().value?s:this.evaluate(e.right,t)}const r=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new K(s.value==r.value);case"!=":return new K(s.value!=r.value)}if(s instanceof ae||r instanceof ae){if(r instanceof ae&&["in","not in"].includes(e.operator.value))return new K("not in"===e.operator.value);throw new Error(`Cannot perform operation ${e.operator.value} on undefined values`)}if(s instanceof ne||r instanceof ne)throw new Error("Cannot perform operation on null values");if("~"===e.operator.value)return new Y(s.value.toString()+r.value.toString());if((s instanceof H||s instanceof J)&&(r instanceof H||r instanceof J)){const t=s.value,o=r.value;switch(e.operator.value){case"+":case"-":case"*":{const n="+"===e.operator.value?t+o:"-"===e.operator.value?t-o:t*o;return s instanceof J||r instanceof J?new J(n):new H(n)}case"/":return new J(t/o);case"%":{const e=t%o;return s instanceof J||r instanceof J?new J(e):new H(e)}case"<":return new K(t":return new K(t>o);case">=":return new K(t>=o);case"<=":return new K(t<=o)}}else if(s instanceof se&&r instanceof se){if("+"===e.operator.value)return new se(s.value.concat(r.value))}else if(r instanceof se){const t=void 0!==r.value.find((e=>e.value===s.value));switch(e.operator.value){case"in":return new K(t);case"not in":return new K(!t)}}if((s instanceof Y||r instanceof Y)&&"+"===e.operator.value)return new Y(s.value.toString()+r.value.toString());if(s instanceof Y&&r instanceof Y)switch(e.operator.value){case"in":return new K(r.value.includes(s.value));case"not in":return new K(!r.value.includes(s.value))}if(s instanceof Y&&r instanceof ee)switch(e.operator.value){case"in":return new K(r.value.has(s.value));case"not in":return new K(!r.value.has(s.value))}throw new SyntaxError(`Unknown operator "${e.operator.value}" between ${s.type} and ${r.type}`)}evaluateArguments(e,t){const s=[],r=new Map;for(const o of e)if("SpreadExpression"===o.type){const e=o,r=this.evaluate(e.argument,t);if(!(r instanceof se))throw new Error(`Cannot unpack non-iterable type: ${r.type}`);for(const e of r.value)s.push(e)}else if("KeywordArgumentExpression"===o.type){const e=o;r.set(e.key.value,this.evaluate(e.value,t))}else{if(r.size>0)throw new Error("Positional arguments must come before keyword arguments");s.push(this.evaluate(o,t))}return[s,r]}applyFilter(e,t,s){if("Identifier"===t.type){const r=t;if("tojson"===r.value)return new Y(Z(e));if(e instanceof se)switch(r.value){case"list":return e;case"first":return e.value[0];case"last":return e.value[e.value.length-1];case"length":return new H(e.value.length);case"reverse":return new se(e.value.slice().reverse());case"sort":return new se(e.value.slice().sort(((e,t)=>ce(e,t,!1))));case"join":return new Y(e.value.map((e=>e.value)).join(""));case"string":return new Y(Z(e,null,0,!1));case"unique":{const t=new Set,s=[];for(const r of e.value)t.has(r.value)||(t.add(r.value),s.push(r));return new se(s)}default:throw new Error(`Unknown ArrayValue filter: ${r.value}`)}else if(e instanceof Y)switch(r.value){case"length":case"upper":case"lower":case"title":case"capitalize":{const t=e.builtins.get(r.value);if(t instanceof oe)return t.value([],s);if(t instanceof H)return t;throw new Error(`Unknown StringValue filter: ${r.value}`)}case"trim":return new Y(e.value.trim());case"indent":return new Y(e.value.split("\n").map(((e,t)=>0===t||0===e.length?e:" "+e)).join("\n"));case"join":case"string":return e;case"int":{const t=parseInt(e.value,10);return new H(isNaN(t)?0:t)}case"float":{const t=parseFloat(e.value);return new J(isNaN(t)?0:t)}default:throw new Error(`Unknown StringValue filter: ${r.value}`)}else if(e instanceof H||e instanceof J)switch(r.value){case"abs":return e instanceof H?new H(Math.abs(e.value)):new J(Math.abs(e.value));case"int":return new H(Math.floor(e.value));case"float":return new J(e.value);default:throw new Error(`Unknown NumericValue filter: ${r.value}`)}else if(e instanceof ee)switch(r.value){case"items":return new se(Array.from(e.value.entries()).map((([e,t])=>new se([new Y(e),t]))));case"length":return new H(e.value.size);default:{const t=e.builtins.get(r.value);if(t)return t instanceof oe?t.value([],s):t;throw new Error(`Unknown ObjectValue filter: ${r.value}`)}}else if(e instanceof K)switch(r.value){case"bool":return new K(e.value);case"int":return new H(e.value?1:0);case"float":return new J(e.value?1:0);case"string":return new Y(e.value?"true":"false");default:throw new Error(`Unknown BooleanValue filter: ${r.value}`)}throw new Error(`Cannot apply filter "${r.value}" to type: ${e.type}`)}if("CallExpression"===t.type){const r=t;if("Identifier"!==r.callee.type)throw new Error(`Unknown filter: ${r.callee.type}`);const o=r.callee.value;if("tojson"===o){const[,t]=this.evaluateArguments(r.args,s),o=t.get("indent")??new ne;if(!(o instanceof H||o instanceof ne))throw new Error("If set, indent must be a number");return new Y(Z(e,o.value))}if("join"===o){let t;if(e instanceof Y)t=Array.from(e.value);else{if(!(e instanceof se))throw new Error(`Cannot apply filter "${o}" to type: ${e.type}`);t=e.value.map((e=>e.value))}const[n,a]=this.evaluateArguments(r.args,s),i=n.at(0)??a.get("separator")??new Y("");if(!(i instanceof Y))throw new Error("separator must be a string");return new Y(t.join(i.value))}if("int"===o||"float"===o){const[t,n]=this.evaluateArguments(r.args,s),a=t.at(0)??n.get("default")??("int"===o?new H(0):new J(0));if(e instanceof Y){const t="int"===o?parseInt(e.value,10):parseFloat(e.value);return isNaN(t)?a:"int"===o?new H(t):new J(t)}if(e instanceof H||e instanceof J)return e;if(e instanceof K)return"int"===o?new H(e.value?1:0):new J(e.value?1:0);throw new Error(`Cannot apply filter "${o}" to type: ${e.type}`)}if("default"===o){const[t,o]=this.evaluateArguments(r.args,s),n=t[0]??new Y(""),a=t[1]??o.get("boolean")??new K(!1);if(!(a instanceof K))throw new Error("`default` filter flag must be a boolean");return e instanceof ae||a.value&&!e.__bool__().value?n:e}if(e instanceof se){switch(o){case"sort":{const[t,o]=this.evaluateArguments(r.args,s),n=t.at(0)??o.get("reverse")??new K(!1);if(!(n instanceof K))throw new Error("reverse must be a boolean");const a=t.at(1)??o.get("case_sensitive")??new K(!1);if(!(a instanceof K))throw new Error("case_sensitive must be a boolean");const i=t.at(2)??o.get("attribute")??new ne;if(!(i instanceof Y||i instanceof H||i instanceof ne))throw new Error("attribute must be a string, integer, or null");const l=e=>{if(i instanceof ne)return e;return le(e,i instanceof H?String(i.value):i.value)};return new se(e.value.slice().sort(((e,t)=>{const s=ce(l(e),l(t),a.value);return n.value?-s:s})))}case"selectattr":case"rejectattr":{const t="selectattr"===o;if(e.value.some((e=>!(e instanceof ee))))throw new Error(`\`${o}\` can only be applied to array of objects`);if(r.args.some((e=>"StringLiteral"!==e.type)))throw new Error(`arguments of \`${o}\` must be strings`);const[n,a,i]=r.args.map((e=>this.evaluate(e,s)));let l;if(a){const e=s.tests.get(a.value);if(!e)throw new Error(`Unknown test: ${a.value}`);l=e}else l=(...e)=>e[0].__bool__().value;const c=e.value.filter((e=>{const s=e.value.get(n.value),r=!!s&&l(s,i);return t?r:!r}));return new se(c)}case"map":{const[,t]=this.evaluateArguments(r.args,s);if(t.has("attribute")){const s=t.get("attribute");if(!(s instanceof Y))throw new Error("attribute must be a string");const r=t.get("default"),o=e.value.map((e=>{if(!(e instanceof ee))throw new Error("items in map must be an object");const t=le(e,s.value);return t instanceof ae?r??new ae:t}));return new se(o)}throw new Error("`map` expressions without `attribute` set are not currently supported.")}}throw new Error(`Unknown ArrayValue filter: ${o}`)}if(e instanceof Y){switch(o){case"indent":{const[t,o]=this.evaluateArguments(r.args,s),n=t.at(0)??o.get("width")??new H(4);if(!(n instanceof H))throw new Error("width must be a number");const a=t.at(1)??o.get("first")??new K(!1),i=t.at(2)??o.get("blank")??new K(!1),l=e.value.split("\n"),c=" ".repeat(n.value),d=l.map(((e,t)=>!a.value&&0===t||!i.value&&0===e.length?e:c+e));return new Y(d.join("\n"))}case"replace":{const t=e.builtins.get("replace");if(!(t instanceof oe))throw new Error("replace filter not available");const[o,n]=this.evaluateArguments(r.args,s);return t.value([...o,new te(n)],s)}}throw new Error(`Unknown StringValue filter: ${o}`)}if(e instanceof ee){const t=e.builtins.get(o);if(t&&t instanceof oe){const[e,o]=this.evaluateArguments(r.args,s);return o.size>0&&e.push(new te(o)),t.value(e,s)}throw new Error(`Unknown ObjectValue filter: ${o}`)}throw new Error(`Cannot apply filter "${o}" to type: ${e.type}`)}throw new Error(`Unknown filter: ${t.type}`)}evaluateFilterExpression(e,t){const s=this.evaluate(e.operand,t);return this.applyFilter(s,e.filter,t)}evaluateTestExpression(e,t){const s=this.evaluate(e.operand,t),r=t.tests.get(e.test.value);if(!r)throw new Error(`Unknown test: ${e.test.value}`);const o=r(s);return new K(e.negate?!o:o)}evaluateSelectExpression(e,t){return this.evaluate(e.test,t).__bool__().value?this.evaluate(e.lhs,t):new ae}evaluateUnaryExpression(e,t){const s=this.evaluate(e.argument,t);if("not"===e.operator.value)return new K(!s.value);throw new SyntaxError(`Unknown operator: ${e.operator.value}`)}evaluateTernaryExpression(e,t){return this.evaluate(e.condition,t).__bool__().value?this.evaluate(e.trueExpr,t):this.evaluate(e.falseExpr,t)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let s="";for(const r of e){const e=this.evaluate(r,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(s+=e.toString())}return new Y(s)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){const[s,r]=this.evaluateArguments(e.args,t);r.size>0&&s.push(new te(r));const o=this.evaluate(e.callee,t);if("FunctionValue"!==o.type)throw new Error(`Cannot call something that is not a function: got ${o.type}`);return o.value(s,t)}evaluateSliceExpression(e,t,s){if(!(e instanceof se||e instanceof Y))throw new Error("Slice object must be an array or string");const r=this.evaluate(t.start,s),o=this.evaluate(t.stop,s),n=this.evaluate(t.step,s);if(!(r instanceof H||r instanceof ae))throw new Error("Slice start must be numeric or undefined");if(!(o instanceof H||o instanceof ae))throw new Error("Slice stop must be numeric or undefined");if(!(n instanceof H||n instanceof ae))throw new Error("Slice step must be numeric or undefined");return e instanceof se?new se(q(e.value,r.value,o.value,n.value)):new Y(q(Array.from(e.value),r.value,o.value,n.value).join(""))}evaluateMemberExpression(e,t){const s=this.evaluate(e.object,t);let r,o;if(e.computed){if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(s,e.property,t);r=this.evaluate(e.property,t)}else r=new Y(e.property.value);if(s instanceof ee){if(!(r instanceof Y))throw new Error(`Cannot access property with non-string: got ${r.type}`);o=s.value.get(r.value)??s.builtins.get(r.value)}else if(s instanceof se||s instanceof Y)if(r instanceof H)o=s.value.at(r.value),s instanceof Y&&(o=new Y(s.value.at(r.value)));else{if(!(r instanceof Y))throw new Error(`Cannot access property with non-string/non-number: got ${r.type}`);o=s.builtins.get(r.value)}else{if(!(r instanceof Y))throw new Error(`Cannot access property with non-string: got ${r.type}`);o=s.builtins.get(r.value)}return o instanceof X?o:new ae}evaluateSet(e,t){const s=e.value?this.evaluate(e.value,t):this.evaluateBlock(e.body,t);if("Identifier"===e.assignee.type){const r=e.assignee.value;t.setVariable(r,s)}else if("TupleLiteral"===e.assignee.type){const r=e.assignee;if(!(s instanceof se))throw new Error(`Cannot unpack non-iterable type in set: ${s.type}`);const o=s.value;if(o.length!==r.value.length)throw new Error(`Too ${r.value.length>o.length?"few":"many"} items to unpack in set`);for(let e=0;et.setVariable(e.loopvar.value,l);else{if("TupleLiteral"!==e.loopvar.type)throw new Error(`Invalid loop variable(s): ${e.loopvar.type}`);{const t=e.loopvar;if("ArrayValue"!==l.type)throw new Error(`Cannot unpack non-iterable type: ${l.type}`);const s=l;if(t.value.length!==s.value.length)throw new Error(`Too ${t.value.length>s.value.length?"few":"many"} items to unpack`);c=e=>{for(let r=0;r0?n[t-1]:new ae],["nextitem",t{const r=new ie(s);let o;t=t.slice(),"KeywordArgumentsValue"===t.at(-1)?.type&&(o=t.pop());for(let s=0;s{const r=new ie(s);if(e.callerArgs)for(let s=0;sthis.evaluate(e,t))));case"TupleLiteral":return new re(e.value.map((e=>this.evaluate(e,t))));case"ObjectLiteral":{const s=new Map;for(const[r,o]of e.value){const e=this.evaluate(r,t);if(!(e instanceof Y))throw new Error(`Object keys must be strings: got ${e.type}`);s.set(e.value,this.evaluate(o,t))}return new ee(s)}case"Identifier":return this.evaluateIdentifier(e,t);case"CallExpression":return this.evaluateCallExpression(e,t);case"MemberExpression":return this.evaluateMemberExpression(e,t);case"UnaryExpression":return this.evaluateUnaryExpression(e,t);case"BinaryExpression":return this.evaluateBinaryExpression(e,t);case"FilterExpression":return this.evaluateFilterExpression(e,t);case"FilterStatement":return this.evaluateFilterStatement(e,t);case"TestExpression":return this.evaluateTestExpression(e,t);case"SelectExpression":return this.evaluateSelectExpression(e,t);case"Ternary":return this.evaluateTernaryExpression(e,t);case"Comment":return new ne;default:throw new SyntaxError(`Unknown node type: ${e.type}`)}}};function ue(e){switch(typeof e){case"number":return Number.isInteger(e)?new H(e):new J(e);case"string":return new Y(e);case"boolean":return new K(e);case"undefined":return new ae;case"object":return null===e?new ne:Array.isArray(e)?new se(e.map(ue)):new ee(new Map(Object.entries(e).map((([e,t])=>[e,ue(t)]))));case"function":return new oe(((t,s)=>ue(e(...t.map((e=>e.value)))??null)));default:throw new Error(`Cannot convert to runtime value: ${e}`)}}var _e="\n",pe="{%- ",me=" -%}";function he(...e){return pe+e.join(" ")+me}function fe(e,t,s){return e.map((e=>function(e,t,s){const r=s.repeat(t);switch(e.type){case"Program":return fe(e.body,t,s);case"If":return function(e,t,s){const r=s.repeat(t),o=[];let n=e;for(;n&&(o.push({test:n.test,body:n.body}),1===n.alternate.length&&"If"===n.alternate[0].type);)n=n.alternate[0];let a=r+he("if",ge(o[0].test))+_e+fe(o[0].body,t+1,s);for(let e=1;e0&&(a+=_e+r+he("else")+_e+fe(n.alternate,t+1,s));return a+=_e+r+he("endif"),a}(e,t,s);case"For":return function(e,t,s){const r=s.repeat(t);let o="";if("SelectExpression"===e.iterable.type){const t=e.iterable;o=`${ge(t.lhs)} if ${ge(t.test)}`}else o=ge(e.iterable);let n=r+he("for",ge(e.loopvar),"in",o)+_e+fe(e.body,t+1,s);e.defaultBlock.length>0&&(n+=_e+r+he("else")+_e+fe(e.defaultBlock,t+1,s));return n+=_e+r+he("endfor"),n}(e,t,s);case"Set":return function(e,t,s){const r=s.repeat(t),o=ge(e.assignee),n=e.value?ge(e.value):"",a=r+he("set",`${o}${e.value?" = "+n:""}`);if(0===e.body.length)return a;return a+_e+fe(e.body,t+1,s)+_e+r+he("endset")}(e,t,s);case"Macro":return function(e,t,s){const r=s.repeat(t),o=e.args.map(ge).join(", ");return r+he("macro",`${e.name.value}(${o})`)+_e+fe(e.body,t+1,s)+_e+r+he("endmacro")}(e,t,s);case"Break":return r+he("break");case"Continue":return r+he("continue");case"CallStatement":return function(e,t,s){const r=s.repeat(t),o=e.callerArgs&&e.callerArgs.length>0?`(${e.callerArgs.map(ge).join(", ")})`:"",n=ge(e.call);let a=r+he(`call${o}`,n)+_e;return a+=fe(e.body,t+1,s)+_e,a+=r+he("endcall"),a}(e,t,s);case"FilterStatement":return function(e,t,s){const r=s.repeat(t),o="Identifier"===e.filter.type?e.filter.value:ge(e.filter);let n=r+he("filter",o)+_e;return n+=fe(e.body,t+1,s)+_e,n+=r+he("endfilter"),n}(e,t,s);case"Comment":return r+"{# "+e.value+" #}";default:return r+"{{- "+ge(e)+" -}}"}}(e,t,s))).join(_e)}function ge(e,t=-1){switch(e.type){case"SpreadExpression":return`*${ge(e.argument)}`;case"Identifier":return e.value;case"IntegerLiteral":case"FloatLiteral":return`${e.value}`;case"StringLiteral":return JSON.stringify(e.value);case"BinaryExpression":{const s=e,r=function(e){switch(e.operator.type){case"MultiplicativeBinaryOperator":return 4;case"AdditiveBinaryOperator":return 3;case"ComparisonBinaryOperator":return 2;case"Identifier":return"and"===e.operator.value?1:"in"===e.operator.value||"not in"===e.operator.value?2:0}return 0}(s),o=ge(s.left,r),n=ge(s.right,r+1),a=`${o} ${s.operator.value} ${n}`;return r`${ge(e)}: ${ge(t)}`)).join(", ")}}`;case"SliceExpression":{const t=e;return`${t.start?ge(t.start):""}:${t.stop?ge(t.stop):""}${t.step?`:${ge(t.step)}`:""}`}case"KeywordArgumentExpression":{const t=e;return`${t.key.value}=${ge(t.value)}`}case"Ternary":{const s=e,r=`${ge(s.trueExpr)} if ${ge(s.condition,0)} else ${ge(s.falseExpr)}`;return t>-1?`(${r})`:r}default:throw new Error(`Unknown expression type: ${e.type}`)}}var we=class{parsed;constructor(e){const t=d(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=$(t)}render(e){const t=new ie;if(function(e){e.set("false",!1),e.set("true",!0),e.set("none",null),e.set("raise_exception",(e=>{throw new Error(e)})),e.set("range",R),e.set("strftime_now",W),e.set("True",!0),e.set("False",!1),e.set("None",null)}(t),e)for(const[s,r]of Object.entries(e))t.set(s,r);return new de(t).run(this.parsed).value}format(e){return function(e,t="\t"){const s="number"==typeof t?" ".repeat(t):t;return fe(e.body,0,s).replace(/\n$/,"")}(this.parsed,e?.indent||"\t")}}},"./src/backends/onnx.js":(e,t,s)=>{"use strict";var r,o;s.r(t),s.d(t,{Tensor:()=>l.Tensor,createInferenceSession:()=>g,deviceToExecutionProviders:()=>h,isONNXProxy:()=>y,isONNXTensor:()=>b,runInferenceSession:()=>x});var n=s("./src/env.js"),a=s("onnxruntime-node"),i=s("?8b6b"),l=s("onnxruntime-common");const c=Object.freeze({auto:null,gpu:null,cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:{name:"webnn",deviceType:"cpu"},"webnn-npu":{name:"webnn",deviceType:"npu"},"webnn-gpu":{name:"webnn",deviceType:"gpu"},"webnn-cpu":{name:"webnn",deviceType:"cpu"}}),d=[];let u,_;const p=Symbol.for("onnxruntime");if(p in globalThis)_=globalThis[p];else if(n.apis.IS_NODE_ENV){switch(_=a??(r||(r=s.t(a,2))),process.platform){case"win32":d.push("dml");break;case"linux":"x64"===process.arch&&d.push("cuda")}d.push("cpu"),u=["cpu"]}else _=o||(o=s.t(i,2)),n.apis.IS_WEBNN_AVAILABLE&&d.push("webnn-npu","webnn-gpu","webnn-cpu","webnn"),n.apis.IS_WEBGPU_AVAILABLE&&d.push("webgpu"),d.push("wasm"),u=["wasm"];const m=_.InferenceSession;function h(e=null){if(!e)return u;switch(e){case"auto":return d;case"gpu":return d.filter((e=>["webgpu","cuda","dml","webnn-gpu"].includes(e)))}if(d.includes(e))return[c[e]??e];throw new Error(`Unsupported device: "${e}". Should be one of: ${d.join(", ")}.`)}let f=null;async function g(e,t,s){f&&await f;const r=m.create(e,t);f??=r;const o=await r;return o.config=s,o}let w=Promise.resolve();const M=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV;async function x(e,t){const s=()=>e.run(t);return await(M?w=w.then(s):s())}function b(e){return e instanceof _.Tensor}const k=_?.env;function y(){return k?.wasm?.proxy}k?.wasm&&("undefined"!=typeof ServiceWorkerGlobalScope&&self instanceof ServiceWorkerGlobalScope||k.wasm.wasmPaths||(k.wasm.wasmPaths=`https://cdn.jsdelivr.net/npm/@huggingface/transformers@${n.env.version}/dist/`),k.wasm.proxy=!1),k?.webgpu&&(k.webgpu.powerPreference="high-performance"),n.env.backends.onnx=k},"./src/base/feature_extraction_utils.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{FeatureExtractor:()=>a,validate_audio_inputs:()=>i});var r=s("./src/utils/constants.js"),o=s("./src/utils/generic.js"),n=s("./src/utils/hub.js");class a extends o.Callable{constructor(e){super(),this.config=e}static async from_pretrained(e,t={}){return new this(await(0,n.getModelJSON)(e,r.FEATURE_EXTRACTOR_NAME,!0,t))}}function i(e,t){if(!(e instanceof Float32Array||e instanceof Float64Array))throw new Error(`${t} expects input to be a Float32Array or a Float64Array, but got ${e?.constructor?.name??typeof e} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}},"./src/base/image_processors_utils.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{ImageProcessor:()=>M,center_to_corners_format:()=>u,post_process_instance_segmentation:()=>w,post_process_object_detection:()=>_,post_process_panoptic_segmentation:()=>g,post_process_semantic_segmentation:()=>p});var r=s("./src/utils/generic.js"),o=s("./src/utils/tensor.js"),n=s("./src/utils/maths.js"),a=(s("./src/utils/image.js"),s("./src/utils/core.js")),i=s("./src/utils/hub.js"),l=s("./src/utils/constants.js");function c(e,t,s=0,r=null){const o=e/t;let a=(0,n.bankers_round)(o)*t;return null!==r&&a>r&&(a=Math.floor(o)*t),at&&a.push(e)}else{let e=(0,n.max)(o.data)[1];if(e===c-1)continue;if(s=(0,n.softmax)(o.data),s[e]e*i[(t+1)%2]))),_.boxes.push(r),_.classes.push(t),_.scores.push(s[t])}}d.push(_)}return d}function p(e,t=null){const s=e.logits,r=s.dims[0];if(null!==t&&t.length!==r)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const n=[];for(let e=0;ed[s]&&(d[s]=t[s],u[s]=e)}const _=new Array(a.dims[0]);for(let e=0;evoid 0!==e));n.push({segmentation:c,labels:p})}return n}function m(e,t,s,r){const o=[],a=[],i=[];for(let l=0;ls&&(o.push(d),a.push(_),i.push(u))}return[o,a,i]}function h(e,t,s,r=.5,o=.8){const n=[];let a=0,i=0;const l=t[s].data;for(let t=0;t=r&&++i;let c=a>0&&i>0;if(c){c=a/i>o}return[c,n]}function f(e,t,s,r,n,a=null,i=null){const[l,c]=i??e[0].dims,d=new o.Tensor("int32",new Int32Array(l*c),[l,c]),u=[];if(null!==i)for(let t=0;tp[e]&&(_[e]=s,p[e]=o[e])}let m=0;const f=d.data;for(let o=0;oo?l=Math.floor(o*i/r):o>r&&(i=Math.floor(r*l/o)),await e.resize(l,i,{resample:s}))}async crop_margin(e,t=200){const s=e.clone().grayscale(),r=(0,n.min)(s.data)[0],o=(0,n.max)(s.data)[0]-r;if(0===o)return e;const a=t/255;let i=s.width,l=s.height,c=0,d=0;const u=s.data;for(let e=0;e200)throw new Error("absolute aspect ratio must be smaller than 200, got "+Math.max(e,t)/Math.min(e,t));let n=Math.round(e/s)*s,a=Math.round(t/s)*s;if(n*a>o){const r=Math.sqrt(e*t/o);n=Math.floor(e/r/s)*s,a=Math.floor(t/r/s)*s}else if(n*athis.preprocess(e))));return{pixel_values:(0,o.stack)(s.map((e=>e.pixel_values)),0),original_sizes:s.map((e=>e.original_size)),reshaped_input_sizes:s.map((e=>e.reshaped_input_size))}}static async from_pretrained(e,t={}){return new this(await(0,i.getModelJSON)(e,l.IMAGE_PROCESSOR_NAME,!0,t))}}},"./src/base/processing_utils.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Processor:()=>a});var r=s("./src/utils/constants.js"),o=s("./src/utils/generic.js"),n=s("./src/utils/hub.js");class a extends o.Callable{static classes=["image_processor_class","tokenizer_class","feature_extractor_class"];static uses_processor_config=!1;static uses_chat_template_file=!1;constructor(e,t,s){super(),this.config=e,this.components=t,this.chat_template=s}get image_processor(){return this.components.image_processor}get tokenizer(){return this.components.tokenizer}get feature_extractor(){return this.components.feature_extractor}apply_chat_template(e,t={}){if(!this.tokenizer)throw new Error("Unable to apply chat template without a tokenizer.");return this.tokenizer.apply_chat_template(e,{tokenize:!1,chat_template:this.chat_template??void 0,...t})}batch_decode(...e){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.batch_decode(...e)}decode(...e){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.decode(...e)}async _call(e,...t){for(const s of[this.image_processor,this.feature_extractor,this.tokenizer])if(s)return s(e,...t);throw new Error("No image processor, feature extractor, or tokenizer found.")}static async from_pretrained(e,t={}){const[s,o,a]=await Promise.all([this.uses_processor_config?(0,n.getModelJSON)(e,r.PROCESSOR_NAME,!0,t):{},Promise.all(this.classes.filter((e=>e in this)).map((async s=>{const r=await this[s].from_pretrained(e,t);return[s.replace(/_class$/,""),r]}))).then(Object.fromEntries),this.uses_chat_template_file?(0,n.getModelText)(e,r.CHAT_TEMPLATE_NAME,!0,t):null]);return new this(s,o,a)}}},"./src/configs.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{AutoConfig:()=>l,PretrainedConfig:()=>i,getCacheShapes:()=>a});var r=s("./src/utils/core.js"),o=s("./src/utils/hub.js");function n(e){const t={};let s={};switch(e.model_type){case"llava":case"paligemma":case"gemma3":case"florence2":case"llava_onevision":case"idefics3":case"ultravox":case"voxtral":case"smolvlm":case"gemma3n":case"mistral3":s=n(e.text_config);break;case"moondream1":s=n(e.phi_config);break;case"musicgen":s=n(e.decoder);break;case"multi_modality":s=n(e.language_config);break;case"gpt2":case"gptj":case"jais":case"codegen":case"gpt_bigcode":t.num_heads="n_head",t.num_layers="n_layer",t.hidden_size="n_embd";break;case"gpt_neox":case"stablelm":case"opt":case"falcon":case"modernbert-decoder":t.num_heads="num_attention_heads",t.num_layers="num_hidden_layers",t.hidden_size="hidden_size";break;case"llama":case"llama4_text":case"nanochat":case"arcee":case"lfm2":case"smollm3":case"olmo":case"olmo2":case"mobilellm":case"granite":case"granitemoehybrid":case"cohere":case"mistral":case"starcoder2":case"qwen2":case"qwen2_vl":case"phi":case"phi3":case"phi3_v":case"llava_qwen2":t.num_heads="num_key_value_heads",t.num_layers="num_hidden_layers",t.hidden_size="hidden_size",t.num_attention_heads="num_attention_heads",t.dim_kv="head_dim";break;case"qwen3":case"gemma":case"gemma2":case"vaultgemma":case"gemma3_text":case"gemma3n_text":case"glm":case"helium":case"ernie4_5":case"ministral":case"ministral3":t.num_heads="num_key_value_heads",t.num_layers="num_hidden_layers",t.dim_kv="head_dim";break;case"openelm":t.num_heads="num_kv_heads",t.num_layers="num_transformer_layers",t.dim_kv="head_dim";break;case"gpt_neo":case"donut-swin":t.num_heads="num_heads",t.num_layers="num_layers",t.hidden_size="hidden_size";break;case"bloom":t.num_heads="n_head",t.num_layers="n_layer",t.hidden_size="hidden_size";break;case"mpt":t.num_heads="n_heads",t.num_layers="n_layers",t.hidden_size="d_model";break;case"exaone":t.num_heads="num_key_value_heads",t.num_layers="num_layers",t.dim_kv="head_dim",t.num_attention_heads="num_attention_heads";break;case"t5":case"mt5":case"longt5":t.num_decoder_layers="num_decoder_layers",t.num_decoder_heads="num_heads",t.decoder_dim_kv="d_kv",t.num_encoder_layers="num_layers",t.num_encoder_heads="num_heads",t.encoder_dim_kv="d_kv";break;case"bart":case"mbart":case"marian":case"whisper":case"lite-whisper":case"m2m_100":case"blenderbot":case"blenderbot-small":case"florence2_language":t.num_decoder_layers="decoder_layers",t.num_decoder_heads="decoder_attention_heads",t.decoder_hidden_size="d_model",t.num_encoder_layers="encoder_layers",t.num_encoder_heads="encoder_attention_heads",t.encoder_hidden_size="d_model";break;case"speecht5":t.num_decoder_layers="decoder_layers",t.num_decoder_heads="decoder_attention_heads",t.decoder_hidden_size="hidden_size",t.num_encoder_layers="encoder_layers",t.num_encoder_heads="encoder_attention_heads",t.encoder_hidden_size="hidden_size";break;case"trocr":t.num_encoder_layers=t.num_decoder_layers="decoder_layers",t.num_encoder_heads=t.num_decoder_heads="decoder_attention_heads",t.encoder_hidden_size=t.decoder_hidden_size="d_model";break;case"musicgen_decoder":t.num_encoder_layers=t.num_decoder_layers="num_hidden_layers",t.num_encoder_heads=t.num_decoder_heads="num_attention_heads",t.encoder_hidden_size=t.decoder_hidden_size="hidden_size";break;case"moonshine":t.num_decoder_layers="decoder_num_hidden_layers",t.num_decoder_heads="decoder_num_key_value_heads",t.num_encoder_layers="encoder_num_hidden_layers",t.num_encoder_heads="encoder_num_key_value_heads",t.encoder_hidden_size=t.decoder_hidden_size="hidden_size";break;case"vision-encoder-decoder":const o=n(e.decoder),a="num_decoder_layers"in o,i=(0,r.pick)(e,["model_type","is_encoder_decoder"]);return a?(i.num_decoder_layers=o.num_decoder_layers,i.num_decoder_heads=o.num_decoder_heads,i.decoder_hidden_size=o.decoder_hidden_size,i.num_encoder_layers=o.num_encoder_layers,i.num_encoder_heads=o.num_encoder_heads,i.encoder_hidden_size=o.encoder_hidden_size):(i.num_layers=o.num_layers,i.num_heads=o.num_heads,i.hidden_size=o.hidden_size),i}const o={...s,...(0,r.pick)(e,["model_type","multi_query","is_encoder_decoder"])};for(const s in t)o[s]=e[t[s]];return o}function a(e,t){if("lfm2"===e.model_type){const s=t?.prefix??"past_key_values",r="present"===s?"present":"past",o={},{layer_types:n,num_attention_heads:a,num_key_value_heads:i,hidden_size:l,conv_L_cache:c}=e,d=l/a,u=t?.batch_size??1;for(let e=0;e{"use strict";s.r(t),s.d(t,{apis:()=>f,env:()=>b});var r=s("node:fs"),o=s("node:path"),n=s("node:url");const a="undefined"!=typeof window&&void 0!==window.document,i="undefined"!=typeof self&&["DedicatedWorkerGlobalScope","ServiceWorkerGlobalScope","SharedWorkerGlobalScope"].includes(self.constructor?.name),l="undefined"!=typeof self&&"caches"in self,c="undefined"!=typeof navigator&&"gpu"in navigator,d="undefined"!=typeof navigator&&"ml"in navigator,u="undefined"!=typeof process,_=u&&"node"===process?.release?.name,p=!k(r),m=!k(o),h=void 0!==globalThis.Deno,f=(globalThis.Bun,Object.freeze({IS_BROWSER_ENV:a,IS_WEBWORKER_ENV:i,IS_WEB_CACHE_AVAILABLE:l,IS_WEBGPU_AVAILABLE:c,IS_WEBNN_AVAILABLE:d,IS_PROCESS_AVAILABLE:u,IS_NODE_ENV:_,IS_FS_AVAILABLE:p,IS_PATH_AVAILABLE:m})),g=p&&m;let w="./";if(g){const e=Object({}).url;e?w=o.dirname(o.dirname(n.fileURLToPath(e))):"undefined"!=typeof __dirname&&(w=o.dirname(__dirname))}const M=g?o.join(w,"/.cache/"):null,x="/models/",b={version:"3.8.1",backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!(a||i),localModelPath:g?o.join(w,x):x,useFS:p,useBrowserCache:l&&!h,useFSCache:p,cacheDir:M,useCustomCache:!1,customCache:null};function k(e){return 0===Object.keys(e).length}},"./src/generation/configuration_utils.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{GenerationConfig:()=>o});var r=s("./src/utils/core.js");class o{max_length=20;max_new_tokens=null;min_length=0;min_new_tokens=null;early_stopping=!1;max_time=null;do_sample=!1;num_beams=1;num_beam_groups=1;penalty_alpha=null;use_cache=!0;temperature=1;top_k=50;top_p=1;typical_p=1;epsilon_cutoff=0;eta_cutoff=0;diversity_penalty=0;repetition_penalty=1;encoder_repetition_penalty=1;length_penalty=1;no_repeat_ngram_size=0;bad_words_ids=null;force_words_ids=null;renormalize_logits=!1;constraints=null;forced_bos_token_id=null;forced_eos_token_id=null;remove_invalid_values=!1;exponential_decay_length_penalty=null;suppress_tokens=null;streamer=null;begin_suppress_tokens=null;forced_decoder_ids=null;guidance_scale=null;num_return_sequences=1;output_attentions=!1;output_hidden_states=!1;output_scores=!1;return_dict_in_generate=!1;pad_token_id=null;bos_token_id=null;eos_token_id=null;encoder_no_repeat_ngram_size=0;decoder_start_token_id=null;generation_kwargs={};constructor(e){Object.assign(this,(0,r.pick)(e,Object.getOwnPropertyNames(this)))}}},"./src/generation/logits_process.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{ClassifierFreeGuidanceLogitsProcessor:()=>g,ForcedBOSTokenLogitsProcessor:()=>l,ForcedEOSTokenLogitsProcessor:()=>c,LogitsProcessor:()=>n,LogitsProcessorList:()=>i,LogitsWarper:()=>a,MinLengthLogitsProcessor:()=>m,MinNewTokensLengthLogitsProcessor:()=>h,NoBadWordsLogitsProcessor:()=>f,NoRepeatNGramLogitsProcessor:()=>_,RepetitionPenaltyLogitsProcessor:()=>p,SuppressTokensAtBeginLogitsProcessor:()=>d,TemperatureLogitsWarper:()=>w,TopKLogitsWarper:()=>x,TopPLogitsWarper:()=>M,WhisperTimeStampLogitsProcessor:()=>u});var r=s("./src/utils/generic.js"),o=(s("./src/utils/tensor.js"),s("./src/utils/maths.js"));class n extends r.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class a extends r.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class i extends r.Callable{constructor(){super(),this.processors=[]}push(e){this.processors.push(e)}extend(e){this.processors.push(...e)}_call(e,t){let s=t;for(const t of this.processors)s=t(e,s);return s}[Symbol.iterator](){return this.processors.values()}}class l extends n{constructor(e){super(),this.bos_token_id=e}_call(e,t){for(let s=0;s=1&&n[n.length-1]>=this.timestamp_begin,i=n.length<2||n[n.length-2]>=this.timestamp_begin;if(a&&(i?r.subarray(this.timestamp_begin).fill(-1/0):r.subarray(0,this.eos_token_id).fill(-1/0)),e[s].length===this.begin_index&&null!==this.max_initial_timestamp_index){const e=this.timestamp_begin+this.max_initial_timestamp_index;r.subarray(e+1).fill(-1/0)}const l=(0,o.log_softmax)(r);Math.log(l.subarray(this.timestamp_begin).map(Math.exp).reduce(((e,t)=>e+t)))>(0,o.max)(l.subarray(0,this.timestamp_begin))[0]&&r.subarray(0,this.timestamp_begin).fill(-1/0)}return t}}class _ extends n{constructor(e){super(),this.no_repeat_ngram_size=e}getNgrams(e){const t=e.length,s=[];for(let r=0;r1 to use the classifier free guidance processor, got guidance scale ${e}.`);this.guidance_scale=e}_call(e,t){if(t.dims[0]!==2*e.length)throw new Error(`Logits should have twice the batch size of the input ids, the first half of batches corresponding to the conditional inputs, and the second half of batches corresponding to the unconditional inputs. Got batch size ${t.dims[0]} for the logits and ${e.length} for the input ids.`);const s=e.length,r=t.slice([0,s],null),o=t.slice([s,t.dims[0]],null);for(let e=0;e1)throw new Error(`\`top_p\` must be a float > 0 and < 1, but is ${e}`);if(!Number.isInteger(s)||s<1)throw new Error(`\`min_tokens_to_keep\` must be a positive integer, but is ${s}`);this.top_p=e,this.filter_value=t,this.min_tokens_to_keep=s}}class x extends a{constructor(e,{filter_value:t=-1/0,min_tokens_to_keep:s=1}={}){if(super(),!Number.isInteger(e)||e<0)throw new Error(`\`top_k\` must be a positive integer, but is ${e}`);this.top_k=Math.max(e,s),this.filter_value=t}}},"./src/generation/logits_sampler.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{LogitsSampler:()=>a});var r=s("./src/utils/generic.js"),o=s("./src/utils/tensor.js"),n=s("./src/utils/maths.js");s("./src/generation/configuration_utils.js");class a extends r.Callable{constructor(e){super(),this.generation_config=e}async _call(e){return this.sample(e)}async sample(e){throw Error("sample should be implemented in subclasses.")}getLogits(e,t){let s=e.dims.at(-1),r=e.data;if(-1===t)r=r.slice(-s);else{let e=t*s;r=r.slice(e,e+s)}return r}randomSelect(e){let t=0;for(let s=0;s1)return new c(e);if(e.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${e.num_return_sequences}.`);return new i(e)}}class i extends a{async sample(e){const t=(0,n.max)(e.data)[1];return[[BigInt(t),0]]}}class l extends a{async sample(e){let t=e.dims.at(-1);this.generation_config.top_k>0&&(t=Math.min(this.generation_config.top_k,t));const[s,r]=await(0,o.topk)(e,t),a=(0,n.softmax)(s.data);return Array.from({length:this.generation_config.num_beams},(()=>{const e=this.randomSelect(a);return[r.data[e],Math.log(a[e])]}))}}class c extends a{async sample(e){let t=e.dims.at(-1);this.generation_config.top_k>0&&(t=Math.min(this.generation_config.top_k,t));const[s,r]=await(0,o.topk)(e,t),a=(0,n.softmax)(s.data);return Array.from({length:this.generation_config.num_beams},((e,t)=>[r.data[t],Math.log(a[t])]))}}},"./src/generation/stopping_criteria.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{EosTokenCriteria:()=>i,InterruptableStoppingCriteria:()=>l,MaxLengthCriteria:()=>a,StoppingCriteria:()=>o,StoppingCriteriaList:()=>n});var r=s("./src/utils/generic.js");class o extends r.Callable{_call(e,t){throw Error("StoppingCriteria needs to be subclassed")}}class n extends r.Callable{constructor(){super(),this.criteria=[]}push(e){this.criteria.push(e)}extend(e){e instanceof n?e=e.criteria:e instanceof o&&(e=[e]),this.criteria.push(...e)}_call(e,t){const s=new Array(e.length).fill(!1);for(const r of this.criteria){const o=r(e,t);for(let e=0;ee.length>=this.max_length))}}class i extends o{constructor(e){super(),Array.isArray(e)||(e=[e]),this.eos_token_id=e}_call(e,t){return e.map((e=>{const t=e.at(-1);return this.eos_token_id.some((e=>t==e))}))}}class l extends o{constructor(){super(),this.interrupted=!1}interrupt(){this.interrupted=!0}reset(){this.interrupted=!1}_call(e,t){return new Array(e.length).fill(this.interrupted)}}},"./src/generation/streamers.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{BaseStreamer:()=>a,TextStreamer:()=>l,WhisperTextStreamer:()=>c});var r=s("./src/utils/core.js"),o=s("./src/tokenizers.js"),n=s("./src/env.js");class a{put(e){throw Error("Not implemented")}end(){throw Error("Not implemented")}}const i=n.apis.IS_PROCESS_AVAILABLE?e=>process.stdout.write(e):e=>console.log(e);class l extends a{constructor(e,{skip_prompt:t=!1,callback_function:s=null,token_callback_function:r=null,skip_special_tokens:o=!0,decode_kwargs:n={},...a}={}){super(),this.tokenizer=e,this.skip_prompt=t,this.callback_function=s??i,this.token_callback_function=r,this.decode_kwargs={skip_special_tokens:o,...n,...a},this.token_cache=[],this.print_len=0,this.next_tokens_are_prompt=!0}put(e){if(e.length>1)throw Error("TextStreamer only supports batch size of 1");const t=this.next_tokens_are_prompt;if(t&&(this.next_tokens_are_prompt=!1,this.skip_prompt))return;const s=e[0];this.token_callback_function?.(s),this.token_cache=(0,r.mergeArrays)(this.token_cache,s);const n=this.tokenizer.decode(this.token_cache,this.decode_kwargs);let a;t||n.endsWith("\n")?(a=n.slice(this.print_len),this.token_cache=[],this.print_len=0):n.length>0&&(0,o.is_chinese_char)(n.charCodeAt(n.length-1))?(a=n.slice(this.print_len),this.print_len+=a.length):(a=n.slice(this.print_len,n.lastIndexOf(" ")+1),this.print_len+=a.length),this.on_finalized_text(a,!1)}end(){let e;if(this.token_cache.length>0){e=this.tokenizer.decode(this.token_cache,this.decode_kwargs).slice(this.print_len),this.token_cache=[],this.print_len=0}else e="";this.next_tokens_are_prompt=!0,this.on_finalized_text(e,!0)}on_finalized_text(e,t){e.length>0&&this.callback_function?.(e),t&&this.callback_function===i&&n.apis.IS_PROCESS_AVAILABLE&&this.callback_function?.("\n")}}class c extends l{constructor(e,{skip_prompt:t=!1,callback_function:s=null,token_callback_function:r=null,on_chunk_start:o=null,on_chunk_end:n=null,on_finalize:a=null,time_precision:i=.02,skip_special_tokens:l=!0,decode_kwargs:c={}}={}){super(e,{skip_prompt:t,skip_special_tokens:l,callback_function:s,token_callback_function:r,decode_kwargs:c}),this.timestamp_begin=e.timestamp_begin,this.on_chunk_start=o,this.on_chunk_end=n,this.on_finalize=a,this.time_precision=i,this.waiting_for_timestamp=!1}put(e){if(e.length>1)throw Error("WhisperTextStreamer only supports batch size of 1");const t=e[0];if(1===t.length){const e=Number(t[0])-this.timestamp_begin;if(e>=0){const s=e*this.time_precision;return this.waiting_for_timestamp?this.on_chunk_end?.(s):this.on_chunk_start?.(s),this.waiting_for_timestamp=!this.waiting_for_timestamp,void this.token_callback_function?.(t)}}return super.put(e)}end(){super.end(),this.on_finalize?.()}}},"./src/models.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{ASTForAudioClassification:()=>Is,ASTModel:()=>Ls,ASTPreTrainedModel:()=>Es,AlbertForMaskedLM:()=>$t,AlbertForQuestionAnswering:()=>Gt,AlbertForSequenceClassification:()=>Bt,AlbertModel:()=>Vt,AlbertPreTrainedModel:()=>Nt,ArceeForCausalLM:()=>to,ArceeModel:()=>eo,ArceePreTrainedModel:()=>Zr,AutoModel:()=>iu,AutoModelForAudioClassification:()=>Pu,AutoModelForAudioFrameClassification:()=>Cu,AutoModelForAudioTextToText:()=>Ou,AutoModelForCTC:()=>Tu,AutoModelForCausalLM:()=>mu,AutoModelForDepthEstimation:()=>Lu,AutoModelForDocumentQuestionAnswering:()=>Su,AutoModelForImageClassification:()=>wu,AutoModelForImageFeatureExtraction:()=>ju,AutoModelForImageMatting:()=>Au,AutoModelForImageSegmentation:()=>Mu,AutoModelForImageTextToText:()=>Du,AutoModelForImageToImage:()=>Eu,AutoModelForMaskGeneration:()=>vu,AutoModelForMaskedLM:()=>hu,AutoModelForNormalEstimation:()=>Iu,AutoModelForObjectDetection:()=>ku,AutoModelForPoseEstimation:()=>zu,AutoModelForQuestionAnswering:()=>fu,AutoModelForSemanticSegmentation:()=>xu,AutoModelForSeq2SeqLM:()=>du,AutoModelForSequenceClassification:()=>lu,AutoModelForSpeechSeq2Seq:()=>uu,AutoModelForTextToSpectrogram:()=>_u,AutoModelForTextToWaveform:()=>pu,AutoModelForTokenClassification:()=>cu,AutoModelForUniversalSegmentation:()=>bu,AutoModelForVision2Seq:()=>gu,AutoModelForXVector:()=>Fu,AutoModelForZeroShotObjectDetection:()=>yu,BartForConditionalGeneration:()=>es,BartForSequenceClassification:()=>ts,BartModel:()=>Zt,BartPretrainedModel:()=>Kt,BaseModelOutput:()=>ae,BeitForImageClassification:()=>oa,BeitModel:()=>ra,BeitPreTrainedModel:()=>sa,BertForMaskedLM:()=>ce,BertForQuestionAnswering:()=>_e,BertForSequenceClassification:()=>de,BertForTokenClassification:()=>ue,BertModel:()=>le,BertPreTrainedModel:()=>ie,BlenderbotForConditionalGeneration:()=>cs,BlenderbotModel:()=>ls,BlenderbotPreTrainedModel:()=>is,BlenderbotSmallForConditionalGeneration:()=>_s,BlenderbotSmallModel:()=>us,BlenderbotSmallPreTrainedModel:()=>ds,BloomForCausalLM:()=>mn,BloomModel:()=>pn,BloomPreTrainedModel:()=>_n,CLIPModel:()=>ar,CLIPPreTrainedModel:()=>nr,CLIPSegForImageSegmentation:()=>yr,CLIPSegModel:()=>kr,CLIPSegPreTrainedModel:()=>br,CLIPTextModel:()=>ir,CLIPTextModelWithProjection:()=>lr,CLIPVisionModel:()=>cr,CLIPVisionModelWithProjection:()=>dr,CamembertForMaskedLM:()=>He,CamembertForQuestionAnswering:()=>Ke,CamembertForSequenceClassification:()=>Je,CamembertForTokenClassification:()=>Ye,CamembertModel:()=>Xe,CamembertPreTrainedModel:()=>Qe,CausalLMOutput:()=>qu,CausalLMOutputWithPast:()=>Wu,ChineseCLIPModel:()=>fr,ChineseCLIPPreTrainedModel:()=>hr,ClapAudioModelWithProjection:()=>dc,ClapModel:()=>lc,ClapPreTrainedModel:()=>ic,ClapTextModelWithProjection:()=>cc,CodeGenForCausalLM:()=>qr,CodeGenModel:()=>Rr,CodeGenPreTrainedModel:()=>$r,CohereForCausalLM:()=>jo,CohereModel:()=>zo,CoherePreTrainedModel:()=>Io,ConvBertForMaskedLM:()=>Oe,ConvBertForQuestionAnswering:()=>Be,ConvBertForSequenceClassification:()=>Ne,ConvBertForTokenClassification:()=>Ve,ConvBertModel:()=>De,ConvBertPreTrainedModel:()=>je,ConvNextForImageClassification:()=>gi,ConvNextModel:()=>fi,ConvNextPreTrainedModel:()=>hi,ConvNextV2ForImageClassification:()=>xi,ConvNextV2Model:()=>Mi,ConvNextV2PreTrainedModel:()=>wi,DFineForObjectDetection:()=>Ta,DFineModel:()=>va,DFinePreTrainedModel:()=>ya,DINOv3ConvNextModel:()=>Ai,DINOv3ConvNextPreTrainedModel:()=>Si,DINOv3ViTModel:()=>Ci,DINOv3ViTPreTrainedModel:()=>Fi,DPTForDepthEstimation:()=>Xa,DPTModel:()=>Qa,DPTPreTrainedModel:()=>Ua,DacDecoderModel:()=>fd,DacDecoderOutput:()=>pd,DacEncoderModel:()=>hd,DacEncoderOutput:()=>_d,DacModel:()=>md,DacPreTrainedModel:()=>ud,DebertaForMaskedLM:()=>tt,DebertaForQuestionAnswering:()=>ot,DebertaForSequenceClassification:()=>st,DebertaForTokenClassification:()=>rt,DebertaModel:()=>et,DebertaPreTrainedModel:()=>Ze,DebertaV2ForMaskedLM:()=>it,DebertaV2ForQuestionAnswering:()=>dt,DebertaV2ForSequenceClassification:()=>lt,DebertaV2ForTokenClassification:()=>ct,DebertaV2Model:()=>at,DebertaV2PreTrainedModel:()=>nt,DecisionTransformerModel:()=>qc,DecisionTransformerPreTrainedModel:()=>Rc,DeiTForImageClassification:()=>La,DeiTModel:()=>Ea,DeiTPreTrainedModel:()=>Aa,DepthAnythingForDepthEstimation:()=>Ja,DepthAnythingPreTrainedModel:()=>Ha,DepthProForDepthEstimation:()=>si,DepthProPreTrainedModel:()=>ti,DetrForObjectDetection:()=>ia,DetrForSegmentation:()=>la,DetrModel:()=>aa,DetrObjectDetectionOutput:()=>ca,DetrPreTrainedModel:()=>na,DetrSegmentationOutput:()=>da,Dinov2ForImageClassification:()=>yi,Dinov2Model:()=>ki,Dinov2PreTrainedModel:()=>bi,Dinov2WithRegistersForImageClassification:()=>Pi,Dinov2WithRegistersModel:()=>Ti,Dinov2WithRegistersPreTrainedModel:()=>vi,DistilBertForMaskedLM:()=>ft,DistilBertForQuestionAnswering:()=>ht,DistilBertForSequenceClassification:()=>pt,DistilBertForTokenClassification:()=>mt,DistilBertModel:()=>_t,DistilBertPreTrainedModel:()=>ut,DonutSwinModel:()=>mi,DonutSwinPreTrainedModel:()=>pi,EdgeTamModel:()=>Ri,EfficientNetForImageClassification:()=>kc,EfficientNetModel:()=>bc,EfficientNetPreTrainedModel:()=>xc,ElectraForMaskedLM:()=>Re,ElectraForQuestionAnswering:()=>Ue,ElectraForSequenceClassification:()=>qe,ElectraForTokenClassification:()=>We,ElectraModel:()=>$e,ElectraPreTrainedModel:()=>Ge,Ernie4_5ForCausalLM:()=>ec,Ernie4_5Model:()=>Zl,Ernie4_5PreTrainedModel:()=>Kl,EsmForMaskedLM:()=>Mt,EsmForSequenceClassification:()=>xt,EsmForTokenClassification:()=>bt,EsmModel:()=>wt,EsmPreTrainedModel:()=>gt,ExaoneForCausalLM:()=>go,ExaoneModel:()=>fo,ExaonePreTrainedModel:()=>ho,FalconForCausalLM:()=>ac,FalconModel:()=>nc,FalconPreTrainedModel:()=>oc,FastViTForImageClassification:()=>Gn,FastViTModel:()=>Bn,FastViTPreTrainedModel:()=>Vn,Florence2ForConditionalGeneration:()=>Qs,Florence2PreTrainedModel:()=>Us,GLPNForDepthEstimation:()=>_i,GLPNModel:()=>ui,GLPNPreTrainedModel:()=>di,GPT2LMHeadModel:()=>Pr,GPT2Model:()=>Tr,GPT2PreTrainedModel:()=>vr,GPTBigCodeForCausalLM:()=>Gr,GPTBigCodeModel:()=>Br,GPTBigCodePreTrainedModel:()=>Vr,GPTJForCausalLM:()=>Nr,GPTJModel:()=>Or,GPTJPreTrainedModel:()=>Dr,GPTNeoForCausalLM:()=>Lr,GPTNeoModel:()=>Er,GPTNeoPreTrainedModel:()=>Ar,GPTNeoXForCausalLM:()=>jr,GPTNeoXModel:()=>zr,GPTNeoXPreTrainedModel:()=>Ir,Gemma2ForCausalLM:()=>Go,Gemma2Model:()=>Bo,Gemma2PreTrainedModel:()=>Vo,Gemma3ForCausalLM:()=>Qo,Gemma3Model:()=>Uo,Gemma3PreTrainedModel:()=>Wo,Gemma3nForConditionalGeneration:()=>Zs,Gemma3nPreTrainedModel:()=>Ks,GemmaForCausalLM:()=>No,GemmaModel:()=>Oo,GemmaPreTrainedModel:()=>Do,GlmForCausalLM:()=>mo,GlmModel:()=>po,GlmPreTrainedModel:()=>_o,GraniteForCausalLM:()=>So,GraniteModel:()=>Co,GraniteMoeHybridForCausalLM:()=>Lo,GraniteMoeHybridModel:()=>Eo,GraniteMoeHybridPreTrainedModel:()=>Ao,GranitePreTrainedModel:()=>Fo,GroundingDinoForObjectDetection:()=>Li,GroundingDinoPreTrainedModel:()=>Ei,GroupViTModel:()=>Nn,GroupViTPreTrainedModel:()=>On,HeliumForCausalLM:()=>uo,HeliumModel:()=>co,HeliumPreTrainedModel:()=>lo,HieraForImageClassification:()=>ja,HieraModel:()=>za,HieraPreTrainedModel:()=>Ia,HubertForCTC:()=>vl,HubertForSequenceClassification:()=>Tl,HubertModel:()=>yl,HubertPreTrainedModel:()=>kl,IJepaForImageClassification:()=>Pn,IJepaModel:()=>Tn,IJepaPreTrainedModel:()=>vn,Idefics3ForConditionalGeneration:()=>tr,Idefics3PreTrainedModel:()=>er,ImageMattingOutput:()=>Uu,JAISLMHeadModel:()=>Sr,JAISModel:()=>Cr,JAISPreTrainedModel:()=>Fr,JinaCLIPModel:()=>wr,JinaCLIPPreTrainedModel:()=>gr,JinaCLIPTextModel:()=>Mr,JinaCLIPVisionModel:()=>xr,Lfm2ForCausalLM:()=>oo,Lfm2Model:()=>ro,Lfm2PreTrainedModel:()=>so,LiteWhisperForConditionalGeneration:()=>Os,Llama4ForCausalLM:()=>Hr,Llama4PreTrainedModel:()=>Xr,LlamaForCausalLM:()=>Qr,LlamaModel:()=>Ur,LlamaPreTrainedModel:()=>Wr,LlavaForConditionalGeneration:()=>Rs,LlavaOnevisionForConditionalGeneration:()=>qs,LlavaPreTrainedModel:()=>$s,LlavaQwen2ForCausalLM:()=>Js,LongT5ForConditionalGeneration:()=>Xt,LongT5Model:()=>Qt,LongT5PreTrainedModel:()=>Ut,M2M100ForConditionalGeneration:()=>Ji,M2M100Model:()=>Hi,M2M100PreTrainedModel:()=>Xi,MBartForCausalLM:()=>as,MBartForConditionalGeneration:()=>os,MBartForSequenceClassification:()=>ns,MBartModel:()=>rs,MBartPreTrainedModel:()=>ss,MPNetForMaskedLM:()=>St,MPNetForQuestionAnswering:()=>Lt,MPNetForSequenceClassification:()=>At,MPNetForTokenClassification:()=>Et,MPNetModel:()=>Ct,MPNetPreTrainedModel:()=>Ft,MT5ForConditionalGeneration:()=>Yt,MT5Model:()=>Jt,MT5PreTrainedModel:()=>Ht,MarianMTModel:()=>Qi,MarianModel:()=>Ui,MarianPreTrainedModel:()=>Wi,MaskFormerForInstanceSegmentation:()=>ci,MaskFormerModel:()=>li,MaskFormerPreTrainedModel:()=>ii,MaskedLMOutput:()=>$u,Metric3DForDepthEstimation:()=>oi,Metric3DPreTrainedModel:()=>ri,Metric3Dv2ForDepthEstimation:()=>ai,Metric3Dv2PreTrainedModel:()=>ni,MgpstrForSceneTextRecognition:()=>Hc,MgpstrModelOutput:()=>Qc,MgpstrPreTrainedModel:()=>Xc,MimiDecoderModel:()=>dd,MimiDecoderOutput:()=>id,MimiEncoderModel:()=>cd,MimiEncoderOutput:()=>ad,MimiModel:()=>ld,MimiPreTrainedModel:()=>nd,Ministral3ForCausalLM:()=>Yl,Ministral3Model:()=>Jl,Ministral3PreTrainedModel:()=>Hl,MinistralForCausalLM:()=>Xl,MinistralModel:()=>Ql,MinistralPreTrainedModel:()=>Ul,Mistral3ForConditionalGeneration:()=>Ys,MistralForCausalLM:()=>Wl,MistralModel:()=>ql,MistralPreTrainedModel:()=>Rl,MobileBertForMaskedLM:()=>vt,MobileBertForQuestionAnswering:()=>Pt,MobileBertForSequenceClassification:()=>Tt,MobileBertModel:()=>yt,MobileBertPreTrainedModel:()=>kt,MobileLLMForCausalLM:()=>xo,MobileLLMModel:()=>Mo,MobileLLMPreTrainedModel:()=>wo,MobileNetV1ForImageClassification:()=>Sc,MobileNetV1ForSemanticSegmentation:()=>Ac,MobileNetV1Model:()=>Cc,MobileNetV1PreTrainedModel:()=>Fc,MobileNetV2ForImageClassification:()=>Ic,MobileNetV2ForSemanticSegmentation:()=>zc,MobileNetV2Model:()=>Lc,MobileNetV2PreTrainedModel:()=>Ec,MobileNetV3ForImageClassification:()=>Oc,MobileNetV3ForSemanticSegmentation:()=>Nc,MobileNetV3Model:()=>Dc,MobileNetV3PreTrainedModel:()=>jc,MobileNetV4ForImageClassification:()=>Gc,MobileNetV4ForSemanticSegmentation:()=>$c,MobileNetV4Model:()=>Bc,MobileNetV4PreTrainedModel:()=>Vc,MobileViTForImageClassification:()=>Un,MobileViTModel:()=>Wn,MobileViTPreTrainedModel:()=>qn,MobileViTV2ForImageClassification:()=>Hn,MobileViTV2Model:()=>Xn,MobileViTV2PreTrainedModel:()=>Qn,ModelOutput:()=>ne,ModernBertDecoderForCausalLM:()=>Pe,ModernBertDecoderModel:()=>Te,ModernBertDecoderPreTrainedModel:()=>ve,ModernBertForMaskedLM:()=>be,ModernBertForSequenceClassification:()=>ke,ModernBertForTokenClassification:()=>ye,ModernBertModel:()=>xe,ModernBertPreTrainedModel:()=>Me,Moondream1ForConditionalGeneration:()=>Ws,MoonshineForConditionalGeneration:()=>Bs,MoonshineModel:()=>Vs,MoonshinePreTrainedModel:()=>Ns,MptForCausalLM:()=>gn,MptModel:()=>fn,MptPreTrainedModel:()=>hn,MultiModalityCausalLM:()=>Uc,MultiModalityPreTrainedModel:()=>Wc,MusicgenForCausalLM:()=>Tc,MusicgenForConditionalGeneration:()=>Pc,MusicgenModel:()=>vc,MusicgenPreTrainedModel:()=>yc,NanoChatForCausalLM:()=>Kr,NanoChatModel:()=>Yr,NanoChatPreTrainedModel:()=>Jr,NeoBertForMaskedLM:()=>he,NeoBertForQuestionAnswering:()=>we,NeoBertForSequenceClassification:()=>fe,NeoBertForTokenClassification:()=>ge,NeoBertModel:()=>me,NeoBertPreTrainedModel:()=>pe,NomicBertModel:()=>Ce,NomicBertPreTrainedModel:()=>Fe,OPTForCausalLM:()=>xn,OPTModel:()=>Mn,OPTPreTrainedModel:()=>wn,Olmo2ForCausalLM:()=>Po,Olmo2Model:()=>To,Olmo2PreTrainedModel:()=>vo,OlmoForCausalLM:()=>yo,OlmoModel:()=>ko,OlmoPreTrainedModel:()=>bo,OpenELMForCausalLM:()=>Jo,OpenELMModel:()=>Ho,OpenELMPreTrainedModel:()=>Xo,OwlViTForObjectDetection:()=>Kn,OwlViTModel:()=>Yn,OwlViTPreTrainedModel:()=>Jn,Owlv2ForObjectDetection:()=>ta,Owlv2Model:()=>ea,Owlv2PreTrainedModel:()=>Zn,PaliGemmaForConditionalGeneration:()=>Hs,PaliGemmaPreTrainedModel:()=>Xs,ParakeetForCTC:()=>rl,ParakeetPreTrainedModel:()=>sl,PatchTSMixerForPrediction:()=>td,PatchTSMixerModel:()=>ed,PatchTSMixerPreTrainedModel:()=>Zc,PatchTSTForPrediction:()=>Kc,PatchTSTModel:()=>Yc,PatchTSTPreTrainedModel:()=>Jc,Phi3ForCausalLM:()=>un,Phi3Model:()=>dn,Phi3PreTrainedModel:()=>cn,Phi3VForCausalLM:()=>or,Phi3VPreTrainedModel:()=>rr,PhiForCausalLM:()=>ln,PhiModel:()=>an,PhiPreTrainedModel:()=>nn,PreTrainedModel:()=>oe,PretrainedMixin:()=>bd,PvtForImageClassification:()=>En,PvtModel:()=>An,PvtPreTrainedModel:()=>Sn,PyAnnoteForAudioFrameClassification:()=>al,PyAnnoteModel:()=>nl,PyAnnotePreTrainedModel:()=>ol,QuestionAnsweringModelOutput:()=>Ru,Qwen2ForCausalLM:()=>Zo,Qwen2Model:()=>Ko,Qwen2PreTrainedModel:()=>Yo,Qwen2VLForConditionalGeneration:()=>on,Qwen2VLPreTrainedModel:()=>rn,Qwen3ForCausalLM:()=>sn,Qwen3Model:()=>tn,Qwen3PreTrainedModel:()=>en,RFDetrForObjectDetection:()=>ba,RFDetrModel:()=>xa,RFDetrObjectDetectionOutput:()=>ka,RFDetrPreTrainedModel:()=>Ma,RTDetrForObjectDetection:()=>pa,RTDetrModel:()=>_a,RTDetrObjectDetectionOutput:()=>ma,RTDetrPreTrainedModel:()=>ua,RTDetrV2ForObjectDetection:()=>ga,RTDetrV2Model:()=>fa,RTDetrV2ObjectDetectionOutput:()=>wa,RTDetrV2PreTrainedModel:()=>ha,ResNetForImageClassification:()=>Na,ResNetModel:()=>Oa,ResNetPreTrainedModel:()=>Da,RoFormerForMaskedLM:()=>Ee,RoFormerForQuestionAnswering:()=>ze,RoFormerForSequenceClassification:()=>Le,RoFormerForTokenClassification:()=>Ie,RoFormerModel:()=>Ae,RoFormerPreTrainedModel:()=>Se,RobertaForMaskedLM:()=>hs,RobertaForQuestionAnswering:()=>ws,RobertaForSequenceClassification:()=>fs,RobertaForTokenClassification:()=>gs,RobertaModel:()=>ms,RobertaPreTrainedModel:()=>ps,Sam2ImageSegmentationOutput:()=>Bi,Sam2Model:()=>$i,Sam2PreTrainedModel:()=>Gi,Sam3TrackerModel:()=>qi,SamImageSegmentationOutput:()=>Vi,SamModel:()=>Ni,SamPreTrainedModel:()=>Oi,SapiensForDepthEstimation:()=>Za,SapiensForNormalEstimation:()=>ei,SapiensForSemanticSegmentation:()=>Ka,SapiensPreTrainedModel:()=>Ya,SegformerForImageClassification:()=>hc,SegformerForSemanticSegmentation:()=>fc,SegformerModel:()=>mc,SegformerPreTrainedModel:()=>pc,Seq2SeqLMOutput:()=>Nu,SequenceClassifierOutput:()=>Vu,SiglipModel:()=>_r,SiglipPreTrainedModel:()=>ur,SiglipTextModel:()=>pr,SiglipVisionModel:()=>mr,SmolLM3ForCausalLM:()=>io,SmolLM3Model:()=>ao,SmolLM3PreTrainedModel:()=>no,SmolVLMForConditionalGeneration:()=>sr,SnacDecoderModel:()=>xd,SnacEncoderModel:()=>Md,SnacModel:()=>wd,SnacPreTrainedModel:()=>gd,SpeechT5ForSpeechToText:()=>Dl,SpeechT5ForTextToSpeech:()=>Ol,SpeechT5HifiGan:()=>Nl,SpeechT5Model:()=>jl,SpeechT5PreTrainedModel:()=>zl,SqueezeBertForMaskedLM:()=>jt,SqueezeBertForQuestionAnswering:()=>Ot,SqueezeBertForSequenceClassification:()=>Dt,SqueezeBertModel:()=>zt,SqueezeBertPreTrainedModel:()=>It,StableLmForCausalLM:()=>Mc,StableLmModel:()=>wc,StableLmPreTrainedModel:()=>gc,Starcoder2ForCausalLM:()=>rc,Starcoder2Model:()=>sc,Starcoder2PreTrainedModel:()=>tc,StyleTextToSpeech2Model:()=>Il,StyleTextToSpeech2PreTrainedModel:()=>Ll,SupertonicForConditionalGeneration:()=>Bl,SupertonicPreTrainedModel:()=>Vl,Swin2SRForImageSuperResolution:()=>Wa,Swin2SRModel:()=>qa,Swin2SRPreTrainedModel:()=>Ra,SwinForImageClassification:()=>Ga,SwinForSemanticSegmentation:()=>$a,SwinModel:()=>Ba,SwinPreTrainedModel:()=>Va,T5ForConditionalGeneration:()=>Wt,T5Model:()=>qt,T5PreTrainedModel:()=>Rt,TableTransformerForObjectDetection:()=>Ca,TableTransformerModel:()=>Fa,TableTransformerObjectDetectionOutput:()=>Sa,TableTransformerPreTrainedModel:()=>Pa,TokenClassifierOutput:()=>Gu,TrOCRForCausalLM:()=>$l,TrOCRPreTrainedModel:()=>Gl,UltravoxModel:()=>rd,UltravoxPreTrainedModel:()=>sd,UniSpeechForCTC:()=>ul,UniSpeechForSequenceClassification:()=>_l,UniSpeechModel:()=>dl,UniSpeechPreTrainedModel:()=>cl,UniSpeechSatForAudioFrameClassification:()=>gl,UniSpeechSatForCTC:()=>hl,UniSpeechSatForSequenceClassification:()=>fl,UniSpeechSatModel:()=>ml,UniSpeechSatPreTrainedModel:()=>pl,VaultGemmaForCausalLM:()=>qo,VaultGemmaModel:()=>Ro,VaultGemmaPreTrainedModel:()=>$o,ViTForImageClassification:()=>yn,ViTMAEModel:()=>In,ViTMAEPreTrainedModel:()=>Ln,ViTMSNForImageClassification:()=>Dn,ViTMSNModel:()=>jn,ViTMSNPreTrainedModel:()=>zn,ViTModel:()=>kn,ViTPreTrainedModel:()=>bn,VisionEncoderDecoderModel:()=>Gs,VitMatteForImageMatting:()=>Rn,VitMattePreTrainedModel:()=>$n,VitPoseForPoseEstimation:()=>Cn,VitPosePreTrainedModel:()=>Fn,VitsModel:()=>_c,VitsModelOutput:()=>Qu,VitsPreTrainedModel:()=>uc,VoxtralForConditionalGeneration:()=>od,Wav2Vec2BertForCTC:()=>xl,Wav2Vec2BertForSequenceClassification:()=>bl,Wav2Vec2BertModel:()=>Ml,Wav2Vec2BertPreTrainedModel:()=>wl,Wav2Vec2ForAudioFrameClassification:()=>tl,Wav2Vec2ForCTC:()=>Zi,Wav2Vec2ForSequenceClassification:()=>el,Wav2Vec2Model:()=>Ki,Wav2Vec2PreTrainedModel:()=>Yi,WavLMForAudioFrameClassification:()=>El,WavLMForCTC:()=>Cl,WavLMForSequenceClassification:()=>Sl,WavLMForXVector:()=>Al,WavLMModel:()=>Fl,WavLMPreTrainedModel:()=>Pl,WeSpeakerResNetModel:()=>ll,WeSpeakerResNetPreTrainedModel:()=>il,WhisperForConditionalGeneration:()=>Ds,WhisperModel:()=>js,WhisperPreTrainedModel:()=>zs,XLMForQuestionAnswering:()=>vs,XLMForSequenceClassification:()=>ks,XLMForTokenClassification:()=>ys,XLMModel:()=>xs,XLMPreTrainedModel:()=>Ms,XLMRobertaForMaskedLM:()=>Fs,XLMRobertaForQuestionAnswering:()=>As,XLMRobertaForSequenceClassification:()=>Cs,XLMRobertaForTokenClassification:()=>Ss,XLMRobertaModel:()=>Ps,XLMRobertaPreTrainedModel:()=>Ts,XLMWithLMHeadModel:()=>bs,XVectorOutput:()=>Bu,YolosForObjectDetection:()=>ji,YolosModel:()=>zi,YolosObjectDetectionOutput:()=>Di,YolosPreTrainedModel:()=>Ii});var r=s("./src/configs.js"),o=s("./src/backends/onnx.js"),n=s("./src/utils/dtypes.js"),a=s("./src/utils/generic.js"),i=s("./src/utils/core.js"),l=s("./src/utils/hub.js"),c=s("./src/utils/constants.js"),d=s("./src/generation/logits_process.js"),u=s("./src/generation/configuration_utils.js"),_=s("./src/utils/tensor.js"),p=s("./src/utils/image.js"),m=s("./src/utils/maths.js"),h=s("./src/generation/stopping_criteria.js"),f=s("./src/generation/logits_sampler.js"),g=s("./src/env.js"),w=s("./src/models/whisper/generation_whisper.js"),M=s("./src/models/whisper/common_whisper.js");const x=0,b=1,k=2,y=3,v=4,T=5,P=6,F=7,C=8,S=9,A=10,E=11,L=12,I=13,z=new Map,j=new Map,D=new Map;async function O(e,t,s){return Object.fromEntries(await Promise.all(Object.keys(t).map((async a=>{const{buffer_or_path:i,session_options:c,session_config:d}=await async function(e,t,s){let a=s.config?.["transformers.js_config"]??{},i=s.device??a.device;i&&"string"!=typeof i&&(i.hasOwnProperty(t)?i=i[t]:(console.warn(`device not specified for "${t}". Using the default device.`),i=null));const c=i??(g.apis.IS_NODE_ENV?"cpu":"wasm"),d=(0,o.deviceToExecutionProviders)(c),u=a.device_config??{};u.hasOwnProperty(c)&&(a={...a,...u[c]});let _=s.dtype??a.dtype;if("string"!=typeof _&&(_&&_.hasOwnProperty(t)?_=_[t]:(_=n.DEFAULT_DEVICE_DTYPE_MAPPING[c]??n.DATA_TYPES.fp32,console.warn(`dtype not specified for "${t}". Using the default dtype (${_}) for this device (${c}).`))),_===n.DATA_TYPES.auto){let e=a.dtype;"string"!=typeof e&&(e=e?.[t]),_=e&&e!==n.DATA_TYPES.auto&&n.DATA_TYPES.hasOwnProperty(e)?e:n.DEFAULT_DEVICE_DTYPE_MAPPING[c]??n.DATA_TYPES.fp32}const p=_;if(!n.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(p))throw new Error(`Invalid dtype: ${p}. Should be one of: ${Object.keys(n.DATA_TYPES).join(", ")}`);if(p===n.DATA_TYPES.fp16&&"webgpu"===c&&!await(0,n.isWebGpuFp16Supported)())throw new Error(`The device (${c}) does not support fp16.`);const m=a.kv_cache_dtype,h=m?"string"==typeof m?m:m[p]??"float32":void 0;if(h&&!["float32","float16"].includes(h))throw new Error(`Invalid kv_cache_dtype: ${h}. Should be one of: float32, float16`);const f={dtype:p,kv_cache_dtype:h,device:c},w=`${t}${n.DEFAULT_DTYPE_SUFFIX_MAPPING[p]}.onnx`,M=`${s.subfolder??""}/${w}`,x={...s.session_options};x.executionProviders??=d;const b=a.free_dimension_overrides;b?x.freeDimensionOverrides??=b:c.startsWith("webnn")&&!x.freeDimensionOverrides&&console.warn(`WebNN does not currently support dynamic shapes and requires 'free_dimension_overrides' to be set in config.json, preferably as a field within config["transformers.js_config"]["device_config"]["${c}"]. When 'free_dimension_overrides' is not set, you may experience significant performance degradation.`);const k=g.apis.IS_NODE_ENV&&g.env.useFSCache,y=(0,l.getModelFile)(e,M,!0,s,k),v=s.use_external_data_format??a.use_external_data_format;let T=[];if(v){let r;r="object"==typeof v?v.hasOwnProperty(w)?v[w]:!!v.hasOwnProperty(t)&&v[t]:v;const o=+r;if(o>l.MAX_EXTERNAL_DATA_CHUNKS)throw new Error(`The number of external data chunks (${o}) exceeds the maximum allowed value (${l.MAX_EXTERNAL_DATA_CHUNKS}).`);for(let t=0;t{const a=await(0,l.getModelFile)(e,o,!0,s,k);t(a instanceof Uint8Array?{path:r,data:a}:r)})))}}else void 0!==x.externalData&&(T=x.externalData.map((async t=>{if("string"==typeof t.data){const r=await(0,l.getModelFile)(e,t.data,!0,s);return{...t,data:r}}return t})));if(T.length>0){const e=await Promise.all(T);g.apis.IS_NODE_ENV||(x.externalData=e)}if("webgpu"===c){const e=(0,r.getCacheShapes)(s.config,{prefix:"present"});if(Object.keys(e).length>0&&!(0,o.isONNXProxy)()){const t={};for(const s in e)t[s]="gpu-buffer";x.preferredOutputLocation=t}}return{buffer_or_path:await y,session_options:x,session_config:f}}(e,t[a],s);return[a,await(0,o.createInferenceSession)(i,c,d)]}))))}async function N(e,t,s){return Object.fromEntries(await Promise.all(Object.keys(t).map((async r=>[r,await(0,l.getModelJSON)(e,t[r],!1,s)]))))}async function V(e,t){const s=function(e,t){const s=Object.create(null),r=[];for(const n of e.inputNames){const e=t[n];e instanceof _.Tensor?s[n]=(0,o.isONNXProxy)()?e.clone():e:r.push(n)}if(r.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${r.join(", ")}.`);const n=Object.keys(t).length,a=e.inputNames.length;if(n>a){let s=Object.keys(t).filter((t=>!e.inputNames.includes(t)));console.warn(`WARNING: Too many inputs were provided (${n} > ${a}). The following inputs will be ignored: "${s.join(", ")}".`)}return s}(e,t);try{const t=Object.fromEntries(Object.entries(s).map((([e,t])=>[e,t.ort_tensor])));return B(await(0,o.runInferenceSession)(e,t))}catch(e){const t=Object.fromEntries(Object.entries(s).map((([e,t])=>{const s={type:t.type,dims:t.dims,location:t.location};return"gpu-buffer"!==s.location&&(s.data=t.data),[e,s]})));throw console.error(`An error occurred during model execution: "${e}".`),console.error("Inputs given to model:",t),e}}function B(e){for(let t in e)(0,o.isONNXTensor)(e[t])?e[t]=new _.Tensor(e[t]):"object"==typeof e[t]&&B(e[t]);return e}function G(e){if(e instanceof _.Tensor)return e;if(0===e.length)throw Error("items must be non-empty");if(Array.isArray(e[0])){if(e.some((t=>t.length!==e[0].length)))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new _.Tensor("int64",BigInt64Array.from(e.flat().map((e=>BigInt(e)))),[e.length,e[0].length])}return new _.Tensor("int64",BigInt64Array.from(e.map((e=>BigInt(e)))),[1,e.length])}function $(e){return new _.Tensor("bool",[e],[1])}async function R(e,t){let{encoder_outputs:s,input_ids:r,decoder_input_ids:o,...n}=t;if(!s){const r=(0,i.pick)(t,e.sessions.model.inputNames);s=(await q(e,r)).last_hidden_state}n.input_ids=o,n.encoder_hidden_states=s,e.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(n.encoder_attention_mask=t.attention_mask);return await U(e,n,!0)}async function q(e,t){const s=e.sessions.model,r=(0,i.pick)(t,s.inputNames);if(s.inputNames.includes("inputs_embeds")&&!r.inputs_embeds){if(!t.input_ids)throw new Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");r.inputs_embeds=await e.encode_text({input_ids:t.input_ids})}if(s.inputNames.includes("token_type_ids")&&!r.token_type_ids){if(!r.input_ids)throw new Error("Both `input_ids` and `token_type_ids` are missing in the model inputs.");r.token_type_ids=(0,_.zeros_like)(r.input_ids)}if(s.inputNames.includes("pixel_mask")&&!r.pixel_mask){if(!r.pixel_values)throw new Error("Both `pixel_values` and `pixel_mask` are missing in the model inputs.");const e=r.pixel_values.dims;r.pixel_mask=(0,_.ones)([e[0],e[2],e[3]])}return await V(s,r)}async function W(e,t){const s=await e.encode(t);return await e.decode(s)}async function U(e,t,s=!1){const r=e.sessions[s?"decoder_model_merged":"model"],{past_key_values:o,...n}=t;if(r.inputNames.includes("use_cache_branch")&&(n.use_cache_branch=$(!!o)),r.inputNames.includes("position_ids")&&n.attention_mask&&!n.position_ids){const t=["paligemma","gemma3_text","gemma3"].includes(e.config.model_type)?1:0;n.position_ids=function(e,t=null,s=0){const{input_ids:r,inputs_embeds:o,attention_mask:n}=e,{data:a,dims:i}=Z(n,s);let l=new _.Tensor("int64",a,i);if(t){const e=-(r??o).dims.at(1);l=l.slice(null,[e,null])}return l}(n,o,t)}e.addPastKeyValues(n,o);const a=(0,i.pick)(n,r.inputNames);return await V(r,a)}function Q({modality_token_id:e,inputs_embeds:t,modality_features:s,input_ids:r,attention_mask:o}){const n=r.tolist().map((t=>t.reduce(((t,s,r)=>(s==e&&t.push(r),t)),[]))),a=n.reduce(((e,t)=>e+t.length),0),i=s.dims[0];if(a!==i)throw new Error(`Number of tokens and features do not match: tokens: ${a}, features ${i}`);let l=0;for(let e=0;ee.dims[1]||o[e.at(-1)]))),{...s,decoder_input_ids:G(t)}}function se(e,...t){return e.config.is_encoder_decoder?te(e,...t):ee(e,...t)}function re(e,t,s,r){const o=!!s.past_key_values;if(null!==r.guidance_scale&&r.guidance_scale>1&&(o?s.input_ids=(0,_.cat)([s.input_ids,s.input_ids],0):(s.input_ids=(0,_.cat)([s.input_ids,(0,_.full_like)(s.input_ids,BigInt(r.pad_token_id))],0),s.attention_mask=(0,_.cat)([s.attention_mask,(0,_.full_like)(s.attention_mask,0n)],0))),!o&&s.pixel_values||(s.pixel_values=(0,_.full)([0,0,3,384,384],1)),o){const e=0,t=1,r=e>0?1:0,o=1;s.images_seq_mask=new _.Tensor("bool",new Array(e+t).fill(!0).fill(!1,0,t),[o,e+t]),s.images_emb_mask=new _.Tensor("bool",new Array(e).fill(!!r),[o,1,e])}return s}class oe extends a.Callable{main_input_name="input_ids";forward_params=["input_ids","attention_mask"];constructor(e,t,s){super(),this.config=e,this.sessions=t,this.configs=s;const r=D.get(this.constructor),o=z.get(r);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,o){case v:this.can_generate=!0,this._forward=U,this._prepare_inputs_for_generation=ee;break;case k:case y:case F:this.can_generate=!0,this._forward=R,this._prepare_inputs_for_generation=te;break;case b:this._forward=R;break;case P:this.can_generate=!0,this._forward=K,this._prepare_inputs_for_generation=se;break;case A:this.can_generate=!0,this._forward=Y,this._prepare_inputs_for_generation=se;break;case S:case L:this.can_generate=!0,this._prepare_inputs_for_generation=se;break;case C:this.can_generate=!0,this._prepare_inputs_for_generation=re;break;case E:this._forward=W;break;default:this._forward=q}this.can_generate&&this.forward_params.push("past_key_values"),this.custom_config=this.config["transformers.js_config"]??{}}async dispose(){const e=[];for(const t of Object.values(this.sessions))t?.handler?.dispose&&e.push(t.handler.dispose());return await Promise.all(e)}static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:o=null,local_files_only:n=!1,revision:a="main",model_file_name:i=null,subfolder:l="onnx",device:d=null,dtype:u=null,use_external_data_format:_=null,session_options:p={}}={}){let m={progress_callback:t,config:s,cache_dir:o,local_files_only:n,revision:a,model_file_name:i,subfolder:l,device:d,dtype:u,use_external_data_format:_,session_options:p};const h=D.get(this),f=z.get(h);let g;if(s=m.config=await r.AutoConfig.from_pretrained(e,m),f===v)g=await Promise.all([O(e,{model:m.model_file_name??"model"},m),N(e,{generation_config:"generation_config.json"},m)]);else if(f===k||f===y)g=await Promise.all([O(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},m),N(e,{generation_config:"generation_config.json"},m)]);else if(f===T)g=await Promise.all([O(e,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},m)]);else if(f===b)g=await Promise.all([O(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},m)]);else if(f===P){const t={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};s.is_encoder_decoder&&(t.model="encoder_model"),g=await Promise.all([O(e,t,m),N(e,{generation_config:"generation_config.json"},m)])}else if(f===A){const t={embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",decoder_model_merged:"decoder_model_merged"};g=await Promise.all([O(e,t,m),N(e,{generation_config:"generation_config.json"},m)])}else if(f===L){const t={embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};g=await Promise.all([O(e,t,m),N(e,{generation_config:"generation_config.json"},m)])}else if(f===F)g=await Promise.all([O(e,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},m),N(e,{generation_config:"generation_config.json"},m)]);else if(f===C)g=await Promise.all([O(e,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"language_model",lm_head:"lm_head",gen_head:"gen_head",gen_img_embeds:"gen_img_embeds",image_decode:"image_decode"},m),N(e,{generation_config:"generation_config.json"},m)]);else if(f===S)g=await Promise.all([O(e,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"model",vision_encoder:"vision_encoder"},m),N(e,{generation_config:"generation_config.json"},m)]);else if(f===E)g=await Promise.all([O(e,{encoder_model:"encoder_model",decoder_model:"decoder_model"},m)]);else if(f===I)g=await Promise.all([O(e,{text_encoder:"text_encoder",latent_denoiser:"latent_denoiser",voice_decoder:"voice_decoder"},m)]);else{if(f!==x){const e=h??s?.model_type;"custom"!==e&&console.warn(`Model type for '${e}' not found, assuming encoder-only architecture. Please report this at ${c.GITHUB_ISSUE_URL}.`)}g=await Promise.all([O(e,{model:m.model_file_name??"model"},m)])}return new this(s,...g)}async _call(e){return await this.forward(e)}async forward(e){return await this._forward(this,e)}get generation_config(){return this.configs?.generation_config??null}_get_logits_processor(e,t,s=null){const r=new d.LogitsProcessorList;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&r.push(new d.RepetitionPenaltyLogitsProcessor(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&r.push(new d.NoRepeatNGramLogitsProcessor(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&r.push(new d.NoBadWordsLogitsProcessor(e.bad_words_ids,e.eos_token_id)),null!==e.min_length&&null!==e.eos_token_id&&e.min_length>0&&r.push(new d.MinLengthLogitsProcessor(e.min_length,e.eos_token_id)),null!==e.min_new_tokens&&null!==e.eos_token_id&&e.min_new_tokens>0&&r.push(new d.MinNewTokensLengthLogitsProcessor(t,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&r.push(new d.ForcedBOSTokenLogitsProcessor(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&r.push(new d.ForcedEOSTokenLogitsProcessor(e.max_length,e.forced_eos_token_id)),null!==e.begin_suppress_tokens){const s=t>1||null===e.forced_bos_token_id?t:t+1;r.push(new d.SuppressTokensAtBeginLogitsProcessor(e.begin_suppress_tokens,s))}return null!==e.guidance_scale&&e.guidance_scale>1&&r.push(new d.ClassifierFreeGuidanceLogitsProcessor(e.guidance_scale)),0===e.temperature&&e.do_sample&&(console.warn("`do_sample` changed to false because `temperature: 0` implies greedy sampling (always selecting the most likely token), which is incompatible with `do_sample: true`."),e.do_sample=!1),e.do_sample&&null!==e.temperature&&1!==e.temperature&&r.push(new d.TemperatureLogitsWarper(e.temperature)),null!==s&&r.extend(s),r}_prepare_generation_config(e,t,s=u.GenerationConfig){const r={...this.config};for(const e of["decoder","generator","text_config"])e in r&&Object.assign(r,r[e]);const o=new s(r);return Object.assign(o,this.generation_config??{}),e&&Object.assign(o,e),t&&Object.assign(o,(0,i.pick)(t,Object.getOwnPropertyNames(o))),o}_get_stopping_criteria(e,t=null){const s=new h.StoppingCriteriaList;return null!==e.max_length&&s.push(new h.MaxLengthCriteria(e.max_length,this.config.max_position_embeddings??null)),null!==e.eos_token_id&&s.push(new h.EosTokenCriteria(e.eos_token_id)),t&&s.extend(t),s}_validate_model_class(){if(!this.can_generate){const e=[Ld,Dd,Ed,Pd],t=D.get(this.constructor),s=new Set,r=this.config.model_type;for(const t of e){const e=t.get(r);e&&s.add(e[0])}let o=`The current model class (${t}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw s.size>0&&(o+=` Please use the following class instead: ${[...s].join(", ")}`),Error(o)}}prepare_inputs_for_generation(...e){return this._prepare_inputs_for_generation(this,...e)}_update_model_kwargs_for_generation({generated_input_ids:e,outputs:t,model_inputs:s,is_encoder_decoder:r}){return s.past_key_values=this.getPastKeyValues(t,s.past_key_values),s.input_ids=new _.Tensor("int64",e.flat(),[e.length,1]),r||(s.attention_mask=(0,_.cat)([s.attention_mask,(0,_.ones)([s.attention_mask.dims[0],1])],1)),s.position_ids=null,s}_prepare_model_inputs({inputs:e,bos_token_id:t,model_kwargs:s}){const r=(0,i.pick)(s,this.forward_params),o=this.main_input_name;if(o in r){if(e)throw new Error("`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. Make sure to either pass {inputs} or {input_name}=...")}else r[o]=e;return{inputs_tensor:r[o],model_inputs:r,model_input_name:o}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:e,model_inputs:t,model_input_name:s,generation_config:r}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!t.inputs_embeds&&"_prepare_inputs_embeds"in this){const{input_ids:e,pixel_values:s,attention_mask:r,...o}=t,n=await this._prepare_inputs_embeds(t);t={...o,...(0,i.pick)(n,["inputs_embeds","attention_mask"])}}let{last_hidden_state:o}=await q(this,t);if(null!==r.guidance_scale&&r.guidance_scale>1)o=(0,_.cat)([o,(0,_.full_like)(o,0)],0),"attention_mask"in t&&(t.attention_mask=(0,_.cat)([t.attention_mask,(0,_.zeros_like)(t.attention_mask)],0));else if(t.decoder_input_ids){const e=G(t.decoder_input_ids).dims[0];if(e!==o.dims[0]){if(1!==o.dims[0])throw new Error(`The encoder outputs have a different batch size (${o.dims[0]}) than the decoder inputs (${e}).`);o=(0,_.cat)(Array.from({length:e},(()=>o)),0)}}return t.encoder_outputs=o,t}_prepare_decoder_input_ids_for_generation({batch_size:e,model_input_name:t,model_kwargs:s,decoder_start_token_id:r,bos_token_id:o,generation_config:n}){let{decoder_input_ids:a,...i}=s;if(!(a instanceof _.Tensor)){if(a)Array.isArray(a[0])||(a=Array.from({length:e},(()=>a)));else if(r??=o,"musicgen"===this.config.model_type)a=Array.from({length:e*this.config.decoder.num_codebooks},(()=>[r]));else if(Array.isArray(r)){if(r.length!==e)throw new Error(`\`decoder_start_token_id\` expcted to have length ${e} but got ${r.length}`);a=r}else a=Array.from({length:e},(()=>[r]));a=G(a)}return s.decoder_attention_mask=(0,_.ones_like)(a),{input_ids:a,model_inputs:i}}async generate({inputs:e=null,generation_config:t=null,logits_processor:s=null,stopping_criteria:r=null,streamer:o=null,...n}){this._validate_model_class(),t=this._prepare_generation_config(t,n);let{inputs_tensor:a,model_inputs:i,model_input_name:l}=this._prepare_model_inputs({inputs:e,model_kwargs:n});const c=this.config.is_encoder_decoder;let d;c&&("encoder_outputs"in i||(i=await this._prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:a,model_inputs:i,model_input_name:l,generation_config:t}))),c?({input_ids:d,model_inputs:i}=this._prepare_decoder_input_ids_for_generation({batch_size:i[l].dims.at(0),model_input_name:l,model_kwargs:i,decoder_start_token_id:t.decoder_start_token_id,bos_token_id:t.bos_token_id,generation_config:t})):d=i[l];let u=d.dims.at(-1);null!==t.max_new_tokens&&(t.max_length=u+t.max_new_tokens);const p=this._get_logits_processor(t,u,s),m=this._get_stopping_criteria(t,r),h=i[l].dims.at(0),g=f.LogitsSampler.getSampler(t),w=new Array(h).fill(0),M=d.tolist();let x;o&&o.put(M);let b={};for(;;){if(i=this.prepare_inputs_for_generation(M,i,t),x=await this.forward(i),t.output_attentions&&t.return_dict_in_generate){const e=this.getAttentions(x);for(const t in e)t in b||(b[t]=[]),b[t].push(e[t])}const e=p(M,x.logits.slice(null,-1,null)),s=[];for(let t=0;te)))break;i=this._update_model_kwargs_for_generation({generated_input_ids:s,outputs:x,model_inputs:i,is_encoder_decoder:c})}o&&o.end();const k=this.getPastKeyValues(x,i.past_key_values,!0),y=new _.Tensor("int64",M.flat(),[M.length,M[0].length]);if(t.return_dict_in_generate)return{sequences:y,past_key_values:k,...b};for(const e of Object.values(x))"gpu-buffer"===e.location&&e.dispose();return y}getPastKeyValues(e,t,s=!1){const r=Object.create(null);for(const o in e)if(o.startsWith("present")){const n=o.replace("present_conv","past_conv").replace("present","past_key_values"),a=o.includes("encoder");if(r[n]=a&&t?t[n]:e[o],t&&(!a||s)){const e=t[n];"gpu-buffer"===e.location&&e.dispose()}}return r}getAttentions(e){const t={};for(const s of["cross_attentions","encoder_attentions","decoder_attentions"])for(const r in e)r.startsWith(s)&&(s in t||(t[s]=[]),t[s].push(e[r]));return t}addPastKeyValues(e,t){if(t)Object.assign(e,t);else{const t=this.sessions.decoder_model_merged??this.sessions.model,s=(e[this.main_input_name]??e.attention_mask)?.dims?.[0]??1,o=t?.config?.kv_cache_dtype??"float32",n="float16"===o?_.DataTypeMap.float16:_.DataTypeMap.float32,a=(0,r.getCacheShapes)(this.config,{batch_size:s});for(const t in a){const s=a[t].reduce(((e,t)=>e*t),1);e[t]=new _.Tensor(o,new n(s),a[t])}}}async encode_image({pixel_values:e}){return(await V(this.sessions.vision_encoder,{pixel_values:e})).image_features}async encode_text({input_ids:e}){return(await V(this.sessions.embed_tokens,{input_ids:e})).inputs_embeds}async encode_audio({audio_values:e}){return(await V(this.sessions.audio_encoder,{audio_values:e})).audio_features}}class ne{}class ae extends ne{constructor({last_hidden_state:e,hidden_states:t=null,attentions:s=null}){super(),this.last_hidden_state=e,this.hidden_states=t,this.attentions=s}}class ie extends oe{}class le extends ie{}class ce extends ie{async _call(e){return new $u(await super._call(e))}}class de extends ie{async _call(e){return new Vu(await super._call(e))}}class ue extends ie{async _call(e){return new Gu(await super._call(e))}}class _e extends ie{async _call(e){return new Ru(await super._call(e))}}class pe extends oe{}class me extends pe{}class he extends pe{async _call(e){return new $u(await super._call(e))}}class fe extends pe{async _call(e){return new Vu(await super._call(e))}}class ge extends pe{async _call(e){return new Gu(await super._call(e))}}class we extends pe{async _call(e){return new Ru(await super._call(e))}}class Me extends oe{}class xe extends Me{}class be extends Me{async _call(e){return new $u(await super._call(e))}}class ke extends Me{async _call(e){return new Vu(await super._call(e))}}class ye extends Me{async _call(e){return new Gu(await super._call(e))}}class ve extends oe{}class Te extends ve{}class Pe extends ve{}class Fe extends oe{}class Ce extends Fe{}class Se extends oe{}class Ae extends Se{}class Ee extends Se{async _call(e){return new $u(await super._call(e))}}class Le extends Se{async _call(e){return new Vu(await super._call(e))}}class Ie extends Se{async _call(e){return new Gu(await super._call(e))}}class ze extends Se{async _call(e){return new Ru(await super._call(e))}}class je extends oe{}class De extends je{}class Oe extends je{async _call(e){return new $u(await super._call(e))}}class Ne extends je{async _call(e){return new Vu(await super._call(e))}}class Ve extends je{async _call(e){return new Gu(await super._call(e))}}class Be extends je{async _call(e){return new Ru(await super._call(e))}}class Ge extends oe{}class $e extends Ge{}class Re extends Ge{async _call(e){return new $u(await super._call(e))}}class qe extends Ge{async _call(e){return new Vu(await super._call(e))}}class We extends Ge{async _call(e){return new Gu(await super._call(e))}}class Ue extends Ge{async _call(e){return new Ru(await super._call(e))}}class Qe extends oe{}class Xe extends Qe{}class He extends Qe{async _call(e){return new $u(await super._call(e))}}class Je extends Qe{async _call(e){return new Vu(await super._call(e))}}class Ye extends Qe{async _call(e){return new Gu(await super._call(e))}}class Ke extends Qe{async _call(e){return new Ru(await super._call(e))}}class Ze extends oe{}class et extends Ze{}class tt extends Ze{async _call(e){return new $u(await super._call(e))}}class st extends Ze{async _call(e){return new Vu(await super._call(e))}}class rt extends Ze{async _call(e){return new Gu(await super._call(e))}}class ot extends Ze{async _call(e){return new Ru(await super._call(e))}}class nt extends oe{}class at extends nt{}class it extends nt{async _call(e){return new $u(await super._call(e))}}class lt extends nt{async _call(e){return new Vu(await super._call(e))}}class ct extends nt{async _call(e){return new Gu(await super._call(e))}}class dt extends nt{async _call(e){return new Ru(await super._call(e))}}class ut extends oe{}class _t extends ut{}class pt extends ut{async _call(e){return new Vu(await super._call(e))}}class mt extends ut{async _call(e){return new Gu(await super._call(e))}}class ht extends ut{async _call(e){return new Ru(await super._call(e))}}class ft extends ut{async _call(e){return new $u(await super._call(e))}}class gt extends oe{}class wt extends gt{}class Mt extends gt{async _call(e){return new $u(await super._call(e))}}class xt extends gt{async _call(e){return new Vu(await super._call(e))}}class bt extends gt{async _call(e){return new Gu(await super._call(e))}}class kt extends oe{}class yt extends kt{}class vt extends kt{async _call(e){return new $u(await super._call(e))}}class Tt extends kt{async _call(e){return new Vu(await super._call(e))}}class Pt extends kt{async _call(e){return new Ru(await super._call(e))}}class Ft extends oe{}class Ct extends Ft{}class St extends Ft{async _call(e){return new $u(await super._call(e))}}class At extends Ft{async _call(e){return new Vu(await super._call(e))}}class Et extends Ft{async _call(e){return new Gu(await super._call(e))}}class Lt extends Ft{async _call(e){return new Ru(await super._call(e))}}class It extends oe{}class zt extends It{}class jt extends It{async _call(e){return new $u(await super._call(e))}}class Dt extends It{async _call(e){return new Vu(await super._call(e))}}class Ot extends It{async _call(e){return new Ru(await super._call(e))}}class Nt extends oe{}class Vt extends Nt{}class Bt extends Nt{async _call(e){return new Vu(await super._call(e))}}class Gt extends Nt{async _call(e){return new Ru(await super._call(e))}}class $t extends Nt{async _call(e){return new $u(await super._call(e))}}class Rt extends oe{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"]}class qt extends Rt{}class Wt extends Rt{}class Ut extends oe{}class Qt extends Ut{}class Xt extends Ut{}class Ht extends oe{}class Jt extends Ht{}class Yt extends Ht{}class Kt extends oe{}class Zt extends Kt{}class es extends Kt{}class ts extends Kt{async _call(e){return new Vu(await super._call(e))}}class ss extends oe{}class rs extends ss{}class os extends ss{}class ns extends ss{async _call(e){return new Vu(await super._call(e))}}class as extends ss{}class is extends oe{}class ls extends is{}class cs extends is{}class ds extends oe{}class us extends ds{}class _s extends ds{}class ps extends oe{}class ms extends ps{}class hs extends ps{async _call(e){return new $u(await super._call(e))}}class fs extends ps{async _call(e){return new Vu(await super._call(e))}}class gs extends ps{async _call(e){return new Gu(await super._call(e))}}class ws extends ps{async _call(e){return new Ru(await super._call(e))}}class Ms extends oe{}class xs extends Ms{}class bs extends Ms{async _call(e){return new $u(await super._call(e))}}class ks extends Ms{async _call(e){return new Vu(await super._call(e))}}class ys extends Ms{async _call(e){return new Gu(await super._call(e))}}class vs extends Ms{async _call(e){return new Ru(await super._call(e))}}class Ts extends oe{}class Ps extends Ts{}class Fs extends Ts{async _call(e){return new $u(await super._call(e))}}class Cs extends Ts{async _call(e){return new Vu(await super._call(e))}}class Ss extends Ts{async _call(e){return new Gu(await super._call(e))}}class As extends Ts{async _call(e){return new Ru(await super._call(e))}}class Es extends oe{}class Ls extends Es{}class Is extends Es{}class zs extends oe{requires_attention_mask=!1;main_input_name="input_features";forward_params=["input_features","attention_mask","decoder_input_ids","decoder_attention_mask","past_key_values"]}class js extends zs{}class Ds extends zs{_prepare_generation_config(e,t){return super._prepare_generation_config(e,t,w.WhisperGenerationConfig)}_retrieve_init_tokens(e){const t=[e.decoder_start_token_id];let s=e.language;const r=e.task;if(e.is_multilingual){s||(console.warn("No language specified - defaulting to English (en)."),s="en");const o=`<|${(0,M.whisper_language_to_code)(s)}|>`;t.push(e.lang_to_id[o]),t.push(e.task_to_id[r??"transcribe"])}else if(s||r)throw new Error("Cannot specify `task` or `language` for an English-only model. If the model is intended to be multilingual, pass `is_multilingual=true` to generate, or update the generation config.");return!e.return_timestamps&&e.no_timestamps_token_id&&t.at(-1)!==e.no_timestamps_token_id?t.push(e.no_timestamps_token_id):e.return_timestamps&&t.at(-1)===e.no_timestamps_token_id&&(console.warn("<|notimestamps|> prompt token is removed from generation_config since `return_timestamps` is set to `true`."),t.pop()),t.filter((e=>null!=e))}async generate({inputs:e=null,generation_config:t=null,logits_processor:s=null,stopping_criteria:r=null,...o}){t=this._prepare_generation_config(t,o);const n=o.decoder_input_ids??this._retrieve_init_tokens(t);if(t.return_timestamps&&(s??=new d.LogitsProcessorList,s.push(new d.WhisperTimeStampLogitsProcessor(t,n))),t.begin_suppress_tokens&&(s??=new d.LogitsProcessorList,s.push(new d.SuppressTokensAtBeginLogitsProcessor(t.begin_suppress_tokens,n.length))),t.return_token_timestamps){if(!t.alignment_heads)throw new Error("Model generation config has no `alignment_heads`, token-level timestamps not available. See https://gist.github.com/hollance/42e32852f24243b748ae6bc1f985b13a on how to add this property to the generation config.");"translate"===t.task&&console.warn("Token-level timestamps may not be reliable for task 'translate'."),t.output_attentions=!0,t.return_dict_in_generate=!0}const a=await super.generate({inputs:e,generation_config:t,logits_processor:s,decoder_input_ids:n,...o});return t.return_token_timestamps&&(a.token_timestamps=this._extract_token_timestamps(a,t.alignment_heads,t.num_frames)),a}_extract_token_timestamps(e,t,s=null,r=.02){if(!e.cross_attentions)throw new Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");null==s&&console.warn("`num_frames` has not been set, meaning the entire audio will be analyzed. This may lead to inaccurate token-level timestamps for short audios (< 30 seconds).");let o=this.config.median_filter_width;void 0===o&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),o=7);const n=e.cross_attentions,a=Array.from({length:this.config.decoder_layers},((e,t)=>(0,_.cat)(n.map((e=>e[t])),2))),l=(0,_.stack)(t.map((([e,t])=>{if(e>=a.length)throw new Error(`Layer index ${e} is out of bounds for cross attentions (length ${a.length}).`);return s?a[e].slice(null,t,null,[0,s]):a[e].slice(null,t)}))).transpose(1,0,2,3),[c,d]=(0,_.std_mean)(l,-2,0,!0),u=l.clone();for(let e=0;es[t+1]-s[t])),a=(0,i.mergeArrays)([1],n).map((e=>!!e)),l=[];for(let e=0;eArray.from({length:e.dims[0]},(t=>Array.from({length:e.dims[1]},(e=>1)))))),p=t?t.tolist():[],h=s?s.tolist():[];let f=0,g=0;for(let e=0;e1==d[e][s])),s=t.reduce(((e,t,s)=>(t==i&&e.push(s),e)),[]).map((e=>t[e+1])),r=s.filter((e=>e==n)).length,_=s.filter((e=>e==a)).length;let w=[],M=0,x=r,b=_;for(let e=0;et>M&&e==n)),s=t.findIndex(((e,t)=>t>M&&e==a)),r=x>0&&-1!==e?e:t.length+1,o=b>0&&-1!==s?s:t.length+1;let i,c,d,u;r0?(0,m.max)(w.at(-1))[0]+1:0;w.push(Array.from({length:3*v},((e,t)=>T+t%v)));const P=v+T,F=_*k*y,C=Array.from({length:F},((e,t)=>P+Math.floor(t/(k*y)))),S=Array.from({length:F},((e,t)=>P+Math.floor(t/y)%k)),A=Array.from({length:F},((e,t)=>P+t%y));w.push([C,S,A].flat()),M=i+F}if(M0?(0,m.max)(w.at(-1))[0]+1:0,s=t.length-M;w.push(Array.from({length:3*s},((t,r)=>e+r%s)))}const k=w.reduce(((e,t)=>e+t.length),0),y=new Array(k);let v=0;for(let e=0;e<3;++e)for(let t=0;te[s%e.length])),o=Array.from({length:t[0]},((s,r)=>(0,m.max)(e.subarray(t[1]*r,t[1]*(r+1)))[0]+1n+BigInt(t[1])));return[new _.Tensor("int64",s,[3,...t]),new _.Tensor("int64",o,[o.length,1])]}{const[t,s]=e.dims,r=BigInt64Array.from({length:3*t*s},((e,r)=>BigInt(Math.floor(r%s/t))));return[new _.Tensor("int64",r,[3,...e.dims]),(0,_.zeros)([t,1])]}}async encode_image({pixel_values:e,image_grid_thw:t}){return(await V(this.sessions.vision_encoder,{pixel_values:e,grid_thw:t})).image_features}_merge_input_ids_with_image_features(e){return X({image_token_id:this.config.image_token_id,...e})}prepare_inputs_for_generation(e,t,s){if(t.attention_mask&&!t.position_ids)if(t.past_key_values){t.pixel_values=null;const e=BigInt(Object.values(t.past_key_values)[0].dims.at(-2)),s=t.rope_deltas.map((t=>e+t));t.position_ids=(0,_.stack)([s,s,s],0)}else[t.position_ids,t.rope_deltas]=this.get_rope_index(t.input_ids,t.image_grid_thw,t.video_grid_thw,t.attention_mask);return t}}class nn extends oe{}class an extends nn{}class ln extends nn{}class cn extends oe{}class dn extends cn{}class un extends cn{}class _n extends oe{}class pn extends _n{}class mn extends _n{}class hn extends oe{}class fn extends hn{}class gn extends hn{}class wn extends oe{}class Mn extends wn{}class xn extends wn{}class bn extends oe{}class kn extends bn{}class yn extends bn{async _call(e){return new Vu(await super._call(e))}}class vn extends oe{}class Tn extends vn{}class Pn extends vn{async _call(e){return new Vu(await super._call(e))}}class Fn extends oe{}class Cn extends Fn{}class Sn extends oe{}class An extends Sn{}class En extends Sn{async _call(e){return new Vu(await super._call(e))}}class Ln extends oe{}class In extends Ln{}class zn extends oe{}class jn extends zn{}class Dn extends zn{async _call(e){return new Vu(await super._call(e))}}class On extends oe{}class Nn extends On{}class Vn extends oe{}class Bn extends Vn{}class Gn extends Vn{async _call(e){return new Vu(await super._call(e))}}class $n extends oe{}class Rn extends $n{async _call(e){return new Uu(await super._call(e))}}class qn extends oe{}class Wn extends qn{}class Un extends qn{async _call(e){return new Vu(await super._call(e))}}class Qn extends oe{}class Xn extends Qn{}class Hn extends Qn{async _call(e){return new Vu(await super._call(e))}}class Jn extends oe{}class Yn extends Jn{}class Kn extends Jn{}class Zn extends oe{}class ea extends Zn{}class ta extends Zn{}class sa extends oe{}class ra extends sa{}class oa extends sa{async _call(e){return new Vu(await super._call(e))}}class na extends oe{}class aa extends na{}class ia extends na{async _call(e){return new ca(await super._call(e))}}class la extends na{async _call(e){return new da(await super._call(e))}}class ca extends ne{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class da extends ne{constructor({logits:e,pred_boxes:t,pred_masks:s}){super(),this.logits=e,this.pred_boxes=t,this.pred_masks=s}}class ua extends oe{}class _a extends ua{}class pa extends ua{async _call(e){return new ma(await super._call(e))}}class ma extends ne{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class ha extends oe{}class fa extends ha{}class ga extends ha{async _call(e){return new wa(await super._call(e))}}class wa extends ma{}class Ma extends oe{}class xa extends Ma{}class ba extends Ma{async _call(e){return new ka(await super._call(e))}}class ka extends ma{}class ya extends oe{}class va extends ya{}class Ta extends ya{async _call(e){return new ma(await super._call(e))}}class Pa extends oe{}class Fa extends Pa{}class Ca extends Pa{async _call(e){return new Sa(await super._call(e))}}class Sa extends ca{}class Aa extends oe{}class Ea extends Aa{}class La extends Aa{async _call(e){return new Vu(await super._call(e))}}class Ia extends oe{}class za extends Ia{}class ja extends Ia{async _call(e){return new Vu(await super._call(e))}}class Da extends oe{}class Oa extends Da{}class Na extends Da{async _call(e){return new Vu(await super._call(e))}}class Va extends oe{}class Ba extends Va{}class Ga extends Va{async _call(e){return new Vu(await super._call(e))}}class $a extends Va{}class Ra extends oe{}class qa extends Ra{}class Wa extends Ra{}class Ua extends oe{}class Qa extends Ua{}class Xa extends Ua{}class Ha extends oe{}class Ja extends Ha{}class Ya extends oe{}class Ka extends Ya{}class Za extends Ya{}class ei extends Ya{}class ti extends oe{}class si extends ti{}class ri extends oe{}class oi extends ri{}class ni extends oe{}class ai extends ni{}class ii extends oe{}class li extends ii{}class ci extends ii{}class di extends oe{}class ui extends di{}class _i extends di{}class pi extends oe{}class mi extends pi{}class hi extends oe{}class fi extends hi{}class gi extends hi{async _call(e){return new Vu(await super._call(e))}}class wi extends oe{}class Mi extends wi{}class xi extends wi{async _call(e){return new Vu(await super._call(e))}}class bi extends oe{}class ki extends bi{}class yi extends bi{async _call(e){return new Vu(await super._call(e))}}class vi extends oe{}class Ti extends vi{}class Pi extends vi{async _call(e){return new Vu(await super._call(e))}}class Fi extends oe{}class Ci extends Fi{}class Si extends oe{}class Ai extends Si{}class Ei extends oe{}class Li extends Ei{}class Ii extends oe{}class zi extends Ii{}class ji extends Ii{async _call(e){return new Di(await super._call(e))}}class Di extends ne{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class Oi extends oe{}class Ni extends Oi{async get_image_embeddings({pixel_values:e}){return await q(this,{pixel_values:e})}async forward(e){e=e.image_embeddings&&e.image_positional_embeddings?{...e}:{...e,...await this.get_image_embeddings(e)},e.input_labels??=(0,_.ones)(e.input_points.dims.slice(0,-1));const t={image_embeddings:e.image_embeddings,image_positional_embeddings:e.image_positional_embeddings};return e.input_points&&(t.input_points=e.input_points),e.input_labels&&(t.input_labels=e.input_labels),e.input_boxes&&(t.input_boxes=e.input_boxes),await V(this.sessions.prompt_encoder_mask_decoder,t)}async _call(e){return new Vi(await super._call(e))}}class Vi extends ne{constructor({iou_scores:e,pred_masks:t}){super(),this.iou_scores=e,this.pred_masks=t}}class Bi extends ne{constructor({iou_scores:e,pred_masks:t,object_score_logits:s}){super(),this.iou_scores=e,this.pred_masks=t,this.object_score_logits=s}}class Gi extends oe{}class $i extends Gi{async get_image_embeddings({pixel_values:e}){return await q(this,{pixel_values:e})}async forward(e){const{num_feature_levels:t}=this.config.vision_config,s=Array.from({length:t},((e,t)=>`image_embeddings.${t}`));if((e=s.some((t=>!e[t]))?{...e,...await this.get_image_embeddings(e)}:{...e}).input_points){if(e.input_boxes&&1!==e.input_boxes.dims[1])throw new Error("When both `input_points` and `input_boxes` are provided, the number of boxes per image must be 1.");const t=e.input_points.dims;e.input_labels??=(0,_.ones)(t.slice(0,-1)),e.input_boxes??=(0,_.full)([t[0],0,4],0)}else{if(!e.input_boxes)throw new Error("At least one of `input_points` or `input_boxes` must be provided.");{const t=e.input_boxes.dims;e.input_labels=(0,_.full)([t[0],t[1],0],-1n),e.input_points=(0,_.full)([t[0],1,0,2],0)}}const r=this.sessions.prompt_encoder_mask_decoder,o=(0,i.pick)(e,r.inputNames);return await V(r,o)}async _call(e){return new Bi(await super._call(e))}}class Ri extends $i{}class qi extends $i{}class Wi extends oe{}class Ui extends Wi{}class Qi extends Wi{}class Xi extends oe{}class Hi extends Xi{}class Ji extends Xi{}class Yi extends oe{}class Ki extends Yi{}class Zi extends Yi{async _call(e){return new qu(await super._call(e))}}class el extends Yi{async _call(e){return new Vu(await super._call(e))}}class tl extends Yi{async _call(e){return new Gu(await super._call(e))}}class sl extends oe{}class rl extends sl{async _call(e){return new qu(await super._call(e))}}class ol extends oe{}class nl extends ol{}class al extends ol{async _call(e){return new Gu(await super._call(e))}}class il extends oe{}class ll extends il{}class cl extends oe{}class dl extends cl{}class ul extends cl{async _call(e){return new qu(await super._call(e))}}class _l extends cl{async _call(e){return new Vu(await super._call(e))}}class pl extends oe{}class ml extends pl{}class hl extends pl{async _call(e){return new qu(await super._call(e))}}class fl extends pl{async _call(e){return new Vu(await super._call(e))}}class gl extends pl{async _call(e){return new Gu(await super._call(e))}}class wl extends oe{}class Ml extends wl{}class xl extends wl{async _call(e){return new qu(await super._call(e))}}class bl extends wl{async _call(e){return new Vu(await super._call(e))}}class kl extends oe{}class yl extends Yi{}class vl extends Yi{async _call(e){return new qu(await super._call(e))}}class Tl extends Yi{async _call(e){return new Vu(await super._call(e))}}class Pl extends oe{}class Fl extends Pl{}class Cl extends Pl{async _call(e){return new qu(await super._call(e))}}class Sl extends Pl{async _call(e){return new Vu(await super._call(e))}}class Al extends Pl{async _call(e){return new Bu(await super._call(e))}}class El extends Pl{async _call(e){return new Gu(await super._call(e))}}class Ll extends oe{}class Il extends Ll{}class zl extends oe{}class jl extends zl{}class Dl extends zl{}class Ol extends zl{async generate_speech(e,t,{threshold:s=.5,minlenratio:r=0,maxlenratio:o=20,vocoder:n=null}={}){const a={input_ids:e},{encoder_outputs:i,encoder_attention_mask:l}=await q(this,a),c=i.dims[1]/this.config.reduction_factor,d=Math.floor(c*o),u=Math.floor(c*r),p=this.config.num_mel_bins;let m=[],h=null,f=null,g=0;for(;;){++g;const e=$(!!f);let r;r=f?f.output_sequence_out:new _.Tensor("float32",new Float32Array(p),[1,1,p]);let o={use_cache_branch:e,output_sequence:r,encoder_attention_mask:l,speaker_embeddings:t,encoder_hidden_states:i};this.addPastKeyValues(o,h),f=await V(this.sessions.decoder_model_merged,o),h=this.getPastKeyValues(f,h);const{prob:n,spectrum:a}=f;if(m.push(a),g>=u&&(Array.from(n.data).filter((e=>e>=s)).length>0||g>=d))break}const w=(0,_.cat)(m),{waveform:M}=await V(n.sessions.model,{spectrogram:w});return{spectrogram:w,waveform:M}}}class Nl extends oe{main_input_name="spectrogram"}class Vl extends oe{}class Bl extends Vl{async generate_speech({input_ids:e,attention_mask:t,style:s,num_inference_steps:r=5,speed:o=1.05}){const{sampling_rate:n,chunk_compress_factor:a,base_chunk_size:i,latent_dim:l}=this.config,{last_hidden_state:c,durations:d}=await V(this.sessions.text_encoder,{input_ids:e,attention_mask:t,style:s});d.div_(o);const u=d.max().item()*n,p=i*a,m=Math.floor((u+p-1)/p),h=e.dims[0],f=(0,_.ones)([h,m]),g=(0,_.full)([h],r);let w=(0,_.randn)([h,l*a,m]);for(let e=0;e0&&a<=o&&(e.data[n++]=e.data[t])}const a=Math.floor(t/r),i=n/(a*r);return new _.Tensor(e.type,e.data.slice(0,n),[a,r,i])}prepare_inputs_for_generation(e,t,s){let r=structuredClone(e);for(let e=0;e=t&&(r[e][t]=BigInt(this.config.decoder.pad_token_id));null!==s.guidance_scale&&s.guidance_scale>1&&(r=r.concat(r));return super.prepare_inputs_for_generation(r,t,s)}async generate(e){const t=await super.generate(e),s=this._apply_and_filter_by_delay_pattern_mask(t).unsqueeze_(0),{audio_values:r}=await V(this.sessions.encodec_decode,{audio_codes:s});return r}}class Fc extends oe{}class Cc extends Fc{}class Sc extends Fc{async _call(e){return new Vu(await super._call(e))}}class Ac extends Fc{}class Ec extends oe{}class Lc extends Ec{}class Ic extends Ec{async _call(e){return new Vu(await super._call(e))}}class zc extends Ec{}class jc extends oe{}class Dc extends jc{}class Oc extends jc{async _call(e){return new Vu(await super._call(e))}}class Nc extends jc{}class Vc extends oe{}class Bc extends Vc{}class Gc extends Vc{async _call(e){return new Vu(await super._call(e))}}class $c extends Vc{}class Rc extends oe{}class qc extends Rc{}class Wc extends oe{}class Uc extends Wc{forward_params=["input_ids","pixel_values","images_seq_mask","images_emb_mask","attention_mask","position_ids","past_key_values"];constructor(...e){super(...e),this._generation_mode="text"}async forward(e){const t=this._generation_mode??"text";let s;if("text"!==t&&e.past_key_values){const t=this.sessions.gen_img_embeds,r=(0,i.pick)({image_ids:e.input_ids},t.inputNames);s=await V(t,r)}else{const t=this.sessions.prepare_inputs_embeds,r=(0,i.pick)(e,t.inputNames);s=await V(t,r)}const r={...e,...s},o=await U(this,r),n=this.sessions["text"===t?"lm_head":"gen_head"];if(!n)throw new Error(`Unable to find "${n}" generation head`);const a=await V(n,(0,i.pick)(o,n.inputNames));return{...s,...o,...a}}async generate(e){return this._generation_mode="text",super.generate(e)}async generate_images(e){this._generation_mode="image";const t=(e.inputs??e[this.main_input_name]).dims[1],s=(await super.generate(e)).slice(null,[t,null]),r=this.sessions.image_decode,{decoded_image:o}=await V(r,{generated_tokens:s}),n=o.add_(1).mul_(127.5).clamp_(0,255).to("uint8"),a=[];for(const e of n){const t=p.RawImage.fromTensor(e);a.push(t)}return a}}class Qc extends ne{constructor({char_logits:e,bpe_logits:t,wp_logits:s}){super(),this.char_logits=e,this.bpe_logits=t,this.wp_logits=s}get logits(){return[this.char_logits,this.bpe_logits,this.wp_logits]}}class Xc extends oe{}class Hc extends Xc{async _call(e){return new Qc(await super._call(e))}}class Jc extends oe{}class Yc extends Jc{}class Kc extends Jc{}class Zc extends oe{}class ed extends Zc{}class td extends Zc{}class sd extends oe{forward_params=["input_ids","attention_mask","position_ids","audio_values","past_key_values"]}class rd extends sd{_merge_input_ids_with_audio_features(e){const t=e.audio_features.dims.at(-1),s=e.audio_features.view(-1,t);return H({audio_token_id:this.config.ignore_index??this.config.audio_token_id,...e,audio_features:s})}}class od extends rd{}class nd extends oe{main_input_name="input_values";forward_params=["input_values"]}class ad extends ne{constructor({audio_codes:e}){super(),this.audio_codes=e}}class id extends ne{constructor({audio_values:e}){super(),this.audio_values=e}}class ld extends nd{async encode(e){return new ad(await V(this.sessions.encoder_model,e))}async decode(e){return new id(await V(this.sessions.decoder_model,e))}}class cd extends nd{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class dd extends nd{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class ud extends oe{main_input_name="input_values";forward_params=["input_values"]}class _d extends ne{constructor({audio_codes:e}){super(),this.audio_codes=e}}class pd extends ne{constructor({audio_values:e}){super(),this.audio_values=e}}class md extends ud{async encode(e){return new _d(await V(this.sessions.encoder_model,e))}async decode(e){return new pd(await V(this.sessions.decoder_model,e))}}class hd extends ud{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class fd extends ud{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class gd extends oe{main_input_name="input_values";forward_params=["input_values"]}class wd extends gd{async encode(e){return await V(this.sessions.encoder_model,e)}async decode(e){return await V(this.sessions.decoder_model,e)}}class Md extends gd{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class xd extends gd{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class bd{static MODEL_CLASS_MAPPINGS=null;static BASE_IF_FAIL=!1;static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:o=null,local_files_only:n=!1,revision:a="main",model_file_name:i=null,subfolder:l="onnx",device:c=null,dtype:d=null,use_external_data_format:u=null,session_options:_={}}={}){const p={progress_callback:t,config:s,cache_dir:o,local_files_only:n,revision:a,model_file_name:i,subfolder:l,device:c,dtype:d,use_external_data_format:u,session_options:_};if(p.config=await r.AutoConfig.from_pretrained(e,p),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);const m=p.config.model_type;for(const t of this.MODEL_CLASS_MAPPINGS){let s=t.get(m);if(!s){for(const e of t.values())if(e[0]===m){s=e;break}if(!s)continue}return await s[1].from_pretrained(e,p)}if(this.BASE_IF_FAIL)return au.has(m)||console.warn(`Unknown model class "${m}", attempting to construct from base class.`),await oe.from_pretrained(e,p);throw Error(`Unsupported model type: ${m}`)}}const kd=new Map([["bert",["BertModel",le]],["neobert",["NeoBertModel",me]],["modernbert",["ModernBertModel",xe]],["nomic_bert",["NomicBertModel",Ce]],["roformer",["RoFormerModel",Ae]],["electra",["ElectraModel",$e]],["esm",["EsmModel",wt]],["convbert",["ConvBertModel",De]],["camembert",["CamembertModel",Xe]],["deberta",["DebertaModel",et]],["deberta-v2",["DebertaV2Model",at]],["mpnet",["MPNetModel",Ct]],["albert",["AlbertModel",Vt]],["distilbert",["DistilBertModel",_t]],["roberta",["RobertaModel",ms]],["xlm",["XLMModel",xs]],["xlm-roberta",["XLMRobertaModel",Ps]],["clap",["ClapModel",lc]],["clip",["CLIPModel",ar]],["clipseg",["CLIPSegModel",kr]],["chinese_clip",["ChineseCLIPModel",fr]],["siglip",["SiglipModel",_r]],["jina_clip",["JinaCLIPModel",wr]],["mobilebert",["MobileBertModel",yt]],["squeezebert",["SqueezeBertModel",zt]],["wav2vec2",["Wav2Vec2Model",Ki]],["wav2vec2-bert",["Wav2Vec2BertModel",Ml]],["unispeech",["UniSpeechModel",dl]],["unispeech-sat",["UniSpeechSatModel",ml]],["hubert",["HubertModel",yl]],["wavlm",["WavLMModel",Fl]],["audio-spectrogram-transformer",["ASTModel",Ls]],["vits",["VitsModel",_c]],["pyannote",["PyAnnoteModel",nl]],["wespeaker-resnet",["WeSpeakerResNetModel",ll]],["detr",["DetrModel",aa]],["rt_detr",["RTDetrModel",_a]],["rt_detr_v2",["RTDetrV2Model",fa]],["rf_detr",["RFDetrModel",xa]],["d_fine",["DFineModel",va]],["table-transformer",["TableTransformerModel",Fa]],["vit",["ViTModel",kn]],["ijepa",["IJepaModel",Tn]],["pvt",["PvtModel",An]],["vit_msn",["ViTMSNModel",jn]],["vit_mae",["ViTMAEModel",In]],["groupvit",["GroupViTModel",Nn]],["fastvit",["FastViTModel",Bn]],["mobilevit",["MobileViTModel",Wn]],["mobilevitv2",["MobileViTV2Model",Xn]],["owlvit",["OwlViTModel",Yn]],["owlv2",["Owlv2Model",ea]],["beit",["BeitModel",ra]],["deit",["DeiTModel",Ea]],["hiera",["HieraModel",za]],["convnext",["ConvNextModel",fi]],["convnextv2",["ConvNextV2Model",Mi]],["dinov2",["Dinov2Model",ki]],["dinov2_with_registers",["Dinov2WithRegistersModel",Ti]],["dinov3_vit",["DINOv3ViTModel",Ci]],["dinov3_convnext",["DINOv3ConvNextModel",Ai]],["resnet",["ResNetModel",Oa]],["swin",["SwinModel",Ba]],["swin2sr",["Swin2SRModel",qa]],["donut-swin",["DonutSwinModel",mi]],["yolos",["YolosModel",zi]],["dpt",["DPTModel",Qa]],["glpn",["GLPNModel",ui]],["hifigan",["SpeechT5HifiGan",Nl]],["efficientnet",["EfficientNetModel",bc]],["decision_transformer",["DecisionTransformerModel",qc]],["patchtst",["PatchTSTForPrediction",Yc]],["patchtsmixer",["PatchTSMixerForPrediction",ed]],["mobilenet_v1",["MobileNetV1Model",Cc]],["mobilenet_v2",["MobileNetV2Model",Lc]],["mobilenet_v3",["MobileNetV3Model",Dc]],["mobilenet_v4",["MobileNetV4Model",Bc]],["maskformer",["MaskFormerModel",li]],["mgp-str",["MgpstrForSceneTextRecognition",Hc]],["style_text_to_speech_2",["StyleTextToSpeech2Model",Il]]]),yd=new Map([["t5",["T5Model",qt]],["longt5",["LongT5Model",Qt]],["mt5",["MT5Model",Jt]],["bart",["BartModel",Zt]],["mbart",["MBartModel",rs]],["marian",["MarianModel",Ui]],["whisper",["WhisperModel",js]],["m2m_100",["M2M100Model",Hi]],["blenderbot",["BlenderbotModel",ls]],["blenderbot-small",["BlenderbotSmallModel",us]]]),vd=new Map([["mimi",["MimiModel",ld]],["dac",["DacModel",md]],["snac",["SnacModel",wd]]]),Td=new Map([["bloom",["BloomModel",pn]],["jais",["JAISModel",Cr]],["gpt2",["GPT2Model",Tr]],["gptj",["GPTJModel",Or]],["gpt_bigcode",["GPTBigCodeModel",Br]],["gpt_neo",["GPTNeoModel",Er]],["gpt_neox",["GPTNeoXModel",zr]],["codegen",["CodeGenModel",Rr]],["llama",["LlamaModel",Ur]],["nanochat",["NanoChatModel",Yr]],["arcee",["ArceeModel",eo]],["lfm2",["Lfm2Model",ro]],["smollm3",["SmolLM3Model",ao]],["exaone",["ExaoneModel",fo]],["olmo",["OlmoModel",ko]],["olmo2",["Olmo2Model",To]],["mobilellm",["MobileLLMModel",Mo]],["granite",["GraniteModel",Co]],["granitemoehybrid",["GraniteMoeHybridModel",Eo]],["cohere",["CohereModel",zo]],["gemma",["GemmaModel",Oo]],["gemma2",["Gemma2Model",Bo]],["vaultgemma",["VaultGemmaModel",Ro]],["gemma3_text",["Gemma3Model",Uo]],["helium",["HeliumModel",co]],["glm",["GlmModel",po]],["openelm",["OpenELMModel",Ho]],["qwen2",["Qwen2Model",Ko]],["qwen3",["Qwen3Model",tn]],["phi",["PhiModel",an]],["phi3",["Phi3Model",dn]],["mpt",["MptModel",fn]],["opt",["OPTModel",Mn]],["mistral",["MistralModel",ql]],["ministral",["MinistralModel",Ql]],["ministral3",["Ministral3Model",Jl]],["ernie4_5",["Ernie4_5Model",Zl]],["starcoder2",["Starcoder2Model",sc]],["falcon",["FalconModel",nc]],["stablelm",["StableLmModel",wc]],["modernbert-decoder",["ModernBertDecoderModel",Te]]]),Pd=new Map([["speecht5",["SpeechT5ForSpeechToText",Dl]],["whisper",["WhisperForConditionalGeneration",Ds]],["lite-whisper",["LiteWhisperForConditionalGeneration",Os]],["moonshine",["MoonshineForConditionalGeneration",Bs]]]),Fd=new Map([["speecht5",["SpeechT5ForTextToSpeech",Ol]]]),Cd=new Map([["vits",["VitsModel",_c]],["musicgen",["MusicgenForConditionalGeneration",Pc]],["supertonic",["SupertonicForConditionalGeneration",Bl]]]),Sd=new Map([["bert",["BertForSequenceClassification",de]],["neobert",["NeoBertForSequenceClassification",fe]],["modernbert",["ModernBertForSequenceClassification",ke]],["roformer",["RoFormerForSequenceClassification",Le]],["electra",["ElectraForSequenceClassification",qe]],["esm",["EsmForSequenceClassification",xt]],["convbert",["ConvBertForSequenceClassification",Ne]],["camembert",["CamembertForSequenceClassification",Je]],["deberta",["DebertaForSequenceClassification",st]],["deberta-v2",["DebertaV2ForSequenceClassification",lt]],["mpnet",["MPNetForSequenceClassification",At]],["albert",["AlbertForSequenceClassification",Bt]],["distilbert",["DistilBertForSequenceClassification",pt]],["roberta",["RobertaForSequenceClassification",fs]],["xlm",["XLMForSequenceClassification",ks]],["xlm-roberta",["XLMRobertaForSequenceClassification",Cs]],["bart",["BartForSequenceClassification",ts]],["mbart",["MBartForSequenceClassification",ns]],["mobilebert",["MobileBertForSequenceClassification",Tt]],["squeezebert",["SqueezeBertForSequenceClassification",Dt]]]),Ad=new Map([["bert",["BertForTokenClassification",ue]],["neobert",["NeoBertForTokenClassification",ge]],["modernbert",["ModernBertForTokenClassification",ye]],["roformer",["RoFormerForTokenClassification",Ie]],["electra",["ElectraForTokenClassification",We]],["esm",["EsmForTokenClassification",bt]],["convbert",["ConvBertForTokenClassification",Ve]],["camembert",["CamembertForTokenClassification",Ye]],["deberta",["DebertaForTokenClassification",rt]],["deberta-v2",["DebertaV2ForTokenClassification",ct]],["mpnet",["MPNetForTokenClassification",Et]],["distilbert",["DistilBertForTokenClassification",mt]],["roberta",["RobertaForTokenClassification",gs]],["xlm",["XLMForTokenClassification",ys]],["xlm-roberta",["XLMRobertaForTokenClassification",Ss]]]),Ed=new Map([["t5",["T5ForConditionalGeneration",Wt]],["longt5",["LongT5ForConditionalGeneration",Xt]],["mt5",["MT5ForConditionalGeneration",Yt]],["bart",["BartForConditionalGeneration",es]],["mbart",["MBartForConditionalGeneration",os]],["marian",["MarianMTModel",Qi]],["m2m_100",["M2M100ForConditionalGeneration",Ji]],["blenderbot",["BlenderbotForConditionalGeneration",cs]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",_s]]]),Ld=new Map([["bloom",["BloomForCausalLM",mn]],["gpt2",["GPT2LMHeadModel",Pr]],["jais",["JAISLMHeadModel",Sr]],["gptj",["GPTJForCausalLM",Nr]],["gpt_bigcode",["GPTBigCodeForCausalLM",Gr]],["gpt_neo",["GPTNeoForCausalLM",Lr]],["gpt_neox",["GPTNeoXForCausalLM",jr]],["codegen",["CodeGenForCausalLM",qr]],["llama",["LlamaForCausalLM",Qr]],["nanochat",["NanoChatForCausalLM",Kr]],["llama4_text",["Llama4ForCausalLM",Hr]],["arcee",["ArceeForCausalLM",to]],["lfm2",["Lfm2ForCausalLM",oo]],["smollm3",["SmolLM3ForCausalLM",io]],["exaone",["ExaoneForCausalLM",go]],["olmo",["OlmoForCausalLM",yo]],["olmo2",["Olmo2ForCausalLM",Po]],["mobilellm",["MobileLLMForCausalLM",xo]],["granite",["GraniteForCausalLM",So]],["granitemoehybrid",["GraniteMoeHybridForCausalLM",Lo]],["cohere",["CohereForCausalLM",jo]],["gemma",["GemmaForCausalLM",No]],["gemma2",["Gemma2ForCausalLM",Go]],["vaultgemma",["VaultGemmaForCausalLM",qo]],["gemma3_text",["Gemma3ForCausalLM",Qo]],["helium",["HeliumForCausalLM",uo]],["glm",["GlmForCausalLM",mo]],["openelm",["OpenELMForCausalLM",Jo]],["qwen2",["Qwen2ForCausalLM",Zo]],["qwen3",["Qwen3ForCausalLM",sn]],["phi",["PhiForCausalLM",ln]],["phi3",["Phi3ForCausalLM",un]],["mpt",["MptForCausalLM",gn]],["opt",["OPTForCausalLM",xn]],["mbart",["MBartForCausalLM",as]],["mistral",["MistralForCausalLM",Wl]],["ministral",["MinistralForCausalLM",Xl]],["ministral3",["Ministral3ForCausalLM",Yl]],["ernie4_5",["Ernie4_5ForCausalLM",ec]],["starcoder2",["Starcoder2ForCausalLM",rc]],["falcon",["FalconForCausalLM",ac]],["trocr",["TrOCRForCausalLM",$l]],["stablelm",["StableLmForCausalLM",Mc]],["modernbert-decoder",["ModernBertDecoderForCausalLM",Pe]],["phi3_v",["Phi3VForCausalLM",or]]]),Id=new Map([["multi_modality",["MultiModalityCausalLM",Uc]]]),zd=new Map([["bert",["BertForMaskedLM",ce]],["neobert",["NeoBertForMaskedLM",he]],["modernbert",["ModernBertForMaskedLM",be]],["roformer",["RoFormerForMaskedLM",Ee]],["electra",["ElectraForMaskedLM",Re]],["esm",["EsmForMaskedLM",Mt]],["convbert",["ConvBertForMaskedLM",Oe]],["camembert",["CamembertForMaskedLM",He]],["deberta",["DebertaForMaskedLM",tt]],["deberta-v2",["DebertaV2ForMaskedLM",it]],["mpnet",["MPNetForMaskedLM",St]],["albert",["AlbertForMaskedLM",$t]],["distilbert",["DistilBertForMaskedLM",ft]],["roberta",["RobertaForMaskedLM",hs]],["xlm",["XLMWithLMHeadModel",bs]],["xlm-roberta",["XLMRobertaForMaskedLM",Fs]],["mobilebert",["MobileBertForMaskedLM",vt]],["squeezebert",["SqueezeBertForMaskedLM",jt]]]),jd=new Map([["bert",["BertForQuestionAnswering",_e]],["neobert",["NeoBertForQuestionAnswering",we]],["roformer",["RoFormerForQuestionAnswering",ze]],["electra",["ElectraForQuestionAnswering",Ue]],["convbert",["ConvBertForQuestionAnswering",Be]],["camembert",["CamembertForQuestionAnswering",Ke]],["deberta",["DebertaForQuestionAnswering",ot]],["deberta-v2",["DebertaV2ForQuestionAnswering",dt]],["mpnet",["MPNetForQuestionAnswering",Lt]],["albert",["AlbertForQuestionAnswering",Gt]],["distilbert",["DistilBertForQuestionAnswering",ht]],["roberta",["RobertaForQuestionAnswering",ws]],["xlm",["XLMForQuestionAnswering",vs]],["xlm-roberta",["XLMRobertaForQuestionAnswering",As]],["mobilebert",["MobileBertForQuestionAnswering",Pt]],["squeezebert",["SqueezeBertForQuestionAnswering",Ot]]]),Dd=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",Gs]],["idefics3",["Idefics3ForConditionalGeneration",tr]],["smolvlm",["SmolVLMForConditionalGeneration",sr]]]),Od=new Map([["llava",["LlavaForConditionalGeneration",Rs]],["llava_onevision",["LlavaOnevisionForConditionalGeneration",qs]],["moondream1",["Moondream1ForConditionalGeneration",Ws]],["florence2",["Florence2ForConditionalGeneration",Qs]],["qwen2-vl",["Qwen2VLForConditionalGeneration",on]],["idefics3",["Idefics3ForConditionalGeneration",tr]],["smolvlm",["SmolVLMForConditionalGeneration",sr]],["paligemma",["PaliGemmaForConditionalGeneration",Hs]],["llava_qwen2",["LlavaQwen2ForCausalLM",Js]],["gemma3n",["Gemma3nForConditionalGeneration",Zs]],["mistral3",["Mistral3ForConditionalGeneration",Ys]]]),Nd=new Map([["ultravox",["UltravoxModel",rd]],["voxtral",["VoxtralForConditionalGeneration",od]]]),Vd=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",Gs]]]),Bd=new Map([["vit",["ViTForImageClassification",yn]],["ijepa",["IJepaForImageClassification",Pn]],["pvt",["PvtForImageClassification",En]],["vit_msn",["ViTMSNForImageClassification",Dn]],["fastvit",["FastViTForImageClassification",Gn]],["mobilevit",["MobileViTForImageClassification",Un]],["mobilevitv2",["MobileViTV2ForImageClassification",Hn]],["beit",["BeitForImageClassification",oa]],["deit",["DeiTForImageClassification",La]],["hiera",["HieraForImageClassification",ja]],["convnext",["ConvNextForImageClassification",gi]],["convnextv2",["ConvNextV2ForImageClassification",xi]],["dinov2",["Dinov2ForImageClassification",yi]],["dinov2_with_registers",["Dinov2WithRegistersForImageClassification",Pi]],["resnet",["ResNetForImageClassification",Na]],["swin",["SwinForImageClassification",Ga]],["segformer",["SegformerForImageClassification",hc]],["efficientnet",["EfficientNetForImageClassification",kc]],["mobilenet_v1",["MobileNetV1ForImageClassification",Sc]],["mobilenet_v2",["MobileNetV2ForImageClassification",Ic]],["mobilenet_v3",["MobileNetV3ForImageClassification",Oc]],["mobilenet_v4",["MobileNetV4ForImageClassification",Gc]]]),Gd=new Map([["detr",["DetrForObjectDetection",ia]],["rt_detr",["RTDetrForObjectDetection",pa]],["rt_detr_v2",["RTDetrV2ForObjectDetection",ga]],["rf_detr",["RFDetrForObjectDetection",ba]],["d_fine",["DFineForObjectDetection",Ta]],["table-transformer",["TableTransformerForObjectDetection",Ca]],["yolos",["YolosForObjectDetection",ji]]]),$d=new Map([["owlvit",["OwlViTForObjectDetection",Kn]],["owlv2",["Owlv2ForObjectDetection",ta]],["grounding-dino",["GroundingDinoForObjectDetection",Li]]]),Rd=new Map([["detr",["DetrForSegmentation",la]],["clipseg",["CLIPSegForImageSegmentation",yr]]]),qd=new Map([["segformer",["SegformerForSemanticSegmentation",fc]],["sapiens",["SapiensForSemanticSegmentation",Ka]],["swin",["SwinForSemanticSegmentation",$a]],["mobilenet_v1",["MobileNetV1ForSemanticSegmentation",Ac]],["mobilenet_v2",["MobileNetV2ForSemanticSegmentation",zc]],["mobilenet_v3",["MobileNetV3ForSemanticSegmentation",Nc]],["mobilenet_v4",["MobileNetV4ForSemanticSegmentation",$c]]]),Wd=new Map([["detr",["DetrForSegmentation",la]],["maskformer",["MaskFormerForInstanceSegmentation",ci]]]),Ud=new Map([["sam",["SamModel",Ni]],["sam2",["Sam2Model",$i]],["edgetam",["EdgeTamModel",Ri]],["sam3_tracker",["Sam3TrackerModel",qi]]]),Qd=new Map([["wav2vec2",["Wav2Vec2ForCTC",Zi]],["wav2vec2-bert",["Wav2Vec2BertForCTC",xl]],["unispeech",["UniSpeechForCTC",ul]],["unispeech-sat",["UniSpeechSatForCTC",hl]],["wavlm",["WavLMForCTC",Cl]],["hubert",["HubertForCTC",vl]],["parakeet_ctc",["ParakeetForCTC",rl]]]),Xd=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",el]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",bl]],["unispeech",["UniSpeechForSequenceClassification",_l]],["unispeech-sat",["UniSpeechSatForSequenceClassification",fl]],["wavlm",["WavLMForSequenceClassification",Sl]],["hubert",["HubertForSequenceClassification",Tl]],["audio-spectrogram-transformer",["ASTForAudioClassification",Is]]]),Hd=new Map([["wavlm",["WavLMForXVector",Al]]]),Jd=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",gl]],["wavlm",["WavLMForAudioFrameClassification",El]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",tl]],["pyannote",["PyAnnoteForAudioFrameClassification",al]]]),Yd=new Map([["vitmatte",["VitMatteForImageMatting",Rn]]]),Kd=new Map([["patchtst",["PatchTSTForPrediction",Kc]],["patchtsmixer",["PatchTSMixerForPrediction",td]]]),Zd=new Map([["swin2sr",["Swin2SRForImageSuperResolution",Wa]]]),eu=new Map([["dpt",["DPTForDepthEstimation",Xa]],["depth_anything",["DepthAnythingForDepthEstimation",Ja]],["glpn",["GLPNForDepthEstimation",_i]],["sapiens",["SapiensForDepthEstimation",Za]],["depth_pro",["DepthProForDepthEstimation",si]],["metric3d",["Metric3DForDepthEstimation",oi]],["metric3dv2",["Metric3Dv2ForDepthEstimation",ai]]]),tu=new Map([["sapiens",["SapiensForNormalEstimation",ei]]]),su=new Map([["vitpose",["VitPoseForPoseEstimation",Cn]]]),ru=new Map([["clip",["CLIPVisionModelWithProjection",dr]],["siglip",["SiglipVisionModel",mr]],["jina_clip",["JinaCLIPVisionModel",xr]]]),ou=[[kd,x],[yd,b],[Td,v],[vd,E],[Sd,x],[Ad,x],[Ed,k],[Pd,k],[Ld,v],[Id,C],[zd,x],[jd,x],[Dd,y],[Od,P],[Nd,A],[Bd,x],[Rd,x],[Wd,x],[qd,x],[Yd,x],[Kd,x],[Zd,x],[eu,x],[tu,x],[su,x],[Gd,x],[$d,x],[Ud,T],[Qd,x],[Xd,x],[Fd,k],[Cd,x],[Hd,x],[Jd,x],[ru,x]];for(const[e,t]of ou)for(const[s,r]of e.values())z.set(s,t),D.set(r,s),j.set(s,r);const nu=[["MusicgenForConditionalGeneration",Pc,F],["Phi3VForCausalLM",or,S],["CLIPTextModelWithProjection",lr,x],["SiglipTextModel",pr,x],["JinaCLIPTextModel",Mr,x],["ClapTextModelWithProjection",cc,x],["ClapAudioModelWithProjection",dc,x],["DacEncoderModel",hd,x],["DacDecoderModel",fd,x],["MimiEncoderModel",cd,x],["MimiDecoderModel",dd,x],["SnacEncoderModel",Md,x],["SnacDecoderModel",xd,x],["Gemma3nForConditionalGeneration",Zs,L],["SupertonicForConditionalGeneration",Bl,I]];for(const[e,t,s]of nu)z.set(e,s),D.set(t,e),j.set(e,t);const au=new Map([["modnet",Rd],["birefnet",Rd],["isnet",Rd],["ben",Rd]]);for(const[e,t]of au.entries())t.set(e,["PreTrainedModel",oe]),z.set(e,x),D.set(oe,e),j.set(e,oe);class iu extends bd{static MODEL_CLASS_MAPPINGS=ou.map((e=>e[0]));static BASE_IF_FAIL=!0}class lu extends bd{static MODEL_CLASS_MAPPINGS=[Sd]}class cu extends bd{static MODEL_CLASS_MAPPINGS=[Ad]}class du extends bd{static MODEL_CLASS_MAPPINGS=[Ed]}class uu extends bd{static MODEL_CLASS_MAPPINGS=[Pd]}class _u extends bd{static MODEL_CLASS_MAPPINGS=[Fd]}class pu extends bd{static MODEL_CLASS_MAPPINGS=[Cd]}class mu extends bd{static MODEL_CLASS_MAPPINGS=[Ld]}class hu extends bd{static MODEL_CLASS_MAPPINGS=[zd]}class fu extends bd{static MODEL_CLASS_MAPPINGS=[jd]}class gu extends bd{static MODEL_CLASS_MAPPINGS=[Dd]}class wu extends bd{static MODEL_CLASS_MAPPINGS=[Bd]}class Mu extends bd{static MODEL_CLASS_MAPPINGS=[Rd]}class xu extends bd{static MODEL_CLASS_MAPPINGS=[qd]}class bu extends bd{static MODEL_CLASS_MAPPINGS=[Wd]}class ku extends bd{static MODEL_CLASS_MAPPINGS=[Gd]}class yu extends bd{static MODEL_CLASS_MAPPINGS=[$d]}class vu extends bd{static MODEL_CLASS_MAPPINGS=[Ud]}class Tu extends bd{static MODEL_CLASS_MAPPINGS=[Qd]}class Pu extends bd{static MODEL_CLASS_MAPPINGS=[Xd]}class Fu extends bd{static MODEL_CLASS_MAPPINGS=[Hd]}class Cu extends bd{static MODEL_CLASS_MAPPINGS=[Jd]}class Su extends bd{static MODEL_CLASS_MAPPINGS=[Vd]}class Au extends bd{static MODEL_CLASS_MAPPINGS=[Yd]}class Eu extends bd{static MODEL_CLASS_MAPPINGS=[Zd]}class Lu extends bd{static MODEL_CLASS_MAPPINGS=[eu]}class Iu extends bd{static MODEL_CLASS_MAPPINGS=[tu]}class zu extends bd{static MODEL_CLASS_MAPPINGS=[su]}class ju extends bd{static MODEL_CLASS_MAPPINGS=[ru]}class Du extends bd{static MODEL_CLASS_MAPPINGS=[Od]}class Ou extends bd{static MODEL_CLASS_MAPPINGS=[Nd]}class Nu extends ne{constructor({logits:e,past_key_values:t,encoder_outputs:s,decoder_attentions:r=null,cross_attentions:o=null}){super(),this.logits=e,this.past_key_values=t,this.encoder_outputs=s,this.decoder_attentions=r,this.cross_attentions=o}}class Vu extends ne{constructor({logits:e,...t}){super(),this.logits=e;const s=Object.values(t);s.length>0&&(this.attentions=s)}}class Bu extends ne{constructor({logits:e,embeddings:t}){super(),this.logits=e,this.embeddings=t}}class Gu extends ne{constructor({logits:e}){super(),this.logits=e}}class $u extends ne{constructor({logits:e}){super(),this.logits=e}}class Ru extends ne{constructor({start_logits:e,end_logits:t}){super(),this.start_logits=e,this.end_logits=t}}class qu extends ne{constructor({logits:e}){super(),this.logits=e}}class Wu extends ne{constructor({logits:e,past_key_values:t}){super(),this.logits=e,this.past_key_values=t}}class Uu extends ne{constructor({alphas:e}){super(),this.alphas=e}}class Qu extends ne{constructor({waveform:e,spectrogram:t}){super(),this.waveform=e,this.spectrogram=t}}},"./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{ASTFeatureExtractor:()=>n});var r=s("./src/base/feature_extraction_utils.js"),o=(s("./src/utils/tensor.js"),s("./src/utils/audio.js"));class n extends r.FeatureExtractor{constructor(e){super(e);const t=this.config.sampling_rate,s=(0,o.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);this.mel_filters=s,this.window=(0,o.window_function)(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}async _extract_fbank_features(e,t){return(0,o.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e){(0,r.validate_audio_inputs)(e,"ASTFeatureExtractor");const t=await this._extract_fbank_features(e,this.config.max_length);if(this.config.do_normalize){const e=2*this.std,s=t.data;for(let t=0;t{"use strict";s.r(t),s.d(t,{AutoFeatureExtractor:()=>a});var r=s("./src/utils/constants.js"),o=s("./src/utils/hub.js"),n=(s("./src/base/feature_extraction_utils.js"),s("./src/models/feature_extractors.js"));class a{static async from_pretrained(e,t={}){const s=await(0,o.getModelJSON)(e,r.FEATURE_EXTRACTOR_NAME,!0,t),a=s.feature_extractor_type,i=n[a];if(!i)throw new Error(`Unknown feature_extractor_type: '${a}'. Please report this at ${r.GITHUB_ISSUE_URL}.`);return new i(s)}}},"./src/models/auto/image_processing_auto.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{AutoImageProcessor:()=>i});var r=s("./src/utils/constants.js"),o=s("./src/utils/hub.js"),n=s("./src/base/image_processors_utils.js"),a=s("./src/models/image_processors.js");class i{static async from_pretrained(e,t={}){const s=await(0,o.getModelJSON)(e,r.IMAGE_PROCESSOR_NAME,!0,t),i=s.image_processor_type??s.feature_extractor_type;let l=a[i?.replace(/Fast$/,"")];return l||(void 0!==i&&console.warn(`Image processor type '${i}' not found, assuming base ImageProcessor. Please report this at ${r.GITHUB_ISSUE_URL}.`),l=n.ImageProcessor),new l(s)}}},"./src/models/auto/processing_auto.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{AutoProcessor:()=>c});var r=s("./src/utils/constants.js"),o=s("./src/utils/hub.js"),n=s("./src/base/processing_utils.js"),a=s("./src/models/processors.js"),i=s("./src/models/image_processors.js"),l=s("./src/models/feature_extractors.js");class c{static async from_pretrained(e,t={}){const s=await(0,o.getModelJSON)(e,r.IMAGE_PROCESSOR_NAME,!0,t),{image_processor_type:c,feature_extractor_type:d,processor_class:u}=s;if(u&&a[u])return a[u].from_pretrained(e,t);if(!c&&!d)throw new Error("No `image_processor_type` or `feature_extractor_type` found in the config.");const _={};if(c){const e=i[c.replace(/Fast$/,"")];if(!e)throw new Error(`Unknown image_processor_type: '${c}'.`);_.image_processor=new e(s)}if(d){const e=i[d];if(e)_.image_processor=new e(s);else{const e=l[d];if(!e)throw new Error(`Unknown feature_extractor_type: '${d}'.`);_.feature_extractor=new e(s)}}return new n.Processor({},_,null)}}},"./src/models/beit/image_processing_beit.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{BeitFeatureExtractor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}},"./src/models/bit/image_processing_bit.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{BitImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}},"./src/models/chinese_clip/image_processing_chinese_clip.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{ChineseCLIPFeatureExtractor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}},"./src/models/clap/feature_extraction_clap.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{ClapFeatureExtractor:()=>n});var r=s("./src/base/feature_extraction_utils.js"),o=(s("./src/utils/tensor.js"),s("./src/utils/audio.js"));class n extends r.FeatureExtractor{constructor(e){super(e),this.mel_filters=(0,o.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,null,"htk"),this.mel_filters_slaney=(0,o.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,"slaney","slaney"),this.window=(0,o.window_function)(this.config.fft_window_size,"hann")}async _get_input_mel(e,t,s,r){let o,n=!1;const a=e.length-t;if(a>0){if("rand_trunc"!==s)throw new Error(`Truncation strategy "${s}" not implemented`);{n=!0;const s=Math.floor(Math.random()*(a+1));e=e.subarray(s,s+t),o=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}}else{if(a<0){let s=new Float64Array(t);if(s.set(e),"repeat"===r)for(let r=e.length;r{"use strict";s.r(t),s.d(t,{CLIPFeatureExtractor:()=>n,CLIPImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}class n extends o{}},"./src/models/convnext/image_processing_convnext.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{ConvNextFeatureExtractor:()=>n,ConvNextImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{constructor(e){super(e),this.crop_pct=this.config.crop_pct??.875}async resize(e){const t=this.size?.shortest_edge;if(void 0===t)throw new Error("Size dictionary must contain 'shortest_edge' key.");if(t<384){const s=Math.floor(t/this.crop_pct),[r,o]=this.get_resize_output_image_size(e,{shortest_edge:s});e=await e.resize(r,o,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class n extends o{}},"./src/models/dac/feature_extraction_dac.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{DacFeatureExtractor:()=>o});var r=s("./src/models/encodec/feature_extraction_encodec.js");class o extends r.EncodecFeatureExtractor{}},"./src/models/deit/image_processing_deit.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{DeiTFeatureExtractor:()=>n,DeiTImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}class n extends o{}},"./src/models/detr/image_processing_detr.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{DetrFeatureExtractor:()=>a,DetrImageProcessor:()=>n});var r=s("./src/base/image_processors_utils.js"),o=s("./src/utils/tensor.js");class n extends r.ImageProcessor{async _call(e){const t=await super._call(e),s=[t.pixel_values.dims[0],64,64],r=(0,o.full)(s,1n);return{...t,pixel_mask:r}}post_process_object_detection(...e){return(0,r.post_process_object_detection)(...e)}post_process_panoptic_segmentation(...e){return(0,r.post_process_panoptic_segmentation)(...e)}post_process_instance_segmentation(...e){return(0,r.post_process_instance_segmentation)(...e)}}class a extends n{}},"./src/models/dinov3_vit/image_processing_dinov3_vit.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{DINOv3ViTImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}},"./src/models/donut/image_processing_donut.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{DonutFeatureExtractor:()=>n,DonutImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{pad_image(e,t,s,r={}){const[o,n,a]=t;let i=this.image_mean;Array.isArray(this.image_mean)||(i=new Array(a).fill(i));let l=this.image_std;Array.isArray(l)||(l=new Array(a).fill(i));const c=i.map(((e,t)=>-e/l[t]));return super.pad_image(e,t,s,{center:!0,constant_values:c,...r})}}class n extends o{}},"./src/models/dpt/image_processing_dpt.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{DPTFeatureExtractor:()=>n,DPTImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}class n extends o{}},"./src/models/efficientnet/image_processing_efficientnet.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{EfficientNetImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{constructor(e){super(e),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map((e=>e*e)))}}},"./src/models/encodec/feature_extraction_encodec.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{EncodecFeatureExtractor:()=>n});var r=s("./src/base/feature_extraction_utils.js"),o=s("./src/utils/tensor.js");class n extends r.FeatureExtractor{async _call(e){(0,r.validate_audio_inputs)(e,"EncodecFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=this.config.feature_size;if(e.length%t!=0)throw new Error(`The length of the audio data must be a multiple of the number of channels (${t}).`);const s=[1,t,e.length/t];return{input_values:new o.Tensor("float32",e,s)}}}},"./src/models/feature_extractors.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{ASTFeatureExtractor:()=>r.ASTFeatureExtractor,ClapFeatureExtractor:()=>n.ClapFeatureExtractor,DacFeatureExtractor:()=>a.DacFeatureExtractor,EncodecFeatureExtractor:()=>o.EncodecFeatureExtractor,Gemma3nAudioFeatureExtractor:()=>i.Gemma3nAudioFeatureExtractor,ImageFeatureExtractor:()=>g.ImageProcessor,MoonshineFeatureExtractor:()=>l.MoonshineFeatureExtractor,ParakeetFeatureExtractor:()=>c.ParakeetFeatureExtractor,PyAnnoteFeatureExtractor:()=>d.PyAnnoteFeatureExtractor,SeamlessM4TFeatureExtractor:()=>u.SeamlessM4TFeatureExtractor,SnacFeatureExtractor:()=>_.SnacFeatureExtractor,SpeechT5FeatureExtractor:()=>p.SpeechT5FeatureExtractor,Wav2Vec2FeatureExtractor:()=>m.Wav2Vec2FeatureExtractor,WeSpeakerFeatureExtractor:()=>h.WeSpeakerFeatureExtractor,WhisperFeatureExtractor:()=>f.WhisperFeatureExtractor});var r=s("./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"),o=s("./src/models/encodec/feature_extraction_encodec.js"),n=s("./src/models/clap/feature_extraction_clap.js"),a=s("./src/models/dac/feature_extraction_dac.js"),i=s("./src/models/gemma3n/feature_extraction_gemma3n.js"),l=s("./src/models/moonshine/feature_extraction_moonshine.js"),c=s("./src/models/parakeet/feature_extraction_parakeet.js"),d=s("./src/models/pyannote/feature_extraction_pyannote.js"),u=s("./src/models/seamless_m4t/feature_extraction_seamless_m4t.js"),_=s("./src/models/snac/feature_extraction_snac.js"),p=s("./src/models/speecht5/feature_extraction_speecht5.js"),m=s("./src/models/wav2vec2/feature_extraction_wav2vec2.js"),h=s("./src/models/wespeaker/feature_extraction_wespeaker.js"),f=s("./src/models/whisper/feature_extraction_whisper.js"),g=s("./src/base/image_processors_utils.js")},"./src/models/florence2/processing_florence2.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Florence2Processor:()=>a});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends r.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;constructor(e,t,s){super(e,t,s);const{tasks_answer_post_processing_type:r,task_prompts_without_inputs:o,task_prompts_with_input:n}=this.image_processor.config;this.tasks_answer_post_processing_type=new Map(Object.entries(r??{})),this.task_prompts_without_inputs=new Map(Object.entries(o??{})),this.task_prompts_with_input=new Map(Object.entries(n??{})),this.regexes={quad_boxes:/(.+?)/gm,bboxes:/([^<]+)?/gm},this.size_per_bin=1e3}construct_prompts(e){"string"==typeof e&&(e=[e]);const t=[];for(const s of e)if(this.task_prompts_without_inputs.has(s))t.push(this.task_prompts_without_inputs.get(s));else{for(const[e,r]of this.task_prompts_with_input)if(s.includes(e)){t.push(r.replaceAll("{input}",s).replaceAll(e,""));break}t.length!==e.length&&t.push(s)}return t}post_process_generation(e,t,s){const r=this.tasks_answer_post_processing_type.get(t)??"pure_text";let o;switch(e=e.replaceAll("","").replaceAll("",""),r){case"pure_text":o=e;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":const n="ocr"===r?"quad_boxes":"bboxes",a=e.matchAll(this.regexes[n]),i=[],l=[];for(const[e,t,...r]of a)i.push(t?t.trim():i.at(-1)??""),l.push(r.map(((e,t)=>(Number(e)+.5)/this.size_per_bin*s[t%2])));o={labels:i,[n]:l};break;default:throw new Error(`Task "${t}" (of type "${r}") not yet implemented.`)}return{[t]:o}}async _call(e,t=null,s={}){if(!e&&!t)throw new Error("Either text or images must be provided");return{...await this.image_processor(e,s),...t?this.tokenizer(this.construct_prompts(t),s):{}}}}},"./src/models/gemma3n/feature_extraction_gemma3n.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Gemma3nAudioFeatureExtractor:()=>a});var r=s("./src/base/feature_extraction_utils.js"),o=s("./src/utils/tensor.js"),n=s("./src/utils/audio.js");class a extends r.FeatureExtractor{constructor(e){super(e);const{fft_length:t,feature_size:s,min_frequency:r,max_frequency:o,sampling_rate:a,frame_length:i}=this.config,l=(0,n.mel_filter_bank)(Math.floor(1+t/2),s,r,o,a,null,"htk",!1);this.mel_filters=l,this.window=(0,n.window_function)(i,"hann")}async _extract_fbank_features(e,t){return(0,n.spectrogram)(e,this.window,this.config.frame_length,this.config.hop_length,{fft_length:this.config.fft_length,center:!1,onesided:!0,preemphasis:this.config.preemphasis,preemphasis_htk_flavor:this.config.preemphasis_htk_flavor,mel_filters:this.mel_filters,log_mel:"log",mel_floor:this.config.mel_floor,remove_dc_offset:!1,transpose:!0})}async _call(e,{max_length:t=48e4,truncation:s=!0,padding:n=!0,pad_to_multiple_of:a=128}={}){if((0,r.validate_audio_inputs)(e,"Gemma3nAudioFeatureExtractor"),s&&e.length>t&&(e=e.slice(0,t)),n&&e.length%a!=0){const t=a-e.length%a,s=new Float64Array(e.length+t);s.set(e),0!==this.config.padding_value&&s.fill(this.config.padding_value,e.length),e=s}const i=await this._extract_fbank_features(e,this.config.max_length),l=(0,o.full)([1,i.dims[0]],!0);return{input_features:i.unsqueeze_(0),input_features_mask:l}}}},"./src/models/gemma3n/processing_gemma3n.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Gemma3nProcessor:()=>i});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/models/auto/feature_extraction_auto.js"),a=s("./src/tokenizers.js");s("./src/utils/image.js"),s("./src/utils/audio.js");class i extends r.Processor{static image_processor_class=o.AutoImageProcessor;static feature_extractor_class=n.AutoFeatureExtractor;static tokenizer_class=a.AutoTokenizer;static uses_processor_config=!0;static uses_chat_template_file=!0;constructor(e,t,s){super(e,t,s),this.audio_seq_length=this.config.audio_seq_length,this.image_seq_length=this.config.image_seq_length;const{audio_token_id:r,boa_token:o,audio_token:n,eoa_token:a,image_token_id:i,boi_token:l,image_token:c,eoi_token:d}=this.tokenizer.config;this.audio_token_id=r,this.boa_token=o,this.audio_token=n;const u=n.repeat(this.audio_seq_length);this.full_audio_sequence=`\n\n${o}${u}${a}\n\n`,this.image_token_id=i,this.boi_token=l,this.image_token=c;const _=c.repeat(this.image_seq_length);this.full_image_sequence=`\n\n${l}${_}${d}\n\n`}async _call(e,t=null,s=null,r={}){let o,n;return"string"==typeof e&&(e=[e]),s&&(o=await this.feature_extractor(s,r),e=e.map((e=>e.replaceAll(this.audio_token,this.full_audio_sequence)))),t&&(n=await this.image_processor(t,r),e=e.map((e=>e.replaceAll(this.image_token,this.full_image_sequence)))),{...this.tokenizer(e,r),...n,...o}}}},"./src/models/glpn/image_processing_glpn.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{GLPNFeatureExtractor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}},"./src/models/grounding_dino/image_processing_grounding_dino.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{GroundingDinoImageProcessor:()=>n});var r=s("./src/base/image_processors_utils.js"),o=s("./src/utils/tensor.js");class n extends r.ImageProcessor{async _call(e){const t=await super._call(e),s=t.pixel_values.dims,r=(0,o.ones)([s[0],s[2],s[3]]);return{...t,pixel_mask:r}}}},"./src/models/grounding_dino/processing_grounding_dino.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{GroundingDinoProcessor:()=>l});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=s("./src/base/image_processors_utils.js");function i(e,t){const s=e.dims.at(-1)-1,r=e.tolist();r.fill(!1,0,1),r.fill(!1,s);const o=t.tolist();return r.map(((e,t)=>e?t:null)).filter((e=>null!==e)).map((e=>o[e]))}class l extends r.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;async _call(e,t,s={}){const r=e?await this.image_processor(e,s):{};return{...t?this.tokenizer(t,s):{},...r}}post_process_grounded_object_detection(e,t,{box_threshold:s=.25,text_threshold:r=.25,target_sizes:o=null}={}){const{logits:n,pred_boxes:l}=e,c=n.dims[0];if(null!==o&&o.length!==c)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const d=n.dims.at(1),u=n.sigmoid(),_=u.max(-1).tolist(),p=l.tolist().map((e=>e.map((e=>(0,a.center_to_corners_format)(e))))),m=[];for(let e=0;ee.map(((e,t)=>e*n[(t+1)%2])))));const a=_[e],l=[],c=[],h=[];for(let o=0;o{"use strict";s.r(t),s.d(t,{Idefics3ImageProcessor:()=>n});var r=s("./src/base/image_processors_utils.js"),o=s("./src/utils/tensor.js");class n extends r.ImageProcessor{constructor(e){super(e),this.do_image_splitting=e.do_image_splitting??!0,this.max_image_size=e.max_image_size}get_resize_for_vision_encoder(e,t){let[s,r]=e.dims.slice(-2);const o=r/s;return r>=s?(r=Math.ceil(r/t)*t,s=Math.floor(r/o),s=Math.ceil(s/t)*t):(s=Math.ceil(s/t)*t,r=Math.floor(s*o),r=Math.ceil(r/t)*t),{height:s,width:r}}async _call(e,{do_image_splitting:t=null,return_row_col_info:s=!1}={}){let r;if(Array.isArray(e)){if(0===e.length||!e[0])throw new Error("No images provided.");r=Array.isArray(e[0])?e:[e]}else r=[[e]];let n=[],a=[],i=[];const l=[],c=[];for(const e of r){let s=await Promise.all(e.map((e=>this.preprocess(e))));l.push(...s.map((e=>e.original_size))),c.push(...s.map((e=>e.reshaped_input_size))),s.forEach((e=>e.pixel_values.unsqueeze_(0)));const{longest_edge:r}=this.max_image_size;let d;if(t??this.do_image_splitting){let e=new Array(s.length),t=new Array(s.length);d=await Promise.all(s.map((async(s,n)=>{const a=this.get_resize_for_vision_encoder(s.pixel_values,r),i=await(0,o.interpolate_4d)(s.pixel_values,{size:[a.height,a.width]}),{frames:l,num_splits_h:c,num_splits_w:d}=await this.split_image(i,this.max_image_size);return e[n]=c,t[n]=d,(0,o.cat)(l,0)}))),a.push(e),i.push(t)}else{const e=[r,r];d=await Promise.all(s.map((t=>(0,o.interpolate_4d)(t.pixel_values,{size:e})))),a.push(new Array(s.length).fill(0)),i.push(new Array(s.length).fill(0))}n.push((0,o.cat)(d,0))}const d=n.length,[u,_,p,m]=n[0].dims;let h,f;if(1===d)h=n[0].unsqueeze_(0),f=(0,o.full)([d,u,p,m],!0);else{const e=Math.max(...n.map((e=>e.dims.at(0))));f=(0,o.full)([d,e,p,m],!0);const t=f.data,s=e*p*m;for(let r=0;rs||i>r){l=Math.ceil(a/s),c=Math.ceil(i/r);const t=Math.ceil(a/l),d=Math.ceil(i/c);for(let s=0;s{"use strict";s.r(t),s.d(t,{Idefics3Processor:()=>l});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=(s("./src/utils/image.js"),s("./src/utils/core.js"));function i(e,t,s,r,o,n){return 0===e&&0===t?function(e,t,s,r){return`${t}${r}`+s.repeat(e)+`${t}`}(s,r,o,n):function(e,t,s,r,o,n){let a="";for(let n=0;n`+o.repeat(e);a+="\n"}return a+=`\n${r}${n}`+o.repeat(e)+`${r}`,a}(s,e,t,r,o,n)}class l extends r.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;static uses_processor_config=!0;fake_image_token="";image_token="";global_img_token="";async _call(e,t=null,s={}){let r;s.return_row_col_info??=!0,t&&(r=await this.image_processor(t,s)),Array.isArray(e)||(e=[e]);const o=r.rows??[new Array(e.length).fill(0)],n=r.cols??[new Array(e.length).fill(0)],l=this.config.image_seq_len,c=[],d=[];for(let t=0;ti(e,u[t],l,this.fake_image_token,this.image_token,this.global_img_token))),p=s.split(this.image_token);if(0===p.length)throw new Error("The image token should be present in the text.");let m=p[0];for(let e=0;e<_.length;++e)m+=_[e]+p[e+1];d.push(m)}return{...this.tokenizer(d),...r}}}},"./src/models/image_processors.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{BeitFeatureExtractor:()=>r.BeitFeatureExtractor,BitImageProcessor:()=>o.BitImageProcessor,CLIPFeatureExtractor:()=>a.CLIPFeatureExtractor,CLIPImageProcessor:()=>a.CLIPImageProcessor,ChineseCLIPFeatureExtractor:()=>n.ChineseCLIPFeatureExtractor,ConvNextFeatureExtractor:()=>i.ConvNextFeatureExtractor,ConvNextImageProcessor:()=>i.ConvNextImageProcessor,DINOv3ViTImageProcessor:()=>d.DINOv3ViTImageProcessor,DPTFeatureExtractor:()=>_.DPTFeatureExtractor,DPTImageProcessor:()=>_.DPTImageProcessor,DeiTFeatureExtractor:()=>l.DeiTFeatureExtractor,DeiTImageProcessor:()=>l.DeiTImageProcessor,DetrFeatureExtractor:()=>c.DetrFeatureExtractor,DetrImageProcessor:()=>c.DetrImageProcessor,DonutFeatureExtractor:()=>u.DonutFeatureExtractor,DonutImageProcessor:()=>u.DonutImageProcessor,EfficientNetImageProcessor:()=>p.EfficientNetImageProcessor,GLPNFeatureExtractor:()=>m.GLPNFeatureExtractor,GroundingDinoImageProcessor:()=>h.GroundingDinoImageProcessor,Idefics3ImageProcessor:()=>f.Idefics3ImageProcessor,JinaCLIPImageProcessor:()=>w.JinaCLIPImageProcessor,LlavaOnevisionImageProcessor:()=>M.LlavaOnevisionImageProcessor,Mask2FormerImageProcessor:()=>x.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>b.MaskFormerFeatureExtractor,MaskFormerImageProcessor:()=>b.MaskFormerImageProcessor,MobileNetV1FeatureExtractor:()=>k.MobileNetV1FeatureExtractor,MobileNetV1ImageProcessor:()=>k.MobileNetV1ImageProcessor,MobileNetV2FeatureExtractor:()=>y.MobileNetV2FeatureExtractor,MobileNetV2ImageProcessor:()=>y.MobileNetV2ImageProcessor,MobileNetV3FeatureExtractor:()=>v.MobileNetV3FeatureExtractor,MobileNetV3ImageProcessor:()=>v.MobileNetV3ImageProcessor,MobileNetV4FeatureExtractor:()=>T.MobileNetV4FeatureExtractor,MobileNetV4ImageProcessor:()=>T.MobileNetV4ImageProcessor,MobileViTFeatureExtractor:()=>P.MobileViTFeatureExtractor,MobileViTImageProcessor:()=>P.MobileViTImageProcessor,NougatImageProcessor:()=>F.NougatImageProcessor,OwlViTFeatureExtractor:()=>S.OwlViTFeatureExtractor,OwlViTImageProcessor:()=>S.OwlViTImageProcessor,Owlv2ImageProcessor:()=>C.Owlv2ImageProcessor,Phi3VImageProcessor:()=>A.Phi3VImageProcessor,PixtralImageProcessor:()=>E.PixtralImageProcessor,PvtImageProcessor:()=>L.PvtImageProcessor,Qwen2VLImageProcessor:()=>I.Qwen2VLImageProcessor,RTDetrImageProcessor:()=>z.RTDetrImageProcessor,Sam2ImageProcessor:()=>D.Sam2ImageProcessor,Sam3ImageProcessor:()=>O.Sam3ImageProcessor,SamImageProcessor:()=>j.SamImageProcessor,SegformerFeatureExtractor:()=>N.SegformerFeatureExtractor,SegformerImageProcessor:()=>N.SegformerImageProcessor,SiglipImageProcessor:()=>V.SiglipImageProcessor,SmolVLMImageProcessor:()=>B.SmolVLMImageProcessor,Swin2SRImageProcessor:()=>G.Swin2SRImageProcessor,VLMImageProcessor:()=>g.VLMImageProcessor,ViTFeatureExtractor:()=>$.ViTFeatureExtractor,ViTImageProcessor:()=>$.ViTImageProcessor,VitMatteImageProcessor:()=>R.VitMatteImageProcessor,VitPoseImageProcessor:()=>q.VitPoseImageProcessor,YolosFeatureExtractor:()=>W.YolosFeatureExtractor,YolosImageProcessor:()=>W.YolosImageProcessor});var r=s("./src/models/beit/image_processing_beit.js"),o=s("./src/models/bit/image_processing_bit.js"),n=s("./src/models/chinese_clip/image_processing_chinese_clip.js"),a=s("./src/models/clip/image_processing_clip.js"),i=s("./src/models/convnext/image_processing_convnext.js"),l=s("./src/models/deit/image_processing_deit.js"),c=s("./src/models/detr/image_processing_detr.js"),d=s("./src/models/dinov3_vit/image_processing_dinov3_vit.js"),u=s("./src/models/donut/image_processing_donut.js"),_=s("./src/models/dpt/image_processing_dpt.js"),p=s("./src/models/efficientnet/image_processing_efficientnet.js"),m=s("./src/models/glpn/image_processing_glpn.js"),h=s("./src/models/grounding_dino/image_processing_grounding_dino.js"),f=s("./src/models/idefics3/image_processing_idefics3.js"),g=s("./src/models/janus/image_processing_janus.js"),w=s("./src/models/jina_clip/image_processing_jina_clip.js"),M=s("./src/models/llava_onevision/image_processing_llava_onevision.js"),x=s("./src/models/mask2former/image_processing_mask2former.js"),b=s("./src/models/maskformer/image_processing_maskformer.js"),k=s("./src/models/mobilenet_v1/image_processing_mobilenet_v1.js"),y=s("./src/models/mobilenet_v2/image_processing_mobilenet_v2.js"),v=s("./src/models/mobilenet_v3/image_processing_mobilenet_v3.js"),T=s("./src/models/mobilenet_v4/image_processing_mobilenet_v4.js"),P=s("./src/models/mobilevit/image_processing_mobilevit.js"),F=s("./src/models/nougat/image_processing_nougat.js"),C=s("./src/models/owlv2/image_processing_owlv2.js"),S=s("./src/models/owlvit/image_processing_owlvit.js"),A=s("./src/models/phi3_v/image_processing_phi3_v.js"),E=s("./src/models/pixtral/image_processing_pixtral.js"),L=s("./src/models/pvt/image_processing_pvt.js"),I=s("./src/models/qwen2_vl/image_processing_qwen2_vl.js"),z=s("./src/models/rt_detr/image_processing_rt_detr.js"),j=s("./src/models/sam/image_processing_sam.js"),D=s("./src/models/sam2/image_processing_sam2.js"),O=s("./src/models/sam3/image_processing_sam3.js"),N=s("./src/models/segformer/image_processing_segformer.js"),V=s("./src/models/siglip/image_processing_siglip.js"),B=s("./src/models/smolvlm/image_processing_smolvlm.js"),G=s("./src/models/swin2sr/image_processing_swin2sr.js"),$=s("./src/models/vit/image_processing_vit.js"),R=s("./src/models/vitmatte/image_processing_vitmatte.js"),q=s("./src/models/vitpose/image_processing_vitpose.js"),W=s("./src/models/yolos/image_processing_yolos.js")},"./src/models/janus/image_processing_janus.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{VLMImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{constructor(e){super({do_pad:!0,pad_size:{width:e.image_size,height:e.image_size},...e}),this.constant_values=this.config.background_color.map((e=>e*this.rescale_factor))}pad_image(e,t,s,r){return super.pad_image(e,t,s,{constant_values:this.constant_values,center:!0,...r})}}},"./src/models/janus/processing_janus.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{VLChatProcessor:()=>c});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=s("./src/utils/core.js"),i=s("./src/utils/tensor.js"),l=s("./src/utils/image.js");class c extends r.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;static uses_processor_config=!0;constructor(e,t,s){super(e,t,s),this.image_tag=this.config.image_tag,this.image_start_tag=this.config.image_start_tag,this.image_end_tag=this.config.image_end_tag,this.num_image_tokens=this.config.num_image_tokens}async _call(e,{images:t=null,chat_template:s="default"}={}){t?Array.isArray(t)||(t=[t]):t=await Promise.all(e.filter((e=>e.images)).flatMap((e=>e.images)).map((e=>l.RawImage.read(e))));const r=this.tokenizer,o=e=>r.encode(e,{add_special_tokens:!1}),n=r.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0,chat_template:s}).split(this.image_tag),c=n.length-1;if(t.length!==c)throw new Error(`Number of images provided (${t.length}) does not match number of "${this.image_tag}" image tags (${c})`);const[d,u,_]=r.model.convert_tokens_to_ids([this.image_tag,this.image_start_tag,this.image_end_tag]);let p=o(n[0]),m=new Array(p.length).fill(!1);for(let e=1;e0){const e=await this.image_processor(t);return e.pixel_values.unsqueeze_(0),{...f,...e}}return f}}},"./src/models/jina_clip/image_processing_jina_clip.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{JinaCLIPImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{constructor(e){const{resize_mode:t,fill_color:s,interpolation:r,size:o,...n}=e;super({...n,size:"squash"===t?{width:o,height:o}:"shortest"===t?{shortest_edge:o}:{longest_edge:o},resample:"bicubic"===r?3:2,do_center_crop:!0,crop_size:o,do_normalize:!0})}}},"./src/models/jina_clip/processing_jina_clip.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{JinaCLIPProcessor:()=>a});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends r.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;async _call(e=null,t=null,s={}){if(!e&&!t)throw new Error("Either text or images must be provided");return{...e?this.tokenizer(e,s):{},...t?await this.image_processor(t,s):{}}}}},"./src/models/llava/processing_llava.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{LlavaProcessor:()=>a});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends r.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;static uses_processor_config=!0;async _call(e,t=null,s={}){const r=await this.image_processor(e,s);if(t){const[e,s]=r.pixel_values.dims.slice(-2),{image_token:o,patch_size:n,num_additional_image_tokens:a}=this.config,i=Math.floor(e/n)*Math.floor(s/n)+a;t=structuredClone(t),Array.isArray(t)||(t=[t]);for(let e=0;e{"use strict";s.r(t),s.d(t,{LlavaOnevisionImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}},"./src/models/mask2former/image_processing_mask2former.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Mask2FormerImageProcessor:()=>o});var r=s("./src/models/maskformer/image_processing_maskformer.js");class o extends r.MaskFormerImageProcessor{}},"./src/models/maskformer/image_processing_maskformer.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{MaskFormerFeatureExtractor:()=>n,MaskFormerImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{post_process_panoptic_segmentation(...e){return(0,r.post_process_panoptic_segmentation)(...e)}post_process_instance_segmentation(...e){return(0,r.post_process_instance_segmentation)(...e)}}class n extends o{}},"./src/models/mgp_str/processing_mgp_str.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{MgpstrProcessor:()=>l});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js"),a=s("./src/utils/maths.js");const i={char:["char_decode",1],bpe:["bpe_decode",2],wp:["wp_decode",102]};class l extends r.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;get char_tokenizer(){return this.components.char_tokenizer}get bpe_tokenizer(){return this.components.bpe_tokenizer}get wp_tokenizer(){return this.components.wp_tokenizer}_decode_helper(e,t){if(!i.hasOwnProperty(t))throw new Error(`Format ${t} is not supported.`);const[s,r]=i[t],o=this[s].bind(this),[n,l]=e.dims,c=[],d=[],u=e.tolist();for(let e=0;e0?o.reduce(((e,t)=>e*t),1):0;d.push(s),c.push(n)}return[o(d),c]}char_decode(e){return this.char_tokenizer.batch_decode(e).map((e=>e.replaceAll(" ","")))}bpe_decode(e){return this.bpe_tokenizer.batch_decode(e)}wp_decode(e){return this.wp_tokenizer.batch_decode(e).map((e=>e.replaceAll(" ","")))}batch_decode([e,t,s]){const[r,o]=this._decode_helper(e,"char"),[n,i]=this._decode_helper(t,"bpe"),[l,c]=this._decode_helper(s,"wp"),d=[],u=[];for(let e=0;e{"use strict";s.r(t),s.d(t,{MobileNetV1FeatureExtractor:()=>n,MobileNetV1ImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v2/image_processing_mobilenet_v2.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{MobileNetV2FeatureExtractor:()=>n,MobileNetV2ImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v3/image_processing_mobilenet_v3.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{MobileNetV3FeatureExtractor:()=>n,MobileNetV3ImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v4/image_processing_mobilenet_v4.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{MobileNetV4FeatureExtractor:()=>n,MobileNetV4ImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}class n extends o{}},"./src/models/mobilevit/image_processing_mobilevit.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{MobileViTFeatureExtractor:()=>n,MobileViTImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}class n extends o{}},"./src/models/moonshine/feature_extraction_moonshine.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{MoonshineFeatureExtractor:()=>n});var r=s("./src/base/feature_extraction_utils.js"),o=s("./src/utils/tensor.js");class n extends r.FeatureExtractor{async _call(e){(0,r.validate_audio_inputs)(e,"MoonshineFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=[1,e.length];return{input_values:new o.Tensor("float32",e,t)}}}},"./src/models/moonshine/processing_moonshine.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{MoonshineProcessor:()=>a});var r=s("./src/models/auto/feature_extraction_auto.js"),o=s("./src/tokenizers.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=r.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/nougat/image_processing_nougat.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{NougatImageProcessor:()=>o});var r=s("./src/models/donut/image_processing_donut.js");class o extends r.DonutImageProcessor{}},"./src/models/owlv2/image_processing_owlv2.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Owlv2ImageProcessor:()=>o});var r=s("./src/models/owlvit/image_processing_owlvit.js");class o extends r.OwlViTImageProcessor{}},"./src/models/owlvit/image_processing_owlvit.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{OwlViTFeatureExtractor:()=>n,OwlViTImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{post_process_object_detection(...e){return(0,r.post_process_object_detection)(...e)}}class n extends o{}},"./src/models/owlvit/processing_owlvit.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{OwlViTProcessor:()=>a});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends r.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor}},"./src/models/paligemma/processing_paligemma.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{PaliGemmaProcessor:()=>i});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");const a="";class i extends r.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;static uses_processor_config=!1;async _call(e,t=null,s={}){t||(console.warn("You are using PaliGemma without a text prefix. It will perform as a picture-captioning model."),t=""),Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);const r=this.tokenizer.bos_token,o=this.image_processor.config.image_seq_length;let n;t.some((e=>e.includes(a)))?n=t.map((e=>{const t=e.replaceAll(a,a.repeat(o)),s=t.lastIndexOf(a),n=-1===s?0:s+7;return t.slice(0,n)+r+t.slice(n)+"\n"})):(console.warn("You are passing both `text` and `images` to `PaliGemmaProcessor`. The processor expects special image tokens in the text, as many tokens as there are images per each text. It is recommended to add `` tokens in the very beginning of your text. For this call, we will infer how many images each text has and add special tokens."),n=t.map((t=>function(e,t,s,r,o){return`${r.repeat(s*o)}${t}${e}\n`}(t,r,o,a,e.length))));const i=this.tokenizer(n,s);return{...await this.image_processor(e,s),...i}}}},"./src/models/parakeet/feature_extraction_parakeet.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{ParakeetFeatureExtractor:()=>a});var r=s("./src/base/feature_extraction_utils.js"),o=s("./src/utils/tensor.js"),n=s("./src/utils/audio.js");class a extends r.FeatureExtractor{constructor(e){super(e),this.config.mel_filters??=(0,n.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,this.config.sampling_rate/2,this.config.sampling_rate,"slaney","slaney");const t=(0,n.window_function)(this.config.win_length,"hann",{periodic:!1});this.window=new Float64Array(this.config.n_fft);const s=Math.floor((this.config.n_fft-this.config.win_length)/2);this.window.set(t,s)}async _extract_fbank_features(e){const t=this.config.preemphasis;for(let s=(e=new Float64Array(e)).length-1;s>=1;--s)e[s]-=t*e[s-1];return await(0,n.spectrogram)(e,this.window,this.window.length,this.config.hop_length,{fft_length:this.config.n_fft,power:2,mel_filters:this.config.mel_filters,log_mel:"log",mel_floor:-1/0,pad_mode:"constant",center:!0,transpose:!0,mel_offset:2**-24})}async _call(e){(0,r.validate_audio_inputs)(e,"ParakeetFeatureExtractor");const t=await this._extract_fbank_features(e),s=Math.floor((e.length+2*Math.floor(this.config.n_fft/2)-this.config.n_fft)/this.config.hop_length),n=t.data;n.fill(0,s*t.dims[1]);const[a,i]=t.dims,l=new Float64Array(i),c=new Float64Array(i);for(let e=0;e1?s-1:1;for(let e=0;e{"use strict";s.r(t),s.d(t,{Phi3VImageProcessor:()=>d});var r=s("./src/base/image_processors_utils.js"),o=s("./src/utils/tensor.js");const n=336,a=[2,3],{ceil:i,floor:l,sqrt:c}=Math;class d extends r.ImageProcessor{constructor(e){super({...e,do_normalize:!0,do_pad:!0,pad_size:"custom",do_convert_rgb:!0,do_resize:!0}),this._num_crops=e.num_crops}calc_num_image_tokens_from_image_size(e,t){const{num_img_tokens:s}=this.config;return l((l(t/n)*l(e/n)+1)*s+1+(l(t/n)+1)*c(s))}get_resize_output_image_size(e,t){const s=this._num_crops,[r,o]=e.size;let n=r/o,a=1;for(;a*Math.ceil(a/n)<=s;)a+=1;a-=1;const i=Math.floor(336*a);return[i,Math.floor(i/n)]}pad_image(e,t,s,r={}){const[o,a]=t,l=n*i(o/n),c=n*i(a/n),d=[1,1,1].map(((e,t)=>(e-this.image_mean[t])/this.image_std[t]));return super.pad_image(e,t,{width:c,height:l},{center:!0,constant_values:d,...r})}async _call(e,{num_crops:t=null}={}){if(this._num_crops=t??=this.config.num_crops,t<4||c(t)%1!=0)throw new Error("num_crops must be a square number >= 4");Array.isArray(e)||(e=[e]);const s=e.length,r=await Promise.all(e.map((e=>this.preprocess(e)))),d=r.map((e=>e.original_size)),u=r.map((e=>e.reshaped_input_size)),_=[];for(const{pixel_values:e}of r){e.unsqueeze_(0);const[s,r]=e.dims.slice(-2),i=await(0,o.interpolate_4d)(e,{size:[n,n],mode:"bicubic"});if(t>0){const d=[],u=c(t),p=l(r/u),m=l(s/u);for(let t=0;te.map((e=>n*i(e/n)))));return{pixel_values:p,original_sizes:d,reshaped_input_sizes:u,image_sizes:new o.Tensor("int64",m.flat(),[s,2]),num_img_tokens:m.map((([e,t])=>this.calc_num_image_tokens_from_image_size(t,e)))}}}},"./src/models/phi3_v/processing_phi3_v.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Phi3VProcessor:()=>l});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");s("./src/utils/image.js");const a="<|image|>",i=/<\|image_\d+\|>/g;class l extends r.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;async _call(e,t=null,{padding:s=!0,truncation:r=!0,num_crops:o=null}={}){let n,l;if(Array.isArray(e)||(e=[e]),t){l=await this.image_processor(t,{num_crops:o});const{num_img_tokens:c}=l,d=e.map(((e,t)=>e.split(i).join(a.repeat(c[t]))));n=this.tokenizer(d,{padding:s,truncation:r});const u=this.tokenizer.model.convert_tokens_to_ids([a])[0];n.input_ids.map_((e=>e==u?-e:e))}else n=this.tokenizer(e);return{...n,...l}}}},"./src/models/pixtral/image_processing_pixtral.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{PixtralImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{get_resize_output_image_size(e,t){const{longest_edge:s}=t;if(void 0===s)throw new Error("size must contain 'longest_edge'");const[r,o]=e.size,n=Math.max(r,o)/s;let a=r,i=o;n>1&&(a=Math.floor(r/n),i=Math.floor(o/n));const{patch_size:l,spatial_merge_size:c}=this.config;if(!c)throw new Error("config must contain 'spatial_merge_size'");const d=l*c;return[(Math.floor((a-1)/d)+1)*d,(Math.floor((i-1)/d)+1)*d]}}},"./src/models/pixtral/processing_pixtral.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{PixtralProcessor:()=>a});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");class a extends r.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;static uses_processor_config=!0;async _call(e,t=null,s={}){const r=await this.image_processor(e,s);if(t){const[e,s]=r.pixel_values.dims.slice(-2),{image_token:o,image_break_token:n,image_end_token:a,patch_size:i,spatial_merge_size:l}=this.config,c=i*l,d=Math.floor(e/c),u=Math.floor(s/c);t=structuredClone(t),Array.isArray(t)||(t=[t]);for(let e=0;e{"use strict";s.r(t),s.d(t,{Florence2Processor:()=>r.Florence2Processor,Gemma3nProcessor:()=>o.Gemma3nProcessor,GroundingDinoProcessor:()=>n.GroundingDinoProcessor,Idefics3Processor:()=>a.Idefics3Processor,JinaCLIPProcessor:()=>l.JinaCLIPProcessor,LlavaProcessor:()=>c.LlavaProcessor,MgpstrProcessor:()=>d.MgpstrProcessor,MoonshineProcessor:()=>u.MoonshineProcessor,OwlViTProcessor:()=>_.OwlViTProcessor,PaliGemmaProcessor:()=>p.PaliGemmaProcessor,Phi3VProcessor:()=>m.Phi3VProcessor,PixtralProcessor:()=>h.PixtralProcessor,PyAnnoteProcessor:()=>f.PyAnnoteProcessor,Qwen2VLProcessor:()=>g.Qwen2VLProcessor,Sam2Processor:()=>M.Sam2Processor,Sam2VideoProcessor:()=>M.Sam2VideoProcessor,SamProcessor:()=>w.SamProcessor,SmolVLMProcessor:()=>x.SmolVLMProcessor,SpeechT5Processor:()=>b.SpeechT5Processor,UltravoxProcessor:()=>k.UltravoxProcessor,VLChatProcessor:()=>i.VLChatProcessor,VoxtralProcessor:()=>y.VoxtralProcessor,Wav2Vec2Processor:()=>v.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>T.Wav2Vec2ProcessorWithLM,WhisperProcessor:()=>P.WhisperProcessor});var r=s("./src/models/florence2/processing_florence2.js"),o=s("./src/models/gemma3n/processing_gemma3n.js"),n=s("./src/models/grounding_dino/processing_grounding_dino.js"),a=s("./src/models/idefics3/processing_idefics3.js"),i=s("./src/models/janus/processing_janus.js"),l=s("./src/models/jina_clip/processing_jina_clip.js"),c=s("./src/models/llava/processing_llava.js"),d=s("./src/models/mgp_str/processing_mgp_str.js"),u=s("./src/models/moonshine/processing_moonshine.js"),_=s("./src/models/owlvit/processing_owlvit.js"),p=s("./src/models/paligemma/processing_paligemma.js"),m=s("./src/models/phi3_v/processing_phi3_v.js"),h=s("./src/models/pixtral/processing_pixtral.js"),f=s("./src/models/pyannote/processing_pyannote.js"),g=s("./src/models/qwen2_vl/processing_qwen2_vl.js"),w=s("./src/models/sam/processing_sam.js"),M=s("./src/models/sam2/processing_sam2.js"),x=s("./src/models/smolvlm/processing_smolvlm.js"),b=s("./src/models/speecht5/processing_speecht5.js"),k=s("./src/models/ultravox/processing_ultravox.js"),y=s("./src/models/voxtral/processing_voxtral.js"),v=s("./src/models/wav2vec2/processing_wav2vec2.js"),T=s("./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js"),P=s("./src/models/whisper/processing_whisper.js")},"./src/models/pvt/image_processing_pvt.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{PvtImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}},"./src/models/pyannote/feature_extraction_pyannote.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{PyAnnoteFeatureExtractor:()=>a});var r=s("./src/base/feature_extraction_utils.js"),o=s("./src/utils/tensor.js"),n=s("./src/utils/maths.js");class a extends r.FeatureExtractor{async _call(e){(0,r.validate_audio_inputs)(e,"PyAnnoteFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));const t=[1,1,e.length];return{input_values:new o.Tensor("float32",e,t)}}samples_to_frames(e){return(e-this.config.offset)/this.config.step}post_process_speaker_diarization(e,t){const s=t/this.samples_to_frames(t)/this.config.sampling_rate,r=[];for(const t of e.tolist()){const e=[];let o=-1;for(let s=0;s({id:e,start:t*s,end:r*s,confidence:o/(r-t)}))))}return r}}},"./src/models/pyannote/processing_pyannote.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{PyAnnoteProcessor:()=>n});var r=s("./src/base/processing_utils.js"),o=s("./src/models/pyannote/feature_extraction_pyannote.js");class n extends r.Processor{static feature_extractor_class=o.PyAnnoteFeatureExtractor;async _call(e){return await this.feature_extractor(e)}post_process_speaker_diarization(...e){return this.feature_extractor.post_process_speaker_diarization(...e)}get sampling_rate(){return this.feature_extractor.config.sampling_rate}}},"./src/models/qwen2_vl/image_processing_qwen2_vl.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Qwen2VLImageProcessor:()=>n});var r=s("./src/base/image_processors_utils.js"),o=s("./src/utils/tensor.js");class n extends r.ImageProcessor{async _call(e,...t){const{pixel_values:s,original_sizes:r,reshaped_input_sizes:n}=await super._call(e,...t);let a=s;const{temporal_patch_size:i,merge_size:l,patch_size:c}=this.config;1===a.dims[0]&&(a=(0,o.cat)(Array.from({length:i},(()=>a)),0));const d=a.dims[0]/i,u=a.dims[1],_=Math.floor(a.dims[2]/c),p=Math.floor(a.dims[3]/c);return{pixel_values:a.view(d,i,u,Math.floor(_/l),l,c,Math.floor(p/l),l,c).permute(0,3,6,4,7,2,1,5,8).view(d*_*p,u*i*c*c),image_grid_thw:new o.Tensor("int64",[d,_,p],[1,3]),original_sizes:r,reshaped_input_sizes:n}}}},"./src/models/qwen2_vl/processing_qwen2_vl.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Qwen2VLProcessor:()=>a});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js"),n=s("./src/tokenizers.js");s("./src/utils/image.js");class a extends r.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;async _call(e,t=null,...s){let r,o;if(Array.isArray(e)||(e=[e]),t&&(r=await this.image_processor(t),o=r.image_grid_thw),o){let t=this.image_processor.config.merge_size**2,s=0;const r=o.tolist();e=e.map((e=>{for(;e.includes("<|image_pad|>");){const o=Number(r[s++].reduce(((e,t)=>e*t),1n));e=e.replace("<|image_pad|>","<|placeholder|>".repeat(Math.floor(o/t)))}return e.replaceAll("<|placeholder|>","<|image_pad|>")}))}return{...this.tokenizer(e),...r}}}},"./src/models/rt_detr/image_processing_rt_detr.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{RTDetrImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{post_process_object_detection(...e){return(0,r.post_process_object_detection)(...e)}}},"./src/models/sam/image_processing_sam.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{SamImageProcessor:()=>a});var r=s("./src/base/image_processors_utils.js"),o=s("./src/utils/core.js"),n=s("./src/utils/tensor.js");class a extends r.ImageProcessor{reshape_input_points(e,t,s,r=!1){e=structuredClone(e);let a=(0,o.calculateDimensions)(e);if(3===a.length)r||(a=[1,...a]),e=[e];else if(4!==a.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");for(let r=0;re!==t.dims[s])))throw Error(`The first ${s.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new n.Tensor("int64",e.flat(1/0).map(BigInt),s)}async _call(e,{input_points:t=null,input_labels:s=null,input_boxes:r=null}={}){const o=await super._call(e);if(t&&(o.input_points=this.reshape_input_points(t,o.original_sizes,o.reshaped_input_sizes)),s){if(!o.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");o.input_labels=this.add_input_labels(s,o.input_points)}return r&&(o.input_boxes=this.reshape_input_points(r,o.original_sizes,o.reshaped_input_sizes,!0)),o}async post_process_masks(e,t,s,{mask_threshold:r=0,binarize:o=!0,pad_size:a=null}={}){const i=[],l=[(a=a??this.pad_size??this.size).height,a.width];for(let a=0;ar&&(t[s]=1);u=new n.Tensor("bool",t,u.dims)}i.push(u)}return i}generate_crop_boxes(e,t,{crop_n_layers:s=0,overlap_ratio:r=512/1500,points_per_crop:o=32,crop_n_points_downscale_factor:n=1}={}){}}},"./src/models/sam/processing_sam.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{SamProcessor:()=>n});var r=s("./src/base/processing_utils.js"),o=s("./src/models/auto/image_processing_auto.js");class n extends r.Processor{static image_processor_class=o.AutoImageProcessor;async _call(...e){return await this.image_processor(...e)}post_process_masks(...e){return this.image_processor.post_process_masks(...e)}reshape_input_points(...e){return this.image_processor.reshape_input_points(...e)}}},"./src/models/sam2/image_processing_sam2.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Sam2ImageProcessor:()=>r.SamImageProcessor});var r=s("./src/models/sam/image_processing_sam.js")},"./src/models/sam2/processing_sam2.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Sam2Processor:()=>o,Sam2VideoProcessor:()=>n});var r=s("./src/models/sam/processing_sam.js");class o extends r.SamProcessor{}class n extends o{}},"./src/models/sam3/image_processing_sam3.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Sam3ImageProcessor:()=>r.Sam2ImageProcessor});var r=s("./src/models/sam2/image_processing_sam2.js")},"./src/models/seamless_m4t/feature_extraction_seamless_m4t.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{SeamlessM4TFeatureExtractor:()=>a});var r=s("./src/base/feature_extraction_utils.js"),o=s("./src/utils/tensor.js"),n=s("./src/utils/audio.js");class a extends r.FeatureExtractor{constructor(e){super(e);const t=this.config.sampling_rate,s=(0,n.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);this.mel_filters=s,this.window=(0,n.window_function)(400,"povey",{periodic:!1})}async _extract_fbank_features(e,t){return e=e.map((e=>32768*e)),(0,n.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e,{padding:t=!0,pad_to_multiple_of:s=2,do_normalize_per_mel_bins:n=!0,return_attention_mask:a=!0}={}){(0,r.validate_audio_inputs)(e,"SeamlessM4TFeatureExtractor");let i,l=await this._extract_fbank_features(e,this.config.max_length);if(n){const[e,t]=l.dims,s=l.data;for(let r=0;r0){const s=new Float32Array(t*(e+n));s.set(r),s.fill(this.config.padding_value,r.length);const c=e+n;l=new o.Tensor(l.type,s,[c,t]),a&&(i=new o.Tensor("int64",new BigInt64Array(c),[1,c]),i.data.fill(1n,0,e))}}const[c,d]=l.dims,u=this.config.stride;if(0!==c%u)throw new Error(`The number of frames (${c}) must be a multiple of the stride (${u}).`);const _=l.view(1,Math.floor(c/u),d*u),p={input_features:_};if(a){const e=_.dims[1],t=new BigInt64Array(e);if(i){const e=i.data;for(let s=1,r=0;s{"use strict";s.r(t),s.d(t,{SegformerFeatureExtractor:()=>n,SegformerImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{post_process_semantic_segmentation(...e){return(0,r.post_process_semantic_segmentation)(...e)}}class n extends o{}},"./src/models/siglip/image_processing_siglip.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{SiglipImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}},"./src/models/smolvlm/image_processing_smolvlm.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{SmolVLMImageProcessor:()=>r.Idefics3ImageProcessor});var r=s("./src/models/idefics3/image_processing_idefics3.js")},"./src/models/smolvlm/processing_smolvlm.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{SmolVLMProcessor:()=>r.Idefics3Processor});var r=s("./src/models/idefics3/processing_idefics3.js")},"./src/models/snac/feature_extraction_snac.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{SnacFeatureExtractor:()=>o});var r=s("./src/models/dac/feature_extraction_dac.js");class o extends r.DacFeatureExtractor{}},"./src/models/speecht5/feature_extraction_speecht5.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{SpeechT5FeatureExtractor:()=>o});var r=s("./src/base/feature_extraction_utils.js");class o extends r.FeatureExtractor{}},"./src/models/speecht5/processing_speecht5.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{SpeechT5Processor:()=>a});var r=s("./src/base/processing_utils.js"),o=s("./src/tokenizers.js"),n=s("./src/models/auto/feature_extraction_auto.js");class a extends r.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=n.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/swin2sr/image_processing_swin2sr.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Swin2SRImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{pad_image(e,t,s,r={}){const[o,n,a]=t;return super.pad_image(e,t,{width:n+(s-n%s)%s,height:o+(s-o%s)%s},{mode:"symmetric",center:!1,constant_values:-1,...r})}}},"./src/models/ultravox/processing_ultravox.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{UltravoxProcessor:()=>a});var r=s("./src/models/auto/feature_extraction_auto.js"),o=s("./src/tokenizers.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=r.AutoFeatureExtractor;static uses_processor_config=!0;async _call(e,t=null,s={}){if(Array.isArray(e))throw new Error("Batched inputs are not supported yet.");let r={};if(t){const o=t.length,{input_features:n}=await this.feature_extractor(t,{...s,max_length:o}),a=Math.round(o/this.config.encoder_ds_factor+1e-4),i=1+Math.ceil(a/this.config.stack_factor);r.audio_token_len=[i],r.audio_values=n;const l=this.config.audio_placeholder;if(!e.includes(l))throw new Error(`The input text does not contain the image token ${l}.`);e=e.replaceAll(l,l.repeat(i))}return{...this.tokenizer(e,{add_special_tokens:!1,...s}),...r}}}},"./src/models/vit/image_processing_vit.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{ViTFeatureExtractor:()=>n,ViTImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{}class n extends o{}},"./src/models/vitmatte/image_processing_vitmatte.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{VitMatteImageProcessor:()=>n});var r=s("./src/base/image_processors_utils.js"),o=s("./src/utils/tensor.js");class n extends r.ImageProcessor{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);const s=await Promise.all(e.map((e=>this.preprocess(e)))),r=await Promise.all(t.map((e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0}))));return{pixel_values:(0,o.stack)(s.map(((e,t)=>(0,o.cat)([e.pixel_values,r[t].pixel_values],0))),0),original_sizes:s.map((e=>e.original_size)),reshaped_input_sizes:s.map((e=>e.reshaped_input_size))}}}},"./src/models/vitpose/image_processing_vitpose.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{VitPoseImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{post_process_pose_estimation(e,t,{threshold:s=null}={}){const r=e.tolist(),[o,n,a,i]=e.dims,l=[];for(let e=0;e{"use strict";s.r(t),s.d(t,{VoxtralProcessor:()=>l});var r=s("./src/models/auto/feature_extraction_auto.js"),o=s("./src/tokenizers.js"),n=s("./src/base/processing_utils.js"),a=s("./src/utils/tensor.js");const i="[AUDIO]";class l extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=r.AutoFeatureExtractor;static uses_processor_config=!1;async _call(e,t=null,s={}){if(Array.isArray(e))throw new Error("Batched inputs are not supported yet.");const r={};if(t){if(!e.includes(i))throw new Error(`The input text does not contain the audio token ${i}.`);Array.isArray(t)||(t=[t]);const o=e.split(i),n=o.length-1;if(n!==t.length)throw new Error(`The number of audio inputs (${t.length}) does not match the number of audio tokens in the text (${n}).`);const l=this.feature_extractor.config.n_samples,c=t.map((e=>function(e,t){const s=[];for(let r=0;re.length)),u=c.flat(),_=(await Promise.all(u.map((e=>this.feature_extractor(e,s))))).map((e=>e.input_features));r.audio_values=_.length>1?(0,a.cat)(_,0):_[0];let p=o[0];for(let e=0;e{"use strict";s.r(t),s.d(t,{Wav2Vec2FeatureExtractor:()=>n});var r=s("./src/base/feature_extraction_utils.js"),o=s("./src/utils/tensor.js");class n extends r.FeatureExtractor{_zero_mean_unit_var_norm(e){const t=e.reduce(((e,t)=>e+t),0)/e.length,s=e.reduce(((e,s)=>e+(s-t)**2),0)/e.length;return e.map((e=>(e-t)/Math.sqrt(s+1e-7)))}async _call(e){(0,r.validate_audio_inputs)(e,"Wav2Vec2FeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=e;this.config.do_normalize&&(t=this._zero_mean_unit_var_norm(t));const s=[1,t.length];return{input_values:new o.Tensor("float32",t,s),attention_mask:new o.Tensor("int64",new BigInt64Array(t.length).fill(1n),s)}}}},"./src/models/wav2vec2/processing_wav2vec2.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Wav2Vec2Processor:()=>a});var r=s("./src/tokenizers.js"),o=s("./src/models/auto/feature_extraction_auto.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=r.AutoTokenizer;static feature_extractor_class=o.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Wav2Vec2ProcessorWithLM:()=>a});var r=s("./src/tokenizers.js"),o=s("./src/models/auto/feature_extraction_auto.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=r.AutoTokenizer;static feature_extractor_class=o.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/wespeaker/feature_extraction_wespeaker.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{WeSpeakerFeatureExtractor:()=>n});var r=s("./src/base/feature_extraction_utils.js"),o=(s("./src/utils/tensor.js"),s("./src/utils/audio.js"));class n extends r.FeatureExtractor{constructor(e){super(e);const t=this.config.sampling_rate,s=(0,o.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);this.mel_filters=s,this.window=(0,o.window_function)(400,"hamming",{periodic:!1}),this.min_num_frames=this.config.min_num_frames}async _extract_fbank_features(e){return e=e.map((e=>32768*e)),(0,o.spectrogram)(e,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1.192092955078125e-7,remove_dc_offset:!0,transpose:!0,min_num_frames:this.min_num_frames})}async _call(e){(0,r.validate_audio_inputs)(e,"WeSpeakerFeatureExtractor");const t=(await this._extract_fbank_features(e)).unsqueeze_(0);if(null===this.config.fbank_centering_span){const e=t.mean(1).data,s=t.data,[r,o,n]=t.dims;for(let t=0;t{"use strict";s.r(t),s.d(t,{WHISPER_LANGUAGE_MAPPING:()=>o,WHISPER_TO_LANGUAGE_CODE_MAPPING:()=>n,whisper_language_to_code:()=>a});const r=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],o=new Map(r),n=new Map([...r.map((([e,t])=>[t,e])),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);function a(e){e=e.toLowerCase();let t=n.get(e);if(void 0===t){const s=e.match(/^<\|([a-z]{2})\|>$/);if(s&&(e=s[1]),!o.has(e)){const t=2===e.length?o.keys():o.values();throw new Error(`Language "${e}" is not supported. Must be one of: ${JSON.stringify(Array.from(t))}`)}t=e}return t}},"./src/models/whisper/feature_extraction_whisper.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{WhisperFeatureExtractor:()=>a});var r=s("./src/base/feature_extraction_utils.js"),o=(s("./src/utils/tensor.js"),s("./src/utils/audio.js")),n=s("./src/utils/maths.js");class a extends r.FeatureExtractor{constructor(e){super(e),this.config.mel_filters??=(0,o.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney"),this.window=(0,o.window_function)(this.config.n_fft,"hann")}async _extract_fbank_features(e){const t=await(0,o.spectrogram)(e,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:Math.min(Math.floor(e.length/this.config.hop_length),this.config.nb_max_frames)}),s=t.data,r=(0,n.max)(s)[0];for(let e=0;eo?(e.length>this.config.n_samples&&console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),s=e.slice(0,o)):(s=new Float32Array(o),s.set(e));return{input_features:(await this._extract_fbank_features(s)).unsqueeze_(0)}}}},"./src/models/whisper/generation_whisper.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{WhisperGenerationConfig:()=>o});var r=s("./src/generation/configuration_utils.js");class o extends r.GenerationConfig{return_timestamps=null;return_token_timestamps=null;num_frames=null;alignment_heads=null;task=null;language=null;no_timestamps_token_id=null;prompt_ids=null;is_multilingual=null;lang_to_id=null;task_to_id=null;max_initial_timestamp_index=1}},"./src/models/whisper/processing_whisper.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{WhisperProcessor:()=>a});var r=s("./src/models/auto/feature_extraction_auto.js"),o=s("./src/tokenizers.js"),n=s("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=r.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/yolos/image_processing_yolos.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{YolosFeatureExtractor:()=>n,YolosImageProcessor:()=>o});var r=s("./src/base/image_processors_utils.js");class o extends r.ImageProcessor{post_process_object_detection(...e){return(0,r.post_process_object_detection)(...e)}}class n extends o{}},"./src/ops/registry.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{TensorOpRegistry:()=>a});var r=s("./src/backends/onnx.js"),o=s("./src/utils/tensor.js");const n=async(e,t,s)=>{const n=await(0,r.createInferenceSession)(new Uint8Array(e),t);return async e=>{const t=(0,r.isONNXProxy)(),a=Object.fromEntries(Object.entries(e).map((([e,s])=>[e,(t?s.clone():s).ort_tensor]))),i=await(0,r.runInferenceSession)(n,a);return Array.isArray(s)?s.map((e=>new o.Tensor(i[e]))):new o.Tensor(i[s])}};class a{static session_options={};static get nearest_interpolate_4d(){return this._nearest_interpolate_4d||(this._nearest_interpolate_4d=n([8,10,18,0,58,129,1,10,41,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,18,10,4,109,111,100,101,34,7,110,101,97,114,101,115,116,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,21],this.session_options,"y")),this._nearest_interpolate_4d}static get bilinear_interpolate_4d(){return this._bilinear_interpolate_4d||(this._bilinear_interpolate_4d=n([8,9,18,0,58,128,1,10,40,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,17,10,4,109,111,100,101,34,6,108,105,110,101,97,114,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bilinear_interpolate_4d}static get bicubic_interpolate_4d(){return this._bicubic_interpolate_4d||(this._bicubic_interpolate_4d=n([8,9,18,0,58,127,10,39,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,16,10,4,109,111,100,101,34,5,99,117,98,105,99,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bicubic_interpolate_4d}static get matmul(){return this._matmul||(this._matmul=n([8,9,18,0,58,55,10,17,10,1,97,10,1,98,18,1,99,34,6,77,97,116,77,117,108,18,1,114,90,9,10,1,97,18,4,10,2,8,1,90,9,10,1,98,18,4,10,2,8,1,98,9,10,1,99,18,4,10,2,8,1,66,2,16,20],this.session_options,"c")),this._matmul}static get stft(){return this._stft||(this._stft=n([8,7,18,0,58,148,1,10,38,10,1,115,10,1,106,10,1,119,10,1,108,18,1,111,34,4,83,84,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,115,90,26,10,1,115,18,21,10,19,8,1,18,15,10,3,18,1,98,10,3,18,1,115,10,3,18,1,99,90,11,10,1,106,18,6,10,4,8,7,18,0,90,16,10,1,119,18,11,10,9,8,1,18,5,10,3,18,1,119,90,11,10,1,108,18,6,10,4,8,7,18,0,98,31,10,1,111,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,102,10,3,18,1,100,10,3,18,1,99,66,2,16,17],this.session_options,"o")),this._stft}static get rfft(){return this._rfft||(this._rfft=n([8,9,18,0,58,97,10,33,10,1,120,10,0,10,1,97,18,1,121,34,3,68,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,100,90,21,10,1,120,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,90,11,10,1,97,18,6,10,4,8,7,18,0,98,21,10,1,121,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,66,2,16,20],this.session_options,"y")),this._rfft}static get top_k(){return this._top_k||(this._top_k=n([8,10,18,0,58,73,10,18,10,1,120,10,1,107,18,1,118,18,1,105,34,4,84,111,112,75,18,1,116,90,9,10,1,120,18,4,10,2,8,1,90,15,10,1,107,18,10,10,8,8,7,18,4,10,2,8,1,98,9,10,1,118,18,4,10,2,8,1,98,9,10,1,105,18,4,10,2,8,7,66,2,16,21],this.session_options,["v","i"])),this._top_k}static get slice(){return this._slice||(this._slice=n([8,7,18,0,58,96,10,25,10,1,120,10,1,115,10,1,101,10,1,97,10,1,116,18,1,121,34,5,83,108,105,99,101,18,1,114,90,9,10,1,120,18,4,10,2,8,1,90,9,10,1,115,18,4,10,2,8,7,90,9,10,1,101,18,4,10,2,8,7,90,9,10,1,97,18,4,10,2,8,7,90,9,10,1,116,18,4,10,2,8,7,98,9,10,1,121,18,4,10,2,8,1,66,2,16,13],this.session_options,"y")),this._slice}}},"./src/pipelines.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{AudioClassificationPipeline:()=>C,AutomaticSpeechRecognitionPipeline:()=>A,BackgroundRemovalPipeline:()=>z,DepthEstimationPipeline:()=>G,DocumentQuestionAnsweringPipeline:()=>N,FeatureExtractionPipeline:()=>P,FillMaskPipeline:()=>M,ImageClassificationPipeline:()=>L,ImageFeatureExtractionPipeline:()=>F,ImageSegmentationPipeline:()=>I,ImageToImagePipeline:()=>B,ImageToTextPipeline:()=>E,ObjectDetectionPipeline:()=>D,Pipeline:()=>h,QuestionAnsweringPipeline:()=>w,SummarizationPipeline:()=>b,Text2TextGenerationPipeline:()=>x,TextClassificationPipeline:()=>f,TextGenerationPipeline:()=>v,TextToAudioPipeline:()=>V,TokenClassificationPipeline:()=>g,TranslationPipeline:()=>k,ZeroShotAudioClassificationPipeline:()=>S,ZeroShotClassificationPipeline:()=>T,ZeroShotImageClassificationPipeline:()=>j,ZeroShotObjectDetectionPipeline:()=>O,pipeline:()=>q});var r=s("./src/tokenizers.js"),o=s("./src/models.js"),n=s("./src/models/auto/processing_auto.js"),a=(s("./src/base/processing_utils.js"),s("./src/utils/generic.js")),i=s("./src/utils/core.js"),l=s("./src/utils/maths.js"),c=s("./src/utils/audio.js"),d=s("./src/utils/tensor.js"),u=s("./src/utils/image.js");async function _(e){return Array.isArray(e)||(e=[e]),await Promise.all(e.map((e=>u.RawImage.read(e))))}async function p(e,t){return Array.isArray(e)||(e=[e]),await Promise.all(e.map((e=>"string"==typeof e||e instanceof URL?(0,c.read_audio)(e,t):e instanceof Float64Array?new Float32Array(e):e)))}function m(e,t){t&&(e=e.map((e=>0|e)));const[s,r,o,n]=e;return{xmin:s,ymin:r,xmax:o,ymax:n}}class h extends a.Callable{constructor({task:e,model:t,tokenizer:s=null,processor:r=null}){super(),this.task=e,this.model=t,this.tokenizer=s,this.processor=r}async dispose(){await this.model.dispose()}}class f extends h{constructor(e){super(e)}async _call(e,{top_k:t=1}={}){const s=this.tokenizer(e,{padding:!0,truncation:!0}),r=await this.model(s),o="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid():e=>new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),n=this.model.config.id2label,a=[];for(const e of r.logits){const s=o(e),r=await(0,d.topk)(s,t),i=r[0].tolist(),l=r[1].tolist().map(((e,t)=>({label:n?n[e]:`LABEL_${e}`,score:i[t]})));1===t?a.push(...l):a.push(l)}return Array.isArray(e)||1===t?a:a[0]}}class g extends h{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){const s=Array.isArray(e),r=this.tokenizer(s?e:[e],{padding:!0,truncation:!0}),o=(await this.model(r)).logits,n=this.model.config.id2label,a=[];for(let e=0;ee==this.tokenizer.sep_token_id)),_=(c[e].map(((e,s)=>1==e&&(0===s||s>r&&-1===d.findIndex((e=>e==t[s]))))),o[e].tolist()),p=n[e].tolist();for(let s=1;s<_.length;++s)(0==c[e]||s<=r||-1!==d.findIndex((e=>e==t[s])))&&(_[s]=-1/0,p[s]=-1/0);const m=(0,l.softmax)(_).map(((e,t)=>[e,t])),h=(0,l.softmax)(p).map(((e,t)=>[e,t]));m[0][0]=0,h[0][0]=0;const f=(0,i.product)(m,h).filter((e=>e[0][1]<=e[1][1])).map((e=>[e[0][1],e[1][1],e[0][0]*e[1][0]])).sort(((e,t)=>t[2]-e[2]));for(let e=0;ee==this.tokenizer.mask_token_id));if(-1===a)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);const i=r[e][a],c=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(i.data),i.dims),t),u=c[0].tolist(),_=c[1].tolist();o.push(_.map(((e,t)=>{const r=s.slice();return r[a]=e,{score:u[t],token:Number(e),token_str:this.tokenizer.decode([e]),sequence:this.tokenizer.decode(r,{skip_special_tokens:!0})}})))}return Array.isArray(e)?o:o[0]}}class x extends h{_key="generated_text";constructor(e){super(e)}async _call(e,t={}){Array.isArray(e)||(e=[e]),this.model.config.prefix&&(e=e.map((e=>this.model.config.prefix+e)));const s=this.model.config.task_specific_params;s&&s[this.task]&&s[this.task].prefix&&(e=e.map((e=>s[this.task].prefix+e)));const r=this.tokenizer,o={padding:!0,truncation:!0};let n;n=this instanceof k&&"_build_translation_inputs"in r?r._build_translation_inputs(e,o,t):r(e,o);const a=await this.model.generate({...n,...t});return r.batch_decode(a,{skip_special_tokens:!0}).map((e=>({[this._key]:e})))}}class b extends x{_key="summary_text";constructor(e){super(e)}}class k extends x{_key="translation_text";constructor(e){super(e)}}function y(e){return Array.isArray(e)&&e.every((e=>"role"in e&&"content"in e))}class v extends h{constructor(e){super(e)}async _call(e,t={}){let s,r=!1,o=!1,n=t.add_special_tokens??(this.tokenizer.add_bos_token||this.tokenizer.add_eos_token)??!1;if("string"==typeof e)s=e=[e];else if(Array.isArray(e)&&e.every((e=>"string"==typeof e)))r=!0,s=e;else{if(y(e))e=[e];else{if(!Array.isArray(e)||!e.every(y))throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");r=!0}o=!0,s=e.map((e=>this.tokenizer.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0}))),n=!1}const a=!o&&(t.return_full_text??!0);this.tokenizer.padding_side="left";const i=this.tokenizer(s,{add_special_tokens:n,padding:!0,truncation:!0}),l=await this.model.generate({...i,...t}),c=this.tokenizer.batch_decode(l,{skip_special_tokens:!0});let d;!a&&i.input_ids.dims.at(-1)>0&&(d=this.tokenizer.batch_decode(i.input_ids,{skip_special_tokens:!0}).map((e=>e.length)));const u=Array.from({length:e.length},(e=>[]));for(let t=0;t[e.toLowerCase(),t]))),this.entailment_id=this.label2id.entailment,void 0===this.entailment_id&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,void 0===this.contradiction_id&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(e,t,{hypothesis_template:s="This example is {}.",multi_label:r=!1}={}){const o=Array.isArray(e);o||(e=[e]),Array.isArray(t)||(t=[t]);const n=t.map((e=>s.replace("{}",e))),a=r||1===t.length,i=[];for(const s of e){const e=[];for(const t of n){const r=this.tokenizer(s,{text_pair:t,padding:!0,truncation:!0}),o=await this.model(r);a?e.push([o.logits.data[this.contradiction_id],o.logits.data[this.entailment_id]]):e.push(o.logits.data[this.entailment_id])}const r=(a?e.map((e=>(0,l.softmax)(e)[1])):(0,l.softmax)(e)).map(((e,t)=>[e,t])).sort(((e,t)=>t[0]-e[0]));i.push({sequence:s,labels:r.map((e=>t[e[1]])),scores:r.map((e=>e[0]))})}return o?i:i[0]}}class P extends h{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:s=!1,quantize:r=!1,precision:o="binary"}={}){const n=this.tokenizer(e,{padding:!0,truncation:!0}),a=await this.model(n);let i=a.last_hidden_state??a.logits??a.token_embeddings;switch(t){case"none":break;case"mean":i=(0,d.mean_pooling)(i,n.attention_mask);break;case"first_token":case"cls":i=i.slice(null,0);break;case"last_token":case"eos":i=i.slice(null,-1);break;default:throw Error(`Pooling method '${t}' not supported.`)}return s&&(i=i.normalize(2,-1)),r&&(i=(0,d.quantize_embeddings)(i,o)),i}}class F extends h{constructor(e){super(e)}async _call(e,{pool:t=null}={}){const s=await _(e),{pixel_values:r}=await this.processor(s),o=await this.model({pixel_values:r});let n;if(t){if(!("pooler_output"in o))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");n=o.pooler_output}else n=o.last_hidden_state??o.logits??o.image_embeds;return n}}class C extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const s=this.processor.feature_extractor.config.sampling_rate,r=await p(e,s),o=this.model.config.id2label,n=[];for(const e of r){const s=await this.processor(e),r=(await this.model(s)).logits[0],a=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(r.data),r.dims),t),i=a[0].tolist(),c=a[1].tolist().map(((e,t)=>({label:o?o[e]:`LABEL_${e}`,score:i[t]})));n.push(c)}return Array.isArray(e)?n:n[0]}}class S extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:s="This is a sound of {}."}={}){const r=!Array.isArray(e);r&&(e=[e]);const o=t.map((e=>s.replace("{}",e))),n=this.tokenizer(o,{padding:!0,truncation:!0}),a=this.processor.feature_extractor.config.sampling_rate,i=await p(e,a),c=[];for(const e of i){const s=await this.processor(e),r=await this.model({...n,...s}),o=(0,l.softmax)(r.logits_per_audio.data);c.push([...o].map(((e,s)=>({score:e,label:t[s]}))))}return r?c[0]:c}}class A extends h{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"whisper":case"lite-whisper":return this._call_whisper(e,t);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":case"parakeet_ctc":return this._call_wav2vec2(e,t);case"moonshine":return this._call_moonshine(e,t);default:throw new Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(e,t){t.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),t.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');const s=!Array.isArray(e);s&&(e=[e]);const r=this.processor.feature_extractor.config.sampling_rate,o=await p(e,r),n=[];for(const e of o){const t=await this.processor(e),s=(await this.model(t)).logits[0],r=[];for(const e of s)r.push((0,l.max)(e.data)[1]);const o=this.tokenizer.decode(r,{skip_special_tokens:!0}).trim();n.push({text:o})}return s?n[0]:n}async _call_whisper(e,t){const s=t.return_timestamps??!1,r=t.chunk_length_s??0,o=t.force_full_sequences??!1;let n=t.stride_length_s??null;const a={...t};"word"===s&&(a.return_token_timestamps=!0,a.return_timestamps=!1);const i=!Array.isArray(e);i&&(e=[e]);const c=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,d=this.processor.feature_extractor.config.hop_length,u=this.processor.feature_extractor.config.sampling_rate,_=await p(e,u),m=[];for(const e of _){let t=[];if(r>0){if(null===n)n=r/6;else if(r<=n)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const s=u*r,o=u*n,a=s-2*o;let i=0;for(;;){const r=i+s,n=e.subarray(i,r),l=await this.processor(n),c=0===i,d=r>=e.length;if(t.push({stride:[n.length,c?0:o,d?0:o],input_features:l.input_features,is_last:d}),d)break;i+=a}}else t=[{stride:[e.length,0,0],input_features:(await this.processor(e)).input_features,is_last:!0}];for(const e of t){a.num_frames=Math.floor(e.stride[0]/d);const t=await this.model.generate({inputs:e.input_features,...a});"word"===s?(e.tokens=t.sequences.tolist()[0],e.token_timestamps=t.token_timestamps.tolist()[0].map((e=>(0,l.round)(e,2)))):e.tokens=t[0].tolist(),e.stride=e.stride.map((e=>e/u))}const[i,_]=this.tokenizer._decode_asr(t,{time_precision:c,return_timestamps:s,force_full_sequences:o});m.push({text:i,..._})}return i?m[0]:m}async _call_moonshine(e,t){const s=!Array.isArray(e);s&&(e=[e]);const r=this.processor.feature_extractor.config.sampling_rate,o=await p(e,r),n=[];for(const e of o){const s=await this.processor(e),o=6*Math.floor(e.length/r),a=await this.model.generate({max_new_tokens:o,...t,...s}),i=this.processor.batch_decode(a,{skip_special_tokens:!0})[0];n.push({text:i})}return s?n[0]:n}}class E extends h{constructor(e){super(e)}async _call(e,t={}){const s=Array.isArray(e),r=await _(e),{pixel_values:o}=await this.processor(r),n=[];for(const e of o){e.dims=[1,...e.dims];const s=await this.model.generate({inputs:e,...t}),r=this.tokenizer.batch_decode(s,{skip_special_tokens:!0}).map((e=>({generated_text:e.trim()})));n.push(r)}return s?n:n[0]}}class L extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){const s=await _(e),{pixel_values:r}=await this.processor(s),o=await this.model({pixel_values:r}),n=this.model.config.id2label,a=[];for(const e of o.logits){const s=await(0,d.topk)(new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),t),r=s[0].tolist(),o=s[1].tolist().map(((e,t)=>({label:n?n[e]:`LABEL_${e}`,score:r[t]})));a.push(o)}return Array.isArray(e)?a:a[0]}}class I extends h{constructor(e){super(e),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(e,{threshold:t=.5,mask_threshold:s=.5,overlap_mask_area_threshold:r=.8,label_ids_to_fuse:o=null,target_sizes:n=null,subtask:a=null}={}){if(Array.isArray(e)&&1!==e.length)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");const i=await _(e),l=i.map((e=>[e.height,e.width])),c=await this.processor(i),{inputNames:d,outputNames:p}=this.model.sessions.model;if(!d.includes("pixel_values")){if(1!==d.length)throw Error(`Expected a single input name, but got ${d.length} inputs: ${d}.`);const e=d[0];if(e in c)throw Error(`Input name ${e} already exists in the inputs.`);c[e]=c.pixel_values}const m=await this.model(c);let h=null;if(null!==a)h=this.subtasks_mapping[a];else if(this.processor.image_processor)for(const[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.image_processor){h=this.processor.image_processor[t].bind(this.processor.image_processor),a=e;break}const f=this.model.config.id2label,g=[];if(a)if("panoptic"===a||"instance"===a){const e=h(m,t,s,r,o,n??l)[0],a=e.segmentation;for(const t of e.segments_info){const e=new Uint8ClampedArray(a.data.length);for(let s=0;st<-e||t>1+e))&&o.sigmoid_();const n=await u.RawImage.fromTensor(o.mul_(255).to("uint8")).resize(r[1],r[0]);g.push({label:null,score:null,mask:n})}}return g}}class z extends I{constructor(e){super(e)}async _call(e,t={}){if(Array.isArray(e)&&1!==e.length)throw Error("Background removal pipeline currently only supports a batch size of 1.");const s=await _(e),r=await super._call(e,t);return s.map(((e,t)=>{const s=e.clone();return s.putAlpha(r[t].mask),s}))}}class j extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:s="This is a photo of {}"}={}){const r=Array.isArray(e),o=await _(e),n=t.map((e=>s.replace("{}",e))),a=this.tokenizer(n,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:i}=await this.processor(o),c=await this.model({...a,pixel_values:i}),d="siglip"===this.model.config.model_type?e=>e.sigmoid().data:e=>(0,l.softmax)(e.data),u=[];for(const e of c.logits_per_image){const s=[...d(e)].map(((e,s)=>({score:e,label:t[s]})));s.sort(((e,t)=>t.score-e.score)),u.push(s)}return r?u:u[0]}}class D extends h{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:s=!1}={}){const r=Array.isArray(e);if(r&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");const o=await _(e),n=s?null:o.map((e=>[e.height,e.width])),{pixel_values:a,pixel_mask:i}=await this.processor(o),l=await this.model({pixel_values:a,pixel_mask:i}),c=this.processor.image_processor.post_process_object_detection(l,t,n),d=this.model.config.id2label,u=c.map((e=>e.boxes.map(((t,r)=>({score:e.scores[r],label:d[e.classes[r]],box:m(t,!s)})))));return r?u:u[0]}}class O extends h{constructor(e){super(e)}async _call(e,t,{threshold:s=.1,top_k:r=null,percentage:o=!1}={}){const n=Array.isArray(e),a=await _(e),i=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(a),c=[];for(let e=0;e({score:e.scores[s],label:e.labels[s],box:m(t,!o)})))}else{const e=this.processor.image_processor.post_process_object_detection(_,s,d,!0)[0];p=e.boxes.map(((s,r)=>({score:e.scores[r],label:t[e.classes[r]],box:m(s,!o)})))}p.sort(((e,t)=>t.score-e.score)),null!==r&&(p=p.slice(0,r)),c.push(p)}return n?c:c[0]}}class N extends h{constructor(e){super(e)}async _call(e,t,s={}){const r=(await _(e))[0],{pixel_values:o}=await this.processor(r),n=`${t}`,a=this.tokenizer(n,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,i=await this.model.generate({inputs:o,max_length:this.model.config.decoder.max_position_embeddings,decoder_input_ids:a,...s}),l=this.tokenizer.batch_decode(i)[0].match(/(.*?)<\/s_answer>/);let c=null;return l&&l.length>=2&&(c=l[1].trim()),[{answer:c}]}}class V extends h{DEFAULT_VOCODER_ID="Xenova/speecht5_hifigan";constructor(e){super(e),this.vocoder=e.vocoder??null}async _prepare_speaker_embeddings(e){if(("string"==typeof e||e instanceof URL)&&(e=new Float32Array(await(await fetch(e)).arrayBuffer())),e instanceof Float32Array)e=new d.Tensor("float32",e,[e.length]);else if(!(e instanceof d.Tensor))throw new Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");return e}async _call(e,{speaker_embeddings:t=null,num_inference_steps:s,speed:r}={}){return this.processor?this._call_text_to_spectrogram(e,{speaker_embeddings:t}):"supertonic"===this.model.config.model_type?this._call_supertonic(e,{speaker_embeddings:t,num_inference_steps:s,speed:r}):this._call_text_to_waveform(e)}async _call_supertonic(e,{speaker_embeddings:t,num_inference_steps:s,speed:r}){if(!t)throw new Error("Speaker embeddings must be provided for Supertonic models.");t=await this._prepare_speaker_embeddings(t);const{sampling_rate:o,style_dim:n}=this.model.config;t=t.view(1,-1,n);const a=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:i}=await this.model.generate_speech({...a,style:t,num_inference_steps:s,speed:r});return new c.RawAudio(i.data,o)}async _call_text_to_waveform(e){const t=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:s}=await this.model(t),r=this.model.config.sampling_rate;return new c.RawAudio(s.data,r)}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await o.AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{dtype:"fp32"}));const{input_ids:s}=this.tokenizer(e,{padding:!0,truncation:!0});t=(t=await this._prepare_speaker_embeddings(t)).view(1,-1);const{waveform:r}=await this.model.generate_speech(s,t,{vocoder:this.vocoder}),n=this.processor.feature_extractor.config.sampling_rate;return new c.RawAudio(r.data,n)}}class B extends h{constructor(e){super(e)}async _call(e){const t=await _(e),s=await this.processor(t),r=await this.model(s),o=[];for(const e of r.reconstruction){const t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");o.push(u.RawImage.fromTensor(t))}return o.length>1?o:o[0]}}class G extends h{constructor(e){super(e)}async _call(e){const t=await _(e),s=await this.processor(t),{predicted_depth:r}=await this.model(s),o=[];for(let e=0;e1?o:o[0]}}const $=Object.freeze({"text-classification":{tokenizer:r.AutoTokenizer,pipeline:f,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:r.AutoTokenizer,pipeline:g,model:o.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:r.AutoTokenizer,pipeline:w,model:o.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:r.AutoTokenizer,pipeline:M,model:o.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:r.AutoTokenizer,pipeline:b,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:r.AutoTokenizer,pipeline:k,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:r.AutoTokenizer,pipeline:x,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:r.AutoTokenizer,pipeline:v,model:o.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:r.AutoTokenizer,pipeline:T,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:C,model:o.AutoModelForAudioClassification,processor:n.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:r.AutoTokenizer,pipeline:S,model:o.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:r.AutoTokenizer,pipeline:A,model:[o.AutoModelForSpeechSeq2Seq,o.AutoModelForCTC],processor:n.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:r.AutoTokenizer,pipeline:V,model:[o.AutoModelForTextToWaveform,o.AutoModelForTextToSpectrogram],processor:[n.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:r.AutoTokenizer,pipeline:E,model:o.AutoModelForVision2Seq,processor:n.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:L,model:o.AutoModelForImageClassification,processor:n.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:I,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"background-removal":{pipeline:z,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/modnet"},type:"image"},"zero-shot-image-classification":{tokenizer:r.AutoTokenizer,pipeline:j,model:o.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:D,model:o.AutoModelForObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:r.AutoTokenizer,pipeline:O,model:o.AutoModelForZeroShotObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:r.AutoTokenizer,pipeline:N,model:o.AutoModelForDocumentQuestionAnswering,processor:n.AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:B,model:o.AutoModelForImageToImage,processor:n.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:G,model:o.AutoModelForDepthEstimation,processor:n.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:r.AutoTokenizer,pipeline:P,model:o.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:n.AutoProcessor,pipeline:F,model:[o.AutoModelForImageFeatureExtraction,o.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),R=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function q(e,t=null,{progress_callback:s=null,config:r=null,cache_dir:o=null,local_files_only:n=!1,revision:a="main",device:l=null,dtype:c=null,subfolder:d="onnx",use_external_data_format:u=null,model_file_name:_=null,session_options:p={}}={}){e=R[e]??e;const m=$[e.split("_",1)[0]];if(!m)throw Error(`Unsupported pipeline: ${e}. Must be one of [${Object.keys($)}]`);t||(t=m.default.model,console.log(`No model specified. Using default model: "${t}".`));const h={progress_callback:s,config:r,cache_dir:o,local_files_only:n,revision:a,device:l,dtype:c,subfolder:d,use_external_data_format:u,model_file_name:_,session_options:p},f=new Map([["tokenizer",m.tokenizer],["model",m.model],["processor",m.processor]]),g=await async function(e,t,s){const r=Object.create(null),o=[];for(const[n,a]of e.entries()){if(!a)continue;let e;e=Array.isArray(a)?new Promise((async(e,r)=>{let o;for(const n of a){if(null===n)return void e(null);try{return void e(await n.from_pretrained(t,s))}catch(e){if(e.message?.includes("Unsupported model type"))o=e;else{if(!e.message?.includes("Could not locate file"))return void r(e);o=e}}}r(o)})):a.from_pretrained(t,s),r[n]=e,o.push(e)}await Promise.all(o);for(const[e,t]of Object.entries(r))r[e]=await t;return r}(f,t,h);g.task=e,(0,i.dispatchCallback)(s,{status:"ready",task:e,model:t});return new(0,m.pipeline)(g)}},"./src/tokenizers.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{AlbertTokenizer:()=>Te,AutoTokenizer:()=>gt,BartTokenizer:()=>Ve,BertTokenizer:()=>ve,BlenderbotSmallTokenizer:()=>ut,BlenderbotTokenizer:()=>dt,BloomTokenizer:()=>Re,CLIPTokenizer:()=>at,CamembertTokenizer:()=>ze,CodeGenTokenizer:()=>nt,CodeLlamaTokenizer:()=>Ue,CohereTokenizer:()=>ht,ConvBertTokenizer:()=>Ee,DebertaTokenizer:()=>Ce,DebertaV2Tokenizer:()=>Se,DistilBertTokenizer:()=>Ie,ElectraTokenizer:()=>De,EsmTokenizer:()=>Ye,FalconTokenizer:()=>He,GPT2Tokenizer:()=>Ne,GPTNeoXTokenizer:()=>Je,GemmaTokenizer:()=>Ze,Grok1Tokenizer:()=>et,HerbertTokenizer:()=>Ae,LlamaTokenizer:()=>We,M2M100Tokenizer:()=>rt,MBart50Tokenizer:()=>Ge,MBartTokenizer:()=>Be,MPNetTokenizer:()=>Xe,MarianTokenizer:()=>lt,MgpstrTokenizer:()=>ft,MobileBertTokenizer:()=>Pe,NllbTokenizer:()=>st,NougatTokenizer:()=>pt,PreTrainedTokenizer:()=>ye,Qwen2Tokenizer:()=>Ke,RoFormerTokenizer:()=>Le,RobertaTokenizer:()=>$e,SiglipTokenizer:()=>it,SpeechT5Tokenizer:()=>_t,SqueezeBertTokenizer:()=>Fe,T5Tokenizer:()=>Oe,TokenizerModel:()=>y,VitsTokenizer:()=>mt,Wav2Vec2CTCTokenizer:()=>ct,WhisperTokenizer:()=>ot,XLMRobertaTokenizer:()=>Qe,XLMTokenizer:()=>je,is_chinese_char:()=>g});var r=s("./src/utils/generic.js"),o=s("./src/utils/core.js"),n=s("./src/utils/hub.js"),a=s("./src/utils/maths.js"),i=s("./src/utils/tensor.js"),l=s("./src/utils/data-structures.js"),c=s("./node_modules/@huggingface/jinja/dist/index.js"),d=s("./src/models/whisper/common_whisper.js");async function u(e,t){const s=await Promise.all([(0,n.getModelJSON)(e,"tokenizer.json",!0,t),(0,n.getModelJSON)(e,"tokenizer_config.json",!0,t)]);return null!==t.legacy&&(s[1].legacy=t.legacy),s}function _(e,t=!0){if(void 0!==e.Regex){let t=e.Regex.replace(/\\([#&~])/g,"$1");for(const[e,s]of b)t=t.replaceAll(e,s);return new RegExp(t,"gu")}if(void 0!==e.String){const s=(0,o.escapeRegExp)(e.String);return new RegExp(t?s:`(${s})`,"gu")}return console.warn("Unknown pattern type:",e),null}function p(e){return new Map(Object.entries(e))}function m(e){const t=e.dims;switch(t.length){case 1:return e.tolist();case 2:if(1!==t[0])throw new Error("Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.");return e.tolist()[0];default:throw new Error(`Expected tensor to have 1-2 dimensions, got ${t.length}.`)}}function h(e){return e.replace(/ \./g,".").replace(/ \?/g,"?").replace(/ \!/g,"!").replace(/ ,/g,",").replace(/ \' /g,"'").replace(/ n\'t/g,"n't").replace(/ \'m/g,"'m").replace(/ \'s/g,"'s").replace(/ \'ve/g,"'ve").replace(/ \'re/g,"'re")}function f(e){return e.replace(/\p{M}/gu,"")}function g(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=63744&&e<=64255||e>=194560&&e<=195103}const w="\\p{P}\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E",M=new RegExp(`^[${w}]+$`,"gu"),x=".,!?…。,、।۔،",b=new Map([["(?i:'s|'t|'re|'ve|'m|'ll|'d)","(?:'([sS]|[tT]|[rR][eE]|[vV][eE]|[mM]|[lL][lL]|[dD]))"],["(?i:[sdmt]|ll|ve|re)","(?:[sS]|[dD]|[mM]|[tT]|[lL][lL]|[vV][eE]|[rR][eE])"],["[^\\r\\n\\p{L}\\p{N}]?+","[^\\r\\n\\p{L}\\p{N}]?"],["[^\\s\\p{L}\\p{N}]++","[^\\s\\p{L}\\p{N}]+"],[` ?[^(\\s|[${x}])]+`,` ?[^\\s${x}]+`]]);class k{constructor(e){this.content=e.content,this.id=e.id,this.single_word=e.single_word??!1,this.lstrip=e.lstrip??!1,this.rstrip=e.rstrip??!1,this.special=e.special??!1,this.normalized=e.normalized??null}}class y extends r.Callable{constructor(e){super(),this.config=e,this.vocab=[],this.tokens_to_ids=new Map,this.unk_token_id=void 0,this.unk_token=void 0,this.end_of_word_suffix=void 0,this.fuse_unk=this.config.fuse_unk??!1}static fromConfig(e,...t){switch(e.type){case"WordPiece":return new v(e);case"Unigram":return new T(e,...t);case"BPE":return new C(e);default:if(e.vocab)return Array.isArray(e.vocab)?new T(e,...t):Object.hasOwn(e,"continuing_subword_prefix")&&Object.hasOwn(e,"unk_token")?Object.hasOwn(e,"merges")?new C(e):new v(e):new S(e,...t);throw new Error(`Unknown TokenizerModel type: ${e.type}`)}}_call(e){return e=this.encode(e),this.fuse_unk&&(e=function(e,t,s){const r=[];let o=0;for(;othis.tokens_to_ids.get(e)??this.unk_token_id))}convert_ids_to_tokens(e){return e.map((e=>this.vocab[e]??this.unk_token))}}class v extends y{constructor(e){super(e),this.tokens_to_ids=p(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.max_input_chars_per_word=e.max_input_chars_per_word??100,this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e}encode(e){const t=[];for(const s of e){const e=[...s];if(e.length>this.max_input_chars_per_word){t.push(this.unk_token);continue}let r=!1,o=0;const n=[];for(;o0&&(r=this.config.continuing_subword_prefix+r),this.tokens_to_ids.has(r)){s=r;break}--t}if(null===s){r=!0;break}n.push(s),o=t}r?t.push(this.unk_token):t.push(...n)}return t}}class T extends y{constructor(e,t){super(e);const s=e.vocab.length;this.vocab=new Array(s),this.scores=new Array(s);for(let t=0;t[e,t]))),this.bos_token=" ",this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=t.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.unk_token=this.vocab[this.unk_token_id],this.minScore=(0,a.min)(this.scores)[0],this.unk_score=this.minScore-10,this.scores[this.unk_token_id]=this.unk_score,this.trie=new l.CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(e){const t=e.chars;let s=0;for(;s{const e=[...Array.from({length:"~".charCodeAt(0)-"!".charCodeAt(0)+1},((e,t)=>t+"!".charCodeAt(0))),...Array.from({length:"¬".charCodeAt(0)-"¡".charCodeAt(0)+1},((e,t)=>t+"¡".charCodeAt(0))),...Array.from({length:"ÿ".charCodeAt(0)-"®".charCodeAt(0)+1},((e,t)=>t+"®".charCodeAt(0)))],t=e.slice();let s=0;for(let r=0;r<256;++r)e.includes(r)||(e.push(r),t.push(256+s),s+=1);const r=t.map((e=>String.fromCharCode(e)));return Object.fromEntries(e.map(((e,t)=>[e,r[t]])))})(),F=(0,o.reverseDictionary)(P);class C extends y{constructor(e){super(e),this.tokens_to_ids=p(e.vocab),this.unk_token_id=this.tokens_to_ids.get(e.unk_token),this.unk_token=e.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e;const t=Array.isArray(e.merges[0]);this.merges=t?e.merges:e.merges.map((e=>e.split(" ",2))),this.bpe_ranks=new Map(this.merges.map(((e,t)=>[JSON.stringify(e),t]))),this.end_of_word_suffix=e.end_of_word_suffix,this.continuing_subword_suffix=e.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.max_length_to_cache=256,this.cache_capacity=1e4,this.cache=new l.LRUCache(this.cache_capacity)}clear_cache(){this.cache.clear()}bpe(e){if(0===e.length)return[];const t=this.cache.get(e);if(void 0!==t)return t;const s=Array.from(e);this.end_of_word_suffix&&(s[s.length-1]+=this.end_of_word_suffix);let r=[];if(s.length>1){const e=new l.PriorityQueue(((e,t)=>e.score`<0x${e.toString(16).toUpperCase().padStart(2,"0")}>`));e.every((e=>this.tokens_to_ids.has(e)))?t.push(...e):t.push(this.unk_token)}else t.push(this.unk_token)}return t}}class S extends y{constructor(e,t){super(e),this.tokens_to_ids=p(t.target_lang?e.vocab[t.target_lang]:e.vocab),this.bos_token=t.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=t.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=t.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=t.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[e,t]of this.tokens_to_ids)this.vocab[t]=e}encode(e){return e}}class A extends r.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"BertNormalizer":return new $(e);case"Precompiled":return new me(e);case"Sequence":return new G(e);case"Replace":return new E(e);case"NFC":return new I(e);case"NFD":return new z(e);case"NFKC":return new j(e);case"NFKD":return new D(e);case"Strip":return new O(e);case"StripAccents":return new N(e);case"Lowercase":return new V(e);case"Prepend":return new B(e);default:throw new Error(`Unknown Normalizer type: ${e.type}`)}}normalize(e){throw Error("normalize should be implemented in subclass.")}_call(e){return this.normalize(e)}}class E extends A{normalize(e){const t=_(this.config.pattern);return null===t?e:e.replaceAll(t,this.config.content)}}class L extends A{form=void 0;normalize(e){return e=e.normalize(this.form)}}class I extends L{form="NFC"}class z extends L{form="NFD"}class j extends L{form="NFKC"}class D extends L{form="NFKD"}class O extends A{normalize(e){return this.config.strip_left&&this.config.strip_right?e=e.trim():(this.config.strip_left&&(e=e.trimStart()),this.config.strip_right&&(e=e.trimEnd())),e}}class N extends A{normalize(e){return e=f(e)}}class V extends A{normalize(e){return e=e.toLowerCase()}}class B extends A{normalize(e){return e=this.config.prepend+e}}class G extends A{constructor(e){super(e),this.normalizers=e.normalizers.map((e=>A.fromConfig(e)))}normalize(e){return this.normalizers.reduce(((e,t)=>t.normalize(e)),e)}}class $ extends A{_tokenize_chinese_chars(e){const t=[];for(let s=0;sthis.pre_tokenize_text(e,t))):this.pre_tokenize_text(e,t)).flat()}_call(e,t){return this.pre_tokenize(e,t)}}class q extends R{constructor(e){super(),this.pattern=new RegExp(`[^\\s${w}]+|[${w}]`,"gu")}pre_tokenize_text(e,t){return e.trim().match(this.pattern)||[]}}class W extends R{constructor(e){super(),this.config=e,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,this.byte_encoder=P,this.text_encoder=new TextEncoder}pre_tokenize_text(e,t){this.add_prefix_space&&!e.startsWith(" ")&&(e=" "+e);return(this.use_regex?e.match(this.pattern)||[]:[e]).map((e=>Array.from(this.text_encoder.encode(e),(e=>this.byte_encoder[e])).join("")))}}class U extends R{constructor(e){super(),this.config=e,this.pattern=_(this.config.pattern,this.config.invert)}pre_tokenize_text(e,t){return null===this.pattern?[]:this.config.invert?e.match(this.pattern)||[]:"removed"===this.config.behavior?.toLowerCase()?e.split(this.pattern).filter((e=>e)):function(e,t){const s=[];let r=0;for(const o of e.matchAll(t)){const t=o[0];r0&&s.push(t),r=o.index+t.length}return rH.fromConfig(e)))}post_process(e,t=null,s={}){let r;for(const o of this.processors)if(o instanceof Z){if(e=o.post_process(e).tokens,t){t=o.post_process(t).tokens}}else{const n=o.post_process(e,t,s);e=n.tokens,r=n.token_type_ids}return{tokens:e,token_type_ids:r}}}class te extends r.Callable{constructor(e){super(),this.config=e,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=e.trim_offsets}static fromConfig(e){if(null===e)return null;switch(e.type){case"WordPiece":return new ae(e);case"Metaspace":return new pe(e);case"ByteLevel":return new ie(e);case"Replace":return new se(e);case"ByteFallback":return new re(e);case"Fuse":return new oe(e);case"Strip":return new ne(e);case"Sequence":return new ce(e);case"CTC":return new le(e);case"BPEDecoder":return new de(e);default:throw new Error(`Unknown Decoder type: ${e.type}`)}}_call(e){return this.decode(e)}decode(e){return this.decode_chain(e).join("")}decode_chain(e){throw Error("`decode_chain` should be implemented in subclass.")}}class se extends te{decode_chain(e){const t=_(this.config.pattern);return null===t?e:e.map((e=>e.replaceAll(t,this.config.content)))}}class re extends te{constructor(e){super(e),this.text_decoder=new TextDecoder}decode_chain(e){const t=[];let s=[];for(const r of e){let e=null;if(6===r.length&&r.startsWith("<0x")&&r.endsWith(">")){const t=parseInt(r.slice(3,5),16);isNaN(t)||(e=t)}if(null!==e)s.push(e);else{if(s.length>0){const e=this.text_decoder.decode(Uint8Array.from(s));t.push(e),s=[]}t.push(r)}}if(s.length>0){const e=this.text_decoder.decode(Uint8Array.from(s));t.push(e),s=[]}return t}}class oe extends te{decode_chain(e){return[e.join("")]}}class ne extends te{constructor(e){super(e),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(e){return e.map((e=>{let t=0;for(let s=0;s(0!==t&&(e=e.startsWith(this.config.prefix)?e.replace(this.config.prefix,""):" "+e),this.cleanup&&(e=h(e)),e)))}}class ie extends te{constructor(e){super(e),this.byte_decoder=F,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(e){const t=e.join(""),s=new Uint8Array([...t].map((e=>this.byte_decoder[e])));return this.text_decoder.decode(s)}decode_chain(e){const t=[];let s=[];for(const r of e)void 0!==this.added_tokens.find((e=>e.content===r))?(s.length>0&&(t.push(this.convert_tokens_to_string(s)),s=[]),t.push(r)):s.push(r);return s.length>0&&t.push(this.convert_tokens_to_string(s)),t}}class le extends te{constructor(e){super(e),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string(e){if(0===e.length)return"";const t=[e[0]];for(let s=1;se!==this.pad_token)).join("");return this.cleanup&&(s=h(s).replaceAll(this.word_delimiter_token," ").trim()),s}decode_chain(e){return[this.convert_tokens_to_string(e)]}}class ce extends te{constructor(e){super(e),this.decoders=e.decoders.map((e=>te.fromConfig(e)))}decode_chain(e){return this.decoders.reduce(((e,t)=>t.decode_chain(e)),e)}}class de extends te{constructor(e){super(e),this.suffix=this.config.suffix}decode_chain(e){return e.map(((t,s)=>t.replaceAll(this.suffix,s===e.length-1?"":" ")))}}class ue extends te{decode_chain(e){let t="";for(let s=1;se.normalize("NFKC"))).join("~")}else e=e.normalize("NFKC");return e}}class he extends R{constructor(e){super(),this.tokenizers=e.pretokenizers.map((e=>R.fromConfig(e)))}pre_tokenize_text(e,t){return this.tokenizers.reduce(((e,s)=>s.pre_tokenize(e,t)),[e])}}class fe extends R{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\w+|[^\w\s]+/g)||[]}}class ge extends R{constructor(e){super()}pre_tokenize_text(e,t){return function(e){return e.match(/\S+/g)||[]}(e)}}class we extends R{constructor(e){super(),this.config=e,this.pattern=_(this.config.pattern),this.content=this.config.content}pre_tokenize_text(e,t){return null===this.pattern?[e]:[e.replaceAll(this.pattern,this.config.content)]}}class Me extends R{constructor(e){super(),this._length=e.length}pre_tokenize_text(e,t){const s=[];for(let t=0;te.content))),this.added_tokens_map=new Map(this.added_tokens.map((e=>[e.content,e]))),this.mask_token=this.getToken("mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken("pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken("sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.unk_token=this.getToken("unk_token"),this.unk_token_id=this.model.tokens_to_ids.get(this.unk_token),this.bos_token=this.getToken("bos_token"),this.bos_token_id=this.model.tokens_to_ids.get(this.bos_token),this.eos_token=this.getToken("eos_token"),this.eos_token_id=this.model.tokens_to_ids.get(this.eos_token),this.model_max_length=t.model_max_length,this.remove_space=t.remove_space,this.clean_up_tokenization_spaces=t.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=t.do_lowercase_and_remove_accent??!1,t.padding_side&&(this.padding_side=t.padding_side),this.add_bos_token=t.add_bos_token,this.add_eos_token=t.add_eos_token,this.legacy=!1,this.chat_template=t.chat_template??null,Array.isArray(this.chat_template)){const e=Object.create(null);for(const{name:t,template:s}of this.chat_template){if("string"!=typeof t||"string"!=typeof s)throw new Error('Chat template must be a list of objects with "name" and "template" properties');e[t]=s}this.chat_template=e}this._compiled_template_cache=new Map}getToken(...e){for(const t of e){const e=this.config[t];if(e){if("object"==typeof e){if("AddedToken"===e.__type)return e.content;throw Error(`Unknown token: ${e}`)}return e}}return null}static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:r=null,local_files_only:o=!1,revision:n="main",legacy:a=null}={}){return new this(...await u(e,{progress_callback:t,config:s,cache_dir:r,local_files_only:o,revision:n,legacy:a}))}_call(e,{text_pair:t=null,add_special_tokens:s=!0,padding:r=!1,truncation:o=null,max_length:n=null,return_tensor:l=!0,return_token_type_ids:c=null}={}){const d=Array.isArray(e);let u;if(d){if(0===e.length)throw Error("text array must be non-empty");if(null!==t){if(!Array.isArray(t))throw Error("text_pair must also be an array");if(e.length!==t.length)throw Error("text and text_pair must have the same length");u=e.map(((e,r)=>this._encode_plus(e,{text_pair:t[r],add_special_tokens:s,return_token_type_ids:c})))}else u=e.map((e=>this._encode_plus(e,{add_special_tokens:s,return_token_type_ids:c})))}else{if(null==e)throw Error("text may not be null or undefined");if(Array.isArray(t))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");u=[this._encode_plus(e,{text_pair:t,add_special_tokens:s,return_token_type_ids:c})]}if(null===n?n=this.model_max_length:null===o&&(!0===r?(console.warn("`max_length` is ignored when `padding: true` and there is no truncation strategy. To pad to max length, use `padding: 'max_length'`."),n=this.model_max_length):!1===r&&(console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation: true` to explicitly truncate examples to max length."),o=!0)),!0===r&&(n=Math.min((0,a.max)(u.map((e=>e.input_ids.length)))[0],n??1/0)),n=Math.min(n,this.model_max_length??1/0),r||o)for(let e=0;en?o&&ke(u[e],n):r&&be(u[e],n,(e=>"input_ids"===e?this.pad_token_id:0),this.padding_side));const _={};if(l){if((!r||!o)&&u.some((e=>{for(const t of Object.keys(e))if(e[t].length!==u[0][t]?.length)return!0;return!1})))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");const e=[u.length,u[0].input_ids.length];for(const t of Object.keys(u[0]))_[t]=new i.Tensor("int64",BigInt64Array.from(u.flatMap((e=>e[t])).map(BigInt)),e)}else{for(const e of Object.keys(u[0]))_[e]=u.map((t=>t[e]));if(!d)for(const e of Object.keys(_))_[e]=_[e][0]}return _}_encode_text(e){if(null===e)return null;const t=this.added_tokens_splitter.split(e);for(let e=0;e0&&(t[e-1]=t[e-1].trimEnd()),s.rstrip&&e{if(0===e.length)return[];if(this.added_tokens_map.has(e))return[e];if(!0===this.remove_space&&(e=e.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(e=function(e){return f(e.toLowerCase())}(e)),null!==this.normalizer&&(e=this.normalizer(e)),0===e.length)return[];const s=null!==this.pre_tokenizer?this.pre_tokenizer(e,{section_index:t}):[e];return this.model(s)}));return s}_encode_plus(e,{text_pair:t=null,add_special_tokens:s=!0,return_token_type_ids:r=null}={}){const{tokens:o,token_type_ids:n}=this._tokenize_helper(e,{pair:t,add_special_tokens:s}),a=this.model.convert_tokens_to_ids(o),i={input_ids:a,attention_mask:new Array(a.length).fill(1)};return(r??this.return_token_type_ids)&&n&&(i.token_type_ids=n),i}_tokenize_helper(e,{pair:t=null,add_special_tokens:s=!1}={}){const r=this._encode_text(e),n=this._encode_text(t);return this.post_processor?this.post_processor(r,n,{add_special_tokens:s}):{tokens:(0,o.mergeArrays)(r??[],n??[])}}tokenize(e,{pair:t=null,add_special_tokens:s=!1}={}){return this._tokenize_helper(e,{pair:t,add_special_tokens:s}).tokens}encode(e,{text_pair:t=null,add_special_tokens:s=!0,return_token_type_ids:r=null}={}){return this._encode_plus(e,{text_pair:t,add_special_tokens:s,return_token_type_ids:r}).input_ids}batch_decode(e,t={}){return e instanceof i.Tensor&&(e=e.tolist()),e.map((e=>this.decode(e,t)))}decode(e,t={}){if(e instanceof i.Tensor&&(e=m(e)),!Array.isArray(e)||0===e.length||!(0,o.isIntegralNumber)(e[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(e,t)}decode_single(e,{skip_special_tokens:t=!1,clean_up_tokenization_spaces:s=null}){let r=this.model.convert_ids_to_tokens(e);t&&(r=r.filter((e=>!this.special_tokens.includes(e))));let o=this.decoder?this.decoder(r):r.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(o=o.replaceAll(this.decoder.end_of_word_suffix," "),t&&(o=o.trim())),(s??this.clean_up_tokenization_spaces)&&(o=h(o)),o}get_chat_template({chat_template:e=null,tools:t=null}={}){if(this.chat_template&&"object"==typeof this.chat_template){const s=this.chat_template;if(null!==e&&Object.hasOwn(s,e))e=s[e];else if(null===e)if(null!==t&&"tool_use"in s)e=s.tool_use;else{if(!("default"in s))throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(s).sort()}.`);e=s.default}}else if(null===e){if(!this.chat_template)throw Error("Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating");e=this.chat_template}return e}apply_chat_template(e,{tools:t=null,documents:s=null,chat_template:r=null,add_generation_prompt:o=!1,tokenize:n=!0,padding:a=!1,truncation:i=!1,max_length:l=null,return_tensor:d=!0,return_dict:u=!1,tokenizer_kwargs:_={},...p}={}){if("string"!=typeof(r=this.get_chat_template({chat_template:r,tools:t})))throw Error("chat_template must be a string, but got "+typeof r);let m=this._compiled_template_cache.get(r);void 0===m&&(m=new c.Template(r),this._compiled_template_cache.set(r,m));const h=Object.create(null);for(const e of xe){const t=this.getToken(e);t&&(h[e]=t)}const f=m.render({messages:e,add_generation_prompt:o,tools:t,documents:s,...h,...p});if(n){const e=this._call(f,{add_special_tokens:!1,padding:a,truncation:i,max_length:l,return_tensor:d,..._});return u?e:e.input_ids}return f}}class ve extends ye{return_token_type_ids=!0}class Te extends ye{return_token_type_ids=!0}class Pe extends ye{return_token_type_ids=!0}class Fe extends ye{return_token_type_ids=!0}class Ce extends ye{return_token_type_ids=!0}class Se extends ye{return_token_type_ids=!0}class Ae extends ye{return_token_type_ids=!0}class Ee extends ye{return_token_type_ids=!0}class Le extends ye{return_token_type_ids=!0}class Ie extends ye{}class ze extends ye{}class je extends ye{return_token_type_ids=!0;constructor(e,t){super(e,t),console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class De extends ye{return_token_type_ids=!0}class Oe extends ye{}class Ne extends ye{}class Ve extends ye{}class Be extends ye{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))),this.lang_to_token=e=>e}_build_translation_inputs(e,t,s){return tt(this,e,t,s)}}class Ge extends Be{}class $e extends ye{}class Re extends ye{}const qe="▁";class We extends ye{padding_side="left";constructor(e,t){super(e,t),this.legacy=t.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new _e({replacement:qe,prepend_scheme:"first"}))}_encode_text(e){if(null===e)return null;if(this.legacy||0===e.length)return super._encode_text(e);let t=super._encode_text(qe+e.replaceAll(qe," "));return t.length>1&&t[0]===qe&&this.special_tokens.includes(t[1])&&(t=t.slice(1)),t}}class Ue extends ye{}class Qe extends ye{}class Xe extends ye{}class He extends ye{}class Je extends ye{}class Ye extends ye{}class Ke extends ye{}class Ze extends ye{}class et extends ye{}function tt(e,t,s,r){if(!("language_codes"in e)||!Array.isArray(e.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in e&&e.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in e)||"function"!=typeof e.lang_to_token)throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const o=r.src_lang,n=r.tgt_lang;if(!e.language_codes.includes(n))throw new Error(`Target language code "${n}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);if(void 0!==o){if(!e.language_codes.includes(o))throw new Error(`Source language code "${o}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);for(const t of e.post_processor.config.single)if("SpecialToken"in t&&e.languageRegex.test(t.SpecialToken.id)){t.SpecialToken.id=e.lang_to_token(o);break}}return r.forced_bos_token_id=e.model.convert_tokens_to_ids([e.lang_to_token(n)])[0],e._call(t,s)}class st extends ye{constructor(e,t){super(e,t),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))),this.lang_to_token=e=>e}_build_translation_inputs(e,t,s){return tt(this,e,t,s)}}class rt extends ye{constructor(e,t){super(e,t),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter((e=>this.languageRegex.test(e))).map((e=>e.slice(2,-2))),this.lang_to_token=e=>`__${e}__`}_build_translation_inputs(e,t,s){return tt(this,e,t,s)}}class ot extends ye{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr(e,{return_timestamps:t=!1,return_language:s=!1,time_precision:r=null,force_full_sequences:o=!0}={}){if(null===r)throw Error("Must specify time_precision");let n=null;const i="word"===t;function l(){return{language:n,timestamp:[null,null],text:""}}const c=[];let u=l(),_=0;const p=this.timestamp_begin,m=p+1500;let h=[],f=[],g=!1,w=null;const x=new Set(this.all_special_ids);for(const s of e){const e=s.tokens,o=i?s.token_timestamps:null;let b=null,k=p;if("stride"in s){const[t,o,n]=s.stride;if(_-=o,w=t-n,o&&(k=o/r+p),n)for(let t=e.length-1;t>=0;--t){const s=Number(e[t]);if(s>=p){if(null!==b&&(s-p)*r=p&&w<=m){const e=(w-p)*r+_,t=(0,a.round)(e,2);if(null!==b&&w>=b)g=!0;else if(g||h.length>0&&w0?(h.push(y),i&&f.push(v)):h.every((e=>0===e.length))&&(u=l(),h=[],y=[],f=[],v=[])}if(h.length>0){if(o&&t)throw new Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");const[e,s]=this.findLongestCommonSequence(h,f),r=this.decode(e);u.text=r,i&&(u.words=this.collateWordTimestamps(e,s,n)),c.push(u)}let b=Object.create(null);const k=c.map((e=>e.text)).join("");if(t||s){for(let e=0;e0;let a=n?[]:null,i=n?t[0]:null;for(let l=1;le===f[s]&&i[o+s]<=t[l][m+s])).length:p.filter(((e,t)=>e===f[t])).length;const w=g/e+e/1e4;g>1&&w>d&&(d=w,u=[o,a,m,h])}const[p,m,h,f]=u,g=Math.floor((m+p)/2),w=Math.floor((f+h)/2);o.push(...s.slice(0,g)),s=c.slice(w),r=s.length,n&&(a.push(...i.slice(0,g)),i=t[l].slice(w))}return o.push(...s),n?(a.push(...i),[o,a]):[o,[]]}collateWordTimestamps(e,t,s){const[r,o,n]=this.combineTokensIntoWords(e,s),a=[];for(let e=0;e=r){const e=((t-r)*s).toFixed(2);o.push(`<|${e}|>`),o.push([])}else o[o.length-1].push(t);return o=o.map((e=>"string"==typeof e?e:super.decode(e,t))),o.join("")}splitTokensOnUnicode(e){const t=this.decode(e,{decode_with_timestamps:!0}),s=[],r=[],o=[];let n=[],a=[],i=0;for(let l=0;l=this.model.tokens_to_ids.get("<|endoftext|>"),_=l.startsWith(" "),p=l.trim(),m=i.test(p);if(u||_||m||0===o.length)o.push(l),n.push(c),a.push(d);else{const e=o.length-1;o[e]+=l,n[e].push(...c),a[e].push(...d)}}return[o,n,a]}mergePunctuations(e,t,s,r,n){const a=structuredClone(e),i=structuredClone(t),l=structuredClone(s);let c=a.length-2,d=a.length-1;for(;c>=0;)a[c].startsWith(" ")&&r.includes(a[c].trim())?(a[d]=a[c]+a[d],i[d]=(0,o.mergeArrays)(i[c],i[d]),l[d]=(0,o.mergeArrays)(l[c],l[d]),a[c]="",i[c]=[],l[c]=[]):d=c,--c;for(c=0,d=1;de)),i.filter((e=>e.length>0)),l.filter((e=>e.length>0))]}}class nt extends ye{}class at extends ye{}class it extends ye{}class lt extends ye{constructor(e,t){super(e,t),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter((e=>this.languageRegex.test(e))),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(e){if(null===e)return null;const[t,...s]=e.trim().split(this.languageRegex);if(0===s.length)return super._encode_text(t);if(2===s.length){const[e,t]=s;return this.supported_language_codes.includes(e)||console.warn(`Unsupported language code "${e}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),(0,o.mergeArrays)([e],super._encode_text(t))}}}class ct extends ye{}class dt extends ye{}class ut extends ye{}class _t extends ye{}class pt extends ye{}class mt extends ye{constructor(e,t){super(e,t),this.decoder=new ue({})}}class ht extends ye{}class ft extends ye{}class gt{static TOKENIZER_CLASS_MAPPING={T5Tokenizer:Oe,DistilBertTokenizer:Ie,CamembertTokenizer:ze,DebertaTokenizer:Ce,DebertaV2Tokenizer:Se,BertTokenizer:ve,HerbertTokenizer:Ae,ConvBertTokenizer:Ee,RoFormerTokenizer:Le,XLMTokenizer:je,ElectraTokenizer:De,MobileBertTokenizer:Pe,SqueezeBertTokenizer:Fe,AlbertTokenizer:Te,GPT2Tokenizer:Ne,BartTokenizer:Ve,MBartTokenizer:Be,MBart50Tokenizer:Ge,RobertaTokenizer:$e,WhisperTokenizer:ot,CodeGenTokenizer:nt,CLIPTokenizer:at,SiglipTokenizer:it,MarianTokenizer:lt,BloomTokenizer:Re,NllbTokenizer:st,M2M100Tokenizer:rt,LlamaTokenizer:We,CodeLlamaTokenizer:Ue,XLMRobertaTokenizer:Qe,MPNetTokenizer:Xe,FalconTokenizer:He,GPTNeoXTokenizer:Je,EsmTokenizer:Ye,Wav2Vec2CTCTokenizer:ct,BlenderbotTokenizer:dt,BlenderbotSmallTokenizer:ut,SpeechT5Tokenizer:_t,NougatTokenizer:pt,VitsTokenizer:mt,Qwen2Tokenizer:Ke,GemmaTokenizer:Ze,Grok1Tokenizer:et,CohereTokenizer:ht,MgpstrTokenizer:ft,PreTrainedTokenizer:ye};static async from_pretrained(e,{progress_callback:t=null,config:s=null,cache_dir:r=null,local_files_only:o=!1,revision:n="main",legacy:a=null}={}){const[i,l]=await u(e,{progress_callback:t,config:s,cache_dir:r,local_files_only:o,revision:n,legacy:a}),c=l.tokenizer_class?.replace(/Fast$/,"")??"PreTrainedTokenizer";let d=this.TOKENIZER_CLASS_MAPPING[c];return d||(console.warn(`Unknown tokenizer class "${c}", attempting to construct from base class.`),d=ye),new d(i,l)}}},"./src/utils/audio.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{RawAudio:()=>k,hamming:()=>_,hanning:()=>u,mel_filter_bank:()=>g,read_audio:()=>c,spectrogram:()=>M,window_function:()=>x});var r=s("./src/utils/hub.js"),o=s("./src/utils/maths.js"),n=s("./src/utils/core.js"),a=s("./src/env.js"),i=s("./src/utils/tensor.js"),l=s("node:fs");async function c(e,t){if("undefined"==typeof AudioContext)throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");const s=await(await(0,r.getFile)(e)).arrayBuffer(),o=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${o.sampleRate}Hz.`);const n=await o.decodeAudioData(s);let a;if(2===n.numberOfChannels){const e=Math.sqrt(2),t=n.getChannelData(0),s=n.getChannelData(1);a=new Float32Array(t.length);for(let r=0;r2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,s=15,r=27/Math.log(6.4))=>e>=t?s+Math.log(e/t)*r:3*e/200};function m(e,t="htk"){const s=p[t];if(!s)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?s(e):e.map((e=>s(e)))}const h={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,s=15,r=Math.log(6.4)/27)=>e>=s?t*Math.exp(r*(e-s)):200*e/3};function f(e,t,s){const r=(t-e)/(s-1);return Float64Array.from({length:s},((t,s)=>e+r*s))}function g(e,t,s,r,o,n=null,a="htk",i=!1){if(null!==n&&"slaney"!==n)throw new Error('norm must be one of null or "slaney"');if(e<2)throw new Error(`Require num_frequency_bins: ${e} >= 2`);if(s>r)throw new Error(`Require min_frequency: ${s} <= max_frequency: ${r}`);const l=f(m(s,a),m(r,a),t+2);let c,d=function(e,t="htk"){const s=h[t];if(!s)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?s(e):e.map((e=>s(e)))}(l,a);if(i){const t=o/(2*(e-1));c=m(Float64Array.from({length:e},((e,s)=>s*t)),a),d=l}else c=f(0,Math.floor(o/2),e);const u=function(e,t){const s=Float64Array.from({length:t.length-1},((e,s)=>t[s+1]-t[s])),r=Array.from({length:e.length},(()=>new Array(t.length)));for(let s=0;snew Array(e.length)));for(let t=0;ta)throw Error(`frame_length (${s}) may not be larger than fft_length (${a})`);if(F!==s)throw new Error(`Length of the window (${F}) must equal frame_length (${s})`);if(r<=0)throw new Error("hop_length must be greater than zero");if(null===l&&null!==m)throw new Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(!p)throw new Error("`preemphasis_htk_flavor=false` is not currently supported.");if(c)switch(d){case"reflect":{const t=Math.floor((a-1)/2)+1;e=function(e,t,s){const r=new e.constructor(e.length+t+s),o=e.length-1;for(let s=0;sC?v&&(E=y):E=A=y);const L=new o.FFT(a),I=new Float64Array(a),z=new Float64Array(L.outputBufferSize),j=new Float32Array(S*E);for(let o=0;o=1;--e)I[e]-=_*I[e-1];I[0]*=1-_}for(let e=0;eMath.pow(e,.85)));break;default:throw new Error(`Unknown window type ${t}.`)}if(s&&(a=a.subarray(0,e)),null===r)return a;if(e>r)throw new Error(`Length of the window (${e}) may not be larger than frame_length (${r})`);return a}function b(e,t,s){for(let r=0;r{let s=await t.arrayBuffer();l.writeFileSync(e,Buffer.from(s))}}await t(e,this.toBlob())}}},"./src/utils/constants.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{CHAT_TEMPLATE_NAME:()=>l,CONFIG_NAME:()=>o,FEATURE_EXTRACTOR_NAME:()=>n,GENERATION_CONFIG_NAME:()=>c,GITHUB_ISSUE_URL:()=>r,IMAGE_PROCESSOR_NAME:()=>a,PROCESSOR_NAME:()=>i});const r="https://github.com/huggingface/transformers.js/issues/new/choose",o="config.json",n="preprocessor_config.json",a=n,i="processor_config.json",l="chat_template.jinja",c="generation_config.json"},"./src/utils/core.js":(e,t,s)=>{"use strict";function r(e,t){e&&e(t)}function o(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[t,e])))}function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a(e){return"TypedArray"===e?.prototype?.__proto__?.constructor?.name}function i(e){return Number.isInteger(e)||"bigint"==typeof e}function l(e){return null==e||-1===e}function c(e){const t=[];let s=e;for(;Array.isArray(s);)t.push(s.length),s=s[0];return t}function d(e,t,s=void 0){const r=e[t];if(void 0!==r)return delete e[t],r;if(void 0===s)throw Error(`Key ${t} does not exist in object.`);return s}function u(...e){return Array.prototype.concat.apply([],e)}function _(...e){return e.reduce(((e,t)=>e.flatMap((e=>t.map((t=>[e,t]))))))}function p(e,t){return Math.abs((e+t)%(2*t)-t)}function m(e,t){const s=URL.createObjectURL(t),r=document.createElement("a");r.href=s,r.download=e,r.click(),r.remove(),URL.revokeObjectURL(s)}function h(e,t){return Object.assign({},...t.map((t=>{if(void 0!==e[t])return{[t]:e[t]}})))}function f(e){let t=0;for(const s of e)++t;return t}function g(e,t){let s=0;for(const r of e)r===t&&++s;return s}s.r(t),s.d(t,{calculateDimensions:()=>c,calculateReflectOffset:()=>p,count:()=>g,dispatchCallback:()=>r,escapeRegExp:()=>n,isIntegralNumber:()=>i,isNullishDimension:()=>l,isTypedArray:()=>a,len:()=>f,mergeArrays:()=>u,pick:()=>h,pop:()=>d,product:()=>_,reverseDictionary:()=>o,saveBlob:()=>m})},"./src/utils/data-structures.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{CharTrie:()=>o,DictionarySplitter:()=>l,LRUCache:()=>c,PriorityQueue:()=>r,TokenLattice:()=>a});class r{constructor(e=(e,t)=>e>t,t=1/0){this._heap=[],this._comparator=e,this._maxSize=t}get size(){return this._heap.length}isEmpty(){return 0===this.size}peek(){return this._heap[0]}push(...e){return this.extend(e)}extend(e){for(const t of e)if(this.size0&&this._swap(0,t),this._heap.pop(),this._siftDown(),e}replace(e){const t=this.peek();return this._heap[0]=e,this._siftDown(),t}_parent(e){return(e+1>>>1)-1}_left(e){return 1+(e<<1)}_right(e){return e+1<<1}_greater(e,t){return this._comparator(this._heap[e],this._heap[t])}_swap(e,t){const s=this._heap[e];this._heap[e]=this._heap[t],this._heap[t]=s}_siftUp(){this._siftUpFrom(this.size-1)}_siftUpFrom(e){for(;e>0&&this._greater(e,this._parent(e));)this._swap(e,this._parent(e)),e=this._parent(e)}_siftDown(){let e=0;for(;this._left(e)[])),this.endNodes=Array.from({length:this.len+1},(()=>[]));const r=new i(this.bosTokenId,0,0,0,0),o=new i(this.eosTokenId,1,this.len,0,0);this.nodes.push(r.clone()),this.nodes.push(o.clone()),this.beginNodes[this.len].push(o),this.endNodes[0].push(r)}insert(e,t,s,r){const o=this.nodes.length,n=new i(r,o,e,t,s);this.beginNodes[e].push(n),this.endNodes[e+t].push(n),this.nodes.push(n)}viterbi(){const e=this.len;let t=0;for(;t<=e;){if(0==this.beginNodes[t].length)return[];for(let e of this.beginNodes[t]){e.prev=null;let s=0,r=null;for(let o of this.endNodes[t]){const t=o.backtraceScore+e.score;(null===r||t>s)&&(r=o.clone(),s=t)}if(null===r)return[];e.prev=r,e.backtraceScore=s}++t}const s=[],r=this.beginNodes[e][0].prev;if(null===r)return[];let o=r.clone();for(;null!==o.prev;){s.push(o.clone());const e=o.clone();o=e.prev.clone()}return s.reverse(),s}piece(e){return this.chars.slice(e.pos,e.pos+e.length).join("")}tokens(){return this.viterbi().map((e=>this.piece(e)))}tokenIds(){return this.viterbi().map((e=>e.tokenId))}}class i{constructor(e,t,s,r,o){this.tokenId=e,this.nodeId=t,this.pos=s,this.length=r,this.score=o,this.prev=null,this.backtraceScore=0}clone(){const e=new i(this.tokenId,this.nodeId,this.pos,this.length,this.score);return e.prev=this.prev,e.backtraceScore=this.backtraceScore,e}}class l{constructor(e){this.trie=this._buildTrie(e)}_buildTrie(e){const t=Object.create(null);for(const s of e){let e=t;for(let t=0;tr&&t.push(e.slice(r,o)),t.push(a),o+=a.length,r=o):++o}return rthis.capacity&&this.cache.delete(this.cache.keys().next().value)}clear(){this.cache.clear()}}},"./src/utils/devices.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{DEVICE_TYPES:()=>r});const r=Object.freeze({auto:"auto",gpu:"gpu",cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:"webnn","webnn-npu":"webnn-npu","webnn-gpu":"webnn-gpu","webnn-cpu":"webnn-cpu"})},"./src/utils/dtypes.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{DATA_TYPES:()=>a,DEFAULT_DEVICE_DTYPE_MAPPING:()=>i,DEFAULT_DTYPE_SUFFIX_MAPPING:()=>l,isWebGpuFp16Supported:()=>n});var r=s("./src/env.js"),o=s("./src/utils/devices.js");const n=function(){let e;return async function(){if(void 0===e)if(r.apis.IS_WEBGPU_AVAILABLE)try{const t=await navigator.gpu.requestAdapter();e=t.features.has("shader-f16")}catch(t){e=!1}else e=!1;return e}}(),a=Object.freeze({auto:"auto",fp32:"fp32",fp16:"fp16",q8:"q8",int8:"int8",uint8:"uint8",q4:"q4",bnb4:"bnb4",q4f16:"q4f16"}),i=Object.freeze({[o.DEVICE_TYPES.wasm]:a.q8}),l=Object.freeze({[a.fp32]:"",[a.fp16]:"_fp16",[a.int8]:"_int8",[a.uint8]:"_uint8",[a.q8]:"_quantized",[a.q4]:"_q4",[a.q4f16]:"_q4f16",[a.bnb4]:"_bnb4"})},"./src/utils/generic.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Callable:()=>r});const r=class{constructor(){let e=function(...t){return e._call(...t)};return Object.setPrototypeOf(e,new.target.prototype)}_call(...e){throw Error("Must implement _call method in subclass")}}},"./src/utils/hub.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{MAX_EXTERNAL_DATA_CHUNKS:()=>i,getFile:()=>_,getModelFile:()=>h,getModelJSON:()=>g,getModelText:()=>f});var r=s("node:fs"),o=s("node:path"),n=s("./src/env.js"),a=s("./src/utils/core.js");const i=100,l={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};class c{constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=r.existsSync(e),this.exists){this.status=200,this.statusText="OK";let t=r.statSync(e);this.headers.set("content-length",t.size.toString()),this.updateContentType();const s=r.createReadStream(e);this.body=new ReadableStream({start(e){s.on("data",(t=>e.enqueue(t))),s.on("end",(()=>e.close())),s.on("error",(t=>e.error(t)))},cancel(){s.destroy()}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const e=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",l[e]??"application/octet-stream")}clone(){let e=new c(this.filePath);return e.exists=this.exists,e.status=this.status,e.statusText=this.statusText,e.headers=new Headers(this.headers),e}async arrayBuffer(){return(await r.promises.readFile(this.filePath)).buffer}async blob(){const e=await r.promises.readFile(this.filePath);return new Blob([e],{type:this.headers.get("content-type")})}async text(){return await r.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function d(e,t=null,s=null){let r;try{r=new URL(e)}catch(e){return!1}return!(t&&!t.includes(r.protocol))&&!(s&&!s.includes(r.hostname))}const u=/^(\b[\w\-.]+\b\/)?\b[\w\-.]{1,96}\b$/;async function _(e){if(n.env.useFS&&!d(e,["http:","https:","blob:"]))return new c(e instanceof URL?"file:"===e.protocol?e.pathname:e.toString():e);if("undefined"!=typeof process&&"node"===process?.release?.name){const t=!!process.env?.TESTING_REMOTELY,s=n.env.version,r=new Headers;r.set("User-Agent",`transformers.js/${s}; is_ci/${t};`);if(d(e,["http:","https:"],["huggingface.co","hf.co"])){const e=process.env?.HF_TOKEN??process.env?.HF_ACCESS_TOKEN;e&&r.set("Authorization",`Bearer ${e}`)}return fetch(e,{headers:r})}return fetch(e)}const p={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};class m{constructor(e){this.path=e}async match(e){let t=o.join(this.path,e),s=new c(t);return s.exists?s:void 0}async put(e,t,s=void 0){let n=o.join(this.path,e);try{const e=t.headers.get("Content-Length"),a=parseInt(e??"0");let i=0;await r.promises.mkdir(o.dirname(n),{recursive:!0});const l=r.createWriteStream(n),c=t.body.getReader();for(;;){const{done:e,value:t}=await c.read();if(e)break;await new Promise(((e,s)=>{l.write(t,(t=>{t?s(t):e()}))})),i+=t.length;const r=a?i/a*100:0;s?.({progress:r,loaded:i,total:a})}l.close()}catch(e){try{await r.promises.unlink(n)}catch{}throw e}}}async function h(e,t,s=!0,r={},o=!1){if(!n.env.allowLocalModels){if(r.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!n.env.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}let i;if((0,a.dispatchCallback)(r.progress_callback,{status:"initiate",name:e,file:t}),!i&&n.env.useCustomCache){if(!n.env.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!n.env.customCache.match||!n.env.customCache.put)throw new Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");i=n.env.customCache}if(!i&&n.env.useBrowserCache){if("undefined"==typeof caches)throw Error("Browser cache is not available in this environment.");try{i=await caches.open("transformers-cache")}catch(e){console.warn("An error occurred while opening the browser cache:",e)}}if(!i&&n.env.useFSCache){if(!n.apis.IS_FS_AVAILABLE)throw Error("File System Cache is not available in this environment.");i=new m(r.cache_dir??n.env.cacheDir)}const l=r.revision??"main",h=w(e,t),f=(g=e,!(!u.test(g)||g.includes("..")||g.includes("--")||g.endsWith(".git")||g.endsWith(".ipynb")));var g;const M=f?w(n.env.localModelPath,h):h,x=w(n.env.remoteHost,n.env.remotePathTemplate.replaceAll("{model}",e).replaceAll("{revision}",encodeURIComponent(l)),t);let b;const k=i instanceof m?"main"===l?h:w(e,l,t):x;let y,v=!1;i&&(y=await async function(e,...t){for(let s of t)try{let t=await e.match(s);if(t)return t}catch(e){continue}}(i,M,k));const T=void 0!==y;if(void 0===y){if(n.env.allowLocalModels){if(d(h,["http:","https:"])){if(r.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${h}.`);if(!n.env.allowRemoteModels)throw new Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${h}.`)}else try{y=await _(M),b=M}catch(e){console.warn(`Unable to load from local path "${M}": "${e}"`)}}if(void 0===y||404===y.status){if(r.local_files_only||!n.env.allowRemoteModels){if(s)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${M}".`);return null}if(!f)throw Error(`Local file missing at "${M}" and download aborted due to invalid model ID "${e}".`);if(y=await _(x),200!==y.status)return function(e,t,s){if(!s)return null;const r=p[e]??`Error (${e}) occurred while trying to load file`;throw Error(`${r}: "${t}".`)}(y.status,x,s);b=k}v=i&&"undefined"!=typeof Response&&y instanceof Response&&200===y.status}let P;if((0,a.dispatchCallback)(r.progress_callback,{status:"download",name:e,file:t}),!n.apis.IS_NODE_ENV||!o){let s;r.progress_callback?T&&"undefined"!=typeof navigator&&/firefox/i.test(navigator.userAgent)?(s=new Uint8Array(await y.arrayBuffer()),(0,a.dispatchCallback)(r.progress_callback,{status:"progress",name:e,file:t,progress:100,loaded:s.length,total:s.length})):s=await async function(e,t){const s=e.headers.get("Content-Length");null===s&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let r=parseInt(s??"0"),o=new Uint8Array(r),n=0;const a=e.body.getReader();async function i(){const{done:e,value:s}=await a.read();if(e)return;const l=n+s.length;if(l>r){r=l;const e=new Uint8Array(r);e.set(o),o=e}o.set(s,n),n=l;return t({progress:n/r*100,loaded:n,total:r}),i()}return await i(),o}(y,(s=>{(0,a.dispatchCallback)(r.progress_callback,{status:"progress",name:e,file:t,...s})})):s=new Uint8Array(await y.arrayBuffer()),P=s}if(v&&b&&void 0===await i.match(b))if(P)await i.put(b,new Response(P,{headers:y.headers})).catch((e=>{console.warn(`Unable to add response to browser cache: ${e}.`)}));else{const s=r.progress_callback?s=>(0,a.dispatchCallback)(r.progress_callback,{status:"progress",name:e,file:t,...s}):void 0;await i.put(b,y,s)}if((0,a.dispatchCallback)(r.progress_callback,{status:"done",name:e,file:t}),P){if(!n.apis.IS_NODE_ENV&&o)throw new Error("Cannot return path in a browser environment.");return P}if(y instanceof c)return y.filePath;const F=await(i?.match(b));if(F instanceof c)return F.filePath;if(F instanceof Response)return new Uint8Array(await F.arrayBuffer());if("string"==typeof F)return F;throw new Error("Unable to get model file path or buffer.")}async function f(e,t,s=!0,r={}){const o=await h(e,t,s,r,!1);if(null===o)return null;return new TextDecoder("utf-8").decode(o)}async function g(e,t,s=!0,r={}){const o=await f(e,t,s,r);return null===o?{}:JSON.parse(o)}function w(...e){return(e=e.map(((t,s)=>(s&&(t=t.replace(new RegExp("^/"),"")),s!==e.length-1&&(t=t.replace(new RegExp("/$"),"")),t)))).join("/")}},"./src/utils/image.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{RawImage:()=>m,load_image:()=>h});var r=s("./src/utils/core.js"),o=s("./src/utils/hub.js"),n=s("./src/env.js"),a=s("./src/utils/tensor.js"),i=s("sharp");let l,c,d;const u=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV;if(u)l=(e,t)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},d=self.createImageBitmap,c=self.ImageData;else{if(!i)throw new Error("Unable to load image processing library.");d=async e=>{const t=(await e.metadata()).channels,{data:s,info:r}=await e.rotate().raw().toBuffer({resolveWithObject:!0}),o=new m(new Uint8ClampedArray(s),r.width,r.height,r.channels);return void 0!==t&&t!==r.channels&&o.convert(t),o}}const _={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},p=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class m{constructor(e,t,s,r){this.data=e,this.width=t,this.height=s,this.channels=r}get size(){return[this.width,this.height]}static async read(e){if(e instanceof m)return e;if("string"==typeof e||e instanceof URL)return await this.fromURL(e);if(e instanceof Blob)return await this.fromBlob(e);if("undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return this.fromCanvas(e);throw new Error("Unsupported input type: "+typeof e)}static fromCanvas(e){if(!u)throw new Error("fromCanvas() is only supported in browser environments.");const t=e.getContext("2d").getImageData(0,0,e.width,e.height).data;return new m(t,e.width,e.height,4)}static async fromURL(e){const t=await(0,o.getFile)(e);if(200!==t.status)throw new Error(`Unable to read image from "${e}" (${t.status} ${t.statusText})`);const s=await t.blob();return this.fromBlob(s)}static async fromBlob(e){if(u){const t=await d(e),s=l(t.width,t.height).getContext("2d");return s.drawImage(t,0,0),new this(s.getImageData(0,0,t.width,t.height).data,t.width,t.height,4)}{const t=i(await e.arrayBuffer());return await d(t)}}static fromTensor(e,t="CHW"){if(3!==e.dims.length)throw new Error(`Tensor should have 3 dimensions, but has ${e.dims.length} dimensions.`);if("CHW"===t)e=e.transpose(1,2,0);else if("HWC"!==t)throw new Error(`Unsupported channel format: ${t}`);if(!(e.data instanceof Uint8ClampedArray||e.data instanceof Uint8Array))throw new Error(`Unsupported tensor type: ${e.type}`);switch(e.dims[2]){case 1:case 2:case 3:case 4:return new m(e.data,e.dims[1],e.dims[0],e.dims[2]);default:throw new Error(`Unsupported number of channels: ${e.dims[2]}`)}}grayscale(){if(1===this.channels)return this;const e=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let t=0,s=0;t=0?i=s:d=-s,r>=0?c=r:u=-r,a.drawImage(n,i,c,e,t,d,u,e,t);return new m(a.getImageData(0,0,e,t).data,e,t,4).convert(o)}{let o=this.toSharp();if(s>=0&&r>=0)o=o.extract({left:Math.floor(s),top:Math.floor(r),width:e,height:t});else if(s<=0&&r<=0){const n=Math.floor(-r),a=Math.floor(-s);o=o.extend({top:n,left:a,right:e-this.width-a,bottom:t-this.height-n})}else{let n=[0,0],a=0;r<0?(n[0]=Math.floor(-r),n[1]=t-this.height-n[0]):a=Math.floor(r);let i=[0,0],l=0;s<0?(i[0]=Math.floor(-s),i[1]=e-this.width-i[0]):l=Math.floor(s),o=o.extend({top:n[0],bottom:n[1],left:i[0],right:i[1]}).extract({left:l,top:a,width:e,height:t})}return await d(o)}}async toBlob(e="image/png",t=1){if(!u)throw new Error("toBlob() is only supported in browser environments.");const s=this.toCanvas();return await s.convertToBlob({type:e,quality:t})}toTensor(e="CHW"){let t=new a.Tensor("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if("HWC"===e);else{if("CHW"!==e)throw new Error(`Unsupported channel format: ${e}`);t=t.permute(2,0,1)}return t}toCanvas(){if(!u)throw new Error("toCanvas() is only supported in browser environments.");const e=this.clone().rgba(),t=l(e.width,e.height),s=new c(e.data,e.width,e.height);return t.getContext("2d").putImageData(s,0,0),t}split(){const{data:e,width:t,height:s,channels:r}=this,o=e.constructor,n=e.length/r,a=Array.from({length:r},(()=>new o(n)));for(let t=0;tnew m(e,t,s,1)))}_update(e,t,s,r=null){return this.data=e,this.width=t,this.height=s,null!==r&&(this.channels=r),this}clone(){return new m(this.data.slice(),this.width,this.height,this.channels)}convert(e){if(this.channels===e)return this;switch(e){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(e){if(!u){if(n.apis.IS_FS_AVAILABLE){const t=this.toSharp();return await t.toFile(e)}throw new Error("Unable to save the image because filesystem is disabled in this environment.")}{if(n.apis.IS_WEBWORKER_ENV)throw new Error("Unable to save an image from a Web Worker.");const t=e.split(".").pop().toLowerCase(),s=p.get(t)??"image/png",o=await this.toBlob(s);(0,r.saveBlob)(e,o)}}toSharp(){if(u)throw new Error("toSharp() is only supported in server-side environments.");return i(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}const h=m.read.bind(m)},"./src/utils/maths.js":(e,t,s)=>{"use strict";function r(e,[t,s,r],[o,n],a="bilinear",i=!1){const l=n/r,c=o/s,d=new e.constructor(o*n*t),u=s*r,_=o*n;for(let a=0;a=0;--e)o[e]=n,r[e]=t[s[e]],n*=r[e];const n=s.map(((e,t)=>o[s.indexOf(t)])),a=new e.constructor(e.length);for(let s=0;s=0;--e)r+=o%t[e]*n[e],o=Math.floor(o/t[e]);a[r]=e[s]}return[a,r]}function n(e){const t=u(e)[0],s=e.map((e=>Math.exp(e-t))),r=s.reduce(((e,t)=>e+t),0);return s.map((e=>e/r))}function a(e){const t=u(e)[0];let s=0;for(let r=0;re-t-r))}function i(e,t){let s=0;for(let r=0;re+t*t),0))}function d(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],s=0;for(let r=1;rt&&(t=e[r],s=r);return[t,s]}function _(e){return e>0&&!(e&e-1)}s.r(t),s.d(t,{FFT:()=>h,bankers_round:()=>w,cos_sim:()=>l,dot:()=>i,dynamic_time_warping:()=>M,interpolate_data:()=>r,log_softmax:()=>a,magnitude:()=>c,max:()=>u,medianFilter:()=>f,min:()=>d,permute_data:()=>o,round:()=>g,softmax:()=>n});class p{constructor(e){if(this.size=0|e,this.size<=1||!_(this.size))throw new Error("FFT size must be a power of two larger than 1");this._csize=e<<1,this.table=new Float64Array(2*this.size);for(let e=0;ee;e<<=1)++t;this._width=t%2==0?t-1:t,this._bitrev=new Int32Array(1<>>t&3)<>>1);for(let t=0;t>>1]=e[t];return s}toComplexArray(e,t){const s=t||this.createComplexArray();for(let t=0;t>>1],s[t+1]=0;return s}transform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._transform4(e,t,1)}realTransform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._realTransform4(e,t,1)}inverseTransform(e,t){if(e===t)throw new Error("Input and output buffers must be different");this._transform4(e,t,-1);for(let t=0;t>=2;a>=2;a>>=2){i=r/a<<1;const t=i>>>2;for(o=0;o>>1,a>>>1)}else for(o=0,n=0;o>>1,a>>>1,s)}const c=this.table;for(a>>=2;a>=2;a>>=2){i=r/a<<1;const t=i>>>1,n=t>>>1,l=n>>>1;for(o=0;o>>1;for(let t=2;t>1;++t){const s=(t+1-e)**2/2,r=Math.sqrt(i**2+l**2)**s,a=s*Math.atan2(l,i),c=2*t;o[c]=r*Math.cos(a),o[c+1]=r*Math.sin(a),n[c]=o[c],n[c+1]=-o[c+1]}this._slicedChirpBuffer=o.subarray(t,s),this._f=new p(r>>1),this._f.transform(this._chirpBuffer,n)}_transform(e,t,s){const r=this._buffer1,o=this._buffer2,n=this._outBuffer1,a=this._outBuffer2,i=this._chirpBuffer,l=this._slicedChirpBuffer,c=this._a;if(s)for(let e=0;e>1];r[e]=o*l[e],r[s]=o*l[s]}else for(let e=0;e=e.length&&(o=2*(e.length-1)-o),r[n++]=e[o]}r.sort(),s[t]=r[o]}return s}function g(e,t){const s=Math.pow(10,t);return Math.round(e*s)/s}function w(e){const t=Math.round(e);return Math.abs(e)%1==.5?t%2==0?t:t-1:t}function M(e){const t=e.length,s=e[0].length,r=[t+1,s+1],o=Array.from({length:r[0]},(()=>Array(r[1]).fill(1/0)));o[0][0]=0;const n=Array.from({length:r[0]},(()=>Array(r[1]).fill(-1)));for(let t=1;t0||i>0;)switch(l.push(a-1),c.push(i-1),n[a][i]){case 0:--a,--i;break;case 1:--a;break;case 2:--i;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${a}, ${i}]. Please file a bug report.`)}return l.reverse(),c.reverse(),[l,c]}},"./src/utils/tensor.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{DataTypeMap:()=>a,Tensor:()=>i,cat:()=>b,full:()=>F,full_like:()=>C,interpolate:()=>c,interpolate_4d:()=>d,layer_norm:()=>g,matmul:()=>u,mean:()=>T,mean_pooling:()=>f,ones:()=>S,ones_like:()=>A,permute:()=>l,quantize_embeddings:()=>j,rand:()=>I,randn:()=>z,rfft:()=>_,slice:()=>h,stack:()=>k,std_mean:()=>v,topk:()=>p,zeros:()=>E,zeros_like:()=>L});var r=s("./src/utils/maths.js"),o=s("./src/backends/onnx.js"),n=s("./src/ops/registry.js");const a=Object.freeze({float32:Float32Array,float16:"undefined"!=typeof Float16Array?Float16Array:Uint16Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array,uint4:Uint8Array,int4:Int8Array});class i{get dims(){return this.ort_tensor.dims}set dims(e){this.ort_tensor.dims=e}get type(){return this.ort_tensor.type}get data(){return this.ort_tensor.data}get size(){return this.ort_tensor.size}get location(){return this.ort_tensor.location}ort_tensor;constructor(...e){return(0,o.isONNXTensor)(e[0])?this.ort_tensor=e[0]:this.ort_tensor=new o.Tensor(e[0],e[1],e[2]),new Proxy(this,{get:(e,t)=>{if("string"==typeof t){let s=Number(t);if(Number.isInteger(s))return e._getitem(s)}return e[t]},set:(e,t,s)=>e[t]=s})}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){const[e,...t]=this.dims;if(t.length>0){const s=t.reduce(((e,t)=>e*t));for(let r=0;r0){const t=s.reduce(((e,t)=>e*t));return this._subarray(e,t,s)}return new i(this.type,[this.data[e]],s)}indexOf(e){const t=this.data;for(let s=0;se*t));if(s!==r)throw Error(`cannot reshape array of size ${s} into shape (${t})`);let o=e;for(let e=t.length-1;e>=0;e--)o=o.reduce(((s,r)=>{let o=s[s.length-1];return o.lengthn)throw new Error(`Invalid slice: ${o}`);const a=[Math.max(e,0),Math.min(n,this.dims[r])];s.push(a),t.push(a[1]-a[0])}}}const r=s.map((([e,t])=>t-e)),o=r.reduce(((e,t)=>e*t)),n=this.data,a=new n.constructor(o),l=this.stride();let c=!0;for(let e=1;e=0;--o){const e=r[o];t+=(n%e+s[o][0])*l[o],n=Math.floor(n/e)}a[e]=n[t]}return new i(this.type,a,t)}permute(...e){return l(this,e)}transpose(...e){return this.permute(...e)}sum(e=null,t=!1){return this.norm(1,e,t)}norm(e="fro",t=null,s=!1){if("fro"===e)e=2;else if("string"==typeof e)throw Error(`Unsupported norm: ${e}`);const r=this.data,o=(t,s)=>t+s**e;if(null===t){const t=r.reduce(o,0)**(1/e);return new i(this.type,[t],[])}const[n,a,l]=y(o,this,t,s);if(1!==e)for(let t=0;t=0;--r){const e=this.dims[r];if(r!==t){s+=o%e*n,n*=this.dims[r]}o=Math.floor(o/e)}r[e]/=o[s]}return this}normalize(e=2,t=1){return this.clone().normalize_(e,t)}stride(){return function(e){const t=new Array(e.length);for(let s=e.length-1,r=1;s>=0;--s)t[s]=r,r*=e[s];return t}(this.dims)}squeeze(e=null){return new i(this.type,this.data,w(this.dims,e))}squeeze_(e=null){return this.dims=w(this.dims,e),this}unsqueeze(e=null){return new i(this.type,this.data,M(this.dims,e))}unsqueeze_(e=null){return this.dims=M(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let s=this.dims.slice(0,e),r=this.dims.slice(e,t+1),o=this.dims.slice(t+1);return this.dims=[...s,r.reduce(((e,t)=>e*t),1),...o],this}flatten(e=0,t=-1){return this.clone().flatten_(e,t)}view(...e){let t=-1;for(let s=0;sr!==t?e*s:e),1);e[t]=s.length/r}return new i(this.type,s,e)}neg_(){const e=this.data;for(let t=0;te?1:0;return new i("bool",t,this.dims)}lt(e){const t=new Uint8Array(this.data.length),s=this.data;for(let r=0;rMath.min(e,t)),this,e,t,1/0);return new i(s,o,n)}max(e=null,t=!1){if(null===e){const e=(0,r.max)(this.data)[0];return new i(this.type,[e],[])}const[s,o,n]=y(((e,t)=>Math.max(e,t)),this,e,t,-1/0);return new i(s,o,n)}argmin(e=null,t=!1){if(null!==e)throw new Error("`dim !== null` not yet implemented.");const s=(0,r.min)(this.data)[1];return new i("int64",[BigInt(s)],[])}argmax(e=null,t=!1){if(null!==e)throw new Error("`dim !== null` not yet implemented.");const s=(0,r.max)(this.data)[1];return new i("int64",[BigInt(s)],[])}to(e){if(this.type===e)return this;if(!a.hasOwnProperty(e))throw new Error(`Unsupported type: ${e}`);let t;const s=["int64","uint64"].includes(this.type),r=["int64","uint64"].includes(e);return s&&!r?t=Number:!s&&r&&(t=["float16","float32","float64"].includes(this.type)?e=>BigInt(Math.floor(e)):BigInt),new i(e,a[e].from(this.data,t),this.dims)}}function l(e,t){const[s,o]=(0,r.permute_data)(e.data,e.dims,t);return new i(e.type,s,o)}function c(e,[t,s],o="bilinear",n=!1){const a=e.dims.at(-3)??1,l=e.dims.at(-2),c=e.dims.at(-1);let d=(0,r.interpolate_data)(e.data,[a,l,c],[t,s],o,n);return new i(e.type,d,[a,t,s])}async function d(e,{size:t=null,mode:s="bilinear"}={}){if(4!==e.dims.length)throw new Error("`interpolate_4d` currently only supports 4D input.");if(!t)throw new Error("`interpolate_4d` requires a `size` argument.");let r,o;if(2===t.length)r=[...e.dims.slice(0,2),...t];else if(3===t.length)r=[e.dims[0],...t];else{if(4!==t.length)throw new Error("`size` must be of length 2, 3, or 4.");r=t}if("nearest"===s)o=await n.TensorOpRegistry.nearest_interpolate_4d;else if("bilinear"===s)o=await n.TensorOpRegistry.bilinear_interpolate_4d;else{if("bicubic"!==s)throw new Error(`Unsupported mode: ${s}`);o=await n.TensorOpRegistry.bicubic_interpolate_4d}const a=new i("int64",new BigInt64Array(r.map(BigInt)),[r.length]);return await o({x:e,s:a})}async function u(e,t){const s=await n.TensorOpRegistry.matmul;return await s({a:e,b:t})}async function _(e,t){const s=await n.TensorOpRegistry.rfft;return await s({x:e,a:t})}async function p(e,t){const s=await n.TensorOpRegistry.top_k;return t=null==t?e.dims.at(-1):Math.min(t,e.dims.at(-1)),await s({x:e,k:new i("int64",[BigInt(t)],[1])})}const m=e=>new i("int64",e,[e.length]);async function h(e,t,s,r,o){const a=await n.TensorOpRegistry.slice;return await a({x:e,s:m(t),e:m(s),a:m(r),t:m(o??new Array(r.length).fill(1))})}function f(e,t){const s=e.data,r=t.data,o=[e.dims[0],e.dims[2]],n=new s.constructor(o[0]*o[1]),[a,l,c]=e.dims;let d=0;for(let e=0;e1!==e)):"number"==typeof t?1===e[t]&&e.splice(t,1):Array.isArray(t)&&(e=e.filter(((e,s)=>1!==e||!t.includes(s)))),e}function M(e,t){return t=x(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function x(e,t,s=null,r=!0){if(e<-t||e>=t){if(r)throw new Error(`IndexError: index ${e} is out of bounds for dimension${null===s?"":" "+s} with size ${t}`);return e<-t?0:t}return e<0&&(e=(e%t+t)%t),e}function b(e,t=0){t=x(t,e[0].dims.length);const s=e[0].dims.slice();s[t]=e.reduce(((e,s)=>e+s.dims[t]),0);const r=s.reduce(((e,t)=>e*t),1),o=new e[0].data.constructor(r),n=e[0].type;if(0===t){let t=0;for(const s of e){const e=s.data;o.set(e,t),t+=e.length}}else{let r=0;for(let n=0;n=0;--o){const e=i[o];let c=a%e;o===t&&(c+=r),n+=c*l,l*=s[o],a=Math.floor(a/e)}o[n]=a[e]}r+=i[t]}}return new i(n,o,s)}function k(e,t=0){return b(e.map((e=>e.unsqueeze(t))),t)}function y(e,t,s=null,r=!1,o=null){const n=t.data,a=t.dims;s=x(s,a.length);const i=a.slice();i[s]=1;const l=new n.constructor(n.length/a[s]);null!==o&&l.fill(o);for(let t=0;t=0;--e){const t=a[e];if(e!==s){r+=o%t*n,n*=i[e]}o=Math.floor(o/t)}l[r]=e(l[r],n[t],t,r)}return r||i.splice(s,1),[t.type,l,i]}function v(e,t=null,s=1,r=!1){const o=e.data,n=e.dims;if(null===t){const t=o.reduce(((e,t)=>e+t),0)/o.length,r=Math.sqrt(o.reduce(((e,s)=>e+(s-t)**2),0)/(o.length-s)),n=new i(e.type,[t],[]);return[new i(e.type,[r],[]),n]}const a=T(e,t=x(t,n.length),r),l=a.data,[c,d,u]=y(((e,t,s,r)=>e+(t-l[r])**2),e,t,r);for(let e=0;ee+t),0);return new i(e.type,[t/o.length],[])}t=x(t,r.length);const[n,a,l]=y(((e,t)=>e+t),e,t,s);if(1!==r[t])for(let e=0;ee*t),1);return new i(s,new r(o).fill(t),e)}function F(e,t){let s,r;if("number"==typeof t)s="float32",r=Float32Array;else if("bigint"==typeof t)s="int64",r=BigInt64Array;else{if("boolean"!=typeof t)throw new Error("Unsupported data type: "+typeof t);s="bool",r=Uint8Array}return P(e,t,s,r)}function C(e,t){return F(e.dims,t)}function S(e){return P(e,1n,"int64",BigInt64Array)}function A(e){return S(e.dims)}function E(e){return P(e,0n,"int64",BigInt64Array)}function L(e){return E(e.dims)}function I(e){const t=e.reduce(((e,t)=>e*t),1);return new i("float32",Float32Array.from({length:t},(()=>Math.random())),e)}function z(e){const t=e.reduce(((e,t)=>e*t),1);return new i("float32",Float32Array.from({length:t},(()=>function(){const e=1-Math.random(),t=1-Math.random();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*t)}())),e)}function j(e,t){if(2!==e.dims.length)throw new Error("The tensor must have 2 dimensions");if(e.dims.at(-1)%8!=0)throw new Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(t))throw new Error("The precision must be either 'binary' or 'ubinary'");const s="binary"===t,r=s?"int8":"uint8",o=s?Int8Array:Uint8Array,n=e.data,a=new o(n.length/8);for(let e=0;e0?1:0,r=Math.floor(e/8),o=e%8;a[r]|=t<<7-o,s&&0===o&&(a[r]-=128)}return new i(r,a,[e.dims[0],e.dims[1]/8])}},"./src/utils/video.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{RawVideo:()=>a,RawVideoFrame:()=>n,load_video:()=>i});var r=s("./src/utils/image.js"),o=s("./src/env.js");class n{constructor(e,t){this.image=e,this.timestamp=t}}class a{constructor(e,t){e.length>0&&e[0]instanceof r.RawImage&&(e=e.map(((s,r)=>new n(s,(r+1)/(e.length+1)*t)))),this.frames=e,this.duration=t}get width(){return this.frames[0].image.width}get height(){return this.frames[0].image.height}get fps(){return this.frames.length/this.duration}}async function i(e,{num_frames:t=null,fps:s=null}={}){if(!o.apis.IS_BROWSER_ENV)throw new Error("`load_video` is currently only supported in browser environments.");if(null==t&&null==s)throw new Error("Either num_frames or fps must be provided.");const i=[],l=document.createElement("video");if(l.crossOrigin="anonymous",l.muted=!0,"string"==typeof e)l.src=e;else if(e instanceof Blob)l.src=URL.createObjectURL(e);else{if(!(e instanceof HTMLVideoElement))throw new Error("Invalid URL or video element provided.");l.src=e.src}if(await new Promise((e=>l.onloadedmetadata=e)),l.seekable.start(0)===l.seekable.end(0)){const e=await fetch(l.src),t=await e.blob();l.src=URL.createObjectURL(t),await new Promise((e=>l.onloadedmetadata=e))}const c=l.duration;let d,u;null!=t?(d=t,u=1===t?0:c/(t-1)):(u=1/s,d=Math.floor(c/u));let _=[];for(let e=0;e{l.onseeked=e})),m.drawImage(l,0,0,p.width,p.height);const t=m.getImageData(0,0,p.width,p.height),s=new r.RawImage(t.data,p.width,p.height,4),o=new n(s,e);i.push(o)}return l.remove(),new a(i,c)}}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return s[e](n,n.exports,o),n.exports}t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(s,r){if(1&r&&(s=this(s)),8&r)return s;if("object"==typeof s&&s){if(4&r&&s.__esModule)return s;if(16&r&&"function"==typeof s.then)return s}var n=Object.create(null);o.r(n);var a={};e=e||[null,t({}),t([]),t(t)];for(var i=2&r&&s;"object"==typeof i&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach((e=>a[e]=()=>s[e]));return a.default=()=>s,o.d(n,a),n},o.d=(e,t)=>{for(var s in t)o.o(t,s)&&!o.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{ASTFeatureExtractor:()=>p.ASTFeatureExtractor,ASTForAudioClassification:()=>s.ASTForAudioClassification,ASTModel:()=>s.ASTModel,ASTPreTrainedModel:()=>s.ASTPreTrainedModel,AlbertForMaskedLM:()=>s.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>s.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>s.AlbertForSequenceClassification,AlbertModel:()=>s.AlbertModel,AlbertPreTrainedModel:()=>s.AlbertPreTrainedModel,AlbertTokenizer:()=>r.AlbertTokenizer,ArceeForCausalLM:()=>s.ArceeForCausalLM,ArceeModel:()=>s.ArceeModel,ArceePreTrainedModel:()=>s.ArceePreTrainedModel,AudioClassificationPipeline:()=>t.AudioClassificationPipeline,AutoConfig:()=>a.AutoConfig,AutoFeatureExtractor:()=>m.AutoFeatureExtractor,AutoImageProcessor:()=>g.AutoImageProcessor,AutoModel:()=>s.AutoModel,AutoModelForAudioClassification:()=>s.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>s.AutoModelForAudioFrameClassification,AutoModelForAudioTextToText:()=>s.AutoModelForAudioTextToText,AutoModelForCTC:()=>s.AutoModelForCTC,AutoModelForCausalLM:()=>s.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>s.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>s.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>s.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>s.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>s.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>s.AutoModelForImageSegmentation,AutoModelForImageTextToText:()=>s.AutoModelForImageTextToText,AutoModelForImageToImage:()=>s.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>s.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>s.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>s.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>s.AutoModelForObjectDetection,AutoModelForPoseEstimation:()=>s.AutoModelForPoseEstimation,AutoModelForQuestionAnswering:()=>s.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>s.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>s.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>s.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>s.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>s.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>s.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>s.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>s.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>s.AutoModelForVision2Seq,AutoModelForXVector:()=>s.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>s.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>x.AutoProcessor,AutoTokenizer:()=>r.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>t.AutomaticSpeechRecognitionPipeline,BackgroundRemovalPipeline:()=>t.BackgroundRemovalPipeline,BartForConditionalGeneration:()=>s.BartForConditionalGeneration,BartForSequenceClassification:()=>s.BartForSequenceClassification,BartModel:()=>s.BartModel,BartPretrainedModel:()=>s.BartPretrainedModel,BartTokenizer:()=>r.BartTokenizer,BaseModelOutput:()=>s.BaseModelOutput,BaseStreamer:()=>b.BaseStreamer,BeitFeatureExtractor:()=>f.BeitFeatureExtractor,BeitForImageClassification:()=>s.BeitForImageClassification,BeitModel:()=>s.BeitModel,BeitPreTrainedModel:()=>s.BeitPreTrainedModel,BertForMaskedLM:()=>s.BertForMaskedLM,BertForQuestionAnswering:()=>s.BertForQuestionAnswering,BertForSequenceClassification:()=>s.BertForSequenceClassification,BertForTokenClassification:()=>s.BertForTokenClassification,BertModel:()=>s.BertModel,BertPreTrainedModel:()=>s.BertPreTrainedModel,BertTokenizer:()=>r.BertTokenizer,BitImageProcessor:()=>f.BitImageProcessor,BlenderbotForConditionalGeneration:()=>s.BlenderbotForConditionalGeneration,BlenderbotModel:()=>s.BlenderbotModel,BlenderbotPreTrainedModel:()=>s.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>s.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>s.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>s.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>r.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>r.BlenderbotTokenizer,BloomForCausalLM:()=>s.BloomForCausalLM,BloomModel:()=>s.BloomModel,BloomPreTrainedModel:()=>s.BloomPreTrainedModel,BloomTokenizer:()=>r.BloomTokenizer,CLIPFeatureExtractor:()=>f.CLIPFeatureExtractor,CLIPImageProcessor:()=>f.CLIPImageProcessor,CLIPModel:()=>s.CLIPModel,CLIPPreTrainedModel:()=>s.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>s.CLIPSegForImageSegmentation,CLIPSegModel:()=>s.CLIPSegModel,CLIPSegPreTrainedModel:()=>s.CLIPSegPreTrainedModel,CLIPTextModel:()=>s.CLIPTextModel,CLIPTextModelWithProjection:()=>s.CLIPTextModelWithProjection,CLIPTokenizer:()=>r.CLIPTokenizer,CLIPVisionModel:()=>s.CLIPVisionModel,CLIPVisionModelWithProjection:()=>s.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>s.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>s.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>s.CamembertForSequenceClassification,CamembertForTokenClassification:()=>s.CamembertForTokenClassification,CamembertModel:()=>s.CamembertModel,CamembertPreTrainedModel:()=>s.CamembertPreTrainedModel,CamembertTokenizer:()=>r.CamembertTokenizer,CausalLMOutput:()=>s.CausalLMOutput,CausalLMOutputWithPast:()=>s.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>f.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>s.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>s.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>s.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>p.ClapFeatureExtractor,ClapModel:()=>s.ClapModel,ClapPreTrainedModel:()=>s.ClapPreTrainedModel,ClapTextModelWithProjection:()=>s.ClapTextModelWithProjection,ClassifierFreeGuidanceLogitsProcessor:()=>y.ClassifierFreeGuidanceLogitsProcessor,CodeGenForCausalLM:()=>s.CodeGenForCausalLM,CodeGenModel:()=>s.CodeGenModel,CodeGenPreTrainedModel:()=>s.CodeGenPreTrainedModel,CodeGenTokenizer:()=>r.CodeGenTokenizer,CodeLlamaTokenizer:()=>r.CodeLlamaTokenizer,CohereForCausalLM:()=>s.CohereForCausalLM,CohereModel:()=>s.CohereModel,CoherePreTrainedModel:()=>s.CoherePreTrainedModel,CohereTokenizer:()=>r.CohereTokenizer,ConvBertForMaskedLM:()=>s.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>s.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>s.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>s.ConvBertForTokenClassification,ConvBertModel:()=>s.ConvBertModel,ConvBertPreTrainedModel:()=>s.ConvBertPreTrainedModel,ConvBertTokenizer:()=>r.ConvBertTokenizer,ConvNextFeatureExtractor:()=>f.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>s.ConvNextForImageClassification,ConvNextImageProcessor:()=>f.ConvNextImageProcessor,ConvNextModel:()=>s.ConvNextModel,ConvNextPreTrainedModel:()=>s.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>s.ConvNextV2ForImageClassification,ConvNextV2Model:()=>s.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>s.ConvNextV2PreTrainedModel,DFineForObjectDetection:()=>s.DFineForObjectDetection,DFineModel:()=>s.DFineModel,DFinePreTrainedModel:()=>s.DFinePreTrainedModel,DINOv3ConvNextModel:()=>s.DINOv3ConvNextModel,DINOv3ConvNextPreTrainedModel:()=>s.DINOv3ConvNextPreTrainedModel,DINOv3ViTImageProcessor:()=>f.DINOv3ViTImageProcessor,DINOv3ViTModel:()=>s.DINOv3ViTModel,DINOv3ViTPreTrainedModel:()=>s.DINOv3ViTPreTrainedModel,DPTFeatureExtractor:()=>f.DPTFeatureExtractor,DPTForDepthEstimation:()=>s.DPTForDepthEstimation,DPTImageProcessor:()=>f.DPTImageProcessor,DPTModel:()=>s.DPTModel,DPTPreTrainedModel:()=>s.DPTPreTrainedModel,DacDecoderModel:()=>s.DacDecoderModel,DacDecoderOutput:()=>s.DacDecoderOutput,DacEncoderModel:()=>s.DacEncoderModel,DacEncoderOutput:()=>s.DacEncoderOutput,DacFeatureExtractor:()=>p.DacFeatureExtractor,DacModel:()=>s.DacModel,DacPreTrainedModel:()=>s.DacPreTrainedModel,DataTypeMap:()=>d.DataTypeMap,DebertaForMaskedLM:()=>s.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>s.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>s.DebertaForSequenceClassification,DebertaForTokenClassification:()=>s.DebertaForTokenClassification,DebertaModel:()=>s.DebertaModel,DebertaPreTrainedModel:()=>s.DebertaPreTrainedModel,DebertaTokenizer:()=>r.DebertaTokenizer,DebertaV2ForMaskedLM:()=>s.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>s.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>s.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>s.DebertaV2ForTokenClassification,DebertaV2Model:()=>s.DebertaV2Model,DebertaV2PreTrainedModel:()=>s.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>r.DebertaV2Tokenizer,DecisionTransformerModel:()=>s.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>s.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>f.DeiTFeatureExtractor,DeiTForImageClassification:()=>s.DeiTForImageClassification,DeiTImageProcessor:()=>f.DeiTImageProcessor,DeiTModel:()=>s.DeiTModel,DeiTPreTrainedModel:()=>s.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>s.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>s.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>t.DepthEstimationPipeline,DepthProForDepthEstimation:()=>s.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>s.DepthProPreTrainedModel,DetrFeatureExtractor:()=>f.DetrFeatureExtractor,DetrForObjectDetection:()=>s.DetrForObjectDetection,DetrForSegmentation:()=>s.DetrForSegmentation,DetrImageProcessor:()=>f.DetrImageProcessor,DetrModel:()=>s.DetrModel,DetrObjectDetectionOutput:()=>s.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>s.DetrPreTrainedModel,DetrSegmentationOutput:()=>s.DetrSegmentationOutput,Dinov2ForImageClassification:()=>s.Dinov2ForImageClassification,Dinov2Model:()=>s.Dinov2Model,Dinov2PreTrainedModel:()=>s.Dinov2PreTrainedModel,Dinov2WithRegistersForImageClassification:()=>s.Dinov2WithRegistersForImageClassification,Dinov2WithRegistersModel:()=>s.Dinov2WithRegistersModel,Dinov2WithRegistersPreTrainedModel:()=>s.Dinov2WithRegistersPreTrainedModel,DistilBertForMaskedLM:()=>s.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>s.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>s.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>s.DistilBertForTokenClassification,DistilBertModel:()=>s.DistilBertModel,DistilBertPreTrainedModel:()=>s.DistilBertPreTrainedModel,DistilBertTokenizer:()=>r.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>t.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>f.DonutFeatureExtractor,DonutImageProcessor:()=>f.DonutImageProcessor,DonutSwinModel:()=>s.DonutSwinModel,DonutSwinPreTrainedModel:()=>s.DonutSwinPreTrainedModel,EdgeTamModel:()=>s.EdgeTamModel,EfficientNetForImageClassification:()=>s.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>f.EfficientNetImageProcessor,EfficientNetModel:()=>s.EfficientNetModel,EfficientNetPreTrainedModel:()=>s.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>s.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>s.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>s.ElectraForSequenceClassification,ElectraForTokenClassification:()=>s.ElectraForTokenClassification,ElectraModel:()=>s.ElectraModel,ElectraPreTrainedModel:()=>s.ElectraPreTrainedModel,ElectraTokenizer:()=>r.ElectraTokenizer,EncodecFeatureExtractor:()=>p.EncodecFeatureExtractor,EosTokenCriteria:()=>k.EosTokenCriteria,Ernie4_5ForCausalLM:()=>s.Ernie4_5ForCausalLM,Ernie4_5Model:()=>s.Ernie4_5Model,Ernie4_5PreTrainedModel:()=>s.Ernie4_5PreTrainedModel,EsmForMaskedLM:()=>s.EsmForMaskedLM,EsmForSequenceClassification:()=>s.EsmForSequenceClassification,EsmForTokenClassification:()=>s.EsmForTokenClassification,EsmModel:()=>s.EsmModel,EsmPreTrainedModel:()=>s.EsmPreTrainedModel,EsmTokenizer:()=>r.EsmTokenizer,ExaoneForCausalLM:()=>s.ExaoneForCausalLM,ExaoneModel:()=>s.ExaoneModel,ExaonePreTrainedModel:()=>s.ExaonePreTrainedModel,FFT:()=>u.FFT,FalconForCausalLM:()=>s.FalconForCausalLM,FalconModel:()=>s.FalconModel,FalconPreTrainedModel:()=>s.FalconPreTrainedModel,FalconTokenizer:()=>r.FalconTokenizer,FastViTForImageClassification:()=>s.FastViTForImageClassification,FastViTModel:()=>s.FastViTModel,FastViTPreTrainedModel:()=>s.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>t.FeatureExtractionPipeline,FeatureExtractor:()=>_.FeatureExtractor,FillMaskPipeline:()=>t.FillMaskPipeline,Florence2ForConditionalGeneration:()=>s.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>s.Florence2PreTrainedModel,Florence2Processor:()=>M.Florence2Processor,ForcedBOSTokenLogitsProcessor:()=>y.ForcedBOSTokenLogitsProcessor,ForcedEOSTokenLogitsProcessor:()=>y.ForcedEOSTokenLogitsProcessor,GLPNFeatureExtractor:()=>f.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>s.GLPNForDepthEstimation,GLPNModel:()=>s.GLPNModel,GLPNPreTrainedModel:()=>s.GLPNPreTrainedModel,GPT2LMHeadModel:()=>s.GPT2LMHeadModel,GPT2Model:()=>s.GPT2Model,GPT2PreTrainedModel:()=>s.GPT2PreTrainedModel,GPT2Tokenizer:()=>r.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>s.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>s.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>s.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>s.GPTJForCausalLM,GPTJModel:()=>s.GPTJModel,GPTJPreTrainedModel:()=>s.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>s.GPTNeoForCausalLM,GPTNeoModel:()=>s.GPTNeoModel,GPTNeoPreTrainedModel:()=>s.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>s.GPTNeoXForCausalLM,GPTNeoXModel:()=>s.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>s.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>r.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>s.Gemma2ForCausalLM,Gemma2Model:()=>s.Gemma2Model,Gemma2PreTrainedModel:()=>s.Gemma2PreTrainedModel,Gemma3ForCausalLM:()=>s.Gemma3ForCausalLM,Gemma3Model:()=>s.Gemma3Model,Gemma3PreTrainedModel:()=>s.Gemma3PreTrainedModel,Gemma3nAudioFeatureExtractor:()=>p.Gemma3nAudioFeatureExtractor,Gemma3nForConditionalGeneration:()=>s.Gemma3nForConditionalGeneration,Gemma3nPreTrainedModel:()=>s.Gemma3nPreTrainedModel,Gemma3nProcessor:()=>M.Gemma3nProcessor,GemmaForCausalLM:()=>s.GemmaForCausalLM,GemmaModel:()=>s.GemmaModel,GemmaPreTrainedModel:()=>s.GemmaPreTrainedModel,GemmaTokenizer:()=>r.GemmaTokenizer,GlmForCausalLM:()=>s.GlmForCausalLM,GlmModel:()=>s.GlmModel,GlmPreTrainedModel:()=>s.GlmPreTrainedModel,GraniteForCausalLM:()=>s.GraniteForCausalLM,GraniteModel:()=>s.GraniteModel,GraniteMoeHybridForCausalLM:()=>s.GraniteMoeHybridForCausalLM,GraniteMoeHybridModel:()=>s.GraniteMoeHybridModel,GraniteMoeHybridPreTrainedModel:()=>s.GraniteMoeHybridPreTrainedModel,GranitePreTrainedModel:()=>s.GranitePreTrainedModel,Grok1Tokenizer:()=>r.Grok1Tokenizer,GroundingDinoForObjectDetection:()=>s.GroundingDinoForObjectDetection,GroundingDinoImageProcessor:()=>f.GroundingDinoImageProcessor,GroundingDinoPreTrainedModel:()=>s.GroundingDinoPreTrainedModel,GroundingDinoProcessor:()=>M.GroundingDinoProcessor,GroupViTModel:()=>s.GroupViTModel,GroupViTPreTrainedModel:()=>s.GroupViTPreTrainedModel,HeliumForCausalLM:()=>s.HeliumForCausalLM,HeliumModel:()=>s.HeliumModel,HeliumPreTrainedModel:()=>s.HeliumPreTrainedModel,HerbertTokenizer:()=>r.HerbertTokenizer,HieraForImageClassification:()=>s.HieraForImageClassification,HieraModel:()=>s.HieraModel,HieraPreTrainedModel:()=>s.HieraPreTrainedModel,HubertForCTC:()=>s.HubertForCTC,HubertForSequenceClassification:()=>s.HubertForSequenceClassification,HubertModel:()=>s.HubertModel,HubertPreTrainedModel:()=>s.HubertPreTrainedModel,IJepaForImageClassification:()=>s.IJepaForImageClassification,IJepaModel:()=>s.IJepaModel,IJepaPreTrainedModel:()=>s.IJepaPreTrainedModel,Idefics3ForConditionalGeneration:()=>s.Idefics3ForConditionalGeneration,Idefics3ImageProcessor:()=>f.Idefics3ImageProcessor,Idefics3PreTrainedModel:()=>s.Idefics3PreTrainedModel,Idefics3Processor:()=>M.Idefics3Processor,ImageClassificationPipeline:()=>t.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>t.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>p.ImageFeatureExtractor,ImageMattingOutput:()=>s.ImageMattingOutput,ImageProcessor:()=>h.ImageProcessor,ImageSegmentationPipeline:()=>t.ImageSegmentationPipeline,ImageToImagePipeline:()=>t.ImageToImagePipeline,ImageToTextPipeline:()=>t.ImageToTextPipeline,InterruptableStoppingCriteria:()=>k.InterruptableStoppingCriteria,JAISLMHeadModel:()=>s.JAISLMHeadModel,JAISModel:()=>s.JAISModel,JAISPreTrainedModel:()=>s.JAISPreTrainedModel,JinaCLIPImageProcessor:()=>f.JinaCLIPImageProcessor,JinaCLIPModel:()=>s.JinaCLIPModel,JinaCLIPPreTrainedModel:()=>s.JinaCLIPPreTrainedModel,JinaCLIPProcessor:()=>M.JinaCLIPProcessor,JinaCLIPTextModel:()=>s.JinaCLIPTextModel,JinaCLIPVisionModel:()=>s.JinaCLIPVisionModel,Lfm2ForCausalLM:()=>s.Lfm2ForCausalLM,Lfm2Model:()=>s.Lfm2Model,Lfm2PreTrainedModel:()=>s.Lfm2PreTrainedModel,LiteWhisperForConditionalGeneration:()=>s.LiteWhisperForConditionalGeneration,Llama4ForCausalLM:()=>s.Llama4ForCausalLM,Llama4PreTrainedModel:()=>s.Llama4PreTrainedModel,LlamaForCausalLM:()=>s.LlamaForCausalLM,LlamaModel:()=>s.LlamaModel,LlamaPreTrainedModel:()=>s.LlamaPreTrainedModel,LlamaTokenizer:()=>r.LlamaTokenizer,LlavaForConditionalGeneration:()=>s.LlavaForConditionalGeneration,LlavaOnevisionForConditionalGeneration:()=>s.LlavaOnevisionForConditionalGeneration,LlavaOnevisionImageProcessor:()=>f.LlavaOnevisionImageProcessor,LlavaPreTrainedModel:()=>s.LlavaPreTrainedModel,LlavaProcessor:()=>M.LlavaProcessor,LlavaQwen2ForCausalLM:()=>s.LlavaQwen2ForCausalLM,LogitsProcessor:()=>y.LogitsProcessor,LogitsProcessorList:()=>y.LogitsProcessorList,LogitsWarper:()=>y.LogitsWarper,LongT5ForConditionalGeneration:()=>s.LongT5ForConditionalGeneration,LongT5Model:()=>s.LongT5Model,LongT5PreTrainedModel:()=>s.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>s.M2M100ForConditionalGeneration,M2M100Model:()=>s.M2M100Model,M2M100PreTrainedModel:()=>s.M2M100PreTrainedModel,M2M100Tokenizer:()=>r.M2M100Tokenizer,MBart50Tokenizer:()=>r.MBart50Tokenizer,MBartForCausalLM:()=>s.MBartForCausalLM,MBartForConditionalGeneration:()=>s.MBartForConditionalGeneration,MBartForSequenceClassification:()=>s.MBartForSequenceClassification,MBartModel:()=>s.MBartModel,MBartPreTrainedModel:()=>s.MBartPreTrainedModel,MBartTokenizer:()=>r.MBartTokenizer,MPNetForMaskedLM:()=>s.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>s.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>s.MPNetForSequenceClassification,MPNetForTokenClassification:()=>s.MPNetForTokenClassification,MPNetModel:()=>s.MPNetModel,MPNetPreTrainedModel:()=>s.MPNetPreTrainedModel,MPNetTokenizer:()=>r.MPNetTokenizer,MT5ForConditionalGeneration:()=>s.MT5ForConditionalGeneration,MT5Model:()=>s.MT5Model,MT5PreTrainedModel:()=>s.MT5PreTrainedModel,MarianMTModel:()=>s.MarianMTModel,MarianModel:()=>s.MarianModel,MarianPreTrainedModel:()=>s.MarianPreTrainedModel,MarianTokenizer:()=>r.MarianTokenizer,Mask2FormerImageProcessor:()=>f.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>f.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>s.MaskFormerForInstanceSegmentation,MaskFormerImageProcessor:()=>f.MaskFormerImageProcessor,MaskFormerModel:()=>s.MaskFormerModel,MaskFormerPreTrainedModel:()=>s.MaskFormerPreTrainedModel,MaskedLMOutput:()=>s.MaskedLMOutput,MaxLengthCriteria:()=>k.MaxLengthCriteria,Metric3DForDepthEstimation:()=>s.Metric3DForDepthEstimation,Metric3DPreTrainedModel:()=>s.Metric3DPreTrainedModel,Metric3Dv2ForDepthEstimation:()=>s.Metric3Dv2ForDepthEstimation,Metric3Dv2PreTrainedModel:()=>s.Metric3Dv2PreTrainedModel,MgpstrForSceneTextRecognition:()=>s.MgpstrForSceneTextRecognition,MgpstrModelOutput:()=>s.MgpstrModelOutput,MgpstrPreTrainedModel:()=>s.MgpstrPreTrainedModel,MgpstrProcessor:()=>M.MgpstrProcessor,MgpstrTokenizer:()=>r.MgpstrTokenizer,MimiDecoderModel:()=>s.MimiDecoderModel,MimiDecoderOutput:()=>s.MimiDecoderOutput,MimiEncoderModel:()=>s.MimiEncoderModel,MimiEncoderOutput:()=>s.MimiEncoderOutput,MimiModel:()=>s.MimiModel,MimiPreTrainedModel:()=>s.MimiPreTrainedModel,MinLengthLogitsProcessor:()=>y.MinLengthLogitsProcessor,MinNewTokensLengthLogitsProcessor:()=>y.MinNewTokensLengthLogitsProcessor,Ministral3ForCausalLM:()=>s.Ministral3ForCausalLM,Ministral3Model:()=>s.Ministral3Model,Ministral3PreTrainedModel:()=>s.Ministral3PreTrainedModel,MinistralForCausalLM:()=>s.MinistralForCausalLM,MinistralModel:()=>s.MinistralModel,MinistralPreTrainedModel:()=>s.MinistralPreTrainedModel,Mistral3ForConditionalGeneration:()=>s.Mistral3ForConditionalGeneration,MistralForCausalLM:()=>s.MistralForCausalLM,MistralModel:()=>s.MistralModel,MistralPreTrainedModel:()=>s.MistralPreTrainedModel,MobileBertForMaskedLM:()=>s.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>s.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>s.MobileBertForSequenceClassification,MobileBertModel:()=>s.MobileBertModel,MobileBertPreTrainedModel:()=>s.MobileBertPreTrainedModel,MobileBertTokenizer:()=>r.MobileBertTokenizer,MobileLLMForCausalLM:()=>s.MobileLLMForCausalLM,MobileLLMModel:()=>s.MobileLLMModel,MobileLLMPreTrainedModel:()=>s.MobileLLMPreTrainedModel,MobileNetV1FeatureExtractor:()=>f.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>s.MobileNetV1ForImageClassification,MobileNetV1ForSemanticSegmentation:()=>s.MobileNetV1ForSemanticSegmentation,MobileNetV1ImageProcessor:()=>f.MobileNetV1ImageProcessor,MobileNetV1Model:()=>s.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>s.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>f.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>s.MobileNetV2ForImageClassification,MobileNetV2ForSemanticSegmentation:()=>s.MobileNetV2ForSemanticSegmentation,MobileNetV2ImageProcessor:()=>f.MobileNetV2ImageProcessor,MobileNetV2Model:()=>s.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>s.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>f.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>s.MobileNetV3ForImageClassification,MobileNetV3ForSemanticSegmentation:()=>s.MobileNetV3ForSemanticSegmentation,MobileNetV3ImageProcessor:()=>f.MobileNetV3ImageProcessor,MobileNetV3Model:()=>s.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>s.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>f.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>s.MobileNetV4ForImageClassification,MobileNetV4ForSemanticSegmentation:()=>s.MobileNetV4ForSemanticSegmentation,MobileNetV4ImageProcessor:()=>f.MobileNetV4ImageProcessor,MobileNetV4Model:()=>s.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>s.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>f.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>s.MobileViTForImageClassification,MobileViTImageProcessor:()=>f.MobileViTImageProcessor,MobileViTModel:()=>s.MobileViTModel,MobileViTPreTrainedModel:()=>s.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>s.MobileViTV2ForImageClassification,MobileViTV2Model:()=>s.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>s.MobileViTV2PreTrainedModel,ModelOutput:()=>s.ModelOutput,ModernBertDecoderForCausalLM:()=>s.ModernBertDecoderForCausalLM,ModernBertDecoderModel:()=>s.ModernBertDecoderModel,ModernBertDecoderPreTrainedModel:()=>s.ModernBertDecoderPreTrainedModel,ModernBertForMaskedLM:()=>s.ModernBertForMaskedLM,ModernBertForSequenceClassification:()=>s.ModernBertForSequenceClassification,ModernBertForTokenClassification:()=>s.ModernBertForTokenClassification,ModernBertModel:()=>s.ModernBertModel,ModernBertPreTrainedModel:()=>s.ModernBertPreTrainedModel,Moondream1ForConditionalGeneration:()=>s.Moondream1ForConditionalGeneration,MoonshineFeatureExtractor:()=>p.MoonshineFeatureExtractor,MoonshineForConditionalGeneration:()=>s.MoonshineForConditionalGeneration,MoonshineModel:()=>s.MoonshineModel,MoonshinePreTrainedModel:()=>s.MoonshinePreTrainedModel,MoonshineProcessor:()=>M.MoonshineProcessor,MptForCausalLM:()=>s.MptForCausalLM,MptModel:()=>s.MptModel,MptPreTrainedModel:()=>s.MptPreTrainedModel,MultiModalityCausalLM:()=>s.MultiModalityCausalLM,MultiModalityPreTrainedModel:()=>s.MultiModalityPreTrainedModel,MusicgenForCausalLM:()=>s.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>s.MusicgenForConditionalGeneration,MusicgenModel:()=>s.MusicgenModel,MusicgenPreTrainedModel:()=>s.MusicgenPreTrainedModel,NanoChatForCausalLM:()=>s.NanoChatForCausalLM,NanoChatModel:()=>s.NanoChatModel,NanoChatPreTrainedModel:()=>s.NanoChatPreTrainedModel,NeoBertForMaskedLM:()=>s.NeoBertForMaskedLM,NeoBertForQuestionAnswering:()=>s.NeoBertForQuestionAnswering,NeoBertForSequenceClassification:()=>s.NeoBertForSequenceClassification,NeoBertForTokenClassification:()=>s.NeoBertForTokenClassification,NeoBertModel:()=>s.NeoBertModel,NeoBertPreTrainedModel:()=>s.NeoBertPreTrainedModel,NllbTokenizer:()=>r.NllbTokenizer,NoBadWordsLogitsProcessor:()=>y.NoBadWordsLogitsProcessor,NoRepeatNGramLogitsProcessor:()=>y.NoRepeatNGramLogitsProcessor,NomicBertModel:()=>s.NomicBertModel,NomicBertPreTrainedModel:()=>s.NomicBertPreTrainedModel,NougatImageProcessor:()=>f.NougatImageProcessor,NougatTokenizer:()=>r.NougatTokenizer,OPTForCausalLM:()=>s.OPTForCausalLM,OPTModel:()=>s.OPTModel,OPTPreTrainedModel:()=>s.OPTPreTrainedModel,ObjectDetectionPipeline:()=>t.ObjectDetectionPipeline,Olmo2ForCausalLM:()=>s.Olmo2ForCausalLM,Olmo2Model:()=>s.Olmo2Model,Olmo2PreTrainedModel:()=>s.Olmo2PreTrainedModel,OlmoForCausalLM:()=>s.OlmoForCausalLM,OlmoModel:()=>s.OlmoModel,OlmoPreTrainedModel:()=>s.OlmoPreTrainedModel,OpenELMForCausalLM:()=>s.OpenELMForCausalLM,OpenELMModel:()=>s.OpenELMModel,OpenELMPreTrainedModel:()=>s.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>f.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>s.OwlViTForObjectDetection,OwlViTImageProcessor:()=>f.OwlViTImageProcessor,OwlViTModel:()=>s.OwlViTModel,OwlViTPreTrainedModel:()=>s.OwlViTPreTrainedModel,OwlViTProcessor:()=>M.OwlViTProcessor,Owlv2ForObjectDetection:()=>s.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>f.Owlv2ImageProcessor,Owlv2Model:()=>s.Owlv2Model,Owlv2PreTrainedModel:()=>s.Owlv2PreTrainedModel,PaliGemmaForConditionalGeneration:()=>s.PaliGemmaForConditionalGeneration,PaliGemmaPreTrainedModel:()=>s.PaliGemmaPreTrainedModel,PaliGemmaProcessor:()=>M.PaliGemmaProcessor,ParakeetFeatureExtractor:()=>p.ParakeetFeatureExtractor,ParakeetForCTC:()=>s.ParakeetForCTC,ParakeetPreTrainedModel:()=>s.ParakeetPreTrainedModel,PatchTSMixerForPrediction:()=>s.PatchTSMixerForPrediction,PatchTSMixerModel:()=>s.PatchTSMixerModel,PatchTSMixerPreTrainedModel:()=>s.PatchTSMixerPreTrainedModel,PatchTSTForPrediction:()=>s.PatchTSTForPrediction,PatchTSTModel:()=>s.PatchTSTModel,PatchTSTPreTrainedModel:()=>s.PatchTSTPreTrainedModel,Phi3ForCausalLM:()=>s.Phi3ForCausalLM,Phi3Model:()=>s.Phi3Model,Phi3PreTrainedModel:()=>s.Phi3PreTrainedModel,Phi3VForCausalLM:()=>s.Phi3VForCausalLM,Phi3VImageProcessor:()=>f.Phi3VImageProcessor,Phi3VPreTrainedModel:()=>s.Phi3VPreTrainedModel,Phi3VProcessor:()=>M.Phi3VProcessor,PhiForCausalLM:()=>s.PhiForCausalLM,PhiModel:()=>s.PhiModel,PhiPreTrainedModel:()=>s.PhiPreTrainedModel,Pipeline:()=>t.Pipeline,PixtralImageProcessor:()=>f.PixtralImageProcessor,PixtralProcessor:()=>M.PixtralProcessor,PreTrainedModel:()=>s.PreTrainedModel,PreTrainedTokenizer:()=>r.PreTrainedTokenizer,PretrainedConfig:()=>a.PretrainedConfig,PretrainedMixin:()=>s.PretrainedMixin,Processor:()=>w.Processor,PvtForImageClassification:()=>s.PvtForImageClassification,PvtImageProcessor:()=>f.PvtImageProcessor,PvtModel:()=>s.PvtModel,PvtPreTrainedModel:()=>s.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>p.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>s.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>s.PyAnnoteModel,PyAnnotePreTrainedModel:()=>s.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>M.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>s.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>t.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>s.Qwen2ForCausalLM,Qwen2Model:()=>s.Qwen2Model,Qwen2PreTrainedModel:()=>s.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>r.Qwen2Tokenizer,Qwen2VLForConditionalGeneration:()=>s.Qwen2VLForConditionalGeneration,Qwen2VLImageProcessor:()=>f.Qwen2VLImageProcessor,Qwen2VLPreTrainedModel:()=>s.Qwen2VLPreTrainedModel,Qwen2VLProcessor:()=>M.Qwen2VLProcessor,Qwen3ForCausalLM:()=>s.Qwen3ForCausalLM,Qwen3Model:()=>s.Qwen3Model,Qwen3PreTrainedModel:()=>s.Qwen3PreTrainedModel,RFDetrForObjectDetection:()=>s.RFDetrForObjectDetection,RFDetrModel:()=>s.RFDetrModel,RFDetrObjectDetectionOutput:()=>s.RFDetrObjectDetectionOutput,RFDetrPreTrainedModel:()=>s.RFDetrPreTrainedModel,RTDetrForObjectDetection:()=>s.RTDetrForObjectDetection,RTDetrImageProcessor:()=>f.RTDetrImageProcessor,RTDetrModel:()=>s.RTDetrModel,RTDetrObjectDetectionOutput:()=>s.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>s.RTDetrPreTrainedModel,RTDetrV2ForObjectDetection:()=>s.RTDetrV2ForObjectDetection,RTDetrV2Model:()=>s.RTDetrV2Model,RTDetrV2ObjectDetectionOutput:()=>s.RTDetrV2ObjectDetectionOutput,RTDetrV2PreTrainedModel:()=>s.RTDetrV2PreTrainedModel,RawAudio:()=>i.RawAudio,RawImage:()=>l.RawImage,RawVideo:()=>c.RawVideo,RawVideoFrame:()=>c.RawVideoFrame,RepetitionPenaltyLogitsProcessor:()=>y.RepetitionPenaltyLogitsProcessor,ResNetForImageClassification:()=>s.ResNetForImageClassification,ResNetModel:()=>s.ResNetModel,ResNetPreTrainedModel:()=>s.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>s.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>s.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>s.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>s.RoFormerForTokenClassification,RoFormerModel:()=>s.RoFormerModel,RoFormerPreTrainedModel:()=>s.RoFormerPreTrainedModel,RoFormerTokenizer:()=>r.RoFormerTokenizer,RobertaForMaskedLM:()=>s.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>s.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>s.RobertaForSequenceClassification,RobertaForTokenClassification:()=>s.RobertaForTokenClassification,RobertaModel:()=>s.RobertaModel,RobertaPreTrainedModel:()=>s.RobertaPreTrainedModel,RobertaTokenizer:()=>r.RobertaTokenizer,Sam2ImageProcessor:()=>f.Sam2ImageProcessor,Sam2ImageSegmentationOutput:()=>s.Sam2ImageSegmentationOutput,Sam2Model:()=>s.Sam2Model,Sam2PreTrainedModel:()=>s.Sam2PreTrainedModel,Sam2Processor:()=>M.Sam2Processor,Sam2VideoProcessor:()=>M.Sam2VideoProcessor,Sam3ImageProcessor:()=>f.Sam3ImageProcessor,Sam3TrackerModel:()=>s.Sam3TrackerModel,SamImageProcessor:()=>f.SamImageProcessor,SamImageSegmentationOutput:()=>s.SamImageSegmentationOutput,SamModel:()=>s.SamModel,SamPreTrainedModel:()=>s.SamPreTrainedModel,SamProcessor:()=>M.SamProcessor,SapiensForDepthEstimation:()=>s.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>s.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>s.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>s.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>p.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>f.SegformerFeatureExtractor,SegformerForImageClassification:()=>s.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>s.SegformerForSemanticSegmentation,SegformerImageProcessor:()=>f.SegformerImageProcessor,SegformerModel:()=>s.SegformerModel,SegformerPreTrainedModel:()=>s.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>s.Seq2SeqLMOutput,SequenceClassifierOutput:()=>s.SequenceClassifierOutput,SiglipImageProcessor:()=>f.SiglipImageProcessor,SiglipModel:()=>s.SiglipModel,SiglipPreTrainedModel:()=>s.SiglipPreTrainedModel,SiglipTextModel:()=>s.SiglipTextModel,SiglipTokenizer:()=>r.SiglipTokenizer,SiglipVisionModel:()=>s.SiglipVisionModel,SmolLM3ForCausalLM:()=>s.SmolLM3ForCausalLM,SmolLM3Model:()=>s.SmolLM3Model,SmolLM3PreTrainedModel:()=>s.SmolLM3PreTrainedModel,SmolVLMForConditionalGeneration:()=>s.SmolVLMForConditionalGeneration,SmolVLMImageProcessor:()=>f.SmolVLMImageProcessor,SmolVLMProcessor:()=>M.SmolVLMProcessor,SnacDecoderModel:()=>s.SnacDecoderModel,SnacEncoderModel:()=>s.SnacEncoderModel,SnacFeatureExtractor:()=>p.SnacFeatureExtractor,SnacModel:()=>s.SnacModel,SnacPreTrainedModel:()=>s.SnacPreTrainedModel,SpeechT5FeatureExtractor:()=>p.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>s.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>s.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>s.SpeechT5HifiGan,SpeechT5Model:()=>s.SpeechT5Model,SpeechT5PreTrainedModel:()=>s.SpeechT5PreTrainedModel,SpeechT5Processor:()=>M.SpeechT5Processor,SpeechT5Tokenizer:()=>r.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>s.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>s.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>s.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>s.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>s.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>r.SqueezeBertTokenizer,StableLmForCausalLM:()=>s.StableLmForCausalLM,StableLmModel:()=>s.StableLmModel,StableLmPreTrainedModel:()=>s.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>s.Starcoder2ForCausalLM,Starcoder2Model:()=>s.Starcoder2Model,Starcoder2PreTrainedModel:()=>s.Starcoder2PreTrainedModel,StoppingCriteria:()=>k.StoppingCriteria,StoppingCriteriaList:()=>k.StoppingCriteriaList,StyleTextToSpeech2Model:()=>s.StyleTextToSpeech2Model,StyleTextToSpeech2PreTrainedModel:()=>s.StyleTextToSpeech2PreTrainedModel,SummarizationPipeline:()=>t.SummarizationPipeline,SupertonicForConditionalGeneration:()=>s.SupertonicForConditionalGeneration,SupertonicPreTrainedModel:()=>s.SupertonicPreTrainedModel,SuppressTokensAtBeginLogitsProcessor:()=>y.SuppressTokensAtBeginLogitsProcessor,Swin2SRForImageSuperResolution:()=>s.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>f.Swin2SRImageProcessor,Swin2SRModel:()=>s.Swin2SRModel,Swin2SRPreTrainedModel:()=>s.Swin2SRPreTrainedModel,SwinForImageClassification:()=>s.SwinForImageClassification,SwinForSemanticSegmentation:()=>s.SwinForSemanticSegmentation,SwinModel:()=>s.SwinModel,SwinPreTrainedModel:()=>s.SwinPreTrainedModel,T5ForConditionalGeneration:()=>s.T5ForConditionalGeneration,T5Model:()=>s.T5Model,T5PreTrainedModel:()=>s.T5PreTrainedModel,T5Tokenizer:()=>r.T5Tokenizer,TableTransformerForObjectDetection:()=>s.TableTransformerForObjectDetection,TableTransformerModel:()=>s.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>s.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>s.TableTransformerPreTrainedModel,TemperatureLogitsWarper:()=>y.TemperatureLogitsWarper,Tensor:()=>d.Tensor,Text2TextGenerationPipeline:()=>t.Text2TextGenerationPipeline,TextClassificationPipeline:()=>t.TextClassificationPipeline,TextGenerationPipeline:()=>t.TextGenerationPipeline,TextStreamer:()=>b.TextStreamer,TextToAudioPipeline:()=>t.TextToAudioPipeline,TokenClassificationPipeline:()=>t.TokenClassificationPipeline,TokenClassifierOutput:()=>s.TokenClassifierOutput,TokenizerModel:()=>r.TokenizerModel,TopKLogitsWarper:()=>y.TopKLogitsWarper,TopPLogitsWarper:()=>y.TopPLogitsWarper,TrOCRForCausalLM:()=>s.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>s.TrOCRPreTrainedModel,TranslationPipeline:()=>t.TranslationPipeline,UltravoxModel:()=>s.UltravoxModel,UltravoxPreTrainedModel:()=>s.UltravoxPreTrainedModel,UltravoxProcessor:()=>M.UltravoxProcessor,UniSpeechForCTC:()=>s.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>s.UniSpeechForSequenceClassification,UniSpeechModel:()=>s.UniSpeechModel,UniSpeechPreTrainedModel:()=>s.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>s.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>s.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>s.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>s.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>s.UniSpeechSatPreTrainedModel,VLChatProcessor:()=>M.VLChatProcessor,VLMImageProcessor:()=>f.VLMImageProcessor,VaultGemmaForCausalLM:()=>s.VaultGemmaForCausalLM,VaultGemmaModel:()=>s.VaultGemmaModel,VaultGemmaPreTrainedModel:()=>s.VaultGemmaPreTrainedModel,ViTFeatureExtractor:()=>f.ViTFeatureExtractor,ViTForImageClassification:()=>s.ViTForImageClassification,ViTImageProcessor:()=>f.ViTImageProcessor,ViTMAEModel:()=>s.ViTMAEModel,ViTMAEPreTrainedModel:()=>s.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>s.ViTMSNForImageClassification,ViTMSNModel:()=>s.ViTMSNModel,ViTMSNPreTrainedModel:()=>s.ViTMSNPreTrainedModel,ViTModel:()=>s.ViTModel,ViTPreTrainedModel:()=>s.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>s.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>s.VitMatteForImageMatting,VitMatteImageProcessor:()=>f.VitMatteImageProcessor,VitMattePreTrainedModel:()=>s.VitMattePreTrainedModel,VitPoseForPoseEstimation:()=>s.VitPoseForPoseEstimation,VitPoseImageProcessor:()=>f.VitPoseImageProcessor,VitPosePreTrainedModel:()=>s.VitPosePreTrainedModel,VitsModel:()=>s.VitsModel,VitsModelOutput:()=>s.VitsModelOutput,VitsPreTrainedModel:()=>s.VitsPreTrainedModel,VitsTokenizer:()=>r.VitsTokenizer,VoxtralForConditionalGeneration:()=>s.VoxtralForConditionalGeneration,VoxtralProcessor:()=>M.VoxtralProcessor,Wav2Vec2BertForCTC:()=>s.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>s.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>s.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>s.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>r.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>p.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>s.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>s.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>s.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>s.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>s.Wav2Vec2PreTrainedModel,Wav2Vec2Processor:()=>M.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>M.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>s.WavLMForAudioFrameClassification,WavLMForCTC:()=>s.WavLMForCTC,WavLMForSequenceClassification:()=>s.WavLMForSequenceClassification,WavLMForXVector:()=>s.WavLMForXVector,WavLMModel:()=>s.WavLMModel,WavLMPreTrainedModel:()=>s.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>p.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>s.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>s.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>p.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>s.WhisperForConditionalGeneration,WhisperModel:()=>s.WhisperModel,WhisperPreTrainedModel:()=>s.WhisperPreTrainedModel,WhisperProcessor:()=>M.WhisperProcessor,WhisperTextStreamer:()=>b.WhisperTextStreamer,WhisperTimeStampLogitsProcessor:()=>y.WhisperTimeStampLogitsProcessor,WhisperTokenizer:()=>r.WhisperTokenizer,XLMForQuestionAnswering:()=>s.XLMForQuestionAnswering,XLMForSequenceClassification:()=>s.XLMForSequenceClassification,XLMForTokenClassification:()=>s.XLMForTokenClassification,XLMModel:()=>s.XLMModel,XLMPreTrainedModel:()=>s.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>s.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>s.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>s.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>s.XLMRobertaForTokenClassification,XLMRobertaModel:()=>s.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>s.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>r.XLMRobertaTokenizer,XLMTokenizer:()=>r.XLMTokenizer,XLMWithLMHeadModel:()=>s.XLMWithLMHeadModel,XVectorOutput:()=>s.XVectorOutput,YolosFeatureExtractor:()=>f.YolosFeatureExtractor,YolosForObjectDetection:()=>s.YolosForObjectDetection,YolosImageProcessor:()=>f.YolosImageProcessor,YolosModel:()=>s.YolosModel,YolosObjectDetectionOutput:()=>s.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>s.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>t.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>t.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>t.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>t.ZeroShotObjectDetectionPipeline,bankers_round:()=>u.bankers_round,cat:()=>d.cat,cos_sim:()=>u.cos_sim,dot:()=>u.dot,dynamic_time_warping:()=>u.dynamic_time_warping,env:()=>e.env,full:()=>d.full,full_like:()=>d.full_like,getCacheShapes:()=>a.getCacheShapes,hamming:()=>i.hamming,hanning:()=>i.hanning,interpolate:()=>d.interpolate,interpolate_4d:()=>d.interpolate_4d,interpolate_data:()=>u.interpolate_data,is_chinese_char:()=>r.is_chinese_char,layer_norm:()=>d.layer_norm,load_image:()=>l.load_image,load_video:()=>c.load_video,log_softmax:()=>u.log_softmax,magnitude:()=>u.magnitude,matmul:()=>d.matmul,max:()=>u.max,mean:()=>d.mean,mean_pooling:()=>d.mean_pooling,medianFilter:()=>u.medianFilter,mel_filter_bank:()=>i.mel_filter_bank,min:()=>u.min,ones:()=>d.ones,ones_like:()=>d.ones_like,permute:()=>d.permute,permute_data:()=>u.permute_data,pipeline:()=>t.pipeline,quantize_embeddings:()=>d.quantize_embeddings,rand:()=>d.rand,randn:()=>d.randn,read_audio:()=>i.read_audio,rfft:()=>d.rfft,round:()=>u.round,slice:()=>d.slice,softmax:()=>u.softmax,spectrogram:()=>i.spectrogram,stack:()=>d.stack,std_mean:()=>d.std_mean,topk:()=>d.topk,window_function:()=>i.window_function,zeros:()=>d.zeros,zeros_like:()=>d.zeros_like});var e=o("./src/env.js"),t=o("./src/pipelines.js"),s=o("./src/models.js"),r=o("./src/tokenizers.js"),a=o("./src/configs.js"),i=o("./src/utils/audio.js"),l=o("./src/utils/image.js"),c=o("./src/utils/video.js"),d=o("./src/utils/tensor.js"),u=o("./src/utils/maths.js"),_=o("./src/base/feature_extraction_utils.js"),p=o("./src/models/feature_extractors.js"),m=o("./src/models/auto/feature_extraction_auto.js"),h=o("./src/base/image_processors_utils.js"),f=o("./src/models/image_processors.js"),g=o("./src/models/auto/image_processing_auto.js"),w=o("./src/base/processing_utils.js"),M=o("./src/models/processors.js"),x=o("./src/models/auto/processing_auto.js"),b=o("./src/generation/streamers.js"),k=o("./src/generation/stopping_criteria.js"),y=o("./src/generation/logits_process.js")})();var a=exports;for(var i in n)a[i]=n[i];n.__esModule&&Object.defineProperty(a,"__esModule",{value:!0})})(); //# sourceMappingURL=transformers.node.min.cjs.map