File size: 8,021 Bytes
5b8f207
1
(this.webpackJsonpchatchan=this.webpackJsonpchatchan||[]).push([[3],{1472:function(n,e,t){"use strict";t.r(e);var r=t(1513),i=t(1512);t.d(e,"__wbg_set_wasm",(function(){return i.c})),t.d(e,"get_encoding",(function(){return i.k})),t.d(e,"encoding_for_model",(function(){return i.j})),t.d(e,"Tiktoken",(function(){return i.a})),t.d(e,"__wbindgen_object_drop_ref",(function(){return i.g})),t.d(e,"__wbindgen_is_undefined",(function(){return i.f})),t.d(e,"__wbg_stringify_029a979dfb73aa17",(function(){return i.d})),t.d(e,"__wbindgen_string_get",(function(){return i.h})),t.d(e,"__wbindgen_error_new",(function(){return i.e})),t.d(e,"__wbg_parse_3ac95b51fc312db8",(function(){return i.b})),t.d(e,"__wbindgen_throw",(function(){return i.i})),Object(i.c)(r)},1512:function(n,e,t){"use strict";(function(n){t.d(e,"c",(function(){return o})),t.d(e,"k",(function(){return q})),t.d(e,"j",(function(){return S})),t.d(e,"a",(function(){return z})),t.d(e,"g",(function(){return W})),t.d(e,"f",(function(){return j})),t.d(e,"d",(function(){return O})),t.d(e,"h",(function(){return T})),t.d(e,"e",(function(){return P})),t.d(e,"b",(function(){return J})),t.d(e,"i",(function(){return D}));var r,i=t(11),_=t(12);function o(n){r=n}var d=new Array(128).fill(void 0);function a(n){return d[n]}d.push(void 0,null,!0,!1);var u=d.length;function c(n){var e=a(n);return function(n){n<132||(d[n]=u,u=n)}(n),e}var f=0,l=null;function b(){return null!==l&&0!==l.byteLength||(l=new Uint8Array(r.memory.buffer)),l}var w=new("undefined"===typeof TextEncoder?(0,n.require)("util").TextEncoder:TextEncoder)("utf-8"),p="function"===typeof w.encodeInto?function(n,e){return w.encodeInto(n,e)}:function(n,e){var t=w.encode(n);return e.set(t),{read:n.length,written:t.length}};function s(n,e,t){if(void 0===t){var r=w.encode(n),i=e(r.length);return b().subarray(i,i+r.length).set(r),f=r.length,i}for(var _=n.length,o=e(_),d=b(),a=0;a<_;a++){var u=n.charCodeAt(a);if(u>127)break;d[o+a]=u}if(a!==_){0!==a&&(n=n.slice(a)),o=t(o,_,_=a+3*n.length);var c=b().subarray(o+a,o+_);a+=p(n,c).written}return f=a,o}var k=null;function y(){return null!==k&&0!==k.byteLength||(k=new Int32Array(r.memory.buffer)),k}var g=new("undefined"===typeof TextDecoder?(0,n.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});function h(n,e){return g.decode(b().subarray(n,n+e))}function v(n){u===d.length&&d.push(d.length+1);var e=u;return u=d[e],d[e]=n,e}g.decode();var x=null;function A(){return null!==x&&0!==x.byteLength||(x=new Uint32Array(r.memory.buffer)),x}function E(n,e){return A().subarray(n/4,n/4+e)}function m(n,e){return b().subarray(n/1,n/1+e)}function q(n,e){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");try{var t=r.__wbindgen_add_to_stack_pointer(-16),i=s(n,r.__wbindgen_export_0,r.__wbindgen_export_1),_=f;r.get_encoding(t,i,_,v(e));var o=y()[t/4+0],d=y()[t/4+1];if(y()[t/4+2])throw c(d);return z.__wrap(o)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function S(n,e){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");try{var t=r.__wbindgen_add_to_stack_pointer(-16),i=s(n,r.__wbindgen_export_0,r.__wbindgen_export_1),_=f;r.encoding_for_model(t,i,_,v(e));var o=y()[t/4+0],d=y()[t/4+1];if(y()[t/4+2])throw c(d);return z.__wrap(o)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function M(n,e){try{return n.apply(this,e)}catch(t){r.__wbindgen_export_3(v(t))}}var z=function(){function n(e,t,_){if(Object(i.a)(this,n),null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");var o=s(e,r.__wbindgen_export_0,r.__wbindgen_export_1),d=f,a=s(_,r.__wbindgen_export_0,r.__wbindgen_export_1),u=f,c=r.tiktoken_new(o,d,v(t),a,u);return n.__wrap(c)}return Object(_.a)(n,[{key:"__destroy_into_raw",value:function(){var n=this.ptr;return this.ptr=0,n}},{key:"free",value:function(){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");var n=this.__destroy_into_raw();r.__wbg_tiktoken_free(n)}},{key:"name",get:function(){try{var n=r.__wbindgen_add_to_stack_pointer(-16);r.tiktoken_name(n,this.ptr);var e,t=y()[n/4+0],i=y()[n/4+1];return 0!==t&&(e=h(t,i).slice(),r.__wbindgen_export_2(t,1*i)),e}finally{r.__wbindgen_add_to_stack_pointer(16)}}},{key:"encode",value:function(n,e,t){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");try{var i=r.__wbindgen_add_to_stack_pointer(-16),_=s(n,r.__wbindgen_export_0,r.__wbindgen_export_1),o=f;r.tiktoken_encode(i,this.ptr,_,o,v(e),v(t));var d=y()[i/4+0],a=y()[i/4+1],u=y()[i/4+2];if(y()[i/4+3])throw c(u);var l=E(d,a).slice();return r.__wbindgen_export_2(d,4*a),l}finally{r.__wbindgen_add_to_stack_pointer(16)}}},{key:"encode_ordinary",value:function(n){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");try{var e=r.__wbindgen_add_to_stack_pointer(-16),t=s(n,r.__wbindgen_export_0,r.__wbindgen_export_1),i=f;r.tiktoken_encode_ordinary(e,this.ptr,t,i);var _=y()[e/4+0],o=y()[e/4+1],d=E(_,o).slice();return r.__wbindgen_export_2(_,4*o),d}finally{r.__wbindgen_add_to_stack_pointer(16)}}},{key:"encode_with_unstable",value:function(n,e,t){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");try{var i=r.__wbindgen_add_to_stack_pointer(-16),_=s(n,r.__wbindgen_export_0,r.__wbindgen_export_1),o=f;r.tiktoken_encode_with_unstable(i,this.ptr,_,o,v(e),v(t));var d=y()[i/4+0],a=y()[i/4+1];if(y()[i/4+2])throw c(a);return c(d)}finally{r.__wbindgen_add_to_stack_pointer(16)}}},{key:"encode_single_token",value:function(n){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");var e=function(n,e){var t=e(1*n.length);return b().set(n,t/1),f=n.length,t}(n,r.__wbindgen_export_0),t=f;return r.tiktoken_encode_single_token(this.ptr,e,t)>>>0}},{key:"decode",value:function(n){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");try{var e=r.__wbindgen_add_to_stack_pointer(-16),t=function(n,e){var t=e(4*n.length);return A().set(n,t/4),f=n.length,t}(n,r.__wbindgen_export_0),i=f;r.tiktoken_decode(e,this.ptr,t,i);var _=y()[e/4+0],o=y()[e/4+1],d=m(_,o).slice();return r.__wbindgen_export_2(_,1*o),d}finally{r.__wbindgen_add_to_stack_pointer(16)}}},{key:"decode_single_token_bytes",value:function(n){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");try{var e=r.__wbindgen_add_to_stack_pointer(-16);r.tiktoken_decode_single_token_bytes(e,this.ptr,n);var t=y()[e/4+0],i=y()[e/4+1],_=m(t,i).slice();return r.__wbindgen_export_2(t,1*i),_}finally{r.__wbindgen_add_to_stack_pointer(16)}}},{key:"token_byte_values",value:function(){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");return c(r.tiktoken_token_byte_values(this.ptr))}}],[{key:"__wrap",value:function(e){var t=Object.create(n.prototype);return t.ptr=e,t}}]),n}();function W(n){c(n)}function j(n){return void 0===a(n)}function O(){return M((function(n){return v(JSON.stringify(a(n)))}),arguments)}function T(n,e){if(null==r)throw new Error("@dqbd/tiktoken: WASM binary has not been propery initialized.");var t,i=a(e),_="string"===typeof i?i:void 0,o=void 0===(t=_)||null===t?0:s(_,r.__wbindgen_export_0,r.__wbindgen_export_1),d=f;y()[n/4+1]=d,y()[n/4+0]=o}function P(n,e){return v(new Error(h(n,e)))}function J(){return M((function(n,e){return v(JSON.parse(h(n,e)))}),arguments)}function D(n,e){throw new Error(h(n,e))}}).call(this,t(1514)(n))},1513:function(n,e,t){"use strict";var r=t.w[n.i];for(var i in t.r(e),r)"__webpack_init__"!=i&&(e[i]=r[i]);t(1512);r.__webpack_init__()},1514:function(n,e){n.exports=function(n){if(!n.webpackPolyfill){var e=Object.create(n);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}}}]);