Files
aiot-platform-ui/apps/web-antd/dist/js/index.esm-j49SPltB.js

21 lines
29 KiB
JavaScript
Raw Normal View History

function X(r,t){t===void 0&&(t={});var e=t.insertAt;if(typeof document!="undefined"){var i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",e==="top"&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=r:a.appendChild(document.createTextNode(r))}}var Y="@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:100% 0}75%{background-position:0 100%}to{background-position:0 0}}@keyframes watermark-horizontal{0%{background-position-x:0}to{background-position-x:100%}}@keyframes watermark-vertical{0%{background-position-y:0}to{background-position-y:100%}}";X(Y);var W=function(r,t){return W=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])},W(r,t)};function q(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");W(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var _=function(){return _=Object.assign||function(t){for(var e,i=1,a=arguments.length;i<a;i++){e=arguments[i];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},_.apply(this,arguments)};function S(r,t,e,i){function a(n){return n instanceof e?n:new e(function(o){o(n)})}return new(e||(e=Promise))(function(n,o){function l(c){try{d(i.next(c))}catch(h){o(h)}}function s(c){try{d(i.throw(c))}catch(h){o(h)}}function d(c){c.done?n(c.value):a(c.value).then(l,s)}d((i=i.apply(r,t||[])).next())})}function b(r,t){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,a,n,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(d){return function(c){return s([d,c])}}function s(d){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(e=0)),e;)try{if(i=1,a&&(n=d[0]&2?a.return:d[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,d[1])).done)return n;switch(a=0,n&&(d=[d[0]&2,n.value]),d[0]){case 0:case 1:n=d;break;case 4:return e.label++,{value:d[1],done:!1};case 5:e.label++,a=d[1],d=[0];continue;case 7:d=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(d[0]===6||d[0]===2)){e=0;continue}if(d[0]===3&&(!n||d[1]>n[0]&&d[1]<n[3])){e.label=d[1];break}if(d[0]===6&&e.label<n[1]){e.label=n[1],n=d;break}if(n&&e.label<n[2]){e.label=n[2],e.ops.push(d);break}n[2]&&e.ops.pop(),e.trys.pop();continue}d=t.call(r,e)}catch(c){d=[6,c],a=0}finally{i=n=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}var V=function(r){return r.toDataURL("image/png",1)},N=function(r){return typeof r=="function"},x=function(r){return r===void 0},F=function(r){return typeof r=="string"},z=function(r,t,e){t===void 0&&(t={}),e===void 0&&(e="http://www.w3.org/2000/svg");var i=document.createElementNS(e,r);for(var a in t)i.setAttribute(a,t[a]);return i},K=function(r,t,e){for(var i=[],a="",n="",o=0,l=t.length;o<l;o++){if(n=t.charAt(o),n===`
`){i.push(a),a="";continue}a+=n,r.measureText(a).width>e&&(i.push(a.substring(0,a.length-1)),a="",o--)}return i.push(a),i},U=function(r,t){return S(void 0,void 0,void 0,function(){var e,i,a,n,o,l,s,d,c;return b(this,function(h){switch(h.label){case 0:return e=z("svg",{xmlns:"http://www.w3.org/2000/svg"}),i=document.createElement("div"),i.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),i.style.cssText=`
text-align: center;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
font: `.concat(r.font,`;
color: `).concat(t.fontColor,`;
`),i.innerHTML="<div class='rich-text-content'>".concat(t.content,"</div>"),document.body.appendChild(i),[4,$(i)];case 1:return h.sent(),a=(c=i.querySelector(".rich-text-content"))===null||c===void 0?void 0:c.getBoundingClientRect(),n=a==null?void 0:a.width,o=a==null?void 0:a.height,document.body.removeChild(i),l=t.richTextWidth||n||t.width,s=t.richTextHeight||o||t.height,e.setAttribute("width",l.toString()),e.setAttribute("height",s.toString()),d=z("foreignObject",{width:l.toString(),height:s.toString()}),d.appendChild(i),e.appendChild(d),[2,{element:e,width:l,height:s}]}})})};function $(r){return S(this,void 0,void 0,function(){var t,e,i,a,n;return b(this,function(o){switch(o.label){case 0:t=r.querySelectorAll("img"),e=function(l){var s,d,c,h,u;return b(this,function(v){switch(v.label){case 0:if(s=l.getAttribute("src"),!s)return[3,6];v.label=1;case 1:return v.trys.push([1,5,,6]),[4,fetch(s)];case 2:return d=v.sent(),[4,d.blob()];case 3:return c=v.sent(),[4,new Promise(function(m,p){var f=new FileReader;f.onloadend=function(){return m(f.result)},f.onerror=p,f.readAsDataURL(c)})];case 4:return h=v.sent(),F(h)&&l.setAttribute("src",h),[3,6];case 5:return u=v.sent(),console.error("Error converting ".concat(s," to base64:"),u),[3,6];case 6:return[2]}})},i=0,a=Array.from(t),o.label=1;case 1:return i<a.length?(n=a[i],[5,e(n)]):[3,4];case 2:o.sent(),o.label=3;case 3:return i++,[3,1];case 4:return[2]}})})}var J=function(r){var t=r.outerHTML.replace(/<(img|br|input|hr|embed)(.*?)>/g,"<$1$2/>").replace(/\n/g,"").replace(/\t/g,"").replace(/#/g,"%23");return"data:image/svg+xml;charset=utf-8,".concat(t)},y=function(r,t){return x(r)?t:r},B=function(r,t,e){t===void 0&&(t=void 0),e===void 0&&(e=void 0);var i=new Image;return i.setAttribute("crossOrigin","anonymous"),!x(t)&&(i.width=t),!x(e)&&(i.height=e),i.src=r,new Promise(function(a){i.onload=function(){a(i)}})},Q=function(r,t,e){return Array.from({length:r},function(){return new Array(t).fill(e)})},Z=function(r,t){if(!r)return"";var e=Math.random()*6+2,i=Math.random()*2+2;switch(t){case"repeat":return"animation: 200s linear 0s infinite alternate watermark !important;";case"repeat-x":return"animation: ".concat(e,"s linear 0s infinite alternate watermark-vertical !important;'");case"repeat-y":return"animation: ".concat(i,"s linear 0s infinite alternate watermark-horizontal !important;'");case"no-repeat":return"animation: ".concat(e,"s linear 0s infinite alternate watermark-horizontal, ").concat(i,"s linear 0s infinite alternate watermark-vertical !important;");default:return""}},G={width:300,height:300,rotate:45,layout:"default",auxiliaryLine:!1,translatePlacement:"middle",contentType:"text",content:"hello watermark-js-plus",textType:"fill",imageWidth:0,imageHeight:0,lineHeight:30,zIndex:2147483647,backgroundPosition:"0 0",backgroundRepeat:"repeat",fontSize:"20px",fontFamily:"sans-serif",fontStyle:"",fontVariant:"",fontColor:"#000",fontWeight:"normal",filter:"none",letterSpacing:"0px",wordSpacing:"0px",globalAlpha:.5,mode:"default",mutationObserve:!0,monitorProtection:!1,movable:!1,parent:"body",onSuccess:function(){},onBeforeDestroy:function(){},onDestroyed:function(){},onObserveError:function(){}},tt=function(r,t,e){var i=r.getContext("2d");if(i===null)throw new Error("get context error");i.font="".concat(t.fontStyle," ").concat(t.fontVariant," ").concat(t.fontWeight," ").concat(t.fontSize," ").concat(t.fontFamily),i.filter=t.filter,i.letterSpacing=t.letterSpacing,i.wordSpacing=t.wordSpacing,t!=null&&t.rotate&&(t.rotate=(360-t.rotate%360)*(Math.PI/180)),x(e.textRowMaxWidth)&&(t.textRowMaxWidth=t.width);var a={image:{rect:{width:t.imageWidth,height:t.imageHeight},position:{x:0,y:0}},textLine:{data:[],yOffsetValue:0},advancedStyleParams:{linear:{x0:0,x1:0},radial:{x0:0,y0:0,r0:0,x1:0,y1:0,r1:0},conic:{x:0,y:0,startAngle:0},pattern:{}}};switch(t.contentType){case"text":a.textLine.data=[t.content];break;case"multi-line-text":a.textLine.data=K(i,t.content,t.textRowMaxWidth);break}var n=t.width/2,o=t.height/2,l="middle",s="center";switch(!x(e==null?void 0:e.translateX)&&!x(e==null?void 0
z-index:`.concat(this.options.zIndex,`!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important;
`).concat(a==="custom"?"top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;":"position:relative!important;",`
`),n=it(this.options),i.style.cssText=`
display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;
position:`.concat(a==="root"?"fixed":"absolute",`!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;
z-index:`).concat(this.options.zIndex,"!important;background-image:url(").concat(e,")!important;background-repeat:").concat(this.options.backgroundRepeat,`!important;
background-size:`).concat(n[0],"px ").concat(n[1],"px!important;background-position:").concat(this.options.backgroundPosition,`;
`).concat(Z(this.options.movable,this.options.backgroundRepeat),`
`),this.watermarkDom.appendChild(i),this.parentElement.appendChild(this.watermarkDom),this.options.mutationObserve)try{this.bindMutationObserve()}catch(m){(c=(d=this.options).onObserveError)===null||c===void 0||c.call(d)}return t&&((u=(h=this.options).onSuccess)===null||u===void 0||u.call(h)),this.isCreating=!1,[2]}})})},r.prototype.destroy=function(){this.remove(),this.watermarkDom=void 0},r.prototype.check=function(){return S(this,void 0,void 0,function(){return b(this,function(t){return[2,this.parentElement.contains(this.watermarkDom)]})})},r.prototype.remove=function(){var t,e,i,a,n,o,l,s;(e=(t=this.options).onBeforeDestroy)===null||e===void 0||e.call(t),(i=this.observer)===null||i===void 0||i.disconnect(),(a=this.parentObserve)===null||a===void 0||a.disconnect(),(o=(n=this.watermarkDom)===null||n===void 0?void 0:n.parentNode)===null||o===void 0||o.removeChild(this.watermarkDom),(s=(l=this.options).onDestroyed)===null||s===void 0||s.call(l)},r.prototype.initConfigData=function(t,e){var i=this;e===void 0&&(e="overwrite"),e==="append"?Object.keys(t).forEach(function(a){i.props&&(i.props[a]=t[a])}):this.props=t,this.options=_(_({},G),this.props),this.changeParentElement(this.options.parent),this.watermarkCanvas=new O(this.props,this.options)},r.prototype.changeParentElement=function(t){if(typeof t=="string"){var e=document.querySelector(t);e&&(this.parentElement=e)}else this.parentElement=t;this.parentElement||console.error("[WatermarkJsPlus]: please pass a valid parent element.")},r.prototype.validateUnique=function(){var t=!0;return Array.from(this.parentElement.childNodes).forEach(function(e){t&&Object.hasOwnProperty.call(e,"__WATERMARK__")&&(t=!1)}),t},r.prototype.validateContent=function(){switch(this.options.contentType){case"image":return Object.hasOwnProperty.call(this.options,"image");case"multi-line-text":case"rich-text":case"text":return this.options.content.length>0}},r.prototype.checkParentElementType=function(){return["html","body"].includes(this.parentElement.tagName.toLocaleLowerCase())?"root":"custom"},r.prototype.bindMutationObserve=function(){var t=this;this.watermarkDom&&(this.observer=new MutationObserver(function(e){return S(t,void 0,void 0,function(){return b(this,function(i){switch(i.label){case 0:return e.length>0?(this.remove(),[4,this.create()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})}),this.observer.observe(this.watermarkDom,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),this.parentObserve=new MutationObserver(function(e){return S(t,void 0,void 0,function(){var i,a,n,o;return b(this,function(l){switch(l.label){case 0:i=0,a=e,l.label=1;case 1:return i<a.length?(n=a[i],(n==null?void 0:n.target)===this.watermarkDom||((o=n==null?void 0:n.removedNodes)===null||o===void 0?void 0:o[0])===this.watermarkDom||n.type==="childList"&&n.target===this.parentElement&&n.target.lastChild!==this.watermarkDom?(this.remove(),[4,this.create()]):[3,3]):[3,4];case 2:l.sent(),l.label=3;case 3:return i++,[3,1];case 4:return[2]}})})}),this.parentObserve.observe(this.parentElement,{attributes:!0,childList:!0,subtree:!0,characterData:!0}))},r}();(function(r){q(t,r);function t(e){e===void 0&&(e={});var i={globalAlpha:.005,mode:"blind"};return r.call(this,_(_({},e),i))||this}return t.prototype.changeOptions=function(){return S(this,arguments,void 0,function(e,i,a){return e===void 0&&(e={}),i===void 0&&(i="overwrite"),a===void 0&&(a=!0),b(this,function(n){switch(n.label){case 0:return e.globalAlpha=.005,e.mode="blind",this.initConfigData(e,i),j(this.options.monitorProtection),a?(this.remove(),[4,this.create()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},t.decode=function(e){var i=e.url,a=i===void 0?"":i,n=e.fillColor,o=n===void 0?"#000":n,l=e.compositeOperation,s=l===void 0?"color-burn":l,d=e.mode,c=d===void 0?"canvas":d,h=e.compositeTimes,u=h===void 0?3:h,v=e.onSuccess;if(a&&c==="canvas"){var m=new Image;m.src=a,m.addEventListener("load",function(){var p=m.width,f=m.height,w=O.createCanvas(p,f),g=w.getContext("2d");if(!g)throw new Error("get context error");g.drawImage(m,0,0,p,f),g