@aim-packages/subtitle 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";var St=Object.defineProperty;var jt=(e,t,r)=>t in e?St(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var v=(e,t,r)=>jt(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function U(e,t=2){return e.toString().padStart(t,"0")}function y(e){const t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=e%3600%60,a=Math.floor(n%1*1e3),c=U(t),s=U(r),u=U(Math.floor(n)),i=U(a,3);return`${c}:${s}:${u}.${i}`}function A(e){if(!e)return 0;const t=e.split(":");try{let r=t[2].split(",");return r.length===1&&(r=t[2].split(".")),parseFloat(t[0])*3600+parseFloat(t[1])*60+parseFloat(r[0])+parseFloat("0."+r[1])}catch{return 0}}function Ve(e){return/[\u4E00-\u9FFF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/.test(e)}const $t=Object.freeze(Object.defineProperty({__proto__:null,containsCJKCharacters:Ve,convertToSeconds:A,formatTime:y,padNumber:U},Symbol.toStringTag,{value:"Module"}));/**
1
+ "use strict";var St=Object.defineProperty;var jt=(e,t,r)=>t in e?St(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var v=(e,t,r)=>jt(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function G(e,t=2){return e.toString().padStart(t,"0")}function g(e){const t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=e%3600%60,a=Math.floor(n%1*1e3),c=G(t),s=G(r),u=G(Math.floor(n)),i=G(a,3);return`${c}:${s}:${u}.${i}`}function A(e){if(!e)return 0;const t=e.split(":");try{let r=t[2].split(",");return r.length===1&&(r=t[2].split(".")),parseFloat(t[0])*3600+parseFloat(t[1])*60+parseFloat(r[0])+parseFloat("0."+r[1])}catch{return 0}}function Ve(e){return/[\u4E00-\u9FFF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/.test(e)}const xt=Object.freeze(Object.defineProperty({__proto__:null,containsCJKCharacters:Ve,convertToSeconds:A,formatTime:g,padNumber:G},Symbol.toStringTag,{value:"Module"}));/**
2
2
  * @name ass2vtt
3
3
  * @desc Converts ASS subtitle data into VTT format.
4
4
  * @author YuQian2015 (https://github.com/YuQian2015)
5
5
  * @license MIT
6
- */function xt(e){const t=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(n=""){return n.split(/[:.]/).map((a,c,s)=>{if(c===s.length-1){if(a.length===1)return"."+a+"00";if(a.length===2)return"."+a+"0"}else if(a.length===1)return(c===0?"0":":0")+a;return c===0?a:c===s.length-1?"."+a:":"+a}).join("")}return`WEBVTT
6
+ */function $t(e){const t=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(n=""){return n.split(/[:.]/).map((a,c,s)=>{if(c===s.length-1){if(a.length===1)return"."+a+"00";if(a.length===2)return"."+a+"0"}else if(a.length===1)return(c===0?"0":":0")+a;return c===0?a:c===s.length-1?"."+a:":"+a}).join("")}return`WEBVTT
7
7
 
8
8
  `+e.split(/\r?\n/).map(n=>{const a=n.match(t);return a?{start:r(a[1].trim()),end:r(a[2].trim()),text:a[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"<br />").trim().split(/\r?\n/).map(c=>c.trim()).join(`
9
9
  `)}:null}).filter(n=>n).map((n,a)=>n?n.start+" --> "+n.end+`
@@ -17,9 +17,9 @@
17
17
  * @author Newtopia Dev (http://www.newtopia.com)
18
18
  * @version 1.0.1
19
19
  * @license MIT
20
- */function Ot(e,t){let r=t;for(;!e[r];)r++;return r}function wt(e){let t=e.length-1;for(;t>=0&&!e[t];)t--;return t}function At(e="",t={propName:{}}){const r=[],n=e.split(/(?:\r\n|\r|\n)/gm).filter(f=>f.length>0),a=n.map((f,l)=>n[l+2]&&/\d{2}:\d{2}:\d{2}[,\.]\d{2,3}\s*-->\s*\d{2}:\d{2}:\d{2}[,\.]\d{2,3}/.test(n[l+2])?f+`\r
21
- `:f).join(`
22
- `).split(/(?:\r\n|\r|\n)/gm),c=wt(a)+1;let s=0,u,i,o;for(let f=0;f<c;f++){for(o={},i=[],f=Ot(a,f),o.id=parseInt(a[f++],10),u=a[f++].split(/[\t ]*-->[\t ]*/),o[t.propName.start||"start"]=t.timeInText?u[0]:A(u[0]),s=u[1].indexOf(" "),s!==-1&&(u[1]=u[1].substr(0,s)),o[t.propName.end||"end"]=t.timeInText?u[1]:A(u[1]);f<c&&a[f];)i.push(a[f++]);const l=t.propName.text||"text";o[l]=i.join(t.keepMultiLine?`
23
- `:" ").replace(/\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}/gi,""),o[l]=o[l].replace(/</g,"&lt;").replace(/>/g,"&gt;"),o[l]=o[l].replace(/&lt;(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)(\/?)&gt;/gi,"<$1$3$7>"),t.ignoreLineBreaks?o[l]=o[l].replace(/\\N/gi,""):o[l]=o[l].replace(/\\N/gi,"<br />"),r.push(o)}return r}function Pt(e,t){const r=/<\/?[^>]+(>|$)/g;return new Promise((n,a)=>{let c={};const s=[];let u=!1;const i=e.split(`
24
- `);i.forEach((f,l)=>{f.replace(r,"")===" "||f.replace(r,"")===""||(f.indexOf("-->")!==-1?(u=!0,typeof c.start=="number"&&c.start>=0&&s.push(se(c)),c={start:ae(f.split("-->")[0].trimRight().split(" ").pop()),end:ae(f.split("-->")[1].trimLeft().split(" ").shift()),part:""}):u&&(s.length!==0?(s[s.length-1].part.replace(r,""),f.replace(r,""),c.part.length===0?c.part=f:c.part=`${c.part}
25
- ${f}`,l===i.length-1&&s.push(se(c))):(c.part=f,s.push(se(c)),c.part="")))}),c=[];const o=/(<([0-9:.>]+)>)/ig;s.forEach(f=>{const _=f.part.split().map(function(g){return g.replace(o,function(p){return p.split("").reduce(function(S,N){return`==${p.replace("<","").replace(">","")}`},0)})})[0].replace(r,"").split(" "),b=[];_.forEach(function(g){if(g.indexOf("==")>-1){const p=g.split("=="),S=p[0];if(p[1],S==""||S=="##")return;b.push({word:$e(g.split("==")[0]),time:ae(g.split("==")[1])})}else b.push({word:$e(g),time:void 0})}),f.words=b,f.part=f.part.replace(r,"")}),n(s)})}function ae(e){const t=e.split(":"),r=t[t.length-3]?+t[t.length-3]:0,n=t[t.length-2]?+t[t.length-2]:0,a=+t[t.length-1];return r*3600+n*60+a}function $e(e){return e.replace(/[^0-9a-z'-]/gi,"").toLowerCase()}function se(e){if(e==null||typeof e!="object")return e;const t=e.constructor();for(const r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function Et(e){return e.Transcription.Paragraphs.map(t=>{const r=t.Words.map(n=>({st:y(n.Start/1e3),et:y(n.End/1e3),text:n.Text,spk:t.SpeakerId}));return{st:y(t.Words[0].Start/1e3),et:y(t.Words[t.Words.length-1].End/1e3),text:r.map(n=>n.text).join(""),spk:t.SpeakerId,children:r}})}function Ct(e){const t=e.words.map(r=>({st:y(r.start),et:y(r.end),text:r.word}));return[{st:y(e.words[0].start),et:y(e.words[e.words.length-1].end),text:e.text,children:t}]}const ie={padding:[.4,0],maxGap:10,minGap:2,minStart:6};function Ft(e){let t,r,n,a,c,s,u,i,o;const f=!!(e&&e.vad&&e.vad.length>0),l="[--end--]",m="[--Single--]",T="[--Full--]",_=/\[(\d{2}:\d{2}:\d{2}\.\d{3}) --> (\d{2}:\d{2}:\d{2}\.\d{3})\]/;let b=!1,g=!1,p="";return S(),{feed:B,reset:S,end:N};function S(){t=!0,r="",n=!1,a="",c=!1,s=void 0,u=0,i=!1,o=0}function N(){if(i){console.log("whisper parser is already end");return}B(l)}function J($){b||(p+=$),!b&&!g&&Ve(p)&&(g=!0),!b&&p.length>50&&(b=!0)}function B($){var Te,_e,Se;J($);const w=[];r+=$,t&&((Te=e==null?void 0:e.onStart)==null||Te.call(e,{type:"event",event:"start",data:[]})),t&&It(r)&&(r=r.slice(qe.length)),t=!1;const Y=r.length;for(;u<Y;){const X=r[u];if(++u,c&&s&&X!=="["&&(s.text+=X),X==="["&&(n&&a.length&&s&&(s.text+=a),a="",n=!0,c=!1),n){if(a+=X,a===T&&(a=""),a===m&&(a="",f&&o++),a===l){s&&w.push(s),i=!0;break}if(_.test(a)){const I=_.exec(a),D=I==null?void 0:I[1],ne=I==null?void 0:I[2];if(s&&w.push(s),D&&ne){if(f&&(e!=null&&e.vad)&&e.vad.length>0){let Z=0;Z=e.vad[o].start-ie.padding[0]<0?0:e.vad[o].start-ie.padding[0];const _t=D==="00:00:00.000";let je=y(A(D)+Z);o>0&&_t&&(je=y(A(D)+Z+ie.padding[0])),s={st:je,et:y(A(ne)+Z),text:"",children:[]}}else s={st:D,et:ne,text:"",children:[]};c=!0,n=!1,a=""}}}}w.length&&((_e=e==null?void 0:e.onParse)==null||_e.call(e,{type:"event",event:"message",data:w})),i&&((Se=e==null?void 0:e.onEnd)==null||Se.call(e,{type:"event",event:"end",data:r}),S())}}const qe=[239,187,191];function It(e){return qe.every((t,r)=>e.charCodeAt(r)===t)}function Lt(e){let t,r,n,a,c,s,u,i;const o=/\[(\d+)\]/,f="[--end--]";return l(),{feed:T,reset:l,end:m};function l(){t=!0,r="",n=0,i=!1,s="",a=void 0,c=!1,u=!1}function m(){T(f)}function T(_){var p,S,N,J,B;const b=[];r+=_,t&&((p=e==null?void 0:e.onStart)==null||p.call(e,{type:"event",event:"start",data:[]})),t&&Mt(r)&&(r=r.slice(Je.length)),t=!1;const g=r.length;for(;n<g;){const $=r[n];if(++n,u&&a&&$!=="["&&(a.text+=$,(S=e==null?void 0:e.onProgress)==null||S.call(e,{type:"event",event:"message",data:[a]})),$==="["&&(c&&s.length&&a&&(a.text+=s,(N=e==null?void 0:e.onProgress)==null||N.call(e,{type:"event",event:"message",data:[a]})),s="",c=!0,u=!1),c){if(s+=$,s===f){a&&b.push(a),i=!0;break}if(o.test(s)){const w=o.exec(s),Y=w==null?void 0:w[1];a&&b.push(a),Y&&(a={index:Number(Y),text:""},u=!0,c=!1,s="")}}}b.length&&((J=e==null?void 0:e.onParse)==null||J.call(e,{type:"event",event:"message",data:b})),i&&((B=e==null?void 0:e.onEnd)==null||B.call(e,{type:"event",event:"end",data:r}),l())}}const Je=[239,187,191];function Mt(e){return Je.every((t,r)=>e.charCodeAt(r)===t)}async function zt(e){return At(e,{keepMultiLine:!0,propName:{}}).filter(n=>n.text).map(n=>({st:y(n.start),et:y(n.end),text:n.text}))}async function Ye(e){return(await Pt(e)).filter(n=>n.part).map(n=>({st:y(n.start),et:y(n.end),text:n.part}))}async function kt(e){return Ye(xt(e))}async function Nt(e){return Et(e)}async function Bt(e){return Ct(e)}const Dt=Object.freeze(Object.defineProperty({__proto__:null,assToAimSegments:kt,createTranslateStreamParser:Lt,createWhisperStreamParser:Ft,openaiToAimSegments:Bt,srtToAimSegments:zt,tingwuToAimSegments:Nt,vttToAimSegments:Ye},Symbol.toStringTag,{value:"Module"}));class Gt{constructor(t){v(this,"chains",{});v(this,"delimit","__replace__");v(this,"onFilter");v(this,"checked",!1);v(this,"checkedText","");v(this,"checkedLevel");v(this,"filteredText","");this.onFilter=t}add(t,r){typeof t!="string"&&(t=new TextDecoder().decode(t));const n=t;if(!n)return;let a=this.chains;for(let c=0;c<n.length;c++){if(n[c]in a)a=a[n[c]];else{if(!(a instanceof Object))break;let s,u;for(let i=c;i<n.length;i++)a[n[i]]={},[s,u]=[a,n[i]],a=a[n[i]];s&&u&&(s[u]={[this.delimit]:r||""});break}c===n.length-1&&(a[this.delimit]=r||"")}}parse(t){t.forEach(r=>{this.add(...r)})}reParse(t){this.chains={},t.forEach(r=>{this.add(r[0],r[1])})}feed(t){if(!this.checked&&!this.chains[t]){this.filteredText+=t,this.onFilter&&this.onFilter(t);return}if(!this.checked&&this.chains[t]){this.checked=!0,this.checkedLevel=this.chains[t],this.checkedText+=t;return}if(this.checked&&this.checkedLevel[t]){this.checkedLevel=this.checkedLevel[t],this.checkedText+=t;return}if(this.checked&&!this.checkedLevel[t]){const r=typeof this.checkedLevel[this.delimit]=="string"?this.checkedLevel[this.delimit]:this.checkedText;r&&r.length&&r.split("").forEach(n=>{this.filteredText+=n,this.onFilter&&this.onFilter(n)}),this.checked=!1,this.checkedText="",this.checkedLevel=void 0,this.chains[t]?(this.checked=!0,this.checkedLevel=this.chains[t],this.checkedText=t):(this.onFilter&&this.onFilter(t),this.filteredText+=t)}}feedAll(t){return t.length?(t.split("").forEach(n=>{this.feed(n)}),this.end()):""}end(){if(this.checked&&this.checkedText){const r=typeof this.checkedLevel[this.delimit]=="string"?this.checkedLevel[this.delimit]:this.checkedText;r&&r.length&&r.split("").forEach(n=>{this.onFilter&&this.onFilter(n),this.filteredText+=n}),this.checkedText="",this.checkedLevel=void 0,this.checked=!1}const t=this.filteredText;return this.filteredText="",t}}const Ut=Object.freeze(Object.defineProperty({__proto__:null,StreamFilter:Gt},Symbol.toStringTag,{value:"Module"}));var Xe=typeof global=="object"&&global&&global.Object===Object&&global,Rt=typeof self=="object"&&self&&self.Object===Object&&self,j=Xe||Rt||Function("return this")(),L=j.Symbol,Ze=Object.prototype,Ht=Ze.hasOwnProperty,Kt=Ze.toString,G=L?L.toStringTag:void 0;function Wt(e){var t=Ht.call(e,G),r=e[G];try{e[G]=void 0;var n=!0}catch{}var a=Kt.call(e);return n&&(t?e[G]=r:delete e[G]),a}var Vt=Object.prototype,qt=Vt.toString;function Jt(e){return qt.call(e)}var Yt="[object Null]",Xt="[object Undefined]",xe=L?L.toStringTag:void 0;function W(e){return e==null?e===void 0?Xt:Yt:xe&&xe in Object(e)?Wt(e):Jt(e)}function V(e){return e!=null&&typeof e=="object"}var de=Array.isArray;function q(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Zt="[object AsyncFunction]",Qt="[object Function]",er="[object GeneratorFunction]",tr="[object Proxy]";function Qe(e){if(!q(e))return!1;var t=W(e);return t==Qt||t==er||t==Zt||t==tr}var ce=j["__core-js_shared__"],Oe=function(){var e=/[^.]+$/.exec(ce&&ce.keys&&ce.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function rr(e){return!!Oe&&Oe in e}var nr=Function.prototype,ar=nr.toString;function C(e){if(e!=null){try{return ar.call(e)}catch{}try{return e+""}catch{}}return""}var sr=/[\\^$.*+?()[\]{}|]/g,ir=/^\[object .+?Constructor\]$/,cr=Function.prototype,or=Object.prototype,ur=cr.toString,fr=or.hasOwnProperty,lr=RegExp("^"+ur.call(fr).replace(sr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function hr(e){if(!q(e)||rr(e))return!1;var t=Qe(e)?lr:ir;return t.test(C(e))}function dr(e,t){return e==null?void 0:e[t]}function F(e,t){var r=dr(e,t);return hr(r)?r:void 0}var ue=F(j,"WeakMap"),we=Object.create,gr=function(){function e(){}return function(t){if(!q(t))return{};if(we)return we(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function pr(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Ae=function(){try{var e=F(Object,"defineProperty");return e({},"",{}),e}catch{}}();function br(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var yr=9007199254740991,vr=/^(?:0|[1-9]\d*)$/;function mr(e,t){var r=typeof e;return t=t??yr,!!t&&(r=="number"||r!="symbol"&&vr.test(e))&&e>-1&&e%1==0&&e<t}function et(e,t,r){t=="__proto__"&&Ae?Ae(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function tt(e,t){return e===t||e!==e&&t!==t}var Tr=Object.prototype,_r=Tr.hasOwnProperty;function rt(e,t,r){var n=e[t];(!(_r.call(e,t)&&tt(n,r))||r===void 0&&!(t in e))&&et(e,t,r)}function ee(e,t,r,n){var a=!r;r||(r={});for(var c=-1,s=t.length;++c<s;){var u=t[c],i=void 0;i===void 0&&(i=e[u]),a?et(r,u,i):rt(r,u,i)}return r}var Sr=9007199254740991;function nt(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Sr}function at(e){return e!=null&&nt(e.length)&&!Qe(e)}var jr=Object.prototype;function ge(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||jr;return e===r}function $r(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var xr="[object Arguments]";function Pe(e){return V(e)&&W(e)==xr}var st=Object.prototype,Or=st.hasOwnProperty,wr=st.propertyIsEnumerable,Ar=Pe(function(){return arguments}())?Pe:function(e){return V(e)&&Or.call(e,"callee")&&!wr.call(e,"callee")};function Pr(){return!1}var it=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ee=it&&typeof module=="object"&&module&&!module.nodeType&&module,Er=Ee&&Ee.exports===it,Ce=Er?j.Buffer:void 0,Cr=Ce?Ce.isBuffer:void 0,ct=Cr||Pr,Fr="[object Arguments]",Ir="[object Array]",Lr="[object Boolean]",Mr="[object Date]",zr="[object Error]",kr="[object Function]",Nr="[object Map]",Br="[object Number]",Dr="[object Object]",Gr="[object RegExp]",Ur="[object Set]",Rr="[object String]",Hr="[object WeakMap]",Kr="[object ArrayBuffer]",Wr="[object DataView]",Vr="[object Float32Array]",qr="[object Float64Array]",Jr="[object Int8Array]",Yr="[object Int16Array]",Xr="[object Int32Array]",Zr="[object Uint8Array]",Qr="[object Uint8ClampedArray]",en="[object Uint16Array]",tn="[object Uint32Array]",d={};d[Vr]=d[qr]=d[Jr]=d[Yr]=d[Xr]=d[Zr]=d[Qr]=d[en]=d[tn]=!0;d[Fr]=d[Ir]=d[Kr]=d[Lr]=d[Wr]=d[Mr]=d[zr]=d[kr]=d[Nr]=d[Br]=d[Dr]=d[Gr]=d[Ur]=d[Rr]=d[Hr]=!1;function rn(e){return V(e)&&nt(e.length)&&!!d[W(e)]}function pe(e){return function(t){return e(t)}}var ot=typeof exports=="object"&&exports&&!exports.nodeType&&exports,R=ot&&typeof module=="object"&&module&&!module.nodeType&&module,nn=R&&R.exports===ot,oe=nn&&Xe.process,M=function(){try{var e=R&&R.require&&R.require("util").types;return e||oe&&oe.binding&&oe.binding("util")}catch{}}(),Fe=M&&M.isTypedArray,an=Fe?pe(Fe):rn,sn=Object.prototype,cn=sn.hasOwnProperty;function ut(e,t){var r=de(e),n=!r&&Ar(e),a=!r&&!n&&ct(e),c=!r&&!n&&!a&&an(e),s=r||n||a||c,u=s?$r(e.length,String):[],i=u.length;for(var o in e)(t||cn.call(e,o))&&!(s&&(o=="length"||a&&(o=="offset"||o=="parent")||c&&(o=="buffer"||o=="byteLength"||o=="byteOffset")||mr(o,i)))&&u.push(o);return u}function ft(e,t){return function(r){return e(t(r))}}var on=ft(Object.keys,Object),un=Object.prototype,fn=un.hasOwnProperty;function ln(e){if(!ge(e))return on(e);var t=[];for(var r in Object(e))fn.call(e,r)&&r!="constructor"&&t.push(r);return t}function be(e){return at(e)?ut(e):ln(e)}function hn(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var dn=Object.prototype,gn=dn.hasOwnProperty;function pn(e){if(!q(e))return hn(e);var t=ge(e),r=[];for(var n in e)n=="constructor"&&(t||!gn.call(e,n))||r.push(n);return r}function ye(e){return at(e)?ut(e,!0):pn(e)}var H=F(Object,"create");function bn(){this.__data__=H?H(null):{},this.size=0}function yn(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var vn="__lodash_hash_undefined__",mn=Object.prototype,Tn=mn.hasOwnProperty;function _n(e){var t=this.__data__;if(H){var r=t[e];return r===vn?void 0:r}return Tn.call(t,e)?t[e]:void 0}var Sn=Object.prototype,jn=Sn.hasOwnProperty;function $n(e){var t=this.__data__;return H?t[e]!==void 0:jn.call(t,e)}var xn="__lodash_hash_undefined__";function On(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=H&&t===void 0?xn:t,this}function E(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}E.prototype.clear=bn;E.prototype.delete=yn;E.prototype.get=_n;E.prototype.has=$n;E.prototype.set=On;function wn(){this.__data__=[],this.size=0}function te(e,t){for(var r=e.length;r--;)if(tt(e[r][0],t))return r;return-1}var An=Array.prototype,Pn=An.splice;function En(e){var t=this.__data__,r=te(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Pn.call(t,r,1),--this.size,!0}function Cn(e){var t=this.__data__,r=te(t,e);return r<0?void 0:t[r][1]}function Fn(e){return te(this.__data__,e)>-1}function In(e,t){var r=this.__data__,n=te(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function O(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}O.prototype.clear=wn;O.prototype.delete=En;O.prototype.get=Cn;O.prototype.has=Fn;O.prototype.set=In;var K=F(j,"Map");function Ln(){this.size=0,this.__data__={hash:new E,map:new(K||O),string:new E}}function Mn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function re(e,t){var r=e.__data__;return Mn(t)?r[typeof t=="string"?"string":"hash"]:r.map}function zn(e){var t=re(this,e).delete(e);return this.size-=t?1:0,t}function kn(e){return re(this,e).get(e)}function Nn(e){return re(this,e).has(e)}function Bn(e,t){var r=re(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function z(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}z.prototype.clear=Ln;z.prototype.delete=zn;z.prototype.get=kn;z.prototype.has=Nn;z.prototype.set=Bn;function lt(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}var ht=ft(Object.getPrototypeOf,Object);function Dn(){this.__data__=new O,this.size=0}function Gn(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function Un(e){return this.__data__.get(e)}function Rn(e){return this.__data__.has(e)}var Hn=200;function Kn(e,t){var r=this.__data__;if(r instanceof O){var n=r.__data__;if(!K||n.length<Hn-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new z(n)}return r.set(e,t),this.size=r.size,this}function k(e){var t=this.__data__=new O(e);this.size=t.size}k.prototype.clear=Dn;k.prototype.delete=Gn;k.prototype.get=Un;k.prototype.has=Rn;k.prototype.set=Kn;function Wn(e,t){return e&&ee(t,be(t),e)}function Vn(e,t){return e&&ee(t,ye(t),e)}var dt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ie=dt&&typeof module=="object"&&module&&!module.nodeType&&module,qn=Ie&&Ie.exports===dt,Le=qn?j.Buffer:void 0,Me=Le?Le.allocUnsafe:void 0;function Jn(e,t){if(t)return e.slice();var r=e.length,n=Me?Me(r):new e.constructor(r);return e.copy(n),n}function Yn(e,t){for(var r=-1,n=e==null?0:e.length,a=0,c=[];++r<n;){var s=e[r];t(s,r,e)&&(c[a++]=s)}return c}function gt(){return[]}var Xn=Object.prototype,Zn=Xn.propertyIsEnumerable,ze=Object.getOwnPropertySymbols,ve=ze?function(e){return e==null?[]:(e=Object(e),Yn(ze(e),function(t){return Zn.call(e,t)}))}:gt;function Qn(e,t){return ee(e,ve(e),t)}var ea=Object.getOwnPropertySymbols,pt=ea?function(e){for(var t=[];e;)lt(t,ve(e)),e=ht(e);return t}:gt;function ta(e,t){return ee(e,pt(e),t)}function bt(e,t,r){var n=t(e);return de(e)?n:lt(n,r(e))}function ra(e){return bt(e,be,ve)}function na(e){return bt(e,ye,pt)}var fe=F(j,"DataView"),le=F(j,"Promise"),he=F(j,"Set"),ke="[object Map]",aa="[object Object]",Ne="[object Promise]",Be="[object Set]",De="[object WeakMap]",Ge="[object DataView]",sa=C(fe),ia=C(K),ca=C(le),oa=C(he),ua=C(ue),x=W;(fe&&x(new fe(new ArrayBuffer(1)))!=Ge||K&&x(new K)!=ke||le&&x(le.resolve())!=Ne||he&&x(new he)!=Be||ue&&x(new ue)!=De)&&(x=function(e){var t=W(e),r=t==aa?e.constructor:void 0,n=r?C(r):"";if(n)switch(n){case sa:return Ge;case ia:return ke;case ca:return Ne;case oa:return Be;case ua:return De}return t});var fa=Object.prototype,la=fa.hasOwnProperty;function ha(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&la.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var Ue=j.Uint8Array;function me(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function da(e,t){var r=t?me(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var ga=/\w*$/;function pa(e){var t=new e.constructor(e.source,ga.exec(e));return t.lastIndex=e.lastIndex,t}var Re=L?L.prototype:void 0,He=Re?Re.valueOf:void 0;function ba(e){return He?Object(He.call(e)):{}}function ya(e,t){var r=t?me(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var va="[object Boolean]",ma="[object Date]",Ta="[object Map]",_a="[object Number]",Sa="[object RegExp]",ja="[object Set]",$a="[object String]",xa="[object Symbol]",Oa="[object ArrayBuffer]",wa="[object DataView]",Aa="[object Float32Array]",Pa="[object Float64Array]",Ea="[object Int8Array]",Ca="[object Int16Array]",Fa="[object Int32Array]",Ia="[object Uint8Array]",La="[object Uint8ClampedArray]",Ma="[object Uint16Array]",za="[object Uint32Array]";function ka(e,t,r){var n=e.constructor;switch(t){case Oa:return me(e);case va:case ma:return new n(+e);case wa:return da(e,r);case Aa:case Pa:case Ea:case Ca:case Fa:case Ia:case La:case Ma:case za:return ya(e,r);case Ta:return new n;case _a:case $a:return new n(e);case Sa:return pa(e);case ja:return new n;case xa:return ba(e)}}function Na(e){return typeof e.constructor=="function"&&!ge(e)?gr(ht(e)):{}}var Ba="[object Map]";function Da(e){return V(e)&&x(e)==Ba}var Ke=M&&M.isMap,Ga=Ke?pe(Ke):Da,Ua="[object Set]";function Ra(e){return V(e)&&x(e)==Ua}var We=M&&M.isSet,Ha=We?pe(We):Ra,Ka=1,Wa=2,Va=4,yt="[object Arguments]",qa="[object Array]",Ja="[object Boolean]",Ya="[object Date]",Xa="[object Error]",vt="[object Function]",Za="[object GeneratorFunction]",Qa="[object Map]",es="[object Number]",mt="[object Object]",ts="[object RegExp]",rs="[object Set]",ns="[object String]",as="[object Symbol]",ss="[object WeakMap]",is="[object ArrayBuffer]",cs="[object DataView]",os="[object Float32Array]",us="[object Float64Array]",fs="[object Int8Array]",ls="[object Int16Array]",hs="[object Int32Array]",ds="[object Uint8Array]",gs="[object Uint8ClampedArray]",ps="[object Uint16Array]",bs="[object Uint32Array]",h={};h[yt]=h[qa]=h[is]=h[cs]=h[Ja]=h[Ya]=h[os]=h[us]=h[fs]=h[ls]=h[hs]=h[Qa]=h[es]=h[mt]=h[ts]=h[rs]=h[ns]=h[as]=h[ds]=h[gs]=h[ps]=h[bs]=!0;h[Xa]=h[vt]=h[ss]=!1;function Q(e,t,r,n,a,c){var s,u=t&Ka,i=t&Wa,o=t&Va;if(s!==void 0)return s;if(!q(e))return e;var f=de(e);if(f){if(s=ha(e),!u)return pr(e,s)}else{var l=x(e),m=l==vt||l==Za;if(ct(e))return Jn(e,u);if(l==mt||l==yt||m&&!a){if(s=i||m?{}:Na(e),!u)return i?ta(e,Vn(s,e)):Qn(e,Wn(s,e))}else{if(!h[l])return a?e:{};s=ka(e,l,u)}}c||(c=new k);var T=c.get(e);if(T)return T;c.set(e,s),Ha(e)?e.forEach(function(g){s.add(Q(g,t,r,g,e,c))}):Ga(e)&&e.forEach(function(g,p){s.set(p,Q(g,t,r,p,e,c))});var _=o?i?na:ra:i?ye:be,b=f?void 0:_(e);return br(b||e,function(g,p){b&&(p=g,g=e[p]),rt(s,p,Q(g,t,r,p,e,c))}),s}var ys=1,vs=4;function ms(e){return Q(e,ys|vs)}class Tt{constructor(t){v(this,"threshold",2);v(this,"hit",0);v(this,"prevSegment");v(this,"hitSegment");v(this,"hitSegmentList",[]);v(this,"options");this.options=t||{}}push(t){var r,n;this.hitSegment&&this.hitSegment.text!==t.text&&(this.hitSegmentList.push(this.hitSegment),this.reset()),this.prevSegment&&t.text===this.prevSegment.text?(this.hit++,this.hit===1&&(this.hitSegment=ms(this.prevSegment)),this.threshold<=this.hit&&this.hitSegment&&(this.hitSegment.et=t.et,this.hitSegment.hit=this.hit,(n=(r=this.options).onHit)==null||n.call(r,this.hitSegmentList))):this.hit=0,this.prevSegment=t}end(){var t,r;this.hitSegment&&(this.hitSegmentList.push(this.hitSegment),(r=(t=this.options).onHit)==null||r.call(t,this.hitSegmentList)),this.reset()}reset(){this.hit=0,this.prevSegment=void 0,this.hitSegment=void 0}}const P={punc:/[.,?!\],。!?…]{1}/,em:/[.?!\]。!?…]{1}/,space:/^\s+|\s+$|\s{2,}/g,ep:/[.,?!,。!?…]{1}\s*$/};function Ts(e,t){let r=[];const n=new Tt({onHit:i=>{r=i}}),a=i=>i.trim().length===0,c=i=>{const o=A(i.st),f=A(i.et);return o>=f},s={emt:[],ep:[],zf:[],punc:[],em:[],space:[]},u=[];return e.forEach((i,o)=>{const f=P.punc.test(i.text),l=P.em.test(i.text),m=P.space.test(i.text),T=a(i.text),_=c(i),b=P.ep.test(i.text);n.push(i),i.punc=f?1:0,f&&s.punc.push(o),i.em=l?1:0,l&&s.em.push(o),i.space=m?1:0,m&&(t!=null&&t.space?i.text=i.text.replace(P.space," ").trim():s.space.push(o)),i.emt=a(i.text)?1:0,T&&(t!=null&&t.emt||s.emt.push(o)),i.zf=c(i)?1:0,_&&(t!=null&&t.zf||s.zf.push(o)),i.ep=b?1:0,b&&(t!=null&&t.ep?i.text=i.text.replace(P.ep,""):s.ep.push(o)),!(t!=null&&t.zf&&i.zf)&&(t!=null&&t.emt&&i.emt||u.push(i))}),n.end(),{result:s,repeat:r,segments:u}}const _s=Object.freeze(Object.defineProperty({__proto__:null,RepeatCheck:Tt,subtitleOptimization:Ts,subtitleOptimizationRegExp:P},Symbol.toStringTag,{value:"Module"}));exports.filter=Ut;exports.parser=Dt;exports.tools=_s;exports.utils=$t;
20
+ */function wt(e,t){let r=t;for(;!e[r];)r++;return r}function Ot(e){let t=e.length-1;for(;t>=0&&!e[t];)t--;return t}function At(e="",t={propName:{}}){const r=[],n=e.split(/(?:\r\n|\r|\n)/gm).filter(o=>o.length>0),a=n.map((o,f)=>n[f+2]&&/\d{2}:\d{2}:\d{2}[,\.]\d{2,3}\s*-->\s*\d{2}:\d{2}:\d{2}[,\.]\d{2,3}/.test(n[f+2])?o+`\r
21
+ `:o).join(`
22
+ `).split(/(?:\r\n|\r|\n)/gm),c=Ot(a)+1;let s=0,u,i,l;for(let o=0;o<c;o++){for(l={},i=[],o=wt(a,o),l.id=parseInt(a[o++],10),u=a[o++].split(/[\t ]*-->[\t ]*/),l[t.propName.start||"start"]=t.timeInText?u[0]:A(u[0]),s=u[1].indexOf(" "),s!==-1&&(u[1]=u[1].substr(0,s)),l[t.propName.end||"end"]=t.timeInText?u[1]:A(u[1]);o<c&&a[o];)i.push(a[o++]);const f=t.propName.text||"text";l[f]=i.join(t.keepMultiLine?`
23
+ `:" ").replace(/\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}/gi,""),l[f]=l[f].replace(/</g,"&lt;").replace(/>/g,"&gt;"),l[f]=l[f].replace(/&lt;(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)(\/?)&gt;/gi,"<$1$3$7>"),t.ignoreLineBreaks?l[f]=l[f].replace(/\\N/gi,""):l[f]=l[f].replace(/\\N/gi,"<br />"),r.push(l)}return r}function Pt(e,t){const r=/<\/?[^>]+(>|$)/g;return new Promise((n,a)=>{let c={};const s=[];let u=!1;const i=e.split(`
24
+ `);i.forEach((o,f)=>{o.replace(r,"")===" "||o.replace(r,"")===""||(o.indexOf("-->")!==-1?(u=!0,typeof c.start=="number"&&c.start>=0&&s.push(se(c)),c={start:ae(o.split("-->")[0].trimRight().split(" ").pop()),end:ae(o.split("-->")[1].trimLeft().split(" ").shift()),part:""}):u&&(s.length!==0?(s[s.length-1].part.replace(r,""),o.replace(r,""),c.part.length===0?c.part=o:c.part=`${c.part}
25
+ ${o}`,f===i.length-1&&s.push(se(c))):(c.part=o,s.push(se(c)),c.part="")))}),c=[];const l=/(<([0-9:.>]+)>)/ig;s.forEach(o=>{const _=o.part.split().map(function(p){return p.replace(l,function(b){return b.split("").reduce(function(S,N){return`==${b.replace("<","").replace(">","")}`},0)})})[0].replace(r,"").split(" "),y=[];_.forEach(function(p){if(p.indexOf("==")>-1){const b=p.split("=="),S=b[0];if(b[1],S==""||S=="##")return;y.push({word:xe(p.split("==")[0]),time:ae(p.split("==")[1])})}else y.push({word:xe(p),time:void 0})}),o.words=y,o.part=o.part.replace(r,"")}),n(s)})}function ae(e){const t=e.split(":"),r=t[t.length-3]?+t[t.length-3]:0,n=t[t.length-2]?+t[t.length-2]:0,a=+t[t.length-1];return r*3600+n*60+a}function xe(e){return e.replace(/[^0-9a-z'-]/gi,"").toLowerCase()}function se(e){if(e==null||typeof e!="object")return e;const t=e.constructor();for(const r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function Et(e){return e.Transcription.Paragraphs.map(t=>{const r=t.Words.map(n=>({st:g(n.Start/1e3),et:g(n.End/1e3),text:n.Text,spk:t.SpeakerId}));return{st:g(t.Words[0].Start/1e3),et:g(t.Words[t.Words.length-1].End/1e3),text:r.map(n=>n.text).join(""),spk:t.SpeakerId,children:r}})}function Ct(e){var t,r;if(e.segments){const n=e.segments.map(a=>({st:g(a.start),et:g(a.end),text:a.text}));if(e.words.length>0){const a=e.words;let c=0,s=0;for(;c<n.length;){const u=n[c];let i=u.text;for(let l=s;l<a.length;l++){const o=a[l];if(o&&i.startsWith(o.word))u.children=u.children||[],u.children.push({st:g(o.start),et:g(o.end),text:o.word}),i=i.substring(o.word.length);else if(o&&new RegExp(`^[\\s\\p{P}]*${o.word}`,"u").test(i)){u.children=u.children||[];const f=i.match(new RegExp(`^[\\s\\p{P}]*${o.word}`,"u"))[0];if(/^[,.?…,。?!!]/u.test(f)){const m=((t=f.match(/^[,.?…,。?!!]+/u))==null?void 0:t[0])||"",T=f.substring(m.length);if(u.children.length>0){const _=u.children[u.children.length-1];_.text+=m}u.children.push({st:g(o.start),et:g(o.end),text:T})}else u.children.push({st:g(o.start),et:g(o.end),text:f});i=i.substring(f.length)}else{s=l;break}}c++}return n}return n}else if(((r=e.words)==null?void 0:r.length)>=0){const n=e.words.map(a=>({st:g(a.start),et:g(a.end),text:a.word}));return[{st:g(e.words[0].start),et:g(e.words[e.words.length-1].end),text:e.text,children:n}]}else return[]}const ie={padding:[.4,0],maxGap:10,minGap:2,minStart:6};function Ft(e){let t,r,n,a,c,s,u,i,l;const o=!!(e&&e.vad&&e.vad.length>0),f="[--end--]",m="[--Single--]",T="[--Full--]",_=/\[(\d{2}:\d{2}:\d{2}\.\d{3}) --> (\d{2}:\d{2}:\d{2}\.\d{3})\]/;let y=!1,p=!1,b="";return S(),{feed:B,reset:S,end:N};function S(){t=!0,r="",n=!1,a="",c=!1,s=void 0,u=0,i=!1,l=0}function N(){if(i){console.log("whisper parser is already end");return}B(f)}function J(x){y||(b+=x),!y&&!p&&Ve(b)&&(p=!0),!y&&b.length>50&&(y=!0)}function B(x){var Te,_e,Se;J(x);const O=[];r+=x,t&&((Te=e==null?void 0:e.onStart)==null||Te.call(e,{type:"event",event:"start",data:[]})),t&&It(r)&&(r=r.slice(qe.length)),t=!1;const Y=r.length;for(;u<Y;){const X=r[u];if(++u,c&&s&&X!=="["&&(s.text+=X),X==="["&&(n&&a.length&&s&&(s.text+=a),a="",n=!0,c=!1),n){if(a+=X,a===T&&(a=""),a===m&&(a="",o&&l++),a===f){s&&O.push(s),i=!0;break}if(_.test(a)){const I=_.exec(a),D=I==null?void 0:I[1],ne=I==null?void 0:I[2];if(s&&O.push(s),D&&ne){if(o&&(e!=null&&e.vad)&&e.vad.length>0){let Z=0;Z=e.vad[l].start-ie.padding[0]<0?0:e.vad[l].start-ie.padding[0];const _t=D==="00:00:00.000";let je=g(A(D)+Z);l>0&&_t&&(je=g(A(D)+Z+ie.padding[0])),s={st:je,et:g(A(ne)+Z),text:"",children:[]}}else s={st:D,et:ne,text:"",children:[]};c=!0,n=!1,a=""}}}}O.length&&((_e=e==null?void 0:e.onParse)==null||_e.call(e,{type:"event",event:"message",data:O})),i&&((Se=e==null?void 0:e.onEnd)==null||Se.call(e,{type:"event",event:"end",data:r}),S())}}const qe=[239,187,191];function It(e){return qe.every((t,r)=>e.charCodeAt(r)===t)}function Lt(e){let t,r,n,a,c,s,u,i;const l=/\[(\d+)\]/,o="[--end--]";return f(),{feed:T,reset:f,end:m};function f(){t=!0,r="",n=0,i=!1,s="",a=void 0,c=!1,u=!1}function m(){T(o)}function T(_){var b,S,N,J,B;const y=[];r+=_,t&&((b=e==null?void 0:e.onStart)==null||b.call(e,{type:"event",event:"start",data:[]})),t&&Mt(r)&&(r=r.slice(Je.length)),t=!1;const p=r.length;for(;n<p;){const x=r[n];if(++n,u&&a&&x!=="["&&(a.text+=x,(S=e==null?void 0:e.onProgress)==null||S.call(e,{type:"event",event:"message",data:[a]})),x==="["&&(c&&s.length&&a&&(a.text+=s,(N=e==null?void 0:e.onProgress)==null||N.call(e,{type:"event",event:"message",data:[a]})),s="",c=!0,u=!1),c){if(s+=x,s===o){a&&y.push(a),i=!0;break}if(l.test(s)){const O=l.exec(s),Y=O==null?void 0:O[1];a&&y.push(a),Y&&(a={index:Number(Y),text:""},u=!0,c=!1,s="")}}}y.length&&((J=e==null?void 0:e.onParse)==null||J.call(e,{type:"event",event:"message",data:y})),i&&((B=e==null?void 0:e.onEnd)==null||B.call(e,{type:"event",event:"end",data:r}),f())}}const Je=[239,187,191];function Mt(e){return Je.every((t,r)=>e.charCodeAt(r)===t)}async function kt(e){return At(e,{keepMultiLine:!0,propName:{}}).filter(n=>n.text).map(n=>({st:g(n.start),et:g(n.end),text:n.text}))}async function Ye(e){return(await Pt(e)).filter(n=>n.part).map(n=>({st:g(n.start),et:g(n.end),text:n.part}))}async function zt(e){return Ye($t(e))}async function Nt(e){return Et(e)}async function Bt(e){return Ct(e)}const Dt=Object.freeze(Object.defineProperty({__proto__:null,assToAimSegments:zt,createTranslateStreamParser:Lt,createWhisperStreamParser:Ft,openaiToAimSegments:Bt,srtToAimSegments:kt,tingwuToAimSegments:Nt,vttToAimSegments:Ye},Symbol.toStringTag,{value:"Module"}));class Rt{constructor(t){v(this,"chains",{});v(this,"delimit","__replace__");v(this,"onFilter");v(this,"checked",!1);v(this,"checkedText","");v(this,"checkedLevel");v(this,"filteredText","");this.onFilter=t}add(t,r){typeof t!="string"&&(t=new TextDecoder().decode(t));const n=t;if(!n)return;let a=this.chains;for(let c=0;c<n.length;c++){if(n[c]in a)a=a[n[c]];else{if(!(a instanceof Object))break;let s,u;for(let i=c;i<n.length;i++)a[n[i]]={},[s,u]=[a,n[i]],a=a[n[i]];s&&u&&(s[u]={[this.delimit]:r||""});break}c===n.length-1&&(a[this.delimit]=r||"")}}parse(t){t.forEach(r=>{this.add(...r)})}reParse(t){this.chains={},t.forEach(r=>{this.add(r[0],r[1])})}feed(t){if(!this.checked&&!this.chains[t]){this.filteredText+=t,this.onFilter&&this.onFilter(t);return}if(!this.checked&&this.chains[t]){this.checked=!0,this.checkedLevel=this.chains[t],this.checkedText+=t;return}if(this.checked&&this.checkedLevel[t]){this.checkedLevel=this.checkedLevel[t],this.checkedText+=t;return}if(this.checked&&!this.checkedLevel[t]){const r=typeof this.checkedLevel[this.delimit]=="string"?this.checkedLevel[this.delimit]:this.checkedText;r&&r.length&&r.split("").forEach(n=>{this.filteredText+=n,this.onFilter&&this.onFilter(n)}),this.checked=!1,this.checkedText="",this.checkedLevel=void 0,this.chains[t]?(this.checked=!0,this.checkedLevel=this.chains[t],this.checkedText=t):(this.onFilter&&this.onFilter(t),this.filteredText+=t)}}feedAll(t){return t.length?(t.split("").forEach(n=>{this.feed(n)}),this.end()):""}end(){if(this.checked&&this.checkedText){const r=typeof this.checkedLevel[this.delimit]=="string"?this.checkedLevel[this.delimit]:this.checkedText;r&&r.length&&r.split("").forEach(n=>{this.onFilter&&this.onFilter(n),this.filteredText+=n}),this.checkedText="",this.checkedLevel=void 0,this.checked=!1}const t=this.filteredText;return this.filteredText="",t}}const Gt=Object.freeze(Object.defineProperty({__proto__:null,StreamFilter:Rt},Symbol.toStringTag,{value:"Module"}));var Xe=typeof global=="object"&&global&&global.Object===Object&&global,Ut=typeof self=="object"&&self&&self.Object===Object&&self,j=Xe||Ut||Function("return this")(),L=j.Symbol,Ze=Object.prototype,Ht=Ze.hasOwnProperty,Wt=Ze.toString,R=L?L.toStringTag:void 0;function Kt(e){var t=Ht.call(e,R),r=e[R];try{e[R]=void 0;var n=!0}catch{}var a=Wt.call(e);return n&&(t?e[R]=r:delete e[R]),a}var Vt=Object.prototype,qt=Vt.toString;function Jt(e){return qt.call(e)}var Yt="[object Null]",Xt="[object Undefined]",$e=L?L.toStringTag:void 0;function K(e){return e==null?e===void 0?Xt:Yt:$e&&$e in Object(e)?Kt(e):Jt(e)}function V(e){return e!=null&&typeof e=="object"}var de=Array.isArray;function q(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Zt="[object AsyncFunction]",Qt="[object Function]",er="[object GeneratorFunction]",tr="[object Proxy]";function Qe(e){if(!q(e))return!1;var t=K(e);return t==Qt||t==er||t==Zt||t==tr}var ce=j["__core-js_shared__"],we=function(){var e=/[^.]+$/.exec(ce&&ce.keys&&ce.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function rr(e){return!!we&&we in e}var nr=Function.prototype,ar=nr.toString;function C(e){if(e!=null){try{return ar.call(e)}catch{}try{return e+""}catch{}}return""}var sr=/[\\^$.*+?()[\]{}|]/g,ir=/^\[object .+?Constructor\]$/,cr=Function.prototype,or=Object.prototype,ur=cr.toString,lr=or.hasOwnProperty,fr=RegExp("^"+ur.call(lr).replace(sr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function hr(e){if(!q(e)||rr(e))return!1;var t=Qe(e)?fr:ir;return t.test(C(e))}function dr(e,t){return e==null?void 0:e[t]}function F(e,t){var r=dr(e,t);return hr(r)?r:void 0}var ue=F(j,"WeakMap"),Oe=Object.create,gr=function(){function e(){}return function(t){if(!q(t))return{};if(Oe)return Oe(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function pr(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Ae=function(){try{var e=F(Object,"defineProperty");return e({},"",{}),e}catch{}}();function br(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var yr=9007199254740991,vr=/^(?:0|[1-9]\d*)$/;function mr(e,t){var r=typeof e;return t=t??yr,!!t&&(r=="number"||r!="symbol"&&vr.test(e))&&e>-1&&e%1==0&&e<t}function et(e,t,r){t=="__proto__"&&Ae?Ae(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function tt(e,t){return e===t||e!==e&&t!==t}var Tr=Object.prototype,_r=Tr.hasOwnProperty;function rt(e,t,r){var n=e[t];(!(_r.call(e,t)&&tt(n,r))||r===void 0&&!(t in e))&&et(e,t,r)}function ee(e,t,r,n){var a=!r;r||(r={});for(var c=-1,s=t.length;++c<s;){var u=t[c],i=void 0;i===void 0&&(i=e[u]),a?et(r,u,i):rt(r,u,i)}return r}var Sr=9007199254740991;function nt(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Sr}function at(e){return e!=null&&nt(e.length)&&!Qe(e)}var jr=Object.prototype;function ge(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||jr;return e===r}function xr(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var $r="[object Arguments]";function Pe(e){return V(e)&&K(e)==$r}var st=Object.prototype,wr=st.hasOwnProperty,Or=st.propertyIsEnumerable,Ar=Pe(function(){return arguments}())?Pe:function(e){return V(e)&&wr.call(e,"callee")&&!Or.call(e,"callee")};function Pr(){return!1}var it=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ee=it&&typeof module=="object"&&module&&!module.nodeType&&module,Er=Ee&&Ee.exports===it,Ce=Er?j.Buffer:void 0,Cr=Ce?Ce.isBuffer:void 0,ct=Cr||Pr,Fr="[object Arguments]",Ir="[object Array]",Lr="[object Boolean]",Mr="[object Date]",kr="[object Error]",zr="[object Function]",Nr="[object Map]",Br="[object Number]",Dr="[object Object]",Rr="[object RegExp]",Gr="[object Set]",Ur="[object String]",Hr="[object WeakMap]",Wr="[object ArrayBuffer]",Kr="[object DataView]",Vr="[object Float32Array]",qr="[object Float64Array]",Jr="[object Int8Array]",Yr="[object Int16Array]",Xr="[object Int32Array]",Zr="[object Uint8Array]",Qr="[object Uint8ClampedArray]",en="[object Uint16Array]",tn="[object Uint32Array]",d={};d[Vr]=d[qr]=d[Jr]=d[Yr]=d[Xr]=d[Zr]=d[Qr]=d[en]=d[tn]=!0;d[Fr]=d[Ir]=d[Wr]=d[Lr]=d[Kr]=d[Mr]=d[kr]=d[zr]=d[Nr]=d[Br]=d[Dr]=d[Rr]=d[Gr]=d[Ur]=d[Hr]=!1;function rn(e){return V(e)&&nt(e.length)&&!!d[K(e)]}function pe(e){return function(t){return e(t)}}var ot=typeof exports=="object"&&exports&&!exports.nodeType&&exports,U=ot&&typeof module=="object"&&module&&!module.nodeType&&module,nn=U&&U.exports===ot,oe=nn&&Xe.process,M=function(){try{var e=U&&U.require&&U.require("util").types;return e||oe&&oe.binding&&oe.binding("util")}catch{}}(),Fe=M&&M.isTypedArray,an=Fe?pe(Fe):rn,sn=Object.prototype,cn=sn.hasOwnProperty;function ut(e,t){var r=de(e),n=!r&&Ar(e),a=!r&&!n&&ct(e),c=!r&&!n&&!a&&an(e),s=r||n||a||c,u=s?xr(e.length,String):[],i=u.length;for(var l in e)(t||cn.call(e,l))&&!(s&&(l=="length"||a&&(l=="offset"||l=="parent")||c&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||mr(l,i)))&&u.push(l);return u}function lt(e,t){return function(r){return e(t(r))}}var on=lt(Object.keys,Object),un=Object.prototype,ln=un.hasOwnProperty;function fn(e){if(!ge(e))return on(e);var t=[];for(var r in Object(e))ln.call(e,r)&&r!="constructor"&&t.push(r);return t}function be(e){return at(e)?ut(e):fn(e)}function hn(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var dn=Object.prototype,gn=dn.hasOwnProperty;function pn(e){if(!q(e))return hn(e);var t=ge(e),r=[];for(var n in e)n=="constructor"&&(t||!gn.call(e,n))||r.push(n);return r}function ye(e){return at(e)?ut(e,!0):pn(e)}var H=F(Object,"create");function bn(){this.__data__=H?H(null):{},this.size=0}function yn(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var vn="__lodash_hash_undefined__",mn=Object.prototype,Tn=mn.hasOwnProperty;function _n(e){var t=this.__data__;if(H){var r=t[e];return r===vn?void 0:r}return Tn.call(t,e)?t[e]:void 0}var Sn=Object.prototype,jn=Sn.hasOwnProperty;function xn(e){var t=this.__data__;return H?t[e]!==void 0:jn.call(t,e)}var $n="__lodash_hash_undefined__";function wn(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=H&&t===void 0?$n:t,this}function E(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}E.prototype.clear=bn;E.prototype.delete=yn;E.prototype.get=_n;E.prototype.has=xn;E.prototype.set=wn;function On(){this.__data__=[],this.size=0}function te(e,t){for(var r=e.length;r--;)if(tt(e[r][0],t))return r;return-1}var An=Array.prototype,Pn=An.splice;function En(e){var t=this.__data__,r=te(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Pn.call(t,r,1),--this.size,!0}function Cn(e){var t=this.__data__,r=te(t,e);return r<0?void 0:t[r][1]}function Fn(e){return te(this.__data__,e)>-1}function In(e,t){var r=this.__data__,n=te(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function w(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}w.prototype.clear=On;w.prototype.delete=En;w.prototype.get=Cn;w.prototype.has=Fn;w.prototype.set=In;var W=F(j,"Map");function Ln(){this.size=0,this.__data__={hash:new E,map:new(W||w),string:new E}}function Mn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function re(e,t){var r=e.__data__;return Mn(t)?r[typeof t=="string"?"string":"hash"]:r.map}function kn(e){var t=re(this,e).delete(e);return this.size-=t?1:0,t}function zn(e){return re(this,e).get(e)}function Nn(e){return re(this,e).has(e)}function Bn(e,t){var r=re(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function k(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}k.prototype.clear=Ln;k.prototype.delete=kn;k.prototype.get=zn;k.prototype.has=Nn;k.prototype.set=Bn;function ft(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}var ht=lt(Object.getPrototypeOf,Object);function Dn(){this.__data__=new w,this.size=0}function Rn(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function Gn(e){return this.__data__.get(e)}function Un(e){return this.__data__.has(e)}var Hn=200;function Wn(e,t){var r=this.__data__;if(r instanceof w){var n=r.__data__;if(!W||n.length<Hn-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new k(n)}return r.set(e,t),this.size=r.size,this}function z(e){var t=this.__data__=new w(e);this.size=t.size}z.prototype.clear=Dn;z.prototype.delete=Rn;z.prototype.get=Gn;z.prototype.has=Un;z.prototype.set=Wn;function Kn(e,t){return e&&ee(t,be(t),e)}function Vn(e,t){return e&&ee(t,ye(t),e)}var dt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ie=dt&&typeof module=="object"&&module&&!module.nodeType&&module,qn=Ie&&Ie.exports===dt,Le=qn?j.Buffer:void 0,Me=Le?Le.allocUnsafe:void 0;function Jn(e,t){if(t)return e.slice();var r=e.length,n=Me?Me(r):new e.constructor(r);return e.copy(n),n}function Yn(e,t){for(var r=-1,n=e==null?0:e.length,a=0,c=[];++r<n;){var s=e[r];t(s,r,e)&&(c[a++]=s)}return c}function gt(){return[]}var Xn=Object.prototype,Zn=Xn.propertyIsEnumerable,ke=Object.getOwnPropertySymbols,ve=ke?function(e){return e==null?[]:(e=Object(e),Yn(ke(e),function(t){return Zn.call(e,t)}))}:gt;function Qn(e,t){return ee(e,ve(e),t)}var ea=Object.getOwnPropertySymbols,pt=ea?function(e){for(var t=[];e;)ft(t,ve(e)),e=ht(e);return t}:gt;function ta(e,t){return ee(e,pt(e),t)}function bt(e,t,r){var n=t(e);return de(e)?n:ft(n,r(e))}function ra(e){return bt(e,be,ve)}function na(e){return bt(e,ye,pt)}var le=F(j,"DataView"),fe=F(j,"Promise"),he=F(j,"Set"),ze="[object Map]",aa="[object Object]",Ne="[object Promise]",Be="[object Set]",De="[object WeakMap]",Re="[object DataView]",sa=C(le),ia=C(W),ca=C(fe),oa=C(he),ua=C(ue),$=K;(le&&$(new le(new ArrayBuffer(1)))!=Re||W&&$(new W)!=ze||fe&&$(fe.resolve())!=Ne||he&&$(new he)!=Be||ue&&$(new ue)!=De)&&($=function(e){var t=K(e),r=t==aa?e.constructor:void 0,n=r?C(r):"";if(n)switch(n){case sa:return Re;case ia:return ze;case ca:return Ne;case oa:return Be;case ua:return De}return t});var la=Object.prototype,fa=la.hasOwnProperty;function ha(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&fa.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var Ge=j.Uint8Array;function me(e){var t=new e.constructor(e.byteLength);return new Ge(t).set(new Ge(e)),t}function da(e,t){var r=t?me(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var ga=/\w*$/;function pa(e){var t=new e.constructor(e.source,ga.exec(e));return t.lastIndex=e.lastIndex,t}var Ue=L?L.prototype:void 0,He=Ue?Ue.valueOf:void 0;function ba(e){return He?Object(He.call(e)):{}}function ya(e,t){var r=t?me(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var va="[object Boolean]",ma="[object Date]",Ta="[object Map]",_a="[object Number]",Sa="[object RegExp]",ja="[object Set]",xa="[object String]",$a="[object Symbol]",wa="[object ArrayBuffer]",Oa="[object DataView]",Aa="[object Float32Array]",Pa="[object Float64Array]",Ea="[object Int8Array]",Ca="[object Int16Array]",Fa="[object Int32Array]",Ia="[object Uint8Array]",La="[object Uint8ClampedArray]",Ma="[object Uint16Array]",ka="[object Uint32Array]";function za(e,t,r){var n=e.constructor;switch(t){case wa:return me(e);case va:case ma:return new n(+e);case Oa:return da(e,r);case Aa:case Pa:case Ea:case Ca:case Fa:case Ia:case La:case Ma:case ka:return ya(e,r);case Ta:return new n;case _a:case xa:return new n(e);case Sa:return pa(e);case ja:return new n;case $a:return ba(e)}}function Na(e){return typeof e.constructor=="function"&&!ge(e)?gr(ht(e)):{}}var Ba="[object Map]";function Da(e){return V(e)&&$(e)==Ba}var We=M&&M.isMap,Ra=We?pe(We):Da,Ga="[object Set]";function Ua(e){return V(e)&&$(e)==Ga}var Ke=M&&M.isSet,Ha=Ke?pe(Ke):Ua,Wa=1,Ka=2,Va=4,yt="[object Arguments]",qa="[object Array]",Ja="[object Boolean]",Ya="[object Date]",Xa="[object Error]",vt="[object Function]",Za="[object GeneratorFunction]",Qa="[object Map]",es="[object Number]",mt="[object Object]",ts="[object RegExp]",rs="[object Set]",ns="[object String]",as="[object Symbol]",ss="[object WeakMap]",is="[object ArrayBuffer]",cs="[object DataView]",os="[object Float32Array]",us="[object Float64Array]",ls="[object Int8Array]",fs="[object Int16Array]",hs="[object Int32Array]",ds="[object Uint8Array]",gs="[object Uint8ClampedArray]",ps="[object Uint16Array]",bs="[object Uint32Array]",h={};h[yt]=h[qa]=h[is]=h[cs]=h[Ja]=h[Ya]=h[os]=h[us]=h[ls]=h[fs]=h[hs]=h[Qa]=h[es]=h[mt]=h[ts]=h[rs]=h[ns]=h[as]=h[ds]=h[gs]=h[ps]=h[bs]=!0;h[Xa]=h[vt]=h[ss]=!1;function Q(e,t,r,n,a,c){var s,u=t&Wa,i=t&Ka,l=t&Va;if(s!==void 0)return s;if(!q(e))return e;var o=de(e);if(o){if(s=ha(e),!u)return pr(e,s)}else{var f=$(e),m=f==vt||f==Za;if(ct(e))return Jn(e,u);if(f==mt||f==yt||m&&!a){if(s=i||m?{}:Na(e),!u)return i?ta(e,Vn(s,e)):Qn(e,Kn(s,e))}else{if(!h[f])return a?e:{};s=za(e,f,u)}}c||(c=new z);var T=c.get(e);if(T)return T;c.set(e,s),Ha(e)?e.forEach(function(p){s.add(Q(p,t,r,p,e,c))}):Ra(e)&&e.forEach(function(p,b){s.set(b,Q(p,t,r,b,e,c))});var _=l?i?na:ra:i?ye:be,y=o?void 0:_(e);return br(y||e,function(p,b){y&&(b=p,p=e[b]),rt(s,b,Q(p,t,r,b,e,c))}),s}var ys=1,vs=4;function ms(e){return Q(e,ys|vs)}class Tt{constructor(t){v(this,"threshold",2);v(this,"hit",0);v(this,"prevSegment");v(this,"hitSegment");v(this,"hitSegmentList",[]);v(this,"options");this.options=t||{}}push(t){var r,n;this.hitSegment&&this.hitSegment.text!==t.text&&(this.hitSegmentList.push(this.hitSegment),this.reset()),this.prevSegment&&t.text===this.prevSegment.text?(this.hit++,this.hit===1&&(this.hitSegment=ms(this.prevSegment)),this.threshold<=this.hit&&this.hitSegment&&(this.hitSegment.et=t.et,this.hitSegment.hit=this.hit,(n=(r=this.options).onHit)==null||n.call(r,this.hitSegmentList))):this.hit=0,this.prevSegment=t}end(){var t,r;this.hitSegment&&(this.hitSegmentList.push(this.hitSegment),(r=(t=this.options).onHit)==null||r.call(t,this.hitSegmentList)),this.reset()}reset(){this.hit=0,this.prevSegment=void 0,this.hitSegment=void 0}}const P={punc:/[.,?!\],。!?…]{1}/,em:/[.?!\]。!?…]{1}/,space:/^\s+|\s+$|\s{2,}/g,ep:/[.,?!,。!?…]{1}\s*$/};function Ts(e,t){let r=[];const n=new Tt({onHit:i=>{r=i}}),a=i=>i.trim().length===0,c=i=>{const l=A(i.st),o=A(i.et);return l>=o},s={emt:[],ep:[],zf:[],punc:[],em:[],space:[]},u=[];return e.forEach((i,l)=>{const o=P.punc.test(i.text),f=P.em.test(i.text),m=P.space.test(i.text),T=a(i.text),_=c(i),y=P.ep.test(i.text);n.push(i),i.punc=o?1:0,o&&s.punc.push(l),i.em=f?1:0,f&&s.em.push(l),i.space=m?1:0,m&&(t!=null&&t.space?i.text=i.text.replace(P.space," ").trim():s.space.push(l)),i.emt=a(i.text)?1:0,T&&(t!=null&&t.emt||s.emt.push(l)),i.zf=c(i)?1:0,_&&(t!=null&&t.zf||s.zf.push(l)),i.ep=y?1:0,y&&(t!=null&&t.ep?i.text=i.text.replace(P.ep,""):s.ep.push(l)),!(t!=null&&t.zf&&i.zf)&&(t!=null&&t.emt&&i.emt||u.push(i))}),n.end(),{result:s,repeat:r,segments:u}}const _s=Object.freeze(Object.defineProperty({__proto__:null,RepeatCheck:Tt,subtitleOptimization:Ts,subtitleOptimizationRegExp:P},Symbol.toStringTag,{value:"Module"}));exports.filter=Gt;exports.parser=Dt;exports.tools=_s;exports.utils=xt;
package/dist/index.d.ts CHANGED
@@ -123,6 +123,11 @@ declare interface OpenAIResult {
123
123
  start: number;
124
124
  end: number;
125
125
  }[];
126
+ segments: {
127
+ text: string;
128
+ start: number;
129
+ end: number;
130
+ }[];
126
131
  }
127
132
 
128
133
  declare function openaiToAimSegments(json: OpenAIResult): Promise<AimSegments[]>;
package/dist/index.es.js CHANGED
@@ -1,11 +1,11 @@
1
- var St = Object.defineProperty;
2
- var jt = (e, t, r) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var m = (e, t, r) => jt(e, typeof t != "symbol" ? t + "" : t, r);
4
- function U(e, t = 2) {
1
+ var xt = Object.defineProperty;
2
+ var St = (e, t, r) => t in e ? xt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var m = (e, t, r) => St(e, typeof t != "symbol" ? t + "" : t, r);
4
+ function G(e, t = 2) {
5
5
  return e.toString().padStart(t, "0");
6
6
  }
7
- function y(e) {
8
- const t = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), n = e % 3600 % 60, a = Math.floor(n % 1 * 1e3), c = U(t), s = U(r), u = U(Math.floor(n)), i = U(a, 3);
7
+ function g(e) {
8
+ const t = Math.floor(e / 3600), r = Math.floor(e % 3600 / 60), n = e % 3600 % 60, a = Math.floor(n % 1 * 1e3), c = G(t), s = G(r), u = G(Math.floor(n)), i = G(a, 3);
9
9
  return `${c}:${s}:${u}.${i}`;
10
10
  }
11
11
  function A(e) {
@@ -26,8 +26,8 @@ const vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
26
26
  __proto__: null,
27
27
  containsCJKCharacters: Ve,
28
28
  convertToSeconds: A,
29
- formatTime: y,
30
- padNumber: U
29
+ formatTime: g,
30
+ padNumber: G
31
31
  }, Symbol.toStringTag, { value: "Module" }));
32
32
  /**
33
33
  * @name ass2vtt
@@ -35,7 +35,7 @@ const vs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
35
35
  * @author YuQian2015 (https://github.com/YuQian2015)
36
36
  * @license MIT
37
37
  */
38
- function xt(e) {
38
+ function jt(e) {
39
39
  const t = new RegExp(
40
40
  "Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$",
41
41
  "i"
@@ -89,16 +89,16 @@ function wt(e) {
89
89
  return t;
90
90
  }
91
91
  function Ot(e = "", t = { propName: {} }) {
92
- const r = [], n = e.split(/(?:\r\n|\r|\n)/gm).filter((f) => f.length > 0), a = n.map((f, l) => n[l + 2] && /\d{2}:\d{2}:\d{2}[,\.]\d{2,3}\s*-->\s*\d{2}:\d{2}:\d{2}[,\.]\d{2,3}/.test(n[l + 2]) ? f + `\r
93
- ` : f).join(`
92
+ const r = [], n = e.split(/(?:\r\n|\r|\n)/gm).filter((o) => o.length > 0), a = n.map((o, f) => n[f + 2] && /\d{2}:\d{2}:\d{2}[,\.]\d{2,3}\s*-->\s*\d{2}:\d{2}:\d{2}[,\.]\d{2,3}/.test(n[f + 2]) ? o + `\r
93
+ ` : o).join(`
94
94
  `).split(/(?:\r\n|\r|\n)/gm), c = wt(a) + 1;
95
- let s = 0, u, i, o;
96
- for (let f = 0; f < c; f++) {
97
- for (o = {}, i = [], f = $t(a, f), o.id = parseInt(a[f++], 10), u = a[f++].split(/[\t ]*-->[\t ]*/), o[t.propName.start || "start"] = t.timeInText ? u[0] : A(u[0]), s = u[1].indexOf(" "), s !== -1 && (u[1] = u[1].substr(0, s)), o[t.propName.end || "end"] = t.timeInText ? u[1] : A(u[1]); f < c && a[f]; )
98
- i.push(a[f++]);
99
- const l = t.propName.text || "text";
100
- o[l] = i.join(t.keepMultiLine ? `
101
- ` : " ").replace(/\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}/gi, ""), o[l] = o[l].replace(/</g, "&lt;").replace(/>/g, "&gt;"), o[l] = o[l].replace(/&lt;(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)(\/?)&gt;/gi, "<$1$3$7>"), t.ignoreLineBreaks ? o[l] = o[l].replace(/\\N/gi, "") : o[l] = o[l].replace(/\\N/gi, "<br />"), r.push(o);
95
+ let s = 0, u, i, l;
96
+ for (let o = 0; o < c; o++) {
97
+ for (l = {}, i = [], o = $t(a, o), l.id = parseInt(a[o++], 10), u = a[o++].split(/[\t ]*-->[\t ]*/), l[t.propName.start || "start"] = t.timeInText ? u[0] : A(u[0]), s = u[1].indexOf(" "), s !== -1 && (u[1] = u[1].substr(0, s)), l[t.propName.end || "end"] = t.timeInText ? u[1] : A(u[1]); o < c && a[o]; )
98
+ i.push(a[o++]);
99
+ const f = t.propName.text || "text";
100
+ l[f] = i.join(t.keepMultiLine ? `
101
+ ` : " ").replace(/\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}/gi, ""), l[f] = l[f].replace(/</g, "&lt;").replace(/>/g, "&gt;"), l[f] = l[f].replace(/&lt;(\/?(font|b|u|i|s))((\s+(\w|\w[\w\-]*\w)(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)(\/?)&gt;/gi, "<$1$3$7>"), t.ignoreLineBreaks ? l[f] = l[f].replace(/\\N/gi, "") : l[f] = l[f].replace(/\\N/gi, "<br />"), r.push(l);
102
102
  }
103
103
  return r;
104
104
  }
@@ -110,38 +110,38 @@ function At(e, t) {
110
110
  let u = !1;
111
111
  const i = e.split(`
112
112
  `);
113
- i.forEach((f, l) => {
114
- f.replace(r, "") === " " || f.replace(r, "") === "" || (f.indexOf("-->") !== -1 ? (u = !0, typeof c.start == "number" && c.start >= 0 && s.push(se(c)), c = {
115
- start: ae(f.split("-->")[0].trimRight().split(" ").pop()),
116
- end: ae(f.split("-->")[1].trimLeft().split(" ").shift()),
113
+ i.forEach((o, f) => {
114
+ o.replace(r, "") === " " || o.replace(r, "") === "" || (o.indexOf("-->") !== -1 ? (u = !0, typeof c.start == "number" && c.start >= 0 && s.push(se(c)), c = {
115
+ start: ae(o.split("-->")[0].trimRight().split(" ").pop()),
116
+ end: ae(o.split("-->")[1].trimLeft().split(" ").shift()),
117
117
  part: ""
118
- }) : u && (s.length !== 0 ? (s[s.length - 1].part.replace(r, ""), f.replace(r, ""), c.part.length === 0 ? c.part = f : c.part = `${c.part}
119
- ${f}`, l === i.length - 1 && s.push(se(c))) : (c.part = f, s.push(se(c)), c.part = "")));
118
+ }) : u && (s.length !== 0 ? (s[s.length - 1].part.replace(r, ""), o.replace(r, ""), c.part.length === 0 ? c.part = o : c.part = `${c.part}
119
+ ${o}`, f === i.length - 1 && s.push(se(c))) : (c.part = o, s.push(se(c)), c.part = "")));
120
120
  }), c = [];
121
- const o = /(<([0-9:.>]+)>)/ig;
122
- s.forEach((f) => {
123
- const _ = f.part.split().map(function(g) {
124
- return g.replace(o, function(p) {
125
- return p.split("").reduce(function(S, N) {
126
- return `==${p.replace("<", "").replace(">", "")}`;
121
+ const l = /(<([0-9:.>]+)>)/ig;
122
+ s.forEach((o) => {
123
+ const _ = o.part.split().map(function(p) {
124
+ return p.replace(l, function(b) {
125
+ return b.split("").reduce(function(x, N) {
126
+ return `==${b.replace("<", "").replace(">", "")}`;
127
127
  }, 0);
128
128
  });
129
- })[0].replace(r, "").split(" "), b = [];
130
- _.forEach(function(g) {
131
- if (g.indexOf("==") > -1) {
132
- const p = g.split("=="), S = p[0];
133
- if (p[1], S == "" || S == "##")
129
+ })[0].replace(r, "").split(" "), y = [];
130
+ _.forEach(function(p) {
131
+ if (p.indexOf("==") > -1) {
132
+ const b = p.split("=="), x = b[0];
133
+ if (b[1], x == "" || x == "##")
134
134
  return;
135
- b.push({
136
- word: xe(g.split("==")[0]),
137
- time: ae(g.split("==")[1])
135
+ y.push({
136
+ word: je(p.split("==")[0]),
137
+ time: ae(p.split("==")[1])
138
138
  });
139
139
  } else
140
- b.push({
141
- word: xe(g),
140
+ y.push({
141
+ word: je(p),
142
142
  time: void 0
143
143
  });
144
- }), f.words = b, f.part = f.part.replace(r, "");
144
+ }), o.words = y, o.part = o.part.replace(r, "");
145
145
  }), n(s);
146
146
  });
147
147
  }
@@ -149,7 +149,7 @@ function ae(e) {
149
149
  const t = e.split(":"), r = t[t.length - 3] ? +t[t.length - 3] : 0, n = t[t.length - 2] ? +t[t.length - 2] : 0, a = +t[t.length - 1];
150
150
  return r * 3600 + n * 60 + a;
151
151
  }
152
- function xe(e) {
152
+ function je(e) {
153
153
  return e.replace(/[^0-9a-z'-]/gi, "").toLowerCase();
154
154
  }
155
155
  function se(e) {
@@ -163,14 +163,14 @@ function se(e) {
163
163
  function Pt(e) {
164
164
  return e.Transcription.Paragraphs.map((t) => {
165
165
  const r = t.Words.map((n) => ({
166
- st: y(n.Start / 1e3),
167
- et: y(n.End / 1e3),
166
+ st: g(n.Start / 1e3),
167
+ et: g(n.End / 1e3),
168
168
  text: n.Text,
169
169
  spk: t.SpeakerId
170
170
  }));
171
171
  return {
172
- st: y(t.Words[0].Start / 1e3),
173
- et: y(t.Words[t.Words.length - 1].End / 1e3),
172
+ st: g(t.Words[0].Start / 1e3),
173
+ et: g(t.Words[t.Words.length - 1].End / 1e3),
174
174
  text: r.map((n) => n.text).join(""),
175
175
  spk: t.SpeakerId,
176
176
  children: r
@@ -178,17 +178,72 @@ function Pt(e) {
178
178
  });
179
179
  }
180
180
  function Et(e) {
181
- const t = e.words.map((r) => ({
182
- st: y(r.start),
183
- et: y(r.end),
184
- text: r.word
185
- }));
186
- return [{
187
- st: y(e.words[0].start),
188
- et: y(e.words[e.words.length - 1].end),
189
- text: e.text,
190
- children: t
191
- }];
181
+ var t, r;
182
+ if (e.segments) {
183
+ const n = e.segments.map((a) => ({
184
+ st: g(a.start),
185
+ et: g(a.end),
186
+ text: a.text
187
+ }));
188
+ if (e.words.length > 0) {
189
+ const a = e.words;
190
+ let c = 0, s = 0;
191
+ for (; c < n.length; ) {
192
+ const u = n[c];
193
+ let i = u.text;
194
+ for (let l = s; l < a.length; l++) {
195
+ const o = a[l];
196
+ if (o && i.startsWith(o.word))
197
+ u.children = u.children || [], u.children.push({
198
+ st: g(o.start),
199
+ et: g(o.end),
200
+ text: o.word
201
+ }), i = i.substring(o.word.length);
202
+ else if (o && new RegExp(`^[\\s\\p{P}]*${o.word}`, "u").test(i)) {
203
+ u.children = u.children || [];
204
+ const f = i.match(new RegExp(`^[\\s\\p{P}]*${o.word}`, "u"))[0];
205
+ if (/^[,.?…,。?!!]/u.test(f)) {
206
+ const v = ((t = f.match(/^[,.?…,。?!!]+/u)) == null ? void 0 : t[0]) || "", T = f.substring(v.length);
207
+ if (u.children.length > 0) {
208
+ const _ = u.children[u.children.length - 1];
209
+ _.text += v;
210
+ }
211
+ u.children.push({
212
+ st: g(o.start),
213
+ et: g(o.end),
214
+ text: T
215
+ });
216
+ } else
217
+ u.children.push({
218
+ st: g(o.start),
219
+ et: g(o.end),
220
+ text: f
221
+ });
222
+ i = i.substring(f.length);
223
+ } else {
224
+ s = l;
225
+ break;
226
+ }
227
+ }
228
+ c++;
229
+ }
230
+ return n;
231
+ }
232
+ return n;
233
+ } else if (((r = e.words) == null ? void 0 : r.length) >= 0) {
234
+ const n = e.words.map((a) => ({
235
+ st: g(a.start),
236
+ et: g(a.end),
237
+ text: a.word
238
+ }));
239
+ return [{
240
+ st: g(e.words[0].start),
241
+ et: g(e.words[e.words.length - 1].end),
242
+ text: e.text,
243
+ children: n
244
+ }];
245
+ } else
246
+ return [];
192
247
  }
193
248
  const ie = {
194
249
  padding: [0.4, 0],
@@ -201,28 +256,28 @@ const ie = {
201
256
  // 宽松模式下,如果VAD第一段的秒数小于该值,则设置为从头开始
202
257
  };
203
258
  function Ct(e) {
204
- let t, r, n, a, c, s, u, i, o;
205
- const f = !!(e && e.vad && e.vad.length > 0), l = "[--end--]", v = "[--Single--]", T = "[--Full--]", _ = /\[(\d{2}:\d{2}:\d{2}\.\d{3}) --> (\d{2}:\d{2}:\d{2}\.\d{3})\]/;
206
- let b = !1, g = !1, p = "";
207
- return S(), { feed: B, reset: S, end: N };
208
- function S() {
209
- t = !0, r = "", n = !1, a = "", c = !1, s = void 0, u = 0, i = !1, o = 0;
259
+ let t, r, n, a, c, s, u, i, l;
260
+ const o = !!(e && e.vad && e.vad.length > 0), f = "[--end--]", v = "[--Single--]", T = "[--Full--]", _ = /\[(\d{2}:\d{2}:\d{2}\.\d{3}) --> (\d{2}:\d{2}:\d{2}\.\d{3})\]/;
261
+ let y = !1, p = !1, b = "";
262
+ return x(), { feed: B, reset: x, end: N };
263
+ function x() {
264
+ t = !0, r = "", n = !1, a = "", c = !1, s = void 0, u = 0, i = !1, l = 0;
210
265
  }
211
266
  function N() {
212
267
  if (i) {
213
268
  console.log("whisper parser is already end");
214
269
  return;
215
270
  }
216
- B(l);
271
+ B(f);
217
272
  }
218
- function J(x) {
219
- b || (p += x), !b && !g && Ve(p) && (g = !0), !b && p.length > 50 && (b = !0);
273
+ function J(j) {
274
+ y || (b += j), !y && !p && Ve(b) && (p = !0), !y && b.length > 50 && (y = !0);
220
275
  }
221
- function B(x) {
222
- var Te, _e, Se;
223
- J(x);
276
+ function B(j) {
277
+ var Te, _e, xe;
278
+ J(j);
224
279
  const O = [];
225
- r += x, t && ((Te = e == null ? void 0 : e.onStart) == null || Te.call(e, {
280
+ r += j, t && ((Te = e == null ? void 0 : e.onStart) == null || Te.call(e, {
226
281
  type: "event",
227
282
  event: "start",
228
283
  data: []
@@ -231,21 +286,21 @@ function Ct(e) {
231
286
  for (; u < Y; ) {
232
287
  const X = r[u];
233
288
  if (++u, c && s && X !== "[" && (s.text += X), X === "[" && (n && a.length && s && (s.text += a), a = "", n = !0, c = !1), n) {
234
- if (a += X, a === T && (a = ""), a === v && (a = "", f && o++), a === l) {
289
+ if (a += X, a === T && (a = ""), a === v && (a = "", o && l++), a === f) {
235
290
  s && O.push(s), i = !0;
236
291
  break;
237
292
  }
238
293
  if (_.test(a)) {
239
294
  const I = _.exec(a), D = I == null ? void 0 : I[1], ne = I == null ? void 0 : I[2];
240
295
  if (s && O.push(s), D && ne) {
241
- if (f && (e != null && e.vad) && e.vad.length > 0) {
296
+ if (o && (e != null && e.vad) && e.vad.length > 0) {
242
297
  let Z = 0;
243
- Z = e.vad[o].start - ie.padding[0] < 0 ? 0 : e.vad[o].start - ie.padding[0];
298
+ Z = e.vad[l].start - ie.padding[0] < 0 ? 0 : e.vad[l].start - ie.padding[0];
244
299
  const _t = D === "00:00:00.000";
245
- let je = y(A(D) + Z);
246
- o > 0 && _t && (je = y(A(D) + Z + ie.padding[0])), s = {
247
- st: je,
248
- et: y(A(ne) + Z),
300
+ let Se = g(A(D) + Z);
301
+ l > 0 && _t && (Se = g(A(D) + Z + ie.padding[0])), s = {
302
+ st: Se,
303
+ et: g(A(ne) + Z),
249
304
  text: "",
250
305
  children: []
251
306
  };
@@ -265,11 +320,11 @@ function Ct(e) {
265
320
  type: "event",
266
321
  event: "message",
267
322
  data: O
268
- })), i && ((Se = e == null ? void 0 : e.onEnd) == null || Se.call(e, {
323
+ })), i && ((xe = e == null ? void 0 : e.onEnd) == null || xe.call(e, {
269
324
  type: "event",
270
325
  event: "end",
271
326
  data: r
272
- }), S());
327
+ }), x());
273
328
  }
274
329
  }
275
330
  const qe = [239, 187, 191];
@@ -278,56 +333,56 @@ function Ft(e) {
278
333
  }
279
334
  function It(e) {
280
335
  let t, r, n, a, c, s, u, i;
281
- const o = /\[(\d+)\]/, f = "[--end--]";
282
- return l(), { feed: T, reset: l, end: v };
283
- function l() {
336
+ const l = /\[(\d+)\]/, o = "[--end--]";
337
+ return f(), { feed: T, reset: f, end: v };
338
+ function f() {
284
339
  t = !0, r = "", n = 0, i = !1, s = "", a = void 0, c = !1, u = !1;
285
340
  }
286
341
  function v() {
287
- T(f);
342
+ T(o);
288
343
  }
289
344
  function T(_) {
290
- var p, S, N, J, B;
291
- const b = [];
292
- r += _, t && ((p = e == null ? void 0 : e.onStart) == null || p.call(e, {
345
+ var b, x, N, J, B;
346
+ const y = [];
347
+ r += _, t && ((b = e == null ? void 0 : e.onStart) == null || b.call(e, {
293
348
  type: "event",
294
349
  event: "start",
295
350
  data: []
296
351
  })), t && Lt(r) && (r = r.slice(Je.length)), t = !1;
297
- const g = r.length;
298
- for (; n < g; ) {
299
- const x = r[n];
300
- if (++n, u && a && x !== "[" && (a.text += x, (S = e == null ? void 0 : e.onProgress) == null || S.call(e, {
352
+ const p = r.length;
353
+ for (; n < p; ) {
354
+ const j = r[n];
355
+ if (++n, u && a && j !== "[" && (a.text += j, (x = e == null ? void 0 : e.onProgress) == null || x.call(e, {
301
356
  type: "event",
302
357
  event: "message",
303
358
  data: [a]
304
- })), x === "[" && (c && s.length && a && (a.text += s, (N = e == null ? void 0 : e.onProgress) == null || N.call(e, {
359
+ })), j === "[" && (c && s.length && a && (a.text += s, (N = e == null ? void 0 : e.onProgress) == null || N.call(e, {
305
360
  type: "event",
306
361
  event: "message",
307
362
  data: [a]
308
363
  })), s = "", c = !0, u = !1), c) {
309
- if (s += x, s === f) {
310
- a && b.push(a), i = !0;
364
+ if (s += j, s === o) {
365
+ a && y.push(a), i = !0;
311
366
  break;
312
367
  }
313
- if (o.test(s)) {
314
- const O = o.exec(s), Y = O == null ? void 0 : O[1];
315
- a && b.push(a), Y && (a = {
368
+ if (l.test(s)) {
369
+ const O = l.exec(s), Y = O == null ? void 0 : O[1];
370
+ a && y.push(a), Y && (a = {
316
371
  index: Number(Y),
317
372
  text: ""
318
373
  }, u = !0, c = !1, s = "");
319
374
  }
320
375
  }
321
376
  }
322
- b.length && ((J = e == null ? void 0 : e.onParse) == null || J.call(e, {
377
+ y.length && ((J = e == null ? void 0 : e.onParse) == null || J.call(e, {
323
378
  type: "event",
324
379
  event: "message",
325
- data: b
380
+ data: y
326
381
  })), i && ((B = e == null ? void 0 : e.onEnd) == null || B.call(e, {
327
382
  type: "event",
328
383
  event: "end",
329
384
  data: r
330
- }), l());
385
+ }), f());
331
386
  }
332
387
  }
333
388
  const Je = [239, 187, 191];
@@ -339,22 +394,22 @@ async function Mt(e) {
339
394
  keepMultiLine: !0,
340
395
  propName: {}
341
396
  }).filter((n) => n.text).map((n) => ({
342
- st: y(n.start),
343
- et: y(n.end),
397
+ st: g(n.start),
398
+ et: g(n.end),
344
399
  text: n.text
345
400
  }));
346
401
  }
347
402
  async function Ye(e) {
348
403
  return (await At(e)).filter((n) => n.part).map((n) => ({
349
- st: y(n.start),
350
- et: y(n.end),
404
+ st: g(n.start),
405
+ et: g(n.end),
351
406
  text: n.part
352
407
  }));
353
408
  }
354
- async function zt(e) {
355
- return Ye(xt(e));
356
- }
357
409
  async function kt(e) {
410
+ return Ye(jt(e));
411
+ }
412
+ async function zt(e) {
358
413
  return Pt(e);
359
414
  }
360
415
  async function Nt(e) {
@@ -362,12 +417,12 @@ async function Nt(e) {
362
417
  }
363
418
  const Ts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
364
419
  __proto__: null,
365
- assToAimSegments: zt,
420
+ assToAimSegments: kt,
366
421
  createTranslateStreamParser: It,
367
422
  createWhisperStreamParser: Ct,
368
423
  openaiToAimSegments: Nt,
369
424
  srtToAimSegments: Mt,
370
- tingwuToAimSegments: kt,
425
+ tingwuToAimSegments: zt,
371
426
  vttToAimSegments: Ye
372
427
  }, Symbol.toStringTag, { value: "Module" }));
373
428
  class Bt {
@@ -452,24 +507,24 @@ const _s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
452
507
  __proto__: null,
453
508
  StreamFilter: Bt
454
509
  }, Symbol.toStringTag, { value: "Module" }));
455
- var Xe = typeof global == "object" && global && global.Object === Object && global, Dt = typeof self == "object" && self && self.Object === Object && self, j = Xe || Dt || Function("return this")(), L = j.Symbol, Ze = Object.prototype, Gt = Ze.hasOwnProperty, Ut = Ze.toString, G = L ? L.toStringTag : void 0;
456
- function Rt(e) {
457
- var t = Gt.call(e, G), r = e[G];
510
+ var Xe = typeof global == "object" && global && global.Object === Object && global, Dt = typeof self == "object" && self && self.Object === Object && self, S = Xe || Dt || Function("return this")(), L = S.Symbol, Ze = Object.prototype, Rt = Ze.hasOwnProperty, Gt = Ze.toString, R = L ? L.toStringTag : void 0;
511
+ function Ut(e) {
512
+ var t = Rt.call(e, R), r = e[R];
458
513
  try {
459
- e[G] = void 0;
514
+ e[R] = void 0;
460
515
  var n = !0;
461
516
  } catch {
462
517
  }
463
- var a = Ut.call(e);
464
- return n && (t ? e[G] = r : delete e[G]), a;
518
+ var a = Gt.call(e);
519
+ return n && (t ? e[R] = r : delete e[R]), a;
465
520
  }
466
- var Ht = Object.prototype, Kt = Ht.toString;
467
- function Wt(e) {
468
- return Kt.call(e);
521
+ var Ht = Object.prototype, Wt = Ht.toString;
522
+ function Kt(e) {
523
+ return Wt.call(e);
469
524
  }
470
525
  var Vt = "[object Null]", qt = "[object Undefined]", $e = L ? L.toStringTag : void 0;
471
- function W(e) {
472
- return e == null ? e === void 0 ? qt : Vt : $e && $e in Object(e) ? Rt(e) : Wt(e);
526
+ function K(e) {
527
+ return e == null ? e === void 0 ? qt : Vt : $e && $e in Object(e) ? Ut(e) : Kt(e);
473
528
  }
474
529
  function V(e) {
475
530
  return e != null && typeof e == "object";
@@ -483,10 +538,10 @@ var Jt = "[object AsyncFunction]", Yt = "[object Function]", Xt = "[object Gener
483
538
  function Qe(e) {
484
539
  if (!q(e))
485
540
  return !1;
486
- var t = W(e);
541
+ var t = K(e);
487
542
  return t == Yt || t == Xt || t == Jt || t == Zt;
488
543
  }
489
- var ce = j["__core-js_shared__"], we = function() {
544
+ var ce = S["__core-js_shared__"], we = function() {
490
545
  var e = /[^.]+$/.exec(ce && ce.keys && ce.keys.IE_PROTO || "");
491
546
  return e ? "Symbol(src)_1." + e : "";
492
547
  }();
@@ -516,14 +571,14 @@ function ur(e) {
516
571
  var t = Qe(e) ? or : nr;
517
572
  return t.test(C(e));
518
573
  }
519
- function fr(e, t) {
574
+ function lr(e, t) {
520
575
  return e == null ? void 0 : e[t];
521
576
  }
522
577
  function F(e, t) {
523
- var r = fr(e, t);
578
+ var r = lr(e, t);
524
579
  return ur(r) ? r : void 0;
525
580
  }
526
- var ue = F(j, "WeakMap"), Oe = Object.create, lr = /* @__PURE__ */ function() {
581
+ var ue = F(S, "WeakMap"), Oe = Object.create, fr = /* @__PURE__ */ function() {
527
582
  function e() {
528
583
  }
529
584
  return function(t) {
@@ -601,52 +656,52 @@ function _r(e, t) {
601
656
  n[r] = t(r);
602
657
  return n;
603
658
  }
604
- var Sr = "[object Arguments]";
659
+ var xr = "[object Arguments]";
605
660
  function Pe(e) {
606
- return V(e) && W(e) == Sr;
661
+ return V(e) && K(e) == xr;
607
662
  }
608
- var st = Object.prototype, jr = st.hasOwnProperty, xr = st.propertyIsEnumerable, $r = Pe(/* @__PURE__ */ function() {
663
+ var st = Object.prototype, Sr = st.hasOwnProperty, jr = st.propertyIsEnumerable, $r = Pe(/* @__PURE__ */ function() {
609
664
  return arguments;
610
665
  }()) ? Pe : function(e) {
611
- return V(e) && jr.call(e, "callee") && !xr.call(e, "callee");
666
+ return V(e) && Sr.call(e, "callee") && !jr.call(e, "callee");
612
667
  };
613
668
  function wr() {
614
669
  return !1;
615
670
  }
616
- var it = typeof exports == "object" && exports && !exports.nodeType && exports, Ee = it && typeof module == "object" && module && !module.nodeType && module, Or = Ee && Ee.exports === it, Ce = Or ? j.Buffer : void 0, Ar = Ce ? Ce.isBuffer : void 0, ct = Ar || wr, Pr = "[object Arguments]", Er = "[object Array]", Cr = "[object Boolean]", Fr = "[object Date]", Ir = "[object Error]", Lr = "[object Function]", Mr = "[object Map]", zr = "[object Number]", kr = "[object Object]", Nr = "[object RegExp]", Br = "[object Set]", Dr = "[object String]", Gr = "[object WeakMap]", Ur = "[object ArrayBuffer]", Rr = "[object DataView]", Hr = "[object Float32Array]", Kr = "[object Float64Array]", Wr = "[object Int8Array]", Vr = "[object Int16Array]", qr = "[object Int32Array]", Jr = "[object Uint8Array]", Yr = "[object Uint8ClampedArray]", Xr = "[object Uint16Array]", Zr = "[object Uint32Array]", d = {};
617
- d[Hr] = d[Kr] = d[Wr] = d[Vr] = d[qr] = d[Jr] = d[Yr] = d[Xr] = d[Zr] = !0;
618
- d[Pr] = d[Er] = d[Ur] = d[Cr] = d[Rr] = d[Fr] = d[Ir] = d[Lr] = d[Mr] = d[zr] = d[kr] = d[Nr] = d[Br] = d[Dr] = d[Gr] = !1;
671
+ var it = typeof exports == "object" && exports && !exports.nodeType && exports, Ee = it && typeof module == "object" && module && !module.nodeType && module, Or = Ee && Ee.exports === it, Ce = Or ? S.Buffer : void 0, Ar = Ce ? Ce.isBuffer : void 0, ct = Ar || wr, Pr = "[object Arguments]", Er = "[object Array]", Cr = "[object Boolean]", Fr = "[object Date]", Ir = "[object Error]", Lr = "[object Function]", Mr = "[object Map]", kr = "[object Number]", zr = "[object Object]", Nr = "[object RegExp]", Br = "[object Set]", Dr = "[object String]", Rr = "[object WeakMap]", Gr = "[object ArrayBuffer]", Ur = "[object DataView]", Hr = "[object Float32Array]", Wr = "[object Float64Array]", Kr = "[object Int8Array]", Vr = "[object Int16Array]", qr = "[object Int32Array]", Jr = "[object Uint8Array]", Yr = "[object Uint8ClampedArray]", Xr = "[object Uint16Array]", Zr = "[object Uint32Array]", d = {};
672
+ d[Hr] = d[Wr] = d[Kr] = d[Vr] = d[qr] = d[Jr] = d[Yr] = d[Xr] = d[Zr] = !0;
673
+ d[Pr] = d[Er] = d[Gr] = d[Cr] = d[Ur] = d[Fr] = d[Ir] = d[Lr] = d[Mr] = d[kr] = d[zr] = d[Nr] = d[Br] = d[Dr] = d[Rr] = !1;
619
674
  function Qr(e) {
620
- return V(e) && nt(e.length) && !!d[W(e)];
675
+ return V(e) && nt(e.length) && !!d[K(e)];
621
676
  }
622
677
  function pe(e) {
623
678
  return function(t) {
624
679
  return e(t);
625
680
  };
626
681
  }
627
- var ot = typeof exports == "object" && exports && !exports.nodeType && exports, R = ot && typeof module == "object" && module && !module.nodeType && module, en = R && R.exports === ot, oe = en && Xe.process, M = function() {
682
+ var ot = typeof exports == "object" && exports && !exports.nodeType && exports, U = ot && typeof module == "object" && module && !module.nodeType && module, en = U && U.exports === ot, oe = en && Xe.process, M = function() {
628
683
  try {
629
- var e = R && R.require && R.require("util").types;
684
+ var e = U && U.require && U.require("util").types;
630
685
  return e || oe && oe.binding && oe.binding("util");
631
686
  } catch {
632
687
  }
633
688
  }(), Fe = M && M.isTypedArray, tn = Fe ? pe(Fe) : Qr, rn = Object.prototype, nn = rn.hasOwnProperty;
634
689
  function ut(e, t) {
635
690
  var r = de(e), n = !r && $r(e), a = !r && !n && ct(e), c = !r && !n && !a && tn(e), s = r || n || a || c, u = s ? _r(e.length, String) : [], i = u.length;
636
- for (var o in e)
637
- (t || nn.call(e, o)) && !(s && // Safari 9 has enumerable `arguments.length` in strict mode.
638
- (o == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
639
- a && (o == "offset" || o == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
640
- c && (o == "buffer" || o == "byteLength" || o == "byteOffset") || // Skip index properties.
641
- br(o, i))) && u.push(o);
691
+ for (var l in e)
692
+ (t || nn.call(e, l)) && !(s && // Safari 9 has enumerable `arguments.length` in strict mode.
693
+ (l == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
694
+ a && (l == "offset" || l == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
695
+ c && (l == "buffer" || l == "byteLength" || l == "byteOffset") || // Skip index properties.
696
+ br(l, i))) && u.push(l);
642
697
  return u;
643
698
  }
644
- function ft(e, t) {
699
+ function lt(e, t) {
645
700
  return function(r) {
646
701
  return e(t(r));
647
702
  };
648
703
  }
649
- var an = ft(Object.keys, Object), sn = Object.prototype, cn = sn.hasOwnProperty;
704
+ var an = lt(Object.keys, Object), sn = Object.prototype, cn = sn.hasOwnProperty;
650
705
  function on(e) {
651
706
  if (!ge(e))
652
707
  return an(e);
@@ -665,13 +720,13 @@ function un(e) {
665
720
  t.push(r);
666
721
  return t;
667
722
  }
668
- var fn = Object.prototype, ln = fn.hasOwnProperty;
723
+ var ln = Object.prototype, fn = ln.hasOwnProperty;
669
724
  function hn(e) {
670
725
  if (!q(e))
671
726
  return un(e);
672
727
  var t = ge(e), r = [];
673
728
  for (var n in e)
674
- n == "constructor" && (t || !ln.call(e, n)) || r.push(n);
729
+ n == "constructor" && (t || !fn.call(e, n)) || r.push(n);
675
730
  return r;
676
731
  }
677
732
  function ye(e) {
@@ -699,10 +754,10 @@ function _n(e) {
699
754
  var t = this.__data__;
700
755
  return H ? t[e] !== void 0 : Tn.call(t, e);
701
756
  }
702
- var Sn = "__lodash_hash_undefined__";
703
- function jn(e, t) {
757
+ var xn = "__lodash_hash_undefined__";
758
+ function Sn(e, t) {
704
759
  var r = this.__data__;
705
- return this.size += this.has(e) ? 0 : 1, r[e] = H && t === void 0 ? Sn : t, this;
760
+ return this.size += this.has(e) ? 0 : 1, r[e] = H && t === void 0 ? xn : t, this;
706
761
  }
707
762
  function E(e) {
708
763
  var t = -1, r = e == null ? 0 : e.length;
@@ -715,8 +770,8 @@ E.prototype.clear = dn;
715
770
  E.prototype.delete = gn;
716
771
  E.prototype.get = mn;
717
772
  E.prototype.has = _n;
718
- E.prototype.set = jn;
719
- function xn() {
773
+ E.prototype.set = Sn;
774
+ function jn() {
720
775
  this.__data__ = [], this.size = 0;
721
776
  }
722
777
  function te(e, t) {
@@ -751,16 +806,16 @@ function w(e) {
751
806
  this.set(n[0], n[1]);
752
807
  }
753
808
  }
754
- w.prototype.clear = xn;
809
+ w.prototype.clear = jn;
755
810
  w.prototype.delete = On;
756
811
  w.prototype.get = An;
757
812
  w.prototype.has = Pn;
758
813
  w.prototype.set = En;
759
- var K = F(j, "Map");
814
+ var W = F(S, "Map");
760
815
  function Cn() {
761
816
  this.size = 0, this.__data__ = {
762
817
  hash: new E(),
763
- map: new (K || w)(),
818
+ map: new (W || w)(),
764
819
  string: new E()
765
820
  };
766
821
  }
@@ -782,29 +837,29 @@ function Ln(e) {
782
837
  function Mn(e) {
783
838
  return re(this, e).has(e);
784
839
  }
785
- function zn(e, t) {
840
+ function kn(e, t) {
786
841
  var r = re(this, e), n = r.size;
787
842
  return r.set(e, t), this.size += r.size == n ? 0 : 1, this;
788
843
  }
789
- function z(e) {
844
+ function k(e) {
790
845
  var t = -1, r = e == null ? 0 : e.length;
791
846
  for (this.clear(); ++t < r; ) {
792
847
  var n = e[t];
793
848
  this.set(n[0], n[1]);
794
849
  }
795
850
  }
796
- z.prototype.clear = Cn;
797
- z.prototype.delete = In;
798
- z.prototype.get = Ln;
799
- z.prototype.has = Mn;
800
- z.prototype.set = zn;
801
- function lt(e, t) {
851
+ k.prototype.clear = Cn;
852
+ k.prototype.delete = In;
853
+ k.prototype.get = Ln;
854
+ k.prototype.has = Mn;
855
+ k.prototype.set = kn;
856
+ function ft(e, t) {
802
857
  for (var r = -1, n = t.length, a = e.length; ++r < n; )
803
858
  e[a + r] = t[r];
804
859
  return e;
805
860
  }
806
- var ht = ft(Object.getPrototypeOf, Object);
807
- function kn() {
861
+ var ht = lt(Object.getPrototypeOf, Object);
862
+ function zn() {
808
863
  this.__data__ = new w(), this.size = 0;
809
864
  }
810
865
  function Nn(e) {
@@ -817,34 +872,34 @@ function Bn(e) {
817
872
  function Dn(e) {
818
873
  return this.__data__.has(e);
819
874
  }
820
- var Gn = 200;
821
- function Un(e, t) {
875
+ var Rn = 200;
876
+ function Gn(e, t) {
822
877
  var r = this.__data__;
823
878
  if (r instanceof w) {
824
879
  var n = r.__data__;
825
- if (!K || n.length < Gn - 1)
880
+ if (!W || n.length < Rn - 1)
826
881
  return n.push([e, t]), this.size = ++r.size, this;
827
- r = this.__data__ = new z(n);
882
+ r = this.__data__ = new k(n);
828
883
  }
829
884
  return r.set(e, t), this.size = r.size, this;
830
885
  }
831
- function k(e) {
886
+ function z(e) {
832
887
  var t = this.__data__ = new w(e);
833
888
  this.size = t.size;
834
889
  }
835
- k.prototype.clear = kn;
836
- k.prototype.delete = Nn;
837
- k.prototype.get = Bn;
838
- k.prototype.has = Dn;
839
- k.prototype.set = Un;
840
- function Rn(e, t) {
890
+ z.prototype.clear = zn;
891
+ z.prototype.delete = Nn;
892
+ z.prototype.get = Bn;
893
+ z.prototype.has = Dn;
894
+ z.prototype.set = Gn;
895
+ function Un(e, t) {
841
896
  return e && ee(t, be(t), e);
842
897
  }
843
898
  function Hn(e, t) {
844
899
  return e && ee(t, ye(t), e);
845
900
  }
846
- var dt = typeof exports == "object" && exports && !exports.nodeType && exports, Ie = dt && typeof module == "object" && module && !module.nodeType && module, Kn = Ie && Ie.exports === dt, Le = Kn ? j.Buffer : void 0, Me = Le ? Le.allocUnsafe : void 0;
847
- function Wn(e, t) {
901
+ var dt = typeof exports == "object" && exports && !exports.nodeType && exports, Ie = dt && typeof module == "object" && module && !module.nodeType && module, Wn = Ie && Ie.exports === dt, Le = Wn ? S.Buffer : void 0, Me = Le ? Le.allocUnsafe : void 0;
902
+ function Kn(e, t) {
848
903
  if (t)
849
904
  return e.slice();
850
905
  var r = e.length, n = Me ? Me(r) : new e.constructor(r);
@@ -860,8 +915,8 @@ function Vn(e, t) {
860
915
  function gt() {
861
916
  return [];
862
917
  }
863
- var qn = Object.prototype, Jn = qn.propertyIsEnumerable, ze = Object.getOwnPropertySymbols, me = ze ? function(e) {
864
- return e == null ? [] : (e = Object(e), Vn(ze(e), function(t) {
918
+ var qn = Object.prototype, Jn = qn.propertyIsEnumerable, ke = Object.getOwnPropertySymbols, me = ke ? function(e) {
919
+ return e == null ? [] : (e = Object(e), Vn(ke(e), function(t) {
865
920
  return Jn.call(e, t);
866
921
  }));
867
922
  } : gt;
@@ -870,7 +925,7 @@ function Yn(e, t) {
870
925
  }
871
926
  var Xn = Object.getOwnPropertySymbols, pt = Xn ? function(e) {
872
927
  for (var t = []; e; )
873
- lt(t, me(e)), e = ht(e);
928
+ ft(t, me(e)), e = ht(e);
874
929
  return t;
875
930
  } : gt;
876
931
  function Zn(e, t) {
@@ -878,7 +933,7 @@ function Zn(e, t) {
878
933
  }
879
934
  function bt(e, t, r) {
880
935
  var n = t(e);
881
- return de(e) ? n : lt(n, r(e));
936
+ return de(e) ? n : ft(n, r(e));
882
937
  }
883
938
  function Qn(e) {
884
939
  return bt(e, be, me);
@@ -886,15 +941,15 @@ function Qn(e) {
886
941
  function ea(e) {
887
942
  return bt(e, ye, pt);
888
943
  }
889
- var fe = F(j, "DataView"), le = F(j, "Promise"), he = F(j, "Set"), ke = "[object Map]", ta = "[object Object]", Ne = "[object Promise]", Be = "[object Set]", De = "[object WeakMap]", Ge = "[object DataView]", ra = C(fe), na = C(K), aa = C(le), sa = C(he), ia = C(ue), $ = W;
890
- (fe && $(new fe(new ArrayBuffer(1))) != Ge || K && $(new K()) != ke || le && $(le.resolve()) != Ne || he && $(new he()) != Be || ue && $(new ue()) != De) && ($ = function(e) {
891
- var t = W(e), r = t == ta ? e.constructor : void 0, n = r ? C(r) : "";
944
+ var le = F(S, "DataView"), fe = F(S, "Promise"), he = F(S, "Set"), ze = "[object Map]", ta = "[object Object]", Ne = "[object Promise]", Be = "[object Set]", De = "[object WeakMap]", Re = "[object DataView]", ra = C(le), na = C(W), aa = C(fe), sa = C(he), ia = C(ue), $ = K;
945
+ (le && $(new le(new ArrayBuffer(1))) != Re || W && $(new W()) != ze || fe && $(fe.resolve()) != Ne || he && $(new he()) != Be || ue && $(new ue()) != De) && ($ = function(e) {
946
+ var t = K(e), r = t == ta ? e.constructor : void 0, n = r ? C(r) : "";
892
947
  if (n)
893
948
  switch (n) {
894
949
  case ra:
895
- return Ge;
950
+ return Re;
896
951
  case na:
897
- return ke;
952
+ return ze;
898
953
  case aa:
899
954
  return Ne;
900
955
  case sa:
@@ -909,21 +964,21 @@ function ua(e) {
909
964
  var t = e.length, r = new e.constructor(t);
910
965
  return t && typeof e[0] == "string" && oa.call(e, "index") && (r.index = e.index, r.input = e.input), r;
911
966
  }
912
- var Ue = j.Uint8Array;
967
+ var Ge = S.Uint8Array;
913
968
  function ve(e) {
914
969
  var t = new e.constructor(e.byteLength);
915
- return new Ue(t).set(new Ue(e)), t;
970
+ return new Ge(t).set(new Ge(e)), t;
916
971
  }
917
- function fa(e, t) {
972
+ function la(e, t) {
918
973
  var r = t ? ve(e.buffer) : e.buffer;
919
974
  return new e.constructor(r, e.byteOffset, e.byteLength);
920
975
  }
921
- var la = /\w*$/;
976
+ var fa = /\w*$/;
922
977
  function ha(e) {
923
- var t = new e.constructor(e.source, la.exec(e));
978
+ var t = new e.constructor(e.source, fa.exec(e));
924
979
  return t.lastIndex = e.lastIndex, t;
925
980
  }
926
- var Re = L ? L.prototype : void 0, He = Re ? Re.valueOf : void 0;
981
+ var Ue = L ? L.prototype : void 0, He = Ue ? Ue.valueOf : void 0;
927
982
  function da(e) {
928
983
  return He ? Object(He.call(e)) : {};
929
984
  }
@@ -931,17 +986,17 @@ function ga(e, t) {
931
986
  var r = t ? ve(e.buffer) : e.buffer;
932
987
  return new e.constructor(r, e.byteOffset, e.length);
933
988
  }
934
- var pa = "[object Boolean]", ba = "[object Date]", ya = "[object Map]", ma = "[object Number]", va = "[object RegExp]", Ta = "[object Set]", _a = "[object String]", Sa = "[object Symbol]", ja = "[object ArrayBuffer]", xa = "[object DataView]", $a = "[object Float32Array]", wa = "[object Float64Array]", Oa = "[object Int8Array]", Aa = "[object Int16Array]", Pa = "[object Int32Array]", Ea = "[object Uint8Array]", Ca = "[object Uint8ClampedArray]", Fa = "[object Uint16Array]", Ia = "[object Uint32Array]";
989
+ var pa = "[object Boolean]", ba = "[object Date]", ya = "[object Map]", ma = "[object Number]", va = "[object RegExp]", Ta = "[object Set]", _a = "[object String]", xa = "[object Symbol]", Sa = "[object ArrayBuffer]", ja = "[object DataView]", $a = "[object Float32Array]", wa = "[object Float64Array]", Oa = "[object Int8Array]", Aa = "[object Int16Array]", Pa = "[object Int32Array]", Ea = "[object Uint8Array]", Ca = "[object Uint8ClampedArray]", Fa = "[object Uint16Array]", Ia = "[object Uint32Array]";
935
990
  function La(e, t, r) {
936
991
  var n = e.constructor;
937
992
  switch (t) {
938
- case ja:
993
+ case Sa:
939
994
  return ve(e);
940
995
  case pa:
941
996
  case ba:
942
997
  return new n(+e);
943
- case xa:
944
- return fa(e, r);
998
+ case ja:
999
+ return la(e, r);
945
1000
  case $a:
946
1001
  case wa:
947
1002
  case Oa:
@@ -961,59 +1016,59 @@ function La(e, t, r) {
961
1016
  return ha(e);
962
1017
  case Ta:
963
1018
  return new n();
964
- case Sa:
1019
+ case xa:
965
1020
  return da(e);
966
1021
  }
967
1022
  }
968
1023
  function Ma(e) {
969
- return typeof e.constructor == "function" && !ge(e) ? lr(ht(e)) : {};
1024
+ return typeof e.constructor == "function" && !ge(e) ? fr(ht(e)) : {};
970
1025
  }
971
- var za = "[object Map]";
972
- function ka(e) {
973
- return V(e) && $(e) == za;
1026
+ var ka = "[object Map]";
1027
+ function za(e) {
1028
+ return V(e) && $(e) == ka;
974
1029
  }
975
- var Ke = M && M.isMap, Na = Ke ? pe(Ke) : ka, Ba = "[object Set]";
1030
+ var We = M && M.isMap, Na = We ? pe(We) : za, Ba = "[object Set]";
976
1031
  function Da(e) {
977
1032
  return V(e) && $(e) == Ba;
978
1033
  }
979
- var We = M && M.isSet, Ga = We ? pe(We) : Da, Ua = 1, Ra = 2, Ha = 4, yt = "[object Arguments]", Ka = "[object Array]", Wa = "[object Boolean]", Va = "[object Date]", qa = "[object Error]", mt = "[object Function]", Ja = "[object GeneratorFunction]", Ya = "[object Map]", Xa = "[object Number]", vt = "[object Object]", Za = "[object RegExp]", Qa = "[object Set]", es = "[object String]", ts = "[object Symbol]", rs = "[object WeakMap]", ns = "[object ArrayBuffer]", as = "[object DataView]", ss = "[object Float32Array]", is = "[object Float64Array]", cs = "[object Int8Array]", os = "[object Int16Array]", us = "[object Int32Array]", fs = "[object Uint8Array]", ls = "[object Uint8ClampedArray]", hs = "[object Uint16Array]", ds = "[object Uint32Array]", h = {};
980
- h[yt] = h[Ka] = h[ns] = h[as] = h[Wa] = h[Va] = h[ss] = h[is] = h[cs] = h[os] = h[us] = h[Ya] = h[Xa] = h[vt] = h[Za] = h[Qa] = h[es] = h[ts] = h[fs] = h[ls] = h[hs] = h[ds] = !0;
1034
+ var Ke = M && M.isSet, Ra = Ke ? pe(Ke) : Da, Ga = 1, Ua = 2, Ha = 4, yt = "[object Arguments]", Wa = "[object Array]", Ka = "[object Boolean]", Va = "[object Date]", qa = "[object Error]", mt = "[object Function]", Ja = "[object GeneratorFunction]", Ya = "[object Map]", Xa = "[object Number]", vt = "[object Object]", Za = "[object RegExp]", Qa = "[object Set]", es = "[object String]", ts = "[object Symbol]", rs = "[object WeakMap]", ns = "[object ArrayBuffer]", as = "[object DataView]", ss = "[object Float32Array]", is = "[object Float64Array]", cs = "[object Int8Array]", os = "[object Int16Array]", us = "[object Int32Array]", ls = "[object Uint8Array]", fs = "[object Uint8ClampedArray]", hs = "[object Uint16Array]", ds = "[object Uint32Array]", h = {};
1035
+ h[yt] = h[Wa] = h[ns] = h[as] = h[Ka] = h[Va] = h[ss] = h[is] = h[cs] = h[os] = h[us] = h[Ya] = h[Xa] = h[vt] = h[Za] = h[Qa] = h[es] = h[ts] = h[ls] = h[fs] = h[hs] = h[ds] = !0;
981
1036
  h[qa] = h[mt] = h[rs] = !1;
982
1037
  function Q(e, t, r, n, a, c) {
983
- var s, u = t & Ua, i = t & Ra, o = t & Ha;
1038
+ var s, u = t & Ga, i = t & Ua, l = t & Ha;
984
1039
  if (s !== void 0)
985
1040
  return s;
986
1041
  if (!q(e))
987
1042
  return e;
988
- var f = de(e);
989
- if (f) {
1043
+ var o = de(e);
1044
+ if (o) {
990
1045
  if (s = ua(e), !u)
991
1046
  return hr(e, s);
992
1047
  } else {
993
- var l = $(e), v = l == mt || l == Ja;
1048
+ var f = $(e), v = f == mt || f == Ja;
994
1049
  if (ct(e))
995
- return Wn(e, u);
996
- if (l == vt || l == yt || v && !a) {
1050
+ return Kn(e, u);
1051
+ if (f == vt || f == yt || v && !a) {
997
1052
  if (s = i || v ? {} : Ma(e), !u)
998
- return i ? Zn(e, Hn(s, e)) : Yn(e, Rn(s, e));
1053
+ return i ? Zn(e, Hn(s, e)) : Yn(e, Un(s, e));
999
1054
  } else {
1000
- if (!h[l])
1055
+ if (!h[f])
1001
1056
  return a ? e : {};
1002
- s = La(e, l, u);
1057
+ s = La(e, f, u);
1003
1058
  }
1004
1059
  }
1005
- c || (c = new k());
1060
+ c || (c = new z());
1006
1061
  var T = c.get(e);
1007
1062
  if (T)
1008
1063
  return T;
1009
- c.set(e, s), Ga(e) ? e.forEach(function(g) {
1010
- s.add(Q(g, t, r, g, e, c));
1011
- }) : Na(e) && e.forEach(function(g, p) {
1012
- s.set(p, Q(g, t, r, p, e, c));
1064
+ c.set(e, s), Ra(e) ? e.forEach(function(p) {
1065
+ s.add(Q(p, t, r, p, e, c));
1066
+ }) : Na(e) && e.forEach(function(p, b) {
1067
+ s.set(b, Q(p, t, r, b, e, c));
1013
1068
  });
1014
- var _ = o ? i ? ea : Qn : i ? ye : be, b = f ? void 0 : _(e);
1015
- return dr(b || e, function(g, p) {
1016
- b && (p = g, g = e[p]), rt(s, p, Q(g, t, r, p, e, c));
1069
+ var _ = l ? i ? ea : Qn : i ? ye : be, y = o ? void 0 : _(e);
1070
+ return dr(y || e, function(p, b) {
1071
+ y && (b = p, p = e[b]), rt(s, b, Q(p, t, r, b, e, c));
1017
1072
  }), s;
1018
1073
  }
1019
1074
  var gs = 1, ps = 4;
@@ -1059,8 +1114,8 @@ function ys(e, t) {
1059
1114
  r = i;
1060
1115
  }
1061
1116
  }), a = (i) => i.trim().length === 0, c = (i) => {
1062
- const o = A(i.st), f = A(i.et);
1063
- return o >= f;
1117
+ const l = A(i.st), o = A(i.et);
1118
+ return l >= o;
1064
1119
  }, s = {
1065
1120
  emt: [],
1066
1121
  ep: [],
@@ -1069,16 +1124,16 @@ function ys(e, t) {
1069
1124
  em: [],
1070
1125
  space: []
1071
1126
  }, u = [];
1072
- return e.forEach((i, o) => {
1073
- const f = P.punc.test(i.text), l = P.em.test(i.text), v = P.space.test(i.text), T = a(i.text), _ = c(i), b = P.ep.test(i.text);
1074
- n.push(i), i.punc = f ? 1 : 0, f && s.punc.push(o), i.em = l ? 1 : 0, l && s.em.push(o), i.space = v ? 1 : 0, v && (t != null && t.space ? i.text = i.text.replace(P.space, " ").trim() : s.space.push(o)), i.emt = a(i.text) ? 1 : 0, T && (t != null && t.emt || s.emt.push(o)), i.zf = c(i) ? 1 : 0, _ && (t != null && t.zf || s.zf.push(o)), i.ep = b ? 1 : 0, b && (t != null && t.ep ? i.text = i.text.replace(P.ep, "") : s.ep.push(o)), !(t != null && t.zf && i.zf) && (t != null && t.emt && i.emt || u.push(i));
1127
+ return e.forEach((i, l) => {
1128
+ const o = P.punc.test(i.text), f = P.em.test(i.text), v = P.space.test(i.text), T = a(i.text), _ = c(i), y = P.ep.test(i.text);
1129
+ n.push(i), i.punc = o ? 1 : 0, o && s.punc.push(l), i.em = f ? 1 : 0, f && s.em.push(l), i.space = v ? 1 : 0, v && (t != null && t.space ? i.text = i.text.replace(P.space, " ").trim() : s.space.push(l)), i.emt = a(i.text) ? 1 : 0, T && (t != null && t.emt || s.emt.push(l)), i.zf = c(i) ? 1 : 0, _ && (t != null && t.zf || s.zf.push(l)), i.ep = y ? 1 : 0, y && (t != null && t.ep ? i.text = i.text.replace(P.ep, "") : s.ep.push(l)), !(t != null && t.zf && i.zf) && (t != null && t.emt && i.emt || u.push(i));
1075
1130
  }), n.end(), {
1076
1131
  result: s,
1077
1132
  repeat: r,
1078
1133
  segments: u
1079
1134
  };
1080
1135
  }
1081
- const Ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1136
+ const xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1082
1137
  __proto__: null,
1083
1138
  RepeatCheck: Tt,
1084
1139
  subtitleOptimization: ys,
@@ -1087,6 +1142,6 @@ const Ss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1087
1142
  export {
1088
1143
  _s as filter,
1089
1144
  Ts as parser,
1090
- Ss as tools,
1145
+ xs as tools,
1091
1146
  vs as utils
1092
1147
  };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@aim-packages/subtitle",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "main": "dist/index.cjs.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "build": "tsc && vite build",
9
- "preview": "vite preview"
9
+ "preview": "vite preview",
10
+ "release": "pnpm build && npm publish --registry=https://registry.npmjs.org/ --access public"
10
11
  },
11
12
  "devDependencies": {
12
13
  "@types/lodash-es": "^4.17.12",