UNPKG

@opra/client

Version:
22 lines (18 loc) • 35.9 kB
/**************************************** * All rights reserved Panates® 2022-2025 * http://www.panates.com *****************************************/ "use strict";var Or=Object.create;var k=Object.defineProperty;var Wr=Object.getOwnPropertyDescriptor;var zr=Object.getOwnPropertyNames;var Yr=Object.getPrototypeOf,Gr=Object.prototype.hasOwnProperty;var s=(n,r)=>k(n,"name",{value:r,configurable:!0});var K=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports),Jr=(n,r)=>{for(var e in r)k(n,e,{get:r[e],enumerable:!0})},xr=(n,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of zr(r))!Gr.call(n,i)&&i!==e&&k(n,i,{get:()=>r[i],enumerable:!(t=Wr(r,i))||t.enumerable});return n};var V=(n,r,e)=>(e=n!=null?Or(Yr(n)):{},xr(r||!n||!n.__esModule?k(e,"default",{value:n,enumerable:!0}):e,n)),Xr=n=>xr(k({},"__esModule",{value:!0}),n);var dr=K(j=>{"use strict";j.byteLength=Vr;j.toByteArray=$r;j.fromByteArray=ee;var A=[],E=[],Kr=typeof Uint8Array<"u"?Uint8Array:Array,Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(T=0,wr=Z.length;T<wr;++T)A[T]=Z[T],E[Z.charCodeAt(T)]=T;var T,wr;E[45]=62;E[95]=63;function mr(n){var r=n.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=n.indexOf("=");e===-1&&(e=r);var t=e===r?0:4-e%4;return[e,t]}s(mr,"getLens");function Vr(n){var r=mr(n),e=r[0],t=r[1];return(e+t)*3/4-t}s(Vr,"byteLength");function Zr(n,r,e){return(r+e)*3/4-e}s(Zr,"_byteLength");function $r(n){var r,e=mr(n),t=e[0],i=e[1],o=new Kr(Zr(n,t,i)),a=0,h=i>0?t-4:t,f;for(f=0;f<h;f+=4)r=E[n.charCodeAt(f)]<<18|E[n.charCodeAt(f+1)]<<12|E[n.charCodeAt(f+2)]<<6|E[n.charCodeAt(f+3)],o[a++]=r>>16&255,o[a++]=r>>8&255,o[a++]=r&255;return i===2&&(r=E[n.charCodeAt(f)]<<2|E[n.charCodeAt(f+1)]>>4,o[a++]=r&255),i===1&&(r=E[n.charCodeAt(f)]<<10|E[n.charCodeAt(f+1)]<<4|E[n.charCodeAt(f+2)]>>2,o[a++]=r>>8&255,o[a++]=r&255),o}s($r,"toByteArray");function Qr(n){return A[n>>18&63]+A[n>>12&63]+A[n>>6&63]+A[n&63]}s(Qr,"tripletToBase64");function re(n,r,e){for(var t,i=[],o=r;o<e;o+=3)t=(n[o]<<16&16711680)+(n[o+1]<<8&65280)+(n[o+2]&255),i.push(Qr(t));return i.join("")}s(re,"encodeChunk");function ee(n){for(var r,e=n.length,t=e%3,i=[],o=16383,a=0,h=e-t;a<h;a+=o)i.push(re(n,a,a+o>h?h:a+o));return t===1?(r=n[e-1],i.push(A[r>>2]+A[r<<4&63]+"==")):t===2&&(r=(n[e-2]<<8)+n[e-1],i.push(A[r>>10]+A[r>>4&63]+A[r<<2&63]+"=")),i.join("")}s(ee,"fromByteArray")});var Er=K($=>{"use strict";$.read=function(n,r,e,t,i){var o,a,h=i*8-t-1,f=(1<<h)-1,l=f>>1,c=-7,p=e?i-1:0,x=e?-1:1,w=n[r+p];for(p+=x,o=w&(1<<-c)-1,w>>=-c,c+=h;c>0;o=o*256+n[r+p],p+=x,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=t;c>0;a=a*256+n[r+p],p+=x,c-=8);if(o===0)o=1-l;else{if(o===f)return a?NaN:(w?-1:1)*(1/0);a=a+Math.pow(2,t),o=o-l}return(w?-1:1)*a*Math.pow(2,o-t)};$.write=function(n,r,e,t,i,o){var a,h,f,l=o*8-i-1,c=(1<<l)-1,p=c>>1,x=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=t?0:o-1,d=t?1:-1,L=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(h=isNaN(r)?1:0,a=c):(a=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+p>=1?r+=x/f:r+=x*Math.pow(2,1-p),r*f>=2&&(a++,f/=2),a+p>=c?(h=0,a=c):a+p>=1?(h=(r*f-1)*Math.pow(2,i),a=a+p):(h=r*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;n[e+w]=h&255,w+=d,h/=256,i-=8);for(a=a<<i|h,l+=i;l>0;n[e+w]=a&255,w+=d,a/=256,l-=8);n[e+w-d]|=L*128}});var kr=K(C=>{"use strict";var Q=dr(),R=Er(),gr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;C.Buffer=u;C.SlowBuffer=se;C.INSPECT_MAX_BYTES=50;var O=2147483647;C.kMaxLength=O;u.TYPED_ARRAY_SUPPORT=te();!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function te(){try{var n=new Uint8Array(1),r={foo:s(function(){return 42},"foo")};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(n,r),n.foo()===42}catch{return!1}}s(te,"typedArraySupport");Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:s(function(){if(u.isBuffer(this))return this.buffer},"get")});Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:s(function(){if(u.isBuffer(this))return this.byteOffset},"get")});function I(n){if(n>O)throw new RangeError('The value "'+n+'" is invalid for option "size"');var r=new Uint8Array(n);return Object.setPrototypeOf(r,u.prototype),r}s(I,"createBuffer");function u(n,r,e){if(typeof n=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return nr(n)}return Ur(n,r,e)}s(u,"Buffer");u.poolSize=8192;function Ur(n,r,e){if(typeof n=="string")return ie(n,r);if(ArrayBuffer.isView(n))return oe(n);if(n==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n);if(v(n,ArrayBuffer)||n&&v(n.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(v(n,SharedArrayBuffer)||n&&v(n.buffer,SharedArrayBuffer)))return er(n,r,e);if(typeof n=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var t=n.valueOf&&n.valueOf();if(t!=null&&t!==n)return u.from(t,r,e);var i=ae(n);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof n[Symbol.toPrimitive]=="function")return u.from(n[Symbol.toPrimitive]("string"),r,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n)}s(Ur,"from");u.from=function(n,r,e){return Ur(n,r,e)};Object.setPrototypeOf(u.prototype,Uint8Array.prototype);Object.setPrototypeOf(u,Uint8Array);function Ar(n){if(typeof n!="number")throw new TypeError('"size" argument must be of type number');if(n<0)throw new RangeError('The value "'+n+'" is invalid for option "size"')}s(Ar,"assertSize");function ne(n,r,e){return Ar(n),n<=0?I(n):r!==void 0?typeof e=="string"?I(n).fill(r,e):I(n).fill(r):I(n)}s(ne,"alloc");u.alloc=function(n,r,e){return ne(n,r,e)};function nr(n){return Ar(n),I(n<0?0:ir(n)|0)}s(nr,"allocUnsafe");u.allocUnsafe=function(n){return nr(n)};u.allocUnsafeSlow=function(n){return nr(n)};function ie(n,r){if((typeof r!="string"||r==="")&&(r="utf8"),!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var e=vr(n,r)|0,t=I(e),i=t.write(n,r);return i!==e&&(t=t.slice(0,i)),t}s(ie,"fromString");function rr(n){for(var r=n.length<0?0:ir(n.length)|0,e=I(r),t=0;t<r;t+=1)e[t]=n[t]&255;return e}s(rr,"fromArrayLike");function oe(n){if(v(n,Uint8Array)){var r=new Uint8Array(n);return er(r.buffer,r.byteOffset,r.byteLength)}return rr(n)}s(oe,"fromArrayView");function er(n,r,e){if(r<0||n.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(n.byteLength<r+(e||0))throw new RangeError('"length" is outside of buffer bounds');var t;return r===void 0&&e===void 0?t=new Uint8Array(n):e===void 0?t=new Uint8Array(n,r):t=new Uint8Array(n,r,e),Object.setPrototypeOf(t,u.prototype),t}s(er,"fromArrayBuffer");function ae(n){if(u.isBuffer(n)){var r=ir(n.length)|0,e=I(r);return e.length===0||n.copy(e,0,0,r),e}if(n.length!==void 0)return typeof n.length!="number"||or(n.length)?I(0):rr(n);if(n.type==="Buffer"&&Array.isArray(n.data))return rr(n.data)}s(ae,"fromObject");function ir(n){if(n>=O)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+O.toString(16)+" bytes");return n|0}s(ir,"checked");function se(n){return+n!=n&&(n=0),u.alloc(+n)}s(se,"SlowBuffer");u.isBuffer=s(function(r){return r!=null&&r._isBuffer===!0&&r!==u.prototype},"isBuffer");u.compare=s(function(r,e){if(v(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),v(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(r)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===e)return 0;for(var t=r.length,i=e.length,o=0,a=Math.min(t,i);o<a;++o)if(r[o]!==e[o]){t=r[o],i=e[o];break}return t<i?-1:i<t?1:0},"compare");u.isEncoding=s(function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding");u.concat=s(function(r,e){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return u.alloc(0);var t;if(e===void 0)for(e=0,t=0;t<r.length;++t)e+=r[t].length;var i=u.allocUnsafe(e),o=0;for(t=0;t<r.length;++t){var a=r[t];if(v(a,Uint8Array))o+a.length>i.length?u.from(a).copy(i,o):Uint8Array.prototype.set.call(i,a,o);else if(u.isBuffer(a))a.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=a.length}return i},"concat");function vr(n,r){if(u.isBuffer(n))return n.length;if(ArrayBuffer.isView(n)||v(n,ArrayBuffer))return n.byteLength;if(typeof n!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof n);var e=n.length,t=arguments.length>2&&arguments[2]===!0;if(!t&&e===0)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return tr(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Lr(n).length;default:if(i)return t?-1:tr(n).length;r=(""+r).toLowerCase(),i=!0}}s(vr,"byteLength");u.byteLength=vr;function ue(n,r,e){var t=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,r>>>=0,e<=r))return"";for(n||(n="utf8");;)switch(n){case"hex":return de(this,r,e);case"utf8":case"utf-8":return Tr(this,r,e);case"ascii":return we(this,r,e);case"latin1":case"binary":return me(this,r,e);case"base64":return ye(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ee(this,r,e);default:if(t)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),t=!0}}s(ue,"slowToString");u.prototype._isBuffer=!0;function S(n,r,e){var t=n[r];n[r]=n[e],n[e]=t}s(S,"swap");u.prototype.swap16=s(function(){var r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<r;e+=2)S(this,e,e+1);return this},"swap16");u.prototype.swap32=s(function(){var r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<r;e+=4)S(this,e,e+3),S(this,e+1,e+2);return this},"swap32");u.prototype.swap64=s(function(){var r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<r;e+=8)S(this,e,e+7),S(this,e+1,e+6),S(this,e+2,e+5),S(this,e+3,e+4);return this},"swap64");u.prototype.toString=s(function(){var r=this.length;return r===0?"":arguments.length===0?Tr(this,0,r):ue.apply(this,arguments)},"toString");u.prototype.toLocaleString=u.prototype.toString;u.prototype.equals=s(function(r){if(!u.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:u.compare(this,r)===0},"equals");u.prototype.inspect=s(function(){var r="",e=C.INSPECT_MAX_BYTES;return r=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(r+=" ... "),"<Buffer "+r+">"},"inspect");gr&&(u.prototype[gr]=u.prototype.inspect);u.prototype.compare=s(function(r,e,t,i,o){if(v(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(e===void 0&&(e=0),t===void 0&&(t=r?r.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||t>r.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=t)return 0;if(i>=o)return-1;if(e>=t)return 1;if(e>>>=0,t>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var a=o-i,h=t-e,f=Math.min(a,h),l=this.slice(i,o),c=r.slice(e,t),p=0;p<f;++p)if(l[p]!==c[p]){a=l[p],h=c[p];break}return a<h?-1:h<a?1:0},"compare");function Ir(n,r,e,t,i){if(n.length===0)return-1;if(typeof e=="string"?(t=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,or(e)&&(e=i?0:n.length-1),e<0&&(e=n.length+e),e>=n.length){if(i)return-1;e=n.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof r=="string"&&(r=u.from(r,t)),u.isBuffer(r))return r.length===0?-1:Br(n,r,e,t,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,r,e):Uint8Array.prototype.lastIndexOf.call(n,r,e):Br(n,[r],e,t,i);throw new TypeError("val must be string, number or Buffer")}s(Ir,"bidirectionalIndexOf");function Br(n,r,e,t,i){var o=1,a=n.length,h=r.length;if(t!==void 0&&(t=String(t).toLowerCase(),t==="ucs2"||t==="ucs-2"||t==="utf16le"||t==="utf-16le")){if(n.length<2||r.length<2)return-1;o=2,a/=2,h/=2,e/=2}function f(w,d){return o===1?w[d]:w.readUInt16BE(d*o)}s(f,"read");var l;if(i){var c=-1;for(l=e;l<a;l++)if(f(n,l)===f(r,c===-1?0:l-c)){if(c===-1&&(c=l),l-c+1===h)return c*o}else c!==-1&&(l-=l-c),c=-1}else for(e+h>a&&(e=a-h),l=e;l>=0;l--){for(var p=!0,x=0;x<h;x++)if(f(n,l+x)!==f(r,x)){p=!1;break}if(p)return l}return-1}s(Br,"arrayIndexOf");u.prototype.includes=s(function(r,e,t){return this.indexOf(r,e,t)!==-1},"includes");u.prototype.indexOf=s(function(r,e,t){return Ir(this,r,e,t,!0)},"indexOf");u.prototype.lastIndexOf=s(function(r,e,t){return Ir(this,r,e,t,!1)},"lastIndexOf");function he(n,r,e,t){e=Number(e)||0;var i=n.length-e;t?(t=Number(t),t>i&&(t=i)):t=i;var o=r.length;t>o/2&&(t=o/2);for(var a=0;a<t;++a){var h=parseInt(r.substr(a*2,2),16);if(or(h))return a;n[e+a]=h}return a}s(he,"hexWrite");function fe(n,r,e,t){return W(tr(r,n.length-e),n,e,t)}s(fe,"utf8Write");function pe(n,r,e,t){return W(Fe(r),n,e,t)}s(pe,"asciiWrite");function ce(n,r,e,t){return W(Lr(r),n,e,t)}s(ce,"base64Write");function le(n,r,e,t){return W(Ue(r,n.length-e),n,e,t)}s(le,"ucs2Write");u.prototype.write=s(function(r,e,t,i){if(e===void 0)i="utf8",t=this.length,e=0;else if(t===void 0&&typeof e=="string")i=e,t=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(t)?(t=t>>>0,i===void 0&&(i="utf8")):(i=t,t=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((t===void 0||t>o)&&(t=o),r.length>0&&(t<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return he(this,r,e,t);case"utf8":case"utf-8":return fe(this,r,e,t);case"ascii":case"latin1":case"binary":return pe(this,r,e,t);case"base64":return ce(this,r,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return le(this,r,e,t);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},"write");u.prototype.toJSON=s(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function ye(n,r,e){return r===0&&e===n.length?Q.fromByteArray(n):Q.fromByteArray(n.slice(r,e))}s(ye,"base64Slice");function Tr(n,r,e){e=Math.min(n.length,e);for(var t=[],i=r;i<e;){var o=n[i],a=null,h=o>239?4:o>223?3:o>191?2:1;if(i+h<=e){var f,l,c,p;switch(h){case 1:o<128&&(a=o);break;case 2:f=n[i+1],(f&192)===128&&(p=(o&31)<<6|f&63,p>127&&(a=p));break;case 3:f=n[i+1],l=n[i+2],(f&192)===128&&(l&192)===128&&(p=(o&15)<<12|(f&63)<<6|l&63,p>2047&&(p<55296||p>57343)&&(a=p));break;case 4:f=n[i+1],l=n[i+2],c=n[i+3],(f&192)===128&&(l&192)===128&&(c&192)===128&&(p=(o&15)<<18|(f&63)<<12|(l&63)<<6|c&63,p>65535&&p<1114112&&(a=p))}}a===null?(a=65533,h=1):a>65535&&(a-=65536,t.push(a>>>10&1023|55296),a=56320|a&1023),t.push(a),i+=h}return xe(t)}s(Tr,"utf8Slice");var Fr=4096;function xe(n){var r=n.length;if(r<=Fr)return String.fromCharCode.apply(String,n);for(var e="",t=0;t<r;)e+=String.fromCharCode.apply(String,n.slice(t,t+=Fr));return e}s(xe,"decodeCodePointsArray");function we(n,r,e){var t="";e=Math.min(n.length,e);for(var i=r;i<e;++i)t+=String.fromCharCode(n[i]&127);return t}s(we,"asciiSlice");function me(n,r,e){var t="";e=Math.min(n.length,e);for(var i=r;i<e;++i)t+=String.fromCharCode(n[i]);return t}s(me,"latin1Slice");function de(n,r,e){var t=n.length;(!r||r<0)&&(r=0),(!e||e<0||e>t)&&(e=t);for(var i="",o=r;o<e;++o)i+=Ae[n[o]];return i}s(de,"hexSlice");function Ee(n,r,e){for(var t=n.slice(r,e),i="",o=0;o<t.length-1;o+=2)i+=String.fromCharCode(t[o]+t[o+1]*256);return i}s(Ee,"utf16leSlice");u.prototype.slice=s(function(r,e){var t=this.length;r=~~r,e=e===void 0?t:~~e,r<0?(r+=t,r<0&&(r=0)):r>t&&(r=t),e<0?(e+=t,e<0&&(e=0)):e>t&&(e=t),e<r&&(e=r);var i=this.subarray(r,e);return Object.setPrototypeOf(i,u.prototype),i},"slice");function y(n,r,e){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+r>e)throw new RangeError("Trying to access beyond buffer length")}s(y,"checkOffset");u.prototype.readUintLE=u.prototype.readUIntLE=s(function(r,e,t){r=r>>>0,e=e>>>0,t||y(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return i},"readUIntLE");u.prototype.readUintBE=u.prototype.readUIntBE=s(function(r,e,t){r=r>>>0,e=e>>>0,t||y(r,e,this.length);for(var i=this[r+--e],o=1;e>0&&(o*=256);)i+=this[r+--e]*o;return i},"readUIntBE");u.prototype.readUint8=u.prototype.readUInt8=s(function(r,e){return r=r>>>0,e||y(r,1,this.length),this[r]},"readUInt8");u.prototype.readUint16LE=u.prototype.readUInt16LE=s(function(r,e){return r=r>>>0,e||y(r,2,this.length),this[r]|this[r+1]<<8},"readUInt16LE");u.prototype.readUint16BE=u.prototype.readUInt16BE=s(function(r,e){return r=r>>>0,e||y(r,2,this.length),this[r]<<8|this[r+1]},"readUInt16BE");u.prototype.readUint32LE=u.prototype.readUInt32LE=s(function(r,e){return r=r>>>0,e||y(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},"readUInt32LE");u.prototype.readUint32BE=u.prototype.readUInt32BE=s(function(r,e){return r=r>>>0,e||y(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},"readUInt32BE");u.prototype.readIntLE=s(function(r,e,t){r=r>>>0,e=e>>>0,t||y(r,e,this.length);for(var i=this[r],o=1,a=0;++a<e&&(o*=256);)i+=this[r+a]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},"readIntLE");u.prototype.readIntBE=s(function(r,e,t){r=r>>>0,e=e>>>0,t||y(r,e,this.length);for(var i=e,o=1,a=this[r+--i];i>0&&(o*=256);)a+=this[r+--i]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a},"readIntBE");u.prototype.readInt8=s(function(r,e){return r=r>>>0,e||y(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},"readInt8");u.prototype.readInt16LE=s(function(r,e){r=r>>>0,e||y(r,2,this.length);var t=this[r]|this[r+1]<<8;return t&32768?t|4294901760:t},"readInt16LE");u.prototype.readInt16BE=s(function(r,e){r=r>>>0,e||y(r,2,this.length);var t=this[r+1]|this[r]<<8;return t&32768?t|4294901760:t},"readInt16BE");u.prototype.readInt32LE=s(function(r,e){return r=r>>>0,e||y(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},"readInt32LE");u.prototype.readInt32BE=s(function(r,e){return r=r>>>0,e||y(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},"readInt32BE");u.prototype.readFloatLE=s(function(r,e){return r=r>>>0,e||y(r,4,this.length),R.read(this,r,!0,23,4)},"readFloatLE");u.prototype.readFloatBE=s(function(r,e){return r=r>>>0,e||y(r,4,this.length),R.read(this,r,!1,23,4)},"readFloatBE");u.prototype.readDoubleLE=s(function(r,e){return r=r>>>0,e||y(r,8,this.length),R.read(this,r,!0,52,8)},"readDoubleLE");u.prototype.readDoubleBE=s(function(r,e){return r=r>>>0,e||y(r,8,this.length),R.read(this,r,!1,52,8)},"readDoubleBE");function m(n,r,e,t,i,o){if(!u.isBuffer(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+t>n.length)throw new RangeError("Index out of range")}s(m,"checkInt");u.prototype.writeUintLE=u.prototype.writeUIntLE=s(function(r,e,t,i){if(r=+r,e=e>>>0,t=t>>>0,!i){var o=Math.pow(2,8*t)-1;m(this,r,e,t,o,0)}var a=1,h=0;for(this[e]=r&255;++h<t&&(a*=256);)this[e+h]=r/a&255;return e+t},"writeUIntLE");u.prototype.writeUintBE=u.prototype.writeUIntBE=s(function(r,e,t,i){if(r=+r,e=e>>>0,t=t>>>0,!i){var o=Math.pow(2,8*t)-1;m(this,r,e,t,o,0)}var a=t-1,h=1;for(this[e+a]=r&255;--a>=0&&(h*=256);)this[e+a]=r/h&255;return e+t},"writeUIntBE");u.prototype.writeUint8=u.prototype.writeUInt8=s(function(r,e,t){return r=+r,e=e>>>0,t||m(this,r,e,1,255,0),this[e]=r&255,e+1},"writeUInt8");u.prototype.writeUint16LE=u.prototype.writeUInt16LE=s(function(r,e,t){return r=+r,e=e>>>0,t||m(this,r,e,2,65535,0),this[e]=r&255,this[e+1]=r>>>8,e+2},"writeUInt16LE");u.prototype.writeUint16BE=u.prototype.writeUInt16BE=s(function(r,e,t){return r=+r,e=e>>>0,t||m(this,r,e,2,65535,0),this[e]=r>>>8,this[e+1]=r&255,e+2},"writeUInt16BE");u.prototype.writeUint32LE=u.prototype.writeUInt32LE=s(function(r,e,t){return r=+r,e=e>>>0,t||m(this,r,e,4,4294967295,0),this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=r&255,e+4},"writeUInt32LE");u.prototype.writeUint32BE=u.prototype.writeUInt32BE=s(function(r,e,t){return r=+r,e=e>>>0,t||m(this,r,e,4,4294967295,0),this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255,e+4},"writeUInt32BE");u.prototype.writeIntLE=s(function(r,e,t,i){if(r=+r,e=e>>>0,!i){var o=Math.pow(2,8*t-1);m(this,r,e,t,o-1,-o)}var a=0,h=1,f=0;for(this[e]=r&255;++a<t&&(h*=256);)r<0&&f===0&&this[e+a-1]!==0&&(f=1),this[e+a]=(r/h>>0)-f&255;return e+t},"writeIntLE");u.prototype.writeIntBE=s(function(r,e,t,i){if(r=+r,e=e>>>0,!i){var o=Math.pow(2,8*t-1);m(this,r,e,t,o-1,-o)}var a=t-1,h=1,f=0;for(this[e+a]=r&255;--a>=0&&(h*=256);)r<0&&f===0&&this[e+a+1]!==0&&(f=1),this[e+a]=(r/h>>0)-f&255;return e+t},"writeIntBE");u.prototype.writeInt8=s(function(r,e,t){return r=+r,e=e>>>0,t||m(this,r,e,1,127,-128),r<0&&(r=255+r+1),this[e]=r&255,e+1},"writeInt8");u.prototype.writeInt16LE=s(function(r,e,t){return r=+r,e=e>>>0,t||m(this,r,e,2,32767,-32768),this[e]=r&255,this[e+1]=r>>>8,e+2},"writeInt16LE");u.prototype.writeInt16BE=s(function(r,e,t){return r=+r,e=e>>>0,t||m(this,r,e,2,32767,-32768),this[e]=r>>>8,this[e+1]=r&255,e+2},"writeInt16BE");u.prototype.writeInt32LE=s(function(r,e,t){return r=+r,e=e>>>0,t||m(this,r,e,4,2147483647,-2147483648),this[e]=r&255,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24,e+4},"writeInt32LE");u.prototype.writeInt32BE=s(function(r,e,t){return r=+r,e=e>>>0,t||m(this,r,e,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=r&255,e+4},"writeInt32BE");function Sr(n,r,e,t,i,o){if(e+t>n.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}s(Sr,"checkIEEE754");function Rr(n,r,e,t,i){return r=+r,e=e>>>0,i||Sr(n,r,e,4,34028234663852886e22,-34028234663852886e22),R.write(n,r,e,t,23,4),e+4}s(Rr,"writeFloat");u.prototype.writeFloatLE=s(function(r,e,t){return Rr(this,r,e,!0,t)},"writeFloatLE");u.prototype.writeFloatBE=s(function(r,e,t){return Rr(this,r,e,!1,t)},"writeFloatBE");function Cr(n,r,e,t,i){return r=+r,e=e>>>0,i||Sr(n,r,e,8,17976931348623157e292,-17976931348623157e292),R.write(n,r,e,t,52,8),e+8}s(Cr,"writeDouble");u.prototype.writeDoubleLE=s(function(r,e,t){return Cr(this,r,e,!0,t)},"writeDoubleLE");u.prototype.writeDoubleBE=s(function(r,e,t){return Cr(this,r,e,!1,t)},"writeDoubleBE");u.prototype.copy=s(function(r,e,t,i){if(!u.isBuffer(r))throw new TypeError("argument should be a Buffer");if(t||(t=0),!i&&i!==0&&(i=this.length),e>=r.length&&(e=r.length),e||(e=0),i>0&&i<t&&(i=t),i===t||r.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(t<0||t>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-e<i-t&&(i=r.length-e+t);var o=i-t;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,t,i):Uint8Array.prototype.set.call(r,this.subarray(t,i),e),o},"copy");u.prototype.fill=s(function(r,e,t,i){if(typeof r=="string"){if(typeof e=="string"?(i=e,e=0,t=this.length):typeof t=="string"&&(i=t,t=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(r.length===1){var o=r.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(r=o)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(e<0||this.length<e||this.length<t)throw new RangeError("Out of range index");if(t<=e)return this;e=e>>>0,t=t===void 0?this.length:t>>>0,r||(r=0);var a;if(typeof r=="number")for(a=e;a<t;++a)this[a]=r;else{var h=u.isBuffer(r)?r:u.from(r,i),f=h.length;if(f===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(a=0;a<t-e;++a)this[a+e]=h[a%f]}return this},"fill");var ge=/[^+/0-9A-Za-z-_]/g;function Be(n){if(n=n.split("=")[0],n=n.trim().replace(ge,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}s(Be,"base64clean");function tr(n,r){r=r||1/0;for(var e,t=n.length,i=null,o=[],a=0;a<t;++a){if(e=n.charCodeAt(a),e>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(a+1===t){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}s(tr,"utf8ToBytes");function Fe(n){for(var r=[],e=0;e<n.length;++e)r.push(n.charCodeAt(e)&255);return r}s(Fe,"asciiToBytes");function Ue(n,r){for(var e,t,i,o=[],a=0;a<n.length&&!((r-=2)<0);++a)e=n.charCodeAt(a),t=e>>8,i=e%256,o.push(i),o.push(t);return o}s(Ue,"utf16leToBytes");function Lr(n){return Q.toByteArray(Be(n))}s(Lr,"base64ToBytes");function W(n,r,e,t){for(var i=0;i<t&&!(i+e>=r.length||i>=n.length);++i)r[i+e]=n[i];return i}s(W,"blitBuffer");function v(n,r){return n instanceof r||n!=null&&n.constructor!=null&&n.constructor.name!=null&&n.constructor.name===r.name}s(v,"isInstance");function or(n){return n!==n}s(or,"numberIsNaN");var Ae=(function(){for(var n="0123456789abcdef",r=new Array(256),e=0;e<16;++e)for(var t=e*16,i=0;i<16;++i)r[t+i]=n[e]+n[i];return r})()});var Se={};Jr(Se,{Backend:()=>b,ClientError:()=>D,FetchBackend:()=>P,HttpBackend:()=>M,HttpClientBase:()=>_,HttpEventType:()=>F,HttpObserveType:()=>U,HttpRequestObservable:()=>H,HttpResponse:()=>N,OpraHttpClient:()=>cr,kBackend:()=>g,kClient:()=>br,kContext:()=>B,urlPath:()=>Te});module.exports=Xr(Se);var _r=V(kr(),1);var br=Symbol.for("kClient"),g=Symbol.for("kBackend"),B=Symbol.for("kContext");var ar=class ar{constructor(r){this.document=r==null?void 0:r.document}};s(ar,"Backend");var b=ar;var sr=class sr extends Error{constructor(r,e){super(r.message),this.cause=e,this.issues=r.issues||[],this.status=r.status,e&&(this.cause=e,e.stack&&(this.stack=e.stack))}};s(sr,"ClientError");var D=sr;var U;(function(n){n.ResponseHeader="response-header",n.Response="response",n.Body="body",n.Events="events"})(U||(U={}));var Y=V(require("@browsery/type-is"),1),Dr=require("@jsopen/objects"),G=require("@opra/common"),Mr=require("rxjs"),Nr=require("rxjs/internal/util/isReadableStreamLike");var ur=class ur extends b{constructor(r,e){super(e);let t=new URL(r);this.serviceUrl=t.toString().split("?")[0].split("#")[0],this.serviceUrl.endsWith("/")||(this.serviceUrl+="/")}};s(ur,"HttpBackend");var M=ur;var z=class z{constructor(r){this.hasBody=!1,this.headers=(r==null?void 0:r.headers)instanceof Headers?r==null?void 0:r.headers:new Headers(r==null?void 0:r.headers),this.status=(r==null?void 0:r.status)||200,this.statusText=(r==null?void 0:r.statusText)||"OK",this.url=(r==null?void 0:r.url)||null,this.ok=this.status>=200&&this.status<300,this.body=r==null?void 0:r.body,this.hasBody=(r==null?void 0:r.body)!=null||!!(r!=null&&r.hasBody),this.contentType=(this.headers.get("content-type")||"").split(";")[0]}clone(r){return new z({...this,...r})}};s(z,"HttpResponse");var N=z;var F;(function(n){n.Sent="Sent",n.UploadProgress="UploadProgress",n.ResponseHeader="ResponseHeader",n.DownloadProgress="DownloadProgress",n.Response="Response",n.User="User"})(F||(F={}));var hr=class hr extends M{constructor(r,e){var t,i,o,a,h,f;super(r,e),this.interceptors=Array.from(new Set([...(e==null?void 0:e.interceptors)||[]])),this.defaults={...e==null?void 0:e.defaults,headers:((t=e==null?void 0:e.defaults)==null?void 0:t.headers)instanceof Headers?(i=e==null?void 0:e.defaults)==null?void 0:i.headers:new Headers((o=e==null?void 0:e.defaults)==null?void 0:o.headers),params:((a=e==null?void 0:e.defaults)==null?void 0:a.params)instanceof URLSearchParams?(h=e==null?void 0:e.defaults)==null?void 0:h.params:new URLSearchParams((f=e==null?void 0:e.defaults)==null?void 0:f.params)}}handle(r){return new Mr.Observable(e=>{(async()=>{let t=this.prepareRequest(r);if(t.body&&r.reportProgress){let l=t.body,c=t.headers.get("content-length")||"0",p=parseInt(c,10)||0,x=0,w=new TransformStream({transform(d,L){L.enqueue(d),x+=d.byteLength,e.next({type:F.UploadProgress,request:t,total:p,loaded:x})}});t=new Request(t.url,{cache:t.cache,credentials:t.credentials,headers:t.headers,integrity:t.integrity,keepalive:t.keepalive,method:t.method,mode:t.mode,redirect:t.redirect,referrer:t.referrer,referrerPolicy:t.referrerPolicy,signal:t.signal,body:l.pipeThrough(w),window:r.window,duplex:"half"})}let i=this.send(t);e.next({request:t,type:F.Sent});let o=await i,a=this.createResponse({url:o.url,headers:o.headers,status:o.status,statusText:o.statusText,hasBody:!!o.body});e.next({request:t,type:F.ResponseHeader,response:a});let h;if(o.body)if(r.reportProgress){let l=o.body,c=o.headers.get("content-length")||"0",p=parseInt(c,10)||0,x=0,w=new Response(new ReadableStream({async start(d){let L=l.getReader();for(;;){let{done:jr,value:yr}=await L.read();if(jr)break;x+=yr.byteLength,d.enqueue(yr),e.next({type:F.DownloadProgress,request:t,total:p,loaded:x})}d.close()}}));h=await this.parseBody(w)}else h=await this.parseBody(o);let f=this.createResponse({url:o.url,headers:o.headers,status:o.status,statusText:o.statusText,body:h});e.next({request:t,type:F.Response,response:f}),e.complete()})().catch(t=>e.error(t))})}send(r){return fetch(r)}prepareRequest(r){let e=r.headers||new Headers,t={...r,...(0,Dr.omit)(this.defaults,["headers","params"]),headers:e};this.defaults.headers.forEach((a,h)=>{e.has(h)||e.set(h,a)});let i=new URL(t.url,this.serviceUrl);this.defaults.params.size&&(this.defaults.params.forEach((a,h)=>{i.searchParams.has(h)||i.searchParams.set(h,a)}),t.url=i.toString());let o=t.body;if(o){let a="";typeof o=="string"||typeof o=="number"||typeof o=="boolean"?(a='text/plain; charset="UTF-8"',t.body=new Blob([String(o)],{type:a}),e.set("Content-Length",String(t.body.size)),delete t.duplex):(0,Nr.isReadableStreamLike)(o)?(a="application/octet-stream",t.duplex="half"):Buffer.isBuffer(o)?(a="application/octet-stream",e.set("Content-Length",String(o.length)),delete t.duplex):(0,G.isBlob)(o)?(a=o.type||"application/octet-stream",e.set("Content-Length",String(o.size)),delete t.duplex):((0,G.isFormData)(o)||(a='application/json;charset="UTF-8"',t.body=new Blob([JSON.stringify(o)],{type:a}),e.set("Content-Length",String(t.body.size))),delete t.duplex),a&&!e.has("Content-Type")&&e.set("Content-Type",a)}return new Request(i.toString(),t)}createResponse(r){return new N(r)}async parseBody(r){let e,t=r.headers.get("Content-Type")||"";if(Y.default.is(t,["json","application/*+json"]))e=await r.json(),typeof e=="string"&&(e=JSON.parse(e));else if(Y.default.is(t,["text"]))e=await r.text();else if(Y.default.is(t,["multipart"]))e=await r.formData();else{let i=await r.arrayBuffer();i.byteLength&&(e=i)}return e}};s(hr,"FetchBackend");var P=hr;var Hr=require("@opra/common");var Pr=V(require("@browsery/type-is"),1),qr=require("@opra/common"),q=require("rxjs");var fr=class fr{constructor(r,e){this.chain=r.reduceRight((t,i)=>(o,a)=>i.intercept(o,{handle:s(h=>t(h,a),"handle")}),ve),this.finalHandler=e}handle(r){return this.chain(r,e=>this.finalHandler.handle(e))}};s(fr,"HttpInterceptorHandler");var J=fr;function ve(n,r){return r(n)}s(ve,"chainEnd");var X=class X extends q.Observable{constructor(r,e){super(t=>{let i=this[B].observe;new J(r.interceptors||[],this[g]).handle(this[B]).subscribe({next(o){if(i===U.Events){t.next(o);return}if(i===U.ResponseHeader&&o.type===F.ResponseHeader){t.next(o.response),t.complete();return}if(o.type===F.Response){let{response:a}=o;if(i===U.Response){t.next(a),t.complete();return}let h=Pr.default.is(o.response.contentType||"",[qr.MimeTypes.opra_response_json]);if(a.status>=400&&a.status<600){t.error(new D({message:a.status+" "+a.statusText,status:a.status,issues:h?a.body.errors:void 0})),t.complete();return}t.next(o.response.body),t.complete()}},error(o){t.error(o)},complete(){t.complete()}})}),Object.defineProperty(this,g,{enumerable:!1,value:r}),Object.defineProperty(this,B,{enumerable:!1,value:{...e,observe:U.Body,headers:new Headers(e==null?void 0:e.headers)}})}clone(){return new X(this[g],this[B])}options(r){return Object.assign(this[B],r),this}header(r,e){let t=this[B].headers;return typeof r=="object"?((r instanceof Headers?r:new Headers(r)).forEach((o,a)=>{a.toLowerCase()==="set-cookie"?t.append(a,o):t.set(a,o)}),this):(e==null||e===""?t.delete(r):t.append(r,String(e)),this)}param(r,e){e&&typeof e=="object"&&(e=JSON.stringify(e));let t=this[B].url.searchParams;return typeof r=="object"?(typeof r.forEach=="function"?r.forEach((i,o)=>t.set(String(o),String(i))):Object.entries(r).forEach(i=>t.set(String(i[0]),String(i[1]))),this):(e==null?t.delete(r):t.set(r,String(e)),this)}observe(r){if(r===this[B].observe)return this;let e=this.clone();return e[B].observe=r||U.Body,e}getBody(){return(0,q.lastValueFrom)(this.observe(U.Body))}getResponse(){return(0,q.lastValueFrom)(this.observe(U.Response))}};s(X,"HttpRequestObservable");var H=X;var Ie=/^(\/*)(.+)/,pr=class pr{constructor(r){Object.defineProperty(this,g,{enumerable:!1,value:r})}get serviceUrl(){return this[g].serviceUrl}async fetchDocument(r){let e={},t=s(async o=>{let a=this.request("$schema",{headers:new Headers({accept:"application/json"})});o&&a.param("id",o);let h=await a.getBody().catch(f=>{throw f.message="Error fetching api schema from url ("+this.serviceUrl+`). `+f.message,f});if(h.references){let f=h.references;h.references={};for(let[l,c]of Object.entries(f)){if(e[c.id]===null)throw new Error("Circular reference detected");e[c.id]=null;let p=await t(c.id);h.references[l]=e[c.id]=p}}return h},"getDocument"),i=await t(r==null?void 0:r.documentId);return await Hr.ApiDocumentFactory.createDocument(i).catch(o=>{throw o.message=`Error loading api document. `+o.message,o})}request(r,e){var i;r=((i=Ie.exec(r))==null?void 0:i[2])||"";let t=new H(this[g],{...e,method:(e==null?void 0:e.method)||"GET",url:new URL(r,this.serviceUrl)});return e!=null&&e.params&&t.param(e.params),t}delete(r,e){return this.request(r,{...e,method:"DELETE"})}get(r,e){return this.request(r,{...e,method:"GET"})}patch(r,e,t){return this.request(r,{...t,method:"PATCH",body:e})}post(r,e,t){return this.request(r,{...t,method:"POST",body:e})}put(r,e,t){return this.request(r,{...t,method:"PUT",body:e})}};s(pr,"HttpClientBase");var _=pr;var lr=class lr extends _{constructor(r,e){super(new P(r,e))}get defaults(){return this[g].defaults}};s(lr,"OpraHttpClient");var cr=lr;function Te(n,...r){let e="",t;for(t=0;t<n.length;t++)e+=n[0]+encodeURIComponent(r[t]);return e}s(Te,"urlPath");globalThis.Buffer=_r.Buffer; /*! Bundled license information: ieee754/index.js: (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *) buffer/index.js: (*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT *) */