@qaecy/cue-ui 0.0.26 → 0.0.27
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/112.js +1 -1
- package/240.js +1 -0
- package/311.js +1 -1
- package/418.js +1 -1
- package/419.js +1 -1
- package/540.js +1 -1
- package/571.js +1 -1
- package/613.js +1 -0
- package/645.js +1 -0
- package/741.js +1 -1
- package/{544.js → 873.js} +1 -1
- package/911.js +1 -1
- package/README.md +4 -0
- package/common.js +1 -1
- package/index.js +1 -1
- package/main.js +1 -1
- package/package.json +1 -1
package/112.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[112],{3112(Ve,V,h){h.d(V,{CueDocumentViewer:()=>Te});var p=h(467),d=h(7705),g=h(2271),r=h(5802),e=h(5547),x=h(9769),M=h(5381),E=h(2245),j=h(1024),P=h(9421),S=h(5903),C=h(9352),N=h(6117),k=h(8547),D=h(3319),w=h(5971),A=h(7573);const L=(o,u)=>t=>t.isHighlight;function G(o,u){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 $(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-button",5),e.bIt("click",function(i){r.eBV(t);const a=e.XpG(2).$implicit,l=e.XpG();return r.Njj(l.onDeleteHighlight(i,a.highlight))}),e.nrm(1,"cue-button-icon",6),e.k0s()}}function B(o,u){if(1&o){const t=e.RV6();e.j41(0,"span",2),e.bIt("click",function(){r.eBV(t);const i=e.XpG().$implicit,a=e.XpG();return r.Njj(a.onHighlightClick(i.highlight))}),e.nVh(1,G,2,1,"span",3),e.EFF(2),e.nVh(3,$,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 O(o,u){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 X(o,u){if(1&o&&e.nVh(0,B,4,4,"span",1)(1,O,2,2,"span"),2&o){const t=u.$implicit;e.vxM(t.isHighlight&&t.highlight?0:1)}}let U=(()=>{class o{path=d.hFB.required();highlights=(0,d.hFB)([]);allowDelete=(0,d.hFB)(!1);allowAdd=(0,d.hFB)(!1);size=(0,d.hFB)("m");highlightClick=(0,d.CGW)();deleteHighlight=(0,d.CGW)();textSelected=(0,d.CGW)();segments=(0,g.EW)(()=>this.parseSegments(this.path(),this.highlights()));parseSegments(t,n){const i=n.filter(c=>c.path===t);if(0===i.length)return[{text:t,isHighlight:!1,segmentStart:0}];const a=[...i].sort((c,f)=>c.start-f.start),l=[];let s=0;for(const c of a)c.start>s&&l.push({text:t.substring(s,c.start),isHighlight:!1,segmentStart:s}),l.push({text:t.substring(c.start,c.end),isHighlight:!0,highlight:c,segmentStart:c.start}),s=c.end;return s<t.length&&l.push({text:t.substring(s),isHighlight:!1,segmentStart:s}),l}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),l=t.currentTarget,s=this.getAbsoluteOffset(l,a.startContainer,a.startOffset),c=this.getAbsoluteOffset(l,a.endContainer,a.endOffset);n.removeAllRanges(),c>s&&this.textSelected.emit({path:this.path(),start:s,end:c,text:this.path().substring(s,c)})}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 f=parseInt(a.getAttribute("data-segment-start"),10);let m=0;const v=document.createTreeWalker(a,NodeFilter.SHOW_TEXT);let _=v.nextNode();for(;_&&_!==n;)m+=_.textContent?.length??0,_=v.nextNode();return f+m+i}a=a.parentElement}const l=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let s=0,c=l.nextNode();for(;c&&c!==n;)s+=c.textContent?.length??0,c=l.nextNode();return s+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(l){return i.onMouseUp(l)}),e.Z7z(1,X,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:[x.MD,w.$,D.a],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 H=h(5745),W=h(2444),z=h(9695),Y=h(5448),J=h(6950);const F=o=>({count:o}),Q=(o,u)=>t=>t.iri;function q(o,u){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 K(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-ag-grid",16),e.bIt("selectedRows",function(i){r.eBV(t);const a=e.XpG(4);return r.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 Z(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-flexcontainer",12)(1,"cue-button",13),e.bIt("click",function(){r.eBV(t);const i=e.XpG(3);return r.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,K,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,F,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,F,t._selectedPaths().length)))}}function ee(o,u){if(1&o&&e.nVh(0,q,3,3,"cue-typography",11)(1,Z,10,14),2&o){const t=e.XpG(2);e.vxM(t._fileLocationsLoading()?0:null!==t._fileLocations()?1:-1)}}function te(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-flexcontainer",9)(1,"cue-input-switch",10),e.bIt("toggleChange",function(i){r.eBV(t);const a=e.XpG();return r.Njj(a.onApplyToAllChange(i))}),e.k0s(),e.j41(2,"cue-typography",11),e.EFF(3),e.nI1(4,"transloco"),e.k0s()(),e.nVh(5,ee,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 ne(o,u){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 ie=(()=>{class o{selection=d.hFB.required();availableEntityCategories=(0,d.hFB)([]);fileLocations=(0,d.hFB)([]);requestFileLocations=(0,d.hFB)(void 0);requestFilePathEntityAdd=(0,d.hFB)(void 0);confirm=(0,d.CGW)();cancel=(0,d.CGW)();_selectedEntityCategory=(0,r.vPA)("");_applyToAllFiles=(0,r.vPA)(!1);_fileLocations=(0,r.vPA)(null);_fileLocationsLoading=(0,r.vPA)(!1);_matchTableExpanded=(0,r.vPA)(!1);_selectedPaths=(0,r.vPA)([]);_saving=(0,r.vPA)(!1);_saveError=(0,r.vPA)(null);_dirPrefix=(0,g.EW)(()=>{const t=this.selection();return t.path.substring(0,t.end)});_matchedLocations=(0,g.EW)(()=>{const t=this._fileLocations();if(!t)return[];const n=this._dirPrefix();return t.filter(i=>i.path.startsWith(n))});_matchCount=(0,g.EW)(()=>this._matchedLocations().length);_matchTableRowData=(0,g.EW)(()=>this._matchedLocations().map(t=>({iri:t.iri,path:t.path,providerId:t.providerId})));_entityCategoryLabelMap=(0,g.EW)(()=>this.availableEntityCategories().reduce((t,n)=>(t[n.iri]=n.label,t),{}));_matchTableRowSelection={mode:"multiRow",selectAll:"filtered"};_filePathLabel=(0,C.Xx)("components.contentBlocks.documentViewer.labelFilePath");_matchTableColDefs=(0,g.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,p.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 l=n._dirPrefix();n._selectedPaths.set(a.filter(s=>s.path.startsWith(l)))}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,p.A)(function*(){const n=t._selectedEntityCategory();if(!n)return;const i=t.selection().path,a=t._fileLocations()?.find(c=>c.path===i)??t.fileLocations().find(c=>c.path===i)??{iri:"",path:i},l=t._applyToAllFiles()&&t._selectedPaths().length>0?t._selectedPaths():[a],s=t.requestFilePathEntityAdd();if(s){t._saving.set(!0),t._saveError.set(null);try{yield s(n,l)}catch(c){return console.error("[EntityMentionModal] Failed to save entity mention:",c),t._saveError.set(c instanceof Error?c.message:String(c)),void t._saving.set(!1)}t._saving.set(!1)}t.confirm.emit({entityCategory:n,paths:l})})()}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(l){return i.onEntityCategoryChange(l)}),e.k0s(),e.nVh(7,te,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,ne,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,Q,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.n,P.F,D.a,w.$,Y.L,E.Typography,H.a,W.l,z.d,J.R,C.Kj],styles:[".modal-content[_ngcontent-%COMP%]{width:640px;max-width:calc(100vw - 32px)}"],changeDetection:0})}return o})();const oe=()=>[];function ae(o,u){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 le(o,u){if(1&o&&(e.j41(0,"cue-key-val-list"),e.nVh(1,ae,2,4,"cue-key-val",6),e.k0s()),2&o){const t=e.XpG();e.R7$(),e.vxM(t.subject()?1:-1)}}function se(o,u){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 re(o,u){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 ce(o,u){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 de(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-button",19),e.bIt("click",function(){r.eBV(t);const i=e.XpG(3);return r.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 ue(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-button",19),e.bIt("click",function(){r.eBV(t);const i=e.XpG(3);return r.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,u){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,ce,2,2,"span",15),e.k0s()(),e.j41(6,"dd",16),e.nVh(7,de,2,1,"cue-button",17),e.j41(8,"cue-file-path-viewer",18),e.bIt("textSelected",function(i){r.eBV(t);const a=e.XpG(2);return r.Njj(a.onTextSelected(i))}),e.k0s(),e.nVh(9,ue,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,oe))("allowDelete",t.filePathEntitiesEditable())("allowAdd",t.filePathEntitiesEditable()),e.R7$(),e.vxM(t.fileLocations().length>1?9:-1)}}function ge(o,u){if(1&o&&(e.j41(0,"cue-key-val-list"),e.nrm(1,"hr"),e.nVh(2,re,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,u){if(1&o){const t=e.RV6();e.j41(0,"cue-entity-mention-modal",22),e.bIt("confirm",function(i){r.eBV(t);const a=e.XpG();return r.Njj(a.onEntityMentionConfirm(i))})("cancel",function(){r.eBV(t);const i=e.XpG();return r.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 me=(()=>{class o{subject=d.hFB.required();handlers=d.hFB.required();dataChanged=(0,d.CGW)();filePathEntityAdded=(0,d.CGW)();fileLocations=(0,d.hFB)([]);_fileLocationsProvider=(0,g.EW)(()=>{const t=this.handlers().requestFileLocations;if(t)return t;const n=this.fileLocations();return n.length?()=>Promise.resolve(n):void 0});filePathEntities=(0,d.geq)([]);contentCategories=(0,d.hFB)([]);contentCategoriesEditable=(0,d.hFB)(!1);filePathEntitiesVisible=(0,d.hFB)(!1);filePathEntitiesEditable=(0,d.hFB)(!1);menuItems=(0,d.hFB)([]);availableContentCategories=(0,d.hFB)([]);availableEntityCategories=(0,d.hFB)([]);collapsed=(0,d.hFB)(!1);hasDocInfo=(0,g.EW)(()=>{const t=""!==this.subject(),n=this.fileLocations().length>0;return t||n});currentFilePathIndex=(0,r.vPA)(0);_entityCategoryModalVisible=(0,r.vPA)(!1);_pendingSelection=(0,r.vPA)(null);_requestFilePathEntityAdd=(0,g.EW)(()=>{var t=this;const n=this.handlers().requestFilePathEntityAdd;if(n)return function(){var i=(0,p.A)(function*(a,l){const s=t._pendingSelection();s&&(yield n({paths:l,start:s.start,end:s.end,text:s.text,entityCategory:a,folderPath:s.path.substring(0,s.end)}))});return function(a,l){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,g.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,g.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,g.uu)(()=>this.contentCategories());contentCategoriesString=(0,g.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,C.Xx)("components.documentInfo.infoChangeContentCategory");rdfEditConfig=(0,g.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,p.A)(function*(a){console.log(a);const l={subject:t.subject(),predicate:`${A.E.qcy}contentCategory`,objects:t._contentCategories(),newObjects:a.newValue,type:"contentCategory",comment:a.comment};yield n(l),t._contentCategories.set(a.newValue),t.dataChanged.emit({contentCategories:a.newValue})}),function(l){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,le,2,1,"cue-key-val-list"),e.k0s(),e.nVh(4,se,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.n,j.p,P.F,S.L,N.W,k.T,D.a,w.$,U,E.Typography,ie,C.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 pe{requestRDFChange;requestFileLocations;requestFilePathEntityAdd}var _e=h(2065),ve=h(5187);const be=["viewerHost"];function Ce(o,u){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 ye(o,u){1&o&&(e.j41(0,"cue-flexcontainer",5)(1,"cue-typography"),e.EFF(2,"Loading\u2026"),e.k0s()())}function xe(o,u){if(1&o&&(e.j41(0,"cue-flexcontainer",5)(1,"cue-typography",7),e.EFF(2),e.k0s()()),2&o){const t=e.XpG(2);e.R7$(2),e.JRh(t.errorMessage())}}function Me(o,u){if(1&o&&(e.j41(0,"div",3),e.nVh(1,Ce,1,3,"cue-document-info",4),e.nVh(2,ye,3,0,"cue-flexcontainer",5)(3,xe,3,1,"cue-flexcontainer",5),e.j41(4,"div",6),e.eu8(5,null,1),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)}}function Ee(o,u){1&o&&e.eu8(0)}function De(o,u){if(1&o&&(e.j41(0,"cue-card",2),e.DNE(1,Ee,1,0,"ng-container",8),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 we(o,u){1&o&&e.eu8(0)}function Pe(o,u){if(1&o&&e.DNE(0,we,1,0,"ng-container",8),2&o){e.XpG();const t=e.sdS(1);e.Y8G("ngTemplateOutlet",t)}}const Fe=[".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"];function I(o){const[u,t]=o.split("?"),n=u.trim();let i=null;if(t){const l=new URLSearchParams(t).get("page");if(null!==l){const s=parseInt(l,10);!isNaN(s)&&s>0&&(i=s)}}return{uuid:n,page:i}}let Te=(()=>{class o{set _viewerHostRef(t){if(this._viewerHost=t,t&&this._lastRenderArgs){const{url:n,suffix:i,page:a,viewerTypeOverride:l}=this._lastRenderArgs;this._renderViewer(n,i,a,l)}}_viewerHost;_lastRenderArgs;currentViewerRef;cue=(0,d.hFB)(void 0);uuid=(0,d.hFB)(void 0);projectId=(0,d.hFB)(void 0);showDocumentInfo=(0,d.hFB)(!0);extraMenuItems=(0,d.hFB)([]);portalBaseURL=(0,d.hFB)("https://cue.qaecy.com");variant=(0,d.hFB)("none");_cardVariant=(0,g.EW)(()=>this.variant());state=(0,r.vPA)("idle");errorMessage=(0,r.vPA)(null);resolvedUrl=(0,r.vPA)(null);resolvedSuffix=(0,r.vPA)(null);_docSubject=(0,r.vPA)("");_alternatives=(0,r.vPA)([]);_originalUuid=(0,r.vPA)(null);_originalDocSuffix=(0,r.vPA)(null);_cueSnapshot=null;_projectIdSnapshot=null;_docInfoHandlers=new pe;_menuItems=(0,g.EW)(()=>{const t=[],n=this._originalUuid(),i=this._originalDocSuffix();n&&i&&t.push({icon:"download",label:"Download file",action:()=>this._downloadOriginal()});const a=this.uuid(),l=this.projectId();if(a&&l){const{uuid:c}=I(a),f=this.portalBaseURL().replace(/\/$/,"");t.push({icon:"external-link",label:"Open in Cue",action:()=>window.open(`${f}/r/${l}/${c}`,"_blank","noopener,noreferrer")})}const s=this._alternatives();if(s.length>1){const c=this.resolvedSuffix();t.push({icon:"document",label:"Alternative representation",children:s.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(){(0,r.QZP)(()=>{const t=this.cue(),n=this.uuid(),i=this.projectId();t&&n&&i?this._load(t,n,i):this.state.set("idle")})}_load(t,n,i){var a=this;return(0,p.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:l,page:s}=I(n),c=t.createProjectDocuments(i),m=(yield c.fetchDocumentData([l]))[l];if(!m)throw new Error(`Document '${l}' not found in project '${i}'.`);a._docSubject.set(m.subject??""),a._originalUuid.set(l),a._originalDocSuffix.set(m.suffix);const v=yield c.fetchAlternativeRepresentations(l);a._alternatives.set([{uuid:l,suffix:m.suffix,original:!0},...v.filter(b=>b.id!==l).map(b=>({uuid:b.id,suffix:b.suffix,original:!1,remoteRelativePath:b.remoteRelativePath}))]);const{uuid:_,suffix:y,remoteRelativePath:T}=function Ie(o,u){const t=[o,...u];let n,i=1/0;for(const a of t){const l=Fe.indexOf(a.suffix);-1!==l&&l<i&&(i=l,n=a)}return n?{uuid:n.id,suffix:n.suffix,remoteRelativePath:n.remoteRelativePath}:{uuid:o.id,suffix:o.suffix}}(m,v),R=T?yield t.storage.getAltRepDownloadUrl(T):yield t.storage.getDownloadUrl(i,_,y);a.resolvedUrl.set(R),a.resolvedSuffix.set(y);const Re=[".eml",".msg",".emlx",".mbx"].includes(m.suffix)&&".json"===y?"email":void 0;yield a._renderViewer(R,y,s,Re),a.state.set("ready")}catch(l){const s=l instanceof Error?l.message:String(l);console.error("[CueDocumentViewerWC] Failed to load document:",s),a.errorMessage.set(s),a.state.set("error")}}else a.state.set("idle")})()}_renderViewer(t,n,i,a){var l=this;return(0,p.A)(function*(){try{const{DocumentViewer:s}=yield Promise.all([h.e(418),h.e(76),h.e(741)]).then(h.bind(h,1741)),{DocumentViewerSettings:c}=yield h.e(418).then(h.bind(h,3418));l._viewerHost?.clear(),l.currentViewerRef?.destroy();const f=new c;if(null!==i&&(f.pdf.page=String(i)),!l._viewerHost)throw new Error("viewerHost is not yet available \u2014 view has not been initialized.");l._lastRenderArgs={url:t,suffix:n,page:i,viewerTypeOverride:a},l.currentViewerRef=l._viewerHost.createComponent(s),l.currentViewerRef.setInput("url",t),l.currentViewerRef.setInput("suffix",n),l.currentViewerRef.setInput("settings",f),a&&l.currentViewerRef.setInput("viewerTypeOverride",a)}catch(s){throw new Error(`Failed to load viewer component: ${s instanceof Error?s.message:String(s)}`)}})()}_switchToAlternative(t){var n=this;return(0,p.A)(function*(){const i=n._cueSnapshot,a=n._projectIdSnapshot;if(i&&a)try{const l=t.remoteRelativePath?yield i.storage.getAltRepDownloadUrl(t.remoteRelativePath):yield i.storage.getDownloadUrl(a,t.uuid,t.suffix);n.resolvedUrl.set(l),n.resolvedSuffix.set(t.suffix),yield n._renderViewer(l,t.suffix,null)}catch(l){console.error("[CueDocumentViewerWC] Failed to switch to alternative:",l)}})()}_downloadOriginal(){var t=this;return(0,p.A)(function*(){const n=t._cueSnapshot,i=t._projectIdSnapshot,a=t._originalUuid(),l=t._originalDocSuffix();if(n&&i&&a&&l)try{const s=yield n.storage.getDownloadUrl(i,a,l),f=yield(yield fetch(s)).blob();(0,_e.KE)(f,`${a}${l}`)}catch(s){console.error("[CueDocumentViewerWC] Failed to download original:",s)}})()}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(be,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"],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%"],[3,"subject","handlers","menuItems"],["direction","column","align","center","justify","center",2,"flex","1","width","100%"],[2,"flex","1","min-height","0","overflow","hidden"],[2,"color","#c44","font-size","13px"],[4,"ngTemplateOutlet"]],template:function(n,i){1&n&&(e.DNE(0,Me,7,2,"ng-template",null,0,e.C5r),e.nVh(2,De,2,3,"cue-card",2)(3,Pe,1,1,"ng-container")),2&n&&(e.R7$(2),e.vxM("none"!==i.variant()?2:3))},dependencies:[x.MD,x.T3,M.n,E.Typography,me,ve.Z],styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0})}return o})()}}]);
|
|
1
|
+
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[112],{3112(Ve,V,h){h.d(V,{CueDocumentViewer:()=>Te});var p=h(467),d=h(7705),g=h(2271),r=h(5802),e=h(5547),x=h(9769),M=h(5381),E=h(2245),j=h(1024),P=h(9421),S=h(5903),C=h(9352),N=h(6117),A=h(8547),D=h(3319),w=h(5971),L=h(7573);const k=(o,u)=>t=>t.isHighlight;function G(o,u){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 $(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-button",5),e.bIt("click",function(i){r.eBV(t);const a=e.XpG(2).$implicit,l=e.XpG();return r.Njj(l.onDeleteHighlight(i,a.highlight))}),e.nrm(1,"cue-button-icon",6),e.k0s()}}function B(o,u){if(1&o){const t=e.RV6();e.j41(0,"span",2),e.bIt("click",function(){r.eBV(t);const i=e.XpG().$implicit,a=e.XpG();return r.Njj(a.onHighlightClick(i.highlight))}),e.nVh(1,G,2,1,"span",3),e.EFF(2),e.nVh(3,$,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 O(o,u){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 X(o,u){if(1&o&&e.nVh(0,B,4,4,"span",1)(1,O,2,2,"span"),2&o){const t=u.$implicit;e.vxM(t.isHighlight&&t.highlight?0:1)}}let U=(()=>{class o{path=d.hFB.required();highlights=(0,d.hFB)([]);allowDelete=(0,d.hFB)(!1);allowAdd=(0,d.hFB)(!1);size=(0,d.hFB)("m");highlightClick=(0,d.CGW)();deleteHighlight=(0,d.CGW)();textSelected=(0,d.CGW)();segments=(0,g.EW)(()=>this.parseSegments(this.path(),this.highlights()));parseSegments(t,n){const i=n.filter(c=>c.path===t);if(0===i.length)return[{text:t,isHighlight:!1,segmentStart:0}];const a=[...i].sort((c,f)=>c.start-f.start),l=[];let s=0;for(const c of a)c.start>s&&l.push({text:t.substring(s,c.start),isHighlight:!1,segmentStart:s}),l.push({text:t.substring(c.start,c.end),isHighlight:!0,highlight:c,segmentStart:c.start}),s=c.end;return s<t.length&&l.push({text:t.substring(s),isHighlight:!1,segmentStart:s}),l}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),l=t.currentTarget,s=this.getAbsoluteOffset(l,a.startContainer,a.startOffset),c=this.getAbsoluteOffset(l,a.endContainer,a.endOffset);n.removeAllRanges(),c>s&&this.textSelected.emit({path:this.path(),start:s,end:c,text:this.path().substring(s,c)})}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 f=parseInt(a.getAttribute("data-segment-start"),10);let m=0;const v=document.createTreeWalker(a,NodeFilter.SHOW_TEXT);let _=v.nextNode();for(;_&&_!==n;)m+=_.textContent?.length??0,_=v.nextNode();return f+m+i}a=a.parentElement}const l=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let s=0,c=l.nextNode();for(;c&&c!==n;)s+=c.textContent?.length??0,c=l.nextNode();return s+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(l){return i.onMouseUp(l)}),e.Z7z(1,X,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,k,i))),e.R7$(),e.Dyx(i.segments()))},dependencies:[x.MD,w.$,D.a],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 H=h(5745),W=h(2444),z=h(9695),Y=h(5448),J=h(6950);const F=o=>({count:o}),Q=(o,u)=>t=>t.iri;function q(o,u){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 K(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-ag-grid",16),e.bIt("selectedRows",function(i){r.eBV(t);const a=e.XpG(4);return r.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 Z(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-flexcontainer",12)(1,"cue-button",13),e.bIt("click",function(){r.eBV(t);const i=e.XpG(3);return r.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,K,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,F,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,F,t._selectedPaths().length)))}}function ee(o,u){if(1&o&&e.nVh(0,q,3,3,"cue-typography",11)(1,Z,10,14),2&o){const t=e.XpG(2);e.vxM(t._fileLocationsLoading()?0:null!==t._fileLocations()?1:-1)}}function te(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-flexcontainer",9)(1,"cue-input-switch",10),e.bIt("toggleChange",function(i){r.eBV(t);const a=e.XpG();return r.Njj(a.onApplyToAllChange(i))}),e.k0s(),e.j41(2,"cue-typography",11),e.EFF(3),e.nI1(4,"transloco"),e.k0s()(),e.nVh(5,ee,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 ne(o,u){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 ie=(()=>{class o{selection=d.hFB.required();availableEntityCategories=(0,d.hFB)([]);fileLocations=(0,d.hFB)([]);requestFileLocations=(0,d.hFB)(void 0);requestFilePathEntityAdd=(0,d.hFB)(void 0);confirm=(0,d.CGW)();cancel=(0,d.CGW)();_selectedEntityCategory=(0,r.vPA)("");_applyToAllFiles=(0,r.vPA)(!1);_fileLocations=(0,r.vPA)(null);_fileLocationsLoading=(0,r.vPA)(!1);_matchTableExpanded=(0,r.vPA)(!1);_selectedPaths=(0,r.vPA)([]);_saving=(0,r.vPA)(!1);_saveError=(0,r.vPA)(null);_dirPrefix=(0,g.EW)(()=>{const t=this.selection();return t.path.substring(0,t.end)});_matchedLocations=(0,g.EW)(()=>{const t=this._fileLocations();if(!t)return[];const n=this._dirPrefix();return t.filter(i=>i.path.startsWith(n))});_matchCount=(0,g.EW)(()=>this._matchedLocations().length);_matchTableRowData=(0,g.EW)(()=>this._matchedLocations().map(t=>({iri:t.iri,path:t.path,providerId:t.providerId})));_entityCategoryLabelMap=(0,g.EW)(()=>this.availableEntityCategories().reduce((t,n)=>(t[n.iri]=n.label,t),{}));_matchTableRowSelection={mode:"multiRow",selectAll:"filtered"};_filePathLabel=(0,C.Xx)("components.contentBlocks.documentViewer.labelFilePath");_matchTableColDefs=(0,g.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,p.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 l=n._dirPrefix();n._selectedPaths.set(a.filter(s=>s.path.startsWith(l)))}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,p.A)(function*(){const n=t._selectedEntityCategory();if(!n)return;const i=t.selection().path,a=t._fileLocations()?.find(c=>c.path===i)??t.fileLocations().find(c=>c.path===i)??{iri:"",path:i},l=t._applyToAllFiles()&&t._selectedPaths().length>0?t._selectedPaths():[a],s=t.requestFilePathEntityAdd();if(s){t._saving.set(!0),t._saveError.set(null);try{yield s(n,l)}catch(c){return console.error("[EntityMentionModal] Failed to save entity mention:",c),t._saveError.set(c instanceof Error?c.message:String(c)),void t._saving.set(!1)}t._saving.set(!1)}t.confirm.emit({entityCategory:n,paths:l})})()}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(l){return i.onEntityCategoryChange(l)}),e.k0s(),e.nVh(7,te,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,ne,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,Q,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.n,P.F,D.a,w.$,Y.L,E.Typography,H.a,W.l,z.d,J.R,C.Kj],styles:[".modal-content[_ngcontent-%COMP%]{width:640px;max-width:calc(100vw - 32px)}"],changeDetection:0})}return o})();const oe=()=>[];function ae(o,u){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 le(o,u){if(1&o&&(e.j41(0,"cue-key-val-list"),e.nVh(1,ae,2,4,"cue-key-val",6),e.k0s()),2&o){const t=e.XpG();e.R7$(),e.vxM(t.subject()?1:-1)}}function se(o,u){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 re(o,u){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 ce(o,u){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 de(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-button",19),e.bIt("click",function(){r.eBV(t);const i=e.XpG(3);return r.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 ue(o,u){if(1&o){const t=e.RV6();e.j41(0,"cue-button",19),e.bIt("click",function(){r.eBV(t);const i=e.XpG(3);return r.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,u){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,ce,2,2,"span",15),e.k0s()(),e.j41(6,"dd",16),e.nVh(7,de,2,1,"cue-button",17),e.j41(8,"cue-file-path-viewer",18),e.bIt("textSelected",function(i){r.eBV(t);const a=e.XpG(2);return r.Njj(a.onTextSelected(i))}),e.k0s(),e.nVh(9,ue,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,oe))("allowDelete",t.filePathEntitiesEditable())("allowAdd",t.filePathEntitiesEditable()),e.R7$(),e.vxM(t.fileLocations().length>1?9:-1)}}function ge(o,u){if(1&o&&(e.j41(0,"cue-key-val-list"),e.nrm(1,"hr"),e.nVh(2,re,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,u){if(1&o){const t=e.RV6();e.j41(0,"cue-entity-mention-modal",22),e.bIt("confirm",function(i){r.eBV(t);const a=e.XpG();return r.Njj(a.onEntityMentionConfirm(i))})("cancel",function(){r.eBV(t);const i=e.XpG();return r.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 me=(()=>{class o{subject=d.hFB.required();handlers=d.hFB.required();dataChanged=(0,d.CGW)();filePathEntityAdded=(0,d.CGW)();fileLocations=(0,d.hFB)([]);_fileLocationsProvider=(0,g.EW)(()=>{const t=this.handlers().requestFileLocations;if(t)return t;const n=this.fileLocations();return n.length?()=>Promise.resolve(n):void 0});filePathEntities=(0,d.geq)([]);contentCategories=(0,d.hFB)([]);contentCategoriesEditable=(0,d.hFB)(!1);filePathEntitiesVisible=(0,d.hFB)(!1);filePathEntitiesEditable=(0,d.hFB)(!1);menuItems=(0,d.hFB)([]);availableContentCategories=(0,d.hFB)([]);availableEntityCategories=(0,d.hFB)([]);collapsed=(0,d.hFB)(!1);hasDocInfo=(0,g.EW)(()=>{const t=""!==this.subject(),n=this.fileLocations().length>0;return t||n});currentFilePathIndex=(0,r.vPA)(0);_entityCategoryModalVisible=(0,r.vPA)(!1);_pendingSelection=(0,r.vPA)(null);_requestFilePathEntityAdd=(0,g.EW)(()=>{var t=this;const n=this.handlers().requestFilePathEntityAdd;if(n)return function(){var i=(0,p.A)(function*(a,l){const s=t._pendingSelection();s&&(yield n({paths:l,start:s.start,end:s.end,text:s.text,entityCategory:a,folderPath:s.path.substring(0,s.end)}))});return function(a,l){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,g.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,g.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,g.uu)(()=>this.contentCategories());contentCategoriesString=(0,g.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,C.Xx)("components.documentInfo.infoChangeContentCategory");rdfEditConfig=(0,g.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,p.A)(function*(a){console.log(a);const l={subject:t.subject(),predicate:`${L.E.qcy}contentCategory`,objects:t._contentCategories(),newObjects:a.newValue,type:"contentCategory",comment:a.comment};yield n(l),t._contentCategories.set(a.newValue),t.dataChanged.emit({contentCategories:a.newValue})}),function(l){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,le,2,1,"cue-key-val-list"),e.k0s(),e.nVh(4,se,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.n,j.p,P.F,S.L,N.W,A.T,D.a,w.$,U,E.Typography,ie,C.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 pe{requestRDFChange;requestFileLocations;requestFilePathEntityAdd}var _e=h(2065),ve=h(5187);const be=["viewerHost"];function Ce(o,u){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 ye(o,u){1&o&&(e.j41(0,"cue-flexcontainer",5)(1,"cue-typography"),e.EFF(2,"Loading\u2026"),e.k0s()())}function xe(o,u){if(1&o&&(e.j41(0,"cue-flexcontainer",5)(1,"cue-typography",7),e.EFF(2),e.k0s()()),2&o){const t=e.XpG(2);e.R7$(2),e.JRh(t.errorMessage())}}function Me(o,u){if(1&o&&(e.j41(0,"div",3),e.nVh(1,Ce,1,3,"cue-document-info",4),e.nVh(2,ye,3,0,"cue-flexcontainer",5)(3,xe,3,1,"cue-flexcontainer",5),e.j41(4,"div",6),e.eu8(5,null,1),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)}}function Ee(o,u){1&o&&e.eu8(0)}function De(o,u){if(1&o&&(e.j41(0,"cue-card",2),e.DNE(1,Ee,1,0,"ng-container",8),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 we(o,u){1&o&&e.eu8(0)}function Pe(o,u){if(1&o&&e.DNE(0,we,1,0,"ng-container",8),2&o){e.XpG();const t=e.sdS(1);e.Y8G("ngTemplateOutlet",t)}}const Fe=[".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"];function I(o){const[u,t]=o.split("?"),n=u.trim();let i=null;if(t){const l=new URLSearchParams(t).get("page");if(null!==l){const s=parseInt(l,10);!isNaN(s)&&s>0&&(i=s)}}return{uuid:n,page:i}}let Te=(()=>{class o{set _viewerHostRef(t){if(this._viewerHost=t,t&&this._lastRenderArgs){const{url:n,suffix:i,page:a,viewerTypeOverride:l}=this._lastRenderArgs;this._renderViewer(n,i,a,l)}}_viewerHost;_lastRenderArgs;currentViewerRef;cue=(0,d.hFB)(void 0);uuid=(0,d.hFB)(void 0);projectId=(0,d.hFB)(void 0);showDocumentInfo=(0,d.hFB)(!0);extraMenuItems=(0,d.hFB)([]);portalBaseURL=(0,d.hFB)("https://cue.qaecy.com");variant=(0,d.hFB)("none");_cardVariant=(0,g.EW)(()=>this.variant());state=(0,r.vPA)("idle");errorMessage=(0,r.vPA)(null);resolvedUrl=(0,r.vPA)(null);resolvedSuffix=(0,r.vPA)(null);_docSubject=(0,r.vPA)("");_alternatives=(0,r.vPA)([]);_originalUuid=(0,r.vPA)(null);_originalDocSuffix=(0,r.vPA)(null);_cueSnapshot=null;_projectIdSnapshot=null;_docInfoHandlers=new pe;_menuItems=(0,g.EW)(()=>{const t=[],n=this._originalUuid(),i=this._originalDocSuffix();n&&i&&t.push({icon:"download",label:"Download file",action:()=>this._downloadOriginal()});const a=this.uuid(),l=this.projectId();if(a&&l){const{uuid:c}=I(a),f=this.portalBaseURL().replace(/\/$/,"");t.push({icon:"external-link",label:"Open in Cue",action:()=>window.open(`${f}/r/${l}/${c}`,"_blank","noopener,noreferrer")})}const s=this._alternatives();if(s.length>1){const c=this.resolvedSuffix();t.push({icon:"document",label:"Alternative representation",children:s.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(){(0,r.QZP)(()=>{const t=this.cue(),n=this.uuid(),i=this.projectId();t&&n&&i?this._load(t,n,i):this.state.set("idle")})}_load(t,n,i){var a=this;return(0,p.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:l,page:s}=I(n),c=t.createProjectDocuments(i),m=(yield c.fetchDocumentData([l]))[l];if(!m)throw new Error(`Document '${l}' not found in project '${i}'.`);a._docSubject.set(m.subject??""),a._originalUuid.set(l),a._originalDocSuffix.set(m.suffix);const v=yield c.fetchAlternativeRepresentations(l);a._alternatives.set([{uuid:l,suffix:m.suffix,original:!0},...v.filter(b=>b.id!==l).map(b=>({uuid:b.id,suffix:b.suffix,original:!1,remoteRelativePath:b.remoteRelativePath}))]);const{uuid:_,suffix:y,remoteRelativePath:T}=function Ie(o,u){const t=[o,...u];let n,i=1/0;for(const a of t){const l=Fe.indexOf(a.suffix);-1!==l&&l<i&&(i=l,n=a)}return n?{uuid:n.id,suffix:n.suffix,remoteRelativePath:n.remoteRelativePath}:{uuid:o.id,suffix:o.suffix}}(m,v),R=T?yield t.storage.getAltRepDownloadUrl(T):yield t.storage.getDownloadUrl(i,_,y);a.resolvedUrl.set(R),a.resolvedSuffix.set(y);const Re=[".eml",".msg",".emlx",".mbx"].includes(m.suffix)&&".json"===y?"email":void 0;yield a._renderViewer(R,y,s,Re),a.state.set("ready")}catch(l){const s=l instanceof Error?l.message:String(l);console.error("[CueDocumentViewerWC] Failed to load document:",s),a.errorMessage.set(s),a.state.set("error")}}else a.state.set("idle")})()}_renderViewer(t,n,i,a){var l=this;return(0,p.A)(function*(){try{const{DocumentViewer:s}=yield Promise.all([h.e(418),h.e(645),h.e(76),h.e(741)]).then(h.bind(h,1741)),{DocumentViewerSettings:c}=yield h.e(418).then(h.bind(h,3418));l._viewerHost?.clear(),l.currentViewerRef?.destroy();const f=new c;if(null!==i&&(f.pdf.page=String(i)),!l._viewerHost)throw new Error("viewerHost is not yet available \u2014 view has not been initialized.");l._lastRenderArgs={url:t,suffix:n,page:i,viewerTypeOverride:a},l.currentViewerRef=l._viewerHost.createComponent(s),l.currentViewerRef.setInput("url",t),l.currentViewerRef.setInput("suffix",n),l.currentViewerRef.setInput("settings",f),a&&l.currentViewerRef.setInput("viewerTypeOverride",a)}catch(s){throw new Error(`Failed to load viewer component: ${s instanceof Error?s.message:String(s)}`)}})()}_switchToAlternative(t){var n=this;return(0,p.A)(function*(){const i=n._cueSnapshot,a=n._projectIdSnapshot;if(i&&a)try{const l=t.remoteRelativePath?yield i.storage.getAltRepDownloadUrl(t.remoteRelativePath):yield i.storage.getDownloadUrl(a,t.uuid,t.suffix);n.resolvedUrl.set(l),n.resolvedSuffix.set(t.suffix),yield n._renderViewer(l,t.suffix,null)}catch(l){console.error("[CueDocumentViewerWC] Failed to switch to alternative:",l)}})()}_downloadOriginal(){var t=this;return(0,p.A)(function*(){const n=t._cueSnapshot,i=t._projectIdSnapshot,a=t._originalUuid(),l=t._originalDocSuffix();if(n&&i&&a&&l)try{const s=yield n.storage.getDownloadUrl(i,a,l),f=yield(yield fetch(s)).blob();(0,_e.KE)(f,`${a}${l}`)}catch(s){console.error("[CueDocumentViewerWC] Failed to download original:",s)}})()}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(be,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"],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%"],[3,"subject","handlers","menuItems"],["direction","column","align","center","justify","center",2,"flex","1","width","100%"],[2,"flex","1","min-height","0","overflow","hidden"],[2,"color","#c44","font-size","13px"],[4,"ngTemplateOutlet"]],template:function(n,i){1&n&&(e.DNE(0,Me,7,2,"ng-template",null,0,e.C5r),e.nVh(2,De,2,3,"cue-card",2)(3,Pe,1,1,"ng-container")),2&n&&(e.R7$(2),e.vxM("none"!==i.variant()?2:3))},dependencies:[x.MD,x.T3,M.n,E.Typography,me,ve.Z],styles:["[_nghost-%COMP%]{display:contents}"],changeDetection:0})}return o})()}}]);
|
package/240.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[240,613],{6034(b,M,s){s.d(M,{y:()=>u});var n=s(7705),h=s(7598),a=s(9769),y=s(5187),D=s(2271),o=s(5547);const v=["*"];let _=(()=>{class r{style=(0,n.hFB)("");gap=(0,n.hFB)("m");columns=(0,n.hFB)(1);getStyles=(0,D.EW)(()=>`\n grid-template-columns: repeat(${this.columns()}, minmax(0, 1fr));\n gap: var(--cue-grid-gap-${this.gap()});\n ${this.style()}\n `);static \u0275fac=function(p){return new(p||r)};static \u0275cmp=o.VBU({type:r,selectors:[["cue-grid"]],hostVars:2,hostBindings:function(p,d){2&p&&o.Aen(d.getStyles())},inputs:{style:[1,"style"],gap:[1,"gap"],columns:[1,"columns"]},ngContentSelectors:v,decls:1,vars:0,template:function(p,d){1&p&&(o.NAR(),o.SdG(0))},styles:["[_nghost-%COMP%]{display:grid}"]})}return r})();var e=s(2245),i=s(5381),t=s(29);const l=["*"];function g(r,f){if(1&r&&(o.j41(0,"cue-typography",2),o.EFF(1),o.k0s()),2&r){const m=o.XpG();o.R7$(),o.SpI(" ",m.label()," ")}}let u=(()=>{class r{label=(0,n.hFB)("");variant=(0,n.hFB)("default");shadow=(0,n.hFB)(!1);padded=(0,n.hFB)(!0);showCloseBtn=(0,n.hFB)(!0);position=(0,n.hFB)("top-left");clickedClose=(0,n.CGW)();margin=(0,n.hFB)("0.5rem");close(m){m.stopPropagation(),m.stopImmediatePropagation(),this.clickedClose.emit()}static \u0275fac=function(p){return new(p||r)};static \u0275cmp=o.VBU({type:r,selectors:[["cue-draggable-card"]],inputs:{label:[1,"label"],variant:[1,"variant"],shadow:[1,"shadow"],padded:[1,"padded"],showCloseBtn:[1,"showCloseBtn"],position:[1,"position"],margin:[1,"margin"]},outputs:{clickedClose:"clickedClose"},ngContentSelectors:l,decls:8,vars:14,consts:[["cdkDrag","",1,"panel",3,"variant","shadow","padded"],["justify","end"],["size","l"],[2,"width","100%"],["name","close",2,"cursor","pointer",3,"click"]],template:function(p,d){1&p&&(o.NAR(),o.j41(0,"cue-card",0)(1,"cue-typography")(2,"cue-grid")(3,"cue-flexcontainer",1),o.nVh(4,g,2,1,"cue-typography",2),o.nrm(5,"span",3),o.j41(6,"cue-svg-icon",4),o.bIt("click",function(C){return d.close(C)}),o.k0s()(),o.SdG(7),o.k0s()()()),2&p&&(o.xc7("top","top-left"===d.position()||"top-right"===d.position()?d.margin():"null")("bottom","bottom-left"===d.position()||"bottom-right"===d.position()?d.margin():"null")("left","top-left"===d.position()||"bottom-left"===d.position()?d.margin():"null")("right","top-right"===d.position()||"bottom-right"===d.position()?d.margin():"null"),o.Y8G("variant",d.variant())("shadow",d.shadow())("padded",d.padded()),o.R7$(3),o.xc7("padding",d.padded()?"0":"10px"),o.R7$(),o.vxM(d.label()&&"undefined"!==d.label()?4:-1))},dependencies:[a.MD,y.Z,_,e.Typography,i.n,t.A,h.T1],styles:[".panel[_ngcontent-%COMP%]{position:absolute;width:fit-content}"]})}return r})()},4613(b,M,s){s.d(M,{Logo:()=>o});var n=s(7705),h=s(5802),a=s(5547),y=s(2271),D=s(6170);let o=(()=>{class v{size=(0,n.hFB)("m");sizeMap={xs:"40px",s:"80px",m:"160px",l:"222px"};active=(0,n.hFB)(!0,{transform:n.L39});continuous=(0,n.hFB)(!1,{transform:n.L39});mode=(0,n.hFB)("default");isDarkMode=(0,n.geq)(!1);handleDarkModeChange(e){this.isDarkMode.set(e),-1===this.raf&&this.animate()}colorA=(0,y.EW)(()=>this.isDarkMode()?[221,246,18]:[18,28,43]);colorB=[0,202,204];paths=[];raf=-1;appearTime=0;disappearTime=0;tip=0;toe=0;mix=[0,0,0];norm=0;animate=e=>{if(void 0!==e){const i=5e-4*(e-this.appearTime);"glow"===this.mode()?this.tip=i%1:(this.tip=Math.min(1,i),this.active()||(this.toe=Math.min(1,6e-4*(e-this.disappearTime))))}if("glow"===this.mode()){const i=.06666666666666667,t=this.rgbToSvg(this.colorA());return this.paths.forEach((l,g)=>{this.norm=1/this.paths.length*g;let c=this.tip-this.norm;if(c<-(1-i)&&(c+=1),c>=0&&c<i){const u=1-c/i;l.setAttribute("stroke",this.rgbToSvg(this.colorB)),l.setAttribute("stroke-opacity",u.toFixed(3))}else l.setAttribute("stroke",t),l.setAttribute("stroke-opacity","0.005")}),void(this.raf=requestAnimationFrame(this.animate))}if(this.paths.forEach((i,t)=>{this.norm=1/this.paths.length*t,this.mix=this.mixRgb(this.colorA(),this.colorB,Math.max(0,Math.min(1,15*(this.tip-this.norm)))),i.setAttribute("stroke",this.tip*this.paths.length>t&&(this.active()||this.toe*this.paths.length<t)?this.rgbToSvg(this.mix):"transparent")}),this.tip>=1&&(this.active()||this.toe>=1))return this.continuous()?void setTimeout(()=>{this.appearTime=performance.now(),this.tip=0,this.toe=0,this.raf=requestAnimationFrame(this.animate)},500):void(this.raf=-1);this.raf=requestAnimationFrame(this.animate)};activate(){this.appearTime=performance.now(),this.animate(this.appearTime)}deactivate(){this.disappearTime=performance.now(),-1===this.raf&&this.animate(this.disappearTime)}mixChannel(e,i,t){return parseInt((e*t+i*(1-t)).toFixed())}mixRgb(e,i,t){return[this.mixChannel(e[0],i[0],t),this.mixChannel(e[1],i[1],t),this.mixChannel(e[2],i[2],t)]}rgbToSvg(e){return`rgb(${e[0]},${e[1]},${e[2]})`}constructor(){(0,h.QZP)(()=>{"glow"===this.mode()||this.active()?this.activate():this.deactivate()}),(0,h.QZP)(()=>{this.isDarkMode(),this.animate()});const e=(0,h.WQX)(a.aKT);(0,a.mal)({read:()=>{if(this.paths.length)return;const i=e.nativeElement.querySelector("svg"),t=e.nativeElement.querySelector("#original-path");if(!t)return;const l=t.getTotalLength(),c=[];for(let u=0;u<400;u++){const r=t.getPointAtLength(l/400*u);c.push({x:parseFloat(r.x.toFixed(2)),y:parseFloat(r.y.toFixed(2))})}c.push(t.getPointAtLength(l)),c.reverse(),c.forEach((u,r)=>{if(0===r||1===r)return;const f=document.createElementNS("http://www.w3.org/2000/svg","path");f.setAttribute("d",`M${c[r-2].x},${c[r-2].y}L${c[r-1].x},${c[r-1].y}L${u.x},${u.y}`),f.setAttribute("fill","none"),f.setAttribute("stroke","transparent"),f.setAttribute("stroke-width",t?.getAttribute("stroke-width")||"1"),f.setAttribute("stroke-miterlimit",t?.getAttribute("stroke-miterlimit")||"1"),i.appendChild(f),this.paths.push(f)})}})}ngOnDestroy(){this.paths=[],cancelAnimationFrame(this.raf),this.raf=-1}static \u0275fac=function(i){return new(i||v)};static \u0275cmp=a.VBU({type:v,selectors:[["cue-logo"]],hostVars:2,hostBindings:function(i,t){2&i&&a.xc7("width",t.sizeMap[t.size()])},inputs:{size:[1,"size"],active:[1,"active"],continuous:[1,"continuous"],mode:[1,"mode"],isDarkMode:[1,"isDarkMode"]},outputs:{isDarkMode:"isDarkModeChange"},decls:2,vars:0,consts:[["cueDarkMode","","xmlns","http://www.w3.org/2000/svg","viewBox","0 0 221.545 86.191","width","222","height","86","overflow","visible",3,"darkModeChange"],["id","original-path","fill","none","stroke","transparent","stroke-miterlimit","10","stroke-width","12","d","M216.046 56.638s-10.561 24.201-36.192 22.991c-25.631-1.21-22.771-24.751-20.351-37.622 2.42-12.871 10.451-20.351 16.831-18.041 6.283 2.275 8.03 9.68 2.09 21.891-5.94 12.211-21.341 37.567-35.862 33.992-12.413-3.056-13.281-23.162-13.281-23.162V29.762v26.925c0 14.471-12.47 23.212-24.672 23.212s-24.672-8.301-24.672-23.212V29.829l-.006.105v13.031c0 20.416-16.55 36.966-36.966 36.966S6 63.381 6 42.966 22.55 6 42.966 6c6.91 0 13.377 1.896 18.91 5.196"]],template:function(i,t){1&i&&(h.qSk(),a.j41(0,"svg",0),a.bIt("darkModeChange",function(g){return t.handleDarkModeChange(g)}),a.nrm(1,"path",1),a.k0s())},dependencies:[D.R],styles:["[_nghost-%COMP%]{display:block}svg[_ngcontent-%COMP%]{flex:1;display:block;width:100%;height:auto}"]})}return v})()},6170(b,M,s){s.d(M,{R:()=>D});var n=s(7705),h=s(5802),a=s(2271),y=s(5547);let D=(()=>{class o{destroyRef=(0,h.WQX)(h.abz);_isDarkMode=(0,h.vPA)(this.hasDarkClass());isDarkMode=(0,a.EW)(()=>this._isDarkMode());darkModeChange=(0,n.CGW)();constructor(){const _=new MutationObserver(e=>{e.forEach(i=>{if("attributes"===i.type&&"class"===i.attributeName){const t=this.hasDarkClass();t!==this._isDarkMode()&&this._isDarkMode.set(t)}})});_.observe(document.body,{attributes:!0,attributeFilter:["class"]}),this.destroyRef.onDestroy(()=>_.disconnect()),(0,h.QZP)(()=>{this.darkModeChange.emit(this._isDarkMode()),document.documentElement.style.colorScheme=this._isDarkMode()?"dark":"light"})}hasDarkClass(){return document.body.classList.contains("dark")}toggleDarkMode(){document.body.classList.toggle("dark")}static \u0275fac=function(e){return new(e||o)};static \u0275dir=y.FsC({type:o,selectors:[["","cueDarkMode",""]],outputs:{darkModeChange:"darkModeChange"},exportAs:["darkModeDetector"]})}return o})()},7851(b,M,s){s.d(M,{k:()=>_});var n=s(7705),h=s(5802),a=s(5547),y=s(4613),D=s(2245);function o(e,i){if(1&e&&(a.j41(0,"cue-typography",1),a.EFF(1),a.k0s()),2&e){const t=a.XpG();a.R7$(),a.JRh(t.message)}}let v=(()=>{class e{message="";static \u0275fac=function(l){return new(l||e)};static \u0275cmp=a.VBU({type:e,selectors:[["cue-logo-loader-overlay"]],decls:2,vars:1,consts:[["size","m","mode","glow"],["size","s",1,"message"]],template:function(l,g){1&l&&(a.nrm(0,"cue-logo",0),a.nVh(1,o,2,1,"cue-typography",1)),2&l&&(a.R7$(),a.vxM(g.message?1:-1))},dependencies:[y.Logo,D.Typography],styles:["[_nghost-%COMP%]{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.75rem;z-index:1000}.message[_ngcontent-%COMP%]{color:var(--color-text-secondary)}"],changeDetection:0})}return e})(),_=(()=>{class e{cueLogoLoader=(0,n.hFB)(!1);cueLogoLoaderMessage=(0,n.hFB)("");el=(0,h.WQX)(a.aKT);appRef=(0,h.WQX)(a.o8S);envInjector=(0,h.WQX)(h.uvJ);renderer=(0,h.WQX)(a.sFG);overlayRef;constructor(){(0,h.QZP)(()=>{const t=this.cueLogoLoader(),l=this.cueLogoLoaderMessage();t?(this.overlayRef||this.createOverlay(),this.overlayRef&&(this.overlayRef.instance.message=l,this.overlayRef.changeDetectorRef.markForCheck())):this.destroyOverlay()})}createOverlay(){this.overlayRef=(0,n.a0P)(v,{environmentInjector:this.envInjector}),this.appRef.attachView(this.overlayRef.hostView),this.renderer.appendChild(this.el.nativeElement,this.overlayRef.hostView.rootNodes[0])}destroyOverlay(){this.overlayRef&&(this.appRef.detachView(this.overlayRef.hostView),this.overlayRef.destroy(),this.overlayRef=void 0)}ngOnDestroy(){this.destroyOverlay()}static \u0275fac=function(l){return new(l||e)};static \u0275dir=a.FsC({type:e,selectors:[["","cueLogoLoader",""]],hostVars:2,hostBindings:function(l,g){2&l&&a.xc7("position","relative")},inputs:{cueLogoLoader:[1,"cueLogoLoader"],cueLogoLoaderMessage:[1,"cueLogoLoaderMessage"]}})}return e})()}}]);
|