PageSourceSearch

https://peakd.com/static/js/image-upload.d9cbfba3.js

js peakd.com collected 2026-10-01 12:00:17 UTC 11,074 bytes, 11 lines download raw bytes

1(self["webpackChunkpeakd"]=self["webpackChunkpeakd"]||[]).push([[6868],{23807:function(e){
2/*!
3 * Compressor.js v1.2.1
4 * https://fengyuanchen.github.io/compressorjs
5 *
6 * Copyright 2018-present Chen Fengyuan
7 * Released under the MIT license
8 *
9 * Date: 2023-02-28T14:09:41.732Z
10 */
11(function(t,r){e.exports=r()})(0,function(){"use strict";function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach(function(e){n(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,s(i.key),i)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(e,t,r){return t=s(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},o.apply(this,arguments)}function l(e,t){if("object"!==typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!==typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function s(e){var t=l(e,"string");return"symbol"===typeof t?t:String(t)}var c={exports:{}};(function(e){"undefined"!==typeof window&&function(t){var r=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,i=t.Blob&&function(){try{return Boolean(new Blob)}catch(e){return!1}}(),a=i&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(e){return!1}}(),n=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,o=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,l=(i||n)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(e){var t,r,l,s,c,u,f,h,d;if(t=e.match(o),!t)throw new Error("invalid data URI");for(r=t[2]?t[1]:"text/plain"+(t[3]||";charset=US-ASCII"),l=!!t[4],s=e.slice(t[0].length),c=l?atob(s):decodeURIComponent(s),u=new ArrayBuffer(c.length),f=new Uint8Array(u),h=0;h<c.length;h+=1)f[h]=c.charCodeAt(h);return i?new Blob([a?f:u],{type:r}):(d=new n,d.append(u),d.getBlob(r))};t.HTMLCanvasElement&&!r.toBlob&&(r.mozGetAsFile?r.toBlob=function(e,t,i){var a=this;setTimeout(function(){i&&r.toDataURL&&l?e(l(a.toDataURL(t,i))):e(a.mozGetAsFile("blob",t))})}:r.toDataURL&&l&&(r.msToBlob?r.toBlob=function(e,t,i){var a=this;setTimeout(function(){(t&&"image/png"!==t||i)&&r.toDataURL&&l?e(l(a.toDataURL(t,i))):e(a.msToBlob(t))})}:r.toBlob=function(e,t,r){var i=this;setTimeout(function(){e(l(i.toDataURL(t,r)))})})),e.exports?e.exports=l:t.dataURLtoBlob=l}(window)})(c);var u=c.exports,f=function(e){return"undefined"!==typeof Blob&&(e instanceof Blob||"[object Blob]"===Object.prototype.toString.call(e))},h={strict:!0,checkOrientation:!0,retainExif:!1,maxWidth:1/0,maxHeight:1/0,minWidth:0,minHeight:0,width:void 0,height:void 0,resize:"none",quality:.8,mimeType:"auto",convertTypes:["image/png"],convertSize:5e6,beforeDraw:null,drew:null,success:null,error:null},d="undefined"!==typeof window&&"undefined"!==typeof window.document,b=d?window:{},p=function(e){return e>0&&e<1/0},m=Array.prototype.slice;function v(e){return Array.from?Array.from(e):m.call(e)}var g=/^image\/.+$/;function w(e){return g.test(e)}function y(e){var t=w(e)?e.substr(6):"";return"jpeg"===t&&(t="jpg"),".".concat(t)}var B=String.fromCharCode;function U(e,t,r){var i,a="";for(r+=t,i=t;i<r;i+=1)a+=B(e.getUint8(i));return a}var O=b.btoa;function j(e,t){var r=[],i=8192,a=new Uint8Array(e);while(a.length>0)r.push(B.apply(null,v(a.subarray(0,i)))),a=a.subarray(i);return"data:".concat(t,";base64,").concat(O(r.join("")))}function x(e){var t,r=new DataView(e);try{var i,a,n;if(255===r.getUint8(0)&&216===r.getUint8(1)){var o=r.byteLength,l=2;while(l+1<o){if(255===r.getUint8(l)&&225===r.getUint8(l+1)){a=l;break}l+=1}}if(a){var s=a+4,c=a+10;if("Exif"===U(r,s,4)){var u=r.getUint16(c);if(i=18761===u,(i||19789===u)&&42===r.getUint16(c+2,i)){var f=r.getUint32(c+4,i);f>=8&&(n=c+f)}}}if(n){var h,d,b=r.getUint16(n,i);for(d=0;d<b;d+=1)if(h=n+12*d+2,274===r.getUint16(h,i)){h+=8,t=r.getUint16(h,i),r.setUint16(h,1,i);break}}}catch(p){t=1}return t}function k(e){var t=0,r=1,i=1;switch(e){case 2:r=-1;break;case 3:t=-180;break;case 4:i=-1;break;case 5:t=90,i=-1;break;case 6:t=90;break;case 7:t=90,r=-1;break;case 8:t=-90;break}return{rotate:t,scaleX:r,scaleY:i}}var A=/\.\d*(?:0|9){12}\d*$/;function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return A.test(e)?Math.round(e*t)/t:e}function T(e){var t=e.aspectRatio,r=e.height,i=e.width,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",n=p(i),o=p(r);if(n&&o){var l=r*t;("contain"===a||"none"===a)&&l>i||"cover"===a&&l<i?r=i/t:i=r*t}else n?r=i/t:o&&(i=r*t);return{width:i,height:r}}
11function E(e){var t=v(new Uint8Array(e)),r=t.length,i=[],a=0;while(a+3<r){var n=t[a],o=t[a+1];if(255===n&&218===o)break;if(255===n&&216===o)a+=2;else{var l=256*t[a+2]+t[a+3],s=a+l+2,c=t.slice(a,s);i.push(c),a=s}}return i.reduce(function(e,t){return 255===t[0]&&225===t[1]?e.concat(t):e},[])}function M(e,t){var r=v(new Uint8Array(e));if(255!==r[2]||224!==r[3])return e;var i=256*r[4]+r[5],a=[255,216].concat(t,r.slice(4+i));return new Uint8Array(a)}var D=b.ArrayBuffer,L=b.FileReader,P=b.URL||b.webkitURL,C=/\.\w+$/,z=b.Compressor,H=function(){function e(i,a){r(this,e),this.file=i,this.exif=[],this.image=new Image,this.options=t(t({},h),a),this.aborted=!1,this.result=null,this.init()}return a(e,[{key:"init",value:function(){var e=this,t=this.file,r=this.options;if(f(t)){var i=t.type;if(w(i))if(P&&L){D||(r.checkOrientation=!1,r.retainExif=!1);var a="image/jpeg"===i,n=a&&r.checkOrientation,l=a&&r.retainExif;if(!P||n||l){var s=new L;this.reader=s,s.onload=function(r){var a=r.target,s=a.result,c={},u=1;n&&(u=x(s),u>1&&o(c,k(u))),l&&(e.exif=E(s)),c.url=n||l?!P||u>1?j(s,i):P.createObjectURL(t):s,e.load(c)},s.onabort=function(){e.fail(new Error("Aborted to read the image with FileReader."))},s.onerror=function(){e.fail(new Error("Failed to read the image with FileReader."))},s.onloadend=function(){e.reader=null},n||l?s.readAsArrayBuffer(t):s.readAsDataURL(t)}else this.load({url:P.createObjectURL(t)})}else this.fail(new Error("The current browser does not support image compression."));else this.fail(new Error("The first argument must be an image File or Blob object."))}else this.fail(new Error("The first argument must be a File or Blob object."))}},{key:"load",value:function(e){var r=this,i=this.file,a=this.image;a.onload=function(){r.draw(t(t({},e),{},{naturalWidth:a.naturalWidth,naturalHeight:a.naturalHeight}))},a.onabort=function(){r.fail(new Error("Aborted to load the image."))},a.onerror=function(){r.fail(new Error("Failed to load the image."))},b.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(b.navigator.userAgent)&&(a.crossOrigin="anonymous"),a.alt=i.name,a.src=e.url}},{key:"draw",value:function(e){var t=this,r=e.naturalWidth,i=e.naturalHeight,a=e.rotate,n=void 0===a?0:a,o=e.scaleX,l=void 0===o?1:o,s=e.scaleY,c=void 0===s?1:s,f=this.file,h=this.image,d=this.options,b=document.createElement("canvas"),m=b.getContext("2d"),v=Math.abs(n)%180===90,g=("contain"===d.resize||"cover"===d.resize)&&p(d.width)&&p(d.height),y=Math.max(d.maxWidth,0)||1/0,B=Math.max(d.maxHeight,0)||1/0,U=Math.max(d.minWidth,0)||0,O=Math.max(d.minHeight,0)||0,x=r/i,k=d.width,A=d.height;if(v){var E=[B,y];y=E[0],B=E[1];var D=[O,U];U=D[0],O=D[1];var P=[A,k];k=P[0],A=P[1]}g&&(x=k/A);var C=T({aspectRatio:x,width:y,height:B},"contain");y=C.width,B=C.height;var z=T({aspectRatio:x,width:U,height:O},"cover");if(U=z.width,O=z.height,g){var H=T({aspectRatio:x,width:k,height:A},d.resize);k=H.width,A=H.height}else{var F=T({aspectRatio:x,width:k,height:A}),S=F.width;k=void 0===S?r:S;var W=F.height;A=void 0===W?i:W}k=Math.floor(R(Math.min(Math.max(k,U),y))),A=Math.floor(R(Math.min(Math.max(A,O),B)));var I=-k/2,q=-A/2,$=k,G=A,K=[];if(g){var X=0,Y=0,N=r,V=i,J=T({aspectRatio:x,width:r,height:i},{contain:"cover",cover:"contain"}[d.resize]);N=J.width,V=J.height,X=(r-N)/2,Y=(i-V)/2,K.push(X,Y,N,V)}if(K.push(I,q,$,G),v){var Q=[A,k];k=Q[0],A=Q[1]}b.width=k,b.height=A,w(d.mimeType)||(d.mimeType=f.type);var Z="transparent";f.size>d.convertSize&&d.convertTypes.indexOf(d.mimeType)>=0&&(d.mimeType="image/jpeg");var _="image/jpeg"===d.mimeType;if(_&&(Z="#fff"),m.fillStyle=Z,m.fillRect(0,0,k,A),d.beforeDraw&&d.beforeDraw.call(this,m,b),!this.aborted&&(m.save(),m.translate(k/2,A/2),m.rotate(n*Math.PI/180),m.scale(l,c),m.drawImage.apply(m,[h].concat(K)),m.restore(),d.drew&&d.drew.call(this,m,b),!this.aborted)){var ee=function(e){if(!t.aborted){var a=function(e){return t.done({naturalWidth:r,naturalHeight:i,result:e})};if(e&&_&&d.retainExif&&t.exif&&t.exif.length>0){var n=function(e){return a(u(j(M(e,t.exif),d.mimeType)))};if(e.arrayBuffer)e.arrayBuffer().then(n).catch(function(){t.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."))});else{var o=new L;t.reader=o,o.onload=function(e){var t=e.target;n(t.result)},o.onabort=function(){t.fail(new Error("Aborted to read the compressed image with FileReader."))},o.onerror=function(){t.fail(new Error("Failed to read the compressed image with FileReader."))},o.onloadend=function(){t.reader=null},o.readAsArrayBuffer(e)}}else a(e)}};b.toBlob?b.toBlob(ee,d.mimeType,d.quality):ee(u(b.toDataURL(d.mimeType,d.quality)))}}}
vendor: 992 bytes, line 11
11,{key:"done",value:function(e){var t=e.naturalWidth,r=e.naturalHeight,i=e.result,a=this.file,n=this.image,o=this.options;if(P&&0===n.src.indexOf("blob:")&&P.revokeObjectURL(n.src),i)if(o.strict&&!o.retainExif&&i.size>a.size&&o.mimeType===a.type&&!(o.width>t||o.height>r||o.minWidth>t||o.minHeight>r||o.maxWidth<t||o.maxHeight<r))i=a;else{var l=new Date;i.lastModified=l.getTime(),i.lastModifiedDate=l,i.name=a.name,i.name&&i.type!==a.type&&(i.name=i.name.replace(C,y(i.type)))}else i=a;this.result=i,o.success&&o.success.call(this,i)}},{key:"fail",value:function(e){var t=this.options;if(!t.error)throw e;t.error.call(this,e)}},{key:"abort",value:function(){this.aborted||(this.aborted=!0,this.reader?this.reader.abort():this.image.complete?this.fail(new Error("The compression process has been aborted.")):(this.image.onload=null,this.image.onabort()))}}],[{key:"noConflict",value:function(){return window.Compressor=z,e}},{key:"setDefaults",value:function(e){o(h,e)}}]),e}();return H})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.