MODNet / _next /static /chunks /8e8c7643-c0bf9f1b464b0e83.js
wuchendi's picture
Update space
4636528
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[253],{2210:(e,t,r)=>{r.d(t,{YOx:()=>p,_K2:()=>_,oye:()=>m,rKH:()=>u});var s=r(9191),o=r(7829),n=r(7946),a=r(8378).Buffer,i={"onnxruntime-common":e=>{e.exports=s},"onnxruntime-web":e=>{e.exports=o},"?2ce3":()=>{},"?7a2c":()=>{},"?a42a":()=>{},"?2b25":()=>{},"?569f":()=>{},"?3f59":()=>{},"?154a":()=>{},"./node_modules/@huggingface/jinja/dist/index.js":(e,t,r)=>{r.r(t),r.d(t,{Environment:()=>et,Interpreter:()=>er,Template:()=>ei,parse:()=>V,tokenize:()=>d});var s=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",NullLiteral:"NullLiteral",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",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndSet:"EndSet",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator",Macro:"Macro",EndMacro:"EndMacro",Break:"Break",Continue:"Continue"}),o=Object.freeze({set:s.Set,for:s.For,in:s.In,is:s.Is,if:s.If,else:s.Else,endset:s.EndSet,endif:s.EndIf,elif:s.ElseIf,endfor:s.EndFor,and:s.And,or:s.Or,not:s.Not,"not in":s.NotIn,macro:s.Macro,endmacro:s.EndMacro,break:s.Break,continue:s.Continue,true:s.BooleanLiteral,false:s.BooleanLiteral,none:s.NullLiteral,True:s.BooleanLiteral,False:s.BooleanLiteral,None:s.NullLiteral}),n=class{constructor(e,t){this.value=e,this.type=t}};function a(e){return/\w/.test(e)}function i(e){return/[0-9]/.test(e)}var l=[["{%",s.OpenStatement],["%}",s.CloseStatement],["{{",s.OpenExpression],["}}",s.CloseExpression],["(",s.OpenParen],[")",s.CloseParen],["{",s.OpenCurlyBracket],["}",s.CloseCurlyBracket],["[",s.OpenSquareBracket],["]",s.CloseSquareBracket],[",",s.Comma],[".",s.Dot],[":",s.Colon],["|",s.Pipe],["<=",s.ComparisonBinaryOperator],[">=",s.ComparisonBinaryOperator],["==",s.ComparisonBinaryOperator],["!=",s.ComparisonBinaryOperator],["<",s.ComparisonBinaryOperator],[">",s.ComparisonBinaryOperator],["+",s.AdditiveBinaryOperator],["-",s.AdditiveBinaryOperator],["*",s.MultiplicativeBinaryOperator],["/",s.MultiplicativeBinaryOperator],["%",s.MultiplicativeBinaryOperator],["=",s.Equals]],c=new Map([["n","\n"],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function d(e,t={}){let r=[],u=function(e,t={}){return e.endsWith("\n")&&(e=e.slice(0,-1)),e=e.replace(/{#.*?#}/gs,"{##}"),t.lstrip_blocks&&(e=e.replace(/^[ \t]*({[#%])/gm,"$1")),t.trim_blocks&&(e=e.replace(/([#%]})\n/g,"$1")),e.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}(e,t),m=0,p=e=>{let t="";for(;e(u[m]);){if("\\"===u[m]){if(++m>=u.length)throw SyntaxError("Unexpected end of input");let e=u[m++],r=c.get(e);if(void 0===r)throw SyntaxError(`Unexpected escaped character: ${e}`);t+=r;continue}if(t+=u[m++],m>=u.length)throw SyntaxError("Unexpected end of input")}return t};e:for(;m<u.length;){let e=r.at(-1)?.type;if(void 0===e||e===s.CloseStatement||e===s.CloseExpression){let e="";for(;m<u.length&&("{"!==u[m]||"%"!==u[m+1]&&"{"!==u[m+1]);)e+=u[m++];if(e.length>0){r.push(new n(e,s.Text));continue}}p(e=>/\s/.test(e));let t=u[m];if("-"===t||"+"===t){let e=r.at(-1)?.type;if(e===s.Text||void 0===e)throw SyntaxError(`Unexpected character: ${t}`);switch(e){case s.Identifier:case s.NumericLiteral:case s.BooleanLiteral:case s.NullLiteral:case s.StringLiteral:case s.CloseParen:case s.CloseSquareBracket:break;default:{++m;let e=p(i);r.push(new n(`${t}${e}`,e.length>0?s.NumericLiteral:s.UnaryOperator));continue}}}for(let[e,t]of l)if(u.slice(m,m+e.length)===e){r.push(new n(e,t)),m+=e.length;continue e}if("'"===t||'"'===t){++m;let e=p(e=>e!==t);r.push(new n(e,s.StringLiteral)),++m;continue}if(i(t)){let e=p(i);r.push(new n(e,s.NumericLiteral));continue}if(a(t)){let e=p(a),t=Object.hasOwn(o,e)?o[e]:s.Identifier;t===s.In&&r.at(-1)?.type===s.Not?(r.pop(),r.push(new n("not in",s.NotIn))):r.push(new n(e,t));continue}throw SyntaxError(`Unexpected character: ${t}`)}return r}var u=class{type="Statement"},m=class extends u{constructor(e){super(),this.body=e}type="Program"},p=class extends u{constructor(e,t,r){super(),this.test=e,this.body=t,this.alternate=r}type="If"},_=class extends u{constructor(e,t,r,s){super(),this.loopvar=e,this.iterable=t,this.body=r,this.defaultBlock=s}type="For"},h=class extends u{type="Break"},g=class extends u{type="Continue"},f=class extends u{constructor(e,t,r){super(),this.assignee=e,this.value=t,this.body=r}type="Set"},M=class extends u{constructor(e,t,r){super(),this.name=e,this.args=t,this.body=r}type="Macro"},w=class extends u{type="Expression"},x=class extends w{constructor(e,t,r){super(),this.object=e,this.property=t,this.computed=r}type="MemberExpression"},b=class extends w{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},T=class extends w{constructor(e){super(),this.value=e}type="Identifier"},P=class extends w{constructor(e){super(),this.value=e}type="Literal"},y=class extends P{type="NumericLiteral"},k=class extends P{type="StringLiteral"},F=class extends P{type="BooleanLiteral"},v=class extends P{type="NullLiteral"},C=class extends P{type="ArrayLiteral"},S=class extends P{type="TupleLiteral"},E=class extends P{type="ObjectLiteral"},A=class extends w{constructor(e,t,r){super(),this.operator=e,this.left=t,this.right=r}type="BinaryExpression"},L=class extends w{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},I=class extends w{constructor(e,t){super(),this.iterable=e,this.test=t}type="SelectExpression"},z=class extends w{constructor(e,t,r){super(),this.operand=e,this.negate=t,this.test=r}type="TestExpression"},j=class extends w{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},D=class extends w{constructor(e,t,r){super(),this.start=e,this.stop=t,this.step=r}type="SliceExpression"},O=class extends w{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"};function V(e){let t=new m([]),r=0;function o(t,s){let o=e[r++];if(!o||o.type!==t)throw Error(`Parser Error: ${s}. ${o.type} !== ${t}.`);return o}function n(...t){return r+t.length<=e.length&&t.some((t,s)=>t!==e[r+s].type)}function a(...t){return r+t.length<=e.length&&t.every((t,s)=>t===e[r+s].type)}function i(e=!1){let t=e?R:l,o=[t()],n=a(s.Comma);for(;n&&(++r,o.push(t()),a(s.Comma)););return n?new S(o):o[0]}function l(){let e=c();if(a(s.If)){++r;let t=c();return a(s.Else)?(++r,new p(t,[e],[c()])):new I(e,t)}return e}function c(){let t=d();for(;a(s.Or);){let s=e[r];++r,t=new A(s,t,d())}return t}function d(){let t=u();for(;a(s.And);){let s=e[r];++r,t=new A(s,t,u())}return t}function u(){let t;for(;a(s.Not);){let s=e[r];++r,t=new j(s,u())}return t??function(){let t=w();for(;a(s.ComparisonBinaryOperator)||a(s.In)||a(s.NotIn);){let s=e[r];++r,t=new A(s,t,w())}return t}()}function w(){let t=B();for(;a(s.AdditiveBinaryOperator);){let s=e[r];++r,t=new A(s,t,B())}return t}function P(e){let t=new b(e,V());return t=N(t),a(s.OpenParen)&&(t=P(t)),t}function V(){o(s.OpenParen,"Expected opening parenthesis for arguments list");let e=function(){let e=[];for(;!a(s.CloseParen);){let t=l();if(a(s.Equals)){if(++r,!(t instanceof T))throw SyntaxError("Expected identifier for keyword argument");t=new O(t,l())}e.push(t),a(s.Comma)&&++r}return e}();return o(s.CloseParen,"Expected closing parenthesis for arguments list"),e}function N(t){for(;a(s.Dot)||a(s.OpenSquareBracket);){let n,i=e[r];++r;let c=i.type!==s.Dot;if(c)n=function(){let e=[],t=!1;for(;!a(s.CloseSquareBracket);)a(s.Colon)?(e.push(void 0),++r,t=!0):(e.push(l()),a(s.Colon)&&(++r,t=!0));if(0===e.length)throw SyntaxError("Expected at least one argument for member/slice expression");if(t){if(e.length>3)throw SyntaxError("Expected 0-3 arguments for slice expression");return new D(...e)}return e[0]}(),o(s.CloseSquareBracket,"Expected closing square bracket");else if("Identifier"!==(n=R()).type)throw SyntaxError("Expected identifier following dot operator");t=new x(t,n,c)}return t}function B(){let t=G();for(;a(s.MultiplicativeBinaryOperator);){let s=e[r];++r,t=new A(s,t,G())}return t}function G(){let e=function(){let e=function(){let e=N(R());return a(s.OpenParen)?P(e):e}();for(;a(s.Pipe);){++r;let t=R();if(!(t instanceof T))throw SyntaxError("Expected identifier for the filter");a(s.OpenParen)&&(t=P(t)),e=new L(e,t)}return e}();for(;a(s.Is);){++r;let t=a(s.Not);t&&++r;let o=R();if(o instanceof F?o=new T(o.value.toString()):o instanceof v&&(o=new T("none")),!(o instanceof T))throw SyntaxError("Expected identifier for the test");e=new z(e,t,o)}return e}function R(){let t=e[r];switch(t.type){case s.NumericLiteral:return++r,new y(Number(t.value));case s.StringLiteral:return++r,new k(t.value);case s.BooleanLiteral:return++r,new F("true"===t.value.toLowerCase());case s.NullLiteral:return++r,new v(null);case s.Identifier:return++r,new T(t.value);case s.OpenParen:{++r;let t=i();if(e[r].type!==s.CloseParen)throw SyntaxError(`Expected closing parenthesis, got ${e[r].type} instead`);return++r,t}case s.OpenSquareBracket:{++r;let e=[];for(;!a(s.CloseSquareBracket);)e.push(l()),a(s.Comma)&&++r;return++r,new C(e)}case s.OpenCurlyBracket:{++r;let e=new Map;for(;!a(s.CloseCurlyBracket);){let t=l();o(s.Colon,"Expected colon between key and value in object literal");let n=l();e.set(t,n),a(s.Comma)&&++r}return++r,new E(e)}default:throw SyntaxError(`Unexpected token: ${t.type}`)}}for(;r<e.length;)t.body.push(function t(){switch(e[r].type){case s.Text:return new k(o(s.Text,"Expected text token").value);case s.OpenStatement:let c;switch(o(s.OpenStatement,"Expected opening statement token"),e[r].type){case s.Set:++r,c=function(){let n=l();if(a(s.Equals))return++r,new f(n,l(),[]);{let a=[];for(o(s.CloseStatement,"Expected %} token");e[r]?.type!==s.OpenStatement||e[r+1]?.type!==s.EndSet;){let e=t();a.push(e)}return o(s.OpenStatement,"Expected {% token"),o(s.EndSet,"Expected endset token"),new f(n,null,a)}}(),o(s.CloseStatement,"Expected closing statement token");break;case s.If:++r,c=function n(){let i=l();o(s.CloseStatement,"Expected closing statement token");let c=[],d=[];for(;e[r]?.type!==s.OpenStatement||e[r+1]?.type!==s.ElseIf&&e[r+1]?.type!==s.Else&&e[r+1]?.type!==s.EndIf;)c.push(t());if(e[r]?.type===s.OpenStatement&&e[r+1]?.type!==s.EndIf)if(++r,a(s.ElseIf))o(s.ElseIf,"Expected elseif token"),d.push(n());else for(o(s.Else,"Expected else token"),o(s.CloseStatement,"Expected closing statement token");e[r]?.type!==s.OpenStatement||e[r+1]?.type!==s.EndIf;)d.push(t());return new p(i,c,d)}(),o(s.OpenStatement,"Expected {% token"),o(s.EndIf,"Expected endif token"),o(s.CloseStatement,"Expected %} token");break;case s.Macro:++r,c=function(){let e=R();if("Identifier"!==e.type)throw SyntaxError("Expected identifier following macro statement");let r=V();o(s.CloseStatement,"Expected closing statement token");let a=[];for(;n(s.OpenStatement,s.EndMacro);)a.push(t());return new M(e,r,a)}(),o(s.OpenStatement,"Expected {% token"),o(s.EndMacro,"Expected endmacro token"),o(s.CloseStatement,"Expected %} token");break;case s.For:++r,c=function(){let e=i(!0);if(!(e instanceof T||e instanceof S))throw SyntaxError(`Expected identifier/tuple for the loop variable, got ${e.type} instead`);o(s.In,"Expected `in` keyword following loop variable");let c=l();o(s.CloseStatement,"Expected closing statement token");let d=[];for(;n(s.OpenStatement,s.EndFor)&&n(s.OpenStatement,s.Else);)d.push(t());let u=[];if(a(s.OpenStatement,s.Else))for(++r,++r,o(s.CloseStatement,"Expected closing statement token");n(s.OpenStatement,s.EndFor);)u.push(t());return new _(e,c,d,u)}(),o(s.OpenStatement,"Expected {% token"),o(s.EndFor,"Expected endfor token"),o(s.CloseStatement,"Expected %} token");break;case s.Break:++r,o(s.CloseStatement,"Expected closing statement token"),c=new h;break;case s.Continue:++r,o(s.CloseStatement,"Expected closing statement token"),c=new g;break;default:throw SyntaxError(`Unknown statement type: ${e[r].type}`)}return c;case s.OpenExpression:o(s.OpenExpression,"Expected opening expression token");let d=l();return o(s.CloseExpression,"Expected closing expression token"),d;default:throw SyntaxError(`Unexpected token type: ${e[r].type}`)}}());return t}function N(e,t,r=1){void 0===t&&(t=e,e=0);let s=[];for(let o=e;o<t;o+=r)s.push(o);return s}function B(e,t,r,s=1){let o=Math.sign(s);o>=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),r=(r??=e.length)<0?Math.max(e.length+r,0):Math.min(r,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),r=(r??=-1)<-1?Math.max(e.length+r,-1):Math.min(r,e.length-1));let n=[];for(let a=t;o*a<o*r;a+=s)n.push(e[a]);return n}function G(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}var R=class extends Error{},q=class extends Error{},$=class{type="RuntimeValue";value;builtins=new Map;constructor(e){this.value=e}__bool__(){return new Q(!!this.value)}},W=class extends ${type="NumericValue"},U=class extends ${type="StringValue";builtins=new Map([["upper",new K(()=>new U(this.value.toUpperCase()))],["lower",new K(()=>new U(this.value.toLowerCase()))],["strip",new K(()=>new U(this.value.trim()))],["title",new K(()=>new U(G(this.value)))],["length",new W(this.value.length)],["rstrip",new K(()=>new U(this.value.trimEnd()))],["lstrip",new K(()=>new U(this.value.trimStart()))],["startswith",new K(e=>{if(0===e.length)throw Error("startswith() requires at least one argument");let t=e[0];if(!(t instanceof U))throw Error("startswith() argument must be a string");return new Q(this.value.startsWith(t.value))})],["endswith",new K(e=>{if(0===e.length)throw Error("endswith() requires at least one argument");let t=e[0];if(!(t instanceof U))throw Error("endswith() argument must be a string");return new Q(this.value.endsWith(t.value))})],["split",new K(e=>{let t=e[0]??new Z;if(!(t instanceof U||t instanceof Z))throw Error("sep argument must be a string or null");let r=e[1]??new W(-1);if(!(r instanceof W))throw Error("maxsplit argument must be a number");let s=[];if(t instanceof Z){let e=this.value.trimStart();for(let{0:t,index:o}of e.matchAll(/\S+/g)){if(-1!==r.value&&s.length>=r.value&&void 0!==o){s.push(t+e.slice(o+t.length));break}s.push(t)}}else{if(""===t.value)throw Error("empty separator");s=this.value.split(t.value),-1!==r.value&&s.length>r.value&&s.push(s.splice(r.value).join(t.value))}return new J(s.map(e=>new U(e)))})]])},Q=class extends ${type="BooleanValue"},X=class extends ${type="ObjectValue";__bool__(){return new Q(this.value.size>0)}builtins=new Map([["get",new K(([e,t])=>{if(!(e instanceof U))throw Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??t??new Z})],["items",new K(()=>new J(Array.from(this.value.entries()).map(([e,t])=>new J([new U(e),t]))))]])},H=class extends X{type="KeywordArgumentsValue"},J=class extends ${type="ArrayValue";builtins=new Map([["length",new W(this.value.length)]]);__bool__(){return new Q(this.value.length>0)}},Y=class extends J{type="TupleValue"},K=class extends ${type="FunctionValue"},Z=class extends ${type="NullValue"},ee=class extends ${type="UndefinedValue"},et=class{constructor(e){this.parent=e}variables=new Map([["namespace",new K(e=>{if(0===e.length)return new X(new Map);if(1!==e.length||!(e[0]instanceof X))throw 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 K],["odd",e=>{if("NumericValue"!==e.type)throw Error(`Cannot apply test "odd" to type: ${e.type}`);return e.value%2!=0}],["even",e=>{if("NumericValue"!==e.type)throw Error(`Cannot apply test "even" to type: ${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=>"NumericValue"===e.type],["integer",e=>"NumericValue"===e.type&&Number.isInteger(e.value)],["iterable",e=>"ArrayValue"===e.type||"StringValue"===e.type],["mapping",e=>"ObjectValue"===e.type],["lower",e=>{let t=e.value;return"StringValue"===e.type&&t===t.toLowerCase()}],["upper",e=>{let 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,function e(t){switch(typeof t){case"number":return new W(t);case"string":return new U(t);case"boolean":return new Q(t);case"undefined":return new ee;case"object":if(null===t)return new Z;if(Array.isArray(t))return new J(t.map(e));return new X(new Map(Object.entries(t).map(([t,r])=>[t,e(r)])));case"function":return new K((r,s)=>e(t(...r.map(e=>e.value))??null));default:throw Error(`Cannot convert to runtime value: ${t}`)}}(t))}declareVariable(e,t){if(this.variables.has(e))throw 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 Error(`Unknown variable: ${e}`)}lookupVariable(e){try{return this.resolve(e).variables.get(e)??new ee}catch{return new ee}}},er=class{global;constructor(e){this.global=e??new et}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){let r=this.evaluate(e.left,t);switch(e.operator.value){case"and":return r.__bool__().value?this.evaluate(e.right,t):r;case"or":return r.__bool__().value?r:this.evaluate(e.right,t)}let s=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new Q(r.value==s.value);case"!=":return new Q(r.value!=s.value)}if(r instanceof ee||s instanceof ee)throw Error("Cannot perform operation on undefined values");if(r instanceof Z||s instanceof Z)throw Error("Cannot perform operation on null values");if(r instanceof W&&s instanceof W)switch(e.operator.value){case"+":return new W(r.value+s.value);case"-":return new W(r.value-s.value);case"*":return new W(r.value*s.value);case"/":return new W(r.value/s.value);case"%":return new W(r.value%s.value);case"<":return new Q(r.value<s.value);case">":return new Q(r.value>s.value);case">=":return new Q(r.value>=s.value);case"<=":return new Q(r.value<=s.value)}else if(r instanceof J&&s instanceof J){if("+"===e.operator.value)return new J(r.value.concat(s.value))}else if(s instanceof J){let t=void 0!==s.value.find(e=>e.value===r.value);switch(e.operator.value){case"in":return new Q(t);case"not in":return new Q(!t)}}if((r instanceof U||s instanceof U)&&"+"===e.operator.value)return new U(r.value.toString()+s.value.toString());if(r instanceof U&&s instanceof U)switch(e.operator.value){case"in":return new Q(s.value.includes(r.value));case"not in":return new Q(!s.value.includes(r.value))}if(r instanceof U&&s instanceof X)switch(e.operator.value){case"in":return new Q(s.value.has(r.value));case"not in":return new Q(!s.value.has(r.value))}throw SyntaxError(`Unknown operator "${e.operator.value}" between ${r.type} and ${s.type}`)}evaluateArguments(e,t){let r=[],s=new Map;for(let o of e)if("KeywordArgumentExpression"===o.type)s.set(o.key.value,this.evaluate(o.value,t));else{if(s.size>0)throw Error("Positional arguments must come before keyword arguments");r.push(this.evaluate(o,t))}return[r,s]}evaluateFilterExpression(e,t){let r=this.evaluate(e.operand,t);if("Identifier"===e.filter.type){let t=e.filter;if("tojson"===t.value)return new U(es(r));if(r instanceof J)switch(t.value){case"list":return r;case"first":return r.value[0];case"last":return r.value[r.value.length-1];case"length":return new W(r.value.length);case"reverse":return new J(r.value.reverse());case"sort":return new J(r.value.sort((e,t)=>{if(e.type!==t.type)throw Error(`Cannot compare different types: ${e.type} and ${t.type}`);switch(e.type){case"NumericValue":return e.value-t.value;case"StringValue":return e.value.localeCompare(t.value);default:throw Error(`Cannot compare type: ${e.type}`)}}));case"join":return new U(r.value.map(e=>e.value).join(""));case"string":return new U(es(r));default:throw Error(`Unknown ArrayValue filter: ${t.value}`)}if(r instanceof U)switch(t.value){case"length":return new W(r.value.length);case"upper":return new U(r.value.toUpperCase());case"lower":return new U(r.value.toLowerCase());case"title":return new U(G(r.value));case"capitalize":return new U(r.value.charAt(0).toUpperCase()+r.value.slice(1));case"trim":return new U(r.value.trim());case"indent":return new U(r.value.split("\n").map((e,t)=>0===t||0===e.length?e:" "+e).join("\n"));case"join":case"string":return r;default:throw Error(`Unknown StringValue filter: ${t.value}`)}if(r instanceof W)if("abs"===t.value)return new W(Math.abs(r.value));else throw Error(`Unknown NumericValue filter: ${t.value}`);else if(r instanceof X)switch(t.value){case"items":return new J(Array.from(r.value.entries()).map(([e,t])=>new J([new U(e),t])));case"length":return new W(r.value.size);default:throw Error(`Unknown ObjectValue filter: ${t.value}`)}throw Error(`Cannot apply filter "${t.value}" to type: ${r.type}`)}if("CallExpression"===e.filter.type){let s=e.filter;if("Identifier"!==s.callee.type)throw Error(`Unknown filter: ${s.callee.type}`);let o=s.callee.value;if("tojson"===o){let[,e]=this.evaluateArguments(s.args,t),o=e.get("indent")??new Z;if(!(o instanceof W||o instanceof Z))throw Error("If set, indent must be a number");return new U(es(r,o.value))}if("join"===o){let e;if(r instanceof U)e=Array.from(r.value);else if(r instanceof J)e=r.value.map(e=>e.value);else throw Error(`Cannot apply filter "${o}" to type: ${r.type}`);let[n,a]=this.evaluateArguments(s.args,t),i=n.at(0)??a.get("separator")??new U("");if(!(i instanceof U))throw Error("separator must be a string");return new U(e.join(i.value))}if(r instanceof J){switch(o){case"selectattr":case"rejectattr":{let e,n="selectattr"===o;if(r.value.some(e=>!(e instanceof X)))throw Error(`\`${o}\` can only be applied to array of objects`);if(s.args.some(e=>"StringLiteral"!==e.type))throw Error(`arguments of \`${o}\` must be strings`);let[a,i,l]=s.args.map(e=>this.evaluate(e,t));if(i){let r=t.tests.get(i.value);if(!r)throw Error(`Unknown test: ${i.value}`);e=r}else e=(...e)=>e[0].__bool__().value;return new J(r.value.filter(t=>{let r=t.value.get(a.value),s=!!r&&e(r,l);return n?s:!s}))}case"map":{let[,e]=this.evaluateArguments(s.args,t);if(e.has("attribute")){let t=e.get("attribute");if(!(t instanceof U))throw Error("attribute must be a string");let s=e.get("default");return new J(r.value.map(e=>{if(!(e instanceof X))throw Error("items in map must be an object");return e.value.get(t.value)??s??new ee}))}throw Error("`map` expressions without `attribute` set are not currently supported.")}}throw Error(`Unknown ArrayValue filter: ${o}`)}if(r instanceof U){if("indent"===o){let[e,o]=this.evaluateArguments(s.args,t),n=e.at(0)??o.get("width")??new W(4);if(!(n instanceof W))throw Error("width must be a number");let a=e.at(1)??o.get("first")??new Q(!1),i=e.at(2)??o.get("blank")??new Q(!1),l=r.value.split("\n"),c=" ".repeat(n.value);return new U(l.map((e,t)=>(a.value||0!==t)&&(i.value||0!==e.length)?c+e:e).join("\n"))}throw Error(`Unknown StringValue filter: ${o}`)}throw Error(`Cannot apply filter "${o}" to type: ${r.type}`)}throw Error(`Unknown filter: ${e.filter.type}`)}evaluateTestExpression(e,t){let r=this.evaluate(e.operand,t),s=t.tests.get(e.test.value);if(!s)throw Error(`Unknown test: ${e.test.value}`);let o=s(r);return new Q(e.negate?!o:o)}evaluateUnaryExpression(e,t){let r=this.evaluate(e.argument,t);if("not"===e.operator.value)return new Q(!r.value);throw SyntaxError(`Unknown operator: ${e.operator.value}`)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let r="";for(let s of e){let e=this.evaluate(s,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(r+=e.value)}return new U(r)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){let[r,s]=this.evaluateArguments(e.args,t);s.size>0&&r.push(new H(s));let o=this.evaluate(e.callee,t);if("FunctionValue"!==o.type)throw Error(`Cannot call something that is not a function: got ${o.type}`);return o.value(r,t)}evaluateSliceExpression(e,t,r){if(!(e instanceof J||e instanceof U))throw Error("Slice object must be an array or string");let s=this.evaluate(t.start,r),o=this.evaluate(t.stop,r),n=this.evaluate(t.step,r);if(!(s instanceof W||s instanceof ee))throw Error("Slice start must be numeric or undefined");if(!(o instanceof W||o instanceof ee))throw Error("Slice stop must be numeric or undefined");if(!(n instanceof W||n instanceof ee))throw Error("Slice step must be numeric or undefined");return e instanceof J?new J(B(e.value,s.value,o.value,n.value)):new U(B(Array.from(e.value),s.value,o.value,n.value).join(""))}evaluateMemberExpression(e,t){let r,s,o=this.evaluate(e.object,t);if(e.computed)if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(o,e.property,t);else r=this.evaluate(e.property,t);else r=new U(e.property.value);if(o instanceof X){if(!(r instanceof U))throw Error(`Cannot access property with non-string: got ${r.type}`);s=o.value.get(r.value)??o.builtins.get(r.value)}else if(o instanceof J||o instanceof U)if(r instanceof W)s=o.value.at(r.value),o instanceof U&&(s=new U(o.value.at(r.value)));else if(r instanceof U)s=o.builtins.get(r.value);else throw Error(`Cannot access property with non-string/non-number: got ${r.type}`);else{if(!(r instanceof U))throw Error(`Cannot access property with non-string: got ${r.type}`);s=o.builtins.get(r.value)}return s instanceof $?s:new ee}evaluateSet(e,t){let r=e.value?this.evaluate(e.value,t):this.evaluateBlock(e.body,t);if("Identifier"===e.assignee.type){let s=e.assignee.value;t.setVariable(s,r)}else if("MemberExpression"===e.assignee.type){let s=e.assignee,o=this.evaluate(s.object,t);if(!(o instanceof X))throw Error("Cannot assign to member of non-object");if("Identifier"!==s.property.type)throw Error("Cannot assign to member with non-identifier property");o.value.set(s.property.value,r)}else throw Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);return new Z}evaluateIf(e,t){let r=this.evaluate(e.test,t);return this.evaluateBlock(r.__bool__().value?e.body:e.alternate,t)}evaluateFor(e,t){let r,s,o=new et(t);if("SelectExpression"===e.iterable.type){let t=e.iterable;s=this.evaluate(t.iterable,o),r=t.test}else s=this.evaluate(e.iterable,o);if(!(s instanceof J))throw Error(`Expected iterable type in for loop: got ${s.type}`);let n=[],a=[];for(let t=0;t<s.value.length;++t){let i,l=new et(o),c=s.value[t];if("Identifier"===e.loopvar.type)i=t=>t.setVariable(e.loopvar.value,c);else if("TupleLiteral"===e.loopvar.type){let t=e.loopvar;if("ArrayValue"!==c.type)throw Error(`Cannot unpack non-iterable type: ${c.type}`);if(t.value.length!==c.value.length)throw Error(`Too ${t.value.length>c.value.length?"few":"many"} items to unpack`);i=e=>{for(let r=0;r<t.value.length;++r){if("Identifier"!==t.value[r].type)throw Error(`Cannot unpack non-identifier type: ${t.value[r].type}`);e.setVariable(t.value[r].value,c.value[r])}}}else throw Error(`Invalid loop variable(s): ${e.loopvar.type}`);(!r||(i(l),this.evaluate(r,l).__bool__().value))&&(n.push(c),a.push(i))}let i="",l=!0;for(let t=0;t<n.length;++t){let r=new Map([["index",new W(t+1)],["index0",new W(t)],["revindex",new W(n.length-t)],["revindex0",new W(n.length-t-1)],["first",new Q(0===t)],["last",new Q(t===n.length-1)],["length",new W(n.length)],["previtem",t>0?n[t-1]:new ee],["nextitem",t<n.length-1?n[t+1]:new ee]]);o.setVariable("loop",new X(r)),a[t](o);try{let t=this.evaluateBlock(e.body,o);i+=t.value}catch(e){if(e instanceof q)continue;if(e instanceof R)break;throw e}l=!1}return l&&(i+=this.evaluateBlock(e.defaultBlock,o).value),new U(i)}evaluateMacro(e,t){return t.setVariable(e.name.value,new K((t,r)=>{let s,o=new et(r);t=t.slice(),t.at(-1)?.type==="KeywordArgumentsValue"&&(s=t.pop());for(let r=0;r<e.args.length;++r){let n=e.args[r],a=t[r];if("Identifier"===n.type){if(!a)throw Error(`Missing positional argument: ${n.value}`);o.setVariable(n.value,a)}else if("KeywordArgumentExpression"===n.type){let e=a??s?.value.get(n.key.value)??this.evaluate(n.value,o);o.setVariable(n.key.value,e)}else throw Error(`Unknown argument type: ${n.type}`)}return this.evaluateBlock(e.body,o)})),new Z}evaluate(e,t){if(void 0===e)return new ee;switch(e.type){case"Program":return this.evalProgram(e,t);case"Set":return this.evaluateSet(e,t);case"If":return this.evaluateIf(e,t);case"For":return this.evaluateFor(e,t);case"Macro":return this.evaluateMacro(e,t);case"Break":throw new R;case"Continue":throw new q;case"NumericLiteral":return new W(Number(e.value));case"StringLiteral":return new U(e.value);case"BooleanLiteral":return new Q(e.value);case"NullLiteral":return new Z(e.value);case"ArrayLiteral":return new J(e.value.map(e=>this.evaluate(e,t)));case"TupleLiteral":return new Y(e.value.map(e=>this.evaluate(e,t)));case"ObjectLiteral":{let r=new Map;for(let[s,o]of e.value){let e=this.evaluate(s,t);if(!(e instanceof U))throw Error(`Object keys must be strings: got ${e.type}`);r.set(e.value,this.evaluate(o,t))}return new X(r)}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"TestExpression":return this.evaluateTestExpression(e,t);default:throw SyntaxError(`Unknown node type: ${e.type}`)}}};function es(e,t,r){let s=r??0;switch(e.type){case"NullValue":case"UndefinedValue":return"null";case"NumericValue":case"StringValue":case"BooleanValue":return JSON.stringify(e.value);case"ArrayValue":case"ObjectValue":{let r=t?" ".repeat(t):"",o="\n"+r.repeat(s),n=o+r;if("ArrayValue"===e.type){let r=e.value.map(e=>es(e,t,s+1));return t?`[${n}${r.join(`,${n}`)}${o}]`:`[${r.join(", ")}]`}{let r=Array.from(e.value.entries()).map(([e,r])=>{let o=`"${e}": ${es(r,t,s+1)}`;return t?`${n}${o}`:o});return t?`{${r.join(",")}${o}}`:`{${r.join(", ")}}`}}default:throw Error(`Cannot convert to JSON: ${e.type}`)}}var eo={MultiplicativeBinaryOperator:2,AdditiveBinaryOperator:1,ComparisonBinaryOperator:0};function en(...e){return"{%- "+e.join(" ")+" -%}"}function ea(e,t=-1){switch(e.type){case"Identifier":return e.value;case"NullLiteral":return"none";case"NumericLiteral":case"BooleanLiteral":return`${e.value}`;case"StringLiteral":return JSON.stringify(e.value);case"BinaryExpression":{let r=eo[e.operator.type]??0,s=ea(e.left,r),o=ea(e.right,r+1),n=`${s} ${e.operator.value} ${o}`;return r<t?`(${n})`:n}case"UnaryExpression":return e.operator.value+("not"===e.operator.value?" ":"")+ea(e.argument,1/0);case"LogicalNegationExpression":return`not ${ea(e.argument,1/0)}`;case"CallExpression":{let t=e.args.map(e=>ea(e,-1)).join(", ");return`${ea(e.callee,-1)}(${t})`}case"MemberExpression":{let t=ea(e.object,-1);"Identifier"!==e.object.type&&(t=`(${t})`);let r=ea(e.property,-1);return e.computed||"Identifier"===e.property.type||(r=`(${r})`),e.computed?`${t}[${r}]`:`${t}.${r}`}case"FilterExpression":{let t=ea(e.operand,1/0);if("CallExpression"===e.filter.type)return`${t} | ${ea(e.filter,-1)}`;return`${t} | ${e.filter.value}`}case"SelectExpression":return`${ea(e.iterable,-1)} | select(${ea(e.test,-1)})`;case"TestExpression":return`${ea(e.operand,-1)} is${e.negate?" not":""} ${e.test.value}`;case"ArrayLiteral":case"TupleLiteral":{let t=e.value.map(e=>ea(e,-1)),r="ArrayLiteral"===e.type?"[]":"()";return`${r[0]}${t.join(", ")}${r[1]}`}case"ObjectLiteral":{let t=Array.from(e.value.entries()).map(([e,t])=>`${ea(e,-1)}: ${ea(t,-1)}`);return`{ ${t.join(", ")} }`}case"SliceExpression":{let t=e.start?ea(e.start,-1):"",r=e.stop?ea(e.stop,-1):"",s=e.step?`:${ea(e.step,-1)}`:"";return`${t}:${r}${s}`}case"KeywordArgumentExpression":return`${e.key.value}=${ea(e.value,-1)}`;case"If":{let t=ea(e.test,-1),r=ea(e.body[0],0),s=ea(e.alternate[0],-1);return`${r} if ${t} else ${s}`}default:throw Error(`Unknown expression type: ${e.type}`)}}var ei=class{parsed;constructor(e){let t=d(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=V(t)}render(e){let t=new et;if(t.set("false",!1),t.set("true",!0),t.set("raise_exception",e=>{throw Error(e)}),t.set("range",N),e)for(let[r,s]of Object.entries(e))t.set(r,s);return new er(t).run(this.parsed).value}format(e){return function(e,t=" "){let r="number"==typeof t?" ".repeat(t):t;return(function e(t,r,s){return t.map(t=>(function(t,r,s){let o=s.repeat(r);switch(t.type){case"Program":return e(t.body,r,s);case"If":return function(t,r,s){let o=s.repeat(r),n=[],a=t;for(;a;)if(n.push({test:a.test,body:a.body}),1===a.alternate.length&&"If"===a.alternate[0].type)a=a.alternate[0];else break;let i=o+en("if",ea(n[0].test))+"\n"+e(n[0].body,r+1,s);for(let t=1;t<n.length;t++)i+="\n"+o+en("elif",ea(n[t].test))+"\n"+e(n[t].body,r+1,s);return a&&a.alternate.length>0&&(i+="\n"+o+en("else")+"\n"+e(a.alternate,r+1,s)),i+="\n"+o+en("endif")}(t,r,s);case"For":var n=t,a=r,i=s;let l=i.repeat(a),c="";if("SelectExpression"===n.iterable.type){let e=n.iterable;c=`${ea(e.iterable)} if ${ea(e.test)}`}else c=ea(n.iterable);let d=l+en("for",ea(n.loopvar),"in",c)+"\n"+e(n.body,a+1,i);return n.defaultBlock.length>0&&(d+="\n"+l+en("else")+"\n"+e(n.defaultBlock,a+1,i)),d+="\n"+l+en("endfor");case"Set":var u=t,m=r,p=s;let _=p.repeat(m),h=ea(u.assignee),g=u.value?ea(u.value):"",f=_+en("set",`${h}${u.value?" = "+g:""}`);return 0===u.body.length?f:f+"\n"+e(u.body,m+1,p)+"\n"+_+en("endset");case"Macro":var M=t,w=r,x=s;let b=x.repeat(w),T=M.args.map(ea).join(", ");return b+en("macro",`${M.name.value}(${T})`)+"\n"+e(M.body,w+1,x)+"\n"+b+en("endmacro");case"Break":return o+en("break");case"Continue":return o+en("continue");default:return o+"{{- "+ea(t)+" -}}"}})(t,r,s)).join("\n")})(e.body,0,r).replace(/\n$/,"")}(this.parsed,e?.indent||" ")}}},"./src/backends/onnx.js":(e,t,r)=>{let s,o;r.r(t),r.d(t,{Tensor:()=>d.Tensor,createInferenceSession:()=>f,deviceToExecutionProviders:()=>h,isONNXProxy:()=>x,isONNXTensor:()=>M});var a,i=r("./src/env.js"),l=r("?2ce3"),c=r("onnxruntime-web"),d=r("onnxruntime-common");let u=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"}}),m=[],p=Symbol.for("onnxruntime");if(p in globalThis)o=globalThis[p];else if(i.apis.IS_NODE_ENV){switch(o=l??(a||(a=r.t(l,2))),n.platform){case"win32":m.push("dml");break;case"linux":"x64"===n.arch&&m.push("cuda")}m.push("cpu"),s=["cpu"]}else o=c,i.apis.IS_WEBNN_AVAILABLE&&m.push("webnn-npu","webnn-gpu","webnn-cpu","webnn"),i.apis.IS_WEBGPU_AVAILABLE&&m.push("webgpu"),m.push("wasm"),s=["wasm"];let _=o.InferenceSession;function h(e=null){if(!e)return s;switch(e){case"auto":return m;case"gpu":return m.filter(e=>["webgpu","cuda","dml","webnn-gpu"].includes(e))}if(m.includes(e))return[u[e]??e];throw Error(`Unsupported device: "${e}". Should be one of: ${m.join(", ")}.`)}let g=null;async function f(e,t,r){g&&await g;let s=_.create(e,t);g??=s;let o=await s;return o.config=r,o}function M(e){return e instanceof o.Tensor}let w=o?.env;function x(){return w?.wasm?.proxy}w?.wasm&&("undefined"!=typeof ServiceWorkerGlobalScope&&self instanceof ServiceWorkerGlobalScope||w.wasm.wasmPaths||(w.wasm.wasmPaths=`https://cdn.jsdelivr.net/npm/@huggingface/transformers@${i.env.version}/dist/`),w.wasm.proxy=!1),w?.webgpu&&(w.webgpu.powerPreference="high-performance"),i.env.backends.onnx=w},"./src/base/feature_extraction_utils.js":(e,t,r)=>{r.r(t),r.d(t,{FeatureExtractor:()=>a,validate_audio_inputs:()=>i});var s=r("./src/utils/constants.js"),o=r("./src/utils/generic.js"),n=r("./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,s.FEATURE_EXTRACTOR_NAME,!0,t))}}function i(e,t){if(!(e instanceof Float32Array||e instanceof Float64Array))throw 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,r)=>{r.r(t),r.d(t,{ImageProcessor:()=>g,center_to_corners_format:()=>u,post_process_instance_segmentation:()=>h,post_process_object_detection:()=>m,post_process_panoptic_segmentation:()=>_,post_process_semantic_segmentation:()=>p});var s=r("./src/utils/generic.js"),o=r("./src/utils/tensor.js"),n=r("./src/utils/maths.js");r("./src/utils/image.js");var a=r("./src/utils/core.js"),i=r("./src/utils/hub.js"),l=r("./src/utils/constants.js");function c(e,t,r=0,s=null){let o=e/t,a=(0,n.bankers_round)(o)*t;return null!==s&&a>s&&(a=Math.floor(o)*t),a<r&&(a=Math.ceil(o)*t),a}function d([e,t],r){return[Math.max(Math.floor(e/r),1)*r,Math.max(Math.floor(t/r),1)*r]}function u([e,t,r,s]){return[e-r/2,t-s/2,e+r/2,t+s/2]}function m(e,t=.5,r=null,s=!1){let o=e.logits,a=e.pred_boxes,[i,l,c]=o.dims;if(null!==r&&r.length!==i)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let d=[];for(let e=0;e<i;++e){let i=null!==r?r[e]:null,m={boxes:[],classes:[],scores:[]},p=o[e],_=a[e];for(let e=0;e<l;++e){let r,o=p[e],a=[];if(s){r=o.sigmoid().data;for(let e=0;e<r.length;++e)r[e]>t&&a.push(e)}else{let e=(0,n.max)(o.data)[1];if(e===c-1||(r=(0,n.softmax)(o.data))[e]<t)continue;a.push(e)}for(let t of a){let s=_[e].data;s=u(s),null!==i&&(s=s.map((e,t)=>e*i[(t+1)%2])),m.boxes.push(s),m.classes.push(t),m.scores.push(r[t])}}d.push(m)}return d}function p(e,t=null){let r=e.logits,s=r.dims[0];if(null!==t&&t.length!==s)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let n=[];for(let e=0;e<s;++e){let s=null!==t?t[e]:null,a=r[e];null!==s&&(a=(0,o.interpolate)(a,s,"bilinear",!1));let[i,l]=s??a.dims.slice(-2),c=new o.Tensor("int32",new Int32Array(i*l),[i,l]),d=a[0].data,u=c.data;for(let e=1;e<a.dims[0];++e){let t=a[e].data;for(let r=0;r<t.length;++r)t[r]>d[r]&&(d[r]=t[r],u[r]=e)}let m=Array(a.dims[0]);for(let e=0;e<u.length;++e){let t=u[e];m[t]=t}let p=m.filter(e=>void 0!==e);n.push({segmentation:c,labels:p})}return n}function _(e,t=.5,r=.5,s=.8,a=null,i=null){null===a&&(console.warn("`label_ids_to_fuse` unset. No instance will be fused."),a=new Set);let l=e.class_queries_logits??e.logits,c=(e.masks_queries_logits??e.pred_masks).sigmoid(),[d,u,m]=l.dims;if(m-=1,null!==i&&i.length!==d)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let p=[];for(let e=0;e<d;++e){let d=null!==i?i[e]:null,u=l[e],_=c[e],[h,g,f]=function(e,t,r,s){let o=[],a=[],i=[];for(let l=0;l<e.dims[0];++l){let c=e[l],d=t[l],u=(0,n.max)(c.data)[1];if(u===s)continue;let m=(0,n.softmax)(c.data)[u];m>r&&(o.push(d),a.push(m),i.push(u))}return[o,a,i]}(u,_,t,m);if(0===f.length){let[e,t]=d??_.dims.slice(-2),r=new o.Tensor("int32",new Int32Array(e*t).fill(-1),[e,t]);p.push({segmentation:r,segments_info:[]});continue}let[M,w]=function(e,t,r,s,n,a=null,i=null){let[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;t<e.length;++t)e[t]=(0,o.interpolate)(e[t],i,"bilinear",!1);let m=new Int32Array(e[0].data.length),p=new Float32Array(e[0].data.length);for(let r=0;r<e.length;++r){let s=t[r],o=e[r].data;for(let e=0;e<o.length;++e)o[e]*=s,o[e]>p[e]&&(m[e]=r,p[e]=o[e])}let _=0,h=d.data;for(let o=0;o<r.length;++o){let a=r[o],[i,l]=function(e,t,r,s=.5,o=.8){let n=[],a=0,i=0,l=t[r].data;for(let t=0;t<e.length;++t)e[t]===r&&(n.push(t),++a),l[t]>=s&&++i;let c=a>0&&i>0;return c&&(c=a/i>o),[c,n]}(m,e,o,s,n);if(i){for(let e of(++_,l))h[e]=_;u.push({id:_,label_id:a,score:t[o]})}}return[d,u]}(h,g,f,r,s,a,d);p.push({segmentation:M,segments_info:w})}return p}function h(e,t=.5,r=null){throw Error("`post_process_instance_segmentation` is not yet implemented.")}class g extends s.Callable{constructor(e){super(),this.image_mean=e.image_mean??e.mean,this.image_std=e.image_std??e.std,this.resample=e.resample??2,this.do_rescale=e.do_rescale??!0,this.rescale_factor=e.rescale_factor??1/255,this.do_normalize=e.do_normalize,this.do_thumbnail=e.do_thumbnail,this.size=e.size??e.image_size,this.do_resize=e.do_resize??void 0!==this.size,this.size_divisibility=e.size_divisibility??e.size_divisor,this.do_center_crop=e.do_center_crop,this.crop_size=e.crop_size,this.do_convert_rgb=e.do_convert_rgb??!0,this.do_crop_margin=e.do_crop_margin,this.pad_size=e.pad_size,this.do_pad=e.do_pad,this.min_pixels=e.min_pixels,this.max_pixels=e.max_pixels,this.do_pad&&!this.pad_size&&this.size&&void 0!==this.size.width&&void 0!==this.size.height&&(this.pad_size=this.size),this.do_flip_channel_order=e.do_flip_channel_order??!1,this.config=e}async thumbnail(e,t,r=2){let s=e.height,o=e.width,n=t.height,a=t.width,i=Math.min(s,n),l=Math.min(o,a);return i===s&&l===o?e:(s>o?l=Math.floor(o*i/s):o>s&&(i=Math.floor(s*l/o)),await e.resize(l,i,{resample:r}))}async crop_margin(e,t=200){let r=e.clone().grayscale(),s=(0,n.min)(r.data)[0],o=(0,n.max)(r.data)[0]-s;if(0===o)return e;let a=t/255,i=r.width,l=r.height,c=0,d=0,u=r.data;for(let e=0;e<r.height;++e){let t=e*r.width;for(let n=0;n<r.width;++n)(u[t+n]-s)/o<a&&(i=Math.min(i,n),l=Math.min(l,e),c=Math.max(c,n),d=Math.max(d,e))}return e=await e.crop([i,l,c,d])}pad_image(e,t,r,{mode:s="constant",center:o=!1,constant_values:n=0}={}){let i,l,[c,d,u]=t;if("number"==typeof r?(i=r,l=r):"square"===r?i=l=Math.max(c,d):(i=r.width,l=r.height),i!==d||l!==c){let r=new Float32Array(i*l*u);if(Array.isArray(n))for(let e=0;e<r.length;++e)r[e]=n[e%u];else 0!==n&&r.fill(n);let[m,p]=o?[Math.floor((i-d)/2),Math.floor((l-c)/2)]:[0,0];for(let t=0;t<c;++t){let s=(t+p)*i,o=t*d;for(let t=0;t<d;++t){let n=(s+t+m)*u,a=(o+t)*u;for(let t=0;t<u;++t)r[n+t]=e[a+t]}}if("symmetric"===s){if(o)throw Error("`center` padding is not supported when `mode` is set to `symmetric`.");let t=c-1,s=d-1;for(let o=0;o<l;++o){let n=o*i,l=(0,a.calculateReflectOffset)(o,t)*d;for(let t=0;t<i;++t){if(o<c&&t<d)continue;let i=(n+t)*u,m=(l+(0,a.calculateReflectOffset)(t,s))*u;for(let t=0;t<u;++t)r[i+t]=e[m+t]}}}e=r,t=[l,i,u]}return[e,t]}rescale(e){for(let t=0;t<e.length;++t)e[t]=this.rescale_factor*e[t]}get_resize_output_image_size(e,t){let r,s,[o,n]=e.size;if(this.do_thumbnail){let{height:e,width:s}=t;r=Math.min(e,s)}else Number.isInteger(t)?(r=t,s=this.config.max_size??r):void 0!==t&&(r=t.shortest_edge,s=t.longest_edge);if(void 0!==r||void 0!==s){let e=void 0===r?1:Math.max(r/o,r/n),t=o*e,a=n*e,i=void 0===s?1:Math.min(s/t,s/a),l=Math.floor(Number((t*i).toFixed(2))),c=Math.floor(Number((a*i).toFixed(2)));return void 0!==this.size_divisibility&&([l,c]=d([l,c],this.size_divisibility)),[l,c]}if(void 0!==t&&void 0!==t.width&&void 0!==t.height){let e=t.width,r=t.height;if(this.config.keep_aspect_ratio&&this.config.ensure_multiple_of){let t=r/n,s=e/o;Math.abs(1-s)<Math.abs(1-t)?t=s:s=t,r=c(t*n,this.config.ensure_multiple_of),e=c(s*o,this.config.ensure_multiple_of)}return[e,r]}if(void 0!==this.size_divisibility)return d([o,n],this.size_divisibility);if(void 0!==this.min_pixels&&void 0!==this.max_pixels)return function(e,t,r=28,s=3136,o=1003520){if(e<r||t<r)throw Error(`height:${e} or width:${t} must be larger than factor:${r}`);if(Math.max(e,t)/Math.min(e,t)>200)throw Error(`absolute aspect ratio must be smaller than 200, got ${Math.max(e,t)/Math.min(e,t)}`);let n=Math.round(e/r)*r,a=Math.round(t/r)*r;if(n*a>o){let s=Math.sqrt(e*t/o);n=Math.floor(e/s/r)*r,a=Math.floor(t/s/r)*r}else if(n*a<s){let o=Math.sqrt(s/(e*t));n=Math.ceil(e*o/r)*r,a=Math.ceil(t*o/r)*r}return[n,a]}(n,o,this.config.patch_size*this.config.merge_size,this.min_pixels,this.max_pixels);throw Error(`Could not resize image due to unsupported \`this.size\` option in config: ${JSON.stringify(t)}`)}async resize(e){let[t,r]=this.get_resize_output_image_size(e,this.size);return await e.resize(t,r,{resample:this.resample})}async preprocess(e,{do_normalize:t=null,do_pad:r=null,do_convert_rgb:s=null,do_convert_grayscale:n=null,do_flip_channel_order:a=null}={}){this.do_crop_margin&&(e=await this.crop_margin(e));let[i,l]=e.size;if(s??this.do_convert_rgb?e=e.rgb():n&&(e=e.grayscale()),this.do_resize&&(e=await this.resize(e)),this.do_thumbnail&&(e=await this.thumbnail(e,this.size,this.resample)),this.do_center_crop){let t,r;Number.isInteger(this.crop_size)?(t=this.crop_size,r=this.crop_size):(t=this.crop_size.width,r=this.crop_size.height),e=await e.center_crop(t,r)}let c=[e.height,e.width],u=Float32Array.from(e.data),m=[e.height,e.width,e.channels];if(this.do_rescale&&this.rescale(u),t??this.do_normalize){let t=this.image_mean;Array.isArray(this.image_mean)||(t=Array(e.channels).fill(t));let r=this.image_std;if(Array.isArray(this.image_std)||(r=Array(e.channels).fill(t)),t.length!==e.channels||r.length!==e.channels)throw Error(`When set to arrays, the length of \`image_mean\` (${t.length}) and \`image_std\` (${r.length}) must match the number of channels in the image (${e.channels}).`);for(let s=0;s<u.length;s+=e.channels)for(let o=0;o<e.channels;++o)u[s+o]=(u[s+o]-t[o])/r[o]}if(r??this.do_pad){if(this.pad_size){let t=this.pad_image(u,[e.height,e.width,e.channels],this.pad_size);[u,m]=t}else if(this.size_divisibility){let[e,t]=d([m[1],m[0]],this.size_divisibility);[u,m]=this.pad_image(u,m,{width:e,height:t})}}if(a??this.do_flip_channel_order){if(3!==m[2])throw Error("Flipping channel order is only supported for RGB images.");for(let e=0;e<u.length;e+=3){let t=u[e];u[e]=u[e+2],u[e+2]=t}}return{original_size:[l,i],reshaped_input_size:c,pixel_values:new o.Tensor("float32",u,m).permute(2,0,1)}}async _call(e,...t){Array.isArray(e)||(e=[e]);let r=await Promise.all(e.map(e=>this.preprocess(e)));return{pixel_values:(0,o.stack)(r.map(e=>e.pixel_values),0),original_sizes:r.map(e=>e.original_size),reshaped_input_sizes:r.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,r)=>{r.r(t),r.d(t,{Processor:()=>a});var s=r("./src/utils/constants.js"),o=r("./src/utils/generic.js"),n=r("./src/utils/hub.js");class a extends o.Callable{static classes=["image_processor_class","tokenizer_class","feature_extractor_class"];static uses_processor_config=!1;constructor(e,t){super(),this.config=e,this.components=t}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 Error("Unable to apply chat template without a tokenizer.");return this.tokenizer.apply_chat_template(e,{tokenize:!1,...t})}batch_decode(...e){if(!this.tokenizer)throw Error("Unable to decode without a tokenizer.");return this.tokenizer.batch_decode(...e)}decode(...e){if(!this.tokenizer)throw Error("Unable to decode without a tokenizer.");return this.tokenizer.decode(...e)}async _call(e,...t){for(let r of[this.image_processor,this.feature_extractor,this.tokenizer])if(r)return r(e,...t);throw Error("No image processor, feature extractor, or tokenizer found.")}static async from_pretrained(e,t){let[r,o]=await Promise.all([this.uses_processor_config?(0,n.getModelJSON)(e,s.PROCESSOR_NAME,!0,t):{},Promise.all(this.classes.filter(e=>e in this).map(async r=>{let s=await this[r].from_pretrained(e,t);return[r.replace(/_class$/,""),s]})).then(Object.fromEntries)]);return new this(r,o)}}},"./src/configs.js":(e,t,r)=>{r.r(t),r.d(t,{AutoConfig:()=>l,PretrainedConfig:()=>i,getKeyValueShapes:()=>a});var s=r("./src/utils/core.js"),o=r("./src/utils/hub.js");async function n(e,t){return await (0,o.getModelJSON)(e,"config.json",!0,t)}function a(e,{prefix:t="past_key_values",batch_size:r=1}={}){let s={},o=e.normalized_config;if(o.is_encoder_decoder&&"num_encoder_heads"in o&&"num_decoder_heads"in o){let e=o.encoder_dim_kv??o.encoder_hidden_size/o.num_encoder_heads,n=o.decoder_dim_kv??o.decoder_hidden_size/o.num_decoder_heads,a=[r,o.num_encoder_heads,0,e],i=[r,o.num_decoder_heads,0,n];for(let e=0;e<o.num_decoder_layers;++e)s[`${t}.${e}.encoder.key`]=a,s[`${t}.${e}.encoder.value`]=a,s[`${t}.${e}.decoder.key`]=i,s[`${t}.${e}.decoder.value`]=i}else{let e=o.num_heads,n=o.num_layers,a=o.dim_kv??o.hidden_size/(o.num_attention_heads??e);if("falcon"===o.model_type){let o=[r*e,0,a];for(let e=0;e<n;++e)s[`${t}.${e}.key`]=o,s[`${t}.${e}.value`]=o}else if(o.multi_query){let o=[r*e,0,2*a];for(let e=0;e<n;++e)s[`${t}.${e}.key_value`]=o}else if("bloom"===o.model_type){let o=[r*e,a,0],i=[r*e,0,a];for(let e=0;e<n;++e)s[`${t}.${e}.key`]=o,s[`${t}.${e}.value`]=i}else if("openelm"===o.model_type)for(let o=0;o<n;++o){let n=[r,e[o],0,a];s[`${t}.${o}.key`]=n,s[`${t}.${o}.value`]=n}else{let o=[r,e,0,a];for(let e=0;e<n;++e)s[`${t}.${e}.key`]=o,s[`${t}.${e}.value`]=o}}return s}class i{model_type=null;is_encoder_decoder=!1;max_position_embeddings;"transformers.js_config";constructor(e){Object.assign(this,e),this.normalized_config=function e(t){let r={},o={};switch(t.model_type){case"llava":case"paligemma":case"gemma3":case"florence2":case"llava_onevision":case"idefics3":case"ultravox":case"smolvlm":o=e(t.text_config);break;case"moondream1":o=e(t.phi_config);break;case"musicgen":o=e(t.decoder);break;case"multi_modality":o=e(t.language_config);break;case"gpt2":case"gptj":case"jais":case"codegen":case"gpt_bigcode":r.num_heads="n_head",r.num_layers="n_layer",r.hidden_size="n_embd";break;case"gpt_neox":case"stablelm":case"opt":case"falcon":r.num_heads="num_attention_heads",r.num_layers="num_hidden_layers",r.hidden_size="hidden_size";break;case"llama":case"olmo":case"olmo2":case"mobilellm":case"granite":case"cohere":case"mistral":case"starcoder2":case"qwen2":case"qwen2_vl":case"phi":case"phi3":case"phi3_v":r.num_heads="num_key_value_heads",r.num_layers="num_hidden_layers",r.hidden_size="hidden_size",r.num_attention_heads="num_attention_heads";break;case"qwen3":case"gemma":case"gemma2":case"gemma3_text":case"glm":case"helium":r.num_heads="num_key_value_heads",r.num_layers="num_hidden_layers",r.dim_kv="head_dim";break;case"openelm":r.num_heads="num_kv_heads",r.num_layers="num_transformer_layers",r.dim_kv="head_dim";break;case"gpt_neo":case"donut-swin":r.num_heads="num_heads",r.num_layers="num_layers",r.hidden_size="hidden_size";break;case"bloom":r.num_heads="n_head",r.num_layers="n_layer",r.hidden_size="hidden_size";break;case"mpt":r.num_heads="n_heads",r.num_layers="n_layers",r.hidden_size="d_model";break;case"exaone":r.num_heads="num_key_value_heads",r.num_layers="num_layers",r.dim_kv="head_dim",r.num_attention_heads="num_attention_heads";break;case"t5":case"mt5":case"longt5":r.num_decoder_layers="num_decoder_layers",r.num_decoder_heads="num_heads",r.decoder_dim_kv="d_kv",r.num_encoder_layers="num_layers",r.num_encoder_heads="num_heads",r.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":r.num_decoder_layers="decoder_layers",r.num_decoder_heads="decoder_attention_heads",r.decoder_hidden_size="d_model",r.num_encoder_layers="encoder_layers",r.num_encoder_heads="encoder_attention_heads",r.encoder_hidden_size="d_model";break;case"speecht5":r.num_decoder_layers="decoder_layers",r.num_decoder_heads="decoder_attention_heads",r.decoder_hidden_size="hidden_size",r.num_encoder_layers="encoder_layers",r.num_encoder_heads="encoder_attention_heads",r.encoder_hidden_size="hidden_size";break;case"trocr":r.num_encoder_layers=r.num_decoder_layers="decoder_layers",r.num_encoder_heads=r.num_decoder_heads="decoder_attention_heads",r.encoder_hidden_size=r.decoder_hidden_size="d_model";break;case"musicgen_decoder":r.num_encoder_layers=r.num_decoder_layers="num_hidden_layers",r.num_encoder_heads=r.num_decoder_heads="num_attention_heads",r.encoder_hidden_size=r.decoder_hidden_size="hidden_size";break;case"moonshine":r.num_decoder_layers="decoder_num_hidden_layers",r.num_decoder_heads="decoder_num_key_value_heads",r.num_encoder_layers="encoder_num_hidden_layers",r.num_encoder_heads="encoder_num_key_value_heads",r.encoder_hidden_size=r.decoder_hidden_size="hidden_size";break;case"vision-encoder-decoder":let n=e(t.decoder),a="num_decoder_layers"in n,i=(0,s.pick)(t,["model_type","is_encoder_decoder"]);return a?(i.num_decoder_layers=n.num_decoder_layers,i.num_decoder_heads=n.num_decoder_heads,i.decoder_hidden_size=n.decoder_hidden_size,i.num_encoder_layers=n.num_encoder_layers,i.num_encoder_heads=n.num_encoder_heads,i.encoder_hidden_size=n.encoder_hidden_size):(i.num_layers=n.num_layers,i.num_heads=n.num_heads,i.hidden_size=n.hidden_size),i}let l={...o,...(0,s.pick)(t,["model_type","multi_query","is_encoder_decoder"])};for(let e in r)l[e]=t[r[e]];return l}(this)}static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:s=null,local_files_only:o=!1,revision:a="main"}={}){return!r||r instanceof i||(r=new i(r)),new this(r??await n(e,{progress_callback:t,config:r,cache_dir:s,local_files_only:o,revision:a}))}}class l{static async from_pretrained(...e){return i.from_pretrained(...e)}}},"./src/env.js":(e,t,r)=>{r.r(t),r.d(t,{apis:()=>g,env:()=>b});var s=r("?569f"),o=r("?3f59"),a=r("?154a");let i="undefined"!=typeof window&&void 0!==window.document,l="undefined"!=typeof self&&self.constructor?.name==="DedicatedWorkerGlobalScope",c="undefined"!=typeof self&&"caches"in self,d="undefined"!=typeof navigator&&"gpu"in navigator,u="undefined"!=typeof navigator&&"ml"in navigator,m=void 0!==n,p=m&&n?.release?.name==="node",_=!T(s),h=!T(o),g=Object.freeze({IS_BROWSER_ENV:i,IS_WEBWORKER_ENV:l,IS_WEB_CACHE_AVAILABLE:c,IS_WEBGPU_AVAILABLE:d,IS_WEBNN_AVAILABLE:u,IS_PROCESS_AVAILABLE:m,IS_NODE_ENV:p,IS_FS_AVAILABLE:_,IS_PATH_AVAILABLE:h}),f=_&&h,M="./";if(f){let e=Object({}).url;e?M=o.dirname(o.dirname(a.fileURLToPath(e))):"undefined"!=typeof __dirname&&(M=o.dirname(__dirname))}let w=f?o.join(M,"/.cache/"):null,x="/models/",b={version:"3.5.1",backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!(i||l),localModelPath:f?o.join(M,x):x,useFS:_,useBrowserCache:c,useFSCache:_,cacheDir:w,useCustomCache:!1,customCache:null};function T(e){return 0===Object.keys(e).length}},"./src/generation/configuration_utils.js":(e,t,r)=>{r.r(t),r.d(t,{GenerationConfig:()=>o});var s=r("./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,s.pick)(e,Object.getOwnPropertyNames(this)))}}},"./src/generation/logits_process.js":(e,t,r)=>{r.r(t),r.d(t,{ClassifierFreeGuidanceLogitsProcessor:()=>f,ForcedBOSTokenLogitsProcessor:()=>l,ForcedEOSTokenLogitsProcessor:()=>c,LogitsProcessor:()=>n,LogitsProcessorList:()=>i,LogitsWarper:()=>a,MinLengthLogitsProcessor:()=>_,MinNewTokensLengthLogitsProcessor:()=>h,NoBadWordsLogitsProcessor:()=>g,NoRepeatNGramLogitsProcessor:()=>m,RepetitionPenaltyLogitsProcessor:()=>p,SuppressTokensAtBeginLogitsProcessor:()=>d,TemperatureLogitsWarper:()=>M,TopKLogitsWarper:()=>x,TopPLogitsWarper:()=>w,WhisperTimeStampLogitsProcessor:()=>u});var s=r("./src/utils/generic.js");r("./src/utils/tensor.js");var o=r("./src/utils/maths.js");class n extends s.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class a extends s.Callable{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class i extends s.Callable{constructor(){super(),this.processors=[]}push(e){this.processors.push(e)}extend(e){this.processors.push(...e)}_call(e,t){let r=t;for(let t of this.processors)r=t(e,r);return r}[Symbol.iterator](){return this.processors.values()}}class l extends n{constructor(e){super(),this.bos_token_id=e}_call(e,t){for(let r=0;r<e.length;++r)if(1===e[r].length){let e=t[r].data;e.fill(-1/0),e[this.bos_token_id]=0}return t}}class c extends n{constructor(e,t){super(),this.max_length=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let r=0;r<e.length;++r)if(e[r].length===this.max_length-1){let e=t[r].data;for(let t of(e.fill(-1/0),this.eos_token_id))e[t]=0}return t}}class d extends n{constructor(e,t){super(),this.begin_suppress_tokens=e,this.begin_index=t}_call(e,t){for(let r=0;r<e.length;++r)if(e[r].length===this.begin_index){let e=t[r].data;for(let t of this.begin_suppress_tokens)e[t]=-1/0}return t}}class u extends n{constructor(e,t){super(),this.eos_token_id=Array.isArray(e.eos_token_id)?e.eos_token_id[0]:e.eos_token_id,this.no_timestamps_token_id=e.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=t.length,t.at(-1)===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=e.max_initial_timestamp_index}_call(e,t){for(let r=0;r<e.length;++r){let s=t[r].data;if(s[this.no_timestamps_token_id]=-1/0,e[r].length===this.begin_index-1){s.fill(-1/0),s[this.timestamp_begin]=0;continue}let n=e[r].slice(this.begin_index),a=n.length>=1&&n[n.length-1]>=this.timestamp_begin,i=n.length<2||n[n.length-2]>=this.timestamp_begin;if(a&&(i?s.subarray(this.timestamp_begin).fill(-1/0):s.subarray(0,this.eos_token_id).fill(-1/0)),e[r].length===this.begin_index&&null!==this.max_initial_timestamp_index){let e=this.timestamp_begin+this.max_initial_timestamp_index;s.subarray(e+1).fill(-1/0)}let l=(0,o.log_softmax)(s);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]&&s.subarray(0,this.timestamp_begin).fill(-1/0)}return t}}class m extends n{constructor(e){super(),this.no_repeat_ngram_size=e}getNgrams(e){let t=e.length,r=[];for(let s=0;s<t+1-this.no_repeat_ngram_size;++s){let t=[];for(let r=0;r<this.no_repeat_ngram_size;++r)t.push(e[s+r]);r.push(t.map(Number))}let s=new Map;for(let e of r){let t=JSON.stringify(e.slice(0,e.length-1)),r=s.get(t)??[];r.push(e[e.length-1]),s.set(t,r)}return s}getGeneratedNgrams(e,t){let r=t.slice(t.length+1-this.no_repeat_ngram_size,t.length);return e.get(JSON.stringify(r.map(Number)))??[]}calcBannedNgramTokens(e){if(e.length+1<this.no_repeat_ngram_size)return[];{let t=this.getNgrams(e);return this.getGeneratedNgrams(t,e)}}_call(e,t){for(let r=0;r<e.length;++r){let s=t[r].data;for(let t of this.calcBannedNgramTokens(e[r]))s[t]=-1/0}return t}}class p extends n{constructor(e){super(),this.penalty=e}_call(e,t){for(let r=0;r<e.length;++r){let s=t[r].data;for(let t of new Set(e[r])){let e=Number(t);s[e]<0?s[e]*=this.penalty:s[e]/=this.penalty}}return t}}class _ extends n{constructor(e,t){super(),this.min_length=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let r=0;r<e.length;++r)if(e[r].length<this.min_length){let e=t[r].data;for(let t of this.eos_token_id)e[t]=-1/0}return t}}class h extends n{constructor(e,t,r){super(),this.prompt_length_to_skip=e,this.min_new_tokens=t,this.eos_token_id=Array.isArray(r)?r:[r]}_call(e,t){for(let r=0;r<e.length;++r)if(e[r].length-this.prompt_length_to_skip<this.min_new_tokens){let e=t[r].data;for(let t of this.eos_token_id)e[t]=-1/0}return t}}class g extends n{constructor(e,t){super(),this.bad_words_ids=e,this.eos_token_id=Array.isArray(t)?t:[t]}_call(e,t){for(let r=0;r<e.length;++r){let s=t[r].data,o=e[r];for(let e of this.bad_words_ids){if(o.length<e.length-1)continue;let t=!0;for(let r=1;r<=e.length-1;++r)if(e.at(-r-1)!=o.at(-r)){t=!1;break}t&&(s[e.at(-1)]=-1/0)}}return t}}class f extends n{constructor(e){if(super(),e<=1)throw Error(`Require guidance scale >1 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 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.`);let r=e.length,s=t.slice([0,r],null),o=t.slice([r,t.dims[0]],null);for(let e=0;e<o.data.length;++e)o.data[e]+=(s.data[e]-o.data[e])*this.guidance_scale;return o}}class M extends a{constructor(e){super(),"number"!=typeof e||e<=0,this.temperature=e}_call(e,t){let r=t.data;for(let e=0;e<r.length;++e)r[e]/=this.temperature;return t}}class w extends a{constructor(e,{filter_value:t=-1/0,min_tokens_to_keep:r=1}={}){if(super(),e<0||e>1)throw Error(`\`top_p\` must be a float > 0 and < 1, but is ${e}`);if(!Number.isInteger(r)||r<1)throw Error(`\`min_tokens_to_keep\` must be a positive integer, but is ${r}`);this.top_p=e,this.filter_value=t,this.min_tokens_to_keep=r}}class x extends a{constructor(e,{filter_value:t=-1/0,min_tokens_to_keep:r=1}={}){if(super(),!Number.isInteger(e)||e<0)throw Error(`\`top_k\` must be a positive integer, but is ${e}`);this.top_k=Math.max(e,r),this.filter_value=t}}},"./src/generation/logits_sampler.js":(e,t,r)=>{r.r(t),r.d(t,{LogitsSampler:()=>a});var s=r("./src/utils/generic.js"),o=r("./src/utils/tensor.js"),n=r("./src/utils/maths.js");r("./src/generation/configuration_utils.js");class a extends s.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 r=e.dims.at(-1),s=e.data;if(-1===t)s=s.slice(-r);else{let e=t*r;s=s.slice(e,e+r)}return s}randomSelect(e){let t=0;for(let r=0;r<e.length;++r)t+=e[r];let r=Math.random()*t;for(let t=0;t<e.length;++t)if((r-=e[t])<=0)return t;return 0}static getSampler(e){if(e.do_sample)return new l(e);if(e.num_beams>1)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){return[[BigInt((0,n.max)(e.data)[1]),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));let[r,s]=await (0,o.topk)(e,t),a=(0,n.softmax)(r.data);return Array.from({length:this.generation_config.num_beams},()=>{let e=this.randomSelect(a);return[s.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));let[r,s]=await (0,o.topk)(e,t),a=(0,n.softmax)(r.data);return Array.from({length:this.generation_config.num_beams},(e,t)=>[s.data[t],Math.log(a[t])])}}},"./src/generation/stopping_criteria.js":(e,t,r)=>{r.r(t),r.d(t,{EosTokenCriteria:()=>i,InterruptableStoppingCriteria:()=>l,MaxLengthCriteria:()=>a,StoppingCriteria:()=>o,StoppingCriteriaList:()=>n});var s=r("./src/utils/generic.js");class o extends s.Callable{_call(e,t){throw Error("StoppingCriteria needs to be subclassed")}}class n extends s.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){let r=Array(e.length).fill(!1);for(let s of this.criteria){let o=s(e,t);for(let e=0;e<r.length;++e)r[e]||=o[e]}return r}[Symbol.iterator](){return this.criteria.values()}}class a extends o{constructor(e,t=null){super(),this.max_length=e,this.max_position_embeddings=t}_call(e){return e.map(e=>e.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=>{let 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 Array(e.length).fill(this.interrupted)}}},"./src/generation/streamers.js":(e,t,r)=>{r.r(t),r.d(t,{BaseStreamer:()=>i,TextStreamer:()=>c,WhisperTextStreamer:()=>d});var s=r("./src/utils/core.js"),o=r("./src/tokenizers.js"),a=r("./src/env.js");class i{put(e){throw Error("Not implemented")}end(){throw Error("Not implemented")}}let l=a.apis.IS_PROCESS_AVAILABLE?e=>n.stdout.write(e):e=>console.log(e);class c extends i{constructor(e,{skip_prompt:t=!1,callback_function:r=null,token_callback_function:s=null,skip_special_tokens:o=!0,decode_kwargs:n={},...a}={}){super(),this.tokenizer=e,this.skip_prompt=t,this.callback_function=r??l,this.token_callback_function=s,this.decode_kwargs={skip_special_tokens:o,...n,...a},this.token_cache=[],this.print_len=0,this.next_tokens_are_prompt=!0}put(e){let t;if(e.length>1)throw Error("TextStreamer only supports batch size of 1");let r=this.next_tokens_are_prompt;if(r&&(this.next_tokens_are_prompt=!1,this.skip_prompt))return;let n=e[0];this.token_callback_function?.(n),this.token_cache=(0,s.mergeArrays)(this.token_cache,n);let a=this.tokenizer.decode(this.token_cache,this.decode_kwargs);r||a.endsWith("\n")?(t=a.slice(this.print_len),this.token_cache=[],this.print_len=0):(t=a.length>0&&(0,o.is_chinese_char)(a.charCodeAt(a.length-1))?a.slice(this.print_len):a.slice(this.print_len,a.lastIndexOf(" ")+1),this.print_len+=t.length),this.on_finalized_text(t,!1)}end(){let e;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):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===l&&a.apis.IS_PROCESS_AVAILABLE&&this.callback_function?.("\n")}}class d extends c{constructor(e,{skip_prompt:t=!1,callback_function:r=null,token_callback_function:s=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:r,token_callback_function:s,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");let t=e[0];if(1===t.length){let r=Number(t[0])-this.timestamp_begin;if(r>=0){let t=r*this.time_precision;this.waiting_for_timestamp?this.on_chunk_end?.(t):this.on_chunk_start?.(t),this.waiting_for_timestamp=!this.waiting_for_timestamp,e=[[]]}}return super.put(e)}end(){super.end(),this.on_finalize?.()}}},"./src/models.js":(e,t,r)=>{r.r(t),r.d(t,{ASTForAudioClassification:()=>t1,ASTModel:()=>t0,ASTPreTrainedModel:()=>tZ,AlbertForMaskedLM:()=>td,AlbertForQuestionAnswering:()=>tc,AlbertForSequenceClassification:()=>tl,AlbertModel:()=>ti,AlbertPreTrainedModel:()=>ta,AutoModel:()=>lw,AutoModelForAudioClassification:()=>lV,AutoModelForAudioFrameClassification:()=>lB,AutoModelForAudioTextToText:()=>lH,AutoModelForCTC:()=>lO,AutoModelForCausalLM:()=>lF,AutoModelForDepthEstimation:()=>l$,AutoModelForDocumentQuestionAnswering:()=>lG,AutoModelForImageClassification:()=>lE,AutoModelForImageFeatureExtraction:()=>lQ,AutoModelForImageMatting:()=>lR,AutoModelForImageSegmentation:()=>lA,AutoModelForImageTextToText:()=>lX,AutoModelForImageToImage:()=>lq,AutoModelForMaskGeneration:()=>lD,AutoModelForMaskedLM:()=>lv,AutoModelForNormalEstimation:()=>lW,AutoModelForObjectDetection:()=>lz,AutoModelForPoseEstimation:()=>lU,AutoModelForQuestionAnswering:()=>lC,AutoModelForSemanticSegmentation:()=>lL,AutoModelForSeq2SeqLM:()=>lT,AutoModelForSequenceClassification:()=>lx,AutoModelForSpeechSeq2Seq:()=>lP,AutoModelForTextToSpectrogram:()=>ly,AutoModelForTextToWaveform:()=>lk,AutoModelForTokenClassification:()=>lb,AutoModelForUniversalSegmentation:()=>lI,AutoModelForVision2Seq:()=>lS,AutoModelForXVector:()=>lN,AutoModelForZeroShotObjectDetection:()=>lj,BartForConditionalGeneration:()=>tT,BartForSequenceClassification:()=>tP,BartModel:()=>tb,BartPretrainedModel:()=>tx,BaseModelOutput:()=>Q,BeitForImageClassification:()=>oy,BeitModel:()=>oP,BeitPreTrainedModel:()=>oT,BertForMaskedLM:()=>J,BertForQuestionAnswering:()=>Z,BertForSequenceClassification:()=>Y,BertForTokenClassification:()=>K,BertModel:()=>H,BertPreTrainedModel:()=>X,BlenderbotForConditionalGeneration:()=>tA,BlenderbotModel:()=>tE,BlenderbotPreTrainedModel:()=>tS,BlenderbotSmallForConditionalGeneration:()=>tz,BlenderbotSmallModel:()=>tI,BlenderbotSmallPreTrainedModel:()=>tL,BloomForCausalLM:()=>s$,BloomModel:()=>sq,BloomPreTrainedModel:()=>sR,CLIPModel:()=>r_,CLIPPreTrainedModel:()=>rp,CLIPSegForImageSegmentation:()=>rA,CLIPSegModel:()=>rE,CLIPSegPreTrainedModel:()=>rS,CLIPTextModel:()=>rh,CLIPTextModelWithProjection:()=>rg,CLIPVisionModel:()=>rf,CLIPVisionModelWithProjection:()=>rM,CamembertForMaskedLM:()=>ev,CamembertForQuestionAnswering:()=>eE,CamembertForSequenceClassification:()=>eC,CamembertForTokenClassification:()=>eS,CamembertModel:()=>eF,CamembertPreTrainedModel:()=>ek,CausalLMOutput:()=>l2,CausalLMOutputWithPast:()=>l3,ChineseCLIPModel:()=>ry,ChineseCLIPPreTrainedModel:()=>rP,ClapAudioModelWithProjection:()=>aR,ClapModel:()=>aB,ClapPreTrainedModel:()=>aN,ClapTextModelWithProjection:()=>aG,CodeGenForCausalLM:()=>rK,CodeGenModel:()=>rY,CodeGenPreTrainedModel:()=>rJ,CohereForCausalLM:()=>sh,CohereModel:()=>s_,CoherePreTrainedModel:()=>sp,ConvBertForMaskedLM:()=>eh,ConvBertForQuestionAnswering:()=>eM,ConvBertForSequenceClassification:()=>eg,ConvBertForTokenClassification:()=>ef,ConvBertModel:()=>e_,ConvBertPreTrainedModel:()=>ep,ConvNextForImageClassification:()=>nv,ConvNextModel:()=>nF,ConvNextPreTrainedModel:()=>nk,ConvNextV2ForImageClassification:()=>nE,ConvNextV2Model:()=>nS,ConvNextV2PreTrainedModel:()=>nC,DFineForObjectDetection:()=>oW,DFineModel:()=>o$,DFinePreTrainedModel:()=>oq,DPTForDepthEstimation:()=>no,DPTModel:()=>ns,DPTPreTrainedModel:()=>nr,DacDecoderModel:()=>iN,DacDecoderOutput:()=>iD,DacEncoderModel:()=>iV,DacEncoderOutput:()=>ij,DacModel:()=>iO,DacPreTrainedModel:()=>iz,DebertaForMaskedLM:()=>eI,DebertaForQuestionAnswering:()=>eD,DebertaForSequenceClassification:()=>ez,DebertaForTokenClassification:()=>ej,DebertaModel:()=>eL,DebertaPreTrainedModel:()=>eA,DebertaV2ForMaskedLM:()=>eN,DebertaV2ForQuestionAnswering:()=>eR,DebertaV2ForSequenceClassification:()=>eB,DebertaV2ForTokenClassification:()=>eG,DebertaV2Model:()=>eV,DebertaV2PreTrainedModel:()=>eO,DecisionTransformerModel:()=>ip,DecisionTransformerPreTrainedModel:()=>im,DeiTForImageClassification:()=>oK,DeiTModel:()=>oY,DeiTPreTrainedModel:()=>oJ,DepthAnythingForDepthEstimation:()=>na,DepthAnythingPreTrainedModel:()=>nn,DepthProForDepthEstimation:()=>nm,DepthProPreTrainedModel:()=>nu,DetrForObjectDetection:()=>ov,DetrForSegmentation:()=>oC,DetrModel:()=>oF,DetrObjectDetectionOutput:()=>oS,DetrPreTrainedModel:()=>ok,DetrSegmentationOutput:()=>oE,Dinov2ForImageClassification:()=>nI,Dinov2Model:()=>nL,Dinov2PreTrainedModel:()=>nA,Dinov2WithRegistersForImageClassification:()=>nD,Dinov2WithRegistersModel:()=>nj,Dinov2WithRegistersPreTrainedModel:()=>nz,DistilBertForMaskedLM:()=>eX,DistilBertForQuestionAnswering:()=>eQ,DistilBertForSequenceClassification:()=>eW,DistilBertForTokenClassification:()=>eU,DistilBertModel:()=>e$,DistilBertPreTrainedModel:()=>eq,DonutSwinModel:()=>ny,DonutSwinPreTrainedModel:()=>nP,EfficientNetForImageClassification:()=>a0,EfficientNetModel:()=>aZ,EfficientNetPreTrainedModel:()=>aK,ElectraForMaskedLM:()=>eb,ElectraForQuestionAnswering:()=>ey,ElectraForSequenceClassification:()=>eT,ElectraForTokenClassification:()=>eP,ElectraModel:()=>ex,ElectraPreTrainedModel:()=>ew,EsmForMaskedLM:()=>eY,EsmForSequenceClassification:()=>eK,EsmForTokenClassification:()=>eZ,EsmModel:()=>eJ,EsmPreTrainedModel:()=>eH,ExaoneForCausalLM:()=>se,ExaoneModel:()=>r7,ExaonePreTrainedModel:()=>r9,FalconForCausalLM:()=>aV,FalconModel:()=>aO,FalconPreTrainedModel:()=>aD,FastViTForImageClassification:()=>oi,FastViTModel:()=>oa,FastViTPreTrainedModel:()=>on,Florence2ForConditionalGeneration:()=>rn,Florence2PreTrainedModel:()=>ro,GLPNForDepthEstimation:()=>nT,GLPNModel:()=>nb,GLPNPreTrainedModel:()=>nx,GPT2LMHeadModel:()=>rz,GPT2Model:()=>rI,GPT2PreTrainedModel:()=>rL,GPTBigCodeForCausalLM:()=>rH,GPTBigCodeModel:()=>rX,GPTBigCodePreTrainedModel:()=>rQ,GPTJForCausalLM:()=>rU,GPTJModel:()=>rW,GPTJPreTrainedModel:()=>r$,GPTNeoForCausalLM:()=>rB,GPTNeoModel:()=>rN,GPTNeoPreTrainedModel:()=>rV,GPTNeoXForCausalLM:()=>rq,GPTNeoXModel:()=>rR,GPTNeoXPreTrainedModel:()=>rG,Gemma2ForCausalLM:()=>sb,Gemma2Model:()=>sx,Gemma2PreTrainedModel:()=>sw,Gemma3ForCausalLM:()=>sy,Gemma3Model:()=>sP,Gemma3PreTrainedModel:()=>sT,GemmaForCausalLM:()=>sM,GemmaModel:()=>sf,GemmaPreTrainedModel:()=>sg,GlmForCausalLM:()=>r6,GlmModel:()=>r5,GlmPreTrainedModel:()=>r8,GraniteForCausalLM:()=>sm,GraniteModel:()=>su,GranitePreTrainedModel:()=>sd,GroundingDinoForObjectDetection:()=>nV,GroundingDinoPreTrainedModel:()=>nO,GroupViTModel:()=>oo,GroupViTPreTrainedModel:()=>os,HeliumForCausalLM:()=>r4,HeliumModel:()=>r3,HeliumPreTrainedModel:()=>r2,HieraForImageClassification:()=>o1,HieraModel:()=>o0,HieraPreTrainedModel:()=>oZ,HubertForCTC:()=>ap,HubertForSequenceClassification:()=>a_,HubertModel:()=>am,HubertPreTrainedModel:()=>au,IJepaForImageClassification:()=>s2,IJepaModel:()=>s1,IJepaPreTrainedModel:()=>s0,Idefics3ForConditionalGeneration:()=>rc,Idefics3PreTrainedModel:()=>rl,ImageMattingOutput:()=>l4,JAISLMHeadModel:()=>rO,JAISModel:()=>rD,JAISPreTrainedModel:()=>rj,JinaCLIPModel:()=>rF,JinaCLIPPreTrainedModel:()=>rk,JinaCLIPTextModel:()=>rv,JinaCLIPVisionModel:()=>rC,LiteWhisperForConditionalGeneration:()=>t8,LlamaForCausalLM:()=>r1,LlamaModel:()=>r0,LlamaPreTrainedModel:()=>rZ,LlavaForConditionalGeneration:()=>rt,LlavaOnevisionForConditionalGeneration:()=>rr,LlavaPreTrainedModel:()=>re,LongT5ForConditionalGeneration:()=>tg,LongT5Model:()=>th,LongT5PreTrainedModel:()=>t_,M2M100ForConditionalGeneration:()=>nY,M2M100Model:()=>nJ,M2M100PreTrainedModel:()=>nH,MBartForCausalLM:()=>tC,MBartForConditionalGeneration:()=>tF,MBartForSequenceClassification:()=>tv,MBartModel:()=>tk,MBartPreTrainedModel:()=>ty,MPNetForMaskedLM:()=>e6,MPNetForQuestionAnswering:()=>te,MPNetForSequenceClassification:()=>e9,MPNetForTokenClassification:()=>e7,MPNetModel:()=>e5,MPNetPreTrainedModel:()=>e8,MT5ForConditionalGeneration:()=>tw,MT5Model:()=>tM,MT5PreTrainedModel:()=>tf,MarianMTModel:()=>nX,MarianModel:()=>nQ,MarianPreTrainedModel:()=>nU,MaskFormerForInstanceSegmentation:()=>nw,MaskFormerModel:()=>nM,MaskFormerPreTrainedModel:()=>nf,MaskedLMOutput:()=>l0,Metric3DForDepthEstimation:()=>n_,Metric3DPreTrainedModel:()=>np,Metric3Dv2ForDepthEstimation:()=>ng,Metric3Dv2PreTrainedModel:()=>nh,MgpstrForSceneTextRecognition:()=>iw,MgpstrModelOutput:()=>ig,MgpstrPreTrainedModel:()=>iM,MimiDecoderModel:()=>iI,MimiDecoderOutput:()=>iE,MimiEncoderModel:()=>iL,MimiEncoderOutput:()=>iS,MimiModel:()=>iA,MimiPreTrainedModel:()=>iC,MistralForCausalLM:()=>aL,MistralModel:()=>aA,MistralPreTrainedModel:()=>aE,MobileBertForMaskedLM:()=>e2,MobileBertForQuestionAnswering:()=>e4,MobileBertForSequenceClassification:()=>e3,MobileBertModel:()=>e1,MobileBertPreTrainedModel:()=>e0,MobileLLMForCausalLM:()=>ss,MobileLLMModel:()=>sr,MobileLLMPreTrainedModel:()=>st,MobileNetV1ForImageClassification:()=>a6,MobileNetV1ForSemanticSegmentation:()=>a9,MobileNetV1Model:()=>a5,MobileNetV1PreTrainedModel:()=>a8,MobileNetV2ForImageClassification:()=>it,MobileNetV2ForSemanticSegmentation:()=>ir,MobileNetV2Model:()=>ie,MobileNetV2PreTrainedModel:()=>a7,MobileNetV3ForImageClassification:()=>ia,MobileNetV3ForSemanticSegmentation:()=>ii,MobileNetV3Model:()=>io,MobileNetV3PreTrainedModel:()=>is,MobileNetV4ForImageClassification:()=>id,MobileNetV4ForSemanticSegmentation:()=>iu,MobileNetV4Model:()=>ic,MobileNetV4PreTrainedModel:()=>il,MobileViTForImageClassification:()=>om,MobileViTModel:()=>ou,MobileViTPreTrainedModel:()=>od,MobileViTV2ForImageClassification:()=>oh,MobileViTV2Model:()=>o_,MobileViTV2PreTrainedModel:()=>op,ModelOutput:()=>U,ModernBertForMaskedLM:()=>er,ModernBertForSequenceClassification:()=>es,ModernBertForTokenClassification:()=>eo,ModernBertModel:()=>et,ModernBertPreTrainedModel:()=>ee,Moondream1ForConditionalGeneration:()=>rs,MoonshineForConditionalGeneration:()=>t9,MoonshineModel:()=>t6,MoonshinePreTrainedModel:()=>t5,MptForCausalLM:()=>sQ,MptModel:()=>sU,MptPreTrainedModel:()=>sW,MultiModalityCausalLM:()=>ih,MultiModalityPreTrainedModel:()=>i_,MusicgenForCausalLM:()=>a3,MusicgenForConditionalGeneration:()=>a4,MusicgenModel:()=>a2,MusicgenPreTrainedModel:()=>a1,NomicBertModel:()=>ea,NomicBertPreTrainedModel:()=>en,OPTForCausalLM:()=>sJ,OPTModel:()=>sH,OPTPreTrainedModel:()=>sX,Olmo2ForCausalLM:()=>sc,Olmo2Model:()=>sl,Olmo2PreTrainedModel:()=>si,OlmoForCausalLM:()=>sa,OlmoModel:()=>sn,OlmoPreTrainedModel:()=>so,OpenELMForCausalLM:()=>sv,OpenELMModel:()=>sF,OpenELMPreTrainedModel:()=>sk,OwlViTForObjectDetection:()=>oM,OwlViTModel:()=>of,OwlViTPreTrainedModel:()=>og,Owlv2ForObjectDetection:()=>ob,Owlv2Model:()=>ox,Owlv2PreTrainedModel:()=>ow,PaliGemmaForConditionalGeneration:()=>ri,PaliGemmaPreTrainedModel:()=>ra,PatchTSMixerForPrediction:()=>ik,PatchTSMixerModel:()=>iy,PatchTSMixerPreTrainedModel:()=>iP,PatchTSTForPrediction:()=>iT,PatchTSTModel:()=>ib,PatchTSTPreTrainedModel:()=>ix,Phi3ForCausalLM:()=>sG,Phi3Model:()=>sB,Phi3PreTrainedModel:()=>sN,Phi3VForCausalLM:()=>rm,Phi3VPreTrainedModel:()=>ru,PhiForCausalLM:()=>sV,PhiModel:()=>sO,PhiPreTrainedModel:()=>sD,PreTrainedModel:()=>W,PretrainedMixin:()=>i$,PvtForImageClassification:()=>s6,PvtModel:()=>s5,PvtPreTrainedModel:()=>s8,PyAnnoteForAudioFrameClassification:()=>n8,PyAnnoteModel:()=>n4,PyAnnotePreTrainedModel:()=>n3,QuestionAnsweringModelOutput:()=>l1,Qwen2ForCausalLM:()=>sE,Qwen2Model:()=>sS,Qwen2PreTrainedModel:()=>sC,Qwen2VLForConditionalGeneration:()=>sj,Qwen2VLPreTrainedModel:()=>sz,Qwen3ForCausalLM:()=>sI,Qwen3Model:()=>sL,Qwen3PreTrainedModel:()=>sA,RFDetrForObjectDetection:()=>oG,RFDetrModel:()=>oB,RFDetrObjectDetectionOutput:()=>oR,RFDetrPreTrainedModel:()=>oN,RTDetrForObjectDetection:()=>oI,RTDetrModel:()=>oL,RTDetrObjectDetectionOutput:()=>oz,RTDetrPreTrainedModel:()=>oA,RTDetrV2ForObjectDetection:()=>oO,RTDetrV2Model:()=>oD,RTDetrV2ObjectDetectionOutput:()=>oV,RTDetrV2PreTrainedModel:()=>oj,ResNetForImageClassification:()=>o4,ResNetModel:()=>o3,ResNetPreTrainedModel:()=>o2,RoFormerForMaskedLM:()=>ec,RoFormerForQuestionAnswering:()=>em,RoFormerForSequenceClassification:()=>ed,RoFormerForTokenClassification:()=>eu,RoFormerModel:()=>el,RoFormerPreTrainedModel:()=>ei,RobertaForMaskedLM:()=>tO,RobertaForQuestionAnswering:()=>tB,RobertaForSequenceClassification:()=>tV,RobertaForTokenClassification:()=>tN,RobertaModel:()=>tD,RobertaPreTrainedModel:()=>tj,SamImageSegmentationOutput:()=>nW,SamModel:()=>n$,SamPreTrainedModel:()=>nq,SapiensForDepthEstimation:()=>nc,SapiensForNormalEstimation:()=>nd,SapiensForSemanticSegmentation:()=>nl,SapiensPreTrainedModel:()=>ni,SegformerForImageClassification:()=>aQ,SegformerForSemanticSegmentation:()=>aX,SegformerModel:()=>aU,SegformerPreTrainedModel:()=>aW,Seq2SeqLMOutput:()=>lJ,SequenceClassifierOutput:()=>lY,SiglipModel:()=>rx,SiglipPreTrainedModel:()=>rw,SiglipTextModel:()=>rb,SiglipVisionModel:()=>rT,SmolVLMForConditionalGeneration:()=>rd,SnacDecoderModel:()=>iq,SnacEncoderModel:()=>iR,SnacModel:()=>iG,SnacPreTrainedModel:()=>iB,SpeechT5ForSpeechToText:()=>ak,SpeechT5ForTextToSpeech:()=>aF,SpeechT5HifiGan:()=>av,SpeechT5Model:()=>ay,SpeechT5PreTrainedModel:()=>aP,SqueezeBertForMaskedLM:()=>ts,SqueezeBertForQuestionAnswering:()=>tn,SqueezeBertForSequenceClassification:()=>to,SqueezeBertModel:()=>tr,SqueezeBertPreTrainedModel:()=>tt,StableLmForCausalLM:()=>aY,StableLmModel:()=>aJ,StableLmPreTrainedModel:()=>aH,Starcoder2ForCausalLM:()=>aj,Starcoder2Model:()=>az,Starcoder2PreTrainedModel:()=>aI,StyleTextToSpeech2Model:()=>aT,StyleTextToSpeech2PreTrainedModel:()=>ab,Swin2SRForImageSuperResolution:()=>nt,Swin2SRModel:()=>ne,Swin2SRPreTrainedModel:()=>o7,SwinForImageClassification:()=>o6,SwinForSemanticSegmentation:()=>o9,SwinModel:()=>o5,SwinPreTrainedModel:()=>o8,T5ForConditionalGeneration:()=>tp,T5Model:()=>tm,T5PreTrainedModel:()=>tu,TableTransformerForObjectDetection:()=>oX,TableTransformerModel:()=>oQ,TableTransformerObjectDetectionOutput:()=>oH,TableTransformerPreTrainedModel:()=>oU,TokenClassifierOutput:()=>lZ,TrOCRForCausalLM:()=>aS,TrOCRPreTrainedModel:()=>aC,UltravoxModel:()=>iv,UltravoxPreTrainedModel:()=>iF,UniSpeechForCTC:()=>ae,UniSpeechForSequenceClassification:()=>at,UniSpeechModel:()=>n7,UniSpeechPreTrainedModel:()=>n9,UniSpeechSatForAudioFrameClassification:()=>aa,UniSpeechSatForCTC:()=>ao,UniSpeechSatForSequenceClassification:()=>an,UniSpeechSatModel:()=>as,UniSpeechSatPreTrainedModel:()=>ar,ViTForImageClassification:()=>sZ,ViTMAEModel:()=>s7,ViTMAEPreTrainedModel:()=>s9,ViTMSNForImageClassification:()=>or,ViTMSNModel:()=>ot,ViTMSNPreTrainedModel:()=>oe,ViTModel:()=>sK,ViTPreTrainedModel:()=>sY,VisionEncoderDecoderModel:()=>t7,VitMatteForImageMatting:()=>oc,VitMattePreTrainedModel:()=>ol,VitPoseForPoseEstimation:()=>s4,VitPosePreTrainedModel:()=>s3,VitsModel:()=>a$,VitsModelOutput:()=>l8,VitsPreTrainedModel:()=>aq,Wav2Vec2BertForCTC:()=>ac,Wav2Vec2BertForSequenceClassification:()=>ad,Wav2Vec2BertModel:()=>al,Wav2Vec2BertPreTrainedModel:()=>ai,Wav2Vec2ForAudioFrameClassification:()=>n2,Wav2Vec2ForCTC:()=>n0,Wav2Vec2ForSequenceClassification:()=>n1,Wav2Vec2Model:()=>nZ,Wav2Vec2PreTrainedModel:()=>nK,WavLMForAudioFrameClassification:()=>ax,WavLMForCTC:()=>af,WavLMForSequenceClassification:()=>aM,WavLMForXVector:()=>aw,WavLMModel:()=>ag,WavLMPreTrainedModel:()=>ah,WeSpeakerResNetModel:()=>n6,WeSpeakerResNetPreTrainedModel:()=>n5,WhisperForConditionalGeneration:()=>t4,WhisperModel:()=>t3,WhisperPreTrainedModel:()=>t2,XLMForQuestionAnswering:()=>tU,XLMForSequenceClassification:()=>t$,XLMForTokenClassification:()=>tW,XLMModel:()=>tR,XLMPreTrainedModel:()=>tG,XLMRobertaForMaskedLM:()=>tH,XLMRobertaForQuestionAnswering:()=>tK,XLMRobertaForSequenceClassification:()=>tJ,XLMRobertaForTokenClassification:()=>tY,XLMRobertaModel:()=>tX,XLMRobertaPreTrainedModel:()=>tQ,XLMWithLMHeadModel:()=>tq,XVectorOutput:()=>lK,YolosForObjectDetection:()=>nG,YolosModel:()=>nB,YolosObjectDetectionOutput:()=>nR,YolosPreTrainedModel:()=>nN});var s=r("./src/configs.js"),o=r("./src/backends/onnx.js"),n=r("./src/utils/dtypes.js"),a=r("./src/utils/generic.js"),i=r("./src/utils/core.js"),l=r("./src/utils/hub.js"),c=r("./src/utils/constants.js"),d=r("./src/generation/logits_process.js"),u=r("./src/generation/configuration_utils.js"),m=r("./src/utils/tensor.js"),p=r("./src/utils/image.js"),_=r("./src/utils/maths.js"),h=r("./src/generation/stopping_criteria.js"),g=r("./src/generation/logits_sampler.js"),f=r("./src/env.js"),M=r("./src/models/whisper/generation_whisper.js"),w=r("./src/models/whisper/common_whisper.js");let x={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4,MaskGeneration:5,ImageTextToText:6,Musicgen:7,MultiModality:8,Phi3V:9,AudioTextToText:10,AutoEncoder:11},b=new Map,T=new Map,P=new Map;async function y(e,t,r){let a=r.config?.["transformers.js_config"]??{},i=r.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));let c=i??(f.apis.IS_NODE_ENV?"cpu":"wasm"),d=(0,o.deviceToExecutionProviders)(c),u=a.device_config??{};u.hasOwnProperty(c)&&(a={...a,...u[c]});let m=r.dtype??a.dtype;if("string"!=typeof m&&(m&&m.hasOwnProperty(t)?m=m[t]:(m=n.DEFAULT_DEVICE_DTYPE_MAPPING[c]??n.DATA_TYPES.fp32,console.warn(`dtype not specified for "${t}". Using the default dtype (${m}) for this device (${c}).`))),m===n.DATA_TYPES.auto){let e=a.dtype;"string"!=typeof e&&(e=e?.[t]),m=e&&e!==n.DATA_TYPES.auto&&n.DATA_TYPES.hasOwnProperty(e)?e:n.DEFAULT_DEVICE_DTYPE_MAPPING[c]??n.DATA_TYPES.fp32}let p=m;if(n.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(p)){if(p===n.DATA_TYPES.fp16&&"webgpu"===c&&!await (0,n.isWebGpuFp16Supported)())throw Error(`The device (${c}) does not support fp16.`)}else throw Error(`Invalid dtype: ${p}. Should be one of: ${Object.keys(n.DATA_TYPES).join(", ")}`);let _=a.kv_cache_dtype,h=_?"string"==typeof _?_:_[p]??"float32":void 0;if(h&&!["float32","float16"].includes(h))throw Error(`Invalid kv_cache_dtype: ${h}. Should be one of: float32, float16`);let g=n.DEFAULT_DTYPE_SUFFIX_MAPPING[p],M=`${t}${g}.onnx`,w=`${r.subfolder??""}/${M}`,x={...r.session_options};x.executionProviders??=d;let 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.`);let T=f.apis.IS_NODE_ENV&&f.env.useFSCache,P=(0,l.getModelFile)(e,w,!0,r,T),y=r.use_external_data_format??a.use_external_data_format,k=[];if(y){let s,o=+("object"==typeof y?y.hasOwnProperty(M)?y[M]:!!y.hasOwnProperty(t)&&y[t]:y);if(o>l.MAX_EXTERNAL_DATA_CHUNKS)throw Error(`The number of external data chunks (${o}) exceeds the maximum allowed value (${l.MAX_EXTERNAL_DATA_CHUNKS}).`);for(let t=0;t<o;++t){let s=`${M}_data${0===t?"":"_"+t}`,o=`${r.subfolder??""}/${s}`;k.push(new Promise(async(t,n)=>{let a=await (0,l.getModelFile)(e,o,!0,r,T);t(a instanceof Uint8Array?{path:s,data:a}:s)}))}}else void 0!==x.externalData&&(k=x.externalData.map(async t=>{if("string"==typeof t.data){let s=await (0,l.getModelFile)(e,t.data,!0,r);return{...t,data:s}}return t}));if(k.length>0){let e=await Promise.all(k);f.apis.IS_NODE_ENV||(x.externalData=e)}if("webgpu"===c){let e=(0,s.getKeyValueShapes)(r.config,{prefix:"present"});if(Object.keys(e).length>0&&!(0,o.isONNXProxy)()){let t={};for(let r in e)t[r]="gpu-buffer";x.preferredOutputLocation=t}}return{buffer_or_path:await P,session_options:x,session_config:{dtype:p,kv_cache_dtype:h,device:c}}}async function k(e,t,r){return Object.fromEntries(await Promise.all(Object.keys(t).map(async s=>{let{buffer_or_path:n,session_options:a,session_config:i}=await y(e,t[s],r);return[s,await (0,o.createInferenceSession)(n,a,i)]})))}async function F(e,t,r){return Object.fromEntries(await Promise.all(Object.keys(t).map(async s=>{let o=await (0,l.getModelJSON)(e,t[s],!1,r);return[s,o]})))}let v=Promise.resolve();async function C(e,t){let r=function(e,t){let r=Object.create(null),s=[];for(let n of e.inputNames){let e=t[n];if(!(e instanceof m.Tensor)){s.push(n);continue}r[n]=(0,o.isONNXProxy)()?e.clone():e}if(s.length>0)throw Error(`An error occurred during model execution: "Missing the following inputs: ${s.join(", ")}.`);let n=Object.keys(t).length,a=e.inputNames.length;if(n>a){let r=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: "${r.join(", ")}".`)}return r}(e,t);try{let t=Object.fromEntries(Object.entries(r).map(([e,t])=>[e,t.ort_tensor])),s=()=>e.run(t),n=await (f.apis.IS_BROWSER_ENV||f.apis.IS_WEBWORKER_ENV?v=v.then(s):s());return function e(t){for(let r in t)(0,o.isONNXTensor)(t[r])?t[r]=new m.Tensor(t[r]):"object"==typeof t[r]&&e(t[r]);return t}(n)}catch(t){let e=Object.fromEntries(Object.entries(r).map(([e,t])=>{let r={type:t.type,dims:t.dims,location:t.location};return"gpu-buffer"!==r.location&&(r.data=t.data),[e,r]}));throw console.error(`An error occurred during model execution: "${t}".`),console.error("Inputs given to model:",e),t}}function S(e){if(e instanceof m.Tensor)return e;if(0===e.length)throw Error("items must be non-empty");if(!Array.isArray(e[0]))return new m.Tensor("int64",BigInt64Array.from(e.map(e=>BigInt(e))),[1,e.length]);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 m.Tensor("int64",BigInt64Array.from(e.flat().map(e=>BigInt(e))),[e.length,e[0].length])}function E(e){return new m.Tensor("bool",[e],[1])}async function A(e,t){let{encoder_outputs:r,input_ids:s,decoder_input_ids:o,...n}=t;if(!r){let s=(0,i.pick)(t,e.sessions.model.inputNames);r=(await L(e,s)).last_hidden_state}return n.input_ids=o,n.encoder_hidden_states=r,e.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(n.encoder_attention_mask=t.attention_mask),await z(e,n,!0)}async function L(e,t){let r=e.sessions.model,s=(0,i.pick)(t,r.inputNames);if(r.inputNames.includes("inputs_embeds")&&!s.inputs_embeds){if(!t.input_ids)throw Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");s.inputs_embeds=await e.encode_text({input_ids:t.input_ids})}if(r.inputNames.includes("token_type_ids")&&!s.token_type_ids){if(!s.input_ids)throw Error("Both `input_ids` and `token_type_ids` are missing in the model inputs.");s.token_type_ids=(0,m.zeros_like)(s.input_ids)}if(r.inputNames.includes("pixel_mask")&&!s.pixel_mask){if(!s.pixel_values)throw Error("Both `pixel_values` and `pixel_mask` are missing in the model inputs.");let e=s.pixel_values.dims;s.pixel_mask=(0,m.ones)([e[0],e[2],e[3]])}return await C(r,s)}async function I(e,t){let r=await e.encode(t);return await e.decode(r)}async function z(e,t,r=!1){let s=e.sessions[r?"decoder_model_merged":"model"],{past_key_values:o,...n}=t;s.inputNames.includes("use_cache_branch")&&(n.use_cache_branch=E(!!o)),s.inputNames.includes("position_ids")&&n.attention_mask&&!n.position_ids&&(n.position_ids=function(e,t=null,r=0){let{input_ids:s,inputs_embeds:o,attention_mask:n}=e,{data:a,dims:i}=B(n,r),l=new m.Tensor("int64",a,i);if(t){let e=-(s??o).dims.at(1);l=l.slice(null,[e,null])}return l}(n,o,+!!["paligemma","gemma3_text","gemma3"].includes(e.config.model_type))),e.addPastKeyValues(n,o);let a=(0,i.pick)(n,s.inputNames);return await C(s,a)}function j({modality_token_id:e,inputs_embeds:t,modality_features:r,input_ids:s,attention_mask:o}){let n=s.tolist().map(t=>t.reduce((t,r,s)=>(r==e&&t.push(s),t),[])),a=n.reduce((e,t)=>e+t.length,0),i=r.dims[0];if(a!==i)throw Error(`Number of tokens and features do not match: tokens: ${a}, features ${i}`);let l=0;for(let e=0;e<n.length;++e){let s=n[e],o=t[e];for(let e=0;e<s.length;++e)o[s[e]].data.set(r[l++].data)}return{inputs_embeds:t,attention_mask:o}}function D({image_token_id:e,inputs_embeds:t,image_features:r,input_ids:s,attention_mask:o}){return j({modality_token_id:e,inputs_embeds:t,modality_features:r,input_ids:s,attention_mask:o})}async function O(e,{encode_function:t,merge_function:r,modality_input_name:s,modality_output_name:o,input_ids:n=null,attention_mask:a=null,position_ids:i=null,inputs_embeds:l=null,past_key_values:c=null,generation_config:d=null,logits_processor:u=null,...p}){let _=p[s];if(!l){if(l=await e.encode_text({input_ids:n,...p}),_&&1!==n.dims[1]){let e=await t({[s]:_,...p});({inputs_embeds:l,attention_mask:a}=r({[o]:e,inputs_embeds:l,input_ids:n,attention_mask:a}))}else if(c&&_&&1===n.dims[1]){let e=n.dims[1],t=Object.values(c)[0].dims.at(-2);a=(0,m.cat)([(0,m.ones)([n.dims[0],t]),a.slice(null,[a.dims[1]-e,a.dims[1]])],1)}}if(!i&&"qwen2_vl"===e.config.model_type){let{image_grid_thw:t,video_grid_thw:r}=p;[i]=e.get_rope_index(n,t,r,a)}return await z(e,{inputs_embeds:l,past_key_values:c,attention_mask:a,position_ids:i,generation_config:d,logits_processor:u},!0)}async function V(e,t){return await O(e,{...t,modality_input_name:"audio_values",modality_output_name:"audio_features",encode_function:e.encode_audio.bind(e),merge_function:e._merge_input_ids_with_audio_features.bind(e)})}async function N(e,t){return await O(e,{...t,modality_input_name:"pixel_values",modality_output_name:"image_features",encode_function:e.encode_image.bind(e),merge_function:e._merge_input_ids_with_image_features.bind(e)})}function B(e,t=0){let[r,s]=e.dims,o=e.data,n=new BigInt64Array(o.length);for(let e=0;e<r;++e){let r=e*s,a=BigInt(t);for(let e=0;e<s;++e){let t=r+e;0n===o[t]?n[t]=BigInt(1):(n[t]=a,a+=o[t])}}return{data:n,dims:e.dims}}function G(e,t,r,s){if(r.past_key_values){let t=Object.values(r.past_key_values)[0].dims.at(-2),{input_ids:s,attention_mask:o}=r;if(o&&o.dims[1]>s.dims[1]);else if(t<s.dims[1])r.input_ids=s.slice(null,[t,null]);else if(null!=e.config.image_token_index&&s.data.some(t=>t==e.config.image_token_index)){let o=e.config.num_image_tokens;if(!o)throw Error("`num_image_tokens` is missing in the model configuration.");let n=s.dims[1]-(t-o);r.input_ids=s.slice(null,[-n,null]),r.attention_mask=(0,m.ones)([1,t+n])}}return r}function R(e,t,r,s){return r.past_key_values&&(t=t.map(e=>[e.at(-1)])),{...r,decoder_input_ids:S(t)}}function q(e,...t){return e.config.is_encoder_decoder?R(e,...t):G(e,...t)}function $(e,t,r,s){let o=!!r.past_key_values;return null!==s.guidance_scale&&s.guidance_scale>1&&(o?r.input_ids=(0,m.cat)([r.input_ids,r.input_ids],0):(r.input_ids=(0,m.cat)([r.input_ids,(0,m.full_like)(r.input_ids,BigInt(s.pad_token_id))],0),r.attention_mask=(0,m.cat)([r.attention_mask,(0,m.full_like)(r.attention_mask,0n)],0))),(o||!r.pixel_values)&&(r.pixel_values=(0,m.full)([0,0,3,384,384],1)),o&&(r.images_seq_mask=new m.Tensor("bool",[,].fill(!0).fill(!1,0,1),[1,1]),r.images_emb_mask=new m.Tensor("bool",[].fill(!1),[1,1,0])),r}class W extends a.Callable{main_input_name="input_ids";forward_params=["input_ids","attention_mask"];constructor(e,t,r){super(),this.config=e,this.sessions=t,this.configs=r;let s=P.get(this.constructor),o=b.get(s);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,o){case x.DecoderOnly:this.can_generate=!0,this._forward=z,this._prepare_inputs_for_generation=G;break;case x.Seq2Seq:case x.Vision2Seq:case x.Musicgen:this.can_generate=!0,this._forward=A,this._prepare_inputs_for_generation=R;break;case x.EncoderDecoder:this._forward=A;break;case x.ImageTextToText:this.can_generate=!0,this._forward=N,this._prepare_inputs_for_generation=q;break;case x.AudioTextToText:this.can_generate=!0,this._forward=V,this._prepare_inputs_for_generation=q;break;case x.Phi3V:this.can_generate=!0,this._prepare_inputs_for_generation=q;break;case x.MultiModality:this.can_generate=!0,this._prepare_inputs_for_generation=$;break;case x.AutoEncoder:this._forward=I;break;default:this._forward=L}this.can_generate&&this.forward_params.push("past_key_values"),this.custom_config=this.config["transformers.js_config"]??{}}async dispose(){let e=[];for(let 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:r=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:m=null,session_options:p={}}={}){let _,h={progress_callback:t,config:r,cache_dir:o,local_files_only:n,revision:a,model_file_name:i,subfolder:l,device:d,dtype:u,use_external_data_format:m,session_options:p},g=P.get(this),f=b.get(g);if(r=h.config=await s.AutoConfig.from_pretrained(e,h),f===x.DecoderOnly)_=await Promise.all([k(e,{model:h.model_file_name??"model"},h),F(e,{generation_config:"generation_config.json"},h)]);else if(f===x.Seq2Seq||f===x.Vision2Seq)_=await Promise.all([k(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},h),F(e,{generation_config:"generation_config.json"},h)]);else if(f===x.MaskGeneration)_=await Promise.all([k(e,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},h)]);else if(f===x.EncoderDecoder)_=await Promise.all([k(e,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},h)]);else if(f===x.ImageTextToText){let t={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};r.is_encoder_decoder&&(t.model="encoder_model"),_=await Promise.all([k(e,t,h),F(e,{generation_config:"generation_config.json"},h)])}else if(f===x.AudioTextToText)_=await Promise.all([k(e,{embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",decoder_model_merged:"decoder_model_merged"},h),F(e,{generation_config:"generation_config.json"},h)]);else if(f===x.Musicgen)_=await Promise.all([k(e,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},h),F(e,{generation_config:"generation_config.json"},h)]);else if(f===x.MultiModality)_=await Promise.all([k(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"},h),F(e,{generation_config:"generation_config.json"},h)]);else if(f===x.Phi3V)_=await Promise.all([k(e,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"model",vision_encoder:"vision_encoder"},h),F(e,{generation_config:"generation_config.json"},h)]);else if(f===x.AutoEncoder)_=await Promise.all([k(e,{encoder_model:"encoder_model",decoder_model:"decoder_model"},h)]);else{if(f!==x.EncoderOnly){let e=g??r?.model_type;"custom"!==e&&console.warn(`Model type for '${e}' not found, assuming encoder-only architecture. Please report this at ${c.GITHUB_ISSUE_URL}.`)}_=await Promise.all([k(e,{model:h.model_file_name??"model"},h)])}return new this(r,..._)}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_warper(e){let t=new d.LogitsProcessorList;return null!==e.temperature&&1!==e.temperature&&t.push(new d.TemperatureLogitsWarper(e.temperature)),null!==e.top_k&&0!==e.top_k&&t.push(new d.TopKLogitsWarper(e.top_k)),null!==e.top_p&&e.top_p<1&&t.push(new d.TopPLogitsWarper(e.top_p)),t}_get_logits_processor(e,t,r=null){let s=new d.LogitsProcessorList;if(null!==e.repetition_penalty&&1!==e.repetition_penalty&&s.push(new d.RepetitionPenaltyLogitsProcessor(e.repetition_penalty)),null!==e.no_repeat_ngram_size&&e.no_repeat_ngram_size>0&&s.push(new d.NoRepeatNGramLogitsProcessor(e.no_repeat_ngram_size)),null!==e.bad_words_ids&&s.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&&s.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&&s.push(new d.MinNewTokensLengthLogitsProcessor(t,e.min_new_tokens,e.eos_token_id)),null!==e.forced_bos_token_id&&s.push(new d.ForcedBOSTokenLogitsProcessor(e.forced_bos_token_id)),null!==e.forced_eos_token_id&&s.push(new d.ForcedEOSTokenLogitsProcessor(e.max_length,e.forced_eos_token_id)),null!==e.begin_suppress_tokens){let r=t>1||null===e.forced_bos_token_id?t:t+1;s.push(new d.SuppressTokensAtBeginLogitsProcessor(e.begin_suppress_tokens,r))}return null!==e.guidance_scale&&e.guidance_scale>1&&s.push(new d.ClassifierFreeGuidanceLogitsProcessor(e.guidance_scale)),null!==r&&s.extend(r),s}_prepare_generation_config(e,t,r=u.GenerationConfig){let s={...this.config};for(let e of["decoder","generator","text_config"])e in s&&Object.assign(s,s[e]);let o=new r(s);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){let r=new h.StoppingCriteriaList;return null!==e.max_length&&r.push(new h.MaxLengthCriteria(e.max_length,this.config.max_position_embeddings??null)),null!==e.eos_token_id&&r.push(new h.EosTokenCriteria(e.eos_token_id)),t&&r.extend(t),r}_validate_model_class(){if(!this.can_generate){let e=P.get(this.constructor),t=new Set,r=this.config.model_type;for(let e of[i1,i8,i0,iH]){let s=e.get(r);s&&t.add(s[0])}let s=`The current model class (${e}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw t.size>0&&(s+=` Please use the following class instead: ${[...t].join(", ")}`),Error(s)}}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:r,is_encoder_decoder:s}){return r.past_key_values=this.getPastKeyValues(t,r.past_key_values),r.input_ids=new m.Tensor("int64",e.flat(),[e.length,1]),s?"decoder_attention_mask"in r:r.attention_mask=(0,m.cat)([r.attention_mask,(0,m.ones)([r.attention_mask.dims[0],1])],1),r.position_ids=null,r}_prepare_model_inputs({inputs:e,bos_token_id:t,model_kwargs:r}){let s=(0,i.pick)(r,this.forward_params),o=this.main_input_name;if(o in s){if(e)throw Error("`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. Make sure to either pass {inputs} or {input_name}=...")}else s[o]=e;return{inputs_tensor:s[o],model_inputs:s,model_input_name:o}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:e,model_inputs:t,model_input_name:r,generation_config:s}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!t.inputs_embeds&&"_prepare_inputs_embeds"in this){let{input_ids:e,pixel_values:r,attention_mask:s,...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 L(this,t);if(null!==s.guidance_scale&&s.guidance_scale>1)o=(0,m.cat)([o,(0,m.full_like)(o,0)],0),"attention_mask"in t&&(t.attention_mask=(0,m.cat)([t.attention_mask,(0,m.zeros_like)(t.attention_mask)],0));else if(t.decoder_input_ids){let e=S(t.decoder_input_ids).dims[0];if(e!==o.dims[0]){if(1!==o.dims[0])throw Error(`The encoder outputs have a different batch size (${o.dims[0]}) than the decoder inputs (${e}).`);o=(0,m.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:r,decoder_start_token_id:s,bos_token_id:o,generation_config:n}){let{decoder_input_ids:a,...i}=r;if(!(a instanceof m.Tensor)){if(a)Array.isArray(a[0])||(a=Array.from({length:e},()=>a));else if(s??=o,"musicgen"===this.config.model_type)a=Array.from({length:e*this.config.decoder.num_codebooks},()=>[s]);else if(Array.isArray(s)){if(s.length!==e)throw Error(`\`decoder_start_token_id\` expcted to have length ${e} but got ${s.length}`);a=s}else a=Array.from({length:e},()=>[s]);a=S(a)}return r.decoder_attention_mask=(0,m.ones_like)(a),{input_ids:a,model_inputs:i}}async generate({inputs:e=null,generation_config:t=null,logits_processor:r=null,stopping_criteria:s=null,streamer:o=null,...n}){let a,i;this._validate_model_class(),t=this._prepare_generation_config(t,n);let{inputs_tensor:l,model_inputs:c,model_input_name:d}=this._prepare_model_inputs({inputs:e,model_kwargs:n}),u=this.config.is_encoder_decoder;u&&("encoder_outputs"in c||(c=await this._prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:l,model_inputs:c,model_input_name:d,generation_config:t}))),u?{input_ids:a,model_inputs:c}=this._prepare_decoder_input_ids_for_generation({batch_size:c[d].dims.at(0),model_input_name:d,model_kwargs:c,decoder_start_token_id:t.decoder_start_token_id,bos_token_id:t.bos_token_id,generation_config:t}):a=c[d];let p=a.dims.at(-1);null!==t.max_new_tokens&&(t.max_length=p+t.max_new_tokens);let _=this._get_logits_processor(t,p,r),h=this._get_stopping_criteria(t,s),f=c[d].dims.at(0),M=g.LogitsSampler.getSampler(t),w=Array(f).fill(0),x=a.tolist();o&&o.put(x);let b={};for(;;){if(c=this.prepare_inputs_for_generation(x,c,t),i=await this.forward(c),t.output_attentions&&t.return_dict_in_generate){let e=this.getAttentions(i);for(let t in e)t in b||(b[t]=[]),b[t].push(e[t])}let e=_(x,i.logits.slice(null,-1,null)),r=[];for(let t=0;t<e.dims.at(0);++t){let s=e[t];for(let[e,o]of(await M(s))){let s=BigInt(e);w[t]+=o,x[t].push(s),r.push([s]);break}}if(o&&o.put(r),h(x).every(e=>e))break;c=this._update_model_kwargs_for_generation({generated_input_ids:r,outputs:i,model_inputs:c,is_encoder_decoder:u})}o&&o.end();let T=this.getPastKeyValues(i,c.past_key_values,!0),P=new m.Tensor("int64",x.flat(),[x.length,x[0].length]);if(t.return_dict_in_generate)return{sequences:P,past_key_values:T,...b};for(let e of Object.values(i))"gpu-buffer"===e.location&&e.dispose();return P}getPastKeyValues(e,t,r=!1){let s=Object.create(null);for(let o in e)if(o.startsWith("present")){let n=o.replace("present","past_key_values"),a=o.includes("encoder");if(a&&t?s[n]=t[n]:s[n]=e[o],t&&(!a||r)){let e=t[n];"gpu-buffer"===e.location&&e.dispose()}}return s}getAttentions(e){let t={};for(let r of["cross_attentions","encoder_attentions","decoder_attentions"])for(let s in e)s.startsWith(r)&&(r in t||(t[r]=[]),t[r].push(e[s]));return t}addPastKeyValues(e,t){if(t)Object.assign(e,t);else{let t=this.sessions.decoder_model_merged??this.sessions.model,r=t?.config?.kv_cache_dtype??"float32",o="float16"===r?new m.DataTypeMap.float16:[],n=(e[this.main_input_name]??e.attention_mask)?.dims?.[0]??1,a=(0,s.getKeyValueShapes)(this.config,{batch_size:n});for(let t in a)e[t]=new m.Tensor(r,o,a[t])}}async encode_image({pixel_values:e}){let t=(await C(this.sessions.vision_encoder,{pixel_values:e})).image_features;return this.config.num_image_tokens||(console.warn(`The number of image tokens was not set in the model configuration. Setting it to the number of features detected by the vision encoder (${t.dims[1]}).`),this.config.num_image_tokens=t.dims[1]),t}async encode_text({input_ids:e}){return(await C(this.sessions.embed_tokens,{input_ids:e})).inputs_embeds}async encode_audio({audio_values:e}){return(await C(this.sessions.audio_encoder,{audio_values:e})).audio_features}}class U{}class Q extends U{constructor({last_hidden_state:e,hidden_states:t=null,attentions:r=null}){super(),this.last_hidden_state=e,this.hidden_states=t,this.attentions=r}}class X extends W{}class H extends X{}class J extends X{async _call(e){return new l0(await super._call(e))}}class Y extends X{async _call(e){return new lY(await super._call(e))}}class K extends X{async _call(e){return new lZ(await super._call(e))}}class Z extends X{async _call(e){return new l1(await super._call(e))}}class ee extends W{}class et extends ee{}class er extends ee{async _call(e){return new l0(await super._call(e))}}class es extends ee{async _call(e){return new lY(await super._call(e))}}class eo extends ee{async _call(e){return new lZ(await super._call(e))}}class en extends W{}class ea extends en{}class ei extends W{}class el extends ei{}class ec extends ei{async _call(e){return new l0(await super._call(e))}}class ed extends ei{async _call(e){return new lY(await super._call(e))}}class eu extends ei{async _call(e){return new lZ(await super._call(e))}}class em extends ei{async _call(e){return new l1(await super._call(e))}}class ep extends W{}class e_ extends ep{}class eh extends ep{async _call(e){return new l0(await super._call(e))}}class eg extends ep{async _call(e){return new lY(await super._call(e))}}class ef extends ep{async _call(e){return new lZ(await super._call(e))}}class eM extends ep{async _call(e){return new l1(await super._call(e))}}class ew extends W{}class ex extends ew{}class eb extends ew{async _call(e){return new l0(await super._call(e))}}class eT extends ew{async _call(e){return new lY(await super._call(e))}}class eP extends ew{async _call(e){return new lZ(await super._call(e))}}class ey extends ew{async _call(e){return new l1(await super._call(e))}}class ek extends W{}class eF extends ek{}class ev extends ek{async _call(e){return new l0(await super._call(e))}}class eC extends ek{async _call(e){return new lY(await super._call(e))}}class eS extends ek{async _call(e){return new lZ(await super._call(e))}}class eE extends ek{async _call(e){return new l1(await super._call(e))}}class eA extends W{}class eL extends eA{}class eI extends eA{async _call(e){return new l0(await super._call(e))}}class ez extends eA{async _call(e){return new lY(await super._call(e))}}class ej extends eA{async _call(e){return new lZ(await super._call(e))}}class eD extends eA{async _call(e){return new l1(await super._call(e))}}class eO extends W{}class eV extends eO{}class eN extends eO{async _call(e){return new l0(await super._call(e))}}class eB extends eO{async _call(e){return new lY(await super._call(e))}}class eG extends eO{async _call(e){return new lZ(await super._call(e))}}class eR extends eO{async _call(e){return new l1(await super._call(e))}}class eq extends W{}class e$ extends eq{}class eW extends eq{async _call(e){return new lY(await super._call(e))}}class eU extends eq{async _call(e){return new lZ(await super._call(e))}}class eQ extends eq{async _call(e){return new l1(await super._call(e))}}class eX extends eq{async _call(e){return new l0(await super._call(e))}}class eH extends W{}class eJ extends eH{}class eY extends eH{async _call(e){return new l0(await super._call(e))}}class eK extends eH{async _call(e){return new lY(await super._call(e))}}class eZ extends eH{async _call(e){return new lZ(await super._call(e))}}class e0 extends W{}class e1 extends e0{}class e2 extends e0{async _call(e){return new l0(await super._call(e))}}class e3 extends e0{async _call(e){return new lY(await super._call(e))}}class e4 extends e0{async _call(e){return new l1(await super._call(e))}}class e8 extends W{}class e5 extends e8{}class e6 extends e8{async _call(e){return new l0(await super._call(e))}}class e9 extends e8{async _call(e){return new lY(await super._call(e))}}class e7 extends e8{async _call(e){return new lZ(await super._call(e))}}class te extends e8{async _call(e){return new l1(await super._call(e))}}class tt extends W{}class tr extends tt{}class ts extends tt{async _call(e){return new l0(await super._call(e))}}class to extends tt{async _call(e){return new lY(await super._call(e))}}class tn extends tt{async _call(e){return new l1(await super._call(e))}}class ta extends W{}class ti extends ta{}class tl extends ta{async _call(e){return new lY(await super._call(e))}}class tc extends ta{async _call(e){return new l1(await super._call(e))}}class td extends ta{async _call(e){return new l0(await super._call(e))}}class tu extends W{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"]}class tm extends tu{}class tp extends tu{}class t_ extends W{}class th extends t_{}class tg extends t_{}class tf extends W{}class tM extends tf{}class tw extends tf{}class tx extends W{}class tb extends tx{}class tT extends tx{}class tP extends tx{async _call(e){return new lY(await super._call(e))}}class ty extends W{}class tk extends ty{}class tF extends ty{}class tv extends ty{async _call(e){return new lY(await super._call(e))}}class tC extends ty{}class tS extends W{}class tE extends tS{}class tA extends tS{}class tL extends W{}class tI extends tL{}class tz extends tL{}class tj extends W{}class tD extends tj{}class tO extends tj{async _call(e){return new l0(await super._call(e))}}class tV extends tj{async _call(e){return new lY(await super._call(e))}}class tN extends tj{async _call(e){return new lZ(await super._call(e))}}class tB extends tj{async _call(e){return new l1(await super._call(e))}}class tG extends W{}class tR extends tG{}class tq extends tG{async _call(e){return new l0(await super._call(e))}}class t$ extends tG{async _call(e){return new lY(await super._call(e))}}class tW extends tG{async _call(e){return new lZ(await super._call(e))}}class tU extends tG{async _call(e){return new l1(await super._call(e))}}class tQ extends W{}class tX extends tQ{}class tH extends tQ{async _call(e){return new l0(await super._call(e))}}class tJ extends tQ{async _call(e){return new lY(await super._call(e))}}class tY extends tQ{async _call(e){return new lZ(await super._call(e))}}class tK extends tQ{async _call(e){return new l1(await super._call(e))}}class tZ extends W{}class t0 extends tZ{}class t1 extends tZ{}class t2 extends W{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 t3 extends t2{}class t4 extends t2{_prepare_generation_config(e,t){return super._prepare_generation_config(e,t,M.WhisperGenerationConfig)}_retrieve_init_tokens(e){let t=[e.decoder_start_token_id],r=e.language,s=e.task;if(e.is_multilingual){r||(console.warn("No language specified - defaulting to English (en)."),r="en");let o=(0,w.whisper_language_to_code)(r),n=`<|${o}|>`;t.push(e.lang_to_id[n]),t.push(e.task_to_id[s??"transcribe"])}else if(r||s)throw 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:r=null,stopping_criteria:s=null,...o}){t=this._prepare_generation_config(t,o);let n=o.decoder_input_ids??this._retrieve_init_tokens(t);if(t.return_timestamps&&(r??=new d.LogitsProcessorList).push(new d.WhisperTimeStampLogitsProcessor(t,n)),t.begin_suppress_tokens&&(r??=new d.LogitsProcessorList).push(new d.SuppressTokensAtBeginLogitsProcessor(t.begin_suppress_tokens,n.length)),t.return_token_timestamps){if(!t.alignment_heads)throw 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}let a=await super.generate({inputs:e,generation_config:t,logits_processor:r,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,r=null,s=.02){if(!e.cross_attentions)throw 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==r&&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);let n=e.cross_attentions,a=Array.from({length:this.config.decoder_layers},(e,t)=>(0,m.cat)(n.map(e=>e[t]),2)),l=(0,m.stack)(t.map(([e,t])=>{if(e>=a.length)throw Error(`Layer index ${e} is out of bounds for cross attentions (length ${a.length}).`);return r?a[e].slice(null,t,null,[0,r]):a[e].slice(null,t)})).transpose(1,0,2,3),[c,d]=(0,m.std_mean)(l,-2,0,!0),u=l.clone();for(let e=0;e<u.dims[0];++e){let t=u[e];for(let r=0;r<t.dims[0];++r){let s=t[r],n=c[e][r][0].data,a=d[e][r][0].data;for(let e=0;e<s.dims[0];++e){let t=s[e].data;for(let e=0;e<t.length;++e)t[e]=(t[e]-a[e])/n[e];t.set((0,_.medianFilter)(t,o))}}}let p=[(0,m.mean)(u,1)],h=e.sequences.dims,g=new m.Tensor("float32",new Float32Array(h[0]*h[1]),h);for(let e=0;e<h[0];++e){let t=p[e].neg().squeeze_(0),[r,o]=(0,_.dynamic_time_warping)(t.tolist()),n=Array.from({length:r.length-1},(e,t)=>r[t+1]-r[t]),a=(0,i.mergeArrays)([1],n).map(e=>!!e),l=[];for(let e=0;e<a.length;++e)a[e]&&l.push(o[e]*s);g[e].data.set(l,1)}return g}}class t8 extends t4{}class t5 extends W{requires_attention_mask=!1;main_input_name="input_values";forward_params=["input_values","decoder_input_ids","past_key_values"]}class t6 extends t5{}class t9 extends t5{}class t7 extends W{main_input_name="pixel_values";forward_params=["pixel_values","decoder_input_ids","encoder_hidden_states","past_key_values"]}class re extends W{forward_params=["input_ids","attention_mask","pixel_values","position_ids","past_key_values"]}class rt extends re{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:r,attention_mask:s}){let o=this.config.image_token_index,n=r.tolist().map(e=>e.findIndex(e=>e==o)),a=n.every(e=>-1===e),i=n.every(e=>-1!==e);if(!a&&!i)throw Error("Every input should contain either 0 or 1 image token.");if(a)return{inputs_embeds:e,attention_mask:s};let l=[],c=[];for(let r=0;r<n.length;++r){let o=n[r],a=e[r],i=t[r],d=s[r];l.push((0,m.cat)([a.slice([0,o]),i,a.slice([o+1,a.dims[0]])],0)),c.push((0,m.cat)([d.slice([0,o]),(0,m.ones)([i.dims[0]]),d.slice([o+1,d.dims[0]])],0))}return{inputs_embeds:(0,m.stack)(l,0),attention_mask:(0,m.stack)(c,0)}}}class rr extends rt{}class rs extends rt{}class ro extends W{forward_params=["input_ids","inputs_embeds","attention_mask","pixel_values","encoder_outputs","decoder_input_ids","decoder_inputs_embeds","decoder_attention_mask","past_key_values"];main_input_name="inputs_embeds"}class rn extends ro{_merge_input_ids_with_image_features({inputs_embeds:e,image_features:t,input_ids:r,attention_mask:s}){return{inputs_embeds:(0,m.cat)([t,e],1),attention_mask:(0,m.cat)([(0,m.ones)(t.dims.slice(0,2)),s],1)}}async _prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:r,attention_mask:s}){let o,n;if(!e&&!t)throw Error("Either `input_ids` or `pixel_values` should be provided.");return e&&(o=await this.encode_text({input_ids:e})),t&&(n=await this.encode_image({pixel_values:t})),o&&n?{inputs_embeds:r,attention_mask:s}=this._merge_input_ids_with_image_features({inputs_embeds:o,image_features:n,input_ids:e,attention_mask:s}):r=o||n,{inputs_embeds:r,attention_mask:s}}async forward({input_ids:e,pixel_values:t,attention_mask:r,decoder_input_ids:s,decoder_attention_mask:o,encoder_outputs:n,past_key_values:a,inputs_embeds:i,decoder_inputs_embeds:l}){if(i||({inputs_embeds:i,attention_mask:r}=await this._prepare_inputs_embeds({input_ids:e,pixel_values:t,inputs_embeds:i,attention_mask:r})),!n){let{last_hidden_state:e}=await L(this,{inputs_embeds:i,attention_mask:r});n=e}if(!l){if(!s)throw Error("Either `decoder_input_ids` or `decoder_inputs_embeds` should be provided.");l=await this.encode_text({input_ids:s})}let c={inputs_embeds:l,attention_mask:o,encoder_attention_mask:r,encoder_hidden_states:n,past_key_values:a};return await z(this,c,!0)}}class ra extends W{forward_params=["input_ids","attention_mask","pixel_values","position_ids","past_key_values"]}class ri extends ra{_merge_input_ids_with_image_features(e){let t=e.image_features.dims.at(-1),r=e.image_features.view(-1,t);return D({image_token_id:this.config.image_token_index,...e,image_features:r})}}class rl extends W{forward_params=["input_ids","attention_mask","pixel_values","pixel_attention_mask","position_ids","past_key_values"]}class rc extends rl{async encode_image({pixel_values:e,pixel_attention_mask:t}){return(await C(this.sessions.vision_encoder,{pixel_values:e,pixel_attention_mask:t})).image_features}_merge_input_ids_with_image_features(e){let t=e.image_features.dims.at(-1),r=e.image_features.view(-1,t);return D({image_token_id:this.config.image_token_id,...e,image_features:r})}}class rd extends rc{}class ru extends W{forward_params=["input_ids","inputs_embeds","attention_mask","position_ids","pixel_values","image_sizes","past_key_values"]}class rm extends ru{async forward({input_ids:e=null,attention_mask:t=null,pixel_values:r=null,image_sizes:s=null,position_ids:o=null,inputs_embeds:n=null,past_key_values:a=null,generation_config:i=null,logits_processor:l=null,...c}){if(!n){let t;if(r&&1!==e.dims[1]){if(!s)throw Error("`image_sizes` must be provided when `pixel_values` is provided.");({image_features:t}=await C(this.sessions.vision_encoder,{pixel_values:r,image_sizes:s}))}else{let e=this.config.normalized_config.hidden_size;t=new m.Tensor("float32",[],[0,e])}({inputs_embeds:n}=await C(this.sessions.prepare_inputs_embeds,{input_ids:e,image_features:t}))}return await z(this,{inputs_embeds:n,past_key_values:a,attention_mask:t,position_ids:o,generation_config:i,logits_processor:l},!1)}}class rp extends W{}class r_ extends rp{}class rh extends rp{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class rg extends rp{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class rf extends rp{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class rM extends rp{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class rw extends W{}class rx extends rw{}class rb extends rw{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class rT extends rp{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class rP extends W{}class ry extends rP{}class rk extends W{}class rF extends rk{async forward(e){let t=!e.input_ids,r=!e.pixel_values;if(t&&r)throw Error("Either `input_ids` or `pixel_values` should be provided.");if(t&&(e.input_ids=(0,m.ones)([e.pixel_values.dims[0],1])),r){let{image_size:t}=this.config.vision_config;e.pixel_values=(0,m.full)([0,3,t,t],0)}let{text_embeddings:s,image_embeddings:o,l2norm_text_embeddings:n,l2norm_image_embeddings:a}=await super.forward(e),i={};return t||(i.text_embeddings=s,i.l2norm_text_embeddings=n),r||(i.image_embeddings=o,i.l2norm_image_embeddings=a),i}}class rv extends rk{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class rC extends rk{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"vision_model"})}}class rS extends W{}class rE extends rS{}class rA extends rS{}class rL extends W{}class rI extends rL{}class rz extends rL{}class rj extends W{}class rD extends rj{}class rO extends rj{}class rV extends W{}class rN extends rV{}class rB extends rV{}class rG extends W{}class rR extends rG{}class rq extends rG{}class r$ extends W{}class rW extends r${}class rU extends r${}class rQ extends W{}class rX extends rQ{}class rH extends rQ{}class rJ extends W{}class rY extends rJ{}class rK extends rJ{}class rZ extends W{}class r0 extends rZ{}class r1 extends rZ{}class r2 extends W{}class r3 extends r2{}class r4 extends r2{}class r8 extends W{}class r5 extends r8{}class r6 extends r8{}class r9 extends W{}class r7 extends r9{}class se extends r9{}class st extends W{}class sr extends st{}class ss extends st{}class so extends W{}class sn extends so{}class sa extends so{}class si extends W{}class sl extends si{}class sc extends si{}class sd extends W{}class su extends sd{}class sm extends sd{}class sp extends W{}class s_ extends sp{}class sh extends sp{}class sg extends W{}class sf extends sg{}class sM extends sg{}class sw extends W{}class sx extends sw{}class sb extends sw{}class sT extends W{}class sP extends sT{}class sy extends sT{}class sk extends W{}class sF extends sk{}class sv extends sk{}class sC extends W{}class sS extends sC{}class sE extends sC{}class sA extends W{}class sL extends sA{}class sI extends sA{}class sz extends W{forward_params=["input_ids","attention_mask","position_ids","past_key_values","pixel_values","image_grid_thw"]}class sj extends sz{get_rope_index(e,t,r,s){let{vision_config:o,image_token_id:n,video_token_id:a,vision_start_token_id:i}=this.config,l=o.spatial_merge_size??2,c=[];if(t||r){let o=e.tolist();s||(s=(0,m.ones_like)(e));let d=s.tolist(),u=Array.from({length:3},t=>Array.from({length:e.dims[0]},t=>Array.from({length:e.dims[1]},e=>1))),p=t?t.tolist():[],h=r?r.tolist():[],g=0,f=0;for(let e=0;e<o.length;++e){let t=o[e].filter((t,r)=>1==d[e][r]),r=t.reduce((e,t,r)=>(t==i&&e.push(r),e),[]).map(e=>t[e+1]),s=r.filter(e=>e==n).length,m=r.filter(e=>e==a).length,M=[],w=0,x=s,b=m;for(let e=0;e<r.length;++e){let e,r,s,o,i=t.findIndex((e,t)=>t>w&&e==n),c=t.findIndex((e,t)=>t>w&&e==a),d=x>0&&-1!==i?i:t.length+1,u=b>0&&-1!==c?c:t.length+1;d<u?([r,s,o]=p[g],++g,--x,e=d):([r,s,o]=h[f],++f,--b,e=u);let[m,T,P]=[Number(r),Math.floor(Number(s)/l),Math.floor(Number(o)/l)],y=e-w,k=M.length>0?(0,_.max)(M.at(-1))[0]+1:0;M.push(Array.from({length:3*y},(e,t)=>k+t%y));let F=y+k,v=m*T*P,C=Array.from({length:v},(e,t)=>F+Math.floor(t/(T*P))),S=Array.from({length:v},(e,t)=>F+Math.floor(t/P)%T),E=Array.from({length:v},(e,t)=>F+t%P);M.push([C,S,E].flat()),w=e+v}if(w<t.length){let e=M.length>0?(0,_.max)(M.at(-1))[0]+1:0,r=t.length-w;M.push(Array.from({length:3*r},(t,s)=>e+s%r))}let T=M.reduce((e,t)=>e+t.length,0),P=Array(T),y=0;for(let e=0;e<3;++e)for(let t=0;t<M.length;++t){let r=M[t],s=r.length/3;for(let t=e*s;t<(e+1)*s;++t)P[y++]=r[t]}let k=0,F=d[e];for(let t=0;t<F.length;++t)if(1==F[t]){for(let r=0;r<3;++r)u[r][e][t]=P[r*T/3+k];++k}let v=(0,_.max)(P)[0];c.push(v+1-o[e].length)}return[new m.Tensor("int64",u.flat(1/0),[3,e.dims[0],e.dims[1]]),new m.Tensor("int64",c,[c.length,1])]}if(s){let{data:e,dims:t}=B(s),r=BigInt64Array.from({length:3*e.length},(t,r)=>e[r%e.length]),o=Array.from({length:t[0]},(r,s)=>(0,_.max)(e.subarray(t[1]*s,t[1]*(s+1)))[0]+1n+BigInt(t[1]));return[new m.Tensor("int64",r,[3,...t]),new m.Tensor("int64",o,[o.length,1])]}{let[t,r]=e.dims,s=BigInt64Array.from({length:3*t*r},(e,s)=>BigInt(Math.floor(s%r/t)));return[new m.Tensor("int64",s,[3,...e.dims]),(0,m.zeros)([t,1])]}}async encode_image({pixel_values:e,image_grid_thw:t}){return(await C(this.sessions.vision_encoder,{pixel_values:e,grid_thw:t})).image_features}_merge_input_ids_with_image_features(e){return D({image_token_id:this.config.image_token_id,...e})}prepare_inputs_for_generation(e,t,r){if(t.attention_mask&&!t.position_ids)if(t.past_key_values){t.pixel_values=null;let e=BigInt(Object.values(t.past_key_values)[0].dims.at(-2)),r=t.rope_deltas.map(t=>e+t);t.position_ids=(0,m.stack)([r,r,r],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 sD extends W{}class sO extends sD{}class sV extends sD{}class sN extends W{}class sB extends sN{}class sG extends sN{}class sR extends W{}class sq extends sR{}class s$ extends sR{}class sW extends W{}class sU extends sW{}class sQ extends sW{}class sX extends W{}class sH extends sX{}class sJ extends sX{}class sY extends W{}class sK extends sY{}class sZ extends sY{async _call(e){return new lY(await super._call(e))}}class s0 extends W{}class s1 extends s0{}class s2 extends s0{async _call(e){return new lY(await super._call(e))}}class s3 extends W{}class s4 extends s3{}class s8 extends W{}class s5 extends s8{}class s6 extends s8{async _call(e){return new lY(await super._call(e))}}class s9 extends W{}class s7 extends s9{}class oe extends W{}class ot extends oe{}class or extends oe{async _call(e){return new lY(await super._call(e))}}class os extends W{}class oo extends os{}class on extends W{}class oa extends on{}class oi extends on{async _call(e){return new lY(await super._call(e))}}class ol extends W{}class oc extends ol{async _call(e){return new l4(await super._call(e))}}class od extends W{}class ou extends od{}class om extends od{async _call(e){return new lY(await super._call(e))}}class op extends W{}class o_ extends op{}class oh extends op{async _call(e){return new lY(await super._call(e))}}class og extends W{}class of extends og{}class oM extends og{}class ow extends W{}class ox extends ow{}class ob extends ow{}class oT extends W{}class oP extends oT{}class oy extends oT{async _call(e){return new lY(await super._call(e))}}class ok extends W{}class oF extends ok{}class ov extends ok{async _call(e){return new oS(await super._call(e))}}class oC extends ok{async _call(e){return new oE(await super._call(e))}}class oS extends U{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class oE extends U{constructor({logits:e,pred_boxes:t,pred_masks:r}){super(),this.logits=e,this.pred_boxes=t,this.pred_masks=r}}class oA extends W{}class oL extends oA{}class oI extends oA{async _call(e){return new oz(await super._call(e))}}class oz extends U{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class oj extends W{}class oD extends oj{}class oO extends oj{async _call(e){return new oV(await super._call(e))}}class oV extends oz{}class oN extends W{}class oB extends oN{}class oG extends oN{async _call(e){return new oR(await super._call(e))}}class oR extends oz{}class oq extends W{}class o$ extends oq{}class oW extends oq{async _call(e){return new oz(await super._call(e))}}class oU extends W{}class oQ extends oU{}class oX extends oU{async _call(e){return new oH(await super._call(e))}}class oH extends oS{}class oJ extends W{}class oY extends oJ{}class oK extends oJ{async _call(e){return new lY(await super._call(e))}}class oZ extends W{}class o0 extends oZ{}class o1 extends oZ{async _call(e){return new lY(await super._call(e))}}class o2 extends W{}class o3 extends o2{}class o4 extends o2{async _call(e){return new lY(await super._call(e))}}class o8 extends W{}class o5 extends o8{}class o6 extends o8{async _call(e){return new lY(await super._call(e))}}class o9 extends o8{}class o7 extends W{}class ne extends o7{}class nt extends o7{}class nr extends W{}class ns extends nr{}class no extends nr{}class nn extends W{}class na extends nn{}class ni extends W{}class nl extends ni{}class nc extends ni{}class nd extends ni{}class nu extends W{}class nm extends nu{}class np extends W{}class n_ extends np{}class nh extends W{}class ng extends nh{}class nf extends W{}class nM extends nf{}class nw extends nf{}class nx extends W{}class nb extends nx{}class nT extends nx{}class nP extends W{}class ny extends nP{}class nk extends W{}class nF extends nk{}class nv extends nk{async _call(e){return new lY(await super._call(e))}}class nC extends W{}class nS extends nC{}class nE extends nC{async _call(e){return new lY(await super._call(e))}}class nA extends W{}class nL extends nA{}class nI extends nA{async _call(e){return new lY(await super._call(e))}}class nz extends W{}class nj extends nz{}class nD extends nz{async _call(e){return new lY(await super._call(e))}}class nO extends W{}class nV extends nO{}class nN extends W{}class nB extends nN{}class nG extends nN{async _call(e){return new nR(await super._call(e))}}class nR extends U{constructor({logits:e,pred_boxes:t}){super(),this.logits=e,this.pred_boxes=t}}class nq extends W{}class n$ extends nq{async get_image_embeddings({pixel_values:e}){return await L(this,{pixel_values:e})}async forward(e){if(e.image_embeddings&&e.image_positional_embeddings||(e={...e,...await this.get_image_embeddings(e)}),!e.input_labels&&e.input_points){let t=e.input_points.dims.slice(0,-1),r=t.reduce((e,t)=>e*t,1);e.input_labels=new m.Tensor("int64",new BigInt64Array(r).fill(1n),t)}let 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 C(this.sessions.prompt_encoder_mask_decoder,t)}async _call(e){return new nW(await super._call(e))}}class nW extends U{constructor({iou_scores:e,pred_masks:t}){super(),this.iou_scores=e,this.pred_masks=t}}class nU extends W{}class nQ extends nU{}class nX extends nU{}class nH extends W{}class nJ extends nH{}class nY extends nH{}class nK extends W{}class nZ extends nK{}class n0 extends nK{async _call(e){return new l2(await super._call(e))}}class n1 extends nK{async _call(e){return new lY(await super._call(e))}}class n2 extends nK{async _call(e){return new lZ(await super._call(e))}}class n3 extends W{}class n4 extends n3{}class n8 extends n3{async _call(e){return new lZ(await super._call(e))}}class n5 extends W{}class n6 extends n5{}class n9 extends W{}class n7 extends n9{}class ae extends n9{async _call(e){return new l2(await super._call(e))}}class at extends n9{async _call(e){return new lY(await super._call(e))}}class ar extends W{}class as extends ar{}class ao extends ar{async _call(e){return new l2(await super._call(e))}}class an extends ar{async _call(e){return new lY(await super._call(e))}}class aa extends ar{async _call(e){return new lZ(await super._call(e))}}class ai extends W{}class al extends ai{}class ac extends ai{async _call(e){return new l2(await super._call(e))}}class ad extends ai{async _call(e){return new lY(await super._call(e))}}class au extends W{}class am extends nK{}class ap extends nK{async _call(e){return new l2(await super._call(e))}}class a_ extends nK{async _call(e){return new lY(await super._call(e))}}class ah extends W{}class ag extends ah{}class af extends ah{async _call(e){return new l2(await super._call(e))}}class aM extends ah{async _call(e){return new lY(await super._call(e))}}class aw extends ah{async _call(e){return new lK(await super._call(e))}}class ax extends ah{async _call(e){return new lZ(await super._call(e))}}class ab extends W{}class aT extends ab{}class aP extends W{}class ay extends aP{}class ak extends aP{}class aF extends aP{async generate_speech(e,t,{threshold:r=.5,minlenratio:s=0,maxlenratio:o=20,vocoder:n=null}={}){let{encoder_outputs:a,encoder_attention_mask:i}=await L(this,{input_ids:e}),l=a.dims[1]/this.config.reduction_factor,c=Math.floor(l*o),d=Math.floor(l*s),u=this.config.num_mel_bins,p=[],_=null,h=null,g=0;for(;;){let e;++g;let s={use_cache_branch:E(!!h),output_sequence:h?h.output_sequence_out:new m.Tensor("float32",new Float32Array(u),[1,1,u]),encoder_attention_mask:i,speaker_embeddings:t,encoder_hidden_states:a};this.addPastKeyValues(s,_),h=await C(this.sessions.decoder_model_merged,s),_=this.getPastKeyValues(h,_);let{prob:o,spectrum:n}=h;if(p.push(n),g>=d&&(Array.from(o.data).filter(e=>e>=r).length>0||g>=c))break}let f=(0,m.cat)(p),{waveform:M}=await C(n.sessions.model,{spectrogram:f});return{spectrogram:f,waveform:M}}}class av extends W{main_input_name="spectrogram"}class aC extends W{}class aS extends aC{}class aE extends W{}class aA extends aE{}class aL extends aE{}class aI extends W{}class az extends aI{}class aj extends aI{}class aD extends W{}class aO extends aD{}class aV extends aD{}class aN extends W{}class aB extends aN{}class aG extends aN{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"text_model"})}}class aR extends aN{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"audio_model"})}}class aq extends W{}class a$ extends aq{async _call(e){return new l8(await super._call(e))}}class aW extends W{}class aU extends aW{}class aQ extends aW{}class aX extends aW{}class aH extends W{}class aJ extends aH{}class aY extends aH{}class aK extends W{}class aZ extends aK{}class a0 extends aK{async _call(e){return new lY(await super._call(e))}}class a1 extends W{}class a2 extends a1{}class a3 extends a1{}class a4 extends W{forward_params=["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"];_apply_and_filter_by_delay_pattern_mask(e){let[t,r]=e.dims,s=this.config.decoder.num_codebooks,o=r-s,n=0;for(let t=0;t<e.size;++t){if(e.data[t]===this.config.decoder.pad_token_id)continue;let a=t%r-Math.floor(t/r)%s;a>0&&a<=o&&(e.data[n++]=e.data[t])}let a=Math.floor(t/s),i=n/(a*s);return new m.Tensor(e.type,e.data.slice(0,n),[a,s,i])}prepare_inputs_for_generation(e,t,r){let s=structuredClone(e);for(let e=0;e<s.length;++e)for(let t=0;t<s[e].length;++t)e%this.config.decoder.num_codebooks>=t&&(s[e][t]=BigInt(this.config.decoder.pad_token_id));return null!==r.guidance_scale&&r.guidance_scale>1&&(s=s.concat(s)),super.prepare_inputs_for_generation(s,t,r)}async generate(e){let t=await super.generate(e),r=this._apply_and_filter_by_delay_pattern_mask(t).unsqueeze_(0),{audio_values:s}=await C(this.sessions.encodec_decode,{audio_codes:r});return s}}class a8 extends W{}class a5 extends a8{}class a6 extends a8{async _call(e){return new lY(await super._call(e))}}class a9 extends a8{}class a7 extends W{}class ie extends a7{}class it extends a7{async _call(e){return new lY(await super._call(e))}}class ir extends a7{}class is extends W{}class io extends is{}class ia extends is{async _call(e){return new lY(await super._call(e))}}class ii extends is{}class il extends W{}class ic extends il{}class id extends il{async _call(e){return new lY(await super._call(e))}}class iu extends il{}class im extends W{}class ip extends im{}class i_ extends W{}class ih extends i_{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){let t,r=this._generation_mode??"text";if("text"!==r&&e.past_key_values){let r=this.sessions.gen_img_embeds,s=(0,i.pick)({image_ids:e.input_ids},r.inputNames);t=await C(r,s)}else{let r=this.sessions.prepare_inputs_embeds,s=(0,i.pick)(e,r.inputNames);t=await C(r,s)}let s={...e,...t},o=await z(this,s),n=this.sessions["text"===r?"lm_head":"gen_head"];if(!n)throw Error(`Unable to find "${n}" generation head`);let a=await C(n,(0,i.pick)(o,n.inputNames));return{...t,...o,...a}}async generate(e){return this._generation_mode="text",super.generate(e)}async generate_images(e){this._generation_mode="image";let t=(e.inputs??e[this.main_input_name]).dims[1],r=(await super.generate(e)).slice(null,[t,null]),s=this.sessions.image_decode,{decoded_image:o}=await C(s,{generated_tokens:r}),n=o.add_(1).mul_(127.5).clamp_(0,255).to("uint8"),a=[];for(let e of n){let t=p.RawImage.fromTensor(e);a.push(t)}return a}}class ig extends U{constructor({char_logits:e,bpe_logits:t,wp_logits:r}){super(),this.char_logits=e,this.bpe_logits=t,this.wp_logits=r}get logits(){return[this.char_logits,this.bpe_logits,this.wp_logits]}}class iM extends W{}class iw extends iM{async _call(e){return new ig(await super._call(e))}}class ix extends W{}class ib extends ix{}class iT extends ix{}class iP extends W{}class iy extends iP{}class ik extends iP{}class iF extends W{forward_params=["input_ids","attention_mask","position_ids","audio_values","past_key_values"]}class iv extends iF{_merge_input_ids_with_audio_features(e){let t=e.audio_features.dims.at(-1),r=e.audio_features.view(-1,t);return function({audio_token_id:e,inputs_embeds:t,audio_features:r,input_ids:s,attention_mask:o}){return j({modality_token_id:e,inputs_embeds:t,modality_features:r,input_ids:s,attention_mask:o})}({audio_token_id:this.config.ignore_index,...e,audio_features:r})}}class iC extends W{main_input_name="input_values";forward_params=["input_values"]}class iS extends U{constructor({audio_codes:e}){super(),this.audio_codes=e}}class iE extends U{constructor({audio_values:e}){super(),this.audio_values=e}}class iA extends iC{async encode(e){return new iS(await C(this.sessions.encoder_model,e))}async decode(e){return new iE(await C(this.sessions.decoder_model,e))}}class iL extends iC{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class iI extends iC{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class iz extends W{main_input_name="input_values";forward_params=["input_values"]}class ij extends U{constructor({audio_codes:e}){super(),this.audio_codes=e}}class iD extends U{constructor({audio_values:e}){super(),this.audio_values=e}}class iO extends iz{async encode(e){return new ij(await C(this.sessions.encoder_model,e))}async decode(e){return new iD(await C(this.sessions.decoder_model,e))}}class iV extends iz{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class iN extends iz{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class iB extends W{main_input_name="input_values";forward_params=["input_values"]}class iG extends iB{async encode(e){return await C(this.sessions.encoder_model,e)}async decode(e){return await C(this.sessions.decoder_model,e)}}class iR extends iB{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"encoder_model"})}}class iq extends iB{static async from_pretrained(e,t={}){return super.from_pretrained(e,{...t,model_file_name:t.model_file_name??"decoder_model"})}}class i${static MODEL_CLASS_MAPPINGS=null;static BASE_IF_FAIL=!1;static async from_pretrained(e,{progress_callback:t=null,config:r=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:m={}}={}){let p={progress_callback:t,config:r,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:m};if(p.config=await s.AutoConfig.from_pretrained(e,p),!this.MODEL_CLASS_MAPPINGS)throw Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);let _=p.config.model_type;for(let t of this.MODEL_CLASS_MAPPINGS){let r=t.get(_);if(!r){for(let e of t.values())if(e[0]===_){r=e;break}if(!r)continue}return await r[1].from_pretrained(e,p)}if(this.BASE_IF_FAIL)return lM.has(_)||console.warn(`Unknown model class "${_}", attempting to construct from base class.`),await W.from_pretrained(e,p);throw Error(`Unsupported model type: ${_}`)}}let iW=new Map([["bert",["BertModel",H]],["modernbert",["ModernBertModel",et]],["nomic_bert",["NomicBertModel",ea]],["roformer",["RoFormerModel",el]],["electra",["ElectraModel",ex]],["esm",["EsmModel",eJ]],["convbert",["ConvBertModel",e_]],["camembert",["CamembertModel",eF]],["deberta",["DebertaModel",eL]],["deberta-v2",["DebertaV2Model",eV]],["mpnet",["MPNetModel",e5]],["albert",["AlbertModel",ti]],["distilbert",["DistilBertModel",e$]],["roberta",["RobertaModel",tD]],["xlm",["XLMModel",tR]],["xlm-roberta",["XLMRobertaModel",tX]],["clap",["ClapModel",aB]],["clip",["CLIPModel",r_]],["clipseg",["CLIPSegModel",rE]],["chinese_clip",["ChineseCLIPModel",ry]],["siglip",["SiglipModel",rx]],["jina_clip",["JinaCLIPModel",rF]],["mobilebert",["MobileBertModel",e1]],["squeezebert",["SqueezeBertModel",tr]],["wav2vec2",["Wav2Vec2Model",nZ]],["wav2vec2-bert",["Wav2Vec2BertModel",al]],["unispeech",["UniSpeechModel",n7]],["unispeech-sat",["UniSpeechSatModel",as]],["hubert",["HubertModel",am]],["wavlm",["WavLMModel",ag]],["audio-spectrogram-transformer",["ASTModel",t0]],["vits",["VitsModel",a$]],["pyannote",["PyAnnoteModel",n4]],["wespeaker-resnet",["WeSpeakerResNetModel",n6]],["detr",["DetrModel",oF]],["rt_detr",["RTDetrModel",oL]],["rt_detr_v2",["RTDetrV2Model",oD]],["rf_detr",["RFDetrModel",oB]],["d_fine",["DFineModel",o$]],["table-transformer",["TableTransformerModel",oQ]],["vit",["ViTModel",sK]],["ijepa",["IJepaModel",s1]],["pvt",["PvtModel",s5]],["vit_msn",["ViTMSNModel",ot]],["vit_mae",["ViTMAEModel",s7]],["groupvit",["GroupViTModel",oo]],["fastvit",["FastViTModel",oa]],["mobilevit",["MobileViTModel",ou]],["mobilevitv2",["MobileViTV2Model",o_]],["owlvit",["OwlViTModel",of]],["owlv2",["Owlv2Model",ox]],["beit",["BeitModel",oP]],["deit",["DeiTModel",oY]],["hiera",["HieraModel",o0]],["convnext",["ConvNextModel",nF]],["convnextv2",["ConvNextV2Model",nS]],["dinov2",["Dinov2Model",nL]],["dinov2_with_registers",["Dinov2WithRegistersModel",nj]],["resnet",["ResNetModel",o3]],["swin",["SwinModel",o5]],["swin2sr",["Swin2SRModel",ne]],["donut-swin",["DonutSwinModel",ny]],["yolos",["YolosModel",nB]],["dpt",["DPTModel",ns]],["glpn",["GLPNModel",nb]],["hifigan",["SpeechT5HifiGan",av]],["efficientnet",["EfficientNetModel",aZ]],["decision_transformer",["DecisionTransformerModel",ip]],["patchtst",["PatchTSTForPrediction",ib]],["patchtsmixer",["PatchTSMixerForPrediction",iy]],["mobilenet_v1",["MobileNetV1Model",a5]],["mobilenet_v2",["MobileNetV2Model",ie]],["mobilenet_v3",["MobileNetV3Model",io]],["mobilenet_v4",["MobileNetV4Model",ic]],["maskformer",["MaskFormerModel",nM]],["mgp-str",["MgpstrForSceneTextRecognition",iw]],["style_text_to_speech_2",["StyleTextToSpeech2Model",aT]]]),iU=new Map([["t5",["T5Model",tm]],["longt5",["LongT5Model",th]],["mt5",["MT5Model",tM]],["bart",["BartModel",tb]],["mbart",["MBartModel",tk]],["marian",["MarianModel",nQ]],["whisper",["WhisperModel",t3]],["m2m_100",["M2M100Model",nJ]],["blenderbot",["BlenderbotModel",tE]],["blenderbot-small",["BlenderbotSmallModel",tI]]]),iQ=new Map([["mimi",["MimiModel",iA]],["dac",["DacModel",iO]],["snac",["SnacModel",iG]]]),iX=new Map([["bloom",["BloomModel",sq]],["jais",["JAISModel",rD]],["gpt2",["GPT2Model",rI]],["gptj",["GPTJModel",rW]],["gpt_bigcode",["GPTBigCodeModel",rX]],["gpt_neo",["GPTNeoModel",rN]],["gpt_neox",["GPTNeoXModel",rR]],["codegen",["CodeGenModel",rY]],["llama",["LlamaModel",r0]],["exaone",["ExaoneModel",r7]],["olmo",["OlmoModel",sn]],["olmo2",["Olmo2Model",sl]],["mobilellm",["MobileLLMModel",sr]],["granite",["GraniteModel",su]],["cohere",["CohereModel",s_]],["gemma",["GemmaModel",sf]],["gemma2",["Gemma2Model",sx]],["gemma3_text",["Gemma3Model",sP]],["helium",["HeliumModel",r3]],["glm",["GlmModel",r5]],["openelm",["OpenELMModel",sF]],["qwen2",["Qwen2Model",sS]],["qwen3",["Qwen3Model",sL]],["phi",["PhiModel",sO]],["phi3",["Phi3Model",sB]],["mpt",["MptModel",sU]],["opt",["OPTModel",sH]],["mistral",["MistralModel",aA]],["starcoder2",["Starcoder2Model",az]],["falcon",["FalconModel",aO]],["stablelm",["StableLmModel",aJ]]]),iH=new Map([["speecht5",["SpeechT5ForSpeechToText",ak]],["whisper",["WhisperForConditionalGeneration",t4]],["lite-whisper",["LiteWhisperForConditionalGeneration",t8]],["moonshine",["MoonshineForConditionalGeneration",t9]]]),iJ=new Map([["speecht5",["SpeechT5ForTextToSpeech",aF]]]),iY=new Map([["vits",["VitsModel",a$]],["musicgen",["MusicgenForConditionalGeneration",a4]]]),iK=new Map([["bert",["BertForSequenceClassification",Y]],["modernbert",["ModernBertForSequenceClassification",es]],["roformer",["RoFormerForSequenceClassification",ed]],["electra",["ElectraForSequenceClassification",eT]],["esm",["EsmForSequenceClassification",eK]],["convbert",["ConvBertForSequenceClassification",eg]],["camembert",["CamembertForSequenceClassification",eC]],["deberta",["DebertaForSequenceClassification",ez]],["deberta-v2",["DebertaV2ForSequenceClassification",eB]],["mpnet",["MPNetForSequenceClassification",e9]],["albert",["AlbertForSequenceClassification",tl]],["distilbert",["DistilBertForSequenceClassification",eW]],["roberta",["RobertaForSequenceClassification",tV]],["xlm",["XLMForSequenceClassification",t$]],["xlm-roberta",["XLMRobertaForSequenceClassification",tJ]],["bart",["BartForSequenceClassification",tP]],["mbart",["MBartForSequenceClassification",tv]],["mobilebert",["MobileBertForSequenceClassification",e3]],["squeezebert",["SqueezeBertForSequenceClassification",to]]]),iZ=new Map([["bert",["BertForTokenClassification",K]],["modernbert",["ModernBertForTokenClassification",eo]],["roformer",["RoFormerForTokenClassification",eu]],["electra",["ElectraForTokenClassification",eP]],["esm",["EsmForTokenClassification",eZ]],["convbert",["ConvBertForTokenClassification",ef]],["camembert",["CamembertForTokenClassification",eS]],["deberta",["DebertaForTokenClassification",ej]],["deberta-v2",["DebertaV2ForTokenClassification",eG]],["mpnet",["MPNetForTokenClassification",e7]],["distilbert",["DistilBertForTokenClassification",eU]],["roberta",["RobertaForTokenClassification",tN]],["xlm",["XLMForTokenClassification",tW]],["xlm-roberta",["XLMRobertaForTokenClassification",tY]]]),i0=new Map([["t5",["T5ForConditionalGeneration",tp]],["longt5",["LongT5ForConditionalGeneration",tg]],["mt5",["MT5ForConditionalGeneration",tw]],["bart",["BartForConditionalGeneration",tT]],["mbart",["MBartForConditionalGeneration",tF]],["marian",["MarianMTModel",nX]],["m2m_100",["M2M100ForConditionalGeneration",nY]],["blenderbot",["BlenderbotForConditionalGeneration",tA]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",tz]]]),i1=new Map([["bloom",["BloomForCausalLM",s$]],["gpt2",["GPT2LMHeadModel",rz]],["jais",["JAISLMHeadModel",rO]],["gptj",["GPTJForCausalLM",rU]],["gpt_bigcode",["GPTBigCodeForCausalLM",rH]],["gpt_neo",["GPTNeoForCausalLM",rB]],["gpt_neox",["GPTNeoXForCausalLM",rq]],["codegen",["CodeGenForCausalLM",rK]],["llama",["LlamaForCausalLM",r1]],["exaone",["ExaoneForCausalLM",se]],["olmo",["OlmoForCausalLM",sa]],["olmo2",["Olmo2ForCausalLM",sc]],["mobilellm",["MobileLLMForCausalLM",ss]],["granite",["GraniteForCausalLM",sm]],["cohere",["CohereForCausalLM",sh]],["gemma",["GemmaForCausalLM",sM]],["gemma2",["Gemma2ForCausalLM",sb]],["gemma3_text",["Gemma3ForCausalLM",sy]],["helium",["HeliumForCausalLM",r4]],["glm",["GlmForCausalLM",r6]],["openelm",["OpenELMForCausalLM",sv]],["qwen2",["Qwen2ForCausalLM",sE]],["qwen3",["Qwen3ForCausalLM",sI]],["phi",["PhiForCausalLM",sV]],["phi3",["Phi3ForCausalLM",sG]],["mpt",["MptForCausalLM",sQ]],["opt",["OPTForCausalLM",sJ]],["mbart",["MBartForCausalLM",tC]],["mistral",["MistralForCausalLM",aL]],["starcoder2",["Starcoder2ForCausalLM",aj]],["falcon",["FalconForCausalLM",aV]],["trocr",["TrOCRForCausalLM",aS]],["stablelm",["StableLmForCausalLM",aY]],["phi3_v",["Phi3VForCausalLM",rm]]]),i2=new Map([["multi_modality",["MultiModalityCausalLM",ih]]]),i3=new Map([["bert",["BertForMaskedLM",J]],["modernbert",["ModernBertForMaskedLM",er]],["roformer",["RoFormerForMaskedLM",ec]],["electra",["ElectraForMaskedLM",eb]],["esm",["EsmForMaskedLM",eY]],["convbert",["ConvBertForMaskedLM",eh]],["camembert",["CamembertForMaskedLM",ev]],["deberta",["DebertaForMaskedLM",eI]],["deberta-v2",["DebertaV2ForMaskedLM",eN]],["mpnet",["MPNetForMaskedLM",e6]],["albert",["AlbertForMaskedLM",td]],["distilbert",["DistilBertForMaskedLM",eX]],["roberta",["RobertaForMaskedLM",tO]],["xlm",["XLMWithLMHeadModel",tq]],["xlm-roberta",["XLMRobertaForMaskedLM",tH]],["mobilebert",["MobileBertForMaskedLM",e2]],["squeezebert",["SqueezeBertForMaskedLM",ts]]]),i4=new Map([["bert",["BertForQuestionAnswering",Z]],["roformer",["RoFormerForQuestionAnswering",em]],["electra",["ElectraForQuestionAnswering",ey]],["convbert",["ConvBertForQuestionAnswering",eM]],["camembert",["CamembertForQuestionAnswering",eE]],["deberta",["DebertaForQuestionAnswering",eD]],["deberta-v2",["DebertaV2ForQuestionAnswering",eR]],["mpnet",["MPNetForQuestionAnswering",te]],["albert",["AlbertForQuestionAnswering",tc]],["distilbert",["DistilBertForQuestionAnswering",eQ]],["roberta",["RobertaForQuestionAnswering",tB]],["xlm",["XLMForQuestionAnswering",tU]],["xlm-roberta",["XLMRobertaForQuestionAnswering",tK]],["mobilebert",["MobileBertForQuestionAnswering",e4]],["squeezebert",["SqueezeBertForQuestionAnswering",tn]]]),i8=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",t7]],["idefics3",["Idefics3ForConditionalGeneration",rc]],["smolvlm",["SmolVLMForConditionalGeneration",rd]]]),i5=new Map([["llava",["LlavaForConditionalGeneration",rt]],["llava_onevision",["LlavaOnevisionForConditionalGeneration",rr]],["moondream1",["Moondream1ForConditionalGeneration",rs]],["florence2",["Florence2ForConditionalGeneration",rn]],["qwen2-vl",["Qwen2VLForConditionalGeneration",sj]],["idefics3",["Idefics3ForConditionalGeneration",rc]],["smolvlm",["SmolVLMForConditionalGeneration",rd]],["paligemma",["PaliGemmaForConditionalGeneration",ri]]]),i6=new Map([["ultravox",["UltravoxModel",iv]]]),i9=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",t7]]]),i7=new Map([["vit",["ViTForImageClassification",sZ]],["ijepa",["IJepaForImageClassification",s2]],["pvt",["PvtForImageClassification",s6]],["vit_msn",["ViTMSNForImageClassification",or]],["fastvit",["FastViTForImageClassification",oi]],["mobilevit",["MobileViTForImageClassification",om]],["mobilevitv2",["MobileViTV2ForImageClassification",oh]],["beit",["BeitForImageClassification",oy]],["deit",["DeiTForImageClassification",oK]],["hiera",["HieraForImageClassification",o1]],["convnext",["ConvNextForImageClassification",nv]],["convnextv2",["ConvNextV2ForImageClassification",nE]],["dinov2",["Dinov2ForImageClassification",nI]],["dinov2_with_registers",["Dinov2WithRegistersForImageClassification",nD]],["resnet",["ResNetForImageClassification",o4]],["swin",["SwinForImageClassification",o6]],["segformer",["SegformerForImageClassification",aQ]],["efficientnet",["EfficientNetForImageClassification",a0]],["mobilenet_v1",["MobileNetV1ForImageClassification",a6]],["mobilenet_v2",["MobileNetV2ForImageClassification",it]],["mobilenet_v3",["MobileNetV3ForImageClassification",ia]],["mobilenet_v4",["MobileNetV4ForImageClassification",id]]]),le=new Map([["detr",["DetrForObjectDetection",ov]],["rt_detr",["RTDetrForObjectDetection",oI]],["rt_detr_v2",["RTDetrV2ForObjectDetection",oO]],["rf_detr",["RFDetrForObjectDetection",oG]],["d_fine",["DFineForObjectDetection",oW]],["table-transformer",["TableTransformerForObjectDetection",oX]],["yolos",["YolosForObjectDetection",nG]]]),lt=new Map([["owlvit",["OwlViTForObjectDetection",oM]],["owlv2",["Owlv2ForObjectDetection",ob]],["grounding-dino",["GroundingDinoForObjectDetection",nV]]]),lr=new Map([["detr",["DetrForSegmentation",oC]],["clipseg",["CLIPSegForImageSegmentation",rA]]]),ls=new Map([["segformer",["SegformerForSemanticSegmentation",aX]],["sapiens",["SapiensForSemanticSegmentation",nl]],["swin",["SwinForSemanticSegmentation",o9]],["mobilenet_v1",["MobileNetV1ForSemanticSegmentation",a9]],["mobilenet_v2",["MobileNetV2ForSemanticSegmentation",ir]],["mobilenet_v3",["MobileNetV3ForSemanticSegmentation",ii]],["mobilenet_v4",["MobileNetV4ForSemanticSegmentation",iu]]]),lo=new Map([["detr",["DetrForSegmentation",oC]],["maskformer",["MaskFormerForInstanceSegmentation",nw]]]),ln=new Map([["sam",["SamModel",n$]]]),la=new Map([["wav2vec2",["Wav2Vec2ForCTC",n0]],["wav2vec2-bert",["Wav2Vec2BertForCTC",ac]],["unispeech",["UniSpeechForCTC",ae]],["unispeech-sat",["UniSpeechSatForCTC",ao]],["wavlm",["WavLMForCTC",af]],["hubert",["HubertForCTC",ap]]]),li=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",n1]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",ad]],["unispeech",["UniSpeechForSequenceClassification",at]],["unispeech-sat",["UniSpeechSatForSequenceClassification",an]],["wavlm",["WavLMForSequenceClassification",aM]],["hubert",["HubertForSequenceClassification",a_]],["audio-spectrogram-transformer",["ASTForAudioClassification",t1]]]),ll=new Map([["wavlm",["WavLMForXVector",aw]]]),lc=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",aa]],["wavlm",["WavLMForAudioFrameClassification",ax]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",n2]],["pyannote",["PyAnnoteForAudioFrameClassification",n8]]]),ld=new Map([["vitmatte",["VitMatteForImageMatting",oc]]]),lu=new Map([["patchtst",["PatchTSTForPrediction",iT]],["patchtsmixer",["PatchTSMixerForPrediction",ik]]]),lm=new Map([["swin2sr",["Swin2SRForImageSuperResolution",nt]]]),lp=new Map([["dpt",["DPTForDepthEstimation",no]],["depth_anything",["DepthAnythingForDepthEstimation",na]],["glpn",["GLPNForDepthEstimation",nT]],["sapiens",["SapiensForDepthEstimation",nc]],["depth_pro",["DepthProForDepthEstimation",nm]],["metric3d",["Metric3DForDepthEstimation",n_]],["metric3dv2",["Metric3Dv2ForDepthEstimation",ng]]]),l_=new Map([["sapiens",["SapiensForNormalEstimation",nd]]]),lh=new Map([["vitpose",["VitPoseForPoseEstimation",s4]]]),lg=new Map([["clip",["CLIPVisionModelWithProjection",rM]],["siglip",["SiglipVisionModel",rT]],["jina_clip",["JinaCLIPVisionModel",rC]]]),lf=[[iW,x.EncoderOnly],[iU,x.EncoderDecoder],[iX,x.DecoderOnly],[iQ,x.AutoEncoder],[iK,x.EncoderOnly],[iZ,x.EncoderOnly],[i0,x.Seq2Seq],[iH,x.Seq2Seq],[i1,x.DecoderOnly],[i2,x.MultiModality],[i3,x.EncoderOnly],[i4,x.EncoderOnly],[i8,x.Vision2Seq],[i5,x.ImageTextToText],[i6,x.AudioTextToText],[i7,x.EncoderOnly],[lr,x.EncoderOnly],[lo,x.EncoderOnly],[ls,x.EncoderOnly],[ld,x.EncoderOnly],[lu,x.EncoderOnly],[lm,x.EncoderOnly],[lp,x.EncoderOnly],[l_,x.EncoderOnly],[lh,x.EncoderOnly],[le,x.EncoderOnly],[lt,x.EncoderOnly],[ln,x.MaskGeneration],[la,x.EncoderOnly],[li,x.EncoderOnly],[iJ,x.Seq2Seq],[iY,x.EncoderOnly],[ll,x.EncoderOnly],[lc,x.EncoderOnly],[lg,x.EncoderOnly]];for(let[e,t]of lf)for(let[r,s]of e.values())b.set(r,t),P.set(s,r),T.set(r,s);for(let[e,t,r]of[["MusicgenForConditionalGeneration",a4,x.Musicgen],["Phi3VForCausalLM",rm,x.Phi3V],["CLIPTextModelWithProjection",rg,x.EncoderOnly],["SiglipTextModel",rb,x.EncoderOnly],["JinaCLIPTextModel",rv,x.EncoderOnly],["ClapTextModelWithProjection",aG,x.EncoderOnly],["ClapAudioModelWithProjection",aR,x.EncoderOnly],["DacEncoderModel",iV,x.EncoderOnly],["DacDecoderModel",iN,x.EncoderOnly],["MimiEncoderModel",iL,x.EncoderOnly],["MimiDecoderModel",iI,x.EncoderOnly],["SnacEncoderModel",iR,x.EncoderOnly],["SnacDecoderModel",iq,x.EncoderOnly]])b.set(e,r),P.set(t,e),T.set(e,t);let lM=new Map([["modnet",lr],["birefnet",lr],["isnet",lr],["ben",lr]]);for(let[e,t]of lM.entries())t.set(e,["PreTrainedModel",W]),b.set(e,x.EncoderOnly),P.set(W,e),T.set(e,W);class lw extends i${static MODEL_CLASS_MAPPINGS=lf.map(e=>e[0]);static BASE_IF_FAIL=!0}class lx extends i${static MODEL_CLASS_MAPPINGS=[iK]}class lb extends i${static MODEL_CLASS_MAPPINGS=[iZ]}class lT extends i${static MODEL_CLASS_MAPPINGS=[i0]}class lP extends i${static MODEL_CLASS_MAPPINGS=[iH]}class ly extends i${static MODEL_CLASS_MAPPINGS=[iJ]}class lk extends i${static MODEL_CLASS_MAPPINGS=[iY]}class lF extends i${static MODEL_CLASS_MAPPINGS=[i1]}class lv extends i${static MODEL_CLASS_MAPPINGS=[i3]}class lC extends i${static MODEL_CLASS_MAPPINGS=[i4]}class lS extends i${static MODEL_CLASS_MAPPINGS=[i8]}class lE extends i${static MODEL_CLASS_MAPPINGS=[i7]}class lA extends i${static MODEL_CLASS_MAPPINGS=[lr]}class lL extends i${static MODEL_CLASS_MAPPINGS=[ls]}class lI extends i${static MODEL_CLASS_MAPPINGS=[lo]}class lz extends i${static MODEL_CLASS_MAPPINGS=[le]}class lj extends i${static MODEL_CLASS_MAPPINGS=[lt]}class lD extends i${static MODEL_CLASS_MAPPINGS=[ln]}class lO extends i${static MODEL_CLASS_MAPPINGS=[la]}class lV extends i${static MODEL_CLASS_MAPPINGS=[li]}class lN extends i${static MODEL_CLASS_MAPPINGS=[ll]}class lB extends i${static MODEL_CLASS_MAPPINGS=[lc]}class lG extends i${static MODEL_CLASS_MAPPINGS=[i9]}class lR extends i${static MODEL_CLASS_MAPPINGS=[ld]}class lq extends i${static MODEL_CLASS_MAPPINGS=[lm]}class l$ extends i${static MODEL_CLASS_MAPPINGS=[lp]}class lW extends i${static MODEL_CLASS_MAPPINGS=[l_]}class lU extends i${static MODEL_CLASS_MAPPINGS=[lh]}class lQ extends i${static MODEL_CLASS_MAPPINGS=[lg]}class lX extends i${static MODEL_CLASS_MAPPINGS=[i5]}class lH extends i${static MODEL_CLASS_MAPPINGS=[i6]}class lJ extends U{constructor({logits:e,past_key_values:t,encoder_outputs:r,decoder_attentions:s=null,cross_attentions:o=null}){super(),this.logits=e,this.past_key_values=t,this.encoder_outputs=r,this.decoder_attentions=s,this.cross_attentions=o}}class lY extends U{constructor({logits:e,...t}){super(),this.logits=e;let r=Object.values(t);r.length>0&&(this.attentions=r)}}class lK extends U{constructor({logits:e,embeddings:t}){super(),this.logits=e,this.embeddings=t}}class lZ extends U{constructor({logits:e}){super(),this.logits=e}}class l0 extends U{constructor({logits:e}){super(),this.logits=e}}class l1 extends U{constructor({start_logits:e,end_logits:t}){super(),this.start_logits=e,this.end_logits=t}}class l2 extends U{constructor({logits:e}){super(),this.logits=e}}class l3 extends U{constructor({logits:e,past_key_values:t}){super(),this.logits=e,this.past_key_values=t}}class l4 extends U{constructor({alphas:e}){super(),this.alphas=e}}class l8 extends U{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,r)=>{r.r(t),r.d(t,{ASTFeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js");r("./src/utils/tensor.js");var o=r("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(e){super(e);let t=this.config.sampling_rate,r=(0,o.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);this.mel_filters=r,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:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e){(0,s.validate_audio_inputs)(e,"ASTFeatureExtractor");let t=await this._extract_fbank_features(e,this.config.max_length);if(this.config.do_normalize){let e=2*this.std,r=t.data;for(let t=0;t<r.length;++t)r[t]=(r[t]-this.mean)/e}return{input_values:t.unsqueeze_(0)}}}},"./src/models/auto/feature_extraction_auto.js":(e,t,r)=>{r.r(t),r.d(t,{AutoFeatureExtractor:()=>a});var s=r("./src/utils/constants.js"),o=r("./src/utils/hub.js");r("./src/base/feature_extraction_utils.js");var n=r("./src/models/feature_extractors.js");class a{static async from_pretrained(e,t={}){let r=await (0,o.getModelJSON)(e,s.FEATURE_EXTRACTOR_NAME,!0,t),a=r.feature_extractor_type,i=n[a];if(!i)throw Error(`Unknown feature_extractor_type: '${a}'. Please report this at ${s.GITHUB_ISSUE_URL}.`);return new i(r)}}},"./src/models/auto/image_processing_auto.js":(e,t,r)=>{r.r(t),r.d(t,{AutoImageProcessor:()=>i});var s=r("./src/utils/constants.js"),o=r("./src/utils/hub.js"),n=r("./src/base/image_processors_utils.js"),a=r("./src/models/image_processors.js");class i{static async from_pretrained(e,t={}){let r=await (0,o.getModelJSON)(e,s.IMAGE_PROCESSOR_NAME,!0,t),i=r.image_processor_type??r.feature_extractor_type,l=a[i];return l||(void 0!==i&&console.warn(`Image processor type '${i}' not found, assuming base ImageProcessor. Please report this at ${s.GITHUB_ISSUE_URL}.`),l=n.ImageProcessor),new l(r)}}},"./src/models/auto/processing_auto.js":(e,t,r)=>{r.r(t),r.d(t,{AutoProcessor:()=>c});var s=r("./src/utils/constants.js"),o=r("./src/utils/hub.js"),n=r("./src/base/processing_utils.js"),a=r("./src/models/processors.js"),i=r("./src/models/image_processors.js"),l=r("./src/models/feature_extractors.js");class c{static async from_pretrained(e,t={}){let r=await (0,o.getModelJSON)(e,s.IMAGE_PROCESSOR_NAME,!0,t),{image_processor_type:c,feature_extractor_type:d,processor_class:u}=r;if(u&&a[u])return a[u].from_pretrained(e,t);if(!c&&!d)throw Error("No `image_processor_type` or `feature_extractor_type` found in the config.");let m={};if(c){let e=i[c];if(!e)throw Error(`Unknown image_processor_type: '${c}'.`);m.image_processor=new e(r)}if(d){let e=i[d];if(e)m.image_processor=new e(r);else{let e=l[d];if(!e)throw Error(`Unknown feature_extractor_type: '${d}'.`);m.feature_extractor=new e(r)}}return new n.Processor({},m)}}},"./src/models/beit/image_processing_beit.js":(e,t,r)=>{r.r(t),r.d(t,{BeitFeatureExtractor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/bit/image_processing_bit.js":(e,t,r)=>{r.r(t),r.d(t,{BitImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/chinese_clip/image_processing_chinese_clip.js":(e,t,r)=>{r.r(t),r.d(t,{ChineseCLIPFeatureExtractor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/clap/feature_extraction_clap.js":(e,t,r)=>{r.r(t),r.d(t,{ClapFeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js");r("./src/utils/tensor.js");var o=r("./src/utils/audio.js");class n extends s.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,r,s){let o,n=e.length-t;if(n>0)if("rand_trunc"===r){let r=Math.floor(Math.random()*(n+1));e=e.subarray(r,r+t),o=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}else throw Error(`Truncation strategy "${r}" not implemented`);else{if(n<0){let r=new Float64Array(t);if(r.set(e),"repeat"===s)for(let s=e.length;s<t;s+=e.length)r.set(e.subarray(0,Math.min(e.length,t-s)),s);else if("repeatpad"===s)for(let t=e.length;t<-n;t+=e.length)r.set(e,t);e=r}if("fusion"===r)throw Error(`Truncation strategy "${r}" not implemented`);o=await this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)}return o.unsqueeze_(0)}async _extract_fbank_features(e,t,r=null){return(0,o.spectrogram)(e,this.window,this.config.fft_window_size,this.config.hop_length,{power:2,mel_filters:t,log_mel:"dB",max_num_frames:r,do_pad:!1,transpose:!0})}async _call(e,{max_length:t=null}={}){return(0,s.validate_audio_inputs)(e,"ClapFeatureExtractor"),{input_features:(await this._get_input_mel(e,t??this.config.nb_max_samples,this.config.truncation,this.config.padding)).unsqueeze_(0)}}}},"./src/models/clip/image_processing_clip.js":(e,t,r)=>{r.r(t),r.d(t,{CLIPFeatureExtractor:()=>n,CLIPImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/convnext/image_processing_convnext.js":(e,t,r)=>{r.r(t),r.d(t,{ConvNextFeatureExtractor:()=>n,ConvNextImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(e){super(e),this.crop_pct=this.config.crop_pct??.875}async resize(e){let t=this.size?.shortest_edge;if(void 0===t)throw Error("Size dictionary must contain 'shortest_edge' key.");if(t<384){let r=Math.floor(t/this.crop_pct),[s,o]=this.get_resize_output_image_size(e,{shortest_edge:r});e=await e.resize(s,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,r)=>{r.r(t),r.d(t,{DacFeatureExtractor:()=>o});var s=r("./src/models/encodec/feature_extraction_encodec.js");class o extends s.EncodecFeatureExtractor{}},"./src/models/deit/image_processing_deit.js":(e,t,r)=>{r.r(t),r.d(t,{DeiTFeatureExtractor:()=>n,DeiTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/detr/image_processing_detr.js":(e,t,r)=>{r.r(t),r.d(t,{DetrFeatureExtractor:()=>a,DetrImageProcessor:()=>n});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(e){let t=await super._call(e),r=[t.pixel_values.dims[0],64,64],s=(0,o.full)(r,1n);return{...t,pixel_mask:s}}post_process_object_detection(...e){return(0,s.post_process_object_detection)(...e)}post_process_panoptic_segmentation(...e){return(0,s.post_process_panoptic_segmentation)(...e)}post_process_instance_segmentation(...e){return(0,s.post_process_instance_segmentation)(...e)}}class a extends n{}},"./src/models/donut/image_processing_donut.js":(e,t,r)=>{r.r(t),r.d(t,{DonutFeatureExtractor:()=>n,DonutImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{pad_image(e,t,r,s={}){let[o,n,a]=t,i=this.image_mean;Array.isArray(this.image_mean)||(i=Array(a).fill(i));let l=this.image_std;Array.isArray(l)||(l=Array(a).fill(i));let c=i.map((e,t)=>-e/l[t]);return super.pad_image(e,t,r,{center:!0,constant_values:c,...s})}}class n extends o{}},"./src/models/dpt/image_processing_dpt.js":(e,t,r)=>{r.r(t),r.d(t,{DPTFeatureExtractor:()=>n,DPTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/efficientnet/image_processing_efficientnet.js":(e,t,r)=>{r.r(t),r.d(t,{EfficientNetImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.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,r)=>{r.r(t),r.d(t,{EncodecFeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js");class n extends s.FeatureExtractor{async _call(e){(0,s.validate_audio_inputs)(e,"EncodecFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=this.config.feature_size;if(e.length%t!=0)throw Error(`The length of the audio data must be a multiple of the number of channels (${t}).`);let r=[1,t,e.length/t];return{input_values:new o.Tensor("float32",e,r)}}}},"./src/models/feature_extractors.js":(e,t,r)=>{r.r(t),r.d(t,{ASTFeatureExtractor:()=>s.ASTFeatureExtractor,ClapFeatureExtractor:()=>n.ClapFeatureExtractor,DacFeatureExtractor:()=>a.DacFeatureExtractor,EncodecFeatureExtractor:()=>o.EncodecFeatureExtractor,ImageFeatureExtractor:()=>h.ImageProcessor,MoonshineFeatureExtractor:()=>i.MoonshineFeatureExtractor,PyAnnoteFeatureExtractor:()=>l.PyAnnoteFeatureExtractor,SeamlessM4TFeatureExtractor:()=>c.SeamlessM4TFeatureExtractor,SnacFeatureExtractor:()=>d.SnacFeatureExtractor,SpeechT5FeatureExtractor:()=>u.SpeechT5FeatureExtractor,Wav2Vec2FeatureExtractor:()=>m.Wav2Vec2FeatureExtractor,WeSpeakerFeatureExtractor:()=>p.WeSpeakerFeatureExtractor,WhisperFeatureExtractor:()=>_.WhisperFeatureExtractor});var s=r("./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"),o=r("./src/models/encodec/feature_extraction_encodec.js"),n=r("./src/models/clap/feature_extraction_clap.js"),a=r("./src/models/dac/feature_extraction_dac.js"),i=r("./src/models/moonshine/feature_extraction_moonshine.js"),l=r("./src/models/pyannote/feature_extraction_pyannote.js"),c=r("./src/models/seamless_m4t/feature_extraction_seamless_m4t.js"),d=r("./src/models/snac/feature_extraction_snac.js"),u=r("./src/models/speecht5/feature_extraction_speecht5.js"),m=r("./src/models/wav2vec2/feature_extraction_wav2vec2.js"),p=r("./src/models/wespeaker/feature_extraction_wespeaker.js"),_=r("./src/models/whisper/feature_extraction_whisper.js"),h=r("./src/base/image_processors_utils.js")},"./src/models/florence2/processing_florence2.js":(e,t,r)=>{r.r(t),r.d(t,{Florence2Processor:()=>a});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),n=r("./src/tokenizers.js");class a extends s.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;constructor(e,t){super(e,t);let{tasks_answer_post_processing_type:r,task_prompts_without_inputs:s,task_prompts_with_input:o}=this.image_processor.config;this.tasks_answer_post_processing_type=new Map(Object.entries(r??{})),this.task_prompts_without_inputs=new Map(Object.entries(s??{})),this.task_prompts_with_input=new Map(Object.entries(o??{})),this.regexes={quad_boxes:/(.+?)<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>/gm,bboxes:/([^<]+)?<loc_(\d+)><loc_(\d+)><loc_(\d+)><loc_(\d+)>/gm},this.size_per_bin=1e3}construct_prompts(e){"string"==typeof e&&(e=[e]);let t=[];for(let r of e)if(this.task_prompts_without_inputs.has(r))t.push(this.task_prompts_without_inputs.get(r));else{for(let[e,s]of this.task_prompts_with_input)if(r.includes(e)){t.push(s.replaceAll("{input}",r).replaceAll(e,""));break}t.length!==e.length&&t.push(r)}return t}post_process_generation(e,t,r){let s,o=this.tasks_answer_post_processing_type.get(t)??"pure_text";switch(e=e.replaceAll("<s>","").replaceAll("</s>",""),o){case"pure_text":s=e;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":let n="ocr"===o?"quad_boxes":"bboxes",a=e.matchAll(this.regexes[n]),i=[],l=[];for(let[e,t,...s]of a)i.push(t?t.trim():i.at(-1)??""),l.push(s.map((e,t)=>(Number(e)+.5)/this.size_per_bin*r[t%2]));s={labels:i,[n]:l};break;default:throw Error(`Task "${t}" (of type "${o}") not yet implemented.`)}return{[t]:s}}async _call(e,t=null,r={}){if(!e&&!t)throw Error("Either text or images must be provided");let s=await this.image_processor(e,r),o=t?this.tokenizer(t,r):{};return{...s,...o}}}},"./src/models/glpn/image_processing_glpn.js":(e,t,r)=>{r.r(t),r.d(t,{GLPNFeatureExtractor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/grounding_dino/image_processing_grounding_dino.js":(e,t,r)=>{r.r(t),r.d(t,{GroundingDinoImageProcessor:()=>n});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(e){let t=await super._call(e),r=t.pixel_values.dims,s=(0,o.ones)([r[0],r[2],r[3]]);return{...t,pixel_mask:s}}}},"./src/models/grounding_dino/processing_grounding_dino.js":(e,t,r)=>{r.r(t),r.d(t,{GroundingDinoProcessor:()=>i});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),n=r("./src/tokenizers.js"),a=r("./src/base/image_processors_utils.js");class i extends s.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;async _call(e,t,r={}){let s=e?await this.image_processor(e,r):{};return{...t?this.tokenizer(t,r):{},...s}}post_process_grounded_object_detection(e,t,{box_threshold:r=.25,text_threshold:s=.25,target_sizes:o=null}={}){let{logits:n,pred_boxes:i}=e,l=n.dims[0];if(null!==o&&o.length!==l)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let c=n.dims.at(1),d=n.sigmoid(),u=d.max(-1).tolist(),m=i.tolist().map(e=>e.map(e=>(0,a.center_to_corners_format)(e))),p=[];for(let e=0;e<l;++e){let n=null!==o?o[e]:null;null!==n&&(m[e]=m[e].map(e=>e.map((e,t)=>e*n[(t+1)%2])));let a=u[e],i=[],l=[],_=[];for(let o=0;o<c;++o){let n=a[o];if(n<=r)continue;let c=m[e][o],u=d[e][o];i.push(n),_.push(c);let p=function(e,t){let r=e.dims.at(-1)-1,s=e.tolist();s.fill(!1,0,1),s.fill(!1,r);let o=t.tolist();return s.map((e,t)=>e?t:null).filter(e=>null!==e).map(e=>o[e])}(u.gt(s),t[e]);l.push(p)}p.push({scores:i,boxes:_,labels:this.batch_decode(l)})}return p}}},"./src/models/idefics3/image_processing_idefics3.js":(e,t,r)=>{r.r(t),r.d(t,{Idefics3ImageProcessor:()=>n});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");class n extends s.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[r,s]=e.dims.slice(-2),o=s/r;return s>=r?r=Math.ceil((r=Math.floor((s=Math.ceil(s/t)*t)/o))/t)*t:s=Math.ceil((s=Math.floor((r=Math.ceil(r/t)*t)*o))/t)*t,{height:r,width:s}}async _call(e,{do_image_splitting:t=null,return_row_col_info:r=!1}={}){let s,n,a;if(Array.isArray(e)){if(0===e.length||!e[0])throw Error("No images provided.");s=Array.isArray(e[0])?e:[e]}else s=[[e]];let i=[],l=[],c=[],d=[],u=[];for(let e of s){let r,s=await Promise.all(e.map(e=>this.preprocess(e)));d.push(...s.map(e=>e.original_size)),u.push(...s.map(e=>e.reshaped_input_size)),s.forEach(e=>e.pixel_values.unsqueeze_(0));let{longest_edge:n}=this.max_image_size;if(t??this.do_image_splitting){let e=Array(s.length),t=Array(s.length);r=await Promise.all(s.map(async(r,s)=>{let a=this.get_resize_for_vision_encoder(r.pixel_values,n),i=await (0,o.interpolate_4d)(r.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[s]=c,t[s]=d,(0,o.cat)(l,0)})),l.push(e),c.push(t)}else{let e=[n,n];r=await Promise.all(s.map(t=>(0,o.interpolate_4d)(t.pixel_values,{size:e}))),l.push(Array(s.length).fill(0)),c.push(Array(s.length).fill(0))}i.push((0,o.cat)(r,0))}let m=i.length,[p,_,h,g]=i[0].dims;if(1===m)n=i[0].unsqueeze_(0),a=(0,o.full)([m,p,h,g],!0);else{let e=Math.max(...i.map(e=>e.dims.at(0))),t=(a=(0,o.full)([m,e,h,g],!0)).data,r=e*h*g;for(let s=0;s<m;++s){let n=i[s].dims[0];if(n<e){i[s]=(0,o.cat)([i[s],(0,o.full)([e-n,_,h,g],0)],0);let a=s*r+n*h*g,l=(s+1)*r;t.fill(!1,a,l)}}n=(0,o.stack)(i,0)}return{pixel_values:n,pixel_attention_mask:a,original_sizes:d,reshaped_input_sizes:u,...r?{rows:l,cols:c}:{}}}async split_image(e,{longest_edge:t}){let r=[],[s,n]=e.dims.slice(-2),a=0,i=0;if(s>t||n>t){a=Math.ceil(s/t),i=Math.ceil(n/t);let l=Math.ceil(s/a),c=Math.ceil(n/i);for(let t=0;t<a;++t)for(let d=0;d<i;++d){let u,m,p,_;t===a-1?(m=s-l,_=s):(m=t*l,_=(t+1)*l),d===i-1?(u=n-c,p=n):(u=d*c,p=(d+1)*c);let h=[m,u],g=[_,p],f=await (0,o.slice)(e,h,g,[2,3]);r.push(f)}(s!==t||n!==t)&&(e=await (0,o.interpolate_4d)(e,{size:[t,t]}))}return r.push(e),{frames:r,num_splits_h:a,num_splits_w:i}}}},"./src/models/idefics3/processing_idefics3.js":(e,t,r)=>{r.r(t),r.d(t,{Idefics3Processor:()=>i});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),n=r("./src/tokenizers.js");r("./src/utils/image.js");var a=r("./src/utils/core.js");class i extends s.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;static uses_processor_config=!0;fake_image_token="<fake_token_around_image>";image_token="<image>";global_img_token="<global-img>";async _call(e,t=null,r={}){let s;r.return_row_col_info??=!0,t&&(s=await this.image_processor(t,r)),Array.isArray(e)||(e=[e]);let o=s.rows??[Array(e.length).fill(0)],n=s.cols??[Array(e.length).fill(0)],i=this.config.image_seq_len,l=[],c=[];for(let t=0;t<e.length;++t){let r=e[t],s=o[t],d=n[t];l.push((0,a.count)(r,this.image_token));let u=s.map((e,t)=>(function(e,t,r,s,o,n){if(0===e&&0===t)return`${s}${n}`+o.repeat(r)+`${s}`;let a="";for(let n=0;n<e;++n){for(let e=0;e<t;++e)a+=s+`<row_${n+1}_col_${e+1}>`+o.repeat(r);a+="\n"}return a+(`
${s}${n}`+o.repeat(r)+`${s}`)})(e,d[t],i,this.fake_image_token,this.image_token,this.global_img_token)),m=r.split(this.image_token);if(0===m.length)throw Error("The image token should be present in the text.");let p=m[0];for(let e=0;e<u.length;++e)p+=u[e]+m[e+1];c.push(p)}return{...this.tokenizer(c),...s}}}},"./src/models/image_processors.js":(e,t,r)=>{r.r(t),r.d(t,{BeitFeatureExtractor:()=>s.BeitFeatureExtractor,BitImageProcessor:()=>o.BitImageProcessor,CLIPFeatureExtractor:()=>a.CLIPFeatureExtractor,CLIPImageProcessor:()=>a.CLIPImageProcessor,ChineseCLIPFeatureExtractor:()=>n.ChineseCLIPFeatureExtractor,ConvNextFeatureExtractor:()=>i.ConvNextFeatureExtractor,ConvNextImageProcessor:()=>i.ConvNextImageProcessor,DPTFeatureExtractor:()=>u.DPTFeatureExtractor,DPTImageProcessor:()=>u.DPTImageProcessor,DeiTFeatureExtractor:()=>l.DeiTFeatureExtractor,DeiTImageProcessor:()=>l.DeiTImageProcessor,DetrFeatureExtractor:()=>c.DetrFeatureExtractor,DetrImageProcessor:()=>c.DetrImageProcessor,DonutFeatureExtractor:()=>d.DonutFeatureExtractor,DonutImageProcessor:()=>d.DonutImageProcessor,EfficientNetImageProcessor:()=>m.EfficientNetImageProcessor,GLPNFeatureExtractor:()=>p.GLPNFeatureExtractor,GroundingDinoImageProcessor:()=>_.GroundingDinoImageProcessor,Idefics3ImageProcessor:()=>h.Idefics3ImageProcessor,JinaCLIPImageProcessor:()=>f.JinaCLIPImageProcessor,LlavaOnevisionImageProcessor:()=>M.LlavaOnevisionImageProcessor,Mask2FormerImageProcessor:()=>w.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>x.MaskFormerFeatureExtractor,MaskFormerImageProcessor:()=>x.MaskFormerImageProcessor,MobileNetV1FeatureExtractor:()=>b.MobileNetV1FeatureExtractor,MobileNetV1ImageProcessor:()=>b.MobileNetV1ImageProcessor,MobileNetV2FeatureExtractor:()=>T.MobileNetV2FeatureExtractor,MobileNetV2ImageProcessor:()=>T.MobileNetV2ImageProcessor,MobileNetV3FeatureExtractor:()=>P.MobileNetV3FeatureExtractor,MobileNetV3ImageProcessor:()=>P.MobileNetV3ImageProcessor,MobileNetV4FeatureExtractor:()=>y.MobileNetV4FeatureExtractor,MobileNetV4ImageProcessor:()=>y.MobileNetV4ImageProcessor,MobileViTFeatureExtractor:()=>k.MobileViTFeatureExtractor,MobileViTImageProcessor:()=>k.MobileViTImageProcessor,NougatImageProcessor:()=>F.NougatImageProcessor,OwlViTFeatureExtractor:()=>C.OwlViTFeatureExtractor,OwlViTImageProcessor:()=>C.OwlViTImageProcessor,Owlv2ImageProcessor:()=>v.Owlv2ImageProcessor,Phi3VImageProcessor:()=>S.Phi3VImageProcessor,PvtImageProcessor:()=>E.PvtImageProcessor,Qwen2VLImageProcessor:()=>A.Qwen2VLImageProcessor,RTDetrImageProcessor:()=>L.RTDetrImageProcessor,SamImageProcessor:()=>I.SamImageProcessor,SegformerFeatureExtractor:()=>z.SegformerFeatureExtractor,SegformerImageProcessor:()=>z.SegformerImageProcessor,SiglipImageProcessor:()=>j.SiglipImageProcessor,SmolVLMImageProcessor:()=>D.SmolVLMImageProcessor,Swin2SRImageProcessor:()=>O.Swin2SRImageProcessor,VLMImageProcessor:()=>g.VLMImageProcessor,ViTFeatureExtractor:()=>V.ViTFeatureExtractor,ViTImageProcessor:()=>V.ViTImageProcessor,VitMatteImageProcessor:()=>N.VitMatteImageProcessor,VitPoseImageProcessor:()=>B.VitPoseImageProcessor,YolosFeatureExtractor:()=>G.YolosFeatureExtractor,YolosImageProcessor:()=>G.YolosImageProcessor});var s=r("./src/models/beit/image_processing_beit.js"),o=r("./src/models/bit/image_processing_bit.js"),n=r("./src/models/chinese_clip/image_processing_chinese_clip.js"),a=r("./src/models/clip/image_processing_clip.js"),i=r("./src/models/convnext/image_processing_convnext.js"),l=r("./src/models/deit/image_processing_deit.js"),c=r("./src/models/detr/image_processing_detr.js"),d=r("./src/models/donut/image_processing_donut.js"),u=r("./src/models/dpt/image_processing_dpt.js"),m=r("./src/models/efficientnet/image_processing_efficientnet.js"),p=r("./src/models/glpn/image_processing_glpn.js"),_=r("./src/models/grounding_dino/image_processing_grounding_dino.js"),h=r("./src/models/idefics3/image_processing_idefics3.js"),g=r("./src/models/janus/image_processing_janus.js"),f=r("./src/models/jina_clip/image_processing_jina_clip.js"),M=r("./src/models/llava_onevision/image_processing_llava_onevision.js"),w=r("./src/models/mask2former/image_processing_mask2former.js"),x=r("./src/models/maskformer/image_processing_maskformer.js"),b=r("./src/models/mobilenet_v1/image_processing_mobilenet_v1.js"),T=r("./src/models/mobilenet_v2/image_processing_mobilenet_v2.js"),P=r("./src/models/mobilenet_v3/image_processing_mobilenet_v3.js"),y=r("./src/models/mobilenet_v4/image_processing_mobilenet_v4.js"),k=r("./src/models/mobilevit/image_processing_mobilevit.js"),F=r("./src/models/nougat/image_processing_nougat.js"),v=r("./src/models/owlv2/image_processing_owlv2.js"),C=r("./src/models/owlvit/image_processing_owlvit.js"),S=r("./src/models/phi3_v/image_processing_phi3_v.js"),E=r("./src/models/pvt/image_processing_pvt.js"),A=r("./src/models/qwen2_vl/image_processing_qwen2_vl.js"),L=r("./src/models/rt_detr/image_processing_rt_detr.js"),I=r("./src/models/sam/image_processing_sam.js"),z=r("./src/models/segformer/image_processing_segformer.js"),j=r("./src/models/siglip/image_processing_siglip.js"),D=r("./src/models/smolvlm/image_processing_smolvlm.js"),O=r("./src/models/swin2sr/image_processing_swin2sr.js"),V=r("./src/models/vit/image_processing_vit.js"),N=r("./src/models/vitmatte/image_processing_vitmatte.js"),B=r("./src/models/vitpose/image_processing_vitpose.js"),G=r("./src/models/yolos/image_processing_yolos.js")},"./src/models/janus/image_processing_janus.js":(e,t,r)=>{r.r(t),r.d(t,{VLMImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.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,r,s){return super.pad_image(e,t,r,{constant_values:this.constant_values,center:!0,...s})}}},"./src/models/janus/processing_janus.js":(e,t,r)=>{r.r(t),r.d(t,{VLChatProcessor:()=>c});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),n=r("./src/tokenizers.js"),a=r("./src/utils/core.js"),i=r("./src/utils/tensor.js"),l=r("./src/utils/image.js");class c extends s.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;static uses_processor_config=!0;constructor(e,t){super(e,t),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:r="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)));let s=this.tokenizer,o=s.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0,chat_template:r}),n=e=>s.encode(e,{add_special_tokens:!1}),c=o.split(this.image_tag),d=c.length-1;if(t.length!==d)throw Error(`Number of images provided (${t.length}) does not match number of "${this.image_tag}" image tags (${d})`);let[u,m,p]=s.model.convert_tokens_to_ids([this.image_tag,this.image_start_tag,this.image_end_tag]),_=n(c[0]),h=Array(_.length).fill(!1);for(let e=1;e<c.length;++e){let t=Array(this.num_image_tokens).fill(u),r=n(c[e]);_=(0,a.mergeArrays)(_,[m],t,[p],r);let s=Array(this.num_image_tokens).fill(!0);h=(0,a.mergeArrays)(h,[!1],s,[!1],Array(r.length).fill(!1))}let g=[1,_.length],f={input_ids:new i.Tensor("int64",_,g),attention_mask:new i.Tensor("int64",Array(_.length).fill(1),g),images_seq_mask:new i.Tensor("bool",h,g),images_emb_mask:new i.Tensor("bool",Array(d*this.num_image_tokens).fill(!0),[1,d,this.num_image_tokens])};if(t&&t.length>0){let 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,r)=>{r.r(t),r.d(t,{JinaCLIPImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(e){let{resize_mode:t,fill_color:r,interpolation:s,size:o,...n}=e;super({...n,size:"squash"===t?{width:o,height:o}:"shortest"===t?{shortest_edge:o}:{longest_edge:o},resample:"bicubic"===s?3:2,do_center_crop:!0,crop_size:o,do_normalize:!0})}}},"./src/models/jina_clip/processing_jina_clip.js":(e,t,r)=>{r.r(t),r.d(t,{JinaCLIPProcessor:()=>a});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),n=r("./src/tokenizers.js");class a extends s.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;async _call(e=null,t=null,r={}){if(!e&&!t)throw Error("Either text or images must be provided");let s=e?this.tokenizer(e,r):{},o=t?await this.image_processor(t,r):{};return{...s,...o}}}},"./src/models/llava_onevision/image_processing_llava_onevision.js":(e,t,r)=>{r.r(t),r.d(t,{LlavaOnevisionImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/mask2former/image_processing_mask2former.js":(e,t,r)=>{r.r(t),r.d(t,{Mask2FormerImageProcessor:()=>o});var s=r("./src/models/maskformer/image_processing_maskformer.js");class o extends s.MaskFormerImageProcessor{}},"./src/models/maskformer/image_processing_maskformer.js":(e,t,r)=>{r.r(t),r.d(t,{MaskFormerFeatureExtractor:()=>n,MaskFormerImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_panoptic_segmentation(...e){return(0,s.post_process_panoptic_segmentation)(...e)}post_process_instance_segmentation(...e){return(0,s.post_process_instance_segmentation)(...e)}}class n extends o{}},"./src/models/mgp_str/processing_mgp_str.js":(e,t,r)=>{r.r(t),r.d(t,{MgpstrProcessor:()=>l});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),n=r("./src/tokenizers.js"),a=r("./src/utils/maths.js");let i={char:["char_decode",1],bpe:["bpe_decode",2],wp:["wp_decode",102]};class l extends s.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 Error(`Format ${t} is not supported.`);let[r,s]=i[t],o=this[r].bind(this),[n,l]=e.dims,c=[],d=[],u=e.tolist();for(let e=0;e<n;++e){let t=u[e],r=[],o=[];for(let e=1;e<l;++e){let[n,i]=(0,a.max)((0,a.softmax)(t[e]));if(o.push(n),i==s)break;r.push(i)}let n=o.length>0?o.reduce((e,t)=>e*t,1):0;d.push(r),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,r]){let[s,o]=this._decode_helper(e,"char"),[n,i]=this._decode_helper(t,"bpe"),[l,c]=this._decode_helper(r,"wp"),d=[],u=[];for(let e=0;e<s.length;++e){let[t,r]=(0,a.max)([o[e],i[e],c[e]]);d.push([s[e],n[e],l[e]][r]),u.push(t)}return{generated_text:d,scores:u,char_preds:s,bpe_preds:n,wp_preds:l}}static async from_pretrained(...e){let t=await super.from_pretrained(...e),r=await n.AutoTokenizer.from_pretrained("Xenova/gpt2"),s=await n.AutoTokenizer.from_pretrained("Xenova/bert-base-uncased");return t.components={image_processor:t.image_processor,char_tokenizer:t.tokenizer,bpe_tokenizer:r,wp_tokenizer:s},t}async _call(e,t=null){let r=await this.image_processor(e);return t&&(r.labels=this.tokenizer(t).input_ids),r}}},"./src/models/mobilenet_v1/image_processing_mobilenet_v1.js":(e,t,r)=>{r.r(t),r.d(t,{MobileNetV1FeatureExtractor:()=>n,MobileNetV1ImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v2/image_processing_mobilenet_v2.js":(e,t,r)=>{r.r(t),r.d(t,{MobileNetV2FeatureExtractor:()=>n,MobileNetV2ImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v3/image_processing_mobilenet_v3.js":(e,t,r)=>{r.r(t),r.d(t,{MobileNetV3FeatureExtractor:()=>n,MobileNetV3ImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v4/image_processing_mobilenet_v4.js":(e,t,r)=>{r.r(t),r.d(t,{MobileNetV4FeatureExtractor:()=>n,MobileNetV4ImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilevit/image_processing_mobilevit.js":(e,t,r)=>{r.r(t),r.d(t,{MobileViTFeatureExtractor:()=>n,MobileViTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/moonshine/feature_extraction_moonshine.js":(e,t,r)=>{r.r(t),r.d(t,{MoonshineFeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js");class n extends s.FeatureExtractor{async _call(e){(0,s.validate_audio_inputs)(e,"MoonshineFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=[1,e.length];return{input_values:new o.Tensor("float32",e,t)}}}},"./src/models/moonshine/processing_moonshine.js":(e,t,r)=>{r.r(t),r.d(t,{MoonshineProcessor:()=>a});var s=r("./src/models/auto/feature_extraction_auto.js"),o=r("./src/tokenizers.js"),n=r("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=s.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/nougat/image_processing_nougat.js":(e,t,r)=>{r.r(t),r.d(t,{NougatImageProcessor:()=>o});var s=r("./src/models/donut/image_processing_donut.js");class o extends s.DonutImageProcessor{}},"./src/models/owlv2/image_processing_owlv2.js":(e,t,r)=>{r.r(t),r.d(t,{Owlv2ImageProcessor:()=>o});var s=r("./src/models/owlvit/image_processing_owlvit.js");class o extends s.OwlViTImageProcessor{}},"./src/models/owlvit/image_processing_owlvit.js":(e,t,r)=>{r.r(t),r.d(t,{OwlViTFeatureExtractor:()=>n,OwlViTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...e){return(0,s.post_process_object_detection)(...e)}}class n extends o{}},"./src/models/owlvit/processing_owlvit.js":(e,t,r)=>{r.r(t),r.d(t,{OwlViTProcessor:()=>a});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),n=r("./src/tokenizers.js");class a extends s.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor}},"./src/models/paligemma/processing_paligemma.js":(e,t,r)=>{r.r(t),r.d(t,{PaliGemmaProcessor:()=>i});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),n=r("./src/tokenizers.js");let a="<image>";class i extends s.Processor{static tokenizer_class=n.AutoTokenizer;static image_processor_class=o.AutoImageProcessor;static uses_processor_config=!1;async _call(e,t=null,r={}){let 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]);let o=this.tokenizer.bos_token,n=this.image_processor.config.image_seq_length;t.some(e=>e.includes(a))?s=t.map(e=>{let t=e.replaceAll(a,a.repeat(n)),r=t.lastIndexOf(a),s=-1===r?0:r+a.length;return t.slice(0,s)+o+t.slice(s)+"\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 `<image>` tokens in the very beginning of your text. For this call, we will infer how many images each text has and add special tokens."),s=t.map(t=>{var r;return r=e.length,`${a.repeat(n*r)}${o}${t}
`}));let i=this.tokenizer(s,r);return{...await this.image_processor(e,r),...i}}}},"./src/models/phi3_v/image_processing_phi3_v.js":(e,t,r)=>{r.r(t),r.d(t,{Phi3VImageProcessor:()=>c});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");let n=[2,3],{ceil:a,floor:i,sqrt:l}=Math;class c extends s.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){let{num_img_tokens:r}=this.config;return i((i(t/336)*i(e/336)+1)*r+1+(i(t/336)+1)*l(r))}get_resize_output_image_size(e,t){let r=this._num_crops,[s,o]=e.size,n=s/o,a=1;for(;a*Math.ceil(a/n)<=r;)a+=1;let i=Math.floor(336*(a-=1)),l=Math.floor(i/n);return[i,l]}pad_image(e,t,r,s={}){let[o,n]=t,i=336*a(o/336),l=336*a(n/336),c=[1,1,1].map((e,t)=>(e-this.image_mean[t])/this.image_std[t]);return super.pad_image(e,t,{width:l,height:i},{center:!0,constant_values:c,...s})}async _call(e,{num_crops:t=null}={}){if(this._num_crops=t??=this.config.num_crops,t<4||l(t)%1!=0)throw Error("num_crops must be a square number >= 4");Array.isArray(e)||(e=[e]);let r=e.length,s=await Promise.all(e.map(e=>this.preprocess(e))),c=s.map(e=>e.original_size),d=s.map(e=>e.reshaped_input_size),u=[];for(let{pixel_values:e}of s){e.unsqueeze_(0);let[r,s]=e.dims.slice(-2),a=await (0,o.interpolate_4d)(e,{size:[336,336],mode:"bicubic"});if(t>0){let c=[],d=l(t),m=i(s/d),p=i(r/d);for(let t=0;t<d;++t)for(let a=0;a<d;++a){let i,l,u,_;t===d-1?(l=r-p,_=r):(l=t*p,_=(t+1)*p),a===d-1?(i=s-m,u=s):(i=a*m,u=(a+1)*m);let h=[l,i],g=[_,u],f=await (0,o.slice)(e,h,g,n);c.push(f)}let _=await (0,o.interpolate_4d)((0,o.cat)(c,0),{size:[336,336],mode:"bicubic"});u.push((0,o.cat)([a,_],0))}else u.push(a)}let m=(0,o.stack)(u,0),p=d.map(e=>e.map(e=>336*a(e/336)));return{pixel_values:m,original_sizes:c,reshaped_input_sizes:d,image_sizes:new o.Tensor("int64",p.flat(),[r,2]),num_img_tokens:p.map(([e,t])=>this.calc_num_image_tokens_from_image_size(t,e))}}}},"./src/models/phi3_v/processing_phi3_v.js":(e,t,r)=>{r.r(t),r.d(t,{Phi3VProcessor:()=>l});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),n=r("./src/tokenizers.js");r("./src/utils/image.js");let a="<|image|>",i=/<\|image_\d+\|>/g;class l extends s.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;async _call(e,t=null,{padding:r=!0,truncation:s=!0,num_crops:o=null}={}){let n,l;if(Array.isArray(e)||(e=[e]),t){let{num_img_tokens:c}=l=await this.image_processor(t,{num_crops:o}),d=e.map((e,t)=>e.split(i).join(a.repeat(c[t])));n=this.tokenizer(d,{padding:r,truncation:s});let 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/processors.js":(e,t,r)=>{r.r(t),r.d(t,{Florence2Processor:()=>s.Florence2Processor,GroundingDinoProcessor:()=>o.GroundingDinoProcessor,Idefics3Processor:()=>n.Idefics3Processor,JinaCLIPProcessor:()=>i.JinaCLIPProcessor,MgpstrProcessor:()=>l.MgpstrProcessor,MoonshineProcessor:()=>c.MoonshineProcessor,OwlViTProcessor:()=>d.OwlViTProcessor,PaliGemmaProcessor:()=>m.PaliGemmaProcessor,Phi3VProcessor:()=>u.Phi3VProcessor,PyAnnoteProcessor:()=>p.PyAnnoteProcessor,Qwen2VLProcessor:()=>_.Qwen2VLProcessor,SamProcessor:()=>h.SamProcessor,SmolVLMProcessor:()=>g.SmolVLMProcessor,SpeechT5Processor:()=>f.SpeechT5Processor,UltravoxProcessor:()=>M.UltravoxProcessor,VLChatProcessor:()=>a.VLChatProcessor,Wav2Vec2Processor:()=>w.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>x.Wav2Vec2ProcessorWithLM,WhisperProcessor:()=>b.WhisperProcessor});var s=r("./src/models/florence2/processing_florence2.js"),o=r("./src/models/grounding_dino/processing_grounding_dino.js"),n=r("./src/models/idefics3/processing_idefics3.js"),a=r("./src/models/janus/processing_janus.js"),i=r("./src/models/jina_clip/processing_jina_clip.js"),l=r("./src/models/mgp_str/processing_mgp_str.js"),c=r("./src/models/moonshine/processing_moonshine.js"),d=r("./src/models/owlvit/processing_owlvit.js"),u=r("./src/models/phi3_v/processing_phi3_v.js"),m=r("./src/models/paligemma/processing_paligemma.js"),p=r("./src/models/pyannote/processing_pyannote.js"),_=r("./src/models/qwen2_vl/processing_qwen2_vl.js"),h=r("./src/models/sam/processing_sam.js"),g=r("./src/models/smolvlm/processing_smolvlm.js"),f=r("./src/models/speecht5/processing_speecht5.js"),M=r("./src/models/ultravox/processing_ultravox.js"),w=r("./src/models/wav2vec2/processing_wav2vec2.js"),x=r("./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js"),b=r("./src/models/whisper/processing_whisper.js")},"./src/models/pvt/image_processing_pvt.js":(e,t,r)=>{r.r(t),r.d(t,{PvtImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/pyannote/feature_extraction_pyannote.js":(e,t,r)=>{r.r(t),r.d(t,{PyAnnoteFeatureExtractor:()=>a});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js"),n=r("./src/utils/maths.js");class a extends s.FeatureExtractor{async _call(e){(0,s.validate_audio_inputs)(e,"PyAnnoteFeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let 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){let r=t/this.samples_to_frames(t)/this.config.sampling_rate,s=[];for(let t of e.tolist()){let e=[],o=-1;for(let r=0;r<t.length;++r){let s=(0,n.softmax)(t[r]),[a,i]=(0,n.max)(s),[l,c]=[r,r+1];i!==o?(o=i,e.push({id:i,start:l,end:c,score:a})):(e.at(-1).end=c,e.at(-1).score+=a)}s.push(e.map(({id:e,start:t,end:s,score:o})=>({id:e,start:t*r,end:s*r,confidence:o/(s-t)})))}return s}}},"./src/models/pyannote/processing_pyannote.js":(e,t,r)=>{r.r(t),r.d(t,{PyAnnoteProcessor:()=>n});var s=r("./src/base/processing_utils.js"),o=r("./src/models/pyannote/feature_extraction_pyannote.js");class n extends s.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,r)=>{r.r(t),r.d(t,{Qwen2VLImageProcessor:()=>n});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(e,...t){let{pixel_values:r,original_sizes:s,reshaped_input_sizes:n}=await super._call(e,...t),a=r,{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));let d=a.dims[0]/i,u=a.dims[1],m=Math.floor(a.dims[2]/c),p=Math.floor(a.dims[3]/c);return{pixel_values:a.view(d,i,u,Math.floor(m/l),l,c,Math.floor(p/l),l,c).permute(0,3,6,4,7,2,1,5,8).view(d*m*p,u*i*c*c),image_grid_thw:new o.Tensor("int64",[d,m,p],[1,3]),original_sizes:s,reshaped_input_sizes:n}}}},"./src/models/qwen2_vl/processing_qwen2_vl.js":(e,t,r)=>{r.r(t),r.d(t,{Qwen2VLProcessor:()=>a});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js"),n=r("./src/tokenizers.js");r("./src/utils/image.js");class a extends s.Processor{static image_processor_class=o.AutoImageProcessor;static tokenizer_class=n.AutoTokenizer;async _call(e,t=null,...r){let s,o;if(Array.isArray(e)||(e=[e]),t&&(o=(s=await this.image_processor(t)).image_grid_thw),o){let t=this.image_processor.config.merge_size**2,r=0,s=o.tolist();e=e.map(e=>{for(;e.includes("<|image_pad|>");){let o=Number(s[r++].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),...s}}}},"./src/models/rt_detr/image_processing_rt_detr.js":(e,t,r)=>{r.r(t),r.d(t,{RTDetrImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...e){return(0,s.post_process_object_detection)(...e)}}},"./src/models/sam/image_processing_sam.js":(e,t,r)=>{r.r(t),r.d(t,{SamImageProcessor:()=>a});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/core.js"),n=r("./src/utils/tensor.js");class a extends s.ImageProcessor{reshape_input_points(e,t,r,s=!1){e=structuredClone(e);let a=(0,o.calculateDimensions)(e);if(3===a.length)s||(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 s=0;s<e.length;++s){let o=t[s],n=r[s],a=[n[0]/o[0],n[1]/o[1]];for(let t=0;t<e[s].length;++t)for(let r=0;r<e[s][t].length;++r)for(let o=0;o<e[s][t][r].length;++o)e[s][t][r][o]*=a[o%2]}return new n.Tensor("float32",Float32Array.from(e.flat(1/0)),a)}add_input_labels(e,t){let r=(0,o.calculateDimensions)(e);if(2===r.length)r=[1,...r],e=[e];else if(3!==r.length)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");if(r.some((e,r)=>e!==t.dims[r]))throw Error(`The first ${r.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new n.Tensor("int64",e.flat(1/0).map(BigInt),r)}async _call(e,{input_points:t=null,input_labels:r=null,input_boxes:s=null}={}){let o=await super._call(e);if(t&&(o.input_points=this.reshape_input_points(t,o.original_sizes,o.reshaped_input_sizes)),r){if(!o.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");o.input_labels=this.add_input_labels(r,o.input_points)}return s&&(o.input_boxes=this.reshape_input_points(s,o.original_sizes,o.reshaped_input_sizes,!0)),o}async post_process_masks(e,t,r,{mask_threshold:s=0,binarize:o=!0,pad_size:a=null}={}){let i=[],l=[(a=a??this.pad_size).height,a.width];for(let a=0;a<t.length;++a){let c=t[a],d=r[a],u=await (0,n.interpolate_4d)(e[a],{mode:"bilinear",size:l});if(u=u.slice(null,null,[0,d[0]],[0,d[1]]),u=await (0,n.interpolate_4d)(u,{mode:"bilinear",size:c}),o){let e=u.data,t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)e[r]>s&&(t[r]=1);u=new n.Tensor("bool",t,u.dims)}i.push(u)}return i}generate_crop_boxes(e,t,{crop_n_layers:r=0,overlap_ratio:s=512/1500,points_per_crop:o=32,crop_n_points_downscale_factor:n=1}={}){}}},"./src/models/sam/processing_sam.js":(e,t,r)=>{r.r(t),r.d(t,{SamProcessor:()=>n});var s=r("./src/base/processing_utils.js"),o=r("./src/models/auto/image_processing_auto.js");class n extends s.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/seamless_m4t/feature_extraction_seamless_m4t.js":(e,t,r)=>{r.r(t),r.d(t,{SeamlessM4TFeatureExtractor:()=>a});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js"),n=r("./src/utils/audio.js");class a extends s.FeatureExtractor{constructor(e){super(e);let t=this.config.sampling_rate,r=(0,n.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);this.mel_filters=r,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:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e,{padding:t=!0,pad_to_multiple_of:r=2,do_normalize_per_mel_bins:n=!0,return_attention_mask:a=!0}={}){let i;(0,s.validate_audio_inputs)(e,"SeamlessM4TFeatureExtractor");let l=await this._extract_fbank_features(e,this.config.max_length);if(n){let[e,t]=l.dims,r=l.data;for(let s=0;s<t;++s){let o=0;for(let n=0;n<e;++n)o+=r[n*t+s];let n=o/e,a=0;for(let o=0;o<e;++o)a+=(r[o*t+s]-n)**2;let i=Math.sqrt((a/=e-1)+1e-7);for(let o=0;o<e;++o){let e=o*t+s;r[e]=(r[e]-n)/i}}}if(t){let[e,t]=l.dims,s=l.data,n=e%r;if(n>0){let r=new Float32Array(t*(e+n));r.set(s),r.fill(this.config.padding_value,s.length);let c=e+n;l=new o.Tensor(l.type,r,[c,t]),a&&(i=new o.Tensor("int64",new BigInt64Array(c),[1,c])).data.fill(1n,0,e)}}let[c,d]=l.dims,u=this.config.stride;if(0!=c%u)throw Error(`The number of frames (${c}) must be a multiple of the stride (${u}).`);let m=l.view(1,Math.floor(c/u),d*u),p={input_features:m};if(a){let e=m.dims[1],t=new BigInt64Array(e);if(i){let e=i.data;for(let r=1,s=0;r<c;r+=u,++s)t[s]=e[r]}else t.fill(1n);p.attention_mask=new o.Tensor("int64",t,[1,e])}return p}}},"./src/models/segformer/image_processing_segformer.js":(e,t,r)=>{r.r(t),r.d(t,{SegformerFeatureExtractor:()=>n,SegformerImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_semantic_segmentation(...e){return(0,s.post_process_semantic_segmentation)(...e)}}class n extends o{}},"./src/models/siglip/image_processing_siglip.js":(e,t,r)=>{r.r(t),r.d(t,{SiglipImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/smolvlm/image_processing_smolvlm.js":(e,t,r)=>{r.r(t),r.d(t,{SmolVLMImageProcessor:()=>s.Idefics3ImageProcessor});var s=r("./src/models/idefics3/image_processing_idefics3.js")},"./src/models/smolvlm/processing_smolvlm.js":(e,t,r)=>{r.r(t),r.d(t,{SmolVLMProcessor:()=>s.Idefics3Processor});var s=r("./src/models/idefics3/processing_idefics3.js")},"./src/models/snac/feature_extraction_snac.js":(e,t,r)=>{r.r(t),r.d(t,{SnacFeatureExtractor:()=>o});var s=r("./src/models/dac/feature_extraction_dac.js");class o extends s.DacFeatureExtractor{}},"./src/models/speecht5/feature_extraction_speecht5.js":(e,t,r)=>{r.r(t),r.d(t,{SpeechT5FeatureExtractor:()=>o});var s=r("./src/base/feature_extraction_utils.js");class o extends s.FeatureExtractor{}},"./src/models/speecht5/processing_speecht5.js":(e,t,r)=>{r.r(t),r.d(t,{SpeechT5Processor:()=>a});var s=r("./src/base/processing_utils.js"),o=r("./src/tokenizers.js"),n=r("./src/models/auto/feature_extraction_auto.js");class a extends s.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,r)=>{r.r(t),r.d(t,{Swin2SRImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{pad_image(e,t,r,s={}){let[o,n,a]=t;return super.pad_image(e,t,{width:n+(r-n%r)%r,height:o+(r-o%r)%r},{mode:"symmetric",center:!1,constant_values:-1,...s})}}},"./src/models/ultravox/processing_ultravox.js":(e,t,r)=>{r.r(t),r.d(t,{UltravoxProcessor:()=>a});var s=r("./src/models/auto/feature_extraction_auto.js"),o=r("./src/tokenizers.js"),n=r("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=s.AutoFeatureExtractor;static uses_processor_config=!0;async _call(e,t=null,r={}){if(Array.isArray(e))throw Error("Batched inputs are not supported yet.");let s={};if(t){let o=t.length,{input_features:n}=await this.feature_extractor(t,{...r,max_length:o}),a=1+Math.ceil(Math.round(o/this.config.encoder_ds_factor+1e-4)/this.config.stack_factor);s.audio_token_len=[a],s.audio_values=n;let i=this.config.audio_placeholder;if(!e.includes(i))throw Error(`The input text does not contain the image token ${i}.`);e=e.replaceAll(i,i.repeat(a))}return{...this.tokenizer(e,{add_special_tokens:!1,...r}),...s}}}},"./src/models/vit/image_processing_vit.js":(e,t,r)=>{r.r(t),r.d(t,{ViTFeatureExtractor:()=>n,ViTImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/vitmatte/image_processing_vitmatte.js":(e,t,r)=>{r.r(t),r.d(t,{VitMatteImageProcessor:()=>n});var s=r("./src/base/image_processors_utils.js"),o=r("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);let r=await Promise.all(e.map(e=>this.preprocess(e))),s=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)(r.map((e,t)=>(0,o.cat)([e.pixel_values,s[t].pixel_values],0)),0),original_sizes:r.map(e=>e.original_size),reshaped_input_sizes:r.map(e=>e.reshaped_input_size)}}}},"./src/models/vitpose/image_processing_vitpose.js":(e,t,r)=>{r.r(t),r.d(t,{VitPoseImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_pose_estimation(e,t,{threshold:r=null}={}){let s=e.tolist(),[o,n,a,i]=e.dims,l=[];for(let e=0;e<o;++e){let o=s[e],n=t[e],c=[];for(let e=0;e<n.length;++e){let t=n[e],s=[],l=[],d=[],u=t.at(-2)/i,m=t.at(-1)/a;for(let e=0;e<o.length;++e){let[t,n]=[0,0],a=0,i=-1/0,c=o[e];for(let e=0;e<c.length;++e){let r=c[e];for(let s=0;s<r.length;++s){let o=r[s];a+=o,i=Math.max(i,o),t+=(s+.5)*o,n+=e*o}}if(null!=r&&i<r)continue;let p=[u*t/a,m*n/a];s.push(p),d.push(e),l.push(i)}c.push({bbox:t,scores:l,labels:d,keypoints:s})}l.push(c)}return l}}},"./src/models/wav2vec2/feature_extraction_wav2vec2.js":(e,t,r)=>{r.r(t),r.d(t,{Wav2Vec2FeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js"),o=r("./src/utils/tensor.js");class n extends s.FeatureExtractor{_zero_mean_unit_var_norm(e){let t=e.reduce((e,t)=>e+t,0)/e.length,r=e.reduce((e,r)=>e+(r-t)**2,0)/e.length;return e.map(e=>(e-t)/Math.sqrt(r+1e-7))}async _call(e){(0,s.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));let r=[1,t.length];return{input_values:new o.Tensor("float32",t,r),attention_mask:new o.Tensor("int64",new BigInt64Array(t.length).fill(1n),r)}}}},"./src/models/wav2vec2/processing_wav2vec2.js":(e,t,r)=>{r.r(t),r.d(t,{Wav2Vec2Processor:()=>a});var s=r("./src/tokenizers.js"),o=r("./src/models/auto/feature_extraction_auto.js"),n=r("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=s.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,r)=>{r.r(t),r.d(t,{Wav2Vec2ProcessorWithLM:()=>a});var s=r("./src/tokenizers.js"),o=r("./src/models/auto/feature_extraction_auto.js"),n=r("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=s.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,r)=>{r.r(t),r.d(t,{WeSpeakerFeatureExtractor:()=>n});var s=r("./src/base/feature_extraction_utils.js");r("./src/utils/tensor.js");var o=r("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(e){super(e);let t=this.config.sampling_rate,r=(0,o.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);this.mel_filters=r,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:1192092955078125e-22,remove_dc_offset:!0,transpose:!0,min_num_frames:this.min_num_frames})}async _call(e){(0,s.validate_audio_inputs)(e,"WeSpeakerFeatureExtractor");let t=(await this._extract_fbank_features(e)).unsqueeze_(0);if(null===this.config.fbank_centering_span){let e=t.mean(1).data,r=t.data,[s,o,n]=t.dims;for(let t=0;t<s;++t){let s=t*o*n,a=t*n;for(let t=0;t<o;++t){let o=s+t*n;for(let t=0;t<n;++t)r[o+t]-=e[a+t]}}}return{input_features:t}}}},"./src/models/whisper/common_whisper.js":(e,t,r)=>{r.r(t),r.d(t,{WHISPER_LANGUAGE_MAPPING:()=>o,WHISPER_TO_LANGUAGE_CODE_MAPPING:()=>n,whisper_language_to_code:()=>a});let s=[["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(s),n=new Map([...s.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){let r=e.match(/^<\|([a-z]{2})\|>$/);if(r&&(e=r[1]),o.has(e))t=e;else{let t=2===e.length?o.keys():o.values();throw Error(`Language "${e}" is not supported. Must be one of: ${JSON.stringify(Array.from(t))}`)}}return t}},"./src/models/whisper/feature_extraction_whisper.js":(e,t,r)=>{r.r(t),r.d(t,{WhisperFeatureExtractor:()=>a});var s=r("./src/base/feature_extraction_utils.js");r("./src/utils/tensor.js");var o=r("./src/utils/audio.js"),n=r("./src/utils/maths.js");class a extends s.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){let 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)}),r=t.data,s=(0,n.max)(r)[0];for(let e=0;e<r.length;++e)r[e]=(Math.max(r[e],s-8)+4)/4;return t}async _call(e,{max_length:t=null}={}){let r;(0,s.validate_audio_inputs)(e,"WhisperFeatureExtractor");let o=t??this.config.n_samples;return e.length>o?(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`."),r=e.slice(0,o)):(r=new Float32Array(o)).set(e),{input_features:(await this._extract_fbank_features(r)).unsqueeze_(0)}}}},"./src/models/whisper/generation_whisper.js":(e,t,r)=>{r.r(t),r.d(t,{WhisperGenerationConfig:()=>o});var s=r("./src/generation/configuration_utils.js");class o extends s.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,r)=>{r.r(t),r.d(t,{WhisperProcessor:()=>a});var s=r("./src/models/auto/feature_extraction_auto.js"),o=r("./src/tokenizers.js"),n=r("./src/base/processing_utils.js");class a extends n.Processor{static tokenizer_class=o.AutoTokenizer;static feature_extractor_class=s.AutoFeatureExtractor;async _call(e){return await this.feature_extractor(e)}}},"./src/models/yolos/image_processing_yolos.js":(e,t,r)=>{r.r(t),r.d(t,{YolosFeatureExtractor:()=>n,YolosImageProcessor:()=>o});var s=r("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...e){return(0,s.post_process_object_detection)(...e)}}class n extends o{}},"./src/ops/registry.js":(e,t,r)=>{r.r(t),r.d(t,{TensorOpRegistry:()=>l});var s=r("./src/backends/onnx.js"),o=r("./src/utils/tensor.js"),n=r("./src/env.js");let a=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV,i=async(e,t,r)=>{let n=await (0,s.createInferenceSession)(new Uint8Array(e),t),i=Promise.resolve();return async e=>{let t=(0,s.isONNXProxy)(),l=Object.fromEntries(Object.entries(e).map(([e,r])=>[e,(t?r.clone():r).ort_tensor])),c=await (i=a?i.then(()=>n.run(l)):n.run(l));return Array.isArray(r)?r.map(e=>new o.Tensor(c[e])):new o.Tensor(c[r])}};class l{static session_options={};static get nearest_interpolate_4d(){return this._nearest_interpolate_4d||(this._nearest_interpolate_4d=i([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=i([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=i([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=i([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=i([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=i([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=i([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=i([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,r)=>{r.r(t),r.d(t,{AudioClassificationPipeline:()=>C,AutomaticSpeechRecognitionPipeline:()=>E,BackgroundRemovalPipeline:()=>z,DepthEstimationPipeline:()=>G,DocumentQuestionAnsweringPipeline:()=>V,FeatureExtractionPipeline:()=>F,FillMaskPipeline:()=>w,ImageClassificationPipeline:()=>L,ImageFeatureExtractionPipeline:()=>v,ImageSegmentationPipeline:()=>I,ImageToImagePipeline:()=>B,ImageToTextPipeline:()=>A,ObjectDetectionPipeline:()=>D,Pipeline:()=>h,QuestionAnsweringPipeline:()=>M,SummarizationPipeline:()=>b,Text2TextGenerationPipeline:()=>x,TextClassificationPipeline:()=>g,TextGenerationPipeline:()=>y,TextToAudioPipeline:()=>N,TokenClassificationPipeline:()=>f,TranslationPipeline:()=>T,ZeroShotAudioClassificationPipeline:()=>S,ZeroShotClassificationPipeline:()=>k,ZeroShotImageClassificationPipeline:()=>j,ZeroShotObjectDetectionPipeline:()=>O,pipeline:()=>$});var s=r("./src/tokenizers.js"),o=r("./src/models.js"),n=r("./src/models/auto/processing_auto.js");r("./src/base/processing_utils.js");var a=r("./src/utils/generic.js"),i=r("./src/utils/core.js"),l=r("./src/utils/maths.js"),c=r("./src/utils/audio.js"),d=r("./src/utils/tensor.js"),u=r("./src/utils/image.js");async function m(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 _(e,t){t&&(e=e.map(e=>0|e));let[r,s,o,n]=e;return{xmin:r,ymin:s,xmax:o,ymax:n}}class h extends a.Callable{constructor({task:e,model:t,tokenizer:r=null,processor:s=null}){super(),this.task=e,this.model=t,this.tokenizer=r,this.processor=s}async dispose(){await this.model.dispose()}}class g extends h{constructor(e){super(e)}async _call(e,{top_k:t=1}={}){let r=this.tokenizer(e,{padding:!0,truncation:!0}),s=await this.model(r),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(let e of s.logits){let r=o(e),s=await (0,d.topk)(r,t),i=s[0].tolist(),l=s[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 f extends h{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){let r=Array.isArray(e),s=this.tokenizer(r?e:[e],{padding:!0,truncation:!0}),o=(await this.model(s)).logits,n=this.model.config.id2label,a=[];for(let e=0;e<o.dims[0];++e){let r=s.input_ids[e],i=o[e],c=[];for(let e=0;e<i.dims[0];++e){let s=i[e],o=(0,l.max)(s.data)[1],a=n?n[o]:`LABEL_${o}`;if(t.includes(a))continue;let d=this.tokenizer.decode([r[e].item()],{skip_special_tokens:!0});if(""===d)continue;let u=(0,l.softmax)(s.data);c.push({entity:a,score:u[o],index:e,word:d})}a.push(c)}return r?a:a[0]}}class M extends h{constructor(e){super(e)}async _call(e,t,{top_k:r=1}={}){let s=this.tokenizer(e,{text_pair:t,padding:!0,truncation:!0}),{start_logits:o,end_logits:n}=await this.model(s),a=s.input_ids.tolist(),c=s.attention_mask.tolist(),d=this.tokenizer.all_special_ids,u=[];for(let e=0;e<o.dims[0];++e){let t=a[e],s=t.findIndex(e=>e==this.tokenizer.sep_token_id);c[e].map((e,r)=>1==e&&(0===r||r>s&&-1===d.findIndex(e=>e==t[r])));let m=o[e].tolist(),p=n[e].tolist();for(let r=1;r<m.length;++r)(0==c[e]||r<=s||-1!==d.findIndex(e=>e==t[r]))&&(m[r]=-1/0,p[r]=-1/0);let _=(0,l.softmax)(m).map((e,t)=>[e,t]),h=(0,l.softmax)(p).map((e,t)=>[e,t]);_[0][0]=0,h[0][0]=0;let g=(0,i.product)(_,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;e<Math.min(g.length,r);++e){let[r,s,o]=g[e],n=t.slice(r,s+1),a=this.tokenizer.decode(n,{skip_special_tokens:!0});u.push({answer:a,score:o})}}return 1===r?u[0]:u}}class w extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){let r=this.tokenizer(e,{padding:!0,truncation:!0}),{logits:s}=await this.model(r),o=[],n=r.input_ids.tolist();for(let e=0;e<n.length;++e){let r=n[e],a=r.findIndex(e=>e==this.tokenizer.mask_token_id);if(-1===a)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);let i=s[e][a],c=await (0,d.topk)(new d.Tensor("float32",(0,l.softmax)(i.data),i.dims),t),u=c[0].tolist(),m=c[1].tolist();o.push(m.map((e,t)=>{let s=r.slice();return s[a]=e,{score:u[t],token:Number(e),token_str:this.tokenizer.decode([e]),sequence:this.tokenizer.decode(s,{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={}){let r;Array.isArray(e)||(e=[e]),this.model.config.prefix&&(e=e.map(e=>this.model.config.prefix+e));let s=this.model.config.task_specific_params;s&&s[this.task]&&s[this.task].prefix&&(e=e.map(e=>s[this.task].prefix+e));let o=this.tokenizer,n={padding:!0,truncation:!0};r=this instanceof T&&"_build_translation_inputs"in o?o._build_translation_inputs(e,n,t):o(e,n);let a=await this.model.generate({...r,...t});return o.batch_decode(a,{skip_special_tokens:!0}).map(e=>({[this._key]:e}))}}class b extends x{_key="summary_text";constructor(e){super(e)}}class T extends x{_key="translation_text";constructor(e){super(e)}}function P(e){return Array.isArray(e)&&e.every(e=>"role"in e&&"content"in e)}class y extends h{constructor(e){super(e)}async _call(e,t={}){let r,s,o=!1,n=!1;if("string"==typeof e)r=e=[e];else if(Array.isArray(e)&&e.every(e=>"string"==typeof e))o=!0,r=e;else{if(P(e))e=[e];else if(Array.isArray(e)&&e.every(P))o=!0;else throw Error("Input must be a string, an array of strings, a Chat, or an array of Chats");n=!0,r=e.map(e=>this.tokenizer.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0}))}let a=t.add_special_tokens??!1,i=!n&&(t.return_full_text??!0);this.tokenizer.padding_side="left";let l=this.tokenizer(r,{add_special_tokens:a,padding:!0,truncation:!0}),c=await this.model.generate({...l,...t}),d=this.tokenizer.batch_decode(c,{skip_special_tokens:!0});!i&&l.input_ids.dims.at(-1)>0&&(s=this.tokenizer.batch_decode(l.input_ids,{skip_special_tokens:!0}).map(e=>e.length));let u=Array.from({length:e.length},e=>[]);for(let t=0;t<d.length;++t){let r=Math.floor(t/c.dims[0]*e.length);s&&(d[t]=d[t].slice(s[r])),u[r].push({generated_text:n?[...e[r],{role:"assistant",content:d[t]}]:d[t]})}return o||1!==u.length?u:u[0]}}class k extends h{constructor(e){super(e),this.label2id=Object.fromEntries(Object.entries(this.model.config.label2id).map(([e,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:r="This example is {}.",multi_label:s=!1}={}){let o=Array.isArray(e);o||(e=[e]),Array.isArray(t)||(t=[t]);let n=t.map(e=>r.replace("{}",e)),a=s||1===t.length,i=[];for(let r of e){let e=[];for(let t of n){let s=this.tokenizer(r,{text_pair:t,padding:!0,truncation:!0}),o=await this.model(s);a?e.push([o.logits.data[this.contradiction_id],o.logits.data[this.entailment_id]]):e.push(o.logits.data[this.entailment_id])}let s=(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:r,labels:s.map(e=>t[e[1]]),scores:s.map(e=>e[0])})}return o?i:i[0]}}class F extends h{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:r=!1,quantize:s=!1,precision:o="binary"}={}){let n=this.tokenizer(e,{padding:!0,truncation:!0}),a=await this.model(n),i=a.last_hidden_state??a.logits??a.token_embeddings;if("none"===t);else if("mean"===t)i=(0,d.mean_pooling)(i,n.attention_mask);else if("cls"===t)i=i.slice(null,0);else throw Error(`Pooling method '${t}' not supported.`);return r&&(i=i.normalize(2,-1)),s&&(i=(0,d.quantize_embeddings)(i,o)),i}}class v extends h{constructor(e){super(e)}async _call(e,{pool:t=null}={}){let r,s=await m(e),{pixel_values:o}=await this.processor(s),n=await this.model({pixel_values:o});if(t){if(!("pooler_output"in n))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");r=n.pooler_output}else r=n.last_hidden_state??n.logits??n.image_embeds;return r}}class C extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){let r=this.processor.feature_extractor.config.sampling_rate,s=await p(e,r),o=this.model.config.id2label,n=[];for(let e of s){let r=await this.processor(e),s=(await this.model(r)).logits[0],a=await (0,d.topk)(new d.Tensor("float32",(0,l.softmax)(s.data),s.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:r="This is a sound of {}."}={}){let s=!Array.isArray(e);s&&(e=[e]);let o=t.map(e=>r.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(let e of i){let r=await this.processor(e),s=await this.model({...n,...r}),o=(0,l.softmax)(s.logits_per_audio.data);c.push([...o].map((e,r)=>({score:e,label:t[r]})))}return s?c[0]:c}}class E 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":return this._call_wav2vec2(e,t);case"moonshine":return this._call_moonshine(e,t);default:throw 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".');let r=!Array.isArray(e);r&&(e=[e]);let s=this.processor.feature_extractor.config.sampling_rate,o=await p(e,s),n=[];for(let e of o){let t=await this.processor(e),r=(await this.model(t)).logits[0],s=[];for(let e of r)s.push((0,l.max)(e.data)[1]);let o=this.tokenizer.decode(s);n.push({text:o})}return r?n[0]:n}async _call_whisper(e,t){let r=t.return_timestamps??!1,s=t.chunk_length_s??0,o=t.force_full_sequences??!1,n=t.stride_length_s??null,a={...t};"word"===r&&(a.return_token_timestamps=!0,a.return_timestamps=!1);let i=!Array.isArray(e);i&&(e=[e]);let 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,m=await p(e,u),_=[];for(let e of m){let t=[];if(s>0){if(null===n)n=s/6;else if(s<=n)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");let r=u*s,o=u*n,a=r-2*o,i=0;for(;;){let s=i+r,n=e.subarray(i,s),l=await this.processor(n),c=0===i,d=s>=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(let e of t){a.num_frames=Math.floor(e.stride[0]/d);let t=await this.model.generate({inputs:e.input_features,...a});"word"===r?(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)}let[i,m]=this.tokenizer._decode_asr(t,{time_precision:c,return_timestamps:r,force_full_sequences:o});_.push({text:i,...m})}return i?_[0]:_}async _call_moonshine(e,t){let r=!Array.isArray(e);r&&(e=[e]);let s=this.processor.feature_extractor.config.sampling_rate,o=await p(e,s),n=[];for(let e of o){let r=await this.processor(e),o=6*Math.floor(e.length/s),a=await this.model.generate({max_new_tokens:o,...t,...r}),i=this.processor.batch_decode(a,{skip_special_tokens:!0})[0];n.push({text:i})}return r?n[0]:n}}class A extends h{constructor(e){super(e)}async _call(e,t={}){let r=Array.isArray(e),s=await m(e),{pixel_values:o}=await this.processor(s),n=[];for(let e of o){e.dims=[1,...e.dims];let r=await this.model.generate({inputs:e,...t}),s=this.tokenizer.batch_decode(r,{skip_special_tokens:!0}).map(e=>({generated_text:e.trim()}));n.push(s)}return r?n:n[0]}}class L extends h{constructor(e){super(e)}async _call(e,{top_k:t=5}={}){let r=await m(e),{pixel_values:s}=await this.processor(r),o=await this.model({pixel_values:s}),n=this.model.config.id2label,a=[];for(let e of o.logits){let r=await (0,d.topk)(new d.Tensor("float32",(0,l.softmax)(e.data),e.dims),t),s=r[0].tolist(),o=r[1].tolist().map((e,t)=>({label:n?n[e]:`LABEL_${e}`,score:s[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:r=.5,overlap_mask_area_threshold:s=.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.");let i=await m(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}.`);let e=d[0];if(e in c)throw Error(`Input name ${e} already exists in the inputs.`);c[e]=c.pixel_values}let _=await this.model(c),h=null;if(null!==a)h=this.subtasks_mapping[a];else if(this.processor.image_processor){for(let[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}}let g=this.model.config.id2label,f=[];if(a)if("panoptic"===a||"instance"===a){let e=h(_,t,r,s,o,n??l)[0],a=e.segmentation;for(let t of e.segments_info){let e=new Uint8ClampedArray(a.data.length);for(let r=0;r<a.data.length;++r)a.data[r]===t.id&&(e[r]=255);let r=new u.RawImage(e,a.dims[1],a.dims[0],1);f.push({score:t.score,label:g[t.label_id],mask:r})}}else if("semantic"===a){let{segmentation:e,labels:t}=h(_,n??l)[0];for(let r of t){let t=new Uint8ClampedArray(e.data.length);for(let s=0;s<e.data.length;++s)e.data[s]===r&&(t[s]=255);let s=new u.RawImage(t,e.dims[1],e.dims[0],1);f.push({score:null,label:g[r],mask:s})}}else throw Error(`Subtask ${a} not supported.`);else{let e=_[p[0]];for(let t=0;t<l.length;++t){let r=l[t],s=e[t];s.data.some(e=>e<-1e-5||e>1.00001)&&s.sigmoid_();let o=await u.RawImage.fromTensor(s.mul_(255).to("uint8")).resize(r[1],r[0]);f.push({label:null,score:null,mask:o})}}return f}}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.");let r=await m(e),s=await super._call(e,t);return r.map((e,t)=>{let r=e.clone();return r.putAlpha(s[t].mask),r})}}class j extends h{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a photo of {}"}={}){let s=Array.isArray(e),o=await m(e),n=t.map(e=>r.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(let e of c.logits_per_image){let r=[...d(e)].map((e,r)=>({score:e,label:t[r]}));r.sort((e,t)=>t.score-e.score),u.push(r)}return s?u:u[0]}}class D extends h{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:r=!1}={}){let s=Array.isArray(e);if(s&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");let o=await m(e),n=r?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,s)=>({score:e.scores[s],label:d[e.classes[s]],box:_(t,!r)})));return s?u:u[0]}}class O extends h{constructor(e){super(e)}async _call(e,t,{threshold:r=.1,top_k:s=null,percentage:o=!1}={}){let n=Array.isArray(e),a=await m(e),i=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(a),c=[];for(let e=0;e<a.length;++e){let n,d=a[e],u=o?null:[[d.height,d.width]],m=l.pixel_values[e].unsqueeze_(0),p=await this.model({...i,pixel_values:m});if("post_process_grounded_object_detection"in this.processor){let e=this.processor.post_process_grounded_object_detection(p,i.input_ids,{box_threshold:r,text_threshold:r,target_sizes:u})[0];n=e.boxes.map((t,r)=>({score:e.scores[r],label:e.labels[r],box:_(t,!o)}))}else{let e=this.processor.image_processor.post_process_object_detection(p,r,u,!0)[0];n=e.boxes.map((r,s)=>({score:e.scores[s],label:t[e.classes[s]],box:_(r,!o)}))}n.sort((e,t)=>t.score-e.score),null!==s&&(n=n.slice(0,s)),c.push(n)}return n?c:c[0]}}class V extends h{constructor(e){super(e)}async _call(e,t,r={}){let s=(await m(e))[0],{pixel_values:o}=await this.processor(s),n=`<s_docvqa><s_question>${t}</s_question><s_answer>`,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,...r}),l=this.tokenizer.batch_decode(i)[0].match(/<s_answer>(.*?)<\/s_answer>/),c=null;return l&&l.length>=2&&(c=l[1].trim()),[{answer:c}]}}class N extends h{DEFAULT_VOCODER_ID="Xenova/speecht5_hifigan";constructor(e){super(e),this.vocoder=e.vocoder??null}async _call(e,{speaker_embeddings:t=null}={}){return this.processor?this._call_text_to_spectrogram(e,{speaker_embeddings:t}):this._call_text_to_waveform(e)}async _call_text_to_waveform(e){let t=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:r}=await this.model(t),s=this.model.config.sampling_rate;return new c.RawAudio(r.data,s)}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await o.AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{dtype:"fp32"})),("string"==typeof t||t instanceof URL)&&(t=new Float32Array(await (await fetch(t)).arrayBuffer())),t instanceof Float32Array)t=new d.Tensor("float32",t,[1,t.length]);else if(!(t instanceof d.Tensor))throw Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");let{input_ids:r}=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:s}=await this.model.generate_speech(r,t,{vocoder:this.vocoder}),n=this.processor.feature_extractor.config.sampling_rate;return new c.RawAudio(s.data,n)}}class B extends h{constructor(e){super(e)}async _call(e){let t=await m(e),r=await this.processor(t),s=await this.model(r),o=[];for(let e of s.reconstruction){let 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){let t=await m(e),r=await this.processor(t),{predicted_depth:s}=await this.model(r),o=[];for(let e=0;e<t.length;++e){let r=s[e],[n,a]=r.dims.slice(-2),[i,l]=t[e].size,c=(await (0,d.interpolate_4d)(r.view(1,1,n,a),{size:[l,i],mode:"bilinear"})).view(l,i),m=c.min().item(),p=c.max().item(),_=c.sub(m).div_(p-m).mul_(255).to("uint8").unsqueeze(0),h=u.RawImage.fromTensor(_);o.push({predicted_depth:c,depth:h})}return o.length>1?o:o[0]}}let R=Object.freeze({"text-classification":{tokenizer:s.AutoTokenizer,pipeline:g,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:s.AutoTokenizer,pipeline:f,model:o.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:s.AutoTokenizer,pipeline:M,model:o.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:s.AutoTokenizer,pipeline:w,model:o.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:s.AutoTokenizer,pipeline:b,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:s.AutoTokenizer,pipeline:T,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:s.AutoTokenizer,pipeline:x,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:s.AutoTokenizer,pipeline:y,model:o.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:s.AutoTokenizer,pipeline:k,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:s.AutoTokenizer,pipeline:S,model:o.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:s.AutoTokenizer,pipeline:E,model:[o.AutoModelForSpeechSeq2Seq,o.AutoModelForCTC],processor:n.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:s.AutoTokenizer,pipeline:N,model:[o.AutoModelForTextToWaveform,o.AutoModelForTextToSpectrogram],processor:[n.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:s.AutoTokenizer,pipeline:A,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:s.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:s.AutoTokenizer,pipeline:O,model:o.AutoModelForZeroShotObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:s.AutoTokenizer,pipeline:V,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:s.AutoTokenizer,pipeline:F,model:o.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:n.AutoProcessor,pipeline:v,model:[o.AutoModelForImageFeatureExtraction,o.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),q=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function $(e,t=null,{progress_callback:r=null,config:s=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:m=null,session_options:p={}}={}){let _=R[(e=q[e]??e).split("_",1)[0]];if(!_)throw Error(`Unsupported pipeline: ${e}. Must be one of [${Object.keys(R)}]`);t||(t=_.default.model,console.log(`No model specified. Using default model: "${t}".`));let h=new Map([["tokenizer",_.tokenizer],["model",_.model],["processor",_.processor]]),g=await W(h,t,{progress_callback:r,config:s,cache_dir:o,local_files_only:n,revision:a,device:l,dtype:c,subfolder:d,use_external_data_format:u,model_file_name:m,session_options:p});return g.task=e,(0,i.dispatchCallback)(r,{status:"ready",task:e,model:t}),new _.pipeline(g)}async function W(e,t,r){let s=Object.create(null),o=[];for(let[n,a]of e.entries()){let e;a&&(e=Array.isArray(a)?new Promise(async(e,s)=>{let o;for(let n of a){if(null===n)return void e(null);try{e(await n.from_pretrained(t,r));return}catch(e){if(e.message?.includes("Unsupported model type"))o=e;else{if(!e.message?.includes("Could not locate file"))return void s(e);o=e}}}s(o)}):a.from_pretrained(t,r),s[n]=e,o.push(e))}for(let[e,t]of(await Promise.all(o),Object.entries(s)))s[e]=await t;return s}},"./src/tokenizers.js":(e,t,r)=>{r.r(t),r.d(t,{AlbertTokenizer:()=>eT,AutoTokenizer:()=>ts,BartTokenizer:()=>eD,BertTokenizer:()=>eb,BlenderbotSmallTokenizer:()=>e6,BlenderbotTokenizer:()=>e5,BloomTokenizer:()=>eB,CLIPTokenizer:()=>e2,CamembertTokenizer:()=>eA,CodeGenTokenizer:()=>e1,CodeLlamaTokenizer:()=>eR,CohereTokenizer:()=>tt,ConvBertTokenizer:()=>eC,DebertaTokenizer:()=>ek,DebertaV2Tokenizer:()=>eF,DistilBertTokenizer:()=>eE,ElectraTokenizer:()=>eI,EsmTokenizer:()=>eQ,FalconTokenizer:()=>eW,GPT2Tokenizer:()=>ej,GPTNeoXTokenizer:()=>eU,GemmaTokenizer:()=>eH,Grok1Tokenizer:()=>eJ,HerbertTokenizer:()=>ev,LlamaTokenizer:()=>eG,M2M100Tokenizer:()=>eZ,MBart50Tokenizer:()=>eV,MBartTokenizer:()=>eO,MPNetTokenizer:()=>e$,MarianTokenizer:()=>e4,MgpstrTokenizer:()=>tr,MobileBertTokenizer:()=>eP,NllbTokenizer:()=>eK,NougatTokenizer:()=>e7,PreTrainedTokenizer:()=>ex,Qwen2Tokenizer:()=>eX,RoFormerTokenizer:()=>eS,RobertaTokenizer:()=>eN,SiglipTokenizer:()=>e3,SpeechT5Tokenizer:()=>e9,SqueezeBertTokenizer:()=>ey,T5Tokenizer:()=>ez,TokenizerModel:()=>P,VitsTokenizer:()=>te,Wav2Vec2CTCTokenizer:()=>e8,WhisperTokenizer:()=>e0,XLMRobertaTokenizer:()=>eq,XLMTokenizer:()=>eL,is_chinese_char:()=>f});var s=r("./src/utils/generic.js"),o=r("./src/utils/core.js"),n=r("./src/utils/hub.js"),a=r("./src/utils/maths.js"),i=r("./src/utils/tensor.js"),l=r("./src/utils/data-structures.js"),c=r("./node_modules/@huggingface/jinja/dist/index.js"),d=r("./src/models/whisper/common_whisper.js");async function u(e,t){let r=await Promise.all([(0,n.getModelJSON)(e,"tokenizer.json",!0,t),(0,n.getModelJSON)(e,"tokenizer_config.json",!0,t)]);return null!==t.legacy&&(r[1].legacy=t.legacy),r}function m(e,t=!0){if(void 0!==e.Regex){let t=e.Regex.replace(/\\([#&~])/g,"$1");for(let[e,r]of b)t=t.replaceAll(e,r);return RegExp(t,"gu")}if(void 0===e.String)return console.warn("Unknown pattern type:",e),null;{let r=(0,o.escapeRegExp)(e.String);return RegExp(t?r:`(${r})`,"gu")}}function p(e){return new Map(Object.entries(e))}function _(e){let t=e.dims;switch(t.length){case 1:return e.tolist();case 2:if(1!==t[0])throw Error("Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.");return e.tolist()[0];default:throw 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 g(e){return e.replace(/\p{M}/gu,"")}function f(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}let M="\\p{P}\\u0021-\\u002F\\u003A-\\u0040\\u005B-\\u0060\\u007B-\\u007E",w=RegExp(`^[${M}]+$`,"gu"),x=".,!?…。,、।۔،",b=new Map([["(?i:'s|'t|'re|'ve|'m|'ll|'d)","(?:'([sS]|[tT]|[rR][eE]|[vV][eE]|[mM]|[lL][lL]|[dD]))"],[` ?[^(\\s|[${x}])]+`,` ?[^\\s${x}]+`]]);class T{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 P extends s.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 y(e);case"Unigram":return new k(e,...t);case"BPE":return new C(e);default:if(e.vocab)if(Array.isArray(e.vocab))return new k(e,...t);else if("object"==typeof e.vocab&&e.continuing_subword_prefix&&e.unk_token)return new y(e);else return new S(e,...t);throw Error(`Unknown TokenizerModel type: ${e.type}`)}}_call(e){return e=this.encode(e),this.fuse_unk&&(e=function(e,t,r){let s=[],o=0;for(;o<e.length;){if(s.push(e[o]),(t.get(e[o])??r)!==r){++o;continue}for(;++o<e.length&&(t.get(e[o])??r)===r;)t.get(s.at(-1))!==r&&(s[s.length-1]+=e[o])}return s}(e,this.tokens_to_ids,this.unk_token_id)),e}encode(e){throw Error("encode should be implemented in subclass.")}convert_tokens_to_ids(e){return e.map(e=>this.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 y extends P{constructor(e){for(let[t,r]of(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=Array(this.tokens_to_ids.size),this.tokens_to_ids))this.vocab[r]=t}encode(e){let t=[];for(let r of e){let e=[...r];if(e.length>this.max_input_chars_per_word){t.push(this.unk_token);continue}let s=!1,o=0,n=[];for(;o<e.length;){let t=e.length,r=null;for(;o<t;){let s=e.slice(o,t).join("");if(o>0&&(s=this.config.continuing_subword_prefix+s),this.tokens_to_ids.has(s)){r=s;break}--t}if(null===r){s=!0;break}n.push(r),o=t}s?t.push(this.unk_token):t.push(...n)}return t}}class k extends P{constructor(e,t){super(e);let r=e.vocab.length;this.vocab=Array(r),this.scores=Array(r);for(let t=0;t<r;++t)[this.vocab[t],this.scores[t]]=e.vocab[t];this.unk_token_id=e.unk_id,this.unk_token=this.vocab[e.unk_id],this.tokens_to_ids=new Map(this.vocab.map((e,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){let t=e.chars,r=0;for(;r<t.length;){let s=!1,n=[],a=t.slice(r).join("");for(let t of this.trie.commonPrefixSearch(a)){n.push(t);let a=this.tokens_to_ids.get(t),i=this.scores[a],l=(0,o.len)(t);e.insert(r,l,i,a),s||1!==l||(s=!0)}s||e.insert(r,1,this.unk_score,this.unk_token_id),r+=1}}tokenize(e){let t=new l.TokenLattice(e,this.bos_token_id,this.eos_token_id);return this.populateNodes(t),t.tokens()}encode(e){let t=[];for(let r of e){let e=this.tokenize(r);t.push(...e)}return t}}let F=(()=>{let e=[...Array.from({length:94},(e,t)=>t+33),...Array.from({length:12},(e,t)=>t+161),...Array.from({length:82},(e,t)=>t+174)],t=e.slice(),r=0;for(let s=0;s<256;++s)e.includes(s)||(e.push(s),t.push(256+r),r+=1);let s=t.map(e=>String.fromCharCode(e));return Object.fromEntries(e.map((e,t)=>[e,s[t]]))})(),v=(0,o.reverseDictionary)(F);class C extends P{constructor(e){for(let[t,r]of(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=Array(this.tokens_to_ids.size),this.tokens_to_ids))this.vocab[r]=t;let 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[];let t=this.cache.get(e);if(void 0!==t)return t;let r=Array.from(e);this.end_of_word_suffix&&(r[r.length-1]+=this.end_of_word_suffix);let s=[];if(r.length>1){let e=new l.PriorityQueue((e,t)=>e.score<t.score),t={token:r[0],bias:0,prev:null,next:null},o=t;for(let t=1;t<r.length;++t){let s={bias:t/r.length,token:r[t],prev:o,next:null};o.next=s,this._add_node(e,o),o=s}for(;!e.isEmpty();){let r=e.pop();if(r.deleted||!r.next||r.next.deleted)continue;if(r.deleted=!0,r.next.deleted=!0,r.prev){let e={...r.prev};r.prev.deleted=!0,r.prev=e,e.prev?e.prev.next=e:t=e}let s={token:r.token+r.next.token,bias:r.bias,prev:r.prev,next:r.next.next};s.prev?(s.prev.next=s,this._add_node(e,s.prev)):t=s,s.next&&(s.next.prev=s,this._add_node(e,s))}for(let e=t;null!==e;e=e.next)s.push(e.token)}else s=r;if(this.continuing_subword_suffix)for(let e=0;e<s.length-1;++e)s[e]+=this.continuing_subword_suffix;return e.length<this.max_length_to_cache&&this.cache.put(e,s),s}_add_node(e,t){let r=this.bpe_ranks.get(JSON.stringify([t.token,t.next.token]));void 0!==r&&(t.score=r+t.bias,e.push(t))}encode(e){let t=[];for(let r of e){if(this.ignore_merges&&this.tokens_to_ids.has(r)){t.push(r);continue}for(let e of this.bpe(r))if(this.tokens_to_ids.has(e))t.push(e);else if(this.byte_fallback){let r=Array.from(this.text_encoder.encode(e)).map(e=>`<0x${e.toString(16).toUpperCase().padStart(2,"0")}>`);r.every(e=>this.tokens_to_ids.has(e))?t.push(...r):t.push(this.unk_token)}else t.push(this.unk_token)}return t}}class S extends P{constructor(e,t){for(let[r,s]of(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=Array(this.tokens_to_ids.size),this.tokens_to_ids))this.vocab[s]=r}encode(e){return e}}class E extends s.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"BertNormalizer":return new R(e);case"Precompiled":return new e_(e);case"Sequence":return new G(e);case"Replace":return new A(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 V(e);case"Lowercase":return new N(e);case"Prepend":return new B(e);default:throw Error(`Unknown Normalizer type: ${e.type}`)}}normalize(e){throw Error("normalize should be implemented in subclass.")}_call(e){return this.normalize(e)}}class A extends E{normalize(e){let t=m(this.config.pattern);return null===t?e:e.replaceAll(t,this.config.content)}}class L extends E{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 E{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 V extends E{normalize(e){return e=g(e)}}class N extends E{normalize(e){return e=e.toLowerCase()}}class B extends E{normalize(e){return e=this.config.prepend+e}}class G extends E{constructor(e){super(e),this.normalizers=e.normalizers.map(e=>E.fromConfig(e))}normalize(e){return this.normalizers.reduce((e,t)=>t.normalize(e),e)}}class R extends E{_tokenize_chinese_chars(e){let t=[];for(let r=0;r<e.length;++r){let s=e[r];f(s.charCodeAt(0))?(t.push(" "),t.push(s),t.push(" ")):t.push(s)}return t.join("")}stripAccents(e){return e.normalize("NFD").replace(/\p{Mn}/gu,"")}_is_control(e){switch(e){case" ":case"\n":case"\r":return!1;default:return/^\p{Cc}|\p{Cf}|\p{Co}|\p{Cs}$/u.test(e)}}_clean_text(e){let t=[];for(let r of e){let e=r.charCodeAt(0);0===e||65533===e||this._is_control(r)||(/^\s$/.test(r)?t.push(" "):t.push(r))}return t.join("")}normalize(e){return this.config.clean_text&&(e=this._clean_text(e)),this.config.handle_chinese_chars&&(e=this._tokenize_chinese_chars(e)),this.config.lowercase?(e=e.toLowerCase(),!1!==this.config.strip_accents&&(e=this.stripAccents(e))):this.config.strip_accents&&(e=this.stripAccents(e)),e}}class q extends s.Callable{static fromConfig(e){if(null===e)return null;switch(e.type){case"BertPreTokenizer":return new $(e);case"Sequence":return new eh(e);case"Whitespace":return new eg(e);case"WhitespaceSplit":return new ef(e);case"Metaspace":return new em(e);case"ByteLevel":return new W(e);case"Split":return new U(e);case"Punctuation":return new Q(e);case"Digits":return new X(e);case"Replace":return new eM(e);default:throw Error(`Unknown PreTokenizer type: ${e.type}`)}}pre_tokenize_text(e,t){throw Error("pre_tokenize_text should be implemented in subclass.")}pre_tokenize(e,t){return(Array.isArray(e)?e.map(e=>this.pre_tokenize_text(e,t)):this.pre_tokenize_text(e,t)).flat()}_call(e,t){return this.pre_tokenize(e,t)}}class $ extends q{constructor(e){super(),this.pattern=RegExp(`[^\\s${M}]+|[${M}]`,"gu")}pre_tokenize_text(e,t){return e.trim().match(this.pattern)||[]}}class W extends q{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=F,this.text_encoder=new TextEncoder}pre_tokenize_text(e,t){return this.add_prefix_space&&!e.startsWith(" ")&&(e=" "+e),(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 q{constructor(e){super(),this.config=e,this.pattern=m(this.config.pattern,this.config.invert)}pre_tokenize_text(e,t){return null===this.pattern?[]:this.config.invert?e.match(this.pattern)||[]:this.config.behavior?.toLowerCase()==="removed"?e.split(this.pattern).filter(e=>e):function(e,t){let r=[],s=0;for(let o of e.matchAll(t)){let t=o[0];s<o.index&&r.push(e.slice(s,o.index)),t.length>0&&r.push(t),s=o.index+t.length}return s<e.length&&r.push(e.slice(s)),r}(e,this.pattern)}}class Q extends q{constructor(e){super(),this.config=e,this.pattern=RegExp(`[^${M}]+|[${M}]+`,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class X extends q{constructor(e){super(),this.config=e;let t=`[^\\d]+|\\d${this.config.individual_digits?"":"+"}`;this.pattern=RegExp(t,"gu")}pre_tokenize_text(e,t){return e.match(this.pattern)||[]}}class H extends s.Callable{constructor(e){super(),this.config=e}static fromConfig(e){if(null===e)return null;switch(e.type){case"TemplateProcessing":return new K(e);case"ByteLevel":return new Z(e);case"RobertaProcessing":return new Y(e);case"BertProcessing":return new J(e);case"Sequence":return new ee(e);default:throw Error(`Unknown PostProcessor type: ${e.type}`)}}post_process(e,...t){throw Error("post_process should be implemented in subclass.")}_call(e,...t){return this.post_process(e,...t)}}class J extends H{constructor(e){super(e),this.cls=e.cls[0],this.sep=e.sep[0]}post_process(e,t=null,{add_special_tokens:r=!0}={}){r&&(e=(0,o.mergeArrays)([this.cls],e,[this.sep]));let s=Array(e.length).fill(0);if(null!==t){let n=r&&this instanceof Y?[this.sep]:[],a=r?[this.sep]:[];e=(0,o.mergeArrays)(e,n,t,a),s=(0,o.mergeArrays)(s,Array(t.length+n.length+a.length).fill(1))}return{tokens:e,token_type_ids:s}}}class Y extends J{}class K extends H{constructor(e){super(e),this.single=e.single,this.pair=e.pair}post_process(e,t=null,{add_special_tokens:r=!0}={}){let s=null===t?this.single:this.pair,n=[],a=[];for(let i of s)"SpecialToken"in i?r&&(n.push(i.SpecialToken.id),a.push(i.SpecialToken.type_id)):"Sequence"in i&&("A"===i.Sequence.id?(n=(0,o.mergeArrays)(n,e),a=(0,o.mergeArrays)(a,Array(e.length).fill(i.Sequence.type_id))):"B"===i.Sequence.id&&(n=(0,o.mergeArrays)(n,t),a=(0,o.mergeArrays)(a,Array(t.length).fill(i.Sequence.type_id))));return{tokens:n,token_type_ids:a}}}class Z extends H{post_process(e,t=null){return t&&(e=(0,o.mergeArrays)(e,t)),{tokens:e}}}class ee extends H{constructor(e){super(e),this.processors=e.processors.map(e=>H.fromConfig(e))}post_process(e,t=null,r={}){let s;for(let o of this.processors)if(o instanceof Z)e=o.post_process(e).tokens,t&&(t=o.post_process(t).tokens);else{let n=o.post_process(e,t,r);e=n.tokens,s=n.token_type_ids}return{tokens:e,token_type_ids:s}}}class et extends s.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 ea(e);case"Metaspace":return new ep(e);case"ByteLevel":return new ei(e);case"Replace":return new er(e);case"ByteFallback":return new es(e);case"Fuse":return new eo(e);case"Strip":return new en(e);case"Sequence":return new ec(e);case"CTC":return new el(e);case"BPEDecoder":return new ed(e);default:throw 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 er extends et{decode_chain(e){let t=m(this.config.pattern);return null===t?e:e.map(e=>e.replaceAll(t,this.config.content))}}class es extends et{constructor(e){super(e),this.text_decoder=new TextDecoder}decode_chain(e){let t=[],r=[];for(let s of e){let e=null;if(6===s.length&&s.startsWith("<0x")&&s.endsWith(">")){let t=parseInt(s.slice(3,5),16);isNaN(t)||(e=t)}if(null!==e)r.push(e);else{if(r.length>0){let e=this.text_decoder.decode(Uint8Array.from(r));t.push(e),r=[]}t.push(s)}}if(r.length>0){let e=this.text_decoder.decode(Uint8Array.from(r));t.push(e),r=[]}return t}}class eo extends et{decode_chain(e){return[e.join("")]}}class en extends et{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 r=0;r<this.start;++r)if(e[r]===this.content){t=r+1;continue}else break;let r=e.length;for(let t=0;t<this.stop;++t){let s=e.length-t-1;if(e[s]===this.content){r=s;continue}break}return e.slice(t,r)})}}class ea extends et{constructor(e){super(e),this.cleanup=e.cleanup}decode_chain(e){return e.map((e,t)=>(0!==t&&(e=e.startsWith(this.config.prefix)?e.replace(this.config.prefix,""):" "+e),this.cleanup&&(e=h(e)),e))}}class ei extends et{constructor(e){super(e),this.byte_decoder=v,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(e){let t=new Uint8Array([...e.join("")].map(e=>this.byte_decoder[e]));return this.text_decoder.decode(t)}decode_chain(e){let t=[],r=[];for(let s of e)void 0!==this.added_tokens.find(e=>e.content===s)?(r.length>0&&(t.push(this.convert_tokens_to_string(r)),r=[]),t.push(s)):r.push(s);return r.length>0&&t.push(this.convert_tokens_to_string(r)),t}}class el extends et{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"";let t=[e[0]];for(let r=1;r<e.length;++r)e[r]!==t.at(-1)&&t.push(e[r]);let r=t.filter(e=>e!==this.pad_token).join("");return this.cleanup&&(r=h(r).replaceAll(this.word_delimiter_token," ").trim()),r}decode_chain(e){return[this.convert_tokens_to_string(e)]}}class ec extends et{constructor(e){super(e),this.decoders=e.decoders.map(e=>et.fromConfig(e))}decode_chain(e){return this.decoders.reduce((e,t)=>t.decode_chain(e),e)}}class ed extends et{constructor(e){super(e),this.suffix=this.config.suffix}decode_chain(e){return e.map((t,r)=>t.replaceAll(this.suffix,r===e.length-1?"":" "))}}class eu extends et{decode_chain(e){let t="";for(let r=1;r<e.length;r+=2)t+=e[r];return[t]}}class em extends q{constructor(e){super(),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement,this.strRep=e.str_rep||this.replacement,this.prepend_scheme=e.prepend_scheme??"always"}pre_tokenize_text(e,{section_index:t}={}){let r=e.replaceAll(" ",this.strRep);return this.addPrefixSpace&&!r.startsWith(this.replacement)&&("always"===this.prepend_scheme||"first"===this.prepend_scheme&&0===t)&&(r=this.strRep+r),[r]}}class ep extends et{constructor(e){super(e),this.addPrefixSpace=e.add_prefix_space,this.replacement=e.replacement}decode_chain(e){let t=[];for(let r=0;r<e.length;++r){let s=e[r].replaceAll(this.replacement," ");this.addPrefixSpace&&0==r&&s.startsWith(" ")&&(s=s.substring(1)),t.push(s)}return t}}class e_ extends E{constructor(e){super(e),this.charsmap=e.precompiled_charsmap}normalize(e){return e=(e=(e=e.replace(/[\u0001-\u0008\u000B\u000E-\u001F\u007F\u008F\u009F]/gm,"")).replace(/[\u0009\u000A\u000C\u000D\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u2581\u3000\uFEFF\uFFFD]/gm," ")).includes("~")?e.split("~").map(e=>e.normalize("NFKC")).join("~"):e.normalize("NFKC")}}class eh extends q{constructor(e){super(),this.tokenizers=e.pretokenizers.map(e=>q.fromConfig(e))}pre_tokenize_text(e,t){return this.tokenizers.reduce((e,r)=>r.pre_tokenize(e,t),[e])}}class eg extends q{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\w+|[^\w\s]+/g)||[]}}class ef extends q{constructor(e){super()}pre_tokenize_text(e,t){return e.match(/\S+/g)||[]}}class eM extends q{constructor(e){super(),this.config=e,this.pattern=m(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)]}}let ew=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];class ex extends s.Callable{return_token_type_ids=!1;padding_side="right";constructor(e,t){for(let r of(super(),this._tokenizer_config=t,this.normalizer=E.fromConfig(e.normalizer),this.pre_tokenizer=q.fromConfig(e.pre_tokenizer),this.model=P.fromConfig(e.model,t),this.post_processor=H.fromConfig(e.post_processor),this.decoder=et.fromConfig(e.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[],e.added_tokens)){let e=new T(r);this.added_tokens.push(e),this.model.tokens_to_ids.set(e.content,e.id),this.model.vocab[e.id]=e.content,e.special&&(this.special_tokens.push(e.content),this.all_special_ids.push(e.id))}if(this.additional_special_tokens=t.additional_special_tokens??[],this.special_tokens.push(...this.additional_special_tokens),this.special_tokens=[...new Set(this.special_tokens)],this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.added_tokens_splitter=new l.DictionarySplitter(this.added_tokens.map(e=>e.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.legacy=!1,this.chat_template=t.chat_template??null,Array.isArray(this.chat_template)){let e=Object.create(null);for(let{name:t,template:r}of this.chat_template){if("string"!=typeof t||"string"!=typeof r)throw Error('Chat template must be a list of objects with "name" and "template" properties');e[t]=r}this.chat_template=e}this._compiled_template_cache=new Map}getToken(...e){for(let t of e){let e=this._tokenizer_config[t];if(e)if("object"!=typeof e)return e;else if("AddedToken"===e.__type)return e.content;else throw Error(`Unknown token: ${e}`)}return null}static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:s=null,local_files_only:o=!1,revision:n="main",legacy:a=null}={}){return new this(...await u(e,{progress_callback:t,config:r,cache_dir:s,local_files_only:o,revision:n,legacy:a}))}_call(e,{text_pair:t=null,add_special_tokens:r=!0,padding:s=!1,truncation:n=null,max_length:l=null,return_tensor:c=!0,return_token_type_ids:d=null}={}){let u,m=Array.isArray(e);if(m){if(0===e.length)throw Error("text array must be non-empty");if(null!==t){if(Array.isArray(t)){if(e.length!==t.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");u=e.map((e,s)=>this._encode_plus(e,{text_pair:t[s],add_special_tokens:r,return_token_type_ids:d}))}else u=e.map(e=>this._encode_plus(e,{add_special_tokens:r,return_token_type_ids:d}))}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:r,return_token_type_ids:d})]}if(null===l?l=this.model_max_length:null===n&&(!0===s?(console.warn("`max_length` is ignored when `padding: true` and there is no truncation strategy. To pad to max length, use `padding: 'max_length'`."),l=this.model_max_length):!1===s&&(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."),n=!0)),!0===s&&(l=Math.min((0,a.max)(u.map(e=>e.input_ids.length))[0],l??1/0)),l=Math.min(l,this.model_max_length??1/0),s||n)for(let e=0;e<u.length;++e)if(u[e].input_ids.length===l)continue;else u[e].input_ids.length>l?n&&function(e,t){for(let r of Object.keys(e))e[r].length=t}(u[e],l):s&&function(e,t,r,s){for(let n of Object.keys(e)){let a=t-e[n].length,i=r(n),l=Array(a).fill(i);e[n]="right"===s?(0,o.mergeArrays)(e[n],l):(0,o.mergeArrays)(l,e[n])}}(u[e],l,e=>"input_ids"===e?this.pad_token_id:0,this.padding_side);let p={};if(c){if(!(s&&n)&&u.some(e=>{for(let 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.");let e=[u.length,u[0].input_ids.length];for(let t of Object.keys(u[0]))p[t]=new i.Tensor("int64",BigInt64Array.from(u.flatMap(e=>e[t]).map(BigInt)),e)}else{for(let e of Object.keys(u[0]))p[e]=u.map(t=>t[e]);if(!m)for(let e of Object.keys(p))p[e]=p[e][0]}return p}_encode_text(e){if(null===e)return null;let t=this.added_tokens_splitter.split(e);for(let e=0;e<t.length;++e){let r=this.added_tokens_map.get(t[e]);r&&(r.lstrip&&e>0&&(t[e-1]=t[e-1].trimEnd()),r.rstrip&&e<t.length-1&&(t[e+1]=t[e+1].trimStart()))}return t.flatMap((e,t)=>{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=g(e.toLowerCase())),null!==this.normalizer&&(e=this.normalizer(e)),0===e.length)return[];let r=null!==this.pre_tokenizer?this.pre_tokenizer(e,{section_index:t}):[e];return this.model(r)})}_encode_plus(e,{text_pair:t=null,add_special_tokens:r=!0,return_token_type_ids:s=null}={}){let{tokens:o,token_type_ids:n}=this._tokenize_helper(e,{pair:t,add_special_tokens:r}),a=this.model.convert_tokens_to_ids(o),i={input_ids:a,attention_mask:Array(a.length).fill(1)};return(s??this.return_token_type_ids)&&n&&(i.token_type_ids=n),i}_tokenize_helper(e,{pair:t=null,add_special_tokens:r=!1}={}){let s=this._encode_text(e),n=this._encode_text(t);return this.post_processor?this.post_processor(s,n,{add_special_tokens:r}):{tokens:(0,o.mergeArrays)(s??[],n??[])}}tokenize(e,{pair:t=null,add_special_tokens:r=!1}={}){return this._tokenize_helper(e,{pair:t,add_special_tokens:r}).tokens}encode(e,{text_pair:t=null,add_special_tokens:r=!0,return_token_type_ids:s=null}={}){return this._encode_plus(e,{text_pair:t,add_special_tokens:r,return_token_type_ids:s}).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=_(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:r=null}){let s=this.model.convert_ids_to_tokens(e);t&&(s=s.filter(e=>!this.special_tokens.includes(e)));let o=this.decoder?this.decoder(s):s.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(o=o.replaceAll(this.decoder.end_of_word_suffix," "),t&&(o=o.trim())),(r??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){let r=this.chat_template;if(null!==e&&Object.hasOwn(r,e))e=r[e];else if(null===e)if(null!==t&&"tool_use"in r)e=r.tool_use;else if("default"in r)e=r.default;else 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(r).sort()}.`)}else if(null===e)if(this.chat_template)e=this.chat_template;else 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");return e}apply_chat_template(e,{tools:t=null,documents:r=null,chat_template:s=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:m={},...p}={}){if("string"!=typeof(s=this.get_chat_template({chat_template:s,tools:t})))throw Error(`chat_template must be a string, but got ${typeof s}`);let _=this._compiled_template_cache.get(s);void 0===_&&(_=new c.Template(s),this._compiled_template_cache.set(s,_));let h=Object.create(null);for(let e of ew){let t=this.getToken(e);t&&(h[e]=t)}let g=_.render({messages:e,add_generation_prompt:o,tools:t,documents:r,...h,...p});if(n){let e=this._call(g,{add_special_tokens:!1,padding:a,truncation:i,max_length:l,return_tensor:d,...m});return u?e:e.input_ids}return g}}class eb extends ex{return_token_type_ids=!0}class eT extends ex{return_token_type_ids=!0}class eP extends ex{return_token_type_ids=!0}class ey extends ex{return_token_type_ids=!0}class ek extends ex{return_token_type_ids=!0}class eF extends ex{return_token_type_ids=!0}class ev extends ex{return_token_type_ids=!0}class eC extends ex{return_token_type_ids=!0}class eS extends ex{return_token_type_ids=!0}class eE extends ex{}class eA extends ex{}class eL extends ex{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 eI extends ex{return_token_type_ids=!0}class ez extends ex{}class ej extends ex{}class eD extends ex{}class eO extends ex{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,r){return eY(this,e,t,r)}}class eV extends eO{}class eN extends ex{}class eB extends ex{}class eG extends ex{padding_side="left";constructor(e,t){super(e,t),this.legacy=t.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new em({replacement:"▁",add_prefix_space:!0,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("▁"+e.replaceAll("▁"," "));return t.length>1&&"▁"===t[0]&&this.special_tokens.includes(t[1])&&(t=t.slice(1)),t}}class eR extends ex{}class eq extends ex{}class e$ extends ex{}class eW extends ex{}class eU extends ex{}class eQ extends ex{}class eX extends ex{}class eH extends ex{}class eJ extends ex{}function eY(e,t,r,s){if(!("language_codes"in e)||!Array.isArray(e.language_codes))throw 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 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 Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");let o=s.src_lang,n=s.tgt_lang;if(!e.language_codes.includes(n))throw 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 Error(`Source language code "${o}" is not valid. Must be one of: {${e.language_codes.join(", ")}}`);for(let 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 s.forced_bos_token_id=e.model.convert_tokens_to_ids([e.lang_to_token(n)])[0],e._call(t,r)}class eK extends ex{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,r){return eY(this,e,t,r)}}class eZ extends ex{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,r){return eY(this,e,t,r)}}class e0 extends ex{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr(e,{return_timestamps:t=!1,return_language:r=!1,time_precision:s=null,force_full_sequences:o=!0}={}){if(null===s)throw Error("Must specify time_precision");let n=null,i="word"===t;function l(){return{language:n,timestamp:[null,null],text:""}}let c=[],u=l(),m=0,p=this.timestamp_begin,_=p+1500,h=[],g=[],f=!1,M=null,x=new Set(this.all_special_ids);for(let r of e){let e=r.tokens,o=i?r.token_timestamps:null,b=null,T=p;if("stride"in r){let[t,o,n]=r.stride;if(m-=o,M=t-n,o&&(T=o/s+p),n)for(let t=e.length-1;t>=0;--t){let r=Number(e[t]);if(r>=p){if(null!==b&&(r-p)*s<M)break;b=r}}}let P=[],y=[];for(let r=0;r<e.length;++r){let M=Number(e[r]);if(x.has(M)){let e=this.decode([M]),r=d.WHISPER_LANGUAGE_MAPPING.get(e.slice(2,-2));if(void 0!==r){if(null!==n&&r!==n&&!t){h.push(P);let e=this.findLongestCommonSequence(h)[0],t=this.decode(e);u.text=t,c.push(u),h=[],P=[],u=l()}n=u.language=r}}else if(M>=p&&M<=_){let e=(M-p)*s+m,t=(0,a.round)(e,2);if(null!==b&&M>=b)f=!0;else if(f||h.length>0&&M<T)f=!1;else if(null===u.timestamp[0])u.timestamp[0]=t;else if(t===u.timestamp[0]);else{u.timestamp[1]=t,h.push(P),i&&g.push(y);let[e,r]=this.findLongestCommonSequence(h,g),s=this.decode(e);u.text=s,i&&(u.words=this.collateWordTimestamps(e,r,n)),c.push(u),h=[],P=[],g=[],y=[],u=l()}}else if(P.push(M),i){let e,t=(0,a.round)(o[r]+m,2);if(r+1<o.length){e=(0,a.round)(o[r+1]+m,2);let n=this.decode([M]);w.test(n)&&(e=(0,a.round)(Math.min(t+s,e),2))}else e=null;y.push([t,e])}}if("stride"in r){let[e,t,s]=r.stride;m+=e-s}P.length>0?(h.push(P),i&&g.push(y)):h.every(e=>0===e.length)&&(u=l(),h=[],P=[],g=[],y=[])}if(h.length>0){if(o&&t)throw 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.");let[e,r]=this.findLongestCommonSequence(h,g),s=this.decode(e);u.text=s,i&&(u.words=this.collateWordTimestamps(e,r,n)),c.push(u)}let b=Object.create(null),T=c.map(e=>e.text).join("");if(t||r){for(let e=0;e<c.length;++e){let s=c[e];t||delete s.timestamp,r||delete s.language}if(i){let e=[];for(let t of c)for(let r of t.words)e.push(r);b={chunks:e}}else b={chunks:c}}return[T,b]}findLongestCommonSequence(e,t=null){let r=e[0],s=r.length,o=[],n=Array.isArray(t)&&t.length>0,a=n?[]:null,i=n?t[0]:null;for(let l=1;l<e.length;++l){let c=e[l],d=0,u=[s,s,0,0],m=c.length;for(let e=1;e<s+m;++e){let o,a=Math.max(0,s-e),p=Math.min(s,s+m-e),_=r.slice(a,p),h=Math.max(0,e-s),g=Math.min(m,e),f=c.slice(h,g);if(_.length!==f.length)throw Error("There is a bug within whisper `decode_asr` function, please report it. Dropping to prevent bad inference.");o=n?_.filter((e,r)=>e===f[r]&&i[a+r]<=t[l][h+r]).length:_.filter((e,t)=>e===f[t]).length;let M=e/1e4,w=o/e+M;o>1&&w>d&&(d=w,u=[a,p,h,g])}let[p,_,h,g]=u,f=Math.floor((_+p)/2),M=Math.floor((g+h)/2);o.push(...r.slice(0,f)),s=(r=c.slice(M)).length,n&&(a.push(...i.slice(0,f)),i=t[l].slice(M))}return(o.push(...r),n)?(a.push(...i),[o,a]):[o,[]]}collateWordTimestamps(e,t,r){let[s,o,n]=this.combineTokensIntoWords(e,r),a=[];for(let e=0;e<s.length;++e){let r=n[e];a.push({text:s[e],timestamp:[t[r.at(0)][0],t[r.at(-1)][1]]})}return a}combineTokensIntoWords(e,t,r="\"'“\xa1\xbf([{-",s="\"'.。,,!!??::”)]}、"){let o,n,a;return["chinese","japanese","thai","lao","myanmar"].includes(t=t??"english")?[o,n,a]=this.splitTokensOnUnicode(e):[o,n,a]=this.splitTokensOnSpaces(e),this.mergePunctuations(o,n,a,r,s)}decode(e,t){let r;return t?.decode_with_timestamps?(e instanceof i.Tensor&&(e=_(e)),r=this.decodeWithTimestamps(e,t)):r=super.decode(e,t),r}decodeWithTimestamps(e,t){let r=t?.time_precision??.02,s=Array.from(this.all_special_ids).at(-1)+1,o=[[]];for(let t of e)if((t=Number(t))>=s){let e=((t-s)*r).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))).join("")}splitTokensOnUnicode(e){let t=this.decode(e,{decode_with_timestamps:!0}),r=[],s=[],o=[],n=[],a=[],i=0;for(let l=0;l<e.length;++l){let c=e[l];n.push(c),a.push(l);let d=this.decode(n,{decode_with_timestamps:!0});d.includes("�")&&"�"!==t[i+d.indexOf("�")]||(r.push(d),s.push(n),o.push(a),n=[],a=[],i+=d.length)}return[r,s,o]}splitTokensOnSpaces(e){let[t,r,s]=this.splitTokensOnUnicode(e),o=[],n=[],a=[],i=RegExp(`^[${M}]$`,"gu");for(let e=0;e<t.length;++e){let l=t[e],c=r[e],d=s[e],u=c[0]>=this.model.tokens_to_ids.get("<|endoftext|>"),m=l.startsWith(" "),p=l.trim(),_=i.test(p);if(u||m||_||0===o.length)o.push(l),n.push(c),a.push(d);else{let e=o.length-1;o[e]+=l,n[e].push(...c),a[e].push(...d)}}return[o,n,a]}mergePunctuations(e,t,r,s,n){let a=structuredClone(e),i=structuredClone(t),l=structuredClone(r),c=a.length-2,d=a.length-1;for(;c>=0;)a[c].startsWith(" ")&&s.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;d<a.length;)!a[c].endsWith(" ")&&n.includes(a[d])?(a[c]+=a[d],i[c]=(0,o.mergeArrays)(i[c],i[d]),l[c]=(0,o.mergeArrays)(l[c],l[d]),a[d]="",i[d]=[],l[d]=[]):c=d,++d;return[a.filter(e=>e),i.filter(e=>e.length>0),l.filter(e=>e.length>0)]}}class e1 extends ex{}class e2 extends ex{}class e3 extends ex{}class e4 extends ex{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;let[t,...r]=e.trim().split(this.languageRegex);if(0===r.length)return super._encode_text(t);if(2===r.length){let[e,t]=r;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 e8 extends ex{}class e5 extends ex{}class e6 extends ex{}class e9 extends ex{}class e7 extends ex{}class te extends ex{constructor(e,t){super(e,t),this.decoder=new eu({})}}class tt extends ex{}class tr extends ex{}class ts{static TOKENIZER_CLASS_MAPPING={T5Tokenizer:ez,DistilBertTokenizer:eE,CamembertTokenizer:eA,DebertaTokenizer:ek,DebertaV2Tokenizer:eF,BertTokenizer:eb,HerbertTokenizer:ev,ConvBertTokenizer:eC,RoFormerTokenizer:eS,XLMTokenizer:eL,ElectraTokenizer:eI,MobileBertTokenizer:eP,SqueezeBertTokenizer:ey,AlbertTokenizer:eT,GPT2Tokenizer:ej,BartTokenizer:eD,MBartTokenizer:eO,MBart50Tokenizer:eV,RobertaTokenizer:eN,WhisperTokenizer:e0,CodeGenTokenizer:e1,CLIPTokenizer:e2,SiglipTokenizer:e3,MarianTokenizer:e4,BloomTokenizer:eB,NllbTokenizer:eK,M2M100Tokenizer:eZ,LlamaTokenizer:eG,CodeLlamaTokenizer:eR,XLMRobertaTokenizer:eq,MPNetTokenizer:e$,FalconTokenizer:eW,GPTNeoXTokenizer:eU,EsmTokenizer:eQ,Wav2Vec2CTCTokenizer:e8,BlenderbotTokenizer:e5,BlenderbotSmallTokenizer:e6,SpeechT5Tokenizer:e9,NougatTokenizer:e7,VitsTokenizer:te,Qwen2Tokenizer:eX,GemmaTokenizer:eH,Grok1Tokenizer:eJ,CohereTokenizer:tt,MgpstrTokenizer:tr,PreTrainedTokenizer:ex};static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:s=null,local_files_only:o=!1,revision:n="main",legacy:a=null}={}){let[i,l]=await u(e,{progress_callback:t,config:r,cache_dir:s,local_files_only:o,revision:n,legacy:a}),c=l.tokenizer_class?.replace(/Fast$/,"")??"PreTrainedTokenizer",d=this.TOKENIZER_CLASS_MAPPING[c];return d||(console.warn(`Unknown tokenizer class "${c}", attempting to construct from base class.`),d=ex),new d(i,l)}}},"./src/utils/audio.js":(e,t,r)=>{r.r(t),r.d(t,{RawAudio:()=>P,hamming:()=>p,hanning:()=>m,mel_filter_bank:()=>M,read_audio:()=>d,spectrogram:()=>x,window_function:()=>b});var s=r("./src/utils/hub.js"),o=r("./src/utils/maths.js"),n=r("./src/utils/core.js"),i=r("./src/env.js"),l=r("?7a2c"),c=r("./src/utils/tensor.js");async function d(e,t){let r;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.");let o=await (await (0,s.getFile)(e)).arrayBuffer(),n=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${n.sampleRate}Hz.`);let a=await n.decodeAudioData(o);if(2===a.numberOfChannels){let e=Math.sqrt(2),t=a.getChannelData(0),s=a.getChannelData(1);r=new Float32Array(t.length);for(let o=0;o<a.length;++o)r[o]=e*(t[o]+s[o])/2}else r=a.getChannelData(0);return r}function u(e,t){if(e<1)return new Float64Array;if(1===e)return new Float64Array([1]);let r=1-t,s=2*Math.PI/(e-1),o=new Float64Array(e);for(let n=0;n<e;++n)o[n]=t-r*Math.cos(n*s);return o}function m(e){return u(e,.5)}function p(e){return u(e,.54)}let _={htk:e=>2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,r=15,s=27/Math.log(6.4))=>e>=t?r+Math.log(e/t)*s:3*e/200};function h(e,t="htk"){let r=_[t];if(!r)throw Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map(e=>r(e))}let g={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,r=15,s=Math.log(6.4)/27)=>e>=r?t*Math.exp(s*(e-r)):200*e/3};function f(e,t,r){let s=(t-e)/(r-1);return Float64Array.from({length:r},(t,r)=>e+s*r)}function M(e,t,r,s,o,n=null,a="htk",i=!1){let l;if(null!==n&&"slaney"!==n)throw Error('norm must be one of null or "slaney"');if(e<2)throw Error(`Require num_frequency_bins: ${e} >= 2`);if(r>s)throw Error(`Require min_frequency: ${r} <= max_frequency: ${s}`);let c=f(h(r,a),h(s,a),t+2),d=function(e,t="htk"){let r=g[t];if(!r)throw Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map(e=>r(e))}(c,a);if(i){let t=o/((e-1)*2);l=h(Float64Array.from({length:e},(e,r)=>r*t),a),d=c}else l=f(0,Math.floor(o/2),e);let u=function(e,t){let r=Float64Array.from({length:t.length-1},(e,r)=>t[r+1]-t[r]),s=Array.from({length:e.length},()=>Array(t.length));for(let r=0;r<e.length;++r){let o=s[r];for(let s=0;s<t.length;++s)o[s]=t[s]-e[r]}let o=t.length-2,n=Array.from({length:o},()=>Array(e.length));for(let t=0;t<e.length;++t){let e=s[t];for(let s=0;s<o;++s){let o=-e[s]/r[s],a=e[s+2]/r[s+1];n[s][t]=Math.max(0,Math.min(o,a))}}return n}(l,d);if(null!==n&&"slaney"===n)for(let r=0;r<t;++r){let t=u[r],s=2/(d[r+2]-d[r]);for(let r=0;r<e;++r)t[r]*=s}return u}function w(e,t,r,s,n){if(r<=0)throw Error("reference must be greater than zero");if(s<=0)throw Error("min_value must be greater than zero");let a=Math.log10(r=Math.max(s,r));for(let r=0;r<e.length;++r)e[r]=t*Math.log10(Math.max(s,e[r])-a);if(null!==n){if(n<=0)throw Error("db_range must be greater than zero");let t=(0,o.max)(e)[0]-n;for(let r=0;r<e.length;++r)e[r]=Math.max(e[r],t)}return e}async function x(e,t,r,s,{fft_length:a=null,power:i=1,center:l=!0,pad_mode:d="reflect",onesided:u=!0,preemphasis:m=null,mel_filters:p=null,mel_floor:_=1e-10,log_mel:h=null,reference:g=1,min_value:f=1e-10,db_range:M=null,remove_dc_offset:b=null,min_num_frames:T=null,max_num_frames:P=null,do_pad:y=!0,transpose:k=!1}={}){let F=t.length;if(null===a&&(a=r),r>a)throw Error(`frame_length (${r}) may not be larger than fft_length (${a})`);if(F!==r)throw Error(`Length of the window (${F}) must equal frame_length (${r})`);if(s<=0)throw Error("hop_length must be greater than zero");if(null===i&&null!==p)throw 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(l){if("reflect"!==d)throw Error(`pad_mode="${d}" not implemented yet.`);let t=Math.floor((a-1)/2)+1;e=function(e,t,r){let s=new e.constructor(e.length+t+r),o=e.length-1;for(let r=0;r<e.length;++r)s[t+r]=e[r];for(let r=1;r<=t;++r)s[t-r]=e[(0,n.calculateReflectOffset)(r,o)];for(let a=1;a<=r;++a)s[o+t+a]=e[(0,n.calculateReflectOffset)(o-a,o)];return s}(e,t,t)}let v=Math.floor(1+Math.floor((e.length-r)/s));null!==T&&v<T&&(v=T);let C=u?Math.floor(a/2)+1:a,S=v,E=v;null!==P&&(P>v?y&&(E=P):E=S=P);let A=new o.FFT(a),L=new Float64Array(a),I=new Float64Array(A.outputBufferSize),z=new Float32Array(C*E);for(let o=0;o<S;++o){let n=o*s,a=Math.min(e.length-n,r);a!==r&&L.fill(0,0,r);for(let t=0;t<a;++t)L[t]=e[n+t];if(b){let e=0;for(let t=0;t<a;++t)e+=L[t];let t=e/a;for(let e=0;e<a;++e)L[e]-=t}if(null!==m){for(let e=a-1;e>=1;--e)L[e]-=m*L[e-1];L[0]*=1-m}for(let e=0;e<t.length;++e)L[e]*=t[e];A.realTransform(I,L);for(let e=0;e<C;++e){let t=e<<1;z[e*E+o]=I[t]**2+I[t+1]**2}}if(null!==i&&2!==i){let e=2/i;for(let t=0;t<z.length;++t)z[t]**=e}let j=p.length,D=await (0,c.matmul)(new c.Tensor("float32",p.flat(),[j,C]),new c.Tensor("float32",z,[C,E]));k&&(D=D.transpose(1,0));let O=D.data;for(let e=0;e<O.length;++e)O[e]=Math.max(_,O[e]);if(null!==i&&null!==h){let e=Math.min(O.length,S*j);switch(h){case"log":for(let t=0;t<e;++t)O[t]=Math.log(O[t]);break;case"log10":for(let t=0;t<e;++t)O[t]=Math.log10(O[t]);break;case"dB":if(1===i)!function(e,t=1,r=1e-5,s=null){w(e,20,t,r,s)}(O,g,f,M);else if(2===i)!function(e,t=1,r=1e-10,s=null){w(e,10,t,r,s)}(O,g,f,M);else throw Error(`Cannot use log_mel option '${h}' with power ${i}`);break;default:throw Error(`log_mel must be one of null, 'log', 'log10' or 'dB'. Got '${h}'`)}}return D}function b(e,t,{periodic:r=!0,frame_length:s=null,center:o=!0}={}){let n,a=r?e+1:e;switch(t){case"boxcar":n=new Float64Array(a).fill(1);break;case"hann":case"hann_window":n=m(a);break;case"hamming":n=p(a);break;case"povey":n=m(a).map(e=>Math.pow(e,.85));break;default:throw Error(`Unknown window type ${t}.`)}if(r&&(n=n.subarray(0,e)),null===s)return n;if(e>s)throw Error(`Length of the window (${e}) may not be larger than frame_length (${s})`);return n}function T(e,t,r){for(let s=0;s<r.length;++s)e.setUint8(t+s,r.charCodeAt(s))}class P{constructor(e,t){this.audio=e,this.sampling_rate=t}toWav(){return function(e,t){let r=44,s=new ArrayBuffer(44+4*e.length),o=new DataView(s);T(o,0,"RIFF"),o.setUint32(4,36+4*e.length,!0),T(o,8,"WAVE"),T(o,12,"fmt "),o.setUint32(16,16,!0),o.setUint16(20,3,!0),o.setUint16(22,1,!0),o.setUint32(24,t,!0),o.setUint32(28,4*t,!0),o.setUint16(32,4,!0),o.setUint16(34,32,!0),T(o,36,"data"),o.setUint32(40,4*e.length,!0);for(let t=0;t<e.length;++t,r+=4)o.setFloat32(r,e[t],!0);return s}(this.audio,this.sampling_rate)}toBlob(){return new Blob([this.toWav()],{type:"audio/wav"})}async save(e){let t;if(i.apis.IS_BROWSER_ENV){if(i.apis.IS_WEBWORKER_ENV)throw Error("Unable to save a file from a Web Worker.");t=n.saveBlob}else if(i.apis.IS_FS_AVAILABLE)t=async(e,t)=>{let r=await t.arrayBuffer();l.writeFileSync(e,a.from(r))};else throw Error("Unable to save because filesystem is disabled in this environment.");await t(e,this.toBlob())}}},"./src/utils/constants.js":(e,t,r)=>{r.r(t),r.d(t,{CHAT_TEMPLATE_NAME:()=>l,CONFIG_NAME:()=>o,FEATURE_EXTRACTOR_NAME:()=>n,GENERATION_CONFIG_NAME:()=>c,GITHUB_ISSUE_URL:()=>s,IMAGE_PROCESSOR_NAME:()=>a,PROCESSOR_NAME:()=>i});let s="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.json",c="generation_config.json"},"./src/utils/core.js":(e,t,r)=>{function s(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 e?.prototype?.__proto__?.constructor?.name==="TypedArray"}function i(e){return Number.isInteger(e)||"bigint"==typeof e}function l(e){return null==e||-1===e}function c(e){let t=[],r=e;for(;Array.isArray(r);)t.push(r.length),r=r[0];return t}function d(e,t,r){let s=e[t];if(void 0!==s)return delete e[t],s;if(void 0===r)throw Error(`Key ${t} does not exist in object.`);return r}function u(...e){return Array.prototype.concat.apply([],e)}function m(...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 _(e,t){let r=URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=e,s.click(),s.remove(),URL.revokeObjectURL(r)}function h(e,t){return Object.assign({},...t.map(t=>{if(void 0!==e[t])return{[t]:e[t]}}))}function g(e){let t=0;for(let r of e)++t;return t}function f(e,t){let r=0;for(let s of e)s===t&&++r;return r}r.r(t),r.d(t,{calculateDimensions:()=>c,calculateReflectOffset:()=>p,count:()=>f,dispatchCallback:()=>s,escapeRegExp:()=>n,isIntegralNumber:()=>i,isNullishDimension:()=>l,isTypedArray:()=>a,len:()=>g,mergeArrays:()=>u,pick:()=>h,pop:()=>d,product:()=>m,reverseDictionary:()=>o,saveBlob:()=>_})},"./src/utils/data-structures.js":(e,t,r)=>{r.r(t),r.d(t,{CharTrie:()=>o,DictionarySplitter:()=>l,LRUCache:()=>c,PriorityQueue:()=>s,TokenLattice:()=>a});class s{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(let t of e)if(this.size<this._maxSize)this._heap.push(t),this._siftUp();else{let e=this._smallest();this._comparator(t,this._heap[e])&&(this._heap[e]=t,this._siftUpFrom(e))}return this.size}pop(){let e=this.peek(),t=this.size-1;return t>0&&this._swap(0,t),this._heap.pop(),this._siftDown(),e}replace(e){let t=this.peek();return this._heap[0]=e,this._siftDown(),t}_parent(e){return(e+1>>>1)-1}_left(e){return(e<<1)+1}_right(e){return e+1<<1}_greater(e,t){return this._comparator(this._heap[e],this._heap[t])}_swap(e,t){let r=this._heap[e];this._heap[e]=this._heap[t],this._heap[t]=r}_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.size&&this._greater(this._left(e),e)||this._right(e)<this.size&&this._greater(this._right(e),e);){let t=this._right(e)<this.size&&this._greater(this._right(e),this._left(e))?this._right(e):this._left(e);this._swap(e,t),e=t}}_smallest(){return 2**Math.floor(Math.log2(this.size))-1}}class o{constructor(){this.root=n.default()}extend(e){for(let t of e)this.push(t)}push(e){let t=this.root;for(let r of e){let e=t.children.get(r);void 0===e&&(e=n.default(),t.children.set(r,e)),t=e}t.isLeaf=!0}*commonPrefixSearch(e){let t=this.root;if(void 0===t)return;let r="";for(let s of e){if(r+=s,void 0===(t=t.children.get(s)))return;t.isLeaf&&(yield r)}}}class n{constructor(e,t){this.isLeaf=e,this.children=t}static default(){return new n(!1,new Map)}}class a{constructor(e,t,r){this.chars=Array.from(e),this.len=this.chars.length,this.bosTokenId=t,this.eosTokenId=r,this.nodes=[],this.beginNodes=Array.from({length:this.len+1},()=>[]),this.endNodes=Array.from({length:this.len+1},()=>[]);let s=new i(this.bosTokenId,0,0,0,0),o=new i(this.eosTokenId,1,this.len,0,0);this.nodes.push(s.clone()),this.nodes.push(o.clone()),this.beginNodes[this.len].push(o),this.endNodes[0].push(s)}insert(e,t,r,s){let o=new i(s,this.nodes.length,e,t,r);this.beginNodes[e].push(o),this.endNodes[e+t].push(o),this.nodes.push(o)}viterbi(){let e=this.len,t=0;for(;t<=e;){if(0==this.beginNodes[t].length)return[];for(let e of this.beginNodes[t]){e.prev=null;let r=0,s=null;for(let o of this.endNodes[t]){let t=o.backtraceScore+e.score;(null===s||t>r)&&(s=o.clone(),r=t)}if(null===s)return[];e.prev=s,e.backtraceScore=r}++t}let r=[],s=this.beginNodes[e][0].prev;if(null===s)return[];let o=s.clone();for(;null!==o.prev;)r.push(o.clone()),o=o.clone().prev.clone();return r.reverse(),r}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,r,s,o){this.tokenId=e,this.nodeId=t,this.pos=r,this.length=s,this.score=o,this.prev=null,this.backtraceScore=0}clone(){let 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){let t=Object.create(null);for(let r of e){let e=t;for(let t=0;t<r.length;++t)e=e[r[t]]??=Object.create(null);e.end=r}return t}split(e){let t=[],r=e.length,s=0,o=0;for(;o<r;){let n=this.trie,a=null,i=o;for(;i<r&&(n=n[e[i]]);)n.end&&(a=n.end),++i;a?(o>s&&t.push(e.slice(s,o)),t.push(a),o+=a.length,s=o):++o}return s<r&&t.push(e.slice(s)),t}}class c{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;let t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}put(e,t){this.cache.has(e)&&this.cache.delete(e),this.cache.set(e,t),this.cache.size>this.capacity&&this.cache.delete(this.cache.keys().next().value)}clear(){this.cache.clear()}}},"./src/utils/devices.js":(e,t,r)=>{r.r(t),r.d(t,{DEVICE_TYPES:()=>s});let s=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,r)=>{r.r(t),r.d(t,{DATA_TYPES:()=>a,DEFAULT_DEVICE_DTYPE_MAPPING:()=>i,DEFAULT_DTYPE_SUFFIX_MAPPING:()=>l,isWebGpuFp16Supported:()=>n});var s=r("./src/env.js"),o=r("./src/utils/devices.js");let n=function(){let e;return async function(){if(void 0===e)if(s.apis.IS_WEBGPU_AVAILABLE)try{e=(await navigator.gpu.requestAdapter()).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,r)=>{r.r(t),r.d(t,{Callable:()=>s});let s=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,r)=>{r.r(t),r.d(t,{MAX_EXTERNAL_DATA_CHUNKS:()=>l,getFile:()=>p,getModelFile:()=>f,getModelJSON:()=>M});var s=r("?7a2c"),o=r("?a42a"),a=r("./src/env.js"),i=r("./src/utils/core.js");let l=100,c={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 d{constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=s.existsSync(e),this.exists){this.status=200,this.statusText="OK";let t=s.statSync(e);this.headers.set("content-length",t.size.toString()),this.updateContentType();let r=s.createReadStream(e);this.body=new ReadableStream({start(e){r.on("data",t=>e.enqueue(t)),r.on("end",()=>e.close()),r.on("error",t=>e.error(t))},cancel(){r.destroy()}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){let e=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",c[e]??"application/octet-stream")}clone(){let e=new d(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 s.promises.readFile(this.filePath)).buffer}async blob(){return new Blob([await s.promises.readFile(this.filePath)],{type:this.headers.get("content-type")})}async text(){return await s.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function u(e,t=null,r=null){let s;try{s=new URL(e)}catch(e){return!1}return(!t||!!t.includes(s.protocol))&&(!r||!!r.includes(s.hostname))}let m=/^(\b[\w\-.]+\b\/)?\b[\w\-.]{1,96}\b$/;async function p(e){if(a.env.useFS&&!u(e,["http:","https:","blob:"]))return new d(e instanceof URL?"file:"===e.protocol?e.pathname:e.toString():e);if(void 0===n||n?.release?.name!=="node")return fetch(e);{let t=!!n.env?.TESTING_REMOTELY,r=a.env.version,s=new Headers;if(s.set("User-Agent",`transformers.js/${r}; is_ci/${t};`),u(e,["http:","https:"],["huggingface.co","hf.co"])){let e=n.env?.HF_TOKEN??n.env?.HF_ACCESS_TOKEN;e&&s.set("Authorization",`Bearer ${e}`)}return fetch(e,{headers:s})}}let _={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 h{constructor(e){this.path=e}async match(e){let t=new d(o.join(this.path,e));return t.exists?t:void 0}async put(e,t,r){let n=o.join(this.path,e);try{let e=t.headers.get("Content-Length"),a=parseInt(e??"0"),i=0;await s.promises.mkdir(o.dirname(n),{recursive:!0});let l=s.createWriteStream(n),c=t.body.getReader();for(;;){let{done:e,value:t}=await c.read();if(e)break;await new Promise((e,r)=>{l.write(t,t=>{if(t)return void r(t);e()})}),i+=t.length;let s=a?i/a*100:0;r?.({progress:s,loaded:i,total:a})}l.close()}catch(e){try{await s.promises.unlink(n)}catch{}throw e}}}async function g(e,...t){for(let r of t)try{let t=await e.match(r);if(t)return t}catch(e){continue}}async function f(e,t,r=!0,s={},o=!1){let n,l,c,M;if(!a.env.allowLocalModels){if(s.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`).");else if(!a.env.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}if((0,i.dispatchCallback)(s.progress_callback,{status:"initiate",name:e,file:t}),!n&&a.env.useCustomCache){if(!a.env.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!a.env.customCache.match||!a.env.customCache.put)throw 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");n=a.env.customCache}if(!n&&a.env.useBrowserCache){if("undefined"==typeof caches)throw Error("Browser cache is not available in this environment.");try{n=await caches.open("transformers-cache")}catch(e){console.warn("An error occurred while opening the browser cache:",e)}}if(!n&&a.env.useFSCache){if(!a.apis.IS_FS_AVAILABLE)throw Error("File System Cache is not available in this environment.");n=new h(s.cache_dir??a.env.cacheDir)}let b=s.revision??"main",T=x(e,t),P=!(!m.test(e)||e.includes("..")||e.includes("--")||e.endsWith(".git")||e.endsWith(".ipynb")),y=P?x(a.env.localModelPath,T):T,k=x(a.env.remoteHost,a.env.remotePathTemplate.replaceAll("{model}",e).replaceAll("{revision}",encodeURIComponent(b)),t),F=n instanceof h?"main"===b?T:x(e,b,t):k,v=!1;n&&(c=await g(n,y,F));let C=void 0!==c;if(void 0===c){if(a.env.allowLocalModels)if(u(T,["http:","https:"])){if(s.local_files_only)throw Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${T}.`);else if(!a.env.allowRemoteModels)throw Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${T}.`)}else try{c=await p(y),l=y}catch(e){console.warn(`Unable to load from local path "${y}": "${e}"`)}if(void 0===c||404===c.status){if(s.local_files_only||!a.env.allowRemoteModels)if(!r)return null;else throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${y}".`);if(!P)throw Error(`Local file missing at "${y}" and download aborted due to invalid model ID "${e}".`);if(200!==(c=await p(k)).status){var S=c.status;if(!r)return null;let e=_[S]??`Error (${S}) occurred while trying to load file`;throw Error(`${e}: "${k}".`)}l=F}v=n&&"undefined"!=typeof Response&&c instanceof Response&&200===c.status}if((0,i.dispatchCallback)(s.progress_callback,{status:"download",name:e,file:t}),!(a.apis.IS_NODE_ENV&&o)){let r;s.progress_callback?C&&"undefined"!=typeof navigator&&/firefox/i.test(navigator.userAgent)?(r=new Uint8Array(await c.arrayBuffer()),(0,i.dispatchCallback)(s.progress_callback,{status:"progress",name:e,file:t,progress:100,loaded:r.length,total:r.length})):r=await w(c,r=>{(0,i.dispatchCallback)(s.progress_callback,{status:"progress",name:e,file:t,...r})}):r=new Uint8Array(await c.arrayBuffer()),M=r}if(v&&l&&await n.match(l)===void 0&&(M?await n.put(l,new Response(M,{headers:c.headers})).catch(e=>{console.warn(`Unable to add response to browser cache: ${e}.`)}):await n.put(l,c,s.progress_callback)),(0,i.dispatchCallback)(s.progress_callback,{status:"done",name:e,file:t}),M){if(!a.apis.IS_NODE_ENV&&o)throw Error("Cannot return path in a browser environment.");return M}if(c instanceof d)return c.filePath;let E=await n?.match(l);if(E instanceof d)return E.filePath;if(E instanceof Response)return new Uint8Array(await E.arrayBuffer());if("string"==typeof E)return E;throw Error("Unable to get model file path or buffer.")}async function M(e,t,r=!0,s={}){let o=await f(e,t,r,s,!1);return null===o?{}:JSON.parse(new TextDecoder("utf-8").decode(o))}async function w(e,t){let r=e.headers.get("Content-Length");null===r&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let s=parseInt(r??"0"),o=new Uint8Array(s),n=0,a=e.body.getReader();async function i(){let{done:e,value:r}=await a.read();if(e)return;let l=n+r.length;if(l>s){let e=new Uint8Array(s=l);e.set(o),o=e}return o.set(r,n),t({progress:(n=l)/s*100,loaded:n,total:s}),i()}return await i(),o}function x(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(RegExp("/$"),"")),t))).join("/")}},"./src/utils/image.js":(e,t,r)=>{let s,o,n;r.r(t),r.d(t,{RawImage:()=>_,load_image:()=>h});var a=r("./src/utils/core.js"),i=r("./src/utils/hub.js"),l=r("./src/env.js"),c=r("./src/utils/tensor.js"),d=r("?2b25");let u=l.apis.IS_BROWSER_ENV||l.apis.IS_WEBWORKER_ENV;if(u)s=(e,t)=>{if(!self.OffscreenCanvas)throw Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},n=self.createImageBitmap,o=self.ImageData;else if(d)n=async e=>{let t=(await e.metadata()).channels,{data:r,info:s}=await e.rotate().raw().toBuffer({resolveWithObject:!0}),o=new _(new Uint8ClampedArray(r),s.width,s.height,s.channels);return void 0!==t&&t!==s.channels&&o.convert(t),o};else throw Error("Unable to load image processing library.");let m={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 _{constructor(e,t,r,s){this.data=e,this.width=t,this.height=r,this.channels=s}get size(){return[this.width,this.height]}static async read(e){if(e instanceof _)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 Error(`Unsupported input type: ${typeof e}`)}static fromCanvas(e){if(!u)throw Error("fromCanvas() is only supported in browser environments.");return new _(e.getContext("2d").getImageData(0,0,e.width,e.height).data,e.width,e.height,4)}static async fromURL(e){let t=await (0,i.getFile)(e);if(200!==t.status)throw Error(`Unable to read image from "${e}" (${t.status} ${t.statusText})`);let r=await t.blob();return this.fromBlob(r)}static async fromBlob(e){if(u){let t=await n(e),r=s(t.width,t.height).getContext("2d");return r.drawImage(t,0,0),new this(r.getImageData(0,0,t.width,t.height).data,t.width,t.height,4)}{let t=d(await e.arrayBuffer());return await n(t)}}static fromTensor(e,t="CHW"){if(3!==e.dims.length)throw 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);else throw Error(`Unsupported channel format: ${t}`);if(!(e.data instanceof Uint8ClampedArray||e.data instanceof Uint8Array))throw Error(`Unsupported tensor type: ${e.type}`);switch(e.dims[2]){case 1:case 2:case 3:case 4:return new _(e.data,e.dims[1],e.dims[0],e.dims[2]);default:throw Error(`Unsupported number of channels: ${e.dims[2]}`)}}grayscale(){if(1===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let t=0,r=0;t<this.data.length;t+=this.channels){let s=this.data[t],o=this.data[t+1],n=this.data[t+2];e[r++]=Math.round(.2989*s+.587*o+.114*n)}break;default:throw Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,1)}rgb(){if(3===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*3);switch(this.channels){case 1:for(let t=0,r=0;t<this.data.length;++t)e[r++]=this.data[t],e[r++]=this.data[t],e[r++]=this.data[t];break;case 4:for(let t=0,r=0;t<this.data.length;t+=4)e[r++]=this.data[t],e[r++]=this.data[t+1],e[r++]=this.data[t+2];break;default:throw Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,3)}rgba(){if(4===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*4);switch(this.channels){case 1:for(let t=0,r=0;t<this.data.length;++t)e[r++]=this.data[t],e[r++]=this.data[t],e[r++]=this.data[t],e[r++]=255;break;case 3:for(let t=0,r=0;t<this.data.length;t+=3)e[r++]=this.data[t],e[r++]=this.data[t+1],e[r++]=this.data[t+2],e[r++]=255;break;default:throw Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this._update(e,this.width,this.height,4)}putAlpha(e){if(e.width!==this.width||e.height!==this.height)throw Error(`Expected mask size to be ${this.width}x${this.height}, but got ${e.width}x${e.height}`);if(1!==e.channels)throw Error(`Expected mask to have 1 channel, but got ${e.channels}`);let t=this.data,r=e.data,s=this.width*this.height;if(3===this.channels){let e=new Uint8ClampedArray(4*s);for(let o=0,n=0,a=0;o<s;++o)e[a++]=t[n++],e[a++]=t[n++],e[a++]=t[n++],e[a++]=r[o];return this._update(e,this.width,this.height,4)}if(4===this.channels){for(let e=0;e<s;++e)t[4*e+3]=r[e];return this}throw Error(`Expected image to have 3 or 4 channels, but got ${this.channels}`)}async resize(e,t,{resample:r=2}={}){if(this.width===e&&this.height===t)return this;let o=m[r]??r,i=(0,a.isNullishDimension)(e),l=(0,a.isNullishDimension)(t);if(i&&l)return this;if(i?e=t/this.height*this.width:l&&(t=e/this.width*this.height),u){let r=this.channels,o=this.toCanvas(),n=s(e,t).getContext("2d");return n.drawImage(o,0,0,e,t),new _(n.getImageData(0,0,e,t).data,e,t,4).convert(r)}{let r=this.toSharp();switch(o){case"box":case"hamming":("box"===o||"hamming"===o)&&(console.warn(`Resampling method ${o} is not yet supported. Using bilinear instead.`),o="bilinear");case"nearest":case"bilinear":case"bicubic":r=r.affine([e/this.width,0,0,t/this.height],{interpolator:o});break;case"lanczos":r=r.resize({width:e,height:t,fit:"fill",kernel:"lanczos3"});break;default:throw Error(`Resampling method ${o} is not supported.`)}return await n(r)}}async pad([e,t,r,o]){if(e=Math.max(e,0),t=Math.max(t,0),r=Math.max(r,0),o=Math.max(o,0),0===e&&0===t&&0===r&&0===o)return this;if(u){let n=this.channels,a=this.toCanvas(),i=this.width+e+t,l=this.height+r+o,c=s(i,l).getContext("2d");return c.drawImage(a,0,0,this.width,this.height,e,r,this.width,this.height),new _(c.getImageData(0,0,i,l).data,i,l,4).convert(n)}{let s=this.toSharp().extend({left:e,right:t,top:r,bottom:o});return await n(s)}}async crop([e,t,r,o]){if(e=Math.max(e,0),t=Math.max(t,0),r=Math.min(r,this.width-1),o=Math.min(o,this.height-1),0===e&&0===t&&r===this.width-1&&o===this.height-1)return this;let a=r-e+1,i=o-t+1;if(u){let r=this.channels,o=this.toCanvas(),n=s(a,i).getContext("2d");return n.drawImage(o,e,t,a,i,0,0,a,i),new _(n.getImageData(0,0,a,i).data,a,i,4).convert(r)}{let r=this.toSharp().extract({left:e,top:t,width:a,height:i});return await n(r)}}async center_crop(e,t){if(this.width===e&&this.height===t)return this;let r=(this.width-e)/2,o=(this.height-t)/2;if(u){let n=this.channels,a=this.toCanvas(),i=s(e,t).getContext("2d"),l=0,c=0,d=0,u=0;return r>=0?l=r:d=-r,o>=0?c=o:u=-o,i.drawImage(a,l,c,e,t,d,u,e,t),new _(i.getImageData(0,0,e,t).data,e,t,4).convert(n)}{let s=this.toSharp();if(r>=0&&o>=0)s=s.extract({left:Math.floor(r),top:Math.floor(o),width:e,height:t});else if(r<=0&&o<=0){let n=Math.floor(-o),a=Math.floor(-r);s=s.extend({top:n,left:a,right:e-this.width-a,bottom:t-this.height-n})}else{let n=[0,0],a=0;o<0?(n[0]=Math.floor(-o),n[1]=t-this.height-n[0]):a=Math.floor(o);let i=[0,0],l=0;r<0?(i[0]=Math.floor(-r),i[1]=e-this.width-i[0]):l=Math.floor(r),s=s.extend({top:n[0],bottom:n[1],left:i[0],right:i[1]}).extract({left:l,top:a,width:e,height:t})}return await n(s)}}async toBlob(e="image/png",t=1){if(!u)throw Error("toBlob() is only supported in browser environments.");let r=this.toCanvas();return await r.convertToBlob({type:e,quality:t})}toTensor(e="CHW"){let t=new c.Tensor("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if("HWC"===e);else if("CHW"===e)t=t.permute(2,0,1);else throw Error(`Unsupported channel format: ${e}`);return t}toCanvas(){if(!u)throw Error("toCanvas() is only supported in browser environments.");let e=this.clone().rgba(),t=s(e.width,e.height),r=new o(e.data,e.width,e.height);return t.getContext("2d").putImageData(r,0,0),t}split(){let{data:e,width:t,height:r,channels:s}=this,o=e.constructor,n=e.length/s,a=Array.from({length:s},()=>new o(n));for(let t=0;t<n;++t){let r=s*t;for(let o=0;o<s;++o)a[o][t]=e[r+o]}return a.map(e=>new _(e,t,r,1))}_update(e,t,r,s=null){return this.data=e,this.width=t,this.height=r,null!==s&&(this.channels=s),this}clone(){return new _(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 Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(e){if(u){if(l.apis.IS_WEBWORKER_ENV)throw Error("Unable to save an image from a Web Worker.");let t=e.split(".").pop().toLowerCase(),r=p.get(t)??"image/png",s=await this.toBlob(r);(0,a.saveBlob)(e,s)}else if(l.apis.IS_FS_AVAILABLE){let t=this.toSharp();return await t.toFile(e)}else throw Error("Unable to save the image because filesystem is disabled in this environment.")}toSharp(){if(u)throw Error("toSharp() is only supported in server-side environments.");return d(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}let h=_.read.bind(_)},"./src/utils/maths.js":(e,t,r)=>{function s(e,[t,r,o],[n,a],i="bilinear",l=!1){let c=a/o,d=n/r,u=new e.constructor(n*a*t),m=r*o,p=n*a;for(let s=0;s<n;++s)for(let n=0;n<a;++n){let i=s*a+n,l=(n+.5)/c-.5,_=(s+.5)/d-.5,h=Math.floor(l),g=Math.floor(_),f=Math.min(h+1,o-1),M=Math.min(g+1,r-1),w=l-(h=Math.max(h,0)),x=_-(g=Math.max(g,0)),b=(1-w)*(1-x),T=w*(1-x),P=(1-w)*x,y=w*x,k=g*o,F=M*o,v=k+h,C=k+f,S=F+h,E=F+f;for(let r=0;r<t;++r){let t=r*m;u[r*p+i]=b*e[t+v]+T*e[t+C]+P*e[t+S]+y*e[t+E]}}return u}function o(e,t,r){let s=Array(r.length),o=Array(r.length);for(let e=r.length-1,n=1;e>=0;--e)o[e]=n,s[e]=t[r[e]],n*=s[e];let n=r.map((e,t)=>o[r.indexOf(t)]),a=new e.constructor(e.length);for(let r=0;r<e.length;++r){let s=0;for(let e=t.length-1,o=r;e>=0;--e)s+=o%t[e]*n[e],o=Math.floor(o/t[e]);a[s]=e[r]}return[a,s]}function n(e){let t=u(e)[0],r=e.map(e=>Math.exp(e-t)),s=r.reduce((e,t)=>e+t,0);return r.map(e=>e/s)}function a(e){let t=u(e)[0],r=0;for(let s=0;s<e.length;++s)r+=Math.exp(e[s]-t);let s=Math.log(r);return e.map(e=>e-t-s)}function i(e,t){let r=0;for(let s=0;s<e.length;++s)r+=e[s]*t[s];return r}function l(e,t){let r=i(e,t),s=c(e);return r/(s*c(t))}function c(e){return Math.sqrt(e.reduce((e,t)=>e+t*t,0))}function d(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let s=1;s<e.length;++s)e[s]<t&&(t=e[s],r=s);return[t,r]}function u(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let s=1;s<e.length;++s)e[s]>t&&(t=e[s],r=s);return[t,r]}function m(e){return e>0&&(e&e-1)==0}r.r(t),r.d(t,{FFT:()=>h,bankers_round:()=>M,cos_sim:()=>l,dot:()=>i,dynamic_time_warping:()=>w,interpolate_data:()=>s,log_softmax:()=>a,magnitude:()=>c,max:()=>u,medianFilter:()=>g,min:()=>d,permute_data:()=>o,round:()=>f,softmax:()=>n});class p{constructor(e){if(this.size=0|e,this.size<=1||!m(this.size))throw 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;e<this.table.length;e+=2){let t=Math.PI*e/this.size;this.table[e]=Math.cos(t),this.table[e+1]=-Math.sin(t)}let t=0;for(let e=1;this.size>e;e<<=1)++t;this._width=t%2==0?t-1:t,this._bitrev=new Int32Array(1<<this._width);for(let e=0;e<this._bitrev.length;++e){this._bitrev[e]=0;for(let t=0;t<this._width;t+=2){let r=this._width-t-2;this._bitrev[e]|=(e>>>t&3)<<r}}}createComplexArray(){return new Float64Array(this._csize)}fromComplexArray(e,t){let r=t||Array(e.length>>>1);for(let t=0;t<e.length;t+=2)r[t>>>1]=e[t];return r}toComplexArray(e,t){let r=t||this.createComplexArray();for(let t=0;t<r.length;t+=2)r[t]=e[t>>>1],r[t+1]=0;return r}transform(e,t){if(e===t)throw Error("Input and output buffers must be different");this._transform4(e,t,1)}realTransform(e,t){if(e===t)throw Error("Input and output buffers must be different");this._realTransform4(e,t,1)}inverseTransform(e,t){if(e===t)throw Error("Input and output buffers must be different");this._transform4(e,t,-1);for(let t=0;t<e.length;++t)e[t]/=this.size}_transform4(e,t,r){let s,o,n=this._csize,a=1<<this._width,i=n/a<<1,l=this._bitrev;if(4===i)for(s=0,o=0;s<n;s+=i,++o){let r=l[o];this._singleTransform2(t,e,s,r,a)}else for(s=0,o=0;s<n;s+=i,++o){let n=l[o];this._singleTransform4(t,e,s,n,a,r)}let c=this.table;for(a>>=2;a>=2;a>>=2){let t=(i=n/a<<1)>>>2;for(s=0;s<n;s+=i){let o=s+t-1;for(let n=s,i=0;n<o;n+=2,i+=a){let s=n,o=s+t,a=o+t,l=a+t,d=e[s],u=e[s+1],m=e[o],p=e[o+1],_=e[a],h=e[a+1],g=e[l],f=e[l+1],M=c[i],w=r*c[i+1],x=m*M-p*w,b=m*w+p*M,T=c[2*i],P=r*c[2*i+1],y=_*T-h*P,k=_*P+h*T,F=c[3*i],v=r*c[3*i+1],C=g*F-f*v,S=g*v+f*F,E=d+y,A=u+k,L=d-y,I=u-k,z=x+C,j=b+S,D=r*(x-C),O=r*(b-S);e[s]=E+z,e[s+1]=A+j,e[o]=L+O,e[o+1]=I-D,e[a]=E-z,e[a+1]=A-j,e[l]=L-O,e[l+1]=I+D}}}}_singleTransform2(e,t,r,s,o){let n=e[s],a=e[s+1],i=e[s+o],l=e[s+o+1];t[r]=n+i,t[r+1]=a+l,t[r+2]=n-i,t[r+3]=a-l}_singleTransform4(e,t,r,s,o,n){let a=2*o,i=3*o,l=e[s],c=e[s+1],d=e[s+o],u=e[s+o+1],m=e[s+a],p=e[s+a+1],_=e[s+i],h=e[s+i+1],g=l+m,f=c+p,M=l-m,w=c-p,x=d+_,b=u+h,T=n*(d-_),P=n*(u-h);t[r]=g+x,t[r+1]=f+b,t[r+2]=M+P,t[r+3]=w-T,t[r+4]=g-x,t[r+5]=f-b,t[r+6]=M-P,t[r+7]=w+T}_realTransform4(e,t,r){let s,o,n=this._csize,a=1<<this._width,i=n/a<<1,l=this._bitrev;if(4===i)for(s=0,o=0;s<n;s+=i,++o){let r=l[o];this._singleRealTransform2(t,e,s,r>>>1,a>>>1)}else for(s=0,o=0;s<n;s+=i,++o){let n=l[o];this._singleRealTransform4(t,e,s,n>>>1,a>>>1,r)}let c=this.table;for(a>>=2;a>=2;a>>=2){let t=(i=n/a<<1)>>>1,o=t>>>1,l=o>>>1;for(s=0;s<n;s+=i)for(let n=0,i=0;n<=l;n+=2,i+=a){let a=s+n,d=a+o,u=d+o,m=u+o,p=e[a],_=e[a+1],h=e[d],g=e[d+1],f=e[u],M=e[u+1],w=e[m],x=e[m+1],b=c[i],T=r*c[i+1],P=h*b-g*T,y=h*T+g*b,k=c[2*i],F=r*c[2*i+1],v=f*k-M*F,C=f*F+M*k,S=c[3*i],E=r*c[3*i+1],A=w*S-x*E,L=w*E+x*S,I=p+v,z=_+C,j=p-v,D=_-C,O=P+A,V=y+L,N=r*(P-A),B=r*(y-L);if(e[a]=I+O,e[a+1]=z+V,e[d]=j+B,e[d+1]=D-N,0===n){e[u]=I-O,e[u+1]=z-V;continue}if(n===l)continue;let G=s+o-n,R=s+t-n;e[G]=j-r*B,e[G+1]=-D-r*N,e[R]=I-r*O,e[R+1]=-z+r*V}}let d=n>>>1;for(let t=2;t<d;t+=2)e[n-t]=e[t],e[n-t+1]=-e[t+1]}_singleRealTransform2(e,t,r,s,o){let n=e[s],a=e[s+o];t[r]=n+a,t[r+1]=0,t[r+2]=n-a,t[r+3]=0}_singleRealTransform4(e,t,r,s,o,n){let a=e[s],i=e[s+o],l=e[s+2*o],c=e[s+3*o],d=a+l,u=a-l,m=i+c,p=n*(i-c);t[r]=d+m,t[r+1]=0,t[r+2]=u,t[r+3]=-p,t[r+4]=d-m,t[r+5]=0,t[r+6]=u,t[r+7]=p}}class _{constructor(e){let t=2*(e-1),r=2*(2*e-1),s=2**Math.ceil(Math.log2(r));this.bufferSize=s,this._a=t;let o=new Float64Array(r),n=new Float64Array(s);this._chirpBuffer=new Float64Array(s),this._buffer1=new Float64Array(s),this._buffer2=new Float64Array(s),this._outBuffer1=new Float64Array(s),this._outBuffer2=new Float64Array(s);let a=-2*Math.PI/e,i=Math.cos(a),l=Math.sin(a);for(let t=0;t<r>>1;++t){let r=(t+1-e)**2/2,s=Math.sqrt(i**2+l**2)**r,a=r*Math.atan2(l,i),c=2*t;o[c]=s*Math.cos(a),o[c+1]=s*Math.sin(a),n[c]=o[c],n[c+1]=-o[c+1]}this._slicedChirpBuffer=o.subarray(t,r),this._f=new p(s>>1),this._f.transform(this._chirpBuffer,n)}_transform(e,t,r){let s=this._buffer1,o=this._buffer2,n=this._outBuffer1,a=this._outBuffer2,i=this._chirpBuffer,l=this._slicedChirpBuffer,c=this._a;if(r)for(let e=0;e<l.length;e+=2){let r=e+1,o=t[e>>1];s[e]=o*l[e],s[r]=o*l[r]}else for(let e=0;e<l.length;e+=2){let r=e+1;s[e]=t[e]*l[e]-t[r]*l[r],s[r]=t[e]*l[r]+t[r]*l[e]}this._f.transform(n,s);for(let e=0;e<i.length;e+=2){let t=e+1;o[e]=n[e]*i[e]-n[t]*i[t],o[t]=n[e]*i[t]+n[t]*i[e]}this._f.inverseTransform(a,o);for(let t=0;t<a.length;t+=2){let r=a[t+c],s=a[t+c+1],o=l[t],n=l[t+1];e[t]=r*o-s*n,e[t+1]=r*n+s*o}}transform(e,t){this._transform(e,t,!1)}realTransform(e,t){this._transform(e,t,!0)}}class h{constructor(e){this.fft_length=e,this.isPowerOfTwo=m(e),this.isPowerOfTwo?(this.fft=new p(e),this.outputBufferSize=2*e):(this.fft=new _(e),this.outputBufferSize=this.fft.bufferSize)}realTransform(e,t){this.fft.realTransform(e,t)}transform(e,t){this.fft.transform(e,t)}}function g(e,t){if(t%2==0||t<=0)throw Error("Window size must be a positive odd number");let r=new e.constructor(e.length),s=new e.constructor(t),o=Math.floor(t/2);for(let t=0;t<e.length;++t){let n=0;for(let r=-o;r<=o;++r){let o=t+r;o<0?o=Math.abs(o):o>=e.length&&(o=2*(e.length-1)-o),s[n++]=e[o]}s.sort(),r[t]=s[o]}return r}function f(e,t){let r=Math.pow(10,t);return Math.round(e*r)/r}function M(e){let t=Math.round(e);return Math.abs(e)%1==.5?t%2==0?t:t-1:t}function w(e){let t=e.length,r=e[0].length,s=[t+1,r+1],o=Array.from({length:s[0]},()=>Array(s[1]).fill(1/0));o[0][0]=0;let n=Array.from({length:s[0]},()=>Array(s[1]).fill(-1));for(let t=1;t<s[1];++t)for(let r=1;r<s[0];++r){let s,a,i=o[r-1][t-1],l=o[r-1][t],c=o[r][t-1];i<l&&i<c?(s=i,a=0):l<i&&l<c?(s=l,a=1):(s=c,a=2),o[r][t]=e[r-1][t-1]+s,n[r][t]=a}for(let e=0;e<s[1];++e)n[0][e]=2;for(let e=0;e<s[0];++e)n[e][0]=1;let a=t,i=r,l=[],c=[];for(;a>0||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 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,r)=>{r.r(t),r.d(t,{DataTypeMap:()=>a,Tensor:()=>i,cat:()=>b,full:()=>v,full_like:()=>C,interpolate:()=>c,interpolate_4d:()=>d,layer_norm:()=>f,matmul:()=>u,mean:()=>k,mean_pooling:()=>g,ones:()=>S,ones_like:()=>E,permute:()=>l,quantize_embeddings:()=>z,rand:()=>I,rfft:()=>m,slice:()=>h,stack:()=>T,std_mean:()=>y,topk:()=>p,zeros:()=>A,zeros_like:()=>L});var s=r("./src/utils/maths.js"),o=r("./src/backends/onnx.js"),n=r("./src/ops/registry.js");let 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 r=Number(t);if(Number.isInteger(r))return e._getitem(r)}return e[t]},set:(e,t,r)=>e[t]=r})}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){let[e,...t]=this.dims;if(t.length>0){let r=t.reduce((e,t)=>e*t);for(let s=0;s<e;++s)yield this._subarray(s,r,t)}else yield*this.data}_getitem(e){let[t,...r]=this.dims;if(e=x(e,t),!(r.length>0))return new i(this.type,[this.data[e]],r);{let t=r.reduce((e,t)=>e*t);return this._subarray(e,t,r)}}indexOf(e){let t=this.data;for(let r=0;r<t.length;++r)if(t[r]==e)return r;return -1}_subarray(e,t,r){let s=e*t,o=(e+1)*t,n="subarray"in this.data?this.data.subarray(s,o):this.data.slice(s,o);return new i(this.type,n,r)}item(){let e=this.data;if(1!==e.length)throw Error(`a Tensor with ${e.length} elements cannot be converted to Scalar`);return e[0]}tolist(){return function(e,t){let r=e.length;if(r!==t.reduce((e,t)=>e*t))throw Error(`cannot reshape array of size ${r} into shape (${t})`);let s=e;for(let e=t.length-1;e>=0;e--)s=s.reduce((r,s)=>{let o=r[r.length-1];return o.length<t[e]?o.push(s):r.push([s]),r},[[]]);return s[0]}(this.data,this.dims)}sigmoid(){return this.clone().sigmoid_()}sigmoid_(){let e=this.data;for(let t=0;t<e.length;++t)e[t]=1/(1+Math.exp(-e[t]));return this}map(e){return this.clone().map_(e)}map_(e){let t=this.data;for(let r=0;r<t.length;++r)t[r]=e(t[r],r,t);return this}mul(e){return this.clone().mul_(e)}mul_(e){let t=this.data;for(let r=0;r<t.length;++r)t[r]*=e;return this}div(e){return this.clone().div_(e)}div_(e){let t=this.data;for(let r=0;r<t.length;++r)t[r]/=e;return this}add(e){return this.clone().add_(e)}add_(e){let t=this.data;for(let r=0;r<t.length;++r)t[r]+=e;return this}sub(e){return this.clone().sub_(e)}sub_(e){let t=this.data;for(let r=0;r<t.length;++r)t[r]-=e;return this}clone(){return new i(this.type,this.data.slice(),this.dims.slice())}slice(...e){let t=[],r=[];for(let s=0;s<this.dims.length;++s){let o=e[s];if(null==o)r.push([0,this.dims[s]]),t.push(this.dims[s]);else if("number"==typeof o)o=x(o,this.dims[s],s),r.push([o,o+1]);else if(Array.isArray(o)&&2===o.length){let[e,n]=o;if((e=null===e?0:x(e,this.dims[s],s,!1))>(n=null===n?this.dims[s]:x(n,this.dims[s],s,!1)))throw Error(`Invalid slice: ${o}`);let a=[Math.max(e,0),Math.min(n,this.dims[s])];r.push(a),t.push(a[1]-a[0])}else throw Error(`Invalid slice: ${o}`)}let s=r.map(([e,t])=>t-e),o=s.reduce((e,t)=>e*t),n=this.data,a=new n.constructor(o),l=this.stride();for(let e=0;e<o;++e){let t=0;for(let o=s.length-1,n=e;o>=0;--o){let e=s[o];t+=(n%e+r[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,r=!1){if("fro"===e)e=2;else if("string"==typeof e)throw Error(`Unsupported norm: ${e}`);let s=this.data,o=(t,r)=>t+r**e;if(null===t){let t=s.reduce(o,0)**(1/e);return new i(this.type,[t],[])}let[n,a,l]=P(o,this,t,r);if(1!==e)for(let t=0;t<a.length;++t)a[t]=a[t]**(1/e);return new i(n,a,l)}normalize_(e=2,t=1){t=x(t,this.dims.length);let r=this.norm(e,t,!0),s=this.data,o=r.data;for(let e=0;e<s.length;++e){let r=0;for(let s=this.dims.length-1,o=e,n=1;s>=0;--s){let e=this.dims[s];s!==t&&(r+=o%e*n,n*=this.dims[s]),o=Math.floor(o/e)}s[e]/=o[r]}return this}normalize(e=2,t=1){return this.clone().normalize_(e,t)}stride(){return function(e){let t=Array(e.length);for(let r=e.length-1,s=1;r>=0;--r)t[r]=s,s*=e[r];return t}(this.dims)}squeeze(e=null){return new i(this.type,this.data,M(this.dims,e))}squeeze_(e=null){return this.dims=M(this.dims,e),this}unsqueeze(e=null){return new i(this.type,this.data,w(this.dims,e))}unsqueeze_(e=null){return this.dims=w(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let r=this.dims.slice(0,e),s=this.dims.slice(e,t+1),o=this.dims.slice(t+1);return this.dims=[...r,s.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 r=0;r<e.length;++r)if(-1===e[r]){if(-1!==t)throw Error("Only one dimension can be inferred");t=r}let r=this.data;if(-1!==t){let s=e.reduce((e,r,s)=>s!==t?e*r:e,1);e[t]=r.length/s}return new i(this.type,r,e)}neg_(){let e=this.data;for(let t=0;t<e.length;++t)e[t]=-e[t];return this}neg(){return this.clone().neg_()}gt(e){let t=new Uint8Array(this.data.length),r=this.data;for(let s=0;s<r.length;++s)t[s]=+(r[s]>e);return new i("bool",t,this.dims)}lt(e){let t=new Uint8Array(this.data.length),r=this.data;for(let s=0;s<r.length;++s)t[s]=+(r[s]<e);return new i("bool",t,this.dims)}clamp_(e,t){let r=this.data;for(let s=0;s<r.length;++s)r[s]=Math.min(Math.max(r[s],e),t);return this}clamp(e,t){return this.clone().clamp_(e,t)}round_(){let e=this.data;for(let t=0;t<e.length;++t)e[t]=Math.round(e[t]);return this}round(){return this.clone().round_()}mean(e=null,t=!1){return k(this,e,t)}min(e=null,t=!1){if(null===e){let e=(0,s.min)(this.data)[0];return new i(this.type,[e],[])}let[r,o,n]=P((e,t)=>Math.min(e,t),this,e,t,1/0);return new i(r,o,n)}max(e=null,t=!1){if(null===e){let e=(0,s.max)(this.data)[0];return new i(this.type,[e],[])}let[r,o,n]=P((e,t)=>Math.max(e,t),this,e,t,-1/0);return new i(r,o,n)}argmin(e=null,t=!1){if(null!==e)throw Error("`dim !== null` not yet implemented.");return new i("int64",[BigInt((0,s.min)(this.data)[1])],[])}argmax(e=null,t=!1){if(null!==e)throw Error("`dim !== null` not yet implemented.");return new i("int64",[BigInt((0,s.max)(this.data)[1])],[])}to(e){let t;if(this.type===e)return this;if(!a.hasOwnProperty(e))throw Error(`Unsupported type: ${e}`);let r=["int64","uint64"].includes(this.type),s=["int64","uint64"].includes(e);return r&&!s?t=Number:!r&&s&&(t=BigInt),new i(e,a[e].from(this.data,t),this.dims)}}function l(e,t){let[r,o]=(0,s.permute_data)(e.data,e.dims,t);return new i(e.type,r,o)}function c(e,[t,r],o="bilinear",n=!1){let a=e.dims.at(-3)??1,l=e.dims.at(-2),d=e.dims.at(-1),u=(0,s.interpolate_data)(e.data,[a,l,d],[t,r],o,n);return new i(e.type,u,[a,t,r])}async function d(e,{size:t=null,mode:r="bilinear"}={}){let s,o;if(4!==e.dims.length)throw Error("`interpolate_4d` currently only supports 4D input.");if(!t)throw Error("`interpolate_4d` requires a `size` argument.");if(2===t.length)s=[...e.dims.slice(0,2),...t];else if(3===t.length)s=[e.dims[0],...t];else if(4===t.length)s=t;else throw Error("`size` must be of length 2, 3, or 4.");if("nearest"===r)o=await n.TensorOpRegistry.nearest_interpolate_4d;else if("bilinear"===r)o=await n.TensorOpRegistry.bilinear_interpolate_4d;else if("bicubic"===r)o=await n.TensorOpRegistry.bicubic_interpolate_4d;else throw Error(`Unsupported mode: ${r}`);let a=new i("int64",new BigInt64Array(s.map(BigInt)),[s.length]);return await o({x:e,s:a})}async function u(e,t){let r=await n.TensorOpRegistry.matmul;return await r({a:e,b:t})}async function m(e,t){let r=await n.TensorOpRegistry.rfft;return await r({x:e,a:t})}async function p(e,t){let r=await n.TensorOpRegistry.top_k;return t=null==t?e.dims.at(-1):Math.min(t,e.dims.at(-1)),await r({x:e,k:new i("int64",[BigInt(t)],[1])})}let _=e=>new i("int64",e,[e.length]);async function h(e,t,r,s,o){let a=await n.TensorOpRegistry.slice;return await a({x:e,s:_(t),e:_(r),a:_(s),t:_(o??Array(s.length).fill(1))})}function g(e,t){let r=e.data,s=t.data,o=[e.dims[0],e.dims[2]],n=new r.constructor(o[0]*o[1]),[a,l,c]=e.dims,d=0;for(let e=0;e<a;++e){let t=e*c*l;for(let o=0;o<c;++o){let a=0,i=0,u=e*l,m=t+o;for(let e=0;e<l;++e){let t=Number(s[u+e]);i+=t,a+=r[m+e*c]*t}let p=a/i;n[d++]=p}}return new i(e.type,n,o)}function f(e,t,{eps:r=1e-5}={}){if(2!==e.dims.length)throw Error("`layer_norm` currently only supports 2D input.");let[s,o]=e.dims;if(1!==t.length&&t[0]!==o)throw Error("`normalized_shape` must be a 1D array with shape `[input.dims[1]]`.");let[n,a]=y(e,1,0,!0),l=n.data,c=a.data,d=e.data,u=new d.constructor(d.length);for(let e=0;e<s;++e){let t=e*o;for(let s=0;s<o;++s){let o=t+s;u[o]=(d[o]-c[e])/(l[e]+r)}}return new i(e.type,u,e.dims)}function M(e,t){return e=e.slice(),null===t?e=e.filter(e=>1!==e):"number"==typeof t?1===e[t]&&e.splice(t,1):Array.isArray(t)&&(e=e.filter((e,r)=>1!==e||!t.includes(r))),e}function w(e,t){return t=x(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function x(e,t,r=null,s=!0){if(e<-t||e>=t)if(!s)return e<-t?0:t;else throw Error(`IndexError: index ${e} is out of bounds for dimension${null===r?"":" "+r} with size ${t}`);return e<0&&(e=(e%t+t)%t),e}function b(e,t=0){t=x(t,e[0].dims.length);let r=e[0].dims.slice();r[t]=e.reduce((e,r)=>e+r.dims[t],0);let s=r.reduce((e,t)=>e*t,1),o=new e[0].data.constructor(s),n=e[0].type;if(0===t){let t=0;for(let r of e){let e=r.data;o.set(e,t),t+=e.length}}else{let s=0;for(let n=0;n<e.length;++n){let{data:a,dims:i}=e[n];for(let e=0;e<a.length;++e){let n=0;for(let o=i.length-1,a=e,l=1;o>=0;--o){let e=i[o],c=a%e;o===t&&(c+=s),n+=c*l,l*=r[o],a=Math.floor(a/e)}o[n]=a[e]}s+=i[t]}}return new i(n,o,r)}function T(e,t=0){return b(e.map(e=>e.unsqueeze(t)),t)}function P(e,t,r=null,s=!1,o=null){let n=t.data,a=t.dims;r=x(r,a.length);let i=a.slice();i[r]=1;let l=new n.constructor(n.length/a[r]);null!==o&&l.fill(o);for(let t=0;t<n.length;++t){let s=0;for(let e=a.length-1,o=t,n=1;e>=0;--e){let t=a[e];e!==r&&(s+=o%t*n,n*=i[e]),o=Math.floor(o/t)}l[s]=e(l[s],n[t],t,s)}return s||i.splice(r,1),[t.type,l,i]}function y(e,t=null,r=1,s=!1){let o=e.data,n=e.dims;if(null===t){let t=o.reduce((e,t)=>e+t,0)/o.length,s=Math.sqrt(o.reduce((e,r)=>e+(r-t)**2,0)/(o.length-r)),n=new i(e.type,[t],[]);return[new i(e.type,[s],[]),n]}let a=k(e,t=x(t,n.length),s),l=a.data,[c,d,u]=P((e,t,r,s)=>e+(t-l[s])**2,e,t,s);for(let e=0;e<d.length;++e)d[e]=Math.sqrt(d[e]/(n[t]-r));return[new i(c,d,u),a]}function k(e,t=null,r=!1){let s=e.dims,o=e.data;if(null===t){let t=o.reduce((e,t)=>e+t,0);return new i(e.type,[t/o.length],[])}let[n,a,l]=P((e,t)=>e+t,e,t=x(t,s.length),r);if(1!==s[t])for(let e=0;e<a.length;++e)a[e]/=s[t];return new i(n,a,l)}function F(e,t,r,s){return new i(r,new s(e.reduce((e,t)=>e*t,1)).fill(t),e)}function v(e,t){let r,s;if("number"==typeof t)r="float32",s=Float32Array;else if("bigint"==typeof t)r="int64",s=BigInt64Array;else if("boolean"==typeof t)r="bool",s=Uint8Array;else throw Error(`Unsupported data type: ${typeof t}`);return F(e,t,r,s)}function C(e,t){return v(e.dims,t)}function S(e){return F(e,1n,"int64",BigInt64Array)}function E(e){return S(e.dims)}function A(e){return F(e,0n,"int64",BigInt64Array)}function L(e){return A(e.dims)}function I(e){let t=e.reduce((e,t)=>e*t,1);return new i("float32",Float32Array.from({length:t},()=>Math.random()),e)}function z(e,t){if(2!==e.dims.length)throw Error("The tensor must have 2 dimensions");if(e.dims.at(-1)%8!=0)throw Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(t))throw Error("The precision must be either 'binary' or 'ubinary'");let r="binary"===t,s=r?Int8Array:Uint8Array,o=e.data,n=new s(o.length/8);for(let e=0;e<o.length;++e){let t=+(o[e]>0),s=Math.floor(e/8),a=e%8;n[s]|=t<<7-a,r&&0===a&&(n[s]-=128)}return new i(r?"int8":"uint8",n,[e.dims[0],e.dims[1]/8])}},"./src/utils/video.js":(e,t,r)=>{r.r(t),r.d(t,{RawVideo:()=>a,RawVideoFrame:()=>n,load_video:()=>i});var s=r("./src/utils/image.js"),o=r("./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 s.RawImage&&(e=e.map((r,s)=>new n(r,(s+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:r=null}={}){let l,c;if(!o.apis.IS_BROWSER_ENV)throw Error("`load_video` is currently only supported in browser environments.");if(null==t&&null==r)throw Error("Either num_frames or fps must be provided.");let d=[],u=document.createElement("video");if(u.crossOrigin="anonymous",u.muted=!0,"string"==typeof e)u.src=e;else if(e instanceof Blob)u.src=URL.createObjectURL(e);else if(e instanceof HTMLVideoElement)u.src=e.src;else throw Error("Invalid URL or video element provided.");if(await new Promise(e=>u.onloadedmetadata=e),u.seekable.start(0)===u.seekable.end(0)){let e=await fetch(u.src),t=await e.blob();u.src=URL.createObjectURL(t),await new Promise(e=>u.onloadedmetadata=e)}let m=u.duration;null!=t?(l=t,c=1===t?0:m/(t-1)):l=Math.floor(m/(c=1/r));let p=[];for(let e=0;e<l;++e)p.push(1===t?m/2:e*c);let _=document.createElement("canvas");_.width=u.videoWidth,_.height=u.videoHeight;let h=_.getContext("2d",{willReadFrequently:!0});for(let e of p){u.currentTime=e,await new Promise(e=>{u.onseeked=e}),h.drawImage(u,0,0,_.width,_.height);let t=h.getImageData(0,0,_.width,_.height),r=new n(new s.RawImage(t.data,_.width,_.height,4),e);d.push(r)}return u.remove(),new a(d,m)}}},l={};function c(e){var t=l[e];if(void 0!==t)return t.exports;var r=l[e]={exports:{}};return i[e](r,r.exports,c),r.exports}(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;c.t=function(r,s){if(1&s&&(r=this(r)),8&s||"object"==typeof r&&r&&(4&s&&r.__esModule||16&s&&"function"==typeof r.then))return r;var o=Object.create(null);c.r(o);var n={};e=e||[null,t({}),t([]),t(t)];for(var a=2&s&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach(e=>n[e]=()=>r[e]);return n.default=()=>r,c.d(o,n),o}})(),c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};(()=>{c.r(d),c.d(d,{ASTFeatureExtractor:()=>p.ASTFeatureExtractor,ASTForAudioClassification:()=>r.ASTForAudioClassification,ASTModel:()=>r.ASTModel,ASTPreTrainedModel:()=>r.ASTPreTrainedModel,AlbertForMaskedLM:()=>r.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>r.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>r.AlbertForSequenceClassification,AlbertModel:()=>r.AlbertModel,AlbertPreTrainedModel:()=>r.AlbertPreTrainedModel,AlbertTokenizer:()=>s.AlbertTokenizer,AudioClassificationPipeline:()=>t.AudioClassificationPipeline,AutoConfig:()=>o.AutoConfig,AutoFeatureExtractor:()=>_.AutoFeatureExtractor,AutoImageProcessor:()=>f.AutoImageProcessor,AutoModel:()=>r.AutoModel,AutoModelForAudioClassification:()=>r.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>r.AutoModelForAudioFrameClassification,AutoModelForAudioTextToText:()=>r.AutoModelForAudioTextToText,AutoModelForCTC:()=>r.AutoModelForCTC,AutoModelForCausalLM:()=>r.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>r.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>r.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>r.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>r.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>r.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>r.AutoModelForImageSegmentation,AutoModelForImageTextToText:()=>r.AutoModelForImageTextToText,AutoModelForImageToImage:()=>r.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>r.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>r.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>r.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>r.AutoModelForObjectDetection,AutoModelForPoseEstimation:()=>r.AutoModelForPoseEstimation,AutoModelForQuestionAnswering:()=>r.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>r.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>r.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>r.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>r.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>r.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>r.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>r.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>r.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>r.AutoModelForVision2Seq,AutoModelForXVector:()=>r.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>r.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>x.AutoProcessor,AutoTokenizer:()=>s.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>t.AutomaticSpeechRecognitionPipeline,BackgroundRemovalPipeline:()=>t.BackgroundRemovalPipeline,BartForConditionalGeneration:()=>r.BartForConditionalGeneration,BartForSequenceClassification:()=>r.BartForSequenceClassification,BartModel:()=>r.BartModel,BartPretrainedModel:()=>r.BartPretrainedModel,BartTokenizer:()=>s.BartTokenizer,BaseModelOutput:()=>r.BaseModelOutput,BaseStreamer:()=>b.BaseStreamer,BeitFeatureExtractor:()=>g.BeitFeatureExtractor,BeitForImageClassification:()=>r.BeitForImageClassification,BeitModel:()=>r.BeitModel,BeitPreTrainedModel:()=>r.BeitPreTrainedModel,BertForMaskedLM:()=>r.BertForMaskedLM,BertForQuestionAnswering:()=>r.BertForQuestionAnswering,BertForSequenceClassification:()=>r.BertForSequenceClassification,BertForTokenClassification:()=>r.BertForTokenClassification,BertModel:()=>r.BertModel,BertPreTrainedModel:()=>r.BertPreTrainedModel,BertTokenizer:()=>s.BertTokenizer,BitImageProcessor:()=>g.BitImageProcessor,BlenderbotForConditionalGeneration:()=>r.BlenderbotForConditionalGeneration,BlenderbotModel:()=>r.BlenderbotModel,BlenderbotPreTrainedModel:()=>r.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>r.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>r.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>r.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>s.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>s.BlenderbotTokenizer,BloomForCausalLM:()=>r.BloomForCausalLM,BloomModel:()=>r.BloomModel,BloomPreTrainedModel:()=>r.BloomPreTrainedModel,BloomTokenizer:()=>s.BloomTokenizer,CLIPFeatureExtractor:()=>g.CLIPFeatureExtractor,CLIPImageProcessor:()=>g.CLIPImageProcessor,CLIPModel:()=>r.CLIPModel,CLIPPreTrainedModel:()=>r.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>r.CLIPSegForImageSegmentation,CLIPSegModel:()=>r.CLIPSegModel,CLIPSegPreTrainedModel:()=>r.CLIPSegPreTrainedModel,CLIPTextModel:()=>r.CLIPTextModel,CLIPTextModelWithProjection:()=>r.CLIPTextModelWithProjection,CLIPTokenizer:()=>s.CLIPTokenizer,CLIPVisionModel:()=>r.CLIPVisionModel,CLIPVisionModelWithProjection:()=>r.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>r.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>r.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>r.CamembertForSequenceClassification,CamembertForTokenClassification:()=>r.CamembertForTokenClassification,CamembertModel:()=>r.CamembertModel,CamembertPreTrainedModel:()=>r.CamembertPreTrainedModel,CamembertTokenizer:()=>s.CamembertTokenizer,CausalLMOutput:()=>r.CausalLMOutput,CausalLMOutputWithPast:()=>r.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>g.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>r.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>r.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>r.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>p.ClapFeatureExtractor,ClapModel:()=>r.ClapModel,ClapPreTrainedModel:()=>r.ClapPreTrainedModel,ClapTextModelWithProjection:()=>r.ClapTextModelWithProjection,ClassifierFreeGuidanceLogitsProcessor:()=>P.ClassifierFreeGuidanceLogitsProcessor,CodeGenForCausalLM:()=>r.CodeGenForCausalLM,CodeGenModel:()=>r.CodeGenModel,CodeGenPreTrainedModel:()=>r.CodeGenPreTrainedModel,CodeGenTokenizer:()=>s.CodeGenTokenizer,CodeLlamaTokenizer:()=>s.CodeLlamaTokenizer,CohereForCausalLM:()=>r.CohereForCausalLM,CohereModel:()=>r.CohereModel,CoherePreTrainedModel:()=>r.CoherePreTrainedModel,CohereTokenizer:()=>s.CohereTokenizer,ConvBertForMaskedLM:()=>r.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>r.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>r.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>r.ConvBertForTokenClassification,ConvBertModel:()=>r.ConvBertModel,ConvBertPreTrainedModel:()=>r.ConvBertPreTrainedModel,ConvBertTokenizer:()=>s.ConvBertTokenizer,ConvNextFeatureExtractor:()=>g.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>r.ConvNextForImageClassification,ConvNextImageProcessor:()=>g.ConvNextImageProcessor,ConvNextModel:()=>r.ConvNextModel,ConvNextPreTrainedModel:()=>r.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>r.ConvNextV2ForImageClassification,ConvNextV2Model:()=>r.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>r.ConvNextV2PreTrainedModel,DFineForObjectDetection:()=>r.DFineForObjectDetection,DFineModel:()=>r.DFineModel,DFinePreTrainedModel:()=>r.DFinePreTrainedModel,DPTFeatureExtractor:()=>g.DPTFeatureExtractor,DPTForDepthEstimation:()=>r.DPTForDepthEstimation,DPTImageProcessor:()=>g.DPTImageProcessor,DPTModel:()=>r.DPTModel,DPTPreTrainedModel:()=>r.DPTPreTrainedModel,DacDecoderModel:()=>r.DacDecoderModel,DacDecoderOutput:()=>r.DacDecoderOutput,DacEncoderModel:()=>r.DacEncoderModel,DacEncoderOutput:()=>r.DacEncoderOutput,DacFeatureExtractor:()=>p.DacFeatureExtractor,DacModel:()=>r.DacModel,DacPreTrainedModel:()=>r.DacPreTrainedModel,DataTypeMap:()=>l.DataTypeMap,DebertaForMaskedLM:()=>r.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>r.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>r.DebertaForSequenceClassification,DebertaForTokenClassification:()=>r.DebertaForTokenClassification,DebertaModel:()=>r.DebertaModel,DebertaPreTrainedModel:()=>r.DebertaPreTrainedModel,DebertaTokenizer:()=>s.DebertaTokenizer,DebertaV2ForMaskedLM:()=>r.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>r.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>r.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>r.DebertaV2ForTokenClassification,DebertaV2Model:()=>r.DebertaV2Model,DebertaV2PreTrainedModel:()=>r.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>s.DebertaV2Tokenizer,DecisionTransformerModel:()=>r.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>r.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>g.DeiTFeatureExtractor,DeiTForImageClassification:()=>r.DeiTForImageClassification,DeiTImageProcessor:()=>g.DeiTImageProcessor,DeiTModel:()=>r.DeiTModel,DeiTPreTrainedModel:()=>r.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>r.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>r.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>t.DepthEstimationPipeline,DepthProForDepthEstimation:()=>r.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>r.DepthProPreTrainedModel,DetrFeatureExtractor:()=>g.DetrFeatureExtractor,DetrForObjectDetection:()=>r.DetrForObjectDetection,DetrForSegmentation:()=>r.DetrForSegmentation,DetrImageProcessor:()=>g.DetrImageProcessor,DetrModel:()=>r.DetrModel,DetrObjectDetectionOutput:()=>r.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>r.DetrPreTrainedModel,DetrSegmentationOutput:()=>r.DetrSegmentationOutput,Dinov2ForImageClassification:()=>r.Dinov2ForImageClassification,Dinov2Model:()=>r.Dinov2Model,Dinov2PreTrainedModel:()=>r.Dinov2PreTrainedModel,Dinov2WithRegistersForImageClassification:()=>r.Dinov2WithRegistersForImageClassification,Dinov2WithRegistersModel:()=>r.Dinov2WithRegistersModel,Dinov2WithRegistersPreTrainedModel:()=>r.Dinov2WithRegistersPreTrainedModel,DistilBertForMaskedLM:()=>r.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>r.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>r.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>r.DistilBertForTokenClassification,DistilBertModel:()=>r.DistilBertModel,DistilBertPreTrainedModel:()=>r.DistilBertPreTrainedModel,DistilBertTokenizer:()=>s.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>t.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>g.DonutFeatureExtractor,DonutImageProcessor:()=>g.DonutImageProcessor,DonutSwinModel:()=>r.DonutSwinModel,DonutSwinPreTrainedModel:()=>r.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>r.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>g.EfficientNetImageProcessor,EfficientNetModel:()=>r.EfficientNetModel,EfficientNetPreTrainedModel:()=>r.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>r.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>r.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>r.ElectraForSequenceClassification,ElectraForTokenClassification:()=>r.ElectraForTokenClassification,ElectraModel:()=>r.ElectraModel,ElectraPreTrainedModel:()=>r.ElectraPreTrainedModel,ElectraTokenizer:()=>s.ElectraTokenizer,EncodecFeatureExtractor:()=>p.EncodecFeatureExtractor,EosTokenCriteria:()=>T.EosTokenCriteria,EsmForMaskedLM:()=>r.EsmForMaskedLM,EsmForSequenceClassification:()=>r.EsmForSequenceClassification,EsmForTokenClassification:()=>r.EsmForTokenClassification,EsmModel:()=>r.EsmModel,EsmPreTrainedModel:()=>r.EsmPreTrainedModel,EsmTokenizer:()=>s.EsmTokenizer,ExaoneForCausalLM:()=>r.ExaoneForCausalLM,ExaoneModel:()=>r.ExaoneModel,ExaonePreTrainedModel:()=>r.ExaonePreTrainedModel,FFT:()=>u.FFT,FalconForCausalLM:()=>r.FalconForCausalLM,FalconModel:()=>r.FalconModel,FalconPreTrainedModel:()=>r.FalconPreTrainedModel,FalconTokenizer:()=>s.FalconTokenizer,FastViTForImageClassification:()=>r.FastViTForImageClassification,FastViTModel:()=>r.FastViTModel,FastViTPreTrainedModel:()=>r.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>t.FeatureExtractionPipeline,FeatureExtractor:()=>m.FeatureExtractor,FillMaskPipeline:()=>t.FillMaskPipeline,Florence2ForConditionalGeneration:()=>r.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>r.Florence2PreTrainedModel,Florence2Processor:()=>w.Florence2Processor,ForcedBOSTokenLogitsProcessor:()=>P.ForcedBOSTokenLogitsProcessor,ForcedEOSTokenLogitsProcessor:()=>P.ForcedEOSTokenLogitsProcessor,GLPNFeatureExtractor:()=>g.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>r.GLPNForDepthEstimation,GLPNModel:()=>r.GLPNModel,GLPNPreTrainedModel:()=>r.GLPNPreTrainedModel,GPT2LMHeadModel:()=>r.GPT2LMHeadModel,GPT2Model:()=>r.GPT2Model,GPT2PreTrainedModel:()=>r.GPT2PreTrainedModel,GPT2Tokenizer:()=>s.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>r.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>r.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>r.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>r.GPTJForCausalLM,GPTJModel:()=>r.GPTJModel,GPTJPreTrainedModel:()=>r.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>r.GPTNeoForCausalLM,GPTNeoModel:()=>r.GPTNeoModel,GPTNeoPreTrainedModel:()=>r.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>r.GPTNeoXForCausalLM,GPTNeoXModel:()=>r.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>r.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>s.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>r.Gemma2ForCausalLM,Gemma2Model:()=>r.Gemma2Model,Gemma2PreTrainedModel:()=>r.Gemma2PreTrainedModel,Gemma3ForCausalLM:()=>r.Gemma3ForCausalLM,Gemma3Model:()=>r.Gemma3Model,Gemma3PreTrainedModel:()=>r.Gemma3PreTrainedModel,GemmaForCausalLM:()=>r.GemmaForCausalLM,GemmaModel:()=>r.GemmaModel,GemmaPreTrainedModel:()=>r.GemmaPreTrainedModel,GemmaTokenizer:()=>s.GemmaTokenizer,GlmForCausalLM:()=>r.GlmForCausalLM,GlmModel:()=>r.GlmModel,GlmPreTrainedModel:()=>r.GlmPreTrainedModel,GraniteForCausalLM:()=>r.GraniteForCausalLM,GraniteModel:()=>r.GraniteModel,GranitePreTrainedModel:()=>r.GranitePreTrainedModel,Grok1Tokenizer:()=>s.Grok1Tokenizer,GroundingDinoForObjectDetection:()=>r.GroundingDinoForObjectDetection,GroundingDinoImageProcessor:()=>g.GroundingDinoImageProcessor,GroundingDinoPreTrainedModel:()=>r.GroundingDinoPreTrainedModel,GroundingDinoProcessor:()=>w.GroundingDinoProcessor,GroupViTModel:()=>r.GroupViTModel,GroupViTPreTrainedModel:()=>r.GroupViTPreTrainedModel,HeliumForCausalLM:()=>r.HeliumForCausalLM,HeliumModel:()=>r.HeliumModel,HeliumPreTrainedModel:()=>r.HeliumPreTrainedModel,HerbertTokenizer:()=>s.HerbertTokenizer,HieraForImageClassification:()=>r.HieraForImageClassification,HieraModel:()=>r.HieraModel,HieraPreTrainedModel:()=>r.HieraPreTrainedModel,HubertForCTC:()=>r.HubertForCTC,HubertForSequenceClassification:()=>r.HubertForSequenceClassification,HubertModel:()=>r.HubertModel,HubertPreTrainedModel:()=>r.HubertPreTrainedModel,IJepaForImageClassification:()=>r.IJepaForImageClassification,IJepaModel:()=>r.IJepaModel,IJepaPreTrainedModel:()=>r.IJepaPreTrainedModel,Idefics3ForConditionalGeneration:()=>r.Idefics3ForConditionalGeneration,Idefics3ImageProcessor:()=>g.Idefics3ImageProcessor,Idefics3PreTrainedModel:()=>r.Idefics3PreTrainedModel,Idefics3Processor:()=>w.Idefics3Processor,ImageClassificationPipeline:()=>t.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>t.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>p.ImageFeatureExtractor,ImageMattingOutput:()=>r.ImageMattingOutput,ImageProcessor:()=>h.ImageProcessor,ImageSegmentationPipeline:()=>t.ImageSegmentationPipeline,ImageToImagePipeline:()=>t.ImageToImagePipeline,ImageToTextPipeline:()=>t.ImageToTextPipeline,InterruptableStoppingCriteria:()=>T.InterruptableStoppingCriteria,JAISLMHeadModel:()=>r.JAISLMHeadModel,JAISModel:()=>r.JAISModel,JAISPreTrainedModel:()=>r.JAISPreTrainedModel,JinaCLIPImageProcessor:()=>g.JinaCLIPImageProcessor,JinaCLIPModel:()=>r.JinaCLIPModel,JinaCLIPPreTrainedModel:()=>r.JinaCLIPPreTrainedModel,JinaCLIPProcessor:()=>w.JinaCLIPProcessor,JinaCLIPTextModel:()=>r.JinaCLIPTextModel,JinaCLIPVisionModel:()=>r.JinaCLIPVisionModel,LiteWhisperForConditionalGeneration:()=>r.LiteWhisperForConditionalGeneration,LlamaForCausalLM:()=>r.LlamaForCausalLM,LlamaModel:()=>r.LlamaModel,LlamaPreTrainedModel:()=>r.LlamaPreTrainedModel,LlamaTokenizer:()=>s.LlamaTokenizer,LlavaForConditionalGeneration:()=>r.LlavaForConditionalGeneration,LlavaOnevisionForConditionalGeneration:()=>r.LlavaOnevisionForConditionalGeneration,LlavaOnevisionImageProcessor:()=>g.LlavaOnevisionImageProcessor,LlavaPreTrainedModel:()=>r.LlavaPreTrainedModel,LogitsProcessor:()=>P.LogitsProcessor,LogitsProcessorList:()=>P.LogitsProcessorList,LogitsWarper:()=>P.LogitsWarper,LongT5ForConditionalGeneration:()=>r.LongT5ForConditionalGeneration,LongT5Model:()=>r.LongT5Model,LongT5PreTrainedModel:()=>r.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>r.M2M100ForConditionalGeneration,M2M100Model:()=>r.M2M100Model,M2M100PreTrainedModel:()=>r.M2M100PreTrainedModel,M2M100Tokenizer:()=>s.M2M100Tokenizer,MBart50Tokenizer:()=>s.MBart50Tokenizer,MBartForCausalLM:()=>r.MBartForCausalLM,MBartForConditionalGeneration:()=>r.MBartForConditionalGeneration,MBartForSequenceClassification:()=>r.MBartForSequenceClassification,MBartModel:()=>r.MBartModel,MBartPreTrainedModel:()=>r.MBartPreTrainedModel,MBartTokenizer:()=>s.MBartTokenizer,MPNetForMaskedLM:()=>r.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>r.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>r.MPNetForSequenceClassification,MPNetForTokenClassification:()=>r.MPNetForTokenClassification,MPNetModel:()=>r.MPNetModel,MPNetPreTrainedModel:()=>r.MPNetPreTrainedModel,MPNetTokenizer:()=>s.MPNetTokenizer,MT5ForConditionalGeneration:()=>r.MT5ForConditionalGeneration,MT5Model:()=>r.MT5Model,MT5PreTrainedModel:()=>r.MT5PreTrainedModel,MarianMTModel:()=>r.MarianMTModel,MarianModel:()=>r.MarianModel,MarianPreTrainedModel:()=>r.MarianPreTrainedModel,MarianTokenizer:()=>s.MarianTokenizer,Mask2FormerImageProcessor:()=>g.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>g.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>r.MaskFormerForInstanceSegmentation,MaskFormerImageProcessor:()=>g.MaskFormerImageProcessor,MaskFormerModel:()=>r.MaskFormerModel,MaskFormerPreTrainedModel:()=>r.MaskFormerPreTrainedModel,MaskedLMOutput:()=>r.MaskedLMOutput,MaxLengthCriteria:()=>T.MaxLengthCriteria,Metric3DForDepthEstimation:()=>r.Metric3DForDepthEstimation,Metric3DPreTrainedModel:()=>r.Metric3DPreTrainedModel,Metric3Dv2ForDepthEstimation:()=>r.Metric3Dv2ForDepthEstimation,Metric3Dv2PreTrainedModel:()=>r.Metric3Dv2PreTrainedModel,MgpstrForSceneTextRecognition:()=>r.MgpstrForSceneTextRecognition,MgpstrModelOutput:()=>r.MgpstrModelOutput,MgpstrPreTrainedModel:()=>r.MgpstrPreTrainedModel,MgpstrProcessor:()=>w.MgpstrProcessor,MgpstrTokenizer:()=>s.MgpstrTokenizer,MimiDecoderModel:()=>r.MimiDecoderModel,MimiDecoderOutput:()=>r.MimiDecoderOutput,MimiEncoderModel:()=>r.MimiEncoderModel,MimiEncoderOutput:()=>r.MimiEncoderOutput,MimiModel:()=>r.MimiModel,MimiPreTrainedModel:()=>r.MimiPreTrainedModel,MinLengthLogitsProcessor:()=>P.MinLengthLogitsProcessor,MinNewTokensLengthLogitsProcessor:()=>P.MinNewTokensLengthLogitsProcessor,MistralForCausalLM:()=>r.MistralForCausalLM,MistralModel:()=>r.MistralModel,MistralPreTrainedModel:()=>r.MistralPreTrainedModel,MobileBertForMaskedLM:()=>r.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>r.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>r.MobileBertForSequenceClassification,MobileBertModel:()=>r.MobileBertModel,MobileBertPreTrainedModel:()=>r.MobileBertPreTrainedModel,MobileBertTokenizer:()=>s.MobileBertTokenizer,MobileLLMForCausalLM:()=>r.MobileLLMForCausalLM,MobileLLMModel:()=>r.MobileLLMModel,MobileLLMPreTrainedModel:()=>r.MobileLLMPreTrainedModel,MobileNetV1FeatureExtractor:()=>g.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>r.MobileNetV1ForImageClassification,MobileNetV1ForSemanticSegmentation:()=>r.MobileNetV1ForSemanticSegmentation,MobileNetV1ImageProcessor:()=>g.MobileNetV1ImageProcessor,MobileNetV1Model:()=>r.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>r.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>g.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>r.MobileNetV2ForImageClassification,MobileNetV2ForSemanticSegmentation:()=>r.MobileNetV2ForSemanticSegmentation,MobileNetV2ImageProcessor:()=>g.MobileNetV2ImageProcessor,MobileNetV2Model:()=>r.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>r.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>g.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>r.MobileNetV3ForImageClassification,MobileNetV3ForSemanticSegmentation:()=>r.MobileNetV3ForSemanticSegmentation,MobileNetV3ImageProcessor:()=>g.MobileNetV3ImageProcessor,MobileNetV3Model:()=>r.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>r.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>g.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>r.MobileNetV4ForImageClassification,MobileNetV4ForSemanticSegmentation:()=>r.MobileNetV4ForSemanticSegmentation,MobileNetV4ImageProcessor:()=>g.MobileNetV4ImageProcessor,MobileNetV4Model:()=>r.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>r.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>g.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>r.MobileViTForImageClassification,MobileViTImageProcessor:()=>g.MobileViTImageProcessor,MobileViTModel:()=>r.MobileViTModel,MobileViTPreTrainedModel:()=>r.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>r.MobileViTV2ForImageClassification,MobileViTV2Model:()=>r.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>r.MobileViTV2PreTrainedModel,ModelOutput:()=>r.ModelOutput,ModernBertForMaskedLM:()=>r.ModernBertForMaskedLM,ModernBertForSequenceClassification:()=>r.ModernBertForSequenceClassification,ModernBertForTokenClassification:()=>r.ModernBertForTokenClassification,ModernBertModel:()=>r.ModernBertModel,ModernBertPreTrainedModel:()=>r.ModernBertPreTrainedModel,Moondream1ForConditionalGeneration:()=>r.Moondream1ForConditionalGeneration,MoonshineFeatureExtractor:()=>p.MoonshineFeatureExtractor,MoonshineForConditionalGeneration:()=>r.MoonshineForConditionalGeneration,MoonshineModel:()=>r.MoonshineModel,MoonshinePreTrainedModel:()=>r.MoonshinePreTrainedModel,MoonshineProcessor:()=>w.MoonshineProcessor,MptForCausalLM:()=>r.MptForCausalLM,MptModel:()=>r.MptModel,MptPreTrainedModel:()=>r.MptPreTrainedModel,MultiModalityCausalLM:()=>r.MultiModalityCausalLM,MultiModalityPreTrainedModel:()=>r.MultiModalityPreTrainedModel,MusicgenForCausalLM:()=>r.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>r.MusicgenForConditionalGeneration,MusicgenModel:()=>r.MusicgenModel,MusicgenPreTrainedModel:()=>r.MusicgenPreTrainedModel,NllbTokenizer:()=>s.NllbTokenizer,NoBadWordsLogitsProcessor:()=>P.NoBadWordsLogitsProcessor,NoRepeatNGramLogitsProcessor:()=>P.NoRepeatNGramLogitsProcessor,NomicBertModel:()=>r.NomicBertModel,NomicBertPreTrainedModel:()=>r.NomicBertPreTrainedModel,NougatImageProcessor:()=>g.NougatImageProcessor,NougatTokenizer:()=>s.NougatTokenizer,OPTForCausalLM:()=>r.OPTForCausalLM,OPTModel:()=>r.OPTModel,OPTPreTrainedModel:()=>r.OPTPreTrainedModel,ObjectDetectionPipeline:()=>t.ObjectDetectionPipeline,Olmo2ForCausalLM:()=>r.Olmo2ForCausalLM,Olmo2Model:()=>r.Olmo2Model,Olmo2PreTrainedModel:()=>r.Olmo2PreTrainedModel,OlmoForCausalLM:()=>r.OlmoForCausalLM,OlmoModel:()=>r.OlmoModel,OlmoPreTrainedModel:()=>r.OlmoPreTrainedModel,OpenELMForCausalLM:()=>r.OpenELMForCausalLM,OpenELMModel:()=>r.OpenELMModel,OpenELMPreTrainedModel:()=>r.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>g.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>r.OwlViTForObjectDetection,OwlViTImageProcessor:()=>g.OwlViTImageProcessor,OwlViTModel:()=>r.OwlViTModel,OwlViTPreTrainedModel:()=>r.OwlViTPreTrainedModel,OwlViTProcessor:()=>w.OwlViTProcessor,Owlv2ForObjectDetection:()=>r.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>g.Owlv2ImageProcessor,Owlv2Model:()=>r.Owlv2Model,Owlv2PreTrainedModel:()=>r.Owlv2PreTrainedModel,PaliGemmaForConditionalGeneration:()=>r.PaliGemmaForConditionalGeneration,PaliGemmaPreTrainedModel:()=>r.PaliGemmaPreTrainedModel,PaliGemmaProcessor:()=>w.PaliGemmaProcessor,PatchTSMixerForPrediction:()=>r.PatchTSMixerForPrediction,PatchTSMixerModel:()=>r.PatchTSMixerModel,PatchTSMixerPreTrainedModel:()=>r.PatchTSMixerPreTrainedModel,PatchTSTForPrediction:()=>r.PatchTSTForPrediction,PatchTSTModel:()=>r.PatchTSTModel,PatchTSTPreTrainedModel:()=>r.PatchTSTPreTrainedModel,Phi3ForCausalLM:()=>r.Phi3ForCausalLM,Phi3Model:()=>r.Phi3Model,Phi3PreTrainedModel:()=>r.Phi3PreTrainedModel,Phi3VForCausalLM:()=>r.Phi3VForCausalLM,Phi3VImageProcessor:()=>g.Phi3VImageProcessor,Phi3VPreTrainedModel:()=>r.Phi3VPreTrainedModel,Phi3VProcessor:()=>w.Phi3VProcessor,PhiForCausalLM:()=>r.PhiForCausalLM,PhiModel:()=>r.PhiModel,PhiPreTrainedModel:()=>r.PhiPreTrainedModel,Pipeline:()=>t.Pipeline,PreTrainedModel:()=>r.PreTrainedModel,PreTrainedTokenizer:()=>s.PreTrainedTokenizer,PretrainedConfig:()=>o.PretrainedConfig,PretrainedMixin:()=>r.PretrainedMixin,Processor:()=>M.Processor,PvtForImageClassification:()=>r.PvtForImageClassification,PvtImageProcessor:()=>g.PvtImageProcessor,PvtModel:()=>r.PvtModel,PvtPreTrainedModel:()=>r.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>p.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>r.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>r.PyAnnoteModel,PyAnnotePreTrainedModel:()=>r.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>w.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>r.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>t.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>r.Qwen2ForCausalLM,Qwen2Model:()=>r.Qwen2Model,Qwen2PreTrainedModel:()=>r.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>s.Qwen2Tokenizer,Qwen2VLForConditionalGeneration:()=>r.Qwen2VLForConditionalGeneration,Qwen2VLImageProcessor:()=>g.Qwen2VLImageProcessor,Qwen2VLPreTrainedModel:()=>r.Qwen2VLPreTrainedModel,Qwen2VLProcessor:()=>w.Qwen2VLProcessor,Qwen3ForCausalLM:()=>r.Qwen3ForCausalLM,Qwen3Model:()=>r.Qwen3Model,Qwen3PreTrainedModel:()=>r.Qwen3PreTrainedModel,RFDetrForObjectDetection:()=>r.RFDetrForObjectDetection,RFDetrModel:()=>r.RFDetrModel,RFDetrObjectDetectionOutput:()=>r.RFDetrObjectDetectionOutput,RFDetrPreTrainedModel:()=>r.RFDetrPreTrainedModel,RTDetrForObjectDetection:()=>r.RTDetrForObjectDetection,RTDetrImageProcessor:()=>g.RTDetrImageProcessor,RTDetrModel:()=>r.RTDetrModel,RTDetrObjectDetectionOutput:()=>r.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>r.RTDetrPreTrainedModel,RTDetrV2ForObjectDetection:()=>r.RTDetrV2ForObjectDetection,RTDetrV2Model:()=>r.RTDetrV2Model,RTDetrV2ObjectDetectionOutput:()=>r.RTDetrV2ObjectDetectionOutput,RTDetrV2PreTrainedModel:()=>r.RTDetrV2PreTrainedModel,RawAudio:()=>n.RawAudio,RawImage:()=>a.RawImage,RawVideo:()=>i.RawVideo,RawVideoFrame:()=>i.RawVideoFrame,RepetitionPenaltyLogitsProcessor:()=>P.RepetitionPenaltyLogitsProcessor,ResNetForImageClassification:()=>r.ResNetForImageClassification,ResNetModel:()=>r.ResNetModel,ResNetPreTrainedModel:()=>r.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>r.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>r.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>r.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>r.RoFormerForTokenClassification,RoFormerModel:()=>r.RoFormerModel,RoFormerPreTrainedModel:()=>r.RoFormerPreTrainedModel,RoFormerTokenizer:()=>s.RoFormerTokenizer,RobertaForMaskedLM:()=>r.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>r.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>r.RobertaForSequenceClassification,RobertaForTokenClassification:()=>r.RobertaForTokenClassification,RobertaModel:()=>r.RobertaModel,RobertaPreTrainedModel:()=>r.RobertaPreTrainedModel,RobertaTokenizer:()=>s.RobertaTokenizer,SamImageProcessor:()=>g.SamImageProcessor,SamImageSegmentationOutput:()=>r.SamImageSegmentationOutput,SamModel:()=>r.SamModel,SamPreTrainedModel:()=>r.SamPreTrainedModel,SamProcessor:()=>w.SamProcessor,SapiensForDepthEstimation:()=>r.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>r.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>r.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>r.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>p.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>g.SegformerFeatureExtractor,SegformerForImageClassification:()=>r.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>r.SegformerForSemanticSegmentation,SegformerImageProcessor:()=>g.SegformerImageProcessor,SegformerModel:()=>r.SegformerModel,SegformerPreTrainedModel:()=>r.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>r.Seq2SeqLMOutput,SequenceClassifierOutput:()=>r.SequenceClassifierOutput,SiglipImageProcessor:()=>g.SiglipImageProcessor,SiglipModel:()=>r.SiglipModel,SiglipPreTrainedModel:()=>r.SiglipPreTrainedModel,SiglipTextModel:()=>r.SiglipTextModel,SiglipTokenizer:()=>s.SiglipTokenizer,SiglipVisionModel:()=>r.SiglipVisionModel,SmolVLMForConditionalGeneration:()=>r.SmolVLMForConditionalGeneration,SmolVLMImageProcessor:()=>g.SmolVLMImageProcessor,SmolVLMProcessor:()=>w.SmolVLMProcessor,SnacDecoderModel:()=>r.SnacDecoderModel,SnacEncoderModel:()=>r.SnacEncoderModel,SnacFeatureExtractor:()=>p.SnacFeatureExtractor,SnacModel:()=>r.SnacModel,SnacPreTrainedModel:()=>r.SnacPreTrainedModel,SpeechT5FeatureExtractor:()=>p.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>r.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>r.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>r.SpeechT5HifiGan,SpeechT5Model:()=>r.SpeechT5Model,SpeechT5PreTrainedModel:()=>r.SpeechT5PreTrainedModel,SpeechT5Processor:()=>w.SpeechT5Processor,SpeechT5Tokenizer:()=>s.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>r.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>r.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>r.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>r.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>r.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>s.SqueezeBertTokenizer,StableLmForCausalLM:()=>r.StableLmForCausalLM,StableLmModel:()=>r.StableLmModel,StableLmPreTrainedModel:()=>r.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>r.Starcoder2ForCausalLM,Starcoder2Model:()=>r.Starcoder2Model,Starcoder2PreTrainedModel:()=>r.Starcoder2PreTrainedModel,StoppingCriteria:()=>T.StoppingCriteria,StoppingCriteriaList:()=>T.StoppingCriteriaList,StyleTextToSpeech2Model:()=>r.StyleTextToSpeech2Model,StyleTextToSpeech2PreTrainedModel:()=>r.StyleTextToSpeech2PreTrainedModel,SummarizationPipeline:()=>t.SummarizationPipeline,SuppressTokensAtBeginLogitsProcessor:()=>P.SuppressTokensAtBeginLogitsProcessor,Swin2SRForImageSuperResolution:()=>r.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>g.Swin2SRImageProcessor,Swin2SRModel:()=>r.Swin2SRModel,Swin2SRPreTrainedModel:()=>r.Swin2SRPreTrainedModel,SwinForImageClassification:()=>r.SwinForImageClassification,SwinForSemanticSegmentation:()=>r.SwinForSemanticSegmentation,SwinModel:()=>r.SwinModel,SwinPreTrainedModel:()=>r.SwinPreTrainedModel,T5ForConditionalGeneration:()=>r.T5ForConditionalGeneration,T5Model:()=>r.T5Model,T5PreTrainedModel:()=>r.T5PreTrainedModel,T5Tokenizer:()=>s.T5Tokenizer,TableTransformerForObjectDetection:()=>r.TableTransformerForObjectDetection,TableTransformerModel:()=>r.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>r.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>r.TableTransformerPreTrainedModel,TemperatureLogitsWarper:()=>P.TemperatureLogitsWarper,Tensor:()=>l.Tensor,Text2TextGenerationPipeline:()=>t.Text2TextGenerationPipeline,TextClassificationPipeline:()=>t.TextClassificationPipeline,TextGenerationPipeline:()=>t.TextGenerationPipeline,TextStreamer:()=>b.TextStreamer,TextToAudioPipeline:()=>t.TextToAudioPipeline,TokenClassificationPipeline:()=>t.TokenClassificationPipeline,TokenClassifierOutput:()=>r.TokenClassifierOutput,TokenizerModel:()=>s.TokenizerModel,TopKLogitsWarper:()=>P.TopKLogitsWarper,TopPLogitsWarper:()=>P.TopPLogitsWarper,TrOCRForCausalLM:()=>r.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>r.TrOCRPreTrainedModel,TranslationPipeline:()=>t.TranslationPipeline,UltravoxModel:()=>r.UltravoxModel,UltravoxPreTrainedModel:()=>r.UltravoxPreTrainedModel,UltravoxProcessor:()=>w.UltravoxProcessor,UniSpeechForCTC:()=>r.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>r.UniSpeechForSequenceClassification,UniSpeechModel:()=>r.UniSpeechModel,UniSpeechPreTrainedModel:()=>r.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>r.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>r.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>r.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>r.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>r.UniSpeechSatPreTrainedModel,VLChatProcessor:()=>w.VLChatProcessor,VLMImageProcessor:()=>g.VLMImageProcessor,ViTFeatureExtractor:()=>g.ViTFeatureExtractor,ViTForImageClassification:()=>r.ViTForImageClassification,ViTImageProcessor:()=>g.ViTImageProcessor,ViTMAEModel:()=>r.ViTMAEModel,ViTMAEPreTrainedModel:()=>r.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>r.ViTMSNForImageClassification,ViTMSNModel:()=>r.ViTMSNModel,ViTMSNPreTrainedModel:()=>r.ViTMSNPreTrainedModel,ViTModel:()=>r.ViTModel,ViTPreTrainedModel:()=>r.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>r.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>r.VitMatteForImageMatting,VitMatteImageProcessor:()=>g.VitMatteImageProcessor,VitMattePreTrainedModel:()=>r.VitMattePreTrainedModel,VitPoseForPoseEstimation:()=>r.VitPoseForPoseEstimation,VitPoseImageProcessor:()=>g.VitPoseImageProcessor,VitPosePreTrainedModel:()=>r.VitPosePreTrainedModel,VitsModel:()=>r.VitsModel,VitsModelOutput:()=>r.VitsModelOutput,VitsPreTrainedModel:()=>r.VitsPreTrainedModel,VitsTokenizer:()=>s.VitsTokenizer,Wav2Vec2BertForCTC:()=>r.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>r.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>r.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>r.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>s.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>p.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>r.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>r.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>r.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>r.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>r.Wav2Vec2PreTrainedModel,Wav2Vec2Processor:()=>w.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>w.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>r.WavLMForAudioFrameClassification,WavLMForCTC:()=>r.WavLMForCTC,WavLMForSequenceClassification:()=>r.WavLMForSequenceClassification,WavLMForXVector:()=>r.WavLMForXVector,WavLMModel:()=>r.WavLMModel,WavLMPreTrainedModel:()=>r.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>p.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>r.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>r.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>p.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>r.WhisperForConditionalGeneration,WhisperModel:()=>r.WhisperModel,WhisperPreTrainedModel:()=>r.WhisperPreTrainedModel,WhisperProcessor:()=>w.WhisperProcessor,WhisperTextStreamer:()=>b.WhisperTextStreamer,WhisperTimeStampLogitsProcessor:()=>P.WhisperTimeStampLogitsProcessor,WhisperTokenizer:()=>s.WhisperTokenizer,XLMForQuestionAnswering:()=>r.XLMForQuestionAnswering,XLMForSequenceClassification:()=>r.XLMForSequenceClassification,XLMForTokenClassification:()=>r.XLMForTokenClassification,XLMModel:()=>r.XLMModel,XLMPreTrainedModel:()=>r.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>r.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>r.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>r.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>r.XLMRobertaForTokenClassification,XLMRobertaModel:()=>r.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>r.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>s.XLMRobertaTokenizer,XLMTokenizer:()=>s.XLMTokenizer,XLMWithLMHeadModel:()=>r.XLMWithLMHeadModel,XVectorOutput:()=>r.XVectorOutput,YolosFeatureExtractor:()=>g.YolosFeatureExtractor,YolosForObjectDetection:()=>r.YolosForObjectDetection,YolosImageProcessor:()=>g.YolosImageProcessor,YolosModel:()=>r.YolosModel,YolosObjectDetectionOutput:()=>r.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>r.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>t.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>t.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>t.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>t.ZeroShotObjectDetectionPipeline,bankers_round:()=>u.bankers_round,cat:()=>l.cat,cos_sim:()=>u.cos_sim,dot:()=>u.dot,dynamic_time_warping:()=>u.dynamic_time_warping,env:()=>e.env,full:()=>l.full,full_like:()=>l.full_like,getKeyValueShapes:()=>o.getKeyValueShapes,hamming:()=>n.hamming,hanning:()=>n.hanning,interpolate:()=>l.interpolate,interpolate_4d:()=>l.interpolate_4d,interpolate_data:()=>u.interpolate_data,is_chinese_char:()=>s.is_chinese_char,layer_norm:()=>l.layer_norm,load_image:()=>a.load_image,load_video:()=>i.load_video,log_softmax:()=>u.log_softmax,magnitude:()=>u.magnitude,matmul:()=>l.matmul,max:()=>u.max,mean:()=>l.mean,mean_pooling:()=>l.mean_pooling,medianFilter:()=>u.medianFilter,mel_filter_bank:()=>n.mel_filter_bank,min:()=>u.min,ones:()=>l.ones,ones_like:()=>l.ones_like,permute:()=>l.permute,permute_data:()=>u.permute_data,pipeline:()=>t.pipeline,quantize_embeddings:()=>l.quantize_embeddings,rand:()=>l.rand,read_audio:()=>n.read_audio,rfft:()=>l.rfft,round:()=>u.round,slice:()=>l.slice,softmax:()=>u.softmax,spectrogram:()=>n.spectrogram,stack:()=>l.stack,std_mean:()=>l.std_mean,topk:()=>l.topk,window_function:()=>n.window_function,zeros:()=>l.zeros,zeros_like:()=>l.zeros_like});var e=c("./src/env.js"),t=c("./src/pipelines.js"),r=c("./src/models.js"),s=c("./src/tokenizers.js"),o=c("./src/configs.js"),n=c("./src/utils/audio.js"),a=c("./src/utils/image.js"),i=c("./src/utils/video.js"),l=c("./src/utils/tensor.js"),u=c("./src/utils/maths.js"),m=c("./src/base/feature_extraction_utils.js"),p=c("./src/models/feature_extractors.js"),_=c("./src/models/auto/feature_extraction_auto.js"),h=c("./src/base/image_processors_utils.js"),g=c("./src/models/image_processors.js"),f=c("./src/models/auto/image_processing_auto.js"),M=c("./src/base/processing_utils.js"),w=c("./src/models/processors.js"),x=c("./src/models/auto/processing_auto.js"),b=c("./src/generation/streamers.js"),T=c("./src/generation/stopping_criteria.js"),P=c("./src/generation/logits_process.js")})(),d.ASTFeatureExtractor,d.ASTForAudioClassification,d.ASTModel,d.ASTPreTrainedModel,d.AlbertForMaskedLM,d.AlbertForQuestionAnswering,d.AlbertForSequenceClassification,d.AlbertModel,d.AlbertPreTrainedModel,d.AlbertTokenizer,d.AudioClassificationPipeline,d.AutoConfig,d.AutoFeatureExtractor,d.AutoImageProcessor;var u=d.AutoModel;d.AutoModelForAudioClassification,d.AutoModelForAudioFrameClassification,d.AutoModelForAudioTextToText,d.AutoModelForCTC,d.AutoModelForCausalLM,d.AutoModelForDepthEstimation,d.AutoModelForDocumentQuestionAnswering,d.AutoModelForImageClassification,d.AutoModelForImageFeatureExtraction,d.AutoModelForImageMatting,d.AutoModelForImageSegmentation,d.AutoModelForImageTextToText,d.AutoModelForImageToImage,d.AutoModelForMaskGeneration,d.AutoModelForMaskedLM,d.AutoModelForNormalEstimation,d.AutoModelForObjectDetection,d.AutoModelForPoseEstimation,d.AutoModelForQuestionAnswering,d.AutoModelForSemanticSegmentation,d.AutoModelForSeq2SeqLM,d.AutoModelForSequenceClassification,d.AutoModelForSpeechSeq2Seq,d.AutoModelForTextToSpectrogram,d.AutoModelForTextToWaveform,d.AutoModelForTokenClassification,d.AutoModelForUniversalSegmentation,d.AutoModelForVision2Seq,d.AutoModelForXVector,d.AutoModelForZeroShotObjectDetection;var m=d.AutoProcessor;d.AutoTokenizer,d.AutomaticSpeechRecognitionPipeline,d.BackgroundRemovalPipeline,d.BartForConditionalGeneration,d.BartForSequenceClassification,d.BartModel,d.BartPretrainedModel,d.BartTokenizer,d.BaseModelOutput,d.BaseStreamer,d.BeitFeatureExtractor,d.BeitForImageClassification,d.BeitModel,d.BeitPreTrainedModel,d.BertForMaskedLM,d.BertForQuestionAnswering,d.BertForSequenceClassification,d.BertForTokenClassification,d.BertModel,d.BertPreTrainedModel,d.BertTokenizer,d.BitImageProcessor,d.BlenderbotForConditionalGeneration,d.BlenderbotModel,d.BlenderbotPreTrainedModel,d.BlenderbotSmallForConditionalGeneration,d.BlenderbotSmallModel,d.BlenderbotSmallPreTrainedModel,d.BlenderbotSmallTokenizer,d.BlenderbotTokenizer,d.BloomForCausalLM,d.BloomModel,d.BloomPreTrainedModel,d.BloomTokenizer,d.CLIPFeatureExtractor,d.CLIPImageProcessor,d.CLIPModel,d.CLIPPreTrainedModel,d.CLIPSegForImageSegmentation,d.CLIPSegModel,d.CLIPSegPreTrainedModel,d.CLIPTextModel,d.CLIPTextModelWithProjection,d.CLIPTokenizer,d.CLIPVisionModel,d.CLIPVisionModelWithProjection,d.CamembertForMaskedLM,d.CamembertForQuestionAnswering,d.CamembertForSequenceClassification,d.CamembertForTokenClassification,d.CamembertModel,d.CamembertPreTrainedModel,d.CamembertTokenizer,d.CausalLMOutput,d.CausalLMOutputWithPast,d.ChineseCLIPFeatureExtractor,d.ChineseCLIPModel,d.ChineseCLIPPreTrainedModel,d.ClapAudioModelWithProjection,d.ClapFeatureExtractor,d.ClapModel,d.ClapPreTrainedModel,d.ClapTextModelWithProjection,d.ClassifierFreeGuidanceLogitsProcessor,d.CodeGenForCausalLM,d.CodeGenModel,d.CodeGenPreTrainedModel,d.CodeGenTokenizer,d.CodeLlamaTokenizer,d.CohereForCausalLM,d.CohereModel,d.CoherePreTrainedModel,d.CohereTokenizer,d.ConvBertForMaskedLM,d.ConvBertForQuestionAnswering,d.ConvBertForSequenceClassification,d.ConvBertForTokenClassification,d.ConvBertModel,d.ConvBertPreTrainedModel,d.ConvBertTokenizer,d.ConvNextFeatureExtractor,d.ConvNextForImageClassification,d.ConvNextImageProcessor,d.ConvNextModel,d.ConvNextPreTrainedModel,d.ConvNextV2ForImageClassification,d.ConvNextV2Model,d.ConvNextV2PreTrainedModel,d.DFineForObjectDetection,d.DFineModel,d.DFinePreTrainedModel,d.DPTFeatureExtractor,d.DPTForDepthEstimation,d.DPTImageProcessor,d.DPTModel,d.DPTPreTrainedModel,d.DacDecoderModel,d.DacDecoderOutput,d.DacEncoderModel,d.DacEncoderOutput,d.DacFeatureExtractor,d.DacModel,d.DacPreTrainedModel,d.DataTypeMap,d.DebertaForMaskedLM,d.DebertaForQuestionAnswering,d.DebertaForSequenceClassification,d.DebertaForTokenClassification,d.DebertaModel,d.DebertaPreTrainedModel,d.DebertaTokenizer,d.DebertaV2ForMaskedLM,d.DebertaV2ForQuestionAnswering,d.DebertaV2ForSequenceClassification,d.DebertaV2ForTokenClassification,d.DebertaV2Model,d.DebertaV2PreTrainedModel,d.DebertaV2Tokenizer,d.DecisionTransformerModel,d.DecisionTransformerPreTrainedModel,d.DeiTFeatureExtractor,d.DeiTForImageClassification,d.DeiTImageProcessor,d.DeiTModel,d.DeiTPreTrainedModel,d.DepthAnythingForDepthEstimation,d.DepthAnythingPreTrainedModel,d.DepthEstimationPipeline,d.DepthProForDepthEstimation,d.DepthProPreTrainedModel,d.DetrFeatureExtractor,d.DetrForObjectDetection,d.DetrForSegmentation,d.DetrImageProcessor,d.DetrModel,d.DetrObjectDetectionOutput,d.DetrPreTrainedModel,d.DetrSegmentationOutput,d.Dinov2ForImageClassification,d.Dinov2Model,d.Dinov2PreTrainedModel,d.Dinov2WithRegistersForImageClassification,d.Dinov2WithRegistersModel,d.Dinov2WithRegistersPreTrainedModel,d.DistilBertForMaskedLM,d.DistilBertForQuestionAnswering,d.DistilBertForSequenceClassification,d.DistilBertForTokenClassification,d.DistilBertModel,d.DistilBertPreTrainedModel,d.DistilBertTokenizer,d.DocumentQuestionAnsweringPipeline,d.DonutFeatureExtractor,d.DonutImageProcessor,d.DonutSwinModel,d.DonutSwinPreTrainedModel,d.EfficientNetForImageClassification,d.EfficientNetImageProcessor,d.EfficientNetModel,d.EfficientNetPreTrainedModel,d.ElectraForMaskedLM,d.ElectraForQuestionAnswering,d.ElectraForSequenceClassification,d.ElectraForTokenClassification,d.ElectraModel,d.ElectraPreTrainedModel,d.ElectraTokenizer,d.EncodecFeatureExtractor,d.EosTokenCriteria,d.EsmForMaskedLM,d.EsmForSequenceClassification,d.EsmForTokenClassification,d.EsmModel,d.EsmPreTrainedModel,d.EsmTokenizer,d.ExaoneForCausalLM,d.ExaoneModel,d.ExaonePreTrainedModel,d.FFT,d.FalconForCausalLM,d.FalconModel,d.FalconPreTrainedModel,d.FalconTokenizer,d.FastViTForImageClassification,d.FastViTModel,d.FastViTPreTrainedModel,d.FeatureExtractionPipeline,d.FeatureExtractor,d.FillMaskPipeline,d.Florence2ForConditionalGeneration,d.Florence2PreTrainedModel,d.Florence2Processor,d.ForcedBOSTokenLogitsProcessor,d.ForcedEOSTokenLogitsProcessor,d.GLPNFeatureExtractor,d.GLPNForDepthEstimation,d.GLPNModel,d.GLPNPreTrainedModel,d.GPT2LMHeadModel,d.GPT2Model,d.GPT2PreTrainedModel,d.GPT2Tokenizer,d.GPTBigCodeForCausalLM,d.GPTBigCodeModel,d.GPTBigCodePreTrainedModel,d.GPTJForCausalLM,d.GPTJModel,d.GPTJPreTrainedModel,d.GPTNeoForCausalLM,d.GPTNeoModel,d.GPTNeoPreTrainedModel,d.GPTNeoXForCausalLM,d.GPTNeoXModel,d.GPTNeoXPreTrainedModel,d.GPTNeoXTokenizer,d.Gemma2ForCausalLM,d.Gemma2Model,d.Gemma2PreTrainedModel,d.Gemma3ForCausalLM,d.Gemma3Model,d.Gemma3PreTrainedModel,d.GemmaForCausalLM,d.GemmaModel,d.GemmaPreTrainedModel,d.GemmaTokenizer,d.GlmForCausalLM,d.GlmModel,d.GlmPreTrainedModel,d.GraniteForCausalLM,d.GraniteModel,d.GranitePreTrainedModel,d.Grok1Tokenizer,d.GroundingDinoForObjectDetection,d.GroundingDinoImageProcessor,d.GroundingDinoPreTrainedModel,d.GroundingDinoProcessor,d.GroupViTModel,d.GroupViTPreTrainedModel,d.HeliumForCausalLM,d.HeliumModel,d.HeliumPreTrainedModel,d.HerbertTokenizer,d.HieraForImageClassification,d.HieraModel,d.HieraPreTrainedModel,d.HubertForCTC,d.HubertForSequenceClassification,d.HubertModel,d.HubertPreTrainedModel,d.IJepaForImageClassification,d.IJepaModel,d.IJepaPreTrainedModel,d.Idefics3ForConditionalGeneration,d.Idefics3ImageProcessor,d.Idefics3PreTrainedModel,d.Idefics3Processor,d.ImageClassificationPipeline,d.ImageFeatureExtractionPipeline,d.ImageFeatureExtractor,d.ImageMattingOutput,d.ImageProcessor,d.ImageSegmentationPipeline,d.ImageToImagePipeline,d.ImageToTextPipeline,d.InterruptableStoppingCriteria,d.JAISLMHeadModel,d.JAISModel,d.JAISPreTrainedModel,d.JinaCLIPImageProcessor,d.JinaCLIPModel,d.JinaCLIPPreTrainedModel,d.JinaCLIPProcessor,d.JinaCLIPTextModel,d.JinaCLIPVisionModel,d.LiteWhisperForConditionalGeneration,d.LlamaForCausalLM,d.LlamaModel,d.LlamaPreTrainedModel,d.LlamaTokenizer,d.LlavaForConditionalGeneration,d.LlavaOnevisionForConditionalGeneration,d.LlavaOnevisionImageProcessor,d.LlavaPreTrainedModel,d.LogitsProcessor,d.LogitsProcessorList,d.LogitsWarper,d.LongT5ForConditionalGeneration,d.LongT5Model,d.LongT5PreTrainedModel,d.M2M100ForConditionalGeneration,d.M2M100Model,d.M2M100PreTrainedModel,d.M2M100Tokenizer,d.MBart50Tokenizer,d.MBartForCausalLM,d.MBartForConditionalGeneration,d.MBartForSequenceClassification,d.MBartModel,d.MBartPreTrainedModel,d.MBartTokenizer,d.MPNetForMaskedLM,d.MPNetForQuestionAnswering,d.MPNetForSequenceClassification,d.MPNetForTokenClassification,d.MPNetModel,d.MPNetPreTrainedModel,d.MPNetTokenizer,d.MT5ForConditionalGeneration,d.MT5Model,d.MT5PreTrainedModel,d.MarianMTModel,d.MarianModel,d.MarianPreTrainedModel,d.MarianTokenizer,d.Mask2FormerImageProcessor,d.MaskFormerFeatureExtractor,d.MaskFormerForInstanceSegmentation,d.MaskFormerImageProcessor,d.MaskFormerModel,d.MaskFormerPreTrainedModel,d.MaskedLMOutput,d.MaxLengthCriteria,d.Metric3DForDepthEstimation,d.Metric3DPreTrainedModel,d.Metric3Dv2ForDepthEstimation,d.Metric3Dv2PreTrainedModel,d.MgpstrForSceneTextRecognition,d.MgpstrModelOutput,d.MgpstrPreTrainedModel,d.MgpstrProcessor,d.MgpstrTokenizer,d.MimiDecoderModel,d.MimiDecoderOutput,d.MimiEncoderModel,d.MimiEncoderOutput,d.MimiModel,d.MimiPreTrainedModel,d.MinLengthLogitsProcessor,d.MinNewTokensLengthLogitsProcessor,d.MistralForCausalLM,d.MistralModel,d.MistralPreTrainedModel,d.MobileBertForMaskedLM,d.MobileBertForQuestionAnswering,d.MobileBertForSequenceClassification,d.MobileBertModel,d.MobileBertPreTrainedModel,d.MobileBertTokenizer,d.MobileLLMForCausalLM,d.MobileLLMModel,d.MobileLLMPreTrainedModel,d.MobileNetV1FeatureExtractor,d.MobileNetV1ForImageClassification,d.MobileNetV1ForSemanticSegmentation,d.MobileNetV1ImageProcessor,d.MobileNetV1Model,d.MobileNetV1PreTrainedModel,d.MobileNetV2FeatureExtractor,d.MobileNetV2ForImageClassification,d.MobileNetV2ForSemanticSegmentation,d.MobileNetV2ImageProcessor,d.MobileNetV2Model,d.MobileNetV2PreTrainedModel,d.MobileNetV3FeatureExtractor,d.MobileNetV3ForImageClassification,d.MobileNetV3ForSemanticSegmentation,d.MobileNetV3ImageProcessor,d.MobileNetV3Model,d.MobileNetV3PreTrainedModel,d.MobileNetV4FeatureExtractor,d.MobileNetV4ForImageClassification,d.MobileNetV4ForSemanticSegmentation,d.MobileNetV4ImageProcessor,d.MobileNetV4Model,d.MobileNetV4PreTrainedModel,d.MobileViTFeatureExtractor,d.MobileViTForImageClassification,d.MobileViTImageProcessor,d.MobileViTModel,d.MobileViTPreTrainedModel,d.MobileViTV2ForImageClassification,d.MobileViTV2Model,d.MobileViTV2PreTrainedModel,d.ModelOutput,d.ModernBertForMaskedLM,d.ModernBertForSequenceClassification,d.ModernBertForTokenClassification,d.ModernBertModel,d.ModernBertPreTrainedModel,d.Moondream1ForConditionalGeneration,d.MoonshineFeatureExtractor,d.MoonshineForConditionalGeneration,d.MoonshineModel,d.MoonshinePreTrainedModel,d.MoonshineProcessor,d.MptForCausalLM,d.MptModel,d.MptPreTrainedModel,d.MultiModalityCausalLM,d.MultiModalityPreTrainedModel,d.MusicgenForCausalLM,d.MusicgenForConditionalGeneration,d.MusicgenModel,d.MusicgenPreTrainedModel,d.NllbTokenizer,d.NoBadWordsLogitsProcessor,d.NoRepeatNGramLogitsProcessor,d.NomicBertModel,d.NomicBertPreTrainedModel,d.NougatImageProcessor,d.NougatTokenizer,d.OPTForCausalLM,d.OPTModel,d.OPTPreTrainedModel,d.ObjectDetectionPipeline,d.Olmo2ForCausalLM,d.Olmo2Model,d.Olmo2PreTrainedModel,d.OlmoForCausalLM,d.OlmoModel,d.OlmoPreTrainedModel,d.OpenELMForCausalLM,d.OpenELMModel,d.OpenELMPreTrainedModel,d.OwlViTFeatureExtractor,d.OwlViTForObjectDetection,d.OwlViTImageProcessor,d.OwlViTModel,d.OwlViTPreTrainedModel,d.OwlViTProcessor,d.Owlv2ForObjectDetection,d.Owlv2ImageProcessor,d.Owlv2Model,d.Owlv2PreTrainedModel,d.PaliGemmaForConditionalGeneration,d.PaliGemmaPreTrainedModel,d.PaliGemmaProcessor,d.PatchTSMixerForPrediction,d.PatchTSMixerModel,d.PatchTSMixerPreTrainedModel,d.PatchTSTForPrediction,d.PatchTSTModel,d.PatchTSTPreTrainedModel,d.Phi3ForCausalLM,d.Phi3Model,d.Phi3PreTrainedModel,d.Phi3VForCausalLM,d.Phi3VImageProcessor,d.Phi3VPreTrainedModel,d.Phi3VProcessor,d.PhiForCausalLM,d.PhiModel,d.PhiPreTrainedModel,d.Pipeline,d.PreTrainedModel,d.PreTrainedTokenizer,d.PretrainedConfig,d.PretrainedMixin,d.Processor,d.PvtForImageClassification,d.PvtImageProcessor,d.PvtModel,d.PvtPreTrainedModel,d.PyAnnoteFeatureExtractor,d.PyAnnoteForAudioFrameClassification,d.PyAnnoteModel,d.PyAnnotePreTrainedModel,d.PyAnnoteProcessor,d.QuestionAnsweringModelOutput,d.QuestionAnsweringPipeline,d.Qwen2ForCausalLM,d.Qwen2Model,d.Qwen2PreTrainedModel,d.Qwen2Tokenizer,d.Qwen2VLForConditionalGeneration,d.Qwen2VLImageProcessor,d.Qwen2VLPreTrainedModel,d.Qwen2VLProcessor,d.Qwen3ForCausalLM,d.Qwen3Model,d.Qwen3PreTrainedModel,d.RFDetrForObjectDetection,d.RFDetrModel,d.RFDetrObjectDetectionOutput,d.RFDetrPreTrainedModel,d.RTDetrForObjectDetection,d.RTDetrImageProcessor,d.RTDetrModel,d.RTDetrObjectDetectionOutput,d.RTDetrPreTrainedModel,d.RTDetrV2ForObjectDetection,d.RTDetrV2Model,d.RTDetrV2ObjectDetectionOutput,d.RTDetrV2PreTrainedModel,d.RawAudio;var p=d.RawImage;d.RawVideo,d.RawVideoFrame,d.RepetitionPenaltyLogitsProcessor,d.ResNetForImageClassification,d.ResNetModel,d.ResNetPreTrainedModel,d.RoFormerForMaskedLM,d.RoFormerForQuestionAnswering,d.RoFormerForSequenceClassification,d.RoFormerForTokenClassification,d.RoFormerModel,d.RoFormerPreTrainedModel,d.RoFormerTokenizer,d.RobertaForMaskedLM,d.RobertaForQuestionAnswering,d.RobertaForSequenceClassification,d.RobertaForTokenClassification,d.RobertaModel,d.RobertaPreTrainedModel,d.RobertaTokenizer,d.SamImageProcessor,d.SamImageSegmentationOutput,d.SamModel,d.SamPreTrainedModel,d.SamProcessor,d.SapiensForDepthEstimation,d.SapiensForNormalEstimation,d.SapiensForSemanticSegmentation,d.SapiensPreTrainedModel,d.SeamlessM4TFeatureExtractor,d.SegformerFeatureExtractor,d.SegformerForImageClassification,d.SegformerForSemanticSegmentation,d.SegformerImageProcessor,d.SegformerModel,d.SegformerPreTrainedModel,d.Seq2SeqLMOutput,d.SequenceClassifierOutput,d.SiglipImageProcessor,d.SiglipModel,d.SiglipPreTrainedModel,d.SiglipTextModel,d.SiglipTokenizer,d.SiglipVisionModel,d.SmolVLMForConditionalGeneration,d.SmolVLMImageProcessor,d.SmolVLMProcessor,d.SnacDecoderModel,d.SnacEncoderModel,d.SnacFeatureExtractor,d.SnacModel,d.SnacPreTrainedModel,d.SpeechT5FeatureExtractor,d.SpeechT5ForSpeechToText,d.SpeechT5ForTextToSpeech,d.SpeechT5HifiGan,d.SpeechT5Model,d.SpeechT5PreTrainedModel,d.SpeechT5Processor,d.SpeechT5Tokenizer,d.SqueezeBertForMaskedLM,d.SqueezeBertForQuestionAnswering,d.SqueezeBertForSequenceClassification,d.SqueezeBertModel,d.SqueezeBertPreTrainedModel,d.SqueezeBertTokenizer,d.StableLmForCausalLM,d.StableLmModel,d.StableLmPreTrainedModel,d.Starcoder2ForCausalLM,d.Starcoder2Model,d.Starcoder2PreTrainedModel,d.StoppingCriteria,d.StoppingCriteriaList,d.StyleTextToSpeech2Model,d.StyleTextToSpeech2PreTrainedModel,d.SummarizationPipeline,d.SuppressTokensAtBeginLogitsProcessor,d.Swin2SRForImageSuperResolution,d.Swin2SRImageProcessor,d.Swin2SRModel,d.Swin2SRPreTrainedModel,d.SwinForImageClassification,d.SwinForSemanticSegmentation,d.SwinModel,d.SwinPreTrainedModel,d.T5ForConditionalGeneration,d.T5Model,d.T5PreTrainedModel,d.T5Tokenizer,d.TableTransformerForObjectDetection,d.TableTransformerModel,d.TableTransformerObjectDetectionOutput,d.TableTransformerPreTrainedModel,d.TemperatureLogitsWarper,d.Tensor,d.Text2TextGenerationPipeline,d.TextClassificationPipeline,d.TextGenerationPipeline,d.TextStreamer,d.TextToAudioPipeline,d.TokenClassificationPipeline,d.TokenClassifierOutput,d.TokenizerModel,d.TopKLogitsWarper,d.TopPLogitsWarper,d.TrOCRForCausalLM,d.TrOCRPreTrainedModel,d.TranslationPipeline,d.UltravoxModel,d.UltravoxPreTrainedModel,d.UltravoxProcessor,d.UniSpeechForCTC,d.UniSpeechForSequenceClassification,d.UniSpeechModel,d.UniSpeechPreTrainedModel,d.UniSpeechSatForAudioFrameClassification,d.UniSpeechSatForCTC,d.UniSpeechSatForSequenceClassification,d.UniSpeechSatModel,d.UniSpeechSatPreTrainedModel,d.VLChatProcessor,d.VLMImageProcessor,d.ViTFeatureExtractor,d.ViTForImageClassification,d.ViTImageProcessor,d.ViTMAEModel,d.ViTMAEPreTrainedModel,d.ViTMSNForImageClassification,d.ViTMSNModel,d.ViTMSNPreTrainedModel,d.ViTModel,d.ViTPreTrainedModel,d.VisionEncoderDecoderModel,d.VitMatteForImageMatting,d.VitMatteImageProcessor,d.VitMattePreTrainedModel,d.VitPoseForPoseEstimation,d.VitPoseImageProcessor,d.VitPosePreTrainedModel,d.VitsModel,d.VitsModelOutput,d.VitsPreTrainedModel,d.VitsTokenizer,d.Wav2Vec2BertForCTC,d.Wav2Vec2BertForSequenceClassification,d.Wav2Vec2BertModel,d.Wav2Vec2BertPreTrainedModel,d.Wav2Vec2CTCTokenizer,d.Wav2Vec2FeatureExtractor,d.Wav2Vec2ForAudioFrameClassification,d.Wav2Vec2ForCTC,d.Wav2Vec2ForSequenceClassification,d.Wav2Vec2Model,d.Wav2Vec2PreTrainedModel,d.Wav2Vec2Processor,d.Wav2Vec2ProcessorWithLM,d.WavLMForAudioFrameClassification,d.WavLMForCTC,d.WavLMForSequenceClassification,d.WavLMForXVector,d.WavLMModel,d.WavLMPreTrainedModel,d.WeSpeakerFeatureExtractor,d.WeSpeakerResNetModel,d.WeSpeakerResNetPreTrainedModel,d.WhisperFeatureExtractor,d.WhisperForConditionalGeneration,d.WhisperModel,d.WhisperPreTrainedModel,d.WhisperProcessor,d.WhisperTextStreamer,d.WhisperTimeStampLogitsProcessor,d.WhisperTokenizer,d.XLMForQuestionAnswering,d.XLMForSequenceClassification,d.XLMForTokenClassification,d.XLMModel,d.XLMPreTrainedModel,d.XLMRobertaForMaskedLM,d.XLMRobertaForQuestionAnswering,d.XLMRobertaForSequenceClassification,d.XLMRobertaForTokenClassification,d.XLMRobertaModel,d.XLMRobertaPreTrainedModel,d.XLMRobertaTokenizer,d.XLMTokenizer,d.XLMWithLMHeadModel,d.XVectorOutput,d.YolosFeatureExtractor,d.YolosForObjectDetection,d.YolosImageProcessor,d.YolosModel,d.YolosObjectDetectionOutput,d.YolosPreTrainedModel,d.ZeroShotAudioClassificationPipeline,d.ZeroShotClassificationPipeline,d.ZeroShotImageClassificationPipeline,d.ZeroShotObjectDetectionPipeline,d.bankers_round,d.cat,d.cos_sim,d.dot,d.dynamic_time_warping;var _=d.env;d.full,d.full_like,d.getKeyValueShapes,d.hamming,d.hanning,d.interpolate,d.interpolate_4d,d.interpolate_data,d.is_chinese_char,d.layer_norm,d.load_image,d.load_video,d.log_softmax,d.magnitude,d.matmul,d.max,d.mean,d.mean_pooling,d.medianFilter,d.mel_filter_bank,d.min,d.ones,d.ones_like,d.permute,d.permute_data,d.pipeline,d.quantize_embeddings,d.rand,d.read_audio,d.rfft,d.round,d.slice,d.softmax,d.spectrogram,d.stack,d.std_mean,d.topk,d.window_function,d.zeros,d.zeros_like}}]);