PageSourceSearch

https://www.chulabook.com/_next/static/chunks/pages/blog/writer/profile-4f2aceb51c1a193f3b46.js

js chulabook.com collected 2026-09-24 09:35:55 UTC 28,283 bytes, 1 lines download raw bytes

1_N_E=(window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[81],{"94Hj":function(e,t,n){"use strict";var o=n("q1tI"),r=n.n(o),i=n("Nm0s"),a=r.a.createElement;t.a=function(e){var t=e.loading,n=e._click,o=e._name,s=e._class,c=e._type,u=e.disabled,p=e.name,l=e.value;return a(r.a.Fragment,null,a("button",{type:c,className:s,disabled:u||t,name:p,value:l,onClick:n},t?a(i.BeatLoader,{size:10,color:"#FFF",loading:t}):o))}},"LqI/":function(e,t,n){!function(e){"use strict";var t;(t=e.Orientation||(e.Orientation={}))[t.TOP_LEFT=1]="TOP_LEFT",t[t.TOP_RIGHT=2]="TOP_RIGHT",t[t.BOTTOM_RIGHT=3]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=4]="BOTTOM_LEFT",t[t.LEFT_TOP=5]="LEFT_TOP",t[t.RIGHT_TOP=6]="RIGHT_TOP",t[t.RIGHT_BOTTOM=7]="RIGHT_BOTTOM",t[t.LEFT_BOTTOM=8]="LEFT_BOTTOM";const n=new WeakMap;function o(e,t,o){return e instanceof Blob?new Promise((r,i)=>{let a=n.get(e);a||(a=new FileReader,n.set(e,a)),a.onerror=e=>{a.onerror=null,a.onload=null,i(e)},a.onload=()=>{a.onerror=null,a.onload=null,r(a.result)},a.readAsArrayBuffer(e.slice(t,t+o))}):Promise.resolve(e.slice(t,t+o))}e.getOrientation=function(t){return n=this,r=void 0,a=function*(){if(!(t instanceof ArrayBuffer||t instanceof Blob))throw new TypeError("Unexpected input type");let n=0;const r=function(e){return e instanceof Blob?e.size:e.byteLength}(t);{const i=yield o(t,n,4);n+=i.byteLength;const a=new DataView(i),s=a.getUint16(0),c=a.getUint16(2);if(65496===s){let a=i.slice(2);do{const r=new DataView(a).getUint16(0);if(65505===r){const e=yield o(t,n,8),r=new DataView(e);if(17784===r.getUint16(2)&&26982===r.getUint16(4)&&0===r.getUint16(6)){n+=e.byteLength;break}n+=r.getUint16(0)}else{if(!(65504<=r&&r<=65519))return e.Orientation.TOP_LEFT;{const e=yield o(t,n,2);n+=e.byteLength,n+=new DataView(e).getUint16(0)-2}}a=yield o(t,n,2),n+=a.byteLength}while(n<r)}else{if(!(18761===s&&10752===c||19789===s&&42===c))return e.Orientation.TOP_LEFT;n=0}}const i=yield o(t,n,8),a=new DataView(i),s=18761===a.getUint16(0);n+=a.getUint32(4,s);const c=yield o(t,n,2);n+=c.byteLength;let u=new DataView(c).getUint16(0,s);for(;u-- >0;){const e=yield o(t,n,12);if(n+=e.byteLength,274===new DataView(e).getUint16(0,s)){const t=new DataView(e.slice(8,12)).getUint16(0,s);if(1<=t&&t<=8)return t;throw new Error("Unexpected Orientation Value")}}return e.Orientation.TOP_LEFT},new((i=void 0)||(i=Promise))((function(e,t){function o(e){try{c(a.next(e))}catch(n){t(n)}}function s(e){try{c(a.throw(e))}catch(n){t(n)}}function c(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(o,s)}c((a=a.apply(n,r||[])).next())}));var n,r,i,a},Object.defineProperty(e,"__esModule",{value:!0})}(t)},OIoI:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return Y}));var o=n("o0o1"),r=n.n(o),i=n("HaE+"),a=n("q1tI"),s=n.n(a),c=n("snKq"),u=n("6MiF"),p=n("z05O"),l=n("rePB"),h=n("TSYQ"),d=n.n(h),m=s.a.createElement,f=function(e){e.show,e._name;var t=e._text,n=e._id,o=e._img,r=(e.index,e.setIndex,e.idx,e.chkImg),i=e.onAction,c=e.onChange,u=Object(a.useState)(o||null),p=u[0],l=(u[1],function(){i&&i(!0),c&&c(!0)});return m(s.a.Fragment,null,p?m("div",{className:"box-img circle text-center",onClick:l},m("label",{htmlFor:n,className:"img-box show mb-0"},m("img",{src:p,className:"middle"}),m("div",{className:"dropbox"}),m("div",{className:"middle-absolute"},m("i",{className:"fas fa-pen-square"}))),m("p",null,t," ","\u0e20\u0e32\u0e1e\u0e1b\u0e01"==t?m("span",{className:"text-danger"},"*"):"")):m("div",{className:"box-img circle text-center",onClick:l},m("label",{htmlFor:n,className:d()("img-box mb-0",r&&"img-required")},m("img",{src:"/icon/icon-add.svg",className:"middle"})),m("p",{className:d()(r&&"text-required")},t," ","\u0e20\u0e32\u0e1e\u0e1b\u0e01"==t?m("span",{className:"text-danger"},"*"):"")))},g=n("nOHt"),v=n.n(g),w=n("zM5D"),b=n("5wIu"),y=function(e,t){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};var S=function(){return(S=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.create;Object.create;function x(e,t,n,o,r){void 0===r&&(r=0);var i=z(t.width,t.height,r),a=i.width,s=i.height;return{x:_(e.x,a,n.width,o),y:_(e.y,s,n.height,o)}}function _(e,t,n,o){var r=t*o/2-n/2;return Math.min(r,Math.max(e,-r))}function O(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function C(e,t){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI}function E(e,t){return Math.min(e,Math.max(0,t))}function P(e,t){return t}function T(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function M(e,t,n,o,r){var i=Math.cos,a=Math.sin,s=r*Math.PI/180;return[(e-n)*i(s)-(t-o)*a(s)+n,(e-n)*a(s)+(t-o)*i(s)+o]}function z(e,t,n){var o=e/2,r=t/2,i=[M(0,0,o,r,n),M(e,0,o,r,n),M(e,t,o,r,n),M(0,t,o,r,n)],a=Math.min.apply(Math,i.map((function(e){return e[0]}))),s=Math.max.apply(Math,i.map((function(e){return e[0]}))),c=Math.min.apply(Math,i.map((function(e){return e[1]})));return{width:s-a,height:Math.max.apply(Math,i.map((function(e){return e[1]})))-c}}function R(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter((function(e){return"string"===typeof e&&e.length>0})).join(" ").trim()}var j=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;
1return n.imageRef=null,n.videoRef=null,n.containerRef=null,n.styleRef=null,n.containerRect=null,n.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},n.dragStartPosition={x:0,y:0},n.dragStartCrop={x:0,y:0},n.lastPinchDistance=0,n.lastPinchRotation=0,n.rafDragTimeout=null,n.rafPinchTimeout=null,n.wheelTimer=null,n.state={cropSize:null,hasWheelJustStarted:!1},n.preventZoomSafari=function(e){return e.preventDefault()},n.cleanEvents=function(){document.removeEventListener("mousemove",n.onMouseMove),document.removeEventListener("mouseup",n.onDragStopped),document.removeEventListener("touchmove",n.onTouchMove),document.removeEventListener("touchend",n.onDragStopped)},n.clearScrollEvent=function(){n.containerRef&&n.containerRef.removeEventListener("wheel",n.onWheel),n.wheelTimer&&clearTimeout(n.wheelTimer)},n.onMediaLoad=function(){n.computeSizes(),n.emitCropData(),n.setInitialCrop(),n.props.onMediaLoaded&&n.props.onMediaLoaded(n.mediaSize)},n.setInitialCrop=function(){var e=n.props,t=e.initialCroppedAreaPixels,o=e.cropSize;if(t){var r=function(e,t,n){var o=t.width/t.naturalWidth,r=function(e,t,n){var o=t.width/t.naturalWidth;if(n)return n.height>n.width?n.height/o/e.height:n.width/o/e.width;var r=e.width/e.height;return t.naturalWidth>=t.naturalHeight*r?t.naturalHeight/e.height:t.naturalWidth/e.width}(e,t,n),i=o*r;return{crop:{x:((t.naturalWidth-e.width)/2-e.x)*i,y:((t.naturalHeight-e.height)/2-e.y)*i},zoom:r}}(t,n.mediaSize,o),i=r.crop,a=r.zoom;n.props.onCropChange(i),n.props.onZoomChange&&n.props.onZoomChange(a)}},n.computeSizes=function(){var e,t,o,r,i,a,s=n.imageRef||n.videoRef;if(s&&n.containerRef){n.containerRect=n.containerRef.getBoundingClientRect(),n.mediaSize={width:s.offsetWidth,height:s.offsetHeight,naturalWidth:(null===(e=n.imageRef)||void 0===e?void 0:e.naturalWidth)||(null===(t=n.videoRef)||void 0===t?void 0:t.videoWidth)||0,naturalHeight:(null===(o=n.imageRef)||void 0===o?void 0:o.naturalHeight)||(null===(r=n.videoRef)||void 0===r?void 0:r.videoHeight)||0};var c=n.props.cropSize?n.props.cropSize:function(e,t,n,o,r,i){void 0===i&&(i=0);var a=z(e,t,i),s=a.width,c=a.height,u=Math.min(s,n),p=Math.min(c,o);return u>p*r?{width:p*r,height:p}:{width:u,height:u/r}}(s.offsetWidth,s.offsetHeight,n.containerRect.width,n.containerRect.height,n.props.aspect,n.props.rotation);(null===(i=n.state.cropSize)||void 0===i?void 0:i.height)===c.height&&(null===(a=n.state.cropSize)||void 0===a?void 0:a.width)===c.width||n.props.onCropSizeChange&&n.props.onCropSizeChange(c),n.setState({cropSize:c},n.recomputeCropPosition)}},n.onMouseDown=function(e){e.preventDefault(),document.addEventListener("mousemove",n.onMouseMove),document.addEventListener("mouseup",n.onDragStopped),n.onDragStart(t.getMousePoint(e))},n.onMouseMove=function(e){return n.onDrag(t.getMousePoint(e))},n.onTouchStart=function(e){e.preventDefault(),document.addEventListener("touchmove",n.onTouchMove,{passive:!1}),document.addEventListener("touchend",n.onDragStopped),2===e.touches.length?n.onPinchStart(e):1===e.touches.length&&n.onDragStart(t.getTouchPoint(e.touches[0]))},n.onTouchMove=function(e){e.preventDefault(),2===e.touches.length?n.onPinchMove(e):1===e.touches.length&&n.onDrag(t.getTouchPoint(e.touches[0]))},n.onDragStart=function(e){var t,o,r=e.x,i=e.y;n.dragStartPosition={x:r,y:i},n.dragStartCrop=S({},n.props.crop),null===(o=(t=n.props).onInteractionStart)||void 0===o||o.call(t)},n.onDrag=function(e){var t=e.x,o=e.y;n.rafDragTimeout&&window.cancelAnimationFrame(n.rafDragTimeout),n.rafDragTimeout=window.requestAnimationFrame((function(){if(n.state.cropSize&&void 0!==t&&void 0!==o){var e=t-n.dragStartPosition.x,r=o-n.dragStartPosition.y,i={x:n.dragStartCrop.x+e,y:n.dragStartCrop.y+r},a=n.props.restrictPosition?x(i,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):i;n.props.onCropChange(a)}}))},n.onDragStopped=function(){var e,t;n.cleanEvents(),n.emitCropData(),null===(t=(e=n.props).onInteractionEnd)||void 0===t||t.call(e)},n.onWheel=function(e){e.preventDefault();var o=t.getMousePoint(e),r=n.props.zoom-e.deltaY*n.props.zoomSpeed/200;n.setNewZoom(r,o),n.state.hasWheelJustStarted||n.setState({hasWheelJustStarted:!0},(function(){var e,t;return null===(t=(e=n.props).onInteractionStart)||void 0===t?void 0:t.call(e)})),n.wheelTimer&&clearTimeout(n.wheelTimer),n.wheelTimer=window.setTimeout((function(){return n.setState({hasWheelJustStarted:!1},(function(){var e,t;return null===(t=(e=n.props).onInteractionEnd)||void 0===t?void 0:t.call(e)}))}),250)},n.getPointOnContainer=function(e){var t=e.x,o=e.y;if(!n.containerRect)throw new Error("The Cropper is not mounted");return{x:n.containerRect.width/2-(t-n.containerRect.left),y:n.containerRect.height/2-(o-n.containerRect.top)}},n.getPointOnMedia=function(e){var t=e.x,o=e.y,r=n.props,i=r.crop,a=r.zoom;return{x:(t+i.x)/a,y:(o+i.y)/a}},n.setNewZoom=function(e,t){if(n.state.cropSize&&n.props.onZoomChange){var o=n.getPointOnContainer(t),r=n.getPointOnMedia(o),i=Math.min(n.props.maxZoom,Math.max(e,n.props.minZoom)),a={x:r.x*i-o.x,y:r.y*i-o.y},s=n.props.restrictPosition?x(a,n.mediaSize,n.state.cropSize,i,n.props.rotation):a;n.props.onCropChange(s),n.props.onZoomChange(i)}},n.emitCropData=function(){if(n.state.cropSize){var e=function(e,t,n,o,r,i,a){void 0===i&&(i=0),void 0===a&&(a=!0);var s=a&&0===i?E:P,c={x:s(100,((t.width-n.width/r)/2-e.x/r)/t.width*100),y:s(100,((t.height-n.height/r)/2-e.y/r)/t.height*100),width:s(100,n.width/t.width*100/r),height:s(100,n.height/t.height*100/r)}
1,u=Math.round(s(t.naturalWidth,c.width*t.naturalWidth/100)),p=Math.round(s(t.naturalHeight,c.height*t.naturalHeight/100)),l=t.naturalWidth>=t.naturalHeight*o?{width:Math.round(p*o),height:p}:{width:u,height:Math.round(u/o)};return{croppedAreaPercentages:c,croppedAreaPixels:S(S({},l),{x:Math.round(s(t.naturalWidth-l.width,c.x*t.naturalWidth/100)),y:Math.round(s(t.naturalHeight-l.height,c.y*t.naturalHeight/100))})}}(n.props.restrictPosition?x(n.props.crop,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):n.props.crop,n.mediaSize,n.state.cropSize,n.getAspect(),n.props.zoom,n.props.rotation,n.props.restrictPosition),t=e.croppedAreaPercentages,o=e.croppedAreaPixels;n.props.onCropComplete&&n.props.onCropComplete(t,o)}},n.recomputeCropPosition=function(){if(n.state.cropSize){var e=n.props.restrictPosition?x(n.props.crop,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):n.props.crop;n.props.onCropChange(e),n.emitCropData()}},n}return function(e,t){function n(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.componentDidMount=function(){window.addEventListener("resize",this.computeSizes),this.containerRef&&(this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.preventZoomSafari),this.containerRef.addEventListener("gesturechange",this.preventZoomSafari)),this.props.disableAutomaticStylesInjection||(this.styleRef=document.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.styleRef.innerHTML=".reactEasyCrop_Container {\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  overflow: hidden;\n  user-select: none;\n  touch-action: none;\n  cursor: move;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n  max-width: 100%;\n  max-height: 100%;\n  margin: auto;\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  left: 0;\n  right: 0;\n  will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_CropArea {\n  position: absolute;\n  left: 50%;\n  top: 50%;\n  transform: translate(-50%, -50%);\n  border: 1px solid rgba(255, 255, 255, 0.5);\n  box-sizing: border-box;\n  box-shadow: 0 0 0 9999em;\n  color: rgba(0, 0, 0, 0.5);\n  overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n  border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n  content: ' ';\n  box-sizing: border-box;\n  position: absolute;\n  border: 1px solid rgba(255, 255, 255, 0.5);\n  top: 0;\n  bottom: 0;\n  left: 33.33%;\n  right: 33.33%;\n  border-top: 0;\n  border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n  content: ' ';\n  box-sizing: border-box;\n  position: absolute;\n  border: 1px solid rgba(255, 255, 255, 0.5);\n  top: 33.33%;\n  bottom: 33.33%;\n  left: 0;\n  right: 0;\n  border-left: 0;\n  border-right: 0;\n}\n",document.head.appendChild(this.styleRef)),this.imageRef&&this.imageRef.complete&&this.onMediaLoad()},t.prototype.componentWillUnmount=function(){window.removeEventListener("resize",this.computeSizes),this.containerRef&&(this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.containerRef.removeEventListener("gesturechange",this.preventZoomSafari)),this.styleRef&&this.styleRef.remove(),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent()},t.prototype.componentDidUpdate=function(e){var t,n,o,r;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():(null===(t=e.cropSize)||void 0===t?void 0:t.height)===(null===(n=this.props.cropSize)||void 0===n?void 0:n.height)&&(null===(o=e.cropSize)||void 0===o?void 0:o.width)===(null===(r=this.props.cropSize)||void 0===r?void 0:r.width)||this.computeSizes(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent())},t.prototype.getAspect=function(){var e=this.props,t=e.cropSize,n=e.aspect;return t?t.width/t.height:n},t.prototype.onPinchStart=function(e){var n=t.getTouchPoint(e.touches[0]),o=t.getTouchPoint(e.touches[1]);this.lastPinchDistance=O(n,o),this.lastPinchRotation=C(n,o),this.onDragStart(T(n,o))},t.prototype.onPinchMove=function(e){var n=this,o=t.getTouchPoint(e.touches[0]),r
1=t.getTouchPoint(e.touches[1]),i=T(o,r);this.onDrag(i),this.rafPinchTimeout&&window.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=window.requestAnimationFrame((function(){var e=O(o,r),t=n.props.zoom*(e/n.lastPinchDistance);n.setNewZoom(t,i),n.lastPinchDistance=e;var a=C(o,r),s=n.props.rotation+(a-n.lastPinchRotation);n.props.onRotationChange&&n.props.onRotationChange(s),n.lastPinchRotation=a}))},t.prototype.render=function(){var e=this,t=this.props,n=t.image,o=t.video,r=t.mediaProps,i=t.transform,a=t.crop,c=a.x,u=a.y,p=t.rotation,l=t.zoom,h=t.cropShape,d=t.showGrid,m=t.style,f=m.containerStyle,g=m.cropAreaStyle,v=m.mediaStyle,w=t.classes,b=w.containerClassName,y=w.cropAreaClassName,x=w.mediaClassName;return s.a.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(t){return e.containerRef=t},"data-testid":"container",style:f,className:R("reactEasyCrop_Container",b)},n?s.a.createElement("img",S({alt:"",className:R("reactEasyCrop_Image",x)},r,{src:n,ref:function(t){return e.imageRef=t},style:S(S({},v),{transform:i||"translate("+c+"px, "+u+"px) rotate("+p+"deg) scale("+l+")"}),onLoad:this.onMediaLoad})):o&&s.a.createElement("video",S({autoPlay:!0,loop:!0,muted:!0,className:R("reactEasyCrop_Video",x)},r,{src:o,ref:function(t){return e.videoRef=t},onLoadedMetadata:this.onMediaLoad,style:S(S({},v),{transform:i||"translate("+c+"px, "+u+"px) rotate("+p+"deg) scale("+l+")"}),controls:!1})),this.state.cropSize&&s.a.createElement("div",{style:S(S({},g),{width:this.state.cropSize.width,height:this.state.cropSize.height}),"data-testid":"cropper",className:R("reactEasyCrop_CropArea","round"===h&&"reactEasyCrop_CropAreaRound",d&&"reactEasyCrop_CropAreaGrid",y)}))},t.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:3,minZoom:1,cropShape:"rect",showGrid:!0,style:{},classes:{},mediaProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0},t.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t}(s.a.Component),N=n("LqI/"),L=function(e){return new Promise((function(t,n){var o=new Image;o.addEventListener("load",(function(){return t(o)})),o.addEventListener("error",(function(e){return n(e)})),o.setAttribute("crossOrigin","anonymous"),o.src=e}))};function D(e){return e*Math.PI/180}function k(e,t){return I.apply(this,arguments)}function I(){return(I=Object(i.a)(r.a.mark((function e(t,n){var o,i,a,s,c,u,p,l=arguments;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=l.length>2&&void 0!==l[2]?l[2]:0,e.next=3,L(t);case 3:return i=e.sent,a=document.createElement("canvas"),s=a.getContext("2d"),c=Math.max(i.width,i.height),u=c/2*Math.sqrt(2)*2,a.width=u,a.height=u,s.translate(u/2,u/2),s.rotate(D(o)),s.translate(-u/2,-u/2),s.drawImage(i,u/2-.5*i.width,u/2-.5*i.height),p=s.getImageData(0,0,u,u),a.width=n.width,a.height=n.height,s.putImageData(p,Math.round(0-u/2+.5*i.width-n.x),Math.round(0-u/2+.5*i.height-n.y)),e.abrupt("return",new Promise((function(e){a.toBlob((function(t){e(URL.createObjectURL(t))}),"image/jpeg")})));case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(e){return W.apply(this,arguments)}function W(){return(W=Object(i.a)(r.a.mark((function e(t){var n,o,i,a,s=arguments;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:0,e.next=3,L(t);case 3:return o=e.sent,i=document.createElement("canvas"),a=i.getContext("2d"),90===n||-90===n||270===n||-270===n?(i.width=o.height,i.height=o.width):(i.width=o.width,i.height=o.height),a.translate(i.width/2,i.height/2),a.rotate(n*Math.PI/180),a.drawImage(o,-o.width/2,-o.height/2),e.abrupt("return",new Promise((function(e){i.toBlob((function(t){e(URL.createObjectURL(t))}),"image/jpeg")})));case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var H=s.a.createElement;function F(e){return new Promise((function(t){var n=new FileReader;n.addEventListener("load",(function(){return t(n.result)}),!1),n.readAsDataURL(e)}))}var B=function(e){var t=e.show,n=e.onHide,o=e.size,s=e.onSubmit,c=e._img,u=e.onAction,p=Object(a.useState)("/images/no-picture.png"),l=(p[0],p[1],Object(a.useState)(null)),h=l[0],d=l[1],m=Object(a.useState)({x:0,y:0}),f=m[0],g=m[1],v=Object(a.useState)(1),y=v[0],S=v[1],x=Object(a.useState)(1),_=x[0],O
1=(x[1],Object(a.useState)(null)),C=O[0],E=O[1],P=Object(a.useState)(null),T=(P[0],P[1]),M=Object(a.useState)(0),z=M[0],R=M[1],L={3:180,6:90,8:-90};Object(a.useEffect)((function(){d(c||null)}),[c]);var D=function(){var e=Object(i.a)(r.a.mark((function e(){return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(h){e.next=2;break}return e.abrupt("return",alert("No file select"));case 2:return e.next=4,W();case 4:return e.next=6,n();case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),I=function(){var e=Object(i.a)(r.a.mark((function e(t){var n,o,i,a;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.target.files&&t.target.files.length>0)){e.next=14;break}return n=t.target.files[0],e.next=4,F(n);case 4:return o=e.sent,e.next=7,Object(N.getOrientation)(n);case 7:if(i=e.sent,!(a=L[i])){e.next=13;break}return e.next=12,A(o,a);case 12:o=e.sent;case 13:d(o);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),W=function(){var e=Object(i.a)(r.a.mark((function e(){var t,n;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k(h,C,z);case 2:return t=e.sent,T(t),e.next=6,fetch(t).then((function(e){return e.blob()})).then((function(e){return new File([e],"images_profile.jpg",{type:"image/jpeg"})}));case 6:n=e.sent,s&&s(n,t),u&&u(!0);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return H(w.a,{className:"modal-alert",centered:!0,show:t,onHide:n,size:o},H(w.a.Body,null,H("div",{className:"py-5"},H("div",{className:"row justify-content-center"},H("div",{className:"col-6"},H("div",{className:"form-group"},H("div",{className:"default-picture"},H("div",null,h?H("div",{className:"crop-container"},H(j,{image:h,crop:f,zoom:y,aspect:_,cropShape:"round",showGrid:!1,onCropChange:function(e){g(e)},onRotationChange:R,onCropComplete:function(e,t){console.log(e,t),E(t)},onZoomChange:function(e){S({zoom:e})}})):H("img",{src:"/images/no-picture.png",className:"mw-100 w-auto"})))))),H("div",{className:"row justify-content-center"},H("div",{className:"col-6"},H("label",{className:"mt-3"},"\u0e44\u0e1f\u0e25\u0e4c"),H("input",{type:"file",className:"form-control",onChange:I,accept:"image/*"}))),H("div",{className:"row justify-content-center mt-4"},H("div",{className:"text-center"},H(b.a,{_type:"button",_class:"btn-outline-primary",_name:"\u0e22\u0e01\u0e40\u0e25\u0e34\u0e01",_click:n}),H(b.a,{_type:"button",_class:"btn-primary ml-3",_name:"\u0e15\u0e01\u0e25\u0e07",_click:D}))))))},U=s.a.createElement,Z=function(e){var t,n=e.img,o=e.onAction,r=e.setImg,i=e.show,a=e.setShow;return U(s.a.Fragment,null,U("h3",null,"\u0e08\u0e31\u0e14\u0e01\u0e32\u0e23\u0e42\u0e1b\u0e23\u0e44\u0e1e\u0e25\u0e4c"),U("div",{className:"row mt-4 mb-3"},U("div",{className:"col-3"},U("div",{className:" text-right ml-4"},U("h4",null,"\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e23\u0e39\u0e1b\u0e42\u0e1b\u0e23\u0e44\u0e1f\u0e25\u0e4c\u0e19\u0e31\u0e01\u0e40\u0e02\u0e35\u0e22\u0e19 "))),U("div",{className:"col-9"},U(f,{_img:n?n.img:null,idx:1,_text:"\u0e42\u0e1b\u0e23\u0e44\u0e1f\u0e25\u0e4c",_name:"picture",_id:"image_profile",onChange:function(){return a(!0)}}))),U(B,(t={onAction:o,show:i,onHide:function(){return a(!1)},size:""},Object(l.a)(t,"size","xl"),Object(l.a)(t,"onSubmit",(function(e,t){r(t,e)})),Object(l.a)(t,"_img",n?n.img:null),t)))},q=n("gdJV"),G=n("94Hj"),V=n("yzAy"),J=s.a.createElement;function Y(){var e=Object(a.useContext)(q.b).user,t=Object(a.useState)(!1),n=t[0],o=t[1],s=Object(a.useState)([]),l=s[0],h=s[1],d=Object(a.useState)([]),m=d[0],f=d[1],g=Object(a.useState)([]),w=g[0],b=g[1],y=Object(a.useState)(!1),S=y[0],x=y[1],_=Object(a.useState)(!1),O=_[0],C=_[1],E=Object(a.useState)([]),P=(E[0],E[1]),T=Object(a.useState)(),M=T[0],z=T[1],R=Object(a.useRef)(null),j=function(){var t=Object(i.a)(r.a.mark((function t(n,o){return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:V.a.updateWriterBanner(n).then(function(){var t=Object(i.a)(r.a.mark((function t(n){return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:x(!1),alert("Update success"),"preview"==o&&window.open("/blog/writer/".concat(e.blog_writer.id,"?preview=1")),N();case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(e){x(!1),console.log(e.response)}));case 1:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),N=function(){var t=Object(i.a)(r.a.mark((function t(){return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:V.a.getBannerwriter(e.blog_writer.id).then(function(){var e=Object(i.a)(r.a.mark((function e(t){var n,o,i,a;return r.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.data,P(n),o=n.filter((function(e){return"desktop"==e.mimetype})).map((function(e){return{id:e.id,img:e.picture}})),i=n.filter((function(e){return"mobile"==e.mimetype})).map((function(e){return{id:e.id,img:e.picture}})),o.length&&h(o),i.length&&f(i),(a=n.filter((function(e){return"profile"==e.mimetype})).map((function(e){return{id:e.id,img:e.picture}}))).length&&z(a[0]);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch((function(e){console.log(e.response)}));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();Object(a.useEffect)((function(){document.getElementsByClassName("main-layout")[0]&&(document.getElementsByClassName("main-layout")[0].style.backgroundColor="#EEEEEE")}),[]),Object(a.useEffect)((function(){var e=function(e){if(O&&!window.confirm("You really want to leave?"))throw v.a.events.emit("routeChangeError"),"Abort route change. Please ignore this error."};return window.onbeforeunload=O&&function(){return O},v.a.events.on("routeChangeStart",e),function(){window.onbeforeunload=null,v.a.events.off("routeChangeStart",e)}}),[O]),Object(a.useEffect)((function(){e&&e.blog_writer&&N()}),[e]);var L=function(){var t=Object(i.a)(r.a.mark((function t(n,o){var i,a,s,c;return r.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.preventDefault(),(i=new FormData(R.current)).append("writer_id",e.blog_writer.id),"publish"==o&&i.append("save_publish",1),a=[],s=[],c=[],l.forEach((function(e,t){var n=0;if(e.edited){s.push({id:e.id,order:t+1});var o="edited-dsk-"+e.id,r={id:e.id,name:o,link:e.link,type:"desktop"};a.push(r),i.append(o,e.file)}else e.file?(s.push({order:t+1,index:n}),n+=1,i.append("banner_desktop",e.file),i.append("link_desktop",e.link)):s.push({id:e.id,order:t+1})})),m.forEach((function(e,t){var n=0;if(e.edited){c.push({id:e.id,order:t+1});var o="edited-mb-"+e.id,r={id:e.id,name:o,link:e.link,type:"mobile"};a.push(r),e.file&&i.append(o,e.file)}else e.file?(c.push({order:t+1,index:n}),n+=1,i.append("banner_mobile",e.file),i.append("link_mobile",e.link)):c.push({id:e.id,order:t+1})})),i.append("picture",M.files),i.append("edited_banner",JSON.stringify(a)),w.forEac
1h((function(e){e.id&&i.append("deleted_banner",e.id)})),C(!1),x(!0),t.next=15,j(i,o);case 15:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}();return J("div",null,J(c.a,{title:"Writer profile",page_name:"dashboard",isHome:!0},J(u.a,{page:"product"},J("form",{onSubmit:L,onKeyDown:function(e){if(13==e.keyCode)return e.preventDefault(),!1},encType:"multipart/form-data",ref:R},J("div",{className:"blog-backend-blog-manage-card w-100 mb-4"},J("div",{key:Math.random()},J(Z,{img:M,onAction:function(e){return C(e)},setImg:function(e,t){z({id:1,img:e,files:t})},show:n,setShow:o}))),J("div",{className:"blog-backend-blog-manage-card w-100"},J(p.a,{bannerDesk:l,setBannerdesk:h,bannerM:m,setBannerM:f,deleted:w,setDeleted:b,onAction:C})),J("div",{className:"blog-backend-blog-manage  d-flex justify-content-center mt-5"},J(G.a,{_type:"button",loading:S,_class:"blog-detail-story-detail-card-btn-n mr-3 blog-w-200px",_name:"\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e41\u0e25\u0e30\u0e1e\u0e23\u0e35\u0e27\u0e34\u0e27",_click:function(e){return L(e,"preview")}}),J(G.a,{_type:"button",loading:S,_class:"blog-detail-story-detail-card-btn-n blog-w-200
1px",_name:"\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e41\u0e25\u0e30\u0e40\u0e1c\u0e22\u0e41\u0e1e\u0e23\u0e48",_click:function(e){return L(e,"publish")}}))))))}},qp1F:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/blog/writer/profile",function(){return n("OIoI")}])}},[["qp1F",0,2,1,3,5,4,6,8,11,20,24,27,36,45]]]);

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.