mirror of
https://github.com/gchq/CyberChef
synced 2025-03-13 21:36:56 +00:00
2 lines
2.1 MiB
JavaScript
2 lines
2.1 MiB
JavaScript
|
/*! For license information please see Code.js.LICENSE.txt */
|
||
|
(()=>{var e={26030:function(e,t,n){var r=n(48287).Buffer;!function(e){"use strict";const t=",".charCodeAt(0),n=";".charCodeAt(0),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=new Uint8Array(64),o=new Uint8Array(128);for(let e=0;e<64;e++){const t=i.charCodeAt(e);a[e]=t,o[t]=e}const s="undefined"!=typeof TextDecoder?new TextDecoder:void 0!==r?{decode:e=>r.from(e.buffer,e.byteOffset,e.byteLength).toString()}:{decode(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}};function l(e,t){const n=e.indexOf(";",t);return-1===n?e.length:n}function u(e,t,n,r){let i=0,a=0,s=0;do{const n=e.charCodeAt(t++);s=o[n],i|=(31&s)<<a,a+=5}while(32&s);const l=1&i;return i>>>=1,l&&(i=-2147483648|-i),n[r]+=i,t}function c(e,n,r){return!(n>=r)&&e.charCodeAt(n)!==t}function p(e){e.sort(d)}function d(e,t){return e[0]-t[0]}function _(e){const r=new Int32Array(5),i=16384,a=16348,o=new Uint8Array(i),l=o.subarray(0,a);let u=0,c="";for(let p=0;p<e.length;p++){const d=e[p];if(p>0&&(u===i&&(c+=s.decode(o),u=0),o[u++]=n),0!==d.length){r[0]=0;for(let e=0;e<d.length;e++){const n=d[e];u>a&&(c+=s.decode(l),o.copyWithin(0,a,u),u-=a),e>0&&(o[u++]=t),u=m(o,u,r,n,0),1!==n.length&&(u=m(o,u,r,n,1),u=m(o,u,r,n,2),u=m(o,u,r,n,3),4!==n.length&&(u=m(o,u,r,n,4)))}}}return c+s.decode(o.subarray(0,u))}function m(e,t,n,r,i){const o=r[i];let s=o-n[i];n[i]=o,s=s<0?-s<<1|1:s<<1;do{let n=31&s;s>>>=5,s>0&&(n|=32),e[t++]=a[n]}while(s>0);return t}const f=/^[\w+.-]+:\/\//,h=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,g=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function E(e){return e.startsWith("/")}function S(e){return/^[.?#]/.test(e)}function b(e){const t=h.exec(e);return D(t[1],t[2]||"",t[3],t[4]||"",t[5]||"/",t[6]||"",t[7]||"")}function D(e,t,n,r,i,a,o){return{scheme:e,user:t,host:n,port:r,path:i,query:a,hash:o,type:7}}function C(e){if(function(e){return e.startsWith("//")}(e)){const t=b("http:"+e);return t.scheme="",t.type=6,t}if(E(e)){const t=b("http://foo.com"+e);return t.scheme="",t.host="",t.type=5,t}if(function(e){return e.startsWith("file:")}(e))return function(e){const t=g.exec(e),n=t[2];return D("file:","",t[1]||"","",E(n)?n:"/"+n,t[3]||"",t[4]||"")}(e);if(function(e){return f.test(e)}(e))return b(e);const t=b("http://foo.com/"+e);return t.scheme="",t.host="",t.type=e?e.startsWith("?")?3:e.startsWith("#")?2:4:1,t}function y(e,t){const n=t<=4,r=e.path.split("/");let i=1,a=0,o=!1;for(let e=1;e<r.length;e++){const t=r[e];t?(o=!1,"."!==t&&(".."!==t?(r[i++]=t,a++):a?(o=!0,a--,i--):n&&(r[i++]=t))):o=!0}let s="";for(let e=1;e<i;e++)s+="/"+r[e];(!s||o&&!s.endsWith("/.."))&&(s+="/"),e.path=s}function A(e,t){if(!e&&!t)return"";const n=C(e);let r=n.type;if(t&&7!==r){const e=C(t),i=e.type;switch(r){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:!function(e,t){y(t,t.type),"/"===e.path?e.path=t.path:e.path=function(e){if(e.endsWith("/.."))return e;const t=e.lastIndexOf("/");return e.slice(0,t+1)}(t.path)+e.path}(n,e);case 5:n.user=e.user,n.host=e.host,n.port=e.port;case 6:n.scheme=e.scheme}i>r&&(r=i)}y(n,r);const i=n.query+n.hash;switch(r){case 2:case 3:return i;case 4:{const r=n.path.slice(1);return r?S(t||e)&&!S(r)?"./"+r+i:r+i:i||"."}case 5:return n.path+i;default:return n.scheme+"//"+n.user+n.host+n.port+n.path+i}}function v(e,t){return t&&!t.endsWith("/")&&(t+="/"),A(e,t)}function T(e,t){for(let n=t;n<e.length;n++)if(!R(e[n]))return n;return e.length}function R(e){for(let t=1;t<e.length;t++)if(e[t][0]<e[t-1][0])return!1;return!0}function N(e,t){return t||(e=e.slice()),e.sort(O)}function O(e,t){return e[0]-t[0]}let x=!1;function I(e,t,n){for(let r=n+1;r<e.length&&e[r][0]===t;n=r++);return n}function w(e,t,n){for(let r=n-1;r>=0&&e[r][0]===t;n=r--);return n}function F(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function k(e,t,n,r){const{lastKey:i,lastNeedle:a,lastIndex:o}=n;let s=0,l=e.length-1;if(r===i){if(t===a)return x=-1!==o&&e[o][0]===t,o;t>=a?s=-1===o?0:o:l=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=function(e,t,n,r){for(;n<=r;){const i=n+(r-n>>1),a=e[
|