pacem 0.40.2 → 0.40.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/pacem-dark-content.min.css +2 -2
- package/dist/css/pacem-dark-shell.min.css +2 -2
- package/dist/css/pacem-dark.min.css +2 -2
- package/dist/css/pacem-light-content.min.css +2 -2
- package/dist/css/pacem-light-shell.min.css +2 -2
- package/dist/css/pacem-light.min.css +2 -2
- package/dist/css/pacem-phousys-content.min.css +2 -2
- package/dist/css/pacem-phousys-shell.min.css +2 -2
- package/dist/css/pacem-phousys.min.css +2 -2
- package/dist/js/azure-maps.d.ts +2 -2
- package/dist/js/pacem-2d.d.ts +2 -2
- package/dist/js/pacem-2d.js +2 -2
- package/dist/js/pacem-2d.min.js +2 -2
- package/dist/js/pacem-3d.d.ts +2 -2
- package/dist/js/pacem-3d.js +2 -2
- package/dist/js/pacem-3d.min.js +2 -2
- package/dist/js/pacem-charts.d.ts +2 -2
- package/dist/js/pacem-charts.js +2 -2
- package/dist/js/pacem-charts.min.js +2 -2
- package/dist/js/pacem-cms.d.ts +2 -2
- package/dist/js/pacem-cms.js +2 -2
- package/dist/js/pacem-cms.min.js +2 -2
- package/dist/js/pacem-core.d.ts +2 -2
- package/dist/js/pacem-core.js +2 -2
- package/dist/js/pacem-core.min.js +2 -2
- package/dist/js/pacem-foundation.d.ts +2 -2
- package/dist/js/pacem-foundation.js +2 -2
- package/dist/js/pacem-foundation.min.js +2 -2
- package/dist/js/pacem-fx.d.ts +2 -2
- package/dist/js/pacem-fx.js +2 -2
- package/dist/js/pacem-fx.min.js +2 -2
- package/dist/js/pacem-logging.d.ts +2 -2
- package/dist/js/pacem-logging.js +2 -2
- package/dist/js/pacem-logging.min.js +2 -2
- package/dist/js/pacem-maps.d.ts +2 -2
- package/dist/js/pacem-maps.js +2 -2
- package/dist/js/pacem-maps.min.js +2 -2
- package/dist/js/pacem-media.d.ts +2 -2
- package/dist/js/pacem-media.js +2 -2
- package/dist/js/pacem-media.min.js +2 -2
- package/dist/js/pacem-networking.js +2 -2
- package/dist/js/pacem-networking.min.js +2 -2
- package/dist/js/pacem-numerical.d.ts +2 -2
- package/dist/js/pacem-numerical.js +2 -2
- package/dist/js/pacem-numerical.min.js +2 -2
- package/dist/js/pacem-plus.d.ts +2 -2
- package/dist/js/pacem-plus.js +2 -2
- package/dist/js/pacem-plus.min.js +2 -2
- package/dist/js/pacem-scaffolding.d.ts +2 -2
- package/dist/js/pacem-scaffolding.js +2 -2
- package/dist/js/pacem-scaffolding.min.js +2 -2
- package/dist/js/pacem-ui.d.ts +2 -2
- package/dist/js/pacem-ui.js +2 -2
- package/dist/js/pacem-ui.min.js +2 -2
- package/dist/js/swagger-types.d.ts +2 -2
- package/package.json +2 -2
package/dist/js/azure-maps.d.ts
CHANGED
package/dist/js/pacem-2d.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
/// <reference path="pacem-core.d.ts" />
|
|
7
7
|
declare namespace Pacem.Drawing {
|
package/dist/js/pacem-2d.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
7
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
package/dist/js/pacem-2d.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
var Pacem,__decorate=this&&this.__decorate||function(t,e,i,r){var a,s=arguments.length,n=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(n=(s<3?a(n):s>3?a(e,i,n):a(e,i))||n);return s>3&&n&&Object.defineProperty(e,i,n),n},__classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(t,e,i,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(t,i):a?a.value=i:e.set(t,i),i},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(t,e,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(t):r?r.value:e.get(t)};!function(t){!function(e){var i;function r(e){return!t.Utils.isNull(e)&&"stage"in e}function a(t){return r(t)}e.isDrawable=r,e.isUiObject=a;e.PresentationState=class PresentationState{static combine(e,i,r=null){var a,s,n,o,l,c,h,d;return{opacity:(null!==(a=e.opacity)&&void 0!==a?a:1)*(null!==(s=i.opacity)&&void 0!==s?s:1),transformMatrix:null!=r?r:t.Matrix2D.multiply(i.transformMatrix,e.transformMatrix),dashArray:null!==(n=e.dashArray)&&void 0!==n?n:i.dashArray,fill:null!==(o=e.fill)&&void 0!==o?o:i.fill,lineCap:null!==(l=e.lineCap)&&void 0!==l?l:i.lineCap,lineJoin:null!==(c=e.lineJoin)&&void 0!==c?c:i.lineJoin,lineWidth:null!==(h=e.lineWidth)&&void 0!==h?h:i.lineWidth,stroke:null!==(d=e.stroke)&&void 0!==d?d:i.stroke}}},e.isPresentationObject=function(t){return a(t)&&("fill"in t||"transformMatrix"in t||"stroke"in t||"lineJoin"in t||"dashArray"in t||"lineWidth"in t||"opacity"in t||"lineCap"in t)},e.isShape=function(t){return a(t)&&"pathData"in t},e.isGroup=function(e){return a(e)&&"childDrawables"in e&&!t.Utils.isNullOrEmpty(e.childDrawables)},e.isText=function(t){return a(t)&&"text"in t&&"string"==typeof t.text},e.isImage=function(t){return a(t)&&"src"in t&&"string"==typeof t.src};class UI2DEvent extends t.CustomUIEvent{constructor(t,e,r,a){super(t,e,r),i.set(this,void 0),__classPrivateFieldSet(this,i,a,"f")}get transformMatrix(){return __classPrivateFieldGet(this,i,"f")}project(e={x:this.screenX,y:this.screenY}){return t.Matrix2D.multiply(e,__classPrivateFieldGet(this,i,"f"))}}i=new WeakMap,e.UI2DEvent=UI2DEvent;e.Shape=class Shape{static empty(){return{pathData:"",vertices:[],boundingRect:{x:0,y:0,width:0,height:0}}}};e.DragEvent=class DragEvent extends UI2DEvent{};e.DrawableEvent=class DrawableEvent extends UI2DEvent{constructor(t,e,i,r){super(t,{detail:e,bubbles:!0,cancelable:!0},i,r)}};e.StageEvent=class StageEvent extends UI2DEvent{constructor(t,e,i,r=e.transformMatrix){super(t,{detail:e,bubbles:!0,cancelable:!0},i,r)}}}(t.Drawing||(t.Drawing={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(i){var r,a,s;i.TAG_MIDDLE_NAME="2d",i.TWO_PI=2*Math.PI;const n=Math.PI/180;class Pacem2DAdapterElement extends e.PacemEventTarget{constructor(){super(...arguments),this.DefaultShapeValues={stroke:"#000",lineWidth:1,fill:"#fff"}}snapshotElement(e,i,r,a){const s=!t.Utils.isNullOrEmpty(i),n=null!=r?r:s?"image/jpeg":null,o=null!=a?a:s?.9:null;return t.Utils.snapshotElement(e,i,n,o)}}i.Pacem2DAdapterElement=Pacem2DAdapterElement;class DrawableElement extends e.PacemCrossItemsContainerElement{validate(t){return!1}findContainer(){return this.parent||this.stage}get stage(){return this._scene=this._scene||t.CustomElementUtils.findAncestorOfType(this,i.Pacem2DElement)}get parent(){return this._drawableParent=this._drawableParent||t.CustomElementUtils.findAncestor(this,(t=>t instanceof DrawableElement))}disconnectedCallback(){delete this._scene,delete this._drawableParent,super.disconnectedCallback()}propertyChangedCallback(e,i,r,a){if(super.propertyChangedCallback(e,i,r,a),"hide"===e){const e=this.stage;t.Utils.isNull(e)||e.draw(this)}}}__decorate([t.Watch({emit:!1,reflectBack:!0,converter:t.PropertyConverters.String})],DrawableElement.prototype,"tag",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Boolean})],DrawableElement.prototype,"inert",void 0),i.DrawableElement=DrawableElement;class UiElement extends DrawableElement{constructor(){super(...arguments),r.set(this,t.Matrix2D.identity)}viewActivatedCallback(){super.viewActivatedCallback(),this._updateTransformMatrix()}propertyChangedCallback(e,i,r,a){if(super.propertyChangedCallback(e,i,r,a),!a)switch(e){case"rotate":case"scaleX":case"scaleY":case"translateX":case"translateY":this._updateTransformMatrix();case"opacity":t.Utils.isNull(this.stage)||this.stage.draw(this)}}_updateTransformMatrix(){var t,e,i,a,s;let o=n*(null!==(t=this.rotate)&&void 0!==t?t:0),l=Math.cos(o),c=Math.sin(o),h=(null!==(e=this.scaleX)&&void 0!==e?e:1)*l,d=-c,m=c,p=(null!==(i=this.scaleY)&&void 0!==i?i:1)*l,u=null!==(a=this.translateX)&&void 0!==a?a:0,v=null!==(s=this.translateY)&&void 0!==s?s:0;__classPrivateFieldSet(this,r,{a:h,b:d,c:m,d:p,e:u,f:v},"f")}get transformMatrix(){const t=__classPrivateFieldGet(this,r,"f");return{a:t.a,b:t.b,c:t.c,d:t.d,e:t.e,f:t.f}}}r=new WeakMap,__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],UiElement.prototype,"rotate",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],UiElement.prototype,"scaleX",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],UiElement.prototype,"scaleY",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],UiElement.prototype,"translateX",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],UiElement.prototype,"translateY",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],UiElement.prototype,"opacity",void 0),i.UiElement=UiElement;class PresentationElement extends UiElement{propertyChangedCallback(e,i,r,a){if(super.propertyChangedCallback(e,i,r,a),!a)switch(e){case"stroke":case"lineWidth":case"lineJoin":case"lineCap":case"dashArray":case"fill":t.Utils.isNull(this.stage)||this.stage.draw(this)}}}__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],PresentationElement.prototype,"stroke",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],PresentationElement.prototype,"fill",void 0),__decorate([t.Watch({emit:!1,converter:{convert:t=>null==t?void 0:t.split(",").map((t=>parseInt(t))).filter((t=>!Number.isNaN(t))),convertBack:t=>null==t?void 0:t.join(",")}})],PresentationElement.prototype,"dashArray",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PresentationElement.prototype,"lineWidth",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],PresentationElement.prototype,"lineJoin",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],PresentationElement.prototype,"lineCap",void 0),i.PresentationElement=PresentationElement;class ShapeElement extends PresentationElement{constructor(){super(...arguments),a.set(this,void 0),s.set(this,void 0)}propertyChangedCallback(e,i,r,a){if(super.propertyChangedCallback(e,i,r,a),!a&&"data"===e)t.Utils.isNull(this.stage)||this.stage.draw(this)}viewActivatedCallback(){super.viewActivatedCallback(),this.recomputeShape()}recomputeShape(){const{pathData:t,vertices:e,boundingRect:i}=this.getShapeGeometry();__classPrivateFieldSet(this,s,e,"f"),__classPrivateFieldSet(this,a,i,"f"),this.data=t}get pathData(){return this.data}get boundingRect(){return __classPrivateFieldGet(this,a,"f")}get vertices(){return __classPrivateFieldGet(this,s,"f")}}a=new WeakMap,s=new WeakMap,__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],ShapeElement.prototype,"data",void 0),i.ShapeElement=ShapeElement}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){var i;let r=i=class PacemCircleElement extends e.ShapeElement{propertyChangedCallback(t,e,i,r){if(super.propertyChangedCallback(t,e,i,r),!r)switch(t){case"center":case"radius":this.recomputeShape()}}getPathData(){const e=this.radius,r=this.center;return t.Utils.isNull(r)||t.Utils.isNull(e)?null:i.getPathData(r,e)}getShapeGeometry(){var t,e;const i=null!==(t=this.center)&&void 0!==t?t:{x:0,y:0},r=null!==(e=this.radius)&&void 0!==e?e:0,a=2*r,s=i.x,n=i.y;return{pathData:this.getPathData(),boundingRect:{x:s-r,y:n-r,width:a,height:a},vertices:[]}}static getPathData(t={x:NaN,y:NaN},i=NaN){return e.PacemEllipseElement.getPathData(t,i,i)}};__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Point})],r.prototype,"center",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],r.prototype,"radius",void 0),r=i=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-circle"})],r),e.PacemCircleElement=r}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){var i;let r=i=class PacemEllipseElement extends e.ShapeElement{propertyChangedCallback(t,e,i,r){if(super.propertyChangedCallback(t,e,i,r),!r)switch(t){case"center":case"rx":case"ry":this.recomputeShape()}}getPathData(){const e=this.rx,r=this.ry,a=this.center;return t.Utils.isNull(a)||t.Utils.isNull(e)||t.Utils.isNull(r)?null:i.getPathData(a,e,r)}getShapeGeometry(){var t,e,i;const r=null!==(t=this.center)&&void 0!==t?t:{x:0,y:0},a=null!==(e=this.rx)&&void 0!==e?e:0,s=null!==(i=this.ry)&&void 0!==i?i:0,n=r.x,o=r.y;return{pathData:this.getPathData(),boundingRect:{x:n-a,y:o-s,width:2*a,height:2*s},vertices:[]}}static getPathData(t={x:NaN,y:NaN},e=NaN,i=NaN){const r=2*e;return`M ${t.x} ${t.y} m ${-e},0 a ${e},${i} 0 1,1 ${r},0 a ${e},${i} 0 1,1 ${-r},0`}};__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Point})],r.prototype,"center",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],r.prototype,"rx",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],r.prototype,"ry",void 0),r=i=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-ellipse"})],r),e.PacemEllipseElement=r}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){var i;let r=class PacemGroupElement extends e.PresentationElement{constructor(){super(...arguments),i.set(this,[])}validate(t){return t instanceof e.DrawableElement&&t.parent===this}get childDrawables(){return __classPrivateFieldGet(this,i,"f")}propertyChangedCallback(e,r,a,s){switch(super.propertyChangedCallback(e,r,a,s),e){case"items":case"datasource":__classPrivateFieldSet(this,i,a||[],"f");const e=this.stage;t.Utils.isNull(e)||e.draw(this,!0)}}};i=new WeakMap,__decorate([t.Watch({emit:!1})],r.prototype,"datasource",void 0),r=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-group"})],r),e.PacemGroupElement=r}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){let i=class PacemImageElement extends e.UiElement{propertyChangedCallback(e,i,r,a){if(!a)switch(e){case"src":case"x":case"y":case"width":case"height":t.Utils.isNull(this.stage)||this.stage.draw(this)}}};__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],i.prototype,"src",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],i.prototype,"x",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],i.prototype,"y",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],i.prototype,"width",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],i.prototype,"height",void 0),i=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-image"})],i),e.PacemImageElement=i}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){var i;let r=i=class PacemLineElement extends e.ShapeElement{propertyChangedCallback(t,e,i,r){if(super.propertyChangedCallback(t,e,i,r),!r)switch(t){case"from":case"to":this.recomputeShape()}}getShapeGeometry(){const e=this.from,i=this.to;if(t.Utils.isNull(e)||t.Utils.isNull(i))return t.Drawing.Shape.empty();const r=e.x,a=e.y,s=i.x,n=i.y,o={x:Math.min(r,s),y:Math.min(a,n),width:Math.abs(r-s),height:Math.abs(a-n)};return{pathData:this.getPathData(),vertices:[e,i],boundingRect:o}}getPathData(){const e=this.from,r=this.to;return t.Utils.isNull(e)||t.Utils.isNull(r)?null:i.getPathData(e,r)}static getPathData(t={x:NaN,y:NaN},e={x:NaN,y:NaN}){return`M ${t.x} ${t.y} L ${e.x} ${e.y}`}};__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Point})],r.prototype,"from",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Point})],r.prototype,"to",void 0),r=i=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-line"})],r),e.PacemLineElement=r}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){let i=class PacemPathElement extends e.ShapeElement{constructor(){super(...arguments),this.getPathData=()=>this.d}propertyChangedCallback(t,e,i,r){super.propertyChangedCallback(t,e,i,r),"d"===t&&this.recomputeShape()}getShapeGeometry(){return{pathData:this.getPathData(),boundingRect:null,vertices:[]}}};__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],i.prototype,"d",void 0),i=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-path"})],i),e.PacemPathElement=i}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){var i,r;let a=r=class PacemPolygonElement extends e.ShapeElement{constructor(){super(...arguments),i.set(this,[])}propertyChangedCallback(t,e,i,r){if(super.propertyChangedCallback(t,e,i,r),!r)switch(t){case"radius":case"starIndent":case"sides":this.data=this.getPathData()}}get vertices(){return __classPrivateFieldGet(this,i,"f")}getPathData(){const e=this.sides,i=this.radius,a=this.center;return t.Utils.isNull(e)||t.Utils.isNull(i)?null:r.getPathData(a,i,e,this.starIndent)}getShapeGeometry(){var e,i,a;const s=null!==(e=this.center)&&void 0!==e?e:{x:0,y:0},n=null!==(i=this.radius)&&void 0!==i?i:0,o=null!==(a=this.sides)&&void 0!==a?a:3,l=this.starIndent;return o<3?t.Drawing.Shape.empty():r.getShapeGeometry(s,n,o,l)}static getShapeGeometry(t,e,i,r=0){const a={x:t.x,y:t.y-e};let s=`M ${a.x} ${a.y}`;const n=[a],o=2*Math.PI/i,l=.5*o,c=r>0,h=e*Math.cos(l);for(let a=1;a<i;a++){const i=a*o,d=t.x+Math.sin(i)*e,m=t.y-Math.cos(i)*e;if(c){const e=h*(1-r),a=i-l,o=t.x+Math.sin(a)*e,c=t.y-Math.cos(a)*e;s+=` L ${o} ${c} L ${d} ${m}`,n.push({x:o,y:c})}else s+=` L ${d} ${m}`;n.push({x:d,y:m})}if(c){const e=h*(1-r),i=2*Math.PI-l,a=t.x+Math.sin(i)*e,o=t.y-Math.cos(i)*e;s+=` L ${a} ${o}`,n.push({x:a,y:o})}n.push(a);const d=2*e;return{pathData:s+" Z",vertices:n,boundingRect:{x:a.x-e,y:a.y,width:d,height:d}}}static getPathData(t,e,i,a=0){const{pathData:s}=r.getShapeGeometry(t,e,i,a);return s}};i=new WeakMap,__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],a.prototype,"sides",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],a.prototype,"radius",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Point})],a.prototype,"center",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],a.prototype,"starIndent",void 0),a=r=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-polygon"})],a),e.PacemPolygonElement=a}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){var i;function r(t){var e;const i=t[2],r=null!==(e=t[4])&&void 0!==e?e:i,s="cut"===t[6]?o.Cut:o.Rounded;return{rx:a(i),ry:a(r),type:s}}function a(t){return{value:parseFloat(t),unit:t.endsWith("%")?"pct":"u"}}function s(t){return`${t.value}${"pct"===t.unit?"%":""}`}const n=/(([\d\.]+%?)(\s*,?\s*([\d\.]+%?))?(\s+(cut|round))?)/g;let o;!function(t){t.Rounded="rounded",t.Cut="cut"}(o=e.CornerType||(e.CornerType={}));let l=i=class PacemRectElement extends e.ShapeElement{propertyChangedCallback(t,e,i,r){super.propertyChangedCallback(t,e,i,r),r||"x"!==t&&"y"!==t&&"w"!==t&&"h"!==t&&"r"!==t&&"cornerType"!==t||this.recomputeShape()}getPathData(){const e=this.x,r=this.y,a=this.w,s=this.h,n=this.r;return t.Utils.isNull(e)||t.Utils.isNull(r)||t.Utils.isNull(a)||t.Utils.isNull(s)?null:i.getPathData(e,r,a,s,n)}getShapeGeometry(){const t=this.x,e=this.y,i=t+this.w,r=e+this.h;return{pathData:this.getPathData(),vertices:[{x:t,y:e},{x:i,y:e},{x:i,y:r},{x:t,y:r}],boundingRect:{x:t,y:e,width:this.w,height:this.h}}}static getPathData(e=NaN,i=NaN,r=NaN,a=NaN,s=null){if(t.Utils.isNullOrEmpty(s))return`M ${e} ${i} h ${r} v ${a} h ${-r} z`;t.Utils.isArray(s)||(s=[s,s,s,s]);const n=s[0],o=s[1],l=s[2],c=s[3],h=t=>"pct"===t.unit?.01*t.value*r:t.value,d=t=>"pct"===t.unit?.01*t.value*a:t.value,m=h(n.rx),p=d(n.ry),u=h(o.rx),v=d(o.ry),g=h(l.rx),_=d(l.ry),f=h(c.rx),y=d(c.ry);let w=`M ${e+m},${i+p}`;if("cut"===n.type)w+=` l ${m},${-p}`;else w+=` a ${m} ${p} 0 0 1 ${m} ${-p}`;if(w+=" h "+(r-m-u),"cut"===o.type)w+=` l ${u},${v}`;else w+=` a ${u} ${v} 0 0 1 ${u} ${v}`;if(w+=" v "+(a-v-_),"cut"===l.type)w+=` l ${-g},${_}`;else w+=` a ${g} ${_} 0 0 1 ${-g} ${_}`;if(w+=" h "+-(r-g-f),"cut"===c.type)w+=` l ${-f},${-y}`;else w+=` a ${f} ${y} 0 0 1 ${-f} ${-y}`;return w+" z"}};__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],l.prototype,"x",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],l.prototype,"y",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],l.prototype,"w",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],l.prototype,"h",void 0),__decorate([t.Watch({emit:!1,converter:{convert:t=>function(t){let e;const i=[];for(;e=n.exec(t);)i.push(e);switch(i.length){case 1:const t=r(i[0]);return[t,t,t,t];case 4:return[r(i[0]),r(i[1]),r(i[2]),r(i[3])];default:return null}}(t),convertBack:t=>function(t){const e=t[0],i=t[1],r=t[2],a=t[3];return`${s(e.rx)},${s(e.ry)} ${s(i.rx)},${s(i.ry)} ${s(r.rx)},${s(r.ry)} ${s(a.rx)},${s(a.ry)}`}(t)}})],l.prototype,"r",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],l.prototype,"cornerType",void 0),l=i=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-rect"})],l),e.PacemRectElement=l}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(i){var r,a;const s=/^\s*[xX]\s*([Mm](in|ax|id))\s*[yY]\s*([Mm](in|ax|id))(\s+(none|slice|meet))?\s*$/,n={convert:t=>{const e=s.exec(t);return e&&e.length>=4?{x:e[1].toLowerCase(),y:e[3].toLowerCase(),slice:"slice"===e[6]}:"none"},convertBack:e=>t.Utils.isNull(e)||"string"==typeof e?"none":`xM${e.x.substr(1)}YM${e.y.substr(1)} ${e.slice?"slice":"meet"}`},o={panControl:!0,zoomControl:!0,panModifiers:[t.EventKeyModifier.AltKey],zoomModifiers:[t.EventKeyModifier.AltKey]};let l=class Pacem2DElement extends e.PacemItemsContainerElement{constructor(){super(...arguments),r.set(this,void 0),a.set(this,t.Matrix2D.identity),this._options=o,this._resizeHandler=e=>{this._size={width:e.detail.width,height:e.detail.height};const i=this.adapter;t.Utils.isNull(i)||this._invalidateSize()},this._zoomHandler=e=>{const i=this._options;if(i.zoomControl&&t.CustomEventUtils.matchModifiers(e,i.zoomModifiers)){t.avoidHandler(e);const i=1+.1*(e.deltaY<0?-1:1),r=t.Utils.offsetRect(e.currentTarget),a={x:e.clientX,y:e.clientY};this._zoom(i,r,a)}},this._panHandler=e=>{const i=this._panningStart,r=this._getPanPoint(e);if(!t.Utils.isNullOrEmpty(i&&i.point)&&!t.Utils.isNull(r)){t.avoidHandler(e);const a=i.factor,s=i.box,n=i.point;this.viewbox={x:s.x-a*(r.x-n.x),y:s.y-a*(r.y-n.y),width:s.width,height:s.height}}},this._panStartHandler=e=>{if(!this._options.panControl)return;const i=this._size,r=this.viewbox||{x:0,y:0,width:i.width,height:i.height},a=this._getPanPoint(e);if(a){t.avoidHandler(e),this._stage.style.pointerEvents="none";const s=this._getActualAspectRatio(),n=r.width/i.width,o=r.height/i.height,l=s.slice?Math.min(n,o):Math.max(n,o);this._panningStart={point:a,box:r,factor:l}}},this._panEndHandler=t=>{this._stage.style.pointerEvents="",this._panningStart=null}}get stage(){return this._stage}snapshot(e){const i=this.adapter;return t.Utils.isNull(i)?Promise.resolve(null):i.snapshot(this,e)}get transformMatrix(){return __classPrivateFieldGet(this,a,"f")}_transformMatrixScale(){const e=t.Utils.extend(this._size||t.Utils.offsetRect(this._stage),{x:0,y:0});var i=__classPrivateFieldGet(this,r,"f")||{x:0,y:0,width:e.width,height:e.height};const a=this.viewbox||i,s=this.aspectRatio||"none",n="none"===s?"stretch":s.slice?"cover":"contain";return t.Rect.findTransform(a,i,n).a}validate(e){return e instanceof i.DrawableElement&&t.Utils.isNull(e.parent)}draw(e,i=!1){const r=this.adapter;if(!this.disabled&&!t.Utils.isNull(r)){let t=new CustomEvent("predraw",{cancelable:!0});this.dispatchEvent(t),t.defaultPrevented||(r.draw(this,e,i),this.dispatchEvent(new CustomEvent("draw")))}}_drawDebounced(e,i=!1){!t.Utils.isNull(e)&&t.Drawing.isGroup(e)?this.draw(e,i):this.draw(e)}requestDraw(t,e=!1){this._drawDebounced(t,e)}_buildUpDatasourceFromDOM(){this.datasource=(this.items||[]).slice()}_getActualAspectRatio(){const t=this.aspectRatio||"none";return{x:"none"===t?"mid":t.x,y:"none"===t?"mid":t.y,slice:"none"!==t&&t.slice}}_zoomFromValue(e){const i=this._size;if(t.Utils.isNull(i))return;const a=t.Utils.extend(i,{x:0,y:0}),s=__classPrivateFieldGet(this,r,"f")||{x:0,y:0,width:i.width,height:i.height},n=this.viewbox||s,o=this.aspectRatio||"none",l="none"===o?"stretch":o.slice?"cover":"contain",c=t.Rect.findTransform(n,a,l),h=t.Rect.findTransform(s,a,l),d=c.a/(h.a*e);this._zoom(d)}_zoom(e,i,r){t.Utils.isNull(i)&&(i=t.Utils.offsetRect(this._stage)),t.Utils.isNull(r)&&(r={x:i.x+.5*i.width,y:i.y+.5*i.height});const a=this._size,s=this.viewbox||{x:0,y:0,width:a.width,height:a.height},n=Math.min(s.width,s.height),o=n*e,l=n*e;if(o>0&&l>0){const t=this._getActualAspectRatio(),e=t.x,a=t.y,n=t.slice,c=s.width/s.height,h=n?Math.max(i.width,i.height):Math.min(i.width,i.height);let d,m;switch(e){case"mid":d=(o-s.width)*(r.x-i.x-.5*(i.width-h))/(h*c);break;case"max":d=(o-s.width)*(r.x-i.x-(i.width-h))/(h*c);break;default:d=(o-s.width)*(r.x-i.x)/(h*c)}switch(a){case"mid":m=(l-s.height)*(r.y-i.y-.5*(i.height-h))/(h*c);break;case"max":m=(l-s.height)*(r.y-i.y-(i.height-h))/(h*c);break;default:m=(l-s.height)*(r.y-i.y)/(h*c)}const p=s.x-d,u=s.y-m;this.viewbox={x:p,y:u,width:o,height:l}}}_getPanPoint(e){const i=this._options;return e instanceof MouseEvent&&t.CustomEventUtils.matchModifiers(e,i.panModifiers)?t.CustomEventUtils.getEventCoordinates(e).page:null}_invalidateSize(){this.adapter.invalidateSize(this,this._size);const i=__classPrivateFieldGet(this,a,"f");__classPrivateFieldSet(this,a,this.adapter.getTransformMatrix(this),"f"),this.dispatchEvent(new t.PropertyChangeEvent({propertyName:"transformMatrix",currentValue:__classPrivateFieldGet(this,a,"f"),oldValue:i})),this.zoom=this._transformMatrixScale(),this.dispatchEvent(new e.ResizeEvent(this._size))}viewActivatedCallback(){super.viewActivatedCallback();const e=this.adapter;t.Utils.isNull(e)||(e.initialize(this),this._invalidateSize(),this._drawDebounced());const i=this._resize;i.addEventListener(t.Components.ResizeEventName,this._resizeHandler,!1);const r=this._stage;i.target=r;const a={capture:!1,passive:!0};r.addEventListener("wheel",this._zoomHandler,!1),r.addEventListener("mousedown",this._panStartHandler,!1),r.addEventListener("touchstart",this._panStartHandler,a),window.addEventListener("mousemove",this._panHandler,!1),window.addEventListener("mouseup",this._panEndHandler,!1),window.addEventListener("touchmove",this._panHandler,a),window.addEventListener("touchend",this._panEndHandler,a)}propertyChangedCallback(e,i,a,s){var n;switch(super.propertyChangedCallback(e,i,a,s),e){case"adapter":t.Utils.isNull(i)||i.dispose(this),t.Utils.isNull(a)||(a.initialize(this),this._invalidateSize(),this._drawDebounced());break;case"aspectRatio":t.Utils.isNull(this.adapter)||this._invalidateSize();break;case"viewbox":t.Utils.isNull(this.adapter)||this._invalidateSize(),__classPrivateFieldSet(this,r,null!==(n=__classPrivateFieldGet(this,r,"f"))&&void 0!==n?n:this.viewbox||null,"f");break;case"items":this._buildUpDatasourceFromDOM();break;case"zoom":a!==this._transformMatrixScale()&&this._zoomFromValue(a);break;case"options":this._options=t.Utils.extend({},o,a||{});break;case"disabled":case"datasource":this._drawDebounced()}}disconnectedCallback(){const e=this._resize,i=this._stage;t.Utils.isNull(e)||e.removeEventListener(t.Components.ResizeEventName,this._resizeHandler,!1),t.Utils.isNull(i)||(i.removeEventListener("wheel",this._zoomHandler,!1),i.removeEventListener("mousedown",this._panStartHandler,!1),i.removeEventListener("touchstart",this._panStartHandler),window.removeEventListener("mousemove",this._panHandler,!1),window.removeEventListener("mouseup",this._panEndHandler,!1),window.removeEventListener("touchmove",this._panHandler),window.removeEventListener("touchend",this._panEndHandler)),t.Utils.isNull(this.adapter)||this.adapter.dispose(this),super.disconnectedCallback()}};r=new WeakMap,a=new WeakMap,__decorate([t.Watch({converter:t.PropertyConverters.Element})],l.prototype,"adapter",void 0),__decorate([t.Watch({reflectBack:!0,converter:t.PropertyConverters.Rect})],l.prototype,"viewbox",void 0),__decorate([t.Watch({emit:!1,reflectBack:!0,converter:n})],l.prototype,"aspectRatio",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],l.prototype,"datasource",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],l.prototype,"options",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Number})],l.prototype,"zoom",void 0),__decorate([t.ViewChild("."+t.PCSS+"-2d")],l.prototype,"_stage",void 0),__decorate([t.ViewChild(t.P+"-resize")],l.prototype,"_resize",void 0),__decorate([t.Debounce(!0)],l.prototype,"_drawDebounced",null),l=__decorate([t.CustomElement({tagName:t.P+"-"+i.TAG_MIDDLE_NAME,shadow:t.Defaults.USE_SHADOW_ROOT,template:`<${t.P}-resize></${t.P}-resize><div class="${t.PCSS}-2d"></div><${t.P}-content></${t.P}-content>`})],l),i.Pacem2DElement=l}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){let i=class PacemTextElement extends e.UiElement{propertyChangedCallback(e,i,r,a){if(!a)switch(e){case"text":case"color":case"fontFamily":case"fontSize":case"anchor":t.Utils.isNull(this.stage)||this.stage.draw(this)}}};__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],i.prototype,"text",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],i.prototype,"color",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],i.prototype,"fontFamily",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],i.prototype,"fontSize",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Point})],i.prototype,"anchor",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],i.prototype,"textAnchor",void 0),i=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-text"})],i),e.PacemTextElement=i}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){e.AdapterUtils=class AdapterUtils{static stageDispatch(e,i,r){e instanceof EventTarget&&e.dispatchEvent(new t.Drawing.StageEvent("stage"+i,e,r,e.transformMatrix))}static itemDispatch(e,i,r){if(!t.Utils.isNull(e)){var a,s,n;r instanceof Event?s=r:a={item:e,offset:r},"string"==typeof i?n=i:(n=i.type,s=i.originalEvent);const l=e.stage.transformMatrix,c=()=>r instanceof Event?new t.Drawing.DrawableEvent(n,e,s,l):new t.Drawing.DragEvent(n,{detail:a,cancelable:n===t.UI.DragDropEventType.Init||n===t.UI.DragDropEventType.Drag},s,l),h=r instanceof Event?new t.Drawing.DrawableEvent("item"+n,e,s,l):new t.Drawing.DragEvent("item"+n,{detail:a,cancelable:n===t.UI.DragDropEventType.Init||n===t.UI.DragDropEventType.Drag},s,l);var o=!1;if(e instanceof EventTarget){const t=c();e.dispatchEvent(t),o=t.defaultPrevented}return e.stage.dispatchEvent(h),o||h.defaultPrevented}return!1}}}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){var i;const r="pacem:2d-canvas-scene",a="pacem:2d-parent-matrix",s=t.CustomElementUtils.setAttachedPropertyValue,n=t.CustomElementUtils.getAttachedPropertyValue;function o(e){return"none"===e||t.Utils.isNullOrEmpty(e)}function l(e,i){return t.Utils.isNull(e)?i:e}let c=class PacemCanvasAdapterElement extends e.Pacem2DAdapterElement{constructor(){super(...arguments),i.set(this,void 0),this._pointer={page:{x:0,y:0},screen:{x:0,y:0},client:{x:0,y:0}},this._dragInitHandler=i=>{var r;const s=this._hitTarget;if(t.Utils.isNull(s)||!t.Drawing.isUiObject(s)||!s.draggable)return void i.preventDefault();const o=i.detail,l=s,c=null!==(r=s.transformMatrix)&&void 0!==r?r:t.Matrix2D.identity,h=n(s,a,t.Matrix2D.identity);o.data={item:l,initialTransformMatrix:c,parentMatrix:h};e.AdapterUtils.itemDispatch(l,i,{x:0,y:0})&&i.preventDefault()},this._draggingHandler=i=>{t.avoidHandler(i),this._dragging=!0;const r=i.detail,a=r.data,s=r.currentPosition.x-r.origin.x,n=r.currentPosition.y-r.origin.y,o={x:s*a.parentMatrix.a+a.initialTransformMatrix.e,y:n*a.parentMatrix.d+a.initialTransformMatrix.f},l=a.item.stage.transformMatrix;if(!e.AdapterUtils.itemDispatch(a.item,i,{x:s*l.a+l.e,y:n*l.d+l.f}))if(a.item instanceof t.Components.Drawing.UiElement)a.item.translateX=o.x,a.item.translateY=o.y;else{const e=a.initialTransformMatrix,i={a:e.a,b:e.b,c:e.c,d:e.d,e:o.x,f:o.y};t.Utils.extend(a.item,{transformMatrix:i})}},this._dragEndHandler=t=>{this._dragging=!1;const i=t.detail.data,r=i.item.transformMatrix;e.AdapterUtils.itemDispatch(i.item,t,{x:r.e,y:r.f})},this._mousemoveHandler=i=>{this._scopeEvent=i,this._pointer=t.CustomEventUtils.getEventCoordinates(i);const a=i.srcElement,s=n(a,r);this._requestDraw(s),this._dragging||t.Utils.isNull(this._hitTarget)||e.AdapterUtils.stageDispatch(s,"move",i)},this._mouseDownUpHandler=i=>{this._scopeEvent=i,this._pointer=t.CustomEventUtils.getEventCoordinates(i);const a=i.target;if(a instanceof HTMLCanvasElement){const s=n(a,r),o=this._hitTarget,l=i.type.replace(/^(mouse|touch)/,""),c="end"===l?"click":l;t.Utils.isNull(o)||o.stage!==s?e.AdapterUtils.stageDispatch(s,c,i):e.AdapterUtils.itemDispatch(this._hitTarget,c,i)}},this._scenes=new WeakMap,this._handles=new WeakMap}snapshot(t,e,i,r){const a=this._scenes;if(a.has(t)){const s=a.get(t).context.canvas;return this.snapshotElement(s,e,i,r)}return Promise.resolve(null)}getCanvas(t){const e=this._scenes;if(e.has(t)){return e.get(t).context.canvas}return null}_getScreenInverseMatrix(e,i){return t.Matrix2D.invert({a:e.a,b:e.b,c:e.c,d:e.d,e:e.e+i.x,f:e.f+i.y})}getTransformMatrix(e){const i=this._scenes;return i.has(e)?i.get(e).screenInverseMatrix:t.Matrix2D.identity}viewActivatedCallback(){super.viewActivatedCallback();const e=this._dragger=document.createElement(t.P+"-drag-drop");e.mode=t.UI.DragDataMode.Copy,e.dropBehavior=t.UI.DropBehavior.None,e.spillBehavior=t.UI.DropTargetMissedBehavior.None;const i=document.createElement("div");i.hidden=!0,e.floater=i;t.CustomElementUtils.findAncestorShell(this).appendChild(e),e.addEventListener(t.UI.DragDropEventType.Init,this._dragInitHandler,!1),e.addEventListener(t.UI.DragDropEventType.Drag,this._draggingHandler,!1),e.addEventListener(t.UI.DragDropEventType.End,this._dragEndHandler,!1)}disconnectedCallback(){const e=this._dragger;t.Utils.isNull(e)||(e.removeEventListener(t.UI.DragDropEventType.Init,this._dragInitHandler,!1),e.removeEventListener(t.UI.DragDropEventType.Drag,this._draggingHandler,!1),e.removeEventListener(t.UI.DragDropEventType.End,this._dragEndHandler,!1),e.remove()),super.disconnectedCallback()}invalidateSize(e,i){const r=this._scenes;if(!t.Utils.isNull(e)&&!t.Utils.isNullOrEmpty(i)&&r.has(e)){const a=r.get(e),s=a.context;s.canvas.width=i.width,s.canvas.height=i.height;const n=a.offset=t.Utils.offsetRect(s.canvas),o={x:0,y:0,width:i.width,height:i.height},l=e.aspectRatio,c=e.viewbox;if(t.Utils.isNullOrEmpty(c))a.transformMatrix=t.Matrix2D.identity;else{let e="contain",i="center",r="middle";if("object"==typeof l){switch(e=l.slice?"cover":"contain",l.x){case"min":i="left";break;case"max":i="right"}switch(l.y){case"min":r="top";break;case"max":r="bottom"}}const s=t.Rect.findTransform({x:0,y:0,width:c.width,height:c.height},o,e,i,r),h=t.Matrix2D.translate(s,{x:-s.a*c.x,y:-s.a*c.y});a.transformMatrix=h,a.screenInverseMatrix=this._getScreenInverseMatrix(h,n)}}this._requestDraw(e)}getHitTarget(e){const i=this._hitTarget;return t.Utils.isNull(i)||i.stage!==e?null:i}initialize(e){if(t.Utils.isNull(e))throw"Provided scene is null or undefined.";const i=this._scenes,a=this._dragger;if(i.has(e)){const r=i.get(e).context.canvas;return t.Utils.isNull(a)||a.register(r),r}const n=e.stage;n.innerHTML="";const o=document.createElement("canvas");s(o,r,e);const l=o.getContext("2d");return o.addEventListener("mousemove",this._mousemoveHandler,!1),o.addEventListener("touchstart",this._mouseDownUpHandler,{passive:!0}),o.addEventListener("touchmove",this._mouseDownUpHandler,{passive:!0}),o.addEventListener("touchend",this._mouseDownUpHandler,{passive:!0}),o.addEventListener("click",this._mouseDownUpHandler,!1),o.addEventListener("mousedown",this._mouseDownUpHandler,!1),o.addEventListener("mouseup",this._mouseDownUpHandler,!1),n.appendChild(o),i.set(e,{context:l,transformMatrix:t.Matrix2D.identity,offset:t.Utils.offsetRect(o),screenInverseMatrix:t.Matrix2D.identity}),t.Utils.isNull(a)||a.register(o),o}dispose(e){const i=this._scenes;if(i.has(e)){var r=i.get(e).context.canvas;const a=this._dragger;t.Utils.isNull(a)||a.unregister(r),r.removeEventListener("click",this._mouseDownUpHandler,!1),r.removeEventListener("touchend",this._mouseDownUpHandler,!1),r.removeEventListener("mousedown",this._mouseDownUpHandler,!1),r.removeEventListener("mouseup",this._mouseDownUpHandler,!1),r.removeEventListener("touchstart",this._mouseDownUpHandler),r.removeEventListener("mousemove",this._mousemoveHandler,!1),r.remove(),i.delete(e)}}_requestDraw(t){const e=this._handles;e.has(t)&&cancelAnimationFrame(e.get(t));e.set(t,(()=>(this.draw(t),requestAnimationFrame((()=>{}))))())}draw(e){const r=this._scenes,a=this._handles;if(!t.Utils.isNull(e)){if(e.adapter!==this)return void(r.has(e)&&(r.delete(e),a.get(e)));if(!r.has(e))return void this.initialize(e);a.has(e)&&cancelAnimationFrame(a.get(e));const s=this._hitTarget,n=e.datasource||[];this._hitTarget=null;const o=r.get(e),l=o.context,c=l.canvas;__classPrivateFieldSet(this,i,getComputedStyle(c),"f"),l.resetTransform(),l.clearRect(0,0,c.width,c.height);const h=o.transformMatrix;l.setTransform(h);const d=this._pointer,m=o.offset,p={x:d.page.x-m.x,y:d.page.y-m.y};for(let t of n)this._draw(e,l,t,{transformMatrix:h},p);const u=this._hitTarget;u!=s&&(t.Utils.isNull(s)||(s instanceof Element&&s.dispatchEvent(new t.Drawing.DrawableEvent("out",s,this._scopeEvent,h)),e.dispatchEvent(new t.Drawing.DrawableEvent("itemout",s,this._scopeEvent,h))),t.Utils.isNull(u)||(u instanceof Element&&u.dispatchEvent(new t.Drawing.DrawableEvent("over",u,this._scopeEvent,h)),e.dispatchEvent(new t.Drawing.DrawableEvent("itemover",u,this._scopeEvent,h))))}}_draw(e,i,r,n,o){var l;if(null!==(l=r.stage)&&void 0!==l||(r.stage=e),t.Drawing.isDrawable(r)&&r.hide)return;let c;t.Drawing.isUiObject(r)&&r.draggable&&!r.hide&&!r.inert&&s(r,a,i.getTransform().inverse()),t.Drawing.isUiObject(r)&&(c=r.transformMatrix,t.Utils.isNull(c)||t.Matrix2D.isIdentity(c)||i.transform(c.a,c.b,c.c,c.d,c.e,c.f));let h=n;if(t.Drawing.isPresentationObject(r)&&(h=t.Drawing.PresentationState.combine(r,n,i.getTransform()),this._setPresentationState(i,h)),t.Drawing.isShape(r))this._drawShape(i,r,o);else if(t.Drawing.isText(r))this._drawText(i,r,o);else if(t.Drawing.isImage(r))this._drawImage(i,r,o);else if(t.Drawing.isGroup(r))for(let t of r.childDrawables||[])this._draw(e,i,t,h,o);t.Drawing.isUiObject(r)&&r.draggable&&!r.hide&&!r.inert&&s(r,"pacem:2d-world-matrix",i.getTransform().inverse()),this._setPresentationState(i,n)}_setPresentationState(e,i){e.setTransform(i.transformMatrix),t.Utils.isNullOrEmpty(i.stroke)||o(i.stroke)?e.strokeStyle="transparent":e.strokeStyle=i.stroke,t.Utils.isNullOrEmpty(i.lineWidth)?e.lineWidth=0:e.lineWidth=i.lineWidth,t.Utils.isNullOrEmpty(i.dashArray)?e.setLineDash([]):e.setLineDash(i.dashArray),t.Utils.isNullOrEmpty(i.lineCap)?e.lineCap="butt":e.lineCap=i.lineCap,t.Utils.isNullOrEmpty(i.lineJoin)?e.lineJoin="miter":e.lineJoin=i.lineJoin,t.Utils.isNullOrEmpty(i.fill)||o(i.fill)?e.fillStyle="transparent":e.fillStyle=i.fill,t.Utils.isNullOrEmpty(i.opacity)?e.globalAlpha=1:e.globalAlpha=i.opacity}_drawImage(e,i,r){const a="pacem:2d-canvas-imagesrc";let o=n(i,a);const c=()=>{let a=o.naturalWidth,s=o.naturalHeight,n=i.width,c=i.height;if(n>0&&c>0||(n>0?c=s*n/a:c>0?n=a*c/s:(n=a,c=s)),!this._dragging&&!i.inert&&!t.Utils.isNull(r)){const t=new Path2D(`M ${i.x} ${i.y} h ${n} v ${c} H ${i.x} Z`);e.isPointInPath(t,r.x,r.y)&&(this._hitTarget=i)}e.globalAlpha=l(i.opacity,1),e.drawImage(o,i.x,i.y,n,c)};t.Utils.isNull(o)?(o=new Image,o.src=i.src,o.onload=()=>{s(i,a,o),c()}):c()}_drawText(e,r,a){var s;const n=this.DefaultShapeValues,c=e.fillStyle=l(r.color,n.stroke),h=(e.getTransform(),r.fontSize>0?`${r.fontSize}px`:__classPrivateFieldGet(this,i,"f").fontSize);e.font=`${h} ${null!==(s=r.fontFamily)&&void 0!==s?s:__classPrivateFieldGet(this,i,"f").fontFamily}`,e.textAlign="middle"===r.textAnchor?"center":r.textAnchor,e.fillText(r.text,r.anchor.x,r.anchor.y),e.globalAlpha=l(r.opacity,1);const d=!o(c);if(!this._dragging&&!r.inert&&!t.Utils.isNull(a)){const t=e.measureText(r.text),i=t.width,s=t.actualBoundingBoxAscent+t.actualBoundingBoxDescent,n=r.anchor.x-t.actualBoundingBoxLeft,o=r.anchor.y-t.actualBoundingBoxAscent,l=new Path2D(`M ${n} ${o} h ${i} v ${s} H ${n} z`);d&&e.isPointInPath(l,a.x,a.y)&&(this._hitTarget=r)}}_drawShape(e,i,r){if(t.Utils.isNullOrEmpty(null==i?void 0:i.pathData))return;e.beginPath();const a="string"!=typeof e.fillStyle||!o(e.fillStyle),s="string"!=typeof e.strokeStyle||!o(e.strokeStyle);var n=new Path2D(i.pathData);this._dragging||i.inert||t.Utils.isNull(r)||(a&&e.isPointInPath(n,r.x,r.y)||s&&e.isPointInStroke(n,r.x,r.y))&&(this._hitTarget=i),s&&e.stroke(n),a&&e.fill(n);const l=!t.Utils.isNullOrEmpty(i.vertices)&&i.vertices.length>1,c=!t.Utils.isNull(i.markerEnd),h=!t.Utils.isNull(i.markerStart),d=!t.Utils.isNull(i.markerMid);if((c||d||h)&&(l||this.log(t.Logging.LogLevel.Warn,"Not enough vertices were explicited in order to make markers renderable.")),l){const t=e.getTransform();if(h){const t=i.markerEnd,r=i.vertices[1],a=i.vertices[0],s=Math.atan2(a.y-r.y,a.x-r.x);this._drawMarker(e,t,a,s)}if(d){const r=i.markerEnd;for(let a=1;a<i.vertices.length-1;a++){e.setTransform(t);const s=i.vertices[a],n=i.vertices[a+1],o=Math.atan2(n.y-s.y,n.x-s.x);this._drawMarker(e,r,n,o)}}if(c){e.setTransform(t);const r=i.markerEnd,a=i.vertices[i.vertices.length-2],s=i.vertices[i.vertices.length-1],n=Math.atan2(s.y-a.y,s.x-a.x);this._drawMarker(e,r,s,n)}}}_drawMarker(e,i,r,a){var s,n;const c=this.DefaultShapeValues,h=(null===(s=i.ref)||void 0===s?void 0:s.x)||0,d=(null===(n=i.ref)||void 0===n?void 0:n.y)||0,m=(i.width||1)*e.lineWidth,p=(i.width||1)*e.lineWidth;let u=i.viewbox,v={x:0,y:0,width:m,height:p};t.Utils.isNull(u)&&(u=v);const g={a:v.width/u.width,d:v.height/u.height};e.translate(r.x,r.y),e.rotate(a),e.scale(g.a,g.d),e.translate(-h,-d),e.fillStyle=l(i.fill,c.fill),e.strokeStyle=l(i.stroke,c.stroke);const _=!o(i.fill),f=!o(i.stroke);var y=new Path2D(i.pathData);_&&e.fill(y),f&&e.stroke(y)}};i=new WeakMap,c=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-canvas-adapter"})],c),e.PacemCanvasAdapterElement=c}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){const i="http://www.w3.org/2000/svg",r="pacem:2-svg-drawable",a="pacem:2d-svg-stage",s=t.CustomElementUtils.getAttachedPropertyValue,n=t.CustomElementUtils.setAttachedPropertyValue,o=t.CustomElementUtils.deleteAttachedPropertyValue;function l(e,i){return t.Utils.isNull(e)?i:e}function c(t,e,i){return i>=t.children.length?(t.appendChild(e),null):t.replaceChild(e,t.children.item(i))}let h=class PacemSvgAdapterElement extends e.Pacem2DAdapterElement{constructor(){super(...arguments),this._hitTarget=null,this._dragInitHandler=i=>{var a;const n=i.detail,o=n.element,l=s(o,r),c=l.stage.transformMatrix,h=null!==(a=l.transformMatrix)&&void 0!==a?a:t.Matrix2D.identity;n.data={stageTransformMatrix:c,item:l,initialTransformMatrix:h};e.AdapterUtils.itemDispatch(l,i,{x:0,y:0})&&i.preventDefault()},this._draggingHandler=i=>{t.avoidHandler(i),this._dragging=!0;const r=i.detail.element,a=i.detail.data,s=i.detail,n=(s.currentPosition.x-s.origin.x)*a.stageTransformMatrix.a,o=(s.currentPosition.y-s.origin.y)*a.stageTransformMatrix.d,l=n+a.initialTransformMatrix.e,c=o+a.initialTransformMatrix.f,h={x:n+a.stageTransformMatrix.e,y:o+a.stageTransformMatrix.f};e.AdapterUtils.itemDispatch(a.item,i,h)||(r.style.transform=`matrix(1,0,0,1,${l},${c})`)},this._dragEndHandler=i=>{this._dragging=!1;const r=i.detail,a=r.element,s=r.data,n=t.Utils.deserializeTransform(a.style),o={x:n.e,y:n.f};if(s.item instanceof t.Components.Drawing.UiElement)s.item.translateX=n.e,s.item.translateY=n.f;else{const e=s.initialTransformMatrix,i={a:e.a,b:e.b,c:e.c,d:e.d,e:o.x,f:o.y};t.Utils.extend(s.item,{transformMatrix:i})}a.style.transform="",e.AdapterUtils.itemDispatch(s.item,i,{x:n.e,y:n.f})},this._mousemoveHandler=i=>{var n=t.CustomEventUtils.getEventCoordinates(i).client;if(!this._dragging){var o=null;document.elementsFromPoint(n.x,n.y).find((t=>(o=s(t,r))&&!o.inert));var l=this._hitTarget,c=o;(t.Utils.isNull(o&&o.stage)||!this._scenes.has(o.stage)||o.inert)&&(c=null);const h=this._hitTarget=c;if(c!==l&&(t.Utils.isNull(l)||(this._dragger.unregister(this._items.get(l)),e.AdapterUtils.itemDispatch(l,"out",i)),t.Utils.isNull(c)||(c.draggable&&this._dragger.register(this._items.get(c)),e.AdapterUtils.itemDispatch(c,"over",i))),t.Utils.isNull(h)){const r=i.currentTarget,n=s(r,a);t.Utils.isNull(n)||e.AdapterUtils.stageDispatch(n,"move",i)}}},this._mouseDownUpHandler=i=>{const r=i.currentTarget;if(r instanceof SVGSVGElement){const n=s(r,a),o=this._hitTarget,l=i.type.replace(/^mouse/,"");t.Utils.isNull(o)||o.stage!==n?e.AdapterUtils.stageDispatch(n,l,i):e.AdapterUtils.itemDispatch(this._hitTarget,l,i)}},this._scenes=new WeakMap,this._markers=new WeakMap,this._items=new WeakMap}snapshot(t,e,i,r){if(this._scenes.has(t)){const a=this._scenes.get(t);return this.snapshotElement(a,e,i,r)}return Promise.resolve(null)}getTransformMatrix(e){const i=this._scenes;return i.has(e)?i.get(e).getScreenCTM().inverse():t.Matrix2D.identity}viewActivatedCallback(){super.viewActivatedCallback();const e=this._dragger=document.createElement(t.P+"-drag-drop");e.mode=t.UI.DragDataMode.Self;t.CustomElementUtils.findAncestorShell(this).appendChild(e),e.addEventListener(t.UI.DragDropEventType.Init,this._dragInitHandler,!1),e.addEventListener(t.UI.DragDropEventType.Drag,this._draggingHandler,!1),e.addEventListener(t.UI.DragDropEventType.End,this._dragEndHandler,!1)}disconnectedCallback(){const e=this._dragger;t.Utils.isNull(e)||(e.removeEventListener(t.UI.DragDropEventType.Init,this._dragInitHandler,!1),e.removeEventListener(t.UI.DragDropEventType.Drag,this._draggingHandler,!1),e.removeEventListener(t.UI.DragDropEventType.End,this._dragEndHandler,!1),e.remove()),super.disconnectedCallback()}invalidateSize(e,i){const r=this._scenes;if(!t.Utils.isNull(e)&&!t.Utils.isNullOrEmpty(i)&&r.has(e)){var a=r.get(e);a.setAttribute("width",i.width+""),a.setAttribute("height",i.height+"");const s=e.viewbox,n=e.aspectRatio;t.Utils.isNullOrEmpty(s)?a.removeAttribute("viewBox"):a.setAttribute("viewBox",`${s.x} ${s.y} ${s.width} ${s.height}`),t.Utils.isNullOrEmpty(n)||"string"==typeof n?a.removeAttribute("preserveAspectRatio"):a.setAttribute("preserveAspectRatio",`xM${n.x.substr(1)}YM${n.y.substr(1)} ${n.slice?"slice":"meet"}`)}}initialize(e){if(t.Utils.isNull(e))throw"Provided scene is null or undefined.";const r=this._scenes;if(r.has(e))return r.get(e);const s=e.stage;s.innerHTML="",this._items=new WeakMap;var o=document.createElementNS(i,"svg");n(o,a,e),s.appendChild(o),r.set(e,o);return o.addEventListener("mousemove",this._mousemoveHandler,!1),o.addEventListener("click",this._mouseDownUpHandler,!1),o.addEventListener("mousedown",this._mouseDownUpHandler,!1),o.addEventListener("mouseup",this._mouseDownUpHandler,!1),o}dispose(t){const e=this._scenes;if(e.has(t)){var i=e.get(t);i.removeEventListener("mousemove",this._mousemoveHandler),i.removeEventListener("click",this._mouseDownUpHandler),i.removeEventListener("mousedown",this._mouseDownUpHandler),i.removeEventListener("mouseup",this._mouseDownUpHandler),o(i,a),i.remove(),e.delete(t)}}getHitTarget(t){return this._hitTarget}draw(e,i,r=!1){const a=this._scenes,s=this._items;if(!t.Utils.isNull(e))if(e.adapter===this){a.has(e)||this.initialize(e);var n=e.datasource,o=!0,l=a.get(e);t.Utils.isNull(i)||s.has(i)&&(n=[i],l=s.get(i).parentNode,o=!1),o&&(l.innerHTML="<defs></defs>",this._markers=new WeakMap),this._draw(e,l,n||[],o,r)}else a.has(e)&&a.delete(e)}_hasItems(e){return t.Drawing.isGroup(e)}_disposeSvg(e){if(!t.Utils.isNull(e)){var i=s(e,r);o(e,r),this._items.delete(i)}}_draw(e,i,a,s,o){var h;const d=this._items;let m=0;if(i.firstElementChild instanceof SVGDefsElement&&m++,!t.Utils.isNullOrEmpty(a))for(let p of a){let a;if(null!==(h=p.stage)&&void 0!==h||(p.stage=e),d.has(p)?(a=d.get(p),a.parentNode!==i&&this._disposeSvg(c(i,a,m))):(a=this._buildSVGElement(p),n(a,r,p),this._disposeSvg(c(i,a,m)),d.set(p,a)),t.Drawing.isDrawable(p)&&(p.hide?a.setAttribute("display","none"):a.removeAttribute("display"),a.style.transform=""),t.Drawing.isShape(p)){const t=a;t.setAttribute("d",l(p.pathData,"M0,0"));for(let{marker:e,suffix:r}of[{marker:p.markerStart,suffix:"start"},{marker:p.markerEnd,suffix:"end"},{marker:p.markerMid,suffix:"mid"}])if(e){const a=this._ensureMarker(i,e);t.setAttribute("marker-"+r,`url(#${a.id})`)}else t.removeAttribute("marker-"+r)}else if(t.Drawing.isText(p)){const e=a;e.textContent=p.text,e.style.fill=t.Utils.isNullOrEmpty(p.color)?"":p.color,e.style.fontFamily=t.Utils.isNullOrEmpty(p.fontFamily)?"":p.fontFamily,e.style.fontSize=t.Utils.isNull(p.fontSize)?"":p.fontSize+"px",e.setAttribute("text-anchor",l(p.textAnchor,"start")),t.Utils.isNull(p.anchor)?(e.removeAttribute("x"),e.removeAttribute("y")):(e.setAttribute("x",p.anchor.x.toString()),e.setAttribute("y",p.anchor.y.toString()))}else if(t.Drawing.isImage(p)){const e=a;e.setAttribute("href",p.src),p.width>0?e.setAttribute("width",""+p.width):e.removeAttribute("width"),p.height>0?e.setAttribute("height",""+p.height):e.removeAttribute("height"),t.Utils.isNull(p.x)?e.removeAttribute("x"):e.setAttribute("x",""+p.x),t.Utils.isNull(p.y)?e.removeAttribute("y"):e.setAttribute("y",""+p.y)}if(t.Drawing.isUiObject(p)){const e=p.transformMatrix;t.Utils.isNull(e)||t.Matrix2D.isIdentity(e)?a.removeAttribute("transform"):a.setAttribute("transform",`matrix(${e.a} ${e.b} ${e.c} ${e.d} ${e.e} ${e.f})`);const i=l(p.opacity,1);1===i?a.removeAttribute("opacity"):a.setAttribute("opacity",""+i)}t.Drawing.isPresentationObject(p)&&(t.Utils.isNullOrEmpty(p.fill)?a.removeAttribute("fill"):a.setAttribute("fill",p.fill),t.Utils.isNullOrEmpty(p.stroke)?a.removeAttribute("stroke"):a.setAttribute("stroke",p.stroke),t.Utils.isNullOrEmpty(p.dashArray)?a.removeAttribute("stroke-dasharray"):a.setAttribute("stroke-dasharray",p.dashArray.join(" ")),t.Utils.isNullOrEmpty(p.lineCap)?a.removeAttribute("stroke-linecap"):a.setAttribute("stroke-linecap",p.lineCap),t.Utils.isNullOrEmpty(p.lineJoin)?a.removeAttribute("stroke-linejoin"):a.setAttribute("stroke-linejoin",p.lineJoin),t.Utils.isNullOrEmpty(p.lineWidth)?a.removeAttribute("stroke-width"):a.setAttribute("stroke-width",""+p.lineWidth)),p.inert?a.style.pointerEvents="none":a.style.pointerEvents="",(s||o)&&this._hasItems(p)&&this._draw(e,a,p.childDrawables,!0,o),m++}if(s)for(let t=i.children.length-1;t>=m;t--){const e=i.children.item(t);this._disposeSvg(e),e.remove()}}_buildSVGElement(e){return t.Drawing.isShape(e)?document.createElementNS(i,"path"):t.Drawing.isText(e)?document.createElementNS(i,"text"):t.Drawing.isImage(e)?document.createElementNS(i,"image"):document.createElementNS(i,"g")}_ensureMarker(e,r){const a=this._markers;a.has(e)||a.set(e,new WeakMap);const s=a.get(e);if(!s.has(r)){const a=document.createElementNS(i,"marker");s.set(r,a);const n=document.createElementNS(i,"path");a.appendChild(n),a.setAttribute("id","mark"+t.Utils.uniqueCode());let o,l=e;for(;t.Utils.isNull(o=l.querySelector(":scope > defs"));){const t=l.parentElement;if(!(t instanceof SVGElement))break;l=t}if(t.Utils.isNull(o))throw new Error("Must provide a <defs> element.");o.appendChild(a)}const n=s.get(r),o=n.firstElementChild;return n.setAttribute("orient","auto-start-reverse"),t.Utils.isNullOrEmpty(r.viewbox)?n.removeAttribute("viewBox"):n.setAttribute("viewBox",`${r.viewbox.x} ${r.viewbox.y} ${r.viewbox.width} ${r.viewbox.height}`),t.Utils.isNullOrEmpty(r.ref)?(n.removeAttribute("refX"),n.removeAttribute("refY")):(n.setAttribute("refX",r.ref.x.toString()),n.setAttribute("refY",r.ref.y.toString())),r.height>0?n.setAttribute("markerHeight",r.height.toString()):n.removeAttribute("markerHeight"),r.width>0?n.setAttribute("markerWidth",r.width.toString()):n.removeAttribute("markerWidth"),o.setAttribute("d",r.pathData),t.Utils.isNullOrEmpty(r.fill)?o.removeAttribute("fill"):o.setAttribute("fill",r.fill),t.Utils.isNullOrEmpty(r.stroke)?o.removeAttribute("stroke"):o.setAttribute("stroke",r.stroke),n}};h=__decorate([t.CustomElement({tagName:t.P+"-"+e.TAG_MIDDLE_NAME+"-svg-adapter"})],h),e.PacemSvgAdapterElement=h}(e.Drawing||(e.Drawing={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={}));
|
package/dist/js/pacem-3d.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
/// <reference path="pacem-core.d.ts" />
|
|
7
7
|
/// <reference path="pacem-numerical.d.ts" />
|
package/dist/js/pacem-3d.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
7
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
package/dist/js/pacem-3d.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
var Pacem,__decorate=this&&this.__decorate||function(e,t,r,a){var i,n=arguments.length,o=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,a);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(n<3?i(o):n>3?i(t,r,o):i(t,r))||o);return n>3&&o&&Object.defineProperty(t,r,o),o},__classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(e,t,r,a,i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,r):i?i.value=r:t.set(e,r),r},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(e,t,r,a){if("a"===r&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?a:"a"===r?a.call(e):a?a.value:t.get(e)},__awaiter=this&&this.__awaiter||function(e,t,r,a){return new(r||(r=Promise))((function(i,n){function o(e){try{c(a.next(e))}catch(e){n(e)}}function s(e){try{c(a.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((a=a.apply(e,t||[])).next())}))};!function(e){!function(t){t.Point3DConverter={convert:t=>e.Geometry.LinearAlgebra.Vector3D.parse(t),convertBack:e=>`${e.x||0} ${e.y||0} ${e.z||0}`},t.QuaternionConverter={convert:t=>e.Geometry.LinearAlgebra.Quaternion.parse(t),convertBack:e=>`${e.x||0} ${e.y||0} ${e.z||0} ${e.w||0}`}}(e.Drawing3D||(e.Drawing3D={}))}(Pacem||(Pacem={})),function(e){!function(e){!function(e){e.Pacem3DDetector=class Pacem3DDetector{constructor(){this._detected={supported:!1,info:{}};let e,t=document.createElement("canvas"),r=["webgl","experimental-webgl","moz-webgl","webkit-3d"],a=function(t){if(t)return e.getParameter(t)},i=(e,t,r)=>{let a=this._detected;(a.info[e]=a.info[e]||{})[t=(t=t.replace(/[^\w]+/g,"")).substring(0,1).toLowerCase()+t.substring(1)]=r};if(navigator.userAgent.indexOf("MSIE")>=0)try{e=window.WebGLHelper.CreateGLContext(t,"canvas")}catch(e){}else for(var n=0;n<r.length;n++)try{if(e=t.getContext(r[n]),e){i("main","Context Name",r[n]);break}}catch(e){}this._detected.supported=!!e,i("main","Platform",navigator.platform),i("main","Agent",navigator.userAgent),e&&(i("main","Vendor",a(e.VENDOR)),i("main","Version",a(e.VERSION)),i("main","Renderer",a(e.RENDERER)),i("main","Shading Language Version",a(e.SHADING_LANGUAGE_VERSION)),i("bits","Rgba Bits",a(e.RED_BITS)+", "+a(e.GREEN_BITS)+", "+a(e.BLUE_BITS)+", "+a(e.ALPHA_BITS)),i("bits","Depth Bits",a(e.DEPTH_BITS)),i("shader","Max Vertex Attribs",a(e.MAX_VERTEX_ATTRIBS)),i("shader","Max Vertex Texture Image Units",a(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),i("shader","Max Varying Vectors",a(e.MAX_VARYING_VECTORS)),i("shader","Max Uniform Vectors",a(e.MAX_VERTEX_UNIFORM_VECTORS)),i("tex","Max Combined Texture Image Units",a(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),i("tex","Max Texture Size",a(e.MAX_TEXTURE_SIZE)),i("tex","Max Cube Map Texture Size",a(e.MAX_CUBE_MAP_TEXTURE_SIZE)),i("tex","Num. Compressed Texture Formats",a(e.COMPRESSED_TEXTURE_FORMATS)),i("misc","Max Render Buffer Size",a(e.MAX_RENDERBUFFER_SIZE)),i("misc","Max Viewport Dimensions",a(e.MAX_VIEWPORT_DIMS)),i("misc","Aliased Line Width Range",a(e.ALIASED_LINE_WIDTH_RANGE)),i("misc","Aliased Point Size Range",a(e.ALIASED_POINT_SIZE_RANGE)),i("misc","Supported Extensions",e.getSupportedExtensions()||[]))}get info(){return this._detected.info}get supported(){return this._detected.supported}}}(e.Drawing3D||(e.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){class NodeGeometry{constructor(e=[]){this.positions=e}barycenter(){const t=this.positions;var r={x:0,y:0,z:0};if(!e.Utils.isNullOrEmpty(t)){for(var a=t.length,i=0;i<t.length;i++){var n=t[i];r.x+=n.x,r.y+=n.y,r.z+=n.z}var o=1*a;r.x/=o,r.y/=o,r.z/=o}return r}boundingBox(){const t=this.positions,r={minX:1/0,minY:1/0,minZ:1/0,maxX:-1/0,maxY:-1/0,maxZ:-1/0};if(!e.Utils.isNullOrEmpty(t))for(var a=0;a<t.length;a++){var i=t[a];r.minX=Math.min(r.minX,i.x),r.minY=Math.min(r.minY,i.y),r.minZ=Math.min(r.minZ,i.z),r.maxX=Math.max(r.maxX,i.x),r.maxY=Math.max(r.maxY,i.y),r.maxZ=Math.max(r.maxZ,i.z)}return r}}t.NodeGeometry=NodeGeometry;t.LineGeometry=class LineGeometry extends NodeGeometry{};t.MeshGeometry=class MeshGeometry extends NodeGeometry{constructor(e,t,r=[],a=[]){super(e),this.triangleIndices=t,this.textureCoordinates=r,this.normals=a}}}(e.Drawing3D||(e.Drawing3D={}))}(Pacem||(Pacem={})),function(e){!function(t){var r;function a(t){return!e.Utils.isNull(t)&&"render"in t&&"function"==typeof t.render}function i(t){return!e.Utils.isNull(t)&&"stage"in t&&a(t.stage)}function n(e){return"transformMatrix"in e&&i(e)}t.isStage=a,t.isRenderable=i,t.isUi3DObject=n,t.isMesh=function(e){return n(e)&&"geometry"in e},t.isGroup=function(t){return n(t)&&"items"in t&&!e.Utils.isNullOrEmpty(t.items)},t.computeSharpVertexNormals=function(t){const r=[];if(!e.Utils.isNullOrEmpty(t)){const a=t.triangleIndices;if(a.length%3!=0)throw new RangeError(`Invalid mesh geometry: ${a.length} is not multiple of 3.`);for(let i=2;i<a.length;i+=3){const n=a[i-2],o=a[i-1],s=a[i],c=t.positions[n],l=t.positions[o],m=t.positions[s],h=e.Geometry.LinearAlgebra.Vector3D.subtract(c,l),p=e.Geometry.LinearAlgebra.Vector3D.subtract(c,m),d=e.Geometry.LinearAlgebra.Vector3D.cross(p,h),u=e.Geometry.LinearAlgebra.Vector3D.unit(d);r.push(u,u,u)}}t.normals=r};class UI3DEvent extends e.CustomUIEvent{constructor(e,t,a,i){super(e,t,a),r.set(this,void 0),__classPrivateFieldSet(this,r,i,"f")}get point(){return __classPrivateFieldGet(this,r,"f")}}r=new WeakMap,t.UI3DEvent=UI3DEvent;t.DragEvent=class DragEvent extends UI3DEvent{};t.RenderableEvent=class RenderableEvent extends UI3DEvent{constructor(e,t,r,a){super(e,{detail:t,bubbles:!0,cancelable:!0},r,a)}}}(e.Drawing3D||(e.Drawing3D={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(r){var a;r.TAG_MIDDLE_NAME="3d",r.DEG2RAD=Math.PI/180;const i={OBJECT_SELECTOR:e.P+"-"+r.TAG_MIDDLE_NAME+"-object",LIGHT_SELECTOR:e.P+"-"+r.TAG_MIDDLE_NAME+"-light",CAMERA_SELECTOR:e.P+"-"+r.TAG_MIDDLE_NAME+"-camera",LINE_SELECTOR:e.P+"-"+r.TAG_MIDDLE_NAME+"-line",MESH_SELECTOR:e.P+"-"+r.TAG_MIDDLE_NAME+"-mesh",GROUP_SELECTOR:e.P+"-"+r.TAG_MIDDLE_NAME+"-group",DEFAULT_COORDS:{x:0,y:0,z:0}};let n;!function(e){e.Position="position",e.Transform="transform",e.Geometry="geometry",e.Children="children",e.Material="material",e.Light="light",e.Camera="camera"}(n=r.StalePropertyFlag||(r.StalePropertyFlag={}));class RenderableElement extends t.PacemCrossItemsContainerElement{constructor(){super(...arguments),a.set(this,[]),this.position=i.DEFAULT_COORDS}validate(e){return!1}findContainer(){return this.parent||this.stage}get stage(){return this._scene=this._scene||e.CustomElementUtils.findAncestorOfType(this,r.Pacem3DElement)}get parent(){return this._drawableParent=this._drawableParent||e.CustomElementUtils.findAncestor(this,(e=>e instanceof RenderableElement))}get flags(){return __classPrivateFieldGet(this,a,"f")}disconnectedCallback(){delete this._scene,delete this._drawableParent,super.disconnectedCallback()}propertyChangedCallback(e,t,r,a){switch(super.propertyChangedCallback(e,t,r,a),e){case"hide":this.setAsDirty();break;case"items":this.setAsDirty(n.Children);break;case"position":this.setAsDirty(n.Position)}}setAsDirty(...e){var t;for(let t of e)this.flags.includes(t)||this.flags.push(t);null===(t=this.stage)||void 0===t||t.render(this)}}a=new WeakMap,__decorate([e.Watch({emit:!1,converter:e.Drawing3D.Point3DConverter})],RenderableElement.prototype,"position",void 0),__decorate([e.Watch({emit:!1,reflectBack:!0,converter:e.PropertyConverters.String})],RenderableElement.prototype,"tag",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],RenderableElement.prototype,"inert",void 0),r.RenderableElement=RenderableElement;class Ui3DElement extends RenderableElement{propertyChangedCallback(e,t,r,a){switch(super.propertyChangedCallback(e,t,r,a),e){case"transformMatrix":this.setAsDirty(n.Transform);break;case"rotate":case"scaleX":case"scaleY":case"translateX":case"translateY":this._computeTransformMatrix()}}_computeTransformMatrix(){const t=e.Utils.isNull(this.rotate)?e.Geometry.LinearAlgebra.Matrix3D.identity():e.Geometry.LinearAlgebra.Quaternion.toRotationMatrix(this.rotate);this.translateX&&(t.offsetX=this.translateX),this.translateY&&(t.offsetY=this.translateY),this.translateZ&&(t.offsetZ=this.translateZ),this.scaleX&&(t.m11=this.scaleX),this.scaleY&&(t.m22=this.scaleY),this.scaleZ&&(t.m33=this.scaleZ),this.transformMatrix=t}}__decorate([e.Watch({emit:!1,converter:e.Drawing3D.QuaternionConverter})],Ui3DElement.prototype,"rotate",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],Ui3DElement.prototype,"scaleX",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],Ui3DElement.prototype,"scaleY",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],Ui3DElement.prototype,"scaleZ",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],Ui3DElement.prototype,"translateX",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],Ui3DElement.prototype,"translateY",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],Ui3DElement.prototype,"translateZ",void 0),__decorate([e.Watch({emit:!1})],Ui3DElement.prototype,"transformMatrix",void 0),r.Ui3DElement=Ui3DElement;let o=class Pacem3DGroupElement extends Ui3DElement{validate(e){return e instanceof RenderableElement}};o=__decorate([e.CustomElement({tagName:i.GROUP_SELECTOR})],o),r.Pacem3DGroupElement=o;let s=class Pacem3DMeshElement extends Ui3DElement{propertyChangedCallback(e,t,r,a){switch(super.propertyChangedCallback(e,t,r,a),e){case"geometry":this.setAsDirty(n.Geometry);break;case"material":case"backMaterial":this.setAsDirty(n.Material)}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],s.prototype,"geometry",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],s.prototype,"material",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],s.prototype,"backMaterial",void 0),s=__decorate([e.CustomElement({tagName:i.MESH_SELECTOR})],s),r.Pacem3DMeshElement=s;let c=class Pacem3DObjectElement extends Ui3DElement{propertyChangedCallback(e,t,r,a){super.propertyChangedCallback(e,t,r,a),"content"!==e&&"type"!==e||this.setAsDirty(n.Geometry,n.Material)}};__decorate([e.Watch({emit:!1})],c.prototype,"content",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],c.prototype,"type",void 0),c=__decorate([e.CustomElement({tagName:i.OBJECT_SELECTOR})],c),r.Pacem3DObjectElement=c;let l=class Pacem3DLightElement extends RenderableElement{constructor(){super(...arguments),this.intensity=.25,this.target=i.DEFAULT_COORDS,this.color="#fff",this.type="omni"}propertyChangedCallback(e,t,r,a){switch(super.propertyChangedCallback(e,t,r,a),e){case"type":case"color":case"intensity":case"target":this.setAsDirty(n.Light)}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],l.prototype,"intensity",void 0),__decorate([e.Watch({emit:!1,converter:e.Drawing3D.Point3DConverter})],l.prototype,"target",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],l.prototype,"color",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],l.prototype,"type",void 0),l=__decorate([e.CustomElement({tagName:i.LIGHT_SELECTOR})],l),r.Pacem3DLightElement=l;let m=class Pacem3DCameraElement extends RenderableElement{constructor(){super(...arguments),this.fov=45,this.aspect=1.78,this.near=.1,this.far=1e3,this.type="perspective",this.lookAt=i.DEFAULT_COORDS}propertyChangedCallback(e,t,r,a){switch(super.propertyChangedCallback(e,t,r,a),e){case"fov":case"aspect":case"near":case"far":case"type":case"lookAt":this.setAsDirty(n.Camera)}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],m.prototype,"fov",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],m.prototype,"aspect",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],m.prototype,"near",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],m.prototype,"far",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],m.prototype,"type",void 0),__decorate([e.Watch({emit:!1,converter:e.Drawing3D.Point3DConverter})],m.prototype,"lookAt",void 0),m=__decorate([e.CustomElement({tagName:i.CAMERA_SELECTOR})],m),r.Pacem3DCameraElement=m;class Pacem3DAdapterElement extends t.PacemEventTarget{}r.Pacem3DAdapterElement=Pacem3DAdapterElement}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(r){var a;let i=class Pacem3DElement extends t.PacemItemsContainerElement{constructor(){super(...arguments),this._addHandler=e=>{this._add(e.target)},this._clickHandler=t=>{let r=this;if(!r.interactive||e.Utils.isNull(r._lastHitResult))return;const a=t.type.replace(/^mouse/,""),i=r._lastHitResult,n=i.object,o=i.point;this._itemDispatch(n,o,a,t)},this._moveHandler=t=>{var r,a;let i=this;if(!i.adapter||!i.interactive)return;const n=i._resizer.currentSize;let o=i.adapter.raycast({x:t.pageX-n.left,y:t.pageY-n.top},n);if(o!=i._lastHitResult){if((null==o?void 0:o.object)!=(null===(r=i._lastHitResult)||void 0===r?void 0:r.object)){const r=null==o?void 0:o.object,n=null===(a=i._lastHitResult)||void 0===a?void 0:a.object,s=null==o?void 0:o.point;e.Utils.isNull(n)||this._itemDispatch(n,s,"out",t),e.Utils.isNull(r)||this._itemDispatch(r,s,"over",t)}i._lastHitResult=o}},a.set(this,void 0),this._resizeHandler=r=>{const i=__classPrivateFieldSet(this,a,r.detail,"f"),n=this.adapter;e.Utils.isNull(n)||(this.adapter.invalidateSize(i),this.dispatchEvent(new t.ResizeEvent(i)))}}validate(e){return e instanceof r.RenderableElement}get stage(){return this._container}get scene(){return this.adapter&&this.adapter.scene}register(t){const r=super.register(t);return r&&(this._add(t),t.addEventListener(e.PropertyChangeEventName,this._addHandler,!1)),r}unregister(t){const r=super.unregister(t);return r&&(t.removeEventListener(e.PropertyChangeEventName,this._addHandler,!1),this._erase(t)),r}_add(e){this.adapter&&this.adapter.addItem(e)}_erase(e){this.adapter&&this.adapter.removeItem(e)}_initializeAdapter(t,r){return new Promise(((a,i)=>{e.Utils.isNull(t)||this.items.forEach((e=>t.removeItem(e))),e.Utils.isNull(this._container)||e.Utils.isNull(r)||r.initialize(this).then((e=>{this.items.forEach((e=>this._add(e)))}),(t=>{this.log(e.Logging.LogLevel.Error,null==t?void 0:t.toString())})),a()}))}propertyChangedCallback(t,r,a,i){super.propertyChangedCallback(t,r,a,i),e.Utils.isNull(this._container)||"adapter"!==t||i||this._initializeAdapter(r,a)}viewActivatedCallback(){super.viewActivatedCallback();const e=this._container,t=this._resizer;t.addEventListener("resize",this._resizeHandler,!1),t.target=e,this._initializeAdapter(null,this.adapter).then((t=>{e.addEventListener("mousemove",this._moveHandler,!1),e.addEventListener("click",this._clickHandler,!1),e.addEventListener("mouseup",this._clickHandler,!1),e.addEventListener("mousedown",this._clickHandler,!1),this.render()}))}_itemDispatch(t,r,a,i){if(!e.Utils.isNull(t)){var n,o,s;i instanceof Event?o=i:n={item:t,offset:i},"string"==typeof a?s=a:(s=a.type,o=a.originalEvent);const l=r,m=()=>i instanceof Event?new e.Drawing3D.RenderableEvent(s,t,o,l):new e.Drawing3D.DragEvent(s,{detail:n,cancelable:s===e.UI.DragDropEventType.Init||s===e.UI.DragDropEventType.Drag},o,l),h=i instanceof Event?new e.Drawing3D.RenderableEvent("item"+s,t,o,l):new e.Drawing3D.DragEvent("item"+s,{detail:n,cancelable:s===e.UI.DragDropEventType.Init||s===e.UI.DragDropEventType.Drag},o,l);var c=!1;if(t instanceof EventTarget){const e=m();t.dispatchEvent(e),c=e.defaultPrevented}return t.stage.dispatchEvent(h),c||h.defaultPrevented}return!1}disconnectedCallback(){const t=this._resizer,r=this._container;e.Utils.isNull(r)||(r.removeEventListener("click",this._clickHandler,!1),r.removeEventListener("mouseup",this._clickHandler,!1),r.removeEventListener("mousedown",this._clickHandler,!1),r.removeEventListener("mousemove",this._moveHandler,!1)),e.Utils.isNull(t)||t.removeEventListener("resize",this._resizeHandler,!1),super.disconnectedCallback()}get size(){return __classPrivateFieldGet(this,a,"f")}render(t,r){if(e.Utils.isNull(t)){if(requestAnimationFrame((()=>this.render())),!this.disabled&&!e.Utils.isNull(this.adapter)){let e=new CustomEvent("prerender",{detail:{scene:this.adapter.scene},cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||(this.adapter.render(),this.dispatchEvent(new CustomEvent("render",{detail:{scene:this.adapter.scene}})))}}else{const r=this.adapter;e.Utils.isNull(r)||r.updateItem(t)}}};a=new WeakMap,__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],i.prototype,"interactive",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],i.prototype,"orbit",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Element})],i.prototype,"adapter",void 0),__decorate([e.ViewChild(`.${e.PCSS}-3d`)],i.prototype,"_container",void 0),__decorate([e.ViewChild(e.P+"-resize")],i.prototype,"_resizer",void 0),i=__decorate([e.CustomElement({tagName:e.P+"-"+r.TAG_MIDDLE_NAME,shadow:e.Defaults.USE_SHADOW_ROOT,template:`<${e.P}-resize watch-position="true"></${e.P}-resize><div class="${e.PCSS}-3d"></div><${e.P}-content></${e.P}-content>`})],i),r.Pacem3DElement=i}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(e){let t;function r(e){return"shader"in e}!function(e){e.Basic="basic",e.Lambert="lambert",e.Phong="phong",e.Standard="standard",e.Line="line"}(t=e.KnownShader||(e.KnownShader={})),e.isMaterial=r,e.isBasicMaterial=function(e){return r(e)&&e.shader===t.Basic},e.isLineMaterial=function(e){return r(e)&&e.shader===t.Line},e.isLambertMaterial=function(e){return r(e)&&e.shader===t.Lambert},e.isPhongMaterial=function(e){return r(e)&&e.shader===t.Phong},e.isStandardMaterial=function(e){return r(e)&&e.shader===t.Standard}}(e.Drawing3D||(e.Drawing3D={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(r){var a;class MaterialElement extends t.PacemEventTarget{constructor(e){super(),a.set(this,void 0),__classPrivateFieldSet(this,a,e,"f")}get shader(){return __classPrivateFieldGet(this,a,"f")}propertyChangedCallback(e,t,r,a){if(super.propertyChangedCallback(e,t,r,a),!a)switch(e){case"opacity":case"wireframe":case"color":case"visible":case"map":this.updateMaterial()}}viewActivatedCallback(){super.viewActivatedCallback(),this.updateMaterial()}updateMaterial(){this.material=this.createMaterial()}createMaterial(){var t,r,a;return{opacity:null!==(t=this.opacity)&&void 0!==t?t:1,wireframe:null!==(r=this.wireframe)&&void 0!==r&&r,color:this.color||e.Utils.Css.getVariableValue(`--${e.PCSS}-color-primary`),visible:null===(a=this.visible)||void 0===a||a,map:this.map,shader:this.shader}}}a=new WeakMap,__decorate([e.Watch()],MaterialElement.prototype,"material",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],MaterialElement.prototype,"opacity",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],MaterialElement.prototype,"wireframe",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],MaterialElement.prototype,"color",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],MaterialElement.prototype,"visible",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],MaterialElement.prototype,"map",void 0),r.MaterialElement=MaterialElement}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){function r(e){const t=[];for(let a of e)"x"in(r=a)&&"number"==typeof r.x&&"y"in r&&"number"==typeof r.y&&"z"in r&&"number"==typeof r.z?t.push(a.x,a.y,a.z):t.push(a.x,a.y);var r;return t}const a="0.152.2",i={VERSION:a,API_URI:`https://unpkg.com/three@${a}/build/three.min.js`,ORBIT_URI:"https://unpkg.com/three@0.147.0/examples/js/controls/OrbitControls.js",LOADERS:[],DEFAULT_MATERIAL:function(){return new THREE.MeshStandardMaterial({color:"#069",flatShading:!0})}};function n(t){var r,a,i,n,o,s,c;if(e.Utils.isNull(t))return null;const l={color:t.color,opacity:null!==(r=t.opacity)&&void 0!==r?r:1,transparent:!0,wireframe:null!==(a=t.wireframe)&&void 0!==a&&a,visible:null===(i=t.visible)||void 0===i||i},m=e.Utils.extend({},l,{wireframe:null!==(n=t.wireframe)&&void 0!==n&&n}),h=e=>(t.map&&(e.map=(new THREE.TextureLoader).load(t.map,(t=>{e.needsUpdate=!0}))),e);if(e.Drawing3D.isStandardMaterial(t)){return h(new THREE.MeshStandardMaterial(e.Utils.extend(m,{roughness:t.roughness,metalness:t.metalness,emissive:t.emissiveColor,flatShading:t.flatShading,refractionRatio:t.refractionRatio})))}if(e.Drawing3D.isPhongMaterial(t)){return h(new THREE.MeshPhongMaterial(e.Utils.extend(m,{shininess:t.shininess,emissive:t.emissiveColor,flatShading:t.flatShading,specular:t.specularColor,reflectivity:t.reflectivity,refractionRatio:t.refractionRatio})))}if(e.Drawing3D.isLambertMaterial(t)){return h(new THREE.MeshLambertMaterial(e.Utils.extend(m,{emissive:t.emissiveColor,reflectivity:t.reflectivity,refractionRatio:t.refractionRatio})))}if(e.Drawing3D.isLineMaterial(t)){const r=t.dashArray&&t.dashArray[0]||null,a=t.dashArray&&t.dashArray.length>1&&t.dashArray[1]||r,i=e.Utils.extend(l,{linecap:null!==(o=t.lineCap)&&void 0!==o?o:"round",linejoin:null!==(s=t.lineJoin)&&void 0!==s?s:"round",linewidth:null!==(c=t.lineWidth)&&void 0!==c?c:1});return e.Utils.isNullOrEmpty(t.dashArray)?new THREE.LineBasicMaterial(i):new THREE.LineDashedMaterial(e.Utils.extend({dashSize:r,gapSize:a},i))}if(e.Drawing3D.isMaterial(t)){return h(new THREE.MeshBasicMaterial(m))}return null}function o(t){var r;if(e.Utils.isNullOrEmpty(t.content))throw new Error("Missing content.");if("obj"===(null===(r=t.type)||void 0===r?void 0:r.toLowerCase())){return(new THREE.OBJLoader).parse(t.content)}return(new THREE.ObjectLoader).parse(t.content)}function s(t){if(e.Utils.isNullOrEmpty(t.geometry))return null;return new(t.geometry instanceof e.Drawing3D.LineGeometry?THREE.Line:THREE.Mesh)}function c(){return"THREE"in window}let l=class Pacem3DThreeAdapterElement extends t.Pacem3DAdapterElement{constructor(){super(...arguments),this._renderer=null,this._camera=null,this._scene=null,this._orbitCtrls=null,this._objects=new WeakMap,this._dict={},this._orbitControlsDelegate=e=>{},this._ensureAndRefresh=(a,c,l)=>{if(c.matrixAutoUpdate=!1,c.visible=!a.hide){if(e.Drawing3D.isMesh(a)){let o=c;if(a.flags.indexOf(t.StalePropertyFlag.Geometry)>=0){o.geometry.dispose();const t=s(a);t.constructor.name!==o.constructor.name&&(l.remove(c),delete this._dict[c.id],c=o=t),o.geometry=function(t){const a=new THREE.BufferGeometry,i=r(t.positions);if(a.setAttribute("position",new THREE.Float32BufferAttribute(i,3)),t instanceof e.Drawing3D.MeshGeometry){e.Utils.isNullOrEmpty(t.triangleIndices)||a.setIndex(t.triangleIndices);const i=r(t.positions);a.setAttribute("position",new THREE.Float32BufferAttribute(i,3));const n=r(t.textureCoordinates);if(a.setAttribute("uv",new THREE.Float32BufferAttribute(n,2)),e.Utils.isNullOrEmpty(t.normals))a.computeVertexNormals();else{const e=r(t.normals);a.setAttribute("normal",new THREE.Float32BufferAttribute(e,3))}}return a}(a.geometry)}if(a.flags.indexOf(t.StalePropertyFlag.Material)>=0){if(e.Utils.isArray(o.material))for(let e of o.material)e.dispose();else o.material.dispose();o.material=function(t,r,a){const i=a,o=[],s=n(t);if(e.Utils.isNull(s)||(s.side=THREE.FrontSide,o.push(s)),!e.Utils.isNull(r))if(r==t)s.side=THREE.DoubleSide;else{const t=n(r);e.Utils.isNull(t)||(t.side=THREE.BackSide,o.push(t))}return i&&o.length>1?o:s}(a.material)||i.DEFAULT_MATERIAL()}}else if(a instanceof t.Pacem3DObjectElement&&(a.flags.indexOf(t.StalePropertyFlag.Material)>=0||a.flags.indexOf(t.StalePropertyFlag.Geometry)>=0))c.parent&&c.parent.remove(c),c=o(a);else if(a instanceof t.Pacem3DGroupElement){if(a.flags.indexOf(t.StalePropertyFlag.Children)>=0){for(let e=c.children.length-1;e>=0;e--){const t=c.children[e];c.remove(t)}for(let e of a.items)this._addOrUpdateItem(e,c)}}else if(a instanceof t.Pacem3DLightElement){const e=c;a.flags.indexOf(t.StalePropertyFlag.Light)>=0&&(e.color=new THREE.Color(a.color),e.intensity=a.intensity)}let h=a.position;if(e.Drawing3D.isUi3DObject(a)&&!e.Utils.isNull(a.transformMatrix)&&(a.flags.indexOf(t.StalePropertyFlag.Position)>=0||a.flags.indexOf(t.StalePropertyFlag.Transform)>=0)){const t=e.Geometry.LinearAlgebra.Matrix3D.from(1,0,0,0,0,1,0,0,0,0,1,0,h.x,h.y,h.z,1),r=e.Geometry.LinearAlgebra.Matrix3D.multiply(a.transformMatrix,t);THREE.Matrix4.prototype.set.apply(c.matrix,[(m=r).m11,m.m21,m.m31,m.offsetX,m.m12,m.m22,m.m32,m.offsetY,m.m13,m.m23,m.m33,m.offsetZ,m.m14,m.m24,m.m34,m.m44])}else a.flags.indexOf(t.StalePropertyFlag.Position)>=0&&(c.position.set(h.x,h.y,h.z),c.updateMatrix())}var m;return c.userData=a.tag,e.Utils.isNull(l.getObjectById(c.id))&&(l.add(c),this._dict[c.id]=a),a.flags.splice(0),c}}dispose(e){}snapshot(t,r,a,i){if(t!=this._3d)return Promise.resolve(null);const n=!e.Utils.isNullOrEmpty(r),o=null!=a?a:n?"image/jpeg":null,s=null!=i?i:n?.9:null;return new Promise(((t,a)=>{this.render(),e.Utils.snapshotElement(this._stage,r,o,s).then(t)}))}project(t){if(e.Utils.isNull(this._camera)||e.Utils.isNull(this._stage))return null;const r=this._stage,a=new THREE.Vector3(t.x,t.y,t.z),i=r.width/2,n=r.height/2,o=a.project(this._camera);return{x:o.x*i+i,y:-o.y*n+n}}zoomFit(...t){return new Promise(((r,a)=>{const i=this._camera,n=this._objects,o=t.filter((e=>n.has(e))).map((e=>n.get(e)));(e.Utils.isNull(i)||e.Utils.isNullOrEmpty(o))&&r(),function(t,r,a,i=1.333){const n=new THREE.Box3;for(const e of a)n.expandByObject(e);const o=n.getSize(new THREE.Vector3),s=n.getCenter(new THREE.Vector3),c=Math.max(o.x,o.y,o.z)/(2*Math.atan(Math.PI*t.fov/360)),l=c/t.aspect,m=i*Math.max(c,l),h=!e.Utils.isNull(r);var p;h&&(p=r.target.clone().sub(t.position).normalize().multiplyScalar(m),r.maxDistance=10*m,r.target.copy(s)),t.near=m/100,t.far=100*m,t.updateProjectionMatrix(),h&&(t.position.copy(r.target).sub(p),r.update())}(i,this._orbitCtrls,o),r()}))}get scene(){return this._scene}raycast(t,r){if(c()&&!e.Utils.isNull(this._camera)){const e=this._camera,a=new THREE.Vector2(t.x/r.width*2-1,-t.y/r.height*2+1),i=new THREE.Raycaster;i.setFromCamera(a,e);const n=i.intersectObjects(this._scene.children,!0);let o,s,c=0;for(;n.length>c&&(s=n[c++])&&(o=s.object);){if(this._dict[o.id].inert)continue;const e=s.point,t={x:e.x,y:e.y,z:e.z};return{object:this._dict[o.id],point:t}}}return null}initialize(t){return __awaiter(this,void 0,void 0,(function*(){if(!e.Utils.isNull(this._stage))return this._stage;this._3d=t;const r=t.stage,a=this._stage=document.createElement("canvas");r.innerHTML="",r.appendChild(a),yield e.CustomElementUtils.importjs(i.API_URI),yield function(...e){return __awaiter(this,void 0,void 0,(function*(){const t=Date.now();var r=!1;do{r=c();for(let t of e)r&&(r=t());r||(yield new Promise((e=>setTimeout(e,500))))}while(!r&&Date.now()-t<3e4);if(!r)throw new Error("The wait for THREE adapter initialization timed out.")}))}(),yield Promise.all([e.CustomElementUtils.importjs(i.ORBIT_URI)].concat(i.LOADERS.map((t=>e.CustomElementUtils.importjs(t))))),this._scene=new THREE.Scene,this.invalidateSize(t.size);let n=this._stage.width,o=this._stage.height,s={canvas:a,antialias:!0,stencil:!1,alpha:!0};return this._renderer=new THREE.WebGLRenderer(s),this._renderer.setSize(n,o),this.orbit=t.orbit,a}))}_setCamera(e){this._camera=e,this.invalidateSize(this._3d.size),this._disposeOrbitControls(),this.orbit&&this._initOrbitControls()}propertyChangedCallback(e,t,r,a){super.propertyChangedCallback(e,t,r,a),"orbit"===e&&(!0===r?this._initOrbitControls():this._disposeOrbitControls())}_initOrbitControls(){const t=this._camera;if(e.Utils.isNull(this._3d)||e.Utils.isNull(t))return;(this._orbitCtrls=new THREE.OrbitControls(t,this._3d.stage)).addEventListener("change",this._orbitControlsDelegate)}_disposeOrbitControls(){const t=this._orbitCtrls;e.Utils.isNull(t)||(t.removeEventListener("change",this._orbitControlsDelegate),t.dispose())}invalidateSize(t){if(!c()||e.Utils.isNull(t))return;let r=t.width,a=t.height;this._stage.width=r,this._stage.height=a;let i=this._camera;i instanceof THREE.PerspectiveCamera&&(i.aspect=r/a,i.updateProjectionMatrix()),this._renderer&&this._renderer.setSize(r,a)}removeItem(t){const r=this._objects,a=r.get(t);e.Utils.isNull(a)||(this._scene.remove(a),delete this._dict[a.id],r.delete(t))}updateItem(e){this._addOrUpdateItem(e)}addItem(e){this._addOrUpdateItem(e)}_addOrUpdateItem(r,a=this._scene){if(c()&&!e.Utils.isNull(a))if(r instanceof t.Pacem3DCameraElement){if("perspective"===r.type){if(this._camera instanceof THREE.PerspectiveCamera)var i=this._camera;else i=new THREE.PerspectiveCamera;const t=new THREE.Vector3(r.lookAt.x,r.lookAt.y,r.lookAt.z);i.lookAt(t),i.fov=r.fov,i.aspect=r.aspect,i.near=r.near,i.far=r.far,i.position.set(r.position.x,r.position.y,r.position.z),this._setCamera(i);const a=this._orbitCtrls;e.Utils.isNull(a)||a.object!==i||(a.target=t,a.update())}}else if(this._objects.has(r)){const e=this._objects.get(r),t=this._ensureAndRefresh(r,e,a);t!=e&&this._objects.set(r,t)}else{const e=e=>{e&&(e=this._ensureAndRefresh(r,e,a),this._objects.set(r,e))};if(r instanceof t.Pacem3DObjectElement){e(o(r))}else if(r instanceof t.Pacem3DMeshElement){e(s(r))}else if(r instanceof t.Pacem3DLightElement){const t=function(e){var t;if("spot"===e.type){const r=new THREE.SpotLight;r.target.position.set(e.target.x,e.target.y,e.target.z),t=r}else t=new THREE.PointLight;return t}(r);e(t)}else if(r instanceof t.Pacem3DGroupElement){e(new THREE.Group)}}}render(){this._camera&&this._renderer.render(this._scene,this._camera)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],l.prototype,"orbit",void 0),l=__decorate([e.CustomElement({tagName:e.P+"-3d-three-adapter"})],l),t.Pacem3DThreeAdapterElement=l}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let r=class BasicMaterialElement extends t.MaterialElement{constructor(){super(e.Drawing3D.KnownShader.Basic)}};r=__decorate([e.CustomElement({tagName:`${e.P}-${t.TAG_MIDDLE_NAME}-material-basic`})],r),t.BasicMaterialElement=r}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let r=class LambertMaterialElement extends t.MaterialElement{constructor(){super(e.Drawing3D.KnownShader.Lambert)}createMaterial(){var t,r;return e.Utils.extend({emissiveColor:this.emissiveColor||"#000",reflectivity:null!==(t=this.reflectivity)&&void 0!==t?t:0,refractionRatio:null!==(r=this.refractionRatio)&&void 0!==r?r:0},super.createMaterial())}propertyChangedCallback(e,t,r,a){if(super.propertyChangedCallback(e,t,r,a),!a)switch(e){case"emissiveColor":case"reflectivity":case"refractionRatio":this.updateMaterial()}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],r.prototype,"emissiveColor",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],r.prototype,"reflectivity",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],r.prototype,"refractionRatio",void 0),r=__decorate([e.CustomElement({tagName:`${e.P}-${t.TAG_MIDDLE_NAME}-material-lambert`})],r),t.LambertMaterialElement=r}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let r=class LineMaterialElement extends t.MaterialElement{constructor(){super(e.Drawing3D.KnownShader.Line)}createMaterial(){var t,r,a;return e.Utils.extend({lineWidth:null!==(t=this.lineWidth)&&void 0!==t?t:1,lineJoin:null!==(r=this.lineJoin)&&void 0!==r?r:"round",lineCap:null!==(a=this.lineCap)&&void 0!==a?a:"round",dashArray:this.dashArray},super.createMaterial())}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],r.prototype,"lineWidth",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],r.prototype,"lineJoin",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],r.prototype,"lineCap",void 0),__decorate([e.Watch({emit:!1,converter:{convert:e=>null==e?void 0:e.split(",").map((e=>parseInt(e))).filter((e=>!Number.isNaN(e))),convertBack:e=>null==e?void 0:e.join(",")}})],r.prototype,"dashArray",void 0),r=__decorate([e.CustomElement({tagName:`${e.P}-${t.TAG_MIDDLE_NAME}-material-line`})],r),t.LineMaterialElement=r}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let r=class PhongMaterialElement extends t.MaterialElement{constructor(){super(e.Drawing3D.KnownShader.Phong)}createMaterial(){var t,r,a,i;return e.Utils.extend({emissiveColor:this.emissiveColor||"#000",reflectivity:null!==(t=this.reflectivity)&&void 0!==t?t:0,refractionRatio:null!==(r=this.refractionRatio)&&void 0!==r?r:0,specularColor:this.specularColor||"#000",shininess:null!==(a=this.shininess)&&void 0!==a?a:0,flatShading:null===(i=this.flatShading)||void 0===i||i},super.createMaterial())}propertyChangedCallback(e,t,r,a){if(super.propertyChangedCallback(e,t,r,a),!a)switch(e){case"emissiveColor":case"reflectivity":case"refractionRatio":case"specularColor":case"shininess":case"flatShading":this.updateMaterial()}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],r.prototype,"emissiveColor",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],r.prototype,"reflectivity",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],r.prototype,"refractionRatio",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],r.prototype,"specularColor",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],r.prototype,"shininess",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],r.prototype,"flatShading",void 0),r=__decorate([e.CustomElement({tagName:`${e.P}-${t.TAG_MIDDLE_NAME}-material-phong`})],r),t.PhongMaterialElement=r}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){let r=class StandardMaterialElement extends t.MaterialElement{constructor(){super(e.Drawing3D.KnownShader.Standard)}createMaterial(){var t,r,a,i;return e.Utils.extend({emissiveColor:this.emissiveColor||"#000",refractionRatio:null!==(t=this.refractionRatio)&&void 0!==t?t:0,metalness:null!==(r=this.metalness)&&void 0!==r?r:0,roughness:null!==(a=this.roughness)&&void 0!==a?a:0,flatShading:null!==(i=this.flatShading)&&void 0!==i&&i},super.createMaterial())}propertyChangedCallback(e,t,r,a){if(super.propertyChangedCallback(e,t,r,a),!a)switch(e){case"emissiveColor":case"roughness":case"metalness":case"refractionRatio":case"flatShading":this.updateMaterial()}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.String})],r.prototype,"emissiveColor",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],r.prototype,"refractionRatio",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],r.prototype,"roughness",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],r.prototype,"metalness",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Boolean})],r.prototype,"flatShading",void 0),r=__decorate([e.CustomElement({tagName:`${e.P}-${t.TAG_MIDDLE_NAME}-material-standard`})],r),t.StandardMaterialElement=r}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){class OBJParser{static parse(r){const a=[],i=/^v((\s+-?[\d\.]+){3})/gm;let n=i.exec(r);for(;n&&n.length;)a.push(t.Point3DConverter.convert(n[1])),n=i.exec(r);const o=[],s=/^vt((\s+-?[\d\.]+){2})/gm;for(n=s.exec(r);n&&n.length;)o.push(e.Point.parse(n[1])),n=s.exec(r);const c=new Array(o.length),l=[],m=/^vn((\s+-?[\d\.]+){3})/gm;for(n=m.exec(r);n&&n.length;)l.push(t.Point3DConverter.convert(n[1])),n=m.exec(r);const h=new Array(l.length),p=[],d=/^f((\s+([\d]+\/[\d]+\/[\d]+)){3,})/gm;for(n=d.exec(r);n&&n.length;){const e=/([\d]+)\/([\d]+)\/([\d]+)/g,t=n[1];let i=e.exec(t),s=0;for(var u,v,y,_,f,g,E=p.length;i&&i.length;)s>2&&(p.push(a[u]),c[E]=o[v],h[E]=l[y],E++,p.push(a[_]),c[E]=o[f],h[E]=l[g],E++),_=parseInt(i[1])-1,f=parseInt(i[2])-1,g=parseInt(i[3])-1,p.push(a[_]),c[E]=o[f],h[E]=l[g],0===s&&(u=_,v=f,y=g),s++,E++,i=e.exec(t);n=d.exec(r)}return new t.MeshGeometry(p,[],c,h)}}__decorate([e.Transformer("parse3D")],class Parser3D{static parseGeometry(e,t){if("obj"===t.toLowerCase())return OBJParser.parse(e);throw new Error(`Type '${t}' is not supported.`)}},"parseGeometry",null)}(e.Drawing3D||(e.Drawing3D={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(r){class Pacem3DPrimitiveElement extends t.PacemEventTarget{viewActivatedCallback(){super.viewActivatedCallback(),e.Utils.isNull(this.geometry)&&(this.geometry=this.createDefaultGeometry())}}__decorate([e.Watch({converter:e.PropertyConverters.Json})],Pacem3DPrimitiveElement.prototype,"geometry",void 0),r.Pacem3DPrimitiveElement=Pacem3DPrimitiveElement}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var r;let a=r=class PacemBoxElement extends t.Pacem3DPrimitiveElement{static createMeshGeometry(t,r,a,i,n,o){const s=t||1,c=r||1,l=a||1,m=i||1,h=n||1,p=o||1,d=[],u=[],v=[];for(var y=0;y<=h;y++)for(var _=c/2-c*(1*y)/(1*h),f=0;f<=p;f++)for(var g=-l/2+l*(1*f)/(1*p),E=0;E<=m;E++){var D=-s/2+s*(1*E)/(1*m);0!=E&&E!=m&&0!=f&&f!=p&&0!=y&&y!=h||d.push({x:D,y:_,z:g})}var C=function(e,t,r){for(var a=1e-5,i=0;i<d.length;i++){var n=d[i];if(Math.abs(n.x-e)<a&&Math.abs(n.y-t)<a&&Math.abs(n.z-r)<a)return i}return-1},P=function(e,t,r,a,i,n,o,s){v.push(e),v.push(t),v.push(r),v.push(e),v.push(r),v.push(a),u.push({x:i,y:s}),u.push({x:o,y:s}),u.push({x:o,y:n}),u.push({x:i,y:s}),u.push({x:o,y:n}),u.push({x:i,y:n})};for(f=0;f<p;f++){_=c/2,g=-l/2+l*(1*f)/(1*p);var M=-l/2+l*(1*(f+1))/(1*p);for(E=0;E<m;E++){var w=-s/2+1*(E+1)*s/(1*m);P(C(D=-s/2+1*E*s/(1*m),_,M),C(w,_,M),C(w,_,g),C(D,_,g),1*E/(1*m),1-1*f/(1*p),1*(E+1)/(1*m),1-1*(f+1)/(1*p))}}for(y=0;y<h;y++){_=c/2-1*y*c/(1*h);var b=c/2-(y+1)*c/(1*h);for(g=-l/2,E=0;E<m;E++){w=s/2-(E+1)*s/(1*m);P(C(D=s/2-1*E*s/(1*m),b,g),C(w,b,g),C(w,_,g),C(D,_,g),1*E/(1*m),1-1*y/(1*h),(E+1)/(1*m),1-(y+1)/(1*h))}}for(y=0;y<h;y++)for(_=c/2-1*y*c/(1*h),b=c/2-(y+1)*c/(1*h),D=-s/2,f=0;f<p;f++){M=-l/2+(f+1)*l/(1*p);P(C(D,b,g=-l/2+f*l/(1*p)),C(D,b,M),C(D,_,M),C(D,_,g),1*f/(1*p),1-y/(1*h),(f+1)/(1*p),1-(y+1)/(1*h))}for(y=0;y<h;y++)for(_=c/2-y*c/(1*h),b=c/2-(y+1)*c/(1*h),g=l/2,E=0;E<m;E++){w=-s/2+(E+1)*s/(1*m);P(C(D=-s/2+E*s/(1*m),b,g),C(w,b,g),C(w,_,g),C(D,_,g),1*E/(1*m),1-1*y/(1*h),(E+1)/(1*m),1-(y+1)/(1*h))}for(y=0;y<h;y++)for(_=c/2-y*c/(1*h),b=c/2-(y+1)*c/(1*h),D=s/2,f=0;f<p;f++){M=l/2-(f+1)*l/(1*p);P(C(D,b,g=l/2-f*l/(1*p)),C(D,b,M),C(D,_,M),C(D,_,g),1*f/(1*p),1-1*y/(1*h),(f+1)/(1*p),1-(y+1)/(1*h))}for(f=0;f<p;f++)for(_=-c/2,g=l/2-l*f/(1*p),M=l/2-l*(f+1)/(1*p),E=0;E<m;E++){w=-s/2+(E+1)*s/(1*m);P(C(D=-s/2+E*s/(1*m),_,M),C(w,_,M),C(w,_,g),C(D,_,g),1*E/(1*m),1-1*f/(1*p),(E+1)/(1*m),1-(f+1)/(1*p))}const x=new e.Drawing3D.MeshGeometry(d,v,u);return e.Drawing3D.computeSharpVertexNormals(x),x}createDefaultGeometry(){return r.createMeshGeometry()}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"width":case"height":case"depth":case"widthSegments":case"heightSegments":case"depthSegments":this.geometry=r.createMeshGeometry(this.width,this.height,this.depth,this.widthSegments,this.heightSegments,this.depthSegments)}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"width",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"height",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"depth",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"widthSegments",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"heightSegments",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"depthSegments",void 0),a=r=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-box"})],a),t.PacemBoxElement=a}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var r;let a=r=class PacemCylinderElement extends t.Pacem3DPrimitiveElement{static createMeshGeometry(r,a,i,n,o){const s=r||1;a||(a=1),i||(i=18),n||(n=5),o||(o=1);const c=[],l=[],m=[],h=t.DEG2RAD*(360/i);c.push({x:0,y:a,z:0}),c.push({x:0,y:0,z:0});const p=s/o;for(let e=1;e<=o;e++)for(var d=p*e,u=0;u<i;u++){const t=2+2*i*(e-1),r=0==u?t+2*(i-1):t+2*(u-1),n=t+2*u,p=Math.cos(h*u),v=-Math.sin(h*u),y=Math.cos(h*(u-1)),_=-Math.sin(h*(u-1)),f=d*p,g=d*v,E={x:f,y:a,z:g},D={x:f,y:0,z:g};c.push(E),c.push(D);const C=.5*d/s,P=p*C,M=v*C,w=y*C,b=_*C;if(1==e){const e=[0,r,n],t=[1,n+1,r+1],a=[{x:.5,y:.5},{x:.5+w,y:.5-b},{x:.5+P,y:.5-M}],i=[{x:.5,y:.5},{x:.5+P,y:.5+M},{x:.5+w,y:.5+b}];Array.prototype.push.apply(m,e),Array.prototype.push.apply(m,t);for(let e=0;e<a.length;e++)l.push(a[e]);for(let e=0;e<i.length;e++)l.push(i[e])}else{const t=2+2*i*(e-2),a=0==u?t+2*(i-1):t+2*(u-1),s=t+2*u,c=(e-1)/o*.5,h=p*c,d=v*c,f=y*c,g=_*c,E={x:.5+w,y:.5-b},D={x:.5+P,y:.5-M},C={x:.5+h,y:.5-d},x={x:.5+f,y:.5-g},A={x:.5+w,y:.5+b},N={x:.5+P,y:.5+M},R={x:.5+h,y:.5+d},S={x:.5+f,y:.5+g};m.push(r),m.push(n),m.push(a),m.push(a),m.push(n),m.push(s),m.push(s+1),m.push(n+1),m.push(r+1),m.push(s+1),m.push(r+1),m.push(a+1),l.push(E),l.push(D),l.push(x),l.push(x),l.push(D),l.push(C),l.push(R),l.push(N),l.push(A),l.push(R),l.push(A),l.push(S)}}const v=2+2*i*o,y=2+2*i*(o-1),_=1/i,f=1/n;for(let e=1;e<=n;e++)for(let t=0;t<i;t++){if(e!=n){var g=s*Math.cos(h*t),E=-s*Math.sin(h*t),D=a*e/n;c.push({x:g,y:D,z:E})}const r=0==t?i-1:t-1,o=1==e?y+2*r+1:v+i*(e-2)+r,p=1==e?y+2*t+1:v+i*(e-2)+t,d=e==n?y+2*t:v+i*(e-1)+t,u=r*_,C=(e-1)*f,P=0==t?1:t*_,M=e*f,w={x:u,y:C},b={x:P,y:C},x={x:P,y:M},A={x:u,y:M};m.push(o),m.push(p),m.push(d),l.push(w),l.push(b),l.push(x),l.push(w),l.push(x),l.push(A)}return new e.Drawing3D.MeshGeometry(c,m,l)}createDefaultGeometry(){return r.createMeshGeometry()}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"radius":case"height":case"sides":case"heightSegments":case"capSegments":this.geometry=r.createMeshGeometry(this.radius,this.height,this.sides,this.heightSegments,this.capSegments)}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"radius",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"height",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"sides",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"heightSegments",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"capSegments",void 0),a=r=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-cylinder"})],a),t.PacemCylinderElement=a}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var r;const a=[{x:0,y:0,z:0},{x:0,y:1,z:0}];let i=r=class PacemLineElement extends t.Pacem3DPrimitiveElement{static createLineGeometry(t){return new e.Drawing3D.LineGeometry(t||a)}createDefaultGeometry(){return r.createLineGeometry()}propertyChangedCallback(e,t,a,i){if(super.propertyChangedCallback(e,t,a,i),"positions"===e)this.geometry=r.createLineGeometry(a)}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Json})],i.prototype,"positions",void 0),i=r=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-line"})],i),t.PacemLineElement=i}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var r;let a=r=class PacemPlaneElement extends t.Pacem3DPrimitiveElement{static createMeshGeometry(t,r,a,i){t||(t=1),r||(r=1),a||(a=4),i||(i=4);const n=[],o=[],s=[],c=[],l=e.Geometry.LinearAlgebra.Vector3D.from(0,0,1);for(let e=0;e<=i;e++)for(let m=0;m<=a;m++){const h=-t/2+m*t/(1*a),p=0,d=-r/2+e*r/(1*i);if(n.push({x:h,y:p,z:d}),e<i&&m<a){const t=a+1,r=(m+1)/(1*a),n=1*m/(1*a),h=1-(e+1)/(1*i),p=1-1*e/(1*i);s.push((e+1)*t+m),s.push((e+1)*t+m+1),s.push(e*t+m+1),s.push((e+1)*t+m),s.push(e*t+m+1),s.push(e*t+m),o.push({x:n,y:h}),o.push({x:r,y:h}),o.push({x:r,y:p}),o.push({x:n,y:h}),o.push({x:r,y:p}),o.push({x:n,y:p}),c.push(l,l,l,l,l,l)}}return new e.Drawing3D.MeshGeometry(n,s,o,c)}createDefaultGeometry(){return r.createMeshGeometry()}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"width":case"length":case"widthSegments":case"lengthSegments":this.geometry=r.createMeshGeometry(this.width,this.length,this.widthSegments,this.lengthSegments)}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"width",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"length",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"widthSegments",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"lengthSegments",void 0),a=r=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-plane"})],a),t.PacemPlaneElement=a}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var r,a,i,n,o;const s=function(e){const t=/([\d.-]+)/i;var r=t.exec(e);const a=[];for(;null!=r;){const i=r[0],n=parseFloat(i);a.push(n),e=e.replace(i,""),r=t.exec(e)}return a},c=e.Geometry.LinearAlgebra.Vector3D;class PolyhedronElement extends t.Pacem3DPrimitiveElement{propertyChangedCallback(e,t,r,a){super.propertyChangedCallback(e,t,r,a),"radius"===e&&this._assignMeshGeometry(r)}_assignMeshGeometry(e){this.geometry=this.createMeshGeometry(e>0?e:1)}createDefaultGeometry(){return this.createMeshGeometry(1)}}__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],PolyhedronElement.prototype,"radius",void 0),t.PolyhedronElement=PolyhedronElement;let l=r=class PacemTetrahedronElement extends PolyhedronElement{static createMeshGeometry(t){t||(t=1);const r="0 0.5774 -0.8165, 0 0.5774 0.8165, 0.8165 -0.5774 0, -0.8165 -0.5774 0".split(","),a=[];for(let e=0;e<r.length;e++){const i=r[e],n=s(i);a.push({x:n[0]*t,y:n[1]*t,z:n[2]*t})}const i="0.5 0.9995, 0.5 0.0004995, 0.0004995 0.5, 0.9995 0.5, 0.5 0.0004995, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.5 0.0004995".split(","),n=[4,5,6,7,8,9,10,11,0,3,2,1],o=[];for(let e=0;e<n.length;e++){const t=s(i[n[e]]);o.push({x:t[0],y:t[1]})}const c=new e.Drawing3D.MeshGeometry(a,[1,2,0,2,3,0,3,1,0,3,2,1],o);return e.Drawing3D.computeSharpVertexNormals(c),c}createMeshGeometry(e=this.radius){return r.createMeshGeometry(e)}};l=r=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-tetrahedron"})],l),t.PacemTetrahedronElement=l;let m=a=class PacemOctahedronElement extends PolyhedronElement{static createMeshGeometry(t){t||(t=1);const r=[6,7,8,9,10,11,12,13,14,15,16,0,17,18,19,20,21,1,2,22,23,4,3,5],a="0 0.7071 -0.7071, 0 0.7071 0.7071, 1 0 0, 0 -0.7071 -0.7071, -1 0 0, 0 -0.7071 0.7071".split(","),i=[];for(let e=0;e<a.length;e++){const r=a[e],n=s(r);i.push({x:n[0]*t,y:n[1]*t,z:n[2]*t})}const n="0.5 0.9995, 0.5 0.9995, 0.0004995 0.5, 0.5 0.9995, 0.9995 0.5, 0.5 0.0004995, 0.5 0.0004995, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.5 0.0004995, 0.5 0.9995, 0.5 0.0004995, 0.9995 0.5, 0.5 0.9995, 0.0004995 0.5, 0.5 0.0004995, 0.0004995 0.5, 0.5 0.0004995, 0.5 0.9995, 0.5 0.0004995, 0.9995 0.5, 0.5 0.0004995, 0.5 0.9995".split(","),o=[];for(let e=0;e<r.length;e++){const t=s(n[r[e]]);o.push({x:t[0],y:t[1]})}const c=new e.Drawing3D.MeshGeometry(i,[1,2,0,2,3,0,3,4,0,4,1,0,4,5,1,5,2,1,2,5,3,4,3,5],o);return e.Drawing3D.computeSharpVertexNormals(c),c}createMeshGeometry(e=this.radius){return a.createMeshGeometry(e)}};m=a=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-octahedron"})],m),t.PacemOctahedronElement=m;let h=i=class PacemHexahedronElement extends PolyhedronElement{static createMeshGeometry(t){t||(t=1);const r=2*t*(1/Math.sqrt(3));return e.Components.Drawing3D.PacemBoxElement.createMeshGeometry(r,r,r)}createMeshGeometry(e=this.radius){return i.createMeshGeometry(e)}};h=i=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-hexahedron"})],h),t.PacemHexahedronElement=h;let p=n=class PacemIcosahedronElement extends PolyhedronElement{static createMeshGeometry(t){t||(t=1);const r=[12,13,14,15,16,17,18,19,20,21,22,23,24,25,0,26,27,28,29,30,31,32,33,1,34,35,36,2,37,38,39,40,41,42,43,7,44,45,46,8,47,48,49,50,51,52,53,9,54,55,3,10,56,57,6,58,59,5,4,11],a="0 0.850651 -0.525731, 0 0.850651 0.525731, 0.850651 0.525731 0, 0.525731 0 -0.850651, -0.525731 0 -0.850651, -0.850651 0.525731 0, -0.525731 0 0.850651, 0.525731 0 0.850651, 0.850651 -0.525731 0, 0 -0.850651 0.525731, 0 -0.850651 -0.525731, -0.850651 -0.525731 0".split(","),i=[];for(let e=0;e<a.length;e++){const r=a[e],n=s(r);i.push({x:n[0]*t,y:n[1]*t,z:n[2]*t})}const n="0.5 0.808708, 0.5 0.999501, 0.5 0.808708, 0.191292 0.5, 0.000499547 0.5, 0.5 0.808708, 0.9995 0.5, 0.808708 0.5,0.000499487 0.5, 0.5 0.191292, 0.5 0.000499487, 0.5 0.191292,0.5 0.191292, 0.999501 0.5, 0.5 0.808708, 0.5 0.808708,0.9995 0.5, 0.808708 0.999501, 0.191292 0.5, 0.808708 0.5,0.5 0.999501, 0.808708 0.5, 0.999501 0.808708, 0.5 0.999501,0.000499487 0.5, 0.5 0.191292, 0.5 0.808708, 0.9995 0.5,0.808708 0.999501, 0.191292 0.5, 0.808708 0.5, 0.5 0.999501,0.808708 0.5, 0.999501 0.808708, 0.5 0.808708, 0.5 0.191292,0.9995 0.5, 0.000499547 0.5, 0.5 0.191292, 0.191292 0.5,0.5 0.000499487, 0.808708 0.5, 0.5 0.000499487, 0.999501 0.191292,0.5 0.191292, 0.808708 0.000499487, 0.9995 0.5, 0.5 0.191292,0.5 0.808708, 0.9995 0.5, 0.5 0.191292, 0.808708 0.000499487,0.999501 0.5, 0.5 0.808708, 0.5 0.000499487, 0.808708 0.5,0.999501 0.191292, 0.808708 0.5, 0.5 0.808708, 0.5 0.191292".split(","),o=[];for(let e=0;e<r.length;e++){const t=s(n[r[e]]);o.push({x:t[0],y:t[1]})}const c=new e.Drawing3D.MeshGeometry(i,[1,2,0,2,3,0,3,4,0,4,5,0,5,1,0,5,6,1,6,7,1,7,2,1,2,8,3,2,7,8,6,9,7,9,8,7,8,10,3,8,9,10,6,11,9,11,10,9,10,4,3,10,11,4,6,5,11,5,4,11],o);return e.Drawing3D.computeSharpVertexNormals(c),c}createMeshGeometry(e=this.radius){return n.createMeshGeometry(e)}};p=n=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-icosahedron"})],p),t.PacemIcosahedronElement=p;let d=o=class PacemDodecahedronElement extends PolyhedronElement{static createMeshGeometry(t){t||(t=1);const r=[c.from(.356822*t,.934172*t,0*t),c.from(-.356822*t,.934172*t,0*t),c.from(.57735*t,.57735*t,-.57735*t),c.from(0*t,.356822*t,-.934172*t),c.from(-.57735*t,.57735*t,-.57735*t),c.from(-.57735*t,.57735*t,.57735*t),c.from(0*t,.356822*t,.934172*t),c.from(.57735*t,.57735*t,.57735*t),c.from(.934172*t,0*t,-.356822*t),c.from(.934172*t,0*t,.356822*t),c.from(0*t,-.356822*t,.934172*t),c.from(.57735*t,-.57735*t,.57735*t),c.from(.57735*t,-.57735*t,-.57735*t),c.from(.356822*t,-.934172*t,0*t),c.from(-.57735*t,-.57735*t,.57735*t),c.from(-.356822*t,-.934172*t,0*t),c.from(0*t,-.356822*t,-.934172*t),c.from(-.57735*t,-.57735*t,-.57735*t),c.from(-.934172*t,0*t,.356822*t),c.from(-.934172*t,0*t,-.356822*t)],a=[20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,0,46,47,48,49,50,51,7,52,53,54,55,56,57,58,59,60,61,9,62,63,64,65,66,67,11,68,69,70,71,72,73,74,75,76,77,13,78,79,80,81,82,83,15,84,85,86,87,88,89,90,91,92,93,17,94,95,96,97,98,99,19,1,4,100,14,101,102,10,103,18,6,5,104,2,105,106,8,107,3,12,16],i="0.5 0.999501, 0.5 0.999501, 0.191292 0.808708, 0.5 0.690792, 0.191292 0.808708, 0.191292 0.808708, 0.5 0.690792, 0.808708 0.808708, 0.000499517 0.5, 0.309208 0.5, 0.5 0.309208, 0.191292 0.191292, 0.191292 0.191292, 0.309208 0.5, 0.191292 0.191292, 0.5 0.000499517, 0.5 0.309208, 0.808708 0.191292, 0.000499517 0.5, 0.309208 0.5, 0.690792 0.5, 0.808708 0.808708, 0.5 0.999501, 0.690792 0.5, 0.5 0.999501, 0.191292 0.808708, 0.690792 0.5, 0.191292 0.808708, 0.309208 0.5, 0.309208 0.5, 0.191292 0.191292, 0.5 0.000499517, 0.309208 0.5, 0.5 0.000499517, 0.808708 0.191292, 0.309208 0.5, 0.808708 0.191292, 0.690792 0.5, 0.191292 0.808708, 0.309208 0.5, 0.690792 0.5, 0.191292 0.808708, 0.690792 0.5, 0.808708 0.808708, 0.191292 0.808708, 0.808708 0.808708, 0.808708 0.808708, 0.5 0.690792, 0.5 0.309208, 0.808708 0.808708, 0.5 0.309208, 0.808708 0.191292, 0.808708 0.191292, 0.9995 0.5, 0.191292 0.191292, 0.5 0.000499517, 0.808708 0.191292, 0.191292 0.191292, 0.808708 0.191292, 0.690792 0.5, 0.191292 0.191292, 0.690792 0.5, 0.191292 0.191292, 0.5 0.000499517, 0.808708 0.191292, 0.191292 0.191292, 0.808708 0.191292, 0.690792 0.5, 0.690792 0.5, 0.309208 0.5, 0.690792 0.5, 0.808708 0.808708, 0.5 0.999501, 0.690792 0.5, 0.5 0.999501, 0.191292 0.808708, 0.690792 0.5, 0.191292 0.808708, 0.5 0.000499517, 0.808708 0.191292, 0.690792 0.5, 0.5 0.000499517, 0.690792 0.5, 0.309208 0.5, 0.309208 0.5, 0.191292 0.191292, 0.9995 0.5, 0.808708 0.808708, 0.5 0.690792, 0.9995 0.5, 0.5 0.690792, 0.5 0.309208, 0.9995 0.5, 0.5 0.309208, 0.309208 0.5, 0.690792 0.5, 0.808708 0.808708, 0.309208 0.5, 0.808708 0.808708, 0.5 0.999501, 0.000499517 0.5, 0.5 0.309208, 0.000499517 0.5, 0.5 0.690792, 0.5 0.690792, 0.000499517 0.5, 0.5 0.690792, 0.191292 0.191292".split(","),n=[];for(let e=0;e<a.length;e++){const t=s(i[a[e]]);n.push({x:t[0],y:t[1]})}const o=new e.Drawing3D.MeshGeometry(r,[0,2,3,0,3,4,0,4,1,1,5,6,1,6,7,1,7,0,7,9,8,7,8,2,7,2,0,7,6,10,7,10,11,7,11,9,11,13,12,11,12,8,11,8,9,11,10,14,11,14,15,11,15,13,15,17,16,15,16,12,15,12,13,15,14,18,15,18,19,15,19,17,19,4,3,19,3,16,19,16,17,19,18,5,19,5,1,19,1,4,18,14,10,18,10,6,18,6,5,3,2,8,3,8,12,3,12,16],n);return e.Drawing3D.computeSharpVertexNormals(o),o}createMeshGeometry(e=this.radius){return o.createMeshGeometry(e)}};d=o=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-dodecahedron"})],d),t.PacemDodecahedronElement=d}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var r;let a=r=class PacemSphereElement extends t.Pacem3DPrimitiveElement{static createMeshGeometry(r,a){const i=[],n=[],o=[],s=r||1,c=a||8,l=t.DEG2RAD*(360/c),m=c%2==0?c/2:(c-1)/2;i.push({x:0,y:s,z:0});for(let e=1;e<m;e++){const t=l*e,r=Math.cos(t),a=Math.sin(t),h=1-1*e/m;for(let t=0;t<c;t++){const p=l*t-Math.PI/2,d=s*a*Math.cos(p),u=s*r,v=s*a*Math.sin(p);i.push({x:d,y:u,z:v});const y=0==t?c-1:t-1,_=0==t?0:1-1*t/c,f=1-1*y/c;if(1==e)o.push(1+t),o.push(1+y),o.push(0),n.push({x:_,y:h}),n.push({x:f,y:h}),n.push({x:.5,y:1});else{o.push((e-1)*c+t+1),o.push((e-1)*c+y+1),o.push((e-2)*c+y+1),o.push((e-1)*c+t+1),o.push((e-2)*c+y+1),o.push((e-2)*c+t+1);const r=1-(e-1)/m;n.push({x:_,y:h}),n.push({x:f,y:h}),n.push({x:f,y:r}),n.push({x:_,y:h}),n.push({x:f,y:r}),n.push({x:_,y:r})}}}i.push({x:0,y:-s,z:0});const h=i.length-1;for(let e=0;e<c;e++){const t=m-2,r=0==e?c-1:e-1,a=0==e?0:1-1*e/c,i=1-1*r/c,s=1-(t+1)/m;o.push(h),o.push(t*c+1+r),o.push(t*c+1+e),n.push({x:.5,y:0}),n.push({x:i,y:s}),n.push({x:a,y:s})}return new e.Drawing3D.MeshGeometry(i,o,n)}createDefaultGeometry(){return r.createMeshGeometry()}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"radius":case"segments":this.geometry=r.createMeshGeometry(this.radius,this.segments)}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"radius",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"segments",void 0),a=r=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-sphere"})],a),t.PacemSphereElement=a}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={})),function(e){!function(t){!function(t){var r;let a=r=class PacemTorusElement extends t.Pacem3DPrimitiveElement{static createMeshGeometry(r,a,i,n){const o=[],s=[],c=[];i||(i=24),n||(n=12);const l=t.DEG2RAD*(360/i),m=t.DEG2RAD*(360/n),h=r||1,p=a||.25;for(let e=0;e<i;e++){const t=l*e-Math.PI/2,r=Math.sin(t),a=Math.cos(t);for(let t=0;t<n;t++){const l=m*t+Math.PI,d=Math.cos(l),u=h*a+p*d*a,v=p*Math.sin(l),y=h*r+p*d*r;o.push({x:u,y:v,z:y});const _=e>0?e-1:i-1,f=t>0?t-1:n-1,g=0==e?0:1-1*e/i,E=t>0?1*t/n:1,D=e>0?1-(e-1)/i:1/i,C=t>0?(t-1)/n:1-1/n;c.push(e*n+f),c.push(_*n+f),c.push(_*n+t),c.push(e*n+f),c.push(_*n+t),c.push(e*n+t),s.push({x:g,y:C}),s.push({x:D,y:C}),s.push({x:D,y:E}),s.push({x:g,y:C}),s.push({x:D,y:E}),s.push({x:g,y:E})}}return new e.Drawing3D.MeshGeometry(o,c,s)}createDefaultGeometry(){return r.createMeshGeometry()}propertyChangedCallback(e,t,a,i){switch(super.propertyChangedCallback(e,t,a,i),e){case"radius":case"innerRadius":case"segments":case"sides":this.geometry=r.createMeshGeometry(this.radius,this.innerRadius,this.segments,this.sides)}}};__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"radius",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"innerRadius",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"segments",void 0),__decorate([e.Watch({emit:!1,converter:e.PropertyConverters.Number})],a.prototype,"sides",void 0),a=r=__decorate([e.CustomElement({tagName:e.P+"-"+t.TAG_MIDDLE_NAME+"-primitive-torus"})],a),t.PacemTorusElement=a}(t.Drawing3D||(t.Drawing3D={}))}(e.Components||(e.Components={}))}(Pacem||(Pacem={}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
/// <reference path="pacem-core.d.ts" />
|
|
7
7
|
/// <reference path="pacem-foundation.d.ts" />
|
package/dist/js/pacem-charts.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
7
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
var Pacem,__decorate=this&&this.__decorate||function(t,e,i,r){var s,a=arguments.length,n=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(n=(a<3?s(n):a>3?s(e,i,n):s(e,i))||n);return a>3&&n&&Object.defineProperty(e,i,n),n},__classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(t,e,i,r,s){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?s.call(t,i):s?s.value=i:e.set(t,i),i},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(t,e,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(t):r?r.value:e.get(t)};!function(t){!function(e){!function(i){i.MANAGED_EVENTS=["keydown","keyup","click","dblclick","mouseover","mouseout","mouseenter","mouseleave","mousedown","mouseup","mousemove","contextmenu"];const r=864e5,s="pacem:chart-series:dataitem",a="pacem:chart-series:series";function n(t,e,i){i>0||(i=o(t,e));const r=(a=i,n=e-t,Math.log10(n)/Math.log10(a)),s=Math.pow(i,Math.floor(r));var a,n;return{min:Math.floor(t/s)*s,max:Math.ceil(e/s)*s,round:s}}function o(t,e){const i=e-t;if(!(i>0))return 2;const r=Math.floor(Math.log10(i)),s=Math.pow(10,-r);if(0!=r)return o(t*s,e*s);const a=t=>{const e=Math.floor(10*Math.abs(t));return(e+10-e%10).roundoff()},n=a(i);let h=10;0!==t&&(h=a(Math.abs(e)));const c=l(h,n);return 1===c?n:Math.max(c,10-c)}function l(t,e){return t<=0?e:l(e%t,t)}class ChartEvent extends t.CustomUIEvent{constructor(t,e,i){super(t,e,i)}}i.ChartEvent=ChartEvent;let h=class PacemChartSeriesElement extends e.PacemItemElement{get values(){return this.datasource}};__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.Json})],h.prototype,"datasource",void 0),__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.String})],h.prototype,"label",void 0),__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.String})],h.prototype,"color",void 0),__decorate([t.Watch({emit:!0,converter:t.PropertyConverters.Boolean})],h.prototype,"datapoints",void 0),__decorate([t.Watch()],h.prototype,"_uiElements",void 0),h=__decorate([t.CustomElement({tagName:t.P+"-chart-series"})],h),i.PacemChartSeriesElement=h;const c="http://www.w3.org/2000/svg";class PacemSeriesChartElement extends e.PacemItemsContainerElement{constructor(){super(),this._itemPropertyChangedCallback=t=>{const e=t.detail.propertyName;"datasource"!==e&&"label"!==e&&"datapoints"!==e&&"cssClass"!==e&&"color"!==e||this.draw()},this._series=[],this._resizeHandler=t=>{this._size=t.detail,this.draw()},this._broadcastHandler=e=>{const i=e.currentTarget,r=t.CustomElementUtils.getAttachedPropertyValue(i,s);if(t.Utils.isNull(r))return;const n=this.getAnchorPoint(i),o=new ChartEvent("item"+e.type,{detail:{dataItem:r,anchorPoint:n}},e),l=t.CustomElementUtils.getAttachedPropertyValue(i,a);l instanceof h&&l.dispatchEvent(o),this.dispatchEvent(o)},this._key=t.Utils.uniqueCode()}validate(t){return t instanceof h}register(e){return!!super.register(e)&&(e.addEventListener(t.PropertyChangeEventName,this._itemPropertyChangedCallback,!1),!0)}unregister(e){return!!super.unregister(e)&&(e.removeEventListener(t.PropertyChangeEventName,this._itemPropertyChangedCallback,!1),!0)}propertyChangedCallback(e,i,r,s){if(super.propertyChangedCallback(e,i,r,s),"target"===e){this._div!=i&&this._div&&this._div.remove(),this._div=null,this._body=null;const e=i;e&&(e.classList.remove(t.PCSS+"-chart-area"),e.innerHTML=""),this._ensureResizer(),this.draw()}else if(!s)switch(e){case"items":this._databindAndDrawDebounced();break;case"datasource":this._databind();case"yAxisDensity":case"xAxisType":case"xAxisPosition":case"yAxisFormat":this.draw()}}_databindAndDrawDebounced(){cancelAnimationFrame(this._handle),this._handle=requestAnimationFrame((()=>{this._databind(),this.draw()}))}_databind(){this._datasource=t.Utils.isNullOrEmpty(this.datasource)?this.items:this.datasource}disconnectedCallback(){this._div&&this._div.remove();const e=this._resizer;t.Utils.isNull(e)||(e.removeEventListener(t.Components.ResizeEventName,this._resizeHandler,!1),e.remove(),this._resizer=null),super.disconnectedCallback()}viewActivatedCallback(){super.viewActivatedCallback(),this._ensureResizer(),this._databind(),this.draw()}_ensureResizer(i=this.target||this._div){if(t.Utils.isNull(this._resizer)){const i=t.CustomElementUtils.findAncestorShell(this);(this._resizer=i.appendChild(new e.PacemResizeElement)).addEventListener(t.Components.ResizeEventName,this._resizeHandler,!1)}this._resizer.target=i}get chartSize(){return this._size}get chartSeries(){return this._series}get chartBody(){return this._body}get chartGrid(){return this._grid}get chartMask(){return this._mask}get chartKey(){return this._key}get chartContainer(){return this._div}assignUiBehaviors(e,r,n,o){const l=!t.Utils.isNull(t.CustomElementUtils.getAttachedPropertyValue(e,s)),h={series:r.label,label:n.label,value:n.value,color:o||r.color};t.CustomElementUtils.setAttachedPropertyValue(e,s,h),t.CustomElementUtils.setAttachedPropertyValue(e,a,r),l||i.MANAGED_EVENTS.forEach((t=>{e.addEventListener(t,this._broadcastHandler)}))}disposeUiBehaviors(e){t.CustomElementUtils.deleteAttachedPropertyValue(e,s),t.CustomElementUtils.deleteAttachedPropertyValue(e,a),i.MANAGED_EVENTS.forEach((t=>{e.removeEventListener(t,this._broadcastHandler)}))}ensureChartContainer(){if(t.Utils.isNull(this._div)){let e=this._div=this.target||document.createElement("div");e.classList.add(t.PCSS+"-chart-area"),e!=this.target&&this.parentElement.insertBefore(e,this)}return this._div}ensureChartBody(e,i,r){if(t.Utils.isNull(this._body)){let i=this._body=document.createElementNS(c,"svg");i.setAttribute("pacem",""),i.setAttribute("class",t.PCSS+"-"+e+"-chart"),i.setAttribute("preserveAspectRatio","xMinYMax slice");const r=this._grid=document.createElementNS(c,"svg");r.setAttribute("pacem",""),r.setAttribute("class","chart-grid");let s=document.createElementNS(c,"defs"),a=this._mask=document.createElementNS(c,"mask"),n=document.createElementNS(c,"rect");n.setAttribute("x","0"),n.setAttribute("y","0"),n.setAttribute("width","100%"),n.setAttribute("height","100%");let o=document.createElementNS(c,"rect");o.setAttribute("y","0"),o.setAttribute("width","100%"),o.setAttribute("fill","#fff"),a.id="gnrc_mask_"+this._key,a.appendChild(n),a.appendChild(o),s.appendChild(a),i.appendChild(s),i.appendChild(r),this._div.appendChild(i)}return this._body}chartDataItemToPoint(e,i){switch(this.xAxisType||"string"){case"number":return{x:parseFloat(e.label),y:e.value};case"date":return{x:t.Utils.parseDate(e.label).valueOf(),y:e.value};case"string":return{x:i.findIndex((t=>t.label==e.label)),y:e.value};default:throw"Not supported."}}getVirtualGrid(e,i,s,a,o,l=this.xAxisType,h){const c=n(a,o,h),d=c.round;var u=[];for(let t=c.min;t<=c.max;t+=d)u.push(t.roundoff());let m=t.Utils.lang(this),p=null;const v=this.xAxisFormat;if(!t.Utils.isNullOrEmpty(v))switch(l){case"number":p=t=>Intl.NumberFormat(m,v).format(t);break;case"date":p=e=>Intl.DateTimeFormat(m,v).format(t.Utils.parseDate(e))}const g=function(e,i,s,a,n,o=10){const l="number"===i||"date"===i?a-s:Math.max(1,e.length-1);for(var h=[],c=1,d=o-1;d>1;d--)if(l%d==0){c=l/d;break}1===c&&l>o&&(c=l);const u="function"==typeof n?n:c>=r?t=>t.toLocaleDateString(n):t=>t.toLocaleTimeString(n),m="function"==typeof n?n:c<r?t=>t.toLocaleString(n):u,p="function"==typeof n?n:t=>t.toLocaleString(n);for(var v=0;v<=l;v+=c){let r;switch(i){case"string":if(v>=e.length)continue;r=e[v].label;break;case"number":r=p(s+v);break;case"date":r=(0==v?m:u)(t.Utils.parseDate(s+v));break;default:throw"Not supported."}h.push(r)}return h}(e,l,i,s,null!=p?p:m);return{x:g,y:u}}wipeOut(t=this._series,e=0){for(var i=t.length-1;i>=e;i--)t[i].remove();t.splice(e)}buildLinearGradient(e,i=!1){const r=document.createElementNS(c,"linearGradient");r.id=this.chartKey+"_grad"+e+(i?"_inverted":""),i&&t.Utils.addClass(r,"bottom-up"),r.setAttribute("x1","0%"),r.setAttribute("x2","0%"),r.setAttribute("y1","0%"),r.setAttribute("y2","100%"),r.setAttribute("spreadMethod","pad");const s=document.createElementNS(c,"stop");s.setAttribute("offset","0%");const a=document.createElementNS(c,"stop");return a.setAttribute("offset","100%"),r.appendChild(s),r.appendChild(a),r}setGradientColor(t,e){for(let i=0;i<t.children.length;i++){const r=t.children.item(i);r instanceof SVGStopElement&&(r.style.stopColor=e)}}estimateYAxisLabelWidth(t){const e=this.formatYAxisLabel(t);return this.estimateLabelWidth(e)}estimateLabelWidth(e){const i=this._grid;if(t.Utils.isNull(i))throw new Error("Unable to estimate label without an underlying grid available.");const r=document.createElementNS(c,"text");r.textContent=e,i.appendChild(r);const s=t.Utils.offset(r);return r.remove(),s.width}formatYAxisLabel(e){const i=this.yAxisFormat;return t.Utils.isNullOrEmpty(i)?e.toString():Intl.NumberFormat(t.Utils.lang(this),i).format(e)}estimateXAxisLabelWidth(t){const e=this.formatXAxisLabel(t);return this.estimateLabelWidth(e)}formatXAxisLabel(e){const i=this.xAxisFormat,r=t.Utils.lang(this);switch(this.xAxisType){case"date":const s=t.Utils.Dates.parse(e);return t.Utils.isNullOrEmpty(i)?s.toLocaleString(r):Intl.DateTimeFormat(r,i).format(s);case"number":const a=e;return t.Utils.isNullOrEmpty(i)?a.toLocaleString(r):Intl.NumberFormat(r,i).format(a);default:return e}}draw(){this.drawSeries(this._datasource)}getAnchorPoint(e){const i=t.Utils.offset(e);return{x:i.left+.5*i.width,y:i.top+.5*i.height}}}__decorate([t.Watch({converter:t.PropertyConverters.Element})],PacemSeriesChartElement.prototype,"target",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],PacemSeriesChartElement.prototype,"xAxisType",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],PacemSeriesChartElement.prototype,"xAxisPosition",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],PacemSeriesChartElement.prototype,"datasource",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Number})],PacemSeriesChartElement.prototype,"yAxisDensity",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],PacemSeriesChartElement.prototype,"yAxisFormat",void 0),__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.Json})],PacemSeriesChartElement.prototype,"xAxisFormat",void 0),__decorate([t.Throttle(!0)],PacemSeriesChartElement.prototype,"draw",null),i.PacemSeriesChartElement=PacemSeriesChartElement}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){const i="http://www.w3.org/2000/svg";let r=class PacemColumnChartElement extends e.PacemSeriesChartElement{constructor(){super(...arguments),this.groupWidth=0}propertyChangedCallback(t,e,i,r){super.propertyChangedCallback(t,e,i,r),"type"!==t&&"groupWidth"!==t||this.draw()}_safen(t=this.groupWidth){return Math.min(1,Math.max(t||.75,0))}drawSeries(e){if(!this.isReady||t.Utils.isNull(this.chartSize))return;this.ensureChartContainer();const r=this.type||"cluster",s=24;var a=this.chartSize;if(a.height<=s||a.width<=s)return;if(t.Utils.isNullOrEmpty(e)||e.every((e=>t.Utils.isNullOrEmpty(e.values))))return void this.wipeOut();const n=this.ensureChartBody("column",a.width,a.height);this.log(t.Logging.LogLevel.Debug,`Drawing ${r} chart.`);const o=this.xAxisType||"string";let l=0,h=0,c=0,d=0,u=0,m=1;const p={negative:[],positive:[]};for(let i of e){let e=i.values;if(!t.Utils.isNullOrEmpty(e)){let t=0;for(let i of e){p.positive[t]=p.positive[t]||0,p.negative[t]=p.negative[t]||0;let r=this.chartDataItemToPoint(i,e);l=Math.min(l,r.y),h=Math.max(h,r.y),c=Math.min(c,r.x),d=Math.max(d,r.x),r.y>0?p.positive[t]+=r.y:r.y<0&&(p.negative[t]+=r.y),t++}u=Math.max(u,e.length)}}const v="stack"===r;v&&(l=Math.min.apply(null,p.negative),h=Math.max.apply(null,p.positive));const g=Math.max(s,this.estimateYAxisLabelWidth(h)+12);0===d&&d===c&&(d=1);const y=(d-c)/u,f=.5*y,_=y*this._safen(this.groupWidth),b=.5*_,C=e.find((e=>!t.Utils.isNullOrEmpty(e.values))),A=this.getVirtualGrid(C.values,c-f,d+f,l,h,o,this.yAxisDensity),E=A.y[A.y.length-1],x=A.y[0];if(E===x)return;const w=a.width-2*g,S=a.height-48,N=S*(1-(E-x-(h-l))/(E-x)),P=S*(E-h)/(E-x);m=w/N,n.setAttribute("height",a.height.toString()),n.setAttribute("width",a.width.toString()),n.setAttribute("viewBox",`0 0 ${a.width} ${a.height}`);let U=0;const M=100*m/(d-c),k=100/(h-l),$=2400/N,L=this.chartSeries,W=this.chartGrid,T=(f-c)*M,O=(t,e)=>{const i=this.chartDataItemToPoint(t,e);return{x:T+2*i.x*T,y:i.y*k}};var D=new Array(u);for(let r of e){let s,a,n,o;if(L.length>U)s=L[U],a=s.firstElementChild.firstElementChild,n=s.firstElementChild.lastElementChild,o=s.lastElementChild;else{s=document.createElementNS(i,"svg"),s.setAttribute("pacem",""),W.insertAdjacentElement("afterend",s);const t=document.createElementNS(i,"defs");t.appendChild(a=this.buildLinearGradient(U)),t.appendChild(n=this.buildLinearGradient(U,!0)),s.appendChild(t),s.appendChild(o=document.createElementNS(i,"g")),L.push(s)}var F="chart-series series-fill";t.Utils.isNullOrEmpty(r.className)||(F+=" "+r.className),s.setAttribute("class",F),s.setAttribute("x",g.toString()),s.setAttribute("y",P.toString()),s.setAttribute("width",w.toString()),s.setAttribute("height",(N+48).toString());const l=r.values,h=t=>{for(;t>=o.children.length;)o.appendChild(document.createElementNS(i,"rect"));const e=o.children.item(t);e.style.stroke=r.color;const s=l[t].value<0?n:a;return this.setGradientColor(s,r.color),e.style.fill=`url(#${s.id})`,e},c=10,d=(t,e,i,r=e)=>{const s=-Math.max(e.y,i.y),a=Math.abs(i.y-e.y),n=()=>{t.setAttribute("y",s.toFixed(c)),t.setAttribute("height",a.toFixed(c))};t.hasAttribute("y")?n():(t.setAttribute("y","-"+r.y.toFixed(c)),t.setAttribute("height","0"),requestAnimationFrame(n))};if(!t.Utils.isNullOrEmpty(l)){const i=O({value:0,label:l[0].label},l);if(v){const e=b*M,s=(_*M).toFixed(c);for(let a=0;a<l.length;a++){const n=l[a];t.Utils.isNullOrEmpty(D[a])&&(D[a]={positive:0,negative:0});const o=D[a];let u=o.positive,m=o.negative;const p=n.value<0,v=p?m:u+n.value,g=p?m+n.value:u,y=O({label:n.label,value:v},l),f=O({label:n.label,value:g},l),_=y.x-e,b=h(a);this.assignUiBehaviors(b,r,n),b.setAttribute("x",_.toFixed(c)),b.setAttribute("width",s),d(b,f,y,i),p?o.negative=g:o.positive=v}}else{const t=b*M,s=2*t/e.length,a=s.toFixed(c);for(let e=0;e<l.length;e++){const n=l[e],o=O(n,l),u=o.x-t+s*U,m=h(e);this.assignUiBehaviors(m,r,n),m.setAttribute("x",u.toFixed(c)),m.setAttribute("width",a),d(m,i,o)}}}for(let t=o.children.length-1;t>=(null==l?void 0:l.length);t--){const e=o.children.item(t);this.disposeUiBehaviors(e),e.remove()}U++}this.wipeOut(L,U);const B=`0 ${-(h*k+$)} ${100*m} ${100+2*$}`;for(var G of L)G.setAttribute("viewBox",B);let H,z=this.chartMask.children.item(1);if(z.setAttribute("x",(0).toString()),z.setAttribute("height",(a.height-s).toString()),W.setAttribute("viewBox",`0 0 ${a.width} ${a.height}`),A.x.length<1||A.y.length<=1){for(let t=W.children.length-1;t>=0;t--)W.children.item(t).remove();return}W.children.length>0?H=W.children.item(0):(H=document.createElementNS(i,"path"),W.appendChild(H));let V=0,R=(t,e,r,s)=>{const a=t+1;let n;return W.children.length<=a?(n=document.createElementNS(i,"text"),W.appendChild(n)):n=W.children.item(a),n.textContent=s,n.setAttribute("x",e.toString()),n.setAttribute("y",r.toString()),n},I=`M${g},24 v${S}`,Y=0;const j=w/A.x.length,J=S/(A.y.length-1);if("none"!==this.xAxisPosition){const t=.5*j+g;for(var q of A.x){let e=t+Y*j;if("top"===this.xAxisPosition){I+=` M${e},24 v-6`;let t=R(V++,e,0,q);t.setAttribute("text-anchor","middle"),t.setAttribute("alignment-baseline","hanging")}else{let t=S+s;I+=` M${e},${t} v6`,R(V++,e,t+s,q).setAttribute("text-anchor","middle")}Y++}}for(var X of(Y=0,A.y)){const t=S+s-Y*J,e=g-6;I+=` M${e},${t} H${w+g}`,R(V++,e-6,t,this.formatYAxisLabel(X)).setAttribute("text-anchor","end"),Y++}H.setAttribute("d",I);for(let t=W.children.length-1;t>V;t--)W.children.item(t).remove()}};__decorate([t.Watch({converter:t.PropertyConverters.String})],r.prototype,"type",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Number})],r.prototype,"groupWidth",void 0),r=__decorate([t.CustomElement({tagName:t.P+"-column-chart"})],r),e.PacemColumnChartElement=r}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(e){var i;function r(e,i,r){let s=e,a=e;const n=t.Utils.isNull(i),o=t.Utils.isNull(r);if(!n||!o){const t=3;let l,h;n||(l=(e.y-i.y)/(e.x-i.x)),o||(h=(r.y-e.y)/(r.x-e.x));const c=((h||l||0)+(l||h||0))/2,d=n?0:(e.x-i.x)/t,u=o?0:(r.x-e.x)/t;s={x:e.x-d,y:e.y-d*c},a={x:e.x+u,y:e.y+u*c}}return{c0:s,c1:a}}const s=t.CustomElementUtils.getAttachedPropertyValue,a=t.CustomElementUtils.setAttachedPropertyValue,n=(t.CustomElementUtils.deleteAttachedPropertyValue,"pacem:chart-series:area"),o="http://www.w3.org/2000/svg";let l=class PacemChartElement extends e.PacemSeriesChartElement{constructor(){super(...arguments),i.set(this,!1),this._enterHandler=t=>{__classPrivateFieldSet(this,i,!0,"f")},this._leaveHandler=t=>{__classPrivateFieldSet(this,i,!1,"f")},this._moveHandler=t=>{__classPrivateFieldGet(this,i,"f")},this._chartFillSeries=[]}_getVirtualGrid(t,e,i,r,s,a=this.xAxisType,n){return super.getVirtualGrid(t,e,i,r,s,a,n)}_wipe(t=this.chartSeries,e=0){super.wipeOut(t,e)}viewActivatedCallback(){super.viewActivatedCallback(),this._setupBehavior()}disconnectedCallback(){this._dismantleBehavior(),super.disconnectedCallback()}propertyChangedCallback(t,e,i,r){switch(super.propertyChangedCallback(t,e,i,r),t){case"type":case"aspectRatio":this.draw()}}_setupBehavior(){this.addEventListener("mouseenter",this._enterHandler,!1),this.addEventListener("mouseleave",this._enterHandler,!1),this.addEventListener("mousemove",this._moveHandler,!1)}_dismantleBehavior(){this.removeEventListener("mouseenter",this._enterHandler,!1),this.removeEventListener("mouseleave",this._leaveHandler,!1),this.removeEventListener("mousemove",this._moveHandler,!1)}_buildLinearGradient(t){return super.buildLinearGradient(t)}_setGradientColor(t,e){super.setGradientColor(t,e)}drawSeries(e){if(!this.isReady||t.Utils.isNull(this.chartSize))return;this.ensureChartContainer();const i=this.type||"line",l=24;var h=this.chartSize;if(h.height<=l||h.width<=l)return;if(t.Utils.isNullOrEmpty(e)||e.every((e=>t.Utils.isNullOrEmpty(e.values))))return void this._wipe();const c=this.ensureChartBody("line",h.width,h.height);this.log(t.Logging.LogLevel.Debug,`Drawing ${i} chart.`);const d=this.xAxisType||"string";let u=Number.NaN,m=Number.NaN,p=Number.NaN,v=Number.NaN,g=1;for(let t of e){let e=t.values;if(e&&e.length){let t=0;for(let i of e){let r=this.chartDataItemToPoint(i,e);u=isNaN(u)?r.y:Math.min(u,r.y),m=isNaN(m)?r.y:Math.max(m,r.y),0===t?p=isNaN(p)?r.x:Math.min(p,r.x):t===e.length-1&&(v=isNaN(v)?r.x:Math.max(v,r.x)),t++}}}const y=Math.max(l,.5*this.estimateXAxisLabelWidth(p)+24),f=Math.max(y,this.estimateYAxisLabelWidth(m)+12),_=e.find((e=>!t.Utils.isNullOrEmpty(e.values))),b=this._getVirtualGrid(_.values,p,v,u,m,d,this.yAxisDensity),C=b.y[b.y.length-1],A=b.y[0];if(C===A)return;const E=h.width-f-y,x=h.height-48,w=x*(1-(C-A-(m-u))/(C-A)),S=x*(C-m)/(C-A);("number"!==d||"monometric"!==this.aspectRatio&&"logaritmic"!==this.aspectRatio)&&(g=E/w,c.setAttribute("height",h.height.toString()),c.setAttribute("width",h.width.toString())),c.setAttribute("viewBox",`0 0 ${h.width} ${h.height}`);let N=0;const P=100*g/(v-p),U=100/(m-u),M=2400/w,k=(t,e)=>{let i=this.chartDataItemToPoint(t,e);return i.y*=U,i.x=(i.x-p)*P,i},$=this.chartSeries,L=this._chartFillSeries,W=this.chartGrid,T="spline"===i||"splinearea"===i;for(let l of e){let e,h,d;if($.length>N)e=$[N],h=L[N],d=h.firstElementChild.firstElementChild;else{e=document.createElementNS(o,"svg"),e.setAttribute("pacem",""),c.appendChild(e),h=document.createElementNS(o,"svg"),h.setAttribute("pacem",""),c.insertBefore(h,c.children.item(N+2));const t=document.createElementNS(o,"defs");t.appendChild(d=this._buildLinearGradient(N)),h.appendChild(t),h.appendChild(document.createElementNS(o,"path")),L.push(h),e.appendChild(document.createElementNS(o,"path")),$.push(e)}let m="chart-series";const p="area"===i||"splinearea"===i;t.Utils.isNullOrEmpty(l.className)||(m+=" "+l.className),[e,h].forEach((t=>{t.setAttribute("class",m),t.setAttribute("x",f.toString()),t.setAttribute("y",S.toString()),t.setAttribute("width",E.toString()),t.setAttribute("height",(w+48).toString())})),t.Utils.addClass(h,t.PCSS+"-inert");let v=h.children.item(1),g=e.firstElementChild;g.style.stroke=l.color,v.style.stroke=g.style.fill="none",this._setGradientColor(d,l.color),v.style.fill=`url(#${d.id})`,v.style.display=p?"":"none";let y="",_=l.values;if(_&&_.length){const i=(t,i,r,s,a)=>{const n=i+1;let l;e.children.length>n?l=e.children.item(n):(l=document.createElementNS(o,"line"),l.setAttribute("class","circle"),e.appendChild(l));const h=t.x.toString(),c=(-t.y).toString();l.setAttribute("x1",h),l.setAttribute("y1",c),l.setAttribute("x2",h),l.setAttribute("y2",c),l.style.stroke=a,this.assignUiBehaviors(l,r,s,a)},h=()=>{const t=l.datapoints?_.length+1:1;for(let r=e.children.length-1;r>=t;r--){var i=e.children.item(r);this.disposeUiBehaviors(i),i.remove()}};if(T){let e,o,h;for(let c=0;c<_.length;c++){const d=_[c];if(isNaN(d.value))continue;let u;o||(o=k(d,_)),T&&c<_.length-1&&(u=k(_[c+1],_));let m=s(l,n,0);m+=d.value,a(l,n,m);var O=r(o,e,u);y+=t.Utils.isNullOrEmpty(y)?`M${o.x},${-o.y} `:`C${h.x},${-h.y} ${O.c0.x},${-O.c0.y} ${o.x},${-o.y} `,l.datapoints&&i(o,c,l,d,l.color),e=o,o=u,h=O.c1}}else{let e=0;for(let r of _){if(isNaN(r.value))continue;const o=k(r,_);let h=s(l,n,0);h+=r.value,a(l,n,h),y+=t.Utils.isNullOrEmpty(y)?`M${o.x},${-o.y} `:`L${o.x},${-o.y} `,l.datapoints&&i(o,e,l,r,l.color),e++}}h()}g.setAttribute("d",y),v.setAttribute("d",y+`V${-u*U} H0 Z`),N++}this._wipe(L,N),this._wipe($,N);const D=`0 ${-(m*U+M)} ${100*g} ${100+2*M}`;for(var F of $.concat(L))F.setAttribute("viewBox",D);let B,G=this.chartMask.children.item(1);if(G.setAttribute("x",(0).toString()),G.setAttribute("height",(h.height-l).toString()),W.setAttribute("viewBox",`0 0 ${h.width} ${h.height}`),b.x.length<=1||b.y.length<=1){for(let t=W.children.length-1;t>=0;t--)W.children.item(t).remove();return}W.children.length>0?B=W.children.item(0):(B=document.createElementNS(o,"path"),W.appendChild(B));let H=0,z=(t,e,i,r)=>{const s=t+1;let a;return W.children.length<=s?(a=document.createElementNS(o,"text"),W.appendChild(a)):a=W.children.item(s),a.textContent=r,a.setAttribute("x",e.toString()),a.setAttribute("y",i.toString()),a},V=`M${f},24 v${x}`,R=0;const I=E/(b.x.length-1),Y=x/(b.y.length-1);if("none"!==this.xAxisPosition)for(var j of b.x){const t=f+R*I;if("top"===this.xAxisPosition){V+=` M${t},24 v-6`;let e=z(H++,t,0,j);e.setAttribute("text-anchor","middle"),e.setAttribute("alignment-baseline","hanging")}else{let e=x+l;V+=` M${t},${e} v6`,z(H++,t,e+l,j).setAttribute("text-anchor","middle")}R++}for(var J of(R=0,b.y)){const t=x+l-R*Y,e=f-6;V+=` M${e},${t} H${E+f}`,z(H++,e-6,t,this.formatYAxisLabel(J)).setAttribute("text-anchor","end"),R++}B.setAttribute("d",V);for(let t=W.children.length-1;t>H;t--)W.children.item(t).remove()}};i=new WeakMap,__decorate([t.Watch({emit:!1,converter:t.PropertyConverters.String})],l.prototype,"type",void 0),__decorate([t.Watch({converter:t.PropertyConverters.String})],l.prototype,"aspectRatio",void 0),l=__decorate([t.CustomElement({tagName:t.P+"-chart"})],l),e.PacemChartElement=l}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={})),function(t){!function(e){!function(i){let r=class PacemPieSliceElement extends e.PacemItemElement{constructor(){super(...arguments),this._broadcastHandler=t=>{this.emit(t)}}findContainer(){return t.CustomElementUtils.findAncestorOfType(this,n)}get chart(){return this.container}getCenterOfMass(){const e=this.chart&&this.chart.area;if(t.Utils.isNull(e))return null;const i=t.Utils.offset(e),r=i.width/2+i.left,s=i.top+i.height/2,n=.5*Math.min(i.width,i.height),o=this.normalizedPolarCoords,l=a-o.angle;return{y:s-n*o.radius*Math.sin(l),x:r+n*o.radius*Math.cos(l)}}propertyChangedCallback(t,e,i,r){super.propertyChangedCallback(t,e,i,r),!r&&this.chart&&"normalizedPolarCoords"!=t&&this.chart.draw()}_assignUi(t){const e=this._ui=t;i.MANAGED_EVENTS.forEach((t=>{e.addEventListener(t,this._broadcastHandler)}))}_disposeUi(){t.Utils.isNull(this._ui)||i.MANAGED_EVENTS.forEach((t=>{this._ui.removeEventListener(t,this._broadcastHandler)}))}};__decorate([t.Watch({converter:t.PropertyConverters.Number})],r.prototype,"value",void 0),__decorate([t.Watch({converter:t.PropertyConverters.String})],r.prototype,"label",void 0),__decorate([t.Watch({converter:t.PropertyConverters.String})],r.prototype,"color",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Json})],r.prototype,"normalizedPolarCoords",void 0),r=__decorate([t.CustomElement({tagName:t.P+"-pie-slice"})],r),i.PacemPieSliceElement=r;const s=2*Math.PI,a=.5*Math.PI;let n=class PacemPieChartElement extends e.PacemItemsContainerElement{constructor(){super(),this.cutout=0,this._slices=new WeakMap,this._key=t.Utils.uniqueCode()}validate(t){return t instanceof r}viewActivatedCallback(){super.viewActivatedCallback(),this.draw()}propertyChangedCallback(e,i,r,s){if(super.propertyChangedCallback(e,i,r,s),"target"===e){this._g=null,this._div&&this._div.remove();const e=i;e&&(e.classList.remove(t.PCSS+"-chart-area"),e.innerHTML=""),this.draw()}else s||"cutout"!==e&&"items"!==e||this.draw()}get area(){return this._svg}disconnectedCallback(){this._div&&this._div.remove(),super.disconnectedCallback()}_ensureArea(){if(t.Utils.isNull(this._g)){let e=this.target||(this._div=document.createElement("div"));e.classList.add(t.PCSS+"-chart-area");let i=this._svg=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("pacem",""),i.setAttribute("preserveAspectRatio","xMidYMid meet"),i.setAttribute("viewBox","0 0 100 100"),i.classList.add(t.PCSS+"-pie-chart");let r=document.createElementNS("http://www.w3.org/2000/svg","defs"),s=this._g=document.createElementNS("http://www.w3.org/2000/svg","g");i.appendChild(r),i.appendChild(s),e.appendChild(i),this._div&&this.parentElement.insertBefore(e,this)}if(this.maskBasedRendering){if(t.Utils.isNull(this._mask)){let t=document.createElementNS("http://www.w3.org/2000/svg","mask");t.id="pie_mask_"+this._key;let e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("x","0"),e.setAttribute("y","0"),e.setAttribute("width","100"),e.setAttribute("height","100"),e.setAttribute("fill","#fff");let i=this._mask=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx","50"),i.setAttribute("cy","50");const r=this._svg.firstElementChild;t.appendChild(e),t.appendChild(i),r.appendChild(t),this._g.setAttribute("mask",`url(#${t.id})`)}const e=50*this._safeCutout;this._mask.setAttribute("r",`${e}`)}else t.Utils.isNull(this._mask)||(this._svg.firstElementChild.innerHTML="",this._mask=null,this._g.removeAttribute("mask"));return this._g}get _safeCutout(){return Math.min(1,Math.max(0,this.cutout))||0}_drawSlice(t,e,i,r){const a=e.value>.5*i?1:0,n=s*e.value/i,o=360*r/i,l=e.value>=i?49.9:50*(1+Math.sin(n)),h=50*(1-Math.cos(n)),c=this._safeCutout,d=50*c;t.style.fill=e.color,t.style.transform=`rotate(${o}deg)`,t.style.transformOrigin="50% 50%";const u=this.maskBasedRendering?`M50,50 V0 A50,50 0 ${a} 1 ${l} ${h} L50,50 Z`:`M50,0 A50,50 0 ${a} 1 ${l} ${h} l${(50-l)*(1-c)},${(50-h)*(1-c)} A${d},${d} 0 ${a} 0 50,${50-d} Z`;t.setAttribute("d",u),e.normalizedPolarCoords={radius:c+Math.SQRT1_2*(1-c),angle:Math.PI*o/180+n/2}}_isSliceOk(t){return!t.disabled}draw(){const e=this._ensureArea(),i=e.children.length,r=this._svg.parentElement;let s=0,a=0,n=0;if(t.Utils.isNullOrEmpty(this.items))e.innerHTML="",t.Utils.removeClass(r,"chart-has-data");else{t.Utils.addClass(r,"chart-has-data");for(let t of this.items)this._isSliceOk(t)&&(a+=t.value);if(a<=0)e.innerHTML="",t.Utils.removeClass(r,"chart-has-data");else for(let r of this.items){if(!this._isSliceOk(r))continue;let o;if(s>=i){const i=document.createElementNS("http://www.w3.org/2000/svg","g");i.setAttribute("class","chart-series "+t.PCSS+"-pie-slice"+(t.Utils.isNullOrEmpty(r.className)?"":" "+r.className)),o=document.createElementNS("http://www.w3.org/2000/svg","path"),i.appendChild(o),e.appendChild(i),r._assignUi(i),this._slices.set(i,r)}else o=e.children.item(s).firstElementChild;r.value>0?(this._drawSlice(o,r,a,n),n+=r.value,o.removeAttribute("display")):o.setAttribute("display","none"),s++}}for(;s<e.children.length;){const t=this._slices,i=e.children.item(s);t.has(i)&&(t.get(i)._disposeUi(),t.delete(i)),e.removeChild(i)}}};__decorate([t.Watch({converter:t.PropertyConverters.Number})],n.prototype,"cutout",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Element})],n.prototype,"target",void 0),__decorate([t.Watch({converter:t.PropertyConverters.Boolean})],n.prototype,"maskBasedRendering",void 0),__decorate([t.Debounce(!0)],n.prototype,"draw",null),n=__decorate([t.CustomElement({tagName:t.P+"-pie-chart"})],n),i.PacemPieChartElement=n}(e.Charts||(e.Charts={}))}(t.Components||(t.Components={}))}(Pacem||(Pacem={}));
|
package/dist/js/pacem-cms.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
/// <reference path="pacem-core.d.ts" />
|
|
7
7
|
/// <reference path="pacem-ui.d.ts" />
|
package/dist/js/pacem-cms.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.
|
|
2
|
+
* pacem v0.40.3 (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
|
-
* Licensed under
|
|
4
|
+
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
7
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|