123456789101112131415161718192021 |
- var Tt=Object.defineProperty,xt=Object.defineProperties;var bt=Object.getOwnPropertyDescriptors;var yt=Object.getOwnPropertySymbols;var At=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var mt=(o,t,e)=>t in o?Tt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,Ct=(o,t)=>{for(var e in t||(t={}))At.call(t,e)&&mt(o,e,t[e]);if(yt)for(var e of yt(t))Rt.call(t,e)&&mt(o,e,t[e]);return o},St=(o,t)=>xt(o,bt(t));var nt=(o,t,e)=>new Promise((n,l)=>{var r=w=>{try{S(e.next(w))}catch(x){l(x)}},u=w=>{try{S(e.throw(w))}catch(x){l(x)}},S=w=>w.done?n(w.value):Promise.resolve(w.value).then(r,u);S((e=e.apply(o,t)).next())});import{d as defineComponent,a as reactive,r as ref,i as createVNode,ac as NGrid,ad as NGi,a9 as NSpace,p as __unplugin_components_3,k as createTextVNode,U as nextTick,cc as commonjsGlobal,cb as getDefaultExportFromCjs,ab as service,u as useMessage,M as watch,cd as NUpload,aa as NModal}from"./index.19a1245a.js";/*!
- * Cropper.js v1.5.13
- * https://fengyuanchen.github.io/cropperjs
- *
- * Copyright 2015-present Chen Fengyuan
- * Released under the MIT license
- *
- * Date: 2022-11-20T05:30:46.114Z
- */function ownKeys(o,t){var e=Object.keys(o);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(o);t&&(n=n.filter(function(l){return Object.getOwnPropertyDescriptor(o,l).enumerable})),e.push.apply(e,n)}return e}function _objectSpread2(o){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?ownKeys(Object(e),!0).forEach(function(n){_defineProperty(o,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(e)):ownKeys(Object(e)).forEach(function(n){Object.defineProperty(o,n,Object.getOwnPropertyDescriptor(e,n))})}return o}function _typeof(o){return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(o)}function _classCallCheck(o,t){if(!(o instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(o,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(o,n.key,n)}}function _createClass(o,t,e){return t&&_defineProperties(o.prototype,t),e&&_defineProperties(o,e),Object.defineProperty(o,"prototype",{writable:!1}),o}function _defineProperty(o,t,e){return t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function _toConsumableArray(o){return _arrayWithoutHoles(o)||_iterableToArray(o)||_unsupportedIterableToArray(o)||_nonIterableSpread()}function _arrayWithoutHoles(o){if(Array.isArray(o))return _arrayLikeToArray(o)}function _iterableToArray(o){if(typeof Symbol!="undefined"&&o[Symbol.iterator]!=null||o["@@iterator"]!=null)return Array.from(o)}function _unsupportedIterableToArray(o,t){if(!!o){if(typeof o=="string")return _arrayLikeToArray(o,t);var e=Object.prototype.toString.call(o).slice(8,-1);if(e==="Object"&&o.constructor&&(e=o.constructor.name),e==="Map"||e==="Set")return Array.from(o);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return _arrayLikeToArray(o,t)}}function _arrayLikeToArray(o,t){(t==null||t>o.length)&&(t=o.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=o[e];return n}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var IS_BROWSER=typeof window!="undefined"&&typeof window.document!="undefined",WINDOW=IS_BROWSER?window:{},IS_TOUCH_DEVICE=IS_BROWSER&&WINDOW.document.documentElement?"ontouchstart"in WINDOW.document.documentElement:!1,HAS_POINTER_EVENT=IS_BROWSER?"PointerEvent"in WINDOW:!1,NAMESPACE="cropper",ACTION_ALL="all",ACTION_CROP="crop",ACTION_MOVE="move",ACTION_ZOOM="zoom",ACTION_EAST="e",ACTION_WEST="w",ACTION_SOUTH="s",ACTION_NORTH="n",ACTION_NORTH_EAST="ne",ACTION_NORTH_WEST="nw",ACTION_SOUTH_EAST="se",ACTION_SOUTH_WEST="sw",CLASS_CROP="".concat(NAMESPACE,"-crop"),CLASS_DISABLED="".concat(NAMESPACE,"-disabled"),CLASS_HIDDEN="".concat(NAMESPACE,"-hidden"),CLASS_HIDE="".concat(NAMESPACE,"-hide"),CLASS_INVISIBLE="".concat(NAMESPACE,"-invisible"),CLASS_MODAL="".concat(NAMESPACE,"-modal"),CLASS_MOVE="".concat(NAMESPACE,"-move"),DATA_ACTION="".concat(NAMESPACE,"Action"),DATA_PREVIEW="".concat(NAMESPACE,"Preview"),DRAG_MODE_CROP="crop",DRAG_MODE_MOVE="move",DRAG_MODE_NONE="none",EVENT_CROP="crop",EVENT_CROP_END="cropend",EVENT_CROP_MOVE="cropmove",EVENT_CROP_START="cropstart",EVENT_DBLCLICK="dblclick",EVENT_TOUCH_START=IS_TOUCH_DEVICE?"touchstart":"mousedown",EVENT_TOUCH_MOVE=IS_TOUCH_DEVICE?"touchmove":"mousemove",EVENT_TOUCH_END=IS_TOUCH_DEVICE?"touchend touchcancel":"mouseup",EVENT_POINTER_DOWN=HAS_POINTER_EVENT?"pointerdown":EVENT_TOUCH_START,EVENT_POINTER_MOVE=HAS_POINTER_EVENT?"pointermove":EVENT_TOUCH_MOVE,EVENT_POINTER_UP=HAS_POINTER_EVENT?"pointerup pointercancel":EVENT_TOUCH_END,EVENT_READY="ready",EVENT_RESIZE="resize",EVENT_WHEEL="wheel",EVENT_ZOOM="zoom",MIME_TYPE_JPEG="image/jpeg",REGEXP_ACTIONS=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,REGEXP_DATA_URL=/^data:/,REGEXP_DATA_URL_JPEG=/^data:image\/jpeg;base64,/,REGEXP_TAG_NAME=/^img|canvas$/i,MIN_CONTAINER_WIDTH=200,MIN_CONTAINER_HEIGHT=100,DEFAULTS={viewMode:0,dragMode:DRAG_MODE_CROP,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:MIN_CONTAINER_WIDTH,minContainerHeight:MIN_CONTAINER_HEIGHT,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},TEMPLATE='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',isNaN=Number.isNaN||WINDOW.isNaN;function isNumber(o){return typeof o=="number"&&!isNaN(o)}var isPositiveNumber=function(t){return t>0&&t<1/0};function isUndefined(o){return typeof o=="undefined"}function isObject(o){return _typeof(o)==="object"&&o!==null}var hasOwnProperty=Object.prototype.hasOwnProperty;function isPlainObject(o){if(!isObject(o))return!1;try{var t=o.constructor,e=t.prototype;return t&&e&&hasOwnProperty.call(e,"isPrototypeOf")}catch(n){return!1}}function isFunction(o){return typeof o=="function"}var slice=Array.prototype.slice;function toArray(o){return Array.from?Array.from(o):slice.call(o)}function forEach(o,t){return o&&isFunction(t)&&(Array.isArray(o)||isNumber(o.length)?toArray(o).forEach(function(e,n){t.call(o,e,n,o)}):isObject(o)&&Object.keys(o).forEach(function(e){t.call(o,o[e],e,o)})),o}var assign=Object.assign||function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),l=1;l<e;l++)n[l-1]=arguments[l];return isObject(t)&&n.length>0&&n.forEach(function(r){isObject(r)&&Object.keys(r).forEach(function(u){t[u]=r[u]})}),t},REGEXP_DECIMALS=/\.\d*(?:0|9){12}\d*$/;function normalizeDecimalNumber(o){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return REGEXP_DECIMALS.test(o)?Math.round(o*t)/t:o}var REGEXP_SUFFIX=/^width|height|left|top|marginLeft|marginTop$/;function setStyle(o,t){var e=o.style;forEach(t,function(n,l){REGEXP_SUFFIX.test(l)&&isNumber(n)&&(n="".concat(n,"px")),e[l]=n})}function hasClass(o,t){return o.classList?o.classList.contains(t):o.className.indexOf(t)>-1}function addClass(o,t){if(!!t){if(isNumber(o.length)){forEach(o,function(n){addClass(n,t)});return}if(o.classList){o.classList.add(t);return}var e=o.className.trim();e?e.indexOf(t)<0&&(o.className="".concat(e," ").concat(t)):o.className=t}}function removeClass(o,t){if(!!t){if(isNumber(o.length)){forEach(o,function(e){removeClass(e,t)});return}if(o.classList){o.classList.remove(t);return}o.className.indexOf(t)>=0&&(o.className=o.className.replace(t,""))}}function toggleClass(o,t,e){if(!!t){if(isNumber(o.length)){forEach(o,function(n){toggleClass(n,t,e)});return}e?addClass(o,t):removeClass(o,t)}}var REGEXP_CAMEL_CASE=/([a-z\d])([A-Z])/g;function toParamCase(o){return o.replace(REGEXP_CAMEL_CASE,"$1-$2").toLowerCase()}function getData(o,t){return isObject(o[t])?o[t]:o.dataset?o.dataset[t]:o.getAttribute("data-".concat(toParamCase(t)))}function setData(o,t,e){isObject(e)?o[t]=e:o.dataset?o.dataset[t]=e:o.setAttribute("data-".concat(toParamCase(t)),e)}function removeData(o,t){if(isObject(o[t]))try{delete o[t]}catch(e){o[t]=void 0}else if(o.dataset)try{delete o.dataset[t]}catch(e){o.dataset[t]=void 0}else o.removeAttribute("data-".concat(toParamCase(t)))}var REGEXP_SPACES=/\s\s*/,onceSupported=function(){var o=!1;if(IS_BROWSER){var t=!1,e=function(){},n=Object.defineProperty({},"once",{get:function(){return o=!0,t},set:function(r){t=r}});WINDOW.addEventListener("test",e,n),WINDOW.removeEventListener("test",e,n)}return o}();function removeListener(o,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=e;t.trim().split(REGEXP_SPACES).forEach(function(r){if(!onceSupported){var u=o.listeners;u&&u[r]&&u[r][e]&&(l=u[r][e],delete u[r][e],Object.keys(u[r]).length===0&&delete u[r],Object.keys(u).length===0&&delete o.listeners)}o.removeEventListener(r,l,n)})}function addListener(o,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=e;t.trim().split(REGEXP_SPACES).forEach(function(r){if(n.once&&!onceSupported){var u=o.listeners,S=u===void 0?{}:u;l=function(){delete S[r][e],o.removeEventListener(r,l,n);for(var x=arguments.length,C=new Array(x),T=0;T<x;T++)C[T]=arguments[T];e.apply(o,C)},S[r]||(S[r]={}),S[r][e]&&o.removeEventListener(r,S[r][e],n),S[r][e]=l,o.listeners=S}o.addEventListener(r,l,n)})}function dispatchEvent(o,t,e){var n;return isFunction(Event)&&isFunction(CustomEvent)?n=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(t,!0,!0,e)),o.dispatchEvent(n)}function getOffset(o){var t=o.getBoundingClientRect();return{left:t.left+(window.pageXOffset-document.documentElement.clientLeft),top:t.top+(window.pageYOffset-document.documentElement.clientTop)}}var location$1=WINDOW.location,REGEXP_ORIGINS=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function isCrossOriginURL(o){var t=o.match(REGEXP_ORIGINS);return t!==null&&(t[1]!==location$1.protocol||t[2]!==location$1.hostname||t[3]!==location$1.port)}function addTimestamp(o){var t="timestamp=".concat(new Date().getTime());return o+(o.indexOf("?")===-1?"?":"&")+t}function getTransforms(o){var t=o.rotate,e=o.scaleX,n=o.scaleY,l=o.translateX,r=o.translateY,u=[];isNumber(l)&&l!==0&&u.push("translateX(".concat(l,"px)")),isNumber(r)&&r!==0&&u.push("translateY(".concat(r,"px)")),isNumber(t)&&t!==0&&u.push("rotate(".concat(t,"deg)")),isNumber(e)&&e!==1&&u.push("scaleX(".concat(e,")")),isNumber(n)&&n!==1&&u.push("scaleY(".concat(n,")"));var S=u.length?u.join(" "):"none";return{WebkitTransform:S,msTransform:S,transform:S}}function getMaxZoomRatio(o){var t=_objectSpread2({},o),e=0;return forEach(o,function(n,l){delete t[l],forEach(t,function(r){var u=Math.abs(n.startX-r.startX),S=Math.abs(n.startY-r.startY),w=Math.abs(n.endX-r.endX),x=Math.abs(n.endY-r.endY),C=Math.sqrt(u*u+S*S),T=Math.sqrt(w*w+x*x),N=(T-C)/C;Math.abs(N)>Math.abs(e)&&(e=N)})}),e}function getPointer(o,t){var e=o.pageX,n=o.pageY,l={endX:e,endY:n};return t?l:_objectSpread2({startX:e,startY:n},l)}function getPointersCenter(o){var t=0,e=0,n=0;return forEach(o,function(l){var r=l.startX,u=l.startY;t+=r,e+=u,n+=1}),t/=n,e/=n,{pageX:t,pageY:e}}function getAdjustedSizes(o){var t=o.aspectRatio,e=o.height,n=o.width,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",r=isPositiveNumber(n),u=isPositiveNumber(e);if(r&&u){var S=e*t;l==="contain"&&S>n||l==="cover"&&S<n?e=n/t:n=e*t}else r?e=n/t:u&&(n=e*t);return{width:n,height:e}}function getRotatedSizes(o){var t=o.width,e=o.height,n=o.degree;if(n=Math.abs(n)%180,n===90)return{width:e,height:t};var l=n%90*Math.PI/180,r=Math.sin(l),u=Math.cos(l),S=t*u+e*r,w=t*r+e*u;return n>90?{width:w,height:S}:{width:S,height:w}}function getSourceCanvas(o,t,e,n){var l=t.aspectRatio,r=t.naturalWidth,u=t.naturalHeight,S=t.rotate,w=S===void 0?0:S,x=t.scaleX,C=x===void 0?1:x,T=t.scaleY,N=T===void 0?1:T,K=e.aspectRatio,P=e.naturalWidth,H=e.naturalHeight,Y=n.fillColor,W=Y===void 0?"transparent":Y,ie=n.imageSmoothingEnabled,B=ie===void 0?!0:ie,A=n.imageSmoothingQuality,E=A===void 0?"low":A,O=n.maxWidth,g=O===void 0?1/0:O,M=n.maxHeight,z=M===void 0?1/0:M,L=n.minWidth,F=L===void 0?0:L,k=n.minHeight,V=k===void 0?0:k,X=document.createElement("canvas"),G=X.getContext("2d"),$=getAdjustedSizes({aspectRatio:K,width:g,height:z}),re=getAdjustedSizes({aspectRatio:K,width:F,height:V},"cover"),ue=Math.min($.width,Math.max(re.width,P)),oe=Math.min($.height,Math.max(re.height,H)),ee=getAdjustedSizes({aspectRatio:l,width:g,height:z}),ce=getAdjustedSizes({aspectRatio:l,width:F,height:V},"cover"),ae=Math.min(ee.width,Math.max(ce.width,r)),pe=Math.min(ee.height,Math.max(ce.height,u)),Z=[-ae/2,-pe/2,ae,pe];return X.width=normalizeDecimalNumber(ue),X.height=normalizeDecimalNumber(oe),G.fillStyle=W,G.fillRect(0,0,ue,oe),G.save(),G.translate(ue/2,oe/2),G.rotate(w*Math.PI/180),G.scale(C,N),G.imageSmoothingEnabled=B,G.imageSmoothingQuality=E,G.drawImage.apply(G,[o].concat(_toConsumableArray(Z.map(function(ne){return Math.floor(normalizeDecimalNumber(ne))})))),G.restore(),X}var fromCharCode=String.fromCharCode;function getStringFromCharCode(o,t,e){var n="";e+=t;for(var l=t;l<e;l+=1)n+=fromCharCode(o.getUint8(l));return n}var REGEXP_DATA_URL_HEAD=/^data:.*,/;function dataURLToArrayBuffer(o){var t=o.replace(REGEXP_DATA_URL_HEAD,""),e=atob(t),n=new ArrayBuffer(e.length),l=new Uint8Array(n);return forEach(l,function(r,u){l[u]=e.charCodeAt(u)}),n}function arrayBufferToDataURL(o,t){for(var e=[],n=8192,l=new Uint8Array(o);l.length>0;)e.push(fromCharCode.apply(null,toArray(l.subarray(0,n)))),l=l.subarray(n);return"data:".concat(t,";base64,").concat(btoa(e.join("")))}function resetAndGetOrientation(o){var t=new DataView(o),e;try{var n,l,r;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(var u=t.byteLength,S=2;S+1<u;){if(t.getUint8(S)===255&&t.getUint8(S+1)===225){l=S;break}S+=1}if(l){var w=l+4,x=l+10;if(getStringFromCharCode(t,w,4)==="Exif"){var C=t.getUint16(x);if(n=C===18761,(n||C===19789)&&t.getUint16(x+2,n)===42){var T=t.getUint32(x+4,n);T>=8&&(r=x+T)}}}if(r){var N=t.getUint16(r,n),K,P;for(P=0;P<N;P+=1)if(K=r+P*12+2,t.getUint16(K,n)===274){K+=8,e=t.getUint16(K,n),t.setUint16(K,1,n);break}}}catch(H){e=1}return e}function parseOrientation(o){var t=0,e=1,n=1;switch(o){case 2:e=-1;break;case 3:t=-180;break;case 4:n=-1;break;case 5:t=90,n=-1;break;case 6:t=90;break;case 7:t=90,e=-1;break;case 8:t=-90;break}return{rotate:t,scaleX:e,scaleY:n}}var render={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,n=this.container,l=this.cropper,r=Number(e.minContainerWidth),u=Number(e.minContainerHeight);addClass(l,CLASS_HIDDEN),removeClass(t,CLASS_HIDDEN);var S={width:Math.max(n.offsetWidth,r>=0?r:MIN_CONTAINER_WIDTH),height:Math.max(n.offsetHeight,u>=0?u:MIN_CONTAINER_HEIGHT)};this.containerData=S,setStyle(l,{width:S.width,height:S.height}),addClass(t,CLASS_HIDDEN),removeClass(l,CLASS_HIDDEN)},initCanvas:function(){var t=this.containerData,e=this.imageData,n=this.options.viewMode,l=Math.abs(e.rotate)%180===90,r=l?e.naturalHeight:e.naturalWidth,u=l?e.naturalWidth:e.naturalHeight,S=r/u,w=t.width,x=t.height;t.height*S>t.width?n===3?w=t.height*S:x=t.width/S:n===3?x=t.width/S:w=t.height*S;var C={aspectRatio:S,naturalWidth:r,naturalHeight:u,width:w,height:x};this.canvasData=C,this.limited=n===1||n===2,this.limitCanvas(!0,!0),C.width=Math.min(Math.max(C.width,C.minWidth),C.maxWidth),C.height=Math.min(Math.max(C.height,C.minHeight),C.maxHeight),C.left=(t.width-C.width)/2,C.top=(t.height-C.height)/2,C.oldLeft=C.left,C.oldTop=C.top,this.initialCanvasData=assign({},C)},limitCanvas:function(t,e){var n=this.options,l=this.containerData,r=this.canvasData,u=this.cropBoxData,S=n.viewMode,w=r.aspectRatio,x=this.cropped&&u;if(t){var C=Number(n.minCanvasWidth)||0,T=Number(n.minCanvasHeight)||0;S>1?(C=Math.max(C,l.width),T=Math.max(T,l.height),S===3&&(T*w>C?C=T*w:T=C/w)):S>0&&(C?C=Math.max(C,x?u.width:0):T?T=Math.max(T,x?u.height:0):x&&(C=u.width,T=u.height,T*w>C?C=T*w:T=C/w));var N=getAdjustedSizes({aspectRatio:w,width:C,height:T});C=N.width,T=N.height,r.minWidth=C,r.minHeight=T,r.maxWidth=1/0,r.maxHeight=1/0}if(e)if(S>(x?0:1)){var K=l.width-r.width,P=l.height-r.height;r.minLeft=Math.min(0,K),r.minTop=Math.min(0,P),r.maxLeft=Math.max(0,K),r.maxTop=Math.max(0,P),x&&this.limited&&(r.minLeft=Math.min(u.left,u.left+(u.width-r.width)),r.minTop=Math.min(u.top,u.top+(u.height-r.height)),r.maxLeft=u.left,r.maxTop=u.top,S===2&&(r.width>=l.width&&(r.minLeft=Math.min(0,K),r.maxLeft=Math.max(0,K)),r.height>=l.height&&(r.minTop=Math.min(0,P),r.maxTop=Math.max(0,P))))}else r.minLeft=-r.width,r.minTop=-r.height,r.maxLeft=l.width,r.maxTop=l.height},renderCanvas:function(t,e){var n=this.canvasData,l=this.imageData;if(e){var r=getRotatedSizes({width:l.naturalWidth*Math.abs(l.scaleX||1),height:l.naturalHeight*Math.abs(l.scaleY||1),degree:l.rotate||0}),u=r.width,S=r.height,w=n.width*(u/n.naturalWidth),x=n.height*(S/n.naturalHeight);n.left-=(w-n.width)/2,n.top-=(x-n.height)/2,n.width=w,n.height=x,n.aspectRatio=u/S,n.naturalWidth=u,n.naturalHeight=S,this.limitCanvas(!0,!1)}(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCanvas(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,setStyle(this.canvas,assign({width:n.width,height:n.height},getTransforms({translateX:n.left,translateY:n.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,n=this.imageData,l=n.naturalWidth*(e.width/e.naturalWidth),r=n.naturalHeight*(e.height/e.naturalHeight);assign(n,{width:l,height:r,left:(e.width-l)/2,top:(e.height-r)/2}),setStyle(this.image,assign({width:n.width,height:n.height},getTransforms(assign({translateX:n.left,translateY:n.top},n)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,n=t.aspectRatio||t.initialAspectRatio,l=Number(t.autoCropArea)||.8,r={width:e.width,height:e.height};n&&(e.height*n>e.width?r.height=r.width/n:r.width=r.height*n),this.cropBoxData=r,this.limitCropBox(!0,!0),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),r.width=Math.max(r.minWidth,r.width*l),r.height=Math.max(r.minHeight,r.height*l),r.left=e.left+(e.width-r.width)/2,r.top=e.top+(e.height-r.height)/2,r.oldLeft=r.left,r.oldTop=r.top,this.initialCropBoxData=assign({},r)},limitCropBox:function(t,e){var n=this.options,l=this.containerData,r=this.canvasData,u=this.cropBoxData,S=this.limited,w=n.aspectRatio;if(t){var x=Number(n.minCropBoxWidth)||0,C=Number(n.minCropBoxHeight)||0,T=S?Math.min(l.width,r.width,r.width+r.left,l.width-r.left):l.width,N=S?Math.min(l.height,r.height,r.height+r.top,l.height-r.top):l.height;x=Math.min(x,l.width),C=Math.min(C,l.height),w&&(x&&C?C*w>x?C=x/w:x=C*w:x?C=x/w:C&&(x=C*w),N*w>T?N=T/w:T=N*w),u.minWidth=Math.min(x,T),u.minHeight=Math.min(C,N),u.maxWidth=T,u.maxHeight=N}e&&(S?(u.minLeft=Math.max(0,r.left),u.minTop=Math.max(0,r.top),u.maxLeft=Math.min(l.width,r.left+r.width)-u.width,u.maxTop=Math.min(l.height,r.top+r.height)-u.height):(u.minLeft=0,u.minTop=0,u.maxLeft=l.width-u.width,u.maxTop=l.height-u.height))},renderCropBox:function(){var t=this.options,e=this.containerData,n=this.cropBoxData;(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCropBox(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,t.movable&&t.cropBoxMovable&&setData(this.face,DATA_ACTION,n.width>=e.width&&n.height>=e.height?ACTION_MOVE:ACTION_ALL),setStyle(this.cropBox,assign({width:n.width,height:n.height},getTransforms({translateX:n.left,translateY:n.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),dispatchEvent(this.element,EVENT_CROP,this.getData())}},preview={initPreview:function(){var t=this.element,e=this.crossOrigin,n=this.options.preview,l=e?this.crossOriginUrl:this.url,r=t.alt||"The image to preview",u=document.createElement("img");if(e&&(u.crossOrigin=e),u.src=l,u.alt=r,this.viewBox.appendChild(u),this.viewBoxImage=u,!!n){var S=n;typeof n=="string"?S=t.ownerDocument.querySelectorAll(n):n.querySelector&&(S=[n]),this.previews=S,forEach(S,function(w){var x=document.createElement("img");setData(w,DATA_PREVIEW,{width:w.offsetWidth,height:w.offsetHeight,html:w.innerHTML}),e&&(x.crossOrigin=e),x.src=l,x.alt=r,x.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',w.innerHTML="",w.appendChild(x)})}},resetPreview:function(){forEach(this.previews,function(t){var e=getData(t,DATA_PREVIEW);setStyle(t,{width:e.width,height:e.height}),t.innerHTML=e.html,removeData(t,DATA_PREVIEW)})},preview:function(){var t=this.imageData,e=this.canvasData,n=this.cropBoxData,l=n.width,r=n.height,u=t.width,S=t.height,w=n.left-e.left-t.left,x=n.top-e.top-t.top;!this.cropped||this.disabled||(setStyle(this.viewBoxImage,assign({width:u,height:S},getTransforms(assign({translateX:-w,translateY:-x},t)))),forEach(this.previews,function(C){var T=getData(C,DATA_PREVIEW),N=T.width,K=T.height,P=N,H=K,Y=1;l&&(Y=N/l,H=r*Y),r&&H>K&&(Y=K/r,P=l*Y,H=K),setStyle(C,{width:P,height:H}),setStyle(C.getElementsByTagName("img")[0],assign({width:u*Y,height:S*Y},getTransforms(assign({translateX:-w*Y,translateY:-x*Y},t))))}))}},events={bind:function(){var t=this.element,e=this.options,n=this.cropper;isFunction(e.cropstart)&&addListener(t,EVENT_CROP_START,e.cropstart),isFunction(e.cropmove)&&addListener(t,EVENT_CROP_MOVE,e.cropmove),isFunction(e.cropend)&&addListener(t,EVENT_CROP_END,e.cropend),isFunction(e.crop)&&addListener(t,EVENT_CROP,e.crop),isFunction(e.zoom)&&addListener(t,EVENT_ZOOM,e.zoom),addListener(n,EVENT_POINTER_DOWN,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&addListener(n,EVENT_WHEEL,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&addListener(n,EVENT_DBLCLICK,this.onDblclick=this.dblclick.bind(this)),addListener(t.ownerDocument,EVENT_POINTER_MOVE,this.onCropMove=this.cropMove.bind(this)),addListener(t.ownerDocument,EVENT_POINTER_UP,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&addListener(window,EVENT_RESIZE,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,n=this.cropper;isFunction(e.cropstart)&&removeListener(t,EVENT_CROP_START,e.cropstart),isFunction(e.cropmove)&&removeListener(t,EVENT_CROP_MOVE,e.cropmove),isFunction(e.cropend)&&removeListener(t,EVENT_CROP_END,e.cropend),isFunction(e.crop)&&removeListener(t,EVENT_CROP,e.crop),isFunction(e.zoom)&&removeListener(t,EVENT_ZOOM,e.zoom),removeListener(n,EVENT_POINTER_DOWN,this.onCropStart),e.zoomable&&e.zoomOnWheel&&removeListener(n,EVENT_WHEEL,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&removeListener(n,EVENT_DBLCLICK,this.onDblclick),removeListener(t.ownerDocument,EVENT_POINTER_MOVE,this.onCropMove),removeListener(t.ownerDocument,EVENT_POINTER_UP,this.onCropEnd),e.responsive&&removeListener(window,EVENT_RESIZE,this.onResize)}},handlers={resize:function(){if(!this.disabled){var t=this.options,e=this.container,n=this.containerData,l=e.offsetWidth/n.width,r=e.offsetHeight/n.height,u=Math.abs(l-1)>Math.abs(r-1)?l:r;if(u!==1){var S,w;t.restore&&(S=this.getCanvasData(),w=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(forEach(S,function(x,C){S[C]=x*u})),this.setCropBoxData(forEach(w,function(x,C){w[C]=x*u})))}}},dblclick:function(){this.disabled||this.options.dragMode===DRAG_MODE_NONE||this.setDragMode(hasClass(this.dragBox,CLASS_CROP)?DRAG_MODE_MOVE:DRAG_MODE_CROP)},wheel:function(t){var e=this,n=Number(this.options.wheelZoomRatio)||.1,l=1;this.disabled||(t.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){e.wheeling=!1},50),t.deltaY?l=t.deltaY>0?1:-1:t.wheelDelta?l=-t.wheelDelta/120:t.detail&&(l=t.detail>0?1:-1),this.zoom(-l*n,t)))},cropStart:function(t){var e=t.buttons,n=t.button;if(!(this.disabled||(t.type==="mousedown"||t.type==="pointerdown"&&t.pointerType==="mouse")&&(isNumber(e)&&e!==1||isNumber(n)&&n!==0||t.ctrlKey))){var l=this.options,r=this.pointers,u;t.changedTouches?forEach(t.changedTouches,function(S){r[S.identifier]=getPointer(S)}):r[t.pointerId||0]=getPointer(t),Object.keys(r).length>1&&l.zoomable&&l.zoomOnTouch?u=ACTION_ZOOM:u=getData(t.target,DATA_ACTION),!!REGEXP_ACTIONS.test(u)&&dispatchEvent(this.element,EVENT_CROP_START,{originalEvent:t,action:u})!==!1&&(t.preventDefault(),this.action=u,this.cropping=!1,u===ACTION_CROP&&(this.cropping=!0,addClass(this.dragBox,CLASS_MODAL)))}},cropMove:function(t){var e=this.action;if(!(this.disabled||!e)){var n=this.pointers;t.preventDefault(),dispatchEvent(this.element,EVENT_CROP_MOVE,{originalEvent:t,action:e})!==!1&&(t.changedTouches?forEach(t.changedTouches,function(l){assign(n[l.identifier]||{},getPointer(l,!0))}):assign(n[t.pointerId||0]||{},getPointer(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,n=this.pointers;t.changedTouches?forEach(t.changedTouches,function(l){delete n[l.identifier]}):delete n[t.pointerId||0],e&&(t.preventDefault(),Object.keys(n).length||(this.action=""),this.cropping&&(this.cropping=!1,toggleClass(this.dragBox,CLASS_MODAL,this.cropped&&this.options.modal)),dispatchEvent(this.element,EVENT_CROP_END,{originalEvent:t,action:e}))}}},change={change:function(t){var e=this.options,n=this.canvasData,l=this.containerData,r=this.cropBoxData,u=this.pointers,S=this.action,w=e.aspectRatio,x=r.left,C=r.top,T=r.width,N=r.height,K=x+T,P=C+N,H=0,Y=0,W=l.width,ie=l.height,B=!0,A;!w&&t.shiftKey&&(w=T&&N?T/N:1),this.limited&&(H=r.minLeft,Y=r.minTop,W=H+Math.min(l.width,n.width,n.left+n.width),ie=Y+Math.min(l.height,n.height,n.top+n.height));var E=u[Object.keys(u)[0]],O={x:E.endX-E.startX,y:E.endY-E.startY},g=function(z){switch(z){case ACTION_EAST:K+O.x>W&&(O.x=W-K);break;case ACTION_WEST:x+O.x<H&&(O.x=H-x);break;case ACTION_NORTH:C+O.y<Y&&(O.y=Y-C);break;case ACTION_SOUTH:P+O.y>ie&&(O.y=ie-P);break}};switch(S){case ACTION_ALL:x+=O.x,C+=O.y;break;case ACTION_EAST:if(O.x>=0&&(K>=W||w&&(C<=Y||P>=ie))){B=!1;break}g(ACTION_EAST),T+=O.x,T<0&&(S=ACTION_WEST,T=-T,x-=T),w&&(N=T/w,C+=(r.height-N)/2);break;case ACTION_NORTH:if(O.y<=0&&(C<=Y||w&&(x<=H||K>=W))){B=!1;break}g(ACTION_NORTH),N-=O.y,C+=O.y,N<0&&(S=ACTION_SOUTH,N=-N,C-=N),w&&(T=N*w,x+=(r.width-T)/2);break;case ACTION_WEST:if(O.x<=0&&(x<=H||w&&(C<=Y||P>=ie))){B=!1;break}g(ACTION_WEST),T-=O.x,x+=O.x,T<0&&(S=ACTION_EAST,T=-T,x-=T),w&&(N=T/w,C+=(r.height-N)/2);break;case ACTION_SOUTH:if(O.y>=0&&(P>=ie||w&&(x<=H||K>=W))){B=!1;break}g(ACTION_SOUTH),N+=O.y,N<0&&(S=ACTION_NORTH,N=-N,C-=N),w&&(T=N*w,x+=(r.width-T)/2);break;case ACTION_NORTH_EAST:if(w){if(O.y<=0&&(C<=Y||K>=W)){B=!1;break}g(ACTION_NORTH),N-=O.y,C+=O.y,T=N*w}else g(ACTION_NORTH),g(ACTION_EAST),O.x>=0?K<W?T+=O.x:O.y<=0&&C<=Y&&(B=!1):T+=O.x,O.y<=0?C>Y&&(N-=O.y,C+=O.y):(N-=O.y,C+=O.y);T<0&&N<0?(S=ACTION_SOUTH_WEST,N=-N,T=-T,C-=N,x-=T):T<0?(S=ACTION_NORTH_WEST,T=-T,x-=T):N<0&&(S=ACTION_SOUTH_EAST,N=-N,C-=N);break;case ACTION_NORTH_WEST:if(w){if(O.y<=0&&(C<=Y||x<=H)){B=!1;break}g(ACTION_NORTH),N-=O.y,C+=O.y,T=N*w,x+=r.width-T}else g(ACTION_NORTH),g(ACTION_WEST),O.x<=0?x>H?(T-=O.x,x+=O.x):O.y<=0&&C<=Y&&(B=!1):(T-=O.x,x+=O.x),O.y<=0?C>Y&&(N-=O.y,C+=O.y):(N-=O.y,C+=O.y);T<0&&N<0?(S=ACTION_SOUTH_EAST,N=-N,T=-T,C-=N,x-=T):T<0?(S=ACTION_NORTH_EAST,T=-T,x-=T):N<0&&(S=ACTION_SOUTH_WEST,N=-N,C-=N);break;case ACTION_SOUTH_WEST:if(w){if(O.x<=0&&(x<=H||P>=ie)){B=!1;break}g(ACTION_WEST),T-=O.x,x+=O.x,N=T/w}else g(ACTION_SOUTH),g(ACTION_WEST),O.x<=0?x>H?(T-=O.x,x+=O.x):O.y>=0&&P>=ie&&(B=!1):(T-=O.x,x+=O.x),O.y>=0?P<ie&&(N+=O.y):N+=O.y;T<0&&N<0?(S=ACTION_NORTH_EAST,N=-N,T=-T,C-=N,x-=T):T<0?(S=ACTION_SOUTH_EAST,T=-T,x-=T):N<0&&(S=ACTION_NORTH_WEST,N=-N,C-=N);break;case ACTION_SOUTH_EAST:if(w){if(O.x>=0&&(K>=W||P>=ie)){B=!1;break}g(ACTION_EAST),T+=O.x,N=T/w}else g(ACTION_SOUTH),g(ACTION_EAST),O.x>=0?K<W?T+=O.x:O.y>=0&&P>=ie&&(B=!1):T+=O.x,O.y>=0?P<ie&&(N+=O.y):N+=O.y;T<0&&N<0?(S=ACTION_NORTH_WEST,N=-N,T=-T,C-=N,x-=T):T<0?(S=ACTION_SOUTH_WEST,T=-T,x-=T):N<0&&(S=ACTION_NORTH_EAST,N=-N,C-=N);break;case ACTION_MOVE:this.move(O.x,O.y),B=!1;break;case ACTION_ZOOM:this.zoom(getMaxZoomRatio(u),t),B=!1;break;case ACTION_CROP:if(!O.x||!O.y){B=!1;break}A=getOffset(this.cropper),x=E.startX-A.left,C=E.startY-A.top,T=r.minWidth,N=r.minHeight,O.x>0?S=O.y>0?ACTION_SOUTH_EAST:ACTION_NORTH_EAST:O.x<0&&(x-=T,S=O.y>0?ACTION_SOUTH_WEST:ACTION_NORTH_WEST),O.y<0&&(C-=N),this.cropped||(removeClass(this.cropBox,CLASS_HIDDEN),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}B&&(r.width=T,r.height=N,r.left=x,r.top=C,this.action=S,this.renderCropBox()),forEach(u,function(M){M.startX=M.endX,M.startY=M.endY})}},methods={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&addClass(this.dragBox,CLASS_MODAL),removeClass(this.cropBox,CLASS_HIDDEN),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=assign({},this.initialImageData),this.canvasData=assign({},this.initialCanvasData),this.cropBoxData=assign({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(assign(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),removeClass(this.dragBox,CLASS_MODAL),addClass(this.cropBox,CLASS_HIDDEN)),this},replace:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,forEach(this.previews,function(n){n.getElementsByTagName("img")[0].src=t}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,removeClass(this.cropper,CLASS_DISABLED)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,addClass(this.cropper,CLASS_DISABLED)),this},destroy:function(){var t=this.element;return t[NAMESPACE]?(t[NAMESPACE]=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,n=this.canvasData,l=n.left,r=n.top;return this.moveTo(isUndefined(t)?t:l+Number(t),isUndefined(e)?e:r+Number(e))},moveTo:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,n=this.canvasData,l=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(isNumber(t)&&(n.left=t,l=!0),isNumber(e)&&(n.top=e,l=!0),l&&this.renderCanvas(!0)),this},zoom:function(t,e){var n=this.canvasData;return t=Number(t),t<0?t=1/(1-t):t=1+t,this.zoomTo(n.width*t/n.naturalWidth,null,e)},zoomTo:function(t,e,n){var l=this.options,r=this.canvasData,u=r.width,S=r.height,w=r.naturalWidth,x=r.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&l.zoomable){var C=w*t,T=x*t;if(dispatchEvent(this.element,EVENT_ZOOM,{ratio:t,oldRatio:u/w,originalEvent:n})===!1)return this;if(n){var N=this.pointers,K=getOffset(this.cropper),P=N&&Object.keys(N).length?getPointersCenter(N):{pageX:n.pageX,pageY:n.pageY};r.left-=(C-u)*((P.pageX-K.left-r.left)/u),r.top-=(T-S)*((P.pageY-K.top-r.top)/S)}else isPlainObject(e)&&isNumber(e.x)&&isNumber(e.y)?(r.left-=(C-u)*((e.x-r.left)/u),r.top-=(T-S)*((e.y-r.top)/S)):(r.left-=(C-u)/2,r.top-=(T-S)/2);r.width=C,r.height=T,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),isNumber(t)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,isNumber(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(isNumber(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,n=this.imageData,l=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(isNumber(t)&&(n.scaleX=t,l=!0),isNumber(e)&&(n.scaleY=e,l=!0),l&&this.renderCanvas(!0,!0)),this},getData:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.options,n=this.imageData,l=this.canvasData,r=this.cropBoxData,u;if(this.ready&&this.cropped){u={x:r.left-l.left,y:r.top-l.top,width:r.width,height:r.height};var S=n.width/n.naturalWidth;if(forEach(u,function(C,T){u[T]=C/S}),t){var w=Math.round(u.y+u.height),x=Math.round(u.x+u.width);u.x=Math.round(u.x),u.y=Math.round(u.y),u.width=x-u.x,u.height=w-u.y}}else u={x:0,y:0,width:0,height:0};return e.rotatable&&(u.rotate=n.rotate||0),e.scalable&&(u.scaleX=n.scaleX||1,u.scaleY=n.scaleY||1),u},setData:function(t){var e=this.options,n=this.imageData,l=this.canvasData,r={};if(this.ready&&!this.disabled&&isPlainObject(t)){var u=!1;e.rotatable&&isNumber(t.rotate)&&t.rotate!==n.rotate&&(n.rotate=t.rotate,u=!0),e.scalable&&(isNumber(t.scaleX)&&t.scaleX!==n.scaleX&&(n.scaleX=t.scaleX,u=!0),isNumber(t.scaleY)&&t.scaleY!==n.scaleY&&(n.scaleY=t.scaleY,u=!0)),u&&this.renderCanvas(!0,!0);var S=n.width/n.naturalWidth;isNumber(t.x)&&(r.left=t.x*S+l.left),isNumber(t.y)&&(r.top=t.y*S+l.top),isNumber(t.width)&&(r.width=t.width*S),isNumber(t.height)&&(r.height=t.height*S),this.setCropBoxData(r)}return this},getContainerData:function(){return this.ready?assign({},this.containerData):{}},getImageData:function(){return this.sized?assign({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&forEach(["left","top","width","height","naturalWidth","naturalHeight"],function(n){e[n]=t[n]}),e},setCanvasData:function(t){var e=this.canvasData,n=e.aspectRatio;return this.ready&&!this.disabled&&isPlainObject(t)&&(isNumber(t.left)&&(e.left=t.left),isNumber(t.top)&&(e.top=t.top),isNumber(t.width)?(e.width=t.width,e.height=t.width/n):isNumber(t.height)&&(e.height=t.height,e.width=t.height*n),this.renderCanvas(!0)),this},getCropBoxData:function(){var t=this.cropBoxData,e;return this.ready&&this.cropped&&(e={left:t.left,top:t.top,width:t.width,height:t.height}),e||{}},setCropBoxData:function(t){var e=this.cropBoxData,n=this.options.aspectRatio,l,r;return this.ready&&this.cropped&&!this.disabled&&isPlainObject(t)&&(isNumber(t.left)&&(e.left=t.left),isNumber(t.top)&&(e.top=t.top),isNumber(t.width)&&t.width!==e.width&&(l=!0,e.width=t.width),isNumber(t.height)&&t.height!==e.height&&(r=!0,e.height=t.height),n&&(l?e.height=e.width/n:r&&(e.width=e.height*n)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,n=getSourceCanvas(this.image,this.imageData,e,t);if(!this.cropped)return n;var l=this.getData(),r=l.x,u=l.y,S=l.width,w=l.height,x=n.width/Math.floor(e.naturalWidth);x!==1&&(r*=x,u*=x,S*=x,w*=x);var C=S/w,T=getAdjustedSizes({aspectRatio:C,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),N=getAdjustedSizes({aspectRatio:C,width:t.minWidth||0,height:t.minHeight||0},"cover"),K=getAdjustedSizes({aspectRatio:C,width:t.width||(x!==1?n.width:S),height:t.height||(x!==1?n.height:w)}),P=K.width,H=K.height;P=Math.min(T.width,Math.max(N.width,P)),H=Math.min(T.height,Math.max(N.height,H));var Y=document.createElement("canvas"),W=Y.getContext("2d");Y.width=normalizeDecimalNumber(P),Y.height=normalizeDecimalNumber(H),W.fillStyle=t.fillColor||"transparent",W.fillRect(0,0,P,H);var ie=t.imageSmoothingEnabled,B=ie===void 0?!0:ie,A=t.imageSmoothingQuality;W.imageSmoothingEnabled=B,A&&(W.imageSmoothingQuality=A);var E=n.width,O=n.height,g=r,M=u,z,L,F,k,V,X;g<=-S||g>E?(g=0,z=0,F=0,V=0):g<=0?(F=-g,g=0,z=Math.min(E,S+g),V=z):g<=E&&(F=0,z=Math.min(S,E-g),V=z),z<=0||M<=-w||M>O?(M=0,L=0,k=0,X=0):M<=0?(k=-M,M=0,L=Math.min(O,w+M),X=L):M<=O&&(k=0,L=Math.min(w,O-M),X=L);var G=[g,M,z,L];if(V>0&&X>0){var $=P/S;G.push(F*$,k*$,V*$,X*$)}return W.drawImage.apply(W,[n].concat(_toConsumableArray(G.map(function(re){return Math.floor(normalizeDecimalNumber(re))})))),Y},setAspectRatio:function(t){var e=this.options;return!this.disabled&&!isUndefined(t)&&(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,n=this.dragBox,l=this.face;if(this.ready&&!this.disabled){var r=t===DRAG_MODE_CROP,u=e.movable&&t===DRAG_MODE_MOVE;t=r||u?t:DRAG_MODE_NONE,e.dragMode=t,setData(n,DATA_ACTION,t),toggleClass(n,CLASS_CROP,r),toggleClass(n,CLASS_MOVE,u),e.cropBoxMovable||(setData(l,DATA_ACTION,t),toggleClass(l,CLASS_CROP,r),toggleClass(l,CLASS_MOVE,u))}return this}},AnotherCropper=WINDOW.Cropper,Cropper=function(){function o(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(_classCallCheck(this,o),!t||!REGEXP_TAG_NAME.test(t.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=t,this.options=assign({},DEFAULTS,isPlainObject(e)&&e),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return _createClass(o,[{key:"init",value:function(){var e=this.element,n=e.tagName.toLowerCase(),l;if(!e[NAMESPACE]){if(e[NAMESPACE]=this,n==="img"){if(this.isImg=!0,l=e.getAttribute("src")||"",this.originalUrl=l,!l)return;l=e.src}else n==="canvas"&&window.HTMLCanvasElement&&(l=e.toDataURL());this.load(l)}}},{key:"load",value:function(e){var n=this;if(!!e){this.url=e,this.imageData={};var l=this.element,r=this.options;if(!r.rotatable&&!r.scalable&&(r.checkOrientation=!1),!r.checkOrientation||!window.ArrayBuffer){this.clone();return}if(REGEXP_DATA_URL.test(e)){REGEXP_DATA_URL_JPEG.test(e)?this.read(dataURLToArrayBuffer(e)):this.clone();return}var u=new XMLHttpRequest,S=this.clone.bind(this);this.reloading=!0,this.xhr=u,u.onabort=S,u.onerror=S,u.ontimeout=S,u.onprogress=function(){u.getResponseHeader("content-type")!==MIME_TYPE_JPEG&&u.abort()},u.onload=function(){n.read(u.response)},u.onloadend=function(){n.reloading=!1,n.xhr=null},r.checkCrossOrigin&&isCrossOriginURL(e)&&l.crossOrigin&&(e=addTimestamp(e)),u.open("GET",e,!0),u.responseType="arraybuffer",u.withCredentials=l.crossOrigin==="use-credentials",u.send()}}},{key:"read",value:function(e){var n=this.options,l=this.imageData,r=resetAndGetOrientation(e),u=0,S=1,w=1;if(r>1){this.url=arrayBufferToDataURL(e,MIME_TYPE_JPEG);var x=parseOrientation(r);u=x.rotate,S=x.scaleX,w=x.scaleY}n.rotatable&&(l.rotate=u),n.scalable&&(l.scaleX=S,l.scaleY=w),this.clone()}},{key:"clone",value:function(){var e=this.element,n=this.url,l=e.crossOrigin,r=n;this.options.checkCrossOrigin&&isCrossOriginURL(n)&&(l||(l="anonymous"),r=addTimestamp(n)),this.crossOrigin=l,this.crossOriginUrl=r;var u=document.createElement("img");l&&(u.crossOrigin=l),u.src=r||n,u.alt=e.alt||"The image to crop",this.image=u,u.onload=this.start.bind(this),u.onerror=this.stop.bind(this),addClass(u,CLASS_HIDE),e.parentNode.insertBefore(u,e.nextSibling)}},{key:"start",value:function(){var e=this,n=this.image;n.onload=null,n.onerror=null,this.sizing=!0;var l=WINDOW.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent),r=function(x,C){assign(e.imageData,{naturalWidth:x,naturalHeight:C,aspectRatio:x/C}),e.initialImageData=assign({},e.imageData),e.sizing=!1,e.sized=!0,e.build()};if(n.naturalWidth&&!l){r(n.naturalWidth,n.naturalHeight);return}var u=document.createElement("img"),S=document.body||document.documentElement;this.sizingImage=u,u.onload=function(){r(u.width,u.height),l||S.removeChild(u)},u.src=n.src,l||(u.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",S.appendChild(u))}},{key:"stop",value:function(){var e=this.image;e.onload=null,e.onerror=null,e.parentNode.removeChild(e),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var e=this.element,n=this.options,l=this.image,r=e.parentNode,u=document.createElement("div");u.innerHTML=TEMPLATE;var S=u.querySelector(".".concat(NAMESPACE,"-container")),w=S.querySelector(".".concat(NAMESPACE,"-canvas")),x=S.querySelector(".".concat(NAMESPACE,"-drag-box")),C=S.querySelector(".".concat(NAMESPACE,"-crop-box")),T=C.querySelector(".".concat(NAMESPACE,"-face"));this.container=r,this.cropper=S,this.canvas=w,this.dragBox=x,this.cropBox=C,this.viewBox=S.querySelector(".".concat(NAMESPACE,"-view-box")),this.face=T,w.appendChild(l),addClass(e,CLASS_HIDDEN),r.insertBefore(S,e.nextSibling),removeClass(l,CLASS_HIDE),this.initPreview(),this.bind(),n.initialAspectRatio=Math.max(0,n.initialAspectRatio)||NaN,n.aspectRatio=Math.max(0,n.aspectRatio)||NaN,n.viewMode=Math.max(0,Math.min(3,Math.round(n.viewMode)))||0,addClass(C,CLASS_HIDDEN),n.guides||addClass(C.getElementsByClassName("".concat(NAMESPACE,"-dashed")),CLASS_HIDDEN),n.center||addClass(C.getElementsByClassName("".concat(NAMESPACE,"-center")),CLASS_HIDDEN),n.background&&addClass(S,"".concat(NAMESPACE,"-bg")),n.highlight||addClass(T,CLASS_INVISIBLE),n.cropBoxMovable&&(addClass(T,CLASS_MOVE),setData(T,DATA_ACTION,ACTION_ALL)),n.cropBoxResizable||(addClass(C.getElementsByClassName("".concat(NAMESPACE,"-line")),CLASS_HIDDEN),addClass(C.getElementsByClassName("".concat(NAMESPACE,"-point")),CLASS_HIDDEN)),this.render(),this.ready=!0,this.setDragMode(n.dragMode),n.autoCrop&&this.crop(),this.setData(n.data),isFunction(n.ready)&&addListener(e,EVENT_READY,n.ready,{once:!0}),dispatchEvent(e,EVENT_READY)}}},{key:"unbuild",value:function(){if(!!this.ready){this.ready=!1,this.unbind(),this.resetPreview();var e=this.cropper.parentNode;e&&e.removeChild(this.cropper),removeClass(this.element,CLASS_HIDDEN)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=AnotherCropper,o}},{key:"setDefaults",value:function(e){assign(DEFAULTS,isPlainObject(e)&&e)}}]),o}();assign(Cropper.prototype,render,preview,events,handlers,change,methods);const cropper="",Copper=defineComponent({name:"copper",emits:["close","cropperNo","cropperOk"],setup(o,{slots:t,attrs:e,emit:n,expose:l}){const r=reactive({visible:!1,img:null,confirmLoading:!1,options:{img:"",autoCrop:!0,autoCropWidth:180,autoCropHeight:180,fixedBox:!0,full:!1,enlarge:1,previewsCircle:!0,centerBox:!0,outputType:"png",title:"\u4FEE\u6539\u5934\u50CF",name:null},previews:{},url:{upload:"/sys/common/saveToImgByStr"},myCropper:null}),u=ref(),S=T=>{const{options:N}=r;r.visible=!0,r.options=Object.assign({},N,T),nextTick(()=>{w()})},w=()=>{r.myCropper=new Cropper(u.value,{viewMode:1,dragMode:"move",aspectRatio:r.options.autoCropWidth/r.options.autoCropHeight,initialAspectRatio:1,autoCropArea:1,cropBoxMovable:!0,cropBoxResizable:!1,background:!0,movable:!0,modal:!0,preview:".before"})},x=T=>{switch(T){case"left":r.myCropper.rotate(90);break;case"right":r.myCropper.rotate(-90);break;case"zoomIn":r.myCropper.zoom(.1);break;case"zoomOut":r.myCropper.zoom(-.1);break}},C=()=>{r.confirmLoading=!0,r.myCropper.getCroppedCanvas({imageSmoothingQuality:"high"}).toBlob(T=>{n("cropperOk",T),r.confirmLoading=!1})};return l({edit:S}),()=>createVNode("div",null,[createVNode(NGrid,{cols:2,xGap:24,style:{paddingTop:"12px"}},{default:()=>[createVNode(NGi,null,{default:()=>[createVNode("div",{style:"width: 100%; height: 300px"},[createVNode("img",{ref:u,id:"myImages",src:r.options.img,alt:""},null)]),createVNode(NSpace,{justify:"end",style:{paddingTop:"12px"}},{default:()=>[createVNode(__unplugin_components_3,{type:"primary",size:"small",onClick:()=>x("left")},{default:()=>[createTextVNode("\u9006\u65F6\u9488\u65CB\u8F6C")]}),createVNode(__unplugin_components_3,{type:"primary",size:"small",onClick:()=>x("right")},{default:()=>[createTextVNode("\u987A\u65F6\u9488\u65CB\u8F6C")]}),createVNode(__unplugin_components_3,{type:"primary",size:"small",onClick:()=>x("zoomIn")},{default:()=>[createTextVNode("\u653E\u5927")]}),createVNode(__unplugin_components_3,{type:"primary",size:"small",onClick:()=>x("zoomOut")},{default:()=>[createTextVNode("\u7F29\u5C0F")]})]})]}),createVNode(NGi,null,{default:()=>[createVNode("span",{style:{fontSize:"15px",fontWeight:600,paddingBottom:"8px",display:"inline-block"}},[createTextVNode("\u9884\u89C8\u56FE\u7247")]),createVNode("div",{class:"before",style:{width:r.options.autoCropWidth+"px",height:r.options.autoCropHeight+"px",overflow:"hidden"}},null)]})]}),createVNode(NSpace,{justify:"end"},{default:()=>[createVNode(__unplugin_components_3,{type:"default",onClick:()=>{r.confirmLoading=!1,n("close"),n("cropperNo")}},{default:()=>[createTextVNode("\u53D6\u6D88")]}),createVNode(__unplugin_components_3,{type:"primary",loading:r.confirmLoading,onClick:C},{default:()=>[createTextVNode("\u786E\u8BA4")]})]})])}});var cosJsSdkV5={exports:{}};(function(module,exports){(function(t,e){module.exports=e()})(commonjsGlobal,function(){return function(o){var t={};function e(n){if(t[n])return t[n].exports;var l=t[n]={i:n,l:!1,exports:{}};return o[n].call(l.exports,l,l.exports,e),l.l=!0,l.exports}return e.m=o,e.c=t,e.d=function(n,l,r){e.o(n,l)||Object.defineProperty(n,l,{enumerable:!0,get:r})},e.r=function(n){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},e.t=function(n,l){if(l&1&&(n=e(n)),l&8||l&4&&typeof n=="object"&&n&&n.__esModule)return n;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),l&2&&typeof n!="string")for(var u in n)e.d(r,u,function(S){return n[S]}.bind(null,u));return r},e.n=function(n){var l=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(l,"a",l),l},e.o=function(n,l){return Object.prototype.hasOwnProperty.call(n,l)},e.p="/dist/",e(e.s="./index.js")}({"./index.js":function(o,t,e){var n=e("./src/cos.js");o.exports=n},"./lib/base64.js":function(o,t){var e=function(n){n=n||{};var l=n.Base64,r="2.1.9",u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S=function(L){for(var F={},k=0,V=L.length;k<V;k++)F[L.charAt(k)]=k;return F}(u),w=String.fromCharCode,x=function(F){if(F.length<2){var k=F.charCodeAt(0);return k<128?F:k<2048?w(192|k>>>6)+w(128|k&63):w(224|k>>>12&15)+w(128|k>>>6&63)+w(128|k&63)}else{var k=65536+(F.charCodeAt(0)-55296)*1024+(F.charCodeAt(1)-56320);return w(240|k>>>18&7)+w(128|k>>>12&63)+w(128|k>>>6&63)+w(128|k&63)}},C=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,T=function(F){return F.replace(C,x)},N=function(F){var k=[0,2,1][F.length%3],V=F.charCodeAt(0)<<16|(F.length>1?F.charCodeAt(1):0)<<8|(F.length>2?F.charCodeAt(2):0),X=[u.charAt(V>>>18),u.charAt(V>>>12&63),k>=2?"=":u.charAt(V>>>6&63),k>=1?"=":u.charAt(V&63)];return X.join("")},K=n.btoa?function(L){return n.btoa(L)}:function(L){return L.replace(/[\s\S]{1,3}/g,N)},P=function(L){return K(T(L))},H=function(F,k){return k?P(String(F)).replace(/[+\/]/g,function(V){return V=="+"?"-":"_"}).replace(/=/g,""):P(String(F))},Y=function(F){return H(F,!0)},W=new RegExp(["[\xC0-\xDF][\x80-\xBF]","[\xE0-\xEF][\x80-\xBF]{2}","[\xF0-\xF7][\x80-\xBF]{3}"].join("|"),"g"),ie=function(F){switch(F.length){case 4:var k=(7&F.charCodeAt(0))<<18|(63&F.charCodeAt(1))<<12|(63&F.charCodeAt(2))<<6|63&F.charCodeAt(3),V=k-65536;return w((V>>>10)+55296)+w((V&1023)+56320);case 3:return w((15&F.charCodeAt(0))<<12|(63&F.charCodeAt(1))<<6|63&F.charCodeAt(2));default:return w((31&F.charCodeAt(0))<<6|63&F.charCodeAt(1))}},B=function(F){return F.replace(W,ie)},A=function(F){var k=F.length,V=k%4,X=(k>0?S[F.charAt(0)]<<18:0)|(k>1?S[F.charAt(1)]<<12:0)|(k>2?S[F.charAt(2)]<<6:0)|(k>3?S[F.charAt(3)]:0),G=[w(X>>>16),w(X>>>8&255),w(X&255)];return G.length-=[0,0,2,1][V],G.join("")},E=n.atob?function(L){return n.atob(L)}:function(L){return L.replace(/[\s\S]{1,4}/g,A)},O=function(L){return B(E(L))},g=function(F){return O(String(F).replace(/[-_]/g,function(k){return k=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},M=function(){var F=n.Base64;return n.Base64=l,F},z={VERSION:r,atob:E,btoa:K,fromBase64:g,toBase64:H,utob:T,encode:H,encodeURI:Y,btou:B,decode:g,noConflict:M};return z}();o.exports=e},"./lib/beacon.min.js":function(o,t,e){var n,l,r=e("./node_modules/@babel/runtime/helpers/typeof.js");(function(u,S){r(t)=="object"&&typeof o!="undefined"?o.exports=S():(n=S,l=typeof n=="function"?n.call(t,e,t,o):n,l!==void 0&&(o.exports=l))})(this,function(){var u=function(c,a){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,m){d.__proto__=m}||function(d,m){for(var D in m)Object.prototype.hasOwnProperty.call(m,D)&&(d[D]=m[D])},u(c,a)},S=function(){return S=Object.assign||function(c){for(var a,d=1,m=arguments.length;d<m;d++)for(var D in a=arguments[d])Object.prototype.hasOwnProperty.call(a,D)&&(c[D]=a[D]);return c},S.apply(this,arguments)};function w(h,c,a,d){return new(a||(a=Promise))(function(m,D){function U(he){try{de(d.next(he))}catch(J){D(J)}}function Q(he){try{de(d.throw(he))}catch(J){D(J)}}function de(he){var J;he.done?m(he.value):(J=he.value,J instanceof a?J:new a(function(xe){xe(J)})).then(U,Q)}de((d=d.apply(h,c||[])).next())})}function x(h,c){var a,d,m,D,U={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return D={next:Q(0),throw:Q(1),return:Q(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function Q(de){return function(he){return function(J){if(a)throw new TypeError("Generator is already executing.");for(;U;)try{if(a=1,d&&(m=2&J[0]?d.return:J[0]?d.throw||((m=d.return)&&m.call(d),0):d.next)&&!(m=m.call(d,J[1])).done)return m;switch(d=0,m&&(J=[2&J[0],m.value]),J[0]){case 0:case 1:m=J;break;case 4:return U.label++,{value:J[1],done:!1};case 5:U.label++,d=J[1],J=[0];continue;case 7:J=U.ops.pop(),U.trys.pop();continue;default:if(m=U.trys,!((m=m.length>0&&m[m.length-1])||J[0]!==6&&J[0]!==2)){U=0;continue}if(J[0]===3&&(!m||J[1]>m[0]&&J[1]<m[3])){U.label=J[1];break}if(J[0]===6&&U.label<m[1]){U.label=m[1],m=J;break}if(m&&U.label<m[2]){U.label=m[2],U.ops.push(J);break}m[2]&&U.ops.pop(),U.trys.pop();continue}J=c.call(h,U)}catch(xe){J=[6,xe],d=0}finally{a=m=0}if(5&J[0])throw J[1];return{value:J[0]?J[1]:void 0,done:!0}}([de,he])}}}var C="__BEACON_",T="__BEACON_deviceId",N="last_report_time",K="sending_event_ids",P="beacon_config",H="beacon_config_request_time",Y=function(){function h(){var c=this;this.emit=function(a,d){if(c){var m,D=c.__EventsList[a];if(D!=null&&D.length){D=D.slice();for(var U=0;U<D.length;U++){m=D[U];try{var Q=m.callback.apply(c,[d]);if(m.type===1&&c.remove(a,m.callback),Q===!1)break}catch(de){throw de}}}return c}},this.__EventsList={}}return h.prototype.indexOf=function(c,a){for(var d=0;d<c.length;d++)if(c[d].callback===a)return d;return-1},h.prototype.on=function(c,a,d){if(d===void 0&&(d=0),this){var m=this.__EventsList[c];if(m||(m=this.__EventsList[c]=[]),this.indexOf(m,a)===-1){var D={name:c,type:d||0,callback:a};return m.push(D),this}return this}},h.prototype.one=function(c,a){this.on(c,a,1)},h.prototype.remove=function(c,a){if(this){var d=this.__EventsList[c];if(!d)return null;if(!a){try{delete this.__EventsList[c]}catch(D){}return null}if(d.length){var m=this.indexOf(d,a);d.splice(m,1)}return this}},h}();function W(h,c){for(var a={},d=0,m=Object.keys(h);d<m.length;d++){var D=m[d],U=h[D];if(typeof U=="string")a[ie(D)]=ie(U);else{if(c)throw new Error("value mast be string !!!!");a[ie(String(D))]=ie(String(U))}}return a}function ie(h){if(typeof h!="string")return h;try{return h.replace(new RegExp("\\|","g"),"%7C").replace(new RegExp("\\&","g"),"%26").replace(new RegExp("\\=","g"),"%3D").replace(new RegExp("\\+","g"),"%2B")}catch(c){return""}}function B(h){return String(h.A99)+String(h.A100)}var A=function(){},E=function(){function h(c){var a=this;this.lifeCycle=new Y,this.uploadJobQueue=[],this.additionalParams={},this.delayTime=0,this._normalLogPipeline=function(d){if(!d||!d.reduce||!d.length)throw new TypeError("createPipeline \u65B9\u6CD5\u9700\u8981\u4F20\u5165\u81F3\u5C11\u6709\u4E00\u4E2A pipe \u7684\u6570\u7EC4");return d.length===1?function(m,D){d[0](m,D||A)}:d.reduce(function(m,D){return function(U,Q){return Q===void 0&&(Q=A),m(U,function(de){return D==null?void 0:D(de,Q)})}})}([function(d){a.send({url:a.strategy.getUploadUrl(),data:d,method:"post",contentType:"application/json;charset=UTF-8"},function(){var m=a.config.onReportSuccess;typeof m=="function"&&m(JSON.stringify(d.events))},function(){var m=a.config.onReportFail;typeof m=="function"&&m(JSON.stringify(d.events))})}]),function(d,m){if(!d)throw m instanceof Error?m:new Error(m)}(Boolean(c.appkey),"appkey must be initial"),this.config=S({},c)}return h.prototype.onUserAction=function(c,a){this.preReport(c,a,!1)},h.prototype.onDirectUserAction=function(c,a){this.preReport(c,a,!0)},h.prototype.preReport=function(c,a,d){c?this.strategy.isEventUpOnOff()&&(this.strategy.isBlackEvent(c)||this.strategy.isSampleEvent(c)||this.onReport(c,a,d)):this.errorReport.reportError("602"," no eventCode")},h.prototype.addAdditionalParams=function(c){for(var a=0,d=Object.keys(c);a<d.length;a++){var m=d[a];this.additionalParams[m]=c[m]}},h.prototype.setChannelId=function(c){this.commonInfo.channelID=String(c)},h.prototype.setOpenId=function(c){this.commonInfo.openid=String(c)},h.prototype.setUnionid=function(c){this.commonInfo.unid=String(c)},h.prototype.getDeviceId=function(){return this.commonInfo.deviceId},h.prototype.getCommonInfo=function(){return this.commonInfo},h.prototype.removeSendingId=function(c){try{var a=JSON.parse(this.storage.getItem(K)),d=a.indexOf(c);d!=-1&&(a.splice(d,1),this.storage.setItem(K,JSON.stringify(a)))}catch(m){}},h}(),O=function(){function h(c,a,d,m){this.requestParams={},this.network=m,this.requestParams.attaid="00400014144",this.requestParams.token="6478159937",this.requestParams.product_id=c.appkey,this.requestParams.platform=d,this.requestParams.uin=a.deviceId,this.requestParams.model="",this.requestParams.os=d,this.requestParams.app_version=c.appVersion,this.requestParams.sdk_version=a.sdkVersion,this.requestParams.error_stack="",this.uploadUrl=c.isOversea?"https://htrace.wetvinfo.com/kv":"https://h.trace.qq.com/kv"}return h.prototype.reportError=function(c,a){this.requestParams._dc=Math.random(),this.requestParams.error_msg=a,this.requestParams.error_code=c,this.network.get(this.uploadUrl,{params:this.requestParams}).catch(function(d){})},h}(),g=function(){function h(c,a,d,m,D){this.strategy={isEventUpOnOff:!0,httpsUploadUrl:"https://otheve.beacon.qq.com/analytics/v2_upload",requestInterval:30,blacklist:[],samplelist:[]},this.realSample={},this.appkey="",this.needQueryConfig=!0,this.appkey=a.appkey,this.storage=m,this.needQueryConfig=c;try{var U=JSON.parse(this.storage.getItem(P));U&&this.processData(U)}catch(Q){}a.isOversea&&(this.strategy.httpsUploadUrl="https://svibeacon.onezapp.com/analytics/v2_upload"),!a.isOversea&&this.needRequestConfig()&&this.requestConfig(a.appVersion,d,D)}return h.prototype.requestConfig=function(c,a,d){var m=this;this.storage.setItem(H,Date.now().toString()),d.post("https://oth.str.beacon.qq.com/trpc.beacon.configserver.BeaconConfigService/QueryConfig",{platformId:typeof wx=="undefined"?"3":"4",mainAppKey:this.appkey,appVersion:c,sdkVersion:a.sdkVersion,osVersion:a.userAgent,model:"",packageName:"",params:{A3:a.deviceId}}).then(function(D){if(D.data.ret==0)try{var U=JSON.parse(D.data.beaconConfig);U&&(m.processData(U),m.storage.setItem(P,D.data.beaconConfig))}catch(Q){}else m.processData(null),m.storage.setItem(P,"")}).catch(function(D){})},h.prototype.processData=function(c){var a,d,m,D,U;this.strategy.isEventUpOnOff=(a=c==null?void 0:c.isEventUpOnOff)!==null&&a!==void 0?a:this.strategy.isEventUpOnOff,this.strategy.httpsUploadUrl=(d=c==null?void 0:c.httpsUploadUrl)!==null&&d!==void 0?d:this.strategy.httpsUploadUrl,this.strategy.requestInterval=(m=c==null?void 0:c.requestInterval)!==null&&m!==void 0?m:this.strategy.requestInterval,this.strategy.blacklist=(D=c==null?void 0:c.blacklist)!==null&&D!==void 0?D:this.strategy.blacklist,this.strategy.samplelist=(U=c==null?void 0:c.samplelist)!==null&&U!==void 0?U:this.strategy.samplelist;for(var Q=0,de=this.strategy.samplelist;Q<de.length;Q++){var he=de[Q].split(",");he.length==2&&(this.realSample[he[0]]=he[1])}},h.prototype.needRequestConfig=function(){if(!this.needQueryConfig)return!1;var c=Number(this.storage.getItem(H));return Date.now()-c>60*this.strategy.requestInterval*1e3},h.prototype.getUploadUrl=function(){return this.strategy.httpsUploadUrl+"?appkey="+this.appkey},h.prototype.isBlackEvent=function(c){return this.strategy.blacklist.indexOf(c)!=-1},h.prototype.isEventUpOnOff=function(){return this.strategy.isEventUpOnOff},h.prototype.isSampleEvent=function(c){return!!Object.prototype.hasOwnProperty.call(this.realSample,c)&&this.realSample[c]<Math.floor(Math.random()*Math.floor(1e4))},h}(),M="session_storage_key",z=function(){function h(c,a,d){this.getSessionStackDepth=0,this.beacon=d,this.storage=c,this.duration=a,this.appkey=d.config.appkey}return h.prototype.getSession=function(){this.getSessionStackDepth+=1;var c=this.storage.getItem(M);if(!c)return this.createSession();var a="",d=0;try{var m=JSON.parse(c)||{sessionId:void 0,sessionStart:void 0};if(!m.sessionId||!m.sessionStart)return this.createSession();var D=Number(this.storage.getItem(N));if(Date.now()-D>this.duration)return this.createSession();a=m.sessionId,d=m.sessionStart,this.getSessionStackDepth=0}catch(U){}return{sessionId:a,sessionStart:d}},h.prototype.createSession=function(){var c=Date.now(),a={sessionId:this.appkey+"_"+c.toString(),sessionStart:c};this.storage.setItem(M,JSON.stringify(a)),this.storage.setItem(N,c.toString());var d="is_new_user",m=this.storage.getItem(d);return this.getSessionStackDepth<=1&&this.beacon.onDirectUserAction("rqd_applaunched",{A21:m?"N":"Y"}),this.storage.setItem(d,JSON.stringify(!1)),a},h}();function L(){var h=navigator.userAgent,c=h.indexOf("compatible")>-1&&h.indexOf("MSIE")>-1,a=h.indexOf("Edge")>-1&&!c,d=h.indexOf("Trident")>-1&&h.indexOf("rv:11.0")>-1;if(c){new RegExp("MSIE (\\d+\\.\\d+);").test(h);var m=parseFloat(RegExp.$1);return m==7?7:m==8?8:m==9?9:m==10?10:6}return a?-2:d?11:-1}function F(h,c){var a,d;return(a="https://tun-cos-1258344701.file.myqcloud.com/fp.js",d===void 0&&(d=Date.now()+"-"+Math.random()),new Promise(function(m,D){if(document.getElementById(d))m(void 0);else{var U=document.getElementsByTagName("head")[0],Q=document.createElement("script");Q.onload=function(){return function(){Q.onload=null,m(void 0)}},Q.onerror=function(de){Q.onerror=null,U.removeChild(Q),D(de)},Q.src=a,Q.id=d,U.appendChild(Q)}})).then(function(){new Fingerprint().getQimei36(h,c)}).catch(function(m){}),""}var k=function(){return(k=Object.assign||function(c){for(var a,d=1,m=arguments.length;d<m;d++)for(var D in a=arguments[d])Object.prototype.hasOwnProperty.call(a,D)&&(c[D]=a[D]);return c}).apply(this,arguments)},V,X=function(){function h(c,a){a===void 0&&(a={}),this.reportOptions={},this.config=c,this.reportOptions=a}return h.canUseDB=function(){return!!(window!=null&&window.indexedDB)},h.prototype.openDB=function(){var c=this;return new Promise(function(a,d){if(!h.canUseDB())return d({message:"\u5F53\u524D\u4E0D\u652F\u6301 indexeddb"});var m=c.config,D=m.name,U=m.version,Q=m.stores,de=indexedDB.open(D,U);de.onsuccess=function(){c.db=de.result,a(),k({result:1,func:"open",params:JSON.stringify(c.config)},c.reportOptions)},de.onerror=function(he){var J,xe;d(he),k({result:0,func:"open",params:JSON.stringify(c.config),error_msg:(xe=(J=he.target)===null||J===void 0?void 0:J.error)===null||xe===void 0?void 0:xe.message},c.reportOptions)},de.onupgradeneeded=function(){c.db=de.result;try{Q==null||Q.forEach(function(he){c.createStore(he)})}catch(he){k({result:0,func:"open",params:JSON.stringify(c.config),error_msg:he.message},c.reportOptions),d(he)}}})},h.prototype.useStore=function(c){return this.storeName=c,this},h.prototype.deleteDB=function(){var c=this;return this.closeDB(),new Promise(function(a,d){var m=indexedDB.deleteDatabase(c.config.name);m.onsuccess=function(){return a()},m.onerror=d})},h.prototype.closeDB=function(){var c;(c=this.db)===null||c===void 0||c.close(),this.db=null},h.prototype.getStoreCount=function(){var c=this;return new Promise(function(a,d){var m=c.getStore("readonly").count();m.onsuccess=function(){return a(m.result)},m.onerror=d})},h.prototype.clearStore=function(){var c=this;return new Promise(function(a,d){var m=c.getStore("readwrite").clear();m.onsuccess=function(){return a()},m.onerror=d})},h.prototype.add=function(c,a){var d=this;return new Promise(function(m,D){var U=d.getStore("readwrite").add(c,a);U.onsuccess=function(){m(U.result)},U.onerror=D})},h.prototype.put=function(c,a){var d=this;return new Promise(function(m,D){var U=d.getStore("readwrite").put(c,a);U.onsuccess=function(){m(U.result)},U.onerror=D})},h.prototype.getStoreAllData=function(){var c=this;return new Promise(function(a,d){var m=c.getStore("readonly").openCursor(),D=[];m.onsuccess=function(){var U;if(!((U=m.result)===null||U===void 0)&&U.value){var Q=m.result.value;D.push(Q),m.result.continue()}else a(D)},m.onerror=d})},h.prototype.getDataRangeByIndex=function(c,a,d,m,D){var U=this;return new Promise(function(Q,de){var he=U.getStore().index(c),J=IDBKeyRange.bound(a,d,m,D),xe=[],Be=he.openCursor(J);Be.onsuccess=function(){var Ue;!((Ue=Be==null?void 0:Be.result)===null||Ue===void 0)&&Ue.value?(xe.push(Be==null?void 0:Be.result.value),Be==null||Be.result.continue()):Q(xe)},Be.onerror=de})},h.prototype.removeDataByIndex=function(c,a,d,m,D){var U=this;return new Promise(function(Q,de){var he=U.getStore("readwrite").index(c),J=IDBKeyRange.bound(a,d,m,D),xe=he.openCursor(J),Be=0;xe.onsuccess=function(Ue){var _e=Ue.target.result;_e?(Be+=1,_e.delete(),_e.continue()):Q(Be)},xe.onerror=de})},h.prototype.createStore=function(c){var a=c.name,d=c.indexes,m=d===void 0?[]:d,D=c.options;if(this.db){this.db.objectStoreNames.contains(a)&&this.db.deleteObjectStore(a);var U=this.db.createObjectStore(a,D);m.forEach(function(Q){U.createIndex(Q.indexName,Q.keyPath,Q.options)})}},h.prototype.getStore=function(c){var a;return c===void 0&&(c="readonly"),(a=this.db)===null||a===void 0?void 0:a.transaction(this.storeName,c).objectStore(this.storeName)},h}(),G="event_table_v3",$="eventId",re=function(){function h(c){this.isReady=!1,this.taskQueue=Promise.resolve(),this.db=new X({name:"Beacon_"+c+"_V3",version:1,stores:[{name:G,options:{keyPath:$},indexes:[{indexName:$,keyPath:$,options:{unique:!0}}]}]}),this.open()}return h.prototype.getCount=function(){var c=this;return this.readyExec(function(){return c.db.getStoreCount()})},h.prototype.setItem=function(c,a){var d=this;return this.readyExec(function(){return d.db.add({eventId:c,value:a})})},h.prototype.getItem=function(c){return w(this,void 0,void 0,function(){var a=this;return x(this,function(d){return[2,this.readyExec(function(){return a.db.getDataRangeByIndex($,c,c)})]})})},h.prototype.removeItem=function(c){var a=this;return this.readyExec(function(){return a.db.removeDataByIndex($,c,c)})},h.prototype.updateItem=function(c,a){var d=this;return this.readyExec(function(){return d.db.put({eventId:c,value:a})})},h.prototype.iterate=function(c){var a=this;return this.readyExec(function(){return a.db.getStoreAllData().then(function(d){d.forEach(function(m){c(m.value)})})})},h.prototype.open=function(){return w(this,void 0,void 0,function(){var c=this;return x(this,function(a){switch(a.label){case 0:return this.taskQueue=this.taskQueue.then(function(){return c.db.openDB()}),[4,this.taskQueue];case 1:return a.sent(),this.isReady=!0,this.db.useStore(G),[2]}})})},h.prototype.readyExec=function(c){return this.isReady?c():(this.taskQueue=this.taskQueue.then(function(){return c()}),this.taskQueue)},h}(),ue=function(){function h(c){this.keyObject={},this.storage=c}return h.prototype.getCount=function(){return this.storage.getStoreCount()},h.prototype.removeItem=function(c){this.storage.removeItem(c),delete this.keyObject[c]},h.prototype.setItem=function(c,a){var d=JSON.stringify(a);this.storage.setItem(c,d),this.keyObject[c]=a},h.prototype.iterate=function(c){for(var a=Object.keys(this.keyObject),d=0;d<a.length;d++){var m=this.storage.getItem(a[d]);c(JSON.parse(m))}},h}(),oe=function(){function h(c,a){var d=this;this.dbEventCount=0,L()>0||!window.indexedDB||/X5Lite/.test(navigator.userAgent)?(this.store=new ue(a),this.dbEventCount=this.store.getCount()):(this.store=new re(c),this.getCount().then(function(m){d.dbEventCount=m}).catch(function(m){}))}return h.prototype.getCount=function(){return w(this,void 0,void 0,function(){return x(this,function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),[4,this.store.getCount()];case 1:return[2,c.sent()];case 2:return c.sent(),[2,Promise.reject()];case 3:return[2]}})})},h.prototype.insertEvent=function(c,a){return w(this,void 0,void 0,function(){var d,m;return x(this,function(D){switch(D.label){case 0:if(this.dbEventCount>=1e4)return[2,Promise.reject()];d=B(c.mapValue),D.label=1;case 1:return D.trys.push([1,3,,4]),this.dbEventCount++,[4,this.store.setItem(d,c)];case 2:return[2,D.sent()];case 3:return m=D.sent(),a&&a(m,c),this.dbEventCount--,[2,Promise.reject()];case 4:return[2]}})})},h.prototype.getEvents=function(){return w(this,void 0,void 0,function(){var c;return x(this,function(a){switch(a.label){case 0:c=[],a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.store.iterate(function(d){c.push(d)})];case 2:return a.sent(),[2,Promise.all(c)];case 3:return a.sent(),[2,Promise.all(c)];case 4:return[2]}})})},h.prototype.removeEvent=function(c){return w(this,void 0,void 0,function(){var a;return x(this,function(d){switch(d.label){case 0:a=B(c.mapValue),d.label=1;case 1:return d.trys.push([1,3,,4]),this.dbEventCount--,[4,this.store.removeItem(a)];case 2:return[2,d.sent()];case 3:return d.sent(),this.dbEventCount++,[2,Promise.reject()];case 4:return[2]}})})},h}(),ee=function(){return(ee=Object.assign||function(c){for(var a,d=1,m=arguments.length;d<m;d++)for(var D in a=arguments[d])Object.prototype.hasOwnProperty.call(a,D)&&(c[D]=a[D]);return c}).apply(this,arguments)};function ce(h){try{return decodeURIComponent(h.replace(/\+/g," "))}catch(c){return null}}function ae(h,c){var a=[null,void 0,"",NaN].includes(h);if(c.isSkipEmpty&&a)return null;var d=!c.isSkipEmpty&&a?"":h;try{return c.encode?encodeURIComponent(d):d}catch(m){return null}}function pe(h,c){c===void 0&&(c={encode:!0,isSkipEmpty:!1});var a=h.url,d=h.query,m=d===void 0?{}:d,D=h.hash,U=a.split("#"),Q=U[0],de=U[1],he=de===void 0?"":de,J=Q.split("?")[0],xe=[],Be=ae(D||he,c),Ue=ee(ee({},function(_e){var Le=_e.split("#"),Ve=Le[0],qe=Le[1],Ge=qe===void 0?"":qe,Ke=Ve.split("?"),We=Ke[0],Xe=Ke[1],it=Xe===void 0?"":Xe,et=ce(Ge),rt=Object.create(null);return it.split("&").forEach(function(f){var v=f.split("="),I=v[0],q=v[1],fe=q===void 0?"":q,Re=ce(I),Me=ce(fe);Re===null||Me===null||Re===""&&Me===""||rt[Re]||(rt[Re]=Me)}),{url:We,query:rt,hash:et}}(a).query),m);return Object.keys(Ue).forEach(function(_e){var Le=ae(_e,c),Ve=ae(Ue[_e],c);Le!==null&&Ve!==null&&xe.push(Le+"="+Ve)}),J+(xe.length?"?"+xe.join("&"):"")+(Be?"#"+Be:"")}function Z(h,c){return new Promise(function(a,d){if(c&&document.querySelectorAll("script[data-tag="+c+"]").length)return a();var m=document.createElement("script"),D=ee({type:"text/javascript",charset:"utf-8"},h);Object.keys(D).forEach(function(U){return function(Q,de,he){if(Q)return he===void 0?Q.getAttribute(de):Q.setAttribute(de,he)}(m,U,D[U])}),c&&(m.dataset.tag=c),m.onload=function(){return a()},m.onreadystatechange=function(){var U=m.readyState;["complete","loaded"].includes(U)&&(m.onreadystatechange=null,a())},m.onerror=d,document.body.appendChild(m)})}(function(h){h[h.equal=0]="equal",h[h.low=-1]="low",h[h.high=1]="high"})(V||(V={}));var ne=function(){return(ne=Object.assign||function(c){for(var a,d=1,m=arguments.length;d<m;d++)for(var D in a=arguments[d])Object.prototype.hasOwnProperty.call(a,D)&&(c[D]=a[D]);return c}).apply(this,arguments)};function ge(h,c,a,d){return new(a||(a=Promise))(function(m,D){function U(he){try{de(d.next(he))}catch(J){D(J)}}function Q(he){try{de(d.throw(he))}catch(J){D(J)}}function de(he){var J;he.done?m(he.value):(J=he.value,J instanceof a?J:new a(function(xe){xe(J)})).then(U,Q)}de((d=d.apply(h,c||[])).next())})}function me(h,c){var a,d,m,D,U={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return D={next:Q(0),throw:Q(1),return:Q(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function Q(de){return function(he){return function(J){if(a)throw new TypeError("Generator is already executing.");for(;U;)try{if(a=1,d&&(m=2&J[0]?d.return:J[0]?d.throw||((m=d.return)&&m.call(d),0):d.next)&&!(m=m.call(d,J[1])).done)return m;switch(d=0,m&&(J=[2&J[0],m.value]),J[0]){case 0:case 1:m=J;break;case 4:return U.label++,{value:J[1],done:!1};case 5:U.label++,d=J[1],J=[0];continue;case 7:J=U.ops.pop(),U.trys.pop();continue;default:if(!((m=(m=U.trys).length>0&&m[m.length-1])||J[0]!==6&&J[0]!==2)){U=0;continue}if(J[0]===3&&(!m||J[1]>m[0]&&J[1]<m[3])){U.label=J[1];break}if(J[0]===6&&U.label<m[1]){U.label=m[1],m=J;break}if(m&&U.label<m[2]){U.label=m[2],U.ops.push(J);break}m[2]&&U.ops.pop(),U.trys.pop();continue}J=c.call(h,U)}catch(xe){J=[6,xe],d=0}finally{a=m=0}if(5&J[0])throw J[1];return{value:J[0]?J[1]:void 0,done:!0}}([de,he])}}}var ve=function(){function h(){this.interceptors=[]}return h.prototype.use=function(c,a){return this.interceptors.push({resolved:c,rejected:a}),this.interceptors.length-1},h.prototype.traverse=function(c,a){a===void 0&&(a=!1);var d=Promise.resolve(c);return(a?Array.prototype.reduceRight:Array.prototype.reduce).call(this.interceptors,function(m,D){if(D){var U=D.resolved,Q=D.rejected;d=d.then(U,Q)}return m},""),d},h.prototype.eject=function(c){this.interceptors[c]&&(this.interceptors[c]=null)},h}(),ye={defaults:{timeout:0,method:"GET",mode:"cors",redirect:"follow",credentials:"same-origin"},headers:{common:{Accept:"application/json, text/plain, */*"},POST:{"Content-Type":"application/x-www-form-urlencoded"},PUT:{"Content-Type":"application/x-www-form-urlencoded"},PATCH:{"Content-Type":"application/x-www-form-urlencoded"}},baseURL:"",polyfillUrl:"https://vm.gtimg.cn/comps/script/fetch.min.js",interceptors:{request:new ve,response:new ve}},Ce=/^([a-z][a-z\d+\-.]*:)?\/\//i,Ee=Object.prototype.toString;function be(h){return ge(this,void 0,void 0,function(){var c;return me(this,function(a){switch(a.label){case 0:if(window.fetch)return[2];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,Z({src:h})];case 2:return a.sent(),[3,4];case 3:throw c=a.sent(),new Error("\u52A0\u8F7D polyfill "+h+" \u5931\u8D25: "+c.message);case 4:return[2]}})})}function Oe(h){return["Accept","Content-Type"].forEach(function(c){return a=c,void((d=h.headers)&&Object.keys(d).forEach(function(m){m!==a&&m.toUpperCase()===a.toUpperCase()&&(d[a]=d[m],delete d[m])}));var a,d}),function(c){if(Ee.call(c)!=="[object Object]")return!1;var a=Object.getPrototypeOf(c);return a===null||a===Object.prototype}(h.body)&&(h.body=JSON.stringify(h.body),h.headers&&(h.headers["Content-Type"]="application/json;charset=utf-8")),h}function we(h){return ge(this,void 0,void 0,function(){var c,a,d,m,D,U,Q,de,he,J,xe,Be,Ue,_e,Le,Ve,qe;return me(this,function(Ge){switch(Ge.label){case 0:return c=ye.baseURL,a=ye.defaults,d=ye.interceptors,[4,be(ye.polyfillUrl)];case 1:return Ge.sent(),(m=ne(ne({},a),h)).headers||(m.headers=function(Ke){Ke===void 0&&(Ke="GET");var We=ye.headers[Ke]||{};return ne(ne({},ye.headers.common),We)}(m.method)),Oe(m),[4,d.request.traverse(m,!0)];case 2:if((D=Ge.sent())instanceof Error)throw D;return D.url=function(Ke,We){return!Ke||Ce.test(We)?We:Ke.replace(/\/+$/,"")+"/"+We.replace(/^\/+/,"")}(c,D.url),U=D.url,Q=D.timeout,de=D.params,he=D.method,J=["GET","DELETE","OPTIONS","HEAD"].includes(he===void 0?"GET":he)&&!!de,xe=J?pe({url:U,query:de}):U,Be=[],Q&&!D.signal&&(Le=new Promise(function(Ke){Ue=setTimeout(function(){Ke(new Error("timeout"))},Q)}),Be.push(Le),_e=new AbortController,D.signal=_e.signal),Be.push(fetch(xe,D).catch(function(Ke){return Ke})),[4,Promise.race(Be)];case 3:return Ve=Ge.sent(),Ue&&clearTimeout(Ue),[4,d.response.traverse(Ve)];case 4:if((qe=Ge.sent())instanceof Error)throw _e==null||_e.abort(),qe;return[2,qe]}})})}var De=function(){function h(c){ye.interceptors.request.use(function(a){var d=a.url,m=a.method,D=a.body,U=D;if(c.onReportBeforeSend){var Q=c.onReportBeforeSend({url:d,method:m,data:D?JSON.parse(D):null});U=Q!=null&&Q.data?JSON.stringify(Q.data):null}return m!="GET"&&U?S(S({},a),{body:U}):a})}return h.prototype.get=function(c,a){return w(this,void 0,void 0,function(){var d,m;return x(this,function(D){switch(D.label){case 0:return[4,we(S({url:c},a))];case 1:return[4,(d=D.sent()).json()];case 2:return m=D.sent(),[2,Promise.resolve({data:m,status:d.status,statusText:d.statusText,headers:d.headers})]}})})},h.prototype.post=function(c,a,d){return w(this,void 0,void 0,function(){var m,D;return x(this,function(U){switch(U.label){case 0:return[4,we(S({url:c,body:a,method:"POST"},d))];case 1:return[4,(m=U.sent()).json()];case 2:return D=U.sent(),[2,Promise.resolve({data:D,status:m.status,statusText:m.statusText,headers:m.headers})]}})})},h}(),He=function(){function h(c){this.appkey=c}return h.prototype.getItem=function(c){try{return window.localStorage.getItem(this.getStoreKey(c))}catch(a){return""}},h.prototype.removeItem=function(c){try{window.localStorage.removeItem(this.getStoreKey(c))}catch(a){}},h.prototype.setItem=function(c,a){try{window.localStorage.setItem(this.getStoreKey(c),a)}catch(d){}},h.prototype.setSessionItem=function(c,a){try{window.sessionStorage.setItem(this.getStoreKey(c),a)}catch(d){}},h.prototype.getSessionItem=function(c){try{return window.sessionStorage.getItem(this.getStoreKey(c))}catch(a){return""}},h.prototype.getStoreKey=function(c){return C+this.appkey+"_"+c},h.prototype.createDeviceId=function(){try{var c=window.localStorage.getItem(T);return c||(c=function(a){for(var d="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz0123456789",m="",D=0;D<a;D++)m+=d.charAt(Math.floor(Math.random()*d.length));return m}(32),window.localStorage.setItem(T,c)),c}catch(a){return""}},h.prototype.clear=function(){try{for(var c=window.localStorage.length,a=0;a<c;a++){var d=window.localStorage.key(a);(d==null?void 0:d.substr(0,9))==C&&window.localStorage.removeItem(d)}}catch(m){}},h.prototype.getStoreCount=function(){var c=0;try{c=window.localStorage.length}catch(a){}return c},h}(),Pe="logid_start",se="4.5.14-web";return function(h){function c(a){var d=h.call(this,a)||this;d.qimei36="",d.uselessCycleTaskNum=0,d.underWeakNet=!1,d.pauseSearching=!1,d.send=function(Q,de,he){d.storage.setItem(N,Date.now().toString()),d.network.post(d.uploadUrl||d.strategy.getUploadUrl(),Q.data).then(function(J){var xe;((xe=J==null?void 0:J.data)===null||xe===void 0?void 0:xe.result)==100?d.delayTime=1e3*J.data.delayTime:d.delayTime=0,de&&de(Q.data),Q.data.events.forEach(function(Be){d.store.removeEvent(Be).then(function(){d.removeSendingId(B(Be.mapValue))})}),d.doCustomCycleTask()}).catch(function(J){var xe=Q.data.events;d.errorReport.reportError(J.code?J.code.toString():"600",J.message),he&&he(Q.data);var Be=JSON.parse(d.storage.getItem(K));xe.forEach(function(Ue){Be&&Be.indexOf(B(Ue))!=-1&&d.store.insertEvent(Ue,function(_e,Le){_e&&d.errorReport.reportError("604","insertEvent fail!")}),d.removeSendingId(B(Ue))}),d.monitorUploadFailed()})};var m,D,U=L();return d.isUnderIE8=U>0&&U<8,d.isUnderIE8||(d.isUnderIE=U>0,a.needInitQimei&&F(a.appkey,function(Q){d.qimei36=Q.q36}),d.network=new De(a),d.storage=new He(a.appkey),d.initCommonInfo(a),d.store=new oe(a.appkey,d.storage),d.errorReport=new O(d.config,d.commonInfo,"web",d.network),d.strategy=new g(a.needQueryConfig==null||a.needQueryConfig,d.config,d.commonInfo,d.storage,d.network),d.logidStartTime=d.storage.getItem(Pe),d.logidStartTime||(d.logidStartTime=Date.now().toString(),d.storage.setItem(Pe,d.logidStartTime)),m=d.logidStartTime,D=Date.now()-Number.parseFloat(m),Math.floor(D/864e5)>=365&&d.storage.clear(),d.initSession(a),d.onDirectUserAction("rqd_js_init",{}),setTimeout(function(){return d.lifeCycle.emit("init")},0),d.initDelayTime=a.delay?a.delay:1e3,d.cycleTask(d.initDelayTime)),d}return function(a,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function m(){this.constructor=a}u(a,d),a.prototype=d===null?Object.create(d):(m.prototype=d.prototype,new m)}(c,h),c.prototype.initSession=function(a){var d=18e5;a.sessionDuration&&a.sessionDuration>3e4&&(d=a.sessionDuration),this.beaconSession=new z(this.storage,d,this)},c.prototype.initCommonInfo=function(a){var d=Number(this.storage.getItem(N));try{var m=JSON.parse(this.storage.getItem(K));(Date.now()-d>3e4||!m)&&this.storage.setItem(K,JSON.stringify([]))}catch(U){}a.uploadUrl&&(this.uploadUrl=a.uploadUrl+"?appkey="+a.appkey);var D=[window.screen.width,window.screen.height];window.devicePixelRatio&&D.push(window.devicePixelRatio),this.commonInfo={deviceId:this.storage.createDeviceId(),language:navigator&&navigator.language||"zh_CN",query:window.location.search,userAgent:navigator.userAgent,pixel:D.join("*"),channelID:a.channelID?String(a.channelID):"",openid:a.openid?String(a.openid):"",unid:a.unionid?String(a.unionid):"",sdkVersion:se},this.config.appVersion=a.versionCode?String(a.versionCode):"",this.config.strictMode=a.strictMode},c.prototype.cycleTask=function(a){var d=this;this.intervalID=window.setInterval(function(){d.pauseSearching||d.store.getEvents().then(function(m){m.length==0&&(d.pauseSearching=!0);var D=[],U=JSON.parse(d.storage.getItem(K));U||(U=[]),m&&m.forEach(function(Q){var de=B(Q.mapValue);U.indexOf(de)==-1&&(D.push(Q),U.push(de))}),D.length!=0&&(d.storage.setItem(K,JSON.stringify(U)),d._normalLogPipeline(d.assembleData(D)))}).catch(function(m){})},a)},c.prototype.onReport=function(a,d,m){var D=this;if(this.isUnderIE8)this.errorReport.reportError("601","UnderIE8");else{this.pauseSearching=!1;var U=this.generateData(a,d,m);if(m&&this.delayTime==0&&!this.underWeakNet)this._normalLogPipeline(this.assembleData(U));else{var Q=U.shift();Q&&this.store.insertEvent(Q,function(de){de&&D.errorReport.reportError("604","insertEvent fail!")}).catch(function(de){D._normalLogPipeline(D.assembleData(U))})}}},c.prototype.onSendBeacon=function(a,d){if(this.isUnderIE)this.errorReport.reportError("605","UnderIE");else{this.pauseSearching=!1;var m=this.assembleData(this.generateData(a,d,!0));typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(this.uploadUrl||this.strategy.getUploadUrl(),JSON.stringify(m))}},c.prototype.generateData=function(a,d,m){var D=[],U="4.5.14-web_"+(m?"direct_log_id":"normal_log_id"),Q=Number(this.storage.getItem(U));return Q=Q||1,d=S(S({},d),{A99:m?"Y":"N",A100:Q.toString(),A72:se,A88:this.logidStartTime}),Q++,this.storage.setItem(U,Q.toString()),D.push({eventCode:a,eventTime:Date.now().toString(),mapValue:W(d,this.config.strictMode)}),D},c.prototype.assembleData=function(a){var d=this.beaconSession.getSession();return{appVersion:this.config.appVersion?ie(this.config.appVersion):"",sdkId:"js",sdkVersion:se,mainAppKey:this.config.appkey,platformId:3,common:W(S(S({},this.additionalParams),{A2:this.commonInfo.deviceId,A8:this.commonInfo.openid,A12:this.commonInfo.language,A17:this.commonInfo.pixel,A23:this.commonInfo.channelID,A50:this.commonInfo.unid,A76:d.sessionId,A101:this.commonInfo.userAgent,A102:window.location.href,A104:document.referrer,A119:this.commonInfo.query,A153:this.qimei36}),!1),events:a}},c.prototype.monitorUploadFailed=function(){this.uselessCycleTaskNum++,this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(6e4),this.underWeakNet=!0)},c.prototype.doCustomCycleTask=function(){this.uselessCycleTaskNum>=5&&(window.clearInterval(this.intervalID),this.cycleTask(this.initDelayTime)),this.uselessCycleTaskNum=0,this.underWeakNet=!1},c}(E)})},"./lib/crypto.js":function(o,t,e){(function(n){var l=e("./node_modules/@babel/runtime/helpers/typeof.js"),r=r||function(u,S){var w={},x=w.lib={},C=function(){},T=x.Base={extend:function(A){C.prototype=this;var E=new C;return A&&E.mixIn(A),E.hasOwnProperty("init")||(E.init=function(){E.$super.init.apply(this,arguments)}),E.init.prototype=E,E.$super=this,E},create:function(){var A=this.extend();return A.init.apply(A,arguments),A},init:function(){},mixIn:function(A){for(var E in A)A.hasOwnProperty(E)&&(this[E]=A[E]);A.hasOwnProperty("toString")&&(this.toString=A.toString)},clone:function(){return this.init.prototype.extend(this)}},N=x.WordArray=T.extend({init:function(A,E){A=this.words=A||[],this.sigBytes=E!=S?E:4*A.length},toString:function(A){return(A||P).stringify(this)},concat:function(A){var E=this.words,O=A.words,g=this.sigBytes;if(A=A.sigBytes,this.clamp(),g%4)for(var M=0;M<A;M++)E[g+M>>>2]|=(O[M>>>2]>>>24-8*(M%4)&255)<<24-8*((g+M)%4);else if(65535<O.length)for(M=0;M<A;M+=4)E[g+M>>>2]=O[M>>>2];else E.push.apply(E,O);return this.sigBytes+=A,this},clamp:function(){var A=this.words,E=this.sigBytes;A[E>>>2]&=4294967295<<32-8*(E%4),A.length=u.ceil(E/4)},clone:function(){var A=T.clone.call(this);return A.words=this.words.slice(0),A},random:function(A){for(var E=[],O=0;O<A;O+=4)E.push(4294967296*u.random()|0);return new N.init(E,A)}}),K=w.enc={},P=K.Hex={stringify:function(A){var E=A.words;A=A.sigBytes;for(var O=[],g=0;g<A;g++){var M=E[g>>>2]>>>24-8*(g%4)&255;O.push((M>>>4).toString(16)),O.push((M&15).toString(16))}return O.join("")},parse:function(A){for(var E=A.length,O=[],g=0;g<E;g+=2)O[g>>>3]|=parseInt(A.substr(g,2),16)<<24-4*(g%8);return new N.init(O,E/2)}},H=K.Latin1={stringify:function(A){var E=A.words;A=A.sigBytes;for(var O=[],g=0;g<A;g++)O.push(String.fromCharCode(E[g>>>2]>>>24-8*(g%4)&255));return O.join("")},parse:function(A){for(var E=A.length,O=[],g=0;g<E;g++)O[g>>>2]|=(A.charCodeAt(g)&255)<<24-8*(g%4);return new N.init(O,E)}},Y=K.Utf8={stringify:function(A){try{return decodeURIComponent(escape(H.stringify(A)))}catch(E){throw Error("Malformed UTF-8 data")}},parse:function(A){return H.parse(unescape(encodeURIComponent(A)))}},W=x.BufferedBlockAlgorithm=T.extend({reset:function(){this._data=new N.init,this._nDataBytes=0},_append:function(A){typeof A=="string"&&(A=Y.parse(A)),this._data.concat(A),this._nDataBytes+=A.sigBytes},_process:function(A){var E=this._data,O=E.words,g=E.sigBytes,M=this.blockSize,z=g/(4*M),z=A?u.ceil(z):u.max((z|0)-this._minBufferSize,0);if(A=z*M,g=u.min(4*A,g),A){for(var L=0;L<A;L+=M)this._doProcessBlock(O,L);L=O.splice(0,A),E.sigBytes-=g}return new N.init(L,g)},clone:function(){var A=T.clone.call(this);return A._data=this._data.clone(),A},_minBufferSize:0});x.Hasher=W.extend({cfg:T.extend(),init:function(A){this.cfg=this.cfg.extend(A),this.reset()},reset:function(){W.reset.call(this),this._doReset()},update:function(A){return this._append(A),this._process(),this},finalize:function(A){return A&&this._append(A),this._doFinalize()},blockSize:16,_createHelper:function(A){return function(E,O){return new A.init(O).finalize(E)}},_createHmacHelper:function(A){return function(E,O){return new ie.HMAC.init(A,O).finalize(E)}}});var ie=w.algo={};return w}(Math);(function(){var u=r,C=u.lib,S=C.WordArray,w=C.Hasher,x=[],C=u.algo.SHA1=w.extend({_doReset:function(){this._hash=new S.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(N,K){for(var P=this._hash.words,H=P[0],Y=P[1],W=P[2],ie=P[3],B=P[4],A=0;80>A;A++){if(16>A)x[A]=N[K+A]|0;else{var E=x[A-3]^x[A-8]^x[A-14]^x[A-16];x[A]=E<<1|E>>>31}E=(H<<5|H>>>27)+B+x[A],E=20>A?E+((Y&W|~Y&ie)+1518500249):40>A?E+((Y^W^ie)+1859775393):60>A?E+((Y&W|Y&ie|W&ie)-1894007588):E+((Y^W^ie)-899497514),B=ie,ie=W,W=Y<<30|Y>>>2,Y=H,H=E}P[0]=P[0]+H|0,P[1]=P[1]+Y|0,P[2]=P[2]+W|0,P[3]=P[3]+ie|0,P[4]=P[4]+B|0},_doFinalize:function(){var N=this._data,K=N.words,P=8*this._nDataBytes,H=8*N.sigBytes;return K[H>>>5]|=128<<24-H%32,K[(H+64>>>9<<4)+14]=Math.floor(P/4294967296),K[(H+64>>>9<<4)+15]=P,N.sigBytes=4*K.length,this._process(),this._hash},clone:function(){var N=w.clone.call(this);return N._hash=this._hash.clone(),N}});u.SHA1=w._createHelper(C),u.HmacSHA1=w._createHmacHelper(C)})(),function(){var u=r,S=u.enc.Utf8;u.algo.HMAC=u.lib.Base.extend({init:function(x,C){x=this._hasher=new x.init,typeof C=="string"&&(C=S.parse(C));var T=x.blockSize,N=4*T;C.sigBytes>N&&(C=x.finalize(C)),C.clamp();for(var K=this._oKey=C.clone(),P=this._iKey=C.clone(),H=K.words,Y=P.words,W=0;W<T;W++)H[W]^=1549556828,Y[W]^=909522486;K.sigBytes=P.sigBytes=N,this.reset()},reset:function(){var x=this._hasher;x.reset(),x.update(this._iKey)},update:function(x){return this._hasher.update(x),this},finalize:function(x){var C=this._hasher;return x=C.finalize(x),C.reset(),C.finalize(this._oKey.clone().concat(x))}})}(),function(){var u=r,S=u.lib,w=S.WordArray,x=u.enc;x.Base64={stringify:function(T){var N=T.words,K=T.sigBytes,P=this._map;T.clamp();for(var H=[],Y=0;Y<K;Y+=3)for(var W=N[Y>>>2]>>>24-Y%4*8&255,ie=N[Y+1>>>2]>>>24-(Y+1)%4*8&255,B=N[Y+2>>>2]>>>24-(Y+2)%4*8&255,A=W<<16|ie<<8|B,E=0;E<4&&Y+E*.75<K;E++)H.push(P.charAt(A>>>6*(3-E)&63));var O=P.charAt(64);if(O)for(;H.length%4;)H.push(O);return H.join("")},parse:function(T){var N=T.length,K=this._map,P=K.charAt(64);if(P){var H=T.indexOf(P);H!=-1&&(N=H)}for(var Y=[],W=0,ie=0;ie<N;ie++)if(ie%4){var B=K.indexOf(T.charAt(ie-1))<<ie%4*2,A=K.indexOf(T.charAt(ie))>>>6-ie%4*2;Y[W>>>2]|=(B|A)<<24-W%4*8,W++}return w.create(Y,W)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),l(n)==="object"?n.exports=r:window.CryptoJS=r}).call(this,e("./node_modules/webpack/buildin/module.js")(o))},"./lib/json2xml.js":function(o,t,e){var n=e("./node_modules/@babel/runtime/helpers/typeof.js"),l="a-zA-Z_\xC0-\xD6\xD8-\xF6\xF8-\xFF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FFF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD",r="-.0-9\xB7\u0300-\u036F\u203F\u2040",u=new RegExp("^([^"+l+"])|^((x|X)(m|M)(l|L))|([^"+l+r+"])","g"),S=/[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm,w=function(K){var P=[];if(K instanceof Object)for(var H in K)K.hasOwnProperty(H)&&P.push(H);return P},x=function(K,P){var H=function(W,ie,B,A,E){var O=P.indent!==void 0?P.indent:" ",g=P.prettyPrint?`
- `+new Array(A).join(O):"";P.removeIllegalNameCharacters&&(W=W.replace(u,"_"));var M=[g,"<",W,B||""];return ie&&ie.length>0?(M.push(">"),M.push(ie),E&&M.push(g),M.push("</"),M.push(W),M.push(">")):M.push("/>"),M.join("")};return function Y(W,ie,B){var A=n(W);switch((Array.isArray?Array.isArray(W):W instanceof Array)?A="array":W instanceof Date&&(A="date"),A){case"array":var E=[];return W.map(function(z){E.push(Y(z,1,B+1))}),P.prettyPrint&&E.push(`
- `),E.join("");case"date":return W.toJSON?W.toJSON():W+"";case"object":var O=[];for(var g in W)if(W.hasOwnProperty(g))if(W[g]instanceof Array)for(var M=0;M<W[g].length;M++)W[g].hasOwnProperty(M)&&O.push(H(g,Y(W[g][M],0,B+1),null,B+1,w(W[g][M]).length));else O.push(H(g,Y(W[g],0,B+1),null,B+1));return P.prettyPrint&&O.length>0&&O.push(`
- `),O.join("");case"function":return W();default:return P.escape?T(W):""+W}}(K,0,0)},C=function(K){var P=['<?xml version="1.0" encoding="UTF-8"'];return K&&P.push(' standalone="yes"'),P.push("?>"),P.join("")};function T(N){return(""+N).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(S,"")}o.exports=function(N,K){if(K||(K={xmlHeader:{standalone:!0},prettyPrint:!0,indent:" ",escape:!0}),typeof N=="string")try{N=JSON.parse(N.toString())}catch(W){return!1}var P="",H="";K&&(n(K)=="object"?(K.xmlHeader&&(P=C(!!K.xmlHeader.standalone)),typeof K.docType!="undefined"&&(H="<!DOCTYPE "+K.docType+">")):P=C()),K=K||{};var Y=[P,K.prettyPrint&&H?`
- `:"",H,x(N,K)];return Y.join("").replace(/\n{2,}/g,`
- `).replace(/\s+$/g,"")}},"./lib/md5.js":function(module,exports,__webpack_require__){(function(process,global,module){var __WEBPACK_AMD_DEFINE_RESULT__,_typeof=__webpack_require__("./node_modules/@babel/runtime/helpers/typeof.js");(function(){var ERROR="input is invalid type",WINDOW=(typeof window=="undefined"?"undefined":_typeof(window))==="object",root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&(typeof self=="undefined"?"undefined":_typeof(self))==="object",NODE_JS=!root.JS_MD5_NO_NODE_JS&&(typeof process=="undefined"?"undefined":_typeof(process))==="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&_typeof(module)==="object"&&module.exports,AMD=__webpack_require__("./node_modules/webpack/buildin/amd-options.js"),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}(root.JS_MD5_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(o){return Object.prototype.toString.call(o)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(o){return _typeof(o)==="object"&&o.buffer&&o.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t){return function(e,n){return new Md5(!0).update(e,n)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.getCtx=t.create=function(){return new Md5},t.update=function(l){return t.create().update(l)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createOutputMethod(n)}return t},nodeWrap=function nodeWrap(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function o(t){if(typeof t=="string")return crypto.createHash("md5").update(t,"utf8").digest("hex");if(t==null)throw ERROR;return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash("md5").update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod};function Md5(o){if(o)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(o,t){if(!this.finalized){for(var e,n=0,l,r=o.length,u=this.blocks,S=this.buffer8;n<r;){if(this.hashed&&(this.hashed=!1,u[0]=u[16],u[16]=u[1]=u[2]=u[3]=u[4]=u[5]=u[6]=u[7]=u[8]=u[9]=u[10]=u[11]=u[12]=u[13]=u[14]=u[15]=0),ARRAY_BUFFER)for(l=this.start;n<r&&l<64;++n)e=o.charCodeAt(n),t||e<128?S[l++]=e:e<2048?(S[l++]=192|e>>6,S[l++]=128|e&63):e<55296||e>=57344?(S[l++]=224|e>>12,S[l++]=128|e>>6&63,S[l++]=128|e&63):(e=65536+((e&1023)<<10|o.charCodeAt(++n)&1023),S[l++]=240|e>>18,S[l++]=128|e>>12&63,S[l++]=128|e>>6&63,S[l++]=128|e&63);else for(l=this.start;n<r&&l<64;++n)e=o.charCodeAt(n),t||e<128?u[l>>2]|=e<<SHIFT[l++&3]:e<2048?(u[l>>2]|=(192|e>>6)<<SHIFT[l++&3],u[l>>2]|=(128|e&63)<<SHIFT[l++&3]):e<55296||e>=57344?(u[l>>2]|=(224|e>>12)<<SHIFT[l++&3],u[l>>2]|=(128|e>>6&63)<<SHIFT[l++&3],u[l>>2]|=(128|e&63)<<SHIFT[l++&3]):(e=65536+((e&1023)<<10|o.charCodeAt(++n)&1023),u[l>>2]|=(240|e>>18)<<SHIFT[l++&3],u[l>>2]|=(128|e>>12&63)<<SHIFT[l++&3],u[l>>2]|=(128|e>>6&63)<<SHIFT[l++&3],u[l>>2]|=(128|e&63)<<SHIFT[l++&3]);this.lastByteIndex=l,this.bytes+=l-this.start,l>=64?(this.start=l-64,this.hash(),this.hashed=!0):this.start=l}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var o=this.blocks,t=this.lastByteIndex;o[t>>2]|=EXTRA[t&3],t>=56&&(this.hashed||this.hash(),o[0]=o[16],o[16]=o[1]=o[2]=o[3]=o[4]=o[5]=o[6]=o[7]=o[8]=o[9]=o[10]=o[11]=o[12]=o[13]=o[14]=o[15]=0),o[14]=this.bytes<<3,o[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var o,t,e,n,l,r,u=this.blocks;this.first?(o=u[0]-680876937,o=(o<<7|o>>>25)-271733879<<0,n=(-1732584194^o&2004318071)+u[1]-117830708,n=(n<<12|n>>>20)+o<<0,e=(-271733879^n&(o^-271733879))+u[2]-1126478375,e=(e<<17|e>>>15)+n<<0,t=(o^e&(n^o))+u[3]-1316259209,t=(t<<22|t>>>10)+e<<0):(o=this.h0,t=this.h1,e=this.h2,n=this.h3,o+=(n^t&(e^n))+u[0]-680876936,o=(o<<7|o>>>25)+t<<0,n+=(e^o&(t^e))+u[1]-389564586,n=(n<<12|n>>>20)+o<<0,e+=(t^n&(o^t))+u[2]+606105819,e=(e<<17|e>>>15)+n<<0,t+=(o^e&(n^o))+u[3]-1044525330,t=(t<<22|t>>>10)+e<<0),o+=(n^t&(e^n))+u[4]-176418897,o=(o<<7|o>>>25)+t<<0,n+=(e^o&(t^e))+u[5]+1200080426,n=(n<<12|n>>>20)+o<<0,e+=(t^n&(o^t))+u[6]-1473231341,e=(e<<17|e>>>15)+n<<0,t+=(o^e&(n^o))+u[7]-45705983,t=(t<<22|t>>>10)+e<<0,o+=(n^t&(e^n))+u[8]+1770035416,o=(o<<7|o>>>25)+t<<0,n+=(e^o&(t^e))+u[9]-1958414417,n=(n<<12|n>>>20)+o<<0,e+=(t^n&(o^t))+u[10]-42063,e=(e<<17|e>>>15)+n<<0,t+=(o^e&(n^o))+u[11]-1990404162,t=(t<<22|t>>>10)+e<<0,o+=(n^t&(e^n))+u[12]+1804603682,o=(o<<7|o>>>25)+t<<0,n+=(e^o&(t^e))+u[13]-40341101,n=(n<<12|n>>>20)+o<<0,e+=(t^n&(o^t))+u[14]-1502002290,e=(e<<17|e>>>15)+n<<0,t+=(o^e&(n^o))+u[15]+1236535329,t=(t<<22|t>>>10)+e<<0,o+=(e^n&(t^e))+u[1]-165796510,o=(o<<5|o>>>27)+t<<0,n+=(t^e&(o^t))+u[6]-1069501632,n=(n<<9|n>>>23)+o<<0,e+=(o^t&(n^o))+u[11]+643717713,e=(e<<14|e>>>18)+n<<0,t+=(n^o&(e^n))+u[0]-373897302,t=(t<<20|t>>>12)+e<<0,o+=(e^n&(t^e))+u[5]-701558691,o=(o<<5|o>>>27)+t<<0,n+=(t^e&(o^t))+u[10]+38016083,n=(n<<9|n>>>23)+o<<0,e+=(o^t&(n^o))+u[15]-660478335,e=(e<<14|e>>>18)+n<<0,t+=(n^o&(e^n))+u[4]-405537848,t=(t<<20|t>>>12)+e<<0,o+=(e^n&(t^e))+u[9]+568446438,o=(o<<5|o>>>27)+t<<0,n+=(t^e&(o^t))+u[14]-1019803690,n=(n<<9|n>>>23)+o<<0,e+=(o^t&(n^o))+u[3]-187363961,e=(e<<14|e>>>18)+n<<0,t+=(n^o&(e^n))+u[8]+1163531501,t=(t<<20|t>>>12)+e<<0,o+=(e^n&(t^e))+u[13]-1444681467,o=(o<<5|o>>>27)+t<<0,n+=(t^e&(o^t))+u[2]-51403784,n=(n<<9|n>>>23)+o<<0,e+=(o^t&(n^o))+u[7]+1735328473,e=(e<<14|e>>>18)+n<<0,t+=(n^o&(e^n))+u[12]-1926607734,t=(t<<20|t>>>12)+e<<0,l=t^e,o+=(l^n)+u[5]-378558,o=(o<<4|o>>>28)+t<<0,n+=(l^o)+u[8]-2022574463,n=(n<<11|n>>>21)+o<<0,r=n^o,e+=(r^t)+u[11]+1839030562,e=(e<<16|e>>>16)+n<<0,t+=(r^e)+u[14]-35309556,t=(t<<23|t>>>9)+e<<0,l=t^e,o+=(l^n)+u[1]-1530992060,o=(o<<4|o>>>28)+t<<0,n+=(l^o)+u[4]+1272893353,n=(n<<11|n>>>21)+o<<0,r=n^o,e+=(r^t)+u[7]-155497632,e=(e<<16|e>>>16)+n<<0,t+=(r^e)+u[10]-1094730640,t=(t<<23|t>>>9)+e<<0,l=t^e,o+=(l^n)+u[13]+681279174,o=(o<<4|o>>>28)+t<<0,n+=(l^o)+u[0]-358537222,n=(n<<11|n>>>21)+o<<0,r=n^o,e+=(r^t)+u[3]-722521979,e=(e<<16|e>>>16)+n<<0,t+=(r^e)+u[6]+76029189,t=(t<<23|t>>>9)+e<<0,l=t^e,o+=(l^n)+u[9]-640364487,o=(o<<4|o>>>28)+t<<0,n+=(l^o)+u[12]-421815835,n=(n<<11|n>>>21)+o<<0,r=n^o,e+=(r^t)+u[15]+530742520,e=(e<<16|e>>>16)+n<<0,t+=(r^e)+u[2]-995338651,t=(t<<23|t>>>9)+e<<0,o+=(e^(t|~n))+u[0]-198630844,o=(o<<6|o>>>26)+t<<0,n+=(t^(o|~e))+u[7]+1126891415,n=(n<<10|n>>>22)+o<<0,e+=(o^(n|~t))+u[14]-1416354905,e=(e<<15|e>>>17)+n<<0,t+=(n^(e|~o))+u[5]-57434055,t=(t<<21|t>>>11)+e<<0,o+=(e^(t|~n))+u[12]+1700485571,o=(o<<6|o>>>26)+t<<0,n+=(t^(o|~e))+u[3]-1894986606,n=(n<<10|n>>>22)+o<<0,e+=(o^(n|~t))+u[10]-1051523,e=(e<<15|e>>>17)+n<<0,t+=(n^(e|~o))+u[1]-2054922799,t=(t<<21|t>>>11)+e<<0,o+=(e^(t|~n))+u[8]+1873313359,o=(o<<6|o>>>26)+t<<0,n+=(t^(o|~e))+u[15]-30611744,n=(n<<10|n>>>22)+o<<0,e+=(o^(n|~t))+u[6]-1560198380,e=(e<<15|e>>>17)+n<<0,t+=(n^(e|~o))+u[13]+1309151649,t=(t<<21|t>>>11)+e<<0,o+=(e^(t|~n))+u[4]-145523070,o=(o<<6|o>>>26)+t<<0,n+=(t^(o|~e))+u[11]-1120210379,n=(n<<10|n>>>22)+o<<0,e+=(o^(n|~t))+u[2]+718787259,e=(e<<15|e>>>17)+n<<0,t+=(n^(e|~o))+u[9]-343485551,t=(t<<21|t>>>11)+e<<0,this.first?(this.h0=o+1732584193<<0,this.h1=t-271733879<<0,this.h2=e-1732584194<<0,this.h3=n+271733878<<0,this.first=!1):(this.h0=this.h0+o<<0,this.h1=this.h1+t<<0,this.h2=this.h2+e<<0,this.h3=this.h3+n<<0)},Md5.prototype.hex=function(){this.finalize();var o=this.h0,t=this.h1,e=this.h2,n=this.h3;return HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(o){if(o==="hex")return this.hex();this.finalize();var t=this.h0,e=this.h1,n=this.h2,l=this.h3,r=[t&255,t>>8&255,t>>16&255,t>>24&255,e&255,e>>8&255,e>>16&255,e>>24&255,n&255,n>>8&255,n>>16&255,n>>24&255,l&255,l>>8&255,l>>16&255,l>>24&255];return r},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var o=new ArrayBuffer(16),t=new Uint32Array(o);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,o},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var o,t,e,n="",l=this.array(),r=0;r<15;)o=l[r++],t=l[r++],e=l[r++],n+=BASE64_ENCODE_CHAR[o>>>2]+BASE64_ENCODE_CHAR[(o<<4|t>>>4)&63]+BASE64_ENCODE_CHAR[(t<<2|e>>>6)&63]+BASE64_ENCODE_CHAR[e&63];return o=l[r],n+=BASE64_ENCODE_CHAR[o>>>2]+BASE64_ENCODE_CHAR[o<<4&63]+"==",n};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),__WEBPACK_AMD_DEFINE_RESULT__!==void 0&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__("./node_modules/process/browser.js"),__webpack_require__("./node_modules/webpack/buildin/global.js"),__webpack_require__("./node_modules/webpack/buildin/module.js")(module))},"./lib/request.js":function(o,t,e){var n=e("./node_modules/@babel/runtime/helpers/typeof.js"),l=function(C){switch(n(C)){case"string":return C;case"boolean":return C?"true":"false";case"number":return isFinite(C)?C:"";default:return""}},r=function(C,T,N,K){return T=T||"&",N=N||"=",C===null&&(C=void 0),n(C)==="object"?Object.keys(C).map(function(P){var H=encodeURIComponent(l(P))+N;return Array.isArray(C[P])?C[P].map(function(Y){return H+encodeURIComponent(l(Y))}).join(T):H+encodeURIComponent(l(C[P]))}).filter(Boolean).join(T):K?encodeURIComponent(l(K))+N+encodeURIComponent(l(C)):""},u=function(C,T,N){var K={};return T.getAllResponseHeaders().trim().split(`
- `).forEach(function(P){if(P){var H=P.indexOf(":"),Y=P.substr(0,H).trim().toLowerCase(),W=P.substr(H+1).trim();K[Y]=W}}),{error:C,statusCode:T.status,statusMessage:T.statusText,headers:K,body:N}},S=function(C,T){return!T&&T==="text"?C.responseText:C.response},w=function(C,T){var N=(C.method||"GET").toUpperCase(),K=C.url;if(C.qs){var P=r(C.qs);P&&(K+=(K.indexOf("?")===-1?"?":"&")+P)}var H=new XMLHttpRequest;if(H.open(N,K,!0),H.responseType=C.dataType||"text",C.xhrFields)for(var Y in C.xhrFields)H[Y]=C.xhrFields[Y];var W=C.headers;if(W)for(var ie in W)W.hasOwnProperty(ie)&&ie.toLowerCase()!=="content-length"&&ie.toLowerCase()!=="user-agent"&&ie.toLowerCase()!=="origin"&&ie.toLowerCase()!=="host"&&H.setRequestHeader(ie,W[ie]);return C.onProgress&&H.upload&&(H.upload.onprogress=C.onProgress),C.onDownloadProgress&&(H.onprogress=C.onDownloadProgress),C.timeout&&(H.timeout=C.timeout),H.ontimeout=function(B){var A=new Error("timeout");T(u(A,H))},H.onload=function(){T(u(null,H,S(H,C.dataType)))},H.onerror=function(B){var A=S(H,C.dataType);if(A)T(u(null,H,A));else{var E=H.statusText;!E&&H.status===0&&(E=new Error("CORS blocked or network error")),T(u(E,H,A))}},H.send(C.body||""),H};o.exports=w},"./lib/xml2json.js":function(o,t,e){var n=e("./node_modules/@xmldom/xmldom/lib/index.js").DOMParser,l=function(){this.version="1.3.5";var u={mergeCDATA:!0,normalize:!0,stripElemPrefix:!0},S=new RegExp(/(?!xmlns)^.*:/);return this.grokType=function(w){return/^\s*$/.test(w)?null:/^(?:true|false)$/i.test(w)?w.toLowerCase()==="true":isFinite(w)?parseFloat(w):w},this.parseString=function(w,x){if(w){var C=this.stringToXML(w);return C.getElementsByTagName("parsererror").length?null:this.parseXML(C,x)}else return null},this.parseXML=function(w,x){for(var C in x)u[C]=x[C];var T={},N=0,K="",P=w.childNodes.length;if(P)for(var H,Y,W,ie=0;ie<w.childNodes.length;ie++)H=w.childNodes.item(ie),H.nodeType===4?u.mergeCDATA&&(K+=H.nodeValue):H.nodeType===3?K+=H.nodeValue:H.nodeType===1&&(N===0&&(T={}),u.stripElemPrefix?Y=H.nodeName.replace(S,""):Y=H.nodeName,W=l.parseXML(H),T.hasOwnProperty(Y)?(T[Y].constructor!==Array&&(T[Y]=[T[Y]]),T[Y].push(W)):(T[Y]=W,N++));return Object.keys(T).length||(T=K||""),T},this.xmlToString=function(w){try{var x=w.xml?w.xml:new XMLSerializer().serializeToString(w);return x}catch(C){return null}},this.stringToXML=function(w){try{var x=null;if(window.DOMParser){var C=new n;return x=C.parseFromString(w,"text/xml"),x}else return x=new ActiveXObject("Microsoft.XMLDOM"),x.async=!1,x.loadXML(w),x}catch(T){return null}},this}.call({}),r=function(S){return l.parseString(S)};o.exports=r},"./node_modules/@babel/runtime/helpers/classCallCheck.js":function(o,t){function e(n,l){if(!(n instanceof l))throw new TypeError("Cannot call a class as a function")}o.exports=e,o.exports.__esModule=!0,o.exports.default=o.exports},"./node_modules/@babel/runtime/helpers/createClass.js":function(o,t){function e(l,r){for(var u=0;u<r.length;u++){var S=r[u];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(l,S.key,S)}}function n(l,r,u){return r&&e(l.prototype,r),u&&e(l,u),Object.defineProperty(l,"prototype",{writable:!1}),l}o.exports=n,o.exports.__esModule=!0,o.exports.default=o.exports},"./node_modules/@babel/runtime/helpers/typeof.js":function(o,t){function e(n){return o.exports=e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},o.exports.__esModule=!0,o.exports.default=o.exports,e(n)}o.exports=e,o.exports.__esModule=!0,o.exports.default=o.exports},"./node_modules/@xmldom/xmldom/lib/conventions.js":function(o,t,e){function n(w,x,C){if(C===void 0&&(C=Array.prototype),w&&typeof C.find=="function")return C.find.call(w,x);for(var T=0;T<w.length;T++)if(Object.prototype.hasOwnProperty.call(w,T)){var N=w[T];if(x.call(void 0,N,T,w))return N}}function l(w,x){return x===void 0&&(x=Object),x&&typeof x.freeze=="function"?x.freeze(w):w}function r(w,x){if(w===null||typeof w!="object")throw new TypeError("target is not an object");for(var C in x)Object.prototype.hasOwnProperty.call(x,C)&&(w[C]=x[C]);return w}var u=l({HTML:"text/html",isHTML:function(w){return w===u.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),S=l({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(w){return w===S.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});t.assign=r,t.find=n,t.freeze=l,t.MIME_TYPE=u,t.NAMESPACE=S},"./node_modules/@xmldom/xmldom/lib/dom-parser.js":function(o,t,e){var n=e("./node_modules/@xmldom/xmldom/lib/conventions.js"),l=e("./node_modules/@xmldom/xmldom/lib/dom.js"),r=e("./node_modules/@xmldom/xmldom/lib/entities.js"),u=e("./node_modules/@xmldom/xmldom/lib/sax.js"),S=l.DOMImplementation,w=n.NAMESPACE,x=u.ParseError,C=u.XMLReader;function T(B){return B.replace(/\r[\n\u0085]/g,`
- `).replace(/[\r\u0085\u2028]/g,`
- `)}function N(B){this.options=B||{locator:{}}}N.prototype.parseFromString=function(B,A){var E=this.options,O=new C,g=E.domBuilder||new P,M=E.errorHandler,z=E.locator,L=E.xmlns||{},F=/\/x?html?$/.test(A),k=F?r.HTML_ENTITIES:r.XML_ENTITIES;z&&g.setDocumentLocator(z),O.errorHandler=K(M,g,z),O.domBuilder=E.domBuilder||g,F&&(L[""]=w.HTML),L.xml=L.xml||w.XML;var V=E.normalizeLineEndings||T;return B&&typeof B=="string"?O.parse(V(B),L,k):O.errorHandler.error("invalid doc source"),g.doc};function K(B,A,E){if(!B){if(A instanceof P)return A;B=A}var O={},g=B instanceof Function;E=E||{};function M(z){var L=B[z];!L&&g&&(L=B.length==2?function(F){B(z,F)}:B),O[z]=L&&function(F){L("[xmldom "+z+"] "+F+Y(E))}||function(){}}return M("warning"),M("error"),M("fatalError"),O}function P(){this.cdata=!1}function H(B,A){A.lineNumber=B.lineNumber,A.columnNumber=B.columnNumber}P.prototype={startDocument:function(){this.doc=new S().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(B,A,E,O){var g=this.doc,M=g.createElementNS(B,E||A),z=O.length;ie(this,M),this.currentElement=M,this.locator&&H(this.locator,M);for(var L=0;L<z;L++){var B=O.getURI(L),F=O.getValue(L),E=O.getQName(L),k=g.createAttributeNS(B,E);this.locator&&H(O.getLocator(L),k),k.value=k.nodeValue=F,M.setAttributeNode(k)}},endElement:function(B,A,E){var O=this.currentElement;O.tagName,this.currentElement=O.parentNode},startPrefixMapping:function(B,A){},endPrefixMapping:function(B){},processingInstruction:function(B,A){var E=this.doc.createProcessingInstruction(B,A);this.locator&&H(this.locator,E),ie(this,E)},ignorableWhitespace:function(B,A,E){},characters:function(B,A,E){if(B=W.apply(this,arguments),B){if(this.cdata)var O=this.doc.createCDATASection(B);else var O=this.doc.createTextNode(B);this.currentElement?this.currentElement.appendChild(O):/^\s*$/.test(B)&&this.doc.appendChild(O),this.locator&&H(this.locator,O)}},skippedEntity:function(B){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(B){(this.locator=B)&&(B.lineNumber=0)},comment:function(B,A,E){B=W.apply(this,arguments);var O=this.doc.createComment(B);this.locator&&H(this.locator,O),ie(this,O)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(B,A,E){var O=this.doc.implementation;if(O&&O.createDocumentType){var g=O.createDocumentType(B,A,E);this.locator&&H(this.locator,g),ie(this,g),this.doc.doctype=g}},warning:function(B){console.warn("[xmldom warning] "+B,Y(this.locator))},error:function(B){console.error("[xmldom error] "+B,Y(this.locator))},fatalError:function(B){throw new x(B,this.locator)}};function Y(B){if(B)return`
- @`+(B.systemId||"")+"#[line:"+B.lineNumber+",col:"+B.columnNumber+"]"}function W(B,A,E){return typeof B=="string"?B.substr(A,E):B.length>=A+E||A?new java.lang.String(B,A,E)+"":B}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(B){P.prototype[B]=function(){return null}});function ie(B,A){B.currentElement?B.currentElement.appendChild(A):B.doc.appendChild(A)}t.__DOMHandler=P,t.normalizeLineEndings=T,t.DOMParser=N},"./node_modules/@xmldom/xmldom/lib/dom.js":function(o,t,e){var n=e("./node_modules/@xmldom/xmldom/lib/conventions.js"),l=n.find,r=n.NAMESPACE;function u(f){return f!==""}function S(f){return f?f.split(/[\t\n\f\r ]+/).filter(u):[]}function w(f,v){return f.hasOwnProperty(v)||(f[v]=!0),f}function x(f){if(!f)return[];var v=S(f);return Object.keys(v.reduce(w,{}))}function C(f){return function(v){return f&&f.indexOf(v)!==-1}}function T(f,v){for(var I in f)Object.prototype.hasOwnProperty.call(f,I)&&(v[I]=f[I])}function N(f,v){var I=f.prototype;if(!(I instanceof v)){let q=function(){};q.prototype=v.prototype,q=new q,T(I,q),f.prototype=I=q}I.constructor!=f&&(typeof f!="function"&&console.error("unknown Class:"+f),I.constructor=f)}var K={},P=K.ELEMENT_NODE=1,H=K.ATTRIBUTE_NODE=2,Y=K.TEXT_NODE=3,W=K.CDATA_SECTION_NODE=4,ie=K.ENTITY_REFERENCE_NODE=5,B=K.ENTITY_NODE=6,A=K.PROCESSING_INSTRUCTION_NODE=7,E=K.COMMENT_NODE=8,O=K.DOCUMENT_NODE=9,g=K.DOCUMENT_TYPE_NODE=10,M=K.DOCUMENT_FRAGMENT_NODE=11,z=K.NOTATION_NODE=12,L={},F={};L.INDEX_SIZE_ERR=(F[1]="Index size error",1),L.DOMSTRING_SIZE_ERR=(F[2]="DOMString size error",2);var k=L.HIERARCHY_REQUEST_ERR=(F[3]="Hierarchy request error",3);L.WRONG_DOCUMENT_ERR=(F[4]="Wrong document",4),L.INVALID_CHARACTER_ERR=(F[5]="Invalid character",5),L.NO_DATA_ALLOWED_ERR=(F[6]="No data allowed",6),L.NO_MODIFICATION_ALLOWED_ERR=(F[7]="No modification allowed",7);var V=L.NOT_FOUND_ERR=(F[8]="Not found",8);L.NOT_SUPPORTED_ERR=(F[9]="Not supported",9);var X=L.INUSE_ATTRIBUTE_ERR=(F[10]="Attribute in use",10);L.INVALID_STATE_ERR=(F[11]="Invalid state",11),L.SYNTAX_ERR=(F[12]="Syntax error",12),L.INVALID_MODIFICATION_ERR=(F[13]="Invalid modification",13),L.NAMESPACE_ERR=(F[14]="Invalid namespace",14),L.INVALID_ACCESS_ERR=(F[15]="Invalid access",15);function G(f,v){if(v instanceof Error)var I=v;else I=this,Error.call(this,F[f]),this.message=F[f],Error.captureStackTrace&&Error.captureStackTrace(this,G);return I.code=f,v&&(this.message=this.message+": "+v),I}G.prototype=Error.prototype,T(L,G);function $(){}$.prototype={length:0,item:function(f){return this[f]||null},toString:function(f,v){for(var I=[],q=0;q<this.length;q++)Xe(this[q],I,f,v);return I.join("")},filter:function(f){return Array.prototype.filter.call(this,f)},indexOf:function(f){return Array.prototype.indexOf.call(this,f)}};function re(f,v){this._node=f,this._refresh=v,ue(this)}function ue(f){var v=f._node._inc||f._node.ownerDocument._inc;if(f._inc!=v){var I=f._refresh(f._node);rt(f,"length",I.length),T(I,f),f._inc=v}}re.prototype.item=function(f){return ue(this),this[f]},N(re,$);function oe(){}function ee(f,v){for(var I=f.length;I--;)if(f[I]===v)return I}function ce(f,v,I,q){if(q?v[ee(v,q)]=I:v[v.length++]=I,f){I.ownerElement=f;var fe=f.ownerDocument;fe&&(q&&ye(fe,f,q),ve(fe,f,I))}}function ae(f,v,I){var q=ee(v,I);if(q>=0){for(var fe=v.length-1;q<fe;)v[q]=v[++q];if(v.length=fe,f){var Re=f.ownerDocument;Re&&(ye(Re,f,I),I.ownerElement=null)}}else throw new G(V,new Error(f.tagName+"@"+I))}oe.prototype={length:0,item:$.prototype.item,getNamedItem:function(f){for(var v=this.length;v--;){var I=this[v];if(I.nodeName==f)return I}},setNamedItem:function(f){var v=f.ownerElement;if(v&&v!=this._ownerElement)throw new G(X);var I=this.getNamedItem(f.nodeName);return ce(this._ownerElement,this,f,I),I},setNamedItemNS:function(f){var v=f.ownerElement,I;if(v&&v!=this._ownerElement)throw new G(X);return I=this.getNamedItemNS(f.namespaceURI,f.localName),ce(this._ownerElement,this,f,I),I},removeNamedItem:function(f){var v=this.getNamedItem(f);return ae(this._ownerElement,this,v),v},removeNamedItemNS:function(f,v){var I=this.getNamedItemNS(f,v);return ae(this._ownerElement,this,I),I},getNamedItemNS:function(f,v){for(var I=this.length;I--;){var q=this[I];if(q.localName==v&&q.namespaceURI==f)return q}return null}};function pe(){}pe.prototype={hasFeature:function(f,v){return!0},createDocument:function(f,v,I){var q=new me;if(q.implementation=this,q.childNodes=new $,q.doctype=I||null,I&&q.appendChild(I),v){var fe=q.createElementNS(f,v);q.appendChild(fe)}return q},createDocumentType:function(f,v,I){var q=new xe;return q.name=f,q.nodeName=f,q.publicId=v||"",q.systemId=I||"",q}};function Z(){}Z.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(f,v){return d(this,f,v)},replaceChild:function(f,v){d(this,f,v,a),v&&this.removeChild(v)},removeChild:function(f){return Ee(this,f)},appendChild:function(f){return this.insertBefore(f,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(f){return et(this.ownerDocument||this,this,f)},normalize:function(){for(var f=this.firstChild;f;){var v=f.nextSibling;v&&v.nodeType==Y&&f.nodeType==Y?(this.removeChild(v),f.appendData(v.data)):(f.normalize(),f=v)}},isSupported:function(f,v){return this.ownerDocument.implementation.hasFeature(f,v)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(f){for(var v=this;v;){var I=v._nsMap;if(I){for(var q in I)if(Object.prototype.hasOwnProperty.call(I,q)&&I[q]===f)return q}v=v.nodeType==H?v.ownerDocument:v.parentNode}return null},lookupNamespaceURI:function(f){for(var v=this;v;){var I=v._nsMap;if(I&&Object.prototype.hasOwnProperty.call(I,f))return I[f];v=v.nodeType==H?v.ownerDocument:v.parentNode}return null},isDefaultNamespace:function(f){var v=this.lookupPrefix(f);return v==null}};function ne(f){return f=="<"&&"<"||f==">"&&">"||f=="&"&&"&"||f=='"'&&"""||"&#"+f.charCodeAt()+";"}T(K,Z),T(K,Z.prototype);function ge(f,v){if(v(f))return!0;if(f=f.firstChild)do if(ge(f,v))return!0;while(f=f.nextSibling)}function me(){this.ownerDocument=this}function ve(f,v,I){f&&f._inc++;var q=I.namespaceURI;q===r.XMLNS&&(v._nsMap[I.prefix?I.localName:""]=I.value)}function ye(f,v,I,q){f&&f._inc++;var fe=I.namespaceURI;fe===r.XMLNS&&delete v._nsMap[I.prefix?I.localName:""]}function Ce(f,v,I){if(f&&f._inc){f._inc++;var q=v.childNodes;if(I)q[q.length++]=I;else{for(var fe=v.firstChild,Re=0;fe;)q[Re++]=fe,fe=fe.nextSibling;q.length=Re,delete q[q.length]}}}function Ee(f,v){var I=v.previousSibling,q=v.nextSibling;return I?I.nextSibling=q:f.firstChild=q,q?q.previousSibling=I:f.lastChild=I,v.parentNode=null,v.previousSibling=null,v.nextSibling=null,Ce(f.ownerDocument,f),v}function be(f){return f&&(f.nodeType===Z.DOCUMENT_NODE||f.nodeType===Z.DOCUMENT_FRAGMENT_NODE||f.nodeType===Z.ELEMENT_NODE)}function Oe(f){return f&&(De(f)||He(f)||we(f)||f.nodeType===Z.DOCUMENT_FRAGMENT_NODE||f.nodeType===Z.COMMENT_NODE||f.nodeType===Z.PROCESSING_INSTRUCTION_NODE)}function we(f){return f&&f.nodeType===Z.DOCUMENT_TYPE_NODE}function De(f){return f&&f.nodeType===Z.ELEMENT_NODE}function He(f){return f&&f.nodeType===Z.TEXT_NODE}function Pe(f,v){var I=f.childNodes||[];if(l(I,De)||we(v))return!1;var q=l(I,we);return!(v&&q&&I.indexOf(q)>I.indexOf(v))}function se(f,v){var I=f.childNodes||[];function q(Re){return De(Re)&&Re!==v}if(l(I,q))return!1;var fe=l(I,we);return!(v&&fe&&I.indexOf(fe)>I.indexOf(v))}function h(f,v,I){if(!be(f))throw new G(k,"Unexpected parent node type "+f.nodeType);if(I&&I.parentNode!==f)throw new G(V,"child not in parent");if(!Oe(v)||we(v)&&f.nodeType!==Z.DOCUMENT_NODE)throw new G(k,"Unexpected node type "+v.nodeType+" for parent node type "+f.nodeType)}function c(f,v,I){var q=f.childNodes||[],fe=v.childNodes||[];if(v.nodeType===Z.DOCUMENT_FRAGMENT_NODE){var Re=fe.filter(De);if(Re.length>1||l(fe,He))throw new G(k,"More than one element or text in fragment");if(Re.length===1&&!Pe(f,I))throw new G(k,"Element in fragment can not be inserted before doctype")}if(De(v)&&!Pe(f,I))throw new G(k,"Only one element can be added and only after doctype");if(we(v)){if(l(q,we))throw new G(k,"Only one doctype is allowed");var Me=l(q,De);if(I&&q.indexOf(Me)<q.indexOf(I))throw new G(k,"Doctype can only be inserted before an element");if(!I&&Me)throw new G(k,"Doctype can not be appended since element is present")}}function a(f,v,I){var q=f.childNodes||[],fe=v.childNodes||[];if(v.nodeType===Z.DOCUMENT_FRAGMENT_NODE){var Re=fe.filter(De);if(Re.length>1||l(fe,He))throw new G(k,"More than one element or text in fragment");if(Re.length===1&&!se(f,I))throw new G(k,"Element in fragment can not be inserted before doctype")}if(De(v)&&!se(f,I))throw new G(k,"Only one element can be added and only after doctype");if(we(v)){if(l(q,function(Ye){return we(Ye)&&Ye!==I}))throw new G(k,"Only one doctype is allowed");var Me=l(q,De);if(I&&q.indexOf(Me)<q.indexOf(I))throw new G(k,"Doctype can only be inserted before an element")}}function d(f,v,I,q){h(f,v,I),f.nodeType===Z.DOCUMENT_NODE&&(q||c)(f,v,I);var fe=v.parentNode;if(fe&&fe.removeChild(v),v.nodeType===M){var Re=v.firstChild;if(Re==null)return v;var Me=v.lastChild}else Re=Me=v;var le=I?I.previousSibling:f.lastChild;Re.previousSibling=le,Me.nextSibling=I,le?le.nextSibling=Re:f.firstChild=Re,I==null?f.lastChild=Me:I.previousSibling=Me;do Re.parentNode=f;while(Re!==Me&&(Re=Re.nextSibling));return Ce(f.ownerDocument||f,f),v.nodeType==M&&(v.firstChild=v.lastChild=null),v}function m(f,v){return v.parentNode&&v.parentNode.removeChild(v),v.parentNode=f,v.previousSibling=f.lastChild,v.nextSibling=null,v.previousSibling?v.previousSibling.nextSibling=v:f.firstChild=v,f.lastChild=v,Ce(f.ownerDocument,f,v),v}me.prototype={nodeName:"#document",nodeType:O,doctype:null,documentElement:null,_inc:1,insertBefore:function(f,v){if(f.nodeType==M){for(var I=f.firstChild;I;){var q=I.nextSibling;this.insertBefore(I,v),I=q}return f}return d(this,f,v),f.ownerDocument=this,this.documentElement===null&&f.nodeType===P&&(this.documentElement=f),f},removeChild:function(f){return this.documentElement==f&&(this.documentElement=null),Ee(this,f)},replaceChild:function(f,v){d(this,f,v,a),f.ownerDocument=this,v&&this.removeChild(v),De(f)&&(this.documentElement=f)},importNode:function(f,v){return it(this,f,v)},getElementById:function(f){var v=null;return ge(this.documentElement,function(I){if(I.nodeType==P&&I.getAttribute("id")==f)return v=I,!0}),v},getElementsByClassName:function(f){var v=x(f);return new re(this,function(I){var q=[];return v.length>0&&ge(I.documentElement,function(fe){if(fe!==I&&fe.nodeType===P){var Re=fe.getAttribute("class");if(Re){var Me=f===Re;if(!Me){var le=x(Re);Me=v.every(C(le))}Me&&q.push(fe)}}}),q})},createElement:function(f){var v=new D;v.ownerDocument=this,v.nodeName=f,v.tagName=f,v.localName=f,v.childNodes=new $;var I=v.attributes=new oe;return I._ownerElement=v,v},createDocumentFragment:function(){var f=new Le;return f.ownerDocument=this,f.childNodes=new $,f},createTextNode:function(f){var v=new de;return v.ownerDocument=this,v.appendData(f),v},createComment:function(f){var v=new he;return v.ownerDocument=this,v.appendData(f),v},createCDATASection:function(f){var v=new J;return v.ownerDocument=this,v.appendData(f),v},createProcessingInstruction:function(f,v){var I=new Ve;return I.ownerDocument=this,I.tagName=I.target=f,I.nodeValue=I.data=v,I},createAttribute:function(f){var v=new U;return v.ownerDocument=this,v.name=f,v.nodeName=f,v.localName=f,v.specified=!0,v},createEntityReference:function(f){var v=new _e;return v.ownerDocument=this,v.nodeName=f,v},createElementNS:function(f,v){var I=new D,q=v.split(":"),fe=I.attributes=new oe;return I.childNodes=new $,I.ownerDocument=this,I.nodeName=v,I.tagName=v,I.namespaceURI=f,q.length==2?(I.prefix=q[0],I.localName=q[1]):I.localName=v,fe._ownerElement=I,I},createAttributeNS:function(f,v){var I=new U,q=v.split(":");return I.ownerDocument=this,I.nodeName=v,I.name=v,I.namespaceURI=f,I.specified=!0,q.length==2?(I.prefix=q[0],I.localName=q[1]):I.localName=v,I}},N(me,Z);function D(){this._nsMap={}}D.prototype={nodeType:P,hasAttribute:function(f){return this.getAttributeNode(f)!=null},getAttribute:function(f){var v=this.getAttributeNode(f);return v&&v.value||""},getAttributeNode:function(f){return this.attributes.getNamedItem(f)},setAttribute:function(f,v){var I=this.ownerDocument.createAttribute(f);I.value=I.nodeValue=""+v,this.setAttributeNode(I)},removeAttribute:function(f){var v=this.getAttributeNode(f);v&&this.removeAttributeNode(v)},appendChild:function(f){return f.nodeType===M?this.insertBefore(f,null):m(this,f)},setAttributeNode:function(f){return this.attributes.setNamedItem(f)},setAttributeNodeNS:function(f){return this.attributes.setNamedItemNS(f)},removeAttributeNode:function(f){return this.attributes.removeNamedItem(f.nodeName)},removeAttributeNS:function(f,v){var I=this.getAttributeNodeNS(f,v);I&&this.removeAttributeNode(I)},hasAttributeNS:function(f,v){return this.getAttributeNodeNS(f,v)!=null},getAttributeNS:function(f,v){var I=this.getAttributeNodeNS(f,v);return I&&I.value||""},setAttributeNS:function(f,v,I){var q=this.ownerDocument.createAttributeNS(f,v);q.value=q.nodeValue=""+I,this.setAttributeNode(q)},getAttributeNodeNS:function(f,v){return this.attributes.getNamedItemNS(f,v)},getElementsByTagName:function(f){return new re(this,function(v){var I=[];return ge(v,function(q){q!==v&&q.nodeType==P&&(f==="*"||q.tagName==f)&&I.push(q)}),I})},getElementsByTagNameNS:function(f,v){return new re(this,function(I){var q=[];return ge(I,function(fe){fe!==I&&fe.nodeType===P&&(f==="*"||fe.namespaceURI===f)&&(v==="*"||fe.localName==v)&&q.push(fe)}),q})}},me.prototype.getElementsByTagName=D.prototype.getElementsByTagName,me.prototype.getElementsByTagNameNS=D.prototype.getElementsByTagNameNS,N(D,Z);function U(){}U.prototype.nodeType=H,N(U,Z);function Q(){}Q.prototype={data:"",substringData:function(f,v){return this.data.substring(f,f+v)},appendData:function(f){f=this.data+f,this.nodeValue=this.data=f,this.length=f.length},insertData:function(f,v){this.replaceData(f,0,v)},appendChild:function(f){throw new Error(F[k])},deleteData:function(f,v){this.replaceData(f,v,"")},replaceData:function(f,v,I){var q=this.data.substring(0,f),fe=this.data.substring(f+v);I=q+I+fe,this.nodeValue=this.data=I,this.length=I.length}},N(Q,Z);function de(){}de.prototype={nodeName:"#text",nodeType:Y,splitText:function(f){var v=this.data,I=v.substring(f);v=v.substring(0,f),this.data=this.nodeValue=v,this.length=v.length;var q=this.ownerDocument.createTextNode(I);return this.parentNode&&this.parentNode.insertBefore(q,this.nextSibling),q}},N(de,Q);function he(){}he.prototype={nodeName:"#comment",nodeType:E},N(he,Q);function J(){}J.prototype={nodeName:"#cdata-section",nodeType:W},N(J,Q);function xe(){}xe.prototype.nodeType=g,N(xe,Z);function Be(){}Be.prototype.nodeType=z,N(Be,Z);function Ue(){}Ue.prototype.nodeType=B,N(Ue,Z);function _e(){}_e.prototype.nodeType=ie,N(_e,Z);function Le(){}Le.prototype.nodeName="#document-fragment",Le.prototype.nodeType=M,N(Le,Z);function Ve(){}Ve.prototype.nodeType=A,N(Ve,Z);function qe(){}qe.prototype.serializeToString=function(f,v,I){return Ge.call(f,v,I)},Z.prototype.toString=Ge;function Ge(f,v){var I=[],q=this.nodeType==9&&this.documentElement||this,fe=q.prefix,Re=q.namespaceURI;if(Re&&fe==null){var fe=q.lookupPrefix(Re);if(fe==null)var Me=[{namespace:Re,prefix:null}]}return Xe(this,I,f,v,Me),I.join("")}function Ke(f,v,I){var q=f.prefix||"",fe=f.namespaceURI;if(!fe||q==="xml"&&fe===r.XML||fe===r.XMLNS)return!1;for(var Re=I.length;Re--;){var Me=I[Re];if(Me.prefix===q)return Me.namespace!==fe}return!0}function We(f,v,I){f.push(" ",v,'="',I.replace(/[<>&"\t\n\r]/g,ne),'"')}function Xe(f,v,I,q,fe){if(fe||(fe=[]),q)if(f=q(f),f){if(typeof f=="string"){v.push(f);return}}else return;switch(f.nodeType){case P:var Re=f.attributes,Me=Re.length,_=f.firstChild,le=f.tagName;I=r.isHTML(f.namespaceURI)||I;var Ye=le;if(!I&&!f.prefix&&f.namespaceURI){for(var Qe,$e=0;$e<Re.length;$e++)if(Re.item($e).name==="xmlns"){Qe=Re.item($e).value;break}if(!Qe)for(var i=fe.length-1;i>=0;i--){var y=fe[i];if(y.prefix===""&&y.namespace===f.namespaceURI){Qe=y.namespace;break}}if(Qe!==f.namespaceURI)for(var i=fe.length-1;i>=0;i--){var y=fe[i];if(y.namespace===f.namespaceURI){y.prefix&&(Ye=y.prefix+":"+le);break}}}v.push("<",Ye);for(var s=0;s<Me;s++){var p=Re.item(s);p.prefix=="xmlns"?fe.push({prefix:p.localName,namespace:p.value}):p.nodeName=="xmlns"&&fe.push({prefix:"",namespace:p.value})}for(var s=0;s<Me;s++){var p=Re.item(s);if(Ke(p,I,fe)){var R=p.prefix||"",b=p.namespaceURI;We(v,R?"xmlns:"+R:"xmlns",b),fe.push({prefix:R,namespace:b})}Xe(p,v,I,q,fe)}if(le===Ye&&Ke(f,I,fe)){var R=f.prefix||"",b=f.namespaceURI;We(v,R?"xmlns:"+R:"xmlns",b),fe.push({prefix:R,namespace:b})}if(_||I&&!/^(?:meta|link|img|br|hr|input)$/i.test(le)){if(v.push(">"),I&&/^script$/i.test(le))for(;_;)_.data?v.push(_.data):Xe(_,v,I,q,fe.slice()),_=_.nextSibling;else for(;_;)Xe(_,v,I,q,fe.slice()),_=_.nextSibling;v.push("</",Ye,">")}else v.push("/>");return;case O:case M:for(var _=f.firstChild;_;)Xe(_,v,I,q,fe.slice()),_=_.nextSibling;return;case H:return We(v,f.name,f.value);case Y:return v.push(f.data.replace(/[<&>]/g,ne));case W:return v.push("<![CDATA[",f.data,"]]>");case E:return v.push("<!--",f.data,"-->");case g:var j=f.publicId,te=f.systemId;if(v.push("<!DOCTYPE ",f.name),j)v.push(" PUBLIC ",j),te&&te!="."&&v.push(" ",te),v.push(">");else if(te&&te!=".")v.push(" SYSTEM ",te,">");else{var ke=f.internalSubset;ke&&v.push(" [",ke,"]"),v.push(">")}return;case A:return v.push("<?",f.target," ",f.data,"?>");case ie:return v.push("&",f.nodeName,";");default:v.push("??",f.nodeName)}}function it(f,v,I){var q;switch(v.nodeType){case P:q=v.cloneNode(!1),q.ownerDocument=f;case M:break;case H:I=!0;break}if(q||(q=v.cloneNode(!1)),q.ownerDocument=f,q.parentNode=null,I)for(var fe=v.firstChild;fe;)q.appendChild(it(f,fe,I)),fe=fe.nextSibling;return q}function et(f,v,I){var q=new v.constructor;for(var fe in v)if(Object.prototype.hasOwnProperty.call(v,fe)){var Re=v[fe];typeof Re!="object"&&Re!=q[fe]&&(q[fe]=Re)}switch(v.childNodes&&(q.childNodes=new $),q.ownerDocument=f,q.nodeType){case P:var Me=v.attributes,le=q.attributes=new oe,Ye=Me.length;le._ownerElement=q;for(var Qe=0;Qe<Ye;Qe++)q.setAttributeNode(et(f,Me.item(Qe),!0));break;case H:I=!0}if(I)for(var $e=v.firstChild;$e;)q.appendChild(et(f,$e,I)),$e=$e.nextSibling;return q}function rt(f,v,I){f[v]=I}try{if(Object.defineProperty){let f=function(v){switch(v.nodeType){case P:case M:var I=[];for(v=v.firstChild;v;)v.nodeType!==7&&v.nodeType!==8&&I.push(f(v)),v=v.nextSibling;return I.join("");default:return v.nodeValue}};Object.defineProperty(re.prototype,"length",{get:function(){return ue(this),this.$$length}}),Object.defineProperty(Z.prototype,"textContent",{get:function(){return f(this)},set:function(v){switch(this.nodeType){case P:case M:for(;this.firstChild;)this.removeChild(this.firstChild);(v||String(v))&&this.appendChild(this.ownerDocument.createTextNode(v));break;default:this.data=v,this.value=v,this.nodeValue=v}}}),rt=function(v,I,q){v["$$"+I]=q}}}catch(f){}t.DocumentType=xe,t.DOMException=G,t.DOMImplementation=pe,t.Element=D,t.Node=Z,t.NodeList=$,t.XMLSerializer=qe},"./node_modules/@xmldom/xmldom/lib/entities.js":function(o,t,e){var n=e("./node_modules/@xmldom/xmldom/lib/conventions.js").freeze;t.XML_ENTITIES=n({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=n({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",times:"\xD7",divide:"\xF7",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",euro:"\u20AC",trade:"\u2122",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"}),t.entityMap=t.HTML_ENTITIES},"./node_modules/@xmldom/xmldom/lib/index.js":function(o,t,e){var n=e("./node_modules/@xmldom/xmldom/lib/dom.js");t.DOMImplementation=n.DOMImplementation,t.XMLSerializer=n.XMLSerializer,t.DOMParser=e("./node_modules/@xmldom/xmldom/lib/dom-parser.js").DOMParser},"./node_modules/@xmldom/xmldom/lib/sax.js":function(o,t,e){var n=e("./node_modules/@xmldom/xmldom/lib/conventions.js").NAMESPACE,l=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,r=new RegExp("[\\-\\.0-9"+l.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),u=new RegExp("^"+l.source+r.source+"*(?::"+l.source+r.source+"*)?$"),S=0,w=1,x=2,C=3,T=4,N=5,K=6,P=7;function H(k,V){this.message=k,this.locator=V,Error.captureStackTrace&&Error.captureStackTrace(this,H)}H.prototype=new Error,H.prototype.name=H.name;function Y(){}Y.prototype={parse:function(k,V,X){var G=this.domBuilder;G.startDocument(),g(V,V={}),W(k,V,X,G,this.errorHandler),G.endDocument()}};function W(k,V,X,G,$){function re(D){if(D>65535){D-=65536;var U=55296+(D>>10),Q=56320+(D&1023);return String.fromCharCode(U,Q)}else return String.fromCharCode(D)}function ue(D){var U=D.slice(1,-1);return Object.hasOwnProperty.call(X,U)?X[U]:U.charAt(0)==="#"?re(parseInt(U.substr(1).replace("x","0x"))):($.error("entity not found:"+D),D)}function oe(D){if(D>me){var U=k.substring(me,D).replace(/&#?\w+;/g,ue);Z&&ee(me),G.characters(U,0,D-me),me=D}}function ee(D,U){for(;D>=ae&&(U=pe.exec(k));)ce=U.index,ae=ce+U[0].length,Z.lineNumber++;Z.columnNumber=D-ce+1}for(var ce=0,ae=0,pe=/.*(?:\r\n?|\n)|.*$/g,Z=G.locator,ne=[{currentNSMap:V}],ge={},me=0;;){try{var ve=k.indexOf("<",me);if(ve<0){if(!k.substr(me).match(/^\s*$/)){var ye=G.doc,Ce=ye.createTextNode(k.substr(me));ye.appendChild(Ce),G.currentElement=Ce}return}switch(ve>me&&oe(ve),k.charAt(ve+1)){case"/":var h=k.indexOf(">",ve+3),Ee=k.substring(ve+2,h).replace(/[ \t\n\r]+$/g,""),be=ne.pop();h<0?(Ee=k.substring(ve+2).replace(/[\s<].*/,""),$.error("end tag name: "+Ee+" is not complete:"+be.tagName),h=ve+1+Ee.length):Ee.match(/\s</)&&(Ee=Ee.replace(/[\s<].*/,""),$.error("end tag name: "+Ee+" maybe not complete"),h=ve+1+Ee.length);var Oe=be.localNSMap,we=be.tagName==Ee,De=we||be.tagName&&be.tagName.toLowerCase()==Ee.toLowerCase();if(De){if(G.endElement(be.uri,be.localName,Ee),Oe)for(var He in Oe)Object.prototype.hasOwnProperty.call(Oe,He)&&G.endPrefixMapping(He);we||$.fatalError("end tag name: "+Ee+" is not match the current start tagName:"+be.tagName)}else ne.push(be);h++;break;case"?":Z&&ee(ve),h=z(k,ve,G);break;case"!":Z&&ee(ve),h=M(k,ve,G,$);break;default:Z&&ee(ve);var Pe=new L,se=ne[ne.length-1].currentNSMap,h=B(k,ve,Pe,se,ue,$),c=Pe.length;if(!Pe.closed&&O(k,h,Pe.tagName,ge)&&(Pe.closed=!0,X.nbsp||$.warning("unclosed xml attribute")),Z&&c){for(var a=ie(Z,{}),d=0;d<c;d++){var m=Pe[d];ee(m.offset),m.locator=ie(Z,{})}G.locator=a,A(Pe,G,se)&&ne.push(Pe),G.locator=Z}else A(Pe,G,se)&&ne.push(Pe);n.isHTML(Pe.uri)&&!Pe.closed?h=E(k,h,Pe.tagName,ue,G):h++}}catch(D){if(D instanceof H)throw D;$.error("element parse error: "+D),h=-1}h>me?me=h:oe(Math.max(ve,me)+1)}}function ie(k,V){return V.lineNumber=k.lineNumber,V.columnNumber=k.columnNumber,V}function B(k,V,X,G,$,re){function ue(Z,ne,ge){X.attributeNames.hasOwnProperty(Z)&&re.fatalError("Attribute "+Z+" redefined"),X.addValue(Z,ne.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,$),ge)}for(var oe,ee,ce=++V,ae=S;;){var pe=k.charAt(ce);switch(pe){case"=":if(ae===w)oe=k.slice(V,ce),ae=C;else if(ae===x)ae=C;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ae===C||ae===w)if(ae===w&&(re.warning('attribute value must after "="'),oe=k.slice(V,ce)),V=ce+1,ce=k.indexOf(pe,V),ce>0)ee=k.slice(V,ce),ue(oe,ee,V-1),ae=N;else throw new Error("attribute value no end '"+pe+"' match");else if(ae==T)ee=k.slice(V,ce),ue(oe,ee,V),re.warning('attribute "'+oe+'" missed start quot('+pe+")!!"),V=ce+1,ae=N;else throw new Error('attribute value must after "="');break;case"/":switch(ae){case S:X.setTagName(k.slice(V,ce));case N:case K:case P:ae=P,X.closed=!0;case T:case w:case x:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return re.error("unexpected end of input"),ae==S&&X.setTagName(k.slice(V,ce)),ce;case">":switch(ae){case S:X.setTagName(k.slice(V,ce));case N:case K:case P:break;case T:case w:ee=k.slice(V,ce),ee.slice(-1)==="/"&&(X.closed=!0,ee=ee.slice(0,-1));case x:ae===x&&(ee=oe),ae==T?(re.warning('attribute "'+ee+'" missed quot(")!'),ue(oe,ee,V)):((!n.isHTML(G[""])||!ee.match(/^(?:disabled|checked|selected)$/i))&&re.warning('attribute "'+ee+'" missed value!! "'+ee+'" instead!!'),ue(ee,ee,V));break;case C:throw new Error("attribute value missed!!")}return ce;case"\x80":pe=" ";default:if(pe<=" ")switch(ae){case S:X.setTagName(k.slice(V,ce)),ae=K;break;case w:oe=k.slice(V,ce),ae=x;break;case T:var ee=k.slice(V,ce);re.warning('attribute "'+ee+'" missed quot(")!!'),ue(oe,ee,V);case N:ae=K;break}else switch(ae){case x:X.tagName,(!n.isHTML(G[""])||!oe.match(/^(?:disabled|checked|selected)$/i))&&re.warning('attribute "'+oe+'" missed value!! "'+oe+'" instead2!!'),ue(oe,oe,V),V=ce,ae=w;break;case N:re.warning('attribute space is required"'+oe+'"!!');case K:ae=w,V=ce;break;case C:ae=T,V=ce;break;case P:throw new Error("elements closed character '/' and '>' must be connected to")}}ce++}}function A(k,V,X){for(var G=k.tagName,$=null,pe=k.length;pe--;){var re=k[pe],ue=re.qName,oe=re.value,Z=ue.indexOf(":");if(Z>0)var ee=re.prefix=ue.slice(0,Z),ce=ue.slice(Z+1),ae=ee==="xmlns"&&ce;else ce=ue,ee=null,ae=ue==="xmlns"&&"";re.localName=ce,ae!==!1&&($==null&&($={},g(X,X={})),X[ae]=$[ae]=oe,re.uri=n.XMLNS,V.startPrefixMapping(ae,oe))}for(var pe=k.length;pe--;){re=k[pe];var ee=re.prefix;ee&&(ee==="xml"&&(re.uri=n.XML),ee!=="xmlns"&&(re.uri=X[ee||""]))}var Z=G.indexOf(":");Z>0?(ee=k.prefix=G.slice(0,Z),ce=k.localName=G.slice(Z+1)):(ee=null,ce=k.localName=G);var ne=k.uri=X[ee||""];if(V.startElement(ne,ce,G,k),k.closed){if(V.endElement(ne,ce,G),$)for(ee in $)Object.prototype.hasOwnProperty.call($,ee)&&V.endPrefixMapping(ee)}else return k.currentNSMap=X,k.localNSMap=$,!0}function E(k,V,X,G,$){if(/^(?:script|textarea)$/i.test(X)){var re=k.indexOf("</"+X+">",V),ue=k.substring(V+1,re);if(/[&<]/.test(ue))return/^script$/i.test(X)?($.characters(ue,0,ue.length),re):(ue=ue.replace(/&#?\w+;/g,G),$.characters(ue,0,ue.length),re)}return V+1}function O(k,V,X,G){var $=G[X];return $==null&&($=k.lastIndexOf("</"+X+">"),$<V&&($=k.lastIndexOf("</"+X)),G[X]=$),$<V}function g(k,V){for(var X in k)Object.prototype.hasOwnProperty.call(k,X)&&(V[X]=k[X])}function M(k,V,X,G){var $=k.charAt(V+2);switch($){case"-":if(k.charAt(V+3)==="-"){var re=k.indexOf("-->",V+4);return re>V?(X.comment(k,V+4,re-V-4),re+3):(G.error("Unclosed comment"),-1)}else return-1;default:if(k.substr(V+3,6)=="CDATA["){var re=k.indexOf("]]>",V+9);return X.startCDATA(),X.characters(k,V+9,re-V-9),X.endCDATA(),re+3}var ue=F(k,V),oe=ue.length;if(oe>1&&/!doctype/i.test(ue[0][0])){var ee=ue[1][0],ce=!1,ae=!1;oe>3&&(/^public$/i.test(ue[2][0])?(ce=ue[3][0],ae=oe>4&&ue[4][0]):/^system$/i.test(ue[2][0])&&(ae=ue[3][0]));var pe=ue[oe-1];return X.startDTD(ee,ce,ae),X.endDTD(),pe.index+pe[0].length}}return-1}function z(k,V,X){var G=k.indexOf("?>",V);if(G){var $=k.substring(V,G).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return $?($[0].length,X.processingInstruction($[1],$[2]),G+2):-1}return-1}function L(){this.attributeNames={}}L.prototype={setTagName:function(k){if(!u.test(k))throw new Error("invalid tagName:"+k);this.tagName=k},addValue:function(k,V,X){if(!u.test(k))throw new Error("invalid attribute:"+k);this.attributeNames[k]=this.length,this[this.length++]={qName:k,value:V,offset:X}},length:0,getLocalName:function(k){return this[k].localName},getLocator:function(k){return this[k].locator},getQName:function(k){return this[k].qName},getURI:function(k){return this[k].uri},getValue:function(k){return this[k].value}};function F(k,V){var X,G=[],$=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for($.lastIndex=V,$.exec(k);X=$.exec(k);)if(G.push(X),X[1])return G}t.XMLReader=Y,t.ParseError=H},"./node_modules/process/browser.js":function(o,t){var e=o.exports={},n,l;function r(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?n=setTimeout:n=r}catch(W){n=r}try{typeof clearTimeout=="function"?l=clearTimeout:l=u}catch(W){l=u}})();function S(W){if(n===setTimeout)return setTimeout(W,0);if((n===r||!n)&&setTimeout)return n=setTimeout,setTimeout(W,0);try{return n(W,0)}catch(ie){try{return n.call(null,W,0)}catch(B){return n.call(this,W,0)}}}function w(W){if(l===clearTimeout)return clearTimeout(W);if((l===u||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(W);try{return l(W)}catch(ie){try{return l.call(null,W)}catch(B){return l.call(this,W)}}}var x=[],C=!1,T,N=-1;function K(){!C||!T||(C=!1,T.length?x=T.concat(x):N=-1,x.length&&P())}function P(){if(!C){var W=S(K);C=!0;for(var ie=x.length;ie;){for(T=x,x=[];++N<ie;)T&&T[N].run();N=-1,ie=x.length}T=null,C=!1,w(W)}}e.nextTick=function(W){var ie=new Array(arguments.length-1);if(arguments.length>1)for(var B=1;B<arguments.length;B++)ie[B-1]=arguments[B];x.push(new H(W,ie)),x.length===1&&!C&&S(P)};function H(W,ie){this.fun=W,this.array=ie}H.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={};function Y(){}e.on=Y,e.addListener=Y,e.once=Y,e.off=Y,e.removeListener=Y,e.removeAllListeners=Y,e.emit=Y,e.prependListener=Y,e.prependOnceListener=Y,e.listeners=function(W){return[]},e.binding=function(W){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(W){throw new Error("process.chdir is not supported")},e.umask=function(){return 0}},"./node_modules/webpack/buildin/amd-options.js":function(o,t){(function(e){o.exports=e}).call(this,{})},"./node_modules/webpack/buildin/global.js":function(o,t){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(n){typeof window=="object"&&(e=window)}o.exports=e},"./node_modules/webpack/buildin/module.js":function(o,t){o.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},"./package.json":function(o){o.exports=JSON.parse('{"name":"cos-js-sdk-v5","version":"1.4.20","description":"JavaScript SDK for [\u817E\u8BAF\u4E91\u5BF9\u8C61\u5B58\u50A8](https://cloud.tencent.com/product/cos)","main":"dist/cos-js-sdk-v5.js","types":"index.d.ts","scripts":{"prettier":"prettier --write src demo/demo.js test/test.js server/sts.js index.d.ts","server":"node server/sts.js","dev":"cross-env NODE_ENV=development webpack -w --mode=development","build":"cross-env NODE_ENV=production webpack --mode=production","cos-auth.min.js":"uglifyjs ./demo/common/cos-auth.js -o ./demo/common/cos-auth.min.js -c -m","test":"jest --runInBand --coverage"},"repository":{"type":"git","url":"git+https://github.com/tencentyun/cos-js-sdk-v5.git"},"keywords":[],"author":"carsonxu","license":"ISC","bugs":{"url":"https://github.com/tencentyun/cos-js-sdk-v5/issues"},"homepage":"https://github.com/tencentyun/cos-js-sdk-v5#readme","dependencies":{"@xmldom/xmldom":"^0.8.6"},"devDependencies":{"@babel/core":"7.17.9","@babel/plugin-transform-runtime":"7.18.10","@babel/preset-env":"7.16.11","babel-loader":"8.2.5","body-parser":"^1.18.3","cross-env":"^5.2.0","express":"^4.16.4","jest":"^29.3.1","jest-environment-jsdom":"^29.3.1","prettier":"^3.0.1","qcloud-cos-sts":"^3.0.2","request":"^2.87.0","terser-webpack-plugin":"4.2.3","uglifyjs":"^2.4.11","webpack":"4.46.0","webpack-cli":"4.10.0"}}')},"./src/advance.js":function(o,t,e){var n=e("./node_modules/@babel/runtime/helpers/typeof.js"),l=e("./src/session.js"),r=e("./src/async.js"),u=e("./src/event.js").EventProxy,S=e("./src/util.js"),w=e("./src/tracker.js");function x(g,M){var z=this,L=new u,F=g.TaskId,k=g.Bucket,V=g.Region,X=g.Key,G=g.Body,$=g.ChunkSize||g.SliceSize||z.options.ChunkSize,re=g.AsyncLimit,ue=g.StorageClass,oe=g.ServerSideEncryption,ee,ce,ae=g.onHashProgress,pe=g.tracker;pe&&pe.setParams({chunkSize:$}),L.on("error",function(Z){if(!!z._isRunningTask(F))return Z.UploadId=g.UploadData.UploadId||"",M(Z)}),L.on("upload_complete",function(Z){var ne=S.extend({UploadId:g.UploadData.UploadId||""},Z);M(null,ne)}),L.on("upload_slice_complete",function(Z){var ne={};S.each(g.Headers,function(ge,me){var ve=me.toLowerCase();(ve.indexOf("x-cos-meta-")===0||ve==="pic-operations")&&(ne[me]=ge)}),H.call(z,{Bucket:k,Region:V,Key:X,UploadId:Z.UploadId,SliceList:Z.SliceList,Headers:ne,tracker:pe},function(ge,me){if(!!z._isRunningTask(F)){if(l.removeUsing(Z.UploadId),ge)return ce(null,!0),L.emit("error",ge);l.removeUploadId.call(z,Z.UploadId),ce({loaded:ee,total:ee},!0),L.emit("upload_complete",me)}})}),L.on("get_upload_data_finish",function(Z){var ne=l.getFileId(G,g.ChunkSize,k,X);ne&&l.saveUploadId.call(z,ne,Z.UploadId,z.options.UploadIdCacheLimit),l.setUsing(Z.UploadId),ce(null,!0),K.call(z,{TaskId:F,Bucket:k,Region:V,Key:X,Body:G,FileSize:ee,SliceSize:$,AsyncLimit:re,ServerSideEncryption:oe,UploadData:Z,Headers:g.Headers,onProgress:ce,tracker:pe},function(ge,me){if(!!z._isRunningTask(F)){if(ge)return ce(null,!0),L.emit("error",ge);L.emit("upload_slice_complete",me)}})}),L.on("get_file_size_finish",function(){if(ce=S.throttleOnProgress.call(z,ee,g.onProgress),g.UploadData.UploadId)L.emit("get_upload_data_finish",g.UploadData);else{var Z=S.extend({TaskId:F,Bucket:k,Region:V,Key:X,Headers:g.Headers,StorageClass:ue,Body:G,FileSize:ee,SliceSize:$,onHashProgress:ae,tracker:pe},g);C.call(z,Z,function(ne,ge){if(!!z._isRunningTask(F)){if(ne)return L.emit("error",ne);g.UploadData.UploadId=ge.UploadId,g.UploadData.PartList=ge.PartList,L.emit("get_upload_data_finish",g.UploadData)}})}}),ee=g.ContentLength,delete g.ContentLength,!g.Headers&&(g.Headers={}),S.each(g.Headers,function(Z,ne){ne.toLowerCase()==="content-length"&&delete g.Headers[ne]}),function(){for(var Z=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],ne=1024*1024,ge=0;ge<Z.length&&(ne=Z[ge]*1024*1024,!(ee/ne<=z.options.MaxPartNumber));ge++);g.ChunkSize=g.SliceSize=$=Math.max($,ne)}(),ee===0?(g.Body="",g.ContentLength=0,g.SkipTask=!0,z.putObject(g,M)):L.emit("get_file_size_finish")}function C(g,M){var z=g.TaskId,L=g.Bucket,F=g.Region,k=g.Key,V=g.StorageClass,X=this,G={},$=g.FileSize,re=g.SliceSize,ue=Math.ceil($/re),oe=0,ee=S.throttleOnProgress.call(X,$,g.onHashProgress),ce=function(ne,ge){var me=re*(ne-1),ve=Math.min(me+re,$),ye=ve-me;G[ne]?ge(null,{PartNumber:ne,ETag:G[ne],Size:ye}):S.fileSlice(g.Body,me,ve,!1,function(Ce){S.getFileMd5(Ce,function(Ee,be){if(Ee)return ge(S.error(Ee));var Oe='"'+be+'"';G[ne]=Oe,oe+=ye,ee({loaded:oe,total:$}),ge(null,{PartNumber:ne,ETag:Oe,Size:ye})})})},ae=function(ne,ge){var me=ne.length;if(me===0)return ge(null,!0);if(me>ue)return ge(null,!1);if(me>1){var ve=Math.max(ne[0].Size,ne[1].Size);if(ve!==re)return ge(null,!1)}var ye=function Ce(Ee){if(Ee<me){var be=ne[Ee];ce(be.PartNumber,function(Oe,we){we&&we.ETag===be.ETag&&we.Size===be.Size?Ce(Ee+1):ge(null,!1)})}else ge(null,!0)};ye(0)},pe=new u;pe.on("error",function(Z){if(!!X._isRunningTask(z))return M(Z)}),pe.on("upload_id_available",function(Z){var ne={},ge=[];S.each(Z.PartList,function(ye){ne[ye.PartNumber]=ye});for(var me=1;me<=ue;me++){var ve=ne[me];ve?(ve.PartNumber=me,ve.Uploaded=!0):ve={PartNumber:me,ETag:null,Uploaded:!1},ge.push(ve)}Z.PartList=ge,M(null,Z)}),pe.on("no_available_upload_id",function(){if(!!X._isRunningTask(z)){var Z=S.extend({Bucket:L,Region:F,Key:k,Query:S.clone(g.Query),StorageClass:V,Body:g.Body,calledBySdk:"sliceUploadFile",tracker:g.tracker},g),ne=S.clone(g.Headers);delete ne["x-cos-mime-limit"],Z.Headers=ne,X.multipartInit(Z,function(ge,me){if(!!X._isRunningTask(z)){if(ge)return pe.emit("error",ge);var ve=me.UploadId;if(!ve)return M(S.error(new Error("no such upload id")));pe.emit("upload_id_available",{UploadId:ve,PartList:[]})}})}}),pe.on("has_and_check_upload_id",function(Z){Z=Z.reverse(),r.eachLimit(Z,1,function(ne,ge){if(!!X._isRunningTask(z)){if(l.using[ne]){ge();return}N.call(X,{Bucket:L,Region:F,Key:k,UploadId:ne,tracker:g.tracker},function(me,ve){if(!!X._isRunningTask(z)){if(me)return l.removeUsing(ne),pe.emit("error",me);var ye=ve.PartList;ye.forEach(function(Ce){Ce.PartNumber*=1,Ce.Size*=1,Ce.ETag=Ce.ETag||""}),ae(ye,function(Ce,Ee){if(!!X._isRunningTask(z)){if(Ce)return pe.emit("error",Ce);Ee?ge({UploadId:ne,PartList:ye}):ge()}})}})}},function(ne){!X._isRunningTask(z)||(ee(null,!0),ne&&ne.UploadId?pe.emit("upload_id_available",ne):pe.emit("no_available_upload_id"))})}),pe.on("seek_local_avail_upload_id",function(Z){var ne=l.getFileId(g.Body,g.ChunkSize,L,k),ge=l.getUploadIdList.call(X,ne);if(!ne||!ge){pe.emit("has_and_check_upload_id",Z);return}var me=function ve(ye){if(ye>=ge.length){pe.emit("has_and_check_upload_id",Z);return}var Ce=ge[ye];if(!S.isInArray(Z,Ce)){l.removeUploadId.call(X,Ce),ve(ye+1);return}if(l.using[Ce]){ve(ye+1);return}N.call(X,{Bucket:L,Region:F,Key:k,UploadId:Ce,tracker:g.tracker},function(Ee,be){!X._isRunningTask(z)||(Ee?(l.removeUploadId.call(X,Ce),ve(ye+1)):pe.emit("upload_id_available",{UploadId:Ce,PartList:be.PartList}))})};me(0)}),pe.on("get_remote_upload_id_list",function(){T.call(X,{Bucket:L,Region:F,Key:k,tracker:g.tracker},function(Z,ne){if(!!X._isRunningTask(z)){if(Z)return pe.emit("error",Z);var ge=S.filter(ne.UploadList,function(ye){return ye.Key===k&&(!V||ye.StorageClass.toUpperCase()===V.toUpperCase())}).reverse().map(function(ye){return ye.UploadId||ye.UploadID});if(ge.length)pe.emit("seek_local_avail_upload_id",ge);else{var me=l.getFileId(g.Body,g.ChunkSize,L,k),ve;me&&(ve=l.getUploadIdList.call(X,me))&&S.each(ve,function(ye){l.removeUploadId.call(X,ye)}),pe.emit("no_available_upload_id")}}})}),pe.emit("get_remote_upload_id_list")}function T(g,M){var z=this,L=[],F={Bucket:g.Bucket,Region:g.Region,Prefix:g.Key,calledBySdk:g.calledBySdk||"sliceUploadFile",tracker:g.tracker},k=function V(){z.multipartList(F,function(X,G){if(X)return M(X);L.push.apply(L,G.Upload||[]),G.IsTruncated==="true"?(F.KeyMarker=G.NextKeyMarker,F.UploadIdMarker=G.NextUploadIdMarker,V()):M(null,{UploadList:L})})};k()}function N(g,M){var z=this,L=[],F={Bucket:g.Bucket,Region:g.Region,Key:g.Key,UploadId:g.UploadId,calledBySdk:"sliceUploadFile",tracker:g.tracker},k=function V(){z.multipartListPart(F,function(X,G){if(X)return M(X);L.push.apply(L,G.Part||[]),G.IsTruncated==="true"?(F.PartNumberMarker=G.NextPartNumberMarker,V()):M(null,{PartList:L})})};k()}function K(g,M){var z=this,L=g.TaskId,F=g.Bucket,k=g.Region,V=g.Key,X=g.UploadData,G=g.FileSize,$=g.SliceSize,re=Math.min(g.AsyncLimit||z.options.ChunkParallelLimit||1,256),ue=g.Body,oe=Math.ceil(G/$),ee=0,ce=g.ServerSideEncryption,ae=g.Headers,pe=S.filter(X.PartList,function(ne){return ne.Uploaded&&(ee+=ne.PartNumber>=oe&&G%$||$),!ne.Uploaded}),Z=g.onProgress;r.eachLimit(pe,re,function(ne,ge){if(!!z._isRunningTask(L)){var me=ne.PartNumber,ve=Math.min(G,ne.PartNumber*$)-(ne.PartNumber-1)*$,ye=0;P.call(z,{TaskId:L,Bucket:F,Region:k,Key:V,SliceSize:$,FileSize:G,PartNumber:me,ServerSideEncryption:ce,Body:ue,UploadData:X,Headers:ae,onProgress:function(Ee){ee+=Ee.loaded-ye,ye=Ee.loaded,Z({loaded:ee,total:G})},tracker:g.tracker},function(Ce,Ee){!z._isRunningTask(L)||(!Ce&&!Ee.ETag&&(Ce='get ETag error, please add "ETag" to CORS ExposeHeader setting.( \u83B7\u53D6ETag\u5931\u8D25\uFF0C\u8BF7\u5728CORS ExposeHeader\u8BBE\u7F6E\u4E2D\u6DFB\u52A0ETag\uFF0C\u8BF7\u53C2\u8003\u6587\u6863\uFF1Ahttps://cloud.tencent.com/document/product/436/13318 )'),Ce?ee-=ye:(ee+=ve-ye,ne.ETag=Ee.ETag),Z({loaded:ee,total:G}),ge(Ce||null,Ee))})}},function(ne){if(!!z._isRunningTask(L)){if(ne)return M(ne);M(null,{UploadId:X.UploadId,SliceList:X.PartList})}})}function P(g,M){var z=this,L=g.TaskId,F=g.Bucket,k=g.Region,V=g.Key,X=g.FileSize,G=g.Body,$=g.PartNumber*1,re=g.SliceSize,ue=g.ServerSideEncryption,oe=g.UploadData,ee=g.Headers||{},ce=z.options.ChunkRetryTimes+1,ae=re*($-1),pe=re,Z=ae+re;Z>X&&(Z=X,pe=Z-ae);var ne=["x-cos-traffic-limit","x-cos-mime-limit"],ge={};S.each(ee,function(ve,ye){ne.indexOf(ye)>-1&&(ge[ye]=ve)});var me=oe.PartList[$-1];r.retry(ce,function(ve){!z._isRunningTask(L)||S.fileSlice(G,ae,Z,!0,function(ye){z.multipartUpload({TaskId:L,Bucket:F,Region:k,Key:V,ContentLength:pe,PartNumber:$,UploadId:oe.UploadId,ServerSideEncryption:ue,Body:ye,Headers:ge,onProgress:g.onProgress,calledBySdk:"sliceUploadFile",tracker:g.tracker},function(Ce,Ee){if(!!z._isRunningTask(L))return Ce?ve(Ce):(me.Uploaded=!0,ve(null,Ee))})})},function(ve,ye){if(!!z._isRunningTask(L))return M(ve,ye)})}function H(g,M){var z=g.Bucket,L=g.Region,F=g.Key,k=g.UploadId,V=g.SliceList,X=this,G=this.options.ChunkRetryTimes+1,$=g.Headers,re=V.map(function(ue){return{PartNumber:ue.PartNumber,ETag:ue.ETag}});r.retry(G,function(ue){X.multipartComplete({Bucket:z,Region:L,Key:F,UploadId:k,Parts:re,Headers:$,calledBySdk:"sliceUploadFile",tracker:g.tracker},ue)},function(ue,oe){M(ue,oe)})}function Y(g,M){var z=g.Bucket,L=g.Region,F=g.Key,k=g.UploadId,V=g.Level||"task",X=g.AsyncLimit,G=this,$=new u;if($.on("error",function(re){return M(re)}),$.on("get_abort_array",function(re){W.call(G,{Bucket:z,Region:L,Key:F,Headers:g.Headers,AsyncLimit:X,AbortArray:re},M)}),V==="bucket")T.call(G,{Bucket:z,Region:L,calledBySdk:"abortUploadTask"},function(re,ue){if(re)return M(re);$.emit("get_abort_array",ue.UploadList||[])});else if(V==="file"){if(!F)return M(S.error(new Error("abort_upload_task_no_key")));T.call(G,{Bucket:z,Region:L,Key:F,calledBySdk:"abortUploadTask"},function(re,ue){if(re)return M(re);$.emit("get_abort_array",ue.UploadList||[])})}else if(V==="task"){if(!k)return M(S.error(new Error("abort_upload_task_no_id")));if(!F)return M(S.error(new Error("abort_upload_task_no_key")));$.emit("get_abort_array",[{Key:F,UploadId:k}])}else return M(S.error(new Error("abort_unknown_level")))}function W(g,M){var z=g.Bucket,L=g.Region,F=g.Key,k=g.AbortArray,V=g.AsyncLimit||1,X=this,G=0,$=new Array(k.length);r.eachLimit(k,V,function(re,ue){var oe=G;if(F&&F!==re.Key){$[oe]={error:{KeyNotMatch:!0}},ue(null);return}var ee=re.UploadId||re.UploadID;X.multipartAbort({Bucket:z,Region:L,Key:re.Key,Headers:g.Headers,UploadId:ee},function(ce){var ae={Bucket:z,Region:L,Key:re.Key,UploadId:ee};$[oe]={error:ce,task:ae},ue(null)}),G++},function(re){if(re)return M(re);for(var ue=[],oe=[],ee=0,ce=$.length;ee<ce;ee++){var ae=$[ee];ae.task&&(ae.error?oe.push(ae.task):ue.push(ae.task))}return M(null,{successList:ue,errorList:oe})})}function ie(g,M){var z=this,L=g.SliceSize===void 0?z.options.SliceSize:g.SliceSize,F=[],k=g.Body,V=k.size||k.length||0,X={TaskId:""};if(z.options.EnableTracker){var G=z.options.UseAccelerate||typeof z.options.Domain=="string"&&z.options.Domain.includes("accelerate.");g.tracker=new w({bucket:g.Bucket,region:g.Region,apiName:"uploadFile",fileKey:g.Key,fileSize:V,accelerate:G,deepTracker:z.options.DeepTracker,customId:z.options.CustomId,delay:z.options.TrackerDelay})}S.each(g,function(ce,ae){n(ce)!=="object"&&typeof ce!="function"&&(X[ae]=ce)});var $=g.onTaskReady,re=function(ae){X.TaskId=ae,$&&$(ae)};g.onTaskReady=re;var ue=V>L?"sliceUploadFile":"putObject",oe=g.onFileFinish,ee=function(ae,pe){g.tracker&&g.tracker.formatResult(ae,pe),oe&&oe(ae,pe,X),M&&M(ae,pe)};F.push({api:ue,params:g,callback:ee}),z._addTasks(F)}function B(g,M){var z=this,L=g.SliceSize===void 0?z.options.SliceSize:g.SliceSize,F=0,k=0,V=S.throttleOnProgress.call(z,k,g.onProgress),X=g.files.length,G=g.onFileFinish,$=Array(X),re=function(ee,ce,ae){V(null,!0),G&&G(ee,ce,ae),$[ae.Index]={options:ae,error:ee,data:ce},--X<=0&&M&&M(null,{files:$})},ue=[];S.each(g.files,function(oe,ee){(function(){var ce=oe.Body,ae=ce.size||ce.length||0,pe={Index:ee,TaskId:""};if(!z.options.UseRawKey&&oe.Key&&oe.Key.substr(0,1)==="/"&&(oe.Key=oe.Key.substr(1)),F+=ae,z.options.EnableTracker){var Z=z.options.UseAccelerate||typeof z.options.Domain=="string"&&z.options.Domain.includes("accelerate.");oe.tracker=new w({bucket:oe.Bucket,region:oe.Region,apiName:"uploadFiles",fileKey:oe.Key,fileSize:ae,accelerate:Z,deepTracker:z.options.DeepTracker,customId:z.options.CustomId,delay:z.options.TrackerDelay})}S.each(oe,function(Oe,we){n(Oe)!=="object"&&typeof Oe!="function"&&(pe[we]=Oe)});var ne=oe.onTaskReady,ge=function(we){pe.TaskId=we,ne&&ne(we)};oe.onTaskReady=ge;var me=0,ve=oe.onProgress,ye=function(we){k=k-me+we.loaded,me=we.loaded,ve&&ve(we),V({loaded:k,total:F})};oe.onProgress=ye;var Ce=ae>L?"sliceUploadFile":"putObject",Ee=oe.onFileFinish,be=function(we,De){oe.tracker&&oe.tracker.formatResult(we,De),Ee&&Ee(we,De),re&&re(we,De,pe)};ue.push({api:Ce,params:oe,callback:be})})()}),z._addTasks(ue)}function A(g,M){var z=new u,L=this,F=g.Bucket,k=g.Region,V=g.Key,X=g.CopySource,G=S.getSourceParams.call(this,X);if(!G){M(S.error(new Error("CopySource format error")));return}var $=G.Bucket,re=G.Region,ue=decodeURIComponent(G.Key),oe=g.CopySliceSize===void 0?L.options.CopySliceSize:g.CopySliceSize;oe=Math.max(0,oe);var ee=g.CopyChunkSize||this.options.CopyChunkSize,ce=this.options.CopyChunkParallelLimit,ae=this.options.ChunkRetryTimes+1,pe=0,Z=0,ne,ge,me={},ve={},ye={};z.on("copy_slice_complete",function(Ce){S.each(g.Headers,function(be,Oe){Oe.toLowerCase().indexOf("x-cos-meta-")});var Ee=S.map(Ce.PartList,function(be){return{PartNumber:be.PartNumber,ETag:be.ETag}});r.retry(ae,function(be){L.multipartComplete({Bucket:F,Region:k,Key:V,UploadId:Ce.UploadId,Parts:Ee,calledBySdk:"sliceCopyFile"},be)},function(be,Oe){if(l.removeUsing(Ce.UploadId),be)return ge(null,!0),M(be);l.removeUploadId(Ce.UploadId),ge({loaded:ne,total:ne},!0),M(null,Oe)})}),z.on("get_copy_data_finish",function(Ce){var Ee=l.getCopyFileId(X,me,ee,F,V);Ee&&l.saveUploadId(Ee,Ce.UploadId,L.options.UploadIdCacheLimit),l.setUsing(Ce.UploadId);var be=S.filter(Ce.PartList,function(Oe){return Oe.Uploaded&&(Z+=Oe.PartNumber>=pe&&ne%ee||ee),!Oe.Uploaded});r.eachLimit(be,ce,function(Oe,we){var De=Oe.PartNumber,He=Oe.CopySourceRange,Pe=Oe.end-Oe.start;r.retry(ae,function(se){E.call(L,{Bucket:F,Region:k,Key:V,CopySource:X,UploadId:Ce.UploadId,PartNumber:De,CopySourceRange:He},se)},function(se,h){if(se)return we(se);Z+=Pe,ge({loaded:Z,total:ne}),Oe.ETag=h.ETag,we(se||null,h)})},function(Oe){if(Oe)return l.removeUsing(Ce.UploadId),ge(null,!0),M(Oe);z.emit("copy_slice_complete",Ce)})}),z.on("get_chunk_size_finish",function(){var Ce=function(){L.multipartInit({Bucket:F,Region:k,Key:V,Headers:ye},function(De,He){if(De)return M(De);g.UploadId=He.UploadId,z.emit("get_copy_data_finish",{UploadId:g.UploadId,PartList:g.PartList})})},Ee=l.getCopyFileId(X,me,ee,F,V),be=l.getUploadIdList(Ee);if(!Ee||!be)return Ce();var Oe=function we(De){if(De>=be.length)return Ce();var He=be[De];if(l.using[He])return we(De+1);N.call(L,{Bucket:F,Region:k,Key:V,UploadId:He},function(Pe,se){if(Pe)l.removeUploadId(He),we(De+1);else{if(l.using[He])return we(De+1);var h={},c=0;S.each(se.PartList,function(a){var d=parseInt(a.Size),m=c+d-1;h[a.PartNumber+"|"+c+"|"+m]=a.ETag,c+=d}),S.each(g.PartList,function(a){var d=h[a.PartNumber+"|"+a.start+"|"+a.end];d&&(a.ETag=d,a.Uploaded=!0)}),z.emit("get_copy_data_finish",{UploadId:He,PartList:g.PartList})}})};Oe(0)}),z.on("get_file_size_finish",function(){if(function(){for(var Ee=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096,5120],be=1024*1024,Oe=0;Oe<Ee.length&&(be=Ee[Oe]*1024*1024,!(ne/be<=L.options.MaxPartNumber));Oe++);g.ChunkSize=ee=Math.max(ee,be),pe=Math.ceil(ne/ee);for(var we=[],De=1;De<=pe;De++){var He=(De-1)*ee,Pe=De*ee<ne?De*ee-1:ne-1,se={PartNumber:De,start:He,end:Pe,CopySourceRange:"bytes="+He+"-"+Pe};we.push(se)}g.PartList=we}(),g.Headers["x-cos-metadata-directive"]==="Replaced"?ye=g.Headers:ye=ve,ye["x-cos-storage-class"]=g.Headers["x-cos-storage-class"]||ve["x-cos-storage-class"],ye=S.clearKey(ye),ve["x-cos-storage-class"]==="ARCHIVE"||ve["x-cos-storage-class"]==="DEEP_ARCHIVE"){var Ce=ve["x-cos-restore"];if(!Ce||Ce==='ongoing-request="true"'){M(S.error(new Error("Unrestored archive object is not allowed to be copied")));return}}delete ye["x-cos-copy-source"],delete ye["x-cos-metadata-directive"],delete ye["x-cos-copy-source-If-Modified-Since"],delete ye["x-cos-copy-source-If-Unmodified-Since"],delete ye["x-cos-copy-source-If-Match"],delete ye["x-cos-copy-source-If-None-Match"],z.emit("get_chunk_size_finish")}),L.headObject({Bucket:$,Region:re,Key:ue},function(Ce,Ee){if(Ce){Ce.statusCode&&Ce.statusCode===404?M(S.error(Ce,{ErrorStatus:ue+" Not Exist"})):M(Ce);return}if(ne=g.FileSize=Ee.headers["content-length"],ne===void 0||!ne){M(S.error(new Error('get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.\uFF08 \u83B7\u53D6Content-Length\u5931\u8D25\uFF0C\u8BF7\u5728CORS ExposeHeader\u8BBE\u7F6E\u4E2D\u6DFB\u52A0Content-Length\uFF0C\u8BF7\u53C2\u8003\u6587\u6863\uFF1Ahttps://cloud.tencent.com/document/product/436/13318 \uFF09')));return}if(ge=S.throttleOnProgress.call(L,ne,g.onProgress),ne<=oe)g.Headers["x-cos-metadata-directive"]||(g.Headers["x-cos-metadata-directive"]="Copy"),L.putObjectCopy(g,function(Oe,we){if(Oe)return ge(null,!0),M(Oe);ge({loaded:ne,total:ne},!0),M(Oe,we)});else{var be=Ee.headers;me=be,ve={"Cache-Control":be["cache-control"],"Content-Disposition":be["content-disposition"],"Content-Encoding":be["content-encoding"],"Content-Type":be["content-type"],Expires:be.expires,"x-cos-storage-class":be["x-cos-storage-class"]},S.each(be,function(Oe,we){var De="x-cos-meta-";we.indexOf(De)===0&&we.length>De.length&&(ve[we]=Oe)}),z.emit("get_file_size_finish")}})}function E(g,M){var z=g.TaskId,L=g.Bucket,F=g.Region,k=g.Key,V=g.CopySource,X=g.UploadId,G=g.PartNumber*1,$=g.CopySourceRange,re=this.options.ChunkRetryTimes+1,ue=this;r.retry(re,function(oe){ue.uploadPartCopy({TaskId:z,Bucket:L,Region:F,Key:k,CopySource:V,UploadId:X,PartNumber:G,CopySourceRange:$},function(ee,ce){oe(ee||null,ce)})},function(oe,ee){return M(oe,ee)})}var O={sliceUploadFile:x,abortUploadTask:Y,uploadFile:ie,uploadFiles:B,sliceCopyFile:A};o.exports.init=function(g,M){M.transferToTaskMethod(O,"sliceUploadFile"),S.each(O,function(z,L){g.prototype[L]=S.apiWrapper(L,z)})}},"./src/async.js":function(o,t){var e=function(u,S,w,x){if(x=x||function(){},!u.length||S<=0)return x();var C=0,T=0,N=0;(function K(){if(C>=u.length)return x();for(;N<S&&T<u.length;)T+=1,N+=1,w(u[T-1],function(P){P?(x(P),x=function(){}):(C+=1,N-=1,C>=u.length?x():K())})})()},n=function(u,S,w){var x=function C(T){S(function(N,K){N&&T<u?C(T+1):w(N,K)})};u<1?w():x(1)},l={eachLimit:e,retry:n};o.exports=l},"./src/base.js":function(o,t,e){var n=e("./node_modules/@babel/runtime/helpers/typeof.js"),l=e("./lib/request.js"),r=e("./src/util.js");function u(i,y){typeof i=="function"&&(y=i,i={});var s=this.options.Protocol||(r.isBrowser&&(typeof location=="undefined"?"undefined":n(location))==="object"&&location.protocol==="http:"?"http:":"https:"),p=this.options.ServiceDomain,R=i.AppId||this.options.appId,b=i.Region;p?(p=p.replace(/\{\{AppId\}\}/gi,R||"").replace(/\{\{Region\}\}/gi,b||"").replace(/\{\{.*?\}\}/gi,""),/^[a-zA-Z]+:\/\//.test(p)||(p=s+"//"+p),p.slice(-1)==="/"&&(p=p.slice(0,-1))):b?p=s+"//cos."+b+".myqcloud.com":p=s+"//service.cos.myqcloud.com";var _="",j=b?"cos."+b+".myqcloud.com":"service.cos.myqcloud.com",te=p.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1");j===te&&(_=j),le.call(this,{Action:"name/cos:GetService",url:p,method:"GET",headers:i.Headers,SignHost:_},function(ke,Te){if(ke)return y(ke);var Se=Te&&Te.ListAllMyBucketsResult&&Te.ListAllMyBucketsResult.Buckets&&Te.ListAllMyBucketsResult.Buckets.Bucket||[];Se=r.isArray(Se)?Se:[Se];var Ae=Te&&Te.ListAllMyBucketsResult&&Te.ListAllMyBucketsResult.Owner||{};y(null,{Buckets:Se,Owner:Ae,statusCode:Te.statusCode,headers:Te.headers})})}function S(i,y){var s=this,p="";if(i.BucketAZConfig){var R={BucketAZConfig:i.BucketAZConfig};p=r.json2xml({CreateBucketConfiguration:R})}le.call(this,{Action:"name/cos:PutBucket",method:"PUT",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,body:p},function(b,_){if(b)return y(b);var j=q({protocol:s.options.Protocol,domain:s.options.Domain,bucket:i.Bucket,region:i.Region,isLocation:!0});y(null,{Location:j,statusCode:_.statusCode,headers:_.headers})})}function w(i,y){le.call(this,{Action:"name/cos:HeadBucket",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,method:"HEAD"},y)}function x(i,y){var s={};s.prefix=i.Prefix||"",s.delimiter=i.Delimiter,s.marker=i.Marker,s["max-keys"]=i.MaxKeys,s["encoding-type"]=i.EncodingType,le.call(this,{Action:"name/cos:GetBucket",ResourceKey:s.prefix,method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,qs:s},function(p,R){if(p)return y(p);var b=R.ListBucketResult||{},_=b.Contents||[],j=b.CommonPrefixes||[];_=r.isArray(_)?_:[_],j=r.isArray(j)?j:[j];var te=r.clone(b);r.extend(te,{Contents:_,CommonPrefixes:j,statusCode:R.statusCode,headers:R.headers}),y(null,te)})}function C(i,y){le.call(this,{Action:"name/cos:DeleteBucket",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,method:"DELETE"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function T(i,y){var s=i.Headers,p="";if(i.AccessControlPolicy){var R=r.clone(i.AccessControlPolicy||{}),b=R.Grants||R.Grant;b=r.isArray(b)?b:[b],delete R.Grant,delete R.Grants,R.AccessControlList={Grant:b},p=r.json2xml({AccessControlPolicy:R}),s["Content-Type"]="application/xml",s["Content-MD5"]=r.b64(r.md5(p))}r.each(s,function(_,j){j.indexOf("x-cos-grant-")===0&&(s[j]=I(s[j]))}),le.call(this,{Action:"name/cos:PutBucketACL",method:"PUT",Bucket:i.Bucket,Region:i.Region,headers:s,action:"acl",body:p},function(_,j){if(_)return y(_);y(null,{statusCode:j.statusCode,headers:j.headers})})}function N(i,y){le.call(this,{Action:"name/cos:GetBucketACL",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"acl"},function(s,p){if(s)return y(s);var R=p.AccessControlPolicy||{},b=R.Owner||{},_=R.AccessControlList.Grant||[];_=r.isArray(_)?_:[_];var j=v(R);p.headers&&p.headers["x-cos-acl"]&&(j.ACL=p.headers["x-cos-acl"]),j=r.extend(j,{Owner:b,Grants:_,statusCode:p.statusCode,headers:p.headers}),y(null,j)})}function K(i,y){var s=i.CORSConfiguration||{},p=s.CORSRules||i.CORSRules||[];p=r.clone(r.isArray(p)?p:[p]),r.each(p,function(j){r.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],function(te){var ke=te+"s",Te=j[ke]||j[te]||[];delete j[ke],j[te]=r.isArray(Te)?Te:[Te]})});var R={CORSRule:p};i.ResponseVary&&(R.ResponseVary=i.ResponseVary);var b=r.json2xml({CORSConfiguration:R}),_=i.Headers;_["Content-Type"]="application/xml",_["Content-MD5"]=r.b64(r.md5(b)),le.call(this,{Action:"name/cos:PutBucketCORS",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:b,action:"cors",headers:_},function(j,te){if(j)return y(j);y(null,{statusCode:te.statusCode,headers:te.headers})})}function P(i,y){le.call(this,{Action:"name/cos:GetBucketCORS",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"cors"},function(s,p){if(s){if(s.statusCode===404&&s.error&&s.error.Code==="NoSuchCORSConfiguration"){var R={CORSRules:[],statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=p.CORSConfiguration||{},_=b.CORSRules||b.CORSRule||[];_=r.clone(r.isArray(_)?_:[_]);var j=b.ResponseVary;r.each(_,function(te){r.each(["AllowedOrigin","AllowedHeader","AllowedMethod","ExposeHeader"],function(ke){var Te=ke+"s",Se=te[Te]||te[ke]||[];delete te[ke],te[Te]=r.isArray(Se)?Se:[Se]})}),y(null,{CORSRules:_,ResponseVary:j,statusCode:p.statusCode,headers:p.headers})})}function H(i,y){le.call(this,{Action:"name/cos:DeleteBucketCORS",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"cors"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode||s.statusCode,headers:p.headers})})}function Y(i,y){le.call(this,{Action:"name/cos:GetBucketLocation",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"location"},y)}function W(i,y){var s=i.Policy;try{typeof s=="string"&&(s=JSON.parse(s))}catch(b){}if(!s||typeof s=="string")return y(r.error(new Error("Policy format error")));var p=JSON.stringify(s);s.version||(s.version="2.0");var R=i.Headers;R["Content-Type"]="application/json",R["Content-MD5"]=r.b64(r.md5(p)),le.call(this,{Action:"name/cos:PutBucketPolicy",method:"PUT",Bucket:i.Bucket,Region:i.Region,action:"policy",body:p,headers:R},function(b,_){if(b&&b.statusCode===204)return y(null,{statusCode:b.statusCode});if(b)return y(b);y(null,{statusCode:_.statusCode,headers:_.headers})})}function ie(i,y){le.call(this,{Action:"name/cos:GetBucketPolicy",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"policy",rawBody:!0},function(s,p){if(s)return s.statusCode&&s.statusCode===403?y(r.error(s,{ErrorStatus:"Access Denied"})):s.statusCode&&s.statusCode===405?y(r.error(s,{ErrorStatus:"Method Not Allowed"})):s.statusCode&&s.statusCode===404?y(r.error(s,{ErrorStatus:"Policy Not Found"})):y(s);var R={};try{R=JSON.parse(p.body)}catch(b){}y(null,{Policy:R,statusCode:p.statusCode,headers:p.headers})})}function B(i,y){le.call(this,{Action:"name/cos:DeleteBucketPolicy",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"policy"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode||s.statusCode,headers:p.headers})})}function A(i,y){var s=i.Tagging||{},p=s.TagSet||s.Tags||i.Tags||[];p=r.clone(r.isArray(p)?p:[p]);var R=r.json2xml({Tagging:{TagSet:{Tag:p}}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketTagging",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"tagging",headers:b},function(_,j){if(_&&_.statusCode===204)return y(null,{statusCode:_.statusCode});if(_)return y(_);y(null,{statusCode:j.statusCode,headers:j.headers})})}function E(i,y){le.call(this,{Action:"name/cos:GetBucketTagging",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"tagging"},function(s,p){if(s){if(s.statusCode===404&&s.error&&(s.error==="Not Found"||s.error.Code==="NoSuchTagSet")){var R={Tags:[],statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=[];try{b=p.Tagging.TagSet.Tag||[]}catch(_){}b=r.clone(r.isArray(b)?b:[b]),y(null,{Tags:b,statusCode:p.statusCode,headers:p.headers})})}function O(i,y){le.call(this,{Action:"name/cos:DeleteBucketTagging",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"tagging"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function g(i,y){var s=i.LifecycleConfiguration||{},p=s.Rules||i.Rules||[];p=r.clone(p);var R=r.json2xml({LifecycleConfiguration:{Rule:p}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketLifecycle",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"lifecycle",headers:b},function(_,j){if(_&&_.statusCode===204)return y(null,{statusCode:_.statusCode});if(_)return y(_);y(null,{statusCode:j.statusCode,headers:j.headers})})}function M(i,y){le.call(this,{Action:"name/cos:GetBucketLifecycle",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"lifecycle"},function(s,p){if(s){if(s.statusCode===404&&s.error&&s.error.Code==="NoSuchLifecycleConfiguration"){var R={Rules:[],statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=[];try{b=p.LifecycleConfiguration.Rule||[]}catch(_){}b=r.clone(r.isArray(b)?b:[b]),y(null,{Rules:b,statusCode:p.statusCode,headers:p.headers})})}function z(i,y){le.call(this,{Action:"name/cos:DeleteBucketLifecycle",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"lifecycle"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function L(i,y){if(!i.VersioningConfiguration){y(r.error(new Error("missing param VersioningConfiguration")));return}var s=i.VersioningConfiguration||{},p=r.json2xml({VersioningConfiguration:s}),R=i.Headers;R["Content-Type"]="application/xml",R["Content-MD5"]=r.b64(r.md5(p)),le.call(this,{Action:"name/cos:PutBucketVersioning",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:p,action:"versioning",headers:R},function(b,_){if(b&&b.statusCode===204)return y(null,{statusCode:b.statusCode});if(b)return y(b);y(null,{statusCode:_.statusCode,headers:_.headers})})}function F(i,y){le.call(this,{Action:"name/cos:GetBucketVersioning",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"versioning"},function(s,p){s||!p.VersioningConfiguration&&(p.VersioningConfiguration={}),y(s,p)})}function k(i,y){var s=r.clone(i.ReplicationConfiguration),p=r.json2xml({ReplicationConfiguration:s});p=p.replace(/<(\/?)Rules>/gi,"<$1Rule>"),p=p.replace(/<(\/?)Tags>/gi,"<$1Tag>");var R=i.Headers;R["Content-Type"]="application/xml",R["Content-MD5"]=r.b64(r.md5(p)),le.call(this,{Action:"name/cos:PutBucketReplication",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:p,action:"replication",headers:R},function(b,_){if(b&&b.statusCode===204)return y(null,{statusCode:b.statusCode});if(b)return y(b);y(null,{statusCode:_.statusCode,headers:_.headers})})}function V(i,y){le.call(this,{Action:"name/cos:GetBucketReplication",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"replication"},function(s,p){if(s){if(s.statusCode===404&&s.error&&(s.error==="Not Found"||s.error.Code==="ReplicationConfigurationnotFoundError")){var R={ReplicationConfiguration:{Rules:[]},statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}!p.ReplicationConfiguration&&(p.ReplicationConfiguration={}),p.ReplicationConfiguration.Rule&&(p.ReplicationConfiguration.Rules=r.makeArray(p.ReplicationConfiguration.Rule),delete p.ReplicationConfiguration.Rule),y(s,p)})}function X(i,y){le.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"replication"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function G(i,y){if(!i.WebsiteConfiguration){y(r.error(new Error("missing param WebsiteConfiguration")));return}var s=r.clone(i.WebsiteConfiguration||{}),p=s.RoutingRules||s.RoutingRule||[];p=r.isArray(p)?p:[p],delete s.RoutingRule,delete s.RoutingRules,p.length&&(s.RoutingRules={RoutingRule:p});var R=r.json2xml({WebsiteConfiguration:s}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketWebsite",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"website",headers:b},function(_,j){if(_&&_.statusCode===204)return y(null,{statusCode:_.statusCode});if(_)return y(_);y(null,{statusCode:j.statusCode,headers:j.headers})})}function $(i,y){le.call(this,{Action:"name/cos:GetBucketWebsite",method:"GET",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,action:"website"},function(s,p){if(s){if(s.statusCode===404&&s.error.Code==="NoSuchWebsiteConfiguration"){var R={WebsiteConfiguration:{},statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=p.WebsiteConfiguration||{};if(b.RoutingRules){var _=r.clone(b.RoutingRules.RoutingRule||[]);_=r.makeArray(_),b.RoutingRules=_}y(null,{WebsiteConfiguration:b,statusCode:p.statusCode,headers:p.headers})})}function re(i,y){le.call(this,{Action:"name/cos:DeleteBucketWebsite",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"website"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function ue(i,y){if(!i.RefererConfiguration){y(r.error(new Error("missing param RefererConfiguration")));return}var s=r.clone(i.RefererConfiguration||{}),p=s.DomainList||{},R=p.Domains||p.Domain||[];R=r.isArray(R)?R:[R],R.length&&(s.DomainList={Domain:R});var b=r.json2xml({RefererConfiguration:s}),_=i.Headers;_["Content-Type"]="application/xml",_["Content-MD5"]=r.b64(r.md5(b)),le.call(this,{Action:"name/cos:PutBucketReferer",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:b,action:"referer",headers:_},function(j,te){if(j&&j.statusCode===204)return y(null,{statusCode:j.statusCode});if(j)return y(j);y(null,{statusCode:te.statusCode,headers:te.headers})})}function oe(i,y){le.call(this,{Action:"name/cos:GetBucketReferer",method:"GET",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,action:"referer"},function(s,p){if(s){if(s.statusCode===404&&s.error.Code==="NoSuchRefererConfiguration"){var R={WebsiteConfiguration:{},statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=p.RefererConfiguration||{};if(b.DomainList){var _=r.makeArray(b.DomainList.Domain||[]);b.DomainList={Domains:_}}y(null,{RefererConfiguration:b,statusCode:p.statusCode,headers:p.headers})})}function ee(i,y){var s=i.DomainConfiguration||{},p=s.DomainRule||i.DomainRule||[];p=r.clone(p);var R=r.json2xml({DomainConfiguration:{DomainRule:p}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketDomain",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"domain",headers:b},function(_,j){if(_&&_.statusCode===204)return y(null,{statusCode:_.statusCode});if(_)return y(_);y(null,{statusCode:j.statusCode,headers:j.headers})})}function ce(i,y){le.call(this,{Action:"name/cos:GetBucketDomain",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"domain"},function(s,p){if(s)return y(s);var R=[];try{R=p.DomainConfiguration.DomainRule||[]}catch(b){}R=r.clone(r.isArray(R)?R:[R]),y(null,{DomainRule:R,statusCode:p.statusCode,headers:p.headers})})}function ae(i,y){le.call(this,{Action:"name/cos:DeleteBucketDomain",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"domain"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function pe(i,y){var s=i.OriginConfiguration||{},p=s.OriginRule||i.OriginRule||[];p=r.clone(p);var R=r.json2xml({OriginConfiguration:{OriginRule:p}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketOrigin",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"origin",headers:b},function(_,j){if(_&&_.statusCode===204)return y(null,{statusCode:_.statusCode});if(_)return y(_);y(null,{statusCode:j.statusCode,headers:j.headers})})}function Z(i,y){le.call(this,{Action:"name/cos:GetBucketOrigin",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"origin"},function(s,p){if(s)return y(s);var R=[];try{R=p.OriginConfiguration.OriginRule||[]}catch(b){}R=r.clone(r.isArray(R)?R:[R]),y(null,{OriginRule:R,statusCode:p.statusCode,headers:p.headers})})}function ne(i,y){le.call(this,{Action:"name/cos:DeleteBucketOrigin",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"origin"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function ge(i,y){var s=r.json2xml({BucketLoggingStatus:i.BucketLoggingStatus||""}),p=i.Headers;p["Content-Type"]="application/xml",p["Content-MD5"]=r.b64(r.md5(s)),le.call(this,{Action:"name/cos:PutBucketLogging",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:s,action:"logging",headers:p},function(R,b){if(R&&R.statusCode===204)return y(null,{statusCode:R.statusCode});if(R)return y(R);y(null,{statusCode:b.statusCode,headers:b.headers})})}function me(i,y){le.call(this,{Action:"name/cos:GetBucketLogging",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"logging"},function(s,p){if(s)return y(s);y(null,{BucketLoggingStatus:p.BucketLoggingStatus,statusCode:p.statusCode,headers:p.headers})})}function ve(i,y,s){var p=r.clone(y.InventoryConfiguration);if(p.OptionalFields){var R=p.OptionalFields||[];p.OptionalFields={Field:R}}if(p.Destination&&p.Destination.COSBucketDestination&&p.Destination.COSBucketDestination.Encryption){var b=p.Destination.COSBucketDestination.Encryption;Object.keys(b).indexOf("SSECOS")>-1&&(b["SSE-COS"]=b.SSECOS,delete b.SSECOS)}var _=r.json2xml({InventoryConfiguration:p}),j=y.Headers;j["Content-Type"]="application/xml",j["Content-MD5"]=r.b64(r.md5(_));var te=i==="PUT"?"name/cos:PutBucketInventory":"name/cos:PostBucketInventory";le.call(this,{Action:te,method:i,Bucket:y.Bucket,Region:y.Region,body:_,action:"inventory",qs:{id:y.Id},headers:j},function(ke,Te){if(ke&&ke.statusCode===204)return s(null,{statusCode:ke.statusCode});if(ke)return s(ke);s(null,{statusCode:Te.statusCode,headers:Te.headers})})}function ye(i,y){return ve.call(this,"PUT",i,y)}function Ce(i,y){return ve.call(this,"POST",i,y)}function Ee(i,y){le.call(this,{Action:"name/cos:GetBucketInventory",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"inventory",qs:{id:i.Id}},function(s,p){if(s)return y(s);var R=p.InventoryConfiguration;if(R&&R.OptionalFields&&R.OptionalFields.Field){var b=R.OptionalFields.Field;r.isArray(b)||(b=[b]),R.OptionalFields=b}if(R.Destination&&R.Destination.COSBucketDestination&&R.Destination.COSBucketDestination.Encryption){var _=R.Destination.COSBucketDestination.Encryption;Object.keys(_).indexOf("SSE-COS")>-1&&(_.SSECOS=_["SSE-COS"],delete _["SSE-COS"])}y(null,{InventoryConfiguration:R,statusCode:p.statusCode,headers:p.headers})})}function be(i,y){le.call(this,{Action:"name/cos:ListBucketInventory",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"inventory",qs:{"continuation-token":i.ContinuationToken}},function(s,p){if(s)return y(s);var R=p.ListInventoryConfigurationResult,b=R.InventoryConfiguration||[];b=r.isArray(b)?b:[b],delete R.InventoryConfiguration,r.each(b,function(_){if(_&&_.OptionalFields&&_.OptionalFields.Field){var j=_.OptionalFields.Field;r.isArray(j)||(j=[j]),_.OptionalFields=j}if(_.Destination&&_.Destination.COSBucketDestination&&_.Destination.COSBucketDestination.Encryption){var te=_.Destination.COSBucketDestination.Encryption;Object.keys(te).indexOf("SSE-COS")>-1&&(te.SSECOS=te["SSE-COS"],delete te["SSE-COS"])}}),R.InventoryConfigurations=b,r.extend(R,{statusCode:p.statusCode,headers:p.headers}),y(null,R)})}function Oe(i,y){le.call(this,{Action:"name/cos:DeleteBucketInventory",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"inventory",qs:{id:i.Id}},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function we(i,y){if(!i.AccelerateConfiguration){y(r.error(new Error("missing param AccelerateConfiguration")));return}var s={AccelerateConfiguration:i.AccelerateConfiguration||{}},p=r.json2xml(s),R={};R["Content-Type"]="application/xml",R["Content-MD5"]=r.b64(r.md5(p)),le.call(this,{Action:"name/cos:PutBucketAccelerate",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:p,action:"accelerate",headers:R},function(b,_){if(b)return y(b);y(null,{statusCode:_.statusCode,headers:_.headers})})}function De(i,y){le.call(this,{Action:"name/cos:GetBucketAccelerate",method:"GET",Bucket:i.Bucket,Region:i.Region,action:"accelerate"},function(s,p){s||!p.AccelerateConfiguration&&(p.AccelerateConfiguration={}),y(s,p)})}function He(i,y){var s=i.ServerSideEncryptionConfiguration||{},p=s.Rule||s.Rules||[],R=r.json2xml({ServerSideEncryptionConfiguration:{Rule:p}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutBucketEncryption",method:"PUT",Bucket:i.Bucket,Region:i.Region,body:R,action:"encryption",headers:b},function(_,j){if(_&&_.statusCode===204)return y(null,{statusCode:_.statusCode});if(_)return y(_);y(null,{statusCode:j.statusCode,headers:j.headers})})}function Pe(i,y){le.call(this,{Action:"name/cos:GetBucketEncryption",method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"encryption"},function(s,p){if(s){if(s.statusCode===404&&s.code==="NoSuchEncryptionConfiguration"){var R={EncryptionConfiguration:{Rules:[]},statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=r.makeArray(p.EncryptionConfiguration&&p.EncryptionConfiguration.Rule||[]);p.EncryptionConfiguration={Rules:b},y(s,p)})}function se(i,y){le.call(this,{Action:"name/cos:DeleteBucketReplication",method:"DELETE",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"encryption"},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function h(i,y){le.call(this,{Action:"name/cos:HeadObject",method:"HEAD",Bucket:i.Bucket,Region:i.Region,Key:i.Key,VersionId:i.VersionId,headers:i.Headers},function(s,p){if(s){var R=s.statusCode;return i.Headers["If-Modified-Since"]&&R&&R===304?y(null,{NotModified:!0,statusCode:R}):y(s)}p.ETag=r.attr(p.headers,"etag",""),y(null,p)})}function c(i,y){var s={};s.prefix=i.Prefix||"",s.delimiter=i.Delimiter,s["key-marker"]=i.KeyMarker,s["version-id-marker"]=i.VersionIdMarker,s["max-keys"]=i.MaxKeys,s["encoding-type"]=i.EncodingType,le.call(this,{Action:"name/cos:GetBucketObjectVersions",ResourceKey:s.prefix,method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,qs:s,action:"versions"},function(p,R){if(p)return y(p);var b=R.ListVersionsResult||{},_=b.DeleteMarker||[];_=r.isArray(_)?_:[_];var j=b.Version||[];j=r.isArray(j)?j:[j];var te=r.clone(b);delete te.DeleteMarker,delete te.Version,r.extend(te,{DeleteMarkers:_,Versions:j,statusCode:R.statusCode,headers:R.headers}),y(null,te)})}function a(i,y){var s=i.Query||{},p=i.QueryString||"",R=r.throttleOnProgress.call(this,0,i.onProgress),b=i.tracker;b&&b.setParams({signStartTime:new Date().getTime()}),s["response-content-type"]=i.ResponseContentType,s["response-content-language"]=i.ResponseContentLanguage,s["response-expires"]=i.ResponseExpires,s["response-cache-control"]=i.ResponseCacheControl,s["response-content-disposition"]=i.ResponseContentDisposition,s["response-content-encoding"]=i.ResponseContentEncoding,le.call(this,{Action:"name/cos:GetObject",method:"GET",Bucket:i.Bucket,Region:i.Region,Key:i.Key,VersionId:i.VersionId,DataType:i.DataType,headers:i.Headers,qs:s,qsStr:p,rawBody:!0,onDownloadProgress:R,tracker:b},function(_,j){if(R(null,!0),_){var te=_.statusCode;return i.Headers["If-Modified-Since"]&&te&&te===304?y(null,{NotModified:!0}):y(_)}y(null,{Body:j.body,ETag:r.attr(j.headers,"etag",""),statusCode:j.statusCode,headers:j.headers})})}function d(i,y){var s=this,p=i.ContentLength,R=r.throttleOnProgress.call(s,p,i.onProgress),b=i.Headers;!b["Cache-Control"]&&!b["cache-control"]&&(b["Cache-Control"]=""),!b["Content-Type"]&&!b["content-type"]&&(b["Content-Type"]=i.Body&&i.Body.type||"");var _=i.UploadAddMetaMd5||s.options.UploadAddMetaMd5||s.options.UploadCheckContentMd5,j=i.tracker;_&&j&&j.setParams({md5StartTime:new Date().getTime()}),r.getBodyMd5(_,i.Body,function(te){te&&(j&&j.setParams({md5EndTime:new Date().getTime()}),s.options.UploadCheckContentMd5&&(b["Content-MD5"]=r.b64(te)),(i.UploadAddMetaMd5||s.options.UploadAddMetaMd5)&&(b["x-cos-meta-md5"]=te)),i.ContentLength!==void 0&&(b["Content-Length"]=i.ContentLength),R(null,!0),le.call(s,{Action:"name/cos:PutObject",TaskId:i.TaskId,method:"PUT",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,qs:i.Query,body:i.Body,onProgress:R,tracker:j},function(ke,Te){if(ke)return R(null,!0),y(ke);R({loaded:p,total:p},!0);var Se=q({ForcePathStyle:s.options.ForcePathStyle,protocol:s.options.Protocol,domain:s.options.Domain,bucket:i.Bucket,region:s.options.UseAccelerate?"accelerate":i.Region,object:i.Key});Se=Se.substr(Se.indexOf("://")+3),Te.Location=Se,Te.ETag=r.attr(Te.headers,"etag",""),y(null,Te)})},i.onHashProgress)}function m(i,y){le.call(this,{Action:"name/cos:DeleteObject",method:"DELETE",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,VersionId:i.VersionId,action:i.Recursive?"recursive":""},function(s,p){if(s){var R=s.statusCode;return R&&R===404?y(null,{BucketNotFound:!0,statusCode:R}):y(s)}y(null,{statusCode:p.statusCode,headers:p.headers})})}function D(i,y){var s={};i.VersionId&&(s.versionId=i.VersionId),le.call(this,{Action:"name/cos:GetObjectACL",method:"GET",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,qs:s,action:"acl"},function(p,R){if(p)return y(p);var b=R.AccessControlPolicy||{},_=b.Owner||{},j=b.AccessControlList&&b.AccessControlList.Grant||[];j=r.isArray(j)?j:[j];var te=v(b);delete te.GrantWrite,R.headers&&R.headers["x-cos-acl"]&&(te.ACL=R.headers["x-cos-acl"]),te=r.extend(te,{Owner:_,Grants:j,statusCode:R.statusCode,headers:R.headers}),y(null,te)})}function U(i,y){var s=i.Headers,p="";if(i.AccessControlPolicy){var R=r.clone(i.AccessControlPolicy||{}),b=R.Grants||R.Grant;b=r.isArray(b)?b:[b],delete R.Grant,delete R.Grants,R.AccessControlList={Grant:b},p=r.json2xml({AccessControlPolicy:R}),s["Content-Type"]="application/xml",s["Content-MD5"]=r.b64(r.md5(p))}r.each(s,function(_,j){j.indexOf("x-cos-grant-")===0&&(s[j]=I(s[j]))}),le.call(this,{Action:"name/cos:PutObjectACL",method:"PUT",Bucket:i.Bucket,Region:i.Region,Key:i.Key,action:"acl",headers:s,body:p},function(_,j){if(_)return y(_);y(null,{statusCode:j.statusCode,headers:j.headers})})}function Q(i,y){var s=i.Headers;s.Origin=i.Origin,s["Access-Control-Request-Method"]=i.AccessControlRequestMethod,s["Access-Control-Request-Headers"]=i.AccessControlRequestHeaders,le.call(this,{Action:"name/cos:OptionsObject",method:"OPTIONS",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:s},function(p,R){if(p)return p.statusCode&&p.statusCode===403?y(null,{OptionsForbidden:!0,statusCode:p.statusCode}):y(p);var b=R.headers||{};y(null,{AccessControlAllowOrigin:b["access-control-allow-origin"],AccessControlAllowMethods:b["access-control-allow-methods"],AccessControlAllowHeaders:b["access-control-allow-headers"],AccessControlExposeHeaders:b["access-control-expose-headers"],AccessControlMaxAge:b["access-control-max-age"],statusCode:R.statusCode,headers:R.headers})})}function de(i,y){var s=this,p=i.Headers;!p["Cache-Control"]&&!p["cache-control"]&&(p["Cache-Control"]="");var R=i.CopySource||"",b=r.getSourceParams.call(this,R);if(!b){y(r.error(new Error("CopySource format error")));return}var _=b.Bucket,j=b.Region,te=decodeURIComponent(b.Key);le.call(this,{Scope:[{action:"name/cos:GetObject",bucket:_,region:j,prefix:te},{action:"name/cos:PutObject",bucket:i.Bucket,region:i.Region,prefix:i.Key}],method:"PUT",Bucket:i.Bucket,Region:i.Region,Key:i.Key,VersionId:i.VersionId,headers:i.Headers},function(ke,Te){if(ke)return y(ke);var Se=r.clone(Te.CopyObjectResult||{}),Ae=q({ForcePathStyle:s.options.ForcePathStyle,protocol:s.options.Protocol,domain:s.options.Domain,bucket:i.Bucket,region:i.Region,object:i.Key,isLocation:!0});r.extend(Se,{Location:Ae,statusCode:Te.statusCode,headers:Te.headers}),y(null,Se)})}function he(i,y){var s=i.CopySource||"",p=r.getSourceParams.call(this,s);if(!p){y(r.error(new Error("CopySource format error")));return}var R=p.Bucket,b=p.Region,_=decodeURIComponent(p.Key);le.call(this,{Scope:[{action:"name/cos:GetObject",bucket:R,region:b,prefix:_},{action:"name/cos:PutObject",bucket:i.Bucket,region:i.Region,prefix:i.Key}],method:"PUT",Bucket:i.Bucket,Region:i.Region,Key:i.Key,VersionId:i.VersionId,qs:{partNumber:i.PartNumber,uploadId:i.UploadId},headers:i.Headers},function(j,te){if(j)return y(j);var ke=r.clone(te.CopyPartResult||{});r.extend(ke,{statusCode:te.statusCode,headers:te.headers}),y(null,ke)})}function J(i,y){var s=i.Objects||[],p=i.Quiet;s=r.isArray(s)?s:[s];var R=r.json2xml({Delete:{Object:s,Quiet:p||!1}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R));var _=r.map(s,function(j){return{action:"name/cos:DeleteObject",bucket:i.Bucket,region:i.Region,prefix:j.Key}});le.call(this,{Scope:_,method:"POST",Bucket:i.Bucket,Region:i.Region,body:R,action:"delete",headers:b},function(j,te){if(j)return y(j);var ke=te.DeleteResult||{},Te=ke.Deleted||[],Se=ke.Error||[];Te=r.isArray(Te)?Te:[Te],Se=r.isArray(Se)?Se:[Se];var Ae=r.clone(ke);r.extend(Ae,{Error:Se,Deleted:Te,statusCode:te.statusCode,headers:te.headers}),y(null,Ae)})}function xe(i,y){var s=i.Headers;if(!i.RestoreRequest){y(r.error(new Error("missing param RestoreRequest")));return}var p=i.RestoreRequest||{},R=r.json2xml({RestoreRequest:p});s["Content-Type"]="application/xml",s["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:RestoreObject",method:"POST",Bucket:i.Bucket,Region:i.Region,Key:i.Key,VersionId:i.VersionId,body:R,action:"restore",headers:s},y)}function Be(i,y){var s=i.Tagging||{},p=s.TagSet||s.Tags||i.Tags||[];p=r.clone(r.isArray(p)?p:[p]);var R=r.json2xml({Tagging:{TagSet:{Tag:p}}}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:PutObjectTagging",method:"PUT",Bucket:i.Bucket,Key:i.Key,Region:i.Region,body:R,action:"tagging",headers:b,VersionId:i.VersionId},function(_,j){if(_&&_.statusCode===204)return y(null,{statusCode:_.statusCode});if(_)return y(_);y(null,{statusCode:j.statusCode,headers:j.headers})})}function Ue(i,y){le.call(this,{Action:"name/cos:GetObjectTagging",method:"GET",Key:i.Key,Bucket:i.Bucket,Region:i.Region,headers:i.Headers,action:"tagging",VersionId:i.VersionId},function(s,p){if(s){if(s.statusCode===404&&s.error&&(s.error==="Not Found"||s.error.Code==="NoSuchTagSet")){var R={Tags:[],statusCode:s.statusCode};s.headers&&(R.headers=s.headers),y(null,R)}else y(s);return}var b=[];try{b=p.Tagging.TagSet.Tag||[]}catch(_){}b=r.clone(r.isArray(b)?b:[b]),y(null,{Tags:b,statusCode:p.statusCode,headers:p.headers})})}function _e(i,y){le.call(this,{Action:"name/cos:DeleteObjectTagging",method:"DELETE",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,action:"tagging",VersionId:i.VersionId},function(s,p){if(s&&s.statusCode===204)return y(null,{statusCode:s.statusCode});if(s)return y(s);y(null,{statusCode:p.statusCode,headers:p.headers})})}function Le(i,y){var s=i.SelectType;if(!s)return y(r.error(new Error("missing param SelectType")));var p=i.SelectRequest||{},R=r.json2xml({SelectRequest:p}),b=i.Headers;b["Content-Type"]="application/xml",b["Content-MD5"]=r.b64(r.md5(R)),le.call(this,{Action:"name/cos:GetObject",method:"POST",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,action:"select",qs:{"select-type":i.SelectType},VersionId:i.VersionId,body:R,DataType:"arraybuffer",rawBody:!0},function(_,j){if(_&&_.statusCode===204)return y(null,{statusCode:_.statusCode});if(_)return y(_);var te=r.parseSelectPayload(j.body);y(null,{statusCode:j.statusCode,headers:j.headers,Body:te.body,Payload:te.payload})})}function Ve(i,y){var s=this,p=i.Headers,R=i.tracker;!p["Cache-Control"]&&!p["cache-control"]&&(p["Cache-Control"]=""),!p["Content-Type"]&&!p["content-type"]&&(p["Content-Type"]=i.Body&&i.Body.type||"");var b=i.Body&&(i.UploadAddMetaMd5||s.options.UploadAddMetaMd5);b&&R&&R.setParams({md5StartTime:new Date().getTime()}),r.getBodyMd5(b,i.Body,function(_){_&&(i.Headers["x-cos-meta-md5"]=_),b&&R&&R.setParams({md5EndTime:new Date().getTime()}),le.call(s,{Action:"name/cos:InitiateMultipartUpload",method:"POST",Bucket:i.Bucket,Region:i.Region,Key:i.Key,action:"uploads",headers:i.Headers,qs:i.Query,tracker:R},function(j,te){if(j)return R&&R.parent&&R.parent.setParams({errorNode:"multipartInit"}),y(j);if(te=r.clone(te||{}),te&&te.InitiateMultipartUploadResult)return y(null,r.extend(te.InitiateMultipartUploadResult,{statusCode:te.statusCode,headers:te.headers}));y(null,te)})},i.onHashProgress)}function qe(i,y){var s=this;r.getFileSize("multipartUpload",i,function(){var p=i.tracker,R=s.options.UploadCheckContentMd5;R&&p&&p.setParams({md5StartTime:new Date().getTime()}),r.getBodyMd5(R,i.Body,function(b){b&&(i.Headers["Content-MD5"]=r.b64(b)),R&&p&&p.setParams({md5EndTime:new Date().getTime()}),p&&p.setParams({partNumber:i.PartNumber}),le.call(s,{Action:"name/cos:UploadPart",TaskId:i.TaskId,method:"PUT",Bucket:i.Bucket,Region:i.Region,Key:i.Key,qs:{partNumber:i.PartNumber,uploadId:i.UploadId},headers:i.Headers,onProgress:i.onProgress,body:i.Body||null,tracker:p},function(_,j){if(_)return p&&p.parent&&p.parent.setParams({errorNode:"multipartUpload"}),y(_);y(null,{ETag:r.attr(j.headers,"etag",""),statusCode:j.statusCode,headers:j.headers})})})})}function Ge(i,y){for(var s=this,p=i.UploadId,R=i.Parts,b=i.tracker,_=0,j=R.length;_<j;_++)R[_].ETag&&R[_].ETag.indexOf('"')===0||(R[_].ETag='"'+R[_].ETag+'"');var te=r.json2xml({CompleteMultipartUpload:{Part:R}});te=te.replace(/\n\s*/g,"");var ke=i.Headers;ke["Content-Type"]="application/xml",ke["Content-MD5"]=r.b64(r.md5(te)),le.call(this,{Action:"name/cos:CompleteMultipartUpload",method:"POST",Bucket:i.Bucket,Region:i.Region,Key:i.Key,qs:{uploadId:p},body:te,headers:ke,tracker:b},function(Te,Se){if(Te)return b&&b.parent&&b.parent.setParams({errorNode:"multipartComplete"}),y(Te);var Ae=q({ForcePathStyle:s.options.ForcePathStyle,protocol:s.options.Protocol,domain:s.options.Domain,bucket:i.Bucket,region:i.Region,object:i.Key,isLocation:!0}),Fe=Se.CompleteMultipartUploadResult||{};Fe.ProcessResults&&Fe&&Fe.ProcessResults&&(Fe.UploadResult={OriginalInfo:{Key:Fe.Key,Location:Ae,ETag:Fe.ETag,ImageInfo:Fe.ImageInfo},ProcessResults:Fe.ProcessResults},delete Fe.ImageInfo,delete Fe.ProcessResults);var Je=r.extend(Fe,{Location:Ae,statusCode:Se.statusCode,headers:Se.headers});y(null,Je)})}function Ke(i,y){var s={};s.delimiter=i.Delimiter,s["encoding-type"]=i.EncodingType,s.prefix=i.Prefix||"",s["max-uploads"]=i.MaxUploads,s["key-marker"]=i.KeyMarker,s["upload-id-marker"]=i.UploadIdMarker,s=r.clearKey(s);var p=i.tracker;p&&p.setParams({signStartTime:new Date().getTime()}),le.call(this,{Action:"name/cos:ListMultipartUploads",ResourceKey:s.prefix,method:"GET",Bucket:i.Bucket,Region:i.Region,headers:i.Headers,qs:s,action:"uploads",tracker:p},function(R,b){if(R)return p&&p.parent&&p.parent.setParams({errorNode:"multipartList"}),y(R);if(b&&b.ListMultipartUploadsResult){var _=b.ListMultipartUploadsResult.Upload||[];_=r.isArray(_)?_:[_],b.ListMultipartUploadsResult.Upload=_}var j=r.clone(b.ListMultipartUploadsResult||{});r.extend(j,{statusCode:b.statusCode,headers:b.headers}),y(null,j)})}function We(i,y){var s={},p=i.tracker;s.uploadId=i.UploadId,s["encoding-type"]=i.EncodingType,s["max-parts"]=i.MaxParts,s["part-number-marker"]=i.PartNumberMarker,le.call(this,{Action:"name/cos:ListParts",method:"GET",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,qs:s},function(R,b){if(R)return p&&p.parent&&p.parent.setParams({errorNode:"multipartListPart"}),y(R);var _=b.ListPartsResult||{},j=_.Part||[];j=r.isArray(j)?j:[j],_.Part=j;var te=r.clone(_);r.extend(te,{statusCode:b.statusCode,headers:b.headers}),y(null,te)})}function Xe(i,y){var s={};s.uploadId=i.UploadId,le.call(this,{Action:"name/cos:AbortMultipartUpload",method:"DELETE",Bucket:i.Bucket,Region:i.Region,Key:i.Key,headers:i.Headers,qs:s},function(p,R){if(p)return y(p);y(null,{statusCode:R.statusCode,headers:R.headers})})}function it(i,y){le.call(this,{method:i.Method,Bucket:i.Bucket,Region:i.Region,Key:i.Key,action:i.Action,headers:i.Headers,qs:i.Query,body:i.Body,Url:i.Url,rawBody:i.RawBody,DataType:i.DataType},function(s,p){if(s)return y(s);p&&p.body&&(p.Body=p.body,delete p.body),y(s,p)})}function et(i,y){var s=i.Headers;!s["Cache-Control"]&&!s["cache-control"]&&(s["Cache-Control"]=""),!s["Content-Type"]&&!s["content-type"]&&(s["Content-Type"]=i.Body&&i.Body.type||""),le.call(this,{Action:"name/cos:AppendObject",method:"POST",Bucket:i.Bucket,Region:i.Region,action:"append",Key:i.Key,body:i.Body,qs:{position:i.Position},headers:i.Headers},function(p,R){if(p)return y(p);y(null,R)})}function rt(i){var y=this;return r.getAuth({SecretId:i.SecretId||this.options.SecretId||"",SecretKey:i.SecretKey||this.options.SecretKey||"",Bucket:i.Bucket,Region:i.Region,Method:i.Method,Key:i.Key,Query:i.Query,Headers:i.Headers,Expires:i.Expires,UseRawKey:y.options.UseRawKey,SystemClockOffset:y.options.SystemClockOffset})}function f(i,y){var s=this,p=i.UseAccelerate===void 0?s.options.UseAccelerate:i.UseAccelerate,R=q({ForcePathStyle:s.options.ForcePathStyle,protocol:i.Protocol||s.options.Protocol,domain:i.Domain||s.options.Domain,bucket:i.Bucket,region:p?"accelerate":i.Region,object:i.Key}),b="";i.Query&&(b+=r.obj2str(i.Query)),i.QueryString&&(b+=(b?"&":"")+i.QueryString);var _=R;if(i.Sign!==void 0&&!i.Sign)return b&&(_+="?"+b),y(null,{Url:_}),_;var j=fe.call(this,{Bucket:i.Bucket,Region:i.Region,UseAccelerate:i.UseAccelerate,Url:R}),te=Re.call(this,{Action:(i.Method||"").toUpperCase()==="PUT"?"name/cos:PutObject":"name/cos:GetObject",Bucket:i.Bucket||"",Region:i.Region||"",Method:i.Method||"get",Key:i.Key,Expires:i.Expires,Headers:i.Headers,Query:i.Query,SignHost:j,ForceSignHost:i.ForceSignHost===!1?!1:s.options.ForceSignHost},function(ke,Te){if(!!y){if(ke){y(ke);return}var Se=function(Je){var st=Je.match(/q-url-param-list.*?(?=&)/g)[0],ot="q-url-param-list="+encodeURIComponent(st.replace(/q-url-param-list=/,"")).toLowerCase(),Ze=new RegExp(st,"g"),at=Je.replace(Ze,ot);return at},Ae=R;Ae+="?"+(Te.Authorization.indexOf("q-signature")>-1?Se(Te.Authorization):"sign="+encodeURIComponent(Te.Authorization)),Te.SecurityToken&&(Ae+="&x-cos-security-token="+Te.SecurityToken),Te.ClientIP&&(Ae+="&clientIP="+Te.ClientIP),Te.ClientUA&&(Ae+="&clientUA="+Te.ClientUA),Te.Token&&(Ae+="&token="+Te.Token),b&&(Ae+="&"+b),setTimeout(function(){y(null,{Url:Ae})})}});return te?(_+="?"+te.Authorization+(te.SecurityToken?"&x-cos-security-token="+te.SecurityToken:""),b&&(_+="&"+b)):b&&(_+="?"+b),_}function v(i){var y={GrantFullControl:[],GrantWrite:[],GrantRead:[],GrantReadAcp:[],GrantWriteAcp:[],ACL:""},s={FULL_CONTROL:"GrantFullControl",WRITE:"GrantWrite",READ:"GrantRead",READ_ACP:"GrantReadAcp",WRITE_ACP:"GrantWriteAcp"},p=i&&i.AccessControlList||{},R=p.Grant;R&&(R=r.isArray(R)?R:[R]);var b={READ:0,WRITE:0,FULL_CONTROL:0};return R&&R.length&&r.each(R,function(_){_.Grantee.ID==="qcs::cam::anyone:anyone"||_.Grantee.URI==="http://cam.qcloud.com/groups/global/AllUsers"?b[_.Permission]=1:_.Grantee.ID!==i.Owner.ID&&y[s[_.Permission]].push('id="'+_.Grantee.ID+'"')}),b.FULL_CONTROL||b.WRITE&&b.READ?y.ACL="public-read-write":b.READ?y.ACL="public-read":y.ACL="private",r.each(s,function(_){y[_]=I(y[_].join(","))}),y}function I(i){var y=i.split(","),s={},p,R;for(p=0;p<y.length;)R=y[p].trim(),s[R]?y.splice(p,1):(s[R]=!0,y[p]=R,p++);return y.join(",")}function q(i){var y=i.region||"",s=i.bucket||"",p=s.substr(0,s.lastIndexOf("-")),R=s.substr(s.lastIndexOf("-")+1),b=i.domain,_=i.object;typeof b=="function"&&(b=b({Bucket:s,Region:y})),["http","https"].includes(i.protocol)&&(i.protocol=i.protocol+":");var j=i.protocol||(r.isBrowser&&(typeof location=="undefined"?"undefined":n(location))==="object"&&location.protocol==="http:"?"http:":"https:");b||(["cn-south","cn-south-2","cn-north","cn-east","cn-southwest","sg"].indexOf(y)>-1?b="{Region}.myqcloud.com":b="cos.{Region}.myqcloud.com",i.ForcePathStyle||(b="{Bucket}."+b)),b=b.replace(/\{\{AppId\}\}/gi,R).replace(/\{\{Bucket\}\}/gi,p).replace(/\{\{Region\}\}/gi,y).replace(/\{\{.*?\}\}/gi,""),b=b.replace(/\{AppId\}/gi,R).replace(/\{BucketName\}/gi,p).replace(/\{Bucket\}/gi,s).replace(/\{Region\}/gi,y).replace(/\{.*?\}/gi,""),/^[a-zA-Z]+:\/\//.test(b)||(b=j+"//"+b),b.slice(-1)==="/"&&(b=b.slice(0,-1));var te=b;return i.ForcePathStyle&&(te+="/"+s),te+="/",_&&(te+=r.camSafeUrlEncode(_).replace(/%2F/g,"/")),i.isLocation&&(te=te.replace(/^https?:\/\//,"")),te}var fe=function(y){if(!y.Bucket||!y.Region)return"";var s=y.UseAccelerate===void 0?this.options.UseAccelerate:y.UseAccelerate,p=y.Url||q({ForcePathStyle:this.options.ForcePathStyle,protocol:this.options.Protocol,domain:this.options.Domain,bucket:y.Bucket,region:s?"accelerate":y.Region}),R=p.replace(/^https?:\/\/([^/]+)(\/.*)?$/,"$1"),b=new RegExp("^([a-z\\d-]+-\\d+\\.)?(cos|cosv6|ci|pic)\\.([a-z\\d-]+)\\.myqcloud\\.com$");return b.test(R)?R:""};function Re(i,y){var s=r.clone(i.Headers),p="";r.each(s,function(Ie,Ne){(Ie===""||["content-type","cache-control","expires"].indexOf(Ne.toLowerCase())>-1)&&delete s[Ne],Ne.toLowerCase()==="host"&&(p=Ie)});var R=i.ForceSignHost!==!1;!p&&i.SignHost&&R&&(s.Host=i.SignHost);var b=!1,_=function(Ne,je){b||(b=!0,je&&je.XCosSecurityToken&&!je.SecurityToken&&(je=r.clone(je),je.SecurityToken=je.XCosSecurityToken,delete je.XCosSecurityToken),y&&y(Ne,je))},j=this,te=i.Bucket||"",ke=i.Region||"",Te=i.Key||"";j.options.ForcePathStyle&&te&&(Te=te+"/"+Te);var Se="/"+Te,Ae={},Fe=i.Scope;if(!Fe){var Je=i.Action||"",st=i.ResourceKey||i.Key||"";Fe=i.Scope||[{action:Je,bucket:te,region:ke,prefix:st}]}var ot=r.md5(JSON.stringify(Fe));j._StsCache=j._StsCache||[],function(){var Ie,Ne;for(Ie=j._StsCache.length-1;Ie>=0;Ie--){Ne=j._StsCache[Ie];var je=Math.round(r.getSkewTime(j.options.SystemClockOffset)/1e3)+30;if(Ne.StartTime&&je<Ne.StartTime||je>=Ne.ExpiredTime){j._StsCache.splice(Ie,1);continue}if(!Ne.ScopeLimit||Ne.ScopeLimit&&Ne.ScopeKey===ot){Ae=Ne;break}}}();var Ze=function(){var Ne="";Ae.StartTime&&i.Expires?Ne=Ae.StartTime+";"+(Ae.StartTime+i.Expires*1):Ae.StartTime&&Ae.ExpiredTime&&(Ne=Ae.StartTime+";"+Ae.ExpiredTime);var je=r.getAuth({SecretId:Ae.TmpSecretId,SecretKey:Ae.TmpSecretKey,Method:i.Method,Pathname:Se,Query:i.Query,Headers:s,Expires:i.Expires,UseRawKey:j.options.UseRawKey,SystemClockOffset:j.options.SystemClockOffset,KeyTime:Ne,ForceSignHost:R}),ze={Authorization:je,SecurityToken:Ae.SecurityToken||Ae.XCosSecurityToken||"",Token:Ae.Token||"",ClientIP:Ae.ClientIP||"",ClientUA:Ae.ClientUA||""};_(null,ze)},at=function(Ne){if(Ne.Authorization){var je=!1,ze=Ne.Authorization;if(ze)if(ze.indexOf(" ")>-1)je=!1;else if(ze.indexOf("q-sign-algorithm=")>-1&&ze.indexOf("q-ak=")>-1&&ze.indexOf("q-sign-time=")>-1&&ze.indexOf("q-key-time=")>-1&&ze.indexOf("q-url-param-list=")>-1)je=!0;else try{ze=atob(ze),ze.indexOf("a=")>-1&&ze.indexOf("k=")>-1&&ze.indexOf("t=")>-1&&ze.indexOf("r=")>-1&&ze.indexOf("b=")>-1&&(je=!0)}catch(tt){}if(!je)return r.error(new Error("getAuthorization callback params format error"))}else{if(!Ne.TmpSecretId)return r.error(new Error('getAuthorization callback params missing "TmpSecretId"'));if(!Ne.TmpSecretKey)return r.error(new Error('getAuthorization callback params missing "TmpSecretKey"'));if(!Ne.SecurityToken&&!Ne.XCosSecurityToken)return r.error(new Error('getAuthorization callback params missing "SecurityToken"'));if(!Ne.ExpiredTime)return r.error(new Error('getAuthorization callback params missing "ExpiredTime"'));if(Ne.ExpiredTime&&Ne.ExpiredTime.toString().length!==10)return r.error(new Error('getAuthorization callback params "ExpiredTime" should be 10 digits'));if(Ne.StartTime&&Ne.StartTime.toString().length!==10)return r.error(new Error('getAuthorization callback params "StartTime" should be 10 StartTime'))}return!1};if(Ae.ExpiredTime&&Ae.ExpiredTime-r.getSkewTime(j.options.SystemClockOffset)/1e3>60)Ze();else if(j.options.getAuthorization)j.options.getAuthorization.call(j,{Bucket:te,Region:ke,Method:i.Method,Key:Te,Pathname:Se,Query:i.Query,Headers:s,Scope:Fe,SystemClockOffset:j.options.SystemClockOffset,ForceSignHost:R},function(Ie){typeof Ie=="string"&&(Ie={Authorization:Ie});var Ne=at(Ie);if(Ne)return _(Ne);Ie.Authorization?_(null,Ie):(Ae=Ie||{},Ae.Scope=Fe,Ae.ScopeKey=ot,j._StsCache.push(Ae),Ze())});else if(j.options.getSTS)j.options.getSTS.call(j,{Bucket:te,Region:ke},function(Ie){Ae=Ie||{},Ae.Scope=Fe,Ae.ScopeKey=ot,Ae.TmpSecretId||(Ae.TmpSecretId=Ae.SecretId),Ae.TmpSecretKey||(Ae.TmpSecretKey=Ae.SecretKey);var Ne=at(Ae);if(Ne)return _(Ne);j._StsCache.push(Ae),Ze()});else return function(){var Ie=r.getAuth({SecretId:i.SecretId||j.options.SecretId,SecretKey:i.SecretKey||j.options.SecretKey,Method:i.Method,Pathname:Se,Query:i.Query,Headers:s,Expires:i.Expires,UseRawKey:j.options.UseRawKey,SystemClockOffset:j.options.SystemClockOffset,ForceSignHost:R}),Ne={Authorization:Ie,SecurityToken:j.options.SecurityToken||j.options.XCosSecurityToken};return _(null,Ne),Ne}();return""}function Me(i){var y=!1,s=!1,p=i.headers&&(i.headers.date||i.headers.Date)||i.error&&i.error.ServerTime;try{var R=i.error.Code,b=i.error.Message;(R==="RequestTimeTooSkewed"||R==="AccessDenied"&&b==="Request has expired")&&(s=!0)}catch(j){}if(i)if(s&&p){var _=Date.parse(p);this.options.CorrectClockSkew&&Math.abs(r.getSkewTime(this.options.SystemClockOffset)-_)>=3e4&&(console.error("error: Local time is too skewed."),this.options.SystemClockOffset=_-Date.now(),y=!0)}else Math.floor(i.statusCode/100)===5&&(y=!0);return y}function le(i,y){var s=this;!i.headers&&(i.headers={}),!i.qs&&(i.qs={}),i.VersionId&&(i.qs.versionId=i.VersionId),i.qs=r.clearKey(i.qs),i.headers&&(i.headers=r.clearKey(i.headers)),i.qs&&(i.qs=r.clearKey(i.qs));var p=r.clone(i.qs);i.action&&(p[i.action]="");var R=i.url||i.Url,b=i.SignHost||fe.call(this,{Bucket:i.Bucket,Region:i.Region,Url:R}),_=i.tracker,j=function te(ke){var Te=s.options.SystemClockOffset;_&&_.setParams({signStartTime:new Date().getTime(),retryTimes:ke-1}),Re.call(s,{Bucket:i.Bucket||"",Region:i.Region||"",Method:i.method,Key:i.Key,Query:p,Headers:i.headers,SignHost:b,Action:i.Action,ResourceKey:i.ResourceKey,Scope:i.Scope,ForceSignHost:s.options.ForceSignHost},function(Se,Ae){if(Se){y(Se);return}_&&_.setParams({signEndTime:new Date().getTime(),httpStartTime:new Date().getTime()}),i.AuthData=Ae,Ye.call(s,i,function(Fe,Je){_&&_.setParams({httpEndTime:new Date().getTime()}),Fe&&ke<2&&(Te!==s.options.SystemClockOffset||Me.call(s,Fe))?(i.headers&&(delete i.headers.Authorization,delete i.headers.token,delete i.headers.clientIP,delete i.headers.clientUA,i.headers["x-cos-security-token"]&&delete i.headers["x-cos-security-token"],i.headers["x-ci-security-token"]&&delete i.headers["x-ci-security-token"]),te(ke+1)):y(Fe,Je)})})};j(1)}function Ye(i,y){var s=this,p=i.TaskId;if(!(p&&!s._isRunningTask(p))){var R=i.Bucket,b=i.Region,_=i.Key,j=i.method||"GET",te=i.Url||i.url,ke=i.body,Te=i.rawBody;s.options.UseAccelerate&&(b="accelerate"),te=te||q({ForcePathStyle:s.options.ForcePathStyle,protocol:s.options.Protocol,domain:s.options.Domain,bucket:R,region:b,object:_}),i.action&&(te=te+"?"+(r.isIOS_QQ?"".concat(i.action,"="):i.action)),i.qsStr&&(te.indexOf("?")>-1?te=te+"&"+i.qsStr:te=te+"?"+i.qsStr);var Se={method:j,url:te,headers:i.headers,qs:i.qs,body:ke},Ae="x-cos-security-token";if(r.isCIHost(te)&&(Ae="x-ci-security-token"),Se.headers.Authorization=i.AuthData.Authorization,i.AuthData.Token&&(Se.headers.token=i.AuthData.Token),i.AuthData.ClientIP&&(Se.headers.clientIP=i.AuthData.ClientIP),i.AuthData.ClientUA&&(Se.headers.clientUA=i.AuthData.ClientUA),i.AuthData.SecurityToken&&(Se.headers[Ae]=i.AuthData.SecurityToken),Se.headers&&(Se.headers=r.clearKey(Se.headers)),Se=r.clearKey(Se),i.onProgress&&typeof i.onProgress=="function"){var Fe=ke&&(ke.size||ke.length)||0;Se.onProgress=function(Ie){if(!(p&&!s._isRunningTask(p))){var Ne=Ie?Ie.loaded:0;i.onProgress({loaded:Ne,total:Fe})}}}i.onDownloadProgress&&(Se.onDownloadProgress=i.onDownloadProgress),i.DataType&&(Se.dataType=i.DataType),this.options.Timeout&&(Se.timeout=this.options.Timeout),s.options.ForcePathStyle&&(Se.pathStyle=s.options.ForcePathStyle),s.emit("before-send",Se);var Je=Se.url.includes("accelerate."),st=Se.qs?Object.keys(Se.qs).map(function(Ie){return"".concat(Ie,"=").concat(Se.qs[Ie])}).join("&"):"",ot=st?Se.url+"?"+st:Se.url;i.tracker&&i.tracker.setParams({reqUrl:ot,accelerate:Je?"Y":"N"}),i.tracker&&i.tracker.parent&&i.tracker.parent.setParams({reqUrl:ot,accelerate:Je?"Y":"N"});var Ze=(s.options.Request||l)(Se,function(Ie){if(!(Ie&&Ie.error==="abort")){var Ne={options:Se,error:Ie&&Ie.error,statusCode:Ie&&Ie.statusCode||0,statusMessage:Ie&&Ie.statusMessage||"",headers:Ie&&Ie.headers||{},body:Ie&&Ie.body};s.emit("after-receive",Ne);var je=Ne.error,ze=Ne.body,tt={statusCode:Ne.statusCode,statusMessage:Ne.statusMessage,headers:Ne.headers},gt,ut=function(ft,pt){if(p&&s.off("inner-kill-task",at),!gt){gt=!0;var ht={};tt&&tt.statusCode&&(ht.statusCode=tt.statusCode),tt&&tt.headers&&(ht.headers=tt.headers),ft?(ft=r.extend(ft||{},ht),y(ft,null)):(pt=r.extend(pt||{},ht),y(null,pt)),Ze=null}};if(je)return ut(r.error(je));var lt=tt.statusCode,vt=Math.floor(lt/100)===2;if(Te&&vt)return ut(null,{body:ze});var ct;try{ct=ze&&ze.indexOf("<")>-1&&ze.indexOf(">")>-1&&r.xml2json(ze)||{}}catch(Et){ct={}}var dt=ct&&ct.Error;vt?ut(null,ct):dt?ut(r.error(new Error(dt.Message),{code:dt.Code,error:dt})):lt?ut(r.error(new Error(tt.statusMessage),{code:""+lt})):lt&&ut(r.error(new Error("statusCode error")))}}),at=function Ie(Ne){Ne.TaskId===p&&(Ze&&Ze.abort&&Ze.abort(),s.off("inner-kill-task",Ie))};p&&s.on("inner-kill-task",at)}}var Qe={getService:u,putBucket:S,headBucket:w,getBucket:x,deleteBucket:C,putBucketAcl:T,getBucketAcl:N,putBucketCors:K,getBucketCors:P,deleteBucketCors:H,getBucketLocation:Y,getBucketPolicy:ie,putBucketPolicy:W,deleteBucketPolicy:B,putBucketTagging:A,getBucketTagging:E,deleteBucketTagging:O,putBucketLifecycle:g,getBucketLifecycle:M,deleteBucketLifecycle:z,putBucketVersioning:L,getBucketVersioning:F,putBucketReplication:k,getBucketReplication:V,deleteBucketReplication:X,putBucketWebsite:G,getBucketWebsite:$,deleteBucketWebsite:re,putBucketReferer:ue,getBucketReferer:oe,putBucketDomain:ee,getBucketDomain:ce,deleteBucketDomain:ae,putBucketOrigin:pe,getBucketOrigin:Z,deleteBucketOrigin:ne,putBucketLogging:ge,getBucketLogging:me,putBucketInventory:ye,postBucketInventory:Ce,getBucketInventory:Ee,listBucketInventory:be,deleteBucketInventory:Oe,putBucketAccelerate:we,getBucketAccelerate:De,putBucketEncryption:He,getBucketEncryption:Pe,deleteBucketEncryption:se,getObject:a,headObject:h,listObjectVersions:c,putObject:d,deleteObject:m,getObjectAcl:D,putObjectAcl:U,optionsObject:Q,putObjectCopy:de,deleteMultipleObject:J,restoreObject:xe,putObjectTagging:Be,getObjectTagging:Ue,deleteObjectTagging:_e,selectObjectContent:Le,appendObject:et,uploadPartCopy:he,multipartInit:Ve,multipartUpload:qe,multipartComplete:Ge,multipartList:Ke,multipartListPart:We,multipartAbort:Xe,request:it,getObjectUrl:f,getAuth:rt};function $e(i,y,s){r.each(["Cors","Acl"],function(p){if(i.slice(-p.length)===p){var R=i.slice(0,-p.length)+p.toUpperCase(),b=r.apiWrapper(i,y),_=!1;s[R]=function(){!_&&console.warn("warning: cos."+R+" has been deprecated. Please Use cos."+i+" instead."),_=!0,b.apply(this,arguments)}}})}o.exports.init=function(i,y){y.transferToTaskMethod(Qe,"putObject"),r.each(Qe,function(s,p){i.prototype[p]=r.apiWrapper(p,s),$e(p,s,i.prototype)})}},"./src/cos.js":function(o,t,e){var n=e("./src/util.js"),l=e("./src/event.js"),r=e("./src/task.js"),u=e("./src/base.js"),S=e("./src/advance.js"),w=e("./package.json"),x={AppId:"",SecretId:"",SecretKey:"",SecurityToken:"",ChunkRetryTimes:2,FileParallelLimit:3,ChunkParallelLimit:3,ChunkSize:1024*1024,SliceSize:1024*1024,CopyChunkParallelLimit:20,CopyChunkSize:1024*1024*10,CopySliceSize:1024*1024*10,MaxPartNumber:1e4,ProgressInterval:1e3,Domain:"",ServiceDomain:"",Protocol:"",CompatibilityMode:!1,ForcePathStyle:!1,UseRawKey:!1,Timeout:0,CorrectClockSkew:!0,SystemClockOffset:0,UploadCheckContentMd5:!1,UploadQueueSize:1e4,UploadAddMetaMd5:!1,UploadIdCacheLimit:50,UseAccelerate:!1,ForceSignHost:!0,EnableTracker:!1,DeepTracker:!1,TrackerDelay:5e3,CustomId:""},C=function(N){this.options=n.extend(n.clone(x),N||{}),this.options.FileParallelLimit=Math.max(1,this.options.FileParallelLimit),this.options.ChunkParallelLimit=Math.max(1,this.options.ChunkParallelLimit),this.options.ChunkRetryTimes=Math.max(0,this.options.ChunkRetryTimes),this.options.ChunkSize=Math.max(1024*1024,this.options.ChunkSize),this.options.CopyChunkParallelLimit=Math.max(1,this.options.CopyChunkParallelLimit),this.options.CopyChunkSize=Math.max(1024*1024,this.options.CopyChunkSize),this.options.CopySliceSize=Math.max(0,this.options.CopySliceSize),this.options.MaxPartNumber=Math.max(1024,Math.min(1e4,this.options.MaxPartNumber)),this.options.Timeout=Math.max(0,this.options.Timeout),this.options.AppId&&console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").'),this.options.SecretId&&this.options.SecretId.indexOf(" ")>-1&&(console.error("error: SecretId\u683C\u5F0F\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5"),console.error("error: SecretId format is incorrect. Please check")),this.options.SecretKey&&this.options.SecretKey.indexOf(" ")>-1&&(console.error("error: SecretKey\u683C\u5F0F\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5"),console.error("error: SecretKey format is incorrect. Please check")),n.isNode()&&(console.warn("warning: cos-js-sdk-v5 \u4E0D\u652F\u6301 nodejs \u73AF\u5883\u4F7F\u7528\uFF0C\u8BF7\u6539\u7528 cos-nodejs-sdk-v5\uFF0C\u53C2\u8003\u6587\u6863\uFF1A https://cloud.tencent.com/document/product/436/8629"),console.warn("warning: cos-js-sdk-v5 does not support nodejs environment. Please use cos-nodejs-sdk-v5 instead. See: https://cloud.tencent.com/document/product/436/8629")),l.init(this),r.init(this)};u.init(C,r),S.init(C,r),C.util={md5:n.md5,xml2json:n.xml2json,json2xml:n.json2xml,encodeBase64:n.encodeBase64},C.getAuthorization=n.getAuth,C.version=w.version,o.exports=C},"./src/event.js":function(o,t){var e=function(r){var u={},S=function(x){return!u[x]&&(u[x]=[]),u[x]};r.on=function(w,x){w==="task-list-update"&&console.warn('warning: Event "'+w+'" has been deprecated. Please use "list-update" instead.'),S(w).push(x)},r.off=function(w,x){for(var C=S(w),T=C.length-1;T>=0;T--)x===C[T]&&C.splice(T,1)},r.emit=function(w,x){for(var C=S(w).map(function(N){return N}),T=0;T<C.length;T++)C[T](x)}},n=function(){e(this)};o.exports.init=e,o.exports.EventProxy=n},"./src/session.js":function(o,t,e){var n=e("./src/util.js"),l="cos_sdk_upload_cache",r=30*24*3600,u,S,w=function(){try{var P=JSON.parse(localStorage.getItem(l))}catch(H){}P||(P=[]),u=P},x=function(){try{u.length?localStorage.setItem(l,JSON.stringify(u)):localStorage.removeItem(l)}catch(P){}},C=function(){if(!u){w.call(this);for(var P=!1,H=Math.round(Date.now()/1e3),Y=u.length-1;Y>=0;Y--){var W=u[Y][2];(!W||W+r<H)&&(u.splice(Y,1),P=!0)}P&&x()}},T=function(){S||(S=setTimeout(function(){x(),S=null},400))},N={using:{},setUsing:function(P){N.using[P]=!0},removeUsing:function(P){delete N.using[P]},getFileId:function(P,H,Y,W){return P.name&&P.size&&P.lastModifiedDate&&H?n.md5([P.name,P.size,P.lastModifiedDate,H,Y,W].join("::")):null},getCopyFileId:function(P,H,Y,W,ie){var B=H["content-length"],A=H.etag||"",E=H["last-modified"];return P&&Y?n.md5([P,B,A,E,Y,W,ie].join("::")):null},getUploadIdList:function(P){if(!P)return null;C.call(this);for(var H=[],Y=0;Y<u.length;Y++)u[Y][0]===P&&H.push(u[Y][1]);return H.length?H:null},saveUploadId:function(P,H,Y){if(C.call(this),!!P){for(var W=u.length-1;W>=0;W--){var ie=u[W];ie[0]===P&&ie[1]===H&&u.splice(W,1)}u.unshift([P,H,Math.round(Date.now()/1e3)]),u.length>Y&&u.splice(Y),T()}},removeUploadId:function(P){C.call(this),delete N.using[P];for(var H=u.length-1;H>=0;H--)u[H][1]===P&&u.splice(H,1);T()}};o.exports=N},"./src/task.js":function(o,t,e){var n=e("./src/session.js"),l=e("./src/util.js"),r={},u=function(x,C){r[C]=x[C],x[C]=function(T,N){T.SkipTask?r[C].call(this,T,N):this._addTask(C,T,N)}},S=function(x){var C=[],T={},N=0,K=0,P=function(E){var O={id:E.id,Bucket:E.Bucket,Region:E.Region,Key:E.Key,FilePath:E.FilePath,state:E.state,loaded:E.loaded,size:E.size,speed:E.speed,percent:E.percent,hashPercent:E.hashPercent,error:E.error};return E.FilePath&&(O.FilePath=E.FilePath),E._custom&&(O._custom=E._custom),O},H=function(){var A,E=function(){A=0,x.emit("task-list-update",{list:l.map(C,P)}),x.emit("list-update",{list:l.map(C,P)})};return function(){A||(A=setTimeout(E))}}(),Y=function(){if(!(C.length<=x.options.UploadQueueSize)){for(var E=0;E<K&&E<C.length&&C.length>x.options.UploadQueueSize;){var O=C[E].state==="waiting"||C[E].state==="checking"||C[E].state==="uploading";!C[E]||!O?(T[C[E].id]&&delete T[C[E].id],C.splice(E,1),K--):E++}H()}},W=function A(){if(!(N>=x.options.FileParallelLimit)){for(;C[K]&&C[K].state!=="waiting";)K++;if(!(K>=C.length)){var E=C[K];K++,N++,E.state="checking",E.params.onTaskStart&&E.params.onTaskStart(P(E)),!E.params.UploadData&&(E.params.UploadData={});var O=l.formatParams(E.api,E.params);r[E.api].call(x,O,function(g,M){!x._isRunningTask(E.id)||((E.state==="checking"||E.state==="uploading")&&(E.state=g?"error":"success",g&&(E.error=g),N--,H(),A(),E.callback&&E.callback(g,M),E.state==="success"&&(E.params&&(delete E.params.UploadData,delete E.params.Body,delete E.params),delete E.callback)),Y())}),H(),setTimeout(A)}}},ie=function(E,O){var g=T[E];if(!!g){var M=g&&g.state==="waiting",z=g&&(g.state==="checking"||g.state==="uploading");if(O==="canceled"&&g.state!=="canceled"||O==="paused"&&M||O==="paused"&&z){if(O==="paused"&&g.params.Body&&typeof g.params.Body.pipe=="function"){console.error("stream not support pause");return}g.state=O,x.emit("inner-kill-task",{TaskId:E,toState:O});try{var L=g&&g.params&&g.params.UploadData.UploadId}catch(F){}O==="canceled"&&L&&n.removeUsing(L),H(),z&&(N--,W()),O==="canceled"&&(g.params&&(delete g.params.UploadData,delete g.params.Body,delete g.params),delete g.callback)}Y()}};x._addTasks=function(A){l.each(A,function(E){x._addTask(E.api,E.params,E.callback,!0)}),H()};var B=!0;x._addTask=function(A,E,O,g){E=l.formatParams(A,E);var M=l.uuid();E.TaskId=M,E.onTaskReady&&E.onTaskReady(M),E.TaskReady&&(E.TaskReady(M),B&&console.warn('warning: Param "TaskReady" has been deprecated. Please use "onTaskReady" instead.'),B=!1);var z={params:E,callback:O,api:A,index:C.length,id:M,Bucket:E.Bucket,Region:E.Region,Key:E.Key,FilePath:E.FilePath||"",state:"waiting",loaded:0,size:0,speed:0,percent:0,hashPercent:0,error:null,_custom:E._custom},L=E.onHashProgress;E.onHashProgress=function(k){!x._isRunningTask(z.id)||(z.hashPercent=k.percent,L&&L(k),H())};var F=E.onProgress;return E.onProgress=function(k){!x._isRunningTask(z.id)||(z.state==="checking"&&(z.state="uploading"),z.loaded=k.loaded,z.speed=k.speed,z.percent=k.percent,F&&F(k),H())},l.getFileSize(A,E,function(k,V){if(k)return O(l.error(k));T[M]=z,C.push(z),z.size=V,!g&&H(),W(),Y()}),M},x._isRunningTask=function(A){var E=T[A];return!!(E&&(E.state==="checking"||E.state==="uploading"))},x.getTaskList=function(){return l.map(C,P)},x.cancelTask=function(A){ie(A,"canceled")},x.pauseTask=function(A){ie(A,"paused")},x.restartTask=function(A){var E=T[A];E&&(E.state==="paused"||E.state==="error")&&(E.state="waiting",H(),K=Math.min(K,E.index),W())},x.isUploadRunning=function(){return N||K<C.length}};o.exports.transferToTaskMethod=u,o.exports.init=S},"./src/tracker.js":function(o,t,e){var n=e("./node_modules/@babel/runtime/helpers/classCallCheck.js"),l=e("./node_modules/@babel/runtime/helpers/createClass.js"),r=e("./node_modules/@babel/runtime/helpers/typeof.js"),u=e("./package.json"),S=null,w=function(A){if(!S){var E=e("./lib/beacon.min.js");S=new E({appkey:"0AND0VEVB24UBGDU",versionCode:u.version,channelID:"js_sdk",openid:"openid",unionid:"unid",strictMode:!1,delay:A,sessionDuration:60*1e3})}return S},x={getUid:function(){var A=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return A()+A()+"-"+A()+"-"+A()+"-"+A()+"-"+A()+A()+A()},getNetType:function(){if((typeof navigator=="undefined"?"undefined":r(navigator))==="object"){var A=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return(A==null?void 0:A.type)||(A==null?void 0:A.effectiveType)||"unknown"}return"unknown"},getOsType:function(){if((typeof navigator=="undefined"?"undefined":r(navigator))!=="object")return"unknown os";var A=navigator.userAgent.toLowerCase(),E=/macintosh|mac os x/i.test(navigator.userAgent);return A.indexOf("win32")>=0||A.indexOf("wow32")>=0?"win32":A.indexOf("win64")>=0||A.indexOf("wow64")>=0?"win64":E?"mac":"unknown os"},isMobile:function(){var A=/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i;return!!((typeof navigator=="undefined"?"undefined":r(navigator))==="object"&&navigator.userAgent.match(A))},isAndroid:function(){var A=/(Android|Adr|Linux)/i;return!!((typeof navigator=="undefined"?"undefined":r(navigator))==="object"&&navigator.userAgent.match(A))},isIOS:function(){var A=/(iPhone|iPod|iPad|iOS)/i;return!!((typeof navigator=="undefined"?"undefined":r(navigator))==="object"&&navigator.userAgent.match(A))},isOtherMobile:function(){return isMobile&&!isAndroid&&!isIOS},getDeviceName:function(){if((typeof navigator=="undefined"?"undefined":r(navigator))!=="object")return"unknown device";var A=navigator.userAgent.toLowerCase();if(A.includes("app/tencent_wemeet"))return"tencent_wemeet";if(A.indexOf("maxthon")>=0){var E=A.match(/maxthon\/([\d.]+)/),O=E&&E[1]||"";return"\u50B2\u6E38\u6D4F\u89C8\u5668 ".concat(O).trim()}if(A.indexOf("qqbrowser")>=0){var g=A.match(/qqbrowser\/([\d.]+)/),M=g&&g[1]||"";return"QQ\u6D4F\u89C8\u5668 ".concat(M).trim()}if(A.indexOf("se 2.x")>=0)return"\u641C\u72D7\u6D4F\u89C8\u5668";if(A.indexOf("wxwork")>=0)return"\u5FAE\u4FE1\u5185\u7F6E\u6D4F\u89C8\u5668";if(A.indexOf("msie")>=0){var z=A.match(/msie ([\d.]+)/),L=z&&z[1]||"";return"IE ".concat(L).trim()}if(A.indexOf("firefox")>=0){var F=A.match(/firefox\/([\d.]+)/),k=F&&F[1]||"";return"Firefox ".concat(k).trim()}if(A.indexOf("chrome")>=0){var V=A.match(/chrome\/([\d.]+)/),X=V&&V[1]||"";return"Chrome ".concat(X).trim()}if(A.indexOf("opera")>=0){var G=A.match(/opera.([\d.]+)/),$=G&&G[1]||"";return"Opera ".concat($).trim()}if(A.indexOf("safari")>=0){var re=A.match(/version\/([\d.]+)/),ue=re&&re[1]||"";return"Safari ".concat(ue).trim()}if(A.indexOf("edge")>=0){var oe=A.match(/edge\/([\d.]+)/),ee=oe&&oe[1]||"";return"edge ".concat(ee).trim()}return A.substr(0,200)}},C={isMobile:x.isMobile(),isBrowser:!x.isMobile(),mobileOsType:x.isAndroid()?"android":x.isIOS?"ios":"other_mobile",pcOsType:x.getOsType()},T={deviceType:C.isMobile?"mobile":C.isBrowser?"browser":"unknown",devicePlatform:C.isMobile?C.mobileOsType:C.pcOsType,deviceName:x.getDeviceName()},N=["multipartInit","multipartUpload","multipartComplete","multipartList","multipartListPart","multipartAbort"],K=["putObject","postObject","appendObject","sliceUploadFile","uploadFile","uploadFiles"].concat(N),P=["getObject"];function H(B){return K.includes(B)?"cos_upload":P.includes(B)?"cos_download":"base_service"}function Y(B){return B.replace(/([A-Z])/g,"_$1").toLowerCase()}function W(B){var A={},E=["tracePlatform","cossdkVersion","region","networkType","host","accelerate","requestPath","size","httpMd5","httpSign","httpFull","name","result","tookTime","errorNode","errorCode","errorMessage","errorRequestId","errorStatusCode","errorServiceName","errorType","traceId","bucket","appid","partNumber","retryTimes","reqUrl","customId","fullError","deviceType","devicePlatform","deviceName"],O=["tracePlatform","cossdkVersion","region","bucket","appid","networkType","host","accelerate","requestPath","partNumber","size","name","result","tookTime","errorRequestId","retryTimes","reqUrl","customId","deviceType","devicePlatform","deviceName"],g=B.result==="Success"?O:E;for(var M in B)if(!!g.includes(M)){var z=Y(M);A[z]=B[M]}return A}var ie=function(){function B(A){n(this,B);var E=A.parent,O=A.traceId,g=A.bucket,M=A.region,z=A.apiName,L=A.fileKey,F=A.fileSize,k=A.accelerate,V=A.customId,X=A.delay,G=A.deepTracker,$=g&&g.substr(g.lastIndexOf("-")+1)||"";this.parent=E,this.deepTracker=G,this.delay=X,this.params={cossdkVersion:u.version,region:M,networkType:"",host:"",accelerate:k?"Y":"N",requestPath:L||"",size:F||-1,httpMd5:0,httpSign:0,httpFull:0,name:z||"",result:"",tookTime:0,errorNode:"",errorCode:"",errorMessage:"",errorRequestId:"",errorStatusCode:0,errorServiceName:"",tracePlatform:"cos-js-sdk-v5",traceId:O||x.getUid(),bucket:g,appid:$,partNumber:0,retryTimes:0,reqUrl:"",customId:V||"",deviceType:T.deviceType,devicePlatform:T.devicePlatform,deviceName:T.deviceName,md5StartTime:0,md5EndTime:0,signStartTime:0,signEndTime:0,httpStartTime:0,httpEndTime:0,startTime:new Date().getTime(),endTime:0},this.beacon=w(X)}return l(B,[{key:"formatResult",value:function(E,O){var g,M,z,L,F,k,V=new Date().getTime(),X=V-this.params.startTime,G=x.getNetType(),$=E?(E==null?void 0:E.code)||(E==null||(g=E.error)===null||g===void 0?void 0:g.code)||(E==null||(M=E.error)===null||M===void 0?void 0:M.Code):"",re=E?(E==null?void 0:E.message)||(E==null||(z=E.error)===null||z===void 0?void 0:z.message)||(E==null||(L=E.error)===null||L===void 0?void 0:L.Message):"",ue=E?(E==null?void 0:E.resource)||(E==null||(F=E.error)===null||F===void 0?void 0:F.resource)||(E==null||(k=E.error)===null||k===void 0?void 0:k.Resource):"",oe=E?E==null?void 0:E.statusCode:O.statusCode,ee=E?(E==null?void 0:E.headers)&&(E==null?void 0:E.headers["x-cos-request-id"]):(O==null?void 0:O.headers)&&(O==null?void 0:O.headers["x-cos-request-id"]),ce=E?ee?"Server":"Client":"";if(Object.assign(this.params,{tookTime:X,networkType:G,httpMd5:this.params.md5EndTime-this.params.md5StartTime,httpSign:this.params.signEndTime-this.params.signStartTime,httpFull:this.params.httpEndTime-this.params.httpStartTime,result:E?"Fail":"Success",errorType:ce,errorCode:$,errorStatusCode:oe,errorMessage:re,errorServiceName:ue,errorRequestId:ee}),E&&(!$||!re)&&(this.params.fullError=E?JSON.stringify(E):""),this.params.name==="getObject"&&(this.params.size=O?O.headers&&O.headers["content-length"]:-1),this.params.reqUrl)try{var ae=/^http(s)?:\/\/(.*?)\//.exec(this.params.reqUrl);this.params.host=ae[2]}catch(pe){this.params.host=this.params.reqUrl}this.sendEvents()}},{key:"setParams",value:function(E){Object.assign(this.params,E)}},{key:"sendEvents",value:function(){if(!(N.includes(this.params.name)&&!this.deepTracker)){var E=H(this.params.name),O=W(this.params);this.beacon||(this.beacon=w(this.delay||5e3)),this.delay===0?this.beacon&&this.beacon.onDirectUserAction(E,O):this.beacon&&this.beacon.onUserAction(E,O)}}},{key:"generateSubTracker",value:function(E){return Object.assign(E,{parent:this,deepTracker:this.deepTracker,traceId:this.params.traceId,bucket:this.params.bucket,region:this.params.region,fileKey:this.params.requestPath,customId:this.params.customId,delay:this.delay}),new B(E)}}]),B}();o.exports=ie},"./src/util.js":function(o,t,e){(function(n){var l=e("./node_modules/@babel/runtime/helpers/typeof.js"),r=e("./lib/md5.js"),u=e("./lib/crypto.js"),S=e("./lib/xml2json.js"),w=e("./lib/json2xml.js"),x=e("./lib/base64.js"),C=e("./src/tracker.js");function T(se){return encodeURIComponent(se).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function N(se,h){var c=[];for(var a in se)se.hasOwnProperty(a)&&c.push(h?T(a).toLowerCase():a);return c.sort(function(d,m){return d=d.toLowerCase(),m=m.toLowerCase(),d===m?0:d>m?1:-1})}var K=function(h,c){var a,d,m,D=[],U=N(h);for(a=0;a<U.length;a++)d=U[a],m=h[d]===void 0||h[d]===null?"":""+h[d],d=c?T(d).toLowerCase():T(d),m=T(m)||"",D.push(d+"="+m);return D.join("&")},P=["cache-control","content-disposition","content-encoding","content-length","content-md5","expect","expires","host","if-match","if-modified-since","if-none-match","if-unmodified-since","origin","range","transfer-encoding"],H=function(h){var c={};for(var a in h){var d=a.toLowerCase();(d.indexOf("x-cos-")>-1||P.indexOf(d)>-1)&&(c[a]=h[a])}return c},Y=function(h){h=h||{};var c=h.SecretId,a=h.SecretKey,d=h.KeyTime,m=(h.method||h.Method||"get").toLowerCase(),D=V(h.Query||h.params||{}),U=H(V(h.Headers||h.headers||{})),Q=h.Key||"",de;h.UseRawKey?de=h.Pathname||h.pathname||"/"+Q:(de=h.Pathname||h.pathname||Q,de.indexOf("/")!==0&&(de="/"+de));var he=h.ForceSignHost!==!1;if(!U.Host&&!U.host&&h.Bucket&&h.Region&&he&&(U.Host=h.Bucket+".cos."+h.Region+".myqcloud.com"),!c)throw new Error("missing param SecretId");if(!a)throw new Error("missing param SecretKey");var J=Math.round(ye(h.SystemClockOffset)/1e3)-1,xe=J,Be=h.Expires||h.expires;Be===void 0?xe+=900:xe+=Be*1||0;var Ue="sha1",_e=c,Le=d||J+";"+xe,Ve=d||J+";"+xe,qe=N(U,!0).join(";").toLowerCase(),Ge=N(D,!0).join(";").toLowerCase(),Ke=u.HmacSHA1(Ve,a).toString(),We=[m,de,Pe.obj2str(D,!0),Pe.obj2str(U,!0),""].join(`
- `),Xe=["sha1",Le,u.SHA1(We).toString(),""].join(`
- `),it=u.HmacSHA1(Xe,Ke).toString(),et=["q-sign-algorithm="+Ue,"q-ak="+_e,"q-sign-time="+Le,"q-key-time="+Ve,"q-header-list="+qe,"q-url-param-list="+Ge,"q-signature="+it].join("&");return et},W=function(h,c,a){var d=c/8,m=h.slice(a,a+d);return new Uint8Array(m).reverse(),new{8:Uint8Array,16:Uint16Array,32:Uint32Array}[c](m)[0]},ie=function(h,c,a,d){var m=h.slice(c,a),D="";return new Uint8Array(m).forEach(function(U){D+=String.fromCharCode(U)}),d&&(D=decodeURIComponent(escape(D))),D},B=function(h){for(var c={},a=ie(h),d={records:[]};h.byteLength;){var m=W(h,32,0),D=W(h,32,4),U=m-D-16,Q=0,de;for(h=h.slice(12);Q<D;){var he=W(h,8,Q),J=ie(h,Q+1,Q+1+he),xe=W(h,16,Q+he+2),Be=ie(h,Q+he+4,Q+he+4+xe);c[J]=Be,Q+=he+4+xe}if(c[":event-type"]==="Records")de=ie(h,Q,Q+U,!0),d.records.push(de);else if(c[":event-type"]==="Stats")de=ie(h,Q,Q+U,!0),d.stats=Pe.xml2json(de).Stats;else if(c[":event-type"]==="error"){var Ue=c[":error-code"],_e=c[":error-message"],Le=new Error(_e);Le.message=_e,Le.name=Le.code=Ue,d.error=Le}h=h.slice(Q+U+4)}return{payload:d.records.join(""),body:a}},A=function(h){var c=this.options.CopySourceParser;if(c)return c(h);var a=h.match(/^([^.]+-\d+)\.cos(v6|-cdc|-cdz|-internal)?\.([^.]+)\.((myqcloud\.com)|(tencentcos\.cn))\/(.+)$/);return a?{Bucket:a[1],Region:a[3],Key:a[7]}:null},E=function(){},O=function(h){var c={};for(var a in h)h.hasOwnProperty(a)&&h[a]!==void 0&&h[a]!==null&&(c[a]=h[a]);return c},g=function(h,c){var a,d=new FileReader;FileReader.prototype.readAsBinaryString?(a=FileReader.prototype.readAsBinaryString,d.onload=function(){c(this.result)}):FileReader.prototype.readAsArrayBuffer?a=function(D){var U="",Q=new FileReader;Q.onload=function(de){for(var he=new Uint8Array(Q.result),J=he.byteLength,xe=0;xe<J;xe++)U+=String.fromCharCode(he[xe]);c(U)},Q.readAsArrayBuffer(D)}:console.error("FileReader not support readAsBinaryString"),a.call(d,h)},M=function(){var se=function(a,d){a=a.split("."),d=d.split(".");for(var m=0;m<d.length;m++)if(a[m]!==d[m])return parseInt(a[m])>parseInt(d[m])?1:-1;return 0},h=function(a){if(!a)return!1;var d=(a.match(/Chrome\/([.\d]+)/)||[])[1],m=(a.match(/QBCore\/([.\d]+)/)||[])[1],D=(a.match(/QQBrowser\/([.\d]+)/)||[])[1],U=d&&se(d,"53.0.2785.116")<0&&m&&se(m,"3.53.991.400")<0&&D&&se(D,"9.0.2524.400")<=0||!1;return U};return h(typeof navigator!="undefined"&&navigator.userAgent)}(),z=function(h,c,a,d,m){var D;if(h.slice?D=h.slice(c,a):h.mozSlice?D=h.mozSlice(c,a):h.webkitSlice&&(D=h.webkitSlice(c,a)),d&&M){var U=new FileReader;U.onload=function(Q){D=null,m(new Blob([U.result]))},U.readAsArrayBuffer(D)}else m(D)},L=function(h,c,a,d){a=a||E,h?typeof c=="string"?a(Pe.md5(c,!0)):Blob&&c instanceof Blob?Pe.getFileMd5(c,function(m,D){a(D)},d):a():a()},F=1024*1024,k=function(h,c,a){var d=h.size,m=0,D=r.getCtx(),U=function Q(de){if(de>=d){var he=D.digest("hex");c(null,he);return}var J=Math.min(d,de+F);Pe.fileSlice(h,de,J,!1,function(xe){g(xe,function(Be){xe=null,D=D.update(Be,!0),m+=Be.length,Be=null,a&&a({loaded:m,total:d,percent:Math.round(m/d*1e4)/1e4}),Q(de+F)})})};U(0)};function V(se){return ee(se,function(h){return l(h)==="object"&&h!==null?V(h):h})}function X(se,h,c){return se&&h in se?se[h]:c}function G(se,h){return oe(h,function(c,a){se[a]=h[a]}),se}function $(se){return se instanceof Array}function re(se,h){for(var c=!1,a=0;a<se.length;a++)if(h===se[a]){c=!0;break}return c}function ue(se){return $(se)?se:[se]}function oe(se,h){for(var c in se)se.hasOwnProperty(c)&&h(se[c],c)}function ee(se,h){var c=$(se)?[]:{};for(var a in se)se.hasOwnProperty(a)&&(c[a]=h(se[a],a));return c}function ce(se,h){var c=$(se),a=c?[]:{};for(var d in se)se.hasOwnProperty(d)&&h(se[d],d)&&(c?a.push(se[d]):a[d]=se[d]);return a}var ae=function(h){var c,a,d,m="";for(c=0,a=h.length/2;c<a;c++)d=parseInt(h[c*2]+h[c*2+1],16),m+=String.fromCharCode(d);return btoa(m)},pe=function(){var h=function(){return((1+Math.random())*65536|0).toString(16).substring(1)};return h()+h()+"-"+h()+"-"+h()+"-"+h()+"-"+h()+h()+h()},Z=function(h,c){var a=c.Bucket,d=c.Region,m=c.Key,D=this.options.Domain,U=!D||typeof D=="string"&&D.indexOf("{Bucket}")>-1,Q=!D||typeof D=="string"&&D.indexOf("{Region}")>-1;if(h.indexOf("Bucket")>-1||h==="deleteMultipleObject"||h==="multipartList"||h==="listObjectVersions"){if(U&&!a)return"Bucket";if(Q&&!d)return"Region"}else if(h.indexOf("Object")>-1||h.indexOf("multipart")>-1||h==="sliceUploadFile"||h==="abortUploadTask"){if(U&&!a)return"Bucket";if(Q&&!d)return"Region";if(!m)return"Key"}return!1},ne=function(h,c){if(c=G({},c),h!=="getAuth"&&h!=="getV4Auth"&&h!=="getObjectUrl"){var a=c.Headers||{};if(c&&l(c)==="object"){(function(){for(var m in c)c.hasOwnProperty(m)&&m.indexOf("x-cos-")>-1&&(a[m]=c[m])})();var d={"x-cos-mfa":"MFA","Content-MD5":"ContentMD5","Content-Length":"ContentLength","Content-Type":"ContentType",Expect:"Expect",Expires:"Expires","Cache-Control":"CacheControl","Content-Disposition":"ContentDisposition","Content-Encoding":"ContentEncoding",Range:"Range","If-Modified-Since":"IfModifiedSince","If-Unmodified-Since":"IfUnmodifiedSince","If-Match":"IfMatch","If-None-Match":"IfNoneMatch","x-cos-copy-source":"CopySource","x-cos-copy-source-Range":"CopySourceRange","x-cos-metadata-directive":"MetadataDirective","x-cos-copy-source-If-Modified-Since":"CopySourceIfModifiedSince","x-cos-copy-source-If-Unmodified-Since":"CopySourceIfUnmodifiedSince","x-cos-copy-source-If-Match":"CopySourceIfMatch","x-cos-copy-source-If-None-Match":"CopySourceIfNoneMatch","x-cos-acl":"ACL","x-cos-grant-read":"GrantRead","x-cos-grant-write":"GrantWrite","x-cos-grant-full-control":"GrantFullControl","x-cos-grant-read-acp":"GrantReadAcp","x-cos-grant-write-acp":"GrantWriteAcp","x-cos-storage-class":"StorageClass","x-cos-traffic-limit":"TrafficLimit","x-cos-mime-limit":"MimeLimit","x-cos-server-side-encryption-customer-algorithm":"SSECustomerAlgorithm","x-cos-server-side-encryption-customer-key":"SSECustomerKey","x-cos-server-side-encryption-customer-key-MD5":"SSECustomerKeyMD5","x-cos-server-side-encryption":"ServerSideEncryption","x-cos-server-side-encryption-cos-kms-key-id":"SSEKMSKeyId","x-cos-server-side-encryption-context":"SSEContext","Pic-Operations":"PicOperations"};Pe.each(d,function(m,D){c[m]!==void 0&&(a[D]=c[m])}),c.Headers=O(a)}}return c},ge=function(h,c){return function(a,d){var m=this;typeof a=="function"&&(d=a,a={}),a=ne(h,a);var D;if(m.options.EnableTracker)if(a.calledBySdk==="sliceUploadFile")D=a.tracker&&a.tracker.generateSubTracker({apiName:h});else if(["uploadFile","uploadFiles"].includes(h))D=null;else{var U=-1;a.Body&&(U=typeof a.Body=="string"?a.Body.length:a.Body.size||a.Body.byteLength||-1),D=new C({bucket:a.Bucket,region:a.Region,apiName:h,fileKey:a.Key,fileSize:U,deepTracker:m.options.DeepTracker,customId:m.options.CustomId,delay:m.options.TrackerDelay})}a.tracker=D;var Q=function(_e){return _e&&_e.headers&&(_e.headers["x-cos-request-id"]&&(_e.RequestId=_e.headers["x-cos-request-id"]),_e.headers["x-ci-request-id"]&&(_e.RequestId=_e.headers["x-ci-request-id"]),_e.headers["x-cos-version-id"]&&(_e.VersionId=_e.headers["x-cos-version-id"]),_e.headers["x-cos-delete-marker"]&&(_e.DeleteMarker=_e.headers["x-cos-delete-marker"])),_e},de=function(_e,Le){D&&D.formatResult(_e,Le),d&&d(Q(_e),Q(Le))},he=function(){if(h!=="getService"&&h!=="abortUploadTask"){var _e=Z.call(m,h,a);if(_e)return"missing param "+_e;if(a.Region){if(m.options.CompatibilityMode){if(!/^([a-z\d-.]+)$/.test(a.Region))return"Region format error."}else{if(a.Region.indexOf("cos.")>-1)return'param Region should not be start with "cos."';if(!/^([a-z\d-]+)$/.test(a.Region))return"Region format error."}!m.options.CompatibilityMode&&a.Region.indexOf("-")===-1&&a.Region!=="yfb"&&a.Region!=="default"&&a.Region!=="accelerate"&&console.warn("warning: param Region format error, find help here: https://cloud.tencent.com/document/product/436/6224")}if(a.Bucket){if(!/^([a-z\d-]+)-(\d+)$/.test(a.Bucket))if(a.AppId)a.Bucket=a.Bucket+"-"+a.AppId;else if(m.options.AppId)a.Bucket=a.Bucket+"-"+m.options.AppId;else return'Bucket should format as "test-1250000000".';a.AppId&&(console.warn('warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g Bucket:"test-1250000000" ).'),delete a.AppId)}!m.options.UseRawKey&&a.Key&&a.Key.substr(0,1)==="/"&&(a.Key=a.Key.substr(1))}},J=he(),xe=["getAuth","getObjectUrl"].includes(h);if(typeof Promise=="function"&&!xe&&!d)return new Promise(function(Ue,_e){if(d=function(Ve,qe){Ve?_e(Ve):Ue(qe)},J)return de(Pe.error(new Error(J)));c.call(m,a,de)});if(J)return de(Pe.error(new Error(J)));var Be=c.call(m,a,de);if(xe)return Be}},me=function(h,c){var a=this,d=0,m=0,D=Date.now(),U,Q;function de(){if(Q=0,c&&typeof c=="function"){U=Date.now();var he=Math.max(0,Math.round((m-d)/((U-D)/1e3)*100)/100)||0,J;m===0&&h===0?J=1:J=Math.floor(m/h*100)/100||0,D=U,d=m;try{c({loaded:m,total:h,speed:he,percent:J})}catch(xe){}}}return function(he,J){if(he&&(m=he.loaded,h=he.total),J)clearTimeout(Q),de();else{if(Q)return;Q=setTimeout(de,a.options.ProgressInterval)}}},ve=function(h,c,a){var d;if(typeof c.Body=="string"?c.Body=new Blob([c.Body],{type:"text/plain"}):c.Body instanceof ArrayBuffer&&(c.Body=new Blob([c.Body])),c.Body&&(c.Body instanceof Blob||c.Body.toString()==="[object File]"||c.Body.toString()==="[object Blob]"))d=c.Body.size;else{a(Pe.error(new Error("params body format error, Only allow File|Blob|String.")));return}c.ContentLength=d,a(null,d)},ye=function(h){return Date.now()+(h||0)},Ce=function(h,c){var a=h;return h.message=h.message||null,typeof c=="string"?(h.error=c,h.message=c):l(c)==="object"&&c!==null&&(G(h,c),(c.code||c.name)&&(h.code=c.code||c.name),c.message&&(h.message=c.message),c.stack&&(h.stack=c.stack)),typeof Object.defineProperty=="function"&&(Object.defineProperty(h,"name",{writable:!0,enumerable:!1}),Object.defineProperty(h,"message",{enumerable:!0})),h.name=c&&c.name||h.name||h.code||"Error",h.code||(h.code=h.name),h.error||(h.error=V(a)),h},Ee=function(){return(typeof globalThis=="undefined"?"undefined":l(globalThis))==="object"&&(globalThis.constructor.name==="DedicatedWorkerGlobalScope"||globalThis.FileReaderSync)},be=function(){return(typeof window=="undefined"?"undefined":l(window))!=="object"&&(typeof n=="undefined"?"undefined":l(n))==="object"&&!0&&!Ee()},Oe=function(h){return/^https?:\/\/([^/]+\.)?ci\.[^/]+/.test(h)},we=function(){if((typeof navigator=="undefined"?"undefined":l(navigator))!=="object")return!1;var se=navigator.userAgent,h=!!se.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);return h}(),De=function(){return(typeof navigator=="undefined"?"undefined":l(navigator))!=="object"?!1:/\sQQ/i.test(navigator.userAgent)}(),He=function(h,c){var a=x.encode(h);return c&&(a=a.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")),a},Pe={noop:E,formatParams:ne,apiWrapper:ge,xml2json:S,json2xml:w,md5:r,clearKey:O,fileSlice:z,getBodyMd5:L,getFileMd5:k,b64:ae,extend:G,isArray:$,isInArray:re,makeArray:ue,each:oe,map:ee,filter:ce,clone:V,attr:X,uuid:pe,camSafeUrlEncode:T,throttleOnProgress:me,getFileSize:ve,getSkewTime:ye,error:Ce,obj2str:K,getAuth:Y,parseSelectPayload:B,getSourceParams:A,isBrowser:!0,isNode:be,isCIHost:Oe,isIOS_QQ:we&&De,encodeBase64:He};o.exports=Pe}).call(this,e("./node_modules/process/browser.js"))}})})})(cosJsSdkV5);const COS=getDefaultExportFromCjs(cosJsSdkV5.exports),ossSwitch="tencent",tencentBucket="daya-online-1303457149",getUploadSign=o=>nt(void 0,null,function*(){const{bucketName:t,filename:e,postData:n}=o,l=ossSwitch;let r=t,u=e,S={};return r=tencentBucket,u="MECMP/"+e,S={key:"MECMP/"+n.key},service.post("/cbs-app/open/getUploadSign?pluginName="+l,{postData:S,pluginName:l,bucketName:r,filename:u})}),onFileUpload=({file:o,action:t,data:e,onProgress:n,onFinish:l,onError:r})=>{new COS({Domain:"https://oss.dayaedu.com",Protocol:"https",getAuthorization:(S,w)=>nt(void 0,null,function*(){w({Authorization:e.signature})})}).uploadFile({Bucket:tencentBucket,Region:"ap-nanjing",Key:`MECMP/${e.name}`,Body:e.file.file,SliceSize:1024*1024*500,onProgress:function(S){n({percent:Math.ceil((S.percent||0)*100)})}}).then(S=>{var w;((w=S.Location)==null?void 0:w.indexOf("http"))>=0?o.url=S.Location:o.url="https://"+S.Location,l()}).catch(S=>{console.log(S,"error"),r()})},onOnlyFileUpload=(o,t)=>nt(void 0,null,function*(){{let e="",n=null;if(yield new COS({Domain:"https://oss.dayaedu.com",getAuthorization:(r,u)=>nt(void 0,null,function*(){u({Authorization:t.signature})})}).uploadFile({Bucket:tencentBucket,Region:"ap-nanjing",Key:`MECMP/${t.name}`,Body:t.file,SliceSize:1024*1024*500}).then(r=>{var u;((u=r.Location)==null?void 0:u.indexOf("http"))>=0?e=r.Location:e="https://"+r.Location}).catch(r=>{n=r}),e)return e;throw new Error(n)}}),UploadFile=defineComponent({name:"upload-file",props:{fileList:{type:String,default:""},imageList:{type:Array,default:()=>[]},accept:{type:String,default:".jpg,.png,.jpeg,.gif"},listType:{type:String,default:"image-card"},showFileList:{type:Boolean,default:!0},desc:{type:String,default:""},text:{type:String,default:"\u4E0A\u4F20\u6587\u4EF6"},size:{type:Number,default:5},max:{type:Number,default:1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},tips:{type:String,default:""},bucketName:{type:String,default:"gyt"},path:{type:String,default:""},fileName:{type:String,default:""},cropper:{type:Boolean,default:!1},options:{type:Object,default:()=>({viewMode:0,autoCrop:!0,enlarge:1,autoCropWidth:200,autoCropHeight:200,fixedBox:!1,previewsCircle:!0,title:"\u4E0A\u4F20\u56FE\u7247"})}},emits:["update:fileList","upload:success","close","readFileInputEventAsArrayBuffer","remove"],setup(o,{slots:t,attrs:e,emit:n,expose:l}){const r=`https://${o.bucketName}.ks3-cn-beijing.ksyuncs.com/`,u=useMessage(),S=ref(!1),w=ref(!1),x=ref(),C=ref(),T=reactive({policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""}),N=ref([]),K=()=>{if(console.log("desc",o.desc),o.fileList){console.log("downloadUrl",o.fileList);const O=o.fileList.split("/");N.value=[{id:new Date().getTime().toString(),name:O[O.length-1],status:"finished",url:o.fileList}]}else if(Array.isArray(o.imageList)){console.log(Array.isArray(o.imageList),o.imageList,"Array.isArray(props.imageList)");let O=[];o.imageList.forEach(g=>{const M=g.split("/");O.push({id:Date.now().toString(),name:M[M.length-1],status:"finished",url:g})}),N.value=O}else N.value=[]};K(),watch(()=>o.imageList,()=>{K()},{deep:!0}),watch(()=>o.fileList,()=>{console.log("list"),K()}),l({handleClearFile:()=>{var O;(O=C.value)==null||O.clear(),console.log("\u6E05\u7A7A",C.value)}});const H=ref(),Y=O=>nt(this,null,function*(){const g=O.file;let M=!0;if(o.size&&(M=g.file.size/1024/1024<o.size,!M))return u.error(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7${o.size}M`),!1;if(!M)return M;if(o.cropper)return W(g.file,z=>{const L=Object.assign({},o.options,{img:z,name:g.file.name});S.value=!0,setTimeout(()=>{var F;(F=H.value)==null||F.edit(L),console.log(H.value,"cropper")},100)}),!1;try{w.value=!0,console.log(o.path,g.file);const z=g.file.name,L=z.slice(z.lastIndexOf(".")),F=`${o.path}${o.fileName||Date.now()+L}`,k={filename:F,bucketName:o.bucketName,postData:{filename:F,acl:"public-read",key:F,unknowValueField:[]}},{data:V}=yield getUploadSign(k);T.policy=V.policy,T.signature=V.signature,T.key=F,T.KSSAccessKeyId=V.kssAccessKeyId,T.name=F,x.value=g.file}catch(z){return w.value=!1,!1}return!0}),W=(O,g)=>nt(this,null,function*(){const M=new FileReader;M.addEventListener("load",()=>g(M.result)),M.readAsDataURL(O)}),ie=({file:O,action:g,onFinish:M,onError:z,onProgress:L})=>{const F=T;F.file=O,onFileUpload({file:O,action:g,data:F,onProgress:L,onFinish:M,onError:z})},B=O=>{n("update:fileList",O.file.url),n("upload:success",{url:O.file.url,name:O.file.name}),n("readFileInputEventAsArrayBuffer",x.value),S.value=!1,w.value=!1},A=O=>nt(this,null,function*(){console.log("\u{1F680} ~ options",O),n("update:fileList",""),n("upload:success",{}),n("remove"),w.value=!1}),E=O=>nt(this,null,function*(){try{const g=`${o.path}${o.fileName||new Date().getTime()+".png"}`,M={filename:g,bucketName:o.bucketName,postData:{filename:g,acl:"public-read",key:g,unknowValueField:[]}},{data:z}=yield getUploadSign(M);T.policy=z.policy,T.signature=z.signature,T.key=g,T.KSSAccessKeyId=z.kssAccessKeyId,T.name=g;const L=St(Ct({},T),{file:O});yield onOnlyFileUpload(r,L).then(F=>{const k=F.split("/");N.value=[{id:new Date().getTime().toString(),name:k[k.length-1],status:"finished",url:F}],n("update:fileList",F),S.value=!1})}catch(g){return!1}});return()=>createVNode("div",null,[createVNode(NUpload,{ref:C,action:r,customRequest:ie,data:T,fileList:N.value,"onUpdate:fileList":O=>N.value=O,listType:o.listType,accept:o.accept,multiple:o.multiple,max:o.max,disabled:o.disabled,showFileList:o.showFileList,showPreviewButton:!0,onBeforeUpload:O=>Y(O),onFinish:O=>B(O),onRemove:O=>A(O)},{default:()=>[o.listType==="image"&&createVNode(__unplugin_components_3,{loading:w.value,type:"primary"},{default:()=>[o.text]})]}),o.tips&&createVNode("p",{style:"font-size: 13px; color: #666; padding-top: 4px;"},[o.tips]),createVNode(NModal,{show:S.value,"onUpdate:show":O=>S.value=O,preset:"dialog",showIcon:!1,title:"\u4E0A\u4F20\u56FE\u7247",style:{width:"800px"}},{default:()=>[createVNode(Copper,{ref:H,onClose:()=>S.value=!1,onCropperOk:E},null)]})])}});export{UploadFile as U,getUploadSign as g,onOnlyFileUpload as o};
|