@hscmap/vue-window
Version:
Vue component for window
1 lines • 31.3 kB
JavaScript
(()=>{"use strict";var t={55:(t,e,n)=>{n.d(e,{Z:()=>a});var i=n(81),o=n.n(i),r=n(645),s=n.n(r)()(o());s.push([t.id,".button[data-v-46a594e4]{background-color:transparent;border:none;font-size:medium;margin:0;padding:0 .25em;border-radius:4pt}",""]);const a=s},275:(t,e,n)=>{n.d(e,{Z:()=>a});var i=n(81),o=n.n(i),r=n(645),s=n.n(r)()(o());s.push([t.id,".window[data-v-300294cc]{display:flex;flex-flow:column;position:absolute;border-radius:4pt 4pt 0 0}.titlebar[data-v-300294cc]{display:flex;flex-flow:row nowrap;border-radius:4pt 4pt 0 0;font-family:sans-serif;padding:.5em;flex:0 0 auto}.title[data-v-300294cc]{flex-grow:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.content[data-v-300294cc]{flex-grow:1;padding:.5em}.draggable-handle[data-v-300294cc]{cursor:move}.fade-enter[data-v-300294cc],.fade-leave-to[data-v-300294cc]{opacity:0;transform:scale(0.9)}.fade-enter-active[data-v-300294cc],.fade-leave-active[data-v-300294cc]{transition:.2s}",""]);const a=s},645:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,o,r){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var h=0;h<t.length;h++){var p=[].concat(t[h]);i&&s[p[0]]||(void 0!==r&&(void 0===p[5]||(p[1]="@layer".concat(p[5].length>0?" ".concat(p[5]):""," {").concat(p[1],"}")),p[5]=r),n&&(p[2]?(p[1]="@media ".concat(p[2]," {").concat(p[1],"}"),p[2]=n):p[2]=n),o&&(p[4]?(p[1]="@supports (".concat(p[4],") {").concat(p[1],"}"),p[4]=o):p[4]="".concat(o)),e.push(p))}},e}},81:t=>{t.exports=function(t){return t[1]}},379:t=>{var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var r={},s=[],a=0;a<t.length;a++){var l=t[a],h=i.base?l[0]+i.base:l[0],p=r[h]||0,u="".concat(h," ").concat(p);r[h]=p+1;var d=n(u),c={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(c);else{var f=o(c,i);i.byIndex=a,e.splice(a,0,{identifier:u,updater:f,references:1})}s.push(u)}return s}function o(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var r=i(t=t||[],o=o||{});return function(t){t=t||[];for(var s=0;s<r.length;s++){var a=n(r[s]);e[a].references--}for(var l=i(t,o),h=0;h<r.length;h++){var p=n(r[h]);0===e[p].references&&(e[p].updater(),e.splice(p,1))}r=l}}},569:t=>{var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},216:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,n)=>{t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},795:t=>{t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,o&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},191:(t,e,n)=>{Object.defineProperty(e,"X",{value:!0});var i=n(14);e.Z=i.Button},582:(t,e,n)=>{Object.defineProperty(e,"X",{value:!0});var i=n(602);e.Z=i.WindowType},377:(t,e)=>{function n(t){return window.TouchEvent&&t instanceof TouchEvent}Object.defineProperty(e,"__esModule",{value:!0}),e.V2=e.SinglePointerEvent=e.isTouchEvent=void 0,e.isTouchEvent=n;var i=function(){function t(t){this.e=t}return t.prototype.stopPropagation=function(){this.e.stopPropagation()},t.prototype.preventDefault=function(){this.e.preventDefault()},Object.defineProperty(t.prototype,"clientX",{get:function(){return n(this.e)?("touchend"===this.e.type?this.e.changedTouches:this.e.touches).item(0).clientX:this.e.clientX},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clientY",{get:function(){return n(this.e)?("touchend"===this.e.type?this.e.changedTouches:this.e.touches).item(0).clientY:this.e.clientY},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clientCoord",{get:function(){return new o(this.clientX,this.clientY)},enumerable:!1,configurable:!0}),t.bindDown=function(e,n,i,o){void 0===o&&(o=!1);var r=function(e){n(new t(e))},s=function(e){1===e.touches.length&&n(new t(e)),e.touches.length>1&&i&&i(new t(e))};return e.addEventListener("mousedown",r,o),e.addEventListener("touchstart",s,o),function(){e.removeEventListener("mousedown",r,o),e.removeEventListener("touchstart",s,o)}},t.bindMove=function(e,n,i){void 0===i&&(i=!1);var o=function(e){n(new t(e))},r=function(e){1===e.touches.length&&n(new t(e))};return e.addEventListener("mousemove",o,i),e.addEventListener("touchmove",r,i),function(){e.removeEventListener("mousemove",o,i),e.removeEventListener("touchmove",r,i)}},t.bindUp=function(e,n,i){void 0===i&&(i=!1);var o=function(e){n(new t(e))},r=function(e){0===e.touches.length&&n(new t(e))};return e.addEventListener("mouseup",o,i),e.addEventListener("touchend",r,i),function(){e.removeEventListener("mouseup",o,i),e.removeEventListener("touchend",r,i)}},t.prototype.originalEvent=function(t){var e=t.mouse,i=t.touch;n(this.e)?i&&i(this.e):e&&e(this.e)},t}();e.SinglePointerEvent=i;var o=function(){function t(t,e){this.x=t,this.y=e}return t.prototype.clone=function(){return new t(this.x,this.y)},t}();e.V2=o},14:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Button=void 0;var i=n(752),o=n(590),r=n(624),s=n(377),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hover=!1,e.active=!1,e}return i.__extends(e,t),Object.defineProperty(e.prototype,"style",{get:function(){var t=this.windowStyle.button;return this.hover&&(t=i.__assign(i.__assign({},t),this.windowStyle.buttonHover)),this.active&&(t=i.__assign(i.__assign({},t),this.windowStyle.buttonActive)),t},enumerable:!1,configurable:!0}),e.prototype.mousedown=function(t){var e=this;t.preventDefault(),this.active=!0;var n=s.SinglePointerEvent.bindUp(document,(function(){e.active=!1,n()}))},e.prototype.mouseup=function(t){this.active&&this.$emit("click")},i.__decorate([r.Inject(o.WINDOW_STYLE_KEY)],e.prototype,"windowStyle",void 0),i.__decorate([r.Prop({type:Boolean,default:!1})],e.prototype,"disabled",void 0),i.__decorate([r.Component],e)}(r.Vue);e.Button=a},413:(t,e)=>{function n(t){var e=t.getBoundingClientRect(),n=e.width,i=e.height,o=e.top,r=e.left;return{width:n,height:i,top:o,left:r,bottom:o+i,right:r+n}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRect=e.naturalSize=void 0,e.naturalSize=function(t){var e=t.style,i=e.width,o=e.height;t.style.width="auto",t.style.height="auto";var r=n(t);return t.style.width=i,t.style.height=o,r},e.getRect=n},392:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DraggableHelper=void 0;var i=n(377),o=function(){function t(t,e,n){var o=this;void 0===n&&(n={}),this.handle=t,this.container=e,this.options=n,this.mousedown=function(t){t.preventDefault();var e=o.handle.getBoundingClientRect(),n=e.left,r=e.top;o.offsetX=t.clientX-n,o.offsetY=t.clientY-r,o.options.onMoveStart&&o.options.onMoveStart(),o.unbindMove=i.SinglePointerEvent.bindMove(document,o.mousemove),o.unbindUp=i.SinglePointerEvent.bindUp(document,o.mouseup)},this.mousemove=function(t){o.container.style.left=t.clientX-o.offsetX+"px",o.container.style.top=t.clientY-o.offsetY+"px",o.options.onMove&&o.options.onMove()},this.mouseup=function(t){o.options.onMoveEnd&&o.options.onMoveEnd(),o.unbindUp(),o.unbindMove(),o.unbindUp=o.unbindMove=void 0},this.unbindDown=i.SinglePointerEvent.bindDown(t,this.mousedown),t.classList.add("draggable-handle")}return t.prototype.teardown=function(){this.handle.classList.remove("draggable-handle"),this.unbindDown(),this.unbindUp&&this.unbindUp(),this.unbindMove&&this.unbindMove()},t}();e.DraggableHelper=o},302:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ResizableHelper=void 0;var i=n(752),o=n(413),r=n(377),s=function(){function t(t,e){var n=this;this.container=t,this.options=e,this.handles=a.map((function(e){return new e(t,n)}));var i=o.naturalSize(t),r=i.width,s=i.height,l=e.maxWidth||window.innerWidth,p=e.maxHeight||window.innerHeight,u=!1;(r<e.minWidth||r>l)&&(t.style.width=h(r,e.minWidth,l)+"px",u=!0),(s<e.minHeight||s>p)&&(t.style.height=h(s,e.minHeight,p)+"px",u=!0),u&&e.onResize&&e.onResize()}return t.prototype.teardown=function(){this.handles.forEach((function(t){return t.teardown()}))},t}();e.ResizableHelper=s;var a=[],l=function(){function t(t,e){var n=this;this.container=t,this.helper=e,this.handleSize=8,this.mousedown=function(t){t.preventDefault(),t.stopPropagation();var e=o.getRect(n.container),i=e.left,s=e.top,a=e.width,l=e.height;n.x0=t.clientX,n.y0=t.clientY,n.left0=i,n.top0=s,n.width0=a,n.height0=l,n.calcSafeBoundaries(),n.helper.options.onResizeStart&&n.helper.options.onResizeStart(),n.unbindMove=r.SinglePointerEvent.bindMove(document,n.mousemove),n.unbindUp=r.SinglePointerEvent.bindUp(document,n.mouseup)},this.mousemove=function(t){t.preventDefault(),t.stopPropagation(),n.setPosition(t),n.fixPosition(),n.helper.options.onResize&&n.helper.options.onResize()},this.mouseup=function(t){t.preventDefault(),t.stopPropagation(),n.helper.options.onResizeEnd&&n.helper.options.onResizeEnd(),n.unbindUp(),n.unbindMove(),n.unbindUp=n.unbindMove=void 0},this.handle=this.createHandleElement(),this.unbindDown=r.SinglePointerEvent.bindDown(this.handle,this.mousedown)}return t.prototype.teardown=function(){this.unbindDown(),this.unbindUp&&this.unbindUp(),this.unbindMove&&this.unbindMove(),this.handle.parentElement.removeChild(this.handle)},t.prototype.calcSafeBoundaries=function(){var t=o.getRect(this.container),e=t.left,n=t.top,i=t.right,r=t.bottom,s=this.helper.options,a=s.maxWidth||window.innerWidth,l=s.maxHeight||window.innerHeight;this.minLeft=Math.max(i-a,0),this.maxLeft=i-s.minWidth,this.minRight=e+s.minWidth,this.maxRight=Math.min(e+a,window.innerWidth),this.minTop=Math.max(r-l,0),this.maxTop=r-s.minHeight,this.minBottom=n+s.minHeight,this.maxBottom=Math.min(n+l,window.innerHeight)},t.prototype.fixPosition=function(){var t=o.getRect(this.container),e=t.width,n=t.height,i=t.left,r=t.top,s=t.right,a=t.bottom,l=this.helper.options;i<this.minLeft?(this.container.style.width=e+i-this.minLeft+"px",this.container.style.left=this.minLeft+"px"):i>this.maxLeft?(this.container.style.width=l.minWidth+"px",this.container.style.left=this.maxLeft+"px"):s<this.minRight?this.container.style.width=l.minWidth+"px":s>this.maxRight&&(this.container.style.width=this.maxRight-i+"px"),r<this.minTop?(this.container.style.height=n+r-this.minTop+"px",this.container.style.top=this.minTop+"px"):r>this.maxTop?(this.container.style.height=l.minHeight+"px",this.container.style.top=this.maxTop+"px"):a<this.minBottom?this.container.style.height=l.minHeight+"px":a>this.maxBottom&&(this.container.style.height=this.maxBottom-r+"px")},t.prototype.createHandleElement=function(){var t=document.createElement("div"),e=t.style;return e.position="absolute",this.applyStyle(e),this.container.appendChild(t),t},t}();function h(t,e,n){return t<e?e:t>n?n:t}a.push(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.setPosition=function(t){this.container.style.width=this.width0+t.clientX-this.x0+"px",this.container.style.height=this.height0+t.clientY-this.y0+"px"},e.prototype.applyStyle=function(t){t.width=2*this.handleSize+"px",t.height=2*this.handleSize+"px",t.right=-this.handleSize+"px",t.bottom=-this.handleSize+"px",t.cursor="nwse-resize"},e}(l),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.setPosition=function(t){this.container.style.height=this.height0+t.clientY-this.y0+"px"},e.prototype.applyStyle=function(t){t.right=this.handleSize+"px",t.left=this.handleSize+"px",t.height=2*this.handleSize+"px",t.bottom=-this.handleSize+"px",t.cursor="ns-resize"},e}(l),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.setPosition=function(t){this.container.style.left=this.left0+t.clientX-this.x0+"px",this.container.style.width=this.width0-(t.clientX-this.x0)+"px",this.container.style.height=this.height0+t.clientY-this.y0+"px"},e.prototype.applyStyle=function(t){t.left=-this.handleSize+"px",t.bottom=-this.handleSize+"px",t.width=2*this.handleSize+"px",t.height=2*this.handleSize+"px",t.cursor="nesw-resize"},e}(l),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.setPosition=function(t){this.container.style.left=this.left0+t.clientX-this.x0+"px",this.container.style.width=this.width0-(t.clientX-this.x0)+"px"},e.prototype.applyStyle=function(t){t.left=-this.handleSize+"px",t.bottom=this.handleSize+"px",t.width=2*this.handleSize+"px",t.top=this.handleSize+"px",t.cursor="ew-resize"},e}(l),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.setPosition=function(t){this.container.style.left=this.left0+t.clientX-this.x0+"px",this.container.style.width=this.width0-(t.clientX-this.x0)+"px",this.container.style.top=this.top0+t.clientY-this.y0+"px",this.container.style.height=this.height0-(t.clientY-this.y0)+"px"},e.prototype.applyStyle=function(t){t.left=-this.handleSize+"px",t.top=-this.handleSize+"px",t.width=2*this.handleSize+"px",t.height=2*this.handleSize+"px",t.cursor="nwse-resize"},e}(l),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.setPosition=function(t){this.container.style.top=this.top0+t.clientY-this.y0+"px",this.container.style.height=this.height0-(t.clientY-this.y0)+"px"},e.prototype.applyStyle=function(t){t.left=this.handleSize+"px",t.right=this.handleSize+"px",t.height=2*this.handleSize+"px",t.top=-this.handleSize+"px",t.cursor="ns-resize"},e}(l),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.setPosition=function(t){this.container.style.top=this.top0+t.clientY-this.y0+"px",this.container.style.height=this.height0-(t.clientY-this.y0)+"px",this.container.style.width=this.width0+t.clientX-this.x0+"px"},e.prototype.applyStyle=function(t){t.right=-this.handleSize+"px",t.top=-this.handleSize+"px",t.height=2*this.handleSize+"px",t.width=2*this.handleSize+"px",t.cursor="nesw-resize"},e}(l),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e.prototype.setPosition=function(t){this.container.style.width=this.width0+t.clientX-this.x0+"px"},e.prototype.applyStyle=function(t){t.right=-this.handleSize+"px",t.top=this.handleSize+"px",t.bottom=this.handleSize+"px",t.width=2*this.handleSize+"px",t.cursor="ew-resize"},e}(l))},590:(t,e)=>{function n(t){return{provide:function(){var n;return(n={})[e.WINDOW_STYLE_KEY]=t,n},render:function(t){return t("div",this.$slots.default)}}}Object.defineProperty(e,"__esModule",{value:!0}),e.StyleMetal=e.StyleWhite=e.StyleBlack=e.StyleFactory=e.WINDOW_STYLE_KEY=void 0,e.WINDOW_STYLE_KEY="@hscmap/vue-window/windowStyle",e.StyleFactory=n,e.StyleBlack=n({window:{color:"#fff",boxShadow:"0 0 6pt rgba(255, 255, 255, 0.75)",backgroundColor:"rgba(31, 31, 31, 0.9)"},titlebar:{backgroundColor:"rgba(63, 63, 63, 0.9)"},content:{},button:{color:"white"},buttonHover:{backgroundColor:"rgba(255, 255, 255, 0.25)"},buttonActive:{color:"black",backgroundColor:"rgba(255, 255, 255, 0.5)"}}),e.StyleWhite=n({window:{color:"#000",boxShadow:"0 2pt 4pt rgba(0, 0, 0, 0.5)",backgroundColor:"rgba(239, 239, 239, 0.95)"},titlebar:{backgroundColor:"rgba(191, 191, 191, 0.9)"},content:{},button:{color:"#000"},buttonHover:{backgroundColor:"rgba(0, 0, 0, 0.25)"},buttonActive:{color:"#fff",backgroundColor:"rgba(0, 0, 0, 0.5)"}}),e.StyleMetal=n({window:{color:"#000",boxShadow:"0 4pt 8pt rgba(0, 0, 0, 0.5)",background:"linear-gradient(to bottom, rgb(215, 215, 215), rgb(191, 191, 191))"},titlebar:{background:"linear-gradient(to bottom, rgb(215, 215, 215), rgb(191, 191, 191))"},content:{},button:{color:"#000"},buttonHover:{backgroundColor:"rgba(0, 0, 0, 0.25)"},buttonActive:{color:"#fff",backgroundColor:"rgba(0, 0, 0, 0.5)"}})},602:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fixPosition=e.WindowResizeEvent=e.WindowType=void 0;var i=n(752),o=n(624),r=n(413),s=n(392),a=n(302),l=n(590),h=n(82),p=n(727),u=n(488),d=[],c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.zIndex="auto",e.openCount=0,e}return i.__extends(e,t),e.prototype.mounted=function(){var t=this;d.push(this),this.zElement=new p.ZElement(this.zGroup,(function(e){return t.zIndex=""+e})),this.isOpen&&this.onIsOpenChange(!0),h.windows.add(this)},e.prototype.beforeDestroy=function(){h.windows.delete(this),this.zElement.unregister(),this.resizableHelper&&this.resizableHelper.teardown(),this.draggableHelper&&this.draggableHelper.teardown(),d.splice(d.indexOf(this),1)},e.prototype.windowElement=function(){return this.$refs.window},e.prototype.titlebarElement=function(){return this.$refs.titlebar},e.prototype.contentElement=function(){return this.$refs.content},e.prototype.activate=function(){this.zElement.raise(),this.$emit("activate")},Object.defineProperty(e.prototype,"styleWindow",{get:function(){return i.__assign(i.__assign({},this.windowStyle.window),{zIndex:this.zIndex,overflow:this.overflow})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"styleTitlebar",{get:function(){return this.windowStyle.titlebar},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"styleContent",{get:function(){var t=i.__assign({},this.windowStyle.content);return this.resizable?t.padding="0":null!=this.padding&&(t.padding=this.padding+"px"),this.isScrollable&&(t.overflow="auto"),t},enumerable:!1,configurable:!0}),e.prototype.onResizableChange=function(t){console.error("prop 'resizable' can't be changed")},e.prototype.onIsOpenChange=function(t){var e=this;t&&(this.$nextTick((function(){0==e.openCount++&&(e.setWindowRect(e),e.setInitialPosition()),e.resizable&&e.onWindowResize(),e.onWindowMove(),e.draggableHelper=new s.DraggableHelper(e.titlebarElement(),e.windowElement(),{onMove:function(){return e.onWindowMove()},onMoveStart:function(){return e.$emit("move-start")},onMoveEnd:function(){return e.$emit("move-end")}}),e.resizable&&e.initResizeHelper()})),this.activateWhenOpen&&this.activate())},e.prototype.onZGroupChange=function(){this.zElement.group=this.zGroup},e.prototype.fixPosition=function(){var t=this.windowElement(),e=t.getBoundingClientRect();e.left<0&&(t.style.left="0px"),e.top<0&&(t.style.top="0px"),e.right>window.innerWidth&&(t.style.left=window.innerWidth-e.width+"px"),e.bottom>window.innerHeight&&(t.style.top=window.innerHeight-e.height+"px")},e.prototype.onLeftChange=function(t){this.setWindowRect({left:t}),this.onWindowMove(!1)},e.prototype.onTopChange=function(t){this.setWindowRect({top:t}),this.onWindowMove(!1)},e.prototype.onWidthChange=function(t){this.setWindowRect({width:t}),this.onWindowResize(!1)},e.prototype.onHeightChange=function(t){this.setWindowRect({height:t}),this.onWindowResize(!1)},e.prototype.setWindowRect=function(t){var e=t.width,n=t.height,i=t.top,o=t.left,r=this.windowElement();if(null!=e&&(r.style.width=e+"px"),null!=n){var s=v(this.titlebarElement()).height;r.style.height=n+s+"px"}null!=o&&(r.style.left=o+"px"),null!=i&&(r.style.top=i+"px")},e.prototype.initResizeHelper=function(){var t=this,e=r.naturalSize(this.titlebarElement()).height;this.resizableHelper=new a.ResizableHelper(this.windowElement(),{onResize:function(){return t.onWindowResize()},onResizeStart:function(){return t.$emit("resize-start")},onResizeEnd:function(){return t.$emit("resize-end")},minWidth:this.minWidth,minHeight:this.minHeight+e,maxWidth:this.maxWidth,maxHeight:this.maxHeight?this.maxHeight+e:void 0})},e.prototype.onWindowResize=function(t){void 0===t&&(t=!0);var e=this.windowElement(),n=this.titlebarElement(),i=this.contentElement(),o=v(i),r=o.width,s=o.height,a=v(e),l=a.width,h=a.height,p=v(n).height,u=l-(i.offsetWidth-r),d=h-p-(i.offsetHeight-s);i.style.width=u+"px",i.style.height=d+"px",m(),this.$emit("resize",new y(u,d)),t&&(this.$emit("update:width",u),this.$emit("update:height",d))},e.prototype.onWindowMove=function(t){void 0===t&&(t=!0),this.fixPosition();var e=this.windowElement().getBoundingClientRect(),n=e.left,i=e.top;t&&(this.$emit("update:left",n),this.$emit("update:top",i))},e.prototype.setInitialPosition=function(){var t,e,n=this,i=this.windowElement(),o=r.naturalSize(i),s=o.width,a=o.height;if(void 0!==this.left!=(void 0!==this.top))throw new Error("Either of left or top is specified. Both must be set or not set.");if("number"==typeof this.left)t=this.left,e=this.top;else{var l=this.positionHint||"auto";switch(l){case"auto":var h=20,p=50,u=0;do{if(d.every((function(t){if(!t.isOpen||n==t)return!0;var e=g(t);if(null==e)return!0;var i,o,r=e.left,s=e.top;return(i=r-h)*i+(o=s-p)*o>16})))break;h=(h+40)%(window.innerWidth-200),p=(p+40)%(window.innerHeight-200)}while(++u<100);t=h,e=p;break;case"center":t=(window.innerWidth-s)/2,e=(window.innerHeight-a)/2;break;default:try{var c=l.split("/").map(Number);if(2!=c.length)throw null;var f=c[0],v=c[1];if(!isFinite(f)||!isFinite(v))throw null;t=f>=0?f:window.innerWidth-s+f,e=v>=0?v:window.innerHeight-a+v}catch(t){throw new Error("invalid position string: "+l)}}}i.style.left=t+"px",i.style.top=e+"px"},e.prototype.closeButtonClick=function(){this.$emit("closebuttonclick"),this.$emit("update:isOpen",!1)},i.__decorate([o.Prop({type:Boolean,default:!0})],e.prototype,"isOpen",void 0),i.__decorate([o.Prop({type:String,default:""})],e.prototype,"title",void 0),i.__decorate([o.Prop({type:Boolean,default:!1})],e.prototype,"closeButton",void 0),i.__decorate([o.Prop({type:Boolean,default:!1})],e.prototype,"resizable",void 0),i.__decorate([o.Prop({type:Boolean,default:!1})],e.prototype,"isScrollable",void 0),i.__decorate([o.Prop({type:Number,default:8})],e.prototype,"padding",void 0),i.__decorate([o.Prop({type:Boolean,default:!0})],e.prototype,"activateWhenOpen",void 0),i.__decorate([o.Prop({type:String})],e.prototype,"positionHint",void 0),i.__decorate([o.Prop({type:Number,default:0})],e.prototype,"zGroup",void 0),i.__decorate([o.Prop({default:"visible"})],e.prototype,"overflow",void 0),i.__decorate([o.Inject(l.WINDOW_STYLE_KEY)],e.prototype,"windowStyle",void 0),i.__decorate([o.Watch("resizable")],e.prototype,"onResizableChange",null),i.__decorate([o.Watch("isOpen")],e.prototype,"onIsOpenChange",null),i.__decorate([o.Watch("zGroup")],e.prototype,"onZGroupChange",null),i.__decorate([o.Prop({type:Number})],e.prototype,"left",void 0),i.__decorate([o.Watch("left")],e.prototype,"onLeftChange",null),i.__decorate([o.Prop({type:Number})],e.prototype,"top",void 0),i.__decorate([o.Watch("top")],e.prototype,"onTopChange",null),i.__decorate([o.Prop({type:Number})],e.prototype,"width",void 0),i.__decorate([o.Watch("width")],e.prototype,"onWidthChange",null),i.__decorate([o.Prop({type:Number})],e.prototype,"height",void 0),i.__decorate([o.Watch("height")],e.prototype,"onHeightChange",null),i.__decorate([o.Prop({type:Number,default:1})],e.prototype,"minWidth",void 0),i.__decorate([o.Prop({type:Number,default:0})],e.prototype,"minHeight",void 0),i.__decorate([o.Prop({type:Number})],e.prototype,"maxWidth",void 0),i.__decorate([o.Prop({type:Number})],e.prototype,"maxHeight",void 0),i.__decorate([o.Component({components:{MyButton:u.default}})],e)}(o.Vue);function f(t){return null!==t?parseFloat(t):0}function v(t){var e=window.getComputedStyle(t);return{width:Math.ceil([e.paddingLeft,e.width,e.paddingRight].map(f).reduce((function(t,e){return t+e}))),height:Math.ceil([e.paddingTop,e.height,e.paddingBottom].map(f).reduce((function(t,e){return t+e})))}}e.WindowType=c;var y=function(t,e){this.width=t,this.height=e};function g(t){var e=t.windowElement(),n=parseFloat(e.style.left||"NaN"),i=parseFloat(e.style.top||"NaN");return isNaN(n)||isNaN(i)?null:{left:n,top:i}}function m(){h.windows.forEach((function(t){t.fixPosition()}))}e.WindowResizeEvent=y,e.fixPosition=m,window.addEventListener("resize",(function(t){return m()}))},82:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.windows=void 0,e.windows=new Set},727:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ZElement=void 0;var n=function(){function t(t,e){var n=this;this._group=t,this.onChange=e,this.a((function(t){return t.push(n)}))}return Object.defineProperty(t.prototype,"group",{get:function(){return this._group},set:function(t){this._group=t;var e=o(this._group),n=o(t);e.splice(e.indexOf(this),1),n.push(this),s()},enumerable:!1,configurable:!0}),t.prototype.unregister=function(){var t=this;this.a((function(e){return e.splice(e.indexOf(t),1)}))},t.prototype.raise=function(){var t=this;this.a((function(e){e.splice(e.indexOf(t),1),e.push(t)}))},t.prototype.a=function(t){t(o(this._group)),s()},t}();e.ZElement=n;var i=new Map;function o(t){return i.has(t)||i.set(t,[]),i.get(t)}function r(t,e){return t>e?-r(e,t):t<0&&e>=0?1:t-e}function s(){for(var t=0,e=0,n=function(t){var e=[];return t.forEach((function(t,n){return e.push(n)})),e}(i).sort(r);e<n.length;e++)for(var s=0,a=o(n[e]);s<a.length;s++){var l=a[s];t!=l.zIndex&&(l.zIndex=t,l.onChange(t)),t++}}},488:(t,e,n)=>{n.r(e),n.d(e,{__esModule:()=>o.X,default:()=>x});var i=function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"button",style:t.style,attrs:{disabled:t.disabled},on:{mouseenter:function(e){t.hover=!0},mouseleave:function(e){t.hover=!1},mousedown:function(e){return e.stopPropagation(),t.mousedown.apply(null,arguments)},touchstart:function(e){return e.stopPropagation(),t.mousedown.apply(null,arguments)},mouseup:t.mouseup,touchend:t.mouseup}},[t._t("default")],2)};i._withStripped=!0;var o=n(191);const r=o.Z;var s=n(379),a=n.n(s),l=n(795),h=n.n(l),p=n(569),u=n.n(p),d=n(565),c=n.n(d),f=n(216),v=n.n(f),y=n(589),g=n.n(y),m=n(55),w={};w.styleTagTransform=g(),w.setAttributes=c(),w.insert=u().bind(null,"head"),w.domAPI=h(),w.insertStyleElement=v(),a()(m.Z,w),m.Z&&m.Z.locals&&m.Z.locals;var b=(0,n(900).Z)(r,i,[],!1,null,"46a594e4",null);b.options.__file="src/button/index.vue";const x=b.exports},544:(t,e,n)=>{n.r(e),n.d(e,{__esModule:()=>o.X,default:()=>x});var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:"fade"},on:{"after-leave":function(e){return t.$emit("close")},"after-enter":function(e){return t.$emit("open")}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.isOpen,expression:"isOpen"}],ref:"window",staticClass:"window",style:t.styleWindow,on:{mousedown:t.activate,touchstart:t.activate}},[n("div",{ref:"titlebar",staticClass:"titlebar",style:t.styleTitlebar},[n("div",{staticClass:"title"},[t.$slots.title?[t._t("title")]:[t._v(t._s(t.title))]],2),t._v(" "),t.closeButton?[n("my-button",{on:{click:t.closeButtonClick}},[t._v("×")])]:t._e()],2),t._v(" "),n("div",{ref:"content",staticClass:"content",style:t.styleContent},[t._t("default")],2)])])};i._withStripped=!0;var o=n(582);const r=o.Z;var s=n(379),a=n.n(s),l=n(795),h=n.n(l),p=n(569),u=n.n(p),d=n(565),c=n.n(d),f=n(216),v=n.n(f),y=n(589),g=n.n(y),m=n(275),w={};w.styleTagTransform=g(),w.setAttributes=c(),w.insert=u().bind(null,"head"),w.domAPI=h(),w.insertStyleElement=v(),a()(m.Z,w),m.Z&&m.Z.locals&&m.Z.locals;var b=(0,n(900).Z)(r,i,[],!1,null,"300294cc",null);b.options.__file="src/window/index.vue";const x=b.exports},900:(t,e,n)=>{function i(t,e,n,i,o,r,s,a){var l,h="function"==typeof t?t.options:t;if(e&&(h.render=e,h.staticRenderFns=n,h._compiled=!0),i&&(h.functional=!0),r&&(h._scopeId="data-v-"+r),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},h._ssrRegister=l):o&&(l=a?function(){o.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:o),l)if(h.functional){h._injectStyles=l;var p=h.render;h.render=function(t,e){return l.call(e),p(t,e)}}else{var u=h.beforeCreate;h.beforeCreate=u?[].concat(u,l):[l]}return{exports:t,options:h}}n.d(e,{Z:()=>i})},752:t=>{t.exports=require("tslib")},624:t=>{t.exports=require("vue-property-decorator")}},e={};function n(i){var o=e[i];if(void 0!==o)return o.exports;var r=e[i]={id:i,exports:{}};return t[i](r,r.exports,n),r.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};(()=>{var t=i;Object.defineProperty(t,"__esModule",{value:!0}),t.WindowType=t.install=t.StyleFactory=t.StyleMetal=t.StyleWhite=t.StyleBlack=void 0;var e=n(544),o=n(590);Object.defineProperty(t,"StyleBlack",{enumerable:!0,get:function(){return o.StyleBlack}}),Object.defineProperty(t,"StyleWhite",{enumerable:!0,get:function(){return o.StyleWhite}}),Object.defineProperty(t,"StyleMetal",{enumerable:!0,get:function(){return o.StyleMetal}}),Object.defineProperty(t,"StyleFactory",{enumerable:!0,get:function(){return o.StyleFactory}});var r=n(602);Object.defineProperty(t,"WindowResizeEvent",{enumerable:!0,get:function(){return r.WindowResizeEvent}}),Object.defineProperty(t,"fixPosition",{enumerable:!0,get:function(){return r.fixPosition}}),t.install=function(t,n){void 0===n&&(n={prefix:"hsc-window"});var i=n.prefix;t.component(""+i,e.default),t.component(i+"-style-black",o.StyleBlack),t.component(i+"-style-white",o.StyleWhite),t.component(i+"-style-metal",o.StyleMetal)};var s=n(82);Object.defineProperty(t,"windows",{enumerable:!0,get:function(){return s.windows}}),t.WindowType=e.default})();var o=exports;for(var r in i)o[r]=i[r];i.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();