1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1743],{57226:function(e,t,n){n.d(t,{w:function(){return r}});async function r(e){try{let t=await fetch(e);if(!t.ok)throw Error("Cannot fetch resource: ".concat(t.statusText));return await t.blob()}catch(e){throw Error("Cannot fetch resource: ".concat(e))}}},31792:function(e,t,n){n.d(t,{Rj:function(){return f},SI:function(){return x},QO:function(){return v}});var r=n(85893);n(68028);var a=n(67294),s=n(99011),i=n(93278),l=n(36102),o=n(34424),c=n(90171),u=n(92564);let d=u.Z.create({container:{paddingVertical:c.K.Six,justifyContent:"center",alignItems:"center"}});function h(e){let{size:t="large",style:n}=e;return(0,r.jsx)(o.Z,{style:[d.container,n],children:(0,r.jsx)(l.P,{size:t})})}function f(e){let{file:t,onLoadComplete:n,children:a}=e;return(0,r.jsx)(i.Z,{file:t,loading:(0,r.jsx)(h,{}),noData:(0,r.jsx)(h,{}),onLoadError:e=>{n&&n({error:e})},onLoadSuccess:e=>{let{numPages:t}=e;n&&n({data:t})},children:a})}s.Tu.workerSrc="https://unpkg.com/pdfjs-dist@".concat(s.i8,"/legacy/build/pdf.worker.min.mjs"),void 0===Promise.withResolvers&&(window.Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}),n(15516);var m=n(68115),g=n(77460),y=n(95327);let p=(e,t,n)=>()=>u.Z.create({container:{width:t,height:n},canvasImage:{position:"absolute",width:"100%",height:"100%",display:e?"flex":"none"},loader:{position:"absolute",width:"100%",height:"100%"},loaderPlaceholder:{width:"100%",height:300}});function x(e){let{width:t,scale:n=1,pageNumber:s,index:i,shouldRenderPage:l=!0,shouldRenderImagePlaceholder:c,onChangePageHeight:u}=e,[d,f]=(0,a.useState)(),[x,b]=(0,a.useState)(),[w,j,S]=(0,m.k)(!1),C=(0,a.useRef)(null),[k,v]=(0,a.useState)(null),[P,_]=(0,a.useState)(n),Z=n!==P&&!!k||!l||w||!!c,I=(0,g.Y)(p,[Z,t*n,x?x*n:void 0]),E=(0,a.useCallback)(()=>{k&&(URL.revokeObjectURL(k),v(null))},[k]);(0,a.useEffect)(()=>()=>E(),[E]),(0,a.useEffect)(()=>{if(C.current){let e=C.current.parentElement;e&&e.querySelectorAll("canvas").forEach(e=>{e!==C.current&&e.remove()})}},[n]),(0,a.useEffect)(()=>{if(!d)return;let e=t/d;b(e),null==u||u(i,e)},[i,u,d,t]);let L=(0,a.useCallback)(()=>{let e,t;if(S(),_(n),k||!C.current)return;let r=C.current,a=r.getContext("2d");if(!(null==a?void 0:a.getImageData(0,0,r.width,r.height))||300===r.width&&150===r.height)return;let s=r.width/r.height;f(s);let i=document.createElement("canvas");s>=1?t=(e=Math.min(1600,r.width))/s:e=(t=Math.min(1600,r.height))*s,i.width=e,i.height=t;let l=i.getContext("2d");null==l||l.drawImage(r,0,0,e,t),i.toBlob(e=>{e&&(E(),v(URL.createObjectURL(e)))},"image/jpeg",.6)},[k,S,n,E]);return(0,r.jsxs)(o.Z,{style:I.container,children:[l&&(0,r.jsx)(y.Z,{renderTextLayer:!0,canvasRef:C,loading:(0,r.jsx)(o.Z,{style:I.loaderPlaceholder}),pageNumber:s,renderAnnotationLayer:!1,scale:n,width:t,onLoadSuccess:j,onRenderSuccess:L}
1),k&&(0,r.jsx)("img",{alt:"Page ".concat(s),src:k,style:I.canvasImage,onError:E}),!k&&(0,r.jsx)(h,{style:I.loader})]})}var b=n(7939),w=n(98805),j=n(12612),S=n(8862),C=n(21682);let k=e=>t=>{let{colors:n,fonts:r}=t;return u.Z.create({container:{alignItems:"center",gap:c.K.One},pageContainer:{borderRadius:S.w.S,borderWidth:1,borderColor:e?n.system.primary:n.elements.outline,overflow:"hidden"},pageContainerSelected:{borderColor:n.system.primary},pageNumber:{...r.caption.medium,color:n.text.secondary},overlay:{...u.Z.absoluteFill,backgroundColor:n.system.primary,opacity:C.D.Three},checkboxContainer:{position:"absolute",top:c.K.Three,right:c.K.Three,width:20,height:20,borderRadius:S.w.Full,borderWidth:2,borderColor:n.system.primary,backgroundColor:e?n.system.primary:void 0}})};function v(e){let{pageIndex:t,isSelected:n,onPress:a}=e,s=(0,g.Y)(k,[n]),i=t+1;return(0,r.jsxs)(o.Z,{style:s.container,children:[(0,r.jsxs)(b.A,{accessibilityLabel:"page_".concat(i),style:[s.pageContainer,n&&s.pageContainerSelected],onPress:()=>{a(t)},children:[(0,r.jsx)(y.Z,{height:186,loading:(0,r.jsx)(h,{size:"small"}),pageNumber:i,renderAnnotationLayer:!1,renderTextLayer:!1,width:131}),n&&(0,r.jsx)(o.Z,{style:s.overlay}),(0,r.jsx)(o.Z,{style:s.checkboxContainer,children:n&&(0,r.jsx)(j.q,{colorToken:"system.onPrimary",size:16})})]}),(0,r.jsx)(w.x,{style:s.pageNumber,children:i})]})}},98669:function(e,t,n){n.r(t),n.d(t,{DocumentPageSelection:function(){return j}});var r=n(85893),a=n(42417),s=n(98805),i=n(61383),l=n(77460),o=n(94098),c=n(67294),u=n(34424),d=n(57226),h=n(31792),f=n(15536),m=n(91005),g=n(24722),y=n(68700),p=n(90171),x=n(92564);let b=e=>{let{colors:t,fonts:n}=e;return x.Z.create({container:{flex:1,gap:p.K.Six},header:{gap:p.K.Four},headerButtons:{flexDirection:"row",gap:p.K.Three},title:{...n.heading.h4,color:t.text.primary},maximumSelected:{...n.paragraph.medium,color:t.text.secondary},pageContainer:{flexDirection:"row",flexWrap:"wrap",gap:p.K.Five}})};function w(e){return Math.min(e,200)}function j(e){let{deckId:t,url:n,onSelectedPagesChange:p,onUpdatePagesCount:x}=e,{navigate:j}=(0,m.s0)(),[S,C]=(0,c.useState)(),k=(0,c.useRef)(null),[v,P]=(0,c.useState)(0),[_,Z]=(0,c.useState)(new Set),I=(0,l.y)(b);(0,c.useEffect)(()=>{p(Array.from(_))},[p,_]);let E=(0,c.useCallback)(()=>{i.G.getInstance().logEvent("ai_doc_gen_pdf_upload_issue"),j(g.xr.AICardsGeneration,{state:{deckId:t,initialContentMode:y.r.Document}})},[t,j]);(0,c.useEffect)(()=>{(0,d.w)(n).then(C).catch(E)},[E,n]);let L=(0,c.useCallback)(()=>{Z(new Set(Array.from({length:w(v)},(e,t)=>t)))},[v]),A=(0,c.useCallback)(()=>{Z(new Set)},[]),D=(0,c.useCallback)(e=>{let t=Array.from({length:v},(e,t)=>t);Z(n=>(0,o.q)(n,e,t,200,e=>e,k))},[v]),R=(0,c.useCallback)(e=>(0,r.jsx)(h.QO,{isSelected:_.has(e),pageIndex:e,onPress:D},"page_".concat(e)),[D,_]),z=(0,c.useMemo)(()=>Array(v).fill(null).map((e,t)=>R(t)),[v,R]);return(0,r.jsxs)(u.Z,{style:I.container,children:[(0,r.jsxs)(u.Z,{style:I.header,children:[(0,r.jsxs)(u.Z,{children:[(0,r.jsx)(s.x,{style:I.title,children:f.o.t("AIDocument_SelectPages_title")}),200===_.size&&(0,r.jsx)(s.x,{style:I.maximumSelected,children:f.o.t("AIDocument_SelectPages_maxPages",{maximumPages:200})})]}),(0,r.jsxs)(u.Z,{style:I.headerButtons,children:[(0,r.jsx)(a.z,{accessibilityLabel:"select_all_button",isDisabled:_.size===v,shape:"rounded",size:"small",title:f.o.t("AIDocument_SelectPages_Button_selectAll"),type:"outlined",onPress:L}),(0,r.jsx)(a.z,{accessibilityLabel:"deselect_all_button",isDisabled:0===_.size,shape:"rounded",size:"small",title:f.o.t("AIDocument_SelectPages_Button_deselectAll"),type:"outlined",onPress:A})]})]}),(0,r.jsx)(h.Rj,{file:S,onLoadComplete:e=>{let{data:t}=e;t?(x(t),P(t),Z(new Set(Array.from({length:w(t)},(e,t)=>t)))):E()},children:(0,r.jsx)(u.Z,{style:I.pageContainer,children:z})})]})}},68115:function(e,t,n){n.d(t,{k:function(){return a}});var r=n(67294);let a=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],[t,n]=(0,r.useState)(e);return[t,(0,r.useCallback)(()=>{n(!0)},[]),(0,r.useCallback)(()=>{n(!1)},[])]}},94098:function(e,t,n){n.d(t,{q:function(){return s}});class r{}class a extends r{static getInstance(){return a.instance||(a.instance=new a),a.instance}static isShiftPressed(){return"undefined"!=typeof document&&a.getInstance().shiftPressed}constructor(){super(),this.shiftPressed=!1,this.handleKeyDown=e=>{"Shift"===e.key&&(this.shiftPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.shiftPressed=!1)},"undefined"!=typeof document&&(document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp))}}a.instance=null;let s=(e,t,n,r,s,i)=>{let l=new Set(e),o=s(t);if(a.isShiftPressed()&&null!==i.current&&i.current!==o){let e=n.findIndex(e=>s(e)===i.current),t=n.findIndex(e=>s(e)===o);if(-1!==e&&-1!==t){let a=n.slice(Math.min(e,t),Math.max(e,t)+1);for(let n of e>t?[...a].reverse():a)if(l.size<r)l.add(n);else break}}else l.has(t)?l.delete(t):l.size<r&&l.add(t);return l.has(t)&&(i.current=o),l}},10362:function(e,t,n){n.d(t,{Z:function(){return r}});function r(e,t){if(!e)throw Error("Invariant failed")}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.