time-to-botec/squiggle/node_modules/@quri/squiggle-lang/dist/bundle.js

2 lines
567 KiB
JavaScript
Raw Normal View History

/*! For license information please see bundle.js.LICENSE.txt */
!function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.squiggle_lang=t():r.squiggle_lang=t()}(self,(()=>(()=>{var r={76738:(r,t,e)=>{"use strict";var n=e(10456),o=e(2434),i=e(9438),a=e(22525),u=e(20114),s=i.make_float;function f(r,t,e){for(var n=i.make(r,[]),o=0;o<r;++o)n[o]=i.make(t,e);return n}function c(r){var t=r.length;return 0===t?[]:i.sub(r,0,t)}function l(r,t,e,n,o){if(o<0||t<0||t>(r.length-o|0)||n<0||n>(e.length-o|0))throw{RE_EXN_ID:"Invalid_argument",_1:"Array.blit",Error:new Error};i.blit(r,t,e,n,o)}var m=a.create("Array.Bottom");function p(r,t){var e=function(e,o,a,u,s,f,c){for(var m=e+o|0,p=u+s|0,v=e,d=i.get(t,e),_=u,g=i.get(a,u),h=c;;){var y=h,b=g,A=_,S=d,T=v;if(n._2(r,S,b)<=0){i.set(f,y,S);var E=T+1|0;if(E>=m)return l(a,A,f,y+1|0,p-A|0);h=y+1|0,d=i.get(t,E),v=E}else{i.set(f,y,b);var x=A+1|0;if(x>=p)return l(t,T,f,y+1|0,m-T|0);h=y+1|0,g=i.get(a,x),_=x}}},o=function(e,o,a,u){for(var s=0;s<u;++s){for(var f=i.get(t,e+s|0),c=(a+s|0)-1|0;c>=a&&n._2(r,i.get(o,c),f)>0;)i.set(o,c+1|0,i.get(o,c)),c=c-1|0;i.set(o,c+1|0,f)}},a=function(r,n,i,u){if(u<=5)return o(r,n,i,u);var s=u/2|0,f=u-s|0;a(r+s|0,n,i+s|0,f),a(r,t,r+f|0,s),e(r+f|0,s,n,i+s|0,f,n,i)},u=t.length;if(u<=5)return o(0,t,0,u);var s=u/2|0,f=u-s|0,c=i.make(f,i.get(t,0));a(s,c,0,f),a(0,t,f,s),e(f,s,c,0,f,t,0)}var v=f,d=i.concat,_=p;t.make_float=s,t.init=function(r,t){if(0===r)return[];if(r<0)throw{RE_EXN_ID:"Invalid_argument",_1:"Array.init",Error:new Error};for(var e=i.make(r,n._1(t,0)),o=1;o<r;++o)e[o]=n._1(t,o);return e},t.make_matrix=f,t.create_matrix=v,t.append=function(r,t){var e=r.length;return 0===e?c(t):0===t.length?i.sub(r,0,e):r.concat(t)},t.concat=d,t.sub=function(r,t,e){if(t<0||e<0||t>(r.length-e|0))throw{RE_EXN_ID:"Invalid_argument",_1:"Array.sub",Error:new Error};return i.sub(r,t,e)},t.copy=c,t.fill=function(r,t,e,n){if(t<0||e<0||t>(r.length-e|0))throw{RE_EXN_ID:"Invalid_argument",_1:"Array.fill",Error:new Error};for(var o=t,i=t+e|0;o<i;++o)r[o]=n},t.blit=l,t.to_list=function(r){for(var t=r.length-1|0,e=0;;){var n=e,o=t;if(o<0)return n;e={hd:r[o],tl:n},t=o-1|0}},t.of_list=function(r){if(!r)return[];for(var t=i.make(function(r,t){for(;;){var e=r;if(!t)return e;t=t.tl,r=e+1|0}}(0,r),r.hd),e=1,n=r.tl;;){var o=n,a=e;if(!o)return t;t[a]=o.hd,n=o.tl,e=a+1|0}},t.iter=function(r,t){for(var e=0,o=t.length;e<o;++e)n._1(r,t[e])},t.iteri=function(r,t){for(var e=0,o=t.length;e<o;++e)n._2(r,e,t[e])},t.map=function(r,t){var e=t.length;if(0===e)return[];for(var o=i.make(e,n._1(r,t[0])),a=1;a<e;++a)o[a]=n._1(r,t[a]);return o},t.mapi=function(r,t){var e=t.length;if(0===e)return[];for(var o=i.make(e,n._2(r,0,t[0])),a=1;a<e;++a)o[a]=n._2(r,a,t[a]);return o},t.fold_left=function(r,t,e){for(var o=t,i=0,a=e.length;i<a;++i)o=n._2(r,o,e[i]);return o},t.fold_right=function(r,t,e){for(var o=e,i=t.length-1|0;i>=0;--i)o=n._2(r,t[i],o);return o},t.iter2=function(r,t,e){if(t.length!==e.length)throw{RE_EXN_ID:"Invalid_argument",_1:"Array.iter2: arrays must have the same length",Error:new Error};for(var o=0,i=t.length;o<i;++o)n._2(r,t[o],e[o])},t.map2=function(r,t,e){var o=t.length;if(o!==e.length)throw{RE_EXN_ID:"Invalid_argument",_1:"Array.map2: arrays must have the same length",Error:new Error};if(0===o)return[];for(var a=i.make(o,n._2(r,t[0],e[0])),u=1;u<o;++u)a[u]=n._2(r,t[u],e[u]);return a},t.for_all=function(r,t){for(var e=t.length,o=0;;){var i=o;if(i===e)return!0;if(!n._1(r,t[i]))return!1;o=i+1|0}},t.exists=function(r,t){for(var e=t.length,o=0;;){var i=o;if(i===e)return!1;if(n._1(r,t[i]))return!0;o=i+1|0}},t.mem=function(r,t){for(var e=t.length,n=0;;){var i=n;if(i===e)return!1;if(o.equal(t[i],r))return!0;n=i+1|0}},t.memq=function(r,t){for(var e=t.length,n=0;;){var o=n;if(o===e)return!1;if(r===t[o])return!0;n=o+1|0}},t.sort=function(r,t){for(var e=function(e,o){var a=1+((o+o|0)+o|0)|0,u=a;if((a+2|0)<e)return n._2(r,i.get(t,a),i.get(t,a+1|0))<0&&(u=a+1|0),n._2(r,i.get(t,u),i.get(t,a+2|0))<0&&(u=a+2|0),u;if((a+1|0)<e&&n._2(r,i.get(t,a),i.get(t,a+1|0))<0)return a+