@qaecy/cue-ui 0.0.57 → 0.0.59
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/1051.js +1 -1
- package/1138.js +1 -1
- package/1153.js +1 -1
- package/1338.js +1 -1
- package/1520.js +1 -0
- package/1701.js +1 -0
- package/1837.js +1 -1
- package/1985.js +1 -1
- package/2014.js +1 -0
- package/2245.js +1 -1
- package/2283.js +1 -0
- package/2317.js +1 -1
- package/2775.js +1 -1
- package/2839.js +1 -1
- package/29.js +1 -1
- package/3036.js +1 -1
- package/3039.js +1 -1
- package/3202.js +1 -0
- package/3213.js +1 -0
- package/3288.js +1 -1
- package/3319.js +1 -0
- package/3577.js +1 -1
- package/3614.js +1 -1
- package/3842.js +1 -0
- package/3869.js +1 -0
- package/4098.js +1 -0
- package/4283.js +1 -1
- package/4311.js +1 -1
- package/4791.js +1 -0
- package/5381.js +1 -0
- package/5448.js +1 -0
- package/5559.js +1 -1
- package/5649.js +1 -1
- package/5738.js +1 -1
- package/5872.js +1 -1
- package/5971.js +1 -0
- package/6027.js +1 -0
- package/617.js +1 -1
- package/6233.js +1 -1
- package/63.js +1 -1
- package/6419.js +1 -1
- package/6423.js +1 -1
- package/650.js +1 -1
- package/6947.js +1 -1
- package/7089.js +1 -0
- package/7154.js +1 -0
- package/7313.js +1 -0
- package/7441.js +1 -1
- package/7719.js +1 -1
- package/7727.js +1 -0
- package/7802.js +1 -0
- package/7851.js +1 -0
- package/804.js +1 -1
- package/8194.js +1 -0
- package/8560.js +1 -1
- package/8659.js +1 -0
- package/8957.js +1 -1
- package/928.js +1 -1
- package/9396.js +1 -1
- package/9707.js +1 -0
- package/992.js +1 -0
- package/common.js +1 -1
- package/index.js +1 -1
- package/main.js +1 -1
- package/package.json +1 -1
- package/2021.js +0 -1
- package/2081.js +0 -1
- package/2399.js +0 -1
- package/2516.js +0 -1
- package/4687.js +0 -1
- package/4879.js +0 -1
- package/5041.js +0 -1
- package/5071.js +0 -1
- package/5137.js +0 -1
- package/7056.js +0 -1
- package/8336.js +0 -1
- package/8791.js +0 -1
- package/8855.js +0 -1
- package/9376.js +0 -1
package/8560.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[8560],{5600(W,F,_){_.d(F,{F:()=>B,g:()=>S});var r=_(7705),g=_(2271),T=_(7089),X=_(5381),A=_(5187),L=_(5971),t=_(3319),h=_(5547),D=_(5802);function Z(C,R){if(1&C){const f=h.RV6();h.j41(0,"cue-flexcontainer",3)(1,"cue-button",6),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.activeTool.set("pan"))}),h.nrm(2,"cue-button-icon",7),h.k0s(),h.j41(3,"cue-button",8),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.activeTool.set("select"))}),h.nrm(4,"cue-button-icon",9),h.k0s()()}if(2&C){const f=h.XpG();h.R7$(),h.Y8G("variant","pan"===f.activeTool()?"secondary":"tertiary"),h.R7$(2),h.Y8G("variant","select"===f.activeTool()?"secondary":"tertiary")}}function k(C,R){if(1&C){const f=h.RV6();h.j41(0,"cue-flexcontainer",3)(1,"cue-button",10),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.handleZoomOut())}),h.nrm(2,"cue-button-icon",11),h.k0s(),h.j41(3,"cue-button",12),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.handleZoomIn())}),h.nrm(4,"cue-button-icon",13),h.k0s(),h.j41(5,"cue-button",14),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.handleZoomFit())}),h.nrm(6,"cue-button-icon",15),h.k0s()()}if(2&C){const f=h.XpG();h.AVh("border-left",f.options().displayPanSelectTools),h.R7$(),h.Y8G("disabled",f.zoom()<=f.minZoom())("cueTooltip",f.zoom()<=f.minZoom()?"Minimum zoom reached":"Zoom out")}}function G(C,R){if(1&C){const f=h.RV6();h.j41(0,"cue-button",16),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.rotate.emit())}),h.nrm(1,"cue-button-icon",17),h.k0s()}if(2&C){const f=h.XpG();h.AVh("border-left",f.options().displayZoom&&f.options().displayRotate)}}class S{hidden=!1;position="bottom";margin="20px";displayZoom=!0;displayRotate=!0;displayPanSelectTools=!1}let B=(()=>{class C{options=(0,r.hFB)(new S);activeTool=(0,r.geq)("pan");panMode=(0,r.geq)(!1);zoom=(0,r.geq)(1);pan=(0,r.geq)({x:0,y:0});minZoom=(0,r.hFB)(1);maxZoom=(0,r.hFB)(10);rotate=(0,r.CGW)();zoomIn=(0,r.CGW)();zoomOut=(0,r.CGW)();zoomFit=(0,r.CGW)();selectMenuPositions=(0,g.EW)(()=>"top"===this.options().position?"bottomleft":"topleft");handleZoomIn(){this.zoomIn.emit()}handleZoomOut(){this.zoomOut.emit()}handleZoomFit(){this.zoomFit.emit()}static \u0275fac=function(z){return new(z||C)};static \u0275cmp=h.VBU({type:C,selectors:[["cue-image-toolbar"]],inputs:{options:[1,"options"],activeTool:[1,"activeTool"],panMode:[1,"panMode"],zoom:[1,"zoom"],pan:[1,"pan"],minZoom:[1,"minZoom"],maxZoom:[1,"maxZoom"]},outputs:{activeTool:"activeToolChange",panMode:"panModeChange",zoom:"zoomChange",pan:"panChange",rotate:"rotate",zoomIn:"zoomIn",zoomOut:"zoomOut",zoomFit:"zoomFit"},decls:6,vars:4,consts:[["justify","center",1,"container"],[1,"toolbar",3,"padded"],["align","center"],["align","center","gap","s"],["align","center","gap","s",3,"border-left"],["cueTooltip","Rotate","size","xs","variant","tertiary",3,"border-left"],["size","xs","cueTooltip","Pan mode \u2014 drag to move the view",3,"click","variant"],["icon","move-grab"],["size","xs","cueTooltip","Select mode \u2014 drag to draw a selection window",3,"click","variant"],["icon","move-click"],["size","xs","variant","tertiary",3,"click","disabled","cueTooltip"],["icon","zoom-out"],["cueTooltip","Zoom in","size","xs","variant","tertiary",3,"click"],["icon","zoom-in"],["cueTooltip","Zoom fit","size","xs","variant","tertiary",3,"click"],["icon","zoom-fit"],["cueTooltip","Rotate","size","xs","variant","tertiary",3,"click"],["icon","rotate-2d"]],template:function(z,b){1&z&&(h.j41(0,"cue-flexcontainer",0)(1,"cue-card",1)(2,"cue-flexcontainer",2),h.nVh(3,Z,5,2,"cue-flexcontainer",3),h.nVh(4,k,7,4,"cue-flexcontainer",4),h.nVh(5,G,2,2,"cue-button",5),h.k0s()()()),2&z&&(h.R7$(),h.Y8G("padded",!1),h.R7$(2),h.vxM(b.options().displayPanSelectTools?3:-1),h.R7$(),h.vxM(b.options().displayZoom?4:-1),h.R7$(),h.vxM(b.options().displayRotate?5:-1))},dependencies:[X.n,A.Card,L.$,t.a,T.d],styles:["[_nghost-%COMP%]{pointer-events:none}.container[_ngcontent-%COMP%]{width:100%;pointer-events:none}.toolbar[_ngcontent-%COMP%]{pointer-events:all;padding:5px 10px}.border-left[_ngcontent-%COMP%]{border-left:1px solid;padding-left:12px}"],changeDetection:0})}return C})()},8560(W,F,_){_.d(F,{ImageViewer:()=>Ue});var r=_(5802),g=_(7705),T=_(2271),X=_(345),A=_(5600),L=_(9769),t=_(5547);let h=(()=>{class s{elementRef=(0,r.WQX)(t.aKT);cdr=(0,r.WQX)(g.gRc);zoom=(0,g.geq)(1);pan=(0,g.geq)({x:0,y:0});minZoom=(0,g.hFB)(1);maxZoom=(0,g.hFB)(10);zoomStep=(0,g.hFB)(.1);panMode=(0,g.hFB)(!0,{transform:e=>{const n=""===e||"false"!==e&&!!e;return!n&&(this.isPanning||this.isWaitingForPan)&&this.onMouseUp(),n}});longPressThreshold=(0,g.hFB)(150);dragThreshold=(0,g.hFB)(3);zoomChange=(0,g.CGW)();panChange=(0,g.CGW)();stateChange=(0,g.CGW)();isPanning=!1;lastPoint={x:0,y:0};isWaitingForPan=!1;downPoint={x:0,y:0};longPressTimer=null;moveListener;upListener;leaveListener;blurListener;visibilityListener;keyListener;contextMenuListener;pointerCancelListener;listenersAttached=!1;isMiddlePanning=!1;_midLastPoint={x:0,y:0};_midMoveListener;_midUpListener;_pinchStartDist=0;_pinchStartZoom=1;_touchStartListener;_touchMoveListener;_touchEndListener;constructor(){this.moveListener=this.onMouseMove.bind(this),this.upListener=this.onMouseUp.bind(this),this.leaveListener=this.onMouseUp.bind(this),this.blurListener=this.onMouseUp.bind(this),this.visibilityListener=()=>{document.hidden&&this.onMouseUp()},this.keyListener=e=>{"Escape"===e.key&&this.onMouseUp()},this.contextMenuListener=this.onMouseUp.bind(this),this.pointerCancelListener=this.onMouseUp.bind(this),this._midMoveListener=this._onMiddlePanMove.bind(this),this._midUpListener=this._onMiddlePanUp.bind(this)}ngOnInit(){this._attachTouchListeners()}ngOnDestroy(){this.removeListeners(),this.clearLongPressTimer(),this._detachTouchListeners(),this._stopMiddlePan()}addListeners(){this.listenersAttached||(this.listenersAttached=!0,window.addEventListener("mousemove",this.moveListener),window.addEventListener("mouseup",this.upListener,!0),window.addEventListener("blur",this.blurListener),document.addEventListener("visibilitychange",this.visibilityListener),document.addEventListener("keydown",this.keyListener),document.addEventListener("contextmenu",this.contextMenuListener),document.addEventListener("pointercancel",this.pointerCancelListener))}removeListeners(){this.listenersAttached=!1,window.removeEventListener("mousemove",this.moveListener),window.removeEventListener("mouseup",this.upListener,!0),window.removeEventListener("blur",this.blurListener),document.removeEventListener("visibilitychange",this.visibilityListener),document.removeEventListener("keydown",this.keyListener),document.removeEventListener("contextmenu",this.contextMenuListener),document.removeEventListener("pointercancel",this.pointerCancelListener)}clearLongPressTimer(){null!==this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}cursorStyle(){return this.isMiddlePanning?"grabbing":this.panMode()?this.isPanning?"grabbing":"grab":null}onMouseDown(e){if(1===e.button)return e.preventDefault(),this.isMiddlePanning=!0,this._midLastPoint={x:e.clientX,y:e.clientY},this.cdr.markForCheck(),window.addEventListener("mousemove",this._midMoveListener),void window.addEventListener("mouseup",this._midUpListener);!this.panMode()||0!==e.button||(e.composedPath?e.composedPath():[]).some(i=>i.hasAttribute&&i.hasAttribute("data-no-pan"))||((this.isPanning||this.isWaitingForPan)&&(this.clearLongPressTimer(),this.isWaitingForPan=!1,this.isPanning=!1,this.removeListeners()),this.isWaitingForPan=!0,this.downPoint={x:e.clientX,y:e.clientY},this.lastPoint={x:e.clientX,y:e.clientY},this.addListeners())}startPanning(){this.clearLongPressTimer(),this.isWaitingForPan=!1,this.isPanning=!0,this.cdr.markForCheck()}onMouseMove(e){if(!this.isWaitingForPan&&!this.isPanning)return;if(this.isWaitingForPan&&!this.isPanning){const l=e.clientX-this.downPoint.x,d=e.clientY-this.downPoint.y;if(Math.sqrt(l*l+d*d)>=this.dragThreshold()){e.preventDefault(),this.startPanning();const u=this.pan(),p={x:u.x+l,y:u.y+d};this.lastPoint={x:e.clientX,y:e.clientY},this.pan.set(p),this.panChange.emit(p),this.emitStateChange()}return}e.preventDefault();const n=e.clientX-this.lastPoint.x,o=e.clientY-this.lastPoint.y;this.lastPoint={x:e.clientX,y:e.clientY};const i=this.pan(),a={x:i.x+n,y:i.y+o};this.pan.set(a),this.panChange.emit(a),this.emitStateChange()}onMouseUp(e){this.clearLongPressTimer();const n=this.isPanning;if(this.isWaitingForPan=!1,this.isPanning=!1,this.removeListeners(),n){this.cdr.markForCheck();const o=i=>{i.stopImmediatePropagation(),i.preventDefault(),window.removeEventListener("click",o,!0)};window.addEventListener("click",o,!0),setTimeout(()=>window.removeEventListener("click",o,!0),50)}}_onMiddlePanMove(e){if(!this.isMiddlePanning)return;const n=e.clientX-this._midLastPoint.x,o=e.clientY-this._midLastPoint.y;this._midLastPoint={x:e.clientX,y:e.clientY};const i=this.pan(),a={x:i.x+n,y:i.y+o};this.pan.set(a),this.panChange.emit(a),this.emitStateChange()}_onMiddlePanUp(e){1===e.button&&this._stopMiddlePan()}_stopMiddlePan(){window.removeEventListener("mousemove",this._midMoveListener),window.removeEventListener("mouseup",this._midUpListener),this.isMiddlePanning&&(this.isMiddlePanning=!1,this.cdr.markForCheck())}onWheel(e){e.preventDefault();const n=this.zoomStep(),o=e.deltaY<0?1+n:1-n,a=this.elementRef.nativeElement.getBoundingClientRect(),l={x:e.clientX-a.left,y:e.clientY-a.top};this.zoomTo(this.zoom()*o,l)}zoomTo(e,n){const o=this.zoom(),i=this.pan(),a=Math.max(this.minZoom(),Math.min(this.maxZoom(),e));if(a===o)return;const l=a/o,d={x:n.x-(n.x-i.x)*l,y:n.y-(n.y-i.y)*l};this.zoom.set(a),this.pan.set(d),this.zoomChange.emit(a),this.panChange.emit(d),this.emitStateChange()}zoomIn(){this.zoomToCenter(this.zoom()+this.zoomStep())}zoomOut(){this.zoomToCenter(this.zoom()-this.zoomStep())}zoomToCenter(e){const n=this.elementRef.nativeElement;this.zoomTo(e,{x:n.clientWidth/2,y:n.clientHeight/2})}emitStateChange(){this.stateChange.emit({zoom:this.zoom(),pan:this.pan()})}static _touchDist(e,n){const o=n.clientX-e.clientX,i=n.clientY-e.clientY;return Math.sqrt(o*o+i*i)}_attachTouchListeners(){const e=this.elementRef.nativeElement;this._touchStartListener=n=>{2===n.touches.length&&(n.preventDefault(),this._pinchStartDist=s._touchDist(n.touches[0],n.touches[1]),this._pinchStartZoom=this.zoom())},this._touchMoveListener=n=>{if(2!==n.touches.length||(n.preventDefault(),0===this._pinchStartDist))return;const o=s._touchDist(n.touches[0],n.touches[1]),i=this._pinchStartZoom*(o/this._pinchStartDist),a=e.getBoundingClientRect();this.zoomTo(i,{x:(n.touches[0].clientX+n.touches[1].clientX)/2-a.left,y:(n.touches[0].clientY+n.touches[1].clientY)/2-a.top})},this._touchEndListener=n=>{n.touches.length<2&&(this._pinchStartDist=0)},e.addEventListener("touchstart",this._touchStartListener,{passive:!1}),e.addEventListener("touchmove",this._touchMoveListener,{passive:!1}),e.addEventListener("touchend",this._touchEndListener,{passive:!1})}_detachTouchListeners(){const e=this.elementRef.nativeElement;this._touchStartListener&&e.removeEventListener("touchstart",this._touchStartListener),this._touchMoveListener&&e.removeEventListener("touchmove",this._touchMoveListener),this._touchEndListener&&e.removeEventListener("touchend",this._touchEndListener)}static \u0275fac=function(n){return new(n||s)};static \u0275dir=t.FsC({type:s,selectors:[["","cuePanZoom",""]],hostVars:2,hostBindings:function(n,o){1&n&&t.bIt("mousedown",function(a){return o.onMouseDown(a)})("wheel",function(a){return o.onWheel(a)}),2&n&&t.xc7("cursor",o.cursorStyle())},inputs:{zoom:[1,"zoom"],pan:[1,"pan"],minZoom:[1,"minZoom"],maxZoom:[1,"maxZoom"],zoomStep:[1,"zoomStep"],panMode:[1,"panMode"],longPressThreshold:[1,"longPressThreshold"],dragThreshold:[1,"dragThreshold"]},outputs:{zoom:"zoomChange",pan:"panChange",zoomChange:"zoomChange",panChange:"panChange",stateChange:"stateChange"}})}return s})();const D=["container"],Z=["*"];let k=(()=>{class s{panZoomDirective=(0,g.ebz)(h);containerRef=(0,g.ebz)("container");zoom=(0,g.geq)(1);pan=(0,g.geq)({x:0,y:0});minZoom=(0,g.hFB)(.1);maxZoom=(0,g.hFB)(10);zoomStep=(0,g.hFB)(.1);panMode=(0,g.hFB)(!0);modelChange=(0,g.CGW)();get transform(){const{x:e,y:n}=this.pan();return`translate(${e}px, ${n}px) scale(${this.zoom()})`}onZoomChange(e){this.zoom.set(e),this.emitModelChange()}onPanChange(e){this.pan.set(e),this.emitModelChange()}emitModelChange(){this.modelChange.emit({pan:{...this.pan()},zoom:this.zoom()})}zoomFit(){this.zoom.set(this.minZoom()),this.pan.set({x:0,y:0}),this.emitModelChange()}zoomIn(){this.panZoomDirective()?.zoomIn()}zoomOut(){this.panZoomDirective()?.zoomOut()}zoomTo(e,n){this.panZoomDirective()?.zoomTo(e,n)}static \u0275fac=function(n){return new(n||s)};static \u0275cmp=t.VBU({type:s,selectors:[["cue-pan-zoom"]],viewQuery:function(n,o){1&n&&t.wEZ(o.panZoomDirective,h,5)(o.containerRef,D,5),2&n&&t.NyB(2)},hostAttrs:[2,"display","block","width","100%","height","100%"],inputs:{zoom:[1,"zoom"],pan:[1,"pan"],minZoom:[1,"minZoom"],maxZoom:[1,"maxZoom"],zoomStep:[1,"zoomStep"],panMode:[1,"panMode"]},outputs:{zoom:"zoomChange",pan:"panChange",modelChange:"modelChange"},ngContentSelectors:Z,decls:5,vars:8,consts:[["container",""],["content",""],["cuePanZoom","",1,"pan-zoom-container",2,"width","100%","height","100%","overflow","hidden","position","relative","touch-action","none",3,"zoomChange","panChange","zoom","pan","minZoom","maxZoom","zoomStep","panMode"],[2,"position","absolute","left","0","top","0","transform-origin","0 0","backface-visibility","hidden"]],template:function(n,o){1&n&&(t.NAR(),t.j41(0,"div",2,0),t.bIt("zoomChange",function(a){return o.onZoomChange(a)})("panChange",function(a){return o.onPanChange(a)}),t.j41(2,"div",3,1),t.SdG(4),t.k0s()()),2&n&&(t.Y8G("zoom",o.zoom())("pan",o.pan())("minZoom",o.minZoom())("maxZoom",o.maxZoom())("zoomStep",o.zoomStep())("panMode",o.panMode()),t.R7$(2),t.xc7("transform",o.transform))},dependencies:[L.MD,h],encapsulation:2,changeDetection:0})}return s})();var G=_(2036),S=_(7023),B=_(9352),C=_(356),R=_(6279),f=_(5187),z=_(2245);class b{constructor(c=[],e=(n,o)=>n<o?-1:n>o?1:0){if(this.data=c,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(c){this.data.push(c),this._up(this.length++)}pop(){if(0===this.length)return;const c=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:e,compare:n}=this,o=e[c];for(;c>0;){const i=c-1>>1,a=e[i];if(n(o,a)>=0)break;e[c]=a,c=i}e[c]=o}_down(c){const{data:e,compare:n}=this,o=this.length>>1,i=e[c];for(;c<o;){let a=1+(c<<1);const l=a+1;if(l<this.length&&n(e[l],e[a])<0&&(a=l),n(e[a],i)>=0)break;e[c]=e[a],c=a}e[c]=i}}function j(s,c,e,n){this.x=s,this.y=c,this.h=e,this.d=function H(s,c,e){let n=!1,o=1/0;for(const i of e)for(let a=0,l=i.length,d=l-1;a<l;d=a++){const m=i[a],u=i[d];m[1]>c!=u[1]>c&&s<(u[0]-m[0])*(c-m[1])/(u[1]-m[1])+m[0]&&(n=!n),o=Math.min(o,Q(s,c,m,u))}return 0===o?0:(n?1:-1)*Math.sqrt(o)}(s,c,n),this.max=this.d+this.h*Math.SQRT2}function Q(s,c,e,n){let o=e[0],i=e[1],a=n[0]-o,l=n[1]-i;if(0!==a||0!==l){const d=((s-o)*a+(c-i)*l)/(a*a+l*l);d>1?(o=n[0],i=n[1]):d>0&&(o+=a*d,i+=l*d)}return a=s-o,l=c-i,a*a+l*l}let K=(()=>{class s{extractPathD(e){const n=e.match(/d="([^"]*)"/);return n?n[1]:null}parsePathToPolygon(e){const n=[],o=e.trim().split(/\s+/);let i=0;for(;i<o.length;){const a=o[i];if("M"===a||"L"===a)i++,i+1<o.length&&(n.push([parseFloat(o[i]),parseFloat(o[i+1])]),i+=2);else{const l=parseFloat(a);!isNaN(l)&&i+1<o.length?(n.push([l,parseFloat(o[i+1])]),i+=2):i++}}return n}getLabelPosition(e){const n=this.extractPathD(e);if(!n)return null;const o=this.parsePathToPolygon(n);if(o.length<3)return null;try{const i=function Y(s,c=1,e=!1){let n=1/0,o=1/0,i=-1/0,a=-1/0;for(const[y,x]of s[0])y<n&&(n=y),x<o&&(o=x),y>i&&(i=y),x>a&&(a=x);const l=i-n,d=a-o,m=Math.max(c,Math.min(l,d));if(m===c){const y=[n,o];return y.distance=0,y}const u=new b([],(y,x)=>x.max-y.max);let p=function U(s){let c=0,e=0,n=0;const o=s[0];for(let a=0,l=o.length,d=l-1;a<l;d=a++){const m=o[a],u=o[d],p=m[0]*u[1]-u[0]*m[1];e+=(m[0]+u[0])*p,n+=(m[1]+u[1])*p,c+=3*p}const i=new j(e/c,n/c,0,s);return 0===c||i.d<0?new j(o[0][0],o[0][1],0,s):i}(s);const v=new j(n+l/2,o+d/2,0,s);v.d>p.d&&(p=v);let M=2;function P(y,x,V){const I=new j(y,x,V,s);M++,I.max>p.d+c&&u.push(I),I.d>p.d&&(p=I,e&&console.log(`found best ${Math.round(1e4*I.d)/1e4} after ${M} probes`))}let w=m/2;for(let y=n;y<i;y+=m)for(let x=o;x<a;x+=m)P(y+w,x+w,w);for(;u.length;){const{max:y,x,y:V,h:I}=u.pop();if(y-p.d<=c)break;w=I/2,P(x-w,V-w,w),P(x+w,V-w,w),P(x-w,V+w,w),P(x+w,V+w,w)}e&&console.log(`num probes: ${M}\nbest distance: ${p.d}`);const E=[p.x,p.y];return E.distance=p.d,E}([o],.01);return{x:i[0],y:i[1]}}catch{return null}}getLabelFontSize(e){const n=this.extractPathD(e);if(!n)return.3;const o=this.parsePathToPolygon(n);if(o.length<3)return.3;const i=o.map(u=>u[0]),a=o.map(u=>u[1]),l=Math.max(...i)-Math.min(...i),d=Math.max(...a)-Math.min(...a),m=Math.min(l,d);return Math.max(m/5,.05)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=r.jDH({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})(),N=(()=>{class s{editingArtefact=(0,r.vPA)(null);isEditing=(0,r.vPA)(!1);editStart=(0,r.vPA)(null);editHandle=(0,r.vPA)("body");hasDragged=!1;hasEdited=!1;originalArtefact=null;drawingArtefacts;mouseToImagePercent;parseXYWH;polygonService;artefactEdited;editMoveListener=this.onEditMouseMove.bind(this);editUpListener=this.onEditMouseUp.bind(this);init(e){this.drawingArtefacts=e.drawingArtefacts,this.mouseToImagePercent=e.mouseToImagePercent,this.parseXYWH=e.parseXYWH,this.polygonService=e.polygonService,this.artefactEdited=e.artefactEdited}startEditArtefact(e,n){this.editingArtefact.set({type:e,index:n});const o=this.drawingArtefacts();let i;"bbox"===e?i=o.xywhs[n]:"circle"===e?i=o.circles[n]:"polygon"===e&&(i=o.polygons[n]),this.originalArtefact=i?{...i}:null}cancelEdit(){const e=this.editingArtefact();if(e&&this.hasEdited&&this.originalArtefact){const n=this.drawingArtefacts();let o;"bbox"===e.type?o=n.xywhs[e.index]:"circle"===e.type?o=n.circles[e.index]:"polygon"===e.type&&(o=n.polygons[e.index]),o&&this.artefactEdited.emit({type:e.type,index:e.index,before:this.originalArtefact,after:o})}this.editingArtefact.set(null),this.isEditing.set(!1),this.editStart.set(null),this.editHandle.set("body"),this.hasEdited=!1,this.originalArtefact=null,window.removeEventListener("mousemove",this.editMoveListener),window.removeEventListener("mouseup",this.editUpListener)}onEditMouseDown(e,n="body"){if(!this.editingArtefact()||0!==e.button)return;e.preventDefault(),e.stopPropagation();const o=this.mouseToImagePercent(e);o&&(this.isEditing.set(!0),this.editStart.set(o),this.editHandle.set(n),this.hasDragged=!1,window.addEventListener("mousemove",this.editMoveListener),window.addEventListener("mouseup",this.editUpListener))}onEditMouseMove(e){if(!this.isEditing())return;e.preventDefault();const n=this.mouseToImagePercent(e),o=this.editStart(),i=this.editingArtefact();if(!n||!o||!i)return;const a=this.editHandle();if("string"==typeof a&&a.startsWith("vertex:")){const m=parseInt(a.split(":")[1],10);return this.polygonService.applyVertexDrag(i.index,m,n,e.shiftKey),this.editStart.set(n),this.hasDragged=!0,void(this.hasEdited=!0)}const l=n.x-o.x,d=n.y-o.y;this.editStart.set(n),this.hasDragged=!0,this.hasEdited=!0,this.applyEditDelta(i,l,d)}onEditMouseUp(e){if(this.isEditing()){if(window.removeEventListener("mousemove",this.editMoveListener),window.removeEventListener("mouseup",this.editUpListener),"body"===this.editHandle()&&!this.hasDragged)return void this.cancelEdit();if(this.isEditing.set(!1),this.editStart.set(null),this.hasEdited){const n=this.editingArtefact();if(n&&this.originalArtefact){const o=this.drawingArtefacts();let i;"bbox"===n.type?i=o.xywhs[n.index]:"circle"===n.type?i=o.circles[n.index]:"polygon"===n.type&&(i=o.polygons[n.index]),i&&(this.artefactEdited.emit({type:n.type,index:n.index,before:this.originalArtefact,after:i}),this.originalArtefact={...i},this.hasEdited=!1)}}}}applyEditDelta(e,n,o){const i=this.editHandle();"body"===i?this.applyMoveDelta(e,n,o):"radius"===i?this.applyCircleRadiusDelta(e.index,n,o):this.applyResizeDelta(e,i,n,o)}applyMoveDelta(e,n,o){this.drawingArtefacts.update(i=>{if("bbox"===e.type){const a=[...i.xywhs],l=a[e.index];if(!l)return i;const d=this.parseXYWH(l.xywhStr);if(!d)return i;const m=Math.max(0,d.x+n),u=Math.max(0,d.y+o);return a[e.index]={...l,xywhStr:`percent:${m.toFixed(2)},${u.toFixed(2)},${d.width.toFixed(2)},${d.height.toFixed(2)}`},{...i,xywhs:a}}if("circle"===e.type){const a=[...i.circles],l=a[e.index];return l?(a[e.index]={...l,cx:l.cx+n,cy:l.cy+o},{...i,circles:a}):i}if("polygon"===e.type){const a=[...i.polygons],l=a[e.index];return l?(a[e.index]={...l,points:l.points.map(([d,m])=>[d+n,m+o])},{...i,polygons:a}):i}return i})}applyResizeDelta(e,n,o,i){"bbox"===e.type&&this.drawingArtefacts.update(a=>{const l=[...a.xywhs],d=l[e.index];if(!d)return a;const m=this.parseXYWH(d.xywhStr);if(!m)return a;let{x:u,y:p,width:v,height:M}=m;return n.includes("w")&&(u+=o,v-=o),n.includes("e")&&(v+=o),n.includes("n")&&(p+=i,M-=i),n.includes("s")&&(M+=i),v<.5&&(v=.5),M<.5&&(M=.5),l[e.index]={...d,xywhStr:`percent:${u.toFixed(2)},${p.toFixed(2)},${v.toFixed(2)},${M.toFixed(2)}`},{...a,xywhs:l}})}applyCircleRadiusDelta(e,n,o){this.drawingArtefacts.update(i=>{const a=[...i.circles],l=a[e];if(!l)return i;const d=Math.sqrt(n*n+o*o)*Math.sign(n||o);return a[e]={...l,r:Math.max(.5,l.r+d)},{...i,circles:a}})}static \u0275fac=function(n){return new(n||s)};static \u0275prov=r.jDH({token:s,factory:s.\u0275fac})}return s})(),$=(()=>{class s{isDrawing=(0,r.vPA)(!1);drawStart=(0,r.vPA)(null);drawCurrent=(0,r.vPA)(null);drawMode;drawColor;drawnArtefactDef;artefactDrawn;mouseToImagePercent;imageDimensions;drawingArtefacts;drawMoveListener=this.onDrawMouseMove.bind(this);drawUpListener=this.onDrawMouseUp.bind(this);initialized=(0,r.vPA)(!1);drawPreview=(0,T.EW)(()=>{if(!this.initialized()||"xywh"!==this.drawMode())return null;const e=this.drawStart(),n=this.drawCurrent();if(!e||!n)return null;const o=Math.min(e.x,n.x),i=Math.min(e.y,n.y),a=Math.abs(n.x-e.x),l=Math.abs(n.y-e.y);return a<.1&&l<.1?null:{x:o,y:i,width:a,height:l,color:this.drawColor()}});circleDrawPreview=(0,T.EW)(()=>{if(!this.initialized()||"circle"!==this.drawMode())return null;const e=this.drawStart(),n=this.drawCurrent();if(!e||!n)return null;const o=Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));return o<.1?null:{cx:e.x,cy:e.y,r:o,color:this.drawColor()}});init(e){this.drawMode=e.drawMode,this.drawColor=e.drawColor,this.drawnArtefactDef=e.drawnArtefactDef,this.artefactDrawn=e.artefactDrawn,this.mouseToImagePercent=e.mouseToImagePercent,this.imageDimensions=e.imageDimensions,this.drawingArtefacts=e.drawingArtefacts,this.initialized.set(!0)}onDrawMouseDown(e){const n=this.drawMode();if("xywh"!==n&&"circle"!==n||0!==e.button)return;e.preventDefault(),e.stopPropagation();const o=this.mouseToImagePercent(e);o&&(this.isDrawing.set(!0),this.drawStart.set(o),this.drawCurrent.set(o),window.addEventListener("mousemove",this.drawMoveListener),window.addEventListener("mouseup",this.drawUpListener))}onDrawMouseMove(e){if(!this.isDrawing())return;e.preventDefault();const n=this.mouseToImagePercent(e);n&&this.drawCurrent.set(n)}onDrawMouseUp(e){if(!this.isDrawing())return;e?.preventDefault(),window.removeEventListener("mousemove",this.drawMoveListener),window.removeEventListener("mouseup",this.drawUpListener);const n=this.drawStart(),o=this.drawCurrent(),i=this.drawMode();if(n&&o)if("xywh"===i){const a=Math.min(n.x,o.x),l=Math.min(n.y,o.y),d=Math.abs(o.x-n.x),m=Math.abs(o.y-n.y);if(d>.5&&m>.5){const p={...this.drawnArtefactDef(),xywhStr:`percent:${a.toFixed(2)},${l.toFixed(2)},${d.toFixed(2)},${m.toFixed(2)}`,color:this.drawColor()},v={x:a,y:l,width:d,height:m};this.artefactDrawn.emit({type:"xywh",def:p,pct:v,abs:this.pctRectToAbs(v)}),this.drawingArtefacts.update(M=>({...M,xywhs:[...M.xywhs,p]}))}}else if("circle"===i){const a=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2));if(a>.5){const d={...this.drawnArtefactDef(),cx:n.x,cy:n.y,r:a,color:this.drawColor()},m=this.imageDimensions();this.artefactDrawn.emit({type:"circle",def:d,pct:{cx:n.x,cy:n.y,r:a},abs:{cx:m?n.x/100*m.width:n.x,cy:m?n.y/100*m.height:n.y,r:m?a/100*m.width:a}}),this.drawingArtefacts.update(u=>({...u,circles:[...u.circles,d]}))}}this.isDrawing.set(!1),this.drawStart.set(null),this.drawCurrent.set(null)}pctRectToAbs(e){const n=this.imageDimensions();return n?{x:e.x/100*n.width,y:e.y/100*n.height,width:e.width/100*n.width,height:e.height/100*n.height}:e}static \u0275fac=function(n){return new(n||s)};static \u0275prov=r.jDH({token:s,factory:s.\u0275fac})}return s})(),O=(()=>{class s{polygonPoints=(0,r.vPA)([]);polygonCursor=(0,r.vPA)(null);lastPolygonClickTime=0;axisSnapLines=(0,r.vPA)({});drawColor;drawnArtefactDef;artefactDrawn;mouseToImagePercent;imageAspectRatio;zoom;imageDimensions;drawingArtefacts;polygonMoveListener=this.onPolygonMouseMove.bind(this);polygonEscListener=this.onPolygonEsc.bind(this);initialized=(0,r.vPA)(!1);polygonDrawPreview=(0,T.EW)(()=>{if(!this.initialized())return null;const e=this.polygonPoints();if(0===e.length)return null;const n=this.polygonCursor();return{points:e,cursorPoint:n?[n.x,n.y]:null,color:this.drawColor()}});init(e){this.drawColor=e.drawColor,this.drawnArtefactDef=e.drawnArtefactDef,this.artefactDrawn=e.artefactDrawn,this.mouseToImagePercent=e.mouseToImagePercent,this.imageAspectRatio=e.imageAspectRatio,this.zoom=e.zoom,this.imageDimensions=e.imageDimensions,this.drawingArtefacts=e.drawingArtefacts,this.initialized.set(!0)}onPolygonClick(e){if(0!==e.button)return;const n=Date.now();if(n-this.lastPolygonClickTime<300)return;this.lastPolygonClickTime=n,e.preventDefault(),e.stopPropagation();const o=this.mouseToImagePercent(e);if(!o)return;const i=this.polygonPoints(),a=this.applySnapping(o,i,e.shiftKey);if(i.length>=3){const l=i[0],d=a.x-l[0],m=a.y-l[1];if(Math.sqrt(d*d+m*m)<this.closeThreshold)return void this.finishPolygon()}this.polygonPoints.update(l=>[...l,[a.x,a.y]]),this.polygonCursor.set(null),0===i.length&&(window.addEventListener("mousemove",this.polygonMoveListener),window.addEventListener("keydown",this.polygonEscListener))}cancelPolygon(){window.removeEventListener("mousemove",this.polygonMoveListener),window.removeEventListener("keydown",this.polygonEscListener),this.polygonPoints.set([]),this.polygonCursor.set(null),this.axisSnapLines.set({})}applyVertexDrag(e,n,o,i){this.drawingArtefacts.update(a=>{const l=[...a.polygons],d=l[e];if(!d)return a;const m=[...d.points.map(M=>[...M])];if(n<0||n>=m.length)return a;const u=m.filter((M,P)=>P!==n);let p=null;m.length>1&&(p=n>0?m[n-1]:m[n+1]);let v=o;return i&&p&&(v=this.snapTo45({x:p[0],y:p[1]},o)),v=this.snapToAxis(v,u,null,i?"none":"both"),m[n]=[v.x,v.y],l[e]={...d,points:m},{...a,polygons:l}})}snapTo45(e,n){const o=this.imageAspectRatio(),i=n.x-e.x,a=(n.y-e.y)/o,l=Math.atan2(a,i),d=Math.round(l/(Math.PI/4))*(Math.PI/4),m=Math.sqrt(i*i+a*a);return{x:e.x+m*Math.cos(d),y:e.y+m*Math.sin(d)*o}}get closeThreshold(){return 1.5/this.zoom()}get axisSnapThresholdX(){const e=this.imageDimensions?.();return e&&0!==e.width?24/(e.width*this.zoom()/100):1.5}get axisSnapThresholdY(){const e=this.imageDimensions?.();return e&&0!==e.height?24/(e.height*this.zoom()/100):1.5}applySnapping(e,n,o){const i=n.length>0?n[n.length-1]:null,a=n.length>1?n.slice(0,-1):[];if(!o||!i)return this.snapToAxis(e,a,i,"both");const l=this.snapTo45({x:i[0],y:i[1]},e),d=Math.abs(l.x-i[0]),m=Math.abs(l.y-i[1]),u=d+m+.001;let p;return p=d/u<.01?"y":m/u<.01?"x":"none",this.snapToAxis(l,a,i,p)}snapToAxis(e,n,o,i){if("none"===i||0===n.length)return this.axisSnapLines.set({}),e;let u,p,{x:a,y:l}=e,d=this.axisSnapThresholdX,m=this.axisSnapThresholdY;const v="x"===i||"both"===i,M="y"===i||"both"===i;for(const[P,w]of n){const E=o&&Math.abs(P-o[0])<.5,y=o&&Math.abs(w-o[1])<.5;if(v&&!E){const x=Math.abs(a-P);x<d&&(d=x,a=P,u=P)}if(M&&!y){const x=Math.abs(l-w);x<m&&(m=x,l=w,p=w)}}return this.axisSnapLines.set({x:u,y:p}),{x:a,y:l}}onPolygonMouseMove(e){const n=this.mouseToImagePercent(e);if(!n)return;const o=this.polygonPoints();this.polygonCursor.set(this.applySnapping(n,o,e.shiftKey))}finishPolygon(){const e=this.polygonPoints();if(e.length<3)return;window.removeEventListener("mousemove",this.polygonMoveListener),window.removeEventListener("keydown",this.polygonEscListener);const o={...this.drawnArtefactDef(),points:[...e],color:this.drawColor()},i=this.imageDimensions();this.artefactDrawn.emit({type:"polygon",def:o,pct:{points:[...e]},abs:{points:e.map(([a,l])=>[i?a/100*i.width:a,i?l/100*i.height:l])}}),this.polygonPoints.set([]),this.polygonCursor.set(null)}onPolygonEsc(e){"Escape"===e.key&&this.cancelPolygon()}static \u0275fac=function(n){return new(n||s)};static \u0275prov=r.jDH({token:s,factory:s.\u0275fac})}return s})();const q=["imageElement"],J=["*"],ee=(s,c)=>({artefact:s,type:"bbox",index:c}),te=(s,c)=>({artefact:s,type:"circle",index:c}),ne=(s,c)=>({artefact:s,type:"polygon",index:c}),oe=(s,c)=>({artefact:s,type:"svgPath",index:c}),ie=(s,c)=>e=>{const n=r.eBV(c).$implicit;return r.Njj(!e.visible||e.visible(n))},se=(s,c)=>c.label;function ae(s,c){if(1&s&&(t.j41(0,"cue-card",13),t.nrm(1,"cue-typography",14),t.k0s()),2&s){const e=t.XpG().$implicit,n=t.XpG();t.xc7("transform","scale("+1/n.zoom()+")"),t.R7$(),t.Y8G("noWrap",!0)("innerHTML",e.label,t.npT)}}function re(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",11),t.bIt("contextMenuOpen",function(){r.eBV(e);const o=t.XpG();return r.Njj(o.isContextMenuOpen.set(!0))})("contextMenuClose",function(){r.eBV(e);const o=t.XpG();return r.Njj(o.isContextMenuOpen.set(!1))})("click",function(o){const i=r.eBV(e).$implicit,a=t.XpG();return r.Njj(a.handleBboxClick(i,o))}),t.nVh(1,ae,2,4,"cue-card",12),t.k0s()}if(2&s){const e=c.$implicit,n=t.XpG(),o=t.sdS(17);t.xc7("left",e.x,"%")("top",e.y,"%")("width",e.width,"%")("height",e.height,"%")("border-color",e.color||"rgba(255, 0, 0, 0.8)")("border-width",3/n.zoom()+"px")("background-color",!1===e.showFill?"transparent":n.getBgColor(e.color)),t.AVh("clickable",n.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit)("removable",!!e.allowRemove),t.Y8G("title",e.label||"")("cueContextMenu",o)("contextMenuData",t.l_i(23,ee,e,e.sourceIndex))("cueContextEnabled",n.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit),t.R7$(),t.vxM(e.label?1:-1)}}function ce(s,c){if(1&s&&t.nrm(0,"div",15),2&s){const e=c,n=t.XpG();t.xc7("left",e.x,"%")("top",e.y,"%")("width",e.width,"%")("height",e.height,"%")("border-color",e.color)("border-width",3/n.zoom()+"px")("background-color",n.getBgColor(e.color))}}function le(s,c){if(1&s){const e=t.RV6();r.qSk(),t.j41(0,"ellipse",17),t.bIt("contextMenuOpen",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!0))})("contextMenuClose",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!1))}),t.k0s()}if(2&s){const e=c.$implicit,n=c.$index,o=t.XpG(2),i=t.sdS(17);t.xc7("pointer-events",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"all":"none")("cursor",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"pointer":"default"),t.Y8G("cueContextMenu",i)("contextMenuData",t.l_i(14,te,e,n))("cueContextEnabled",o.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit),t.BMQ("cx",e.cx)("cy",e.cy)("rx",e.r)("ry",e.r*o.imageAspectRatio())("stroke",e.color||"rgba(255, 0, 0, 0.8)")("fill",!1===e.showFill?"none":o.getBgColor(e.color))("stroke-width",3/o.zoom())}}function de(s,c){if(1&s&&(t.j41(0,"cue-card",13),t.nrm(1,"cue-typography",14),t.k0s()),2&s){const e=t.XpG().$implicit,n=t.XpG(2);t.xc7("left",e.cx,"%")("top",e.cy-e.r*n.imageAspectRatio(),"%")("transform","scale("+1/n.zoom()+")"),t.R7$(),t.Y8G("noWrap",!0)("innerHTML",e.label,t.npT)}}function me(s,c){1&s&&t.nVh(0,de,2,8,"cue-card",18),2&s&&t.vxM(c.$implicit.label?0:-1)}function he(s,c){if(1&s&&(r.qSk(),t.j41(0,"svg",8),t.Z7z(1,le,1,17,":svg:ellipse",16,t.Vm6),t.k0s(),t.Z7z(3,me,1,1,null,null,t.Vm6)),2&s){const e=t.XpG();t.R7$(),t.Dyx(e.drawingArtefacts().circles),t.R7$(2),t.Dyx(e.drawingArtefacts().circles)}}function ue(s,c){if(1&s&&(r.qSk(),t.j41(0,"svg",8),t.nrm(1,"ellipse",19),t.k0s()),2&s){const e=c,n=t.XpG();t.R7$(),t.BMQ("cx",e.cx)("cy",e.cy)("rx",e.r)("ry",e.r*n.imageAspectRatio())("stroke",e.color)("fill",n.getBgColor(e.color))("stroke-width",3/n.zoom())}}function ge(s,c){if(1&s){const e=t.RV6();r.qSk(),t.j41(0,"polygon",21),t.bIt("contextMenuOpen",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!0))})("contextMenuClose",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!1))}),t.k0s()}if(2&s){const e=c.$implicit,n=c.$index,o=t.XpG(2),i=t.sdS(17);t.xc7("pointer-events",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"all":"none")("cursor",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"pointer":"default"),t.AVh("clickable",o.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit),t.Y8G("cueContextMenu",i)("contextMenuData",t.l_i(13,ne,e,n))("cueContextEnabled",o.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit),t.BMQ("points",o.pointsToAttr(e.points))("stroke",e.color||"rgba(255, 0, 0, 0.8)")("fill",!1===e.showFill?"none":o.getBgColor(e.color))("stroke-width",3/o.zoom())}}function pe(s,c){if(1&s&&(t.j41(0,"cue-card",13),t.nrm(1,"cue-typography",14),t.k0s()),2&s){const e=t.XpG().$implicit,n=t.XpG(2);t.xc7("left",n.polygonCentroid(e.points).x,"%")("top",n.polygonCentroid(e.points).y,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.Y8G("noWrap",!0)("innerHTML",e.label,t.npT)}}function _e(s,c){1&s&&t.nVh(0,pe,2,8,"cue-card",18),2&s&&t.vxM(c.$implicit.label?0:-1)}function fe(s,c){if(1&s&&(r.qSk(),t.j41(0,"svg",8),t.Z7z(1,ge,1,16,":svg:polygon",20,t.Vm6),t.k0s(),t.Z7z(3,_e,1,1,null,null,t.Vm6)),2&s){const e=t.XpG();t.R7$(),t.Dyx(e.drawingArtefacts().polygons),t.R7$(2),t.Dyx(e.drawingArtefacts().polygons)}}function we(s,c){if(1&s&&(r.qSk(),t.nrm(0,"line",25)(1,"line",26)),2&s){const e=t.XpG(),n=t.XpG();t.BMQ("x1",e.points[e.points.length-1][0])("y1",e.points[e.points.length-1][1])("x2",e.cursorPoint[0])("y2",e.cursorPoint[1])("stroke",e.color)("stroke-width",2/n.zoom()),t.R7$(),t.BMQ("x1",e.cursorPoint[0])("y1",e.cursorPoint[1])("x2",e.points[0][0])("y2",e.points[0][1])("stroke",e.color)("stroke-width",1/n.zoom())}}function xe(s,c){if(1&s&&t.nrm(0,"div",27),2&s){const e=c.$implicit,n=t.XpG(),o=t.XpG();t.xc7("left",e[0],"%")("top",e[1],"%")("transform","translate(-50%, -50%) scale("+1/o.zoom()+")")("background",n.color)}}function ve(s,c){if(1&s&&t.nrm(0,"div",28),2&s){const e=t.XpG(),n=t.XpG();t.xc7("left",e.cursorPoint[0],"%")("top",e.cursorPoint[1],"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")")("background",e.color)}}function Me(s,c){if(1&s&&t.nrm(0,"div",31),2&s){const e=t.XpG();t.xc7("left",e.x,"%")}}function ye(s,c){if(1&s&&t.nrm(0,"div",32),2&s){const e=t.XpG();t.xc7("top",e.y,"%")}}function be(s,c){if(1&s&&(t.nVh(0,Me,1,2,"div",29),t.nVh(1,ye,1,2,"div",30)),2&s){const e=c;t.vxM(void 0!==e.x?0:-1),t.R7$(),t.vxM(void 0!==e.y?1:-1)}}function Ce(s,c){if(1&s&&(r.qSk(),t.j41(0,"svg",8),t.nrm(1,"polyline",22),t.nVh(2,we,2,12),t.k0s(),t.Z7z(3,xe,1,8,"div",23,t.Vm6),t.nVh(5,ve,1,8,"div",24),t.nVh(6,be,2,2)),2&s){let e;const n=c,o=t.XpG();t.R7$(),t.BMQ("points",o.pointsToAttr(n.points))("stroke",n.color)("stroke-width",3/o.zoom()),t.R7$(),t.vxM(n.cursorPoint?2:-1),t.R7$(),t.Dyx(n.points),t.R7$(2),t.vxM(n.cursorPoint&&!o.isCursorOnVertex(n.cursorPoint,n.points)?5:-1),t.R7$(),t.vxM((e=o.polygonService.axisSnapLines())?6:-1,e)}}function De(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",33),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG();return r.Njj("polygon"===i.drawMode()?i.polygonService.onPolygonClick(o):i.drawingService.onDrawMouseDown(o))})("keydown.escape",function(){r.eBV(e);const o=t.XpG();return r.Njj(o.polygonService.cancelPolygon())}),t.k0s()}}function Pe(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",35),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"nw"))}),t.k0s(),t.j41(1,"div",36),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"ne"))}),t.k0s(),t.j41(2,"div",37),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"sw"))}),t.k0s(),t.j41(3,"div",38),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"se"))}),t.k0s(),t.j41(4,"div",39),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"n"))}),t.k0s(),t.j41(5,"div",40),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"s"))}),t.k0s(),t.j41(6,"div",41),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"w"))}),t.k0s(),t.j41(7,"div",42),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"e"))}),t.k0s()}if(2&s){const e=t.XpG().$implicit,n=t.XpG(3);t.xc7("left",e.x,"%")("top",e.y,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x+e.width,"%")("top",e.y,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x,"%")("top",e.y+e.height,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x+e.width,"%")("top",e.y+e.height,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x+e.width/2,"%")("top",e.y,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x+e.width/2,"%")("top",e.y+e.height,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x,"%")("top",e.y+e.height/2,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x+e.width,"%")("top",e.y+e.height/2,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")")}}function ze(s,c){if(1&s&&t.nVh(0,Pe,8,48),2&s){const e=c.$index,n=t.XpG(2);t.vxM(e===n.index?0:-1)}}function Te(s,c){if(1&s&&t.Z7z(0,ze,1,1,null,null,t.Vm6),2&s){const e=t.XpG(2);t.Dyx(e.boundingBoxes())}}function Ie(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",43),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"radius"))}),t.k0s(),t.j41(1,"div",43),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"radius"))}),t.k0s(),t.j41(2,"div",44),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"radius"))}),t.k0s(),t.j41(3,"div",44),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"radius"))}),t.k0s()}if(2&s){const e=t.XpG().$implicit,n=t.XpG(3);t.xc7("left",e.cx+e.r,"%")("top",e.cy,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.cx-e.r,"%")("top",e.cy,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.cx,"%")("top",e.cy-e.r*n.imageAspectRatio(),"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.cx,"%")("top",e.cy+e.r*n.imageAspectRatio(),"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")")}}function Ee(s,c){if(1&s&&t.nVh(0,Ie,4,24),2&s){const e=c.$index,n=t.XpG(2);t.vxM(e===n.index?0:-1)}}function Ve(s,c){if(1&s&&t.Z7z(0,Ee,1,1,null,null,t.Vm6),2&s){const e=t.XpG(2);t.Dyx(e.drawingArtefacts().circles)}}function ke(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",46),t.bIt("mousedown",function(o){const i=r.eBV(e).$index,a=t.XpG(5);return r.Njj(a.editService.onEditMouseDown(o,"vertex:"+i))}),t.k0s()}if(2&s){const e=c.$implicit,n=t.XpG(5);t.xc7("left",e[0],"%")("top",e[1],"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")")}}function Ae(s,c){if(1&s&&t.Z7z(0,ke,1,6,"div",45,t.Vm6),2&s){const e=t.XpG().$implicit;t.Dyx(e.points)}}function Le(s,c){if(1&s&&t.nVh(0,Ae,2,0),2&s){const e=c.$index,n=t.XpG(2);t.vxM(e===n.index?0:-1)}}function Se(s,c){if(1&s&&t.Z7z(0,Le,1,1,null,null,t.Vm6),2&s){const e=t.XpG(2);t.Dyx(e.drawingArtefacts().polygons)}}function Re(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",34),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG();return r.Njj(i.editService.onEditMouseDown(o,"body"))}),t.nVh(1,Te,2,0),t.nVh(2,Ve,2,0),t.nVh(3,Se,2,0),t.k0s()}if(2&s){const e=c;t.R7$(),t.vxM("bbox"===e.type?1:-1),t.R7$(),t.vxM("circle"===e.type?2:-1),t.R7$(),t.vxM("polygon"===e.type?3:-1)}}function je(s,c){if(1&s){const e=t.RV6();r.qSk(),t.j41(0,"g",49),t.bIt("contextMenuOpen",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!0))})("contextMenuClose",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!1))})("click",function(o){const i=r.eBV(e).$implicit,a=t.XpG(2);return r.Njj(a.handleSvgPathClick(i,o))}),t.k0s()}if(2&s){const e=c.$implicit,n=c.$index,o=t.XpG(2),i=t.sdS(17);t.xc7("pointer-events",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"all":"none")("cursor",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"pointer":"default")("--dxf-sw",null!=e.strokeWidth&&o.zoom()?e.strokeWidth/o.zoom():null),t.AVh("clickable",o.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit),t.Y8G("cueContextMenu",i)("contextMenuData",t.l_i(18,oe,e,n))("cueContextEnabled",o.contextMenuItems().length>0&&o.contextMenuItems().some(t._m7(17,ie,c))||!!e.allowRemove||!!e.allowEdit)("innerHTML",o.safeSvg(e.svg),t.npT),t.BMQ("title",e.label||"")("transform",e.transform||null)("stroke",e.color||"#ffa8a8")("fill",e.fillColor||"none")("stroke-dasharray",e.strokeDashArray||null)}}function Fe(s,c){if(1&s&&(t.j41(0,"cue-card",13),t.nrm(1,"cue-typography",14),t.k0s()),2&s){const e=c,n=t.XpG().$implicit,o=t.XpG(2);t.xc7("left",e.x,"%")("top",e.y,"%")("transform","translate(-50%, -50%) scale("+1/o.zoom()+")"),t.R7$(),t.Y8G("noWrap",!0)("innerHTML",n.label,t.npT)}}function Xe(s,c){if(1&s&&t.nVh(0,Fe,2,8,"cue-card",18),2&s){let e;const n=c.$implicit,o=t.XpG(2);t.vxM((e=n.label&&o.getSvgLabelPositionPercent(n.svg,n.transform))?0:-1,e)}}function Ze(s,c){if(1&s&&(r.qSk(),t.j41(0,"svg",47),t.Z7z(1,je,1,21,":svg:g",48,t.Vm6),t.k0s(),t.Z7z(3,Xe,1,1,null,null,t.Vm6)),2&s){const e=t.XpG();t.BMQ("viewBox",e.svgViewBox()),t.R7$(),t.Dyx(e.drawingArtefacts().svgPaths),t.R7$(2),t.Dyx(e.drawingArtefacts().svgPaths)}}function Ge(s,c){if(1&s){const e=t.RV6();t.j41(0,"cue-menu-item",50),t.bIt("click",function(){r.eBV(e);const o=t.XpG().$implicit,i=t.XpG(2).$implicit;return r.Njj(o.action(i.artefact))}),t.EFF(1),t.k0s()}if(2&s){const e=t.XpG().$implicit;t.R7$(),t.SpI(" ",e.label," ")}}function Be(s,c){if(1&s&&t.nVh(0,Ge,2,1,"cue-menu-item"),2&s){const e=c.$implicit,n=t.XpG(2).$implicit;t.vxM(!e.visible||e.visible(n.artefact)?0:-1)}}function Ne(s,c){if(1&s){const e=t.RV6();t.j41(0,"cue-menu-item",50),t.bIt("click",function(){r.eBV(e);const o=t.XpG(2).$implicit,i=t.XpG();return r.Njj(i.editService.startEditArtefact(o.type,"bbox"===o.type?o.artefact.sourceIndex:o.index))}),t.EFF(1),t.nI1(2,"transloco"),t.k0s()}2&s&&(t.R7$(),t.SpI(" ",t.bMT(2,1,"common.buttons.edit")," "))}function $e(s,c){if(1&s){const e=t.RV6();t.j41(0,"cue-menu-item",50),t.bIt("click",function(){r.eBV(e);const o=t.XpG(2).$implicit,i=t.XpG();return r.Njj("bbox"===o.type?i.removeArtefact(o.artefact):"circle"===o.type?i.removeCircleArtefact(o.index):"polygon"===o.type?i.removePolygonArtefact(o.index):i.removeSvgPathArtefact(o.index))}),t.EFF(1),t.nI1(2,"transloco"),t.k0s()}2&s&&(t.R7$(),t.SpI(" ",t.bMT(2,1,"common.buttons.delete")," "))}function Oe(s,c){if(1&s&&(t.j41(0,"cue-menu-wrap"),t.Z7z(1,Be,1,1,null,null,se),t.nVh(3,Ne,3,3,"cue-menu-item"),t.nVh(4,$e,3,3,"cue-menu-item"),t.k0s()),2&s){const e=t.XpG().$implicit,n=t.XpG();t.R7$(),t.Dyx(n.contextMenuItems()),t.R7$(2),t.vxM(!e.artefact.allowEdit||"bbox"!==e.type&&"circle"!==e.type&&"polygon"!==e.type?-1:3),t.R7$(),t.vxM(e.artefact.allowRemove?4:-1)}}function We(s,c){if(1&s&&t.nVh(0,Oe,5,2,"cue-menu-wrap"),2&s){const e=t.XpG();t.vxM(e.contextMenuItems().length>0?0:-1)}}function Ye(s,c){if(1&s){const e=t.RV6();t.j41(0,"cue-image-toolbar",52),t.mxI("zoomChange",function(o){r.eBV(e);const i=t.XpG(2);return t.DH7(i.zoom,o)||(i.zoom=o),r.Njj(o)})("panChange",function(o){r.eBV(e);const i=t.XpG(2);return t.DH7(i.pan,o)||(i.pan=o),r.Njj(o)})("activeToolChange",function(o){r.eBV(e);const i=t.XpG(2);return t.DH7(i.activeTool,o)||(i.activeTool=o),r.Njj(o)}),t.bIt("rotate",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.handleRotate())})("zoomIn",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.handleZoomIn())})("zoomOut",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.handleZoomOut())})("zoomFit",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.calculateFitZoom())}),t.k0s()}if(2&s){const e=t.XpG(),n=t.XpG();t.Aen(n.toolbarStyle()),t.Y8G("options",e),t.R50("zoom",n.zoom)("pan",n.pan)("activeTool",n.activeTool),t.Y8G("minZoom",n.minZoom())("maxZoom",n.maxZoom())}}function He(s,c){1&s&&t.nVh(0,Ye,1,8,"cue-image-toolbar",51),2&s&&t.vxM(c.hidden?-1:0)}let Ue=(()=>{class s{svgHelpers=(0,r.WQX)(K);editService=(0,r.WQX)(N);drawingService=(0,r.WQX)($);polygonService=(0,r.WQX)(O);sanitizer=(0,r.WQX)(X.up);onEscape(){this.polygonService.polygonPoints().length>0&&this.polygonService.cancelPolygon(),this.editService.editingArtefact()&&this.editService.cancelEdit()}onEnter(){this.editService.editingArtefact()&&this.editService.cancelEdit()}src=g.hFB.required();alt=(0,g.hFB)("");fitMode=(0,g.hFB)("contain");toolbarOptions=(0,g.hFB)(new A.g);drawMode=(0,g.hFB)("none");panDisabled=(0,g.hFB)(!1);zoomDisabled=(0,g.hFB)(!1);drawnArtefactDef=(0,g.hFB)({allowRemove:!0,allowEdit:!0,color:"rgba(255, 0, 0, 0.9)"});contextMenuItems=(0,g.hFB)([]);activeTool=(0,g.geq)("pan");drawingArtefacts=(0,g.geq)((0,G.x)());artefactSelected=(0,g.CGW)();artefactDrawn=(0,g.CGW)();artefactRemoved=(0,g.CGW)();artefactEdited=(0,g.CGW)();drawColor=(0,T.EW)(()=>this.drawnArtefactDef().color??"rgba(255, 0, 0, 0.9)");panModeActive=(0,T.EW)(()=>!this.panDisabled()&&"none"===this.drawMode()&&!this.editService.editingArtefact()&&!this.isContextMenuOpen()&&"select"!==this.activeTool());boundingBoxes=(0,T.EW)(()=>this.drawingArtefacts().xywhs.map((n,o)=>{const i=this.parseXYWH("string"==typeof n?n:n.xywhStr);return i&&0!==i.width&&0!==i.height?("object"==typeof n&&(i.color=n.color,i.label=n.label,i.showFill=n.showFill,i.allowRemove=n.allowRemove,i.allowEdit=n.allowEdit),i.sourceIndex=o,i):null}).filter(Boolean));panZoom=(0,g.ebz)(k);imageElement=(0,g.ebz)("imageElement");rotationAngle=(0,r.vPA)(0);pan=(0,r.vPA)({x:0,y:0});isContextMenuOpen=(0,r.vPA)(!1);isZooming=(0,r.vPA)(!1);_zoomEndTimer=null;constructor(){(0,r.QZP)(e=>{const n=this.panZoom();if(n){const o=n.containerRef()?.nativeElement;if(o){const i=new ResizeObserver(()=>{this.zoomDisabled()||this.calculateFitZoom()});i.observe(o),e(()=>i.disconnect())}}}),(0,r.QZP)(e=>{this.zoom(),this.isZooming.set(!0),this._zoomEndTimer&&clearTimeout(this._zoomEndTimer),this._zoomEndTimer=setTimeout(()=>this.isZooming.set(!1),150),e(()=>{this._zoomEndTimer&&clearTimeout(this._zoomEndTimer)})}),queueMicrotask(()=>{const e=this.mouseToImagePercent.bind(this),n=this.parseXYWH.bind(this);this.editService.init({drawingArtefacts:this.drawingArtefacts,mouseToImagePercent:e,parseXYWH:n,polygonService:this.polygonService,artefactEdited:this.artefactEdited}),this.drawingService.init({drawMode:this.drawMode,drawColor:this.drawColor,drawnArtefactDef:this.drawnArtefactDef,artefactDrawn:this.artefactDrawn,mouseToImagePercent:e,imageDimensions:this.imageDimensions,drawingArtefacts:this.drawingArtefacts}),this.polygonService.init({drawColor:this.drawColor,drawnArtefactDef:this.drawnArtefactDef,artefactDrawn:this.artefactDrawn,mouseToImagePercent:e,imageAspectRatio:this.imageAspectRatio,zoom:this.zoom,imageDimensions:this.imageDimensions,drawingArtefacts:this.drawingArtefacts})})}zoom=(0,r.vPA)(1);imageDimensions=(0,r.vPA)(null);imageAspectRatio=(0,T.EW)(()=>{const e=this.imageDimensions();return e&&0!==e.height?e.width/e.height:1});minZoom=(0,r.vPA)(1);maxZoom=(0,r.vPA)(10);toolbarStyle=(0,T.EW)(()=>{const e=this.toolbarOptions();return{position:"absolute",left:e.margin,right:e.margin,["top"===e.position?"top":"bottom"]:e.margin,"z-index":"1000",display:"flex","justify-content":"center"}});onImageLoad(){const e=this.imageElement()?.nativeElement;e&&(this.imageDimensions.set({width:e.naturalWidth,height:e.naturalHeight}),this.zoomDisabled()||this.calculateFitZoom())}calculateFitZoom(){const e=this.panZoom(),n=this.imageElement()?.nativeElement;!e||!n||requestAnimationFrame(()=>{const o=e.containerRef()?.nativeElement;if(!o)return;const i=o.getBoundingClientRect(),a=n.naturalWidth,l=n.naturalHeight;if(0===a||0===l)return;const d=i.width/a,m=i.height/l;let u=1;u="contain"===this.fitMode()?Math.min(d,m):"cover"===this.fitMode()?Math.max(d,m):1,this.minZoom.set(Math.min(u,1)),this.zoom.set(u),this.centerImage()})}centerImage(){const e=this.panZoom();e?requestAnimationFrame(()=>{const n=e.containerRef()?.nativeElement;if(!n)return;const o=n.getBoundingClientRect(),i=this.zoom(),a=this.imageDimensions()?.width||0,l=this.imageDimensions()?.height||0;this.pan.set({x:(o.width-a*i)/2,y:(o.height-l*i)/2})}):this.pan.set({x:0,y:0})}handleRotate(){this.rotationAngle.update(e=>(e-90)%360),this.pan.update(()=>({x:0,y:0}))}handleZoomIn(){this.panZoom()?.zoomIn()}handleZoomOut(){this.panZoom()?.zoomOut()}parseXYWH(e){try{const o=e.replace("percent:","").split(",").map(m=>parseFloat(m.trim()));if(4!==o.length||o.some(isNaN))return console.warn(`Invalid XYWH format: ${e}`),null;const[i,a,l,d]=o;return{x:i,y:a,width:l,height:d}}catch(n){return console.error(`Error parsing XYWH: ${e}`,n),null}}getBgColor(e){if(!e)return"rgba(255, 0, 0, 0.1)";const n=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/);if(n)return`rgba(${n[1]}, ${n[2]}, ${n[3]}, 0.1)`;const o=e.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const i=o[1];return`rgba(${parseInt(3===i.length?i[0]+i[0]:i.slice(0,2),16)}, ${parseInt(3===i.length?i[1]+i[1]:i.slice(2,4),16)}, ${parseInt(3===i.length?i[2]+i[2]:i.slice(4,6),16)}, 0.1)`}return e.replace(/rgba?\([^)]+\)/,"rgba(255, 0, 0, 0.1)")}mouseToImagePercent(e){const n=this.imageElement()?.nativeElement;if(!n)return null;const o=n.getBoundingClientRect(),a=(e.clientY-o.top)/o.height*100;return{x:Math.max(0,Math.min(100,(e.clientX-o.left)/o.width*100)),y:Math.max(0,Math.min(100,a))}}handleBboxClick(e,n){n.stopPropagation(),this.artefactSelected.emit(e)}removeArtefact(e){if(null==e.sourceIndex)return;const n=this.drawingArtefacts().xywhs[e.sourceIndex];this.drawingArtefacts.update(o=>({...o,xywhs:o.xywhs.filter((i,a)=>a!==e.sourceIndex)})),n&&this.artefactRemoved.emit(n)}removeCircleArtefact(e){const n=this.drawingArtefacts().circles[e];this.drawingArtefacts.update(o=>({...o,circles:o.circles.filter((i,a)=>a!==e)})),n&&this.artefactRemoved.emit(n)}removePolygonArtefact(e){const n=this.drawingArtefacts().polygons[e];this.drawingArtefacts.update(o=>({...o,polygons:o.polygons.filter((i,a)=>a!==e)})),n&&this.artefactRemoved.emit(n)}handleSvgPathClick(e,n){n.stopPropagation(),this.artefactSelected.emit(e)}removeSvgPathArtefact(e){const n=this.drawingArtefacts().svgPaths[e];this.drawingArtefacts.update(o=>({...o,svgPaths:o.svgPaths.filter((i,a)=>a!==e)})),n&&this.artefactRemoved.emit(n)}svgViewBox=(0,T.EW)(()=>{const e=this.imageDimensions();if(e&&e.width>0&&e.height>0)return`0 0 ${e.width} ${e.height}`;const n=this.drawingArtefacts().svgPaths;if(n.length>0){const i=n[0].svg.match(/viewBox="([^"]+)"/);if(i)return i[1]}return"0 0 100 100"});getSvgLabelPositionPercent(e,n){const o=this.svgHelpers.getLabelPosition(e);if(!o)return null;const i=this.imageDimensions();if(!i||0===i.width||0===i.height)return null;let{x:a,y:l}=o;if(n){const d=n.match(/matrix\(\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*\)/);if(d){const[,m,u,p,v,M,P]=d.map(Number),E=u*a+v*l+P;a=m*a+p*l+M,l=E}}return{x:a/i.width*100,y:l/i.height*100}}pointsToAttr(e){return e.map(n=>n[0]+","+n[1]).join(" ")}polygonCentroid(e){let n=0,o=0;for(const i of e)n+=i[0],o+=i[1];return{x:n/e.length,y:o/e.length}}isCursorOnVertex(e,n){for(const o of n)if(Math.abs(e[0]-o[0])<.5&&Math.abs(e[1]-o[1])<.5)return!0;return!1}safeSvg(e){let n=e.trim();if(n.startsWith("<svg")){const i=(new DOMParser).parseFromString(n,"image/svg+xml"),a=i.querySelector("parsererror");a&&console.warn("[ImageViewer] safeSvg: SVG parse error",a.textContent),n=i.documentElement.innerHTML}return this.sanitizer.bypassSecurityTrustHtml(n)}static \u0275fac=function(n){return new(n||s)};static \u0275cmp=t.VBU({type:s,selectors:[["cue-image-viewer"]],viewQuery:function(n,o){1&n&&t.wEZ(o.panZoom,k,5)(o.imageElement,q,5),2&n&&t.NyB(2)},hostBindings:function(n,o){1&n&&t.bIt("keydown.escape",function(){return o.onEscape()},t.EBC)("keydown.enter",function(){return o.onEnter()},t.EBC)},inputs:{src:[1,"src"],alt:[1,"alt"],fitMode:[1,"fitMode"],toolbarOptions:[1,"toolbarOptions"],drawMode:[1,"drawMode"],panDisabled:[1,"panDisabled"],zoomDisabled:[1,"zoomDisabled"],drawnArtefactDef:[1,"drawnArtefactDef"],contextMenuItems:[1,"contextMenuItems"],activeTool:[1,"activeTool"],drawingArtefacts:[1,"drawingArtefacts"]},outputs:{activeTool:"activeToolChange",drawingArtefacts:"drawingArtefactsChange",artefactSelected:"artefactSelected",artefactDrawn:"artefactDrawn",artefactRemoved:"artefactRemoved",artefactEdited:"artefactEdited"},features:[t.Jv_([N,$,O])],ngContentSelectors:J,decls:19,vars:19,consts:[["imageElement",""],["artefactContextMenu",""],[1,"container"],[2,"width","100%","height","100%",3,"zoomChange","panChange","minZoom","maxZoom","zoom","pan","zoomStep","panMode"],[1,"image-container"],["draggable","false",2,"max-width","none","height","auto","display","block","user-select","none",3,"load","src","alt"],["trigger","leftclick",1,"bounding-box-overlay",3,"clickable","removable","left","top","width","height","border-color","border-width","background-color","title","cueContextMenu","contextMenuData","cueContextEnabled"],[1,"bounding-box-overlay","draw-preview",3,"left","top","width","height","border-color","border-width","background-color"],["viewBox","0 0 100 100","preserveAspectRatio","none",1,"svg-overlay",2,"position","absolute","top","0","left","0","width","100%","height","100%","pointer-events","none","overflow","visible"],["tabindex","0",1,"draw-overlay"],[1,"draw-overlay","edit-overlay"],["trigger","leftclick",1,"bounding-box-overlay",3,"contextMenuOpen","contextMenuClose","click","title","cueContextMenu","contextMenuData","cueContextEnabled"],[1,"bbox-label",3,"transform"],[1,"bbox-label"],["size","xs","weight","medium",3,"noWrap","innerHTML"],[1,"bounding-box-overlay","draw-preview"],["vector-effect","non-scaling-stroke","trigger","leftclick",1,"clickable",3,"pointer-events","cursor","cueContextMenu","contextMenuData","cueContextEnabled"],["vector-effect","non-scaling-stroke","trigger","leftclick",1,"clickable",3,"contextMenuOpen","contextMenuClose","cueContextMenu","contextMenuData","cueContextEnabled"],[1,"bbox-label",3,"left","top","transform"],["vector-effect","non-scaling-stroke","stroke-dasharray","6 4"],["vector-effect","non-scaling-stroke","trigger","leftclick",3,"pointer-events","cursor","clickable","cueContextMenu","contextMenuData","cueContextEnabled"],["vector-effect","non-scaling-stroke","trigger","leftclick",3,"contextMenuOpen","contextMenuClose","cueContextMenu","contextMenuData","cueContextEnabled"],["fill","none","vector-effect","non-scaling-stroke","stroke-dasharray","6 4"],[1,"polygon-vertex",3,"left","top","transform","background"],[1,"polygon-vertex","cursor-preview",3,"left","top","transform","background"],["vector-effect","non-scaling-stroke","stroke-dasharray","4 4","opacity","0.6"],["vector-effect","non-scaling-stroke","stroke-dasharray","2 4","opacity","0.3"],[1,"polygon-vertex"],[1,"polygon-vertex","cursor-preview"],[1,"snap-guide","vertical",3,"left"],[1,"snap-guide","horizontal",3,"top"],[1,"snap-guide","vertical"],[1,"snap-guide","horizontal"],["tabindex","0",1,"draw-overlay",3,"mousedown","keydown.escape"],[1,"draw-overlay","edit-overlay",3,"mousedown"],[1,"resize-handle","nw",3,"mousedown"],[1,"resize-handle","ne",3,"mousedown"],[1,"resize-handle","sw",3,"mousedown"],[1,"resize-handle","se",3,"mousedown"],[1,"resize-handle","n",3,"mousedown"],[1,"resize-handle","s",3,"mousedown"],[1,"resize-handle","w",3,"mousedown"],[1,"resize-handle","e",3,"mousedown"],[1,"resize-handle","radius",3,"mousedown"],[1,"resize-handle","radius-v",3,"mousedown"],[1,"resize-handle","vertex",3,"left","top","transform"],[1,"resize-handle","vertex",3,"mousedown"],["preserveAspectRatio","none",1,"svg-overlay",2,"position","absolute","top","0","left","0","width","100%","height","100%","pointer-events","none","overflow","visible"],["trigger","leftclick",3,"clickable","pointer-events","cursor","cueContextMenu","contextMenuData","cueContextEnabled","--dxf-sw","innerHTML"],["trigger","leftclick",3,"contextMenuOpen","contextMenuClose","click","cueContextMenu","contextMenuData","cueContextEnabled","innerHTML"],[3,"click"],[3,"options","style","zoom","pan","activeTool","minZoom","maxZoom"],[3,"zoomChange","panChange","activeToolChange","rotate","zoomIn","zoomOut","zoomFit","options","zoom","pan","activeTool","minZoom","maxZoom"]],template:function(n,o){if(1&n){const i=t.RV6();t.NAR(),t.j41(0,"div",2)(1,"cue-pan-zoom",3),t.mxI("zoomChange",function(l){return r.eBV(i),t.DH7(o.zoom,l)||(o.zoom=l),r.Njj(l)})("panChange",function(l){return r.eBV(i),t.DH7(o.pan,l)||(o.pan=l),r.Njj(l)}),t.j41(2,"div",4)(3,"img",5,0),t.bIt("load",function(){return o.onImageLoad()}),t.k0s(),t.Z7z(5,re,2,26,"div",6,t.Vm6),t.nVh(7,ce,1,14,"div",7),t.nVh(8,he,5,0),t.nVh(9,ue,2,7,":svg:svg",8),t.nVh(10,fe,5,0),t.nVh(11,Ce,7,6),t.nVh(12,De,1,0,"div",9),t.nVh(13,Re,4,3,"div",10),t.nVh(14,Ze,5,1),t.SdG(15),t.DNE(16,We,1,1,"ng-template",null,1,t.C5r),t.k0s()(),t.nVh(18,He,1,1),t.k0s()}if(2&n){let i,a,l,d,m;t.R7$(),t.Y8G("minZoom",o.zoomDisabled()?o.zoom():o.minZoom())("maxZoom",o.zoomDisabled()?o.zoom():o.maxZoom()),t.R50("zoom",o.zoom)("pan",o.pan),t.Y8G("zoomStep",.1)("panMode",o.panModeActive()),t.R7$(),t.xc7("transform","rotate("+o.rotationAngle()+"deg)"),t.R7$(),t.Y8G("src",o.src(),t.B4B)("alt",o.alt()),t.R7$(2),t.Dyx(o.boundingBoxes()),t.R7$(2),t.vxM((i=o.drawingService.drawPreview())?7:-1,i),t.R7$(),t.vxM(o.drawingArtefacts().circles.length>0?8:-1),t.R7$(),t.vxM((a=o.drawingService.circleDrawPreview())?9:-1,a),t.R7$(),t.vxM(o.drawingArtefacts().polygons.length>0?10:-1),t.R7$(),t.vxM((l=o.polygonService.polygonDrawPreview())?11:-1,l),t.R7$(),t.vxM("none"!==o.drawMode()?12:-1),t.R7$(),t.vxM((d=o.editService.editingArtefact())?13:-1,d),t.R7$(),t.vxM(o.drawingArtefacts().svgPaths.length>0&&!o.isZooming()?14:-1),t.R7$(4),t.vxM((m=o.toolbarOptions())?18:-1,m)}},dependencies:[L.MD,A.F,k,S.Q,C.M,R.D,f.Card,z.Typography,B.Kj],styles:["[_nghost-%COMP%]{display:contents}.container[_ngcontent-%COMP%]{position:relative;width:100%;height:100%;overflow:hidden;display:flex;flex-direction:column}.image-container[_ngcontent-%COMP%]{position:relative;height:auto}.bounding-box-overlay[_ngcontent-%COMP%]{position:absolute;border:3px solid rgba(255,0,0,.8);background-color:#ff00001a;box-sizing:border-box;pointer-events:none;z-index:5;transition:border-width .2s ease,background-color .2s ease}.bounding-box-overlay.clickable[_ngcontent-%COMP%]{pointer-events:auto;cursor:pointer}.bounding-box-overlay.clickable[_ngcontent-%COMP%]:hover{border-width:3px;background-color:#ff000040}.bbox-label[_ngcontent-%COMP%]{position:absolute;top:-12px;left:-28px;transform-origin:bottom left;pointer-events:none;z-index:6;--cue-card-padding-x: 8px;--cue-card-padding-y: 4px}cue-image-toolbar[_ngcontent-%COMP%]{position:absolute;left:0;right:0;bottom:0;z-index:10;display:flex;justify-content:center}.draw-overlay[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%;cursor:crosshair;z-index:6}.edit-overlay[_ngcontent-%COMP%]{cursor:move;z-index:8}.resize-handle[_ngcontent-%COMP%]{position:absolute;width:8px;height:8px;background:#fff;border:2px solid rgba(0,120,215,.9);border-radius:2px;z-index:9;pointer-events:auto}.resize-handle.nw[_ngcontent-%COMP%]{cursor:nw-resize}.resize-handle.ne[_ngcontent-%COMP%]{cursor:ne-resize}.resize-handle.sw[_ngcontent-%COMP%]{cursor:sw-resize}.resize-handle.se[_ngcontent-%COMP%]{cursor:se-resize}.resize-handle.n[_ngcontent-%COMP%]{cursor:n-resize}.resize-handle.s[_ngcontent-%COMP%]{cursor:s-resize}.resize-handle.e[_ngcontent-%COMP%]{cursor:e-resize}.resize-handle.w[_ngcontent-%COMP%]{cursor:w-resize}.resize-handle.radius[_ngcontent-%COMP%]{cursor:ew-resize;border-radius:50%}.resize-handle.radius-v[_ngcontent-%COMP%]{cursor:ns-resize;border-radius:50%}.draw-preview[_ngcontent-%COMP%]{border-style:dashed!important;pointer-events:none;z-index:7}.bounding-box-overlay.removable[_ngcontent-%COMP%]{pointer-events:auto}.polygon-vertex[_ngcontent-%COMP%]{position:absolute;width:8px;height:8px;border-radius:50%;border:2px solid white;pointer-events:none;z-index:7}.polygon-vertex.cursor-preview[_ngcontent-%COMP%]{opacity:.6}.snap-guide[_ngcontent-%COMP%]{position:absolute;pointer-events:none;z-index:6}.snap-guide.vertical[_ngcontent-%COMP%]{top:0;bottom:0;width:0;border-left:1px dashed rgba(0,200,255,.7)}.snap-guide.horizontal[_ngcontent-%COMP%]{left:0;right:0;height:0;border-top:1px dashed rgba(0,200,255,.7)}"],changeDetection:0})}return s})()}}]);
|
|
1
|
+
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[8560],{5600(W,F,_){_.d(F,{F:()=>G,g:()=>S});var r=_(7705),g=_(2271),T=_(7089),X=_(5381),A=_(5187),L=_(5971),t=_(3319),h=_(5547),D=_(5802);function Z(C,R){if(1&C){const f=h.RV6();h.j41(0,"cue-flexcontainer",3)(1,"cue-button",6),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.activeTool.set("pan"))}),h.nrm(2,"cue-button-icon",7),h.k0s(),h.j41(3,"cue-button",8),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.activeTool.set("select"))}),h.nrm(4,"cue-button-icon",9),h.k0s()()}if(2&C){const f=h.XpG();h.R7$(),h.Y8G("variant","pan"===f.activeTool()?"secondary":"tertiary"),h.R7$(2),h.Y8G("variant","select"===f.activeTool()?"secondary":"tertiary")}}function k(C,R){if(1&C){const f=h.RV6();h.j41(0,"cue-flexcontainer",3)(1,"cue-button",10),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.handleZoomOut())}),h.nrm(2,"cue-button-icon",11),h.k0s(),h.j41(3,"cue-button",12),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.handleZoomIn())}),h.nrm(4,"cue-button-icon",13),h.k0s(),h.j41(5,"cue-button",14),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.handleZoomFit())}),h.nrm(6,"cue-button-icon",15),h.k0s()()}if(2&C){const f=h.XpG();h.AVh("border-left",f.options().displayPanSelectTools),h.R7$(),h.Y8G("disabled",f.zoom()<=f.minZoom())("cueTooltip",f.zoom()<=f.minZoom()?"Minimum zoom reached":"Zoom out")}}function B(C,R){if(1&C){const f=h.RV6();h.j41(0,"cue-button",16),h.bIt("click",function(){D.eBV(f);const b=h.XpG();return D.Njj(b.rotate.emit())}),h.nrm(1,"cue-button-icon",17),h.k0s()}if(2&C){const f=h.XpG();h.AVh("border-left",f.options().displayZoom&&f.options().displayRotate)}}class S{hidden=!1;position="bottom";margin="20px";displayZoom=!0;displayRotate=!0;displayPanSelectTools=!1}let G=(()=>{class C{options=(0,r.hFB)(new S);activeTool=(0,r.geq)("pan");panMode=(0,r.geq)(!1);zoom=(0,r.geq)(1);pan=(0,r.geq)({x:0,y:0});minZoom=(0,r.hFB)(1);maxZoom=(0,r.hFB)(10);rotate=(0,r.CGW)();zoomIn=(0,r.CGW)();zoomOut=(0,r.CGW)();zoomFit=(0,r.CGW)();selectMenuPositions=(0,g.EW)(()=>"top"===this.options().position?"bottomleft":"topleft");handleZoomIn(){this.zoomIn.emit()}handleZoomOut(){this.zoomOut.emit()}handleZoomFit(){this.zoomFit.emit()}static \u0275fac=function(z){return new(z||C)};static \u0275cmp=h.VBU({type:C,selectors:[["cue-image-toolbar"]],inputs:{options:[1,"options"],activeTool:[1,"activeTool"],panMode:[1,"panMode"],zoom:[1,"zoom"],pan:[1,"pan"],minZoom:[1,"minZoom"],maxZoom:[1,"maxZoom"]},outputs:{activeTool:"activeToolChange",panMode:"panModeChange",zoom:"zoomChange",pan:"panChange",rotate:"rotate",zoomIn:"zoomIn",zoomOut:"zoomOut",zoomFit:"zoomFit"},decls:6,vars:4,consts:[["justify","center",1,"container"],[1,"toolbar",3,"padded"],["align","center"],["align","center","gap","s"],["align","center","gap","s",3,"border-left"],["cueTooltip","Rotate","size","xs","variant","tertiary",3,"border-left"],["size","xs","cueTooltip","Pan mode \u2014 drag to move the view",3,"click","variant"],["icon","move-grab"],["size","xs","cueTooltip","Select mode \u2014 drag to draw a selection window",3,"click","variant"],["icon","move-click"],["size","xs","variant","tertiary",3,"click","disabled","cueTooltip"],["icon","zoom-out"],["cueTooltip","Zoom in","size","xs","variant","tertiary",3,"click"],["icon","zoom-in"],["cueTooltip","Zoom fit","size","xs","variant","tertiary",3,"click"],["icon","zoom-fit"],["cueTooltip","Rotate","size","xs","variant","tertiary",3,"click"],["icon","rotate-2d"]],template:function(z,b){1&z&&(h.j41(0,"cue-flexcontainer",0)(1,"cue-card",1)(2,"cue-flexcontainer",2),h.nVh(3,Z,5,2,"cue-flexcontainer",3),h.nVh(4,k,7,4,"cue-flexcontainer",4),h.nVh(5,B,2,2,"cue-button",5),h.k0s()()()),2&z&&(h.R7$(),h.Y8G("padded",!1),h.R7$(2),h.vxM(b.options().displayPanSelectTools?3:-1),h.R7$(),h.vxM(b.options().displayZoom?4:-1),h.R7$(),h.vxM(b.options().displayRotate?5:-1))},dependencies:[X.FlexContainer,A.Card,L.Button,t.ButtonIcon,T.d],styles:["[_nghost-%COMP%]{pointer-events:none}.container[_ngcontent-%COMP%]{width:100%;pointer-events:none}.toolbar[_ngcontent-%COMP%]{pointer-events:all;padding:5px 10px}.border-left[_ngcontent-%COMP%]{border-left:1px solid;padding-left:12px}"],changeDetection:0})}return C})()},8560(W,F,_){_.d(F,{ImageViewer:()=>Ue});var r=_(5802),g=_(7705),T=_(2271),X=_(345),A=_(5600),L=_(9769),t=_(5547);let h=(()=>{class s{elementRef=(0,r.WQX)(t.aKT);cdr=(0,r.WQX)(g.gRc);zoom=(0,g.geq)(1);pan=(0,g.geq)({x:0,y:0});minZoom=(0,g.hFB)(1);maxZoom=(0,g.hFB)(10);zoomStep=(0,g.hFB)(.1);panMode=(0,g.hFB)(!0,{transform:e=>{const n=""===e||"false"!==e&&!!e;return!n&&(this.isPanning||this.isWaitingForPan)&&this.onMouseUp(),n}});longPressThreshold=(0,g.hFB)(150);dragThreshold=(0,g.hFB)(3);zoomChange=(0,g.CGW)();panChange=(0,g.CGW)();stateChange=(0,g.CGW)();isPanning=!1;lastPoint={x:0,y:0};isWaitingForPan=!1;downPoint={x:0,y:0};longPressTimer=null;moveListener;upListener;leaveListener;blurListener;visibilityListener;keyListener;contextMenuListener;pointerCancelListener;listenersAttached=!1;isMiddlePanning=!1;_midLastPoint={x:0,y:0};_midMoveListener;_midUpListener;_pinchStartDist=0;_pinchStartZoom=1;_touchStartListener;_touchMoveListener;_touchEndListener;constructor(){this.moveListener=this.onMouseMove.bind(this),this.upListener=this.onMouseUp.bind(this),this.leaveListener=this.onMouseUp.bind(this),this.blurListener=this.onMouseUp.bind(this),this.visibilityListener=()=>{document.hidden&&this.onMouseUp()},this.keyListener=e=>{"Escape"===e.key&&this.onMouseUp()},this.contextMenuListener=this.onMouseUp.bind(this),this.pointerCancelListener=this.onMouseUp.bind(this),this._midMoveListener=this._onMiddlePanMove.bind(this),this._midUpListener=this._onMiddlePanUp.bind(this)}ngOnInit(){this._attachTouchListeners()}ngOnDestroy(){this.removeListeners(),this.clearLongPressTimer(),this._detachTouchListeners(),this._stopMiddlePan()}addListeners(){this.listenersAttached||(this.listenersAttached=!0,window.addEventListener("mousemove",this.moveListener),window.addEventListener("mouseup",this.upListener,!0),window.addEventListener("blur",this.blurListener),document.addEventListener("visibilitychange",this.visibilityListener),document.addEventListener("keydown",this.keyListener),document.addEventListener("contextmenu",this.contextMenuListener),document.addEventListener("pointercancel",this.pointerCancelListener))}removeListeners(){this.listenersAttached=!1,window.removeEventListener("mousemove",this.moveListener),window.removeEventListener("mouseup",this.upListener,!0),window.removeEventListener("blur",this.blurListener),document.removeEventListener("visibilitychange",this.visibilityListener),document.removeEventListener("keydown",this.keyListener),document.removeEventListener("contextmenu",this.contextMenuListener),document.removeEventListener("pointercancel",this.pointerCancelListener)}clearLongPressTimer(){null!==this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}cursorStyle(){return this.isMiddlePanning?"grabbing":this.panMode()?this.isPanning?"grabbing":"grab":null}onMouseDown(e){if(1===e.button)return e.preventDefault(),this.isMiddlePanning=!0,this._midLastPoint={x:e.clientX,y:e.clientY},this.cdr.markForCheck(),window.addEventListener("mousemove",this._midMoveListener),void window.addEventListener("mouseup",this._midUpListener);!this.panMode()||0!==e.button||(e.composedPath?e.composedPath():[]).some(i=>i.hasAttribute&&i.hasAttribute("data-no-pan"))||((this.isPanning||this.isWaitingForPan)&&(this.clearLongPressTimer(),this.isWaitingForPan=!1,this.isPanning=!1,this.removeListeners()),this.isWaitingForPan=!0,this.downPoint={x:e.clientX,y:e.clientY},this.lastPoint={x:e.clientX,y:e.clientY},this.addListeners())}startPanning(){this.clearLongPressTimer(),this.isWaitingForPan=!1,this.isPanning=!0,this.cdr.markForCheck()}onMouseMove(e){if(!this.isWaitingForPan&&!this.isPanning)return;if(this.isWaitingForPan&&!this.isPanning){const l=e.clientX-this.downPoint.x,d=e.clientY-this.downPoint.y;if(Math.sqrt(l*l+d*d)>=this.dragThreshold()){e.preventDefault(),this.startPanning();const u=this.pan(),p={x:u.x+l,y:u.y+d};this.lastPoint={x:e.clientX,y:e.clientY},this.pan.set(p),this.panChange.emit(p),this.emitStateChange()}return}e.preventDefault();const n=e.clientX-this.lastPoint.x,o=e.clientY-this.lastPoint.y;this.lastPoint={x:e.clientX,y:e.clientY};const i=this.pan(),a={x:i.x+n,y:i.y+o};this.pan.set(a),this.panChange.emit(a),this.emitStateChange()}onMouseUp(e){this.clearLongPressTimer();const n=this.isPanning;if(this.isWaitingForPan=!1,this.isPanning=!1,this.removeListeners(),n){this.cdr.markForCheck();const o=i=>{i.stopImmediatePropagation(),i.preventDefault(),window.removeEventListener("click",o,!0)};window.addEventListener("click",o,!0),setTimeout(()=>window.removeEventListener("click",o,!0),50)}}_onMiddlePanMove(e){if(!this.isMiddlePanning)return;const n=e.clientX-this._midLastPoint.x,o=e.clientY-this._midLastPoint.y;this._midLastPoint={x:e.clientX,y:e.clientY};const i=this.pan(),a={x:i.x+n,y:i.y+o};this.pan.set(a),this.panChange.emit(a),this.emitStateChange()}_onMiddlePanUp(e){1===e.button&&this._stopMiddlePan()}_stopMiddlePan(){window.removeEventListener("mousemove",this._midMoveListener),window.removeEventListener("mouseup",this._midUpListener),this.isMiddlePanning&&(this.isMiddlePanning=!1,this.cdr.markForCheck())}onWheel(e){e.preventDefault();const n=this.zoomStep(),o=e.deltaY<0?1+n:1-n,a=this.elementRef.nativeElement.getBoundingClientRect(),l={x:e.clientX-a.left,y:e.clientY-a.top};this.zoomTo(this.zoom()*o,l)}zoomTo(e,n){const o=this.zoom(),i=this.pan(),a=Math.max(this.minZoom(),Math.min(this.maxZoom(),e));if(a===o)return;const l=a/o,d={x:n.x-(n.x-i.x)*l,y:n.y-(n.y-i.y)*l};this.zoom.set(a),this.pan.set(d),this.zoomChange.emit(a),this.panChange.emit(d),this.emitStateChange()}zoomIn(){this.zoomToCenter(this.zoom()+this.zoomStep())}zoomOut(){this.zoomToCenter(this.zoom()-this.zoomStep())}zoomToCenter(e){const n=this.elementRef.nativeElement;this.zoomTo(e,{x:n.clientWidth/2,y:n.clientHeight/2})}emitStateChange(){this.stateChange.emit({zoom:this.zoom(),pan:this.pan()})}static _touchDist(e,n){const o=n.clientX-e.clientX,i=n.clientY-e.clientY;return Math.sqrt(o*o+i*i)}_attachTouchListeners(){const e=this.elementRef.nativeElement;this._touchStartListener=n=>{2===n.touches.length&&(n.preventDefault(),this._pinchStartDist=s._touchDist(n.touches[0],n.touches[1]),this._pinchStartZoom=this.zoom())},this._touchMoveListener=n=>{if(2!==n.touches.length||(n.preventDefault(),0===this._pinchStartDist))return;const o=s._touchDist(n.touches[0],n.touches[1]),i=this._pinchStartZoom*(o/this._pinchStartDist),a=e.getBoundingClientRect();this.zoomTo(i,{x:(n.touches[0].clientX+n.touches[1].clientX)/2-a.left,y:(n.touches[0].clientY+n.touches[1].clientY)/2-a.top})},this._touchEndListener=n=>{n.touches.length<2&&(this._pinchStartDist=0)},e.addEventListener("touchstart",this._touchStartListener,{passive:!1}),e.addEventListener("touchmove",this._touchMoveListener,{passive:!1}),e.addEventListener("touchend",this._touchEndListener,{passive:!1})}_detachTouchListeners(){const e=this.elementRef.nativeElement;this._touchStartListener&&e.removeEventListener("touchstart",this._touchStartListener),this._touchMoveListener&&e.removeEventListener("touchmove",this._touchMoveListener),this._touchEndListener&&e.removeEventListener("touchend",this._touchEndListener)}static \u0275fac=function(n){return new(n||s)};static \u0275dir=t.FsC({type:s,selectors:[["","cuePanZoom",""]],hostVars:2,hostBindings:function(n,o){1&n&&t.bIt("mousedown",function(a){return o.onMouseDown(a)})("wheel",function(a){return o.onWheel(a)}),2&n&&t.xc7("cursor",o.cursorStyle())},inputs:{zoom:[1,"zoom"],pan:[1,"pan"],minZoom:[1,"minZoom"],maxZoom:[1,"maxZoom"],zoomStep:[1,"zoomStep"],panMode:[1,"panMode"],longPressThreshold:[1,"longPressThreshold"],dragThreshold:[1,"dragThreshold"]},outputs:{zoom:"zoomChange",pan:"panChange",zoomChange:"zoomChange",panChange:"panChange",stateChange:"stateChange"}})}return s})();const D=["container"],Z=["*"];let k=(()=>{class s{panZoomDirective=(0,g.ebz)(h);containerRef=(0,g.ebz)("container");zoom=(0,g.geq)(1);pan=(0,g.geq)({x:0,y:0});minZoom=(0,g.hFB)(.1);maxZoom=(0,g.hFB)(10);zoomStep=(0,g.hFB)(.1);panMode=(0,g.hFB)(!0);modelChange=(0,g.CGW)();get transform(){const{x:e,y:n}=this.pan();return`translate(${e}px, ${n}px) scale(${this.zoom()})`}onZoomChange(e){this.zoom.set(e),this.emitModelChange()}onPanChange(e){this.pan.set(e),this.emitModelChange()}emitModelChange(){this.modelChange.emit({pan:{...this.pan()},zoom:this.zoom()})}zoomFit(){this.zoom.set(this.minZoom()),this.pan.set({x:0,y:0}),this.emitModelChange()}zoomIn(){this.panZoomDirective()?.zoomIn()}zoomOut(){this.panZoomDirective()?.zoomOut()}zoomTo(e,n){this.panZoomDirective()?.zoomTo(e,n)}static \u0275fac=function(n){return new(n||s)};static \u0275cmp=t.VBU({type:s,selectors:[["cue-pan-zoom"]],viewQuery:function(n,o){1&n&&t.wEZ(o.panZoomDirective,h,5)(o.containerRef,D,5),2&n&&t.NyB(2)},hostAttrs:[2,"display","block","width","100%","height","100%"],inputs:{zoom:[1,"zoom"],pan:[1,"pan"],minZoom:[1,"minZoom"],maxZoom:[1,"maxZoom"],zoomStep:[1,"zoomStep"],panMode:[1,"panMode"]},outputs:{zoom:"zoomChange",pan:"panChange",modelChange:"modelChange"},ngContentSelectors:Z,decls:5,vars:8,consts:[["container",""],["content",""],["cuePanZoom","",1,"pan-zoom-container",2,"width","100%","height","100%","overflow","hidden","position","relative","touch-action","none",3,"zoomChange","panChange","zoom","pan","minZoom","maxZoom","zoomStep","panMode"],[2,"position","absolute","left","0","top","0","transform-origin","0 0","backface-visibility","hidden"]],template:function(n,o){1&n&&(t.NAR(),t.j41(0,"div",2,0),t.bIt("zoomChange",function(a){return o.onZoomChange(a)})("panChange",function(a){return o.onPanChange(a)}),t.j41(2,"div",3,1),t.SdG(4),t.k0s()()),2&n&&(t.Y8G("zoom",o.zoom())("pan",o.pan())("minZoom",o.minZoom())("maxZoom",o.maxZoom())("zoomStep",o.zoomStep())("panMode",o.panMode()),t.R7$(2),t.xc7("transform",o.transform))},dependencies:[L.MD,h],encapsulation:2,changeDetection:0})}return s})();var B=_(2036),S=_(7023),G=_(9352),C=_(356),R=_(6279),f=_(5187),z=_(2245);class b{constructor(c=[],e=(n,o)=>n<o?-1:n>o?1:0){if(this.data=c,this.length=this.data.length,this.compare=e,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(c){this.data.push(c),this._up(this.length++)}pop(){if(0===this.length)return;const c=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:e,compare:n}=this,o=e[c];for(;c>0;){const i=c-1>>1,a=e[i];if(n(o,a)>=0)break;e[c]=a,c=i}e[c]=o}_down(c){const{data:e,compare:n}=this,o=this.length>>1,i=e[c];for(;c<o;){let a=1+(c<<1);const l=a+1;if(l<this.length&&n(e[l],e[a])<0&&(a=l),n(e[a],i)>=0)break;e[c]=e[a],c=a}e[c]=i}}function j(s,c,e,n){this.x=s,this.y=c,this.h=e,this.d=function H(s,c,e){let n=!1,o=1/0;for(const i of e)for(let a=0,l=i.length,d=l-1;a<l;d=a++){const m=i[a],u=i[d];m[1]>c!=u[1]>c&&s<(u[0]-m[0])*(c-m[1])/(u[1]-m[1])+m[0]&&(n=!n),o=Math.min(o,Q(s,c,m,u))}return 0===o?0:(n?1:-1)*Math.sqrt(o)}(s,c,n),this.max=this.d+this.h*Math.SQRT2}function Q(s,c,e,n){let o=e[0],i=e[1],a=n[0]-o,l=n[1]-i;if(0!==a||0!==l){const d=((s-o)*a+(c-i)*l)/(a*a+l*l);d>1?(o=n[0],i=n[1]):d>0&&(o+=a*d,i+=l*d)}return a=s-o,l=c-i,a*a+l*l}let K=(()=>{class s{extractPathD(e){const n=e.match(/d="([^"]*)"/);return n?n[1]:null}parsePathToPolygon(e){const n=[],o=e.trim().split(/\s+/);let i=0;for(;i<o.length;){const a=o[i];if("M"===a||"L"===a)i++,i+1<o.length&&(n.push([parseFloat(o[i]),parseFloat(o[i+1])]),i+=2);else{const l=parseFloat(a);!isNaN(l)&&i+1<o.length?(n.push([l,parseFloat(o[i+1])]),i+=2):i++}}return n}getLabelPosition(e){const n=this.extractPathD(e);if(!n)return null;const o=this.parsePathToPolygon(n);if(o.length<3)return null;try{const i=function Y(s,c=1,e=!1){let n=1/0,o=1/0,i=-1/0,a=-1/0;for(const[y,x]of s[0])y<n&&(n=y),x<o&&(o=x),y>i&&(i=y),x>a&&(a=x);const l=i-n,d=a-o,m=Math.max(c,Math.min(l,d));if(m===c){const y=[n,o];return y.distance=0,y}const u=new b([],(y,x)=>x.max-y.max);let p=function U(s){let c=0,e=0,n=0;const o=s[0];for(let a=0,l=o.length,d=l-1;a<l;d=a++){const m=o[a],u=o[d],p=m[0]*u[1]-u[0]*m[1];e+=(m[0]+u[0])*p,n+=(m[1]+u[1])*p,c+=3*p}const i=new j(e/c,n/c,0,s);return 0===c||i.d<0?new j(o[0][0],o[0][1],0,s):i}(s);const v=new j(n+l/2,o+d/2,0,s);v.d>p.d&&(p=v);let M=2;function P(y,x,V){const I=new j(y,x,V,s);M++,I.max>p.d+c&&u.push(I),I.d>p.d&&(p=I,e&&console.log(`found best ${Math.round(1e4*I.d)/1e4} after ${M} probes`))}let w=m/2;for(let y=n;y<i;y+=m)for(let x=o;x<a;x+=m)P(y+w,x+w,w);for(;u.length;){const{max:y,x,y:V,h:I}=u.pop();if(y-p.d<=c)break;w=I/2,P(x-w,V-w,w),P(x+w,V-w,w),P(x-w,V+w,w),P(x+w,V+w,w)}e&&console.log(`num probes: ${M}\nbest distance: ${p.d}`);const E=[p.x,p.y];return E.distance=p.d,E}([o],.01);return{x:i[0],y:i[1]}}catch{return null}}getLabelFontSize(e){const n=this.extractPathD(e);if(!n)return.3;const o=this.parsePathToPolygon(n);if(o.length<3)return.3;const i=o.map(u=>u[0]),a=o.map(u=>u[1]),l=Math.max(...i)-Math.min(...i),d=Math.max(...a)-Math.min(...a),m=Math.min(l,d);return Math.max(m/5,.05)}static \u0275fac=function(n){return new(n||s)};static \u0275prov=r.jDH({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})(),N=(()=>{class s{editingArtefact=(0,r.vPA)(null);isEditing=(0,r.vPA)(!1);editStart=(0,r.vPA)(null);editHandle=(0,r.vPA)("body");hasDragged=!1;hasEdited=!1;originalArtefact=null;drawingArtefacts;mouseToImagePercent;parseXYWH;polygonService;artefactEdited;editMoveListener=this.onEditMouseMove.bind(this);editUpListener=this.onEditMouseUp.bind(this);init(e){this.drawingArtefacts=e.drawingArtefacts,this.mouseToImagePercent=e.mouseToImagePercent,this.parseXYWH=e.parseXYWH,this.polygonService=e.polygonService,this.artefactEdited=e.artefactEdited}startEditArtefact(e,n){this.editingArtefact.set({type:e,index:n});const o=this.drawingArtefacts();let i;"bbox"===e?i=o.xywhs[n]:"circle"===e?i=o.circles[n]:"polygon"===e&&(i=o.polygons[n]),this.originalArtefact=i?{...i}:null}cancelEdit(){const e=this.editingArtefact();if(e&&this.hasEdited&&this.originalArtefact){const n=this.drawingArtefacts();let o;"bbox"===e.type?o=n.xywhs[e.index]:"circle"===e.type?o=n.circles[e.index]:"polygon"===e.type&&(o=n.polygons[e.index]),o&&this.artefactEdited.emit({type:e.type,index:e.index,before:this.originalArtefact,after:o})}this.editingArtefact.set(null),this.isEditing.set(!1),this.editStart.set(null),this.editHandle.set("body"),this.hasEdited=!1,this.originalArtefact=null,window.removeEventListener("mousemove",this.editMoveListener),window.removeEventListener("mouseup",this.editUpListener)}onEditMouseDown(e,n="body"){if(!this.editingArtefact()||0!==e.button)return;e.preventDefault(),e.stopPropagation();const o=this.mouseToImagePercent(e);o&&(this.isEditing.set(!0),this.editStart.set(o),this.editHandle.set(n),this.hasDragged=!1,window.addEventListener("mousemove",this.editMoveListener),window.addEventListener("mouseup",this.editUpListener))}onEditMouseMove(e){if(!this.isEditing())return;e.preventDefault();const n=this.mouseToImagePercent(e),o=this.editStart(),i=this.editingArtefact();if(!n||!o||!i)return;const a=this.editHandle();if("string"==typeof a&&a.startsWith("vertex:")){const m=parseInt(a.split(":")[1],10);return this.polygonService.applyVertexDrag(i.index,m,n,e.shiftKey),this.editStart.set(n),this.hasDragged=!0,void(this.hasEdited=!0)}const l=n.x-o.x,d=n.y-o.y;this.editStart.set(n),this.hasDragged=!0,this.hasEdited=!0,this.applyEditDelta(i,l,d)}onEditMouseUp(e){if(this.isEditing()){if(window.removeEventListener("mousemove",this.editMoveListener),window.removeEventListener("mouseup",this.editUpListener),"body"===this.editHandle()&&!this.hasDragged)return void this.cancelEdit();if(this.isEditing.set(!1),this.editStart.set(null),this.hasEdited){const n=this.editingArtefact();if(n&&this.originalArtefact){const o=this.drawingArtefacts();let i;"bbox"===n.type?i=o.xywhs[n.index]:"circle"===n.type?i=o.circles[n.index]:"polygon"===n.type&&(i=o.polygons[n.index]),i&&(this.artefactEdited.emit({type:n.type,index:n.index,before:this.originalArtefact,after:i}),this.originalArtefact={...i},this.hasEdited=!1)}}}}applyEditDelta(e,n,o){const i=this.editHandle();"body"===i?this.applyMoveDelta(e,n,o):"radius"===i?this.applyCircleRadiusDelta(e.index,n,o):this.applyResizeDelta(e,i,n,o)}applyMoveDelta(e,n,o){this.drawingArtefacts.update(i=>{if("bbox"===e.type){const a=[...i.xywhs],l=a[e.index];if(!l)return i;const d=this.parseXYWH(l.xywhStr);if(!d)return i;const m=Math.max(0,d.x+n),u=Math.max(0,d.y+o);return a[e.index]={...l,xywhStr:`percent:${m.toFixed(2)},${u.toFixed(2)},${d.width.toFixed(2)},${d.height.toFixed(2)}`},{...i,xywhs:a}}if("circle"===e.type){const a=[...i.circles],l=a[e.index];return l?(a[e.index]={...l,cx:l.cx+n,cy:l.cy+o},{...i,circles:a}):i}if("polygon"===e.type){const a=[...i.polygons],l=a[e.index];return l?(a[e.index]={...l,points:l.points.map(([d,m])=>[d+n,m+o])},{...i,polygons:a}):i}return i})}applyResizeDelta(e,n,o,i){"bbox"===e.type&&this.drawingArtefacts.update(a=>{const l=[...a.xywhs],d=l[e.index];if(!d)return a;const m=this.parseXYWH(d.xywhStr);if(!m)return a;let{x:u,y:p,width:v,height:M}=m;return n.includes("w")&&(u+=o,v-=o),n.includes("e")&&(v+=o),n.includes("n")&&(p+=i,M-=i),n.includes("s")&&(M+=i),v<.5&&(v=.5),M<.5&&(M=.5),l[e.index]={...d,xywhStr:`percent:${u.toFixed(2)},${p.toFixed(2)},${v.toFixed(2)},${M.toFixed(2)}`},{...a,xywhs:l}})}applyCircleRadiusDelta(e,n,o){this.drawingArtefacts.update(i=>{const a=[...i.circles],l=a[e];if(!l)return i;const d=Math.sqrt(n*n+o*o)*Math.sign(n||o);return a[e]={...l,r:Math.max(.5,l.r+d)},{...i,circles:a}})}static \u0275fac=function(n){return new(n||s)};static \u0275prov=r.jDH({token:s,factory:s.\u0275fac})}return s})(),$=(()=>{class s{isDrawing=(0,r.vPA)(!1);drawStart=(0,r.vPA)(null);drawCurrent=(0,r.vPA)(null);drawMode;drawColor;drawnArtefactDef;artefactDrawn;mouseToImagePercent;imageDimensions;drawingArtefacts;drawMoveListener=this.onDrawMouseMove.bind(this);drawUpListener=this.onDrawMouseUp.bind(this);initialized=(0,r.vPA)(!1);drawPreview=(0,T.EW)(()=>{if(!this.initialized()||"xywh"!==this.drawMode())return null;const e=this.drawStart(),n=this.drawCurrent();if(!e||!n)return null;const o=Math.min(e.x,n.x),i=Math.min(e.y,n.y),a=Math.abs(n.x-e.x),l=Math.abs(n.y-e.y);return a<.1&&l<.1?null:{x:o,y:i,width:a,height:l,color:this.drawColor()}});circleDrawPreview=(0,T.EW)(()=>{if(!this.initialized()||"circle"!==this.drawMode())return null;const e=this.drawStart(),n=this.drawCurrent();if(!e||!n)return null;const o=Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));return o<.1?null:{cx:e.x,cy:e.y,r:o,color:this.drawColor()}});init(e){this.drawMode=e.drawMode,this.drawColor=e.drawColor,this.drawnArtefactDef=e.drawnArtefactDef,this.artefactDrawn=e.artefactDrawn,this.mouseToImagePercent=e.mouseToImagePercent,this.imageDimensions=e.imageDimensions,this.drawingArtefacts=e.drawingArtefacts,this.initialized.set(!0)}onDrawMouseDown(e){const n=this.drawMode();if("xywh"!==n&&"circle"!==n||0!==e.button)return;e.preventDefault(),e.stopPropagation();const o=this.mouseToImagePercent(e);o&&(this.isDrawing.set(!0),this.drawStart.set(o),this.drawCurrent.set(o),window.addEventListener("mousemove",this.drawMoveListener),window.addEventListener("mouseup",this.drawUpListener))}onDrawMouseMove(e){if(!this.isDrawing())return;e.preventDefault();const n=this.mouseToImagePercent(e);n&&this.drawCurrent.set(n)}onDrawMouseUp(e){if(!this.isDrawing())return;e?.preventDefault(),window.removeEventListener("mousemove",this.drawMoveListener),window.removeEventListener("mouseup",this.drawUpListener);const n=this.drawStart(),o=this.drawCurrent(),i=this.drawMode();if(n&&o)if("xywh"===i){const a=Math.min(n.x,o.x),l=Math.min(n.y,o.y),d=Math.abs(o.x-n.x),m=Math.abs(o.y-n.y);if(d>.5&&m>.5){const p={...this.drawnArtefactDef(),xywhStr:`percent:${a.toFixed(2)},${l.toFixed(2)},${d.toFixed(2)},${m.toFixed(2)}`,color:this.drawColor()},v={x:a,y:l,width:d,height:m};this.artefactDrawn.emit({type:"xywh",def:p,pct:v,abs:this.pctRectToAbs(v)}),this.drawingArtefacts.update(M=>({...M,xywhs:[...M.xywhs,p]}))}}else if("circle"===i){const a=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2));if(a>.5){const d={...this.drawnArtefactDef(),cx:n.x,cy:n.y,r:a,color:this.drawColor()},m=this.imageDimensions();this.artefactDrawn.emit({type:"circle",def:d,pct:{cx:n.x,cy:n.y,r:a},abs:{cx:m?n.x/100*m.width:n.x,cy:m?n.y/100*m.height:n.y,r:m?a/100*m.width:a}}),this.drawingArtefacts.update(u=>({...u,circles:[...u.circles,d]}))}}this.isDrawing.set(!1),this.drawStart.set(null),this.drawCurrent.set(null)}pctRectToAbs(e){const n=this.imageDimensions();return n?{x:e.x/100*n.width,y:e.y/100*n.height,width:e.width/100*n.width,height:e.height/100*n.height}:e}static \u0275fac=function(n){return new(n||s)};static \u0275prov=r.jDH({token:s,factory:s.\u0275fac})}return s})(),O=(()=>{class s{polygonPoints=(0,r.vPA)([]);polygonCursor=(0,r.vPA)(null);lastPolygonClickTime=0;axisSnapLines=(0,r.vPA)({});drawColor;drawnArtefactDef;artefactDrawn;mouseToImagePercent;imageAspectRatio;zoom;imageDimensions;drawingArtefacts;polygonMoveListener=this.onPolygonMouseMove.bind(this);polygonEscListener=this.onPolygonEsc.bind(this);initialized=(0,r.vPA)(!1);polygonDrawPreview=(0,T.EW)(()=>{if(!this.initialized())return null;const e=this.polygonPoints();if(0===e.length)return null;const n=this.polygonCursor();return{points:e,cursorPoint:n?[n.x,n.y]:null,color:this.drawColor()}});init(e){this.drawColor=e.drawColor,this.drawnArtefactDef=e.drawnArtefactDef,this.artefactDrawn=e.artefactDrawn,this.mouseToImagePercent=e.mouseToImagePercent,this.imageAspectRatio=e.imageAspectRatio,this.zoom=e.zoom,this.imageDimensions=e.imageDimensions,this.drawingArtefacts=e.drawingArtefacts,this.initialized.set(!0)}onPolygonClick(e){if(0!==e.button)return;const n=Date.now();if(n-this.lastPolygonClickTime<300)return;this.lastPolygonClickTime=n,e.preventDefault(),e.stopPropagation();const o=this.mouseToImagePercent(e);if(!o)return;const i=this.polygonPoints(),a=this.applySnapping(o,i,e.shiftKey);if(i.length>=3){const l=i[0],d=a.x-l[0],m=a.y-l[1];if(Math.sqrt(d*d+m*m)<this.closeThreshold)return void this.finishPolygon()}this.polygonPoints.update(l=>[...l,[a.x,a.y]]),this.polygonCursor.set(null),0===i.length&&(window.addEventListener("mousemove",this.polygonMoveListener),window.addEventListener("keydown",this.polygonEscListener))}cancelPolygon(){window.removeEventListener("mousemove",this.polygonMoveListener),window.removeEventListener("keydown",this.polygonEscListener),this.polygonPoints.set([]),this.polygonCursor.set(null),this.axisSnapLines.set({})}applyVertexDrag(e,n,o,i){this.drawingArtefacts.update(a=>{const l=[...a.polygons],d=l[e];if(!d)return a;const m=[...d.points.map(M=>[...M])];if(n<0||n>=m.length)return a;const u=m.filter((M,P)=>P!==n);let p=null;m.length>1&&(p=n>0?m[n-1]:m[n+1]);let v=o;return i&&p&&(v=this.snapTo45({x:p[0],y:p[1]},o)),v=this.snapToAxis(v,u,null,i?"none":"both"),m[n]=[v.x,v.y],l[e]={...d,points:m},{...a,polygons:l}})}snapTo45(e,n){const o=this.imageAspectRatio(),i=n.x-e.x,a=(n.y-e.y)/o,l=Math.atan2(a,i),d=Math.round(l/(Math.PI/4))*(Math.PI/4),m=Math.sqrt(i*i+a*a);return{x:e.x+m*Math.cos(d),y:e.y+m*Math.sin(d)*o}}get closeThreshold(){return 1.5/this.zoom()}get axisSnapThresholdX(){const e=this.imageDimensions?.();return e&&0!==e.width?24/(e.width*this.zoom()/100):1.5}get axisSnapThresholdY(){const e=this.imageDimensions?.();return e&&0!==e.height?24/(e.height*this.zoom()/100):1.5}applySnapping(e,n,o){const i=n.length>0?n[n.length-1]:null,a=n.length>1?n.slice(0,-1):[];if(!o||!i)return this.snapToAxis(e,a,i,"both");const l=this.snapTo45({x:i[0],y:i[1]},e),d=Math.abs(l.x-i[0]),m=Math.abs(l.y-i[1]),u=d+m+.001;let p;return p=d/u<.01?"y":m/u<.01?"x":"none",this.snapToAxis(l,a,i,p)}snapToAxis(e,n,o,i){if("none"===i||0===n.length)return this.axisSnapLines.set({}),e;let u,p,{x:a,y:l}=e,d=this.axisSnapThresholdX,m=this.axisSnapThresholdY;const v="x"===i||"both"===i,M="y"===i||"both"===i;for(const[P,w]of n){const E=o&&Math.abs(P-o[0])<.5,y=o&&Math.abs(w-o[1])<.5;if(v&&!E){const x=Math.abs(a-P);x<d&&(d=x,a=P,u=P)}if(M&&!y){const x=Math.abs(l-w);x<m&&(m=x,l=w,p=w)}}return this.axisSnapLines.set({x:u,y:p}),{x:a,y:l}}onPolygonMouseMove(e){const n=this.mouseToImagePercent(e);if(!n)return;const o=this.polygonPoints();this.polygonCursor.set(this.applySnapping(n,o,e.shiftKey))}finishPolygon(){const e=this.polygonPoints();if(e.length<3)return;window.removeEventListener("mousemove",this.polygonMoveListener),window.removeEventListener("keydown",this.polygonEscListener);const o={...this.drawnArtefactDef(),points:[...e],color:this.drawColor()},i=this.imageDimensions();this.artefactDrawn.emit({type:"polygon",def:o,pct:{points:[...e]},abs:{points:e.map(([a,l])=>[i?a/100*i.width:a,i?l/100*i.height:l])}}),this.polygonPoints.set([]),this.polygonCursor.set(null)}onPolygonEsc(e){"Escape"===e.key&&this.cancelPolygon()}static \u0275fac=function(n){return new(n||s)};static \u0275prov=r.jDH({token:s,factory:s.\u0275fac})}return s})();const q=["imageElement"],J=["*"],ee=(s,c)=>({artefact:s,type:"bbox",index:c}),te=(s,c)=>({artefact:s,type:"circle",index:c}),ne=(s,c)=>({artefact:s,type:"polygon",index:c}),oe=(s,c)=>({artefact:s,type:"svgPath",index:c}),ie=(s,c)=>e=>{const n=r.eBV(c).$implicit;return r.Njj(!e.visible||e.visible(n))},se=(s,c)=>c.label;function ae(s,c){if(1&s&&(t.j41(0,"cue-card",13),t.nrm(1,"cue-typography",14),t.k0s()),2&s){const e=t.XpG().$implicit,n=t.XpG();t.xc7("transform","scale("+1/n.zoom()+")"),t.R7$(),t.Y8G("noWrap",!0)("innerHTML",e.label,t.npT)}}function re(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",11),t.bIt("contextMenuOpen",function(){r.eBV(e);const o=t.XpG();return r.Njj(o.isContextMenuOpen.set(!0))})("contextMenuClose",function(){r.eBV(e);const o=t.XpG();return r.Njj(o.isContextMenuOpen.set(!1))})("click",function(o){const i=r.eBV(e).$implicit,a=t.XpG();return r.Njj(a.handleBboxClick(i,o))}),t.nVh(1,ae,2,4,"cue-card",12),t.k0s()}if(2&s){const e=c.$implicit,n=t.XpG(),o=t.sdS(17);t.xc7("left",e.x,"%")("top",e.y,"%")("width",e.width,"%")("height",e.height,"%")("border-color",e.color||"rgba(255, 0, 0, 0.8)")("border-width",3/n.zoom()+"px")("background-color",!1===e.showFill?"transparent":n.getBgColor(e.color)),t.AVh("clickable",n.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit)("removable",!!e.allowRemove),t.Y8G("title",e.label||"")("cueContextMenu",o)("contextMenuData",t.l_i(23,ee,e,e.sourceIndex))("cueContextEnabled",n.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit),t.R7$(),t.vxM(e.label?1:-1)}}function ce(s,c){if(1&s&&t.nrm(0,"div",15),2&s){const e=c,n=t.XpG();t.xc7("left",e.x,"%")("top",e.y,"%")("width",e.width,"%")("height",e.height,"%")("border-color",e.color)("border-width",3/n.zoom()+"px")("background-color",n.getBgColor(e.color))}}function le(s,c){if(1&s){const e=t.RV6();r.qSk(),t.j41(0,"ellipse",17),t.bIt("contextMenuOpen",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!0))})("contextMenuClose",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!1))}),t.k0s()}if(2&s){const e=c.$implicit,n=c.$index,o=t.XpG(2),i=t.sdS(17);t.xc7("pointer-events",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"all":"none")("cursor",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"pointer":"default"),t.Y8G("cueContextMenu",i)("contextMenuData",t.l_i(14,te,e,n))("cueContextEnabled",o.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit),t.BMQ("cx",e.cx)("cy",e.cy)("rx",e.r)("ry",e.r*o.imageAspectRatio())("stroke",e.color||"rgba(255, 0, 0, 0.8)")("fill",!1===e.showFill?"none":o.getBgColor(e.color))("stroke-width",3/o.zoom())}}function de(s,c){if(1&s&&(t.j41(0,"cue-card",13),t.nrm(1,"cue-typography",14),t.k0s()),2&s){const e=t.XpG().$implicit,n=t.XpG(2);t.xc7("left",e.cx,"%")("top",e.cy-e.r*n.imageAspectRatio(),"%")("transform","scale("+1/n.zoom()+")"),t.R7$(),t.Y8G("noWrap",!0)("innerHTML",e.label,t.npT)}}function me(s,c){1&s&&t.nVh(0,de,2,8,"cue-card",18),2&s&&t.vxM(c.$implicit.label?0:-1)}function he(s,c){if(1&s&&(r.qSk(),t.j41(0,"svg",8),t.Z7z(1,le,1,17,":svg:ellipse",16,t.Vm6),t.k0s(),t.Z7z(3,me,1,1,null,null,t.Vm6)),2&s){const e=t.XpG();t.R7$(),t.Dyx(e.drawingArtefacts().circles),t.R7$(2),t.Dyx(e.drawingArtefacts().circles)}}function ue(s,c){if(1&s&&(r.qSk(),t.j41(0,"svg",8),t.nrm(1,"ellipse",19),t.k0s()),2&s){const e=c,n=t.XpG();t.R7$(),t.BMQ("cx",e.cx)("cy",e.cy)("rx",e.r)("ry",e.r*n.imageAspectRatio())("stroke",e.color)("fill",n.getBgColor(e.color))("stroke-width",3/n.zoom())}}function ge(s,c){if(1&s){const e=t.RV6();r.qSk(),t.j41(0,"polygon",21),t.bIt("contextMenuOpen",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!0))})("contextMenuClose",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!1))}),t.k0s()}if(2&s){const e=c.$implicit,n=c.$index,o=t.XpG(2),i=t.sdS(17);t.xc7("pointer-events",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"all":"none")("cursor",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"pointer":"default"),t.AVh("clickable",o.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit),t.Y8G("cueContextMenu",i)("contextMenuData",t.l_i(13,ne,e,n))("cueContextEnabled",o.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit),t.BMQ("points",o.pointsToAttr(e.points))("stroke",e.color||"rgba(255, 0, 0, 0.8)")("fill",!1===e.showFill?"none":o.getBgColor(e.color))("stroke-width",3/o.zoom())}}function pe(s,c){if(1&s&&(t.j41(0,"cue-card",13),t.nrm(1,"cue-typography",14),t.k0s()),2&s){const e=t.XpG().$implicit,n=t.XpG(2);t.xc7("left",n.polygonCentroid(e.points).x,"%")("top",n.polygonCentroid(e.points).y,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.Y8G("noWrap",!0)("innerHTML",e.label,t.npT)}}function _e(s,c){1&s&&t.nVh(0,pe,2,8,"cue-card",18),2&s&&t.vxM(c.$implicit.label?0:-1)}function fe(s,c){if(1&s&&(r.qSk(),t.j41(0,"svg",8),t.Z7z(1,ge,1,16,":svg:polygon",20,t.Vm6),t.k0s(),t.Z7z(3,_e,1,1,null,null,t.Vm6)),2&s){const e=t.XpG();t.R7$(),t.Dyx(e.drawingArtefacts().polygons),t.R7$(2),t.Dyx(e.drawingArtefacts().polygons)}}function we(s,c){if(1&s&&(r.qSk(),t.nrm(0,"line",25)(1,"line",26)),2&s){const e=t.XpG(),n=t.XpG();t.BMQ("x1",e.points[e.points.length-1][0])("y1",e.points[e.points.length-1][1])("x2",e.cursorPoint[0])("y2",e.cursorPoint[1])("stroke",e.color)("stroke-width",2/n.zoom()),t.R7$(),t.BMQ("x1",e.cursorPoint[0])("y1",e.cursorPoint[1])("x2",e.points[0][0])("y2",e.points[0][1])("stroke",e.color)("stroke-width",1/n.zoom())}}function xe(s,c){if(1&s&&t.nrm(0,"div",27),2&s){const e=c.$implicit,n=t.XpG(),o=t.XpG();t.xc7("left",e[0],"%")("top",e[1],"%")("transform","translate(-50%, -50%) scale("+1/o.zoom()+")")("background",n.color)}}function ve(s,c){if(1&s&&t.nrm(0,"div",28),2&s){const e=t.XpG(),n=t.XpG();t.xc7("left",e.cursorPoint[0],"%")("top",e.cursorPoint[1],"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")")("background",e.color)}}function Me(s,c){if(1&s&&t.nrm(0,"div",31),2&s){const e=t.XpG();t.xc7("left",e.x,"%")}}function ye(s,c){if(1&s&&t.nrm(0,"div",32),2&s){const e=t.XpG();t.xc7("top",e.y,"%")}}function be(s,c){if(1&s&&(t.nVh(0,Me,1,2,"div",29),t.nVh(1,ye,1,2,"div",30)),2&s){const e=c;t.vxM(void 0!==e.x?0:-1),t.R7$(),t.vxM(void 0!==e.y?1:-1)}}function Ce(s,c){if(1&s&&(r.qSk(),t.j41(0,"svg",8),t.nrm(1,"polyline",22),t.nVh(2,we,2,12),t.k0s(),t.Z7z(3,xe,1,8,"div",23,t.Vm6),t.nVh(5,ve,1,8,"div",24),t.nVh(6,be,2,2)),2&s){let e;const n=c,o=t.XpG();t.R7$(),t.BMQ("points",o.pointsToAttr(n.points))("stroke",n.color)("stroke-width",3/o.zoom()),t.R7$(),t.vxM(n.cursorPoint?2:-1),t.R7$(),t.Dyx(n.points),t.R7$(2),t.vxM(n.cursorPoint&&!o.isCursorOnVertex(n.cursorPoint,n.points)?5:-1),t.R7$(),t.vxM((e=o.polygonService.axisSnapLines())?6:-1,e)}}function De(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",33),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG();return r.Njj("polygon"===i.drawMode()?i.polygonService.onPolygonClick(o):i.drawingService.onDrawMouseDown(o))})("keydown.escape",function(){r.eBV(e);const o=t.XpG();return r.Njj(o.polygonService.cancelPolygon())}),t.k0s()}}function Pe(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",35),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"nw"))}),t.k0s(),t.j41(1,"div",36),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"ne"))}),t.k0s(),t.j41(2,"div",37),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"sw"))}),t.k0s(),t.j41(3,"div",38),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"se"))}),t.k0s(),t.j41(4,"div",39),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"n"))}),t.k0s(),t.j41(5,"div",40),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"s"))}),t.k0s(),t.j41(6,"div",41),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"w"))}),t.k0s(),t.j41(7,"div",42),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"e"))}),t.k0s()}if(2&s){const e=t.XpG().$implicit,n=t.XpG(3);t.xc7("left",e.x,"%")("top",e.y,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x+e.width,"%")("top",e.y,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x,"%")("top",e.y+e.height,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x+e.width,"%")("top",e.y+e.height,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x+e.width/2,"%")("top",e.y,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x+e.width/2,"%")("top",e.y+e.height,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x,"%")("top",e.y+e.height/2,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.x+e.width,"%")("top",e.y+e.height/2,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")")}}function ze(s,c){if(1&s&&t.nVh(0,Pe,8,48),2&s){const e=c.$index,n=t.XpG(2);t.vxM(e===n.index?0:-1)}}function Te(s,c){if(1&s&&t.Z7z(0,ze,1,1,null,null,t.Vm6),2&s){const e=t.XpG(2);t.Dyx(e.boundingBoxes())}}function Ie(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",43),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"radius"))}),t.k0s(),t.j41(1,"div",43),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"radius"))}),t.k0s(),t.j41(2,"div",44),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"radius"))}),t.k0s(),t.j41(3,"div",44),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG(4);return r.Njj(i.editService.onEditMouseDown(o,"radius"))}),t.k0s()}if(2&s){const e=t.XpG().$implicit,n=t.XpG(3);t.xc7("left",e.cx+e.r,"%")("top",e.cy,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.cx-e.r,"%")("top",e.cy,"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.cx,"%")("top",e.cy-e.r*n.imageAspectRatio(),"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")"),t.R7$(),t.xc7("left",e.cx,"%")("top",e.cy+e.r*n.imageAspectRatio(),"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")")}}function Ee(s,c){if(1&s&&t.nVh(0,Ie,4,24),2&s){const e=c.$index,n=t.XpG(2);t.vxM(e===n.index?0:-1)}}function Ve(s,c){if(1&s&&t.Z7z(0,Ee,1,1,null,null,t.Vm6),2&s){const e=t.XpG(2);t.Dyx(e.drawingArtefacts().circles)}}function ke(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",46),t.bIt("mousedown",function(o){const i=r.eBV(e).$index,a=t.XpG(5);return r.Njj(a.editService.onEditMouseDown(o,"vertex:"+i))}),t.k0s()}if(2&s){const e=c.$implicit,n=t.XpG(5);t.xc7("left",e[0],"%")("top",e[1],"%")("transform","translate(-50%, -50%) scale("+1/n.zoom()+")")}}function Ae(s,c){if(1&s&&t.Z7z(0,ke,1,6,"div",45,t.Vm6),2&s){const e=t.XpG().$implicit;t.Dyx(e.points)}}function Le(s,c){if(1&s&&t.nVh(0,Ae,2,0),2&s){const e=c.$index,n=t.XpG(2);t.vxM(e===n.index?0:-1)}}function Se(s,c){if(1&s&&t.Z7z(0,Le,1,1,null,null,t.Vm6),2&s){const e=t.XpG(2);t.Dyx(e.drawingArtefacts().polygons)}}function Re(s,c){if(1&s){const e=t.RV6();t.j41(0,"div",34),t.bIt("mousedown",function(o){r.eBV(e);const i=t.XpG();return r.Njj(i.editService.onEditMouseDown(o,"body"))}),t.nVh(1,Te,2,0),t.nVh(2,Ve,2,0),t.nVh(3,Se,2,0),t.k0s()}if(2&s){const e=c;t.R7$(),t.vxM("bbox"===e.type?1:-1),t.R7$(),t.vxM("circle"===e.type?2:-1),t.R7$(),t.vxM("polygon"===e.type?3:-1)}}function je(s,c){if(1&s){const e=t.RV6();r.qSk(),t.j41(0,"g",49),t.bIt("contextMenuOpen",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!0))})("contextMenuClose",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.isContextMenuOpen.set(!1))})("click",function(o){const i=r.eBV(e).$implicit,a=t.XpG(2);return r.Njj(a.handleSvgPathClick(i,o))}),t.k0s()}if(2&s){const e=c.$implicit,n=c.$index,o=t.XpG(2),i=t.sdS(17);t.xc7("pointer-events",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"all":"none")("cursor",o.contextMenuItems().length>0||e.allowRemove||e.allowEdit?"pointer":"default")("--dxf-sw",null!=e.strokeWidth&&o.zoom()?e.strokeWidth/o.zoom():null),t.AVh("clickable",o.contextMenuItems().length>0||!!e.allowRemove||!!e.allowEdit),t.Y8G("cueContextMenu",i)("contextMenuData",t.l_i(18,oe,e,n))("cueContextEnabled",o.contextMenuItems().length>0&&o.contextMenuItems().some(t._m7(17,ie,c))||!!e.allowRemove||!!e.allowEdit)("innerHTML",o.safeSvg(e.svg),t.npT),t.BMQ("title",e.label||"")("transform",e.transform||null)("stroke",e.color||"#ffa8a8")("fill",e.fillColor||"none")("stroke-dasharray",e.strokeDashArray||null)}}function Fe(s,c){if(1&s&&(t.j41(0,"cue-card",13),t.nrm(1,"cue-typography",14),t.k0s()),2&s){const e=c,n=t.XpG().$implicit,o=t.XpG(2);t.xc7("left",e.x,"%")("top",e.y,"%")("transform","translate(-50%, -50%) scale("+1/o.zoom()+")"),t.R7$(),t.Y8G("noWrap",!0)("innerHTML",n.label,t.npT)}}function Xe(s,c){if(1&s&&t.nVh(0,Fe,2,8,"cue-card",18),2&s){let e;const n=c.$implicit,o=t.XpG(2);t.vxM((e=n.label&&o.getSvgLabelPositionPercent(n.svg,n.transform))?0:-1,e)}}function Ze(s,c){if(1&s&&(r.qSk(),t.j41(0,"svg",47),t.Z7z(1,je,1,21,":svg:g",48,t.Vm6),t.k0s(),t.Z7z(3,Xe,1,1,null,null,t.Vm6)),2&s){const e=t.XpG();t.BMQ("viewBox",e.svgViewBox()),t.R7$(),t.Dyx(e.drawingArtefacts().svgPaths),t.R7$(2),t.Dyx(e.drawingArtefacts().svgPaths)}}function Be(s,c){if(1&s){const e=t.RV6();t.j41(0,"cue-menu-item",50),t.bIt("click",function(){r.eBV(e);const o=t.XpG().$implicit,i=t.XpG(2).$implicit;return r.Njj(o.action(i.artefact))}),t.EFF(1),t.k0s()}if(2&s){const e=t.XpG().$implicit;t.R7$(),t.SpI(" ",e.label," ")}}function Ge(s,c){if(1&s&&t.nVh(0,Be,2,1,"cue-menu-item"),2&s){const e=c.$implicit,n=t.XpG(2).$implicit;t.vxM(!e.visible||e.visible(n.artefact)?0:-1)}}function Ne(s,c){if(1&s){const e=t.RV6();t.j41(0,"cue-menu-item",50),t.bIt("click",function(){r.eBV(e);const o=t.XpG(2).$implicit,i=t.XpG();return r.Njj(i.editService.startEditArtefact(o.type,"bbox"===o.type?o.artefact.sourceIndex:o.index))}),t.EFF(1),t.nI1(2,"transloco"),t.k0s()}2&s&&(t.R7$(),t.SpI(" ",t.bMT(2,1,"common.buttons.edit")," "))}function $e(s,c){if(1&s){const e=t.RV6();t.j41(0,"cue-menu-item",50),t.bIt("click",function(){r.eBV(e);const o=t.XpG(2).$implicit,i=t.XpG();return r.Njj("bbox"===o.type?i.removeArtefact(o.artefact):"circle"===o.type?i.removeCircleArtefact(o.index):"polygon"===o.type?i.removePolygonArtefact(o.index):i.removeSvgPathArtefact(o.index))}),t.EFF(1),t.nI1(2,"transloco"),t.k0s()}2&s&&(t.R7$(),t.SpI(" ",t.bMT(2,1,"common.buttons.delete")," "))}function Oe(s,c){if(1&s&&(t.j41(0,"cue-menu-wrap"),t.Z7z(1,Ge,1,1,null,null,se),t.nVh(3,Ne,3,3,"cue-menu-item"),t.nVh(4,$e,3,3,"cue-menu-item"),t.k0s()),2&s){const e=t.XpG().$implicit,n=t.XpG();t.R7$(),t.Dyx(n.contextMenuItems()),t.R7$(2),t.vxM(!e.artefact.allowEdit||"bbox"!==e.type&&"circle"!==e.type&&"polygon"!==e.type?-1:3),t.R7$(),t.vxM(e.artefact.allowRemove?4:-1)}}function We(s,c){if(1&s&&t.nVh(0,Oe,5,2,"cue-menu-wrap"),2&s){const e=t.XpG();t.vxM(e.contextMenuItems().length>0?0:-1)}}function Ye(s,c){if(1&s){const e=t.RV6();t.j41(0,"cue-image-toolbar",52),t.mxI("zoomChange",function(o){r.eBV(e);const i=t.XpG(2);return t.DH7(i.zoom,o)||(i.zoom=o),r.Njj(o)})("panChange",function(o){r.eBV(e);const i=t.XpG(2);return t.DH7(i.pan,o)||(i.pan=o),r.Njj(o)})("activeToolChange",function(o){r.eBV(e);const i=t.XpG(2);return t.DH7(i.activeTool,o)||(i.activeTool=o),r.Njj(o)}),t.bIt("rotate",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.handleRotate())})("zoomIn",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.handleZoomIn())})("zoomOut",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.handleZoomOut())})("zoomFit",function(){r.eBV(e);const o=t.XpG(2);return r.Njj(o.calculateFitZoom())}),t.k0s()}if(2&s){const e=t.XpG(),n=t.XpG();t.Aen(n.toolbarStyle()),t.Y8G("options",e),t.R50("zoom",n.zoom)("pan",n.pan)("activeTool",n.activeTool),t.Y8G("minZoom",n.minZoom())("maxZoom",n.maxZoom())}}function He(s,c){1&s&&t.nVh(0,Ye,1,8,"cue-image-toolbar",51),2&s&&t.vxM(c.hidden?-1:0)}let Ue=(()=>{class s{svgHelpers=(0,r.WQX)(K);editService=(0,r.WQX)(N);drawingService=(0,r.WQX)($);polygonService=(0,r.WQX)(O);sanitizer=(0,r.WQX)(X.up);onEscape(){this.polygonService.polygonPoints().length>0&&this.polygonService.cancelPolygon(),this.editService.editingArtefact()&&this.editService.cancelEdit()}onEnter(){this.editService.editingArtefact()&&this.editService.cancelEdit()}src=g.hFB.required();alt=(0,g.hFB)("");fitMode=(0,g.hFB)("contain");toolbarOptions=(0,g.hFB)(new A.g);drawMode=(0,g.hFB)("none");panDisabled=(0,g.hFB)(!1);zoomDisabled=(0,g.hFB)(!1);drawnArtefactDef=(0,g.hFB)({allowRemove:!0,allowEdit:!0,color:"rgba(255, 0, 0, 0.9)"});contextMenuItems=(0,g.hFB)([]);activeTool=(0,g.geq)("pan");drawingArtefacts=(0,g.geq)((0,B.x)());artefactSelected=(0,g.CGW)();artefactDrawn=(0,g.CGW)();artefactRemoved=(0,g.CGW)();artefactEdited=(0,g.CGW)();drawColor=(0,T.EW)(()=>this.drawnArtefactDef().color??"rgba(255, 0, 0, 0.9)");panModeActive=(0,T.EW)(()=>!this.panDisabled()&&"none"===this.drawMode()&&!this.editService.editingArtefact()&&!this.isContextMenuOpen()&&"select"!==this.activeTool());boundingBoxes=(0,T.EW)(()=>this.drawingArtefacts().xywhs.map((n,o)=>{const i=this.parseXYWH("string"==typeof n?n:n.xywhStr);return i&&0!==i.width&&0!==i.height?("object"==typeof n&&(i.color=n.color,i.label=n.label,i.showFill=n.showFill,i.allowRemove=n.allowRemove,i.allowEdit=n.allowEdit),i.sourceIndex=o,i):null}).filter(Boolean));panZoom=(0,g.ebz)(k);imageElement=(0,g.ebz)("imageElement");rotationAngle=(0,r.vPA)(0);pan=(0,r.vPA)({x:0,y:0});isContextMenuOpen=(0,r.vPA)(!1);isZooming=(0,r.vPA)(!1);_zoomEndTimer=null;constructor(){(0,r.QZP)(e=>{const n=this.panZoom();if(n){const o=n.containerRef()?.nativeElement;if(o){const i=new ResizeObserver(()=>{this.zoomDisabled()||this.calculateFitZoom()});i.observe(o),e(()=>i.disconnect())}}}),(0,r.QZP)(e=>{this.zoom(),this.isZooming.set(!0),this._zoomEndTimer&&clearTimeout(this._zoomEndTimer),this._zoomEndTimer=setTimeout(()=>this.isZooming.set(!1),150),e(()=>{this._zoomEndTimer&&clearTimeout(this._zoomEndTimer)})}),queueMicrotask(()=>{const e=this.mouseToImagePercent.bind(this),n=this.parseXYWH.bind(this);this.editService.init({drawingArtefacts:this.drawingArtefacts,mouseToImagePercent:e,parseXYWH:n,polygonService:this.polygonService,artefactEdited:this.artefactEdited}),this.drawingService.init({drawMode:this.drawMode,drawColor:this.drawColor,drawnArtefactDef:this.drawnArtefactDef,artefactDrawn:this.artefactDrawn,mouseToImagePercent:e,imageDimensions:this.imageDimensions,drawingArtefacts:this.drawingArtefacts}),this.polygonService.init({drawColor:this.drawColor,drawnArtefactDef:this.drawnArtefactDef,artefactDrawn:this.artefactDrawn,mouseToImagePercent:e,imageAspectRatio:this.imageAspectRatio,zoom:this.zoom,imageDimensions:this.imageDimensions,drawingArtefacts:this.drawingArtefacts})})}zoom=(0,r.vPA)(1);imageDimensions=(0,r.vPA)(null);imageAspectRatio=(0,T.EW)(()=>{const e=this.imageDimensions();return e&&0!==e.height?e.width/e.height:1});minZoom=(0,r.vPA)(1);maxZoom=(0,r.vPA)(10);toolbarStyle=(0,T.EW)(()=>{const e=this.toolbarOptions();return{position:"absolute",left:e.margin,right:e.margin,["top"===e.position?"top":"bottom"]:e.margin,"z-index":"1000",display:"flex","justify-content":"center"}});onImageLoad(){const e=this.imageElement()?.nativeElement;e&&(this.imageDimensions.set({width:e.naturalWidth,height:e.naturalHeight}),this.zoomDisabled()||this.calculateFitZoom())}calculateFitZoom(){const e=this.panZoom(),n=this.imageElement()?.nativeElement;!e||!n||requestAnimationFrame(()=>{const o=e.containerRef()?.nativeElement;if(!o)return;const i=o.getBoundingClientRect(),a=n.naturalWidth,l=n.naturalHeight;if(0===a||0===l)return;const d=i.width/a,m=i.height/l;let u=1;u="contain"===this.fitMode()?Math.min(d,m):"cover"===this.fitMode()?Math.max(d,m):1,this.minZoom.set(Math.min(u,1)),this.zoom.set(u),this.centerImage()})}centerImage(){const e=this.panZoom();e?requestAnimationFrame(()=>{const n=e.containerRef()?.nativeElement;if(!n)return;const o=n.getBoundingClientRect(),i=this.zoom(),a=this.imageDimensions()?.width||0,l=this.imageDimensions()?.height||0;this.pan.set({x:(o.width-a*i)/2,y:(o.height-l*i)/2})}):this.pan.set({x:0,y:0})}handleRotate(){this.rotationAngle.update(e=>(e-90)%360),this.pan.update(()=>({x:0,y:0}))}handleZoomIn(){this.panZoom()?.zoomIn()}handleZoomOut(){this.panZoom()?.zoomOut()}parseXYWH(e){try{const o=e.replace("percent:","").split(",").map(m=>parseFloat(m.trim()));if(4!==o.length||o.some(isNaN))return console.warn(`Invalid XYWH format: ${e}`),null;const[i,a,l,d]=o;return{x:i,y:a,width:l,height:d}}catch(n){return console.error(`Error parsing XYWH: ${e}`,n),null}}getBgColor(e){if(!e)return"rgba(255, 0, 0, 0.1)";const n=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)/);if(n)return`rgba(${n[1]}, ${n[2]}, ${n[3]}, 0.1)`;const o=e.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const i=o[1];return`rgba(${parseInt(3===i.length?i[0]+i[0]:i.slice(0,2),16)}, ${parseInt(3===i.length?i[1]+i[1]:i.slice(2,4),16)}, ${parseInt(3===i.length?i[2]+i[2]:i.slice(4,6),16)}, 0.1)`}return e.replace(/rgba?\([^)]+\)/,"rgba(255, 0, 0, 0.1)")}mouseToImagePercent(e){const n=this.imageElement()?.nativeElement;if(!n)return null;const o=n.getBoundingClientRect(),a=(e.clientY-o.top)/o.height*100;return{x:Math.max(0,Math.min(100,(e.clientX-o.left)/o.width*100)),y:Math.max(0,Math.min(100,a))}}handleBboxClick(e,n){n.stopPropagation(),this.artefactSelected.emit(e)}removeArtefact(e){if(null==e.sourceIndex)return;const n=this.drawingArtefacts().xywhs[e.sourceIndex];this.drawingArtefacts.update(o=>({...o,xywhs:o.xywhs.filter((i,a)=>a!==e.sourceIndex)})),n&&this.artefactRemoved.emit(n)}removeCircleArtefact(e){const n=this.drawingArtefacts().circles[e];this.drawingArtefacts.update(o=>({...o,circles:o.circles.filter((i,a)=>a!==e)})),n&&this.artefactRemoved.emit(n)}removePolygonArtefact(e){const n=this.drawingArtefacts().polygons[e];this.drawingArtefacts.update(o=>({...o,polygons:o.polygons.filter((i,a)=>a!==e)})),n&&this.artefactRemoved.emit(n)}handleSvgPathClick(e,n){n.stopPropagation(),this.artefactSelected.emit(e)}removeSvgPathArtefact(e){const n=this.drawingArtefacts().svgPaths[e];this.drawingArtefacts.update(o=>({...o,svgPaths:o.svgPaths.filter((i,a)=>a!==e)})),n&&this.artefactRemoved.emit(n)}svgViewBox=(0,T.EW)(()=>{const e=this.imageDimensions();if(e&&e.width>0&&e.height>0)return`0 0 ${e.width} ${e.height}`;const n=this.drawingArtefacts().svgPaths;if(n.length>0){const i=n[0].svg.match(/viewBox="([^"]+)"/);if(i)return i[1]}return"0 0 100 100"});getSvgLabelPositionPercent(e,n){const o=this.svgHelpers.getLabelPosition(e);if(!o)return null;const i=this.imageDimensions();if(!i||0===i.width||0===i.height)return null;let{x:a,y:l}=o;if(n){const d=n.match(/matrix\(\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*,\s*([-\d.e]+)\s*\)/);if(d){const[,m,u,p,v,M,P]=d.map(Number),E=u*a+v*l+P;a=m*a+p*l+M,l=E}}return{x:a/i.width*100,y:l/i.height*100}}pointsToAttr(e){return e.map(n=>n[0]+","+n[1]).join(" ")}polygonCentroid(e){let n=0,o=0;for(const i of e)n+=i[0],o+=i[1];return{x:n/e.length,y:o/e.length}}isCursorOnVertex(e,n){for(const o of n)if(Math.abs(e[0]-o[0])<.5&&Math.abs(e[1]-o[1])<.5)return!0;return!1}safeSvg(e){let n=e.trim();if(n.startsWith("<svg")){const i=(new DOMParser).parseFromString(n,"image/svg+xml"),a=i.querySelector("parsererror");a&&console.warn("[ImageViewer] safeSvg: SVG parse error",a.textContent),n=i.documentElement.innerHTML}return this.sanitizer.bypassSecurityTrustHtml(n)}static \u0275fac=function(n){return new(n||s)};static \u0275cmp=t.VBU({type:s,selectors:[["cue-image-viewer"]],viewQuery:function(n,o){1&n&&t.wEZ(o.panZoom,k,5)(o.imageElement,q,5),2&n&&t.NyB(2)},hostBindings:function(n,o){1&n&&t.bIt("keydown.escape",function(){return o.onEscape()},t.EBC)("keydown.enter",function(){return o.onEnter()},t.EBC)},inputs:{src:[1,"src"],alt:[1,"alt"],fitMode:[1,"fitMode"],toolbarOptions:[1,"toolbarOptions"],drawMode:[1,"drawMode"],panDisabled:[1,"panDisabled"],zoomDisabled:[1,"zoomDisabled"],drawnArtefactDef:[1,"drawnArtefactDef"],contextMenuItems:[1,"contextMenuItems"],activeTool:[1,"activeTool"],drawingArtefacts:[1,"drawingArtefacts"]},outputs:{activeTool:"activeToolChange",drawingArtefacts:"drawingArtefactsChange",artefactSelected:"artefactSelected",artefactDrawn:"artefactDrawn",artefactRemoved:"artefactRemoved",artefactEdited:"artefactEdited"},features:[t.Jv_([N,$,O])],ngContentSelectors:J,decls:19,vars:19,consts:[["imageElement",""],["artefactContextMenu",""],[1,"container"],[2,"width","100%","height","100%",3,"zoomChange","panChange","minZoom","maxZoom","zoom","pan","zoomStep","panMode"],[1,"image-container"],["draggable","false",2,"max-width","none","height","auto","display","block","user-select","none",3,"load","src","alt"],["trigger","leftclick",1,"bounding-box-overlay",3,"clickable","removable","left","top","width","height","border-color","border-width","background-color","title","cueContextMenu","contextMenuData","cueContextEnabled"],[1,"bounding-box-overlay","draw-preview",3,"left","top","width","height","border-color","border-width","background-color"],["viewBox","0 0 100 100","preserveAspectRatio","none",1,"svg-overlay",2,"position","absolute","top","0","left","0","width","100%","height","100%","pointer-events","none","overflow","visible"],["tabindex","0",1,"draw-overlay"],[1,"draw-overlay","edit-overlay"],["trigger","leftclick",1,"bounding-box-overlay",3,"contextMenuOpen","contextMenuClose","click","title","cueContextMenu","contextMenuData","cueContextEnabled"],[1,"bbox-label",3,"transform"],[1,"bbox-label"],["size","xs","weight","medium",3,"noWrap","innerHTML"],[1,"bounding-box-overlay","draw-preview"],["vector-effect","non-scaling-stroke","trigger","leftclick",1,"clickable",3,"pointer-events","cursor","cueContextMenu","contextMenuData","cueContextEnabled"],["vector-effect","non-scaling-stroke","trigger","leftclick",1,"clickable",3,"contextMenuOpen","contextMenuClose","cueContextMenu","contextMenuData","cueContextEnabled"],[1,"bbox-label",3,"left","top","transform"],["vector-effect","non-scaling-stroke","stroke-dasharray","6 4"],["vector-effect","non-scaling-stroke","trigger","leftclick",3,"pointer-events","cursor","clickable","cueContextMenu","contextMenuData","cueContextEnabled"],["vector-effect","non-scaling-stroke","trigger","leftclick",3,"contextMenuOpen","contextMenuClose","cueContextMenu","contextMenuData","cueContextEnabled"],["fill","none","vector-effect","non-scaling-stroke","stroke-dasharray","6 4"],[1,"polygon-vertex",3,"left","top","transform","background"],[1,"polygon-vertex","cursor-preview",3,"left","top","transform","background"],["vector-effect","non-scaling-stroke","stroke-dasharray","4 4","opacity","0.6"],["vector-effect","non-scaling-stroke","stroke-dasharray","2 4","opacity","0.3"],[1,"polygon-vertex"],[1,"polygon-vertex","cursor-preview"],[1,"snap-guide","vertical",3,"left"],[1,"snap-guide","horizontal",3,"top"],[1,"snap-guide","vertical"],[1,"snap-guide","horizontal"],["tabindex","0",1,"draw-overlay",3,"mousedown","keydown.escape"],[1,"draw-overlay","edit-overlay",3,"mousedown"],[1,"resize-handle","nw",3,"mousedown"],[1,"resize-handle","ne",3,"mousedown"],[1,"resize-handle","sw",3,"mousedown"],[1,"resize-handle","se",3,"mousedown"],[1,"resize-handle","n",3,"mousedown"],[1,"resize-handle","s",3,"mousedown"],[1,"resize-handle","w",3,"mousedown"],[1,"resize-handle","e",3,"mousedown"],[1,"resize-handle","radius",3,"mousedown"],[1,"resize-handle","radius-v",3,"mousedown"],[1,"resize-handle","vertex",3,"left","top","transform"],[1,"resize-handle","vertex",3,"mousedown"],["preserveAspectRatio","none",1,"svg-overlay",2,"position","absolute","top","0","left","0","width","100%","height","100%","pointer-events","none","overflow","visible"],["trigger","leftclick",3,"clickable","pointer-events","cursor","cueContextMenu","contextMenuData","cueContextEnabled","--dxf-sw","innerHTML"],["trigger","leftclick",3,"contextMenuOpen","contextMenuClose","click","cueContextMenu","contextMenuData","cueContextEnabled","innerHTML"],[3,"click"],[3,"options","style","zoom","pan","activeTool","minZoom","maxZoom"],[3,"zoomChange","panChange","activeToolChange","rotate","zoomIn","zoomOut","zoomFit","options","zoom","pan","activeTool","minZoom","maxZoom"]],template:function(n,o){if(1&n){const i=t.RV6();t.NAR(),t.j41(0,"div",2)(1,"cue-pan-zoom",3),t.mxI("zoomChange",function(l){return r.eBV(i),t.DH7(o.zoom,l)||(o.zoom=l),r.Njj(l)})("panChange",function(l){return r.eBV(i),t.DH7(o.pan,l)||(o.pan=l),r.Njj(l)}),t.j41(2,"div",4)(3,"img",5,0),t.bIt("load",function(){return o.onImageLoad()}),t.k0s(),t.Z7z(5,re,2,26,"div",6,t.Vm6),t.nVh(7,ce,1,14,"div",7),t.nVh(8,he,5,0),t.nVh(9,ue,2,7,":svg:svg",8),t.nVh(10,fe,5,0),t.nVh(11,Ce,7,6),t.nVh(12,De,1,0,"div",9),t.nVh(13,Re,4,3,"div",10),t.nVh(14,Ze,5,1),t.SdG(15),t.DNE(16,We,1,1,"ng-template",null,1,t.C5r),t.k0s()(),t.nVh(18,He,1,1),t.k0s()}if(2&n){let i,a,l,d,m;t.R7$(),t.Y8G("minZoom",o.zoomDisabled()?o.zoom():o.minZoom())("maxZoom",o.zoomDisabled()?o.zoom():o.maxZoom()),t.R50("zoom",o.zoom)("pan",o.pan),t.Y8G("zoomStep",.1)("panMode",o.panModeActive()),t.R7$(),t.xc7("transform","rotate("+o.rotationAngle()+"deg)"),t.R7$(),t.Y8G("src",o.src(),t.B4B)("alt",o.alt()),t.R7$(2),t.Dyx(o.boundingBoxes()),t.R7$(2),t.vxM((i=o.drawingService.drawPreview())?7:-1,i),t.R7$(),t.vxM(o.drawingArtefacts().circles.length>0?8:-1),t.R7$(),t.vxM((a=o.drawingService.circleDrawPreview())?9:-1,a),t.R7$(),t.vxM(o.drawingArtefacts().polygons.length>0?10:-1),t.R7$(),t.vxM((l=o.polygonService.polygonDrawPreview())?11:-1,l),t.R7$(),t.vxM("none"!==o.drawMode()?12:-1),t.R7$(),t.vxM((d=o.editService.editingArtefact())?13:-1,d),t.R7$(),t.vxM(o.drawingArtefacts().svgPaths.length>0&&!o.isZooming()?14:-1),t.R7$(4),t.vxM((m=o.toolbarOptions())?18:-1,m)}},dependencies:[L.MD,A.F,k,S.Q,C.M,R.D,f.Card,z.Typography,G.Kj],styles:["[_nghost-%COMP%]{display:contents}.container[_ngcontent-%COMP%]{position:relative;width:100%;height:100%;overflow:hidden;display:flex;flex-direction:column}.image-container[_ngcontent-%COMP%]{position:relative;height:auto}.bounding-box-overlay[_ngcontent-%COMP%]{position:absolute;border:3px solid rgba(255,0,0,.8);background-color:#ff00001a;box-sizing:border-box;pointer-events:none;z-index:5;transition:border-width .2s ease,background-color .2s ease}.bounding-box-overlay.clickable[_ngcontent-%COMP%]{pointer-events:auto;cursor:pointer}.bounding-box-overlay.clickable[_ngcontent-%COMP%]:hover{border-width:3px;background-color:#ff000040}.bbox-label[_ngcontent-%COMP%]{position:absolute;top:-12px;left:-28px;transform-origin:bottom left;pointer-events:none;z-index:6;--cue-card-padding-x: 8px;--cue-card-padding-y: 4px}cue-image-toolbar[_ngcontent-%COMP%]{position:absolute;left:0;right:0;bottom:0;z-index:10;display:flex;justify-content:center}.draw-overlay[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%;cursor:crosshair;z-index:6}.edit-overlay[_ngcontent-%COMP%]{cursor:move;z-index:8}.resize-handle[_ngcontent-%COMP%]{position:absolute;width:8px;height:8px;background:#fff;border:2px solid rgba(0,120,215,.9);border-radius:2px;z-index:9;pointer-events:auto}.resize-handle.nw[_ngcontent-%COMP%]{cursor:nw-resize}.resize-handle.ne[_ngcontent-%COMP%]{cursor:ne-resize}.resize-handle.sw[_ngcontent-%COMP%]{cursor:sw-resize}.resize-handle.se[_ngcontent-%COMP%]{cursor:se-resize}.resize-handle.n[_ngcontent-%COMP%]{cursor:n-resize}.resize-handle.s[_ngcontent-%COMP%]{cursor:s-resize}.resize-handle.e[_ngcontent-%COMP%]{cursor:e-resize}.resize-handle.w[_ngcontent-%COMP%]{cursor:w-resize}.resize-handle.radius[_ngcontent-%COMP%]{cursor:ew-resize;border-radius:50%}.resize-handle.radius-v[_ngcontent-%COMP%]{cursor:ns-resize;border-radius:50%}.draw-preview[_ngcontent-%COMP%]{border-style:dashed!important;pointer-events:none;z-index:7}.bounding-box-overlay.removable[_ngcontent-%COMP%]{pointer-events:auto}.polygon-vertex[_ngcontent-%COMP%]{position:absolute;width:8px;height:8px;border-radius:50%;border:2px solid white;pointer-events:none;z-index:7}.polygon-vertex.cursor-preview[_ngcontent-%COMP%]{opacity:.6}.snap-guide[_ngcontent-%COMP%]{position:absolute;pointer-events:none;z-index:6}.snap-guide.vertical[_ngcontent-%COMP%]{top:0;bottom:0;width:0;border-left:1px dashed rgba(0,200,255,.7)}.snap-guide.horizontal[_ngcontent-%COMP%]{left:0;right:0;height:0;border-top:1px dashed rgba(0,200,255,.7)}"],changeDetection:0})}return s})()}}]);
|
package/8659.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[8659],{8659(l,g,a){a.d(g,{StatusBadge:()=>i});var r=a(7705),s=a(2271),e=a(5547);const u=["*"];function d(t,p){if(1&t&&e.Hgh(0,"span",2),2&t){const o=e.XpG();e.xc7("background",o.fg())}}let i=(()=>{class t{tone=(0,r.hFB)("neutral");dot=(0,r.hFB)(!1);static TONES={success:["var(--cue-color-success)","rgba(76,175,80,.14)"],warning:["#b07d00","rgba(255,193,7,.18)"],neutral:["var(--cue-color-midgray)","rgba(131,148,176,.16)"],blue:["var(--cue-color-blue)","rgba(40,89,225,.10)"],error:["var(--cue-color-error)","rgba(252,38,38,.12)"]};fg=(0,s.EW)(()=>t.TONES[this.tone()][0]);bg=(0,s.EW)(()=>t.TONES[this.tone()][1]);static \u0275fac=function(n){return new(n||t)};static \u0275cmp=e.VBU({type:t,selectors:[["cue-status-badge"]],inputs:{tone:[1,"tone"],dot:[1,"dot"]},ngContentSelectors:u,decls:3,vars:5,consts:[[1,"badge"],[1,"dot",3,"background"],[1,"dot"]],template:function(n,c){1&n&&(e.NAR(),e.rj2(0,"span",0),e.nVh(1,d,1,2,"span",1),e.SdG(2),e.eux()),2&n&&(e.xc7("color",c.fg())("background",c.bg()),e.R7$(),e.vxM(c.dot()?1:-1))},styles:[".badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:5px;padding:3px 9px;border-radius:var(--cue-radius-pill);font-size:11px;font-weight:600;letter-spacing:.02em;white-space:nowrap}.dot[_ngcontent-%COMP%]{width:6px;height:6px;border-radius:50%;flex:none}"],changeDetection:0})}return t})()}}]);
|
package/8957.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[1338,8957],{8957(O,_,a){a.d(_,{Input:()=>P});var l=a(7705),u=a(5802),d=a(9417),g=a(2245),f=a(5381),h=a(29),e=a(5547);const v=["inputField"];function M(i,p){1&i&&e.EFF(0," * ")}function C(i,p){if(1&i&&(e.j41(0,"span",4),e.nrm(1,"cue-svg-icon",7),e.k0s()),2&i){const n=e.XpG();e.R7$(),e.Y8G("name",n.icon())}}function m(i,p){if(1&i&&(e.j41(0,"cue-typography",6),e.EFF(1),e.k0s()),2&i){const n=e.XpG();e.R7$(),e.JRh(n.error())}}let P=(()=>{class i{value=(0,l.geq)("");_displayValue=(0,u.vPA)("");info=(0,l.hFB)("");label=(0,l.hFB)("");placeholder=(0,l.hFB)("");error=(0,l.hFB)(void 0);required=(0,l.hFB)(!1);icon=(0,l.hFB)();type=(0,l.hFB)("text");size=(0,l.hFB)("m");isFocused=!1;disabled=!1;autofilled=(0,u.vPA)(!1);inputField;valueChange=(0,l.CGW)();valueCommit=(0,l.CGW)();_lastSyncedValue="";_syncDisplay=(0,u.QZP)(()=>{const n=this.value()||"";n!==this._lastSyncedValue&&(this._lastSyncedValue=n,!this.isFocused&&n!==this._displayValue()&&this._displayValue.set(n))});onChange=n=>{};onTouched=()=>{};writeValue(n){const o=n||"";this.value.set(o),this.isFocused||this._displayValue.set(o)}registerOnChange(n){this.onChange=n}registerOnTouched(n){this.onTouched=n}setDisabledState(n){this.disabled=n}onAnimationStart(n){if(n.animationName.endsWith("cue-autofill-start")){this.autofilled.set(!0);const o=this.inputField?.nativeElement.value??"";o&&o!==this.value()&&(this._displayValue.set(o),this.valueChange.emit(o),this.onChange(o),this.onTouched())}else n.animationName.endsWith("cue-autofill-cancel")&&this.autofilled.set(!1)}emitValue(n){const o=n.target.value;this.valueChange.emit(o),this.onChange(o)}focus(){this.isFocused=!0,this.value()&&this._displayValue.set(this.value()),this.inputField?.nativeElement&&this.inputField.nativeElement.focus()}onBlur(){this.isFocused=!1;const n=this.inputField?.nativeElement.value??this._displayValue();this._displayValue.set(n),this.valueCommit.emit(n),this.onTouched()}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=e.VBU({type:i,selectors:[["cue-input"]],viewQuery:function(o,t){if(1&o&&e.GBs(v,5),2&o){let c;e.mGM(c=e.lsd())&&(t.inputField=c.first)}},inputs:{value:[1,"value"],info:[1,"info"],label:[1,"label"],placeholder:[1,"placeholder"],error:[1,"error"],required:[1,"required"],icon:[1,"icon"],type:[1,"type"],size:[1,"size"]},outputs:{value:"valueChange",valueChange:"valueChange",valueCommit:"valueCommit"},features:[e.Jv_([{provide:d.kq,useExisting:(0,u.Rfq)(()=>i),multi:!0}])],decls:9,vars:13,consts:[["inputField",""],[1,"form-field"],["size","s",1,"label",3,"click","info"],["align","center","gap","s"],[2,"height","12px"],[1,"input",3,"input","focus","blur","animationstart","type","value","placeholder","disabled"],["size","s",1,"error-text"],[3,"name"]],template:function(o,t){if(1&o){const c=e.RV6();e.j41(0,"div",1)(1,"cue-typography",2),e.bIt("click",function(){u.eBV(c);const s=e.sdS(7);return u.Njj(s.focus())}),e.EFF(2),e.nVh(3,M,1,0),e.k0s(),e.j41(4,"cue-flexcontainer",3),e.nVh(5,C,2,1,"span",4),e.j41(6,"input",5,0),e.bIt("input",function(s){return t.emitValue(s)})("focus",function(){return t.isFocused=!0})("blur",function(){return t.onBlur()})("animationstart",function(s){return t.onAnimationStart(s)}),e.k0s()(),e.nVh(8,m,2,1,"cue-typography",6),e.k0s()}2&o&&(e.HbH("size-"+t.size()),e.AVh("focused",t.isFocused||t._displayValue()||t.placeholder()||t.autofilled()),e.R7$(),e.Y8G("info",t.info()),e.R7$(),e.SpI(" ",t.label()," "),e.R7$(),e.vxM(t.required()?3:-1),e.R7$(2),e.vxM(t.icon()?5:-1),e.R7$(),e.Y8G("type",t.type())("value",t._displayValue())("placeholder",t.placeholder())("disabled",t.disabled),e.R7$(2),e.vxM(t.error()?8:-1))},dependencies:[g.Typography,f.n,h.A],styles:['.form-field[_ngcontent-%COMP%]{position:relative}.input[_ngcontent-%COMP%]{color:var(--cue-input-value-color);width:100%;border:none;border-bottom:1px solid var(--cue-input-border-bottom-color);background:none;outline:none;font-family:var(--cue-font-family)}.size-xs[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]{padding:var(--cue-input-xs-padding);font-size:var(--cue-input-xs-font-size)}.size-s[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]{padding:var(--cue-input-s-padding);font-size:var(--cue-input-s-font-size)}.size-m[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]{padding:var(--cue-input-m-padding);font-size:var(--cue-input-m-font-size)}.size-l[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]{padding:var(--cue-input-l-padding);font-size:var(--cue-input-l-font-size)}.input[_ngcontent-%COMP%]::placeholder{color:var(--cue-input-placeholder-color);font-family:var(--cue-font-family);opacity:.5}.input[_ngcontent-%COMP%]:-webkit-autofill, .input[_ngcontent-%COMP%]:-webkit-autofill:hover, .input[_ngcontent-%COMP%]:-webkit-autofill:focus{-webkit-box-shadow:0 0 0px 1000px transparent inset;-webkit-transition:background-color 5000s ease-in-out 0s;transition:background-color 5000s ease-in-out 0s;-webkit-text-fill-color:var(--cue-input-value-color)}@keyframes _ngcontent-%COMP%_cue-autofill-start{}@keyframes _ngcontent-%COMP%_cue-autofill-cancel{}.input[_ngcontent-%COMP%]:-webkit-autofill{animation-name:_ngcontent-%COMP%_cue-autofill-start}.input[_ngcontent-%COMP%]:not(:-webkit-autofill){animation-name:_ngcontent-%COMP%_cue-autofill-cancel}.label[_ngcontent-%COMP%]{position:absolute;pointer-events:auto;transition:all .2s ease;cursor:text}.size-xs[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{top:var(--cue-input-xs-label-top);left:var(--cue-input-xs-label-left)}.size-s[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{top:var(--cue-input-s-label-top);left:var(--cue-input-s-label-left)}.size-m[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{top:var(--cue-input-m-label-top);left:var(--cue-input-m-label-left)}.size-l[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{top:var(--cue-input-l-label-top);left:var(--cue-input-l-label-left)}.form-field.focused[_ngcontent-%COMP%] .label[_ngcontent-%COMP%], .form-field[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]:not(:placeholder-shown) + .label[_ngcontent-%COMP%], .form-field[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:valid + .label[_ngcontent-%COMP%]{color:var(--cue-input-value-color)}.size-xs.focused[_ngcontent-%COMP%] .label[_ngcontent-%COMP%], .size-xs[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]:not(:placeholder-shown) + .label[_ngcontent-%COMP%], .size-xs[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:valid + .label[_ngcontent-%COMP%]{top:var(--cue-input-xs-label-focused-top);font-size:var(--cue-input-xs-label-focused-font-size)}.size-s.focused[_ngcontent-%COMP%] .label[_ngcontent-%COMP%], .size-s[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]:not(:placeholder-shown) + .label[_ngcontent-%COMP%], .size-s[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:valid + .label[_ngcontent-%COMP%]{top:var(--cue-input-s-label-focused-top);font-size:var(--cue-input-s-label-focused-font-size)}.size-m.focused[_ngcontent-%COMP%] .label[_ngcontent-%COMP%], .size-m[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]:not(:placeholder-shown) + .label[_ngcontent-%COMP%], .size-m[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:valid + .label[_ngcontent-%COMP%]{top:var(--cue-input-m-label-focused-top);font-size:var(--cue-input-m-label-focused-font-size)}.size-l.focused[_ngcontent-%COMP%] .label[_ngcontent-%COMP%], .size-l[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]:not(:placeholder-shown) + .label[_ngcontent-%COMP%], .size-l[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:valid + .label[_ngcontent-%COMP%]{top:var(--cue-input-l-label-focused-top);font-size:var(--cue-input-l-label-focused-font-size)}.underline[_ngcontent-%COMP%]{content:"";position:absolute;bottom:0;left:0;height:1px;width:0;background-color:var(--cue-input-border-bottom-color);transition:width .3s ease}.form-field.focused[_ngcontent-%COMP%] .underline[_ngcontent-%COMP%]{width:100%}.error-text[_ngcontent-%COMP%]{color:var(--cue-error);margin-top:4px;min-height:18px}'],changeDetection:0})}return i})()}}]);
|
|
1
|
+
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[1338,2245,8957,9495],{9495(O,v,u){u.d(v,{InlineInput:()=>m});var a=u(7705),r=u(5802),d=u(5547);const M=["inputEl"];let m=(()=>{class f{value=(0,a.geq)("");placeholder=(0,a.hFB)("");autofocus=(0,a.hFB)(!1);valueChange=(0,a.CGW)();save=(0,a.CGW)();cancel=(0,a.CGW)();inputEl;constructor(){(0,r.QZP)(()=>{const e=this.value(),c=this.inputEl?.nativeElement;c&&c.innerText.replace(/\n$/,"")!==e&&(c.innerText=e)})}ngAfterViewInit(){const e=this.inputEl?.nativeElement;e&&(e.innerText=this.value()),this.autofocus()&&e&&e.focus()}onInput(e){const _=e.target.innerText.replace(/\n$/,"");this.value.set(_),this.valueChange.emit(_)}onEnter(e){e.preventDefault(),this.save.emit()}onEscape(e){e.preventDefault(),this.cancel.emit()}onBlur(){this.save.emit()}static \u0275fac=function(c){return new(c||f)};static \u0275cmp=d.VBU({type:f,selectors:[["cue-inline-input"]],viewQuery:function(c,_){if(1&c&&d.GBs(M,5),2&c){let g;d.mGM(g=d.lsd())&&(_.inputEl=g.first)}},inputs:{value:[1,"value"],placeholder:[1,"placeholder"],autofocus:[1,"autofocus"]},outputs:{value:"valueChange",valueChange:"valueChange",save:"save",cancel:"cancel"},decls:2,vars:1,consts:[["inputEl",""],["contenteditable","true","role","textbox","aria-multiline","true",3,"input","keydown.enter","keydown.escape","blur"]],template:function(c,_){1&c&&(d.rj2(0,"span",1,0),d.VwU("input",function(h){return _.onInput(h)})("keydown.enter",function(h){return _.onEnter(h)})("keydown.escape",function(h){return _.onEscape(h)})("blur",function(){return _.onBlur()}),d.eux()),2&c&&d.BMQ("data-placeholder",_.placeholder())},styles:["[_nghost-%COMP%]{display:inline}span[contenteditable][_ngcontent-%COMP%]{outline:none;-webkit-text-decoration:underline dashed;text-decoration:underline dashed;text-underline-offset:3px;white-space:pre-wrap;word-break:break-word;cursor:text}span[contenteditable][_ngcontent-%COMP%]:empty:before{content:attr(data-placeholder);color:var(--cue-input-placeholder-color, currentColor);opacity:.5;pointer-events:none}"],changeDetection:0})}return f})()},8957(O,v,u){u.d(v,{Input:()=>p});var a=u(7705),r=u(5802),d=u(2271),M=u(9417),m=u(2245),f=u(5381),t=u(29),e=u(5547);const c=["inputField"];function _(s,l){1&s&&e.EFF(0," * ")}function g(s,l){if(1&s&&(e.j41(0,"span",4),e.nrm(1,"cue-svg-icon",8),e.k0s()),2&s){const n=e.XpG();e.R7$(),e.Y8G("name",n.icon())}}function h(s,l){if(1&s){const n=e.RV6();e.j41(0,"button",9),e.bIt("click",function(){r.eBV(n);const i=e.XpG();return r.Njj(i.showPassword.set(!i.showPassword()))}),e.nrm(1,"cue-svg-icon",8),e.k0s()}if(2&s){const n=e.XpG();e.BMQ("aria-label",n.showPassword()?"Hide password":"Show password"),e.R7$(),e.Y8G("name",n.showPassword()?"eye-off":"eye")}}function y(s,l){if(1&s&&(e.j41(0,"cue-typography",7),e.EFF(1),e.k0s()),2&s){const n=e.XpG();e.R7$(),e.JRh(n.error())}}let p=(()=>{class s{value=(0,a.geq)("");_displayValue=(0,r.vPA)("");info=(0,a.hFB)("");label=(0,a.hFB)("");placeholder=(0,a.hFB)("");error=(0,a.hFB)(void 0);required=(0,a.hFB)(!1);icon=(0,a.hFB)();type=(0,a.hFB)("text");size=(0,a.hFB)("m");showPassword=(0,r.vPA)(!1);effectiveType=(0,d.EW)(()=>"password"===this.type()&&this.showPassword()?"text":this.type());isFocused=!1;disabled=!1;autofilled=(0,r.vPA)(!1);inputField;valueChange=(0,a.CGW)();valueCommit=(0,a.CGW)();_lastSyncedValue="";_syncDisplay=(0,r.QZP)(()=>{const n=this.value()||"";n!==this._lastSyncedValue&&(this._lastSyncedValue=n,!this.isFocused&&n!==this._displayValue()&&this._displayValue.set(n))});onChange=n=>{};onTouched=()=>{};writeValue(n){const o=n||"";this.value.set(o),this.isFocused||this._displayValue.set(o)}registerOnChange(n){this.onChange=n}registerOnTouched(n){this.onTouched=n}setDisabledState(n){this.disabled=n}onAnimationStart(n){if(n.animationName.endsWith("cue-autofill-start")){this.autofilled.set(!0);const o=this.inputField?.nativeElement.value??"";o&&o!==this.value()&&(this._displayValue.set(o),this.valueChange.emit(o),this.onChange(o),this.onTouched())}else n.animationName.endsWith("cue-autofill-cancel")&&this.autofilled.set(!1)}emitValue(n){const o=n.target.value;this.valueChange.emit(o),this.onChange(o)}focus(){this.isFocused=!0,this.value()&&this._displayValue.set(this.value()),this.inputField?.nativeElement&&this.inputField.nativeElement.focus()}onBlur(){this.isFocused=!1;const n=this.inputField?.nativeElement.value??this._displayValue();this._displayValue.set(n),this.valueCommit.emit(n),this.onTouched()}static \u0275fac=function(o){return new(o||s)};static \u0275cmp=e.VBU({type:s,selectors:[["cue-input"]],viewQuery:function(o,i){if(1&o&&e.GBs(c,5),2&o){let b;e.mGM(b=e.lsd())&&(i.inputField=b.first)}},inputs:{value:[1,"value"],info:[1,"info"],label:[1,"label"],placeholder:[1,"placeholder"],error:[1,"error"],required:[1,"required"],icon:[1,"icon"],type:[1,"type"],size:[1,"size"]},outputs:{value:"valueChange",valueChange:"valueChange",valueCommit:"valueCommit"},features:[e.Jv_([{provide:M.kq,useExisting:(0,r.Rfq)(()=>s),multi:!0}])],decls:10,vars:14,consts:[["inputField",""],[1,"form-field"],["size","s",1,"label",3,"click","info"],["align","center","gap","s"],[2,"height","12px"],[1,"input",3,"input","focus","blur","animationstart","type","value","placeholder","disabled"],["type","button",1,"toggle-visibility"],["size","s",1,"error-text"],[3,"name"],["type","button",1,"toggle-visibility",3,"click"]],template:function(o,i){if(1&o){const b=e.RV6();e.j41(0,"div",1)(1,"cue-typography",2),e.bIt("click",function(){r.eBV(b);const C=e.sdS(7);return r.Njj(C.focus())}),e.EFF(2),e.nVh(3,_,1,0),e.k0s(),e.j41(4,"cue-flexcontainer",3),e.nVh(5,g,2,1,"span",4),e.j41(6,"input",5,0),e.bIt("input",function(C){return i.emitValue(C)})("focus",function(){return i.isFocused=!0})("blur",function(){return i.onBlur()})("animationstart",function(C){return i.onAnimationStart(C)}),e.k0s(),e.nVh(8,h,2,2,"button",6),e.k0s(),e.nVh(9,y,2,1,"cue-typography",7),e.k0s()}2&o&&(e.HbH("size-"+i.size()),e.AVh("focused",i.isFocused||i._displayValue()||i.placeholder()||i.autofilled()),e.R7$(),e.Y8G("info",i.info()),e.R7$(),e.SpI(" ",i.label()," "),e.R7$(),e.vxM(i.required()?3:-1),e.R7$(2),e.vxM(i.icon()?5:-1),e.R7$(),e.Y8G("type",i.effectiveType())("value",i._displayValue())("placeholder",i.placeholder())("disabled",i.disabled),e.R7$(2),e.vxM("password"===i.type()?8:-1),e.R7$(),e.vxM(i.error()?9:-1))},dependencies:[m.Typography,f.FlexContainer,t.A],styles:['.form-field[_ngcontent-%COMP%]{position:relative}.toggle-visibility[_ngcontent-%COMP%]{display:flex;align-items:center;flex-shrink:0;width:16px;height:16px;padding:0;border:none;background:none;color:var(--cue-input-value-color);cursor:pointer;opacity:.6}.toggle-visibility[_ngcontent-%COMP%]:hover{opacity:1}.input[_ngcontent-%COMP%]{color:var(--cue-input-value-color);width:100%;border:none;border-bottom:1px solid var(--cue-input-border-bottom-color);background:none;outline:none;font-family:var(--cue-font-family)}.size-xs[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]{padding:var(--cue-input-xs-padding);font-size:var(--cue-input-xs-font-size)}.size-s[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]{padding:var(--cue-input-s-padding);font-size:var(--cue-input-s-font-size)}.size-m[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]{padding:var(--cue-input-m-padding);font-size:var(--cue-input-m-font-size)}.size-l[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]{padding:var(--cue-input-l-padding);font-size:var(--cue-input-l-font-size)}.input[_ngcontent-%COMP%]::placeholder{color:var(--cue-input-placeholder-color);font-family:var(--cue-font-family);opacity:.5}.input[_ngcontent-%COMP%]:-webkit-autofill, .input[_ngcontent-%COMP%]:-webkit-autofill:hover, .input[_ngcontent-%COMP%]:-webkit-autofill:focus{-webkit-box-shadow:0 0 0px 1000px transparent inset;-webkit-transition:background-color 5000s ease-in-out 0s;transition:background-color 5000s ease-in-out 0s;-webkit-text-fill-color:var(--cue-input-value-color)}@keyframes _ngcontent-%COMP%_cue-autofill-start{}@keyframes _ngcontent-%COMP%_cue-autofill-cancel{}.input[_ngcontent-%COMP%]:-webkit-autofill{animation-name:_ngcontent-%COMP%_cue-autofill-start}.input[_ngcontent-%COMP%]:not(:-webkit-autofill){animation-name:_ngcontent-%COMP%_cue-autofill-cancel}.label[_ngcontent-%COMP%]{position:absolute;pointer-events:auto;transition:all .2s ease;cursor:text}.size-xs[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{top:var(--cue-input-xs-label-top);left:var(--cue-input-xs-label-left)}.size-s[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{top:var(--cue-input-s-label-top);left:var(--cue-input-s-label-left)}.size-m[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{top:var(--cue-input-m-label-top);left:var(--cue-input-m-label-left)}.size-l[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{top:var(--cue-input-l-label-top);left:var(--cue-input-l-label-left)}.form-field.focused[_ngcontent-%COMP%] .label[_ngcontent-%COMP%], .form-field[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]:not(:placeholder-shown) + .label[_ngcontent-%COMP%], .form-field[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:valid + .label[_ngcontent-%COMP%]{color:var(--cue-input-value-color)}.size-xs.focused[_ngcontent-%COMP%] .label[_ngcontent-%COMP%], .size-xs[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]:not(:placeholder-shown) + .label[_ngcontent-%COMP%], .size-xs[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:valid + .label[_ngcontent-%COMP%]{top:var(--cue-input-xs-label-focused-top);font-size:var(--cue-input-xs-label-focused-font-size)}.size-s.focused[_ngcontent-%COMP%] .label[_ngcontent-%COMP%], .size-s[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]:not(:placeholder-shown) + .label[_ngcontent-%COMP%], .size-s[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:valid + .label[_ngcontent-%COMP%]{top:var(--cue-input-s-label-focused-top);font-size:var(--cue-input-s-label-focused-font-size)}.size-m.focused[_ngcontent-%COMP%] .label[_ngcontent-%COMP%], .size-m[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]:not(:placeholder-shown) + .label[_ngcontent-%COMP%], .size-m[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:valid + .label[_ngcontent-%COMP%]{top:var(--cue-input-m-label-focused-top);font-size:var(--cue-input-m-label-focused-font-size)}.size-l.focused[_ngcontent-%COMP%] .label[_ngcontent-%COMP%], .size-l[_ngcontent-%COMP%] .input[_ngcontent-%COMP%]:not(:placeholder-shown) + .label[_ngcontent-%COMP%], .size-l[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:valid + .label[_ngcontent-%COMP%]{top:var(--cue-input-l-label-focused-top);font-size:var(--cue-input-l-label-focused-font-size)}.underline[_ngcontent-%COMP%]{content:"";position:absolute;bottom:0;left:0;height:1px;width:0;background-color:var(--cue-input-border-bottom-color);transition:width .3s ease}.form-field.focused[_ngcontent-%COMP%] .underline[_ngcontent-%COMP%]{width:100%}.error-text[_ngcontent-%COMP%]{color:var(--cue-error);margin-top:4px;min-height:18px}'],changeDetection:0})}return s})()},2245(O,v,u){u.r(v),u.d(v,{Typography:()=>y});var a=u(7705),r=u(2271),d=u(7089),M=u(5381),m=u(29),f=u(9495),t=u(5547),e=u(5802);const c=["*"];function _(p,s){if(1&p){const l=t.RV6();t.j41(0,"div",2),t.bIt("input",function(o){e.eBV(l);const i=t.XpG();return e.Njj(i.onInput(o))})("blur",function(o){e.eBV(l);const i=t.XpG();return e.Njj(i.onInput(o))}),t.k0s()}if(2&p){const l=t.XpG();t.Aen(l.getStyles()),t.xc7("font-style",l.italic()?"italic":"normal"),t.Y8G("innerHTML",l.innerHTML(),t.npT)("contentEditable",l.editable())}}function g(p,s){if(1&p&&t.nrm(0,"cue-svg-icon",5),2&p){const l=t.XpG(2);t.xc7("--cue-icon-width",l.infoSize()+"px"),t.Y8G("cueTooltip",l.info())}}function h(p,s){if(1&p){const l=t.RV6();t.j41(0,"div",3),t.bIt("input",function(o){e.eBV(l);const i=t.XpG();return e.Njj(i.onInput(o))})("blur",function(o){e.eBV(l);const i=t.XpG();return e.Njj(i.onInput(o))}),t.SdG(1),t.k0s(),t.nVh(2,g,1,3,"cue-svg-icon",4)}if(2&p){const l=t.XpG();t.Aen(l.getStyles()),t.xc7("font-style",l.italic()?"italic":"normal"),t.Y8G("contentEditable",l.editable()),t.R7$(2),t.vxM(l.info()?2:-1)}}let y=(()=>{class p{_inlineInput=(0,a.sbv)(f.InlineInput);hasInlineInput=(0,r.EW)(()=>!!this._inlineInput());as=(0,a.hFB)("div");size=(0,a.hFB)("m");weight=(0,a.hFB)("regular");align=(0,a.hFB)("start");noWrap=(0,a.hFB)(!1);italic=(0,a.hFB)(!1);innerHTML=(0,a.hFB)(null);info=(0,a.hFB)("");editable=(0,a.hFB)(!1);change=(0,a.CGW)();onInput(l){this.editable()&&this.change.emit(l.target.innerText)}getStyles=(0,r.EW)(()=>`\n font-family: var(--cue-font-family);\n font-size: var(--cue-font-${this.size()}-size);\n line-height: var(--cue-font-${this.size()}-line-height);\n letter-spacing: var(--cue-font-${this.size()}-letter-spacing);\n font-weight: var(--cue-font-weight-${this.weight()});\n text-align: ${this.align()};\n ${this.noWrap()?"white-space: nowrap; overflow: hidden; text-overflow: ellipsis;":""}\n `);infoSize=(0,r.EW)(()=>{switch(this.size()){case"xs":return 10;case"s":return 12;case"m":default:return 14;case"l":return 16;case"xl":return 18}});static \u0275fac=function(n){return new(n||p)};static \u0275cmp=t.VBU({type:p,selectors:[["cue-typography"]],contentQueries:function(n,o,i){1&n&&t.C6U(i,o._inlineInput,f.InlineInput,5),2&n&&t.NyB()},inputs:{as:[1,"as"],size:[1,"size"],weight:[1,"weight"],align:[1,"align"],noWrap:[1,"noWrap"],italic:[1,"italic"],innerHTML:[1,"innerHTML"],info:[1,"info"],editable:[1,"editable"]},outputs:{change:"change"},ngContentSelectors:c,decls:3,vars:2,consts:[["justify","start","align","center",3,"noGap"],[3,"style","font-style","innerHTML","contentEditable"],[3,"input","blur","innerHTML","contentEditable"],[3,"input","blur","contentEditable"],["name","info",2,"margin-left","4px","vertical-align","super","cursor","pointer",3,"cueTooltip","--cue-icon-width"],["name","info",2,"margin-left","4px","vertical-align","super","cursor","pointer",3,"cueTooltip"]],template:function(n,o){1&n&&(t.NAR(),t.j41(0,"cue-flexcontainer",0),t.nVh(1,_,1,6,"div",1)(2,h,3,6),t.k0s()),2&n&&(t.Y8G("noGap",!0),t.R7$(),t.vxM(o.innerHTML()?1:2))},dependencies:[m.A,d.d,M.FlexContainer],encapsulation:2})}return p})()}}]);
|
package/928.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[928],{928(z,m,a){a.d(m,{CueProjectList:()=>k});var v=a(467),i=a(7705),c=a(5802),l=a(2271),h=a(2611),j=a(8017),f=a(6455),S=a(8334),u=a(2306),_=a(140),g=a(58),y=a(5187),p=a(1951),t=a(5547);function w(n,d){if(1&n){const e=t.RV6();t.j41(0,"cue-tabs",0)(1,"cue-tab",1)(2,"cue-ag-grid",2),t.bIt("selectedRows",function(s){c.eBV(e);const r=t.XpG();return c.Njj(r.onSelectedRows(s))}),t.k0s()(),t.j41(3,"cue-tab",3)(4,"cue-map",4),t.bIt("clickedFeature",function(s){c.eBV(e);const r=t.XpG();return c.Njj(r.onMapFeatureClick(s))}),t.k0s()()()}if(2&n){const e=t.XpG();t.Y8G("variant",e.variant()),t.R7$(2),t.Y8G("rowData",e.projects())("columnDefs",e.columnDefs)("rowSelection",e.rowSelection)("showPaginator",!1)("size",e.size())("overlaySettings",e.overlaySettings())("overlayActions",e.overlayActions()),t.R7$(2),t.Y8G("layers",e.mapLayers())("settings",e._mapSettings())("zoomToFit",!0)("hoverTooltipFn",e.mapHoverTooltipFn)}}function x(n,d){if(1&n){const e=t.RV6();t.j41(0,"cue-card",5)(1,"cue-ag-grid",7),t.bIt("selectedRows",function(s){c.eBV(e);const r=t.XpG(2);return c.Njj(r.onSelectedRows(s))}),t.k0s()()}if(2&n){const e=t.XpG(2);t.Y8G("variant",e._cardVariant())("padded",!1),t.R7$(),t.Y8G("rowData",e.projects())("columnDefs",e.columnDefs)("rowSelection",e.rowSelection)("showPaginator",!1)("size",e.size())}}function
|
|
1
|
+
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[928],{928(z,m,a){a.d(m,{CueProjectList:()=>k});var v=a(467),i=a(7705),c=a(5802),l=a(2271),h=a(2611),j=a(8017),f=a(6455),S=a(8334),u=a(2306),_=a(140),g=a(58),y=a(5187),p=a(1951),t=a(5547);function w(n,d){if(1&n){const e=t.RV6();t.j41(0,"cue-tabs",0)(1,"cue-tab",1)(2,"cue-ag-grid",2),t.bIt("selectedRows",function(s){c.eBV(e);const r=t.XpG();return c.Njj(r.onSelectedRows(s))}),t.k0s()(),t.j41(3,"cue-tab",3)(4,"cue-map",4),t.bIt("clickedFeature",function(s){c.eBV(e);const r=t.XpG();return c.Njj(r.onMapFeatureClick(s))}),t.k0s()()()}if(2&n){const e=t.XpG();t.Y8G("variant",e.variant()),t.R7$(2),t.Y8G("rowData",e.projects())("columnDefs",e.columnDefs)("rowSelection",e.rowSelection)("showPaginator",!1)("size",e.size())("overlaySettings",e.overlaySettings())("overlayActions",e.overlayActions()),t.R7$(2),t.Y8G("layers",e.mapLayers())("settings",e._mapSettings())("zoomToFit",!0)("hoverTooltipFn",e.mapHoverTooltipFn)}}function x(n,d){if(1&n){const e=t.RV6();t.j41(0,"cue-card",5)(1,"cue-ag-grid",7),t.bIt("selectedRows",function(s){c.eBV(e);const r=t.XpG(2);return c.Njj(r.onSelectedRows(s))}),t.k0s()()}if(2&n){const e=t.XpG(2);t.Y8G("variant",e._cardVariant())("padded",!1),t.R7$(),t.Y8G("rowData",e.projects())("columnDefs",e.columnDefs)("rowSelection",e.rowSelection)("showPaginator",!1)("size",e.size())}}function C(n,d){if(1&n){const e=t.RV6();t.j41(0,"cue-ag-grid",7),t.bIt("selectedRows",function(s){c.eBV(e);const r=t.XpG(2);return c.Njj(r.onSelectedRows(s))}),t.k0s()}if(2&n){const e=t.XpG(2);t.Y8G("rowData",e.projects())("columnDefs",e.columnDefs)("rowSelection",e.rowSelection)("showPaginator",!1)("size",e.size())}}function P(n,d){if(1&n&&t.nVh(0,x,2,7,"cue-card",5)(1,C,1,5,"cue-ag-grid",6),2&n){const e=t.XpG();t.vxM("none"!==e.variant()?0:1)}}let D=(()=>{class n{projects=(0,i.hFB)([]);mapSettings=(0,i.hFB)(new u.yY);variant=(0,i.hFB)("none");overlaySettings=(0,i.hFB)(new p.K);overlayActions=(0,i.hFB)([]);size=(0,i.hFB)("m");projectSelected=(0,i.CGW)();_cardVariant=(0,l.EW)(()=>this.variant());columnDefs=[{field:"name",headerName:"Project",flex:1}];rowSelection={mode:"singleRow",checkboxes:!1,enableClickSelection:!0};_mapSettings=(0,l.EW)(()=>({...this.mapSettings(),contextMenu:{showProperties:!1,showFlyTo:!1}}));mapHoverTooltipFn=e=>e.name??null;onSelectedRows(e){const o=e[0]?.id;o&&this.projectSelected.emit(o)}onMapFeatureClick(e){const o=e.feature.properties?.id;o&&this.projectSelected.emit(o)}hasLocations=(0,l.EW)(()=>this.projects().some(e=>!!e.location));mapLayers=(0,l.EW)(()=>{const e=this.projects().filter(s=>!!s.location);if(!e.length)return[];const o=new u.ux("Projects","projects");return o.collection=new _.o(e.flatMap(s=>{const r=(0,g.S)(s.location);return r?[{type:"Feature",geometry:(0,g.n)(r),properties:{name:s.name,id:s.id}}]:[]})),[o]});static \u0275fac=function(o){return new(o||n)};static \u0275cmp=t.VBU({type:n,selectors:[["cue-proj-list"]],inputs:{projects:[1,"projects"],mapSettings:[1,"mapSettings"],variant:[1,"variant"],overlaySettings:[1,"overlaySettings"],overlayActions:[1,"overlayActions"],size:[1,"size"]},outputs:{projectSelected:"projectSelected"},decls:2,vars:1,consts:[[2,"flex","1",3,"variant"],["label","List"],[3,"selectedRows","rowData","columnDefs","rowSelection","showPaginator","size","overlaySettings","overlayActions"],["label","Map"],[3,"clickedFeature","layers","settings","zoomToFit","hoverTooltipFn"],[2,"height","100%","width","100%",3,"variant","padded"],[3,"rowData","columnDefs","rowSelection","showPaginator","size"],[3,"selectedRows","rowData","columnDefs","rowSelection","showPaginator","size"]],template:function(o,s){1&o&&t.nVh(0,w,5,12,"cue-tabs",0)(1,P,2,1),2&o&&t.vxM(s.hasLocations()?0:1)},dependencies:[h.R,j.T,f.t,S.o,y.Card],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%}cue-tabs[_ngcontent-%COMP%]{flex:1}cue-ag-grid[_ngcontent-%COMP%]{flex:1}cue-map[_ngcontent-%COMP%]{flex:1;min-height:300px}"],changeDetection:0})}return n})();var M=a(5381),L=a(2245),b=a(7851),T=a(7293);function F(n,d){if(1&n&&(t.j41(0,"cue-flexcontainer",0)(1,"cue-typography",2),t.EFF(2),t.k0s()()),2&n){const e=t.XpG();t.R7$(2),t.SpI(" ",e.errorMessage()," ")}}function N(n,d){1&n&&t.nrm(0,"cue-logo-link",4)}function R(n,d){if(1&n){const e=t.RV6();t.j41(0,"div",1)(1,"cue-proj-list",3),t.bIt("projectSelected",function(s){c.eBV(e);const r=t.XpG();return c.Njj(r.projectSelected.emit(s))}),t.k0s(),t.nVh(2,N,1,0,"cue-logo-link",4),t.k0s()}if(2&n){const e=t.XpG();t.Y8G("cueLogoLoader","loading"===e.state()),t.R7$(),t.Y8G("projects",e.projects())("mapSettings",e.mapSettings())("variant",e.variant())("size",e.size())("overlaySettings",e._overlaySettings)("overlayActions",e._overlayActions),t.R7$(),t.vxM(e.showLogo()?2:-1)}}let k=(()=>{class n{sdkState=(0,i.hFB)(void 0);mapboxToken=(0,i.hFB)(void 0);variant=(0,i.hFB)("none");size=(0,i.hFB)("m");showLogo=(0,i.hFB)(!1,{transform:i.L39});projectSelected=(0,i.CGW)();state=(0,c.vPA)("idle");errorMessage=(0,c.vPA)(null);_rawProjects=(0,c.vPA)([]);mapSettings=(0,l.EW)(()=>({...new u.yY,mapboxToken:this.mapboxToken()}));projects=(0,l.EW)(()=>this._rawProjects().map(e=>({id:e.id,name:e.name,location:e.location??void 0})));_overlaySettings=Object.assign(new p.K,{mode:"row"});_overlayActions=[{label:"Open in Cue portal",icon:"external-link",action:e=>{const o=e.rowData.id,s=o?`https://cue.qaecy.com/home/project?p=${encodeURIComponent(o)}`:"https://cue.qaecy.com/home/projects";window.open(s,"_blank","noopener,noreferrer")}}];_lastCue;_inputWarningTimer;constructor(){this._inputWarningTimer=setTimeout(()=>{this.sdkState()?.cue||console.warn('[cue-project-list] Required input "sdkState" is not set or missing a `cue` property. Pass a { cue: Cue } object to enable project loading.')},3e3),(0,c.QZP)(()=>{const e=this.sdkState()?.cue;e!==this._lastCue&&(this._lastCue=e,e?this._loadProjects(e.projects):(this._rawProjects.set([]),this.state.set("idle"),this.errorMessage.set(null)))})}ngOnDestroy(){clearTimeout(this._inputWarningTimer)}_loadProjects(e){var o=this;return(0,v.A)(function*(){o.state.set("loading"),o.errorMessage.set(null);try{const s=yield e.listProjects();o._rawProjects.set(s),o.state.set("ready")}catch(s){console.error("[CueProjectList] Failed to load projects:",s),o.errorMessage.set(s instanceof Error?s.message:String(s)),o.state.set("error")}})()}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=t.VBU({type:n,selectors:[["cue-project-list"]],inputs:{sdkState:[1,"sdkState"],mapboxToken:[1,"mapboxToken"],variant:[1,"variant"],size:[1,"size"],showLogo:[1,"showLogo"]},outputs:{projectSelected:"projectSelected"},decls:2,vars:1,consts:[["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[2,"position","relative","height","100%","width","100%",3,"cueLogoLoader"],[2,"color","#c44","font-size","13px"],[2,"height","100%",3,"projectSelected","projects","mapSettings","variant","size","overlaySettings","overlayActions"],[2,"position","absolute","top","12px","right","12px","z-index","5"]],template:function(o,s){1&o&&t.nVh(0,F,3,1,"cue-flexcontainer",0)(1,R,3,8,"div",1),2&o&&t.vxM("error"===s.state()?0:1)},dependencies:[D,M.FlexContainer,L.Typography,b.k,T.x],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return n})()}}]);
|
package/9396.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[9396],{9396(W,x,c){c.d(x,{CueContextViewer:()=>L});var p=c(467),d=c(7705),a=c(5802),r=c(2271),g=c(9376),v=c(4879),_=c(2839),f=c(6455),y=c(8334),C=c(9352),D=c(7851),e=c(5547);function I(n,l){1&n&&(e.j41(0,"div",1),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&n&&(e.R7$(),e.JRh(e.bMT(2,1,"components.contextViewer.infoNoContext")))}function w(n,l){if(1&n){const t=e.RV6();e.j41(0,"cue-tabs",2)(1,"cue-tab",5),e.nI1(2,"transloco"),e.j41(3,"cue-doc-list",6),e.bIt("clickedDocument",function(s){a.eBV(t);const i=e.XpG();return a.Njj(i.onDocumentClicked(s))}),e.k0s()(),e.j41(4,"cue-tab",5),e.nI1(5,"transloco"),e.j41(6,"cue-ent-list-inner",7),e.bIt("rowClicked",function(s){a.eBV(t);const i=e.XpG();return a.Njj(i.onEntityRowClicked(s))}),e.k0s()()()}if(2&n){const t=e.XpG();e.R7$(),e.Y8G("label",e.bMT(2,9,"components.contextViewer.tabDocuments")),e.R7$(2),e.Y8G("documentRefs",t.documentRefs())("documentData",t.documentData())("handlers",t._docHandlers())("variant",t.variant()),e.R7$(),e.Y8G("label",e.bMT(5,11,"components.contextViewer.tabEntities")),e.R7$(2),e.Y8G("entities",t.entityIris())("entityData",t.entityData())("handlers",t._entityHandlers())}}function b(n,l){if(1&n){const t=e.RV6();e.j41(0,"cue-doc-list",6),e.bIt("clickedDocument",function(s){a.eBV(t);const i=e.XpG();return a.Njj(i.onDocumentClicked(s))}),e.k0s()}if(2&n){const t=e.XpG();e.Y8G("documentRefs",t.documentRefs())("documentData",t.documentData())("handlers",t._docHandlers())("variant",t.variant())}}function M(n,l){if(1&n){const t=e.RV6();e.j41(0,"cue-ent-list-inner",8),e.bIt("rowClicked",function(s){a.eBV(t);const i=e.XpG();return a.Njj(i.onEntityRowClicked(s))}),e.k0s()}if(2&n){const t=e.XpG();e.Y8G("entities",t.entityIris())("entityData",t.entityData())("handlers",t._entityHandlers())}}function R(n,l){1&n&&(e.j41(0,"div",1),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&n&&(e.R7$(),e.JRh(e.bMT(2,1,"components.contextViewer.infoNoItems")))}let k=(()=>{class n{contextId=(0,d.hFB)(void 0);handlers=(0,d.hFB)(void 0);variant=(0,d.hFB)("none");contextDoc=(0,d.hFB)(void 0);documentData=(0,d.hFB)({});entityData=(0,d.hFB)({});itemRowClicked=(0,d.CGW)();loading=(0,r.EW)(()=>!!this.contextId()&&!this.contextDoc());_docItems=(0,r.EW)(()=>(this.contextDoc()?.items??[]).filter(t=>"document"===t.type));_entityItems=(0,r.EW)(()=>(this.contextDoc()?.items??[]).filter(t=>"entity"===t.type));hasDocuments=(0,r.EW)(()=>this._docItems().length>0);hasEntities=(0,r.EW)(()=>this._entityItems().length>0);hasBoth=(0,r.EW)(()=>this.hasDocuments()&&this.hasEntities());documentRefs=(0,r.EW)(()=>this._docItems().map(t=>({id:t.id,relevance:t.relevance})));entityIris=(0,r.EW)(()=>this._entityItems().map(t=>t.id));_docHandlers=(0,r.EW)(()=>({requestData:t=>this.handlers()?.requestDocumentData?.(t),requestDownload:t=>this.handlers()?.requestDownloadDocument?.(t),requestOpen:(t,o)=>this.handlers()?.requestOpenDocument?.(t,o),requestOpenInDir:(t,o)=>this.handlers()?.requestOpenDocumentInDir?.(t,o)}));_entityHandlers=(0,r.EW)(()=>({requestData:(t,o)=>this.handlers()?.requestEntityData?.(t,o),requestOpen:t=>this.handlers()?.requestOpenEntity?.(t)}));onEntityRowClicked({row:t}){this.itemRowClicked.emit({type:"entity",row:t,index:this._originalIndex(t.entity)})}onDocumentClicked(t){this.itemRowClicked.emit({type:"document",row:t,index:this._originalIndex(t.id)})}_originalIndex(t){return(this.contextDoc()?.items??[]).findIndex(o=>o.id===t)}constructor(){(0,a.QZP)(()=>{const t=this.contextId();t&&this.handlers()?.requestContext?.(t)})}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["cue-context-viewer-inner"]],inputs:{contextId:[1,"contextId"],handlers:[1,"handlers"],variant:[1,"variant"],contextDoc:[1,"contextDoc"],documentData:[1,"documentData"],entityData:[1,"entityData"]},outputs:{itemRowClicked:"itemRowClicked"},decls:7,vars:5,consts:[[2,"position","relative","height","100%","width","100%",3,"cueLogoLoader","cueLogoLoaderMessage"],[1,"cv-status"],[2,"height","100%"],[3,"documentRefs","documentData","handlers","variant"],[2,"height","400px",3,"entities","entityData","handlers"],[3,"label"],[3,"clickedDocument","documentRefs","documentData","handlers","variant"],[2,"height","100%",3,"rowClicked","entities","entityData","handlers"],[2,"height","400px",3,"rowClicked","entities","entityData","handlers"]],template:function(o,s){1&o&&(e.j41(0,"div",0),e.nI1(1,"transloco"),e.nVh(2,I,3,3,"div",1)(3,w,7,13,"cue-tabs",2)(4,b,1,4,"cue-doc-list",3)(5,M,1,3,"cue-ent-list-inner",4)(6,R,3,3,"div",1),e.k0s()),2&o&&(e.Y8G("cueLogoLoader",s.loading())("cueLogoLoaderMessage",e.bMT(1,3,"components.contextViewer.infoLoading")),e.R7$(2),e.vxM(s.contextDoc()?s.hasBoth()?3:s.hasDocuments()?4:s.hasEntities()?5:6:2))},dependencies:[v.g,_.u,f.t,y.o,D.k,C.Kj],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.cv-status[_ngcontent-%COMP%]{padding:16px;color:var(--cue-color-midgray, #888);font-size:13px}"],changeDetection:0})}return n})();var V=c(5381),j=c(2245),N=c(7293);function E(n,l){if(1&n&&(e.j41(0,"cue-flexcontainer",0)(1,"cue-typography",2),e.EFF(2),e.k0s()()),2&n){const t=e.XpG();e.R7$(2),e.SpI(" ",t.errorMessage()," ")}}function T(n,l){1&n&&(e.j41(0,"cue-flexcontainer",0)(1,"cue-typography",3),e.EFF(2," No project connected. "),e.k0s()())}function G(n,l){if(1&n&&e.nrm(0,"cue-logo-link",5),2&n){const t=e.XpG(2);e.Y8G("projectId",t.projectId())}}function F(n,l){if(1&n){const t=e.RV6();e.j41(0,"div",1)(1,"cue-context-viewer-inner",4),e.bIt("itemRowClicked",function(s){a.eBV(t);const i=e.XpG();return a.Njj(i.itemRowClicked.emit(s))}),e.k0s(),e.nVh(2,G,1,1,"cue-logo-link",5),e.k0s()}if(2&n){const t=e.XpG();e.Y8G("cueLogoLoader","loading"===t.state()),e.R7$(),e.Y8G("contextDoc",t.contextDoc())("documentData",t.documentData())("entityData",t.entityData())("handlers",t._handlers())("variant",t.variant()),e.R7$(),e.vxM(t.showLogo()?2:-1)}}function B(n){return{id:n.id,contentIRI:n.contentIRI??n.id,path:n.path??"",suffix:n.suffix??"",size:n.size??0,tags:n.tags??[],summary:n.summary??"",categories:n.categories??[],subject:n.subject,providerId:n.providerId,relevance:0}}let L=(()=>{class n{cue=(0,d.hFB)(void 0);projectId=(0,d.hFB)(void 0);contextId=(0,d.hFB)(void 0);variant=(0,d.hFB)("none");showLogo=(0,d.hFB)(!1,{transform:d.L39});itemRowClicked=(0,d.CGW)();state=(0,a.vPA)("idle");errorMessage=(0,a.vPA)(null);contextDoc=(0,a.vPA)(void 0);documentData=(0,a.vPA)({});entityData=(0,a.vPA)({});_documents=(0,a.vPA)(void 0);_entities=(0,a.vPA)(void 0);_unsubDocs;_unsubEntities;_inputWarningTimer;_handlers=(0,r.EW)(()=>({requestDocumentData:t=>this._documents()?.requestDocumentData(t),requestEntityData:(t,o)=>this._entities()?.requestEntityData(t,o)}));constructor(){this._inputWarningTimer=setTimeout(()=>{this.cue()||console.warn('[cue-context-viewer] Required input "cue" is not set. Pass an authenticated Cue SDK instance.'),this.projectId()||console.warn('[cue-context-viewer] Required input "projectId" is not set.'),this.contextId()||console.warn('[cue-context-viewer] Required input "contextId" is not set.')},3e3),(0,a.QZP)(()=>{this._load(this.cue(),this.projectId(),this.contextId())})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._teardown()}_load(t,o,s){var i=this;return(0,p.A)(function*(){if(i._teardown(),i.contextDoc.set(void 0),i.documentData.set({}),i.entityData.set({}),t&&o&&s){i.state.set("loading"),i.errorMessage.set(null);try{const u=yield t.api.contexts.getContext(o,s);i.contextDoc.set(u);const m=new g.f$(t.api,o),h=new g.g8(t.api,o);i._documents.set(m),i._entities.set(h),i._unsubDocs=m.documentInfoMap.subscribe(()=>i._syncDocumentData(m)),i._unsubEntities=h.entityInfoMap.subscribe(()=>i._syncEntityData(h)),i.state.set("ready")}catch(u){console.error("[cue-context-viewer] Failed to load context",u),i.errorMessage.set(u instanceof Error?u.message:"Failed to load context."),i.state.set("error")}}else i.state.set("idle")})()}_syncDocumentData(t){const o=t.documentInfoMap.get(),s={};for(const[i,u]of Object.entries(o))s[i]=B(u);this.documentData.set(s)}_syncEntityData(t){const o=t.entityInfoMap.get(),s={};for(const[i,u]of Object.entries(o))s[i]={value:u.value??i,categories:u.categories??[],mentionCount:u.mentionCount};this.entityData.set(s)}_teardown(){this._unsubDocs?.(),this._unsubEntities?.(),this._unsubDocs=void 0,this._unsubEntities=void 0,this._documents.set(void 0),this._entities.set(void 0)}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["cue-context-viewer"]],inputs:{cue:[1,"cue"],projectId:[1,"projectId"],contextId:[1,"contextId"],variant:[1,"variant"],showLogo:[1,"showLogo"]},outputs:{itemRowClicked:"itemRowClicked"},decls:3,vars:1,consts:[["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[2,"position","relative","height","100%","width","100%",3,"cueLogoLoader"],[2,"color","#c44","font-size","13px"],[2,"color","#9ca3af","font-size","13px"],[2,"height","100%",3,"itemRowClicked","contextDoc","documentData","entityData","handlers","variant"],[2,"position","absolute","top","12px","left","12px","z-index","5",3,"projectId"]],template:function(o,s){1&o&&e.nVh(0,E,3,1,"cue-flexcontainer",0)(1,T,3,0,"cue-flexcontainer",0)(2,F,3,7,"div",1),2&o&&e.vxM("error"===s.state()?0:"idle"===s.state()?1:2)},dependencies:[k,V.n,j.Typography,D.k,N.x],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return n})()}}]);
|
|
1
|
+
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[9396],{9396(U,p,c){c.d(p,{CueContextViewer:()=>A});var _=c(467),u=c(7705),a=c(5802),d=c(2271),h=c(8645),v=c(2283),x=c(2839),f=c(4631),y=c(1625),C=c(6455),I=c(8334),w=c(9352),D=c(7851),t=c(5547);function b(n,r){1&n&&(t.j41(0,"div",1),t.EFF(1),t.nI1(2,"transloco"),t.k0s()),2&n&&(t.R7$(),t.JRh(t.bMT(2,1,"components.contextViewer.infoNoContext")))}function M(n,r){if(1&n){const e=t.RV6();t.j41(0,"cue-tabs",2)(1,"cue-tab",7),t.nI1(2,"transloco"),t.j41(3,"cue-doc-list",8),t.bIt("clickedDocument",function(s){a.eBV(e);const o=t.XpG();return a.Njj(o.onDocumentClicked(s))}),t.k0s()(),t.j41(4,"cue-tab",7),t.nI1(5,"transloco"),t.j41(6,"cue-ent-list-inner",9),t.bIt("rowClicked",function(s){a.eBV(e);const o=t.XpG();return a.Njj(o.onEntityRowClicked(s))}),t.k0s()()()}if(2&n){const e=t.XpG();t.R7$(),t.Y8G("label",t.bMT(2,9,"components.contextViewer.tabDocuments")),t.R7$(2),t.Y8G("documentRefs",e.documentRefs())("documentData",e.documentData())("handlers",e._docHandlers())("variant",e.variant()),t.R7$(),t.Y8G("label",t.bMT(5,11,"components.contextViewer.tabEntities")),t.R7$(2),t.Y8G("entities",e.entityIris())("entityData",e.entityData())("handlers",e._entityHandlers())}}function E(n,r){if(1&n&&t.nrm(0,"cue-document-info",3),2&n){const e=t.XpG();t.Y8G("subject",e.singleDocumentSubject())("handlers",e._docInfoHandlers)("contentCategories",e.singleDocument().categories)("fileLocations",e.singleDocumentFileLocations())}}function j(n,r){if(1&n){const e=t.RV6();t.j41(0,"cue-doc-list",8),t.bIt("clickedDocument",function(s){a.eBV(e);const o=t.XpG();return a.Njj(o.onDocumentClicked(s))}),t.k0s()}if(2&n){const e=t.XpG();t.Y8G("documentRefs",e.documentRefs())("documentData",e.documentData())("handlers",e._docHandlers())("variant",e.variant())}}function V(n,r){if(1&n&&t.nrm(0,"cue-entity-info",5),2&n){const e=t.XpG();t.Y8G("entity",e.singleEntity())("handlers",e._entityInfoHandlers)}}function N(n,r){if(1&n){const e=t.RV6();t.j41(0,"cue-ent-list-inner",10),t.bIt("rowClicked",function(s){a.eBV(e);const o=t.XpG();return a.Njj(o.onEntityRowClicked(s))}),t.k0s()}if(2&n){const e=t.XpG();t.Y8G("entities",e.entityIris())("entityData",e.entityData())("handlers",e._entityHandlers())}}function R(n,r){1&n&&(t.j41(0,"div",1),t.EFF(1),t.nI1(2,"transloco"),t.k0s()),2&n&&(t.R7$(),t.JRh(t.bMT(2,1,"components.contextViewer.infoNoItems")))}let k=(()=>{class n{contextId=(0,u.hFB)(void 0);handlers=(0,u.hFB)(void 0);variant=(0,u.hFB)("none");contextDoc=(0,u.hFB)(void 0);documentData=(0,u.hFB)({});entityData=(0,u.hFB)({});itemRowClicked=(0,u.CGW)();loading=(0,d.EW)(()=>!!this.contextId()&&!this.contextDoc());_docItems=(0,d.EW)(()=>(this.contextDoc()?.items??[]).filter(e=>"document"===e.type));_entityItems=(0,d.EW)(()=>(this.contextDoc()?.items??[]).filter(e=>"entity"===e.type));hasDocuments=(0,d.EW)(()=>this._docItems().length>0);hasEntities=(0,d.EW)(()=>this._entityItems().length>0);hasBoth=(0,d.EW)(()=>this.hasDocuments()&&this.hasEntities());documentRefs=(0,d.EW)(()=>this._docItems().map(e=>({id:e.id,relevance:e.relevance})));entityIris=(0,d.EW)(()=>this._entityItems().map(e=>e.id));singleDocument=(0,d.EW)(()=>{if(1===this._docItems().length)return this.documentData()[this._docItems()[0].id]});isSingleDocument=(0,d.EW)(()=>this.hasDocuments()&&!this.hasEntities()&&!!this.singleDocument());singleDocumentSubject=(0,d.EW)(()=>this.singleDocument()?.subject||this.singleDocument()?.path||"");singleDocumentFileLocations=(0,d.EW)(()=>{const e=this.singleDocument();return e?[{iri:e.id,path:e.path,providerId:e.providerId}]:[]});_docInfoHandlers={};singleEntity=(0,d.EW)(()=>{if(1!==this._entityItems().length)return;const e=this._entityItems()[0].id,i=this.entityData()[e];return i?{iri:e,value:i.value,categories:i.categories}:void 0});isSingleEntity=(0,d.EW)(()=>this.hasEntities()&&!this.hasDocuments()&&!!this.singleEntity());_entityInfoHandlers={};_docHandlers=(0,d.EW)(()=>({requestData:e=>this.handlers()?.requestDocumentData?.(e),requestDownload:e=>this.handlers()?.requestDownloadDocument?.(e),requestOpen:(e,i)=>this.handlers()?.requestOpenDocument?.(e,i),requestOpenInDir:(e,i)=>this.handlers()?.requestOpenDocumentInDir?.(e,i)}));_entityHandlers=(0,d.EW)(()=>({requestData:(e,i)=>this.handlers()?.requestEntityData?.(e,i),requestOpen:e=>this.handlers()?.requestOpenEntity?.(e)}));onEntityRowClicked({row:e}){this.itemRowClicked.emit({type:"entity",row:e,index:this._originalIndex(e.entity)})}onDocumentClicked(e){this.itemRowClicked.emit({type:"document",row:e,index:this._originalIndex(e.id)})}_originalIndex(e){return(this.contextDoc()?.items??[]).findIndex(i=>i.id===e)}constructor(){(0,a.QZP)(()=>{const e=this.contextId();e&&this.handlers()?.requestContext?.(e)})}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=t.VBU({type:n,selectors:[["cue-context-viewer-inner"]],inputs:{contextId:[1,"contextId"],handlers:[1,"handlers"],variant:[1,"variant"],contextDoc:[1,"contextDoc"],documentData:[1,"documentData"],entityData:[1,"entityData"]},outputs:{itemRowClicked:"itemRowClicked"},decls:9,vars:5,consts:[[2,"position","relative","height","100%","width","100%",3,"cueLogoLoader","cueLogoLoaderMessage"],[1,"cv-status"],[2,"height","100%"],[3,"subject","handlers","contentCategories","fileLocations"],[3,"documentRefs","documentData","handlers","variant"],[3,"entity","handlers"],[2,"height","400px",3,"entities","entityData","handlers"],[3,"label"],[3,"clickedDocument","documentRefs","documentData","handlers","variant"],[2,"height","100%",3,"rowClicked","entities","entityData","handlers"],[2,"height","400px",3,"rowClicked","entities","entityData","handlers"]],template:function(i,s){1&i&&(t.j41(0,"div",0),t.nI1(1,"transloco"),t.nVh(2,b,3,3,"div",1)(3,M,7,13,"cue-tabs",2)(4,E,1,4,"cue-document-info",3)(5,j,1,4,"cue-doc-list",4)(6,V,1,2,"cue-entity-info",5)(7,N,1,3,"cue-ent-list-inner",6)(8,R,3,3,"div",1),t.k0s()),2&i&&(t.Y8G("cueLogoLoader",s.loading())("cueLogoLoaderMessage",t.bMT(1,3,"components.contextViewer.infoLoading")),t.R7$(2),t.vxM(s.contextDoc()?s.hasBoth()?3:s.isSingleDocument()?4:s.hasDocuments()?5:s.isSingleEntity()?6:s.hasEntities()?7:8:2))},dependencies:[v.g,x.u,f.G,y.U,C.t,I.o,D.k,w.Kj],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.cv-status[_ngcontent-%COMP%]{padding:16px;color:var(--cue-color-midgray, #888);font-size:13px}"],changeDetection:0})}return n})();var G=c(5381),T=c(2245),L=c(7293),F=c(7727),W=c(3202);function B(n,r){if(1&n&&(t.j41(0,"cue-flexcontainer",0)(1,"cue-typography",2),t.EFF(2),t.k0s()()),2&n){const e=t.XpG();t.R7$(2),t.SpI(" ",e.errorMessage()," ")}}function X(n,r){1&n&&(t.j41(0,"cue-flexcontainer",0)(1,"cue-typography",3),t.EFF(2," No project connected. "),t.k0s()())}function Y(n,r){if(1&n&&t.nrm(0,"cue-document-viewer-wc",4),2&n){const e=t.XpG(2);t.Y8G("cue",e.cue())("projectId",e.projectId())("uuid",r)("showLogo",e.showLogo())("variant",e.variant())}}function P(n,r){if(1&n&&t.nrm(0,"cue-entity-viewer-wc",5),2&n){const e=t.XpG(2);t.Y8G("cue",e.cue())("projectId",e.projectId())("iri",r)("showLogo",e.showLogo())("variant",e.variant())}}function H(n,r){if(1&n&&t.nrm(0,"cue-logo-link",7),2&n){const e=t.XpG(3);t.Y8G("projectId",e.projectId())}}function O(n,r){if(1&n){const e=t.RV6();t.j41(0,"cue-context-viewer-inner",6),t.bIt("itemRowClicked",function(s){a.eBV(e);const o=t.XpG(2);return a.Njj(o.itemRowClicked.emit(s))}),t.k0s(),t.nVh(1,H,1,1,"cue-logo-link",7)}if(2&n){const e=t.XpG(2);t.Y8G("contextDoc",e.contextDoc())("documentData",e.documentData())("entityData",e.entityData())("handlers",e._handlers())("variant",e.variant()),t.R7$(),t.vxM(e.showLogo()?1:-1)}}function S(n,r){if(1&n&&(t.j41(0,"div",1),t.nVh(1,Y,1,5,"cue-document-viewer-wc",4)(2,P,1,5,"cue-entity-viewer-wc",5)(3,O,2,6),t.k0s()),2&n){let e;const i=t.XpG();t.Y8G("cueLogoLoader","loading"===i.state()),t.R7$(),t.vxM((e=i._singleDocumentUuid())?1:(e=i._singleEntityIri())?2:3,e)}}function $(n){return{id:n.id,contentIRI:n.contentIRI??n.id,path:n.path??"",suffix:n.suffix??"",size:n.size??0,tags:n.tags??[],summary:n.summary??"",categories:n.categories??[],subject:n.subject,providerId:n.providerId,relevance:0}}let A=(()=>{class n{cue=(0,u.hFB)(void 0);projectId=(0,u.hFB)(void 0);contextId=(0,u.hFB)(void 0);variant=(0,u.hFB)("none");showLogo=(0,u.hFB)(!1,{transform:u.L39});itemRowClicked=(0,u.CGW)();state=(0,a.vPA)("idle");errorMessage=(0,a.vPA)(null);contextDoc=(0,a.vPA)(void 0);documentData=(0,a.vPA)({});entityData=(0,a.vPA)({});_documents=(0,a.vPA)(void 0);_entities=(0,a.vPA)(void 0);_unsubDocs;_unsubEntities;_inputWarningTimer;_singleDocumentUuid=(0,d.EW)(()=>{const e=this.contextDoc()?.items??[],i=e.filter(o=>"document"===o.type),s=e.filter(o=>"entity"===o.type);return 1===i.length&&0===s.length?i[0].id:void 0});_singleEntityIri=(0,d.EW)(()=>{const e=this.contextDoc()?.items??[],i=e.filter(o=>"document"===o.type),s=e.filter(o=>"entity"===o.type);return 1===s.length&&0===i.length?s[0].id:void 0});_handlers=(0,d.EW)(()=>({requestDocumentData:e=>this._documents()?.requestDocumentData(e),requestEntityData:(e,i)=>this._entities()?.requestEntityData(e,i)}));constructor(){this._inputWarningTimer=setTimeout(()=>{this.cue()||console.warn('[cue-context-viewer] Required input "cue" is not set. Pass an authenticated Cue SDK instance.'),this.projectId()||console.warn('[cue-context-viewer] Required input "projectId" is not set.'),this.contextId()||console.warn('[cue-context-viewer] Required input "contextId" is not set.')},3e3),(0,a.QZP)(()=>{this._load(this.cue(),this.projectId(),this.contextId())})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._teardown()}_load(e,i,s){var o=this;return(0,_.A)(function*(){if(o._teardown(),o.contextDoc.set(void 0),o.documentData.set({}),o.entityData.set({}),e&&i&&s){o.state.set("loading"),o.errorMessage.set(null);try{const l=yield e.api.contexts.getContext(i,s);o.contextDoc.set(l);const m=new h.f$(e.api,i),g=new h.g8(e.api,i);o._documents.set(m),o._entities.set(g),o._unsubDocs=m.documentInfoMap.subscribe(()=>o._syncDocumentData(m)),o._unsubEntities=g.entityInfoMap.subscribe(()=>o._syncEntityData(g)),o.state.set("ready")}catch(l){console.error("[cue-context-viewer] Failed to load context",l),o.errorMessage.set(l instanceof Error?l.message:"Failed to load context."),o.state.set("error")}}else o.state.set("idle")})()}_syncDocumentData(e){const i=e.documentInfoMap.get(),s={};for(const[o,l]of Object.entries(i))s[o]=$(l);this.documentData.set(s)}_syncEntityData(e){const i=e.entityInfoMap.get(),s={};for(const[o,l]of Object.entries(i))s[o]={value:l.value??o,categories:l.categories??[],mentionCount:l.mentionCount};this.entityData.set(s)}_teardown(){this._unsubDocs?.(),this._unsubEntities?.(),this._unsubDocs=void 0,this._unsubEntities=void 0,this._documents.set(void 0),this._entities.set(void 0)}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=t.VBU({type:n,selectors:[["cue-context-viewer"]],inputs:{cue:[1,"cue"],projectId:[1,"projectId"],contextId:[1,"contextId"],variant:[1,"variant"],showLogo:[1,"showLogo"]},outputs:{itemRowClicked:"itemRowClicked"},decls:3,vars:1,consts:[["direction","column","align","center","justify","center",2,"height","100%","width","100%","padding","8px"],[2,"position","relative","height","100%","width","100%",3,"cueLogoLoader"],[2,"color","#c44","font-size","13px"],[2,"color","#9ca3af","font-size","13px"],[2,"height","100%","display","block",3,"cue","projectId","uuid","showLogo","variant"],[2,"height","100%","display","block",3,"cue","projectId","iri","showLogo","variant"],[2,"height","100%",3,"itemRowClicked","contextDoc","documentData","entityData","handlers","variant"],[2,"position","absolute","top","12px","left","12px","z-index","5",3,"projectId"]],template:function(i,s){1&i&&t.nVh(0,B,3,1,"cue-flexcontainer",0)(1,X,3,0,"cue-flexcontainer",0)(2,S,4,2,"div",1),2&i&&t.vxM("error"===s.state()?0:"idle"===s.state()?1:2)},dependencies:[k,G.FlexContainer,T.Typography,D.k,L.x,F.CueDocumentViewer,W.CueEntityViewer],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return n})()}}]);
|
package/9707.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[9695,9707],{5448(R,O,_){"use strict";_.d(O,{ButtonLabel:()=>D});var g=_(7705),x=_(2245),u=_(5547);const e=["*"];let D=(()=>{class p{fontSize=(0,g.hFB)("m");italic=(0,g.hFB)(!1);noWrap=(0,g.hFB)(!0);static \u0275fac=function(b){return new(b||p)};static \u0275cmp=u.VBU({type:p,selectors:[["cue-button-label"]],inputs:{fontSize:[1,"fontSize"],italic:[1,"italic"],noWrap:[1,"noWrap"]},ngContentSelectors:e,decls:3,vars:3,consts:[[3,"size","italic","noWrap"]],template:function(b,v){1&b&&(u.NAR(),u.j41(0,"div")(1,"cue-typography",0),u.SdG(2),u.k0s()()),2&b&&(u.R7$(),u.Y8G("size",v.fontSize())("italic",v.italic())("noWrap",v.noWrap()))},dependencies:[x.Typography],styles:["div[_ngcontent-%COMP%]{transform:translateY(.05em)}"]})}return p})()},9695(R,O,_){"use strict";_.d(O,{Switch:()=>p});var g=_(7705),x=_(29),u=_(5547);function e(d,s){if(1&d&&u.nrm(0,"cue-svg-icon",2),2&d){const b=u.XpG();u.Y8G("name",b.iconChecked())}}function D(d,s){if(1&d&&u.nrm(0,"cue-svg-icon",2),2&d){const b=u.XpG();u.Y8G("name",b.icon())}}let p=(()=>{class d{size=(0,g.hFB)("m");icon=(0,g.hFB)(void 0);iconChecked=(0,g.hFB)(void 0);disabled=(0,g.hFB)(!1);checked=(0,g.geq)(!1);toggleChange=(0,g.CGW)();toggle(){this.checked.set(!this.checked()),this.toggleChange.emit(this.checked())}static \u0275fac=function(v){return new(v||d)};static \u0275cmp=u.VBU({type:d,selectors:[["cue-input-switch"]],hostVars:5,hostBindings:function(v,M){2&v&&(u.BMQ("size",M.size()),u.AVh("checked",M.checked())("disabled",M.disabled()))},inputs:{size:[1,"size"],icon:[1,"icon"],iconChecked:[1,"iconChecked"],disabled:[1,"disabled"],checked:[1,"checked"]},outputs:{checked:"checkedChange",toggleChange:"toggleChange"},decls:4,vars:3,consts:[["type","checkbox",3,"click","checked","disabled"],[1,"indicator"],[3,"name"]],template:function(v,M){1&v&&(u.j41(0,"input",0),u.bIt("click",function(){return M.toggle()}),u.k0s(),u.j41(1,"div",1),u.nVh(2,e,1,1,"cue-svg-icon",2)(3,D,1,1,"cue-svg-icon",2),u.k0s()),2&v&&(u.Y8G("checked",M.checked())("disabled",M.disabled()),u.R7$(2),u.vxM(M.checked()&&M.iconChecked()?2:M.icon()?3:-1))},dependencies:[x.A],styles:["[_nghost-%COMP%]{--cue-input-switch-height: 18px;--cue-input-switch-width: calc(var(--cue-input-switch-height) * 1.7);--cue-input-switch-inset: 2px;--cue-input-switch-indicator-width: calc( var(--cue-input-switch-height) - (2 * var(--cue-input-switch-inset)) );--cue-input-switch-icon-width: calc( var(--cue-input-switch-indicator-width) - (2 * var(--cue-input-switch-inset)) );display:block;flex-shrink:0;position:relative;height:var(--cue-input-switch-height);width:var(--cue-input-switch-width);border-radius:var(--cue-input-switch-height);--cue-icon-width: var(--cue-input-switch-icon-width);background:var(--cue-input-switch-background);transition:background-color .4s ease}[size=xs][_nghost-%COMP%]{--cue-input-switch-height: 12px;--cue-input-switch-inset: 1px}[size=s][_nghost-%COMP%]{--cue-input-switch-height: 14px;--cue-input-switch-inset: 1px}[size=m][_nghost-%COMP%]{--cue-input-switch-height: 18px;--cue-input-switch-inset: 2px}[size=l][_nghost-%COMP%]{--cue-input-switch-height: 22px;--cue-input-switch-inset: 3px}[size=xl][_nghost-%COMP%]{--cue-input-switch-height: 28px;--cue-input-switch-inset: 3px}@container cue-container (width < 20em){[_nghost-%COMP%]{--cue-input-switch-height: 16px}[size=xs][_nghost-%COMP%]{--cue-input-switch-height: 10px}[size=s][_nghost-%COMP%]{--cue-input-switch-height: 12px}[size=m][_nghost-%COMP%]{--cue-input-switch-height: 16px}[size=l][_nghost-%COMP%]{--cue-input-switch-height: 18px}[size=xl][_nghost-%COMP%]{--cue-input-switch-height: 20px}}.checked[_nghost-%COMP%]{background:var(--cue-input-switch-checked-background)}.disabled[_nghost-%COMP%]{background:var(--cue-input-switch-disabled-background);cursor:default}[_nghost-%COMP%] .indicator[_ngcontent-%COMP%]{pointer-events:none;position:absolute;left:var(--cue-input-switch-inset);top:var(--cue-input-switch-inset);width:var(--cue-input-switch-indicator-width);aspect-ratio:1;border-radius:50%;display:flex;align-items:center;justify-content:center;background-color:var(--cue-input-switch-indicator-background);color:var(--cue-input-switch-indicator-foreground);transition:left .4s ease,background-color .4s ease,color .4s ease}.checked[_nghost-%COMP%] .indicator[_ngcontent-%COMP%]{left:calc(var(--cue-input-switch-width) - var(--cue-input-switch-inset) - var( --cue-input-switch-indicator-width ));background:var(--cue-input-switch-checked-indicator-background);color:var(--cue-input-switch-checked-indicator-foreground)}.disabled[_nghost-%COMP%] .indicator[_ngcontent-%COMP%]{background:var(--cue-input-switch-disabled-indicator-background);color:var(--cue-input-switch-disabled-indicator-foreground)}input[_ngcontent-%COMP%]{all:unset;position:absolute;inset:0;cursor:pointer;border-radius:var(--cue-input-switch-height)}input[_ngcontent-%COMP%]:focus-visible:not(:disabled) + .indicator[_ngcontent-%COMP%]{outline:1px solid var(--cue-input-switch-focus-color);outline-offset:2px}"]})}return d})()},5745(R,O,_){"use strict";_.d(O,{a:()=>I});var g=_(7705),x=_(5802),u=_(2271),e=_(5547);const D=["dialog"],p=["*",[["","modal-footer",""]]],d=["*","[modal-footer]"];function s(w,z){if(1&w&&(e.rj2(0,"h2",7),e.EFF(1),e.eux()),2&w){const l=e.XpG(3);e.R7$(),e.JRh(l.effectiveTitle())}}function b(w,z){if(1&w&&(e.rj2(0,"p",8),e.EFF(1),e.eux()),2&w){const l=e.XpG(3);e.R7$(),e.JRh(l.subtitle())}}function v(w,z){if(1&w){const l=e.RV6();e.rj2(0,"button",10),e.VwU("click",function(){x.eBV(l);const P=e.XpG(3);return x.Njj(P.onClose())}),x.qSk(),e.rj2(1,"svg",11),e.Hgh(2,"path",12),e.eux()()}}function M(w,z){if(1&w&&(e.rj2(0,"div",4)(1,"div",6),e.nVh(2,s,2,1,"h2",7),e.nVh(3,b,2,1,"p",8),e.eux(),e.nVh(4,v,3,0,"button",9),e.eux()),2&w){const l=e.XpG(2);e.R7$(2),e.vxM(l.effectiveTitle()?2:-1),e.R7$(),e.vxM(l.subtitle()?3:-1),e.R7$(),e.vxM(l.displayCloseBtn()?4:-1)}}function U(w,z){if(1&w&&(e.rj2(0,"div",3),e.VwU("click",function(S){return S.stopPropagation()}),e.nVh(1,M,5,3,"div",4),e.rj2(2,"div",5),e.SdG(3),e.eux(),e.SdG(4,1),e.eux()),2&w){const l=e.XpG();e.xc7("min-width",l.minWidth()),e.AVh("has-header",l.effectiveTitle()||l.displayCloseBtn()),e.R7$(),e.vxM(l.effectiveTitle()||l.displayCloseBtn()?1:-1)}}let I=(()=>{class w{visible=(0,g.geq)(!0);closeOnBackgroundClick=(0,g.hFB)(!0);displayCloseBtn=(0,g.hFB)(!0);label=(0,g.hFB)("");title=(0,g.hFB)("");subtitle=(0,g.hFB)("");minWidth=(0,g.hFB)();close=(0,g.CGW)();dialogRef=g.ebz.required("dialog");effectiveTitle=(0,u.EW)(()=>this.title()||this.label());constructor(){(0,x.QZP)(()=>{const l=this.dialogRef().nativeElement;this.visible()?l.open||l.showModal():l.open&&l.close()})}onBackdropClick(){this.closeOnBackgroundClick()&&this.onClose()}onClose(){this.visible.set(!1),this.close.emit()}static \u0275fac=function(S){return new(S||w)};static \u0275cmp=e.VBU({type:w,selectors:[["cue-modal"]],viewQuery:function(S,P){1&S&&e.wEZ(P.dialogRef,D,5),2&S&&e.NyB()},inputs:{visible:[1,"visible"],closeOnBackgroundClick:[1,"closeOnBackgroundClick"],displayCloseBtn:[1,"displayCloseBtn"],label:[1,"label"],title:[1,"title"],subtitle:[1,"subtitle"],minWidth:[1,"minWidth"]},outputs:{visible:"visibleChange",close:"close"},ngContentSelectors:d,decls:3,vars:1,consts:[["dialog",""],[1,"modal-dialog",3,"cancel","click"],[1,"panel",3,"has-header","minWidth"],[1,"panel",3,"click"],[1,"header"],[1,"body"],[1,"header-text"],[1,"modal-title"],[1,"modal-subtitle"],["type","button","aria-label","Close",1,"close-btn"],["type","button","aria-label","Close",1,"close-btn",3,"click"],["viewBox","0 0 256 256","xmlns","http://www.w3.org/2000/svg"],["fill","currentColor","d","M205.66 194.34a8 8 0 0 1-11.32 11.32L128 139.31l-66.34 66.35a8 8 0 0 1-11.32-11.32L116.69 128L61.34 72.66a8 8 0 0 1 11.32-11.32L128 116.69l66.34-66.35a8 8 0 0 1 11.32 11.32L139.31 128Z"]],template:function(S,P){1&S&&(e.NAR(p),e.rj2(0,"dialog",1,0),e.VwU("cancel",function(){return P.onClose()})("click",function(){return P.onBackdropClick()}),e.nVh(2,U,5,5,"div",2),e.eux()),2&S&&(e.R7$(2),e.vxM(P.visible()?2:-1))},styles:[".modal-dialog[_ngcontent-%COMP%]{padding:0;border:none;background:transparent;overflow:visible;margin:auto;outline:none;max-width:min(calc(100vw - 32px),80vw)}.modal-dialog[_ngcontent-%COMP%]::backdrop{background-color:var(--cue-modal-overlay-color, rgba(14, 24, 39, .55));-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.panel[_ngcontent-%COMP%]{background:var(--cue-default);color:var(--cue-defaultContrast);border-radius:24px;border:1px solid var(--cue-border-color);box-shadow:0 12px 48px #00000047;max-height:88vh;overflow-y:auto;overflow-x:hidden;box-sizing:border-box;scrollbar-width:thin}.header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:12px;padding:26px 26px 0;margin-bottom:20px}.header-text[_ngcontent-%COMP%]{flex:1}.modal-title[_ngcontent-%COMP%]{margin:0;font-size:20px;font-weight:700;letter-spacing:-.01em;font-family:var(--cue-font-family);color:var(--cue-defaultContrast)}.modal-subtitle[_ngcontent-%COMP%]{margin:5px 0 0;font-size:13px;color:var(--cue-color-midgray);letter-spacing:.02em;line-height:1.5}.close-btn[_ngcontent-%COMP%]{flex:none;width:34px;height:34px;border-radius:50%;border:none;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--cue-color-midgray);padding:0;margin-top:-4px;transition:background .15s,color .15s}.close-btn[_ngcontent-%COMP%]:hover{background:var(--cue-main-background);color:var(--cue-main-foreground)}.close-btn[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{width:18px;height:18px;display:block}.body[_ngcontent-%COMP%]{padding:26px}.has-header[_ngcontent-%COMP%] .body[_ngcontent-%COMP%]{padding-top:0}"]})}return w})()},2065(R,O,_){"use strict";function u(p,d,s="text/plain"){return function g(p,d="data.zip"){const s=document.createElement("a"),b=URL.createObjectURL(p);s.href=b,s.download=d,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(b)}(new Blob([p],{type:s}),d)}function e(p,d){const s=document.createElement("a");s.style.display="hidden",s.setAttribute("href",window.URL.createObjectURL(p)),s.setAttribute("download",d),document.body.appendChild(s),s.click(),s.remove()}_.d(O,{KE:()=>e,YN:()=>u})},7573(R,O,_){"use strict";_.d(O,{E:()=>g});const g={qcy:"https://dev.qaecy.com/ont#","qcy-e":"https://dev.qaecy.com/enum#","qcy-f":"https://dev.qaecy.com/functions#",obc:"https://w3id.org/obc#",dicc:"https://w3id.org/digitalconstruction/0.5/Contexts#",dicv:"https://w3id.org/digitalconstruction/0.5/Variables#",dice:"https://w3id.org/digitalconstruction/0.5/Entities#",dicp:"https://w3id.org/digitalconstruction/0.5/Processes#",dica:"https://w3id.org/digitalconstruction/0.5/Agents#",dici:"https://w3id.org/digitalconstruction/0.5/Information#",dicbm:"https://w3id.org/digitalconstruction/0.5/Materials#",dicob:"https://w3id.org/digitalconstruction/0.5/Occupancy#",dicl:"https://w3id.org/digitalconstruction/0.5/Lifecycle#",dices:"https://w3id.org/digitalconstruction/0.5/Energy#",dicu:"https://w3id.org/digitalconstruction/0.5/Units#",diclvl:"https://w3id.org/digitalconstruction/0.5/Levels#",dicstg:"https://w3id.org/digitalconstruction/0.5/Stages#"}},7374(R){R.exports=function(){"use strict";var _=6e4,g=36e5,x="millisecond",u="second",e="minute",D="hour",p="day",d="week",s="month",b="quarter",v="year",M="date",U="Invalid Date",I=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,z={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(c){var i=["th","st","nd","rd"],t=c%100;return"["+c+(i[(t-20)%10]||i[t]||i[0])+"]"}},l=function(c,i,t){var o=String(c);return!o||o.length>=i?c:""+Array(i+1-o.length).join(t)+c},S={s:l,z:function(c){var i=-c.utcOffset(),t=Math.abs(i),o=Math.floor(t/60),n=t%60;return(i<=0?"+":"-")+l(o,2,"0")+":"+l(n,2,"0")},m:function c(i,t){if(i.date()<t.date())return-c(t,i);var o=12*(t.year()-i.year())+(t.month()-i.month()),n=i.clone().add(o,s),r=t-n<0,a=i.clone().add(o+(r?-1:1),s);return+(-(o+(t-n)/(r?n-a:a-n))||0)},a:function(c){return c<0?Math.ceil(c)||0:Math.floor(c)},p:function(c){return{M:s,y:v,w:d,d:p,D:M,h:D,m:e,s:u,ms:x,Q:b}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(c){return void 0===c}},P="en",T={};T[P]=z;var H="$isDayjsObject",G=function(c){return c instanceof Y||!(!c||!c[H])},F=function c(i,t,o){var n;if(!i)return P;if("string"==typeof i){var r=i.toLowerCase();T[r]&&(n=r),t&&(T[r]=t,n=r);var a=i.split("-");if(!n&&a.length>1)return c(a[0])}else{var f=i.name;T[f]=i,n=f}return!o&&n&&(P=n),n||!o&&P},C=function(c,i){if(G(c))return c.clone();var t="object"==typeof i?i:{};return t.date=c,t.args=arguments,new Y(t)},h=S;h.l=F,h.i=G,h.w=function(c,i){return C(c,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var Y=function(){function c(t){this.$L=F(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[H]=!0}var i=c.prototype;return i.parse=function(t){this.$d=function(o){var n=o.date,r=o.utc;if(null===n)return new Date(NaN);if(h.u(n))return new Date;if(n instanceof Date)return new Date(n);if("string"==typeof n&&!/Z$/i.test(n)){var a=n.match(I);if(a){var f=a[2]-1||0,m=(a[7]||"0").substring(0,3);return r?new Date(Date.UTC(a[1],f,a[3]||1,a[4]||0,a[5]||0,a[6]||0,m)):new Date(a[1],f,a[3]||1,a[4]||0,a[5]||0,a[6]||0,m)}}return new Date(n)}(t),this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return h},i.isValid=function(){return this.$d.toString()!==U},i.isSame=function(t,o){var n=C(t);return this.startOf(o)<=n&&n<=this.endOf(o)},i.isAfter=function(t,o){return C(t)<this.startOf(o)},i.isBefore=function(t,o){return this.endOf(o)<C(t)},i.$g=function(t,o,n){return h.u(t)?this[o]:this.set(n,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,o){var n=this,r=!!h.u(o)||o,a=h.p(t),f=function(W,$){var E=h.w(n.$u?Date.UTC(n.$y,$,W):new Date(n.$y,$,W),n);return r?E:E.endOf(p)},m=function(W,$){return h.w(n.toDate()[W].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice($)),n)},y=this.$W,k=this.$M,B=this.$D,A="set"+(this.$u?"UTC":"");switch(a){case v:return r?f(1,0):f(31,11);case s:return r?f(1,k):f(0,k+1);case d:var L=this.$locale().weekStart||0,j=(y<L?y+7:y)-L;return f(r?B-j:B+(6-j),k);case p:case M:return m(A+"Hours",0);case D:return m(A+"Minutes",1);case e:return m(A+"Seconds",2);case u:return m(A+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,o){var n,r=h.p(t),a="set"+(this.$u?"UTC":""),f=(n={},n[p]=a+"Date",n[M]=a+"Date",n[s]=a+"Month",n[v]=a+"FullYear",n[D]=a+"Hours",n[e]=a+"Minutes",n[u]=a+"Seconds",n[x]=a+"Milliseconds",n)[r],m=r===p?this.$D+(o-this.$W):o;if(r===s||r===v){var y=this.clone().set(M,1);y.$d[f](m),y.init(),this.$d=y.set(M,Math.min(this.$D,y.daysInMonth())).$d}else f&&this.$d[f](m);return this.init(),this},i.set=function(t,o){return this.clone().$set(t,o)},i.get=function(t){return this[h.p(t)]()},i.add=function(t,o){var n,r=this;t=Number(t);var a=h.p(o),f=function(k){var B=C(r);return h.w(B.date(B.date()+Math.round(k*t)),r)};if(a===s)return this.set(s,this.$M+t);if(a===v)return this.set(v,this.$y+t);if(a===p)return f(1);if(a===d)return f(7);var m=(n={},n[e]=_,n[D]=g,n[u]=1e3,n)[a]||1,y=this.$d.getTime()+t*m;return h.w(y,this)},i.subtract=function(t,o){return this.add(-1*t,o)},i.format=function(t){var o=this,n=this.$locale();if(!this.isValid())return n.invalidDate||U;var r=t||"YYYY-MM-DDTHH:mm:ssZ",a=h.z(this),f=this.$H,m=this.$m,y=this.$M,k=n.weekdays,B=n.months,L=function($,E,N,V){return $&&($[E]||$(o,r))||N[E].slice(0,V)},j=function($){return h.s(f%12||12,$,"0")},W=n.meridiem||function($,E,N){var V=$<12?"AM":"PM";return N?V.toLowerCase():V};return r.replace(w,function($,E){return E||function(N){switch(N){case"YY":return String(o.$y).slice(-2);case"YYYY":return h.s(o.$y,4,"0");case"M":return y+1;case"MM":return h.s(y+1,2,"0");case"MMM":return L(n.monthsShort,y,B,3);case"MMMM":return L(B,y);case"D":return o.$D;case"DD":return h.s(o.$D,2,"0");case"d":return String(o.$W);case"dd":return L(n.weekdaysMin,o.$W,k,2);case"ddd":return L(n.weekdaysShort,o.$W,k,3);case"dddd":return k[o.$W];case"H":return String(f);case"HH":return h.s(f,2,"0");case"h":return j(1);case"hh":return j(2);case"a":return W(f,m,!0);case"A":return W(f,m,!1);case"m":return String(m);case"mm":return h.s(m,2,"0");case"s":return String(o.$s);case"ss":return h.s(o.$s,2,"0");case"SSS":return h.s(o.$ms,3,"0");case"Z":return a}return null}($)||a.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,o,n){var r,a=this,f=h.p(o),m=C(t),y=(m.utcOffset()-this.utcOffset())*_,k=this-m,B=function(){return h.m(a,m)};switch(f){case v:r=B()/12;break;case s:r=B();break;case b:r=B()/3;break;case d:r=(k-y)/6048e5;break;case p:r=(k-y)/864e5;break;case D:r=k/g;break;case e:r=k/_;break;case u:r=k/1e3;break;default:r=k}return n?r:h.a(r)},i.daysInMonth=function(){return this.endOf(s).$D},i.$locale=function(){return T[this.$L]},i.locale=function(t,o){if(!t)return this.$L;var n=this.clone(),r=F(t,o,!0);return r&&(n.$L=r),n},i.clone=function(){return h.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},c}(),K=Y.prototype;return C.prototype=K,[["$ms",x],["$s",u],["$m",e],["$H",D],["$W",p],["$M",s],["$y",v],["$D",M]].forEach(function(c){K[c[1]]=function(i){return this.$g(i,c[0],c[1])}}),C.extend=function(c,i){return c.$i||(c(i,Y,C),c.$i=!0),C},C.locale=F,C.isDayjs=G,C.unix=function(c){return C(1e3*c)},C.en=T[P],C.Ls=T,C.p={},C}()}}]);
|