(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[46760],{129291:(e,t,o)=>{o.d(t,{MH:()=>l,ad:()=>a,iN:()=>d});var i=o(7789),s=o(584992);const{Provider:r,useHook:n}=(0,s.Z)({name:"board_picker",sampleRate:i.DQ?1:.1}),a=(e,t)=>{let o="unknown";null!=t&&t.includes("pin/")?o="PinCloseup":"/"===t?o="HomeFeed":"PinBookMarklet"===t&&(o="PinBookmarklet"),null==e||e.addBinaryAnnotation("source",o,"STRING")},l=r,d=n},846760:(e,t,o)=>{o.d(t,{xH:()=>N,uC:()=>Y,sR:()=>q,DR:()=>Q});var i=o(667294),s=o(702664),r=o(24886),n=o(898781),a=o(883119),l=o(785893);function d(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}class c extends i.Component{constructor(...e){super(...e),d(this,"state",{hovered:!1}),d(this,"handleMouseEnter",(()=>{this.setState({hovered:!0})})),d(this,"handleMouseLeave",(()=>{this.setState({hovered:!1})})),d(this,"handleTouch",(()=>{const{board:e,onClick:t,section:o}=this.props;t(o,e)})),d(this,"handleButtonClick",(({event:e})=>{const{onButtonClick:t}=this.props;this.handleTouch(),t&&t(),e.stopPropagation()})),d(this,"tapAreaRef",(0,i.createRef)())}focus(){const e=this.tapAreaRef.current;e&&e.focus()}render(){var e,t,o,i,s,n;const{hovered:d}=this.state,{buttonText:c,section:h,showSectionSaveButton:u,useLegoLayout:_}=this.props;return(0,l.jsx)(a.iP,{onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onTap:this.handleTouch,ref:this.tapAreaRef,children:(0,l.jsxs)(a.xu,{color:d?"secondary":"default","data-test-id":`section-row-${h.title||""}`,display:"flex",alignItems:"center",height:_?64:52,marginStart:_?2:0,marginEnd:_?2:0,padding:_?2:0,marginTop:_?0:1,rounding:3,dangerouslySetInlineStyle:{__style:_?{}:{marginLeft:53,marginRight:11}},children:[_&&!(null===(e=h.preview_pins)||void 0===e||!e.length)&&(0,l.jsx)(r.Z,{image_url:null!==(t=h.preview_pins[0].image_square_url)&&void 0!==t?t:"",naturalHeight:null!==(o=null===(i=h.preview_pins[0].image_square_size_pixels)||void 0===i?void 0:i.height)&&void 0!==o?o:1,naturalWidth:null!==(s=null===(n=h.preview_pins[0].image_square_size_pixels)||void 0===n?void 0:n.width)&&void 0!==s?s:1}),(0,l.jsx)(a.xu,{flex:"grow",paddingY:1,marginStart:_?0:4,children:(0,l.jsx)(a.xv,{lineClamp:1,weight:_?"bold":"normal",children:h.title})}),d&&u&&(0,l.jsx)(a.xu,{marginEnd:_?0:2,flex:"none",children:(0,l.jsx)(a.zx,{accessibilityLabel:"save button",color:"red",text:c||this.props.i18n.bt("Save", "Save", "save button", undefined, true),onClick:this.handleButtonClick})})]})})}}function h(e){const t=(0,n.ZP)();return(0,l.jsx)(c,{...e,i18n:t})}d(c,"defaultProps",{showSectionSaveButton:!0});var u=o(717615),_=o(784590),g=o(19121),p=o(231947);function x(e){const t=(0,n.ZP)(),{board:o,buttonText:i,onClick:s,onButtonClick:r,showSectionSaveButton:d,useLegoLayout:c}=e,x=(0,u.Z)(),b=(0,g.Z)(),v=(0,p.lJ)(b,x),f=(0,_.Z)({name:"BoardSectionsRepinResource",options:{board_id:o.id,orbac_subject_id:v},noCache:!0}),y=f&&f.data||[];return(0,l.jsxs)(a.xu,{children:[!f.isLoaded&&(0,l.jsx)(a.kC,{alignItems:"center",height:"100%",justifyContent:"center",minHeight:200,width:"100%",children:(0,l.jsx)(a.$j,{accessibilityLabel:t.bt("loading board picker", "loading board picker", "accessibility text for loading spinner", undefined, true),show:!0})}),f.isLoaded&&(0,l.jsxs)(a.xu,{children:[c&&(0,l.jsx)(a.xu,{marginStart:4,marginTop:2,paddingY:1,children:(0,l.jsx)(a.xv,{size:"100",children:t.bt("Section", "Section", "PinBetterSave.BoardFlyout.SectionPlaceholderText", undefined, true)})}),y.map((e=>(0,l.jsx)(h,{board:o,buttonText:i,onButtonClick:r,onClick:s,section:e,showSectionSaveButton:d,useLegoLayout:c},e.id)))]})]})}function b({onClick:e,title:t,showIcon:o}){const s=(0,n.ZP)(),[r,d]=(0,i.useState)(!1);return(0,l.jsx)(a.iP,{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onTap:()=>{e({title:t})},children:(0,l.jsxs)(a.xu,{color:r?"secondary":"default",display:"flex",alignItems:"center",height:o?64:52,marginStart:3,marginEnd:3,marginBottom:1,rounding:3,children:[(0,l.jsx)(a.xu,{flex:"none",marginBottom:1,marginStart:o?1:2,marginEnd:3,marginTop:1,overflow:"hidden",width:o?48:36,height:o?48:36,rounding:o?2:1,children:(0,l.jsx)(a.xu,{alignItems:o?"center":void 0,color:"secondary",display:o?"flex":void 0,height:"100%",justifyContent:o?"center":void 0,width:"100%",children:o&&(0,l.jsx)(a.JO,{icon:"add",color:"default",size:20,accessibilityLabel:s.bt("Create board icon", "Create board icon", "BoardSuggestionRow.AccessibilityLabel.Text", undefined, true)})})}),(0,l.jsx)(a.xu,{flex:"grow",paddingY:1,children:(0,l.jsx)(a.xv,{lineClamp:1,weight:"bold",children:t})}),r&&(0,l.jsx)(a.xu,{marginEnd:2,children:(0,l.jsx)(a.zx,{accessibilityLabel:"create button",color:"red",text:s.bt("Create", "Create", "create button to create a new board", undefined, true)})})]})})}function v(e){const t=(0,n.ZP)(),{suggestionsResource:o,onClick:s,pinBuilderSuggestions:r,inWebRepinFlowExp:d}=e,c=r||o&&o.data||[],h=(0,l.jsxs)(i.Fragment,{children:[d&&(0,l.jsx)(a.xu,{marginStart:4,marginTop:2,paddingY:1,children:(0,l.jsx)(a.xv,{size:"100",children:t.bt("Suggestions", "Suggestions", "PinBetterSave.BoardFlyout.SectionPlaceholderText", undefined, true)})}),c.map(((e,t)=>(0,l.jsx)(b,{title:e.title,onClick:s,showIcon:d},t)))]});return(0,l.jsx)(i.Fragment,{children:c?h:(0,l.jsx)(a.kC,{alignItems:"center",height:"100%",justifyContent:"center",minHeight:200,width:"100%",children:(0,l.jsx)(a.$j,{accessibilityLabel:t.bt("loading board suggestions", "loading board suggestions", "accessibility text for loading spinner", undefined, true),show:!0})})})}function f({isBoardCreate:e,onCreateBoardClick:t,useLegoLayout:o}){const s=(0,n.ZP)(),[r,d]=(0,i.useState)(!1);return(0,l.jsx)(a.xu,{"data-test-id":"create-board",height:"100%",display:"flex",children:(0,l.jsx)(a.iP,{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onTap:t,rounding:2,children:(0,l.jsxs)(a.xu,{display:"flex",alignItems:"center",padding:o?4:2,color:r?"secondary":"default",width:"100%",height:"100%",children:[(0,l.jsx)(a.xu,{rounding:o?2:0,dangerouslySetInlineStyle:{__style:o?{padding:"14px"}:{}},marginStart:o?0:4,marginEnd:o?2:5,color:o?"secondary":"transparent",children:(0,l.jsx)(a.JO,{accessibilityLabel:"",size:o?20:28,icon:o?"add":"add-circle",color:o?"default":"error"})}),e?(0,l.jsx)(a.xv,{align:"center",lineClamp:1,weight:"bold",children:s.bt("Create board", "Create board", " - ", undefined, true)}):(0,l.jsx)(a.xv,{align:"center",lineClamp:1,weight:"bold",children:s.bt("Create section", "Create section", " - ", undefined, true)})]})})})}var y=o(217641),m=o(391254),S=o(6637),B=o(984206),j=o(941646),w=o(615298),P=o(814197),C=o(414327),A=o(407043),L=o(773285),z=o(486746),k=o(27255);function R(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}class T extends i.Component{constructor(...e){super(...e),R(this,"state",{hovered:!1}),R(this,"handleMouseEnter",(()=>{this.setState({hovered:!0})})),R(this,"handleMouseLeave",(()=>{this.setState({hovered:!1})})),R(this,"handleTouch",(()=>{const{board:e,onClick:t}=this.props;t(e)})),R(this,"handleButtonClick",(({event:e})=>{const{onButtonClick:t}=this.props;this.handleTouch(),t&&t(),e.stopPropagation()})),R(this,"tapAreaRef",(0,i.createRef)())}focus(){const e=this.tapAreaRef.current;e&&e.focus()}render(){var e;const{hovered:t}=this.state,{accessibilityLabelText:o,board:i,buttonText:s,displayAlreadySavedMsg:r,i18n:n,isSectionOpen:d,shouldOpenSections:c,showSaveToProfile:h,showFlyoutSaveButton:u,useLegoLayout:_}=this.props,g=!!i.section_count&&i.section_count>0,p=g?"boardWithSection":"boardWithoutSection",x=!!i.images&&!!i.images["75x75"],b=x?null===(e=i.images)||void 0===e?void 0:e["75x75"]:null,v=x?null==b?void 0:b[b.length-1].url:i.image_cover_url;return(0,l.jsx)(j.Z,{id:p,children:(0,l.jsx)(a.iP,{onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onTap:this.handleTouch,ref:this.tapAreaRef,children:(0,l.jsxs)(a.xu,{alignItems:"center",color:t?"secondary":"default","data-test-id":`board-row-${i.name||""}`,display:"flex",height:_?64:52,marginStart:_?2:3,marginEnd:_?2:3,marginBottom:_?0:1,marginTop:_?0:1,padding:_?2:0,rounding:3,children:[(0,l.jsxs)(a.xu,{"aria-hidden":"true",flex:"none",height:_?48:36,marginBottom:_?0:1,marginStart:_?0:2,marginEnd:_?2:3,marginTop:_?0:1,overflow:"hidden",width:_?48:36,children:[h&&"boardless"===i.type&&(0,l.jsx)(a.zd,{rounding:2,width:48,height:48,children:(0,l.jsx)(a.xu,{color:t?"default":"secondary",display:"flex",height:"100%",width:"100%",children:(0,l.jsx)(a.xu,{padding:3,children:(0,l.jsx)(a.JO,{accessibilityLabel:this.props.i18n.bt("Save to profile icon", "Save to profile icon", "BoardRow.TapArea.Icon", undefined, true),color:"default",icon:"history",size:24})})})}),v&&!c&&(0,l.jsx)(a.zd,{height:_?48:36,rounding:2,wash:!0,width:_?48:36,children:(0,l.jsx)(a.Ee,{src:v,alt:"",naturalHeight:_?48:36,naturalWidth:_?48:36,fit:"cover"})}),v&&c?(0,l.jsx)(a.zd,{rounding:2,wash:!0,width:_?48:36,height:_?48:36,children:(0,l.jsx)(a.Ee,{src:v,alt:"",naturalHeight:_?48:36,naturalWidth:_?48:36,fit:"cover"})}):(0,l.jsx)(a.xu,{color:c?"secondary":"transparent",width:"100%",height:"100%"})]}),(0,l.jsxs)(a.xu,{flex:"grow",paddingY:1,overflow:"hidden",marginStart:_?0:1,children:[(0,l.jsx)(a.xv,{lineClamp:1,weight:c||!c?"bold":"normal",children:i.name}),r&&(0,l.jsx)(a.xu,{marginTop:1,children:(0,l.jsx)(a.xv,{align:"start",color:"default",size:"100",children:n.bt("Saved here already", "Saved here already", "BoardFlyout.AlreadySaved.Message", undefined, true)})})]}),i&&(!t||t&&g&&!d)?(0,l.jsx)(a.xu,{children:(0,l.jsx)(z.Z,{board:i,isOpen:i.isOpen,showCollaborativeIcon:!!i.is_collaborative,showPrivateIcon:i.privacy===k.Z.BoardPrivacy.SECRET,showProtectedIcon:i.privacy===k.Z.BoardPrivacy.PROTECTED,showSectionsIcon:g&&c,useLegoLayout:_})}):null,t&&(0===i.section_count||!c)&&u&&(0,l.jsx)(a.xu,{marginEnd:_?0:2,flex:"none",children:(0,l.jsx)(a.zx,{accessibilityLabel:o||this.props.i18n.bt("Save button", "save button", "boardRow.saveButton", undefined, true),color:"red",onClick:this.handleButtonClick,text:s||this.props.i18n.bt("Save", "Save", "save button", undefined, true)})})]})})})}}R(T,"defaultProps",{shouldOpenSections:!0,showFlyoutSaveButton:!0});const I=(0,i.forwardRef)(((e,t)=>{const o=(0,n.ZP)();return(0,l.jsx)(T,{...e,ref:t,i18n:o})}));var E=o(780280),F=o(129291);function H(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const O=e=>e?498:439,M=360,Z=e=>e?80:52;class W extends i.PureComponent{constructor(...e){var t;super(...e),t=this,H(this,"state",{boardSuggestions:[],isSectionOpen:null,selectedBoardId:"",selectedBoardCategory:"",searchQuery:"",searchBoxFocused:!0}),H(this,"getItems",(e=>{const{boardResource:t,changeBoardModal:o,showSaveToProfile:i}=this.props;if(null==t||!t.data)return[];const{all_boards:s}=t.data,r=[{boardId:"",image_cover_url:"",is_collaborative:!1,isOpen:!1,name:this.props.i18n.bt("Profile", "Profile", "pinBetterSave.initialSelection.boardlessPinsOption", undefined, true),privacy:"public",section_count:0,type:"boardless",url:"/me/"}],n=this.getAllBoards().map((e=>this.mapBoards(e,"allBoards",0))),a=this.getShortlist().map(((e,t)=>this.mapBoards(e,"shortlist",t+1))),l=i&&!o&&s.length>=3?[...r,...a.slice(0,2)]:a,{searchQuery:d}=this.state;return d.length>=B.Z?[...(0,w.j)(n,d)]:[...s.length<3&&i?[{type:"header",title:this.props.i18n.bt("Quick save and organise later", "Quick save and organize later", "BoardFlyout.inPinBetterSaveAndLessThanThreeBoards.boardlessPinsTitle", undefined, true)},...r]:[],...s.length>3&&l&&l.length?[{type:"header",title:e?this.props.i18n.bt("Top choices", "Top choices", "PinBetterSave.BoardFlyout.TopChoicesSectionTitle", undefined, true):this.props.i18n.bt("Top board suggestions", "Top board suggestions", "Header for top suggesions in board picker", undefined, true)},...l]:[],...s.length>0?[{type:"header",title:s.length<3&&i?this.props.i18n.bt("Save to board", "Save to board", "BoardFlyout.inPinBetterSaveAndLessThanThreeBoards.saveToBoardTitle", undefined, true):this.props.i18n.bt("All boards", "All boards", "Header for all boards in board picker", undefined, true)},...n]:[]]})),H(this,"mapBoards",((e,t,o)=>{const{selectedBoardId:i,selectedBoardCategory:s}=this.state,r=e.id===i&&t===s;return{...e,category:t,isOpen:r,gridIndex:o}})),H(this,"handleBack",(()=>{const{setBoardWithSection:e}=this.props;this.setState({isSectionOpen:!1,selectedBoardId:"",selectedBoardCategory:""}),e&&e(null)})),H(this,"handleSectionClick",((e,t)=>{const{onItemChosen:o,logContextEvent:i}=this.props;i({event_type:101,component:13282,element:36,object_id_str:t.id,view_type:91,aux_data:{grid_index:t.gridIndex}}),o({boardId:t.id,url:e.slug?`${t.url}${e.slug}/`:t.url,sectionId:e.id,title:e.title||"",type:e.type,imageCoverUrl:t.image_cover_url,ownerUsername:t.owner&&t.owner.username||""})})),H(this,"getPinBuilderSuggestions",(async function(){const{pin:e}=t.props;if(e){var o;const i=S.Z.create("BoardTitleSuggestionsResource",{pin_id:e.id}),s=await i.callGet({showError:!1});if(null!==(o=s.resource_response)&&void 0!==o&&o.data){const e=s.resource_response.data.map((e=>({title:e.title})))||[];t.setState({boardSuggestions:e})}}})),H(this,"getAllBoards",(()=>{var e;const{boardResource:t,advertiser_id:o}=this.props;return((null==t||null===(e=t.data)||void 0===e?void 0:e.all_boards)||[]).filter((e=>!o||"secret"!==e.privacy))})),H(this,"getShortlist",(()=>{var e;const{suggestedBoardsShortListResource:t,displayShortlistMostRecentBoard:o,boardResource:i}=this.props,s=(null==i||null===(e=i.data)||void 0===e?void 0:e.boards_shortlist)||[];return o?s:(null==t?void 0:t.data)||[]})),H(this,"getBoards",(e=>"allBoards"===e?this.getAllBoards():"shortlist"===e?this.getShortlist():[])),H(this,"handleBoardWithSectionsClick",(e=>{const{setBoardWithSection:t}=this.props,{selectedBoardId:o,selectedBoardCategory:i}=this.state,s=this.getBoards(e.category).find((({id:t})=>t===e.id)),r=o===e.id&&i===e.category;s&&t&&t(s),this.setState({isSectionOpen:!0,selectedBoardId:r?"":e.id,selectedBoardCategory:r?"":e.category})})),H(this,"handleBoardClick",(({board:e,toggleSections:t})=>{const{onItemChosen:o,logContextEvent:i}=this.props;this.setState({searchBoxFocused:!1}),t?this.handleBoardWithSectionsClick({id:e.id,category:e.category}):(i({event_type:101,component:13282,element:36,object_id_str:e.id,view_type:91,aux_data:{grid_index:e.gridIndex}}),o({boardId:e.id,url:e.url,title:e.name||"",type:e.type,imageCoverUrl:e.image_cover_url,privacy:e.privacy}))})),H(this,"handleSearchQueryUpdate",(e=>{this.setState((t=>({...t,searchQuery:e})))})),H(this,"boardSectionsHeaderRef",(0,i.createRef)())}componentDidMount(){this.props.boardResource&&this.props.boardResource.isLoaded&&this.setPWTLoadingEnd(),this.props.setBoardWithSection&&this.props.setBoardWithSection(null)}componentDidUpdate(e,t){e.boardResource&&!e.boardResource.isLoaded&&this.props.boardResource&&this.props.boardResource.isLoaded&&this.setPWTLoadingEnd(),this.state.isSectionOpen&&!t.isSectionOpen&&this.boardSectionsHeaderRef.current&&this.boardSectionsHeaderRef.current.focus()}setPWTLoadingEnd(){const{boardResource:e,boardPickerStopwatch:t}=this.props;t&&(!e||e.error?t.error():t.stop())}render(){const{accessibilityLabelText:e,boardResource:t,buttonText:o,changeBoardModal:s,customItem:r,onBoardCreate:n,onButtonClick:d,paneHeight:c,paneWidth:h,requestContext:u,showSaveToProfile:_,showCreateBoardButton:g,showFlyoutSaveButton:p,showSections:b,showSectionSaveButton:S,suggestedBoardsShortListResource:B,pinAlreadySavedBoard:w,useStoryboardStyle:C,useLegoLayout:A}=this.props,{boardSuggestions:L,isSectionOpen:z,searchBoxFocused:k,searchQuery:R}=this.state;if(!t)return null;const{isLoaded:T,error:E}=t;let F=[];(T&&!E||B&&B.data&&!B.error)&&(F=this.getItems(!!A));const H=F.filter((e=>e&&"allBoards"===e.category)).length;H<=3&&0===L.length&&this.getPinBuilderSuggestions();const W=C?200:322,U=C?214:334,$=c||290,D=u.isRTL?"BoardsSlideRightRTL":"BoardsSlideLeft";let Q="";null!==z&&(Q=u.isRTL?"BoardsSlideLeftRTL":"BoardsSlideRight");const Y=e=>(0,l.jsxs)(i.Fragment,{children:[!A&&(0,l.jsx)(a.iz,{}),(0,l.jsx)(a.xu,{overflow:"hidden",height:Z(A),borderStyle:A&&H>=3&&F.length>1?"shadow":"none",dangerouslySetInlineStyle:{__style:{borderBottomRightRadius:8,borderBottomLeftRadius:8}},children:(0,l.jsx)(f,{onCreateBoardClick:()=>n({title:this.state.searchQuery}),isBoardCreate:e,useLegoLayout:A})})]});return(0,l.jsxs)(a.xu,{width:A&&!s?"100%":h,rounding:2,overflow:"hidden",height:C||s?"100%":O(A),color:"default",zIndex:P.lI,children:[(0,l.jsx)(m.Z,{unsafeCSS:"\n.BoardsSlideLeft {\n  animation: boardFlyoutSlideLeft 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;\n}\n\n.BoardsSlideRight {\n  animation: boardFlyoutSlideRight 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;\n}\n\n.BoardsSlideLeftRTL {\n  animation: boardFlyoutSlideLeftRTL 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;\n}\n\n.BoardsSlideRightRTL {\n  animation: boardFlyoutSlideRightRTL 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;\n}\n\n@keyframes boardFlyoutSlideLeft {\n  from {\n    margin-left: 0%;\n  }\n\n  to {\n    margin-left: -100%;\n  }\n}\n\n@keyframes boardFlyoutSlideRight {\n  from {\n    margin-left: -100%;\n  }\n\n  to {\n    margin-left: 0%;\n  }\n}\n\n@keyframes boardFlyoutSlideLeftRTL {\n  from {\n    margin-right: -100%;\n  }\n\n  to {\n    margin-right: 0%;\n  }\n}\n\n@keyframes boardFlyoutSlideRightRTL {\n  from {\n    margin-right: 0%;\n  }\n\n  to {\n    margin-right: -100%;\n  }\n}\n"}),T?null:(0,l.jsx)(a.kC,{alignItems:"center",height:"100%",justifyContent:"center",minHeight:200,width:A&&!s?M:h,children:(0,l.jsx)(a.$j,{accessibilityLabel:this.props.i18n.bt("loading board picker", "loading board picker", "accessibility text for loading spinner", undefined, true),show:!0})}),(0,l.jsx)(a.kC,{direction:"row",children:T&&(0,l.jsx)("div",{className:z?D:Q,children:(0,l.jsx)(a.xu,{position:"relative",children:(0,l.jsxs)(a.xu,{display:"flex",direction:"row",width:A&&!s?720:2*(null!=h?h:0),zIndex:new a.Ry(0),children:[(0,l.jsxs)(a.kC,{alignItems:"stretch",justifyContent:"start",direction:"column",width:A&&!s?M:h,children:[A&&!s&&(0,l.jsx)(a.kC,{alignItems:"center",height:64,justifyContent:"center",children:(0,l.jsx)(a.xv,{align:"center",size:"300",weight:"bold",children:_?this.props.i18n.bt("Save", "Save", "PinBetterSave.BoardFlyout.SavePlaceholder", undefined, true):this.props.i18n.bt("Save to board", "Save to board", "PinBetterSave.BoardFlyout.SaveToBoardPlaceholder", undefined, true)})}),!s&&(0,l.jsx)(a.xu,{padding:A?0:3,paddingX:A?4:3,height:A?64:"auto",children:(0,l.jsx)(y.Z,{accessibilityLabel:this.props.i18n.bt("Search through your boards", "Search through your boards", "search bar placeholder text", undefined, true),focused:k,id:"pickerSearchField",onChange:({value:e})=>this.handleSearchQueryUpdate(e),placeholder:this.props.i18n.bt("Search", "Search", "search bar placeholder text", undefined, true),value:R})}),(0,l.jsxs)(a.xu,{minHeight:A?290:W,maxHeight:A?$:W,overflow:"scrollY",children:[B&&!B.isLoaded?(0,l.jsx)(j.Z,{id:"suggestedBoardsContainer",children:(0,l.jsx)(a.kC,{alignItems:"center",height:"100%",justifyContent:"center",minHeight:128.5,width:"100%",children:(0,l.jsx)(a.$j,{accessibilityLabel:this.props.i18n.bt("loading board picker", "loading board picker", "accessibility text for loading spinner", undefined, true),show:!0})})}):null,r,F.map(((t,i)=>"header"===t.type?(0,l.jsx)(a.xu,{paddingX:A?4:3,paddingY:1,marginTop:i>0?2:1,children:(0,l.jsx)(a.xv,{size:A?"100":"200",children:t.title})},t.title):(0,l.jsx)(a.xu,{children:(0,l.jsx)(I,{accessibilityLabelText:e,board:t,buttonText:o,displayAlreadySavedMsg:w&&w.id===t.id,onClick:e=>{this.handleBoardClick({board:e,toggleSections:b&&!!e.section_count})},onButtonClick:d,shouldOpenSections:b,showFlyoutSaveButton:p,showSaveToProfile:_,useLegoLayout:A})},`${t.category}-${t.id}`))),H<=3&&(0,l.jsx)(v,{onClick:n,pinBuilderSuggestions:L,inWebRepinFlowExp:A})]}),g&&Y(!0)]}),z&&(0,l.jsxs)(a.xu,{display:"flex",direction:"column",width:A&&!s?M:h,marginBottom:A?2:0,children:[(0,l.jsxs)(a.kC,{alignContent:"center",alignItems:"center",direction:"row",justifyContent:"center",children:[(0,l.jsx)(a.sg,{span:2,children:(0,l.jsx)(a.xu,{display:"flex",justifyContent:"start",alignContent:"center",alignItems:"center",marginStart:3,children:(0,l.jsx)(a.hU,{accessibilityLabel:"Back button",icon:"arrow-back",iconColor:"darkGray",onClick:this.handleBack,size:"sm"})})}),(0,l.jsx)(a.sg,{span:8,children:(0,l.jsx)(a.kC,{alignItems:"center",height:A?64:52,justifyContent:"center",children:(0,l.jsx)(a.xv,{weight:"bold",children:A?this.props.i18n.bt("Save Pin to", "Save Pin to", "PinBetterSave.BoardFlyout.SectionHeader", undefined, true):this.props.i18n.bt("Choose section", "Choose section", "Header for section header", undefined, true)})})}),(0,l.jsx)(a.sg,{span:2,children:(0,l.jsx)(a.xu,{})})]}),!A&&(0,l.jsx)(a.iz,{}),(0,l.jsx)(a.xu,{minHeight:A?354:U,maxHeight:A?$:U,overflow:"scrollY",children:F?(0,l.jsx)(i.Fragment,{children:F&&F.map((e=>"header"===e.type?null:(0,l.jsx)(a.xu,{children:e.isOpen&&(0,l.jsxs)(i.Fragment,{children:[A&&(0,l.jsx)(a.xu,{marginStart:4,marginTop:2,paddingY:1,children:(0,l.jsx)(a.xv,{size:"100",children:this.props.i18n.bt("Board", "Board", "PinBetterSave.BoardFlyout.BoardPickerTitle", undefined, true)})}),(0,l.jsx)(I,{board:e,buttonText:o,displayAlreadySavedMsg:w&&w.id===e.id,isSectionOpen:!0,onClick:e=>{this.handleBoardClick({board:e,toggleSections:!1})},onButtonClick:d,shouldOpenSections:!1,showFlyoutSaveButton:p,ref:this.boardSectionsHeaderRef,useLegoLayout:A}),(0,l.jsx)(x,{board:e,buttonText:o,onClick:this.handleSectionClick,onButtonClick:d,showSectionSaveButton:S,useLegoLayout:A})]})},`${e.category}-${e.id}`)))}):null}),g&&!s&&Y(!1)]})]})})})})]})}}function U(e){const{logContextEvent:t}=(0,A.v)(),o=(0,n.ZP)();return(0,l.jsx)(W,{...e,boardPickerStopwatch:(0,F.iN)(),requestContext:(0,E.B)(),i18n:o,logContextEvent:t})}function $(e,t,o){const{advertiser:i}=e;let s;if(o&&o.user&&o.user.username&&(s=o.user.username),t&&i){const o=e.advertiser;if(t.isAuth&&o.is_impersonation)return{hasMUA:!1,advertiser_id:o.id,username:o.owner_user_id};if(t.isAuth&&o.owner_user_id!==t.id)return{hasMUA:!0,advertiser_id:o.id,username:o.owner_user_id};if(t.isAuth&&o.owner_user_id===t.id)return{hasMUA:!1,advertiser_id:o.id,username:"me"}}return{advertiser_id:void 0,hasMUA:void 0,username:s}}function D(e){const{advertiser_id:t,hasMUA:o}=e,{username:i}=e;let s={field_set_key:"board_picker",filter:o?"protected":"all",...i?{username:i}:Object.freeze({}),...t?{advertiser_id:t}:{}};return(!e.useStoryboardStyle||e.isORBACBeta)&&e.orbacActingAs&&e.orbacActingAs.user&&e.orbacActingAs.user.username&&(s={...s,username:e.orbacActingAs.user.username,orbac_subject_id:e.orbacActingAs.id}),s}function Q(e,t){return(o,i)=>o((0,C.jB)("BoardPickerBoardsResource",D($(i(),e,t))))}function Y(e){const t=(0,g.Z)(),o={...e,...(0,s.useSelector)((e=>$(e,t)))},i=(0,_.Z)({name:"BoardPickerBoardsResource",options:D(o)});return(0,l.jsx)(U,{...o,boardResource:i})}function q(e){const t=(0,u.Z)(),o=(0,g.Z)(),i=(0,p.lJ)(o,t),{anyEnabled:s}=(0,L.F)().checkExperiment("web_m10n_business_access_orbac_www");return(0,l.jsx)(Y,{...e,orbacActingAs:i?t:void 0,isORBACBeta:s})}function N(e){const t=(0,_.Z)({name:"BoardPickerBoardsShortlistResource",options:{pin_id:e.pin.id,shortlist_length:3,num_shortlist_suggestions:3}}),{data:o}=(0,_.Z)({name:"ApiResource",options:{url:`/v3/pins/${e.pin.id}/`,field_sets:["pin.pinned_to_board()"]},noCache:!0});return(0,l.jsx)(U,{...e,suggestedBoardsShortListResource:t,pinAlreadySavedBoard:null==o?void 0:o.pinned_to_board})}H(W,"defaultProps",{paneWidth:320,showCreateBoardButton:!0,showFlyoutSaveButton:!0,showSections:!0,showSectionSaveButton:!0,useLegoLayout:!0})},217641:(e,t,o)=>{o.d(t,{Z:()=>n});var i=o(667294),s=o(883119),r=o(785893);function n(e){const{accessibilityLabel:t,focused:o,id:n,onBlur:a,onChange:l,onFocus:d,placeholder:c,value:h,size:u="lg"}=e,_=(0,i.useRef)(null);return(0,i.useEffect)((()=>{if(o){const e=_.current;window.requestAnimationFrame((()=>{const t=e&&e.querySelector("input");t instanceof HTMLInputElement&&t.focus()}))}}),[o]),(0,r.jsx)(s.xu,{ref:_,children:(0,r.jsx)(s.Um,{accessibilityLabel:t,id:n,onBlur:a,onChange:l,onFocus:d,placeholder:c,size:u,value:h})})}}}]);
//# sourceMappingURL=https://sm.pinimg.com/webapp/46760.en_AU-a84e87379c52f440.mjs.map