(()=>{"use strict";var e,t={7911:(e,t,r)=>{var n=r(4804),i=r(7811),o=r(9800),a=r(7761),s=r(9529),c=r(6424),h=r(5761),l=r(196);let d=null;class u{constructor(e){this.gl=e;const t=this.initShaderProgram();this.programInfo={program:t,attribLocations:{vertexPosition:e.getAttribLocation(t,"aVertexPosition")},uniformLocations:{uScaling:e.getUniformLocation(t,"uScaling")}},this.positionBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW)}getVertexShaderSource(){return"\n      attribute vec4 aVertexPosition;\n      uniform vec2 uScaling;\n      void main() {\n        gl_Position = vec4(aVertexPosition[0] * uScaling[0], aVertexPosition[1] * uScaling[1], -1.0, 1.0);\n      }\n    "}getFragmentShaderSource(){return"\n      precision highp float;\n      void main() {\n        gl_FragColor = vec4(.5, .5, .5, .6);\n      }\n  "}initShaderProgram(){const e=this.gl,t=this.getVertexShaderSource(),r=this.getFragmentShaderSource(),n=u.loadShader(e,e.VERTEX_SHADER,t),i=u.loadShader(e,e.FRAGMENT_SHADER,r),o=e.createProgram();if(e.attachShader(o,n),e.attachShader(o,i),e.linkProgram(o),!e.getProgramParameter(o,e.LINK_STATUS))throw new Error(`Unable to initialize the shader program: ${e.getProgramInfoLog(o)}`);return o}drawMask(e){const t=this.gl,r=this.programInfo;t.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.vertexAttribPointer(r.attribLocations.vertexPosition,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(r.attribLocations.vertexPosition),t.useProgram(r.program),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,255),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.uniform2fv(r.uniformLocations.uScaling,e),t.blendFunc(t.ZERO,t.ONE),t.drawArrays(t.TRIANGLE_STRIP,0,4),t.stencilFunc(t.EQUAL,0,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.uniform2fv(r.uniformLocations.uScaling,[1,1]),t.blendFunc(t.ZERO,t.SRC_ALPHA),t.drawArrays(t.TRIANGLE_STRIP,0,4)}static loadShader(e,t,r){const n=e.createShader(t);if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))throw new Error(`An error occurred compiling the shaders: ${e.getShaderInfoLog(n)}`);return n}}function g(e,t,r){const n=t/r;let i;return n>1?(i=[e.width,e.width/n],i[1]>e.height&&(i=[e.height*n,e.height])):(i=[e.height*n,e.height],i[0]>e.width&&(i=[e.width,e.width/n])),{scaling:[i[0]/e.width,i[1]/e.height],width:i[0],height:i[1],offsetX:(e.width-i[0])/2,offsetY:(e.height-i[1])/2}}Cesium.Ion.defaultAccessToken=l.x;const f=new h.Z({layers:[new c.Z({source:new s.Z})],controls:(0,a.c)({attributionOptions:{collapsible:!1}}),target:"map",view:new o.ZP({center:(0,i.vs)([25,20],"EPSG:4326","EPSG:3857"),zoom:3})}),m=new n.Z({map:f}),S=m.getCesiumScene();function E(){const e=document.querySelector("#printValue").value,t=S.canvas,r=Math.min(t.width,t.height);return"portrait"===e?g(t,r/4,r/2):g(t,r/2,r/4)}Cesium.createWorldTerrainAsync().then((e=>S.terrainProvider=e)),m.setEnabled(!0),document.getElementById("enable").addEventListener("click",(()=>m.setEnabled(!m.getEnabled()))),function(e,t){const r=e.canvas,n=r.getContext("webgl2")||r.getContext("webgl");if(t){if(!d){const r=new u(n);d=e.postRender.addEventListener((()=>{r.drawMask(t())}))}}else d&&(d(),d=null);e.requestRender()}(S,(()=>E().scaling)),window.takeScreenshot=async function(){const e=E(),t=await function(e,t){return new Promise(((r,n)=>{const i=e.postRender.addEventListener((()=>{i();try{let n;if(t){const r=document.createElement("canvas");r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(e.canvas,t.offsetX,t.offsetY,t.width,t.height,0,0,t.width,t.height),n=r.toDataURL()}else n=e.canvas.toDataURL();r(n)}catch(e){n(e)}}));e.requestRender()}))}(S,e),r=new Image;r.src=t,document.body.append(r)}}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var o=r[e]={exports:{}};return t[e].call(o.exports,o,o.exports,n),o.exports}n.m=t,e=[],n.O=(t,r,i,o)=>{if(!r){var a=1/0;for(l=0;l<e.length;l++){for(var[r,i,o]=e[l],s=!0,c=0;c<r.length;c++)(!1&o||a>=o)&&Object.keys(n.O).every((e=>n.O[e](r[c])))?r.splice(c--,1):(s=!1,o<a&&(a=o));if(s){e.splice(l--,1);var h=i();void 0!==h&&(t=h)}}return t}o=o||0;for(var l=e.length;l>0&&e[l-1][2]>o;l--)e[l]=e[l-1];e[l]=[r,i,o]},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.j=740,(()=>{var e={740:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var i,o,[a,s,c]=r,h=0;if(a.some((t=>0!==e[t]))){for(i in s)n.o(s,i)&&(n.m[i]=s[i]);if(c)var l=c(n)}for(t&&t(r);h<a.length;h++)o=a[h],n.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return n.O(l)},r=self.webpackChunkol_cesium=self.webpackChunkol_cesium||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i=n.O(void 0,[351],(()=>n(7911)));i=n.O(i)})();
//# sourceMappingURL=print.4b270c4d3f0c9c6eb2fa.js.map