@qaecy/cue-ui 0.0.57 → 0.0.58
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/1837.js +1 -1
- package/1985.js +1 -1
- package/2003.js +1 -0
- package/2014.js +1 -0
- package/2021.js +1 -1
- package/2081.js +1 -1
- 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/3288.js +1 -1
- package/3319.js +1 -0
- package/3577.js +1 -1
- package/3614.js +1 -1
- package/4098.js +1 -0
- package/4283.js +1 -1
- package/4311.js +1 -1
- package/4791.js +1 -0
- package/5277.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/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/880.js +1 -0
- package/8855.js +1 -1
- package/8957.js +1 -1
- package/928.js +1 -1
- package/9396.js +1 -1
- 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/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/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/880.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[880,9695],{5448(J,V,u){"use strict";u.d(V,{ButtonLabel:()=>e});var C=u(7705),p=u(2245),h=u(5547);const s=["*"];let e=(()=>{class D{fontSize=(0,C.hFB)("m");italic=(0,C.hFB)(!1);noWrap=(0,C.hFB)(!0);static \u0275fac=function(F){return new(F||D)};static \u0275cmp=h.VBU({type:D,selectors:[["cue-button-label"]],inputs:{fontSize:[1,"fontSize"],italic:[1,"italic"],noWrap:[1,"noWrap"]},ngContentSelectors:s,decls:3,vars:3,consts:[[3,"size","italic","noWrap"]],template:function(F,k){1&F&&(h.NAR(),h.j41(0,"div")(1,"cue-typography",0),h.SdG(2),h.k0s()()),2&F&&(h.R7$(),h.Y8G("size",k.fontSize())("italic",k.italic())("noWrap",k.noWrap()))},dependencies:[p.Typography],styles:["div[_ngcontent-%COMP%]{transform:translateY(.05em)}"]})}return D})()},9695(J,V,u){"use strict";u.d(V,{Switch:()=>D});var C=u(7705),p=u(29),h=u(5547);function s(M,_){if(1&M&&h.nrm(0,"cue-svg-icon",2),2&M){const F=h.XpG();h.Y8G("name",F.iconChecked())}}function e(M,_){if(1&M&&h.nrm(0,"cue-svg-icon",2),2&M){const F=h.XpG();h.Y8G("name",F.icon())}}let D=(()=>{class M{size=(0,C.hFB)("m");icon=(0,C.hFB)(void 0);iconChecked=(0,C.hFB)(void 0);disabled=(0,C.hFB)(!1);checked=(0,C.geq)(!1);toggleChange=(0,C.CGW)();toggle(){this.checked.set(!this.checked()),this.toggleChange.emit(this.checked())}static \u0275fac=function(k){return new(k||M)};static \u0275cmp=h.VBU({type:M,selectors:[["cue-input-switch"]],hostVars:5,hostBindings:function(k,R){2&k&&(h.BMQ("size",R.size()),h.AVh("checked",R.checked())("disabled",R.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(k,R){1&k&&(h.j41(0,"input",0),h.bIt("click",function(){return R.toggle()}),h.k0s(),h.j41(1,"div",1),h.nVh(2,s,1,1,"cue-svg-icon",2)(3,e,1,1,"cue-svg-icon",2),h.k0s()),2&k&&(h.Y8G("checked",R.checked())("disabled",R.disabled()),h.R7$(2),h.vxM(R.checked()&&R.iconChecked()?2:R.icon()?3:-1))},dependencies:[p.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 M})()},5745(J,V,u){"use strict";u.d(V,{a:()=>ie});var C=u(7705),p=u(5802),h=u(2271),s=u(5547);const e=["dialog"],D=["*",[["","modal-footer",""]]],M=["*","[modal-footer]"];function _($,U){if(1&$&&(s.rj2(0,"h2",7),s.EFF(1),s.eux()),2&$){const w=s.XpG(3);s.R7$(),s.JRh(w.effectiveTitle())}}function F($,U){if(1&$&&(s.rj2(0,"p",8),s.EFF(1),s.eux()),2&$){const w=s.XpG(3);s.R7$(),s.JRh(w.subtitle())}}function k($,U){if(1&$){const w=s.RV6();s.rj2(0,"button",10),s.VwU("click",function(){p.eBV(w);const L=s.XpG(3);return p.Njj(L.onClose())}),p.qSk(),s.rj2(1,"svg",11),s.Hgh(2,"path",12),s.eux()()}}function R($,U){if(1&$&&(s.rj2(0,"div",4)(1,"div",6),s.nVh(2,_,2,1,"h2",7),s.nVh(3,F,2,1,"p",8),s.eux(),s.nVh(4,k,3,0,"button",9),s.eux()),2&$){const w=s.XpG(2);s.R7$(2),s.vxM(w.effectiveTitle()?2:-1),s.R7$(),s.vxM(w.subtitle()?3:-1),s.R7$(),s.vxM(w.displayCloseBtn()?4:-1)}}function G($,U){if(1&$&&(s.rj2(0,"div",3),s.VwU("click",function(B){return B.stopPropagation()}),s.nVh(1,R,5,3,"div",4),s.rj2(2,"div",5),s.SdG(3),s.eux(),s.SdG(4,1),s.eux()),2&$){const w=s.XpG();s.xc7("min-width",w.minWidth()),s.AVh("has-header",w.effectiveTitle()||w.displayCloseBtn()),s.R7$(),s.vxM(w.effectiveTitle()||w.displayCloseBtn()?1:-1)}}let ie=(()=>{class ${visible=(0,C.geq)(!0);closeOnBackgroundClick=(0,C.hFB)(!0);displayCloseBtn=(0,C.hFB)(!0);label=(0,C.hFB)("");title=(0,C.hFB)("");subtitle=(0,C.hFB)("");minWidth=(0,C.hFB)();close=(0,C.CGW)();dialogRef=C.ebz.required("dialog");effectiveTitle=(0,h.EW)(()=>this.title()||this.label());constructor(){(0,p.QZP)(()=>{const w=this.dialogRef().nativeElement;this.visible()?w.open||w.showModal():w.open&&w.close()})}onBackdropClick(){this.closeOnBackgroundClick()&&this.onClose()}onClose(){this.visible.set(!1),this.close.emit()}static \u0275fac=function(B){return new(B||$)};static \u0275cmp=s.VBU({type:$,selectors:[["cue-modal"]],viewQuery:function(B,L){1&B&&s.wEZ(L.dialogRef,e,5),2&B&&s.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:M,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(B,L){1&B&&(s.NAR(D),s.rj2(0,"dialog",1,0),s.VwU("cancel",function(){return L.onClose()})("click",function(){return L.onBackdropClick()}),s.nVh(2,G,5,5,"div",2),s.eux()),2&B&&(s.R7$(2),s.vxM(L.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 $})()},2399(J,V,u){"use strict";u.d(V,{CueDocumentViewer:()=>Se});var C=u(467),p=u(7705),h=u(2271),s=u(5802),e=u(5547),D=u(9769),M=u(5381),_=u(2245),F=u(1024),k=u(9421),R=u(5794),G=u(9352),ie=u(6117),$=u(8547),U=u(3319),w=u(5971),B=u(7573);const L=(o,y)=>t=>t.isHighlight;function A(o,y){if(1&o&&(e.j41(0,"span",3),e.EFF(1),e.k0s()),2&o){const t=e.XpG(2).$implicit;e.R7$(),e.JRh(t.highlight.label)}}function ce(o,y){if(1&o){const t=e.RV6();e.j41(0,"cue-button",5),e.bIt("click",function(i){s.eBV(t);const a=e.XpG(2).$implicit,c=e.XpG();return s.Njj(c.onDeleteHighlight(i,a.highlight))}),e.nrm(1,"cue-button-icon",6),e.k0s()}}function oe(o,y){if(1&o){const t=e.RV6();e.j41(0,"span",2),e.bIt("click",function(){s.eBV(t);const i=e.XpG().$implicit,a=e.XpG();return s.Njj(a.onHighlightClick(i.highlight))}),e.nVh(1,A,2,1,"span",3),e.EFF(2),e.nVh(3,ce,2,0,"cue-button",4),e.k0s()}if(2&o){const t=e.XpG().$implicit,n=e.XpG();e.BMQ("data-segment-start",t.segmentStart),e.R7$(),e.vxM(t.highlight.label?1:-1),e.R7$(),e.SpI(" ",t.text," "),e.R7$(),e.vxM(n.allowDelete()?3:-1)}}function Z(o,y){if(1&o&&(e.j41(0,"span"),e.EFF(1),e.k0s()),2&o){const t=e.XpG().$implicit;e.BMQ("data-segment-start",t.segmentStart),e.R7$(),e.JRh(t.text)}}function S(o,y){if(1&o&&e.nVh(0,oe,4,4,"span",1)(1,Z,2,2,"span"),2&o){const t=y.$implicit;e.vxM(t.isHighlight&&t.highlight?0:1)}}let P=(()=>{class o{path=p.hFB.required();highlights=(0,p.hFB)([]);allowDelete=(0,p.hFB)(!1);allowAdd=(0,p.hFB)(!1);size=(0,p.hFB)("m");highlightClick=(0,p.CGW)();deleteHighlight=(0,p.CGW)();textSelected=(0,p.CGW)();segments=(0,h.EW)(()=>this.parseSegments(this.path(),this.highlights()));parseSegments(t,n){const i=n.filter(x=>x.path===t);if(0===i.length)return[{text:t,isHighlight:!1,segmentStart:0}];const a=[...i].sort((x,q)=>x.start-q.start),c=[];let f=0;for(const x of a)x.start>f&&c.push({text:t.substring(f,x.start),isHighlight:!1,segmentStart:f}),c.push({text:t.substring(x.start,x.end),isHighlight:!0,highlight:x,segmentStart:x.start}),f=x.end;return f<t.length&&c.push({text:t.substring(f),isHighlight:!1,segmentStart:f}),c}onHighlightClick(t){const n=this.path().substring(t.start,t.end);this.highlightClick.emit({path:this.path(),highlight:t,text:n})}onDeleteHighlight(t,n){t.stopPropagation(),this.deleteHighlight.emit({path:this.path(),highlight:n})}onMouseUp(t){if(!this.allowAdd())return;const n=window.getSelection();if(!n||n.isCollapsed||!n.rangeCount||!n.toString().trim())return;const a=n.getRangeAt(0),c=t.currentTarget,f=this.getAbsoluteOffset(c,a.startContainer,a.startOffset),x=this.getAbsoluteOffset(c,a.endContainer,a.endOffset);n.removeAllRanges(),x>f&&this.textSelected.emit({path:this.path(),start:f,end:x,text:this.path().substring(f,x)})}getAbsoluteOffset(t,n,i){let a=n.nodeType===Node.TEXT_NODE?n.parentElement:n;for(;a&&a!==t;){if(a instanceof HTMLElement&&a.hasAttribute("data-segment-start")){const q=parseInt(a.getAttribute("data-segment-start"),10);let X=0;const ae=document.createTreeWalker(a,NodeFilter.SHOW_TEXT);let ne=ae.nextNode();for(;ne&&ne!==n;)X+=ne.textContent?.length??0,ne=ae.nextNode();return q+X+i}a=a.parentElement}const c=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let f=0,x=c.nextNode();for(;x&&x!==n;)f+=x.textContent?.length??0,x=c.nextNode();return f+i}static \u0275fac=function(n){return new(n||o)};static \u0275cmp=e.VBU({type:o,selectors:[["cue-file-path-viewer"]],inputs:{path:[1,"path"],highlights:[1,"highlights"],allowDelete:[1,"allowDelete"],allowAdd:[1,"allowAdd"],size:[1,"size"]},outputs:{highlightClick:"highlightClick",deleteHighlight:"deleteHighlight",textSelected:"textSelected"},decls:3,vars:7,consts:[[1,"path-content",3,"mouseup"],[1,"highlight-segment"],[1,"highlight-segment",3,"click"],[1,"highlight-label"],["size","xs","aria-label","Remove highlight",1,"delete-button"],["size","xs","aria-label","Remove highlight",1,"delete-button",3,"click"],["icon","close"]],template:function(n,i){1&n&&(e.j41(0,"div",0),e.bIt("mouseup",function(c){return i.onMouseUp(c)}),e.Z7z(1,S,2,1,null,null,e.Vm6),e.k0s()),2&n&&(e.AVh("size-s","s"===i.size())("allow-add",i.allowAdd())("has-highlights",i.segments().some(e._m7(6,L,i))),e.R7$(),e.Dyx(i.segments()))},dependencies:[D.MD,w.Button,U.ButtonIcon],styles:["[_nghost-%COMP%]{display:contents}.path-content[_ngcontent-%COMP%]{display:block;flex:1;min-width:0;word-break:break-all;text-align:start;font-family:var(--cue-font-family);font-size:var(--cue-font-m-size);line-height:var(--cue-font-m-line-height);letter-spacing:var(--cue-font-m-letter-spacing);font-weight:var(--cue-font-weight-regular)}.path-content.size-s[_ngcontent-%COMP%]{font-size:var(--cue-font-s-size);line-height:var(--cue-font-s-line-height);letter-spacing:var(--cue-font-s-letter-spacing)}.path-content.allow-add[_ngcontent-%COMP%]{cursor:text;-webkit-user-select:text;user-select:text}.path-content.has-highlights[_ngcontent-%COMP%]{padding-top:.8rem;line-height:2.3rem}.highlight-segment[_ngcontent-%COMP%]{display:inline-block;vertical-align:text-bottom;position:relative;line-height:normal;font-weight:var(--cue-font-weight-medium);cursor:pointer;padding:0 .2rem;border-radius:3px;border:1px solid currentColor;transition:all .2s ease}.highlight-segment[_ngcontent-%COMP%] .highlight-label[_ngcontent-%COMP%]{font-family:var(--cue-font-family);position:absolute;bottom:100%;left:0;font-size:.5rem;line-height:1;opacity:.7;margin-bottom:.15rem;white-space:nowrap;pointer-events:none}.highlight-segment[_ngcontent-%COMP%] .delete-button[_ngcontent-%COMP%]{position:absolute;top:-12px;right:-12px;z-index:10;opacity:0;transition:opacity .2s ease;pointer-events:none}.highlight-segment[_ngcontent-%COMP%]:hover{background:color-mix(in srgb,currentColor 12%,transparent)}.highlight-segment[_ngcontent-%COMP%]:hover .delete-button[_ngcontent-%COMP%]{opacity:1;pointer-events:all}"],changeDetection:0})}return o})();var ee=u(5745),le=u(63),m=u(9695),d=u(5448),l=u(2611);const g=o=>({count:o}),r=(o,y)=>t=>t.iri;function v(o,y){1&o&&(e.j41(0,"cue-typography",11),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&o&&(e.R7$(),e.JRh(e.bMT(2,1,"components.documentInfo.infoLoadingFilePaths")))}function b(o,y){if(1&o){const t=e.RV6();e.j41(0,"cue-ag-grid",16),e.bIt("selectedRows",function(i){s.eBV(t);const a=e.XpG(4);return s.Njj(a.onMatchedPathsSelectionChange(i))}),e.k0s()}if(2&o){const t=e.XpG(4);e.Y8G("rowData",t._matchTableRowData())("columnDefs",t._matchTableColDefs())("rowSelection",t._matchTableRowSelection)}}function E(o,y){if(1&o){const t=e.RV6();e.j41(0,"cue-flexcontainer",12)(1,"cue-button",13),e.bIt("click",function(){s.eBV(t);const i=e.XpG(3);return s.Njj(i._matchTableExpanded.set(!i._matchTableExpanded()))}),e.nrm(2,"cue-button-icon",14),e.j41(3,"cue-button-label"),e.EFF(4),e.nI1(5,"transloco"),e.k0s()(),e.nVh(6,b,1,3,"cue-ag-grid",15),e.k0s(),e.j41(7,"cue-typography",11),e.EFF(8),e.nI1(9,"transloco"),e.k0s()}if(2&o){const t=e.XpG(3);e.R7$(2),e.Y8G("icon",t._matchTableExpanded()?"arrow-up":"arrow-dropdown"),e.R7$(2),e.JRh(e.i5U(5,4,1===t._matchCount()?"components.documentInfo.filePathMatched":"components.documentInfo.filePathsMatched",e.eq3(10,g,t._matchCount()))),e.R7$(2),e.vxM(t._matchTableExpanded()?6:-1),e.R7$(2),e.JRh(e.i5U(9,7,"components.documentInfo.applyToNPaths",e.eq3(12,g,t._selectedPaths().length)))}}function T(o,y){if(1&o&&e.nVh(0,v,3,3,"cue-typography",11)(1,E,10,14),2&o){const t=e.XpG(2);e.vxM(t._fileLocationsLoading()?0:null!==t._fileLocations()?1:-1)}}function I(o,y){if(1&o){const t=e.RV6();e.j41(0,"cue-flexcontainer",9)(1,"cue-input-switch",10),e.bIt("toggleChange",function(i){s.eBV(t);const a=e.XpG();return s.Njj(a.onApplyToAllChange(i))}),e.k0s(),e.j41(2,"cue-typography",11),e.EFF(3),e.nI1(4,"transloco"),e.k0s()(),e.nVh(5,T,2,1)}if(2&o){const t=e.XpG();e.R7$(),e.Y8G("checked",t._applyToAllFiles()),e.R7$(2),e.JRh(e.bMT(4,3,"components.documentInfo.applyToAllFiles")),e.R7$(2),e.vxM(t._applyToAllFiles()?5:-1)}}function O(o,y){if(1&o&&(e.j41(0,"cue-typography",8),e.EFF(1),e.nI1(2,"transloco"),e.k0s()),2&o){const t=e.XpG();e.R7$(),e.Lme("",e.bMT(2,2,"components.documentInfo.errorSavingEntityMention"),": ",t._saveError())}}let N=(()=>{class o{selection=p.hFB.required();availableEntityCategories=(0,p.hFB)([]);fileLocations=(0,p.hFB)([]);requestFileLocations=(0,p.hFB)(void 0);requestFilePathEntityAdd=(0,p.hFB)(void 0);confirm=(0,p.CGW)();cancel=(0,p.CGW)();_selectedEntityCategory=(0,s.vPA)("");_applyToAllFiles=(0,s.vPA)(!1);_fileLocations=(0,s.vPA)(null);_fileLocationsLoading=(0,s.vPA)(!1);_matchTableExpanded=(0,s.vPA)(!1);_selectedPaths=(0,s.vPA)([]);_saving=(0,s.vPA)(!1);_saveError=(0,s.vPA)(null);_dirPrefix=(0,h.EW)(()=>{const t=this.selection();return t.path.substring(0,t.end)});_matchedLocations=(0,h.EW)(()=>{const t=this._fileLocations();if(!t)return[];const n=this._dirPrefix();return t.filter(i=>i.path.startsWith(n))});_matchCount=(0,h.EW)(()=>this._matchedLocations().length);_matchTableRowData=(0,h.EW)(()=>this._matchedLocations().map(t=>({iri:t.iri,path:t.path,providerId:t.providerId})));_entityCategoryLabelMap=(0,h.EW)(()=>this.availableEntityCategories().reduce((t,n)=>(t[n.iri]=n.label,t),{}));_matchTableRowSelection={mode:"multiRow",selectAll:"filtered"};_filePathLabel=(0,G.Xx)("components.contentBlocks.documentViewer.labelFilePath");_matchTableColDefs=(0,h.EW)(()=>[{headerName:this._filePathLabel(),field:"path",flex:1,filter:!0,sortable:!0}]);onEntityCategoryChange(t){this._selectedEntityCategory.set("string"==typeof t?t:String(t??""))}onApplyToAllChange(t){var n=this;return(0,C.A)(function*(){if(n._applyToAllFiles.set(t),n._matchTableExpanded.set(!1),!t)return n._fileLocations.set(null),void n._selectedPaths.set([]);const i=n.requestFileLocations();if(i){n._fileLocationsLoading.set(!0);try{const a=yield i();n._fileLocations.set(a);const c=n._dirPrefix();n._selectedPaths.set(a.filter(f=>f.path.startsWith(c)))}finally{n._fileLocationsLoading.set(!1)}}})()}onMatchedPathsSelectionChange(t){const n=this._fileLocations()??[];this._selectedPaths.set(t.map(i=>n.find(a=>a.path===i.path)??{iri:"",path:i.path}))}onConfirm(){var t=this;return(0,C.A)(function*(){const n=t._selectedEntityCategory();if(!n)return;const i=t.selection().path,a=t._fileLocations()?.find(x=>x.path===i)??t.fileLocations().find(x=>x.path===i)??{iri:"",path:i},c=t._applyToAllFiles()&&t._selectedPaths().length>0?t._selectedPaths():[a],f=t.requestFilePathEntityAdd();if(f){t._saving.set(!0),t._saveError.set(null);try{yield f(n,c)}catch(x){return console.error("[EntityMentionModal] Failed to save entity mention:",x),t._saveError.set(x instanceof Error?x.message:String(x)),void t._saving.set(!1)}t._saving.set(!1)}t.confirm.emit({entityCategory:n,paths:c})})()}onCancel(){this.cancel.emit()}static \u0275fac=function(n){return new(n||o)};static \u0275cmp=e.VBU({type:o,selectors:[["cue-entity-mention-modal"]],inputs:{selection:[1,"selection"],availableEntityCategories:[1,"availableEntityCategories"],fileLocations:[1,"fileLocations"],requestFileLocations:[1,"requestFileLocations"],requestFilePathEntityAdd:[1,"requestFilePathEntityAdd"]},outputs:{confirm:"confirm",cancel:"cancel"},decls:18,vars:24,consts:[[3,"close","displayCloseBtn","closeOnBackgroundClick"],[1,"modal-content"],["direction","column","gap","m"],[3,"key","val"],[3,"valueChange","value","options","labelMap","label","showFilter"],["direction","row","justify","center"],[3,"click","disabled"],["variant","secondary",3,"click","disabled"],["size","s",2,"color","var(--cue-error)"],["direction","row","gap","s","align","center"],[3,"toggleChange","checked"],["size","s"],["direction","column","gap","xs"],["variant","ghost","size","xs",3,"click"],[3,"icon"],["size","s","height","220px",3,"rowData","columnDefs","rowSelection"],["size","s","height","220px",3,"selectedRows","rowData","columnDefs","rowSelection"]],template:function(n,i){1&n&&(e.j41(0,"cue-modal",0),e.bIt("close",function(){return i.onCancel()}),e.j41(1,"div",1)(2,"cue-flexcontainer",2),e.nrm(3,"cue-key-val",3),e.nI1(4,"transloco"),e.j41(5,"cue-select",4),e.nI1(6,"transloco"),e.bIt("valueChange",function(c){return i.onEntityCategoryChange(c)}),e.k0s(),e.nVh(7,I,6,5),e.j41(8,"cue-flexcontainer",5)(9,"cue-button",6),e.bIt("click",function(){return i.onCancel()}),e.j41(10,"cue-button-label"),e.EFF(11),e.nI1(12,"transloco"),e.k0s()(),e.j41(13,"cue-button",7),e.bIt("click",function(){return i.onConfirm()}),e.j41(14,"cue-button-label"),e.EFF(15),e.nI1(16,"transloco"),e.k0s()()(),e.nVh(17,O,3,4,"cue-typography",8),e.k0s()()()),2&n&&(e.Y8G("displayCloseBtn",!1)("closeOnBackgroundClick",!1),e.R7$(3),e.Y8G("key",e.bMT(4,15,"components.documentInfo.labelSelectedText"))("val",i.selection().text),e.R7$(2),e.Y8G("value",i._selectedEntityCategory())("options",i.availableEntityCategories().map(e._m7(17,r,i)))("labelMap",i._entityCategoryLabelMap())("label",e.bMT(6,18,"components.entityInfo.labelEntityCategory"))("showFilter",i.availableEntityCategories().length>5),e.R7$(2),e.vxM(i.requestFileLocations()?7:-1),e.R7$(2),e.Y8G("disabled",i._saving()),e.R7$(2),e.JRh(e.bMT(12,20,"components.modals.rdfEdit.buttonCancel")),e.R7$(2),e.Y8G("disabled",!i._selectedEntityCategory()||i._saving()),e.R7$(2),e.JRh(e.bMT(16,22,"components.modals.rdfEdit.buttonSave")),e.R7$(2),e.vxM(i._saveError()?17:-1))},dependencies:[M.FlexContainer,k.F,U.ButtonIcon,w.Button,d.ButtonLabel,_.Typography,ee.a,le.Select,m.Switch,l.R,G.Kj],styles:[".modal-content[_ngcontent-%COMP%]{width:640px;max-width:calc(100vw - 32px)}"],changeDetection:0})}return o})();const Y=()=>[];function z(o,y){if(1&o&&(e.nrm(0,"cue-key-val",6),e.nI1(1,"transloco")),2&o){const t=e.XpG(2);e.Y8G("key",e.bMT(1,2,"components.contentBlocks.documentViewer.labelSubject"))("val",t.subject())}}function K(o,y){if(1&o&&(e.j41(0,"cue-key-val-list"),e.nVh(1,z,2,4,"cue-key-val",6),e.k0s()),2&o){const t=e.XpG();e.R7$(),e.vxM(t.subject()?1:-1)}}function H(o,y){if(1&o&&(e.j41(0,"cue-flexcontainer",4)(1,"cue-menu",7)(2,"cue-button",8,0),e.nrm(4,"cue-button-icon",9),e.k0s(),e.nrm(5,"cue-menu-nested",10),e.k0s()()),2&o){const t=e.XpG();e.R7$(5),e.Y8G("items",t.menuItems())}}function j(o,y){if(1&o&&(e.nrm(0,"cue-key-val-editable",11),e.nI1(1,"transloco"),e.nI1(2,"transloco")),2&o){const t=e.XpG(2);e.Y8G("key",1===t.contentCategories().length?e.bMT(1,4,"components.contentBlocks.documentViewer.labelContentCategory"):e.bMT(2,6,"components.contentBlocks.documentViewer.labelContentCategories"))("val",t.contentCategoriesString())("rdfConfig",t.rdfEditConfig())("editDisabled",!t.contentCategoriesEditable())}}function W(o,y){if(1&o&&(e.j41(0,"span",15),e.EFF(1),e.k0s()),2&o){const t=e.XpG(3);e.R7$(),e.Lme("(",t.currentFilePathIndex()+1,"/",t.fileLocations().length,")")}}function Q(o,y){if(1&o){const t=e.RV6();e.j41(0,"cue-button",19),e.bIt("click",function(){s.eBV(t);const i=e.XpG(3);return s.Njj(i.prevFilePath())}),e.nrm(1,"cue-button-icon",20),e.k0s()}if(2&o){const t=e.XpG(3);e.Y8G("disabled",0===t.currentFilePathIndex())}}function te(o,y){if(1&o){const t=e.RV6();e.j41(0,"cue-button",19),e.bIt("click",function(){s.eBV(t);const i=e.XpG(3);return s.Njj(i.nextFilePath())}),e.nrm(1,"cue-button-icon",21),e.k0s()}if(2&o){const t=e.XpG(3);e.Y8G("disabled",t.currentFilePathIndex()===t.fileLocations().length-1)}}function he(o,y){if(1&o){const t=e.RV6();e.j41(0,"dl",12)(1,"dt",13)(2,"cue-typography",14),e.EFF(3),e.nI1(4,"transloco"),e.nVh(5,W,2,2,"span",15),e.k0s()(),e.j41(6,"dd",16),e.nVh(7,Q,2,1,"cue-button",17),e.j41(8,"cue-file-path-viewer",18),e.bIt("textSelected",function(i){s.eBV(t);const a=e.XpG(2);return s.Njj(a.onTextSelected(i))}),e.k0s(),e.nVh(9,te,2,1,"cue-button",17),e.k0s()()}if(2&o){const t=e.XpG(2);e.R7$(3),e.SpI(" ",e.bMT(4,8,"components.contentBlocks.documentViewer.labelFilePath")," "),e.R7$(2),e.vxM(t.fileLocations().length>1?5:-1),e.R7$(2),e.vxM(t.fileLocations().length>1?7:-1),e.R7$(),e.Y8G("path",t.fileLocations()[t.currentFilePathIndex()].path)("highlights",t.filePathEntitiesVisible()?t.filePathHighlights():e.lJ4(10,Y))("allowDelete",t.filePathEntitiesEditable())("allowAdd",t.filePathEntitiesEditable()),e.R7$(),e.vxM(t.fileLocations().length>1?9:-1)}}function ge(o,y){if(1&o&&(e.j41(0,"cue-key-val-list"),e.nrm(1,"hr"),e.nVh(2,j,3,8,"cue-key-val-editable",11),e.nVh(3,he,10,11,"dl",12),e.k0s()),2&o){const t=e.XpG();e.R7$(2),e.vxM(t.contentCategories()&&t.contentCategories().length>0?2:-1),e.R7$(),e.vxM(t.fileLocations().length>0?3:-1)}}function fe(o,y){if(1&o){const t=e.RV6();e.j41(0,"cue-entity-mention-modal",22),e.bIt("confirm",function(i){s.eBV(t);const a=e.XpG();return s.Njj(a.onEntityMentionConfirm(i))})("cancel",function(){s.eBV(t);const i=e.XpG();return s.Njj(i.onEntityMentionCancel())}),e.k0s()}if(2&o){const t=e.XpG();e.Y8G("selection",t._pendingSelection())("availableEntityCategories",t.availableEntityCategories())("fileLocations",t.fileLocations())("requestFileLocations",t._fileLocationsProvider())("requestFilePathEntityAdd",t._requestFilePathEntityAdd())}}let pe=(()=>{class o{subject=p.hFB.required();handlers=p.hFB.required();dataChanged=(0,p.CGW)();filePathEntityAdded=(0,p.CGW)();fileLocations=(0,p.hFB)([]);_fileLocationsProvider=(0,h.EW)(()=>{const t=this.handlers().requestFileLocations;if(t)return t;const n=this.fileLocations();return n.length?()=>Promise.resolve(n):void 0});filePathEntities=(0,p.geq)([]);contentCategories=(0,p.hFB)([]);contentCategoriesEditable=(0,p.hFB)(!1);filePathEntitiesVisible=(0,p.hFB)(!1);filePathEntitiesEditable=(0,p.hFB)(!1);menuItems=(0,p.hFB)([]);availableContentCategories=(0,p.hFB)([]);availableEntityCategories=(0,p.hFB)([]);collapsed=(0,p.hFB)(!1);hasDocInfo=(0,h.EW)(()=>{const t=""!==this.subject(),n=this.fileLocations().length>0;return t||n});currentFilePathIndex=(0,s.vPA)(0);_entityCategoryModalVisible=(0,s.vPA)(!1);_pendingSelection=(0,s.vPA)(null);_requestFilePathEntityAdd=(0,h.EW)(()=>{var t=this;const n=this.handlers().requestFilePathEntityAdd;if(n)return function(){var i=(0,C.A)(function*(a,c){const f=t._pendingSelection();f&&(yield n({paths:c,start:f.start,end:f.end,text:f.text,entityCategory:a,folderPath:f.path.substring(0,f.end)}))});return function(a,c){return i.apply(this,arguments)}}()});prevFilePath(){this.currentFilePathIndex()>0&&this.currentFilePathIndex.update(t=>t-1)}nextFilePath(){this.currentFilePathIndex()<this.fileLocations().length-1&&this.currentFilePathIndex.update(t=>t+1)}filePathHighlights=(0,h.EW)(()=>this.filePathEntities().map(t=>({path:t.path,start:t.startIndex,end:t.endIndex,label:this.availableEntityCategories().find(n=>n.iri===t.entityCategory)?.label??t.entityCategory.split("/").pop()??t.entityCategory})));entityCategoryLabelMap=(0,h.EW)(()=>this.availableEntityCategories().reduce((t,n)=>(t[n.iri]=n.label,t),{}));onTextSelected(t){this._pendingSelection.set(t),this._entityCategoryModalVisible.set(!0)}onEntityMentionConfirm(t){const n=this._pendingSelection();n&&(this.filePathEntities.update(i=>[...i,...t.paths.map(a=>({path:a.path,entityCategory:t.entityCategory,startIndex:n.start,endIndex:n.end}))]),this.filePathEntityAdded.emit({paths:t.paths,start:n.start,end:n.end,text:n.text,entityCategory:t.entityCategory,folderPath:n.path.substring(0,n.end)}),this._entityCategoryModalVisible.set(!1),this._pendingSelection.set(null))}onEntityMentionCancel(){this._entityCategoryModalVisible.set(!1),this._pendingSelection.set(null)}_contentCategories=(0,h.uu)(()=>this.contentCategories());contentCategoriesString=(0,h.EW)(()=>this._contentCategories().map(t=>this._iriToString(t)).sort().join(", "));_iriToString(t){const n=this.availableContentCategories()?.find(i=>i.iri===t);return n?n.label:t}infoChangeContentCategory=(0,G.Xx)("components.documentInfo.infoChangeContentCategory");rdfEditConfig=(0,h.EW)(()=>{var t=this;const n=this.handlers()?.requestRDFChange;var i;if(void 0!==n)return{message:this.infoChangeContentCategory(),existingValue:this._contentCategories(),dataType:"multiselect",options:this.availableContentCategories()?.map(i=>i.iri),optionLabelMap:this.availableContentCategories()?.reduce((i,a)=>(i[a.iri]=a.label,i),{}),requestSave:(i=(0,C.A)(function*(a){console.log(a);const c={subject:t.subject(),predicate:`${B.E.qcy}contentCategory`,objects:t._contentCategories(),newObjects:a.newValue,type:"contentCategory",comment:a.comment};yield n(c),t._contentCategories.set(a.newValue),t.dataChanged.emit({contentCategories:a.newValue})}),function(c){return i.apply(this,arguments)})};console.warn("No RDF change request handler defined")});static \u0275fac=function(n){return new(n||o)};static \u0275cmp=e.VBU({type:o,selectors:[["cue-document-info"]],inputs:{subject:[1,"subject"],handlers:[1,"handlers"],fileLocations:[1,"fileLocations"],filePathEntities:[1,"filePathEntities"],contentCategories:[1,"contentCategories"],contentCategoriesEditable:[1,"contentCategoriesEditable"],filePathEntitiesVisible:[1,"filePathEntitiesVisible"],filePathEntitiesEditable:[1,"filePathEntitiesEditable"],menuItems:[1,"menuItems"],availableContentCategories:[1,"availableContentCategories"],availableEntityCategories:[1,"availableEntityCategories"],collapsed:[1,"collapsed"]},outputs:{dataChanged:"dataChanged",filePathEntityAdded:"filePathEntityAdded",filePathEntities:"filePathEntitiesChange"},decls:7,vars:4,consts:[["trigger",""],["direction","column",2,"min-height","50px"],["direction","row"],["direction","column",2,"flex","1 1"],["direction","column",2,"width","50px"],[3,"selection","availableEntityCategories","fileLocations","requestFileLocations","requestFilePathEntityAdd"],["size","l",3,"key","val"],["positioning","bottomleft"],["trigger","","variant","tertiary"],["icon","more-vert"],["menu","",3,"items"],["size","s",3,"key","val","rdfConfig","editDisabled"],[1,"file-path-nav-container"],[1,"file-path-label"],["size","xs"],[1,"path-counter"],[1,"file-path-row"],["variant","tertiary","size","xs",3,"disabled"],["size","s",3,"textSelected","path","highlights","allowDelete","allowAdd"],["variant","tertiary","size","xs",3,"click","disabled"],["icon","paginator-back"],["icon","paginator-next"],[3,"confirm","cancel","selection","availableEntityCategories","fileLocations","requestFileLocations","requestFilePathEntityAdd"]],template:function(n,i){1&n&&(e.j41(0,"cue-flexcontainer",1)(1,"cue-flexcontainer",2)(2,"cue-flexcontainer",3),e.nVh(3,K,2,1,"cue-key-val-list"),e.k0s(),e.nVh(4,H,6,1,"cue-flexcontainer",4),e.k0s(),e.nVh(5,ge,4,2,"cue-key-val-list"),e.k0s(),e.nVh(6,fe,1,5,"cue-entity-mention-modal",5)),2&n&&(e.R7$(3),e.vxM(i.fileLocations().length>0||i.subject()?3:-1),e.R7$(),e.vxM(i.menuItems().length>0?4:-1),e.R7$(),e.vxM(!i.collapsed()&&i.hasDocInfo()?5:-1),e.R7$(),e.vxM(i._entityCategoryModalVisible()&&i._pendingSelection()?6:-1))},dependencies:[M.FlexContainer,F.p,k.F,R.L,ie.W,$.T,U.ButtonIcon,w.Button,P,_.Typography,N,G.Kj],styles:[".file-path-nav-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px}.file-path-label[_ngcontent-%COMP%]{display:block;margin:0}.file-path-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;margin:0;overflow:visible;padding:1px}.file-path-row[_ngcontent-%COMP%] cue-file-path-viewer[_ngcontent-%COMP%]{flex:1;overflow:visible;min-width:0}.path-counter[_ngcontent-%COMP%]{opacity:.6}"],changeDetection:0})}return o})();class me{requestRDFChange;requestFileLocations;requestFilePathEntityAdd}var _e=u(2065),ve=u(5187),be=u(7293);const Ce=["viewerHost"];function ye(o,y){if(1&o&&e.nrm(0,"cue-document-info",4),2&o){const t=e.XpG(2);e.Y8G("subject",t._docSubject())("handlers",t._docInfoHandlers)("menuItems",t._menuItems())}}function Me(o,y){1&o&&(e.j41(0,"cue-flexcontainer",5)(1,"cue-typography"),e.EFF(2,"Loading\u2026"),e.k0s()())}function xe(o,y){if(1&o&&(e.j41(0,"cue-flexcontainer",5)(1,"cue-typography",8),e.EFF(2),e.k0s()()),2&o){const t=e.XpG(2);e.R7$(2),e.JRh(t.errorMessage())}}function we(o,y){if(1&o&&e.nrm(0,"cue-logo-link",7),2&o){const t=e.XpG(2);e.Y8G("projectId",t.projectId())("resourceId",t._uuidOnly())}}function De(o,y){if(1&o&&(e.j41(0,"div",3),e.nVh(1,ye,1,3,"cue-document-info",4),e.nVh(2,Me,3,0,"cue-flexcontainer",5)(3,xe,3,1,"cue-flexcontainer",5),e.j41(4,"div",6),e.eu8(5,null,1),e.k0s(),e.nVh(7,we,1,2,"cue-logo-link",7),e.k0s()),2&o){const t=e.XpG();e.R7$(),e.vxM(t.showDocumentInfo()&&"ready"===t.state()?1:-1),e.R7$(),e.vxM("loading"===t.state()?2:"error"===t.state()?3:-1),e.R7$(5),e.vxM(t.showLogo()?7:-1)}}function Pe(o,y){1&o&&e.eu8(0)}function Ee(o,y){if(1&o&&(e.j41(0,"cue-card",2),e.DNE(1,Pe,1,0,"ng-container",9),e.k0s()),2&o){const t=e.XpG(),n=e.sdS(1);e.Y8G("variant",t._cardVariant())("padded",!0),e.R7$(),e.Y8G("ngTemplateOutlet",n)}}function ke(o,y){1&o&&e.eu8(0)}function Fe(o,y){if(1&o&&e.DNE(0,ke,1,0,"ng-container",9),2&o){e.XpG();const t=e.sdS(1);e.Y8G("ngTemplateOutlet",t)}}const Te=[".fragments",".dxf",".pdf",".png",".jpg",".jpeg",".svg",".gif",".webp",".bmp",".avif",".apng",".xlsx",".xls",".csv",".json",".jsonld",".xml",".css",".js",".html",".htm",".sh",".txt",".rst",".md"];let Se=(()=>{class o{set _viewerHostRef(t){if(this._viewerHost=t,t&&this._lastRenderArgs){const{url:n,suffix:i,page:a,viewerTypeOverride:c}=this._lastRenderArgs;this._renderViewer(n,i,a,c)}}_viewerHost;_lastRenderArgs;currentViewerRef;cue=(0,p.hFB)(void 0);uuid=(0,p.hFB)(void 0);projectId=(0,p.hFB)(void 0);showDocumentInfo=(0,p.hFB)(!0,{transform:p.L39});showLogo=(0,p.hFB)(!1,{transform:p.L39});_uuidOnly=(0,h.EW)(()=>{const t=this.uuid();return t?t.split("?")[0].trim():void 0});extraMenuItems=(0,p.hFB)([]);portalBaseURL=(0,p.hFB)("https://cue.qaecy.com");variant=(0,p.hFB)("none");_cardVariant=(0,h.EW)(()=>this.variant());state=(0,s.vPA)("idle");errorMessage=(0,s.vPA)(null);resolvedUrl=(0,s.vPA)(null);resolvedSuffix=(0,s.vPA)(null);_docSubject=(0,s.vPA)("");_alternatives=(0,s.vPA)([]);_originalUuid=(0,s.vPA)(null);_originalDocSuffix=(0,s.vPA)(null);_cueSnapshot=null;_projectIdSnapshot=null;_inputWarningTimer;_blobUrls=new Set;_docInfoHandlers=new me;_menuItems=(0,h.EW)(()=>{const t=[],n=this._originalUuid(),i=this._originalDocSuffix();n&&i&&t.push({icon:"download",label:"Download file",action:()=>this._downloadOriginal()});const a=this._alternatives();if(a.length>1){const c=this.resolvedSuffix();t.push({icon:"document",label:"Alternative representation",children:a.map(f=>({label:f.original?`Original (${f.suffix.replace(".","").toUpperCase()})`:f.suffix.replace(".","").toUpperCase(),tooltip:c===f.suffix?"Currently shown":void 0,action:()=>this._switchToAlternative(f)}))})}return t.push(...this.extraMenuItems()),t});constructor(){this._inputWarningTimer=setTimeout(()=>{this.cue()||console.warn('[cue-document-viewer] Required input "cue" is not set. Pass an authenticated Cue SDK instance.'),this.uuid()||console.warn('[cue-document-viewer] Required input "uuid" is not set. Pass the document UUID to display.'),this.projectId()||console.warn('[cue-document-viewer] Required input "projectId" is not set. Pass the Cue project ID the document belongs to.')},3e3),(0,s.QZP)(()=>{const t=this.cue(),n=this.uuid(),i=this.projectId();t&&n&&i?this._load(t,n,i):this.state.set("idle")})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._blobUrls.forEach(t=>URL.revokeObjectURL(t))}_load(t,n,i){var a=this;return(0,C.A)(function*(){if(t&&n&&i){a.state.set("loading"),a.resolvedUrl.set(null),a.resolvedSuffix.set(null),a.errorMessage.set(null),a._docSubject.set(""),a._originalUuid.set(null),a._originalDocSuffix.set(null),a._alternatives.set([]),a._viewerHost?.clear(),a.currentViewerRef?.destroy(),a.currentViewerRef=void 0,a._lastRenderArgs=void 0;try{a._cueSnapshot=t,a._projectIdSnapshot=i;const{uuid:c,page:f}=function $e(o){const[y,t]=o.split("?"),n=y.trim();let i=null;if(t){const c=new URLSearchParams(t).get("page");if(null!==c){const f=parseInt(c,10);!isNaN(f)&&f>0&&(i=f)}}return{uuid:n,page:i}}(n),x=t.createProjectDocuments(i),X=(yield x.fetchDocumentData([c]))[c];if(!X)throw new Error(`Document '${c}' not found in project '${i}'.`);a._docSubject.set(X.subject??""),a._originalUuid.set(c),a._originalDocSuffix.set(X.suffix);const ae=yield x.fetchAlternativeRepresentations(c);a._alternatives.set([{uuid:c,suffix:X.suffix,original:!0},...ae.filter(se=>se.id!==c).map(se=>({uuid:se.id,suffix:se.suffix,original:!1,remoteRelativePath:se.remoteRelativePath}))]);const{uuid:ne,suffix:re,remoteRelativePath:de}=function Re(o,y){const t=[o,...y];let n,i=1/0;for(const a of t){const c=Te.indexOf(a.suffix);-1!==c&&c<i&&(i=c,n=a)}return n?{uuid:n.id,suffix:n.suffix,remoteRelativePath:n.remoteRelativePath}:{uuid:o.id,suffix:o.suffix}}(X,ae),ue=de?yield a._toBlobUrl(t,t.storage.getAltRepDownloadUrl(de),i):yield a._toBlobUrl(t,t.storage.getDownloadUrl(i,ne,re),i);a.resolvedUrl.set(ue),a.resolvedSuffix.set(re);const Ie=[".eml",".msg",".emlx",".mbx"].includes(X.suffix)&&".json"===re?"email":void 0;yield a._renderViewer(ue,re,f,Ie),a.state.set("ready")}catch(c){const f=c instanceof Error?c.message:String(c);console.error("[CueDocumentViewerWC] Failed to load document:",f),a.errorMessage.set(f),a.state.set("error")}}else a.state.set("idle")})()}_toBlobUrl(t,n,i){var a=this;return(0,C.A)(function*(){const c=yield t.auth.authenticatedFetch(n,{headers:{"cue-project-id":i}});if(!c.ok)throw new Error(`Failed to fetch document: ${c.status} ${c.statusText}`);const f=URL.createObjectURL(yield c.blob());return a._blobUrls.add(f),f})()}_renderViewer(t,n,i,a){var c=this;return(0,C.A)(function*(){try{const{DocumentViewer:f}=yield Promise.all([u.e(3418),u.e(3036)]).then(u.bind(u,3036)),{DocumentViewerSettings:x}=yield u.e(3418).then(u.bind(u,3418));c._viewerHost?.clear(),c.currentViewerRef?.destroy();const q=new x;if(null!==i&&(q.pdf.page=String(i)),!c._viewerHost)throw new Error("viewerHost is not yet available \u2014 view has not been initialized.");c._lastRenderArgs={url:t,suffix:n,page:i,viewerTypeOverride:a},c.currentViewerRef=c._viewerHost.createComponent(f),c.currentViewerRef.setInput("url",t),c.currentViewerRef.setInput("suffix",n),c.currentViewerRef.setInput("settings",q),a&&c.currentViewerRef.setInput("viewerTypeOverride",a)}catch(f){throw new Error(`Failed to load viewer component: ${f instanceof Error?f.message:String(f)}`)}})()}_switchToAlternative(t){var n=this;return(0,C.A)(function*(){const i=n._cueSnapshot,a=n._projectIdSnapshot;if(i&&a)try{const c=t.remoteRelativePath?yield n._toBlobUrl(i,i.storage.getAltRepDownloadUrl(t.remoteRelativePath),a):yield n._toBlobUrl(i,i.storage.getDownloadUrl(a,t.uuid,t.suffix),a);n.resolvedUrl.set(c),n.resolvedSuffix.set(t.suffix),yield n._renderViewer(c,t.suffix,null)}catch(c){console.error("[CueDocumentViewerWC] Failed to switch to alternative:",c)}})()}_downloadOriginal(){var t=this;return(0,C.A)(function*(){const n=t._cueSnapshot,i=t._projectIdSnapshot,a=t._originalUuid(),c=t._originalDocSuffix();if(n&&i&&a&&c)try{const f=yield n.storage.downloadBlob(i,a,c);(0,_e.KE)(f,`${a}${c}`)}catch(f){console.error("[CueDocumentViewerWC] Failed to download original:",f)}})()}static \u0275fac=function(n){return new(n||o)};static \u0275cmp=e.VBU({type:o,selectors:[["cue-document-viewer-wc"]],viewQuery:function(n,i){if(1&n&&e.GBs(Ce,5,e.c1b),2&n){let a;e.mGM(a=e.lsd())&&(i._viewerHostRef=a.first)}},inputs:{cue:[1,"cue"],uuid:[1,"uuid"],projectId:[1,"projectId"],showDocumentInfo:[1,"showDocumentInfo"],showLogo:[1,"showLogo"],extraMenuItems:[1,"extraMenuItems"],portalBaseURL:[1,"portalBaseURL"],variant:[1,"variant"]},decls:4,vars:1,consts:[["body",""],["viewerHost",""],[2,"height","100%","width","100%",3,"variant","padded"],[2,"display","flex","flex-direction","column","height","100%","width","100%","position","relative"],[3,"subject","handlers","menuItems"],["direction","column","align","center","justify","center",2,"flex","1","width","100%"],[2,"flex","1","min-height","0","overflow","hidden"],[2,"position","absolute","bottom","12px","right","12px","z-index","5",3,"projectId","resourceId"],[2,"color","#c44","font-size","13px"],[4,"ngTemplateOutlet"]],template:function(n,i){1&n&&(e.DNE(0,De,8,3,"ng-template",null,0,e.C5r),e.nVh(2,Ee,2,3,"cue-card",2)(3,Fe,1,1,"ng-container")),2&n&&(e.R7$(2),e.vxM("none"!==i.variant()?2:3))},dependencies:[D.MD,D.T3,M.FlexContainer,_.Typography,pe,ve.Card,be.x],styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0})}return o})()},2065(J,V,u){"use strict";function h(D,M,_="text/plain"){return function C(D,M="data.zip"){const _=document.createElement("a"),F=URL.createObjectURL(D);_.href=F,_.download=M,document.body.appendChild(_),_.click(),document.body.removeChild(_),URL.revokeObjectURL(F)}(new Blob([D],{type:_}),M)}function s(D,M){const _=document.createElement("a");_.style.display="hidden",_.setAttribute("href",window.URL.createObjectURL(D)),_.setAttribute("download",M),document.body.appendChild(_),_.click(),_.remove()}u.d(V,{KE:()=>s,YN:()=>h})},7573(J,V,u){"use strict";u.d(V,{E:()=>C});const C={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(J){J.exports=function(){"use strict";var u=6e4,C=36e5,p="millisecond",h="second",s="minute",e="hour",D="day",M="week",_="month",F="quarter",k="year",R="date",G="Invalid Date",ie=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,$=/\[([^\]]+)]|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,U={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(m){var d=["th","st","nd","rd"],l=m%100;return"["+m+(d[(l-20)%10]||d[l]||d[0])+"]"}},w=function(m,d,l){var g=String(m);return!g||g.length>=d?m:""+Array(d+1-g.length).join(l)+m},B={s:w,z:function(m){var d=-m.utcOffset(),l=Math.abs(d),g=Math.floor(l/60),r=l%60;return(d<=0?"+":"-")+w(g,2,"0")+":"+w(r,2,"0")},m:function m(d,l){if(d.date()<l.date())return-m(l,d);var g=12*(l.year()-d.year())+(l.month()-d.month()),r=d.clone().add(g,_),v=l-r<0,b=d.clone().add(g+(v?-1:1),_);return+(-(g+(l-r)/(v?r-b:b-r))||0)},a:function(m){return m<0?Math.ceil(m)||0:Math.floor(m)},p:function(m){return{M:_,y:k,w:M,d:D,D:R,h:e,m:s,s:h,ms:p,Q:F}[m]||String(m||"").toLowerCase().replace(/s$/,"")},u:function(m){return void 0===m}},L="en",A={};A[L]=U;var ce="$isDayjsObject",oe=function(m){return m instanceof ee||!(!m||!m[ce])},Z=function m(d,l,g){var r;if(!d)return L;if("string"==typeof d){var v=d.toLowerCase();A[v]&&(r=v),l&&(A[v]=l,r=v);var b=d.split("-");if(!r&&b.length>1)return m(b[0])}else{var E=d.name;A[E]=d,r=E}return!g&&r&&(L=r),r||!g&&L},S=function(m,d){if(oe(m))return m.clone();var l="object"==typeof d?d:{};return l.date=m,l.args=arguments,new ee(l)},P=B;P.l=Z,P.i=oe,P.w=function(m,d){return S(m,{locale:d.$L,utc:d.$u,x:d.$x,$offset:d.$offset})};var ee=function(){function m(l){this.$L=Z(l.locale,null,!0),this.parse(l),this.$x=this.$x||l.x||{},this[ce]=!0}var d=m.prototype;return d.parse=function(l){this.$d=function(g){var r=g.date,v=g.utc;if(null===r)return new Date(NaN);if(P.u(r))return new Date;if(r instanceof Date)return new Date(r);if("string"==typeof r&&!/Z$/i.test(r)){var b=r.match(ie);if(b){var E=b[2]-1||0,T=(b[7]||"0").substring(0,3);return v?new Date(Date.UTC(b[1],E,b[3]||1,b[4]||0,b[5]||0,b[6]||0,T)):new Date(b[1],E,b[3]||1,b[4]||0,b[5]||0,b[6]||0,T)}}return new Date(r)}(l),this.init()},d.init=function(){var l=this.$d;this.$y=l.getFullYear(),this.$M=l.getMonth(),this.$D=l.getDate(),this.$W=l.getDay(),this.$H=l.getHours(),this.$m=l.getMinutes(),this.$s=l.getSeconds(),this.$ms=l.getMilliseconds()},d.$utils=function(){return P},d.isValid=function(){return this.$d.toString()!==G},d.isSame=function(l,g){var r=S(l);return this.startOf(g)<=r&&r<=this.endOf(g)},d.isAfter=function(l,g){return S(l)<this.startOf(g)},d.isBefore=function(l,g){return this.endOf(g)<S(l)},d.$g=function(l,g,r){return P.u(l)?this[g]:this.set(r,l)},d.unix=function(){return Math.floor(this.valueOf()/1e3)},d.valueOf=function(){return this.$d.getTime()},d.startOf=function(l,g){var r=this,v=!!P.u(g)||g,b=P.p(l),E=function(H,j){var W=P.w(r.$u?Date.UTC(r.$y,j,H):new Date(r.$y,j,H),r);return v?W:W.endOf(D)},T=function(H,j){return P.w(r.toDate()[H].apply(r.toDate("s"),(v?[0,0,0,0]:[23,59,59,999]).slice(j)),r)},I=this.$W,O=this.$M,N=this.$D,Y="set"+(this.$u?"UTC":"");switch(b){case k:return v?E(1,0):E(31,11);case _:return v?E(1,O):E(0,O+1);case M:var z=this.$locale().weekStart||0,K=(I<z?I+7:I)-z;return E(v?N-K:N+(6-K),O);case D:case R:return T(Y+"Hours",0);case e:return T(Y+"Minutes",1);case s:return T(Y+"Seconds",2);case h:return T(Y+"Milliseconds",3);default:return this.clone()}},d.endOf=function(l){return this.startOf(l,!1)},d.$set=function(l,g){var r,v=P.p(l),b="set"+(this.$u?"UTC":""),E=(r={},r[D]=b+"Date",r[R]=b+"Date",r[_]=b+"Month",r[k]=b+"FullYear",r[e]=b+"Hours",r[s]=b+"Minutes",r[h]=b+"Seconds",r[p]=b+"Milliseconds",r)[v],T=v===D?this.$D+(g-this.$W):g;if(v===_||v===k){var I=this.clone().set(R,1);I.$d[E](T),I.init(),this.$d=I.set(R,Math.min(this.$D,I.daysInMonth())).$d}else E&&this.$d[E](T);return this.init(),this},d.set=function(l,g){return this.clone().$set(l,g)},d.get=function(l){return this[P.p(l)]()},d.add=function(l,g){var r,v=this;l=Number(l);var b=P.p(g),E=function(O){var N=S(v);return P.w(N.date(N.date()+Math.round(O*l)),v)};if(b===_)return this.set(_,this.$M+l);if(b===k)return this.set(k,this.$y+l);if(b===D)return E(1);if(b===M)return E(7);var T=(r={},r[s]=u,r[e]=C,r[h]=1e3,r)[b]||1,I=this.$d.getTime()+l*T;return P.w(I,this)},d.subtract=function(l,g){return this.add(-1*l,g)},d.format=function(l){var g=this,r=this.$locale();if(!this.isValid())return r.invalidDate||G;var v=l||"YYYY-MM-DDTHH:mm:ssZ",b=P.z(this),E=this.$H,T=this.$m,I=this.$M,O=r.weekdays,N=r.months,z=function(j,W,Q,te){return j&&(j[W]||j(g,v))||Q[W].slice(0,te)},K=function(j){return P.s(E%12||12,j,"0")},H=r.meridiem||function(j,W,Q){var te=j<12?"AM":"PM";return Q?te.toLowerCase():te};return v.replace($,function(j,W){return W||function(Q){switch(Q){case"YY":return String(g.$y).slice(-2);case"YYYY":return P.s(g.$y,4,"0");case"M":return I+1;case"MM":return P.s(I+1,2,"0");case"MMM":return z(r.monthsShort,I,N,3);case"MMMM":return z(N,I);case"D":return g.$D;case"DD":return P.s(g.$D,2,"0");case"d":return String(g.$W);case"dd":return z(r.weekdaysMin,g.$W,O,2);case"ddd":return z(r.weekdaysShort,g.$W,O,3);case"dddd":return O[g.$W];case"H":return String(E);case"HH":return P.s(E,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return H(E,T,!0);case"A":return H(E,T,!1);case"m":return String(T);case"mm":return P.s(T,2,"0");case"s":return String(g.$s);case"ss":return P.s(g.$s,2,"0");case"SSS":return P.s(g.$ms,3,"0");case"Z":return b}return null}(j)||b.replace(":","")})},d.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},d.diff=function(l,g,r){var v,b=this,E=P.p(g),T=S(l),I=(T.utcOffset()-this.utcOffset())*u,O=this-T,N=function(){return P.m(b,T)};switch(E){case k:v=N()/12;break;case _:v=N();break;case F:v=N()/3;break;case M:v=(O-I)/6048e5;break;case D:v=(O-I)/864e5;break;case e:v=O/C;break;case s:v=O/u;break;case h:v=O/1e3;break;default:v=O}return r?v:P.a(v)},d.daysInMonth=function(){return this.endOf(_).$D},d.$locale=function(){return A[this.$L]},d.locale=function(l,g){if(!l)return this.$L;var r=this.clone(),v=Z(l,g,!0);return v&&(r.$L=v),r},d.clone=function(){return P.w(this.$d,this)},d.toDate=function(){return new Date(this.valueOf())},d.toJSON=function(){return this.isValid()?this.toISOString():null},d.toISOString=function(){return this.$d.toISOString()},d.toString=function(){return this.$d.toUTCString()},m}(),le=ee.prototype;return S.prototype=le,[["$ms",p],["$s",h],["$m",s],["$H",e],["$W",D],["$M",_],["$y",k],["$D",R]].forEach(function(m){le[m[1]]=function(d){return this.$g(d,m[0],m[1])}}),S.extend=function(m,d){return m.$i||(m(d,ee,S),m.$i=!0),S},S.locale=Z,S.isDayjs=oe,S.unix=function(m){return S(1e3*m)},S.en=A[L],S.Ls=A,S.p={},S}()}}]);
|
package/8855.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[8855],{3183(P,x,o){o.d(x,{A:()=>C});var E=o(7705),_=o(5802),u=o(9417),m=o(1359),M=o(8957),T=o(2245),D=o(5381),a=o(5547);const r=(g,c)=>c.value;function v(g,c){if(1&g){const n=a.RV6();a.j41(0,"cue-input",6),a.bIt("valueChange",function(s){_.eBV(n);const t=a.XpG();return t.searchText=s,_.Njj(t.onSearchChange())}),a.k0s()}if(2&g){const n=a.XpG();a.Y8G("value",n.searchText)}}function i(g,c){if(1&g){const n=a.RV6();a.j41(0,"cue-checkbox",7),a.bIt("checkedChange",function(s){const t=_.eBV(n).$implicit,f=a.XpG();return t.selected=s,_.Njj(f.onSelectionChange())}),a.k0s()}if(2&g){const n=c.$implicit;a.Y8G("label",n.value||"(blank)")("checked",n.selected)}}function b(g,c){1&g&&(a.j41(0,"cue-typography",5),a.EFF(1,"No results"),a.k0s())}let C=(()=>{class g{_cdr=(0,_.WQX)(E.gRc);_params;options=[];filteredOptions=[];searchText="";agInit(n){this._params=n}afterGuiAttached(n){this._refreshOptions(),this._cdr.markForCheck()}onNewRowsLoaded(){this._refreshOptions(),this._cdr.markForCheck()}isFilterActive(){return this.options.some(n=>!n.selected)}doesFilterPass(n){const l=new Set(this.options.filter(e=>e.selected).map(e=>e.value)),s=this._params.getValue(n.node),t=null==s?"":String(s);return"..."===t||"Loading..."===t||(""===t?l.has(""):t.split(", ").map(e=>e.trim()).some(e=>l.has(e)))}getModel(){return this.isFilterActive()?{selectedValues:this.options.filter(n=>n.selected).map(n=>n.value)}:null}setModel(n){if(n){const l=new Set(n.selectedValues);this.options.forEach(s=>s.selected=l.has(s.value))}else this.options.forEach(l=>l.selected=!0);this._applySearch(),this._cdr.markForCheck()}onSelectionChange(){this._params.filterChangedCallback(),this._cdr.markForCheck()}onSearchChange(){this._applySearch(),this._cdr.markForCheck()}get allSelected(){return this.options.length>0&&this.options.every(n=>n.selected)}toggleAll(n){this.options.forEach(l=>l.selected=n),this._applySearch(),this._params.filterChangedCallback(),this._cdr.markForCheck()}_refreshOptions(){const n=new Set;this._params.api.forEachNode(s=>{const t=this._params.getValue(s);if(null==t||""===t)n.add("");else{const f=String(t);if("..."===f||"Loading..."===f)return;const e=f.split(", ").map(p=>p.trim());for(const p of e)n.add(p)}});const l=new Map(this.options.map(s=>[s.value,s.selected]));this.options=Array.from(n).sort((s,t)=>s.localeCompare(t)).map(s=>({value:s,selected:l.get(s)??!0})),this._applySearch()}_applySearch(){const n=this.searchText.toLowerCase().trim();this.filteredOptions=n?this.options.filter(l=>l.value.toLowerCase().includes(n)):this.options}static \u0275fac=function(l){return new(l||g)};static \u0275cmp=a.VBU({type:g,selectors:[["cue-multi-select-filter"]],decls:7,vars:3,consts:[["direction","column","gap","s"],["placeholder","Search...","size","s",3,"value"],["size","s","label","Select all",3,"checkedChange","checked"],[1,"msf-list"],["size","s",3,"label","checked"],["size","s"],["placeholder","Search...","size","s",3,"valueChange","value"],["size","s",3,"checkedChange","label","checked"]],template:function(l,s){1&l&&(a.j41(0,"cue-flexcontainer",0),a.nVh(1,v,1,1,"cue-input",1),a.j41(2,"cue-checkbox",2),a.bIt("checkedChange",function(f){return s.toggleAll(f)}),a.k0s(),a.j41(3,"div",3),a.Z7z(4,i,1,2,"cue-checkbox",4,r),a.nVh(6,b,2,0,"cue-typography",5),a.k0s()()),2&l&&(a.R7$(),a.vxM(s.options.length>10?1:-1),a.R7$(),a.Y8G("checked",s.allSelected),a.R7$(2),a.Dyx(s.filteredOptions),a.R7$(2),a.vxM(0===s.filteredOptions.length?6:-1))},dependencies:[u.YN,m.Checkbox,M.Input,T.Typography,D.n],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:200px;max-width:300px;box-sizing:border-box}.msf-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;max-height:200px;overflow-y:auto}"],changeDetection:0})}return g})()},5902(P,x,o){o.d(x,{U:()=>b});var E=o(7705),_=o(5802),u=o(2271),m=o(9352),M=o(8957),T=o(63),D=o(2245),a=o(5381),r=o(5547);function v(C,g){if(1&C){const c=r.RV6();r.j41(0,"cue-input",4),r.bIt("valueChange",function(l){_.eBV(c);const s=r.XpG();return _.Njj(s.onValueChange(l))}),r.k0s()}if(2&C){const c=r.XpG();r.Y8G("value",c.filterText)}}function i(C,g){if(1&C){const c=r.RV6();r.j41(0,"cue-typography",5),r.bIt("click",function(){_.eBV(c);const l=r.XpG();return _.Njj(l.clear())}),r.EFF(1,"Clear"),r.k0s()}}let b=(()=>{class C{_cdr=(0,_.WQX)(E.gRc);_params;filterText="";filterType="contains";filterTypeOptions=["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"];_labelContains=(0,m.Xx)("components.agGridColumnSelect.textFilterContains");_labelNotContains=(0,m.Xx)("components.agGridColumnSelect.textFilterNotContains");_labelEquals=(0,m.Xx)("components.agGridColumnSelect.textFilterEquals");_labelNotEqual=(0,m.Xx)("components.agGridColumnSelect.textFilterNotEqual");_labelStartsWith=(0,m.Xx)("components.agGridColumnSelect.textFilterStartsWith");_labelEndsWith=(0,m.Xx)("components.agGridColumnSelect.textFilterEndsWith");_labelBlank=(0,m.Xx)("components.agGridColumnSelect.textFilterBlank");_labelNotBlank=(0,m.Xx)("components.agGridColumnSelect.textFilterNotBlank");filterTypeLabelMap=(0,u.EW)(()=>({contains:this._labelContains(),notContains:this._labelNotContains(),equals:this._labelEquals(),notEqual:this._labelNotEqual(),startsWith:this._labelStartsWith(),endsWith:this._labelEndsWith(),blank:this._labelBlank(),notBlank:this._labelNotBlank()}));showTextInput=(0,u.EW)(()=>!["blank","notBlank"].includes(this.filterType));agInit(c){this._params=c}afterGuiAttached(c){this._cdr.markForCheck()}isFilterActive(){return!!["blank","notBlank"].includes(this.filterType)||this.filterText.trim().length>0}doesFilterPass(c){const n=this._params.getValue(c.node),l=null==n?"":String(n),s=this.filterText.toLowerCase().trim(),t=l.toLowerCase();switch(this.filterType){case"contains":default:return t.includes(s);case"notContains":return!t.includes(s);case"equals":return t===s;case"notEqual":return t!==s;case"startsWith":return t.startsWith(s);case"endsWith":return t.endsWith(s);case"blank":return""===l;case"notBlank":return""!==l}}getModel(){return this.isFilterActive()?{filterType:"text",type:this.filterType,filter:this.filterText}:null}setModel(c){this.filterText=c?.filter??"",this.filterType=c?.type??"contains",this._cdr.markForCheck()}onValueChange(c){this.filterText=c,this._params.filterChangedCallback(),this._cdr.markForCheck()}onFilterTypeChange(c){this.filterType=String(c||"contains"),["blank","notBlank"].includes(this.filterType)&&(this.filterText=""),this._params.filterChangedCallback(),this._cdr.markForCheck()}clear(){this.filterText="",this.filterType="contains",this._params.filterChangedCallback(),this._cdr.markForCheck()}static \u0275fac=function(n){return new(n||C)};static \u0275cmp=r.VBU({type:C,selectors:[["cue-text-filter"]],decls:4,vars:5,consts:[["direction","column","gap","s"],["size","s",3,"valueChange","value","options","labelMap"],["placeholder","Filter...","size","s",3,"value"],["size","s",2,"cursor","pointer","text-align","right"],["placeholder","Filter...","size","s",3,"valueChange","value"],["size","s",2,"cursor","pointer","text-align","right",3,"click"]],template:function(n,l){1&n&&(r.j41(0,"cue-flexcontainer",0)(1,"cue-select",1),r.bIt("valueChange",function(t){return l.onFilterTypeChange(t)}),r.k0s(),r.nVh(2,v,1,1,"cue-input",2),r.nVh(3,i,2,0,"cue-typography",3),r.k0s()),2&n&&(r.R7$(),r.Y8G("value",l.filterType)("options",l.filterTypeOptions)("labelMap",l.filterTypeLabelMap()),r.R7$(),r.vxM(l.showTextInput()?2:-1),r.R7$(),r.vxM(l.filterText||"contains"!==l.filterType?3:-1))},dependencies:[M.Input,T.Select,D.Typography,a.n],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:180px;max-width:280px;box-sizing:border-box}"],changeDetection:0})}return C})()},5448(P,x,o){o.d(x,{L:()=>M});var E=o(7705),_=o(2245),u=o(5547);const m=["*"];let M=(()=>{class T{fontSize=(0,E.hFB)("m");italic=(0,E.hFB)(!1);noWrap=(0,E.hFB)(!0);static \u0275fac=function(r){return new(r||T)};static \u0275cmp=u.VBU({type:T,selectors:[["cue-button-label"]],inputs:{fontSize:[1,"fontSize"],italic:[1,"italic"],noWrap:[1,"noWrap"]},ngContentSelectors:m,decls:3,vars:3,consts:[[3,"size","italic","noWrap"]],template:function(r,v){1&r&&(u.NAR(),u.j41(0,"div")(1,"cue-typography",0),u.SdG(2),u.k0s()()),2&r&&(u.R7$(),u.Y8G("size",v.fontSize())("italic",v.italic())("noWrap",v.noWrap()))},dependencies:[_.Typography],styles:["div[_ngcontent-%COMP%]{transform:translateY(.05em)}"]})}return T})()},7643(P,x,o){o.d(x,{CueEntityList:()=>s});var E=o(467),_=o(7705),u=o(5802),m=o(2271),M=o(2839),T=o(5381),D=o(2245),a=o(9769),r=o(7851),v=o(7293),i=o(5547);function b(t,f){if(1&t&&(i.j41(0,"cue-flexcontainer",2)(1,"cue-typography",4),i.EFF(2),i.k0s()()),2&t){const e=i.XpG(2);i.R7$(2),i.SpI(" ",e.errorMessage()," ")}}function C(t,f){if(1&t){const e=i.RV6();i.j41(0,"cue-ent-list-inner",7),i.bIt("rowClicked",function(d){u.eBV(e);const h=i.XpG(3);return u.Njj(h.rowClicked.emit(d))})("clickedOpen",function(d){u.eBV(e);const h=i.XpG(3);return u.Njj(h.clickedOpen.emit(d))}),i.k0s()}if(2&t){const e=i.XpG(3);i.Y8G("entities",e._displayIris())("entityData",e.entityData())("handlers",e.handlers())("mapboxToken",e.mapboxToken())("paginationPageSize",e.paginationPageSize())("size",e.size())("variant",e.variant())}}function g(t,f){1&t&&(i.j41(0,"cue-flexcontainer",2)(1,"cue-typography",8),i.EFF(2," No project connected. "),i.k0s()())}function c(t,f){if(1&t&&i.nrm(0,"cue-logo-link",6),2&t){let e;const p=i.XpG(3);i.Y8G("projectId",null==(e=p.sdkState())?null:e.projectId)}}function n(t,f){if(1&t&&(i.j41(0,"div",3),i.nVh(1,C,1,7,"cue-ent-list-inner",5)(2,g,3,0,"cue-flexcontainer",2),i.nVh(3,c,1,1,"cue-logo-link",6),i.k0s()),2&t){const e=i.XpG(2);i.Y8G("cueLogoLoader","loading"===e.state()),i.R7$(),i.vxM(e.handlers()?1:"loading"!==e.state()?2:-1),i.R7$(2),i.vxM(e.showLogo()?3:-1)}}function l(t,f){if(1&t&&i.nVh(0,b,3,1,"cue-flexcontainer",2)(1,n,4,3,"div",3),2&t){const e=i.XpG();i.vxM("error"===e.state()?0:1)}}let s=(()=>{class t{iris=(0,_.hFB)([]);categoryIris=(0,_.hFB)(void 0);sdkState=(0,_.hFB)(void 0);mapboxToken=(0,_.hFB)(void 0);paginationPageSize=(0,_.hFB)(10,{transform:_.Udg});size=(0,_.hFB)("m");variant=(0,_.hFB)("none");showLogo=(0,_.hFB)(!1,{transform:_.L39});rowClicked=(0,_.CGW)();clickedOpen=(0,_.CGW)();state=(0,u.vPA)("idle");errorMessage=(0,u.vPA)(null);entityData=(0,u.vPA)({});_entities=(0,u.vPA)(void 0);_categoryResolvedIris=(0,u.vPA)([]);_displayIris=(0,m.EW)(()=>void 0!==this.categoryIris()?this._categoryResolvedIris():this.iris());_unsubscribe;_inputWarningTimer;handlers=(0,m.EW)(()=>{var e=this;const p=this._entities();if(p)return{requestData:(d,h)=>{const y=d.map(k=>k.split("/").pop()).filter(Boolean);p.requestEntityData(y,h)},requestLocations:d=>{if(!this.mapboxToken())return void console.warn("[cue-entity-list] No mapboxToken provided \u2014 skipping map location fetch.");const h=d.map(y=>y.split("/").pop()).filter(Boolean);p.requestEntityLocations(h)},checkHasLocations:(d=(0,E.A)(function*(h){const y=e.sdkState()?.cue,k=e.sdkState()?.projectId;if(!(e.mapboxToken()&&y&&k&&h.length))return!1;const F=`PREFIX qcy: <https://dev.qaecy.com/ont#>\nASK WHERE {\n ?entity qcy:hasEntityCategory ?cat .\n FILTER(?cat IN (${h.map(S=>`<${S}>`).join(" ")}))\n { ?entity qcy:similarTo ?osm . FILTER(STRSTARTS(STR(?osm), "https://www.openstreetmap.org/")) }\n UNION\n { ?entity qcy:relatedEntity ?loc . ?loc qcy:similarTo ?osm . FILTER(STRSTARTS(STR(?osm), "https://www.openstreetmap.org/")) }\n}`;try{return!0===(yield y.api.sparql(F,k))?.boolean}catch{return!1}}),function(y){return d.apply(this,arguments)})};var d});constructor(){this._inputWarningTimer=setTimeout(()=>{this.sdkState()||console.warn('[cue-entity-list] Required input "sdkState" is not set. Pass a { entities: CueProjectEntities } (or include a `cue` instance) object to load entity data.')},3e3),(0,u.QZP)(()=>{this._setupEntities(this.sdkState()?.entities)}),(0,u.QZP)(()=>{const e=this.categoryIris(),p=this._entities();void 0!==e&&this._fetchByCategories(e,p)})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._teardown()}_setupEntities(e){if(this._teardown(),!e)return this._entities.set(void 0),this.entityData.set({}),void this.state.set("idle");this._entities.set(e),this.state.set("ready"),this._syncEntityData(e),this._unsubscribe=e.entityInfoMap.subscribe(()=>{this._syncEntityData(e)})}_syncEntityData(e){const p=e.entityInfoMap.get(),d={};for(const h of Object.keys(p)){const y=p[h],k=Array.isArray(y.documentRefs)?y.documentRefs.map(O=>"string"==typeof O?{id:O}:O):y.documentRefs;d[e.entityIri(h)]={...y,documentRefs:k}}this.entityData.set(d)}_fetchByCategories(e,p){var d=this;return(0,E.A)(function*(){if(p&&e.length){d.state.set("loading");try{const h=yield p.entitiesByCategory(e);d._categoryResolvedIris.set(h.map(y=>y.iri)),d.state.set("ready")}catch(h){console.error("[cue-entity-list] Failed to fetch entities by category",h),d.errorMessage.set("Failed to load entities for the given categories."),d.state.set("error")}}else d._categoryResolvedIris.set([])})()}_teardown(){this._unsubscribe?.(),this._unsubscribe=void 0}static \u0275fac=function(p){return new(p||t)};static \u0275cmp=i.VBU({type:t,selectors:[["cue-entity-list"]],inputs:{iris:[1,"iris"],categoryIris:[1,"categoryIris"],sdkState:[1,"sdkState"],mapboxToken:[1,"mapboxToken"],paginationPageSize:[1,"paginationPageSize"],size:[1,"size"],variant:[1,"variant"],showLogo:[1,"showLogo"]},outputs:{rowClicked:"rowClicked",clickedOpen:"clickedOpen"},decls:3,vars:1,consts:[["body",""],[3,"ngTemplateOutlet"],["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,"entities","entityData","handlers","mapboxToken","paginationPageSize","size","variant"],[2,"position","absolute","top","12px","right","12px","z-index","5",3,"projectId"],[2,"height","100%",3,"rowClicked","clickedOpen","entities","entityData","handlers","mapboxToken","paginationPageSize","size","variant"],[2,"color","#9ca3af","font-size","13px"]],template:function(p,d){if(1&p&&(i.DNE(0,l,2,1,"ng-template",null,0,i.C5r),i.eu8(2,1)),2&p){const h=i.sdS(1);i.R7$(2),i.Y8G("ngTemplateOutlet",h)}},dependencies:[M.u,T.n,D.Typography,a.T3,r.k,v.x],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return t})()}}]);
|
|
1
|
+
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[8855],{3183(P,x,o){o.d(x,{A:()=>C});var E=o(7705),_=o(5802),u=o(9417),m=o(1359),M=o(8957),T=o(2245),D=o(5381),a=o(5547);const r=(g,c)=>c.value;function v(g,c){if(1&g){const n=a.RV6();a.j41(0,"cue-input",6),a.bIt("valueChange",function(s){_.eBV(n);const t=a.XpG();return t.searchText=s,_.Njj(t.onSearchChange())}),a.k0s()}if(2&g){const n=a.XpG();a.Y8G("value",n.searchText)}}function i(g,c){if(1&g){const n=a.RV6();a.j41(0,"cue-checkbox",7),a.bIt("checkedChange",function(s){const t=_.eBV(n).$implicit,f=a.XpG();return t.selected=s,_.Njj(f.onSelectionChange())}),a.k0s()}if(2&g){const n=c.$implicit;a.Y8G("label",n.value||"(blank)")("checked",n.selected)}}function b(g,c){1&g&&(a.j41(0,"cue-typography",5),a.EFF(1,"No results"),a.k0s())}let C=(()=>{class g{_cdr=(0,_.WQX)(E.gRc);_params;options=[];filteredOptions=[];searchText="";agInit(n){this._params=n}afterGuiAttached(n){this._refreshOptions(),this._cdr.markForCheck()}onNewRowsLoaded(){this._refreshOptions(),this._cdr.markForCheck()}isFilterActive(){return this.options.some(n=>!n.selected)}doesFilterPass(n){const l=new Set(this.options.filter(e=>e.selected).map(e=>e.value)),s=this._params.getValue(n.node),t=null==s?"":String(s);return"..."===t||"Loading..."===t||(""===t?l.has(""):t.split(", ").map(e=>e.trim()).some(e=>l.has(e)))}getModel(){return this.isFilterActive()?{selectedValues:this.options.filter(n=>n.selected).map(n=>n.value)}:null}setModel(n){if(n){const l=new Set(n.selectedValues);this.options.forEach(s=>s.selected=l.has(s.value))}else this.options.forEach(l=>l.selected=!0);this._applySearch(),this._cdr.markForCheck()}onSelectionChange(){this._params.filterChangedCallback(),this._cdr.markForCheck()}onSearchChange(){this._applySearch(),this._cdr.markForCheck()}get allSelected(){return this.options.length>0&&this.options.every(n=>n.selected)}toggleAll(n){this.options.forEach(l=>l.selected=n),this._applySearch(),this._params.filterChangedCallback(),this._cdr.markForCheck()}_refreshOptions(){const n=new Set;this._params.api.forEachNode(s=>{const t=this._params.getValue(s);if(null==t||""===t)n.add("");else{const f=String(t);if("..."===f||"Loading..."===f)return;const e=f.split(", ").map(p=>p.trim());for(const p of e)n.add(p)}});const l=new Map(this.options.map(s=>[s.value,s.selected]));this.options=Array.from(n).sort((s,t)=>s.localeCompare(t)).map(s=>({value:s,selected:l.get(s)??!0})),this._applySearch()}_applySearch(){const n=this.searchText.toLowerCase().trim();this.filteredOptions=n?this.options.filter(l=>l.value.toLowerCase().includes(n)):this.options}static \u0275fac=function(l){return new(l||g)};static \u0275cmp=a.VBU({type:g,selectors:[["cue-multi-select-filter"]],decls:7,vars:3,consts:[["direction","column","gap","s"],["placeholder","Search...","size","s",3,"value"],["size","s","label","Select all",3,"checkedChange","checked"],[1,"msf-list"],["size","s",3,"label","checked"],["size","s"],["placeholder","Search...","size","s",3,"valueChange","value"],["size","s",3,"checkedChange","label","checked"]],template:function(l,s){1&l&&(a.j41(0,"cue-flexcontainer",0),a.nVh(1,v,1,1,"cue-input",1),a.j41(2,"cue-checkbox",2),a.bIt("checkedChange",function(f){return s.toggleAll(f)}),a.k0s(),a.j41(3,"div",3),a.Z7z(4,i,1,2,"cue-checkbox",4,r),a.nVh(6,b,2,0,"cue-typography",5),a.k0s()()),2&l&&(a.R7$(),a.vxM(s.options.length>10?1:-1),a.R7$(),a.Y8G("checked",s.allSelected),a.R7$(2),a.Dyx(s.filteredOptions),a.R7$(2),a.vxM(0===s.filteredOptions.length?6:-1))},dependencies:[u.YN,m.Checkbox,M.Input,T.Typography,D.FlexContainer],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:200px;max-width:300px;box-sizing:border-box}.msf-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;max-height:200px;overflow-y:auto}"],changeDetection:0})}return g})()},5902(P,x,o){o.d(x,{U:()=>b});var E=o(7705),_=o(5802),u=o(2271),m=o(9352),M=o(8957),T=o(63),D=o(2245),a=o(5381),r=o(5547);function v(C,g){if(1&C){const c=r.RV6();r.j41(0,"cue-input",4),r.bIt("valueChange",function(l){_.eBV(c);const s=r.XpG();return _.Njj(s.onValueChange(l))}),r.k0s()}if(2&C){const c=r.XpG();r.Y8G("value",c.filterText)}}function i(C,g){if(1&C){const c=r.RV6();r.j41(0,"cue-typography",5),r.bIt("click",function(){_.eBV(c);const l=r.XpG();return _.Njj(l.clear())}),r.EFF(1,"Clear"),r.k0s()}}let b=(()=>{class C{_cdr=(0,_.WQX)(E.gRc);_params;filterText="";filterType="contains";filterTypeOptions=["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"];_labelContains=(0,m.Xx)("components.agGridColumnSelect.textFilterContains");_labelNotContains=(0,m.Xx)("components.agGridColumnSelect.textFilterNotContains");_labelEquals=(0,m.Xx)("components.agGridColumnSelect.textFilterEquals");_labelNotEqual=(0,m.Xx)("components.agGridColumnSelect.textFilterNotEqual");_labelStartsWith=(0,m.Xx)("components.agGridColumnSelect.textFilterStartsWith");_labelEndsWith=(0,m.Xx)("components.agGridColumnSelect.textFilterEndsWith");_labelBlank=(0,m.Xx)("components.agGridColumnSelect.textFilterBlank");_labelNotBlank=(0,m.Xx)("components.agGridColumnSelect.textFilterNotBlank");filterTypeLabelMap=(0,u.EW)(()=>({contains:this._labelContains(),notContains:this._labelNotContains(),equals:this._labelEquals(),notEqual:this._labelNotEqual(),startsWith:this._labelStartsWith(),endsWith:this._labelEndsWith(),blank:this._labelBlank(),notBlank:this._labelNotBlank()}));showTextInput=(0,u.EW)(()=>!["blank","notBlank"].includes(this.filterType));agInit(c){this._params=c}afterGuiAttached(c){this._cdr.markForCheck()}isFilterActive(){return!!["blank","notBlank"].includes(this.filterType)||this.filterText.trim().length>0}doesFilterPass(c){const n=this._params.getValue(c.node),l=null==n?"":String(n),s=this.filterText.toLowerCase().trim(),t=l.toLowerCase();switch(this.filterType){case"contains":default:return t.includes(s);case"notContains":return!t.includes(s);case"equals":return t===s;case"notEqual":return t!==s;case"startsWith":return t.startsWith(s);case"endsWith":return t.endsWith(s);case"blank":return""===l;case"notBlank":return""!==l}}getModel(){return this.isFilterActive()?{filterType:"text",type:this.filterType,filter:this.filterText}:null}setModel(c){this.filterText=c?.filter??"",this.filterType=c?.type??"contains",this._cdr.markForCheck()}onValueChange(c){this.filterText=c,this._params.filterChangedCallback(),this._cdr.markForCheck()}onFilterTypeChange(c){this.filterType=String(c||"contains"),["blank","notBlank"].includes(this.filterType)&&(this.filterText=""),this._params.filterChangedCallback(),this._cdr.markForCheck()}clear(){this.filterText="",this.filterType="contains",this._params.filterChangedCallback(),this._cdr.markForCheck()}static \u0275fac=function(n){return new(n||C)};static \u0275cmp=r.VBU({type:C,selectors:[["cue-text-filter"]],decls:4,vars:5,consts:[["direction","column","gap","s"],["size","s",3,"valueChange","value","options","labelMap"],["placeholder","Filter...","size","s",3,"value"],["size","s",2,"cursor","pointer","text-align","right"],["placeholder","Filter...","size","s",3,"valueChange","value"],["size","s",2,"cursor","pointer","text-align","right",3,"click"]],template:function(n,l){1&n&&(r.j41(0,"cue-flexcontainer",0)(1,"cue-select",1),r.bIt("valueChange",function(t){return l.onFilterTypeChange(t)}),r.k0s(),r.nVh(2,v,1,1,"cue-input",2),r.nVh(3,i,2,0,"cue-typography",3),r.k0s()),2&n&&(r.R7$(),r.Y8G("value",l.filterType)("options",l.filterTypeOptions)("labelMap",l.filterTypeLabelMap()),r.R7$(),r.vxM(l.showTextInput()?2:-1),r.R7$(),r.vxM(l.filterText||"contains"!==l.filterType?3:-1))},dependencies:[M.Input,T.Select,D.Typography,a.FlexContainer],styles:["[_nghost-%COMP%]{display:block;padding:var(--cue-card-padding-y) var(--cue-card-padding-x);min-width:180px;max-width:280px;box-sizing:border-box}"],changeDetection:0})}return C})()},5448(P,x,o){o.d(x,{ButtonLabel:()=>M});var E=o(7705),_=o(2245),u=o(5547);const m=["*"];let M=(()=>{class T{fontSize=(0,E.hFB)("m");italic=(0,E.hFB)(!1);noWrap=(0,E.hFB)(!0);static \u0275fac=function(r){return new(r||T)};static \u0275cmp=u.VBU({type:T,selectors:[["cue-button-label"]],inputs:{fontSize:[1,"fontSize"],italic:[1,"italic"],noWrap:[1,"noWrap"]},ngContentSelectors:m,decls:3,vars:3,consts:[[3,"size","italic","noWrap"]],template:function(r,v){1&r&&(u.NAR(),u.j41(0,"div")(1,"cue-typography",0),u.SdG(2),u.k0s()()),2&r&&(u.R7$(),u.Y8G("size",v.fontSize())("italic",v.italic())("noWrap",v.noWrap()))},dependencies:[_.Typography],styles:["div[_ngcontent-%COMP%]{transform:translateY(.05em)}"]})}return T})()},7643(P,x,o){o.d(x,{CueEntityList:()=>s});var E=o(467),_=o(7705),u=o(5802),m=o(2271),M=o(2839),T=o(5381),D=o(2245),a=o(9769),r=o(7851),v=o(7293),i=o(5547);function b(t,f){if(1&t&&(i.j41(0,"cue-flexcontainer",2)(1,"cue-typography",4),i.EFF(2),i.k0s()()),2&t){const e=i.XpG(2);i.R7$(2),i.SpI(" ",e.errorMessage()," ")}}function C(t,f){if(1&t){const e=i.RV6();i.j41(0,"cue-ent-list-inner",7),i.bIt("rowClicked",function(d){u.eBV(e);const h=i.XpG(3);return u.Njj(h.rowClicked.emit(d))})("clickedOpen",function(d){u.eBV(e);const h=i.XpG(3);return u.Njj(h.clickedOpen.emit(d))}),i.k0s()}if(2&t){const e=i.XpG(3);i.Y8G("entities",e._displayIris())("entityData",e.entityData())("handlers",e.handlers())("mapboxToken",e.mapboxToken())("paginationPageSize",e.paginationPageSize())("size",e.size())("variant",e.variant())}}function g(t,f){1&t&&(i.j41(0,"cue-flexcontainer",2)(1,"cue-typography",8),i.EFF(2," No project connected. "),i.k0s()())}function c(t,f){if(1&t&&i.nrm(0,"cue-logo-link",6),2&t){let e;const p=i.XpG(3);i.Y8G("projectId",null==(e=p.sdkState())?null:e.projectId)}}function n(t,f){if(1&t&&(i.j41(0,"div",3),i.nVh(1,C,1,7,"cue-ent-list-inner",5)(2,g,3,0,"cue-flexcontainer",2),i.nVh(3,c,1,1,"cue-logo-link",6),i.k0s()),2&t){const e=i.XpG(2);i.Y8G("cueLogoLoader","loading"===e.state()),i.R7$(),i.vxM(e.handlers()?1:"loading"!==e.state()?2:-1),i.R7$(2),i.vxM(e.showLogo()?3:-1)}}function l(t,f){if(1&t&&i.nVh(0,b,3,1,"cue-flexcontainer",2)(1,n,4,3,"div",3),2&t){const e=i.XpG();i.vxM("error"===e.state()?0:1)}}let s=(()=>{class t{iris=(0,_.hFB)([]);categoryIris=(0,_.hFB)(void 0);sdkState=(0,_.hFB)(void 0);mapboxToken=(0,_.hFB)(void 0);paginationPageSize=(0,_.hFB)(10,{transform:_.Udg});size=(0,_.hFB)("m");variant=(0,_.hFB)("none");showLogo=(0,_.hFB)(!1,{transform:_.L39});rowClicked=(0,_.CGW)();clickedOpen=(0,_.CGW)();state=(0,u.vPA)("idle");errorMessage=(0,u.vPA)(null);entityData=(0,u.vPA)({});_entities=(0,u.vPA)(void 0);_categoryResolvedIris=(0,u.vPA)([]);_displayIris=(0,m.EW)(()=>void 0!==this.categoryIris()?this._categoryResolvedIris():this.iris());_unsubscribe;_inputWarningTimer;handlers=(0,m.EW)(()=>{var e=this;const p=this._entities();if(p)return{requestData:(d,h)=>{const y=d.map(k=>k.split("/").pop()).filter(Boolean);p.requestEntityData(y,h)},requestLocations:d=>{if(!this.mapboxToken())return void console.warn("[cue-entity-list] No mapboxToken provided \u2014 skipping map location fetch.");const h=d.map(y=>y.split("/").pop()).filter(Boolean);p.requestEntityLocations(h)},checkHasLocations:(d=(0,E.A)(function*(h){const y=e.sdkState()?.cue,k=e.sdkState()?.projectId;if(!(e.mapboxToken()&&y&&k&&h.length))return!1;const F=`PREFIX qcy: <https://dev.qaecy.com/ont#>\nASK WHERE {\n ?entity qcy:hasEntityCategory ?cat .\n FILTER(?cat IN (${h.map(S=>`<${S}>`).join(" ")}))\n { ?entity qcy:similarTo ?osm . FILTER(STRSTARTS(STR(?osm), "https://www.openstreetmap.org/")) }\n UNION\n { ?entity qcy:relatedEntity ?loc . ?loc qcy:similarTo ?osm . FILTER(STRSTARTS(STR(?osm), "https://www.openstreetmap.org/")) }\n}`;try{return!0===(yield y.api.sparql(F,k))?.boolean}catch{return!1}}),function(y){return d.apply(this,arguments)})};var d});constructor(){this._inputWarningTimer=setTimeout(()=>{this.sdkState()||console.warn('[cue-entity-list] Required input "sdkState" is not set. Pass a { entities: CueProjectEntities } (or include a `cue` instance) object to load entity data.')},3e3),(0,u.QZP)(()=>{this._setupEntities(this.sdkState()?.entities)}),(0,u.QZP)(()=>{const e=this.categoryIris(),p=this._entities();void 0!==e&&this._fetchByCategories(e,p)})}ngOnDestroy(){clearTimeout(this._inputWarningTimer),this._teardown()}_setupEntities(e){if(this._teardown(),!e)return this._entities.set(void 0),this.entityData.set({}),void this.state.set("idle");this._entities.set(e),this.state.set("ready"),this._syncEntityData(e),this._unsubscribe=e.entityInfoMap.subscribe(()=>{this._syncEntityData(e)})}_syncEntityData(e){const p=e.entityInfoMap.get(),d={};for(const h of Object.keys(p)){const y=p[h],k=Array.isArray(y.documentRefs)?y.documentRefs.map(O=>"string"==typeof O?{id:O}:O):y.documentRefs;d[e.entityIri(h)]={...y,documentRefs:k}}this.entityData.set(d)}_fetchByCategories(e,p){var d=this;return(0,E.A)(function*(){if(p&&e.length){d.state.set("loading");try{const h=yield p.entitiesByCategory(e);d._categoryResolvedIris.set(h.map(y=>y.iri)),d.state.set("ready")}catch(h){console.error("[cue-entity-list] Failed to fetch entities by category",h),d.errorMessage.set("Failed to load entities for the given categories."),d.state.set("error")}}else d._categoryResolvedIris.set([])})()}_teardown(){this._unsubscribe?.(),this._unsubscribe=void 0}static \u0275fac=function(p){return new(p||t)};static \u0275cmp=i.VBU({type:t,selectors:[["cue-entity-list"]],inputs:{iris:[1,"iris"],categoryIris:[1,"categoryIris"],sdkState:[1,"sdkState"],mapboxToken:[1,"mapboxToken"],paginationPageSize:[1,"paginationPageSize"],size:[1,"size"],variant:[1,"variant"],showLogo:[1,"showLogo"]},outputs:{rowClicked:"rowClicked",clickedOpen:"clickedOpen"},decls:3,vars:1,consts:[["body",""],[3,"ngTemplateOutlet"],["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,"entities","entityData","handlers","mapboxToken","paginationPageSize","size","variant"],[2,"position","absolute","top","12px","right","12px","z-index","5",3,"projectId"],[2,"height","100%",3,"rowClicked","clickedOpen","entities","entityData","handlers","mapboxToken","paginationPageSize","size","variant"],[2,"color","#9ca3af","font-size","13px"]],template:function(p,d){if(1&p&&(i.DNE(0,l,2,1,"ng-template",null,0,i.C5r),i.eu8(2,1)),2&p){const h=i.sdS(1);i.R7$(2),i.Y8G("ngTemplateOutlet",h)}},dependencies:[M.u,T.FlexContainer,D.Typography,a.T3,r.k,v.x],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return t})()}}]);
|