(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[78120],{337148:e=>{var t,i,s={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"StelaOnIdeaPinPermissionQuery",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"v3GetCurrentUserHandlerQuery",plural:!1,selections:[{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"data",plural:!1,selections:[t={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"ipStelaRecDisabled",storageKey:null}],type:"User",abstractKey:null}],storageKey:null}],type:"V3GetCurrentUserHandler",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"StelaOnIdeaPinPermissionQuery",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"v3GetCurrentUserHandlerQuery",plural:!1,selections:[i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"data",plural:!1,selections:[i,t,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],type:"Node",abstractKey:"__isNode"}],storageKey:null}],type:"V3GetCurrentUserHandler",abstractKey:null}],storageKey:null}]},params:{id:"2653a6ed13b2a48a0adbce54781b1b88b025b8bd93a112b8a0bd15da606dcbe9",metadata:{},name:"StelaOnIdeaPinPermissionQuery",operationKind:"query",text:null}};s.hash="c061d1400492f868408772f86f659738",e.exports=s},887831:(e,t,i)=>{i.d(t,{Z:()=>r});var s=i(667294);let n=null,o=!1,l=0;const a=()=>{n&&clearTimeout(n),o=!0,n=setTimeout((()=>{o=!1}),100)},r=()=>{const[e,t]=(0,s.useState)(!1),i=(0,s.useRef)(null);(0,s.useEffect)((()=>(0===l&&window.addEventListener("scroll",a),l+=1,()=>{i.current&&clearTimeout(i.current),l-=1,l||window.removeEventListener("scroll",a)})),[]);const n=e=>{i.current&&clearTimeout(i.current),i.current=e&&o?setTimeout((()=>n(!0)),100):setTimeout((()=>{t(e)}),32)};return{isHovering:e,hoverHandlers:(0,s.useRef)({onMouseOver:()=>n(!0),onMouseLeave:()=>n(!1)}).current}}},897103:(e,t,i)=>{i.d(t,{Z:()=>y});var s=i(667294),n=i(702664),o=i(488769),l=i(27255),a=i(654287),r=i(984206),d=i(109892),c=i(717615),h=i(784590),u=i(19121),p=i(615298),_=i(507016),g=i(231947),x=i(414327),m=i(898781),b=i(883119),v=i(785893);function f(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function C({board:e,hovered:t,searchQuery:i}){const s=e.privacy===l.Z.BoardPrivacy.SECRET;return(0,v.jsxs)(b.xu,{color:t?"secondary":"default",display:"flex",padding:2,rounding:2,children:[(0,v.jsx)(b.xu,{flex:"grow",children:(0,v.jsx)(b.xv,{weight:"bold",children:(0,_.W)(i,e.name)})}),(0,v.jsxs)(b.kC,{alignItems:"stretch",justifyContent:"start",direction:"row",flex:"none",children:[s&&(0,v.jsx)(o.Z,{type:"secret"}),e.is_collaborative&&(0,v.jsx)(o.Z,{type:"group"})]})]})}class P extends s.Component{constructor(e){super(e),f(this,"getSections",(()=>{var e;if(null===(e=this.props.boardResource.data)||void 0===e||!e.all_boards)return[];const{searchQuery:t}=this.state,{boardResource:{data:{all_boards:i}}}=this.props;return t.length>=r.Z?[{items:(0,p.j)(i,t)}]:[{items:i}]})),f(this,"createBtnDisabled",(()=>{var e;if(null===(e=this.props.boardResource.data)||void 0===e||!e.all_boards)return!1;const{boardResource:{data:{all_boards:t}}}=this.props,{searchQuery:i}=this.state;return t.some((e=>{var t;return(null===(t=e.name)||void 0===t?void 0:t.toLowerCase())===i.toLowerCase()}))})),f(this,"handleBoardCreate",(e=>()=>{const{searchQuery:e}=this.state;if(!e)return;const{createBoard:t,invalidateBoardPickerBoardsResource:i,onBoardCreate:s}=this.props;i(),s?s(e):t({name:e,privacy:"public"}).then((e=>{const{onBoardChosen:t}=this.props;t(e)}))})),f(this,"handleBoardSelected",(e=>{this.props.onBoardChosen(e),this.setState({selectedBoard:e})})),f(this,"handleSearchQueryUpdate",(e=>{this.setState({searchQuery:e})})),f(this,"renderRow",(({item:e,hovered:t})=>{const{searchQuery:i}=this.state;return(0,v.jsx)(C,{board:e,hovered:t,searchQuery:i})})),this.state={searchQuery:"",selectedBoard:e.board}}render(){const{boardResource:e,board:t,isBoardlessPinsBoard:i,isQuickCreatesBoard:s,isStoryPin:n,viewer:o}=this.props,{searchQuery:l,selectedBoard:r}=this.state;let d=this.props.i18n.bt("Select a board", "Select a board", "Label for selecting a board in Edit Pin Modal", undefined, true);return t?d=s?this.props.i18n.bt("Choose board", "Choose board", "BoardPickerFlyout.displayBoardName.quickCreatesBoard", undefined, true):i?this.props.i18n.bt("Profile", "Profile", "BoardPickerFlyout.displayBoarName.boardlessPins", undefined, true):t.name:r&&(d=r.name),(0,v.jsxs)(b.xu,{children:[(0,v.jsx)(b.$j,{accessibilityLabel:this.props.i18n.bt("loading board picker", "loading board picker", "accessibility text for loading spinner", undefined, true),show:!e.isLoaded}),e.data&&(0,v.jsx)(a.Z,{createBtnDisabled:this.createBtnDisabled(),dropdownValue:d||"",isStoryPin:n,onCreate:this.handleBoardCreate(o),onSearchQueryUpdate:this.handleSearchQueryUpdate,onSelect:this.handleBoardSelected,renderRow:this.renderRow,searchQuery:l,sections:this.getSections(),blockBoardChange:null==t?void 0:t.is_ads_only})]})}}function y(e){const t=(0,d.Z)(),i=(0,m.ZP)(),s=(0,n.useDispatch)(),o=(0,u.Z)(),l=(0,n.useSelector)((({advertiser:e})=>e)),a=o.isAuth&&l&&l.owner_user_id!==o.id,r=a?l.id:null,p=a?l.owner_user_id:null,_=(0,c.Z)(),b=(0,g.Ms)(o,_),f=b||p,C=(0,h.Z)({name:"BoardPickerBoardsResource",options:{pin_id:e.pinId,field_set_key:"board_picker",onlyFetchBoards:!0,username:f,...r&&p?{advertiser_id:r,filter:"protected",username:p}:{}},noCache:!0});return(0,v.jsx)(P,{...e,advertiser_id:r,boardResource:C,createBoard:e=>t({boardCreateOptions:e}),invalidateBoardPickerBoardsResource:()=>{s((0,x.jB)("BoardPickerBoardsResource",{field_set_key:"board_picker",...b?{username:b}:{username:p}}))},username:p,viewer:o,i18n:i})}},654287:(e,t,i)=>{i.d(t,{Z:()=>p});var s=i(667294),n=i(176020),o=i(33897),l=i(960260),a=i(887831),r=i(898781),d=i(883119),c=i(785893);function h(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class u extends s.Component{constructor(...e){super(...e),h(this,"state",{showFlyout:!1}),h(this,"setContainerRef",(e=>{this.containerRef=e})),h(this,"handleCreate",(()=>{this.hideFlyout();const{onCreate:e}=this.props;e&&e()})),h(this,"handleSelectItem",(e=>{this.hideFlyout();const{onSelect:t,onCreate:i}=this.props;e?t(e):i&&i()})),h(this,"handleDropdownTouch",(()=>{this.setState((e=>({showFlyout:!e.showFlyout})))})),h(this,"handleHideFlyout",(e=>{this.containerRef&&e.target instanceof HTMLElement&&!this.containerRef.contains(e.target)&&this.hideFlyout()})),h(this,"hideFlyout",(()=>{const{hoverHandlers:{onMouseLeave:e}}=this.props;e(),this.setState({showFlyout:!1})}))}componentDidMount(){document.addEventListener("click",this.handleHideFlyout,{capture:!0})}componentWillUnmount(){document.removeEventListener("click",this.handleHideFlyout,{capture:!0})}render(){const{dropdownValue:e,fetchMore:t,hoverHandlers:{onMouseOver:i,onMouseLeave:s},isHovering:a,isStoryPin:r,onCreate:h,onSearchQueryUpdate:u,renderRow:p,searchQuery:_,sections:g,createBtnDisabled:x,blockBoardChange:m}=this.props,{showFlyout:b}=this.state;this.indexManager=new n.Z(g.map((e=>e.items))),this.indexManager.setSelectItem(this.handleSelectItem);const v=!_.trim()||!!x;return(0,c.jsxs)(d.xu,{ref:this.setContainerRef,flex:r?"grow":void 0,children:[(0,c.jsx)(d.iP,{fullWidth:!!r,onMouseEnter:i,onMouseLeave:s,onTap:this.handleDropdownTouch,rounding:2,disabled:!!m,children:(0,c.jsxs)(d.xu,{alignItems:"center",color:a?"lightWash":"secondary",direction:"row",display:"flex",flex:"grow",paddingX:4,paddingY:r?4:3,rounding:r?4:2,children:[(0,c.jsx)(d.kC,{alignItems:"stretch",justifyContent:"start",flex:"grow",children:(0,c.jsx)(d.xv,{weight:"bold",color:m?"subtle":"default",children:e})}),m?(0,c.jsx)(d.JO,{accessibilityLabel:"",color:"subtle",icon:"arrow-down",size:14}):(0,c.jsx)(d.JO,{accessibilityLabel:"",color:"default",icon:"arrow-down",size:14})]})}),b&&(0,c.jsx)(d.xu,{position:"relative",children:(0,c.jsxs)(d.xu,{borderStyle:"sm",color:"default",direction:"column",display:"flex",overflow:"hidden",position:"absolute",rounding:r?4:2,width:"100%",zIndex:new d.Ry(1),children:[(0,c.jsx)(d.xu,{children:(0,c.jsxs)(d.xu,{display:"flex",marginStart:-1,marginEnd:-1,padding:2,children:[(0,c.jsx)(d.xu,{display:"flex",flex:"grow",paddingX:1,children:(0,c.jsx)(o.Z,{hideIcon:!0,indexManager:this.indexManager,onChange:u,value:_})}),h&&(0,c.jsx)(d.xu,{paddingX:1,children:(0,c.jsx)(d.zx,{disabled:v,onClick:this.handleCreate,text:this.props.i18n.bt("Create", "Create", "board or section dropdown create button", undefined, true)})})]})}),(0,c.jsx)(l.Z,{fetchMore:t,indexManager:this.indexManager,maxHeight:240,onSelectItem:this.handleSelectItem,renderItem:p,sections:g})]})})]})}}function p(e){const t=(0,r.ZP)(),{isHovering:i,hoverHandlers:s}=(0,a.Z)();return(0,c.jsx)(u,{...e,i18n:t,isHovering:i,hoverHandlers:s})}},241563:(e,t,i)=>{i.d(t,{Z:()=>v,x:()=>b});var s=i(667294),n=i(702664),o=i(654287),l=i(984206),a=i(784590),r=i(678638),d=i(615298),c=i(507016),h=i(898781),u=i(883119),p=i(785893);function _(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const g="NO_SECTION_VALUE";function x({section:e,hovered:t,searchQuery:i}){return(0,p.jsxs)(u.xu,{children:[(0,p.jsx)(u.xu,{color:t?"secondary":"default",display:"flex",padding:2,rounding:2,children:(0,p.jsx)(u.xu,{flex:"grow",children:(0,p.jsx)(u.xv,{weight:"bold",children:(0,c.W)(i,e.title)})})}),e.id===g&&(0,p.jsx)(u.iz,{})]})}class m extends s.Component{constructor(...e){super(...e),_(this,"state",{searchQuery:""}),_(this,"getPickerSections",(()=>{const{searchQuery:e}=this.state,{sectionsResource:t,mergingFromSectionId:i}=this.props;let s=t&&t.data||[];return s=i?s.filter((e=>e.id!==i)):[{id:g,title:this.props.i18n.bt("No section", "No section", "default dropdown option for selecting a board section on pin edit", undefined, true)},...s],e.length>=l.Z&&(s=(0,d.j)(s,e,"title")),[{items:s}]})),_(this,"createBtnDisabled",(()=>{const{sectionsResource:e}=this.props,{searchQuery:t}=this.state;return!(!e||!e.data)&&e.data.some((e=>{var i;return(null===(i=e.title)||void 0===i?void 0:i.toLowerCase())===t.toLocaleLowerCase()}))})),_(this,"handleSectionCreate",(()=>{const{board:e,onSectionChange:t,sectionsResource:i,dispatch:s,onSectionCreate:n}=this.props,{searchQuery:o}=this.state;n?n(o):s&&e.id&&s((0,r.vB)({boardId:e.id,name:o},this.props.i18n)).then((e=>{i&&i.refresh(),this.setState({searchQuery:""}),t(e)}))})),_(this,"handleSectionSelected",(e=>{const{onSectionChange:t}=this.props;e.id===g?(t(null),this.setState({searchQuery:""})):(t(e),this.setState({searchQuery:""}))})),_(this,"handleSearchQueryUpdate",(e=>{this.setState({searchQuery:e})})),_(this,"renderRow",(({item:e,hovered:t})=>{const{searchQuery:i}=this.state;return(0,p.jsx)(x,{hovered:t,searchQuery:i,section:e})}))}componentDidUpdate(e){const t=e.selectedSectionId,{selectedSectionId:i}=this.props;if(i!==t){const{sectionsResource:e}=this.props;e&&e.refresh()}}render(){const{isStoryPin:e,sectionsResource:t,selectedSectionId:i,mergingFromSectionId:s,selectedSectionName:n}=this.props,{searchQuery:l}=this.state;let a=s?this.props.i18n.bt("Pick a section", "Pick a section", "default dropdown option for selecting a board section to merge to", undefined, true):this.props.i18n.bt("No section", "No section", "default dropdown option for selecting a board section on pin edit", undefined, true);if(i){let e;t&&t.data&&(e=t.data.find((e=>e.id===i))),a=e&&e.title||a}else n&&(a=n);return(0,p.jsxs)(u.xu,{children:[(0,p.jsx)(u.$j,{accessibilityLabel:this.props.i18n.bt("loading section picker", "loading section picker", "accessibility text for loading spinner", undefined, true),show:!!t&&!t.isLoaded}),(!t||t&&t.isLoaded)&&(0,p.jsx)(o.Z,{createBtnDisabled:this.createBtnDisabled(),dropdownValue:a,isStoryPin:e,onCreate:s?null:this.handleSectionCreate,onSearchQueryUpdate:this.handleSearchQueryUpdate,onSelect:this.handleSectionSelected,renderRow:this.renderRow,searchQuery:l,sections:this.getPickerSections()})]})}}function b(e){const t=(0,h.ZP)();return(0,p.jsx)(m,{...e,dispatch:(0,n.useDispatch)(),i18n:t})}function v(e){const t=(0,a.Z)({name:"BoardSectionsRepinResource",options:{board_id:e.board.id},noCache:!0});return(0,p.jsx)(b,{...e,sectionsResource:t})}},33897:(e,t,i)=>{i.d(t,{Z:()=>c});var s=i(667294),n=(i(176020),i(755742)),o=i(883119),l=i(898781),a=i(785893);function r(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class d extends s.Component{constructor(...e){super(...e),r(this,"setInputRef",(e=>{e&&(this._input=e)})),r(this,"handleKeyDown",(e=>{const{disabled:t,indexManager:i}=this.props;if(!t)switch(e.which){case n.Z.ENTER:case n.Z.NUMPAD_ENTER:e.preventDefault(),i.select();break;case n.Z.UP:e.preventDefault(),i.prev();break;case n.Z.DOWN:e.preventDefault(),i.next()}}))}componentDidMount(){this._input&&this._input.focus()}render(){const{onChange:e,value:t}=this.props;return(0,a.jsx)("div",{onKeyDown:this.handleKeyDown,role:"presentation",style:{width:"100%"},children:(0,a.jsx)(o.Um,{accessibilityLabel:"",id:"pickerSearchField",onChange:({value:t})=>e(t),placeholder:this.props.i18n.bt("Search", "Search", "search bar placeholder text", undefined, true),ref:this.setInputRef,size:"lg",value:t})})}}const c=function(e){const t=(0,l.ZP)();return(0,a.jsx)(d,{...e,i18n:t})}},916062:(e,t,i)=>{i.d(t,{Z:()=>o});var s=i(53987),n=i(276775);function o(e){const t=(0,n.useLocation)(),i=(0,n.useParams)(),o=(0,n.useHistory)();return()=>{if(e&&(0,s.L6)(t)&&i.id===e.id){var n,l,a,r;const t="quick_saves"===(null===(n=e.board)||void 0===n?void 0:n.layout)||"quick_creates"===(null===(l=e.board)||void 0===l?void 0:l.layout)?"/me/":null!==(a=null===(r=e.board)||void 0===r?void 0:r.url)&&void 0!==a?a:"/";o.replace(t)}}}},176020:(e,t,i)=>{i.d(t,{Z:()=>l});const s={row:0,section:0},n={row:-1,section:-1},o=()=>{};class l{constructor(e){this.index={...s},this.sections=e,this.updateCallback=o,this.selectItem=o}getIndex(){return this.index}isAtStart(){const{row:e,section:t}=this.index;return 0===e&&0===t}isAtEnd(){const{row:e,section:t}=this.index,i=this.sections[t]||[];return this.sections.length===t+1&&i.length===e+1}next(){if(this.isAtEnd())return;const{row:e,section:t}=this.index;e===n.row&&t===n.section?this.index={...s}:this.sections[t].length>e+1?this.index.row+=1:(this.index.section+=1,this.index.row=0),this.updateCallback(!0)}prev(){if(this.isAtStart())return;const{row:e,section:t}=this.index;if(e===n.row&&t===n.section)this.index={...s};else if(e>0)this.index.row-=1;else{const e=this.index.section-1;this.index={section:e,row:this.sections[e].length-1}}this.updateCallback(!0)}select(){const{row:e,section:t}=this.index;this.selectItem((this.sections[t]||[])[e])}setInactive(){this.index={...n},this.updateCallback()}setSelectItem(e){this.selectItem=e}setUpdateCallback(e){this.updateCallback=e}updateIndex(e){this.index=e,this.updateCallback()}}},960260:(e,t,i)=>{i.d(t,{Z:()=>r});var s=i(667294),n=i(425480),o=(i(176020),i(883119)),l=i(785893);function a(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class r extends s.Component{constructor(e){super(e),a(this,"setSelectedItemRef",(e=>{this.selectedItemRef=e})),a(this,"handleIndexUpdate",(e=>{const{indexManager:t}=this.props;this.setState({selectedIndex:t.getIndex(),selectionMovedByKeyboard:!!e})})),a(this,"handleSelectItem",(e=>()=>{const{disabled:t,onSelectItem:i}=this.props;t||i(e)})),a(this,"handleMouseEnter",(e=>()=>{const{disabled:t,indexManager:i}=this.props;t||i.updateIndex(e)})),a(this,"handleMouseLeave",(()=>{const{disabled:e,indexManager:t}=this.props;e||t.setInactive()})),a(this,"renderItems",((e,t)=>{const{renderItem:i}=this.props,{selectedIndex:s}=this.state,{row:n,section:a}=s||{},{customProps:r={},items:d,renderItem:c}=e,{isDisabled:h=(e=>!1)}=r,u=t===a,p=c||i;return p&&d.map(((e,i)=>{const s=h(e),a={section:t,row:i},d=u&&i===n;return(0,l.jsx)(o.xu,{"data-test-id":"board-selection",ref:!s&&d?this.setSelectedItemRef:null,children:s?p({item:e,hovered:d,sectionProps:r}):(0,l.jsx)(o.iP,{fullWidth:!1,onMouseEnter:this.handleMouseEnter(a),onMouseLeave:this.handleMouseLeave,onTap:this.handleSelectItem(e),rounding:2,children:p({item:e,hovered:d,sectionProps:r})})},i)}))})),a(this,"renderSections",(()=>{const{renderSectionHeader:e,sections:t}=this.props;return t.map(((t,i)=>(0,l.jsxs)(o.xu,{children:[e&&e(t,i),this.renderItems(t,i)]},i)))}));const{indexManager:t}=this.props;this.state={selectedIndex:t.getIndex(),selectionMovedByKeyboard:!1},t.setUpdateCallback(this.handleIndexUpdate)}componentDidUpdate(e){const{containerRef:t}=this;if(this.selectedItemRef&&this.state.selectionMovedByKeyboard&&t){const e=this.selectedItemRef;if(!(e instanceof HTMLElement))return;const i=e.getBoundingClientRect(),s=i.top,n=i.bottom,o=t.getBoundingClientRect(),l=o.top;n>=o.bottom?e.scrollIntoView(!1):s<=l&&e.scrollIntoView(!0)}e.indexManager!==this.props.indexManager&&this.props.indexManager.setUpdateCallback(this.handleIndexUpdate)}render(){const{grow:e=!1,maxHeight:t,fetchMore:i}=this.props;return(0,l.jsx)(n.Z,{fetchMore:i,children:({setRef:i,onScroll:s})=>(0,l.jsx)(o.xu,{flex:e?"grow":void 0,height:e?"100%":void 0,maxHeight:t,onScroll:s,overflow:"auto",ref:e=>{this.containerRef=e,i(e)},children:this.renderSections()})})}}},274495:(e,t,i)=>{i.d(t,{Z:()=>a});var s=i(883119),n=i(785893);const o={__style:{margin:"0 10px",borderRight:"3px solid transparent",borderTop:"3px solid #fff",animation:"spin .8s linear infinite"}};function l(){return(0,n.jsx)(s.xu,{alignItems:"center",color:"primary",display:"flex",height:"100%",justifyContent:"center",position:"absolute",width:"100%",rounding:8,children:(0,n.jsx)(s.xu,{dangerouslySetInlineStyle:o,display:"inlineBlock",height:18,position:"relative",rounding:"circle",width:18})})}function a({disabled:e,name:t,onClick:i,size:o,submitting:a,text:r}){return(0,n.jsxs)(s.xu,{display:"flex",position:"relative",children:[a&&(0,n.jsx)(l,{}),(0,n.jsx)(s.zx,{color:"red",disabled:e||a,name:t,onClick:i,size:o,type:"submit",text:r})]})}},482567:(e,t,i)=>{i.d(t,{_:()=>n});var s=i(6637);function n(e,t,i,n){return async o=>{const l=s.Z.create("ApiResource",{url:`/v3/pins/${e}/notes/`,data:{pin_note_content:i,...n?{orbac_subject_id:n}:Object.freeze({})}});let a;a=i?t?await l.callUpdate():await l.callCreate():await l.callDelete();const{resource_response:r}=a;o(function(e,t){return{type:"PIN_NOTE_UPDATE",payload:{pinId:e,pinNote:t}}}(e,null==r?void 0:r.data))}}},78120:(e,t,i)=>{i.d(t,{ZP:()=>Pe,Tr:()=>fe,aU:()=>be});var s=i(667294),n=i(702664),o=i(41233),l=i(150361),a=i.n(l),r=i(898781),d=i(883119),c=i(785893);function h({commentsDisabled:e,onCommentChange:t,onPhotoChange:i,photosDisabled:s,isManagedView:n,isNoTitle:o}){const l=(0,r.ZP)(),a=n?6:o?0:3;return(0,c.jsxs)(d.xu,{children:[!o&&(0,c.jsx)(d.iz,{}),(0,c.jsxs)(d.xu,{mdDisplay:"flex",justifyContent:"between",paddingX:n?0:4,paddingY:a,children:[!n&&!o&&(0,c.jsx)(d.xu,{column:12,mdColumn:3,paddingY:2,children:(0,c.jsx)(d.xv,{size:"200",children:l.bt("Comment permissions", "Comment Permissions", "Label for comments setting on a pin in pin edit form", undefined, true)})}),(0,c.jsxs)(d.xu,{column:12,mdColumn:n?12:8,children:[(0,c.jsxs)(d.xu,{paddingY:1,display:"flex",alignItems:"center","data-test-id":"allow-comments-switch",children:[(0,c.jsx)(d.rs,{onChange:t,id:"CommentSwitch",switched:!e}),(0,c.jsx)(d.xu,{paddingX:2,children:(0,c.jsx)(d.__,{htmlFor:"CommentSwitch",children:(0,c.jsx)(d.xv,{size:"200",children:l.bt("Allow people to comment", "Allow people to comment", "Label for toggling comments on a pin in pin edit form", undefined, true)})})})]}),i&&(0,c.jsxs)(d.xu,{paddingY:1,alignItems:"center",display:"flex",children:[(0,c.jsx)(d.rs,{onChange:i,id:"PhotoSwitch",switched:!s}),(0,c.jsx)(d.xu,{paddingX:2,children:(0,c.jsx)(d.__,{htmlFor:"PhotoSwitch",children:(0,c.jsx)(d.xv,{size:"200",children:l.bt("Allow people to upload photos", "Allow people to upload photos", "Label for toggling photos on a pin in pin edit form", undefined, true)})})})]})]})]})]})}var u=i(27255),p=i(618446),_=i.n(p),g=i(121151),x=i(274495),m=i(941646),b=i(499128),v=i(343341);function f(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class C extends s.PureComponent{constructor(...e){super(...e),f(this,"state",{deleting:!1}),f(this,"unmounted",!1),f(this,"handleConfirm",(()=>{if(this.state.deleting)return;const{onDeletePin:e}=this.props;this.setState({deleting:!0}),e().then((()=>this.handleDeleteDidComplete())).catch((e=>this.handleDeleteDidComplete(e)))})),f(this,"handleDeleteDidComplete",(e=>{const{toastManagerContext:t}=this.props;this.unmounted||this.setState({deleting:!1}),e||t.showToast((({hideToast:e})=>(0,c.jsx)(b.ZP,{onHide:e,text:this.props.i18n.bt("Pin deleted", "Pin deleted!", "User deleted their pin", undefined, true)})))}))}componentWillUnmount(){this.unmounted=!0}render(){const{i18n:e,onDismiss:t,showStoryPinCreatorDeleteMessage:i}=this.props,{deleting:s}=this.state;return(0,c.jsx)(g.ZP,{heading:e.bt("Are you sure?", "Are you sure?", "Confirm the user wants to delete the pin", undefined, true),accessibilityModalLabel:e.bt("Are you sure you want to delete this Pin?", "Are you sure you want to delete this pin?", "Accessible label to confirm the user wants to delete the pin", undefined, true),size:"sm",onDismiss:t,footer:(0,c.jsxs)(d.xu,{display:"flex",justifyContent:"center",marginStart:-1,marginEnd:-1,children:[(0,c.jsx)(d.xu,{paddingX:1,children:(0,c.jsx)(d.zx,{fullWidth:!0,onClick:t,text:e.bt("Cancel", "Cancel", " - ", undefined, true)})}),(0,c.jsx)(d.xu,{paddingX:1,children:(0,c.jsx)(m.Z,{id:"confirm-delete-pin",children:(0,c.jsx)(x.Z,{onClick:this.handleConfirm,text:e.bt("Delete", "Delete", "PinEditModal.DeletePinConfirmation.DeleteButton", undefined, true),submitting:s})})})]}),children:(0,c.jsx)(d.xu,{padding:4,display:"flex",justifyContent:"center",children:(0,c.jsx)(d.xv,{children:i?e.bt("If you delete this Pin, it'll be gone forever and no-one who has saved it will be able to view it.", "If you delete this Pin, it'll be gone for good and those who've saved it won't be able to view it.", "PinEditModal.DeletePinConfirmation", undefined, true):e.bt("Once you delete a Pin, you can't undo it.", "Once you delete a Pin, you can't undo it!", " - ", undefined, true)})})})}}function P(e){const t=(0,r.ZP)();return(0,c.jsx)(C,{...e,i18n:t,toastManagerContext:(0,v.F9)()})}function y({canEdit:e,onAltTextChange:t,altText:i}){const n=(0,r.ZP)();return(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(d.iz,{}),(0,c.jsxs)(d.xu,{mdDisplay:"flex",justifyContent:"between",paddingX:4,paddingY:3,children:[(0,c.jsx)(d.xu,{column:12,mdColumn:3,paddingY:2,children:(0,c.jsx)(d.__,{htmlFor:"AltTextField",children:(0,c.jsx)(d.xv,{size:"200",children:n.bt("Alt text", "Alt text", "EditPinModal.EditAltText", undefined, true)})})}),(0,c.jsx)(d.xu,{column:12,mdColumn:8,children:e?(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(d.xu,{children:(0,c.jsx)(d.nv,{id:"AltTextField",onChange:({value:e})=>t({value:e.slice(0,500)}),size:"lg",value:i||""})}),(0,c.jsx)(d.xu,{children:(0,c.jsx)(d.__,{htmlFor:"AltTextField",children:(0,c.jsx)(d.xu,{marginTop:1,children:(0,c.jsx)(d.xv,{size:"200",color:"subtle",children:n.bt("This helps people using screen readers understand what your Pin is about.", "This helps people using screen readers understand what your Pin is about.", "EditPinModal.EditAltText", undefined, true)})})})})]}):(0,c.jsx)(d.xu,{column:12,mdColumn:8,paddingY:2,children:(0,c.jsx)(d.xv,{size:"200",weight:"bold",children:i})})})]})]})}var j=i(897103),S=i(990823);function w({board:e={},canEdit:t,isOriginallyQuickCreatesBoard:i,onBoardChange:s,onBoardCreate:n,viewerId:o}){const l=(0,r.ZP)(),{showEnabledSaveBehavior:a}=(0,S.ZP)(o),h="quick_saves"===e.layout&&a,u="quick_creates"===e.layout;return(0,c.jsxs)(d.xu,{mdDisplay:"flex",justifyContent:"between",paddingX:4,paddingY:3,children:[(0,c.jsx)(d.xu,{column:12,mdColumn:3,paddingY:2,children:(0,c.jsx)(d.__,{htmlFor:"BoardPicker",children:(0,c.jsx)(d.xv,{size:"200",children:i?l.bt("Organise on a board (optional)", "Organize to a board (optional)", "editPinModal.editBoard.optionalBoardLabel", undefined, true):l.bt("Board", "Board", " - ", undefined, true)})})}),t?(0,c.jsx)(d.xu,{column:12,mdColumn:8,"data-test-id":"edit-board",children:(0,c.jsx)(j.Z,{board:e,isBoardlessPinsBoard:h,isQuickCreatesBoard:u,onBoardChosen:s,onBoardCreate:n})}):e.name&&(0,c.jsx)(d.xu,{column:12,mdColumn:8,paddingY:2,children:(0,c.jsx)(d.xv,{size:"200",weight:"bold",children:e.name})})]})}var A=i(857752),z=i(43898),I=i(407043);function E(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class D extends s.Component{constructor(...e){super(...e),E(this,"state",{focused:!1}),E(this,"suggestionAnchorRef",(0,s.createRef)()),E(this,"handleBlur",(e=>{this.setState({focused:!1});const{onBlur:t}=this.props;t&&t(e)})),E(this,"handleFocus",(e=>{this.setState({focused:!0});const{onFocus:t}=this.props;t&&t(e)})),E(this,"handleChange",(({text:e,mentions:t})=>{this.props.onDescriptionChange({value:e,userMentionTags:t})}))}render(){const{canAddUserMentionTags:e,canEdit:t,description:i,errorMessage:n,initialMentions:o,label:l,placeholder:a,onDescriptionChange:r}=this.props,h={__style:{...this.state.focused?{boxShadow:"0 0 0 3px #92c2fb"}:{}}};return(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(d.iz,{}),(0,c.jsxs)(d.xu,{mdDisplay:"flex",justifyContent:"between",paddingX:4,paddingY:3,children:[(0,c.jsx)(d.xu,{column:12,mdColumn:3,paddingY:2,children:(0,c.jsx)(d.__,{htmlFor:"DescriptionField",children:(0,c.jsx)(d.xv,{size:"200",children:l})})}),t?(0,c.jsxs)(d.xu,{column:12,mdColumn:8,children:[(0,c.jsx)(d.xu,{children:e?(0,c.jsx)(d.xu,{borderStyle:"lg",dangerouslySetInlineStyle:h,id:"DescriptionField",minHeight:48,paddingX:2,paddingY:4,ref:this.suggestionAnchorRef,role:"textbox",rounding:4,children:(0,c.jsx)(A.Z,{initialMentions:o,initialText:i,onAddMention:()=>{this.props.logContextEvent({event_type:8905,element:116,aux_data:{tag_type:1}})},onBlur:this.handleBlur,onChange:this.handleChange,onFocus:this.handleFocus,onSearchMentionCancel:()=>{this.props.logContextEvent({event_type:8908,element:116,aux_data:{tag_type:1}})},onSuggestionsPopoverOpen:()=>{this.props.logContextEvent({event_type:8907,element:116,aux_data:{tag_type:1}})},maxSuggestions:4,placeholder:a})}):(0,c.jsx)(d.Kx,{id:"DescriptionField",placeholder:a,value:i,onChange:({value:e})=>{r({value:e,userMentionTags:[]})},hasError:(n||"").length>0})}),!!n&&(0,c.jsx)(d.xu,{children:(0,c.jsx)(z.Z,{errorMessage:n,htmlFor:"pin-edit-description"})})]}):(0,c.jsx)(d.xu,{column:12,mdColumn:8,paddingY:2,children:(0,c.jsx)(d.xv,{size:"200",weight:"bold",children:i})})]})]})}}const k=function(e){const{logContextEvent:t}=(0,I.v)();return(0,c.jsx)(D,{...e,logContextEvent:t})};var T=i(356725),M=i(239062),R=i(876371);function B({isCarousel:e,onMouseEnter:t,onMouseLeave:i,shouldShowCarouselSliders:s,onCarouselSlide:n,currentIndex:o,carouselData:l,pinId:a,description:r,image:h={}}){return(0,c.jsxs)(d.xu,{paddingX:4,paddingY:3,children:[e&&(()=>{const e=l&&l.carousel_slots&&l.carousel_slots.length||1;return e>=2&&(0,c.jsx)(d.xu,{padding:2,children:(0,c.jsx)(d.__,{htmlFor:"CardsIndex",children:(0,c.jsxs)(d.xv,{size:"200",children:[o+1,"/",e]})})})})(),(0,c.jsx)(d.zd,{width:236,children:(0,c.jsxs)(d.xu,{onMouseEnter:t,onMouseLeave:i,children:[(0,c.jsxs)(d.zd,{rounding:2,wash:!0,children:[e&&s&&(0,c.jsx)(d.xu,{display:"inlineBlock",height:"100%",position:"absolute",width:"100%",zIndex:new d.Ry(10),dangerouslySetInlineStyle:{__style:{background:"rgba(0, 0, 0, 0.3)"}},children:(0,c.jsx)(M.default,{handleCarouselSwipe:n,carouselIndex:o,carouselData:l,pinId:a,isEditMode:!0})}),e?(0,c.jsx)(R.Z,{carouselIndex:o,isCloseup:!1,carouselData:l,pinId:a,isEditMode:!0}):(0,c.jsx)(d.Ee,{alt:r,color:"#efefef",naturalHeight:h.height,src:h.url,naturalWidth:h.width})]}),e&&(0,c.jsx)(T.default,{carouselIndex:o,carouselData:l,pinId:a,handleCarouselSwipe:n,isEditMode:!0,variant:"legacy"})]})})]})}function L({apiErrorMessage:e,shouldShowGenericUpdateError:t,onClickDeleteButton:i,disableDelete:s,onHide:n,shouldDisableSave:o,triggerBoardAndSectionCreate:l}){const a=(0,r.ZP)();return(0,c.jsxs)(d.xu,{display:"flex",justifyContent:"between",marginStart:-1,marginEnd:-1,children:[(0,c.jsx)(m.Z,{id:"delete-pin-button",children:(0,c.jsx)(d.zx,{fullWidth:!0,text:a.bt("Delete", "Delete", "EditPinModal.EditPinFooter.Delete", undefined, true),onClick:i,disabled:s})}),t&&(0,c.jsx)(d.xu,{display:"flex",marginStart:2,marginTop:2,justifyContent:"center",children:(0,c.jsx)(z.Z,{errorMessage:e||a.bt("Sorry, an error occurred whilst editing your Pin.", "Sorry! There was an error editing your Pin.", "EditPinModal.EditPinFooter.ErrorMessageToast", undefined, true),htmlFor:"pin-edit-generic-error"})}),(0,c.jsxs)(d.xu,{display:"flex",justifyContent:"between",marginStart:-2,marginEnd:-2,children:[(0,c.jsx)(d.xu,{paddingX:2,children:(0,c.jsx)(d.zx,{fullWidth:!0,text:a.bt("Cancel", "Cancel", "EditPinModal.EditPinFooter.Cancel", undefined, true),onClick:n})}),(0,c.jsx)(d.xu,{paddingX:2,"data-test-id":"edit-pin-save",children:(0,c.jsx)(d.zx,{fullWidth:!0,text:a.bt("Save", "Save", "EditPinModal.EditPinFooter.Save", undefined, true),color:"red",onClick:l,disabled:o})})]})]})}function F({pinNoteText:e,isCollaborative:t,onPinNoteChange:i}){const n=(0,r.ZP)();return(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(d.iz,{}),(0,c.jsxs)(d.xu,{mdDisplay:"flex",justifyContent:"between",paddingX:4,paddingY:3,children:[(0,c.jsx)(d.xu,{column:12,mdColumn:3,paddingY:2,children:(0,c.jsx)(d.__,{htmlFor:"PinNoteField",children:(0,c.jsx)(d.xv,{size:"200",children:t?n.bt("Note to group", "Note to group", "editPinModal.editPinNote.groupTitle", undefined, true):n.bt("Note to self", "Note to self", "editPinModal.editPinNote.title", undefined, true)})})}),(0,c.jsx)(d.xu,{column:12,mdColumn:8,paddingY:2,"data-test-id":"note-to-self-input",children:(0,c.jsx)(d.Kx,{errorMessage:e.length>=500?n.bt("Character limit reached", "Character limit reached", "editPinModal.editPinNote.warningText", undefined, true):void 0,id:"PinNoteField",onChange:i,placeholder:n.bt("Add a private note to remember your ideas about this Pin", "Add a private note to remember your ideas about this Pin", "editPinModal.editPinNote.placeholderText", undefined, true),value:e})})]})]})}var Z=i(241563);function U({board:e,canEdit:t,currentSection:i,onSectionChange:s,onSectionCreate:n,sectionId:o,sectionName:l}){const a=(0,r.ZP)(),h=null!=e&&e.id?Z.Z:Z.x;return"quick_creates"===(null==e?void 0:e.layout)?null:(0,c.jsxs)(d.xu,{mdDisplay:"flex",justifyContent:"between",paddingX:4,paddingY:3,children:[(0,c.jsx)(d.xu,{column:12,mdColumn:3,paddingY:3,children:(0,c.jsx)(d.__,{htmlFor:"SectionPicker",children:(0,c.jsx)(d.xv,{size:"200",children:a.bt("Section", "Section", "label for editing a Pin's board section", undefined, true)})})}),t&&e?(0,c.jsx)(d.xu,{column:12,mdColumn:8,children:(0,c.jsx)(h,{board:e,onSectionChange:s,selectedSectionId:o,selectedSectionName:l,onSectionCreate:n})}):(0,c.jsx)(d.xu,{column:12,mdColumn:8,paddingY:2,children:(0,c.jsx)(d.xv,{size:"200",weight:"bold",children:i&&!(e||{}).is_collaborative?i.title:a.bt("No section", "No section", "default dropdown option for selecting a board section on pin edit", undefined, true)})})]})}function N({canEdit:e,onTitleChange:t,title:i,errorMessage:n}){const o=(0,r.ZP)();return(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(d.iz,{}),(0,c.jsxs)(d.xu,{mdDisplay:"flex",justifyContent:"between",paddingX:4,paddingY:3,children:[(0,c.jsx)(d.xu,{column:12,mdColumn:3,paddingY:2,children:(0,c.jsx)(d.__,{htmlFor:"TitleField",children:(0,c.jsx)(d.xv,{size:"200",children:o.bt("Title", "Title", "Label for editing title of pin", undefined, true)})})}),(0,c.jsx)(d.xu,{column:12,mdColumn:8,children:e?(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(d.xu,{"data-test-id":"pin-title-input",children:(0,c.jsx)(d.nv,{hasError:(n||"").length>0,id:"TitleField",onChange:t,size:"lg",value:i})}),!!n&&(0,c.jsx)(d.xu,{children:(0,c.jsx)(z.Z,{errorMessage:n,htmlFor:"pin-edit-title"})})]}):(0,c.jsx)(d.xu,{column:12,mdColumn:8,paddingY:2,children:(0,c.jsx)(d.xv,{size:"200",weight:"bold",children:i})})})]})]})}function O({onChangeWebsite:e,link:t,errorMessage:i}){const n=(0,r.ZP)();return(0,c.jsxs)(s.Fragment,{children:[(0,c.jsx)(d.iz,{}),(0,c.jsxs)(d.xu,{mdDisplay:"flex",justifyContent:"between",paddingX:4,paddingY:3,children:[(0,c.jsx)(d.xu,{column:12,mdColumn:3,paddingY:2,children:(0,c.jsx)(d.__,{htmlFor:"WebsiteField",children:(0,c.jsx)(d.xv,{size:"200",children:n.bt("Website", "Website", " - ", undefined, true)})})}),(0,c.jsxs)(d.xu,{column:12,mdColumn:8,children:[(0,c.jsx)(d.xu,{children:(0,c.jsx)(d.nv,{hasError:(i||"").length>0,id:"WebsiteField",onChange:e,size:"lg",value:t})}),!!i&&(0,c.jsx)(d.xu,{children:(0,c.jsx)(z.Z,{errorMessage:i,htmlFor:"pin-edit-website"})})]})]})]})}var Q,H=i(947599),Y=i(167912);const V=void 0!==Q?Q:Q=i(337148);function X({onShoppingRecChange:e,shoppingRecDisabled:t,storyPinData:i}){var n,o;const l=(0,r.ZP)(),a=(0,Y.useLazyLoadQuery)(V,{});if(!a)return null;const{has_product_pins:h}=i||{},u=null===(n=a.v3GetCurrentUserHandlerQuery)||void 0===n||null===(o=n.data)||void 0===o?void 0:o.ipStelaRecDisabled;return(0,c.jsx)(s.Fragment,{children:(0,c.jsxs)(d.xu,{mdDisplay:"flex",justifyContent:"between",paddingX:4,children:[(0,c.jsx)(d.xu,{column:12,mdColumn:3,paddingY:2,children:(0,c.jsx)(d.xv,{size:"200",children:l.bt("Shopping recommendations", "Shopping recommendations", "Heading for shopping recommendations permissions", undefined, true)})}),(0,c.jsx)(d.xu,{column:12,mdColumn:8,children:(0,c.jsxs)(d.xu,{paddingY:1,display:"flex",alignItems:"start",children:[(0,c.jsx)(d.rs,{onChange:e,id:"PhotoSwitch",switched:!t,disabled:u||h}),(0,c.jsx)(d.xu,{paddingX:2,children:(0,c.jsx)(d.__,{htmlFor:"stelaSwitch",children:(0,c.jsxs)(d.kC,{alignItems:"stretch",justifyContent:"start",direction:"column",children:[(0,c.jsx)(d.xv,{size:"200",color:u?"subtle":"default",children:l.bt("Show similar products ", "Show similar products ", "Label to toggle similar products on ideal pin", undefined, true)}),u?(0,c.jsxs)(d.xv,{color:"subtle",size:"200",children:[l.bt("You’ve disabled shopping recommendations for your profile ", "You’ve disabled shopping recommendations for your profile ", "Text indicating shopping recommendations are currently disabled", undefined, true),(0,c.jsx)(d.xv,{inline:!0,size:"200",weight:"bold",color:"subtle",children:(0,c.jsx)(d.rU,{display:"inlineBlock",href:"https://www.pinterest.com/settings/permissions",target:"blank",rel:"nofollow",underline:"hover",children:l.bt("Edit profile settings", "Edit profile settings", "Link to the settings page to enable shopping recommendations on idea pins", undefined, true)})})]}):(0,c.jsxs)(d.xu,{display:"flex",direction:"column",marginTop:1,children:[(0,c.jsx)(d.xu,{marginBottom:1,children:(0,c.jsx)(d.xv,{size:"200",children:l.bt("People can shop for products similar to those shown in this Idea Pin using visual search", "People can shop products similar to what’s shown in this Idea Pin using visual search", "Text indicating shopping recommendations are currently enabled", undefined, true)})}),(0,c.jsx)(d.xv,{size:"200",children:l.bt("Shopping recommendations are not available for Idea ads and Idea Pins with product tags or a paid partnership label", "Shopping recommendations aren’t available for Idea ads and Idea Pins with product tags or paid partnership label", "Explanation about how stela on idea pins with tagged products arent available", undefined, true)})]})]})})})]})})]})})}function W({shoppingRecDisabled:e,onShoppingRecChange:t,isNoTitle:i}){const n=(0,r.ZP)();return(0,c.jsxs)(s.Fragment,{children:[!i&&(0,c.jsx)(d.iz,{}),(0,c.jsxs)(d.xu,{mdDisplay:"flex",justifyContent:"between",paddingX:4,paddingY:i?0:3,children:[!i&&(0,c.jsx)(d.xu,{column:12,mdColumn:3,paddingY:2,children:(0,c.jsx)(d.xv,{size:"200",children:n.bt("Recommendations", "Recommendations", "EditPinModal.recommendations", undefined, true)})}),(0,c.jsx)(d.xu,{column:12,mdColumn:8,children:(0,c.jsxs)(d.xu,{paddingY:1,display:"flex",alignItems:"center",children:[(0,c.jsx)(d.rs,{onChange:t,id:"ShoppingRecSwitch",switched:!e}),(0,c.jsx)(d.xu,{paddingX:2,children:(0,c.jsx)(d.__,{htmlFor:"ShoppingRecSwitch",children:(0,c.jsx)(d.xv,{size:"200",children:n.bt("Show shopping recommendations", "Show shopping recommendations", "EditPinModal.recommendations.showShoppingRecommendations.label", undefined, true)})})})]})})]})]})}var K=i(717615),q=i(916062),G=i(784590),J=i(19121),$=i(422946),ee=i(956800),te=i(482567),ie=i(90326),se=i(825067),ne=i(6637),oe=i(827896),le=i(254176),ae=i(947729),re=i(231947),de=i(780280),ce=i(14890),he=i(678638),ue=i(414327),pe=i(134906),_e=i(563339),ge=i(276775);function xe(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function me(e){return Boolean(e&&e.trim().length)}function be(e,t){const i=me(e),s=me(t);return(i||s)&&e!==t}class ve extends s.Component{constructor(...e){var t,i,s,n,o,l,r,d,c,h,p,g,x,m,b,v,f,C,P;super(...e),xe(this,"state",{altText:(null===(t=this.props.pinResource.data)||void 0===t?void 0:t.alt_text)||"",board:(null===(i=this.props.pinResource.data)||void 0===i?void 0:i.board)||null,commentsDisabled:(null===(s=this.props.pinResource.data)||void 0===s?void 0:s.comments_disabled)||(null===(n=this.props.pinResource.data)||void 0===n?void 0:n.did_it_disabled)||!1,description:(null===(o=this.props.pinResource.data)||void 0===o||null===(l=o.description)||void 0===l?void 0:l.trim())||"",apiErrorMessage:null,link:(null===(r=this.props.pinResource.data)||void 0===r?void 0:r.link)||"",pinNoteText:(null===(d=this.props.pinResource.data)||void 0===d||null===(c=d.pin_note)||void 0===c?void 0:c.text)||"",sectionId:(null===(h=this.props.pinResource.data)||void 0===h||null===(p=h.section)||void 0===p?void 0:p.id)||null,sectionName:(null===(g=this.props.pinResource.data)||void 0===g||null===(x=g.section)||void 0===x?void 0:x.title)||null,showDeleteConfirmation:!1,carousel_data:(null===(m=this.props.pinResource.data)||void 0===m?void 0:m.carousel_data)||null,title:(null===(b=this.props.pinResource.data)||void 0===b?void 0:b.title)||"",isLoadingPin:!Boolean(this.props.pinResource.isLoaded),isProcessing:!1,currentIndex:void 0!==this.props.carouselSlotCurrentIndex?this.props.carouselSlotCurrentIndex:(null===(v=this.props.pinResource.data)||void 0===v||null===(f=v.carousel_data)||void 0===f?void 0:f.index)||0,shoppingRecDisabled:null===(C=this.props.pinResource.data)||void 0===C?void 0:C.shopping_rec_disabled,shouldApplyTextToAll:!1,shouldDisableSave:!1,shouldShowCarouselSliders:!1,shouldShowValidationTitleError:!1,shouldShowValidationDescriptionError:!1,shouldShowValidationLinkFormatError:!1,shouldShowGenericUpdateError:!1,shouldShowValidationUserMentionTagsError:!1,userMentionTags:(null===(P=this.props.pinResource.data)||void 0===P?void 0:P.user_mention_tags)||[]}),xe(this,"onClickDeleteButton",(()=>this.setState({showDeleteConfirmation:!0}))),xe(this,"onHideConfirmation",(()=>this.setState({showDeleteConfirmation:!1}))),xe(this,"updateCarouselSlotIndex",(()=>{const{carouselSlotCurrentIndex:e}=this.props;this.setState({currentIndex:void 0!==e?e:this.props.pinResource.data&&this.props.pinResource.data.carousel_data&&this.props.pinResource.data.carousel_data.index||0})})),xe(this,"handleBoardChange",(e=>{const{board:{id:t}}=this.state;e.id!==t&&this.setState({board:e,sectionId:null,sectionName:null})})),xe(this,"createBoard",(e=>{const{createBoard:t,viewer:i,orbacActingAs:s}=this.props,{board:n}=this.state,o=(0,re.lJ)(i,s);!n.id&&n.name&&e&&t(n.name,e,o).then((e=>{if(this._isMounted){const{sectionId:t,sectionName:i}=this.state;!t&&i?(this.setState({board:e}),this.createSection()):(this.handleBoardChange(e),this.handleSave())}}))})),xe(this,"handleBoardCreateClick",(e=>{if(!e)return;const t={name:e,privacy:u.Z.BoardPrivacy.PUBLIC,access:"write"};this.setState({board:t,sectionId:null,sectionName:null})})),xe(this,"createSection",(()=>{const{board:e,sectionName:t}=this.state,{viewer:i,orbacActingAs:s}=this.props,n=(0,re.lJ)(i,s);if(!t)return;if(!e.id)return void this.createBoard();const o={boardId:e.id,name:t},{createSection:l}=this.props;l(o,n).then((e=>{this._isMounted&&(this.setState({sectionId:e&&e.id||null,sectionName:e&&e.title||null}),this.handleSave())})).catch((()=>{this.setState({shouldShowGenericUpdateError:!0,apiErrorMessage:null})}))})),xe(this,"handleSectionCreateClick",(e=>{if(0===e.length)return;const{board:t}=this.state;t&&this.setState({sectionId:null,sectionName:e})})),xe(this,"handleSectionChange",(e=>this.setState({sectionId:e&&e.id||null,sectionName:e&&e.title||null,shouldShowGenericUpdateError:!1}))),xe(this,"handleDeletePin",(()=>{const{advertiser_id:e,changeBoardPinCount:t,changeUserPinCount:i,dispatch:s,getClientTrackingParams:n,onDelete:o,onHide:l,orbacActingAs:a,pinId:r,pinResource:{data:d},removeBoardlessPin:c,viewer:h}=this.props,u=(0,re.lJ)(h,a),p={...e?{advertiser_id:e}:{},...u?{orbac_subject_id:u}:Object.freeze({}),id:r,client_tracking_params:n(r)};return ne.Z.create("PinResource",p).callDelete().then((()=>{if(this._isMounted){if(!d)return;const{board:{id:e}={},pinner:{id:n}={},section:a}=d,c=null==a?void 0:a.id;t({boardId:e,sectionId:c,increment:-1}),i({userId:n,increment:-1}),s((0,le.xQ)(e)),s((0,ee.EX)({feedId:c||e,feedType:c?$.DV.BOARD_SECTION_PINS:$.DV.BOARDFEED,itemIds:[r],itemType:"pin"})),s((0,ee.EX)({feedId:n,feedType:$.DV.STORY_PINS_FEED,itemIds:[r],itemType:"pin"})),s((0,ee.EX)({feedId:n,feedType:$.DV.PROFILE_PINS_FEED,itemIds:[r],itemType:"pin"})),c&&s((0,he.CE)(c)),l(),o&&o()}h.id&&c(h.id,r)}))})),xe(this,"sanitizeCarouselData",(e=>{let{carousel_data:t}=this.state;if(e&&(t=e),t){const{carousel_slots:e}=t;if(e){const t={carousel_slots:[]};return e.forEach((e=>{const i={description:e.details||"",title:e.title||"",link:e.link||""};t.carousel_slots.push(i)})),t}}return null})),xe(this,"triggerBoardAndSectionCreate",(e=>()=>{const{board:t,sectionId:i,sectionName:s}=this.state;t&&!t.id&&t.name?this.createBoard(e):!i&&s?this.createSection():this.handleSave()})),xe(this,"logPinEditEvent",((e,t,i,s,n)=>{const o={},{pinId:l,view:a,viewParameter:r}=this.props,{userMentionTags:d}=this.state;if(o.objectId=l,o.num_user_mention_tags=d.length,e&&(o.board_was_modified=!0),!e&&t&&(o.board_section_was_modified=!0),i){const{description:e}=this.state,{description:t}=n;o.original_pin_description=t,o.edited_pin_description=e}if(s){const{carousel_data:e}=this.state,{carousel_data:t}=n;o.original_carousel_data=JSON.stringify(this.sanitizeCarouselData(t)),o.edited_carousel_data=JSON.stringify(this.sanitizeCarouselData(e))}this.props.logContextEvent({event_type:2,component:208,view_type:a,view_parameter:r,aux_data:{...o}})})),xe(this,"handleSave",(()=>{this.setState({apiErrorMessage:null,isProcessing:!0});const{advertiser_id:e,completeResourceFetch:t,invalidatePinResource:i,orbacActingAs:s,pinId:n,pinResource:{data:o},onHide:l,removeBoardlessPin:a,updatePinNote:r,viewer:d}=this.props;if(!o)return;const{alt_text:c,board:h,comments_disabled:u,did_it_disabled:p,title:g,description:x,link:m,pin_note:b,section:v,carousel_data:f,shopping_rec_disabled:C}=o,P=null==b?void 0:b.text,{carousel_data:y,shouldShowValidationLinkFormatError:j}=this.state;let S;if(y){const e=this.sanitizeCarouselData();e&&(S=JSON.stringify(e))}const{altText:w,board:A,commentsDisabled:z,currentIndex:I,title:E,description:D,pinNoteText:k,sectionId:T,shoppingRecDisabled:M,carousel_data:R,userMentionTags:B}=this.state,L=A||h,F=j?m:this.state.link,Z=(0,re.lJ)(d,s),U={alt_text:w,board_id:null==L?void 0:L.id,board_section_id:T,carousel_data_json:S,description:D,disable_comments:z,disable_did_it:z,id:n,link:F,shopping_rec_disabled:M,title:E,user_mention_tags:JSON.stringify(B),...e?{advertiser_id:e}:{},...Z?{orbac_subject_id:Z}:Object.freeze({})},N=v&&v.id||null,O=null==L?void 0:L.id,Q=null==h?void 0:h.id,H=be(c,w),Y=Q!==O,V=(Boolean(N)||Boolean(T))&&N!==T,X=be(g,E),W=be(x,D),K=be(m,F),q=Boolean(R)&&Boolean(f)&&!_()(R,f),G=u!==z||p!==z,J=be(P,k);H||Y||V||X||W||J||K||q||G||C!==M?(J&&r(n,P,k,Z),ne.Z.create("PinResource",U).callUpdate().then((e=>{if(this._isMounted){var s;const{changeBoardPinCount:c,onSubmit:h,pinId:u,pinMoved:p}=this.props;var n,r;if((Y||V)&&O&&Q)p({selectedPinIds:[u],source:{boardId:Q,sectionId:N},target:{boardId:O,sectionId:T}}),c({boardId:O,sectionId:T||void 0,increment:1}),c({boardId:Q,sectionId:N||void 0,increment:-1}),d.id&&"quick_saves"===(null===(n=o.board)||void 0===n?void 0:n.layout)&&a(d.id,u);if(h&&O&&null!=L&&L.url)h({boardId:O,title:null!==(r=L.name)&&void 0!==r?r:"",sectionId:T,url:L.url});l(),i(u,Z),null!==(s=e.resource_response)&&void 0!==s&&s.data.carousel_data&&(e.resource_response.data.carousel_data.index=I),t(e,Z),this.logPinEditEvent(Y,V,W,q,o)}})).catch((()=>{const{shouldShowValidationTitleError:e,shouldShowValidationDescriptionError:t,shouldShowValidationLinkFormatError:i}=this.state;this.setState({isProcessing:!1,shouldShowGenericUpdateError:!e&&!t&&!i})}))):(l(),i(n,Z)),this.setState({isProcessing:!1})})),xe(this,"handleTextChanges",((e,t)=>{const{carousel_data:i}=this.state;if(!i)return;const s=a()(i),{carousel_slots:n=[]}=s,{currentIndex:o,shouldApplyTextToAll:l,description:r,link:d,title:c}=this.state,h=this.valueIsValidForType(e,t);switch(l?n.forEach((i=>i[t]=e)):n[o]&&(n[o][t]=e),t){case"details":const t=0===o?e:r;this.setState({description:t,carousel_data:s||null,shouldShowValidationDescriptionError:!h,shouldShowGenericUpdateError:!1});break;case"link":const i=0===o?e:d;this.setState({link:i,carousel_data:s||null,shouldShowValidationLinkFormatError:!h,shouldShowGenericUpdateError:!1});break;case"title":const n=0===o?e:c;this.setState({title:n,carousel_data:s||null,shouldShowValidationTitleError:!h,shouldShowGenericUpdateError:!1})}})),xe(this,"handleDescriptionChange",(({value:e,userMentionTags:t})=>{const i=this.valueIsValidForType(e,"description"),s=t.length<=5;t.length<this.state.userMentionTags.length&&this.props.logContextEvent({event_type:8906,element:116,aux_data:{tag_type:1}}),this.setState({description:e,userMentionTags:t,shouldShowValidationDescriptionError:!i,shouldShowValidationUserMentionTagsError:!s,shouldShowGenericUpdateError:!1})})),xe(this,"handleCarouselDetailsChange",(({value:e})=>{this.handleTextChanges(e,"details")})),xe(this,"handleTitleChange",(({value:e})=>{const t=this.valueIsValidForType(e,"title");this.setState({title:e,shouldShowValidationTitleError:!t,shouldShowGenericUpdateError:!1})})),xe(this,"handleCarouselTitleChange",(({value:e})=>{this.handleTextChanges(e,"title")})),xe(this,"handleAltTextChange",(({value:e})=>{this.setState({altText:e})})),xe(this,"valueIsValidForType",((e,t)=>{switch(t){case"details":case"description":return e.length<=500;case"link":return e.length>=0&&0===(0,pe.FU)([(0,pe.Jx)({message:this.props.i18n.bt("Not a valid URL.", "Not a valid url.", "Validation error for an improperly formated url", undefined, true)})],e).length;case"title":return e.length<=100;default:return!0}})),xe(this,"handleWebsiteChange",(({value:e})=>{const t=this.valueIsValidForType(e,"link");this.setState({link:e,shouldDisableSave:!t,shouldShowValidationLinkFormatError:!t,shouldShowGenericUpdateError:!1})})),xe(this,"handleCarouselWebsiteChange",(({value:e})=>{this.handleTextChanges(e,"link")})),xe(this,"handleCommentChange",(e=>this.setState({commentsDisabled:!e.value}))),xe(this,"handleShoppingRecChange",(e=>{this.setState({shoppingRecDisabled:!e.value})})),xe(this,"handleShouldApplyToAll",(e=>{if(e){const{currentIndex:t=0,carousel_data:i}=this.state;if(!i)return;const s=a()(i),{carousel_slots:n=[]}=s,{details:o,link:l,title:r}=n[t];n.forEach((e=>{e.details=o,e.title=r,e.link=l})),this.setState({carousel_data:s,shouldApplyTextToAll:e})}else this.setState({shouldApplyTextToAll:e})})),xe(this,"handleCarouselSlider",(e=>{const{carousel_data:t}=this.state,i=t&&t.carousel_slots&&t.carousel_slots.length||1;e>=0&&e<i&&this.setState({currentIndex:e})})),xe(this,"handleMouseEnter",(()=>{this.setState({shouldShowCarouselSliders:!0})})),xe(this,"handleMouseLeave",(()=>{this.setState({shouldShowCarouselSliders:!1})}))}componentDidMount(){this._isMounted=!0,this.updateCarouselSlotIndex()}componentDidUpdate(e){const{pinResource:{data:t,isLoaded:i},carouselSlotCurrentIndex:s}=this.props;var n;t&&i!==e.pinResource.isLoaded&&this.setState({altText:t.alt_text,board:t.board,commentsDisabled:t.comments_disabled||t.did_it_disabled,description:t.description&&t.description.trim(),isLoadingPin:!1,link:t.link,pinNoteText:(null===(n=t.pin_note)||void 0===n?void 0:n.text)||"",sectionId:(t.section||{}).id,sectionName:(t.section||{}).title,title:t.title,carousel_data:t.carousel_data,currentIndex:void 0!==s?s:t.carousel_data&&t.carousel_data.index||0,shouldApplyTextToAll:!1,userMentionTags:t.user_mention_tags||[],shoppingRecDisabled:t.shopping_rec_disabled})}componentWillUnmount(){this._isMounted=!1}getCurrentUserId(e){return e.isAuth?e.id:""}render(){var e,t,i;const{disableDelete:s,onHide:n,orbacActingAs:l,pinResource:a,pinId:r,viewer:u}=this.props,{altText:p,apiErrorMessage:_,board:x,commentsDisabled:m,description:b,link:v,pinNoteText:f,sectionId:C,sectionName:j,showDeleteConfirmation:S,title:A,isLoadingPin:z,isProcessing:I,carousel_data:E,shouldApplyTextToAll:D,currentIndex:T,shoppingRecDisabled:M,shouldDisableSave:R,shouldShowCarouselSliders:Z,shouldShowValidationTitleError:Q,shouldShowValidationDescriptionError:Y,shouldShowValidationLinkFormatError:V,shouldShowGenericUpdateError:K,shouldShowValidationUserMentionTagsError:q,userMentionTags:G}=this.state,J=a.data||{},$=!!(J&&J.story_pin_data_id&&J.story_pin_data),ee=(null===(e=J.native_creator)||void 0===e?void 0:e.id)===this.getCurrentUserId(u);if(S)return(0,c.jsx)(P,{onDeletePin:this.handleDeletePin,onDismiss:this.onHideConfirmation,showStoryPinCreatorDeleteMessage:$&&ee});const te=!!(E&&E.carousel_slots&&E.carousel_slots.length>1),ie=E&&E.carousel_slots&&E.carousel_slots.length>0&&E.carousel_slots[T]||{},{details:se="",link:ne="",title:oe=""}=ie,le=J&&(J.access||[]).includes("write")||this.props.canEdit||!!x&&(0,o.Z)({action:4,board:x,viewer:u})||!!x&&(0,re.KY)(u,x,l),de=e=>{const t=(0,re.lJ)(e,l),i=t||this.getCurrentUserId(e),s=this.props.canEdit&&this.props.advertiserOwnerUserId?this.props.advertiserOwnerUserId:i;return le&&!J.is_repin&&!$&&(te||!E)&&(J.native_creator&&J.native_creator.id===s||te&&J.pinner&&J.pinner.id===s||J.link_domain&&J.link_domain.official_user&&J.link_domain.official_user.id===s||!!J.domain&&J.pinner&&J.pinner.id===s&&J.pinner.domain_url&&J.pinner.domain_url.includes(J.domain))},ce=J&&J.images&&J.images["474x"]||{},he=$&&!!J.story_pin_data&&ee,ue=de(u)?(0,c.jsx)(N,{canEdit:le,onTitleChange:te?this.handleCarouselTitleChange:this.handleTitleChange,title:te&&oe?oe:A,errorMessage:Q?(0,ae.Y8)(te,this.props.i18n):""}):null,pe=(le||u.isAuth&&(J.pinner||{}).id===u.id)&&de(u)?(0,c.jsx)(k,{canAddUserMentionTags:!te,canEdit:le,description:(te?se:b)||"",errorMessage:(()=>Y?(0,ae.MM)(te,this.props.i18n):q?(0,ae.bl)(te,this.props.i18n):"")(),initialMentions:G,label:this.props.i18n.bt("Description", "Description", "Label for editing description", undefined, true),placeholder:this.props.i18n.bt("Tell us about this Pin...", "Tell us about this Pin...", "Placeholder for editing description", undefined, true),onDescriptionChange:te?this.handleCarouselDetailsChange:this.handleDescriptionChange}):null,_e=(0,c.jsx)(F,{isCollaborative:!(null==x||!x.is_collaborative),onPinNoteChange:({value:e})=>{this.setState({pinNoteText:e})},pinNoteText:f}),ge=(e=>de(e)&&!(J.aggregated_pin_data&&J.aggregated_pin_data.is_shop_the_look))(u)?(0,c.jsx)(O,{link:te&&ne?ne:v,onChangeWebsite:te?this.handleCarouselWebsiteChange:this.handleWebsiteChange,errorMessage:V?(0,ae.qj)(te,this.props.i18n):""}):null,xe=te?(0,c.jsxs)(d.xu,{display:"flex",justifyContent:"end",paddingX:4,paddingY:3,alignItems:"end",children:[(0,c.jsx)(d.xu,{paddingY:2,children:(0,c.jsx)(d.__,{htmlFor:"applyTextToAll",children:(0,c.jsx)(d.xv,{children:this.props.i18n.bt("Apply text to all", "Apply text to all", "Apply title, description, link to all cards", undefined, true)})})}),(0,c.jsx)(d.xu,{paddingX:2,paddingY:2,children:(0,c.jsx)(d.rs,{onChange:e=>this.handleShouldApplyToAll(e.value),id:"applyTextToAll",switched:D})})]}):null,me=de(u)?(0,c.jsx)(y,{canEdit:le,onAltTextChange:this.handleAltTextChange,altText:p}):null,be=J.can_delete_did_it_and_comments?(0,c.jsx)(h,{commentsDisabled:m,onCommentChange:this.handleCommentChange}):null,ve=!u.isAuth||(null===(t=J.pinner)||void 0===t?void 0:t.id)!==u.id||J.is_repin||J.story_pin_data||u.shopping_rec_disabled?null:(0,c.jsx)(W,{shoppingRecDisabled:M,onShoppingRecChange:this.handleShoppingRecChange}),fe=!!(0,re.lJ)(u,l),Ce=!!u.has_quicksave_board&&!!u.boardCount&&u.boardCount<2&&!fe&&!this.props.advertiserOwnerUserId,Pe="quick_creates"===(null===(i=J.board)||void 0===i?void 0:i.layout),ye=(0,re.Ms)(u,l);return(0,c.jsx)(g.ZP,{heading:this.props.i18n.bt("Edit this Pin", "Edit this Pin", "EditPinModal.ModalHeading.EditThisPin", undefined, true),accessibilityModalLabel:this.props.i18n.bt("Edit your previously saved Pin", "Edit your previously saved pin", "EditPinModal.ModalHeading.AccessibleLabel", undefined, true),size:Ce?"sm":"lg",onDismiss:n,footer:(0,c.jsx)(L,{apiErrorMessage:_,shouldShowGenericUpdateError:K,onClickDeleteButton:this.onClickDeleteButton,disableDelete:!le||s,onHide:n,shouldDisableSave:R,triggerBoardAndSectionCreate:this.triggerBoardAndSectionCreate(ye)}),children:z||!a.isLoaded||I?(0,c.jsx)(d.kC,{alignItems:"center",justifyContent:"center",children:(0,c.jsx)(d.$j,{accessibilityLabel:this.props.i18n.bt("Loading", "loading", "EditPinModal.LoadingPin.Spinner", undefined, true),show:!0})}):(0,c.jsxs)(d.xu,{display:"flex",justifyContent:Ce?"center":"between",minHeight:350,paddingX:4,children:[Ce?null:(0,c.jsxs)(d.xu,{column:12,mdColumn:9,children:[(0,c.jsx)(w,{board:x||J.board,canEdit:le,isOriginallyQuickCreatesBoard:Pe,onBoardChange:this.handleBoardChange,onBoardCreate:this.handleBoardCreateClick,viewerId:u.id||""}),(0,c.jsx)(U,{board:x||J.board,canEdit:le,onSectionCreate:this.handleSectionCreateClick,onSectionChange:this.handleSectionChange,sectionId:C,sectionName:j,currentSection:J.section}),ue,pe,ge,xe,me,_e,be,ve,he&&(0,c.jsx)(H.Z,{children:(0,c.jsx)(X,{onShoppingRecChange:this.handleShoppingRecChange,shoppingRecDisabled:M,storyPinData:J.story_pin_data})})]}),(0,c.jsx)(B,{isCarousel:te,shouldShowCarouselSliders:Z,onCarouselSlide:this.handleCarouselSlider,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,currentIndex:this.state.currentIndex,carouselData:this.state.carousel_data,pinId:r,description:b,image:ce})]})})}}const fe=(e,t,i)=>({field_set_key:"detailed",id:e,preserve_component_state:t,...i?{orbac_subject_id:i}:Object.freeze({})}),Ce=(0,n.connect)(null,((e,t)=>({changeBoardPinCount:t=>e((0,le.Br)(t)),changeUserPinCount:t=>e((0,ie.JS)(t)),completeResourceFetch:(t,i)=>e((0,ue.Sr)("PinResource",fe(t.resource_response.data.id,!1,i),t)),createBoard:(t,i,s)=>e((0,le.aX)(t,i,s)),createSection:(i,s)=>e((0,he.vB)(i,t.i18n,s)),invalidatePinResource:(t,i)=>e((0,ue.jB)("PinResource",fe(t,!0,i))),removeBoardlessPin:(t,i)=>e((0,ee.EX)({feedId:t,feedType:$.DV.BOARDLESS_PINS,itemIds:[i],itemType:"pin"})),pinMoved:(0,ce.bindActionCreators)(_e.S,e),updatePinNote:(t,i,s,n)=>e((0,te._)(t,i,s,n))})))(ve);function Pe(e){var t;const i=(0,r.ZP)(),{logContextEvent:s}=(0,I.v)(),o=(0,n.useSelector)((({advertiser:e})=>e)),l=null===(t=(0,se.W)())||void 0===t?void 0:t.onPinDelete,a=(0,K.Z)(),d=(0,J.Z)(),h=(0,re.lJ)(d,a),u=(0,G.Z)({name:"PinResource",options:fe(e.pinId,!0,h)}),p=(0,oe.Z)(),_=d.isAuth&&Boolean(o)?o.id:void 0,g=d.isAuth&&Boolean(o)&&o.owner_user_id!==d.id?o.owner_user_id:void 0,x=(0,q.Z)(u.data);return(0,c.jsx)(Ce,{...e,advertiser_id:_,advertiserOwnerUserId:g,getClientTrackingParams:p,dispatch:(0,n.useDispatch)(),history:(0,ge.useHistory)(),i18n:i,logContextEvent:s,onDelete:()=>{var t;x(),null===(t=e.onDelete)||void 0===t||t.call(e),l&&l({pinId:e.pinId})},orbacActingAs:a,pinResource:u,requestContext:(0,de.B)(),viewer:d})}},947729:(e,t,i)=>{function s(e,t){return e?t.bt("Title too long. Make sure all card titles have fewer than 100 characters", "Title too long. Make sure all cards' titles have less than 100 characters", "Title entered is too long while editing a carousel pin and/or one of its pins", undefined, true):t.bt("Title too long. Make sure title has fewer than 100 characters", "Title too long. Make sure title has less than 100 characters", "Title entered is too long while editing a pin", undefined, true)}function n(e,t){return e?t.bt("Description too long. Make sure all card descriptions have fewer than 500 characters", "Description too long. Make sure all cards' descriptions have less than 500 characters", "Description entered is too long while editing a carousel pin and/or one of its pins", undefined, true):t.bt("Description too long. Make sure description has fewer than 500 characters", "Description too long. Make sure description has less than 500 characters", "Description entered is too long while editing a pin", undefined, true)}function o(e,t){return t.bt("Too many mentions. Make sure you have no more than 5.", "Too many mentions. Make sure you have at most 5.", "editPinModal.errorMessages.userMentionOverLimit", undefined, true)}function l(e,t){return e?t.bt("Need to provide a valid URL. Make sure all card links are valid", "Need to provide a valid URL. Make sure all cards' links are valid", "Invalid URL/link provided while editing a carousel pin and/or one of its pins", undefined, true):t.bt("Need to provide a valid URL. Make sure the link is valid", "Need to provide a valid URL. Make sure the link is valid", "Invalid URL/link provided while editing a pin", undefined, true)}i.d(t,{MM:()=>n,Y8:()=>s,bl:()=>o,qj:()=>l})},507016:(e,t,i)=>{i.d(t,{W:()=>c,Z:()=>h});var s=i(488769),n=i(486746),o=i(27255),l=i(24886),a=i(898781),r=i(883119),d=i(785893);function c(e,t=""){const i=e&&e.length>1?new RegExp(e,"i"):"";return e&&e.length>1?t.split(i).reduce(((i,s,n)=>{if(i.length>0&&e&&e.length){const o=t.toLowerCase().indexOf(e.toLowerCase());return i.concat((0,d.jsx)("em",{style:{borderBottom:"1px solid #333",fontStyle:"normal",paddingBottom:"1px"},children:t.substring(o,o+e.length)},n),s)}return[s]}),[]):t}const h=function(e){var t,i,h,u,p,_;const g=(0,a.ZP)(),{disabled:x,item:m,isSection:b,isSelectMode:v,isWithinSectionPicker:f,saveState:C,searchQuery:P,selected:y}=e,j=b?null:m,S=b?m:null,w=S&&S.title||j&&j.name||"";let A="",z=!1,I="",E=0;j&&({image_cover_url:A,is_collaborative:z,privacy:I,section_count:E=0}=j);const D=c(P,w),k=I===o.Z.BoardPrivacy.SECRET,T=!x&&(y||!!C),M=!f&&"number"==typeof E&&E>0,R="number"==typeof E&&E>0?"boardWithSection":"boardWithoutSection",B=v?g.bt("Select", "Select", "Board select button label", undefined, true):g.bt("Save", "Save", "Pin save button label", undefined, true);return(0,d.jsxs)(r.xu,{alignItems:"center",color:T?"secondary":"default",display:"flex",height:64,marginStart:2,marginEnd:2,marginTop:1,padding:2,rounding:3,"data-test-id":R,children:[j&&(0,d.jsx)(r.xu,{height:48,width:48,color:"secondary",overflow:"hidden",rounding:2,marginEnd:2,flex:"none",children:A?(0,d.jsx)(r.Ee,{src:A,alt:w,fit:"cover",naturalWidth:1,naturalHeight:1}):(0,d.jsx)("span",{})}),S&&!(null===(t=S.preview_pins)||void 0===t||!t.length)&&(0,d.jsx)(l.Z,{image_url:null!==(i=S.preview_pins[0].image_square_url)&&void 0!==i?i:"",naturalHeight:null!==(h=null===(u=S.preview_pins[0].image_square_size_pixels)||void 0===u?void 0:u.height)&&void 0!==h?h:1,naturalWidth:null!==(p=null===(_=S.preview_pins[0].image_square_size_pixels)||void 0===_?void 0:_.width)&&void 0!==p?p:1}),(0,d.jsxs)(r.kC,{alignItems:"center",flex:"grow",justifyContent:"between",children:[(0,d.jsx)(r.xv,{color:x?"subtle":"default",size:"300",lineClamp:1,weight:"bold",children:D}),(M||!T)&&(0,d.jsxs)(r.kC,{alignItems:"center",justifyContent:"start",children:[k&&(0,d.jsx)(s.Z,{type:"secret"}),z&&(0,d.jsx)(n.Z,{board:j,showCollaborativeIcon:z,useLegoLayout:!0}),M&&(0,d.jsx)(s.Z,{type:"sections"})]}),!M&&T&&!C&&(0,d.jsx)(r.xu,{alignItems:"center",color:"primary","data-test-id":"BoardPickerSaveButton",display:"flex",flex:"none",paddingX:3,paddingY:2,rounding:4,children:(0,d.jsx)(r.xv,{color:"inverse",overflow:"normal",size:"300",weight:"bold",children:B})}),!M&&T&&"loading"===C&&(0,d.jsx)(r.xu,{dangerouslySetInlineStyle:{__style:{transform:"scale(0.7)"}},maxHeight:35,children:(0,d.jsx)(r.$j,{accessibilityLabel:g.bt("Saving", "Saving", "Accessibility label for saving a pin to a board", undefined, true),show:!0})})]})]})}}}]);
//# sourceMappingURL=https://sm.pinimg.com/webapp/78120.en_AU-2b5a7e414ff5b5c9.mjs.map